Created
January 13, 2020 06:01
-
-
Save laalaguer/4aa1787887cc7d5aa23c85dd2a59d1d9 to your computer and use it in GitHub Desktop.
The snippet for building a tx body
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Using thor-devkit.js | |
const Transaction = require('thor-devkit/dist/transaction').Transaction | |
// Construct transaction body. | |
const txBody = { | |
// Test-net: 0x27, Main-net: 0x4a. | |
chainTag: 0x27, | |
// After which block this tx should happen? | |
// 16 characters of block ID. | |
blockRef: '0x004984e1064ed410', | |
// Expires after 30 days. | |
expiration: 30 * 8640, | |
// Call the contract method "increaseAmount" | |
clauses: [{ | |
to: '0x6d48628bb5bf20e5b4e591c948e0394e0d5bb078', | |
value: 0, | |
data: '0x74f667c4' | |
}], | |
gasPriceCoef: 0, | |
gas: 50000, | |
dependsOn: null, | |
nonce: '0xa3b6232f', // Random number | |
// Must include this field to activate VIP-191. | |
reserved: { | |
features: 1 | |
} | |
} | |
// Construct a transaction. | |
const tx = new Transaction(txBody) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment