@airgap/ethereum 0.13.21-beta.7 → 0.13.21
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 +7 -7
- package/v1/clients/crypto/EthereumCryptoClient.d.ts +7 -0
- package/v1/clients/crypto/EthereumCryptoClient.js +147 -0
- package/v1/clients/crypto/EthereumCryptoClient.js.map +1 -0
- package/v1/clients/info/EthereumInfoClient.d.ts +9 -7
- package/v1/clients/info/EthereumInfoClient.js.map +1 -1
- package/v1/clients/info/EtherscanInfoClient.d.ts +2 -1
- package/v1/clients/info/EtherscanInfoClient.js +0 -2
- package/v1/clients/info/EtherscanInfoClient.js.map +1 -1
- package/v1/clients/node/EthereumNodeClient.d.ts +18 -0
- package/v1/clients/node/EthereumNodeClient.js +3 -0
- package/v1/clients/node/EthereumNodeClient.js.map +1 -0
- package/v1/clients/node/HttpEthereumNodeClient.d.ts +66 -0
- package/v1/clients/node/HttpEthereumNodeClient.js +443 -0
- package/v1/clients/node/HttpEthereumNodeClient.js.map +1 -0
- package/v1/data/EthereumAddress.d.ts +7 -0
- package/v1/data/EthereumAddress.js +46 -0
- package/v1/data/EthereumAddress.js.map +1 -0
- package/v1/index.d.ts +19 -6
- package/v1/index.js +16 -1
- package/v1/index.js.map +1 -1
- package/v1/module/ERC20Tokens.d.ts +1 -1
- package/v1/module/EthereumModule.d.ts +4 -4
- package/v1/module/EthereumModule.js.map +1 -1
- package/v1/protocol/EthereumBaseProtocol.d.ts +84 -7
- package/v1/protocol/EthereumBaseProtocol.js +779 -8
- package/v1/protocol/EthereumBaseProtocol.js.map +1 -1
- package/v1/protocol/EthereumChainIds.d.ts +1 -0
- package/v1/protocol/EthereumChainIds.js +340 -0
- package/v1/protocol/EthereumChainIds.js.map +1 -0
- package/v1/protocol/EthereumProtocol.d.ts +6 -7
- package/v1/protocol/EthereumProtocol.js +3 -4
- package/v1/protocol/EthereumProtocol.js.map +1 -1
- package/v1/protocol/erc20/ERC20Protocol.d.ts +32 -0
- package/v1/protocol/erc20/ERC20Protocol.js +397 -0
- package/v1/protocol/erc20/ERC20Protocol.js.map +1 -0
- package/v1/protocol/erc20/ERC20Token.d.ts +15 -10
- package/v1/protocol/erc20/ERC20Token.js +26 -35
- package/v1/protocol/erc20/ERC20Token.js.map +1 -1
- package/v1/serializer/v3/schemas/converter/transaction-converter.d.ts +8 -0
- package/v1/serializer/v3/schemas/converter/transaction-converter.js +76 -0
- package/v1/serializer/v3/schemas/converter/transaction-converter.js.map +1 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-ethereum-typed.d.ts +10 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-ethereum-typed.js +3 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-ethereum-typed.js.map +1 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-ethereum.d.ts +14 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-ethereum.js +3 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-ethereum.js.map +1 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-response-ethereum.d.ts +3 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-response-ethereum.js +3 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-response-ethereum.js.map +1 -0
- package/v1/serializer/v3/schemas/generated/transaction-sign-request-ethereum-typed.json +41 -0
- package/v1/serializer/v3/schemas/generated/transaction-sign-request-ethereum.json +58 -0
- package/v1/serializer/v3/schemas/generated/transaction-sign-response-ethereum.json +19 -0
- package/v1/serializer/v3/serializer-companion.js +10 -9
- package/v1/serializer/v3/serializer-companion.js.map +1 -1
- package/v1/serializer/v3/validators/transaction-validator.d.ts +7 -0
- package/v1/serializer/v3/validators/transaction-validator.js +71 -0
- package/v1/serializer/v3/validators/transaction-validator.js.map +1 -0
- package/v1/types/crypto.d.ts +2 -0
- package/v1/types/crypto.js +3 -0
- package/v1/types/crypto.js.map +1 -0
- package/v1/types/protocol.d.ts +35 -0
- package/v1/types/protocol.js +3 -0
- package/v1/types/protocol.js.map +1 -0
- package/v1/types/transaction.d.ts +24 -0
- package/v1/types/transaction.js +3 -0
- package/v1/types/transaction.js.map +1 -0
- package/v1/utils/EthereumUtils.d.ts +16 -0
- package/v1/utils/EthereumUtils.js +155 -0
- package/v1/utils/EthereumUtils.js.map +1 -0
- package/v1/utils/key.d.ts +5 -0
- package/v1/utils/key.js +101 -0
- package/v1/utils/key.js.map +1 -0
- package/v1/utils/protocol.d.ts +4 -5
- package/v1/utils/protocol.js.map +1 -1
|
@@ -0,0 +1,443 @@
|
|
|
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
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
+
function step(op) {
|
|
31
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
+
while (_) try {
|
|
33
|
+
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;
|
|
34
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
+
switch (op[0]) {
|
|
36
|
+
case 0: case 1: t = op; break;
|
|
37
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
+
default:
|
|
41
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
+
if (t[2]) _.ops.pop();
|
|
46
|
+
_.trys.pop(); continue;
|
|
47
|
+
}
|
|
48
|
+
op = body.call(thisArg, _);
|
|
49
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
54
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
55
|
+
if (ar || !(i in from)) {
|
|
56
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
57
|
+
ar[i] = from[i];
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
61
|
+
};
|
|
62
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
63
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
64
|
+
};
|
|
65
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
66
|
+
exports.HttpEthereumNodeClient = exports.EthereumRPCDataTransfer = exports.EthereumRPCDataBalanceOf = exports.EthereumRPCData = exports.EthereumRPCBody = void 0;
|
|
67
|
+
// tslint:disable: max-classes-per-file
|
|
68
|
+
var RPCBody_1 = require("@airgap/coinlib-core/data/RPCBody");
|
|
69
|
+
var axios_0_19_0_1 = __importDefault(require("@airgap/coinlib-core/dependencies/src/axios-0.19.0"));
|
|
70
|
+
var bignumber_1 = require("@airgap/coinlib-core/dependencies/src/bignumber.js-9.0.0/bignumber");
|
|
71
|
+
var errors_1 = require("@airgap/coinlib-core/errors");
|
|
72
|
+
var coinlib_error_1 = require("@airgap/coinlib-core/errors/coinlib-error");
|
|
73
|
+
var coinlib_core_1 = require("@airgap/coinlib-core");
|
|
74
|
+
var EthereumUtils_1 = require("../../utils/EthereumUtils");
|
|
75
|
+
var EthereumRPCBody = /** @class */ (function (_super) {
|
|
76
|
+
__extends(EthereumRPCBody, _super);
|
|
77
|
+
function EthereumRPCBody() {
|
|
78
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
79
|
+
}
|
|
80
|
+
EthereumRPCBody.prototype.toRPCBody = function () {
|
|
81
|
+
return JSON.stringify(this.toJSON());
|
|
82
|
+
};
|
|
83
|
+
EthereumRPCBody.prototype.toJSON = function () {
|
|
84
|
+
return {
|
|
85
|
+
jsonrpc: this.jsonrpc,
|
|
86
|
+
method: this.method,
|
|
87
|
+
params: this.params,
|
|
88
|
+
id: this.id
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
EthereumRPCBody.blockEarliest = 'earliest';
|
|
92
|
+
EthereumRPCBody.blockLatest = 'latest';
|
|
93
|
+
EthereumRPCBody.blockPending = 'pending';
|
|
94
|
+
return EthereumRPCBody;
|
|
95
|
+
}(RPCBody_1.RPCBody));
|
|
96
|
+
exports.EthereumRPCBody = EthereumRPCBody;
|
|
97
|
+
var EthereumRPCData = /** @class */ (function () {
|
|
98
|
+
function EthereumRPCData(methodSignature) {
|
|
99
|
+
this.methodSignature = methodSignature;
|
|
100
|
+
}
|
|
101
|
+
EthereumRPCData.prototype.abiEncoded = function () {
|
|
102
|
+
var hash = EthereumUtils_1.EthereumUtils.sha3(this.methodSignature);
|
|
103
|
+
if (hash === null) {
|
|
104
|
+
return '';
|
|
105
|
+
}
|
|
106
|
+
return "0x".concat(hash.slice(2, 10));
|
|
107
|
+
};
|
|
108
|
+
EthereumRPCData.addLeadingZeroPadding = function (value, targetLength) {
|
|
109
|
+
if (targetLength === void 0) { targetLength = EthereumRPCData.parametersLength; }
|
|
110
|
+
var result = value;
|
|
111
|
+
while (result.length < targetLength || result.length % 2 !== 0) {
|
|
112
|
+
result = '0' + result;
|
|
113
|
+
}
|
|
114
|
+
return result;
|
|
115
|
+
};
|
|
116
|
+
EthereumRPCData.removeLeadingZeroPadding = function (value) {
|
|
117
|
+
var result = value;
|
|
118
|
+
while (result.startsWith('0')) {
|
|
119
|
+
result = result.slice(1); // this can probably be done much more efficiently with a regex
|
|
120
|
+
}
|
|
121
|
+
return result;
|
|
122
|
+
};
|
|
123
|
+
EthereumRPCData.abiDecoded = function (value, encodedType) {
|
|
124
|
+
switch (encodedType) {
|
|
125
|
+
case 'bytes':
|
|
126
|
+
if (value.startsWith('0x')) {
|
|
127
|
+
value = value.slice(2);
|
|
128
|
+
}
|
|
129
|
+
var buffer = Buffer.from(value, 'hex');
|
|
130
|
+
var offset = new bignumber_1.BigNumber(buffer.slice(0, 32).toString('hex'), 16).toNumber();
|
|
131
|
+
var length_1 = new bignumber_1.BigNumber(buffer.slice(offset, offset + 32).toString('hex'), 16).toNumber();
|
|
132
|
+
return buffer.slice(offset + 32, offset + 32 + length_1).toString('hex');
|
|
133
|
+
default:
|
|
134
|
+
(0, coinlib_core_1.assertNever)(encodedType);
|
|
135
|
+
throw new errors_1.UnsupportedError(coinlib_error_1.Domain.ETHEREUM, 'Unsupported ABI encoded type');
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
// 2 chars = 1 byte hence to get to 32 bytes we need 64 chars
|
|
139
|
+
EthereumRPCData.parametersLength = 64;
|
|
140
|
+
return EthereumRPCData;
|
|
141
|
+
}());
|
|
142
|
+
exports.EthereumRPCData = EthereumRPCData;
|
|
143
|
+
var EthereumRPCDataBalanceOf = /** @class */ (function (_super) {
|
|
144
|
+
__extends(EthereumRPCDataBalanceOf, _super);
|
|
145
|
+
function EthereumRPCDataBalanceOf(address) {
|
|
146
|
+
var _this = _super.call(this, "".concat(EthereumRPCDataBalanceOf.methodName, "(address)")) || this;
|
|
147
|
+
_this.address = address;
|
|
148
|
+
return _this;
|
|
149
|
+
}
|
|
150
|
+
EthereumRPCDataBalanceOf.prototype.abiEncoded = function () {
|
|
151
|
+
var srcAddress = this.address;
|
|
152
|
+
if (srcAddress.startsWith('0x')) {
|
|
153
|
+
srcAddress = srcAddress.slice(2);
|
|
154
|
+
}
|
|
155
|
+
return _super.prototype.abiEncoded.call(this) + EthereumRPCData.addLeadingZeroPadding(srcAddress);
|
|
156
|
+
};
|
|
157
|
+
EthereumRPCDataBalanceOf.methodName = 'balanceOf';
|
|
158
|
+
return EthereumRPCDataBalanceOf;
|
|
159
|
+
}(EthereumRPCData));
|
|
160
|
+
exports.EthereumRPCDataBalanceOf = EthereumRPCDataBalanceOf;
|
|
161
|
+
var EthereumRPCDataTransfer = /** @class */ (function (_super) {
|
|
162
|
+
__extends(EthereumRPCDataTransfer, _super);
|
|
163
|
+
function EthereumRPCDataTransfer(toAddressOrData, amount) {
|
|
164
|
+
var _this = _super.call(this, "".concat(EthereumRPCDataTransfer.methodName, "(address,uint256)")) || this;
|
|
165
|
+
if (amount) {
|
|
166
|
+
var toAddress = toAddressOrData;
|
|
167
|
+
_this.recipient = toAddress;
|
|
168
|
+
_this.amount = amount;
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
var data = toAddressOrData;
|
|
172
|
+
var methodID = _super.prototype.abiEncoded.call(_this);
|
|
173
|
+
if (!data.startsWith(methodID)) {
|
|
174
|
+
throw new errors_1.InvalidValueError(coinlib_error_1.Domain.ETHEREUM, 'unexpected method ID');
|
|
175
|
+
}
|
|
176
|
+
var params = data.slice(methodID.length);
|
|
177
|
+
var recipient = EthereumRPCData.removeLeadingZeroPadding(params.slice(0, EthereumRPCData.parametersLength));
|
|
178
|
+
var parsedAmount = EthereumRPCData.removeLeadingZeroPadding(params.slice(EthereumRPCData.parametersLength));
|
|
179
|
+
_this.recipient = "0x".concat(recipient);
|
|
180
|
+
_this.amount = "0x".concat(parsedAmount);
|
|
181
|
+
}
|
|
182
|
+
return _this;
|
|
183
|
+
}
|
|
184
|
+
EthereumRPCDataTransfer.prototype.abiEncoded = function () {
|
|
185
|
+
var dstAddress = this.recipient;
|
|
186
|
+
if (dstAddress.startsWith('0x')) {
|
|
187
|
+
dstAddress = dstAddress.slice(2);
|
|
188
|
+
}
|
|
189
|
+
var transferAmount = this.amount;
|
|
190
|
+
if (transferAmount.startsWith('0x')) {
|
|
191
|
+
transferAmount = transferAmount.slice(2);
|
|
192
|
+
}
|
|
193
|
+
return (_super.prototype.abiEncoded.call(this) +
|
|
194
|
+
EthereumRPCData.addLeadingZeroPadding(dstAddress.toLowerCase()) +
|
|
195
|
+
EthereumRPCData.addLeadingZeroPadding(transferAmount.toLowerCase()));
|
|
196
|
+
};
|
|
197
|
+
EthereumRPCDataTransfer.methodName = 'transfer';
|
|
198
|
+
return EthereumRPCDataTransfer;
|
|
199
|
+
}(EthereumRPCData));
|
|
200
|
+
exports.EthereumRPCDataTransfer = EthereumRPCDataTransfer;
|
|
201
|
+
var HttpEthereumNodeClient = /** @class */ (function () {
|
|
202
|
+
function HttpEthereumNodeClient(baseURL, headers) {
|
|
203
|
+
this.baseURL = baseURL;
|
|
204
|
+
this.headers = headers;
|
|
205
|
+
}
|
|
206
|
+
HttpEthereumNodeClient.prototype.fetchBalance = function (address) {
|
|
207
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
208
|
+
var body, response;
|
|
209
|
+
return __generator(this, function (_a) {
|
|
210
|
+
switch (_a.label) {
|
|
211
|
+
case 0:
|
|
212
|
+
body = new EthereumRPCBody('eth_getBalance', [address, EthereumRPCBody.blockLatest]);
|
|
213
|
+
return [4 /*yield*/, this.send(body)];
|
|
214
|
+
case 1:
|
|
215
|
+
response = _a.sent();
|
|
216
|
+
return [2 /*return*/, new bignumber_1.BigNumber(response.result)];
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
});
|
|
220
|
+
};
|
|
221
|
+
HttpEthereumNodeClient.prototype.fetchTransactionCount = function (address) {
|
|
222
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
223
|
+
var body, response;
|
|
224
|
+
return __generator(this, function (_a) {
|
|
225
|
+
switch (_a.label) {
|
|
226
|
+
case 0:
|
|
227
|
+
body = new EthereumRPCBody('eth_getTransactionCount', [address, EthereumRPCBody.blockLatest]);
|
|
228
|
+
return [4 /*yield*/, this.send(body)];
|
|
229
|
+
case 1:
|
|
230
|
+
response = _a.sent();
|
|
231
|
+
return [2 /*return*/, new bignumber_1.BigNumber(response.result).toNumber()];
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
});
|
|
235
|
+
};
|
|
236
|
+
HttpEthereumNodeClient.prototype.sendSignedTransaction = function (transaction) {
|
|
237
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
238
|
+
var body;
|
|
239
|
+
return __generator(this, function (_a) {
|
|
240
|
+
switch (_a.label) {
|
|
241
|
+
case 0:
|
|
242
|
+
body = new EthereumRPCBody('eth_sendRawTransaction', [transaction]);
|
|
243
|
+
return [4 /*yield*/, this.send(body)];
|
|
244
|
+
case 1: return [2 /*return*/, (_a.sent()).result];
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
});
|
|
248
|
+
};
|
|
249
|
+
HttpEthereumNodeClient.prototype.getTransactionStatus = function (transactionHash) {
|
|
250
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
251
|
+
var body, response;
|
|
252
|
+
return __generator(this, function (_a) {
|
|
253
|
+
switch (_a.label) {
|
|
254
|
+
case 0:
|
|
255
|
+
body = new EthereumRPCBody('eth_getTransactionReceipt', [transactionHash]);
|
|
256
|
+
return [4 /*yield*/, this.send(body)];
|
|
257
|
+
case 1:
|
|
258
|
+
response = _a.sent();
|
|
259
|
+
return [2 /*return*/, response.result.status === '0x1' ? { type: 'applied' } : { type: 'failed' }];
|
|
260
|
+
}
|
|
261
|
+
});
|
|
262
|
+
});
|
|
263
|
+
};
|
|
264
|
+
HttpEthereumNodeClient.prototype.callBalanceOf = function (contractAddress, address) {
|
|
265
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
266
|
+
var body, response;
|
|
267
|
+
return __generator(this, function (_a) {
|
|
268
|
+
switch (_a.label) {
|
|
269
|
+
case 0:
|
|
270
|
+
body = this.balanceOfBody(contractAddress, address);
|
|
271
|
+
return [4 /*yield*/, this.send(body)];
|
|
272
|
+
case 1:
|
|
273
|
+
response = _a.sent();
|
|
274
|
+
return [2 /*return*/, new bignumber_1.BigNumber(response.result)];
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
});
|
|
278
|
+
};
|
|
279
|
+
HttpEthereumNodeClient.prototype.callBalanceOfOnContracts = function (contractAddresses, address) {
|
|
280
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
281
|
+
var bodies, responses, result;
|
|
282
|
+
var _this = this;
|
|
283
|
+
return __generator(this, function (_a) {
|
|
284
|
+
switch (_a.label) {
|
|
285
|
+
case 0:
|
|
286
|
+
bodies = contractAddresses.map(function (contractAddress, index) { return _this.balanceOfBody(contractAddress, address, index); });
|
|
287
|
+
return [4 /*yield*/, this.batchSend(bodies)];
|
|
288
|
+
case 1:
|
|
289
|
+
responses = _a.sent();
|
|
290
|
+
result = {};
|
|
291
|
+
responses.forEach(function (response) {
|
|
292
|
+
var _a;
|
|
293
|
+
result[contractAddresses[response.id]] = new bignumber_1.BigNumber((_a = response.result) !== null && _a !== void 0 ? _a : 0);
|
|
294
|
+
});
|
|
295
|
+
return [2 /*return*/, result];
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
});
|
|
299
|
+
};
|
|
300
|
+
HttpEthereumNodeClient.prototype.balanceOfBody = function (contractAddress, address, id) {
|
|
301
|
+
if (id === void 0) { id = 0; }
|
|
302
|
+
var data = new EthereumRPCDataBalanceOf(address);
|
|
303
|
+
return this.contractCallBody(contractAddress, data, [EthereumRPCBody.blockLatest], id);
|
|
304
|
+
};
|
|
305
|
+
HttpEthereumNodeClient.prototype.estimateTransactionGas = function (fromAddress, toAddress, amount, data, gas) {
|
|
306
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
307
|
+
var body, response;
|
|
308
|
+
return __generator(this, function (_a) {
|
|
309
|
+
switch (_a.label) {
|
|
310
|
+
case 0:
|
|
311
|
+
body = new EthereumRPCBody('eth_estimateGas', [{ from: fromAddress, to: toAddress, gas: gas, value: amount, data: data }]);
|
|
312
|
+
return [4 /*yield*/, this.send(body)];
|
|
313
|
+
case 1:
|
|
314
|
+
response = _a.sent();
|
|
315
|
+
return [2 /*return*/, new bignumber_1.BigNumber(response.result)];
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
});
|
|
319
|
+
};
|
|
320
|
+
HttpEthereumNodeClient.prototype.estimateTransferGas = function (contractAddress, fromAddress, toAddress, hexAmount) {
|
|
321
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
322
|
+
var data, result;
|
|
323
|
+
return __generator(this, function (_a) {
|
|
324
|
+
data = new EthereumRPCDataTransfer(toAddress, hexAmount);
|
|
325
|
+
result = this.estimateTransactionGas(fromAddress, contractAddress, undefined, data.abiEncoded());
|
|
326
|
+
return [2 /*return*/, result];
|
|
327
|
+
});
|
|
328
|
+
});
|
|
329
|
+
};
|
|
330
|
+
HttpEthereumNodeClient.prototype.getGasPrice = function () {
|
|
331
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
332
|
+
var body, response;
|
|
333
|
+
return __generator(this, function (_a) {
|
|
334
|
+
switch (_a.label) {
|
|
335
|
+
case 0:
|
|
336
|
+
body = new EthereumRPCBody('eth_gasPrice', []);
|
|
337
|
+
return [4 /*yield*/, this.send(body)];
|
|
338
|
+
case 1:
|
|
339
|
+
response = _a.sent();
|
|
340
|
+
return [2 /*return*/, new bignumber_1.BigNumber(response.result)];
|
|
341
|
+
}
|
|
342
|
+
});
|
|
343
|
+
});
|
|
344
|
+
};
|
|
345
|
+
HttpEthereumNodeClient.prototype.getContractName = function (contractAddress) {
|
|
346
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
347
|
+
var data, body, response, result;
|
|
348
|
+
return __generator(this, function (_a) {
|
|
349
|
+
switch (_a.label) {
|
|
350
|
+
case 0:
|
|
351
|
+
data = new EthereumRPCData('name()');
|
|
352
|
+
body = this.contractCallBody(contractAddress, data, [EthereumRPCBody.blockLatest]);
|
|
353
|
+
return [4 /*yield*/, this.send(body)];
|
|
354
|
+
case 1:
|
|
355
|
+
response = _a.sent();
|
|
356
|
+
if (!response.result) {
|
|
357
|
+
return [2 /*return*/, undefined];
|
|
358
|
+
}
|
|
359
|
+
result = EthereumRPCData.abiDecoded(response.result, 'bytes');
|
|
360
|
+
return [2 /*return*/, EthereumUtils_1.EthereumUtils.hexToUtf8(result)];
|
|
361
|
+
}
|
|
362
|
+
});
|
|
363
|
+
});
|
|
364
|
+
};
|
|
365
|
+
HttpEthereumNodeClient.prototype.getContractSymbol = function (contractAddress) {
|
|
366
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
367
|
+
var data, body, response, result;
|
|
368
|
+
return __generator(this, function (_a) {
|
|
369
|
+
switch (_a.label) {
|
|
370
|
+
case 0:
|
|
371
|
+
data = new EthereumRPCData('symbol()');
|
|
372
|
+
body = this.contractCallBody(contractAddress, data, [EthereumRPCBody.blockLatest]);
|
|
373
|
+
return [4 /*yield*/, this.send(body)];
|
|
374
|
+
case 1:
|
|
375
|
+
response = _a.sent();
|
|
376
|
+
if (!response.result) {
|
|
377
|
+
return [2 /*return*/, undefined];
|
|
378
|
+
}
|
|
379
|
+
result = EthereumRPCData.abiDecoded(response.result, 'bytes');
|
|
380
|
+
return [2 /*return*/, EthereumUtils_1.EthereumUtils.hexToUtf8(result)];
|
|
381
|
+
}
|
|
382
|
+
});
|
|
383
|
+
});
|
|
384
|
+
};
|
|
385
|
+
HttpEthereumNodeClient.prototype.getContractDecimals = function (contractAddress) {
|
|
386
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
387
|
+
var data, body, response;
|
|
388
|
+
return __generator(this, function (_a) {
|
|
389
|
+
switch (_a.label) {
|
|
390
|
+
case 0:
|
|
391
|
+
data = new EthereumRPCData('decimals()');
|
|
392
|
+
body = this.contractCallBody(contractAddress, data, [EthereumRPCBody.blockLatest]);
|
|
393
|
+
return [4 /*yield*/, this.send(body)];
|
|
394
|
+
case 1:
|
|
395
|
+
response = _a.sent();
|
|
396
|
+
if (!response.result) {
|
|
397
|
+
return [2 /*return*/, undefined];
|
|
398
|
+
}
|
|
399
|
+
return [2 /*return*/, EthereumUtils_1.EthereumUtils.hexToNumber(response.result).toNumber()];
|
|
400
|
+
}
|
|
401
|
+
});
|
|
402
|
+
});
|
|
403
|
+
};
|
|
404
|
+
HttpEthereumNodeClient.prototype.contractCallBody = function (contractAddress, data, extraParams, id, jsonrpc) {
|
|
405
|
+
if (extraParams === void 0) { extraParams = []; }
|
|
406
|
+
return new EthereumRPCBody('eth_call', __spreadArray([{ to: contractAddress, data: data.abiEncoded() }], extraParams, true), id, jsonrpc);
|
|
407
|
+
};
|
|
408
|
+
HttpEthereumNodeClient.prototype.send = function (body) {
|
|
409
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
410
|
+
var response;
|
|
411
|
+
return __generator(this, function (_a) {
|
|
412
|
+
switch (_a.label) {
|
|
413
|
+
case 0: return [4 /*yield*/, axios_0_19_0_1.default.post(this.baseURL, body.toRPCBody(), { headers: this.headers }).catch(function (error) {
|
|
414
|
+
throw new errors_1.NetworkError(coinlib_error_1.Domain.ETHEREUM, error);
|
|
415
|
+
})];
|
|
416
|
+
case 1:
|
|
417
|
+
response = _a.sent();
|
|
418
|
+
return [2 /*return*/, response.data];
|
|
419
|
+
}
|
|
420
|
+
});
|
|
421
|
+
});
|
|
422
|
+
};
|
|
423
|
+
HttpEthereumNodeClient.prototype.batchSend = function (bodies) {
|
|
424
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
425
|
+
var response;
|
|
426
|
+
return __generator(this, function (_a) {
|
|
427
|
+
switch (_a.label) {
|
|
428
|
+
case 0: return [4 /*yield*/, axios_0_19_0_1.default
|
|
429
|
+
.post(this.baseURL, JSON.stringify(bodies.map(function (body) { return body.toJSON(); })), { headers: this.headers })
|
|
430
|
+
.catch(function (error) {
|
|
431
|
+
throw new errors_1.NetworkError(coinlib_error_1.Domain.ETHEREUM, error);
|
|
432
|
+
})];
|
|
433
|
+
case 1:
|
|
434
|
+
response = _a.sent();
|
|
435
|
+
return [2 /*return*/, response.data];
|
|
436
|
+
}
|
|
437
|
+
});
|
|
438
|
+
});
|
|
439
|
+
};
|
|
440
|
+
return HttpEthereumNodeClient;
|
|
441
|
+
}());
|
|
442
|
+
exports.HttpEthereumNodeClient = HttpEthereumNodeClient;
|
|
443
|
+
//# sourceMappingURL=HttpEthereumNodeClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HttpEthereumNodeClient.js","sourceRoot":"","sources":["../../../../src/v1/clients/node/HttpEthereumNodeClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAuC;AACvC,6DAA2D;AAC3D,oGAAsF;AACtF,gGAA8F;AAC9F,sDAA+F;AAC/F,2EAAkE;AAElE,qDAAkD;AAGlD,2DAAyD;AAIzD;IAAqC,mCAAO;IAA5C;;IAiBA,CAAC;IAZQ,mCAAS,GAAhB;QACE,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAA;IACtC,CAAC;IAEM,gCAAM,GAAb;QACE,OAAO;YACL,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,EAAE,EAAE,IAAI,CAAC,EAAE;SACZ,CAAA;IACH,CAAC;IAfa,6BAAa,GAAW,UAAU,CAAA;IAClC,2BAAW,GAAW,QAAQ,CAAA;IAC9B,4BAAY,GAAW,SAAS,CAAA;IAchD,sBAAC;CAAA,AAjBD,CAAqC,iBAAO,GAiB3C;AAjBY,0CAAe;AA6B5B;IAKE,yBAAY,eAAuB;QACjC,IAAI,CAAC,eAAe,GAAG,eAAe,CAAA;IACxC,CAAC;IAEM,oCAAU,GAAjB;QACE,IAAM,IAAI,GAAG,6BAAa,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAA;QACrD,IAAI,IAAI,KAAK,IAAI,EAAE;YACjB,OAAO,EAAE,CAAA;SACV;QAED,OAAO,YAAK,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC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AM,CAAC,QAAQ,EAAE,KAAmB,CAAC,CAAA;wBAC9D,CAAC,CAAC,EAAA;;wBAJE,QAAQ,GAAG,SAIb;wBAEJ,sBAAO,QAAQ,CAAC,IAAI,EAAA;;;;KACrB;IACH,6BAAC;AAAD,CAAC,AAzJD,IAyJC;AAzJY,wDAAsB"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.EthereumAddress = void 0;
|
|
27
|
+
// @ts-ignore
|
|
28
|
+
var ethUtil = __importStar(require("@airgap/coinlib-core/dependencies/src/ethereumjs-util-5.2.0"));
|
|
29
|
+
var key_1 = require("../utils/key");
|
|
30
|
+
var EthereumAddress = /** @class */ (function () {
|
|
31
|
+
function EthereumAddress(value) {
|
|
32
|
+
this.value = value;
|
|
33
|
+
}
|
|
34
|
+
EthereumAddress.from = function (publicKey) {
|
|
35
|
+
var hexPublicKey = publicKey.type === 'pub' ? (0, key_1.convertPublicKey)(publicKey, 'hex') : (0, key_1.convertExtendedPublicKey)(publicKey, 'hex');
|
|
36
|
+
var bufferPublicKey = Buffer.from(hexPublicKey.value, 'hex');
|
|
37
|
+
var address = ethUtil.toChecksumAddress(ethUtil.pubToAddress(bufferPublicKey, true).toString('hex'));
|
|
38
|
+
return new EthereumAddress(address);
|
|
39
|
+
};
|
|
40
|
+
EthereumAddress.prototype.asString = function () {
|
|
41
|
+
return this.value;
|
|
42
|
+
};
|
|
43
|
+
return EthereumAddress;
|
|
44
|
+
}());
|
|
45
|
+
exports.EthereumAddress = EthereumAddress;
|
|
46
|
+
//# sourceMappingURL=EthereumAddress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EthereumAddress.js","sourceRoot":"","sources":["../../../src/v1/data/EthereumAddress.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,aAAa;AACb,mGAAsF;AAGtF,oCAAyE;AAEzE;IACE,yBAAqC,KAAa;QAAb,UAAK,GAAL,KAAK,CAAQ;IAAG,CAAC;IAExC,oBAAI,GAAlB,UAAmB,SAAwC;QACzD,IAAM,YAAY,GAChB,SAAS,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,IAAA,sBAAgB,EAAC,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,IAAA,8BAAwB,EAAC,SAAS,EAAE,KAAK,CAAC,CAAA;QAC5G,IAAM,eAAe,GAAW,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;QAEtE,IAAM,OAAO,GAAW,OAAO,CAAC,iBAAiB,CAAC,OAAO,CAAC,YAAY,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAA;QAE9G,OAAO,IAAI,eAAe,CAAC,OAAO,CAAC,CAAA;IACrC,CAAC;IAEM,kCAAQ,GAAf;QACE,OAAO,IAAI,CAAC,KAAK,CAAA;IACnB,CAAC;IACH,sBAAC;AAAD,CAAC,AAhBD,IAgBC;AAhBY,0CAAe"}
|
package/v1/index.d.ts
CHANGED
|
@@ -1,17 +1,30 @@
|
|
|
1
1
|
import { EtherscanBlockExplorer } from './block-explorer/EtherscanBlockExplorer';
|
|
2
|
-
import { EthereumInfoClient
|
|
2
|
+
import { EthereumInfoClient } from './clients/info/EthereumInfoClient';
|
|
3
3
|
import { EtherscanInfoClient } from './clients/info/EtherscanInfoClient';
|
|
4
|
+
import { HttpEthereumNodeClient, EthereumRPCBody, EthereumRPCData, EthereumRPCResponse } from './clients/node/HttpEthereumNodeClient';
|
|
5
|
+
import { EthereumNodeClient } from './clients/node/EthereumNodeClient';
|
|
4
6
|
import { erc20Tokens } from './module/ERC20Tokens';
|
|
5
7
|
import { EthereumModule } from './module/EthereumModule';
|
|
8
|
+
import { ERC20Protocol, ERC20ProtocolImpl } from './protocol/erc20/ERC20Protocol';
|
|
6
9
|
import { createERC20Token, ERC20Token, ERC20TokenImpl } from './protocol/erc20/ERC20Token';
|
|
7
|
-
import { DEFAULT_ETHEREUM_UNITS_METADATA, EthereumBaseProtocol, EthereumBaseProtocolImpl
|
|
10
|
+
import { DEFAULT_ETHEREUM_UNITS_METADATA, EthereumBaseProtocol, EthereumBaseProtocolImpl } from './protocol/EthereumBaseProtocol';
|
|
8
11
|
import { createEthereumProtocol, createEthereumProtocolOptions, EthereumProtocol } from './protocol/EthereumProtocol';
|
|
12
|
+
import { ethereumSignedTransactionToResponse, ethereumTransactionSignRequestToUnsigned, ethereumTransactionSignResponseToSigned, ethereumUnsignedTransactionToRequest } from './serializer/v3/schemas/converter/transaction-converter';
|
|
13
|
+
import { EthereumTransactionValidator } from './serializer/v3/validators/transaction-validator';
|
|
14
|
+
import { EthereumTransactionSignRequest } from './serializer/v3/schemas/definitions/transaction-sign-request-ethereum';
|
|
15
|
+
import { EthereumTypedTransactionSignRequest } from './serializer/v3/schemas/definitions/transaction-sign-request-ethereum-typed';
|
|
16
|
+
import { EthereumTransactionSignResponse } from './serializer/v3/schemas/definitions/transaction-sign-response-ethereum';
|
|
17
|
+
import { EthereumCryptoConfiguration } from './types/crypto';
|
|
18
|
+
import { ERC20TokenMetadata, ERC20TokenOptions, EthereumBaseProtocolOptions, EthereumProtocolNetwork, EthereumProtocolOptions, EthereumUnits } from './types/protocol';
|
|
19
|
+
import { EthereumRawUnsignedTransaction, EthereumSignedTransaction, EthereumTransactionCursor, EthereumTypedUnsignedTransaction, EthereumUnsignedTransaction } from './types/transaction';
|
|
20
|
+
import { EthereumUtils } from './utils/EthereumUtils';
|
|
9
21
|
import { isAnyEthereumProtocol, isEthereumERC20Protocol, isEthereumERC20Token, isEthereumProtocol } from './utils/protocol';
|
|
10
22
|
export { EthereumModule };
|
|
11
|
-
export { EthereumBaseProtocol, EthereumBaseProtocolImpl, EthereumProtocol, createEthereumProtocol, createEthereumProtocolOptions, ERC20Token, ERC20TokenImpl, createERC20Token };
|
|
23
|
+
export { EthereumBaseProtocol, EthereumBaseProtocolImpl, EthereumProtocol, createEthereumProtocol, createEthereumProtocolOptions, ERC20Protocol, ERC20ProtocolImpl, ERC20Token, ERC20TokenImpl, createERC20Token };
|
|
12
24
|
export { EtherscanBlockExplorer };
|
|
13
25
|
export { DEFAULT_ETHEREUM_UNITS_METADATA };
|
|
14
|
-
export {
|
|
15
|
-
export { EthereumUnits };
|
|
16
|
-
export {
|
|
26
|
+
export { EthereumNodeClient, HttpEthereumNodeClient, EthereumInfoClient, EtherscanInfoClient };
|
|
27
|
+
export { EthereumCryptoConfiguration, EthereumUnits, EthereumProtocolNetwork, EthereumProtocolOptions, ERC20TokenMetadata, ERC20TokenOptions, EthereumBaseProtocolOptions, EthereumUnsignedTransaction, EthereumTypedUnsignedTransaction, EthereumRawUnsignedTransaction, EthereumSignedTransaction, EthereumTransactionCursor, EthereumRPCData, EthereumRPCBody, EthereumRPCResponse };
|
|
28
|
+
export { EthereumTransactionSignRequest, EthereumTypedTransactionSignRequest, EthereumTransactionSignResponse, ethereumUnsignedTransactionToRequest, ethereumSignedTransactionToResponse, ethereumTransactionSignRequestToUnsigned, ethereumTransactionSignResponseToSigned, EthereumTransactionValidator };
|
|
29
|
+
export { EthereumUtils, isAnyEthereumProtocol, isEthereumProtocol, isEthereumERC20Protocol, isEthereumERC20Token };
|
|
17
30
|
export { erc20Tokens };
|
package/v1/index.js
CHANGED
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.erc20Tokens = exports.isEthereumERC20Token = exports.isEthereumERC20Protocol = exports.isEthereumProtocol = exports.isAnyEthereumProtocol = exports.EtherscanInfoClient = exports.EthereumInfoClient = exports.DEFAULT_ETHEREUM_UNITS_METADATA = exports.EtherscanBlockExplorer = exports.createERC20Token = exports.ERC20TokenImpl = exports.createEthereumProtocolOptions = exports.createEthereumProtocol = exports.EthereumBaseProtocolImpl = exports.EthereumModule = void 0;
|
|
3
|
+
exports.erc20Tokens = exports.isEthereumERC20Token = exports.isEthereumERC20Protocol = exports.isEthereumProtocol = exports.isAnyEthereumProtocol = exports.EthereumUtils = exports.EthereumTransactionValidator = exports.ethereumTransactionSignResponseToSigned = exports.ethereumTransactionSignRequestToUnsigned = exports.ethereumSignedTransactionToResponse = exports.ethereumUnsignedTransactionToRequest = exports.EthereumRPCBody = exports.EthereumRPCData = exports.EtherscanInfoClient = exports.EthereumInfoClient = exports.HttpEthereumNodeClient = exports.DEFAULT_ETHEREUM_UNITS_METADATA = exports.EtherscanBlockExplorer = exports.createERC20Token = exports.ERC20TokenImpl = exports.ERC20ProtocolImpl = exports.createEthereumProtocolOptions = exports.createEthereumProtocol = exports.EthereumBaseProtocolImpl = exports.EthereumModule = void 0;
|
|
4
4
|
var EtherscanBlockExplorer_1 = require("./block-explorer/EtherscanBlockExplorer");
|
|
5
5
|
Object.defineProperty(exports, "EtherscanBlockExplorer", { enumerable: true, get: function () { return EtherscanBlockExplorer_1.EtherscanBlockExplorer; } });
|
|
6
6
|
var EthereumInfoClient_1 = require("./clients/info/EthereumInfoClient");
|
|
7
7
|
Object.defineProperty(exports, "EthereumInfoClient", { enumerable: true, get: function () { return EthereumInfoClient_1.EthereumInfoClient; } });
|
|
8
8
|
var EtherscanInfoClient_1 = require("./clients/info/EtherscanInfoClient");
|
|
9
9
|
Object.defineProperty(exports, "EtherscanInfoClient", { enumerable: true, get: function () { return EtherscanInfoClient_1.EtherscanInfoClient; } });
|
|
10
|
+
var HttpEthereumNodeClient_1 = require("./clients/node/HttpEthereumNodeClient");
|
|
11
|
+
Object.defineProperty(exports, "HttpEthereumNodeClient", { enumerable: true, get: function () { return HttpEthereumNodeClient_1.HttpEthereumNodeClient; } });
|
|
12
|
+
Object.defineProperty(exports, "EthereumRPCBody", { enumerable: true, get: function () { return HttpEthereumNodeClient_1.EthereumRPCBody; } });
|
|
13
|
+
Object.defineProperty(exports, "EthereumRPCData", { enumerable: true, get: function () { return HttpEthereumNodeClient_1.EthereumRPCData; } });
|
|
10
14
|
var ERC20Tokens_1 = require("./module/ERC20Tokens");
|
|
11
15
|
Object.defineProperty(exports, "erc20Tokens", { enumerable: true, get: function () { return ERC20Tokens_1.erc20Tokens; } });
|
|
12
16
|
var EthereumModule_1 = require("./module/EthereumModule");
|
|
13
17
|
Object.defineProperty(exports, "EthereumModule", { enumerable: true, get: function () { return EthereumModule_1.EthereumModule; } });
|
|
18
|
+
var ERC20Protocol_1 = require("./protocol/erc20/ERC20Protocol");
|
|
19
|
+
Object.defineProperty(exports, "ERC20ProtocolImpl", { enumerable: true, get: function () { return ERC20Protocol_1.ERC20ProtocolImpl; } });
|
|
14
20
|
var ERC20Token_1 = require("./protocol/erc20/ERC20Token");
|
|
15
21
|
Object.defineProperty(exports, "createERC20Token", { enumerable: true, get: function () { return ERC20Token_1.createERC20Token; } });
|
|
16
22
|
Object.defineProperty(exports, "ERC20TokenImpl", { enumerable: true, get: function () { return ERC20Token_1.ERC20TokenImpl; } });
|
|
@@ -20,6 +26,15 @@ Object.defineProperty(exports, "EthereumBaseProtocolImpl", { enumerable: true, g
|
|
|
20
26
|
var EthereumProtocol_1 = require("./protocol/EthereumProtocol");
|
|
21
27
|
Object.defineProperty(exports, "createEthereumProtocol", { enumerable: true, get: function () { return EthereumProtocol_1.createEthereumProtocol; } });
|
|
22
28
|
Object.defineProperty(exports, "createEthereumProtocolOptions", { enumerable: true, get: function () { return EthereumProtocol_1.createEthereumProtocolOptions; } });
|
|
29
|
+
var transaction_converter_1 = require("./serializer/v3/schemas/converter/transaction-converter");
|
|
30
|
+
Object.defineProperty(exports, "ethereumSignedTransactionToResponse", { enumerable: true, get: function () { return transaction_converter_1.ethereumSignedTransactionToResponse; } });
|
|
31
|
+
Object.defineProperty(exports, "ethereumTransactionSignRequestToUnsigned", { enumerable: true, get: function () { return transaction_converter_1.ethereumTransactionSignRequestToUnsigned; } });
|
|
32
|
+
Object.defineProperty(exports, "ethereumTransactionSignResponseToSigned", { enumerable: true, get: function () { return transaction_converter_1.ethereumTransactionSignResponseToSigned; } });
|
|
33
|
+
Object.defineProperty(exports, "ethereumUnsignedTransactionToRequest", { enumerable: true, get: function () { return transaction_converter_1.ethereumUnsignedTransactionToRequest; } });
|
|
34
|
+
var transaction_validator_1 = require("./serializer/v3/validators/transaction-validator");
|
|
35
|
+
Object.defineProperty(exports, "EthereumTransactionValidator", { enumerable: true, get: function () { return transaction_validator_1.EthereumTransactionValidator; } });
|
|
36
|
+
var EthereumUtils_1 = require("./utils/EthereumUtils");
|
|
37
|
+
Object.defineProperty(exports, "EthereumUtils", { enumerable: true, get: function () { return EthereumUtils_1.EthereumUtils; } });
|
|
23
38
|
var protocol_1 = require("./utils/protocol");
|
|
24
39
|
Object.defineProperty(exports, "isAnyEthereumProtocol", { enumerable: true, get: function () { return protocol_1.isAnyEthereumProtocol; } });
|
|
25
40
|
Object.defineProperty(exports, "isEthereumERC20Protocol", { enumerable: true, get: function () { return protocol_1.isEthereumERC20Protocol; } });
|
package/v1/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/v1/index.ts"],"names":[],"mappings":";;;AAAA,kFAAgF;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/v1/index.ts"],"names":[],"mappings":";;;AAAA,kFAAgF;AA6DvE,uGA7DA,+CAAsB,OA6DA;AA5D/B,wEAAsE;AAoEjB,mGApE5C,uCAAkB,OAoE4C;AAnEvE,0EAAwE;AAmEC,oGAnEhE,yCAAmB,OAmEgE;AAlE5F,gFAAqI;AAkExG,uGAlEpB,+CAAsB,OAkEoB;AAkBjD,gGApF+B,wCAAe,OAoF/B;AADf,gGAnFgD,wCAAe,OAmFhD;AAjFjB,oDAAkD;AAyGzC,4FAzGA,yBAAW,OAyGA;AAxGpB,0DAAwD;AAoC/C,+FApCA,+BAAc,OAoCA;AAnCvB,gEAAiF;AA8C/E,kGA9CsB,iCAAiB,OA8CtB;AA7CnB,0DAA0F;AAgDxF,iGAhDO,6BAAgB,OAgDP;AADhB,+FA/CqC,2BAAc,OA+CrC;AA9ChB,wEAAiI;AAwDxH,gHAxDA,sDAA+B,OAwDA;AAjBtC,yGAvC8D,+CAAwB,OAuC9D;AAtC1B,gEAAqH;AAwCnH,uGAxCO,yCAAsB,OAwCP;AACtB,8GAzC+B,gDAA6B,OAyC/B;AAxC/B,iGAKgE;AAkF9D,oHAtFA,2DAAmC,OAsFA;AACnC,yHAtFA,gEAAwC,OAsFA;AACxC,wHAtFA,+DAAuC,OAsFA;AAHvC,qHAlFA,4DAAoC,OAkFA;AAhFtC,0FAA+F;AAoF7F,6GApFO,oDAA4B,OAoFP;AAhE9B,uDAAqD;AAqE5C,8FArEA,6BAAa,OAqEA;AApEtB,6CAA2H;AAoEnG,sGApEf,gCAAqB,OAoEe;AAAsB,wGApEnC,kCAAuB,OAoEmC;AAAE,qGApEnC,+BAAoB,OAoEmC;AAAjE,mGApEgC,6BAAkB,OAoEhC"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { AirGapModule, AirGapV3SerializerCompanion, ProtocolConfiguration } from '@airgap/module-kit';
|
|
2
2
|
import { BlockExplorer } from '@airgap/module-kit/block-explorer/block-explorer';
|
|
3
3
|
import { OfflineProtocol, OnlineProtocol } from '@airgap/module-kit/protocol/protocol';
|
|
4
|
-
import {
|
|
4
|
+
import { EthereumProtocolNetwork } from '../types/protocol';
|
|
5
5
|
export declare class EthereumModule implements AirGapModule<{
|
|
6
|
-
ProtocolNetwork:
|
|
6
|
+
ProtocolNetwork: EthereumProtocolNetwork;
|
|
7
7
|
}> {
|
|
8
8
|
private readonly networkRegistries;
|
|
9
9
|
readonly supportedProtocols: Record<string, ProtocolConfiguration>;
|
|
10
10
|
constructor();
|
|
11
11
|
createOfflineProtocol(identifier: string): Promise<OfflineProtocol | undefined>;
|
|
12
|
-
createOnlineProtocol(identifier: string, networkOrId?:
|
|
13
|
-
createBlockExplorer(identifier: string, networkOrId?:
|
|
12
|
+
createOnlineProtocol(identifier: string, networkOrId?: EthereumProtocolNetwork | string): Promise<OnlineProtocol | undefined>;
|
|
13
|
+
createBlockExplorer(identifier: string, networkOrId?: EthereumProtocolNetwork | string): Promise<BlockExplorer | undefined>;
|
|
14
14
|
createV3SerializerCompanion(): Promise<AirGapV3SerializerCompanion>;
|
|
15
15
|
private createProtocol;
|
|
16
16
|
}
|