-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add and use TransactionOptionsDto (#1715)
* Add and use TransactionOptionsDto * Use .transpose() * Add tagged data payload example * Add change file
- Loading branch information
Showing
7 changed files
with
164 additions
and
43 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"nodejs-binding": patch | ||
--- | ||
|
||
Fix tagged data payload type. |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/** | ||
* This example will send a transaction with a tagged data payload | ||
*/ | ||
const getUnlockedManager = require('./account-manager'); | ||
|
||
async function run() { | ||
try { | ||
const manager = await getUnlockedManager(); | ||
const account = await manager.getAccount('Alice'); | ||
|
||
await account.sync(); | ||
|
||
//TODO: Replace with the address of your choice! | ||
const address = | ||
'rms1qrrv7flg6lz5cssvzv2lsdt8c673khad060l4quev6q09tkm9mgtupgf0h0'; | ||
const amount = '1000000'; | ||
|
||
const response = await account.sendAmount([ | ||
{ | ||
address, | ||
amount, | ||
}, | ||
], | ||
{ | ||
taggedDataPayload: { | ||
type: 5, | ||
// 'Stardust' hex encoded | ||
tag: "0x5374617264757374", data: "0x5374617264757374" | ||
} | ||
}); | ||
|
||
console.log(response); | ||
|
||
console.log( | ||
`Check your block on http://localhost:14265/api/core/v2/blocks/${response.blockId}`, | ||
); | ||
} catch (error) { | ||
console.log('Error: ', error); | ||
} | ||
process.exit(0); | ||
} | ||
|
||
|
||
run(); |
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
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
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
Oops, something went wrong.