Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions src/types/scopes/bip122.types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import type { RpcMethod } from '.';

type Utxo = {
// Outpoint of the utxo in the format <txid>:<vout>
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>;
};
};
2 changes: 2 additions & 0 deletions src/types/scopes/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { Bip122Rpc } from './bip122.types';
import type { Eip155Rpc } from './eip155.types';
import type { SolanaRpc } from './solana.types';

Expand Down Expand Up @@ -32,4 +33,5 @@ export type MethodReturn<T extends RpcApi, S extends Scope<T>, M extends MethodN
export type DefaultRpcApi = {
eip155: Eip155Rpc;
solana: SolanaRpc;
bip122: Bip122Rpc;
};
Loading