# @portkey-v1/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 **1.5.4-alpha.22** (published 2024-02-07) · ISC license · 0 weekly downloads

## Install

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

## Health

**Score 35/100 (D)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.5.4-alpha.22 |
| Published | 2024-02-07 |
| First published | 2023-12-26 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 74.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9 |
| Maintainers | potterp, yellow.m |

## Links

- npm: https://www.npmjs.com/package/@portkey-v1/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-v1/contracts

## Recent versions

- 1.5.4-alpha.22 (latest) — 2024-02-07
- 1.5.4-alpha.21 — 2024-02-05
- 1.5.4-alpha.20 — 2024-02-04
- 1.5.4-alpha.19 — 2024-02-02
- 1.5.4-alpha.18 — 2024-01-30
- 1.5.4-alpha.17 — 2024-01-26
- 1.5.4-alpha.16 — 2024-01-25
- 1.5.4-alpha.15 — 2024-01-23
- 1.5.4-alpha.14 — 2024-01-23
- 1.5.4-alpha.13 — 2024-01-22
- 1.5.4-alpha.12 — 2024-01-22
- 1.5.4-alpha.11 — 2024-01-22
- 1.5.4-alpha.10 — 2024-01-19
- 1.5.4-alpha.9 — 2024-01-19
- 1.5.4-alpha.8 — 2024-01-18
- … 5 more at https://npm.io/package/@portkey-v1/contracts/versions

## README

# `@portkey-v1/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-v1/contracts
```

### Using Yarn

```bash
yarn add @portkey-v1/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-v1/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-v1/contracts
[npm-url]: https://npmjs.org/package/@portkey-v1/contracts

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