@airgap/ethereum 0.13.11-beta.0 → 0.13.11-beta.1
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 +11 -9
- package/airgap-coinlib-ethereum.min.js +0 -117080
- package/index.d.ts +0 -1
- package/index.js +0 -18
- package/index.js.map +0 -1
- package/v0/index.d.ts +0 -12
- package/v0/index.js +0 -39
- package/v0/index.js.map +0 -1
- package/v0/protocol/BaseEthereumProtocol.d.ts +0 -98
- package/v0/protocol/BaseEthereumProtocol.js +0 -939
- package/v0/protocol/BaseEthereumProtocol.js.map +0 -1
- package/v0/protocol/EthereumAddress.d.ts +0 -8
- package/v0/protocol/EthereumAddress.js +0 -43
- package/v0/protocol/EthereumAddress.js.map +0 -1
- package/v0/protocol/EthereumChainIDs.d.ts +0 -1
- package/v0/protocol/EthereumChainIDs.js +0 -340
- package/v0/protocol/EthereumChainIDs.js.map +0 -1
- package/v0/protocol/EthereumClassicProtocol.d.ts +0 -6
- package/v0/protocol/EthereumClassicProtocol.js +0 -30
- package/v0/protocol/EthereumClassicProtocol.js.map +0 -1
- package/v0/protocol/EthereumCryptoClient.d.ts +0 -12
- package/v0/protocol/EthereumCryptoClient.js +0 -148
- package/v0/protocol/EthereumCryptoClient.js.map +0 -1
- package/v0/protocol/EthereumProtocol.d.ts +0 -10
- package/v0/protocol/EthereumProtocol.js +0 -34
- package/v0/protocol/EthereumProtocol.js.map +0 -1
- package/v0/protocol/EthereumProtocolOptions.d.ts +0 -46
- package/v0/protocol/EthereumProtocolOptions.js +0 -150
- package/v0/protocol/EthereumProtocolOptions.js.map +0 -1
- package/v0/protocol/EthereumRopstenProtocol.d.ts +0 -6
- package/v0/protocol/EthereumRopstenProtocol.js +0 -30
- package/v0/protocol/EthereumRopstenProtocol.js.map +0 -1
- package/v0/protocol/EthereumTypes.d.ts +0 -14
- package/v0/protocol/EthereumTypes.js +0 -3
- package/v0/protocol/EthereumTypes.js.map +0 -1
- package/v0/protocol/clients/info-clients/EtherscanInfoClient.d.ts +0 -8
- package/v0/protocol/clients/info-clients/EtherscanInfoClient.js +0 -195
- package/v0/protocol/clients/info-clients/EtherscanInfoClient.js.map +0 -1
- package/v0/protocol/clients/info-clients/InfoClient.d.ts +0 -8
- package/v0/protocol/clients/info-clients/InfoClient.js +0 -11
- package/v0/protocol/clients/info-clients/InfoClient.js.map +0 -1
- package/v0/protocol/clients/node-clients/AirGapNodeClient.d.ts +0 -41
- package/v0/protocol/clients/node-clients/AirGapNodeClient.js +0 -353
- package/v0/protocol/clients/node-clients/AirGapNodeClient.js.map +0 -1
- package/v0/protocol/clients/node-clients/NodeClient.d.ts +0 -17
- package/v0/protocol/clients/node-clients/NodeClient.js +0 -11
- package/v0/protocol/clients/node-clients/NodeClient.js.map +0 -1
- package/v0/protocol/erc20/ERC20.d.ts +0 -3
- package/v0/protocol/erc20/ERC20.js +0 -9
- package/v0/protocol/erc20/ERC20.js.map +0 -1
- package/v0/protocol/erc20/GenericERC20.d.ts +0 -32
- package/v0/protocol/erc20/GenericERC20.js +0 -335
- package/v0/protocol/erc20/GenericERC20.js.map +0 -1
- package/v0/protocol/utils/utils.d.ts +0 -13
- package/v0/protocol/utils/utils.js +0 -140
- package/v0/protocol/utils/utils.js.map +0 -1
- package/v0/serializer/schemas/v2/transaction-sign-request-ethereum.json +0 -50
- package/v0/serializer/schemas/v2/transaction-sign-response-ethereum.json +0 -19
- package/v0/serializer/schemas/v3/transaction-sign-request-ethereum-typed.json +0 -38
- package/v0/serializer/schemas/v3/transaction-sign-request-ethereum.json +0 -50
- package/v0/serializer/schemas/v3/transaction-sign-response-ethereum.json +0 -19
- package/v0/serializer/validators/transaction-validator.d.ts +0 -15
- package/v0/serializer/validators/transaction-validator.js +0 -96
- package/v0/serializer/validators/transaction-validator.js.map +0 -1
- package/v0/serializer/validators/validators.d.ts +0 -1
- package/v0/serializer/validators/validators.js +0 -78
- package/v0/serializer/validators/validators.js.map +0 -1
- package/v0/types/signed-transaction-ethereum.d.ts +0 -5
- package/v0/types/signed-transaction-ethereum.js +0 -3
- package/v0/types/signed-transaction-ethereum.js.map +0 -1
- package/v0/types/transaction-ethereum.d.ts +0 -14
- package/v0/types/transaction-ethereum.js +0 -3
- package/v0/types/transaction-ethereum.js.map +0 -1
- package/v0/types/unsigned-transaction-ethereum-typed.d.ts +0 -11
- package/v0/types/unsigned-transaction-ethereum-typed.js +0 -3
- package/v0/types/unsigned-transaction-ethereum-typed.js.map +0 -1
- package/v0/types/unsigned-transaction-ethereum.d.ts +0 -15
- package/v0/types/unsigned-transaction-ethereum.js +0 -3
- package/v0/types/unsigned-transaction-ethereum.js.map +0 -1
- package/v1/block-explorer/EtherscanBlockExplorer.d.ts +0 -9
- package/v1/block-explorer/EtherscanBlockExplorer.js +0 -74
- package/v1/block-explorer/EtherscanBlockExplorer.js.map +0 -1
- package/v1/clients/crypto/EthereumCryptoClient.d.ts +0 -7
- package/v1/clients/crypto/EthereumCryptoClient.js +0 -147
- package/v1/clients/crypto/EthereumCryptoClient.js.map +0 -1
- package/v1/clients/info/EthereumInfoClient.d.ts +0 -15
- package/v1/clients/info/EthereumInfoClient.js +0 -11
- package/v1/clients/info/EthereumInfoClient.js.map +0 -1
- package/v1/clients/info/EtherscanInfoClient.d.ts +0 -7
- package/v1/clients/info/EtherscanInfoClient.js +0 -165
- package/v1/clients/info/EtherscanInfoClient.js.map +0 -1
- package/v1/clients/node/AirGapNodeClient.d.ts +0 -41
- package/v1/clients/node/AirGapNodeClient.js +0 -351
- package/v1/clients/node/AirGapNodeClient.js.map +0 -1
- package/v1/clients/node/EthereumNodeClient.d.ts +0 -17
- package/v1/clients/node/EthereumNodeClient.js +0 -11
- package/v1/clients/node/EthereumNodeClient.js.map +0 -1
- package/v1/data/EthereumAddress.d.ts +0 -7
- package/v1/data/EthereumAddress.js +0 -46
- package/v1/data/EthereumAddress.js.map +0 -1
- package/v1/index.d.ts +0 -10
- package/v1/index.js +0 -13
- package/v1/index.js.map +0 -1
- package/v1/module/ERC20Tokens.d.ts +0 -3
- package/v1/module/ERC20Tokens.js +0 -815
- package/v1/module/ERC20Tokens.js.map +0 -1
- package/v1/module/EthereumModule.d.ts +0 -13
- package/v1/module/EthereumModule.js +0 -125
- package/v1/module/EthereumModule.js.map +0 -1
- package/v1/module.d.ts +0 -3
- package/v1/module.js +0 -24
- package/v1/module.js.map +0 -1
- package/v1/protocol/EthereumBaseProtocol.d.ts +0 -83
- package/v1/protocol/EthereumBaseProtocol.js +0 -866
- package/v1/protocol/EthereumBaseProtocol.js.map +0 -1
- package/v1/protocol/EthereumChainIds.d.ts +0 -1
- package/v1/protocol/EthereumChainIds.js +0 -340
- package/v1/protocol/EthereumChainIds.js.map +0 -1
- package/v1/protocol/EthereumProtocol.d.ts +0 -8
- package/v1/protocol/EthereumProtocol.js +0 -64
- package/v1/protocol/EthereumProtocol.js.map +0 -1
- package/v1/protocol/erc20/ERC20Token.d.ts +0 -8
- package/v1/protocol/erc20/ERC20Token.js +0 -421
- package/v1/protocol/erc20/ERC20Token.js.map +0 -1
- package/v1/serializer/v3/schemas/converter/transaction-converter.d.ts +0 -12
- package/v1/serializer/v3/schemas/converter/transaction-converter.js +0 -80
- package/v1/serializer/v3/schemas/converter/transaction-converter.js.map +0 -1
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-ethereum-typed.d.ts +0 -10
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-ethereum-typed.js +0 -3
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-ethereum-typed.js.map +0 -1
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-ethereum.d.ts +0 -14
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-ethereum.js +0 -3
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-ethereum.js.map +0 -1
- package/v1/serializer/v3/schemas/definitions/transaction-sign-response-ethereum.d.ts +0 -3
- package/v1/serializer/v3/schemas/definitions/transaction-sign-response-ethereum.js +0 -3
- package/v1/serializer/v3/schemas/definitions/transaction-sign-response-ethereum.js.map +0 -1
- package/v1/serializer/v3/schemas/generated/transaction-sign-request-ethereum-typed.json +0 -41
- package/v1/serializer/v3/schemas/generated/transaction-sign-request-ethereum.json +0 -58
- package/v1/serializer/v3/schemas/generated/transaction-sign-response-ethereum.json +0 -19
- package/v1/serializer/v3/serializer-companion.d.ts +0 -13
- package/v1/serializer/v3/serializer-companion.js +0 -190
- package/v1/serializer/v3/serializer-companion.js.map +0 -1
- package/v1/serializer/v3/validators/transaction-validator.d.ts +0 -7
- package/v1/serializer/v3/validators/transaction-validator.js +0 -71
- package/v1/serializer/v3/validators/transaction-validator.js.map +0 -1
- package/v1/types/protocol.d.ts +0 -32
- package/v1/types/protocol.js +0 -3
- package/v1/types/protocol.js.map +0 -1
- package/v1/types/transaction.d.ts +0 -24
- package/v1/types/transaction.js +0 -3
- package/v1/types/transaction.js.map +0 -1
- package/v1/utils/EthereumUtils.d.ts +0 -13
- package/v1/utils/EthereumUtils.js +0 -140
- package/v1/utils/EthereumUtils.js.map +0 -1
- package/v1/utils/key.d.ts +0 -5
- package/v1/utils/key.js +0 -88
- package/v1/utils/key.js.map +0 -1
|
@@ -1,351 +0,0 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
54
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
55
|
-
};
|
|
56
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
57
|
-
exports.AirGapNodeClient = exports.EthereumRPCDataTransfer = exports.EthereumRPCDataBalanceOf = exports.EthereumRPCData = void 0;
|
|
58
|
-
// tslint:disable: max-classes-per-file
|
|
59
|
-
var RPCBody_1 = require("@airgap/coinlib-core/data/RPCBody");
|
|
60
|
-
var axios_0_19_0_1 = __importDefault(require("@airgap/coinlib-core/dependencies/src/axios-0.19.0"));
|
|
61
|
-
var bignumber_1 = require("@airgap/coinlib-core/dependencies/src/bignumber.js-9.0.0/bignumber");
|
|
62
|
-
var errors_1 = require("@airgap/coinlib-core/errors");
|
|
63
|
-
var coinlib_error_1 = require("@airgap/coinlib-core/errors/coinlib-error");
|
|
64
|
-
var EthereumUtils_1 = require("../../utils/EthereumUtils");
|
|
65
|
-
var EthereumNodeClient_1 = require("./EthereumNodeClient");
|
|
66
|
-
var EthereumRPCBody = /** @class */ (function (_super) {
|
|
67
|
-
__extends(EthereumRPCBody, _super);
|
|
68
|
-
function EthereumRPCBody() {
|
|
69
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
70
|
-
}
|
|
71
|
-
EthereumRPCBody.prototype.toRPCBody = function () {
|
|
72
|
-
return JSON.stringify(this.toJSON());
|
|
73
|
-
};
|
|
74
|
-
EthereumRPCBody.prototype.toJSON = function () {
|
|
75
|
-
return {
|
|
76
|
-
jsonrpc: this.jsonrpc,
|
|
77
|
-
method: this.method,
|
|
78
|
-
params: this.params,
|
|
79
|
-
id: this.id
|
|
80
|
-
};
|
|
81
|
-
};
|
|
82
|
-
EthereumRPCBody.blockEarliest = 'earliest';
|
|
83
|
-
EthereumRPCBody.blockLatest = 'latest';
|
|
84
|
-
EthereumRPCBody.blockPending = 'pending';
|
|
85
|
-
return EthereumRPCBody;
|
|
86
|
-
}(RPCBody_1.RPCBody));
|
|
87
|
-
var EthereumRPCData = /** @class */ (function () {
|
|
88
|
-
function EthereumRPCData(methodSignature) {
|
|
89
|
-
this.methodSignature = methodSignature;
|
|
90
|
-
}
|
|
91
|
-
EthereumRPCData.prototype.abiEncoded = function () {
|
|
92
|
-
var hash = EthereumUtils_1.EthereumUtils.sha3(this.methodSignature);
|
|
93
|
-
if (hash === null) {
|
|
94
|
-
return '';
|
|
95
|
-
}
|
|
96
|
-
return "0x".concat(hash.slice(2, 10));
|
|
97
|
-
};
|
|
98
|
-
EthereumRPCData.addLeadingZeroPadding = function (value, targetLength) {
|
|
99
|
-
if (targetLength === void 0) { targetLength = EthereumRPCData.parametersLength; }
|
|
100
|
-
var result = value;
|
|
101
|
-
while (result.length < targetLength) {
|
|
102
|
-
result = '0' + result;
|
|
103
|
-
}
|
|
104
|
-
return result;
|
|
105
|
-
};
|
|
106
|
-
EthereumRPCData.removeLeadingZeroPadding = function (value) {
|
|
107
|
-
var result = value;
|
|
108
|
-
while (result.startsWith('0')) {
|
|
109
|
-
result = result.slice(1); // this can probably be done much more efficiently with a regex
|
|
110
|
-
}
|
|
111
|
-
return result;
|
|
112
|
-
};
|
|
113
|
-
// 2 chars = 1 byte hence to get to 32 bytes we need 64 chars
|
|
114
|
-
EthereumRPCData.parametersLength = 64;
|
|
115
|
-
return EthereumRPCData;
|
|
116
|
-
}());
|
|
117
|
-
exports.EthereumRPCData = EthereumRPCData;
|
|
118
|
-
var EthereumRPCDataBalanceOf = /** @class */ (function (_super) {
|
|
119
|
-
__extends(EthereumRPCDataBalanceOf, _super);
|
|
120
|
-
function EthereumRPCDataBalanceOf(address) {
|
|
121
|
-
var _this = _super.call(this, "".concat(EthereumRPCDataBalanceOf.methodName, "(address)")) || this;
|
|
122
|
-
_this.address = address;
|
|
123
|
-
return _this;
|
|
124
|
-
}
|
|
125
|
-
EthereumRPCDataBalanceOf.prototype.abiEncoded = function () {
|
|
126
|
-
var srcAddress = this.address;
|
|
127
|
-
if (srcAddress.startsWith('0x')) {
|
|
128
|
-
srcAddress = srcAddress.slice(2);
|
|
129
|
-
}
|
|
130
|
-
return _super.prototype.abiEncoded.call(this) + EthereumRPCData.addLeadingZeroPadding(srcAddress);
|
|
131
|
-
};
|
|
132
|
-
EthereumRPCDataBalanceOf.methodName = 'balanceOf';
|
|
133
|
-
return EthereumRPCDataBalanceOf;
|
|
134
|
-
}(EthereumRPCData));
|
|
135
|
-
exports.EthereumRPCDataBalanceOf = EthereumRPCDataBalanceOf;
|
|
136
|
-
var EthereumRPCDataTransfer = /** @class */ (function (_super) {
|
|
137
|
-
__extends(EthereumRPCDataTransfer, _super);
|
|
138
|
-
function EthereumRPCDataTransfer(toAddressOrData, amount) {
|
|
139
|
-
var _this = _super.call(this, "".concat(EthereumRPCDataTransfer.methodName, "(address,uint256)")) || this;
|
|
140
|
-
if (amount) {
|
|
141
|
-
var toAddress = toAddressOrData;
|
|
142
|
-
_this.recipient = toAddress;
|
|
143
|
-
_this.amount = amount;
|
|
144
|
-
}
|
|
145
|
-
else {
|
|
146
|
-
var data = toAddressOrData;
|
|
147
|
-
var methodID = _super.prototype.abiEncoded.call(_this);
|
|
148
|
-
if (!data.startsWith(methodID)) {
|
|
149
|
-
throw new errors_1.InvalidValueError(coinlib_error_1.Domain.ETHEREUM, 'unexpected method ID');
|
|
150
|
-
}
|
|
151
|
-
var params = data.slice(methodID.length);
|
|
152
|
-
var recipient = EthereumRPCData.removeLeadingZeroPadding(params.slice(0, EthereumRPCData.parametersLength));
|
|
153
|
-
var parsedAmount = EthereumRPCData.removeLeadingZeroPadding(params.slice(EthereumRPCData.parametersLength));
|
|
154
|
-
_this.recipient = "0x".concat(recipient);
|
|
155
|
-
_this.amount = "0x".concat(parsedAmount);
|
|
156
|
-
}
|
|
157
|
-
return _this;
|
|
158
|
-
}
|
|
159
|
-
EthereumRPCDataTransfer.prototype.abiEncoded = function () {
|
|
160
|
-
var dstAddress = this.recipient;
|
|
161
|
-
if (dstAddress.startsWith('0x')) {
|
|
162
|
-
dstAddress = dstAddress.slice(2);
|
|
163
|
-
}
|
|
164
|
-
var transferAmount = this.amount;
|
|
165
|
-
if (transferAmount.startsWith('0x')) {
|
|
166
|
-
transferAmount = transferAmount.slice(2);
|
|
167
|
-
}
|
|
168
|
-
return (_super.prototype.abiEncoded.call(this) +
|
|
169
|
-
EthereumRPCData.addLeadingZeroPadding(dstAddress.toLowerCase()) +
|
|
170
|
-
EthereumRPCData.addLeadingZeroPadding(transferAmount.toLowerCase()));
|
|
171
|
-
};
|
|
172
|
-
EthereumRPCDataTransfer.methodName = 'transfer';
|
|
173
|
-
return EthereumRPCDataTransfer;
|
|
174
|
-
}(EthereumRPCData));
|
|
175
|
-
exports.EthereumRPCDataTransfer = EthereumRPCDataTransfer;
|
|
176
|
-
var AirGapNodeClient = /** @class */ (function (_super) {
|
|
177
|
-
__extends(AirGapNodeClient, _super);
|
|
178
|
-
function AirGapNodeClient(baseURL) {
|
|
179
|
-
return _super.call(this, baseURL) || this;
|
|
180
|
-
}
|
|
181
|
-
AirGapNodeClient.prototype.fetchBalance = function (address) {
|
|
182
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
183
|
-
var body, response;
|
|
184
|
-
return __generator(this, function (_a) {
|
|
185
|
-
switch (_a.label) {
|
|
186
|
-
case 0:
|
|
187
|
-
body = new EthereumRPCBody('eth_getBalance', [address, EthereumRPCBody.blockLatest]);
|
|
188
|
-
return [4 /*yield*/, this.send(body)];
|
|
189
|
-
case 1:
|
|
190
|
-
response = _a.sent();
|
|
191
|
-
return [2 /*return*/, new bignumber_1.BigNumber(response.result)];
|
|
192
|
-
}
|
|
193
|
-
});
|
|
194
|
-
});
|
|
195
|
-
};
|
|
196
|
-
AirGapNodeClient.prototype.fetchTransactionCount = function (address) {
|
|
197
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
198
|
-
var body, response;
|
|
199
|
-
return __generator(this, function (_a) {
|
|
200
|
-
switch (_a.label) {
|
|
201
|
-
case 0:
|
|
202
|
-
body = new EthereumRPCBody('eth_getTransactionCount', [address, EthereumRPCBody.blockLatest]);
|
|
203
|
-
return [4 /*yield*/, this.send(body)];
|
|
204
|
-
case 1:
|
|
205
|
-
response = _a.sent();
|
|
206
|
-
return [2 /*return*/, new bignumber_1.BigNumber(response.result).toNumber()];
|
|
207
|
-
}
|
|
208
|
-
});
|
|
209
|
-
});
|
|
210
|
-
};
|
|
211
|
-
AirGapNodeClient.prototype.sendSignedTransaction = function (transaction) {
|
|
212
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
213
|
-
var body;
|
|
214
|
-
return __generator(this, function (_a) {
|
|
215
|
-
switch (_a.label) {
|
|
216
|
-
case 0:
|
|
217
|
-
body = new EthereumRPCBody('eth_sendRawTransaction', [transaction]);
|
|
218
|
-
return [4 /*yield*/, this.send(body)];
|
|
219
|
-
case 1: return [2 /*return*/, (_a.sent()).result];
|
|
220
|
-
}
|
|
221
|
-
});
|
|
222
|
-
});
|
|
223
|
-
};
|
|
224
|
-
AirGapNodeClient.prototype.getTransactionStatus = function (transactionHash) {
|
|
225
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
226
|
-
var body, response;
|
|
227
|
-
return __generator(this, function (_a) {
|
|
228
|
-
switch (_a.label) {
|
|
229
|
-
case 0:
|
|
230
|
-
body = new EthereumRPCBody('eth_getTransactionReceipt', [transactionHash]);
|
|
231
|
-
return [4 /*yield*/, this.send(body)];
|
|
232
|
-
case 1:
|
|
233
|
-
response = _a.sent();
|
|
234
|
-
return [2 /*return*/, response.result.status === '0x1' ? { type: 'applied' } : { type: 'failed' }];
|
|
235
|
-
}
|
|
236
|
-
});
|
|
237
|
-
});
|
|
238
|
-
};
|
|
239
|
-
AirGapNodeClient.prototype.callBalanceOf = function (contractAddress, address) {
|
|
240
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
241
|
-
var body, response;
|
|
242
|
-
return __generator(this, function (_a) {
|
|
243
|
-
switch (_a.label) {
|
|
244
|
-
case 0:
|
|
245
|
-
body = this.balanceOfBody(contractAddress, address);
|
|
246
|
-
return [4 /*yield*/, this.send(body)];
|
|
247
|
-
case 1:
|
|
248
|
-
response = _a.sent();
|
|
249
|
-
return [2 /*return*/, new bignumber_1.BigNumber(response.result)];
|
|
250
|
-
}
|
|
251
|
-
});
|
|
252
|
-
});
|
|
253
|
-
};
|
|
254
|
-
AirGapNodeClient.prototype.callBalanceOfOnContracts = function (contractAddresses, address) {
|
|
255
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
256
|
-
var bodies, responses, result;
|
|
257
|
-
var _this = this;
|
|
258
|
-
return __generator(this, function (_a) {
|
|
259
|
-
switch (_a.label) {
|
|
260
|
-
case 0:
|
|
261
|
-
bodies = contractAddresses.map(function (contractAddress, index) { return _this.balanceOfBody(contractAddress, address, index); });
|
|
262
|
-
return [4 /*yield*/, this.batchSend(bodies)];
|
|
263
|
-
case 1:
|
|
264
|
-
responses = _a.sent();
|
|
265
|
-
result = {};
|
|
266
|
-
responses.forEach(function (response) {
|
|
267
|
-
var _a;
|
|
268
|
-
result[contractAddresses[response.id]] = new bignumber_1.BigNumber((_a = response.result) !== null && _a !== void 0 ? _a : 0);
|
|
269
|
-
});
|
|
270
|
-
return [2 /*return*/, result];
|
|
271
|
-
}
|
|
272
|
-
});
|
|
273
|
-
});
|
|
274
|
-
};
|
|
275
|
-
AirGapNodeClient.prototype.balanceOfBody = function (contractAddress, address, id) {
|
|
276
|
-
if (id === void 0) { id = 0; }
|
|
277
|
-
var data = new EthereumRPCDataBalanceOf(address);
|
|
278
|
-
return new EthereumRPCBody('eth_call', [{ to: contractAddress, data: data.abiEncoded() }, EthereumRPCBody.blockLatest], id);
|
|
279
|
-
};
|
|
280
|
-
AirGapNodeClient.prototype.estimateTransactionGas = function (fromAddress, toAddress, amount, data, gas) {
|
|
281
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
282
|
-
var body, response;
|
|
283
|
-
return __generator(this, function (_a) {
|
|
284
|
-
switch (_a.label) {
|
|
285
|
-
case 0:
|
|
286
|
-
body = new EthereumRPCBody('eth_estimateGas', [{ from: fromAddress, to: toAddress, gas: gas, value: amount, data: data }]);
|
|
287
|
-
return [4 /*yield*/, this.send(body)];
|
|
288
|
-
case 1:
|
|
289
|
-
response = _a.sent();
|
|
290
|
-
return [2 /*return*/, new bignumber_1.BigNumber(response.result)];
|
|
291
|
-
}
|
|
292
|
-
});
|
|
293
|
-
});
|
|
294
|
-
};
|
|
295
|
-
AirGapNodeClient.prototype.estimateTransferGas = function (contractAddress, fromAddress, toAddress, hexAmount) {
|
|
296
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
297
|
-
var data, result;
|
|
298
|
-
return __generator(this, function (_a) {
|
|
299
|
-
data = new EthereumRPCDataTransfer(toAddress, hexAmount);
|
|
300
|
-
result = this.estimateTransactionGas(fromAddress, contractAddress, undefined, data.abiEncoded());
|
|
301
|
-
return [2 /*return*/, result];
|
|
302
|
-
});
|
|
303
|
-
});
|
|
304
|
-
};
|
|
305
|
-
AirGapNodeClient.prototype.getGasPrice = function () {
|
|
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_gasPrice', []);
|
|
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
|
-
AirGapNodeClient.prototype.send = function (body) {
|
|
321
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
322
|
-
var response;
|
|
323
|
-
return __generator(this, function (_a) {
|
|
324
|
-
switch (_a.label) {
|
|
325
|
-
case 0: return [4 /*yield*/, axios_0_19_0_1.default.post(this.baseURL, body.toRPCBody()).catch(function (error) {
|
|
326
|
-
throw new errors_1.NetworkError(coinlib_error_1.Domain.TEZOS, error);
|
|
327
|
-
})];
|
|
328
|
-
case 1:
|
|
329
|
-
response = _a.sent();
|
|
330
|
-
return [2 /*return*/, response.data];
|
|
331
|
-
}
|
|
332
|
-
});
|
|
333
|
-
});
|
|
334
|
-
};
|
|
335
|
-
AirGapNodeClient.prototype.batchSend = function (bodies) {
|
|
336
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
337
|
-
var data;
|
|
338
|
-
return __generator(this, function (_a) {
|
|
339
|
-
switch (_a.label) {
|
|
340
|
-
case 0: return [4 /*yield*/, axios_0_19_0_1.default.post(this.baseURL, JSON.stringify(bodies.map(function (body) { return body.toJSON(); })))];
|
|
341
|
-
case 1:
|
|
342
|
-
data = (_a.sent()).data;
|
|
343
|
-
return [2 /*return*/, data];
|
|
344
|
-
}
|
|
345
|
-
});
|
|
346
|
-
});
|
|
347
|
-
};
|
|
348
|
-
return AirGapNodeClient;
|
|
349
|
-
}(EthereumNodeClient_1.EthereumNodeClient));
|
|
350
|
-
exports.AirGapNodeClient = AirGapNodeClient;
|
|
351
|
-
//# sourceMappingURL=AirGapNodeClient.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":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A;;;;KACtC;IAEa,+BAAI,GAAlB,UAAmB,IAAqB;;;;;4BACrB,qBAAM,sBAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,UAAC,KAAK;4BAC5E,MAAM,IAAI,qBAAY,CAAC,sBAAM,CAAC,KAAK,EAAE,KAAmB,CAAC,CAAA;wBAC3D,CAAC,CAAC,EAAA;;wBAFI,QAAQ,GAAG,SAEf;wBAEF,sBAAO,QAAQ,CAAC,IAAI,EAAA;;;;KACrB;IAEa,oCAAS,GAAvB,UAAwB,MAAyB;;;;;4BACjC,qBAAM,sBAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,UAAC,IAAI,IAAK,OAAA,IAAI,CAAC,MAAM,EAAE,EAAb,CAAa,CAAC,CAAC,CAAC,EAAA;;wBAA3F,IAAI,GAAG,CAAC,SAAmF,CAAC,CAAC,IAAI;wBAEvG,sBAAO,IAAI,EAAA;;;;KACZ;IACH,uBAAC;AAAD,CAAC,AArGD,CAAsC,uCAAkB,GAqGvD;AArGY,4CAAgB"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import BigNumber from '@airgap/coinlib-core/dependencies/src/bignumber.js-9.0.0/bignumber';
|
|
2
|
-
import { AirGapTransactionStatus } from '@airgap/module-kit';
|
|
3
|
-
export declare abstract class EthereumNodeClient {
|
|
4
|
-
baseURL: string;
|
|
5
|
-
constructor(baseURL: string);
|
|
6
|
-
abstract fetchBalance(address: string): Promise<BigNumber>;
|
|
7
|
-
abstract fetchTransactionCount(address: string): Promise<number>;
|
|
8
|
-
abstract sendSignedTransaction(transaction: string): Promise<string>;
|
|
9
|
-
abstract callBalanceOf(contractAddress: string, address: string): Promise<BigNumber>;
|
|
10
|
-
abstract getTransactionStatus(transactionHash: string): Promise<AirGapTransactionStatus>;
|
|
11
|
-
abstract estimateTransferGas(contractAddress: string, fromAddress: string, toAddress: string, hexAmount: string): Promise<BigNumber>;
|
|
12
|
-
abstract estimateTransactionGas(fromAddress: string, toAddress: string, amount?: string, data?: string, gas?: string): Promise<BigNumber>;
|
|
13
|
-
abstract getGasPrice(): Promise<BigNumber>;
|
|
14
|
-
abstract callBalanceOfOnContracts(contractAddresses: string[], address: string): Promise<{
|
|
15
|
-
[contractAddress: string]: BigNumber;
|
|
16
|
-
}>;
|
|
17
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EthereumNodeClient = void 0;
|
|
4
|
-
var EthereumNodeClient = /** @class */ (function () {
|
|
5
|
-
function EthereumNodeClient(baseURL) {
|
|
6
|
-
this.baseURL = baseURL;
|
|
7
|
-
}
|
|
8
|
-
return EthereumNodeClient;
|
|
9
|
-
}());
|
|
10
|
-
exports.EthereumNodeClient = EthereumNodeClient;
|
|
11
|
-
//# sourceMappingURL=EthereumNodeClient.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EthereumNodeClient.js","sourceRoot":"","sources":["../../../../src/v1/clients/node/EthereumNodeClient.ts"],"names":[],"mappings":";;;AAGA;IAGE,4BAAY,OAAe;QACzB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;IAwBH,yBAAC;AAAD,CAAC,AA7BD,IA6BC;AA7BqB,gDAAkB"}
|
|
@@ -1,46 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { EtherscanBlockExplorer } from './block-explorer/EtherscanBlockExplorer';
|
|
2
|
-
import { EthereumModule } from './module/EthereumModule';
|
|
3
|
-
import { createERC20Token, ERC20Token } from './protocol/erc20/ERC20Token';
|
|
4
|
-
import { createEthereumProtocol, createEthereumProtocolOptions, EthereumProtocol } from './protocol/EthereumProtocol';
|
|
5
|
-
import { ERC20TokenMetadata, EthereumProtocolNetwork, EthereumProtocolOptions, EthereumUnits } from './types/protocol';
|
|
6
|
-
import { EthereumRawUnsignedTransaction, EthereumSignedTransaction, EthereumTransactionCursor, EthereumTypedUnsignedTransaction, EthereumUnsignedTransaction } from './types/transaction';
|
|
7
|
-
export { EthereumModule };
|
|
8
|
-
export { EthereumProtocol, createEthereumProtocol, createEthereumProtocolOptions, ERC20Token, createERC20Token };
|
|
9
|
-
export { EtherscanBlockExplorer };
|
|
10
|
-
export { EthereumUnits, EthereumProtocolNetwork, EthereumProtocolOptions, ERC20TokenMetadata, EthereumUnsignedTransaction, EthereumTypedUnsignedTransaction, EthereumRawUnsignedTransaction, EthereumSignedTransaction, EthereumTransactionCursor };
|
package/v1/index.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EtherscanBlockExplorer = exports.createERC20Token = exports.createEthereumProtocolOptions = exports.createEthereumProtocol = exports.EthereumModule = void 0;
|
|
4
|
-
var EtherscanBlockExplorer_1 = require("./block-explorer/EtherscanBlockExplorer");
|
|
5
|
-
Object.defineProperty(exports, "EtherscanBlockExplorer", { enumerable: true, get: function () { return EtherscanBlockExplorer_1.EtherscanBlockExplorer; } });
|
|
6
|
-
var EthereumModule_1 = require("./module/EthereumModule");
|
|
7
|
-
Object.defineProperty(exports, "EthereumModule", { enumerable: true, get: function () { return EthereumModule_1.EthereumModule; } });
|
|
8
|
-
var ERC20Token_1 = require("./protocol/erc20/ERC20Token");
|
|
9
|
-
Object.defineProperty(exports, "createERC20Token", { enumerable: true, get: function () { return ERC20Token_1.createERC20Token; } });
|
|
10
|
-
var EthereumProtocol_1 = require("./protocol/EthereumProtocol");
|
|
11
|
-
Object.defineProperty(exports, "createEthereumProtocol", { enumerable: true, get: function () { return EthereumProtocol_1.createEthereumProtocol; } });
|
|
12
|
-
Object.defineProperty(exports, "createEthereumProtocolOptions", { enumerable: true, get: function () { return EthereumProtocol_1.createEthereumProtocolOptions; } });
|
|
13
|
-
//# sourceMappingURL=index.js.map
|
package/v1/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/v1/index.ts"],"names":[],"mappings":";;;AAAA,kFAAgF;AAuBvE,uGAvBA,+CAAsB,OAuBA;AAtB/B,0DAAwD;AAc/C,+FAdA,+BAAc,OAcA;AAbvB,0DAA0E;AAiBoB,iGAjBrF,6BAAgB,OAiBqF;AAhB9G,gEAAqH;AAgB1F,uGAhBlB,yCAAsB,OAgBkB;AAAE,8GAhBlB,gDAA6B,OAgBkB"}
|