Skip to content

Commit 0e9cf75

Browse files
committed
create a integration test
1 parent f4428bd commit 0e9cf75

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

tests_integration/index.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,16 @@ async function main() {
3636
console.log("nonce " + nonce)
3737

3838
// 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);
4041

4142
const resp = await axios.post("https://api.zondax.ch/polkadot/node/metadata/hash", {id: 'roc'})
4243

4344
console.log("metadata hash " + resp.data.metadataHash)
4445

4546
// Create the payload for signing
4647
const payload = api.createType('ExtrinsicPayload', {
47-
method: transfer.method.toHex(),
48+
method: remark.method.toHex(),
4849
nonce: nonce as unknown as number,
4950
genesisHash: api.genesisHash,
5051
blockHash: api.genesisHash,
@@ -69,7 +70,7 @@ async function main() {
6970
era: payload.era,
7071
genesisHash: api.genesisHash,
7172
blockHash: api.genesisHash,
72-
method: transfer.method.toHex(),
73+
method: remark.method.toHex(),
7374
nonce: nonce as unknown as number,
7475
specVersion: api.runtimeVersion.specVersion,
7576
tip: 0,
@@ -79,13 +80,13 @@ async function main() {
7980
}
8081

8182
// 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 );
8384

8485
console.log("signedTx to broadcast[hex] " + Buffer.from(signedExtrinsic.toU8a()).toString("hex"))
8586
console.log("signedTx to broadcast[human] " + JSON.stringify(signedExtrinsic.toHuman(true)))
8687

8788
// Submit the signed transaction
88-
await transfer.send((status)=>{
89+
await remark.send((status)=>{
8990
console.log(`Tx status: ${JSON.stringify(status)}`);
9091
});
9192

0 commit comments

Comments
 (0)