@dioxide-js/silas
Version:
RPC utility for Silas
71 lines (70 loc) • 2.14 kB
TypeScript
import { AlgOption } from '../utils/address/base';
import { Alg } from '../utils';
import { DIOX, OriginalTxn } from '../api/type';
export type SignMethod = (txdata: Uint8Array, privatekey: Uint8Array) => Promise<Uint8Array>;
export interface TransferDIOParams {
to: string;
amount: string;
secretKey: Uint8Array | string;
ttl?: number;
sender: string;
}
export interface TransferFCAParams {
symbol: string;
to: string;
amount: string;
secretKey: Uint8Array | string;
ttl?: number;
}
export interface TxOption {
alg?: Alg;
apiKey: string;
showDuration?: boolean;
n?: number;
customSign?: SignMethod;
showTxFlow?: boolean;
}
declare class Transaction {
private txnServices;
private overViewServices;
customSign?: SignMethod;
alg: Alg;
showTxFlow?: boolean;
n: number;
private duration;
constructor(opts: TxOption);
getTx: (hash: string) => Promise<import("../api/type").TxDetailResponse>;
private compose;
sign(originalTxn: OriginalTxn, secretKey: Uint8Array | string, option?: AlgOption): Promise<{
composedTxDataWithPK: string;
signature: string;
longPK: string;
rawTxData: string;
hash: string;
pk: string;
txFlow: {
compose: number;
sign: number;
verify: number;
computedNonce: number;
all: number;
};
nonceTime: number[];
}>;
send(secretKey: Uint8Array | string, originTxn: OriginalTxn): Promise<string>;
sendRawTx(rawTxData: string): Promise<string>;
getEstimatedFee(originTxn: OriginalTxn): Promise<string | number | bigint>;
calculateGasFee(options: {
average: number;
scale: number;
gasLimit: number;
}): number | string | bigint;
transfer(params: TransferDIOParams): Promise<string>;
sk2base32Address(sk: Uint8Array | string, alg: Alg): Promise<string>;
sureFinalized(hash: string, options?: {
max?: number;
verbose?: boolean;
interval: number;
}): Promise<DIOX.TxDetail | false>;
}
export { Transaction };