Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
parity
txwrapper
Commits
a86cc328
Commit
a86cc328
authored
Dec 03, 2019
by
Amaury Martiny
Browse files
fix: Fix keepAlive
parent
8795ba12
Changes
7
Show whitespace changes
Inline
Side-by-side
src/balanceTransfer.spec.ts
View file @
a86cc328
...
@@ -11,7 +11,7 @@ describe('balanceTransfer', () => {
...
@@ -11,7 +11,7 @@ describe('balanceTransfer', () => {
expect
(
unsigned
.
blockNumber
).
toBe
(
'
0x0041a58e
'
);
expect
(
unsigned
.
blockNumber
).
toBe
(
'
0x0041a58e
'
);
expect
(
unsigned
.
era
).
toBe
(
'
0xeb58
'
);
expect
(
unsigned
.
era
).
toBe
(
'
0xeb58
'
);
expect
(
unsigned
.
method
).
toBe
(
expect
(
unsigned
.
method
).
toBe
(
'
0x060
0
ff96074594cccf1cd185fa8a72ceaeefd86648f8d45514f3ce33c31bdd07e4655d30
'
'
0x060
3
ff96074594cccf1cd185fa8a72ceaeefd86648f8d45514f3ce33c31bdd07e4655d30
'
);
);
expect
(
unsigned
.
nonce
).
toBe
(
'
0x00000002
'
);
expect
(
unsigned
.
nonce
).
toBe
(
'
0x00000002
'
);
expect
(
unsigned
.
specVersion
).
toBe
(
'
0x000003fb
'
);
expect
(
unsigned
.
specVersion
).
toBe
(
'
0x000003fb
'
);
...
...
src/balanceTransfer.ts
View file @
a86cc328
...
@@ -84,7 +84,7 @@ export function balanceTransfer(info: TxInfo): UnsignedTransaction {
...
@@ -84,7 +84,7 @@ export function balanceTransfer(info: TxInfo): UnsignedTransaction {
const
metadata
=
new
Metadata
(
registry
,
info
.
metadataRpc
);
const
metadata
=
new
Metadata
(
registry
,
info
.
metadataRpc
);
const
transfer
=
info
.
keepAlive
const
transfer
=
info
.
keepAlive
?
metadata
.
tx
.
balances
.
transferKeepAlive
transfer
?
metadata
.
tx
.
balances
.
transferKeepAlive
:
metadata
.
tx
.
balances
.
transfer
;
:
metadata
.
tx
.
balances
.
transfer
;
const
method
=
transfer
(
info
.
to
,
info
.
amount
).
toHex
();
const
method
=
transfer
(
info
.
to
,
info
.
amount
).
toHex
();
...
...
src/createSignedTx.spec.ts
View file @
a86cc328
...
@@ -11,7 +11,7 @@ describe('createSignedTx', () => {
...
@@ -11,7 +11,7 @@ describe('createSignedTx', () => {
const
tx
=
createSignedTx
(
unsigned
,
signature
);
const
tx
=
createSignedTx
(
unsigned
,
signature
);
expect
(
tx
).
toBe
(
expect
(
tx
).
toBe
(
'
0x2d0284ffd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d00
3d0fdf8b55e6712b2766d80e9a4f527c3deb3d728a815db77df52d766643cdab3170e25ccd867a4d16c0a8f648b753cd95fed0b46ace6cc4e6e5942712409908
eb580800060
0
ff96074594cccf1cd185fa8a72ceaeefd86648f8d45514f3ce33c31bdd07e4655d30
'
'
0x2d0284ffd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d00
737ecfa4c54aae9e7d00a07e6e412f149e87a7543ed9afea48e469af4cb18a9aad0819710a34eb051970d992faf8fc50884139d9b4cdc43655481c7a3aaa4700
eb580800060
3
ff96074594cccf1cd185fa8a72ceaeefd86648f8d45514f3ce33c31bdd07e4655d30
'
);
);
done
();
done
();
...
...
src/createSigningPayload.spec.ts
View file @
a86cc328
...
@@ -7,7 +7,7 @@ describe('createSigningPayload', () => {
...
@@ -7,7 +7,7 @@ describe('createSigningPayload', () => {
const
signingPayload
=
createSigningPayload
(
balanceTransfer
(
TEST_TX_INFO
));
const
signingPayload
=
createSigningPayload
(
balanceTransfer
(
TEST_TX_INFO
));
expect
(
signingPayload
).
toEqual
(
expect
(
signingPayload
).
toEqual
(
'
0x90060
0
ff96074594cccf1cd185fa8a72ceaeefd86648f8d45514f3ce33c31bdd07e4655d30eb580800fb030000e3777fa922cafbff200cadeaea1a76bd7898ad5b89f7848999058b50e715f6361fc7493f3c1e9ac758a183839906475f8363aafb1b1d3e910fe16fab4ae1b582
'
'
0x90060
3
ff96074594cccf1cd185fa8a72ceaeefd86648f8d45514f3ce33c31bdd07e4655d30eb580800fb030000e3777fa922cafbff200cadeaea1a76bd7898ad5b89f7848999058b50e715f6361fc7493f3c1e9ac758a183839906475f8363aafb1b1d3e910fe16fab4ae1b582
'
);
);
});
});
});
});
src/decodeTx.spec.ts
View file @
a86cc328
...
@@ -14,9 +14,14 @@ describe('decodeTx', () => {
...
@@ -14,9 +14,14 @@ describe('decodeTx', () => {
const
txInfo
=
decodeTx
(
tx
,
metadataRpc
);
const
txInfo
=
decodeTx
(
tx
,
metadataRpc
);
([
'
address
'
,
'
amount
'
,
'
nonce
'
,
'
tip
'
,
'
to
'
]
as
const
).
forEach
(
key
=>
([
expect
(
txInfo
[
key
]).
toBe
(
TEST_TX_INFO
[
key
])
'
address
'
,
);
'
amount
'
,
'
keepAlive
'
,
'
nonce
'
,
'
tip
'
,
'
to
'
]
as
const
).
forEach
(
key
=>
expect
(
txInfo
[
key
]).
toBe
(
TEST_TX_INFO
[
key
]));
done
();
done
();
});
});
...
...
src/decodeTx.ts
View file @
a86cc328
...
@@ -30,6 +30,7 @@ export function decodeTx(
...
@@ -30,6 +30,7 @@ export function decodeTx(
return
{
return
{
address
:
tx
.
signer
.
toString
(),
address
:
tx
.
signer
.
toString
(),
amount
:
(
tx
.
method
.
args
[
1
]
as
Compact
<
Balance
>
).
toNumber
(),
amount
:
(
tx
.
method
.
args
[
1
]
as
Compact
<
Balance
>
).
toNumber
(),
keepAlive
:
tx
.
method
.
methodName
===
'
transferKeepAlive
'
,
metadataRpc
,
metadataRpc
,
nonce
:
tx
.
nonce
.
toNumber
(),
nonce
:
tx
.
nonce
.
toNumber
(),
tip
:
tx
.
tip
.
toNumber
(),
tip
:
tx
.
tip
.
toNumber
(),
...
...
src/util/testUtil.ts
View file @
a86cc328
...
@@ -20,6 +20,7 @@ export const TEST_TX_INFO: TxInfo = {
...
@@ -20,6 +20,7 @@ export const TEST_TX_INFO: TxInfo = {
genesisHash
:
genesisHash
:
'
0xe3777fa922cafbff200cadeaea1a76bd7898ad5b89f7848999058b50e715f636
'
,
'
0xe3777fa922cafbff200cadeaea1a76bd7898ad5b89f7848999058b50e715f636
'
,
metadataRpc
,
metadataRpc
,
keepAlive
:
true
,
nonce
:
2
,
nonce
:
2
,
specVersion
:
1019
,
specVersion
:
1019
,
tip
:
0
,
tip
:
0
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment