@okcontract/sdk
Version:
One-stop-shop permissionless SDK for building any blockchain frontend
41 lines (40 loc) • 1.31 kB
TypeScript
import type { Abi, AbiFunction } from "abitype";
import { type ABIExtra, type ABIMethod } from "@okcontract/coredata";
import type { ValueDefinition } from "@okcontract/lambdascript";
import { type Role } from "@scv/auth";
/**
* @todo wrong type on purpose to enforce abstract datatypes...
*/
export type UniqueMethodName = string;
/**
* extractFunctionName shortens the method name when unambiguous.
* @param name
* @returns
*/
export declare const extractFunctionName: (name: string) => UniqueMethodName;
export type ContractFunctionValues = [
AbiFunction[],
AbiFunction[],
AbiFunction[]
];
/**
* isAdminReserved check if an ABIMethod function is admin reserved
* @param v
* @returns
*/
export declare const isAdminReserved: (m: ABIMethod) => boolean;
/**
* isWhitelisted return whether a method is whitelisted
* for a given ABIExtra ref
*/
export declare const isWhitelisted: (abix: ABIExtra, m: string) => boolean;
export declare const filterABIMethods: (role: Role, VRW: ContractFunctionValues, pivotEnv: ValueDefinition[], abix: ABIExtra) => [string, AbiFunction][];
/**
* splitABI splits the ABI between:
* - values that are constant and no input (V)
* - read (R)
* - write (W)
* @param abi
* @returns
*/
export declare const splitABI: (abi: Abi) => ContractFunctionValues;