@airgap/ethereum 0.13.45-beta.3 → 0.13.45-beta.5
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 +1 -0
- package/v0/protocol/BaseEthereumProtocol.js +872 -460
- package/v0/protocol/BaseEthereumProtocol.js.map +1 -1
- package/v0/protocol/EthereumAddress.d.ts +1 -0
- package/v0/protocol/EthereumAddress.js +17 -26
- package/v0/protocol/EthereumAddress.js.map +1 -1
- package/v0/protocol/EthereumClassicProtocol.js +23 -6
- package/v0/protocol/EthereumClassicProtocol.js.map +1 -1
- package/v0/protocol/EthereumCryptoClient.js +125 -66
- package/v0/protocol/EthereumCryptoClient.js.map +1 -1
- package/v0/protocol/EthereumProtocol.js +28 -9
- package/v0/protocol/EthereumProtocol.js.map +1 -1
- package/v0/protocol/EthereumProtocolOptions.d.ts +1 -1
- package/v0/protocol/EthereumProtocolOptions.js +117 -36
- package/v0/protocol/EthereumProtocolOptions.js.map +1 -1
- package/v0/protocol/EthereumRopstenProtocol.js +23 -6
- package/v0/protocol/EthereumRopstenProtocol.js.map +1 -1
- package/v0/protocol/clients/info-clients/EtherscanInfoClient.js +186 -86
- package/v0/protocol/clients/info-clients/EtherscanInfoClient.js.map +1 -1
- package/v0/protocol/clients/info-clients/InfoClient.js +4 -3
- package/v0/protocol/clients/info-clients/InfoClient.js.map +1 -1
- package/v0/protocol/clients/node-clients/AirGapNodeClient.js +298 -126
- package/v0/protocol/clients/node-clients/AirGapNodeClient.js.map +1 -1
- package/v0/protocol/clients/node-clients/NodeClient.js +4 -3
- 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 +300 -161
- package/v0/protocol/erc20/GenericERC20.js.map +1 -1
- package/v0/protocol/utils/utils.js +55 -52
- package/v0/protocol/utils/utils.js.map +1 -1
- package/v0/serializer/validators/transaction-validator.js +31 -23
- package/v0/serializer/validators/transaction-validator.js.map +1 -1
- package/v0/serializer/validators/validators.js +73 -25
- package/v0/serializer/validators/validators.js.map +1 -1
- package/v1/block-explorer/EtherscanBlockExplorer.js +61 -12
- package/v1/block-explorer/EtherscanBlockExplorer.js.map +1 -1
- package/v1/clients/crypto/EthereumCryptoClient.js +124 -69
- package/v1/clients/crypto/EthereumCryptoClient.js.map +1 -1
- package/v1/clients/info/EthereumInfoClient.d.ts +1 -1
- package/v1/clients/info/EthereumInfoClient.js +4 -3
- package/v1/clients/info/EthereumInfoClient.js.map +1 -1
- package/v1/clients/info/EtherscanInfoClient.js +162 -84
- package/v1/clients/info/EtherscanInfoClient.js.map +1 -1
- package/v1/clients/node/HttpEthereumNodeClient.d.ts +2 -2
- package/v1/clients/node/HttpEthereumNodeClient.js +375 -164
- package/v1/clients/node/HttpEthereumNodeClient.js.map +1 -1
- package/v1/data/EthereumAddress.js +20 -29
- 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 +112 -43
- package/v1/module/EthereumModule.js.map +1 -1
- package/v1/module.js +3 -2
- package/v1/module.js.map +1 -1
- package/v1/protocol/EthereumBaseProtocol.js +788 -467
- package/v1/protocol/EthereumBaseProtocol.js.map +1 -1
- package/v1/protocol/EthereumProtocol.js +46 -15
- package/v1/protocol/EthereumProtocol.js.map +1 -1
- package/v1/protocol/erc20/ERC20Protocol.js +360 -213
- package/v1/protocol/erc20/ERC20Protocol.js.map +1 -1
- package/v1/protocol/erc20/ERC20Token.d.ts +1 -1
- package/v1/protocol/erc20/ERC20Token.js +113 -35
- package/v1/protocol/erc20/ERC20Token.js.map +1 -1
- package/v1/serializer/v3/schemas/converter/transaction-converter.js +42 -25
- package/v1/serializer/v3/schemas/converter/transaction-converter.js.map +1 -1
- package/v1/serializer/v3/serializer-companion.js +148 -71
- package/v1/serializer/v3/serializer-companion.js.map +1 -1
- package/v1/serializer/v3/validators/transaction-validator.js +17 -14
- 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 +60 -57
- package/v1/utils/EthereumUtils.js.map +1 -1
- package/v1/utils/key.js +19 -28
- package/v1/utils/key.js.map +1 -1
- package/v1/utils/protocol.js +21 -33
- package/v1/utils/protocol.js.map +1 -1
|
@@ -1,4 +1,19 @@
|
|
|
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
|
+
})();
|
|
2
17
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
18
|
if (k2 === undefined) k2 = k;
|
|
4
19
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -15,182 +30,306 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
30
|
}) : function(o, v) {
|
|
16
31
|
o["default"] = v;
|
|
17
32
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) ||
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
};
|
|
27
|
-
return function (
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
41
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
42
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
43
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
44
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
45
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
46
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
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
|
+
};
|
|
35
76
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
77
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
78
|
};
|
|
38
79
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
80
|
exports.GenericERC20 = void 0;
|
|
40
|
-
|
|
81
|
+
var bignumber_1 = __importDefault(require("@airgap/coinlib-core/dependencies/src/bignumber.js-9.0.0/bignumber"));
|
|
41
82
|
// @ts-ignore
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
this
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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]);
|
|
83
|
+
var ethUtil = __importStar(require("@airgap/coinlib-core/dependencies/src/ethereumjs-util-5.2.0"));
|
|
84
|
+
var errors_1 = require("@airgap/coinlib-core/errors");
|
|
85
|
+
var coinlib_error_1 = require("@airgap/coinlib-core/errors/coinlib-error");
|
|
86
|
+
var ICoinSubProtocol_1 = require("@airgap/coinlib-core/protocols/ICoinSubProtocol");
|
|
87
|
+
var BaseEthereumProtocol_1 = require("../BaseEthereumProtocol");
|
|
88
|
+
var AirGapNodeClient_1 = require("../clients/node-clients/AirGapNodeClient");
|
|
89
|
+
var utils_1 = require("../utils/utils");
|
|
90
|
+
var EthereumTransaction = require('@airgap/coinlib-core/dependencies/src/ethereumjs-tx-1.3.7/index');
|
|
91
|
+
var GenericERC20 = /** @class */ (function (_super) {
|
|
92
|
+
__extends(GenericERC20, _super);
|
|
93
|
+
function GenericERC20(options) {
|
|
94
|
+
var _this = _super.call(this, options) || this;
|
|
95
|
+
_this.options = options;
|
|
96
|
+
_this.isSubProtocol = true;
|
|
97
|
+
_this.subProtocolType = ICoinSubProtocol_1.SubProtocolType.TOKEN;
|
|
98
|
+
_this.contractAddress = options.config.contractAddress;
|
|
99
|
+
_this.symbol = options.config.symbol;
|
|
100
|
+
_this.name = options.config.name;
|
|
101
|
+
_this.marketSymbol = options.config.marketSymbol;
|
|
102
|
+
_this.identifier = options.config.identifier;
|
|
103
|
+
_this.decimals = options.config.decimals;
|
|
104
|
+
return _this;
|
|
75
105
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
return
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
106
|
+
GenericERC20.prototype.getIsSubProtocol = function () {
|
|
107
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
108
|
+
return __generator(this, function (_a) {
|
|
109
|
+
return [2 /*return*/, this.isSubProtocol];
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
GenericERC20.prototype.getSubProtocolType = function () {
|
|
114
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
115
|
+
return __generator(this, function (_a) {
|
|
116
|
+
return [2 /*return*/, this.subProtocolType];
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
GenericERC20.prototype.getContractAddress = function () {
|
|
121
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
122
|
+
return __generator(this, function (_a) {
|
|
123
|
+
return [2 /*return*/, this.contractAddress];
|
|
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) {
|
|
83
157
|
if (!transaction.data || transaction.data === '0x') {
|
|
84
158
|
transaction.data = new AirGapNodeClient_1.EthereumRPCDataTransfer(transaction.to, transaction.value).abiEncoded(); // backwards-compatible fix
|
|
85
159
|
}
|
|
86
|
-
return
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
160
|
+
return _super.prototype.signWithPrivateKey.call(this, privateKey, transaction);
|
|
161
|
+
};
|
|
162
|
+
GenericERC20.prototype.estimateGas = function (source, recipient, hexValue) {
|
|
163
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
164
|
+
var result;
|
|
165
|
+
return __generator(this, function (_a) {
|
|
166
|
+
switch (_a.label) {
|
|
167
|
+
case 0: return [4 /*yield*/, this.options.nodeClient.estimateTransferGas(this.contractAddress, source, recipient, hexValue)];
|
|
168
|
+
case 1:
|
|
169
|
+
result = _a.sent();
|
|
170
|
+
return [2 /*return*/, result];
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
};
|
|
175
|
+
GenericERC20.prototype.estimateMaxTransactionValueFromPublicKey = function (publicKey, recipients, fee) {
|
|
176
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
177
|
+
return __generator(this, function (_a) {
|
|
178
|
+
return [2 /*return*/, this.getBalanceOfPublicKey(publicKey)];
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
};
|
|
182
|
+
GenericERC20.prototype.estimateFeeDefaultsFromPublicKey = function (publicKey, recipients, values, data) {
|
|
183
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
184
|
+
var address, estimatedGas, gasPrise, feeStepFactor, estimatedFee, lowFee, mediumFee, highFee;
|
|
185
|
+
return __generator(this, function (_a) {
|
|
186
|
+
switch (_a.label) {
|
|
187
|
+
case 0:
|
|
188
|
+
if (recipients.length !== values.length) {
|
|
189
|
+
return [2 /*return*/, Promise.reject('recipients length does not match with values')];
|
|
190
|
+
}
|
|
191
|
+
if (recipients.length !== 1) {
|
|
192
|
+
return [2 /*return*/, Promise.reject('you cannot have 0 recipients')];
|
|
193
|
+
}
|
|
194
|
+
return [4 /*yield*/, this.getAddressFromPublicKey(publicKey)];
|
|
195
|
+
case 1:
|
|
196
|
+
address = (_a.sent()).address;
|
|
197
|
+
return [4 /*yield*/, this.estimateGas(address, recipients[0], utils_1.EthereumUtils.toHex(values[0]))];
|
|
198
|
+
case 2:
|
|
199
|
+
estimatedGas = _a.sent();
|
|
200
|
+
return [4 /*yield*/, this.options.nodeClient.getGasPrice()];
|
|
201
|
+
case 3:
|
|
202
|
+
gasPrise = _a.sent();
|
|
203
|
+
feeStepFactor = new bignumber_1.default(0.5);
|
|
204
|
+
estimatedFee = estimatedGas.times(gasPrise);
|
|
205
|
+
lowFee = estimatedFee.minus(estimatedFee.times(feeStepFactor).integerValue(bignumber_1.default.ROUND_FLOOR));
|
|
206
|
+
mediumFee = estimatedFee;
|
|
207
|
+
highFee = mediumFee.plus(mediumFee.times(feeStepFactor).integerValue(bignumber_1.default.ROUND_FLOOR));
|
|
208
|
+
return [2 /*return*/, {
|
|
209
|
+
low: lowFee.shiftedBy(-this.feeDecimals).toFixed(),
|
|
210
|
+
medium: mediumFee.shiftedBy(-this.feeDecimals).toFixed(),
|
|
211
|
+
high: highFee.shiftedBy(-this.feeDecimals).toFixed()
|
|
212
|
+
}];
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
});
|
|
216
|
+
};
|
|
217
|
+
GenericERC20.prototype.prepareTransactionFromPublicKey = function (publicKey, recipients, values, fee) {
|
|
218
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
219
|
+
var wrappedValues, wrappedFee, balance, _a, address, ethBalance, _b, estimatedGas, txCount, gasPrice, transaction;
|
|
220
|
+
return __generator(this, function (_c) {
|
|
221
|
+
switch (_c.label) {
|
|
222
|
+
case 0:
|
|
223
|
+
wrappedValues = values.map(function (value) { return new bignumber_1.default(value); });
|
|
224
|
+
wrappedFee = new bignumber_1.default(fee);
|
|
225
|
+
if (recipients.length !== wrappedValues.length) {
|
|
226
|
+
throw new errors_1.ConditionViolationError(coinlib_error_1.Domain.ERC20, 'recipients length does not match with values');
|
|
227
|
+
}
|
|
228
|
+
if (recipients.length !== 1) {
|
|
229
|
+
throw new errors_1.ConditionViolationError(coinlib_error_1.Domain.ERC20, 'you cannot have 0 recipients');
|
|
230
|
+
}
|
|
231
|
+
_a = bignumber_1.default.bind;
|
|
232
|
+
return [4 /*yield*/, this.getBalanceOfPublicKey(publicKey)];
|
|
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));
|
|
159
278
|
}
|
|
160
279
|
Promise.all(promises)
|
|
161
|
-
.then((values)
|
|
162
|
-
|
|
163
|
-
overallResolve(values.reduce((a, b)
|
|
164
|
-
return { transactions: a.transactions.concat(b.transactions), cursor: { page } };
|
|
280
|
+
.then(function (values) {
|
|
281
|
+
var page = Math.max.apply(Math, values.map(function (txResult) { return txResult.cursor.page; }));
|
|
282
|
+
overallResolve(values.reduce(function (a, b) {
|
|
283
|
+
return { transactions: a.transactions.concat(b.transactions), cursor: { page: page } };
|
|
165
284
|
}));
|
|
166
285
|
})
|
|
167
286
|
.catch(overallReject);
|
|
168
287
|
});
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
return
|
|
193
|
-
|
|
194
|
-
|
|
288
|
+
};
|
|
289
|
+
GenericERC20.prototype.getTransactionDetailsFromSigned = function (signedTx) {
|
|
290
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
291
|
+
var ethTxs, ethTx, extractedTx, tokenTransferDetails;
|
|
292
|
+
return __generator(this, function (_a) {
|
|
293
|
+
switch (_a.label) {
|
|
294
|
+
case 0: return [4 /*yield*/, _super.prototype.getTransactionDetailsFromSigned.call(this, signedTx)];
|
|
295
|
+
case 1:
|
|
296
|
+
ethTxs = _a.sent();
|
|
297
|
+
if (ethTxs.length !== 1) {
|
|
298
|
+
throw new errors_1.ConditionViolationError(coinlib_error_1.Domain.ERC20, 'More than one ETH transaction detected.');
|
|
299
|
+
}
|
|
300
|
+
ethTx = ethTxs[0];
|
|
301
|
+
extractedTx = new EthereumTransaction(signedTx.transaction);
|
|
302
|
+
tokenTransferDetails = new AirGapNodeClient_1.EthereumRPCDataTransfer("0x".concat(extractedTx.data.toString('hex')));
|
|
303
|
+
ethTx.to = [ethUtil.toChecksumAddress(tokenTransferDetails.recipient)];
|
|
304
|
+
ethTx.amount = new bignumber_1.default(tokenTransferDetails.amount).toString(10);
|
|
305
|
+
return [2 /*return*/, [ethTx]];
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
});
|
|
309
|
+
};
|
|
310
|
+
GenericERC20.prototype.getTransactionDetails = function (unsignedTx) {
|
|
311
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
312
|
+
var unsignedEthereumTx, ethTxs, ethTx, tokenTransferDetails;
|
|
313
|
+
return __generator(this, function (_a) {
|
|
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));
|
|
195
334
|
exports.GenericERC20 = GenericERC20;
|
|
196
335
|
//# 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,iHAA0F;AAC1F,aAAa;AACb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