@airgap/ethereum 0.13.11-beta.1 → 0.13.11-beta.11
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/index.d.ts +1 -0
- package/index.js +18 -0
- package/index.js.map +1 -0
- package/package.json +1 -5
- package/v0/index.d.ts +12 -0
- package/v0/index.js +39 -0
- package/v0/index.js.map +1 -0
- package/v0/protocol/BaseEthereumProtocol.d.ts +98 -0
- package/v0/protocol/BaseEthereumProtocol.js +939 -0
- package/v0/protocol/BaseEthereumProtocol.js.map +1 -0
- package/v0/protocol/EthereumAddress.d.ts +8 -0
- package/v0/protocol/EthereumAddress.js +43 -0
- package/v0/protocol/EthereumAddress.js.map +1 -0
- package/v0/protocol/EthereumChainIDs.d.ts +1 -0
- package/v0/protocol/EthereumChainIDs.js +340 -0
- package/v0/protocol/EthereumChainIDs.js.map +1 -0
- package/v0/protocol/EthereumClassicProtocol.d.ts +6 -0
- package/v0/protocol/EthereumClassicProtocol.js +30 -0
- package/v0/protocol/EthereumClassicProtocol.js.map +1 -0
- package/v0/protocol/EthereumCryptoClient.d.ts +12 -0
- package/v0/protocol/EthereumCryptoClient.js +148 -0
- package/v0/protocol/EthereumCryptoClient.js.map +1 -0
- package/v0/protocol/EthereumProtocol.d.ts +10 -0
- package/v0/protocol/EthereumProtocol.js +34 -0
- package/v0/protocol/EthereumProtocol.js.map +1 -0
- package/v0/protocol/EthereumProtocolOptions.d.ts +46 -0
- package/v0/protocol/EthereumProtocolOptions.js +150 -0
- package/v0/protocol/EthereumProtocolOptions.js.map +1 -0
- package/v0/protocol/EthereumRopstenProtocol.d.ts +6 -0
- package/v0/protocol/EthereumRopstenProtocol.js +30 -0
- package/v0/protocol/EthereumRopstenProtocol.js.map +1 -0
- package/v0/protocol/EthereumTypes.d.ts +14 -0
- package/v0/protocol/EthereumTypes.js +3 -0
- package/v0/protocol/EthereumTypes.js.map +1 -0
- package/v0/protocol/clients/info-clients/EtherscanInfoClient.d.ts +8 -0
- package/v0/protocol/clients/info-clients/EtherscanInfoClient.js +195 -0
- package/v0/protocol/clients/info-clients/EtherscanInfoClient.js.map +1 -0
- package/v0/protocol/clients/info-clients/InfoClient.d.ts +8 -0
- package/v0/protocol/clients/info-clients/InfoClient.js +11 -0
- package/v0/protocol/clients/info-clients/InfoClient.js.map +1 -0
- package/v0/protocol/clients/node-clients/AirGapNodeClient.d.ts +41 -0
- package/v0/protocol/clients/node-clients/AirGapNodeClient.js +353 -0
- package/v0/protocol/clients/node-clients/AirGapNodeClient.js.map +1 -0
- package/v0/protocol/clients/node-clients/NodeClient.d.ts +17 -0
- package/v0/protocol/clients/node-clients/NodeClient.js +11 -0
- package/v0/protocol/clients/node-clients/NodeClient.js.map +1 -0
- package/v0/protocol/erc20/ERC20.d.ts +3 -0
- package/v0/protocol/erc20/ERC20.js +9 -0
- package/v0/protocol/erc20/ERC20.js.map +1 -0
- package/v0/protocol/erc20/GenericERC20.d.ts +32 -0
- package/v0/protocol/erc20/GenericERC20.js +335 -0
- package/v0/protocol/erc20/GenericERC20.js.map +1 -0
- package/v0/protocol/utils/utils.d.ts +13 -0
- package/v0/protocol/utils/utils.js +140 -0
- package/v0/protocol/utils/utils.js.map +1 -0
- package/v0/serializer/schemas/v2/transaction-sign-request-ethereum.json +50 -0
- package/v0/serializer/schemas/v2/transaction-sign-response-ethereum.json +19 -0
- package/v0/serializer/schemas/v3/transaction-sign-request-ethereum-typed.json +38 -0
- package/v0/serializer/schemas/v3/transaction-sign-request-ethereum.json +50 -0
- package/v0/serializer/schemas/v3/transaction-sign-response-ethereum.json +19 -0
- package/v0/serializer/validators/transaction-validator.d.ts +15 -0
- package/v0/serializer/validators/transaction-validator.js +96 -0
- package/v0/serializer/validators/transaction-validator.js.map +1 -0
- package/v0/serializer/validators/validators.d.ts +1 -0
- package/v0/serializer/validators/validators.js +78 -0
- package/v0/serializer/validators/validators.js.map +1 -0
- package/v0/types/signed-transaction-ethereum.d.ts +5 -0
- package/v0/types/signed-transaction-ethereum.js +3 -0
- package/v0/types/signed-transaction-ethereum.js.map +1 -0
- package/v0/types/transaction-ethereum.d.ts +14 -0
- package/v0/types/transaction-ethereum.js +3 -0
- package/v0/types/transaction-ethereum.js.map +1 -0
- package/v0/types/unsigned-transaction-ethereum-typed.d.ts +11 -0
- package/v0/types/unsigned-transaction-ethereum-typed.js +3 -0
- package/v0/types/unsigned-transaction-ethereum-typed.js.map +1 -0
- package/v0/types/unsigned-transaction-ethereum.d.ts +15 -0
- package/v0/types/unsigned-transaction-ethereum.js +3 -0
- package/v0/types/unsigned-transaction-ethereum.js.map +1 -0
- package/v1/block-explorer/EtherscanBlockExplorer.d.ts +9 -0
- package/v1/block-explorer/EtherscanBlockExplorer.js +74 -0
- package/v1/block-explorer/EtherscanBlockExplorer.js.map +1 -0
- 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 +15 -0
- package/v1/clients/info/EthereumInfoClient.js +11 -0
- package/v1/clients/info/EthereumInfoClient.js.map +1 -0
- package/v1/clients/info/EtherscanInfoClient.d.ts +7 -0
- package/v1/clients/info/EtherscanInfoClient.js +165 -0
- package/v1/clients/info/EtherscanInfoClient.js.map +1 -0
- package/v1/clients/node/AirGapNodeClient.d.ts +41 -0
- package/v1/clients/node/AirGapNodeClient.js +351 -0
- package/v1/clients/node/AirGapNodeClient.js.map +1 -0
- package/v1/clients/node/EthereumNodeClient.d.ts +17 -0
- package/v1/clients/node/EthereumNodeClient.js +11 -0
- package/v1/clients/node/EthereumNodeClient.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 +11 -0
- package/v1/index.js +13 -0
- package/v1/index.js.map +1 -0
- package/v1/module/ERC20Tokens.d.ts +3 -0
- package/v1/module/ERC20Tokens.js +815 -0
- package/v1/module/ERC20Tokens.js.map +1 -0
- package/v1/module/EthereumModule.d.ts +13 -0
- package/v1/module/EthereumModule.js +125 -0
- package/v1/module/EthereumModule.js.map +1 -0
- package/v1/module.d.ts +3 -0
- package/v1/module.js +24 -0
- package/v1/module.js.map +1 -0
- package/v1/protocol/EthereumBaseProtocol.d.ts +84 -0
- package/v1/protocol/EthereumBaseProtocol.js +827 -0
- package/v1/protocol/EthereumBaseProtocol.js.map +1 -0
- 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 +8 -0
- package/v1/protocol/EthereumProtocol.js +64 -0
- package/v1/protocol/EthereumProtocol.js.map +1 -0
- package/v1/protocol/erc20/ERC20Token.d.ts +8 -0
- package/v1/protocol/erc20/ERC20Token.js +421 -0
- package/v1/protocol/erc20/ERC20Token.js.map +1 -0
- package/v1/serializer/v3/schemas/converter/transaction-converter.d.ts +12 -0
- package/v1/serializer/v3/schemas/converter/transaction-converter.js +80 -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.d.ts +13 -0
- package/v1/serializer/v3/serializer-companion.js +190 -0
- package/v1/serializer/v3/serializer-companion.js.map +1 -0
- 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 +32 -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 +13 -0
- package/v1/utils/EthereumUtils.js +140 -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
|
@@ -0,0 +1,148 @@
|
|
|
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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
|
+
if (k2 === undefined) k2 = k;
|
|
19
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
20
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
21
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
22
|
+
}
|
|
23
|
+
Object.defineProperty(o, k2, desc);
|
|
24
|
+
}) : (function(o, m, k, k2) {
|
|
25
|
+
if (k2 === undefined) k2 = k;
|
|
26
|
+
o[k2] = m[k];
|
|
27
|
+
}));
|
|
28
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
29
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
30
|
+
}) : function(o, v) {
|
|
31
|
+
o["default"] = v;
|
|
32
|
+
});
|
|
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
|
+
};
|
|
76
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
77
|
+
exports.EthereumCryptoClient = void 0;
|
|
78
|
+
// @ts-ignore
|
|
79
|
+
var EthereumJSUtils = __importStar(require("@airgap/coinlib-core/dependencies/src/ethereumjs-util-5.2.0"));
|
|
80
|
+
var errors_1 = require("@airgap/coinlib-core/errors");
|
|
81
|
+
var coinlib_error_1 = require("@airgap/coinlib-core/errors/coinlib-error");
|
|
82
|
+
var Secp256k1CryptoClient_1 = require("@airgap/coinlib-core/protocols/Secp256k1CryptoClient");
|
|
83
|
+
var eth_sig_util_1 = require("@metamask/eth-sig-util");
|
|
84
|
+
var EthereumCryptoClient = /** @class */ (function (_super) {
|
|
85
|
+
__extends(EthereumCryptoClient, _super);
|
|
86
|
+
function EthereumCryptoClient(protocol) {
|
|
87
|
+
var _this = _super.call(this) || this;
|
|
88
|
+
_this.protocol = protocol;
|
|
89
|
+
return _this;
|
|
90
|
+
}
|
|
91
|
+
EthereumCryptoClient.prototype.signMessage = function (message, keypair) {
|
|
92
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
93
|
+
var privateKey, msgParams_1, msgParams_2, msgParams, messageBuffer, signature;
|
|
94
|
+
return __generator(this, function (_a) {
|
|
95
|
+
if (!keypair.privateKey) {
|
|
96
|
+
throw new errors_1.NotFoundError(coinlib_error_1.Domain.ETHEREUM, "Private key not provided");
|
|
97
|
+
}
|
|
98
|
+
privateKey = Buffer.from(keypair.privateKey, 'hex');
|
|
99
|
+
try {
|
|
100
|
+
try {
|
|
101
|
+
msgParams_1 = JSON.parse(message) // TODO types
|
|
102
|
+
;
|
|
103
|
+
return [2 /*return*/, (0, eth_sig_util_1.signTypedData)({ privateKey: privateKey, data: msgParams_1, version: eth_sig_util_1.SignTypedDataVersion.V4 })];
|
|
104
|
+
}
|
|
105
|
+
catch (e) { }
|
|
106
|
+
try {
|
|
107
|
+
msgParams_2 = JSON.parse(message) // TODO types
|
|
108
|
+
;
|
|
109
|
+
return [2 /*return*/, (0, eth_sig_util_1.signTypedData)({ privateKey: privateKey, data: msgParams_2, version: eth_sig_util_1.SignTypedDataVersion.V3 })];
|
|
110
|
+
}
|
|
111
|
+
catch (e) { }
|
|
112
|
+
msgParams = JSON.parse(message);
|
|
113
|
+
return [2 /*return*/, (0, eth_sig_util_1.signTypedData)({ privateKey: privateKey, data: msgParams, version: eth_sig_util_1.SignTypedDataVersion.V1 })];
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
messageBuffer = EthereumJSUtils.hashPersonalMessage(EthereumJSUtils.toBuffer(message));
|
|
117
|
+
signature = EthereumJSUtils.ecsign(messageBuffer, privateKey);
|
|
118
|
+
return [2 /*return*/, EthereumJSUtils.toRpcSig(signature.v, signature.r, signature.s)];
|
|
119
|
+
}
|
|
120
|
+
return [2 /*return*/];
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
EthereumCryptoClient.prototype.verifyMessage = function (message, signature, publicKey) {
|
|
125
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
126
|
+
var msgBuffer, msgHash, signatureBuffer, signatureParams, recoveredPublicKey, recoveredAddressBuffer, recoveredAddress, address;
|
|
127
|
+
return __generator(this, function (_a) {
|
|
128
|
+
switch (_a.label) {
|
|
129
|
+
case 0:
|
|
130
|
+
msgBuffer = EthereumJSUtils.toBuffer(message);
|
|
131
|
+
msgHash = EthereumJSUtils.hashPersonalMessage(msgBuffer);
|
|
132
|
+
signatureBuffer = EthereumJSUtils.toBuffer(signature);
|
|
133
|
+
signatureParams = EthereumJSUtils.fromRpcSig(signatureBuffer);
|
|
134
|
+
recoveredPublicKey = EthereumJSUtils.ecrecover(msgHash, signatureParams.v, signatureParams.r, signatureParams.s);
|
|
135
|
+
recoveredAddressBuffer = EthereumJSUtils.publicToAddress(recoveredPublicKey);
|
|
136
|
+
recoveredAddress = EthereumJSUtils.bufferToHex(recoveredAddressBuffer);
|
|
137
|
+
return [4 /*yield*/, this.protocol.getAddressFromPublicKey(publicKey)];
|
|
138
|
+
case 1:
|
|
139
|
+
address = _a.sent();
|
|
140
|
+
return [2 /*return*/, recoveredAddress.toLowerCase() === address.address.toLowerCase()];
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
};
|
|
145
|
+
return EthereumCryptoClient;
|
|
146
|
+
}(Secp256k1CryptoClient_1.Secp256k1CryptoClient));
|
|
147
|
+
exports.EthereumCryptoClient = EthereumCryptoClient;
|
|
148
|
+
//# sourceMappingURL=EthereumCryptoClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EthereumCryptoClient.js","sourceRoot":"","sources":["../../../src/v0/protocol/EthereumCryptoClient.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BaseEthereumProtocol } from './BaseEthereumProtocol';
|
|
2
|
+
import { EtherscanInfoClient } from './clients/info-clients/EtherscanInfoClient';
|
|
3
|
+
import { AirGapNodeClient } from './clients/node-clients/AirGapNodeClient';
|
|
4
|
+
import { EthereumProtocolOptions } from './EthereumProtocolOptions';
|
|
5
|
+
export declare class EthereumProtocol extends BaseEthereumProtocol<AirGapNodeClient, EtherscanInfoClient> {
|
|
6
|
+
readonly options: EthereumProtocolOptions;
|
|
7
|
+
supportsHD: boolean;
|
|
8
|
+
standardDerivationPath: string;
|
|
9
|
+
constructor(options?: EthereumProtocolOptions);
|
|
10
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.EthereumProtocol = void 0;
|
|
19
|
+
var BaseEthereumProtocol_1 = require("./BaseEthereumProtocol");
|
|
20
|
+
var EthereumProtocolOptions_1 = require("./EthereumProtocolOptions");
|
|
21
|
+
var EthereumProtocol = /** @class */ (function (_super) {
|
|
22
|
+
__extends(EthereumProtocol, _super);
|
|
23
|
+
function EthereumProtocol(options) {
|
|
24
|
+
if (options === void 0) { options = new EthereumProtocolOptions_1.EthereumProtocolOptions(); }
|
|
25
|
+
var _this = _super.call(this, options) || this;
|
|
26
|
+
_this.options = options;
|
|
27
|
+
_this.supportsHD = true;
|
|
28
|
+
_this.standardDerivationPath = "m/44'/60'/0'";
|
|
29
|
+
return _this;
|
|
30
|
+
}
|
|
31
|
+
return EthereumProtocol;
|
|
32
|
+
}(BaseEthereumProtocol_1.BaseEthereumProtocol));
|
|
33
|
+
exports.EthereumProtocol = EthereumProtocol;
|
|
34
|
+
//# sourceMappingURL=EthereumProtocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EthereumProtocol.js","sourceRoot":"","sources":["../../../src/v0/protocol/EthereumProtocol.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,+DAA6D;AAG7D,qEAAmE;AAEnE;IAAsC,oCAA2D;IAI/F,0BAA4B,OAAgE;QAAhE,wBAAA,EAAA,cAAuC,iDAAuB,EAAE;QAA5F,YACE,kBAAM,OAAO,CAAC,SACf;QAF2B,aAAO,GAAP,OAAO,CAAyD;QAHrF,gBAAU,GAAY,IAAI,CAAA;QAC1B,4BAAsB,GAAW,cAAc,CAAA;;IAItD,CAAC;IACH,uBAAC;AAAD,CAAC,AAPD,CAAsC,2CAAoB,GAOzD;AAPY,4CAAgB"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ProtocolBlockExplorer } from '@airgap/coinlib-core/utils/ProtocolBlockExplorer';
|
|
2
|
+
import { NetworkType, ProtocolNetwork } from '@airgap/coinlib-core/utils/ProtocolNetwork';
|
|
3
|
+
import { ProtocolOptions } from '@airgap/coinlib-core/utils/ProtocolOptions';
|
|
4
|
+
import { SubProtocolSymbols } from '@airgap/coinlib-core/utils/ProtocolSymbols';
|
|
5
|
+
import { EthereumInfoClient } from './clients/info-clients/InfoClient';
|
|
6
|
+
import { EthereumNodeClient } from './clients/node-clients/NodeClient';
|
|
7
|
+
export declare const NODE_URL: string;
|
|
8
|
+
export declare const BLOCK_EXPLORER_API: string;
|
|
9
|
+
export declare class EthereumProtocolNetworkExtras {
|
|
10
|
+
readonly chainID: number;
|
|
11
|
+
readonly blockExplorerApi: string;
|
|
12
|
+
constructor(chainID?: number, blockExplorerApi?: string);
|
|
13
|
+
}
|
|
14
|
+
export declare class EtherscanBlockExplorer implements ProtocolBlockExplorer {
|
|
15
|
+
readonly blockExplorer: string;
|
|
16
|
+
constructor(blockExplorer?: string);
|
|
17
|
+
getAddressLink(address: string): Promise<string>;
|
|
18
|
+
getTransactionLink(transactionId: string): Promise<string>;
|
|
19
|
+
}
|
|
20
|
+
export declare class EthereumProtocolNetwork extends ProtocolNetwork<EthereumProtocolNetworkExtras> {
|
|
21
|
+
constructor(name?: string, type?: NetworkType, rpcUrl?: string, blockExplorer?: ProtocolBlockExplorer, extras?: EthereumProtocolNetworkExtras);
|
|
22
|
+
}
|
|
23
|
+
export declare class EthereumProtocolConfig {
|
|
24
|
+
constructor();
|
|
25
|
+
}
|
|
26
|
+
export declare class EthereumProtocolOptions implements ProtocolOptions<EthereumProtocolConfig> {
|
|
27
|
+
readonly network: EthereumProtocolNetwork;
|
|
28
|
+
readonly config: EthereumProtocolConfig;
|
|
29
|
+
readonly nodeClient: EthereumNodeClient;
|
|
30
|
+
readonly infoClient: EthereumInfoClient;
|
|
31
|
+
constructor(network?: EthereumProtocolNetwork, config?: EthereumProtocolConfig);
|
|
32
|
+
}
|
|
33
|
+
export declare class EthereumERC20ProtocolConfig {
|
|
34
|
+
readonly symbol: string;
|
|
35
|
+
readonly name: string;
|
|
36
|
+
readonly marketSymbol: string;
|
|
37
|
+
readonly identifier: SubProtocolSymbols;
|
|
38
|
+
readonly contractAddress: string;
|
|
39
|
+
readonly decimals: number;
|
|
40
|
+
constructor(symbol: string, name: string, marketSymbol: string, identifier: SubProtocolSymbols, contractAddress: string, decimals: number);
|
|
41
|
+
}
|
|
42
|
+
export declare class EthereumERC20ProtocolOptions extends EthereumProtocolOptions {
|
|
43
|
+
readonly network: EthereumProtocolNetwork;
|
|
44
|
+
readonly config: EthereumERC20ProtocolConfig;
|
|
45
|
+
constructor(network: EthereumProtocolNetwork, config: EthereumERC20ProtocolConfig);
|
|
46
|
+
}
|
|
@@ -0,0 +1,150 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
+
exports.EthereumERC20ProtocolOptions = exports.EthereumERC20ProtocolConfig = exports.EthereumProtocolOptions = exports.EthereumProtocolConfig = exports.EthereumProtocolNetwork = exports.EtherscanBlockExplorer = exports.EthereumProtocolNetworkExtras = exports.BLOCK_EXPLORER_API = exports.NODE_URL = void 0;
|
|
55
|
+
var ProtocolNetwork_1 = require("@airgap/coinlib-core/utils/ProtocolNetwork");
|
|
56
|
+
var EtherscanInfoClient_1 = require("./clients/info-clients/EtherscanInfoClient");
|
|
57
|
+
var AirGapNodeClient_1 = require("./clients/node-clients/AirGapNodeClient");
|
|
58
|
+
// tslint:disable:max-classes-per-file
|
|
59
|
+
var MAINNET_NAME = 'Mainnet';
|
|
60
|
+
exports.NODE_URL = 'https://eth-rpc-proxy.airgap.prod.gke.papers.tech';
|
|
61
|
+
var BLOCK_EXPLORER_URL = 'https://etherscan.io';
|
|
62
|
+
exports.BLOCK_EXPLORER_API = 'https://api.etherscan.io';
|
|
63
|
+
var EthereumProtocolNetworkExtras = /** @class */ (function () {
|
|
64
|
+
function EthereumProtocolNetworkExtras(chainID, blockExplorerApi) {
|
|
65
|
+
if (chainID === void 0) { chainID = 1; }
|
|
66
|
+
if (blockExplorerApi === void 0) { blockExplorerApi = exports.BLOCK_EXPLORER_API; }
|
|
67
|
+
this.chainID = chainID;
|
|
68
|
+
this.blockExplorerApi = blockExplorerApi;
|
|
69
|
+
}
|
|
70
|
+
return EthereumProtocolNetworkExtras;
|
|
71
|
+
}());
|
|
72
|
+
exports.EthereumProtocolNetworkExtras = EthereumProtocolNetworkExtras;
|
|
73
|
+
var EtherscanBlockExplorer = /** @class */ (function () {
|
|
74
|
+
function EtherscanBlockExplorer(blockExplorer) {
|
|
75
|
+
if (blockExplorer === void 0) { blockExplorer = BLOCK_EXPLORER_URL; }
|
|
76
|
+
this.blockExplorer = blockExplorer;
|
|
77
|
+
}
|
|
78
|
+
EtherscanBlockExplorer.prototype.getAddressLink = function (address) {
|
|
79
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
80
|
+
return __generator(this, function (_a) {
|
|
81
|
+
return [2 /*return*/, "".concat(this.blockExplorer, "/address/").concat(address)];
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
EtherscanBlockExplorer.prototype.getTransactionLink = function (transactionId) {
|
|
86
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
87
|
+
return __generator(this, function (_a) {
|
|
88
|
+
return [2 /*return*/, "".concat(this.blockExplorer, "/tx/").concat(transactionId)];
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
return EtherscanBlockExplorer;
|
|
93
|
+
}());
|
|
94
|
+
exports.EtherscanBlockExplorer = EtherscanBlockExplorer;
|
|
95
|
+
var EthereumProtocolNetwork = /** @class */ (function (_super) {
|
|
96
|
+
__extends(EthereumProtocolNetwork, _super);
|
|
97
|
+
function EthereumProtocolNetwork(name, type, rpcUrl, blockExplorer, extras) {
|
|
98
|
+
if (name === void 0) { name = MAINNET_NAME; }
|
|
99
|
+
if (type === void 0) { type = ProtocolNetwork_1.NetworkType.MAINNET; }
|
|
100
|
+
if (rpcUrl === void 0) { rpcUrl = exports.NODE_URL; }
|
|
101
|
+
if (blockExplorer === void 0) { blockExplorer = new EtherscanBlockExplorer(); }
|
|
102
|
+
if (extras === void 0) { extras = new EthereumProtocolNetworkExtras(); }
|
|
103
|
+
return _super.call(this, name, type, rpcUrl, blockExplorer, extras) || this;
|
|
104
|
+
}
|
|
105
|
+
return EthereumProtocolNetwork;
|
|
106
|
+
}(ProtocolNetwork_1.ProtocolNetwork));
|
|
107
|
+
exports.EthereumProtocolNetwork = EthereumProtocolNetwork;
|
|
108
|
+
var EthereumProtocolConfig = /** @class */ (function () {
|
|
109
|
+
function EthereumProtocolConfig() {
|
|
110
|
+
}
|
|
111
|
+
return EthereumProtocolConfig;
|
|
112
|
+
}());
|
|
113
|
+
exports.EthereumProtocolConfig = EthereumProtocolConfig;
|
|
114
|
+
var EthereumProtocolOptions = /** @class */ (function () {
|
|
115
|
+
function EthereumProtocolOptions(network, config) {
|
|
116
|
+
if (network === void 0) { network = new EthereumProtocolNetwork(); }
|
|
117
|
+
if (config === void 0) { config = new EthereumProtocolConfig(); }
|
|
118
|
+
this.network = network;
|
|
119
|
+
this.config = config;
|
|
120
|
+
this.nodeClient = new AirGapNodeClient_1.AirGapNodeClient(network.rpcUrl);
|
|
121
|
+
this.infoClient = new EtherscanInfoClient_1.EtherscanInfoClient(network.extras.blockExplorerApi);
|
|
122
|
+
}
|
|
123
|
+
return EthereumProtocolOptions;
|
|
124
|
+
}());
|
|
125
|
+
exports.EthereumProtocolOptions = EthereumProtocolOptions;
|
|
126
|
+
var EthereumERC20ProtocolConfig = /** @class */ (function () {
|
|
127
|
+
function EthereumERC20ProtocolConfig(symbol, name, marketSymbol, identifier, contractAddress, decimals) {
|
|
128
|
+
this.symbol = symbol;
|
|
129
|
+
this.name = name;
|
|
130
|
+
this.marketSymbol = marketSymbol;
|
|
131
|
+
this.identifier = identifier;
|
|
132
|
+
this.contractAddress = contractAddress;
|
|
133
|
+
this.decimals = decimals;
|
|
134
|
+
}
|
|
135
|
+
return EthereumERC20ProtocolConfig;
|
|
136
|
+
}());
|
|
137
|
+
exports.EthereumERC20ProtocolConfig = EthereumERC20ProtocolConfig;
|
|
138
|
+
var EthereumERC20ProtocolOptions = /** @class */ (function (_super) {
|
|
139
|
+
__extends(EthereumERC20ProtocolOptions, _super);
|
|
140
|
+
function EthereumERC20ProtocolOptions(network, config) {
|
|
141
|
+
if (network === void 0) { network = new EthereumProtocolNetwork(); }
|
|
142
|
+
var _this = _super.call(this, network, config) || this;
|
|
143
|
+
_this.network = network;
|
|
144
|
+
_this.config = config;
|
|
145
|
+
return _this;
|
|
146
|
+
}
|
|
147
|
+
return EthereumERC20ProtocolOptions;
|
|
148
|
+
}(EthereumProtocolOptions));
|
|
149
|
+
exports.EthereumERC20ProtocolOptions = EthereumERC20ProtocolOptions;
|
|
150
|
+
//# sourceMappingURL=EthereumProtocolOptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EthereumProtocolOptions.js","sourceRoot":"","sources":["../../../src/v0/protocol/EthereumProtocolOptions.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BaseEthereumProtocol } from './BaseEthereumProtocol';
|
|
2
|
+
import { EtherscanInfoClient } from './clients/info-clients/EtherscanInfoClient';
|
|
3
|
+
import { AirGapNodeClient } from './clients/node-clients/AirGapNodeClient';
|
|
4
|
+
export declare class EthereumRopstenProtocol extends BaseEthereumProtocol<AirGapNodeClient, EtherscanInfoClient> {
|
|
5
|
+
constructor();
|
|
6
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.EthereumRopstenProtocol = void 0;
|
|
19
|
+
var BaseEthereumProtocol_1 = require("./BaseEthereumProtocol");
|
|
20
|
+
var EthereumProtocolOptions_1 = require("./EthereumProtocolOptions");
|
|
21
|
+
var EthereumRopstenProtocol = /** @class */ (function (_super) {
|
|
22
|
+
__extends(EthereumRopstenProtocol, _super);
|
|
23
|
+
function EthereumRopstenProtocol() {
|
|
24
|
+
// we probably need another network here, explorer is ok
|
|
25
|
+
return _super.call(this, new EthereumProtocolOptions_1.EthereumProtocolOptions(new EthereumProtocolOptions_1.EthereumProtocolNetwork(undefined, undefined, 'https://ropsten.infura.io', undefined, new EthereumProtocolOptions_1.EthereumProtocolNetworkExtras(3, 'https://api-ropsten.etherscan.io/')))) || this;
|
|
26
|
+
}
|
|
27
|
+
return EthereumRopstenProtocol;
|
|
28
|
+
}(BaseEthereumProtocol_1.BaseEthereumProtocol));
|
|
29
|
+
exports.EthereumRopstenProtocol = EthereumRopstenProtocol;
|
|
30
|
+
//# sourceMappingURL=EthereumRopstenProtocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EthereumRopstenProtocol.js","sourceRoot":"","sources":["../../../src/v0/protocol/EthereumRopstenProtocol.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,+DAA6D;AAG7D,qEAA2H;AAE3H;IAA6C,2CAA2D;IACtG;QACE,wDAAwD;eACxD,kBACE,IAAI,iDAAuB,CACzB,IAAI,iDAAuB,CACzB,SAAS,EACT,SAAS,EACT,2BAA2B,EAC3B,SAAS,EACT,IAAI,uDAA6B,CAAC,CAAC,EAAE,mCAAmC,CAAC,CAC1E,CACF,CACF;IACH,CAAC;IACH,8BAAC;AAAD,CAAC,AAfD,CAA6C,2CAAoB,GAehE;AAfY,0DAAuB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IAirGapAddressResult, IProtocolAddressCursor } from '@airgap/coinlib-core/interfaces/IAirGapAddress';
|
|
2
|
+
import { IAirGapTransaction } from '@airgap/coinlib-core/interfaces/IAirGapTransaction';
|
|
3
|
+
export interface EthereumTransactionCursor {
|
|
4
|
+
page: number;
|
|
5
|
+
}
|
|
6
|
+
export interface EthereumTransactionResult {
|
|
7
|
+
transactions: IAirGapTransaction[];
|
|
8
|
+
cursor: EthereumTransactionCursor;
|
|
9
|
+
}
|
|
10
|
+
export interface EthereumAddressCursor extends IProtocolAddressCursor {
|
|
11
|
+
hasNext: false;
|
|
12
|
+
}
|
|
13
|
+
export interface EthereumAddressResult extends IAirGapAddressResult<EthereumAddressCursor> {
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EthereumTypes.js","sourceRoot":"","sources":["../../../src/v0/protocol/EthereumTypes.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { EthereumProtocol } from '../../EthereumProtocol';
|
|
2
|
+
import { EthereumTransactionCursor, EthereumTransactionResult } from '../../EthereumTypes';
|
|
3
|
+
import { EthereumInfoClient } from './InfoClient';
|
|
4
|
+
export declare class EtherscanInfoClient extends EthereumInfoClient {
|
|
5
|
+
constructor(baseURL?: string);
|
|
6
|
+
fetchTransactions(protocol: EthereumProtocol, address: string, limit: any, cursor?: EthereumTransactionCursor): Promise<EthereumTransactionResult>;
|
|
7
|
+
fetchContractTransactions(protocol: EthereumProtocol, contractAddress: string, address: string, limit: number, cursor?: EthereumTransactionCursor): Promise<EthereumTransactionResult>;
|
|
8
|
+
}
|