@airgap/ethereum 0.13.45-beta.1 → 0.13.45-beta.3
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/package.json +5 -5
- package/v0/index.js +10 -10
- package/v0/index.js.map +1 -1
- package/v0/protocol/BaseEthereumProtocol.d.ts +0 -1
- package/v0/protocol/BaseEthereumProtocol.js +460 -872
- package/v0/protocol/BaseEthereumProtocol.js.map +1 -1
- package/v0/protocol/EthereumAddress.d.ts +0 -1
- package/v0/protocol/EthereumAddress.js +26 -17
- package/v0/protocol/EthereumAddress.js.map +1 -1
- package/v0/protocol/EthereumClassicProtocol.js +6 -23
- package/v0/protocol/EthereumClassicProtocol.js.map +1 -1
- package/v0/protocol/EthereumCryptoClient.js +66 -125
- package/v0/protocol/EthereumCryptoClient.js.map +1 -1
- package/v0/protocol/EthereumProtocol.js +9 -28
- package/v0/protocol/EthereumProtocol.js.map +1 -1
- package/v0/protocol/EthereumProtocolOptions.d.ts +1 -1
- package/v0/protocol/EthereumProtocolOptions.js +36 -117
- package/v0/protocol/EthereumProtocolOptions.js.map +1 -1
- package/v0/protocol/EthereumRopstenProtocol.js +6 -23
- package/v0/protocol/EthereumRopstenProtocol.js.map +1 -1
- package/v0/protocol/clients/info-clients/EtherscanInfoClient.js +86 -186
- package/v0/protocol/clients/info-clients/EtherscanInfoClient.js.map +1 -1
- package/v0/protocol/clients/info-clients/InfoClient.js +3 -4
- package/v0/protocol/clients/info-clients/InfoClient.js.map +1 -1
- package/v0/protocol/clients/node-clients/AirGapNodeClient.js +126 -298
- package/v0/protocol/clients/node-clients/AirGapNodeClient.js.map +1 -1
- package/v0/protocol/clients/node-clients/NodeClient.js +3 -4
- package/v0/protocol/clients/node-clients/NodeClient.js.map +1 -1
- package/v0/protocol/erc20/ERC20.js +4 -4
- package/v0/protocol/erc20/ERC20.js.map +1 -1
- package/v0/protocol/erc20/GenericERC20.js +161 -300
- package/v0/protocol/erc20/GenericERC20.js.map +1 -1
- package/v0/protocol/utils/utils.js +52 -55
- package/v0/protocol/utils/utils.js.map +1 -1
- package/v0/serializer/validators/transaction-validator.js +23 -31
- package/v0/serializer/validators/transaction-validator.js.map +1 -1
- package/v0/serializer/validators/validators.js +25 -73
- package/v0/serializer/validators/validators.js.map +1 -1
- package/v1/block-explorer/EtherscanBlockExplorer.js +12 -61
- package/v1/block-explorer/EtherscanBlockExplorer.js.map +1 -1
- package/v1/clients/crypto/EthereumCryptoClient.js +69 -124
- package/v1/clients/crypto/EthereumCryptoClient.js.map +1 -1
- package/v1/clients/info/EthereumInfoClient.d.ts +1 -1
- package/v1/clients/info/EthereumInfoClient.js +3 -4
- package/v1/clients/info/EthereumInfoClient.js.map +1 -1
- package/v1/clients/info/EtherscanInfoClient.js +84 -162
- package/v1/clients/info/EtherscanInfoClient.js.map +1 -1
- package/v1/clients/node/HttpEthereumNodeClient.d.ts +2 -2
- package/v1/clients/node/HttpEthereumNodeClient.js +164 -375
- package/v1/clients/node/HttpEthereumNodeClient.js.map +1 -1
- package/v1/data/EthereumAddress.js +29 -20
- package/v1/data/EthereumAddress.js.map +1 -1
- package/v1/index.js +14 -14
- package/v1/index.js.map +1 -1
- package/v1/module/EthereumModule.js +43 -112
- package/v1/module/EthereumModule.js.map +1 -1
- package/v1/module.js +2 -3
- package/v1/module.js.map +1 -1
- package/v1/protocol/EthereumBaseProtocol.js +467 -788
- package/v1/protocol/EthereumBaseProtocol.js.map +1 -1
- package/v1/protocol/EthereumProtocol.js +15 -46
- package/v1/protocol/EthereumProtocol.js.map +1 -1
- package/v1/protocol/erc20/ERC20Protocol.js +213 -360
- package/v1/protocol/erc20/ERC20Protocol.js.map +1 -1
- package/v1/protocol/erc20/ERC20Token.d.ts +1 -1
- package/v1/protocol/erc20/ERC20Token.js +35 -113
- package/v1/protocol/erc20/ERC20Token.js.map +1 -1
- package/v1/serializer/v3/schemas/converter/transaction-converter.js +25 -42
- package/v1/serializer/v3/schemas/converter/transaction-converter.js.map +1 -1
- package/v1/serializer/v3/serializer-companion.js +71 -148
- package/v1/serializer/v3/serializer-companion.js.map +1 -1
- package/v1/serializer/v3/validators/transaction-validator.js +14 -17
- package/v1/serializer/v3/validators/transaction-validator.js.map +1 -1
- package/v1/types/crypto.d.ts +1 -1
- package/v1/types/protocol.d.ts +1 -1
- package/v1/types/transaction.d.ts +1 -1
- package/v1/utils/EthereumUtils.js +57 -60
- package/v1/utils/EthereumUtils.js.map +1 -1
- package/v1/utils/key.js +28 -19
- package/v1/utils/key.js.map +1 -1
- package/v1/utils/protocol.js +33 -21
- package/v1/utils/protocol.js.map +1 -1
|
@@ -1,19 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
3
|
if (k2 === undefined) k2 = k;
|
|
19
4
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -30,306 +15,182 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
30
15
|
}) : function(o, v) {
|
|
31
16
|
o["default"] = v;
|
|
32
17
|
});
|
|
33
|
-
var __importStar = (this && this.__importStar) || function (
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
return
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
51
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
52
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
53
|
-
function step(op) {
|
|
54
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
55
|
-
while (_) try {
|
|
56
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
57
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
58
|
-
switch (op[0]) {
|
|
59
|
-
case 0: case 1: t = op; break;
|
|
60
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
61
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
62
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
63
|
-
default:
|
|
64
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
65
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
66
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
67
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
68
|
-
if (t[2]) _.ops.pop();
|
|
69
|
-
_.trys.pop(); continue;
|
|
70
|
-
}
|
|
71
|
-
op = body.call(thisArg, _);
|
|
72
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
73
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
74
|
-
}
|
|
75
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
76
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
77
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
78
37
|
};
|
|
79
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
80
39
|
exports.GenericERC20 = void 0;
|
|
81
|
-
|
|
40
|
+
const bignumber_1 = __importDefault(require("@airgap/coinlib-core/dependencies/src/bignumber.js-9.0.0/bignumber"));
|
|
82
41
|
// @ts-ignore
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
_this.decimals = options.config.decimals;
|
|
104
|
-
return _this;
|
|
42
|
+
const ethUtil = __importStar(require("@airgap/coinlib-core/dependencies/src/ethereumjs-util-5.2.0"));
|
|
43
|
+
const errors_1 = require("@airgap/coinlib-core/errors");
|
|
44
|
+
const coinlib_error_1 = require("@airgap/coinlib-core/errors/coinlib-error");
|
|
45
|
+
const ICoinSubProtocol_1 = require("@airgap/coinlib-core/protocols/ICoinSubProtocol");
|
|
46
|
+
const BaseEthereumProtocol_1 = require("../BaseEthereumProtocol");
|
|
47
|
+
const AirGapNodeClient_1 = require("../clients/node-clients/AirGapNodeClient");
|
|
48
|
+
const utils_1 = require("../utils/utils");
|
|
49
|
+
const EthereumTransaction = require('@airgap/coinlib-core/dependencies/src/ethereumjs-tx-1.3.7/index');
|
|
50
|
+
class GenericERC20 extends BaseEthereumProtocol_1.BaseEthereumProtocol {
|
|
51
|
+
constructor(options) {
|
|
52
|
+
super(options);
|
|
53
|
+
this.options = options;
|
|
54
|
+
this.isSubProtocol = true;
|
|
55
|
+
this.subProtocolType = ICoinSubProtocol_1.SubProtocolType.TOKEN;
|
|
56
|
+
this.contractAddress = options.config.contractAddress;
|
|
57
|
+
this.symbol = options.config.symbol;
|
|
58
|
+
this.name = options.config.name;
|
|
59
|
+
this.marketSymbol = options.config.marketSymbol;
|
|
60
|
+
this.identifier = options.config.identifier;
|
|
61
|
+
this.decimals = options.config.decimals;
|
|
105
62
|
}
|
|
106
|
-
|
|
107
|
-
return
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
};
|
|
127
|
-
GenericERC20.prototype.getBalanceOfPublicKey = function (publicKey) {
|
|
128
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
129
|
-
var address;
|
|
130
|
-
return __generator(this, function (_a) {
|
|
131
|
-
switch (_a.label) {
|
|
132
|
-
case 0: return [4 /*yield*/, this.getAddressFromPublicKey(publicKey)];
|
|
133
|
-
case 1:
|
|
134
|
-
address = _a.sent();
|
|
135
|
-
return [2 /*return*/, this.getBalanceOfAddresses([address.address])];
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
});
|
|
139
|
-
};
|
|
140
|
-
GenericERC20.prototype.getBalanceOfAddresses = function (addresses) {
|
|
141
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
142
|
-
var balances;
|
|
143
|
-
var _this = this;
|
|
144
|
-
return __generator(this, function (_a) {
|
|
145
|
-
switch (_a.label) {
|
|
146
|
-
case 0: return [4 /*yield*/, Promise.all(addresses.map(function (address) {
|
|
147
|
-
return _this.options.nodeClient.callBalanceOf(_this.contractAddress, address);
|
|
148
|
-
}))];
|
|
149
|
-
case 1:
|
|
150
|
-
balances = _a.sent();
|
|
151
|
-
return [2 /*return*/, balances.reduce(function (a, b) { return a.plus(b); }).toString(10)];
|
|
152
|
-
}
|
|
153
|
-
});
|
|
154
|
-
});
|
|
155
|
-
};
|
|
156
|
-
GenericERC20.prototype.signWithPrivateKey = function (privateKey, transaction) {
|
|
63
|
+
async getIsSubProtocol() {
|
|
64
|
+
return this.isSubProtocol;
|
|
65
|
+
}
|
|
66
|
+
async getSubProtocolType() {
|
|
67
|
+
return this.subProtocolType;
|
|
68
|
+
}
|
|
69
|
+
async getContractAddress() {
|
|
70
|
+
return this.contractAddress;
|
|
71
|
+
}
|
|
72
|
+
async getBalanceOfPublicKey(publicKey) {
|
|
73
|
+
const address = await this.getAddressFromPublicKey(publicKey);
|
|
74
|
+
return this.getBalanceOfAddresses([address.address]);
|
|
75
|
+
}
|
|
76
|
+
async getBalanceOfAddresses(addresses) {
|
|
77
|
+
const balances = await Promise.all(addresses.map((address) => {
|
|
78
|
+
return this.options.nodeClient.callBalanceOf(this.contractAddress, address);
|
|
79
|
+
}));
|
|
80
|
+
return balances.reduce((a, b) => a.plus(b)).toString(10);
|
|
81
|
+
}
|
|
82
|
+
signWithPrivateKey(privateKey, transaction) {
|
|
157
83
|
if (!transaction.data || transaction.data === '0x') {
|
|
158
84
|
transaction.data = new AirGapNodeClient_1.EthereumRPCDataTransfer(transaction.to, transaction.value).abiEncoded(); // backwards-compatible fix
|
|
159
85
|
}
|
|
160
|
-
return
|
|
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
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
case 1:
|
|
234
|
-
balance = new (_a.apply(bignumber_1.default, [void 0, _c.sent()]))();
|
|
235
|
-
if (!balance.isGreaterThanOrEqualTo(wrappedValues[0])) return [3 /*break*/, 8];
|
|
236
|
-
return [4 /*yield*/, this.getAddressFromPublicKey(publicKey).then(function (address) { return address.address; })];
|
|
237
|
-
case 2:
|
|
238
|
-
address = _c.sent();
|
|
239
|
-
_b = bignumber_1.default.bind;
|
|
240
|
-
return [4 /*yield*/, _super.prototype.getBalanceOfAddresses.call(this, [address])];
|
|
241
|
-
case 3:
|
|
242
|
-
ethBalance = new (_b.apply(bignumber_1.default, [void 0, _c.sent()]))();
|
|
243
|
-
return [4 /*yield*/, this.estimateGas(address, recipients[0], utils_1.EthereumUtils.toHex(wrappedValues[0].toFixed()))];
|
|
244
|
-
case 4:
|
|
245
|
-
estimatedGas = _c.sent();
|
|
246
|
-
if (!ethBalance.isGreaterThanOrEqualTo(wrappedFee)) return [3 /*break*/, 6];
|
|
247
|
-
return [4 /*yield*/, this.options.nodeClient.fetchTransactionCount(address)];
|
|
248
|
-
case 5:
|
|
249
|
-
txCount = _c.sent();
|
|
250
|
-
gasPrice = wrappedFee.isEqualTo(0)
|
|
251
|
-
? new bignumber_1.default(0)
|
|
252
|
-
: wrappedFee.div(estimatedGas).integerValue(bignumber_1.default.ROUND_CEIL);
|
|
253
|
-
transaction = {
|
|
254
|
-
nonce: utils_1.EthereumUtils.toHex(txCount),
|
|
255
|
-
gasLimit: utils_1.EthereumUtils.toHex(estimatedGas.toFixed()),
|
|
256
|
-
gasPrice: utils_1.EthereumUtils.toHex(gasPrice.toFixed()),
|
|
257
|
-
to: this.contractAddress,
|
|
258
|
-
value: utils_1.EthereumUtils.toHex(new bignumber_1.default(0).toFixed()),
|
|
259
|
-
chainId: this.options.network.extras.chainID,
|
|
260
|
-
data: new AirGapNodeClient_1.EthereumRPCDataTransfer(recipients[0], utils_1.EthereumUtils.toHex(wrappedValues[0].toFixed())).abiEncoded()
|
|
261
|
-
};
|
|
262
|
-
return [2 /*return*/, transaction];
|
|
263
|
-
case 6: throw new errors_1.BalanceError(coinlib_error_1.Domain.ERC20, 'not enough ETH balance');
|
|
264
|
-
case 7: return [3 /*break*/, 9];
|
|
265
|
-
case 8: throw new errors_1.BalanceError(coinlib_error_1.Domain.ERC20, 'not enough token balance');
|
|
266
|
-
case 9: return [2 /*return*/];
|
|
267
|
-
}
|
|
268
|
-
});
|
|
269
|
-
});
|
|
270
|
-
};
|
|
271
|
-
GenericERC20.prototype.getTransactionsFromAddresses = function (addresses, limit, cursor) {
|
|
272
|
-
var _this = this;
|
|
273
|
-
return new Promise(function (overallResolve, overallReject) {
|
|
274
|
-
var promises = [];
|
|
275
|
-
for (var _i = 0, addresses_1 = addresses; _i < addresses_1.length; _i++) {
|
|
276
|
-
var address = addresses_1[_i];
|
|
277
|
-
promises.push(_this.options.infoClient.fetchContractTransactions(_this, _this.contractAddress, address, limit, cursor));
|
|
86
|
+
return super.signWithPrivateKey(privateKey, transaction);
|
|
87
|
+
}
|
|
88
|
+
async estimateGas(source, recipient, hexValue) {
|
|
89
|
+
const result = await this.options.nodeClient.estimateTransferGas(this.contractAddress, source, recipient, hexValue);
|
|
90
|
+
return result;
|
|
91
|
+
}
|
|
92
|
+
async estimateMaxTransactionValueFromPublicKey(publicKey, recipients, fee) {
|
|
93
|
+
return this.getBalanceOfPublicKey(publicKey);
|
|
94
|
+
}
|
|
95
|
+
async estimateFeeDefaultsFromPublicKey(publicKey, recipients, values, data) {
|
|
96
|
+
if (recipients.length !== values.length) {
|
|
97
|
+
return Promise.reject('recipients length does not match with values');
|
|
98
|
+
}
|
|
99
|
+
if (recipients.length !== 1) {
|
|
100
|
+
return Promise.reject('you cannot have 0 recipients');
|
|
101
|
+
}
|
|
102
|
+
const address = (await this.getAddressFromPublicKey(publicKey)).address;
|
|
103
|
+
const estimatedGas = await this.estimateGas(address, recipients[0], utils_1.EthereumUtils.toHex(values[0]));
|
|
104
|
+
const gasPrise = await this.options.nodeClient.getGasPrice();
|
|
105
|
+
const feeStepFactor = new bignumber_1.default(0.5);
|
|
106
|
+
const estimatedFee = estimatedGas.times(gasPrise);
|
|
107
|
+
const lowFee = estimatedFee.minus(estimatedFee.times(feeStepFactor).integerValue(bignumber_1.default.ROUND_FLOOR));
|
|
108
|
+
const mediumFee = estimatedFee;
|
|
109
|
+
const highFee = mediumFee.plus(mediumFee.times(feeStepFactor).integerValue(bignumber_1.default.ROUND_FLOOR));
|
|
110
|
+
return {
|
|
111
|
+
low: lowFee.shiftedBy(-this.feeDecimals).toFixed(),
|
|
112
|
+
medium: mediumFee.shiftedBy(-this.feeDecimals).toFixed(),
|
|
113
|
+
high: highFee.shiftedBy(-this.feeDecimals).toFixed()
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
async prepareTransactionFromPublicKey(publicKey, recipients, values, fee) {
|
|
117
|
+
const wrappedValues = values.map((value) => new bignumber_1.default(value));
|
|
118
|
+
const wrappedFee = new bignumber_1.default(fee);
|
|
119
|
+
if (recipients.length !== wrappedValues.length) {
|
|
120
|
+
throw new errors_1.ConditionViolationError(coinlib_error_1.Domain.ERC20, 'recipients length does not match with values');
|
|
121
|
+
}
|
|
122
|
+
if (recipients.length !== 1) {
|
|
123
|
+
throw new errors_1.ConditionViolationError(coinlib_error_1.Domain.ERC20, 'you cannot have 0 recipients');
|
|
124
|
+
}
|
|
125
|
+
const balance = new bignumber_1.default(await this.getBalanceOfPublicKey(publicKey));
|
|
126
|
+
if (balance.isGreaterThanOrEqualTo(wrappedValues[0])) {
|
|
127
|
+
const address = await this.getAddressFromPublicKey(publicKey).then((address) => address.address);
|
|
128
|
+
const ethBalance = new bignumber_1.default(await super.getBalanceOfAddresses([address]));
|
|
129
|
+
const estimatedGas = await this.estimateGas(address, recipients[0], utils_1.EthereumUtils.toHex(wrappedValues[0].toFixed()));
|
|
130
|
+
if (ethBalance.isGreaterThanOrEqualTo(wrappedFee)) {
|
|
131
|
+
const txCount = await this.options.nodeClient.fetchTransactionCount(address);
|
|
132
|
+
const gasPrice = wrappedFee.isEqualTo(0)
|
|
133
|
+
? new bignumber_1.default(0)
|
|
134
|
+
: wrappedFee.div(estimatedGas).integerValue(bignumber_1.default.ROUND_CEIL);
|
|
135
|
+
const transaction = {
|
|
136
|
+
nonce: utils_1.EthereumUtils.toHex(txCount),
|
|
137
|
+
gasLimit: utils_1.EthereumUtils.toHex(estimatedGas.toFixed()),
|
|
138
|
+
gasPrice: utils_1.EthereumUtils.toHex(gasPrice.toFixed()),
|
|
139
|
+
to: this.contractAddress,
|
|
140
|
+
value: utils_1.EthereumUtils.toHex(new bignumber_1.default(0).toFixed()),
|
|
141
|
+
chainId: this.options.network.extras.chainID,
|
|
142
|
+
data: new AirGapNodeClient_1.EthereumRPCDataTransfer(recipients[0], utils_1.EthereumUtils.toHex(wrappedValues[0].toFixed())).abiEncoded()
|
|
143
|
+
};
|
|
144
|
+
return transaction;
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
throw new errors_1.BalanceError(coinlib_error_1.Domain.ERC20, 'not enough ETH balance');
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
throw new errors_1.BalanceError(coinlib_error_1.Domain.ERC20, 'not enough token balance');
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
getTransactionsFromAddresses(addresses, limit, cursor) {
|
|
155
|
+
return new Promise((overallResolve, overallReject) => {
|
|
156
|
+
const promises = [];
|
|
157
|
+
for (const address of addresses) {
|
|
158
|
+
promises.push(this.options.infoClient.fetchContractTransactions(this, this.contractAddress, address, limit, cursor));
|
|
278
159
|
}
|
|
279
160
|
Promise.all(promises)
|
|
280
|
-
.then(
|
|
281
|
-
|
|
282
|
-
overallResolve(values.reduce(
|
|
283
|
-
return { transactions: a.transactions.concat(b.transactions), cursor: { page
|
|
161
|
+
.then((values) => {
|
|
162
|
+
const page = Math.max(...values.map((txResult) => txResult.cursor.page));
|
|
163
|
+
overallResolve(values.reduce((a, b) => {
|
|
164
|
+
return { transactions: a.transactions.concat(b.transactions), cursor: { page } };
|
|
284
165
|
}));
|
|
285
166
|
})
|
|
286
167
|
.catch(overallReject);
|
|
287
168
|
});
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
return
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
switch (_a.label) {
|
|
315
|
-
case 0:
|
|
316
|
-
unsignedEthereumTx = unsignedTx;
|
|
317
|
-
return [4 /*yield*/, _super.prototype.getTransactionDetails.call(this, unsignedEthereumTx)];
|
|
318
|
-
case 1:
|
|
319
|
-
ethTxs = _a.sent();
|
|
320
|
-
if (ethTxs.length !== 1) {
|
|
321
|
-
throw new errors_1.ConditionViolationError(coinlib_error_1.Domain.ERC20, 'More than one ETH transaction detected.');
|
|
322
|
-
}
|
|
323
|
-
ethTx = ethTxs[0];
|
|
324
|
-
tokenTransferDetails = new AirGapNodeClient_1.EthereumRPCDataTransfer(unsignedEthereumTx.transaction.data);
|
|
325
|
-
ethTx.to = [ethUtil.toChecksumAddress(tokenTransferDetails.recipient)];
|
|
326
|
-
ethTx.amount = new bignumber_1.default(tokenTransferDetails.amount).toString(10);
|
|
327
|
-
return [2 /*return*/, [ethTx]];
|
|
328
|
-
}
|
|
329
|
-
});
|
|
330
|
-
});
|
|
331
|
-
};
|
|
332
|
-
return GenericERC20;
|
|
333
|
-
}(BaseEthereumProtocol_1.BaseEthereumProtocol));
|
|
169
|
+
}
|
|
170
|
+
async getTransactionDetailsFromSigned(signedTx) {
|
|
171
|
+
const ethTxs = await super.getTransactionDetailsFromSigned(signedTx);
|
|
172
|
+
if (ethTxs.length !== 1) {
|
|
173
|
+
throw new errors_1.ConditionViolationError(coinlib_error_1.Domain.ERC20, 'More than one ETH transaction detected.');
|
|
174
|
+
}
|
|
175
|
+
const ethTx = ethTxs[0];
|
|
176
|
+
const extractedTx = new EthereumTransaction(signedTx.transaction);
|
|
177
|
+
const tokenTransferDetails = new AirGapNodeClient_1.EthereumRPCDataTransfer(`0x${extractedTx.data.toString('hex')}`);
|
|
178
|
+
ethTx.to = [ethUtil.toChecksumAddress(tokenTransferDetails.recipient)];
|
|
179
|
+
ethTx.amount = new bignumber_1.default(tokenTransferDetails.amount).toString(10);
|
|
180
|
+
return [ethTx];
|
|
181
|
+
}
|
|
182
|
+
async getTransactionDetails(unsignedTx) {
|
|
183
|
+
const unsignedEthereumTx = unsignedTx;
|
|
184
|
+
const ethTxs = await super.getTransactionDetails(unsignedEthereumTx);
|
|
185
|
+
if (ethTxs.length !== 1) {
|
|
186
|
+
throw new errors_1.ConditionViolationError(coinlib_error_1.Domain.ERC20, 'More than one ETH transaction detected.');
|
|
187
|
+
}
|
|
188
|
+
const ethTx = ethTxs[0];
|
|
189
|
+
const tokenTransferDetails = new AirGapNodeClient_1.EthereumRPCDataTransfer(unsignedEthereumTx.transaction.data);
|
|
190
|
+
ethTx.to = [ethUtil.toChecksumAddress(tokenTransferDetails.recipient)];
|
|
191
|
+
ethTx.amount = new bignumber_1.default(tokenTransferDetails.amount).toString(10);
|
|
192
|
+
return [ethTx];
|
|
193
|
+
}
|
|
194
|
+
}
|
|
334
195
|
exports.GenericERC20 = GenericERC20;
|
|
335
196
|
//# sourceMappingURL=GenericERC20.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenericERC20.js","sourceRoot":"","sources":["../../../../src/v0/protocol/erc20/GenericERC20.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GenericERC20.js","sourceRoot":"","sources":["../../../../src/v0/protocol/erc20/GenericERC20.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,mHAA0F;AAC1F,aAAa;AACb,qGAAsF;AACtF,wDAAmF;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