@gamedust-ph/presendsnap
TypeScript icon, indicating that this package has built-in type declarations

0.4.4 • Public • Published

btcsnap

0.3.1

btcsnap help you manage your bitcoin on Metamask Flask

Snap Introducion

For more about snap, please fellow metamask snap guide here

Usage

  1. Enable this snap on your dapp
const result: boolean = await ethereum.request({
    method: 'wallet_enable',
    params: [
      {
        wallet_snap: { "npm:btcsnap": {} },
      },
    ],
  });
  1. get extended your extended public keys
const result: string = await ethereum.request({
    method: 'wallet_invokeSnap',
    params: [
      "npm:btcsnap",
      {
        method: 'btc_getPublicExtendedKey',
        params: {
          network: "Main" // for testnet use "Test" ,
        },
      },
    ],
  });
  1. sign Psbt
const result: { txId:string, txHex:string } = await ethereum.request({
      method: 'wallet_invokeSnap',
      params: [
        snapId,
        {
          method: 'btc_signPsbt',
          params: {
            psbt: base64Psbt // base64 string for the pbst,
            network: "Main" // for testnet use "Test",
          },
        },
      ],
    })

Build

For Build the snap and test your snap locally please run

yarn rebuild

Test

For run all tests run the following command:

yarn test

Live Example

If you would like to use this snap on your dapp, you can follow the code on here

Dependencies (3)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i @gamedust-ph/presendsnap

    Weekly Downloads

    1

    Version

    0.4.4

    License

    ISC

    Unpacked Size

    689 kB

    Total Files

    5

    Last publish

    Collaborators

    • gamedust-ph