diff --git a/src/types/scopes/bip122.types.ts b/src/types/scopes/bip122.types.ts new file mode 100644 index 0000000..1809c85 --- /dev/null +++ b/src/types/scopes/bip122.types.ts @@ -0,0 +1,50 @@ +import type { RpcMethod } from '.'; + +type Utxo = { + // Outpoint of the utxo in the format : + outpoint: string; + // Value of output in satoshis + value: string; + derivationIndex: number; + // scriptPubley in ASM format + scriptPubkey: string; + scriptPubkeyHex: string; + // If the script can be represented as an address, omitted otherwise + address?: string; +}; + +export type Bip122Rpc = { + methods: { + signMessage: RpcMethod< + { + account: { address: string }; + message: string; + }, + { signature: string } + >; + sendTransfer: RpcMethod< + { + account: { address: string }; + recipients: { address: string; amount: string }[]; + feeRate?: number; + }, + { txid: string } + >; + signPsbt: RpcMethod< + { + account: { address: string }; + options: { + fill: boolean; + broadcast: boolean; + }; + psbt: string; + feeRate?: number | undefined; + }, + { psbt: string; txid: string | null } + >; + fillPsbt: RpcMethod<{ account: { address: string }; psbt: string }, { psbt: string }>; + broadcastPsbt: RpcMethod<{ account: { address: string }; psbt: string }, { txid: string }>; + computeFee: RpcMethod<{ account: { address: string }; psbt: string }, { fee: string }>; + getUtxo: RpcMethod<{ account: { address: string }; outpoint: string }, Utxo>; + }; +}; diff --git a/src/types/scopes/index.ts b/src/types/scopes/index.ts index c9dba34..c2b7932 100644 --- a/src/types/scopes/index.ts +++ b/src/types/scopes/index.ts @@ -1,3 +1,4 @@ +import type { Bip122Rpc } from './bip122.types'; import type { Eip155Rpc } from './eip155.types'; import type { SolanaRpc } from './solana.types'; @@ -32,4 +33,5 @@ export type MethodReturn, M extends MethodN export type DefaultRpcApi = { eip155: Eip155Rpc; solana: SolanaRpc; + bip122: Bip122Rpc; };