# @portkey/contracts

> ![ES Version](https://img.shields.io/badge/ES-2020-yellow) ![Node Version](https://img.shields.io/badge/node-14.x-green) [![NPM Package Version][npm-image-version]][npm-url]

Latest version **2.23.0-alpha.15** (published 2026-01-06) · ISC license · 0 weekly downloads

## Install

```sh
npm install @portkey/contracts
pnpm add @portkey/contracts
yarn add @portkey/contracts
bun add @portkey/contracts
```

## Health

**Score 55/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.23.0-alpha.15 |
| Published | 2026-01-06 |
| First published | 2023-02-23 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 88.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9 |
| Maintainers | potterp, yellow.m, frankportkey, codingwizard-portkey, aurora_v5_ptk, carbon-lv, sarah999, portkey-zz |

## Links

- npm: https://www.npmjs.com/package/@portkey/contracts
- Repository: https://github.com/Portkey-Wallet/portkey-web
- Homepage: https://portkey.finance/
- Issues: https://github.com/Portkey-Wallet/portkey-web/issues
- npm.io page: https://npm.io/package/@portkey/contracts

## Dependencies (3)

- [@portkey/types](https://npm.io/package/@portkey/types.md) ^2.23.0-alpha.15
- [@portkey/utils](https://npm.io/package/@portkey/utils.md) ^2.23.0-alpha.15
- [@portkey/provider-types](https://npm.io/package/@portkey/provider-types.md) ^2.5.0-alpha.4

## Recent versions

- 2.23.0-alpha.15 (latest) — 2026-01-06
- 2.23.0-alpha.13 — 2025-11-19
- 2.22.0-alpha.11 — 2025-11-19
- 2.24.0-alpha.1 — 2025-11-11
- 2.23.0-alpha.12 — 2025-10-22
- 2.22.0-alpha.10 — 2025-10-22
- 2.23.0-alpha.11 — 2025-10-16
- 2.22.0-alpha.9 — 2025-10-16
- 2.23.0-alpha.10 — 2025-10-15
- 2.23.0-alpha.9 — 2025-09-30
- 2.23.0-alpha.8 — 2025-09-29
- 2.23.0-alpha.7 — 2025-09-29
- 2.23.0-alpha.6 — 2025-09-29
- 2.23.0-alpha.5 — 2025-09-25
- 2.23.0-alpha.4 — 2025-09-25
- … 391 more at https://npm.io/package/@portkey/contracts/versions

## README

# `@portkey/contracts`

![ES Version](https://img.shields.io/badge/ES-2020-yellow)
![Node Version](https://img.shields.io/badge/node-14.x-green)
[![NPM Package Version][npm-image-version]][npm-url]

## Installation

### Using NPM

```bash
npm install @portkey/contracts
```

### Using Yarn

```bash
yarn add @portkey/contracts
```

## Prerequisites

- :gear: [NodeJS](https://nodejs.org/) (LTS/Fermium)
- :toolbox: [Yarn](https://yarnpkg.com/)/[Lerna](https://lerna.js.org/)

## Package.json Scripts

| Script   | Description                                        |
| -------- | -------------------------------------------------- |
| clean    | Uses `rm` to remove `dist/`                        |
| build    | Uses `tsc` to build package and dependent packages |
| lint     | Uses `eslint` to lint package                      |
| lint:fix | Uses `eslint` to check and fix any warnings        |
| format   | Uses `prettier` to format the code                 |

# Basic Usage

```typescript
import { getContractBasic } from '@portkey/contracts'

// use ca contract 
const contract = await getContractBasic({
  chainType: 'aelf',
  account: 'your account',
  contractAddress: 'contractAddress',
  caContractAddress: 'caContractAddress',
  callType: 'ca',
  caHash: 'caHash',
  rpcUrl: 'rpcUrl',
});

// use base contract 
const contract = await getContractBasic({
  account: 'your account',
  contractAddress: 'contractAddress',
  chainType: 'aelf',
  rpcUrl: 'rpcUrl',
})

// use portkey provider
import detectProvider from '@portkey/detect-provider';
// detect provider
const provider = await detectProvider();
// get chain provider
const chainProvider = await provider.getChain('AELF');

const contract = await getContractBasic({
  chainProvider,
  contractAddress: 'contractAddress',
});

// call view
contract.callViewMethod('your method', paramsOption);
// call send
contract.callSendMethod('your method', 'your address', paramsOption);
```

### standard types

[contract types](../types/src/contract.ts)

[npm-image-version]: https://img.shields.io/npm/v/@portkey/contracts
[npm-url]: https://npmjs.org/package/@portkey/contracts

---
_Source: https://npm.io/package/@portkey/contracts · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
