Bitcoin Wallet Snap
Configuration
Rename .env.example
to .env
Configurations are setup though .env
,
LOG_LEVEL=6
QUICKNODE_TESTNET_ENDPOINT=
QUICKNODE_MAINNET_ENDPOINT=
SIMPLEHASH_API_KEY=
Rpcs:
API keyring_createAccount
example:
provider.request({
method: 'wallet_invokeKeyring',
params: {
snapId,
request: {
method: 'keyring_createAccount',
params: {
scope: 'bip122:000000000933ea01ad0ee984209779ba',
},
},
},
});
API keyring_getAccountBalances
example:
provider.request({
method: 'wallet_invokeKeyring',
params: {
snapId,
request: {
method: 'keyring_getAccountBalances',
params: {
account: 'dc06350a-82db-434b-b113-066135804f63',
id: 'da40b782-e054-4260-9a6a-c8717a022f92',
assets: ['bip122:000000000019d6689c085ae165831e93/slip44:0'],
},
},
},
});
API chain_getTransactionStatus
example:
provider.request({
method: 'wallet_invokeSnap',
params: {
snapId,
request: {
method: 'chain_getTransactionStatus',
params: {
scope: 'bip122:000000000933ea01ad0ee984209779ba',
transactionId: '5639078d-742e-4901-8993-bc25a5ef6161',
},
},
},
});
API sendBitcoin
example:
provider.request({
method: 'wallet_invokeKeyring',
params: {
snapId,
request: {
method: 'keyring_submitRequest',
params: {
account: 'dc06350a-82db-434b-b113-066135804f63',
id: 'da40b782-e054-4260-9a6a-c8717a022f92',
scope: 'bip122:000000000933ea01ad0ee984209779ba',
request: {
method: 'sendBitcoin',
params: {
recipients: {
['tb1qlhkuysju47s642834n7f3tyk67mvnt2cfd9r7y']: '0.00000500',
},
replaceable: true,
dryrun: true,
},
},
},
},
},
});
API estimateFee
example:
provider.request({
method: 'wallet_invokeSnap',
params: {
snapId,
request: {
method: 'estimateFee',
params: {
account: '9506e13e-d343-406f-8408-fad033ab7c0d',
amount: '0.00001',
},
},
},
});
API getMaxSpendableBalance
example:
provider.request({
method: 'wallet_invokeSnap',
params: {
snapId,
request: {
method: 'getMaxSpendableBalance',
params: {
account: "9506e13e-d343-406f-8408-fad033ab7c0d",
},
},
});