mirror of
https://github.com/zhigang1992/wallet.git
synced 2026-04-28 20:55:30 +08:00
feat: btc send transfer
This commit is contained in:
@@ -24,10 +24,11 @@ const bitcoinTestnet: BitcoinNetwork = {
|
||||
};
|
||||
|
||||
const ecdsaPublicKeyLength = 33;
|
||||
export const TEST_TESTNET_ACCOUNT_1_PUBKEY_P2WPKH =
|
||||
const TEST_TESTNET_ACCOUNT_1_PUBKEY_P2WPKH =
|
||||
'02b6b0afe5f620bc8e532b640b148dd9dea0ed19d11f8ab420fcce488fe3974893';
|
||||
export const TEST_TESTNET_ACCOUNT_1_PUBKEY_TR =
|
||||
const TEST_TESTNET_ACCOUNT_1_PUBKEY_TR =
|
||||
'03cf7525b9d94fd35eaf6b4ac4c570f718d1df142606ba3a64e2407ea01a37778f';
|
||||
const TEST_TESTNET_ACCOUNT_2_BTC_ADDRESS = 'tb1qkzvk9hr7uvas23hspvsgqfvyc8h4nngeqjqtnj';
|
||||
|
||||
function ecdsaPublicKeyToSchnorr(pubKey: Uint8Array) {
|
||||
if (pubKey.byteLength !== ecdsaPublicKeyLength) throw new Error('Invalid public key length');
|
||||
@@ -172,7 +173,7 @@ export const Bitcoin = () => {
|
||||
return (
|
||||
<Box py={6}>
|
||||
<Text as="h2" textStyle="display.small">
|
||||
Bitcoin
|
||||
Bitcoin Testnet
|
||||
</Text>
|
||||
<Text textStyle="body.large" display="block" my={'loose'}>
|
||||
Try testing Partially Signed Bitcoin Transactions.
|
||||
@@ -208,6 +209,25 @@ export const Bitcoin = () => {
|
||||
>
|
||||
Sign PSBT at index (Taproot)
|
||||
</Button>
|
||||
<Button
|
||||
mt={3}
|
||||
onClick={() => {
|
||||
console.log('requesting');
|
||||
window.btc
|
||||
?.request('sendTransfer', {
|
||||
address: TEST_TESTNET_ACCOUNT_2_BTC_ADDRESS,
|
||||
amount: '10000',
|
||||
})
|
||||
.then(resp => {
|
||||
console.log({ sucesss: resp });
|
||||
})
|
||||
.catch(error => {
|
||||
console.log({ error });
|
||||
});
|
||||
}}
|
||||
>
|
||||
Send transfer
|
||||
</Button>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user