Skip to content

Latest commit

 

History

History
68 lines (60 loc) · 2.39 KB

pushTransaction.md

File metadata and controls

68 lines (60 loc) · 2.39 KB

Push transaction

Broadcast the transaction to the selected network.

ES6

const result = await TrezorConnect.pushTransaction(params);

CommonJS

TrezorConnect.pushTransaction(params).then(function(result) {

});

Params

Optional common params

  • tx - obligatory string serialized transaction,
  • coin - obligatory string Determines network definition specified in coins.json file. Coin shortcut, name or label can be used.

Example

TrezorConnect.pushTransaction({
    tx: "010000000182488650ef25a58fef6788bd71b8212038d7f2bbe4750bc7bcb44701e85ef6d5000000006b4830450221009a0b7be0d4ed3146ee262b42202841834698bb3ee39c24e7437df208b8b7077102202b79ab1e7736219387dffe8d615bbdba87e11477104b867ef47afed1a5ede7810121023230848585885f63803a0a8aecdd6538792d5c539215c91698e315bf0253b43dffffffff0160cc0500000000001976a914de9b2a8da088824e8fe51debea566617d851537888ac00000000",
    coin: "btc"
});

Result

{
    success: true,
    payload: {
        txid: string, // transaction id
    }
}

Error

{
    success: false,
    payload: {
        error: string // error message
    }
}

Migration from older version

version 4 and below

var tx = "010000000182488650ef25a58fef6788bd71b8212038d7f2bbe4750bc7bcb44701e85ef6d5000000006b4830450221009a0b7be0d4ed3146ee262b42202841834698bb3ee39c24e7437df208b8b7077102202b79ab1e7736219387dffe8d615bbdba87e11477104b867ef47afed1a5ede7810121023230848585885f63803a0a8aecdd6538792d5c539215c91698e315bf0253b43dffffffff0160cc0500000000001976a914de9b2a8da088824e8fe51debea566617d851537888ac00000000";
TrezorConnect.pushTransaction(tx, function(result) {
    ...
});

version 5

// params are key-value pairs inside Object
TrezorConnect.pushTransaction({ 
    tx: "010000000182488650ef25a58fef6788bd71b8212038d7f2bbe4750bc7bcb44701e85ef6d5000000006b4830450221009a0b7be0d4ed3146ee262b42202841834698bb3ee39c24e7437df208b8b7077102202b79ab1e7736219387dffe8d615bbdba87e11477104b867ef47afed1a5ede7810121023230848585885f63803a0a8aecdd6538792d5c539215c91698e315bf0253b43dffffffff0160cc0500000000001976a914de9b2a8da088824e8fe51debea566617d851537888ac00000000",
    coin: "btc"
}).then(function(result) {
    ...
})