Skip to main content

@portkey/utils

Introduction

Installation

npm install @portkey/utils

encodedTx

Get transaction raw

Usage

import { aelf } from "@portkey/utils";

const raw = await aelf.encodedTx(params as EncodedParams);

Supplemental Code

type EncodedParams = {
instance: any;
functionName: string;
paramsOption: any;
contract: any;
};

getELFContract

Get elf contract

Usage

import { aelf } from "@portkey/utils";
/**
* rpcUrl: string;
* contractAddress: string;
* privateKey: string;
* {refBlockNumberStrategy: number} // When initialising the contract, set the indexing block height strategy by default

*/
const contract = await aelf.getELFContract(rpcUrl, tokenAddress, privateKey, {
refBlockNumberStrategy: -8,
});

handleVerificationDoc

Get guardian detail by verificationDoc

Usage

import { aelf } from "@portkey/utils";

const detail = await aelf.handleVerificationDoc(verificationDoc);

Supplemental Code

detail
{
type, // guardian type
guardianIdentifier,
verificationTime,
verifierAddress,
salt,
}

Example response

{
type: 'Email',
guardianIdentifier: 'fsdf...grger',
verificationTime: 'xxxx',
verifierAddress: 'http://xxx.com',
salt: "1c02...7631",
}