@@ -36,15 +36,16 @@ async function main() {
36
36
console . log ( "nonce " + nonce )
37
37
38
38
// Create the transfer transaction
39
- const transfer = api . tx . balances . transferKeepAlive ( receiverAddress , transferAmount ) ;
39
+ const tx = Buffer . from ( "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" ) ;
40
+ const remark = api . tx . system . remark ( tx ) ;
40
41
41
42
const resp = await axios . post ( "https://api.zondax.ch/polkadot/node/metadata/hash" , { id : 'roc' } )
42
43
43
44
console . log ( "metadata hash " + resp . data . metadataHash )
44
45
45
46
// Create the payload for signing
46
47
const payload = api . createType ( 'ExtrinsicPayload' , {
47
- method : transfer . method . toHex ( ) ,
48
+ method : remark . method . toHex ( ) ,
48
49
nonce : nonce as unknown as number ,
49
50
genesisHash : api . genesisHash ,
50
51
blockHash : api . genesisHash ,
@@ -69,7 +70,7 @@ async function main() {
69
70
era : payload . era ,
70
71
genesisHash : api . genesisHash ,
71
72
blockHash : api . genesisHash ,
72
- method : transfer . method . toHex ( ) ,
73
+ method : remark . method . toHex ( ) ,
73
74
nonce : nonce as unknown as number ,
74
75
specVersion : api . runtimeVersion . specVersion ,
75
76
tip : 0 ,
@@ -79,13 +80,13 @@ async function main() {
79
80
}
80
81
81
82
// Combine the payload and signature to create a signed extrinsic
82
- const signedExtrinsic = transfer . addSignature ( senderAddress . address , signature , payloadValue ) ;
83
+ const signedExtrinsic = remark . addSignature ( senderAddress . address , signature , payloadValue ) ;
83
84
84
85
console . log ( "signedTx to broadcast[hex] " + Buffer . from ( signedExtrinsic . toU8a ( ) ) . toString ( "hex" ) )
85
86
console . log ( "signedTx to broadcast[human] " + JSON . stringify ( signedExtrinsic . toHuman ( true ) ) )
86
87
87
88
// Submit the signed transaction
88
- await transfer . send ( ( status ) => {
89
+ await remark . send ( ( status ) => {
89
90
console . log ( `Tx status: ${ JSON . stringify ( status ) } ` ) ;
90
91
} ) ;
91
92
0 commit comments