@open-social-protocol/osp-plugin-api-types
Version:
API types for Open Social Protocol plugins
88 lines (67 loc) • 1.68 kB
TypeScript
export {OspReceipt} from "@open-social-protocol/osp-client";
export type AccessList = Array<{ address: string, storageKeys: Array<string> }>;
export interface Transaction {
hash?: string;
to?: string;
from?: string;
nonce: number;
gasLimit: bigint;
gasPrice?: bigint;
data: string;
value: bigint;
chainId: number;
r?: string;
s?: string;
v?: number;
// Typed-Transaction features
type?: number | null;
// EIP-2930; Type 1 & EIP-1559; Type 2
accessList?: AccessList;
// EIP-1559; Type 2
maxPriorityFeePerGas?: bigint;
maxFeePerGas?: bigint;
}
export interface Log {
blockNumber: number;
blockHash: string;
transactionIndex: number;
removed: boolean;
address: string;
data: string;
topics: Array<string>;
transactionHash: string;
logIndex: number;
}
export interface TransactionReceipt {
to: string;
from: string;
contractAddress: string,
transactionIndex: number,
root?: string,
gasUsed: bigint,
logsBloom: string,
blockHash: string,
transactionHash: string,
logs: Array<Log>,
blockNumber: number,
confirmations: number,
cumulativeGasUsed: bigint,
effectiveGasPrice: bigint,
byzantium: boolean,
type: number;
status?: number
}
export interface TransactionResponse extends Transaction {
hash: string;
// Only if a transaction has been mined
blockNumber?: number,
blockHash?: string,
timestamp?: number,
confirmations: number,
// Not optional (as it is in Transaction)
from: string;
// The raw transaction
raw?: string,
// This function waits until the transaction has been mined
wait: (confirmations?: number) => Promise<TransactionReceipt>
}