Skip to content

Commit 80dcaf6

Browse files
committed
Add calling param to payload.
1 parent 97765b0 commit 80dcaf6

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

tests/vrf/pre/deposit.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const rpcBaseUrl = 'http://localhost:8080';
22
const contractAddr = '0000000000000000000000000000000000000001';
33
const fromPubKey = '03db73ea4b9eb3f0f9d46034f194ba098229841133467a209070207b75a202db8b';
4-
const amount = 1000;
4+
const depositAmount = 1000;
55

66
const axios = require('axios');
77

@@ -13,14 +13,15 @@ const transaction = {
1313
createdAt: Math.floor(Date.now() / 1000),
1414
nonce: 0,
1515
gasPrice: 1,
16-
amount: amount,
16+
amount: 0,
1717
to: contractAddr
1818
};
1919

2020
transaction.payload = Buffer.concat(
2121
[
2222
Buffer.from(['deposit'.length]),
23-
Buffer.from('deposit', 'ascii')
23+
Buffer.from('deposit', 'ascii'),
24+
Buffer.from(`{"depositAmount": ${depositAmount}}`, 'ascii')
2425
]
2526
);
2627

tests/vrf/pre/withdraw.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const rpcBaseUrl = 'http://localhost:8080';
22
const contractAddr = '0000000000000000000000000000000000000001';
33
const fromPubKey = '03db73ea4b9eb3f0f9d46034f194ba098229841133467a209070207b75a202db8b';
4-
const amount = 987;
4+
const withdrawAmount = 987;
55

66
const axios = require('axios');
77

@@ -13,14 +13,15 @@ const transaction = {
1313
createdAt: Math.floor(Date.now() / 1000),
1414
nonce: 0,
1515
gasPrice: 1,
16-
amount: amount,
16+
amount: 0,
1717
to: contractAddr
1818
};
1919

2020
transaction.payload = Buffer.concat(
2121
[
2222
Buffer.from(['withdraw'.length]),
23-
Buffer.from('withdraw', 'ascii')
23+
Buffer.from('withdraw', 'ascii'),
24+
Buffer.from(`{"withdrawAmount": ${withdrawAmount}}`, 'ascii')
2425
]
2526
);
2627

0 commit comments

Comments
 (0)