Skip to content

Commit

Permalink
update dot tip (#136)
Browse files Browse the repository at this point in the history
* update dot tip

* update version

Co-authored-by: Li Tian <tli2@cobo.com>
  • Loading branch information
soralit and Li Tian authored Sep 15, 2020
1 parent 57b157c commit a68c4fa
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "crypto-coin-kit",
"version": "0.2.31",
"version": "0.2.32",
"description": "crypto coin kit for common coins",
"main": "./dist/index.js",
"scripts": {
Expand Down
1 change: 1 addition & 0 deletions src/DOT/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ export class DOT implements Coin {
specVersion: new BN(data.specVersion),
transactionVersion: new BN(data.transactionVersion),
},
tip: data.tip || 0,
},
);
const signedTx = signed.toHex();
Expand Down
23 changes: 23 additions & 0 deletions src/__tests__/coins/DOT.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,29 @@ describe('coins.DOT', () => {
expect(reg.test(result.txHex)).toBe(true);
});

it('should generate transaction with tip', () => {
const keyProviderSync = sr25519KeyProviderSync(privateKey, publicKey);
const txData = {
value: 100000000000,
dest: '5DUmuykcaNu6bVE9R7Ya25oPMw3GkYjYLM2P9b5L1FdoB7kf',
blockHash:
'0xe143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e',
tip: 9000000000,
nonce: 3,
implVersion: 0,
authoringVersion: 2,
specVersion: 41,
transactionVersion: 2,
metaData: westend,
blockNumber: 0,
};
const result = wnd.generateTransactionSync(txData, keyProviderSync);
const reg = new RegExp(
'0x4902848cba3d59242abc565c99a47c3afaf23668f2e1b1a76a38ab71868ae2dafca96301([a-f0-9]+)000c07001a71180204003e97c7cee955a5f2ab3f9346ed85bf2c1b16fcc1afae3e40942bbab648a036040700e8764817',
);
expect(reg.test(result.txHex)).toBe(true);
});

it('should generate dot transaction', () => {
//https://polkascan.io/polkadot/event/1515777-2
const keyProviderSync = sr25519KeyProviderSync(privateKey, publicKey);
Expand Down

0 comments on commit a68c4fa

Please sign in to comment.