Constructor
new TrezorSignMultisigTransaction(options)
Parameters:
| Name | Type | Description | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object | options argument Properties
|
Example
import {
generateMultisigFromHex, TESTNET, P2SH,
} from "unchained-bitcoin";
import {TrezorSignMultisigTransaction} from "unchained-wallets";
const redeemScript = "5...ae";
const inputs = [
{
txid: "8d276c76b3550b145e44d35c5833bae175e0351b4a5c57dc1740387e78f57b11",
index: 1,
multisig: generateMultisigFromHex(TESTNET, P2SH, redeemScript),
amountSats: '1234000'
},
// other inputs...
];
const outputs = [
{
amountSats: '1299659',
address: "2NGHod7V2TAAXC1iUdNmc6R8UUd4TVTuBmp"
},
// other outputs...
];
const interaction = new TrezorSignMultisigTransaction({
network: TESTNET,
inputs,
outputs,
bip32Paths: ["m/45'/0'/0'/0", // add more, 1 per input],
});
const signature = await interaction.run();
console.log(signatures);
// ["ababab...", // 1 per input]
Extends
Methods
connectParams() → {Array.<function(), Object>}
- Overrides:
- Source:
Returns:
TrezorConnect parameters
- Type
- Array.<function(), Object>
messages() → {Array.<module:interaction.Message>}
Adds messages describing the signing flow.
- Overrides:
- Source:
Returns:
messages for this interaction
- Type
- Array.<module:interaction.Message>
parse() → {void}
Throws an error.
- Overrides:
- Source:
Throws:
An error since this is a direct interaction.
Returns:
- Type
- void
parsePayload(payload) → {Array.<string>|string}
Parses the signature(s) out of the response payload.
Ensures each input's signature hasa a trailing ...01 SIGHASH_ALL byte.
Parameters:
| Name | Type | Description |
|---|---|---|
payload |
Object | the original payload from the device response |
- Overrides:
- Source:
Returns:
array of input signatures, one per input or signed psbt with signatures inserted
- Type
- Array.<string> | string
request() → {void}
Throws an error.
- Overrides:
- Source:
Throws:
An error since this is a direct interaction.
Returns:
- Type
- void
(async) run() → {Promise}
Awaits the call of this.method, passing in the output of
this.params().
If the call returns but is unsuccessful (result.success) is
false, will throw the returned error message. If some other
error is thrown, it will not be caught.
Otherwise it returns the result of passing result.payload to
this.parsePayload.
- Overrides:
- Source:
Returns:
handles the work of calling TrezorConnect
- Type
- Promise