@ledgerhq/coin-multiversx 0.6.0-nightly.5 → 0.6.0-nightly.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +20 -0
- package/package.json +6 -6
- package/lib/bridge.integration.test.d.ts +0 -4
- package/lib/bridge.integration.test.d.ts.map +0 -1
- package/lib/bridge.integration.test.js +0 -142
- package/lib/bridge.integration.test.js.map +0 -1
- package/lib/buildOptimisticOperation.test.d.ts +0 -2
- package/lib/buildOptimisticOperation.test.d.ts.map +0 -1
- package/lib/buildOptimisticOperation.test.js +0 -78
- package/lib/buildOptimisticOperation.test.js.map +0 -1
- package/lib/buildTransaction.unit.test.d.ts +0 -2
- package/lib/buildTransaction.unit.test.d.ts.map +0 -1
- package/lib/buildTransaction.unit.test.js +0 -47
- package/lib/buildTransaction.unit.test.js.map +0 -1
- package/lib-es/bridge.integration.test.d.ts +0 -4
- package/lib-es/bridge.integration.test.d.ts.map +0 -1
- package/lib-es/bridge.integration.test.js +0 -139
- package/lib-es/bridge.integration.test.js.map +0 -1
- package/lib-es/buildOptimisticOperation.test.d.ts +0 -2
- package/lib-es/buildOptimisticOperation.test.d.ts.map +0 -1
- package/lib-es/buildOptimisticOperation.test.js +0 -73
- package/lib-es/buildOptimisticOperation.test.js.map +0 -1
- package/lib-es/buildTransaction.unit.test.d.ts +0 -2
- package/lib-es/buildTransaction.unit.test.d.ts.map +0 -1
- package/lib-es/buildTransaction.unit.test.js +0 -42
- package/lib-es/buildTransaction.unit.test.js.map +0 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
|
|
2
|
-
> @ledgerhq/coin-multiversx@0.6.0-nightly.
|
|
2
|
+
> @ledgerhq/coin-multiversx@0.6.0-nightly.6 build /home/runner/work/ledger-live/ledger-live/libs/coin-modules/coin-multiversx
|
|
3
3
|
> tsc && tsc -m esnext --moduleResolution bundler --outDir lib-es
|
|
4
4
|
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @ledgerhq/coin-elrond
|
|
2
2
|
|
|
3
|
+
## 0.6.0-nightly.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`b4ceaff`](https://github.com/LedgerHQ/ledger-live/commit/b4ceaff2ecf68d8a14e09801c76ab0b014c45286), [`f392f69`](https://github.com/LedgerHQ/ledger-live/commit/f392f6912f445cc2f7cf4dfcfd030fa3da76f736), [`cbc0648`](https://github.com/LedgerHQ/ledger-live/commit/cbc064885d8e0459e40d327a2e5389204b3ec705)]:
|
|
8
|
+
- @ledgerhq/cryptoassets@13.31.0-nightly.7
|
|
9
|
+
- @ledgerhq/types-live@6.87.0-nightly.5
|
|
10
|
+
- @ledgerhq/live-env@2.19.0-nightly.2
|
|
11
|
+
- @ledgerhq/coin-framework@6.7.0-nightly.7
|
|
12
|
+
- @ledgerhq/live-network@2.0.20-nightly.3
|
|
13
|
+
|
|
14
|
+
## 0.6.0-nightly.6
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [[`51995e9`](https://github.com/LedgerHQ/ledger-live/commit/51995e96a9e1fafe14c7cbe45ce0b1ec8ebd106b)]:
|
|
19
|
+
- @ledgerhq/types-live@6.87.0-nightly.4
|
|
20
|
+
- @ledgerhq/coin-framework@6.7.0-nightly.6
|
|
21
|
+
- @ledgerhq/cryptoassets@13.31.0-nightly.6
|
|
22
|
+
|
|
3
23
|
## 0.6.0-nightly.5
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/coin-multiversx",
|
|
3
|
-
"version": "0.6.0-nightly.
|
|
3
|
+
"version": "0.6.0-nightly.7",
|
|
4
4
|
"description": "Ledger MultiversX Coin integration",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Ledger",
|
|
@@ -52,16 +52,16 @@
|
|
|
52
52
|
"lodash": "^4.17.21",
|
|
53
53
|
"protobufjs": "^7.2.6",
|
|
54
54
|
"rxjs": "^7.8.1",
|
|
55
|
-
"@ledgerhq/coin-framework": "^6.7.0-nightly.
|
|
56
|
-
"@ledgerhq/cryptoassets": "^13.31.0-nightly.
|
|
55
|
+
"@ledgerhq/coin-framework": "^6.7.0-nightly.7",
|
|
56
|
+
"@ledgerhq/cryptoassets": "^13.31.0-nightly.7",
|
|
57
57
|
"@ledgerhq/devices": "8.6.2-nightly.0",
|
|
58
58
|
"@ledgerhq/errors": "^6.27.0-nightly.0",
|
|
59
|
-
"@ledgerhq/live-env": "^2.19.0-nightly.
|
|
60
|
-
"@ledgerhq/live-network": "^2.0.20-nightly.
|
|
59
|
+
"@ledgerhq/live-env": "^2.19.0-nightly.2",
|
|
60
|
+
"@ledgerhq/live-network": "^2.0.20-nightly.3",
|
|
61
61
|
"@ledgerhq/live-promise": "^0.1.1",
|
|
62
62
|
"@ledgerhq/logs": "^6.13.0",
|
|
63
63
|
"@ledgerhq/types-cryptoassets": "^7.29.0-nightly.0",
|
|
64
|
-
"@ledgerhq/types-live": "^6.87.0-nightly.
|
|
64
|
+
"@ledgerhq/types-live": "^6.87.0-nightly.5"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@types/invariant": "^2.2.37",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bridge.integration.test.d.ts","sourceRoot":"","sources":["../src/bridge.integration.test.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAkB,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAIxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAiI3C,eAAO,MAAM,OAAO,EAAE,WAAW,CAAC,WAAW,CAM5C,CAAC"}
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.dataset = void 0;
|
|
4
|
-
const errors_1 = require("@ledgerhq/errors");
|
|
5
|
-
const bignumber_js_1 = require("bignumber.js");
|
|
6
|
-
const transaction_1 = require("./transaction");
|
|
7
|
-
const TEST_ADDRESS = "erd1vgfp3g7azqjx4wsmtt7067m0l62v3psmqzr24j6xvywj2tlz0gesvyzsq2";
|
|
8
|
-
const elrond = {
|
|
9
|
-
FIXME_ignorePreloadFields: [
|
|
10
|
-
"validators", // They are always changing
|
|
11
|
-
],
|
|
12
|
-
scanAccounts: [
|
|
13
|
-
{
|
|
14
|
-
name: "multiversx seed 1",
|
|
15
|
-
apdus: `
|
|
16
|
-
=> ed030000080000000080000000
|
|
17
|
-
<= 3e6572643176676670336737617a716a783477736d7474373036376d306c3632763370736d717a7232346a36787679776a32746c7a3067657376797a7371329000
|
|
18
|
-
=> ed030000080000000080000000
|
|
19
|
-
<= 3e6572643176676670336737617a716a783477736d7474373036376d306c3632763370736d717a7232346a36787679776a32746c7a3067657376797a7371329000
|
|
20
|
-
=> ed030000080000000080000001
|
|
21
|
-
<= 3e65726431706d33676a65326c6d643576796c6463767579366a7078676465347261706a70756a76756a6b65653661376a77327a6d6834747172653739367a9000
|
|
22
|
-
`,
|
|
23
|
-
},
|
|
24
|
-
],
|
|
25
|
-
accounts: [
|
|
26
|
-
{
|
|
27
|
-
raw: {
|
|
28
|
-
id: `js:2:multiversx:${TEST_ADDRESS}:`,
|
|
29
|
-
seedIdentifier: `${TEST_ADDRESS}`,
|
|
30
|
-
name: "MultiversX 1",
|
|
31
|
-
derivationMode: "",
|
|
32
|
-
index: 0,
|
|
33
|
-
freshAddress: `${TEST_ADDRESS}`,
|
|
34
|
-
freshAddressPath: "44'/508'/0'/0'/0'",
|
|
35
|
-
blockHeight: 0,
|
|
36
|
-
operations: [],
|
|
37
|
-
pendingOperations: [],
|
|
38
|
-
currencyId: "elrond",
|
|
39
|
-
lastSyncDate: "",
|
|
40
|
-
balance: "299569965",
|
|
41
|
-
subAccounts: [
|
|
42
|
-
{
|
|
43
|
-
// MEX account
|
|
44
|
-
id: `js:2:multiversx:${TEST_ADDRESS}:+4d45582d343535633537`,
|
|
45
|
-
balance: "100",
|
|
46
|
-
spendableBalance: "100",
|
|
47
|
-
type: "TokenAccountRaw",
|
|
48
|
-
tokenId: "multiversx/esdt/4d45582d343535633537",
|
|
49
|
-
parentId: `js:2:multiversx:${TEST_ADDRESS}:`,
|
|
50
|
-
operations: [],
|
|
51
|
-
pendingOperations: [],
|
|
52
|
-
},
|
|
53
|
-
],
|
|
54
|
-
},
|
|
55
|
-
transactions: [
|
|
56
|
-
{
|
|
57
|
-
name: "recipient and sender must not be the same",
|
|
58
|
-
transaction: (0, transaction_1.fromTransactionRaw)({
|
|
59
|
-
family: "multiversx",
|
|
60
|
-
recipient: `${TEST_ADDRESS}`,
|
|
61
|
-
amount: "100000000",
|
|
62
|
-
mode: "send",
|
|
63
|
-
fees: null,
|
|
64
|
-
gasLimit: 50000000,
|
|
65
|
-
}),
|
|
66
|
-
expectedStatus: {
|
|
67
|
-
amount: new bignumber_js_1.BigNumber("100000000"),
|
|
68
|
-
errors: {
|
|
69
|
-
recipient: new errors_1.InvalidAddressBecauseDestinationIsAlsoSource(),
|
|
70
|
-
},
|
|
71
|
-
warnings: {},
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
name: "Not enough balance",
|
|
76
|
-
transaction: (0, transaction_1.fromTransactionRaw)({
|
|
77
|
-
family: "multiversx",
|
|
78
|
-
recipient: "erd1frj909pfums4m8aza596595l9pl56crwdj077vs2aqcw6ynl28wsfkw9rd",
|
|
79
|
-
amount: "1000000000000000000000000",
|
|
80
|
-
mode: "send",
|
|
81
|
-
fees: null,
|
|
82
|
-
gasLimit: 50000000,
|
|
83
|
-
}),
|
|
84
|
-
expectedStatus: {
|
|
85
|
-
errors: {
|
|
86
|
-
amount: new errors_1.NotEnoughBalance(),
|
|
87
|
-
},
|
|
88
|
-
warnings: {},
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
name: "Not enough balance (ESDT transfer)",
|
|
93
|
-
transaction: (0, transaction_1.fromTransactionRaw)({
|
|
94
|
-
family: "multiversx",
|
|
95
|
-
recipient: "erd1frj909pfums4m8aza596595l9pl56crwdj077vs2aqcw6ynl28wsfkw9rd",
|
|
96
|
-
amount: "1000000000000000000000000",
|
|
97
|
-
mode: "send",
|
|
98
|
-
fees: null,
|
|
99
|
-
gasLimit: 50000000,
|
|
100
|
-
subAccountId: `js:2:multiversx:${TEST_ADDRESS}:+4d45582d343535633537`,
|
|
101
|
-
}),
|
|
102
|
-
expectedStatus: {
|
|
103
|
-
errors: {
|
|
104
|
-
amount: new errors_1.NotEnoughBalance(),
|
|
105
|
-
},
|
|
106
|
-
warnings: {},
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
name: "Send max",
|
|
111
|
-
transaction: (0, transaction_1.fromTransactionRaw)({
|
|
112
|
-
family: "multiversx",
|
|
113
|
-
recipient: "erd1frj909pfums4m8aza596595l9pl56crwdj077vs2aqcw6ynl28wsfkw9rd",
|
|
114
|
-
useAllAmount: true,
|
|
115
|
-
amount: "0",
|
|
116
|
-
mode: "send",
|
|
117
|
-
fees: null,
|
|
118
|
-
gasLimit: 50000000,
|
|
119
|
-
}),
|
|
120
|
-
expectedStatus: (account, _, status) => {
|
|
121
|
-
return {
|
|
122
|
-
amount: account.balance.minus(status.estimatedFees),
|
|
123
|
-
warnings: {},
|
|
124
|
-
errors: {},
|
|
125
|
-
};
|
|
126
|
-
},
|
|
127
|
-
},
|
|
128
|
-
],
|
|
129
|
-
},
|
|
130
|
-
],
|
|
131
|
-
};
|
|
132
|
-
exports.dataset = {
|
|
133
|
-
implementations: ["js"],
|
|
134
|
-
currencies: {
|
|
135
|
-
// multiversx,
|
|
136
|
-
elrond,
|
|
137
|
-
},
|
|
138
|
-
};
|
|
139
|
-
describe("MultiversX bridge", () => {
|
|
140
|
-
test.todo("This is an empty test to make jest command pass. Remove it once there is a real test.");
|
|
141
|
-
});
|
|
142
|
-
//# sourceMappingURL=bridge.integration.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bridge.integration.test.js","sourceRoot":"","sources":["../src/bridge.integration.test.ts"],"names":[],"mappings":";;;AAAA,6CAAkG;AAElG,+CAAyC;AAEzC,+CAAmD;AAGnD,MAAM,YAAY,GAAG,gEAAgE,CAAC;AAEtF,MAAM,MAAM,GAAgC;IAC1C,yBAAyB,EAAE;QACzB,YAAY,EAAE,2BAA2B;KAC1C;IACD,YAAY,EAAE;QACZ;YACE,IAAI,EAAE,mBAAmB;YACzB,KAAK,EAAE;;;;;;;KAOR;SACA;KACF;IACD,QAAQ,EAAE;QACR;YACE,GAAG,EAAE;gBACH,EAAE,EAAE,mBAAmB,YAAY,GAAG;gBACtC,cAAc,EAAE,GAAG,YAAY,EAAE;gBACjC,IAAI,EAAE,cAAc;gBACpB,cAAc,EAAE,EAAE;gBAClB,KAAK,EAAE,CAAC;gBACR,YAAY,EAAE,GAAG,YAAY,EAAE;gBAC/B,gBAAgB,EAAE,mBAAmB;gBACrC,WAAW,EAAE,CAAC;gBACd,UAAU,EAAE,EAAE;gBACd,iBAAiB,EAAE,EAAE;gBACrB,UAAU,EAAE,QAAQ;gBACpB,YAAY,EAAE,EAAE;gBAChB,OAAO,EAAE,WAAW;gBACpB,WAAW,EAAE;oBACX;wBACE,cAAc;wBACd,EAAE,EAAE,mBAAmB,YAAY,wBAAwB;wBAC3D,OAAO,EAAE,KAAK;wBACd,gBAAgB,EAAE,KAAK;wBACvB,IAAI,EAAE,iBAAiB;wBACvB,OAAO,EAAE,sCAAsC;wBAC/C,QAAQ,EAAE,mBAAmB,YAAY,GAAG;wBAC5C,UAAU,EAAE,EAAE;wBACd,iBAAiB,EAAE,EAAE;qBACtB;i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;oBACE,IAAI,EAAE,UAAU;oBAChB,WAAW,EAAE,IAAA,gCAAkB,EAAC;wBAC9B,MAAM,EAAE,YAAY;wBACpB,SAAS,EAAE,gEAAgE;wBAC3E,YAAY,EAAE,IAAI;wBAClB,MAAM,EAAE,GAAG;wBACX,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,IAAI;wBACV,QAAQ,EAAE,QAAQ;qBACnB,CAAC;oBACF,cAAc,EAAE,CAAC,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE;wBACrC,OAAO;4BACL,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC;4BACnD,QAAQ,EAAE,EAAE;4BACZ,MAAM,EAAE,EAAE;yBACX,CAAC;oBACJ,CAAC;iBACF;aACF;SACF;KACF;CACF,CAAC;AAEW,QAAA,OAAO,GAA6B;IAC/C,eAAe,EAAE,CAAC,IAAI,CAAC;IACvB,UAAU,EAAE;QACV,cAAc;QACd,MAAM;KACP;CACF,CAAC;AAEF,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IACjC,IAAI,CAAC,IAAI,CACP,uFAAuF,CACxF,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buildOptimisticOperation.test.d.ts","sourceRoot":"","sources":["../src/buildOptimisticOperation.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
7
|
-
const buildOptimisticOperation_1 = require("./buildOptimisticOperation");
|
|
8
|
-
describe("buildOptimisticOperation", () => {
|
|
9
|
-
it("should work with mode = send", async () => {
|
|
10
|
-
const account = {
|
|
11
|
-
freshAddress: "erd1qyu5wthldzr8wx5c9ucg8kjagg0jfs53s8nr3zpz3hypefsdd8ssycr6th",
|
|
12
|
-
};
|
|
13
|
-
const transaction = {
|
|
14
|
-
family: "multiversx",
|
|
15
|
-
mode: "send",
|
|
16
|
-
fees: new bignumber_js_1.default("1"),
|
|
17
|
-
amount: new bignumber_js_1.default("42"),
|
|
18
|
-
recipient: "erd1spyavw0956vq68xj8y4tenjpq2wd5a9p2c6j8gsz7ztyrnpxrruqzu66jx",
|
|
19
|
-
};
|
|
20
|
-
const notSignedTransaction = {
|
|
21
|
-
nonce: 7,
|
|
22
|
-
};
|
|
23
|
-
const operation = (0, buildOptimisticOperation_1.buildOptimisticOperation)(account, transaction, notSignedTransaction);
|
|
24
|
-
expect(operation.type).toEqual("OUT");
|
|
25
|
-
expect(operation.value).toEqual(new bignumber_js_1.default("43"));
|
|
26
|
-
expect(operation.fee).toEqual(new bignumber_js_1.default("1"));
|
|
27
|
-
expect(operation.extra).toEqual({
|
|
28
|
-
amount: new bignumber_js_1.default("0"),
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
it("should work with mode = delegate", async () => {
|
|
32
|
-
const account = {
|
|
33
|
-
freshAddress: "erd1qyu5wthldzr8wx5c9ucg8kjagg0jfs53s8nr3zpz3hypefsdd8ssycr6th",
|
|
34
|
-
};
|
|
35
|
-
const transaction = {
|
|
36
|
-
family: "multiversx",
|
|
37
|
-
mode: "delegate",
|
|
38
|
-
fees: new bignumber_js_1.default("1"),
|
|
39
|
-
amount: new bignumber_js_1.default("42"),
|
|
40
|
-
recipient: "erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqppllllls9ftvxy",
|
|
41
|
-
data: "delegate",
|
|
42
|
-
};
|
|
43
|
-
const notSignedTransaction = {
|
|
44
|
-
nonce: 7,
|
|
45
|
-
};
|
|
46
|
-
const operation = (0, buildOptimisticOperation_1.buildOptimisticOperation)(account, transaction, notSignedTransaction);
|
|
47
|
-
expect(operation.type).toEqual("DELEGATE");
|
|
48
|
-
expect(operation.value).toEqual(new bignumber_js_1.default("43"));
|
|
49
|
-
expect(operation.fee).toEqual(new bignumber_js_1.default("1"));
|
|
50
|
-
expect(operation.extra).toEqual({
|
|
51
|
-
amount: new bignumber_js_1.default("42"),
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
it("should work with mode = claimRewards", async () => {
|
|
55
|
-
const account = {
|
|
56
|
-
freshAddress: "erd1qyu5wthldzr8wx5c9ucg8kjagg0jfs53s8nr3zpz3hypefsdd8ssycr6th",
|
|
57
|
-
};
|
|
58
|
-
const transaction = {
|
|
59
|
-
family: "multiversx",
|
|
60
|
-
mode: "claimRewards",
|
|
61
|
-
fees: new bignumber_js_1.default("1"),
|
|
62
|
-
amount: new bignumber_js_1.default("42"),
|
|
63
|
-
recipient: "erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqppllllls9ftvxy",
|
|
64
|
-
data: "claimRewards",
|
|
65
|
-
};
|
|
66
|
-
const notSignedTransaction = {
|
|
67
|
-
nonce: 7,
|
|
68
|
-
};
|
|
69
|
-
const operation = (0, buildOptimisticOperation_1.buildOptimisticOperation)(account, transaction, notSignedTransaction);
|
|
70
|
-
expect(operation.type).toEqual("REWARD");
|
|
71
|
-
expect(operation.value).toEqual(new bignumber_js_1.default("1"));
|
|
72
|
-
expect(operation.fee).toEqual(new bignumber_js_1.default("1"));
|
|
73
|
-
expect(operation.extra).toEqual({
|
|
74
|
-
amount: new bignumber_js_1.default("0"),
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
//# sourceMappingURL=buildOptimisticOperation.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buildOptimisticOperation.test.js","sourceRoot":"","sources":["../src/buildOptimisticOperation.test.ts"],"names":[],"mappings":";;;;;AAAA,gEAAqC;AACrC,yE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CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QACzC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,IAAI,sBAAS,CAAC,GAAG,CAAC,CAAC,CAAC;QACpD,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,sBAAS,CAAC,GAAG,CAAC,CAAC,CAAC;QAClD,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;YAC9B,MAAM,EAAE,IAAI,sBAAS,CAAC,GAAG,CAAC;SAC3B,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buildTransaction.unit.test.d.ts","sourceRoot":"","sources":["../src/buildTransaction.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
7
|
-
const buildTransaction_1 = require("./buildTransaction");
|
|
8
|
-
describe("doBuildTransactionToSign", () => {
|
|
9
|
-
it("should serialize transaction without data field", async () => {
|
|
10
|
-
const serializedTransaction = await (0, buildTransaction_1.doBuildTransactionToSign)({
|
|
11
|
-
transaction: {
|
|
12
|
-
family: "multiversx",
|
|
13
|
-
mode: "send",
|
|
14
|
-
fees: null,
|
|
15
|
-
amount: new bignumber_js_1.default("1"),
|
|
16
|
-
recipient: "erd1qyu5wthldzr8wx5c9ucg8kjagg0jfs53s8nr3zpz3hypefsdd8ssycr6th",
|
|
17
|
-
gasLimit: 50000000,
|
|
18
|
-
},
|
|
19
|
-
sender: "erd1spyavw0956vq68xj8y4tenjpq2wd5a9p2c6j8gsz7ztyrnpxrruqzu66jx",
|
|
20
|
-
nonce: 1,
|
|
21
|
-
value: "0",
|
|
22
|
-
minGasLimit: 50000000,
|
|
23
|
-
chainID: "1",
|
|
24
|
-
});
|
|
25
|
-
expect(serializedTransaction).toEqual(`{"nonce":1,"value":"0","receiver":"erd1qyu5wthldzr8wx5c9ucg8kjagg0jfs53s8nr3zpz3hypefsdd8ssycr6th","sender":"erd1spyavw0956vq68xj8y4tenjpq2wd5a9p2c6j8gsz7ztyrnpxrruqzu66jx","gasPrice":1000000000,"gasLimit":50000000,"chainID":"1","version":2,"options":1}`);
|
|
26
|
-
});
|
|
27
|
-
it("should serialize transaction with data field", async () => {
|
|
28
|
-
const serializedTransaction = await (0, buildTransaction_1.doBuildTransactionToSign)({
|
|
29
|
-
transaction: {
|
|
30
|
-
family: "multiversx",
|
|
31
|
-
mode: "send",
|
|
32
|
-
fees: null,
|
|
33
|
-
amount: new bignumber_js_1.default("1"),
|
|
34
|
-
recipient: "erd1qyu5wthldzr8wx5c9ucg8kjagg0jfs53s8nr3zpz3hypefsdd8ssycr6th",
|
|
35
|
-
data: Buffer.from("ESDTTransfer@55544b2d326638306539@0de0b6b3a7640000").toString("base64"),
|
|
36
|
-
gasLimit: 50000000,
|
|
37
|
-
},
|
|
38
|
-
sender: "erd1spyavw0956vq68xj8y4tenjpq2wd5a9p2c6j8gsz7ztyrnpxrruqzu66jx",
|
|
39
|
-
nonce: 1,
|
|
40
|
-
value: "0",
|
|
41
|
-
minGasLimit: 50000000,
|
|
42
|
-
chainID: "1",
|
|
43
|
-
});
|
|
44
|
-
expect(serializedTransaction).toEqual(`{"nonce":1,"value":"0","receiver":"erd1qyu5wthldzr8wx5c9ucg8kjagg0jfs53s8nr3zpz3hypefsdd8ssycr6th","sender":"erd1spyavw0956vq68xj8y4tenjpq2wd5a9p2c6j8gsz7ztyrnpxrruqzu66jx","gasPrice":1000000000,"gasLimit":50000000,"data":"RVNEVFRyYW5zZmVyQDU1NTQ0YjJkMzI2NjM4MzA2NTM5QDBkZTBiNmIzYTc2NDAwMDA=","chainID":"1","version":2,"options":1}`);
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
//# sourceMappingURL=buildTransaction.unit.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buildTransaction.unit.test.js","sourceRoot":"","sources":["../src/buildTransaction.unit.test.ts"],"names":[],"mappings":";;;;;AAAA,gEAAqC;AACrC,yDAA8D;AAE9D,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;IACxC,EAAE,CAAC,iDAAiD,EAAE,KAAK,IAAI,EAAE;QAC/D,MAAM,qBAAqB,GAAG,MAAM,IAAA,2CAAwB,EAAC;YAC3D,WAAW,EAAE;gBACX,MAAM,EAAE,YAAY;gBACpB,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,IAAI;gBACV,MAAM,EAAE,IAAI,sBAAS,CAAC,GAAG,CAAC;gBAC1B,SAAS,EAAE,gEAAgE;gBAC3E,QAAQ,EAAE,QAAQ;aACnB;YACD,MAAM,EAAE,gEAAgE;YACxE,KAAK,EAAE,CAAC;YACR,KAAK,EAAE,GAAG;YACV,WAAW,EAAE,QAAQ;YACrB,OAAO,EAAE,GAAG;SACb,CAAC,CAAC;QAEH,MAAM,CAAC,qBAAqB,CAAC,CAAC,OAAO,CACnC,+PAA+P,CAChQ,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8CAA8C,EAAE,KAAK,IAAI,EAAE;QAC5D,MAAM,qBAAqB,GAAG,MAAM,IAAA,2CAAwB,EAAC;YAC3D,WAAW,EAAE;gBACX,MAAM,EAAE,YAAY;gBACpB,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,IAAI;gBACV,MAAM,EAAE,IAAI,sBAAS,CAAC,GAAG,CAAC;gBAC1B,SAAS,EAAE,gEAAgE;gBAC3E,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,oDAAoD,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;gBAC1F,QAAQ,EAAE,QAAQ;aACnB;YACD,MAAM,EAAE,gEAAgE;YACxE,KAAK,EAAE,CAAC;YACR,KAAK,EAAE,GAAG;YACV,WAAW,EAAE,QAAQ;YACrB,OAAO,EAAE,GAAG;SACb,CAAC,CAAC;QAEH,MAAM,CAAC,qBAAqB,CAAC,CAAC,OAAO,CACnC,6UAA6U,CAC9U,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bridge.integration.test.d.ts","sourceRoot":"","sources":["../src/bridge.integration.test.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAkB,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAIxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAiI3C,eAAO,MAAM,OAAO,EAAE,WAAW,CAAC,WAAW,CAM5C,CAAC"}
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import { InvalidAddressBecauseDestinationIsAlsoSource, NotEnoughBalance } from "@ledgerhq/errors";
|
|
2
|
-
import { BigNumber } from "bignumber.js";
|
|
3
|
-
import { fromTransactionRaw } from "./transaction";
|
|
4
|
-
const TEST_ADDRESS = "erd1vgfp3g7azqjx4wsmtt7067m0l62v3psmqzr24j6xvywj2tlz0gesvyzsq2";
|
|
5
|
-
const elrond = {
|
|
6
|
-
FIXME_ignorePreloadFields: [
|
|
7
|
-
"validators", // They are always changing
|
|
8
|
-
],
|
|
9
|
-
scanAccounts: [
|
|
10
|
-
{
|
|
11
|
-
name: "multiversx seed 1",
|
|
12
|
-
apdus: `
|
|
13
|
-
=> ed030000080000000080000000
|
|
14
|
-
<= 3e6572643176676670336737617a716a783477736d7474373036376d306c3632763370736d717a7232346a36787679776a32746c7a3067657376797a7371329000
|
|
15
|
-
=> ed030000080000000080000000
|
|
16
|
-
<= 3e6572643176676670336737617a716a783477736d7474373036376d306c3632763370736d717a7232346a36787679776a32746c7a3067657376797a7371329000
|
|
17
|
-
=> ed030000080000000080000001
|
|
18
|
-
<= 3e65726431706d33676a65326c6d643576796c6463767579366a7078676465347261706a70756a76756a6b65653661376a77327a6d6834747172653739367a9000
|
|
19
|
-
`,
|
|
20
|
-
},
|
|
21
|
-
],
|
|
22
|
-
accounts: [
|
|
23
|
-
{
|
|
24
|
-
raw: {
|
|
25
|
-
id: `js:2:multiversx:${TEST_ADDRESS}:`,
|
|
26
|
-
seedIdentifier: `${TEST_ADDRESS}`,
|
|
27
|
-
name: "MultiversX 1",
|
|
28
|
-
derivationMode: "",
|
|
29
|
-
index: 0,
|
|
30
|
-
freshAddress: `${TEST_ADDRESS}`,
|
|
31
|
-
freshAddressPath: "44'/508'/0'/0'/0'",
|
|
32
|
-
blockHeight: 0,
|
|
33
|
-
operations: [],
|
|
34
|
-
pendingOperations: [],
|
|
35
|
-
currencyId: "elrond",
|
|
36
|
-
lastSyncDate: "",
|
|
37
|
-
balance: "299569965",
|
|
38
|
-
subAccounts: [
|
|
39
|
-
{
|
|
40
|
-
// MEX account
|
|
41
|
-
id: `js:2:multiversx:${TEST_ADDRESS}:+4d45582d343535633537`,
|
|
42
|
-
balance: "100",
|
|
43
|
-
spendableBalance: "100",
|
|
44
|
-
type: "TokenAccountRaw",
|
|
45
|
-
tokenId: "multiversx/esdt/4d45582d343535633537",
|
|
46
|
-
parentId: `js:2:multiversx:${TEST_ADDRESS}:`,
|
|
47
|
-
operations: [],
|
|
48
|
-
pendingOperations: [],
|
|
49
|
-
},
|
|
50
|
-
],
|
|
51
|
-
},
|
|
52
|
-
transactions: [
|
|
53
|
-
{
|
|
54
|
-
name: "recipient and sender must not be the same",
|
|
55
|
-
transaction: fromTransactionRaw({
|
|
56
|
-
family: "multiversx",
|
|
57
|
-
recipient: `${TEST_ADDRESS}`,
|
|
58
|
-
amount: "100000000",
|
|
59
|
-
mode: "send",
|
|
60
|
-
fees: null,
|
|
61
|
-
gasLimit: 50000000,
|
|
62
|
-
}),
|
|
63
|
-
expectedStatus: {
|
|
64
|
-
amount: new BigNumber("100000000"),
|
|
65
|
-
errors: {
|
|
66
|
-
recipient: new InvalidAddressBecauseDestinationIsAlsoSource(),
|
|
67
|
-
},
|
|
68
|
-
warnings: {},
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
name: "Not enough balance",
|
|
73
|
-
transaction: fromTransactionRaw({
|
|
74
|
-
family: "multiversx",
|
|
75
|
-
recipient: "erd1frj909pfums4m8aza596595l9pl56crwdj077vs2aqcw6ynl28wsfkw9rd",
|
|
76
|
-
amount: "1000000000000000000000000",
|
|
77
|
-
mode: "send",
|
|
78
|
-
fees: null,
|
|
79
|
-
gasLimit: 50000000,
|
|
80
|
-
}),
|
|
81
|
-
expectedStatus: {
|
|
82
|
-
errors: {
|
|
83
|
-
amount: new NotEnoughBalance(),
|
|
84
|
-
},
|
|
85
|
-
warnings: {},
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
name: "Not enough balance (ESDT transfer)",
|
|
90
|
-
transaction: fromTransactionRaw({
|
|
91
|
-
family: "multiversx",
|
|
92
|
-
recipient: "erd1frj909pfums4m8aza596595l9pl56crwdj077vs2aqcw6ynl28wsfkw9rd",
|
|
93
|
-
amount: "1000000000000000000000000",
|
|
94
|
-
mode: "send",
|
|
95
|
-
fees: null,
|
|
96
|
-
gasLimit: 50000000,
|
|
97
|
-
subAccountId: `js:2:multiversx:${TEST_ADDRESS}:+4d45582d343535633537`,
|
|
98
|
-
}),
|
|
99
|
-
expectedStatus: {
|
|
100
|
-
errors: {
|
|
101
|
-
amount: new NotEnoughBalance(),
|
|
102
|
-
},
|
|
103
|
-
warnings: {},
|
|
104
|
-
},
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
name: "Send max",
|
|
108
|
-
transaction: fromTransactionRaw({
|
|
109
|
-
family: "multiversx",
|
|
110
|
-
recipient: "erd1frj909pfums4m8aza596595l9pl56crwdj077vs2aqcw6ynl28wsfkw9rd",
|
|
111
|
-
useAllAmount: true,
|
|
112
|
-
amount: "0",
|
|
113
|
-
mode: "send",
|
|
114
|
-
fees: null,
|
|
115
|
-
gasLimit: 50000000,
|
|
116
|
-
}),
|
|
117
|
-
expectedStatus: (account, _, status) => {
|
|
118
|
-
return {
|
|
119
|
-
amount: account.balance.minus(status.estimatedFees),
|
|
120
|
-
warnings: {},
|
|
121
|
-
errors: {},
|
|
122
|
-
};
|
|
123
|
-
},
|
|
124
|
-
},
|
|
125
|
-
],
|
|
126
|
-
},
|
|
127
|
-
],
|
|
128
|
-
};
|
|
129
|
-
export const dataset = {
|
|
130
|
-
implementations: ["js"],
|
|
131
|
-
currencies: {
|
|
132
|
-
// multiversx,
|
|
133
|
-
elrond,
|
|
134
|
-
},
|
|
135
|
-
};
|
|
136
|
-
describe("MultiversX bridge", () => {
|
|
137
|
-
test.todo("This is an empty test to make jest command pass. Remove it once there is a real test.");
|
|
138
|
-
});
|
|
139
|
-
//# sourceMappingURL=bridge.integration.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bridge.integration.test.js","sourceRoot":"","sources":["../src/bridge.integration.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4CAA4C,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAElG,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAGnD,MAAM,YAAY,GAAG,gEAAgE,CAAC;AAEtF,MAAM,MAAM,GAAgC;IAC1C,yBAAyB,EAAE;QACzB,YAAY,EAAE,2BAA2B;KAC1C;IACD,YAAY,EAAE;QACZ;YACE,IAAI,EAAE,mBAAmB;YACzB,KAAK,EAAE;;;;;;;KAOR;SACA;KACF;IACD,QAAQ,EAAE;QACR;YACE,GAAG,EAAE;gBACH,EAAE,EAAE,m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AE;QACV,cAAc;QACd,MAAM;KACP;CACF,CAAC;AAEF,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IACjC,IAAI,CAAC,IAAI,CACP,uFAAuF,CACxF,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buildOptimisticOperation.test.d.ts","sourceRoot":"","sources":["../src/buildOptimisticOperation.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import BigNumber from "bignumber.js";
|
|
2
|
-
import { buildOptimisticOperation } from "./buildOptimisticOperation";
|
|
3
|
-
describe("buildOptimisticOperation", () => {
|
|
4
|
-
it("should work with mode = send", async () => {
|
|
5
|
-
const account = {
|
|
6
|
-
freshAddress: "erd1qyu5wthldzr8wx5c9ucg8kjagg0jfs53s8nr3zpz3hypefsdd8ssycr6th",
|
|
7
|
-
};
|
|
8
|
-
const transaction = {
|
|
9
|
-
family: "multiversx",
|
|
10
|
-
mode: "send",
|
|
11
|
-
fees: new BigNumber("1"),
|
|
12
|
-
amount: new BigNumber("42"),
|
|
13
|
-
recipient: "erd1spyavw0956vq68xj8y4tenjpq2wd5a9p2c6j8gsz7ztyrnpxrruqzu66jx",
|
|
14
|
-
};
|
|
15
|
-
const notSignedTransaction = {
|
|
16
|
-
nonce: 7,
|
|
17
|
-
};
|
|
18
|
-
const operation = buildOptimisticOperation(account, transaction, notSignedTransaction);
|
|
19
|
-
expect(operation.type).toEqual("OUT");
|
|
20
|
-
expect(operation.value).toEqual(new BigNumber("43"));
|
|
21
|
-
expect(operation.fee).toEqual(new BigNumber("1"));
|
|
22
|
-
expect(operation.extra).toEqual({
|
|
23
|
-
amount: new BigNumber("0"),
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
it("should work with mode = delegate", async () => {
|
|
27
|
-
const account = {
|
|
28
|
-
freshAddress: "erd1qyu5wthldzr8wx5c9ucg8kjagg0jfs53s8nr3zpz3hypefsdd8ssycr6th",
|
|
29
|
-
};
|
|
30
|
-
const transaction = {
|
|
31
|
-
family: "multiversx",
|
|
32
|
-
mode: "delegate",
|
|
33
|
-
fees: new BigNumber("1"),
|
|
34
|
-
amount: new BigNumber("42"),
|
|
35
|
-
recipient: "erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqppllllls9ftvxy",
|
|
36
|
-
data: "delegate",
|
|
37
|
-
};
|
|
38
|
-
const notSignedTransaction = {
|
|
39
|
-
nonce: 7,
|
|
40
|
-
};
|
|
41
|
-
const operation = buildOptimisticOperation(account, transaction, notSignedTransaction);
|
|
42
|
-
expect(operation.type).toEqual("DELEGATE");
|
|
43
|
-
expect(operation.value).toEqual(new BigNumber("43"));
|
|
44
|
-
expect(operation.fee).toEqual(new BigNumber("1"));
|
|
45
|
-
expect(operation.extra).toEqual({
|
|
46
|
-
amount: new BigNumber("42"),
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
it("should work with mode = claimRewards", async () => {
|
|
50
|
-
const account = {
|
|
51
|
-
freshAddress: "erd1qyu5wthldzr8wx5c9ucg8kjagg0jfs53s8nr3zpz3hypefsdd8ssycr6th",
|
|
52
|
-
};
|
|
53
|
-
const transaction = {
|
|
54
|
-
family: "multiversx",
|
|
55
|
-
mode: "claimRewards",
|
|
56
|
-
fees: new BigNumber("1"),
|
|
57
|
-
amount: new BigNumber("42"),
|
|
58
|
-
recipient: "erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqppllllls9ftvxy",
|
|
59
|
-
data: "claimRewards",
|
|
60
|
-
};
|
|
61
|
-
const notSignedTransaction = {
|
|
62
|
-
nonce: 7,
|
|
63
|
-
};
|
|
64
|
-
const operation = buildOptimisticOperation(account, transaction, notSignedTransaction);
|
|
65
|
-
expect(operation.type).toEqual("REWARD");
|
|
66
|
-
expect(operation.value).toEqual(new BigNumber("1"));
|
|
67
|
-
expect(operation.fee).toEqual(new BigNumber("1"));
|
|
68
|
-
expect(operation.extra).toEqual({
|
|
69
|
-
amount: new BigNumber("0"),
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
//# sourceMappingURL=buildOptimisticOperation.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buildOptimisticOperation.test.js","sourceRoot":"","sources":["../src/buildOptimisticOperation.test.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAGtE,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;IACxC,EAAE,CAAC,8BAA8B,EAAE,KAAK,IAAI,EAAE;QAC5C,MAAM,OAAO,GAAG;YACd,YAAY,EAAE,gEAAgE;SAC1D,CAAC;QAEvB,MAAM,WAAW,GAAG;YAClB,MAAM,EAAE,YAAY;YACpB,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,IAAI,SAAS,CAAC,GAAG,CAAC;YACxB,MAAM,EAAE,IAAI,SAAS,CAAC,IAAI,CAAC;YAC3B,SAAS,EAAE,gEAAgE;SAC7D,CAAC;QAEjB,MAAM,oBAAoB,GAAkC;YAC1D,KAAK,EAAE,CAAC;SACwB,CAAC;QAEnC,MAAM,SAAS,GAAG,wBAAwB,CAAC,OAAO,EAAE,WAAW,EAAE,oBAAoB,CAAC,CAAC;QAEvF,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACtC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;QACrD,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;QAClD,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;YAC9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AAS,CAAC,GAAG,CAAC;YACxB,MAAM,EAAE,IAAI,SAAS,CAAC,IAAI,CAAC;YAC3B,SAAS,EAAE,gEAAgE;YAC3E,IAAI,EAAE,cAAc;SACN,CAAC;QAEjB,MAAM,oBAAoB,GAAkC;YAC1D,KAAK,EAAE,CAAC;SACwB,CAAC;QAEnC,MAAM,SAAS,GAAG,wBAAwB,CAAC,OAAO,EAAE,WAAW,EAAE,oBAAoB,CAAC,CAAC;QAEvF,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QACzC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,IAAI,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;QACpD,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;QAClD,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;YAC9B,MAAM,EAAE,IAAI,SAAS,CAAC,GAAG,CAAC;SAC3B,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buildTransaction.unit.test.d.ts","sourceRoot":"","sources":["../src/buildTransaction.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import BigNumber from "bignumber.js";
|
|
2
|
-
import { doBuildTransactionToSign } from "./buildTransaction";
|
|
3
|
-
describe("doBuildTransactionToSign", () => {
|
|
4
|
-
it("should serialize transaction without data field", async () => {
|
|
5
|
-
const serializedTransaction = await doBuildTransactionToSign({
|
|
6
|
-
transaction: {
|
|
7
|
-
family: "multiversx",
|
|
8
|
-
mode: "send",
|
|
9
|
-
fees: null,
|
|
10
|
-
amount: new BigNumber("1"),
|
|
11
|
-
recipient: "erd1qyu5wthldzr8wx5c9ucg8kjagg0jfs53s8nr3zpz3hypefsdd8ssycr6th",
|
|
12
|
-
gasLimit: 50000000,
|
|
13
|
-
},
|
|
14
|
-
sender: "erd1spyavw0956vq68xj8y4tenjpq2wd5a9p2c6j8gsz7ztyrnpxrruqzu66jx",
|
|
15
|
-
nonce: 1,
|
|
16
|
-
value: "0",
|
|
17
|
-
minGasLimit: 50000000,
|
|
18
|
-
chainID: "1",
|
|
19
|
-
});
|
|
20
|
-
expect(serializedTransaction).toEqual(`{"nonce":1,"value":"0","receiver":"erd1qyu5wthldzr8wx5c9ucg8kjagg0jfs53s8nr3zpz3hypefsdd8ssycr6th","sender":"erd1spyavw0956vq68xj8y4tenjpq2wd5a9p2c6j8gsz7ztyrnpxrruqzu66jx","gasPrice":1000000000,"gasLimit":50000000,"chainID":"1","version":2,"options":1}`);
|
|
21
|
-
});
|
|
22
|
-
it("should serialize transaction with data field", async () => {
|
|
23
|
-
const serializedTransaction = await doBuildTransactionToSign({
|
|
24
|
-
transaction: {
|
|
25
|
-
family: "multiversx",
|
|
26
|
-
mode: "send",
|
|
27
|
-
fees: null,
|
|
28
|
-
amount: new BigNumber("1"),
|
|
29
|
-
recipient: "erd1qyu5wthldzr8wx5c9ucg8kjagg0jfs53s8nr3zpz3hypefsdd8ssycr6th",
|
|
30
|
-
data: Buffer.from("ESDTTransfer@55544b2d326638306539@0de0b6b3a7640000").toString("base64"),
|
|
31
|
-
gasLimit: 50000000,
|
|
32
|
-
},
|
|
33
|
-
sender: "erd1spyavw0956vq68xj8y4tenjpq2wd5a9p2c6j8gsz7ztyrnpxrruqzu66jx",
|
|
34
|
-
nonce: 1,
|
|
35
|
-
value: "0",
|
|
36
|
-
minGasLimit: 50000000,
|
|
37
|
-
chainID: "1",
|
|
38
|
-
});
|
|
39
|
-
expect(serializedTransaction).toEqual(`{"nonce":1,"value":"0","receiver":"erd1qyu5wthldzr8wx5c9ucg8kjagg0jfs53s8nr3zpz3hypefsdd8ssycr6th","sender":"erd1spyavw0956vq68xj8y4tenjpq2wd5a9p2c6j8gsz7ztyrnpxrruqzu66jx","gasPrice":1000000000,"gasLimit":50000000,"data":"RVNEVFRyYW5zZmVyQDU1NTQ0YjJkMzI2NjM4MzA2NTM5QDBkZTBiNmIzYTc2NDAwMDA=","chainID":"1","version":2,"options":1}`);
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
//# sourceMappingURL=buildTransaction.unit.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buildTransaction.unit.test.js","sourceRoot":"","sources":["../src/buildTransaction.unit.test.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAE9D,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;IACxC,EAAE,CAAC,iDAAiD,EAAE,KAAK,IAAI,EAAE;QAC/D,MAAM,qBAAqB,GAAG,MAAM,wBAAwB,CAAC;YAC3D,WAAW,EAAE;gBACX,MAAM,EAAE,YAAY;gBACpB,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,IAAI;gBACV,MAAM,EAAE,IAAI,SAAS,CAAC,GAAG,CAAC;gBAC1B,SAAS,EAAE,gEAAgE;gBAC3E,QAAQ,EAAE,QAAQ;aACnB;YACD,MAAM,EAAE,gEAAgE;YACxE,KAAK,EAAE,CAAC;YACR,KAAK,EAAE,GAAG;YACV,WAAW,EAAE,QAAQ;YACrB,OAAO,EAAE,GAAG;SACb,CAAC,CAAC;QAEH,MAAM,CAAC,qBAAqB,CAAC,CAAC,OAAO,CACnC,+PAA+P,CAChQ,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8CAA8C,EAAE,KAAK,IAAI,EAAE;QAC5D,MAAM,qBAAqB,GAAG,MAAM,wBAAwB,CAAC;YAC3D,WAAW,EAAE;gBACX,MAAM,EAAE,YAAY;gBACpB,IAAI,EAAE,MAAM;gBACZ,IAAI,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