🧡BitCoin

Detecting the Provider

Once ioPay Wallet is installed and running, you should find that ioPay's mobile in-app browser have a window.ioPay object available in the developer console.

Method

requestAccounts(): Connect the current account.

Returns:

  • Promise - string: address of current account

Example:

try {
  let accounts = await window.ioPay.requestAccounts();
  console.log('connect success', accounts);
} catch (e) {
  console.log('connect failed');
}
> connect success ['mfaCeWXkqRTPG85mLXMbBZEJRS8b7bw4Kb']

Method

getPublicKey()

Returns:

  • Promise - string: publicKey

Example:

Method

signMessage

Parameters

  • msg - string: a string to sign

Returns

  • Promise - string: the signature.

Example:

Method

signPsbt

This method will traverse all inputs that match the current address to sign.

Parameters

  • psbtHex - string: the hex string of psbt to sign

  • options

    • autoFinalized - boolean: whether finalize psbt after signing, default is true

    • toSignInputs - array:

      • index - number: which input to sign

      • address - string: (at least specify either an address or a publicKey) Which corresponding private key to use for signing

      • publicKey - string: (at least specify either an address or a publicKey) Which corresponding private key to use for signing

      • sighashTypes - number[]: (optionals) sighashTypes

      • disableTweakSigner - boolean :(optionals) When signing and unlocking Taproot addresses, the tweakSigner is used by default for signature generation. Enabling this allows for signing with the original private key.

Returns:

  • Promise - string: the hex string of signed psbt

Example:

Last updated