@ledgerhq/coin-evm 0.6.1 → 0.7.0-next.0
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/.eslintrc.js +8 -1
- package/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +24 -0
- package/jest.config.js +1 -0
- package/lib/__tests__/fixtures/prepareTransaction.fixtures.js.map +1 -1
- package/lib/__tests__/fixtures/transaction.fixtures.d.ts.map +1 -1
- package/lib/__tests__/fixtures/transaction.fixtures.js +80 -0
- package/lib/__tests__/fixtures/transaction.fixtures.js.map +1 -1
- package/lib/__tests__/integration/bridge.integration.test.d.ts.map +1 -1
- package/lib/__tests__/integration/bridge.integration.test.js +4 -4
- package/lib/__tests__/integration/bridge.integration.test.js.map +1 -1
- package/lib/__tests__/unit/adapters/ethers.unit.test.js +15 -0
- package/lib/__tests__/unit/adapters/ethers.unit.test.js.map +1 -1
- package/lib/__tests__/unit/adapters/ledger.unit.test.js +63 -0
- package/lib/__tests__/unit/adapters/ledger.unit.test.js.map +1 -1
- package/lib/__tests__/unit/api/explorer/etherscan.unit.test.js +4 -0
- package/lib/__tests__/unit/api/explorer/etherscan.unit.test.js.map +1 -1
- package/lib/__tests__/unit/api/explorer/index.unit.test.js +10 -19
- package/lib/__tests__/unit/api/explorer/index.unit.test.js.map +1 -1
- package/lib/__tests__/unit/api/gasTracker/index.unit.test.js +8 -0
- package/lib/__tests__/unit/api/gasTracker/index.unit.test.js.map +1 -1
- package/lib/__tests__/unit/api/gasTracker/ledger.unit.test.js +182 -80
- package/lib/__tests__/unit/api/gasTracker/ledger.unit.test.js.map +1 -1
- package/lib/__tests__/unit/api/node/rpc.unit.test.js.map +1 -1
- package/lib/__tests__/unit/getTransactionStatus.unit.test.js +316 -143
- package/lib/__tests__/unit/getTransactionStatus.unit.test.js.map +1 -1
- package/lib/__tests__/unit/hw-getAddress.unit.test.js.map +1 -1
- package/lib/__tests__/unit/logic.unit.test.js +4 -4
- package/lib/__tests__/unit/logic.unit.test.js.map +1 -1
- package/lib/__tests__/unit/preload.unit.test.js.map +1 -1
- package/lib/__tests__/unit/signOperation.unit.test.js +1 -1
- package/lib/__tests__/unit/signOperation.unit.test.js.map +1 -1
- package/lib/__tests__/unit/synchronization.unit.test.js.map +1 -1
- package/lib/__tests__/unit/transaction.unit.test.js +95 -18
- package/lib/__tests__/unit/transaction.unit.test.js.map +1 -1
- package/lib/adapters/ethers.d.ts.map +1 -1
- package/lib/adapters/ethers.js +10 -5
- package/lib/adapters/ethers.js.map +1 -1
- package/lib/adapters/ledger.d.ts.map +1 -1
- package/lib/adapters/ledger.js +41 -8
- package/lib/adapters/ledger.js.map +1 -1
- package/lib/api/explorer/etherscan.d.ts +1 -1
- package/lib/api/explorer/etherscan.js +1 -1
- package/lib/api/explorer/ledger.d.ts +2 -2
- package/lib/api/explorer/ledger.d.ts.map +1 -1
- package/lib/api/explorer/ledger.js +2 -1
- package/lib/api/explorer/ledger.js.map +1 -1
- package/lib/api/gasTracker/ledger.d.ts.map +1 -1
- package/lib/api/gasTracker/ledger.js +18 -11
- package/lib/api/gasTracker/ledger.js.map +1 -1
- package/lib/api/node/ledger.d.ts.map +1 -1
- package/lib/api/node/ledger.js +7 -0
- package/lib/api/node/ledger.js.map +1 -1
- package/lib/api/node/rpc.common.d.ts.map +1 -1
- package/lib/api/node/rpc.common.js.map +1 -1
- package/lib/api/node/types.d.ts +2 -2
- package/lib/api/node/types.d.ts.map +1 -1
- package/lib/api/node/types.js.map +1 -1
- package/lib/cli-transaction.d.ts +3 -1
- package/lib/cli-transaction.d.ts.map +1 -1
- package/lib/cli-transaction.js.map +1 -1
- package/lib/datasets/ethereum1.js +2 -2
- package/lib/datasets/ethereum1.js.map +1 -1
- package/lib/errors.d.ts +0 -3
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +1 -2
- package/lib/errors.js.map +1 -1
- package/lib/getTransactionStatus.d.ts +2 -12
- package/lib/getTransactionStatus.d.ts.map +1 -1
- package/lib/getTransactionStatus.js +30 -10
- package/lib/getTransactionStatus.js.map +1 -1
- package/lib/hw-signMessage.js.map +1 -1
- package/lib/logic.d.ts +6 -2
- package/lib/logic.d.ts.map +1 -1
- package/lib/logic.js +19 -7
- package/lib/logic.js.map +1 -1
- package/lib/prepareTransaction.js.map +1 -1
- package/lib/signer.d.ts +1 -1
- package/lib/signer.d.ts.map +1 -1
- package/lib/specs.d.ts.map +1 -1
- package/lib/specs.js +117 -64
- package/lib/specs.js.map +1 -1
- package/lib/speculos-deviceActions.d.ts +3 -6
- package/lib/speculos-deviceActions.d.ts.map +1 -1
- package/lib/speculos-deviceActions.js +47 -7
- package/lib/speculos-deviceActions.js.map +1 -1
- package/lib/synchronization.d.ts.map +1 -1
- package/lib/synchronization.js.map +1 -1
- package/lib/transaction.d.ts.map +1 -1
- package/lib/transaction.js +33 -0
- package/lib/transaction.js.map +1 -1
- package/lib/types/ledger.d.ts +2 -2
- package/lib/types/ledger.d.ts.map +1 -1
- package/lib/types/transaction.d.ts +16 -6
- package/lib/types/transaction.d.ts.map +1 -1
- package/lib-es/__tests__/fixtures/prepareTransaction.fixtures.js.map +1 -1
- package/lib-es/__tests__/fixtures/transaction.fixtures.d.ts.map +1 -1
- package/lib-es/__tests__/fixtures/transaction.fixtures.js +80 -0
- package/lib-es/__tests__/fixtures/transaction.fixtures.js.map +1 -1
- package/lib-es/__tests__/integration/bridge.integration.test.d.ts.map +1 -1
- package/lib-es/__tests__/integration/bridge.integration.test.js +4 -4
- package/lib-es/__tests__/integration/bridge.integration.test.js.map +1 -1
- package/lib-es/__tests__/unit/adapters/ethers.unit.test.js +15 -0
- package/lib-es/__tests__/unit/adapters/ethers.unit.test.js.map +1 -1
- package/lib-es/__tests__/unit/adapters/ledger.unit.test.js +63 -0
- package/lib-es/__tests__/unit/adapters/ledger.unit.test.js.map +1 -1
- package/lib-es/__tests__/unit/api/explorer/etherscan.unit.test.js +4 -0
- package/lib-es/__tests__/unit/api/explorer/etherscan.unit.test.js.map +1 -1
- package/lib-es/__tests__/unit/api/explorer/index.unit.test.js +10 -19
- package/lib-es/__tests__/unit/api/explorer/index.unit.test.js.map +1 -1
- package/lib-es/__tests__/unit/api/gasTracker/index.unit.test.js +8 -0
- package/lib-es/__tests__/unit/api/gasTracker/index.unit.test.js.map +1 -1
- package/lib-es/__tests__/unit/api/gasTracker/ledger.unit.test.js +183 -81
- package/lib-es/__tests__/unit/api/gasTracker/ledger.unit.test.js.map +1 -1
- package/lib-es/__tests__/unit/api/node/rpc.unit.test.js.map +1 -1
- package/lib-es/__tests__/unit/getTransactionStatus.unit.test.js +317 -144
- package/lib-es/__tests__/unit/getTransactionStatus.unit.test.js.map +1 -1
- package/lib-es/__tests__/unit/hw-getAddress.unit.test.js.map +1 -1
- package/lib-es/__tests__/unit/logic.unit.test.js +4 -4
- package/lib-es/__tests__/unit/logic.unit.test.js.map +1 -1
- package/lib-es/__tests__/unit/preload.unit.test.js.map +1 -1
- package/lib-es/__tests__/unit/signOperation.unit.test.js +1 -1
- package/lib-es/__tests__/unit/signOperation.unit.test.js.map +1 -1
- package/lib-es/__tests__/unit/synchronization.unit.test.js.map +1 -1
- package/lib-es/__tests__/unit/transaction.unit.test.js +95 -18
- package/lib-es/__tests__/unit/transaction.unit.test.js.map +1 -1
- package/lib-es/adapters/ethers.d.ts.map +1 -1
- package/lib-es/adapters/ethers.js +10 -5
- package/lib-es/adapters/ethers.js.map +1 -1
- package/lib-es/adapters/ledger.d.ts.map +1 -1
- package/lib-es/adapters/ledger.js +41 -8
- package/lib-es/adapters/ledger.js.map +1 -1
- package/lib-es/api/explorer/etherscan.d.ts +1 -1
- package/lib-es/api/explorer/etherscan.js +1 -1
- package/lib-es/api/explorer/ledger.d.ts +2 -2
- package/lib-es/api/explorer/ledger.d.ts.map +1 -1
- package/lib-es/api/explorer/ledger.js +2 -1
- package/lib-es/api/explorer/ledger.js.map +1 -1
- package/lib-es/api/gasTracker/ledger.d.ts.map +1 -1
- package/lib-es/api/gasTracker/ledger.js +19 -12
- package/lib-es/api/gasTracker/ledger.js.map +1 -1
- package/lib-es/api/node/ledger.d.ts.map +1 -1
- package/lib-es/api/node/ledger.js +7 -0
- package/lib-es/api/node/ledger.js.map +1 -1
- package/lib-es/api/node/rpc.common.d.ts.map +1 -1
- package/lib-es/api/node/rpc.common.js.map +1 -1
- package/lib-es/api/node/types.d.ts +2 -2
- package/lib-es/api/node/types.d.ts.map +1 -1
- package/lib-es/api/node/types.js.map +1 -1
- package/lib-es/cli-transaction.d.ts +3 -1
- package/lib-es/cli-transaction.d.ts.map +1 -1
- package/lib-es/cli-transaction.js.map +1 -1
- package/lib-es/datasets/ethereum1.js +2 -2
- package/lib-es/datasets/ethereum1.js.map +1 -1
- package/lib-es/errors.d.ts +0 -3
- package/lib-es/errors.d.ts.map +1 -1
- package/lib-es/errors.js +0 -1
- package/lib-es/errors.js.map +1 -1
- package/lib-es/getTransactionStatus.d.ts +2 -12
- package/lib-es/getTransactionStatus.d.ts.map +1 -1
- package/lib-es/getTransactionStatus.js +30 -7
- package/lib-es/getTransactionStatus.js.map +1 -1
- package/lib-es/hw-signMessage.js.map +1 -1
- package/lib-es/logic.d.ts +6 -2
- package/lib-es/logic.d.ts.map +1 -1
- package/lib-es/logic.js +15 -4
- package/lib-es/logic.js.map +1 -1
- package/lib-es/prepareTransaction.js.map +1 -1
- package/lib-es/signer.d.ts +1 -1
- package/lib-es/signer.d.ts.map +1 -1
- package/lib-es/specs.d.ts.map +1 -1
- package/lib-es/specs.js +118 -65
- package/lib-es/specs.js.map +1 -1
- package/lib-es/speculos-deviceActions.d.ts +3 -6
- package/lib-es/speculos-deviceActions.d.ts.map +1 -1
- package/lib-es/speculos-deviceActions.js +46 -6
- package/lib-es/speculos-deviceActions.js.map +1 -1
- package/lib-es/synchronization.d.ts.map +1 -1
- package/lib-es/synchronization.js.map +1 -1
- package/lib-es/transaction.d.ts.map +1 -1
- package/lib-es/transaction.js +33 -0
- package/lib-es/transaction.js.map +1 -1
- package/lib-es/types/ledger.d.ts +2 -2
- package/lib-es/types/ledger.d.ts.map +1 -1
- package/lib-es/types/transaction.d.ts +16 -6
- package/lib-es/types/transaction.d.ts.map +1 -1
- package/package.json +14 -11
- package/src/__tests__/fixtures/prepareTransaction.fixtures.ts +2 -2
- package/src/__tests__/fixtures/transaction.fixtures.ts +80 -0
- package/src/__tests__/integration/bridge.integration.test.ts +6 -6
- package/src/__tests__/unit/adapters/ethers.unit.test.ts +21 -0
- package/src/__tests__/unit/adapters/ledger.unit.test.ts +67 -0
- package/src/__tests__/unit/api/explorer/etherscan.unit.test.ts +9 -5
- package/src/__tests__/unit/api/explorer/index.unit.test.ts +7 -7
- package/src/__tests__/unit/api/gasTracker/index.unit.test.ts +8 -0
- package/src/__tests__/unit/api/gasTracker/ledger.unit.test.ts +217 -83
- package/src/__tests__/unit/api/node/rpc.unit.test.ts +2 -2
- package/src/__tests__/unit/getTransactionStatus.unit.test.ts +535 -257
- package/src/__tests__/unit/hw-getAddress.unit.test.ts +5 -2
- package/src/__tests__/unit/logic.unit.test.ts +16 -4
- package/src/__tests__/unit/preload.unit.test.ts +3 -1
- package/src/__tests__/unit/signOperation.unit.test.ts +7 -2
- package/src/__tests__/unit/synchronization.unit.test.ts +1 -1
- package/src/__tests__/unit/transaction.unit.test.ts +179 -41
- package/src/adapters/ethers.ts +11 -5
- package/src/adapters/ledger.ts +42 -8
- package/src/api/explorer/etherscan.ts +1 -1
- package/src/api/explorer/ledger.ts +4 -2
- package/src/api/gasTracker/ledger.ts +20 -19
- package/src/api/node/ledger.ts +8 -1
- package/src/api/node/rpc.common.ts +16 -3
- package/src/api/node/types.ts +2 -2
- package/src/cli-transaction.ts +5 -1
- package/src/datasets/ethereum1.ts +2 -2
- package/src/errors.ts +0 -3
- package/src/getTransactionStatus.ts +44 -5
- package/src/hw-signMessage.ts +1 -1
- package/src/logic.ts +27 -6
- package/src/prepareTransaction.ts +2 -2
- package/src/signOperation.ts +1 -1
- package/src/signer.ts +1 -1
- package/src/specs.ts +142 -81
- package/src/speculos-deviceActions.ts +60 -10
- package/src/synchronization.ts +5 -1
- package/src/transaction.ts +47 -0
- package/src/types/ledger.ts +2 -2
- package/src/types/transaction.ts +19 -6
- package/tsconfig.json +1 -0
|
@@ -12,12 +12,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const cryptoassets_1 = require("@ledgerhq/cryptoassets");
|
|
15
16
|
const errors_1 = require("@ledgerhq/errors");
|
|
16
17
|
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
17
|
-
const
|
|
18
|
-
const common_fixtures_1 = require("../fixtures/common.fixtures");
|
|
19
|
-
const getTransactionStatus_1 = __importDefault(require("../../getTransactionStatus"));
|
|
18
|
+
const fast_check_1 = __importDefault(require("fast-check"));
|
|
20
19
|
const errors_2 = require("../../errors");
|
|
20
|
+
const getTransactionStatus_1 = __importDefault(require("../../getTransactionStatus"));
|
|
21
|
+
const common_fixtures_1 = require("../fixtures/common.fixtures");
|
|
21
22
|
const recipient = "0xe2ca7390e76c5A992749bB622087310d2e63ca29"; // rambo.eth
|
|
22
23
|
const testData = Buffer.from("testBufferString").toString("hex");
|
|
23
24
|
const tokenAccount = (0, common_fixtures_1.makeTokenAccount)("0xkvn", (0, cryptoassets_1.getTokenById)("ethereum/erc20/usd__coin"));
|
|
@@ -53,6 +54,22 @@ const eip1559Tx = {
|
|
|
53
54
|
maxPriorityFeePerGas: new bignumber_js_1.default(100),
|
|
54
55
|
type: 2,
|
|
55
56
|
};
|
|
57
|
+
const erc721Nft = {
|
|
58
|
+
contract: "0xNftContract",
|
|
59
|
+
tokenId: "1",
|
|
60
|
+
amount: new bignumber_js_1.default(1),
|
|
61
|
+
currencyId: account.currency.id,
|
|
62
|
+
id: "doesn't matter",
|
|
63
|
+
standard: "ERC721",
|
|
64
|
+
};
|
|
65
|
+
const erc1155Nft = {
|
|
66
|
+
contract: "0xAnotherNftContract",
|
|
67
|
+
tokenId: "2",
|
|
68
|
+
amount: new bignumber_js_1.default(2),
|
|
69
|
+
currencyId: account.currency.id,
|
|
70
|
+
id: "still doesn't matter",
|
|
71
|
+
standard: "ERC1155",
|
|
72
|
+
};
|
|
56
73
|
const gasOptions = {
|
|
57
74
|
slow: {
|
|
58
75
|
maxFeePerGas: new bignumber_js_1.default(1),
|
|
@@ -88,7 +105,7 @@ describe("EVM Family", () => {
|
|
|
88
105
|
const res = yield (0, getTransactionStatus_1.default)(account, tx);
|
|
89
106
|
expect(res.errors).toEqual(expect.objectContaining({
|
|
90
107
|
recipient: new errors_1.InvalidAddress("", {
|
|
91
|
-
|
|
108
|
+
currencyName: account.currency.name,
|
|
92
109
|
}),
|
|
93
110
|
}));
|
|
94
111
|
}));
|
|
@@ -97,11 +114,11 @@ describe("EVM Family", () => {
|
|
|
97
114
|
const res = yield (0, getTransactionStatus_1.default)(account, tx);
|
|
98
115
|
expect(res.errors).toEqual(expect.objectContaining({
|
|
99
116
|
recipient: new errors_1.InvalidAddress("", {
|
|
100
|
-
|
|
117
|
+
currencyName: account.currency.name,
|
|
101
118
|
}),
|
|
102
119
|
}));
|
|
103
120
|
}));
|
|
104
|
-
it("should detect the recipient not being an EIP55 address and have
|
|
121
|
+
it("should detect the recipient not being an EIP55 address and have a warning", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
105
122
|
const tx = Object.assign(Object.assign({}, eip1559Tx), { recipient: recipient.toLowerCase() });
|
|
106
123
|
const res = yield (0, getTransactionStatus_1.default)(account, tx);
|
|
107
124
|
expect(res.warnings).toEqual(expect.objectContaining({
|
|
@@ -137,133 +154,102 @@ describe("EVM Family", () => {
|
|
|
137
154
|
}));
|
|
138
155
|
});
|
|
139
156
|
describe("Gas", () => {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
const response = yield (0, getTransactionStatus_1.default)(account, Object.assign(Object.assign({}, eip1559Tx), { customGasLimit: eip1559Tx.gasLimit.minus(1) }));
|
|
229
|
-
expect(response.warnings).toEqual(expect.objectContaining({
|
|
230
|
-
gasLimit: new errors_1.GasLessThanEstimate(),
|
|
231
|
-
}));
|
|
232
|
-
}));
|
|
233
|
-
it("should detect maxPriorityFeePerGas being greater than max gasOptions maxPriorityFeePerGas and warn", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
234
|
-
const response = yield (0, getTransactionStatus_1.default)(account, Object.assign(Object.assign({}, eip1559Tx), { gasOptions, maxPriorityFeePerGas: new bignumber_js_1.default(4) }));
|
|
235
|
-
expect(response.warnings).toEqual(expect.objectContaining({
|
|
236
|
-
maxPriorityFee: new errors_1.PriorityFeeTooHigh(),
|
|
237
|
-
}));
|
|
238
|
-
}));
|
|
239
|
-
it("should detect maxPriorityFeePerGas being lower than min gasOptions maxPriorityFeePerGas and warn", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
240
|
-
const response = yield (0, getTransactionStatus_1.default)(account, Object.assign(Object.assign({}, eip1559Tx), { gasOptions, maxPriorityFeePerGas: new bignumber_js_1.default(0.5) }));
|
|
241
|
-
expect(response.warnings).toEqual(expect.objectContaining({
|
|
242
|
-
maxPriorityFee: new errors_1.PriorityFeeTooLow(),
|
|
243
|
-
}));
|
|
244
|
-
}));
|
|
245
|
-
it("should detect maxFeePerGas being lower than recommanded next base fee and warn", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
246
|
-
const response = yield (0, getTransactionStatus_1.default)(account, Object.assign(Object.assign({}, eip1559Tx), { gasOptions, maxFeePerGas: new bignumber_js_1.default(1) }));
|
|
247
|
-
expect(response.warnings).toEqual(expect.objectContaining({
|
|
248
|
-
maxFee: new errors_1.MaxFeeTooLow(),
|
|
249
|
-
}));
|
|
250
|
-
}));
|
|
157
|
+
describe("Common", () => {
|
|
158
|
+
describe.each([
|
|
159
|
+
{ type: "Legacy", defaultTx: legacyTx },
|
|
160
|
+
{ type: "EIP1559", defaultTx: eip1559Tx },
|
|
161
|
+
])("Transaction Type: $type", ({ defaultTx }) => {
|
|
162
|
+
it("should detect missing fees and have an error", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
163
|
+
const tx = Object.assign(Object.assign({}, defaultTx), { gasPrice: undefined, maxFeePerGas: undefined });
|
|
164
|
+
const res = yield (0, getTransactionStatus_1.default)(account, tx);
|
|
165
|
+
expect(res.errors).toEqual(expect.objectContaining({
|
|
166
|
+
gasPrice: new errors_1.FeeNotLoaded(),
|
|
167
|
+
}));
|
|
168
|
+
}));
|
|
169
|
+
it("should detect a gasLimit = 0 and have an error", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
170
|
+
const tx = Object.assign(Object.assign({}, defaultTx), { gasLimit: new bignumber_js_1.default(0) });
|
|
171
|
+
const res = yield (0, getTransactionStatus_1.default)(account, tx);
|
|
172
|
+
expect(res.errors).toEqual(expect.objectContaining({
|
|
173
|
+
gasLimit: new errors_1.FeeNotLoaded(),
|
|
174
|
+
}));
|
|
175
|
+
}));
|
|
176
|
+
it("should detect gas being too high for the account balance and have an error", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
177
|
+
const notEnoughBalanceResponse = yield (0, getTransactionStatus_1.default)(Object.assign(Object.assign({}, account), { balance: new bignumber_js_1.default(2099999) }), defaultTx);
|
|
178
|
+
const enoughBalanceResponse = yield (0, getTransactionStatus_1.default)(Object.assign(Object.assign({}, account), { balance: new bignumber_js_1.default(2100001) }), defaultTx);
|
|
179
|
+
expect(notEnoughBalanceResponse.errors).toEqual(expect.objectContaining({
|
|
180
|
+
gasPrice: new errors_1.NotEnoughGas(),
|
|
181
|
+
}));
|
|
182
|
+
expect(enoughBalanceResponse.errors).not.toEqual(expect.objectContaining({
|
|
183
|
+
gasPrice: new errors_1.NotEnoughGas(),
|
|
184
|
+
}));
|
|
185
|
+
}));
|
|
186
|
+
it("should not detect gas being too high when there is no recipient and have an error", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
187
|
+
const notEnoughBalanceResponse = yield (0, getTransactionStatus_1.default)(Object.assign(Object.assign({}, account), { balance: new bignumber_js_1.default(2099999) }), Object.assign(Object.assign({}, defaultTx), { recipient: "" }));
|
|
188
|
+
const enoughhBalanceResponse = yield (0, getTransactionStatus_1.default)(Object.assign(Object.assign({}, account), { balance: new bignumber_js_1.default(2100001) }), Object.assign(Object.assign({}, defaultTx), { recipient: "" }));
|
|
189
|
+
expect(notEnoughBalanceResponse.errors).not.toEqual(expect.objectContaining({
|
|
190
|
+
gasPrice: new errors_1.NotEnoughGas(),
|
|
191
|
+
}));
|
|
192
|
+
expect(enoughhBalanceResponse.errors).not.toEqual(expect.objectContaining({
|
|
193
|
+
gasPrice: new errors_1.NotEnoughGas(),
|
|
194
|
+
}));
|
|
195
|
+
}));
|
|
196
|
+
it("should detect gas limit being too low in a tx and have an error", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
197
|
+
const tx = Object.assign(Object.assign({}, defaultTx), { gasLimit: new bignumber_js_1.default(20000) }); // min should be 21000
|
|
198
|
+
const res = yield (0, getTransactionStatus_1.default)(account, tx);
|
|
199
|
+
expect(res.errors).toEqual(expect.objectContaining({
|
|
200
|
+
gasLimit: new errors_1.GasLessThanEstimate(),
|
|
201
|
+
}));
|
|
202
|
+
}));
|
|
203
|
+
});
|
|
204
|
+
});
|
|
205
|
+
describe("Specific", () => {
|
|
206
|
+
describe("Transaction Type: EIP1559", () => {
|
|
207
|
+
it("should detect a maxPriorityFee = 0 and have an error", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
208
|
+
const res = yield (0, getTransactionStatus_1.default)(Object.assign(Object.assign({}, account), { balance: new bignumber_js_1.default(2100000) }), Object.assign(Object.assign({}, eip1559Tx), { maxPriorityFeePerGas: new bignumber_js_1.default(0) }));
|
|
209
|
+
expect(res.errors).toEqual(expect.objectContaining({
|
|
210
|
+
maxPriorityFee: new errors_1.PriorityFeeTooLow(),
|
|
211
|
+
}));
|
|
212
|
+
}));
|
|
213
|
+
it("should detect maxFeePerGas being greater than max gasOptions maxFeePerGas and error", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
214
|
+
const response = yield (0, getTransactionStatus_1.default)(account, Object.assign(Object.assign({}, eip1559Tx), { gasOptions, maxFeePerGas: new bignumber_js_1.default(5) }));
|
|
215
|
+
expect(response.errors).toEqual(expect.objectContaining({
|
|
216
|
+
maxPriorityFee: new errors_1.PriorityFeeHigherThanMaxFee(),
|
|
217
|
+
}));
|
|
218
|
+
}));
|
|
219
|
+
it("should detect customGasLimit being lower than gasLimit and warn", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
220
|
+
const response = yield (0, getTransactionStatus_1.default)(account, Object.assign(Object.assign({}, eip1559Tx), { customGasLimit: eip1559Tx.gasLimit.minus(1) }));
|
|
221
|
+
expect(response.warnings).toEqual(expect.objectContaining({
|
|
222
|
+
gasLimit: new errors_1.GasLessThanEstimate(),
|
|
223
|
+
}));
|
|
224
|
+
}));
|
|
225
|
+
it("should detect maxPriorityFeePerGas being greater than max gasOptions maxPriorityFeePerGas and warn", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
226
|
+
const response = yield (0, getTransactionStatus_1.default)(account, Object.assign(Object.assign({}, eip1559Tx), { gasOptions, maxPriorityFeePerGas: new bignumber_js_1.default(4) }));
|
|
227
|
+
expect(response.warnings).toEqual(expect.objectContaining({
|
|
228
|
+
maxPriorityFee: new errors_1.PriorityFeeTooHigh(),
|
|
229
|
+
}));
|
|
230
|
+
}));
|
|
231
|
+
it("should detect maxPriorityFeePerGas being lower than min gasOptions maxPriorityFeePerGas and warn", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
232
|
+
const response = yield (0, getTransactionStatus_1.default)(account, Object.assign(Object.assign({}, eip1559Tx), { gasOptions, maxPriorityFeePerGas: new bignumber_js_1.default(0.5) }));
|
|
233
|
+
expect(response.warnings).toEqual(expect.objectContaining({
|
|
234
|
+
maxPriorityFee: new errors_1.PriorityFeeTooLow(),
|
|
235
|
+
}));
|
|
236
|
+
}));
|
|
237
|
+
it("should detect maxFeePerGas being lower than recommanded next base fee and warn", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
238
|
+
const response = yield (0, getTransactionStatus_1.default)(account, Object.assign(Object.assign({}, eip1559Tx), { gasOptions, maxFeePerGas: new bignumber_js_1.default(1) }));
|
|
239
|
+
expect(response.warnings).toEqual(expect.objectContaining({
|
|
240
|
+
maxFee: new errors_1.MaxFeeTooLow(),
|
|
241
|
+
}));
|
|
242
|
+
}));
|
|
243
|
+
});
|
|
244
|
+
});
|
|
251
245
|
});
|
|
252
246
|
describe("Nft", () => {
|
|
253
247
|
describe("ERC721", () => {
|
|
254
|
-
const nft = {
|
|
255
|
-
contract: "0xNftContract",
|
|
256
|
-
tokenId: "1",
|
|
257
|
-
amount: new bignumber_js_1.default(1),
|
|
258
|
-
currencyId: account.currency.id,
|
|
259
|
-
id: "doesn't matter",
|
|
260
|
-
standard: "ERC721",
|
|
261
|
-
};
|
|
262
248
|
it("should detect a transaction for an ERC721 nft not owned by the account and have an error", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
263
249
|
const tx = Object.assign(Object.assign({}, eip1559Tx), { mode: "erc721", nft: {
|
|
264
250
|
collectionName: "",
|
|
265
|
-
contract:
|
|
266
|
-
tokenId:
|
|
251
|
+
contract: erc721Nft.contract,
|
|
252
|
+
tokenId: erc721Nft.tokenId,
|
|
267
253
|
quantity: new bignumber_js_1.default(1),
|
|
268
254
|
} });
|
|
269
255
|
const res = yield (0, getTransactionStatus_1.default)(account, tx);
|
|
@@ -271,21 +257,26 @@ describe("EVM Family", () => {
|
|
|
271
257
|
amount: new errors_2.NotOwnedNft(),
|
|
272
258
|
}));
|
|
273
259
|
}));
|
|
260
|
+
it("should detect a transaction for an ERC721 nft owned by the account but it does not have enough balance to pay for gas and have an error", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
261
|
+
const tx = Object.assign(Object.assign({}, eip1559Tx), { mode: "erc721", nft: {
|
|
262
|
+
collectionName: "",
|
|
263
|
+
contract: erc721Nft.contract,
|
|
264
|
+
tokenId: erc721Nft.tokenId,
|
|
265
|
+
quantity: new bignumber_js_1.default(1),
|
|
266
|
+
} });
|
|
267
|
+
const res = yield (0, getTransactionStatus_1.default)(Object.assign(Object.assign({}, account), { nfts: [erc721Nft] }), tx);
|
|
268
|
+
expect(res.errors).toEqual(expect.objectContaining({
|
|
269
|
+
amount: new errors_1.NotEnoughBalanceInParentAccount(),
|
|
270
|
+
gasPrice: new errors_1.NotEnoughGas(),
|
|
271
|
+
}));
|
|
272
|
+
}));
|
|
274
273
|
});
|
|
275
274
|
describe("ERC1155", () => {
|
|
276
|
-
const nft = {
|
|
277
|
-
contract: "0xAnotherNftContract",
|
|
278
|
-
tokenId: "2",
|
|
279
|
-
amount: new bignumber_js_1.default(2),
|
|
280
|
-
currencyId: account.currency.id,
|
|
281
|
-
id: "still doesn't matter",
|
|
282
|
-
standard: "ERC1155",
|
|
283
|
-
};
|
|
284
275
|
it("should detect a transaction for an ERC1155 nft not owned by the account and have an error", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
285
276
|
const tx = Object.assign(Object.assign({}, eip1559Tx), { mode: "erc1155", nft: {
|
|
286
277
|
collectionName: "",
|
|
287
|
-
contract:
|
|
288
|
-
tokenId:
|
|
278
|
+
contract: erc1155Nft.contract,
|
|
279
|
+
tokenId: erc1155Nft.tokenId,
|
|
289
280
|
quantity: new bignumber_js_1.default(1),
|
|
290
281
|
} });
|
|
291
282
|
const res = yield (0, getTransactionStatus_1.default)(account, tx);
|
|
@@ -296,11 +287,11 @@ describe("EVM Family", () => {
|
|
|
296
287
|
it("should detect a transaction for an ERC1155 where the quantity is 0 or below and have an error", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
297
288
|
const tx = Object.assign(Object.assign({}, eip1559Tx), { mode: "erc1155", nft: {
|
|
298
289
|
collectionName: "",
|
|
299
|
-
contract:
|
|
300
|
-
tokenId:
|
|
290
|
+
contract: erc1155Nft.contract,
|
|
291
|
+
tokenId: erc1155Nft.tokenId,
|
|
301
292
|
quantity: new bignumber_js_1.default(0),
|
|
302
293
|
} });
|
|
303
|
-
const res = yield (0, getTransactionStatus_1.default)(Object.assign(Object.assign({}, account), { nfts: [
|
|
294
|
+
const res = yield (0, getTransactionStatus_1.default)(Object.assign(Object.assign({}, account), { nfts: [erc1155Nft] }), tx);
|
|
304
295
|
expect(res.errors).toEqual(expect.objectContaining({
|
|
305
296
|
amount: new errors_2.QuantityNeedsToBePositive(),
|
|
306
297
|
}));
|
|
@@ -308,15 +299,197 @@ describe("EVM Family", () => {
|
|
|
308
299
|
it("should detect a transaction for an ERC1155 nft but the account doesn't own enough of it and have an error", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
309
300
|
const tx = Object.assign(Object.assign({}, eip1559Tx), { mode: "erc1155", nft: {
|
|
310
301
|
collectionName: "",
|
|
311
|
-
contract:
|
|
312
|
-
tokenId:
|
|
302
|
+
contract: erc1155Nft.contract,
|
|
303
|
+
tokenId: erc1155Nft.tokenId,
|
|
313
304
|
quantity: new bignumber_js_1.default(3),
|
|
314
305
|
} });
|
|
315
|
-
const res = yield (0, getTransactionStatus_1.default)(Object.assign(Object.assign({}, account), { nfts: [
|
|
306
|
+
const res = yield (0, getTransactionStatus_1.default)(Object.assign(Object.assign({}, account), { nfts: [erc1155Nft] }), tx);
|
|
316
307
|
expect(res.errors).toEqual(expect.objectContaining({
|
|
317
308
|
amount: new errors_2.NotEnoughNftOwned(),
|
|
318
309
|
}));
|
|
319
310
|
}));
|
|
311
|
+
it("should detect a transaction for an ERC1155 nft owned by the account but it does not have enough balance to pay for gas and have an error", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
312
|
+
const tx = Object.assign(Object.assign({}, eip1559Tx), { mode: "erc1155", nft: {
|
|
313
|
+
collectionName: "",
|
|
314
|
+
contract: erc1155Nft.contract,
|
|
315
|
+
tokenId: erc1155Nft.tokenId,
|
|
316
|
+
quantity: new bignumber_js_1.default(1),
|
|
317
|
+
} });
|
|
318
|
+
const res = yield (0, getTransactionStatus_1.default)(Object.assign(Object.assign({}, account), { nfts: [erc1155Nft] }), tx);
|
|
319
|
+
expect(res.errors).toEqual(expect.objectContaining({
|
|
320
|
+
amount: new errors_1.NotEnoughBalanceInParentAccount(),
|
|
321
|
+
gasPrice: new errors_1.NotEnoughGas(),
|
|
322
|
+
}));
|
|
323
|
+
}));
|
|
324
|
+
});
|
|
325
|
+
});
|
|
326
|
+
describe("Fee Ratio", () => {
|
|
327
|
+
/**
|
|
328
|
+
* Helper function to narrow down the type of transaction and set the
|
|
329
|
+
* specific field depending on the type of transaction
|
|
330
|
+
*/
|
|
331
|
+
const specifyTx = ({ tx, specificField, }) => {
|
|
332
|
+
if (tx.type === 2) {
|
|
333
|
+
return Object.assign(Object.assign({}, tx), { maxFeePerGas: new bignumber_js_1.default(specificField) });
|
|
334
|
+
}
|
|
335
|
+
else {
|
|
336
|
+
return Object.assign(Object.assign({}, tx), { gasPrice: new bignumber_js_1.default(specificField) });
|
|
337
|
+
}
|
|
338
|
+
};
|
|
339
|
+
describe.each([
|
|
340
|
+
{ type: "Legacy", defaultTx: legacyTx },
|
|
341
|
+
{ type: "EIP1559", defaultTx: eip1559Tx },
|
|
342
|
+
])("Transaction Type: $type", ({ defaultTx }) => {
|
|
343
|
+
describe("when fees are too high compared to the amount (fees are more than 10% of the amount)", () => {
|
|
344
|
+
it("should have a warning", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
345
|
+
yield fast_check_1.default.assert(fast_check_1.default.asyncProperty(fast_check_1.default
|
|
346
|
+
.record({
|
|
347
|
+
amount: fast_check_1.default.integer({ min: 1 }),
|
|
348
|
+
gasLimit: fast_check_1.default.integer({ min: 1 }),
|
|
349
|
+
specificField: fast_check_1.default.integer({ min: 1 }),
|
|
350
|
+
})
|
|
351
|
+
.filter(({ amount, gasLimit, specificField }) => (0, bignumber_js_1.default)(gasLimit)
|
|
352
|
+
.multipliedBy((0, bignumber_js_1.default)(specificField))
|
|
353
|
+
.times(10)
|
|
354
|
+
.gt((0, bignumber_js_1.default)(amount))), ({ amount, gasLimit, specificField }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
355
|
+
const tx = specifyTx({
|
|
356
|
+
tx: Object.assign(Object.assign({}, defaultTx), { amount: new bignumber_js_1.default(amount), gasLimit: new bignumber_js_1.default(gasLimit), data: undefined }),
|
|
357
|
+
specificField,
|
|
358
|
+
});
|
|
359
|
+
const res = yield (0, getTransactionStatus_1.default)(account, tx);
|
|
360
|
+
expect(res.warnings).toEqual(expect.objectContaining({
|
|
361
|
+
feeTooHigh: new errors_1.FeeTooHigh(),
|
|
362
|
+
}));
|
|
363
|
+
})));
|
|
364
|
+
}));
|
|
365
|
+
/**
|
|
366
|
+
* Note: This is to test the lower bound of the x*y*r=a equation
|
|
367
|
+
* with x = gasPrice, y = gasLimit, a = amount, r = ratio
|
|
368
|
+
* This test would pass for r = 10 but would fail for r = 9
|
|
369
|
+
*/
|
|
370
|
+
it("should have a warning for lower bound", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
371
|
+
const amount = 990;
|
|
372
|
+
const gasLimit = 11;
|
|
373
|
+
const specificField = 10;
|
|
374
|
+
const tx = specifyTx({
|
|
375
|
+
tx: Object.assign(Object.assign({}, defaultTx), { amount: new bignumber_js_1.default(amount), gasLimit: new bignumber_js_1.default(gasLimit), data: undefined }),
|
|
376
|
+
specificField,
|
|
377
|
+
});
|
|
378
|
+
const res = yield (0, getTransactionStatus_1.default)(account, tx);
|
|
379
|
+
expect(res.warnings).toEqual(expect.objectContaining({
|
|
380
|
+
feeTooHigh: new errors_1.FeeTooHigh(),
|
|
381
|
+
}));
|
|
382
|
+
}));
|
|
383
|
+
});
|
|
384
|
+
describe("when fees are not too high compared to the amount (fees are less than or equal to 10% of the amount)", () => {
|
|
385
|
+
it("should not have a warning", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
386
|
+
yield fast_check_1.default.assert(fast_check_1.default.asyncProperty(fast_check_1.default
|
|
387
|
+
.record({
|
|
388
|
+
amount: fast_check_1.default.integer({ min: 1 }),
|
|
389
|
+
gasLimit: fast_check_1.default.integer({ min: 1 }),
|
|
390
|
+
specificField: fast_check_1.default.integer({ min: 1 }),
|
|
391
|
+
})
|
|
392
|
+
.filter(({ amount, specificField, gasLimit }) => (0, bignumber_js_1.default)(specificField)
|
|
393
|
+
.multipliedBy((0, bignumber_js_1.default)(gasLimit))
|
|
394
|
+
.times(10)
|
|
395
|
+
.lt((0, bignumber_js_1.default)(amount))), ({ amount, specificField, gasLimit }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
396
|
+
const tx = specifyTx({
|
|
397
|
+
tx: Object.assign(Object.assign({}, defaultTx), { amount: new bignumber_js_1.default(amount), gasLimit: new bignumber_js_1.default(gasLimit), data: undefined }),
|
|
398
|
+
specificField,
|
|
399
|
+
});
|
|
400
|
+
const res = yield (0, getTransactionStatus_1.default)(account, tx);
|
|
401
|
+
expect(res.warnings).toEqual(expect.not.objectContaining({
|
|
402
|
+
feeTooHigh: new errors_1.FeeTooHigh(),
|
|
403
|
+
}));
|
|
404
|
+
})));
|
|
405
|
+
}));
|
|
406
|
+
/**
|
|
407
|
+
* Note: This is to test the upper bound of the x*y*r=a equation
|
|
408
|
+
* with x = gasPrice, y = gasLimit, a = amount, r = ratio
|
|
409
|
+
* This test would pass for r = 10 but would fail for r = 11
|
|
410
|
+
*/
|
|
411
|
+
it("should not have a warning for upper bound", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
412
|
+
const amount = 100;
|
|
413
|
+
const gasLimit = 1;
|
|
414
|
+
const specificField = 10;
|
|
415
|
+
const tx = specifyTx({
|
|
416
|
+
tx: Object.assign(Object.assign({}, defaultTx), { amount: new bignumber_js_1.default(amount), gasLimit: new bignumber_js_1.default(gasLimit), data: undefined }),
|
|
417
|
+
specificField,
|
|
418
|
+
});
|
|
419
|
+
const res = yield (0, getTransactionStatus_1.default)(account, tx);
|
|
420
|
+
expect(res.warnings).toEqual(expect.not.objectContaining({
|
|
421
|
+
feeTooHigh: new errors_1.FeeTooHigh(),
|
|
422
|
+
}));
|
|
423
|
+
}));
|
|
424
|
+
});
|
|
425
|
+
describe("when tx has data", () => {
|
|
426
|
+
it("should not have a warning", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
427
|
+
const amount = 1;
|
|
428
|
+
const gasLimit = 1;
|
|
429
|
+
const specificField = 1;
|
|
430
|
+
const tx = specifyTx({
|
|
431
|
+
tx: Object.assign(Object.assign({}, defaultTx), { amount: new bignumber_js_1.default(amount), gasLimit: new bignumber_js_1.default(gasLimit) }),
|
|
432
|
+
specificField,
|
|
433
|
+
});
|
|
434
|
+
const res = yield (0, getTransactionStatus_1.default)(account, tx);
|
|
435
|
+
expect(res.warnings).toEqual(expect.not.objectContaining({
|
|
436
|
+
feeTooHigh: new errors_1.FeeTooHigh(),
|
|
437
|
+
}));
|
|
438
|
+
}));
|
|
439
|
+
});
|
|
440
|
+
describe("when tx is nft tx", () => {
|
|
441
|
+
it("should not have a warning for ERC721 NFT", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
442
|
+
const amount = 1;
|
|
443
|
+
const gasLimit = 1;
|
|
444
|
+
const specificField = 1;
|
|
445
|
+
const tx = specifyTx({
|
|
446
|
+
tx: Object.assign(Object.assign({}, defaultTx), { amount: new bignumber_js_1.default(amount), gasLimit: new bignumber_js_1.default(gasLimit), mode: "erc721", nft: {
|
|
447
|
+
collectionName: "",
|
|
448
|
+
contract: erc721Nft.contract,
|
|
449
|
+
tokenId: erc721Nft.tokenId,
|
|
450
|
+
quantity: new bignumber_js_1.default(1),
|
|
451
|
+
} }),
|
|
452
|
+
specificField,
|
|
453
|
+
});
|
|
454
|
+
const res = yield (0, getTransactionStatus_1.default)(account, tx);
|
|
455
|
+
expect(res.warnings).toEqual(expect.not.objectContaining({
|
|
456
|
+
feeTooHigh: new errors_1.FeeTooHigh(),
|
|
457
|
+
}));
|
|
458
|
+
}));
|
|
459
|
+
it("should not have a warning for ERC1155 NFT", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
460
|
+
const amount = 1;
|
|
461
|
+
const gasLimit = 1;
|
|
462
|
+
const specificField = 1;
|
|
463
|
+
const tx = specifyTx({
|
|
464
|
+
tx: Object.assign(Object.assign({}, defaultTx), { amount: new bignumber_js_1.default(amount), gasLimit: new bignumber_js_1.default(gasLimit), mode: "erc1155", nft: {
|
|
465
|
+
collectionName: "",
|
|
466
|
+
contract: erc1155Nft.contract,
|
|
467
|
+
tokenId: erc1155Nft.tokenId,
|
|
468
|
+
quantity: new bignumber_js_1.default(1),
|
|
469
|
+
} }),
|
|
470
|
+
specificField,
|
|
471
|
+
});
|
|
472
|
+
const res = yield (0, getTransactionStatus_1.default)(account, tx);
|
|
473
|
+
expect(res.warnings).toEqual(expect.not.objectContaining({
|
|
474
|
+
feeTooHigh: new errors_1.FeeTooHigh(),
|
|
475
|
+
}));
|
|
476
|
+
}));
|
|
477
|
+
});
|
|
478
|
+
describe("when tx is token tx", () => {
|
|
479
|
+
it("should not have a warning", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
480
|
+
const amount = 1;
|
|
481
|
+
const gasLimit = 1;
|
|
482
|
+
const specificField = 1;
|
|
483
|
+
const tx = specifyTx({
|
|
484
|
+
tx: Object.assign(Object.assign({}, defaultTx), { amount: new bignumber_js_1.default(amount), gasLimit: new bignumber_js_1.default(gasLimit), subAccountId: tokenAccount.id }),
|
|
485
|
+
specificField,
|
|
486
|
+
});
|
|
487
|
+
const res = yield (0, getTransactionStatus_1.default)(account, tx);
|
|
488
|
+
expect(res.warnings).toEqual(expect.not.objectContaining({
|
|
489
|
+
feeTooHigh: new errors_1.FeeTooHigh(),
|
|
490
|
+
}));
|
|
491
|
+
}));
|
|
492
|
+
});
|
|
320
493
|
});
|
|
321
494
|
});
|
|
322
495
|
describe("Global return", () => {
|