@portkey-v1/contracts
TypeScript icon, indicating that this package has built-in type declarations

1.5.4-alpha.22 • Public • Published

@portkey-v1/contracts

ES Version Node Version NPM Package Version

Installation

Using NPM

npm install @portkey-v1/contracts

Using Yarn

yarn add @portkey-v1/contracts

Prerequisites

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

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

Readme

Keywords

none

Package Sidebar

Install

npm i @portkey-v1/contracts

Weekly Downloads

665

Version

1.5.4-alpha.22

License

ISC

Unpacked Size

76.3 kB

Total Files

54

Last publish

Collaborators

  • potterp
  • yellow.m