@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.
Files changed (159) hide show
  1. package/index.d.ts +1 -0
  2. package/index.js +18 -0
  3. package/index.js.map +1 -0
  4. package/package.json +1 -5
  5. package/v0/index.d.ts +12 -0
  6. package/v0/index.js +39 -0
  7. package/v0/index.js.map +1 -0
  8. package/v0/protocol/BaseEthereumProtocol.d.ts +98 -0
  9. package/v0/protocol/BaseEthereumProtocol.js +939 -0
  10. package/v0/protocol/BaseEthereumProtocol.js.map +1 -0
  11. package/v0/protocol/EthereumAddress.d.ts +8 -0
  12. package/v0/protocol/EthereumAddress.js +43 -0
  13. package/v0/protocol/EthereumAddress.js.map +1 -0
  14. package/v0/protocol/EthereumChainIDs.d.ts +1 -0
  15. package/v0/protocol/EthereumChainIDs.js +340 -0
  16. package/v0/protocol/EthereumChainIDs.js.map +1 -0
  17. package/v0/protocol/EthereumClassicProtocol.d.ts +6 -0
  18. package/v0/protocol/EthereumClassicProtocol.js +30 -0
  19. package/v0/protocol/EthereumClassicProtocol.js.map +1 -0
  20. package/v0/protocol/EthereumCryptoClient.d.ts +12 -0
  21. package/v0/protocol/EthereumCryptoClient.js +148 -0
  22. package/v0/protocol/EthereumCryptoClient.js.map +1 -0
  23. package/v0/protocol/EthereumProtocol.d.ts +10 -0
  24. package/v0/protocol/EthereumProtocol.js +34 -0
  25. package/v0/protocol/EthereumProtocol.js.map +1 -0
  26. package/v0/protocol/EthereumProtocolOptions.d.ts +46 -0
  27. package/v0/protocol/EthereumProtocolOptions.js +150 -0
  28. package/v0/protocol/EthereumProtocolOptions.js.map +1 -0
  29. package/v0/protocol/EthereumRopstenProtocol.d.ts +6 -0
  30. package/v0/protocol/EthereumRopstenProtocol.js +30 -0
  31. package/v0/protocol/EthereumRopstenProtocol.js.map +1 -0
  32. package/v0/protocol/EthereumTypes.d.ts +14 -0
  33. package/v0/protocol/EthereumTypes.js +3 -0
  34. package/v0/protocol/EthereumTypes.js.map +1 -0
  35. package/v0/protocol/clients/info-clients/EtherscanInfoClient.d.ts +8 -0
  36. package/v0/protocol/clients/info-clients/EtherscanInfoClient.js +195 -0
  37. package/v0/protocol/clients/info-clients/EtherscanInfoClient.js.map +1 -0
  38. package/v0/protocol/clients/info-clients/InfoClient.d.ts +8 -0
  39. package/v0/protocol/clients/info-clients/InfoClient.js +11 -0
  40. package/v0/protocol/clients/info-clients/InfoClient.js.map +1 -0
  41. package/v0/protocol/clients/node-clients/AirGapNodeClient.d.ts +41 -0
  42. package/v0/protocol/clients/node-clients/AirGapNodeClient.js +353 -0
  43. package/v0/protocol/clients/node-clients/AirGapNodeClient.js.map +1 -0
  44. package/v0/protocol/clients/node-clients/NodeClient.d.ts +17 -0
  45. package/v0/protocol/clients/node-clients/NodeClient.js +11 -0
  46. package/v0/protocol/clients/node-clients/NodeClient.js.map +1 -0
  47. package/v0/protocol/erc20/ERC20.d.ts +3 -0
  48. package/v0/protocol/erc20/ERC20.js +9 -0
  49. package/v0/protocol/erc20/ERC20.js.map +1 -0
  50. package/v0/protocol/erc20/GenericERC20.d.ts +32 -0
  51. package/v0/protocol/erc20/GenericERC20.js +335 -0
  52. package/v0/protocol/erc20/GenericERC20.js.map +1 -0
  53. package/v0/protocol/utils/utils.d.ts +13 -0
  54. package/v0/protocol/utils/utils.js +140 -0
  55. package/v0/protocol/utils/utils.js.map +1 -0
  56. package/v0/serializer/schemas/v2/transaction-sign-request-ethereum.json +50 -0
  57. package/v0/serializer/schemas/v2/transaction-sign-response-ethereum.json +19 -0
  58. package/v0/serializer/schemas/v3/transaction-sign-request-ethereum-typed.json +38 -0
  59. package/v0/serializer/schemas/v3/transaction-sign-request-ethereum.json +50 -0
  60. package/v0/serializer/schemas/v3/transaction-sign-response-ethereum.json +19 -0
  61. package/v0/serializer/validators/transaction-validator.d.ts +15 -0
  62. package/v0/serializer/validators/transaction-validator.js +96 -0
  63. package/v0/serializer/validators/transaction-validator.js.map +1 -0
  64. package/v0/serializer/validators/validators.d.ts +1 -0
  65. package/v0/serializer/validators/validators.js +78 -0
  66. package/v0/serializer/validators/validators.js.map +1 -0
  67. package/v0/types/signed-transaction-ethereum.d.ts +5 -0
  68. package/v0/types/signed-transaction-ethereum.js +3 -0
  69. package/v0/types/signed-transaction-ethereum.js.map +1 -0
  70. package/v0/types/transaction-ethereum.d.ts +14 -0
  71. package/v0/types/transaction-ethereum.js +3 -0
  72. package/v0/types/transaction-ethereum.js.map +1 -0
  73. package/v0/types/unsigned-transaction-ethereum-typed.d.ts +11 -0
  74. package/v0/types/unsigned-transaction-ethereum-typed.js +3 -0
  75. package/v0/types/unsigned-transaction-ethereum-typed.js.map +1 -0
  76. package/v0/types/unsigned-transaction-ethereum.d.ts +15 -0
  77. package/v0/types/unsigned-transaction-ethereum.js +3 -0
  78. package/v0/types/unsigned-transaction-ethereum.js.map +1 -0
  79. package/v1/block-explorer/EtherscanBlockExplorer.d.ts +9 -0
  80. package/v1/block-explorer/EtherscanBlockExplorer.js +74 -0
  81. package/v1/block-explorer/EtherscanBlockExplorer.js.map +1 -0
  82. package/v1/clients/crypto/EthereumCryptoClient.d.ts +7 -0
  83. package/v1/clients/crypto/EthereumCryptoClient.js +147 -0
  84. package/v1/clients/crypto/EthereumCryptoClient.js.map +1 -0
  85. package/v1/clients/info/EthereumInfoClient.d.ts +15 -0
  86. package/v1/clients/info/EthereumInfoClient.js +11 -0
  87. package/v1/clients/info/EthereumInfoClient.js.map +1 -0
  88. package/v1/clients/info/EtherscanInfoClient.d.ts +7 -0
  89. package/v1/clients/info/EtherscanInfoClient.js +165 -0
  90. package/v1/clients/info/EtherscanInfoClient.js.map +1 -0
  91. package/v1/clients/node/AirGapNodeClient.d.ts +41 -0
  92. package/v1/clients/node/AirGapNodeClient.js +351 -0
  93. package/v1/clients/node/AirGapNodeClient.js.map +1 -0
  94. package/v1/clients/node/EthereumNodeClient.d.ts +17 -0
  95. package/v1/clients/node/EthereumNodeClient.js +11 -0
  96. package/v1/clients/node/EthereumNodeClient.js.map +1 -0
  97. package/v1/data/EthereumAddress.d.ts +7 -0
  98. package/v1/data/EthereumAddress.js +46 -0
  99. package/v1/data/EthereumAddress.js.map +1 -0
  100. package/v1/index.d.ts +11 -0
  101. package/v1/index.js +13 -0
  102. package/v1/index.js.map +1 -0
  103. package/v1/module/ERC20Tokens.d.ts +3 -0
  104. package/v1/module/ERC20Tokens.js +815 -0
  105. package/v1/module/ERC20Tokens.js.map +1 -0
  106. package/v1/module/EthereumModule.d.ts +13 -0
  107. package/v1/module/EthereumModule.js +125 -0
  108. package/v1/module/EthereumModule.js.map +1 -0
  109. package/v1/module.d.ts +3 -0
  110. package/v1/module.js +24 -0
  111. package/v1/module.js.map +1 -0
  112. package/v1/protocol/EthereumBaseProtocol.d.ts +84 -0
  113. package/v1/protocol/EthereumBaseProtocol.js +827 -0
  114. package/v1/protocol/EthereumBaseProtocol.js.map +1 -0
  115. package/v1/protocol/EthereumChainIds.d.ts +1 -0
  116. package/v1/protocol/EthereumChainIds.js +340 -0
  117. package/v1/protocol/EthereumChainIds.js.map +1 -0
  118. package/v1/protocol/EthereumProtocol.d.ts +8 -0
  119. package/v1/protocol/EthereumProtocol.js +64 -0
  120. package/v1/protocol/EthereumProtocol.js.map +1 -0
  121. package/v1/protocol/erc20/ERC20Token.d.ts +8 -0
  122. package/v1/protocol/erc20/ERC20Token.js +421 -0
  123. package/v1/protocol/erc20/ERC20Token.js.map +1 -0
  124. package/v1/serializer/v3/schemas/converter/transaction-converter.d.ts +12 -0
  125. package/v1/serializer/v3/schemas/converter/transaction-converter.js +80 -0
  126. package/v1/serializer/v3/schemas/converter/transaction-converter.js.map +1 -0
  127. package/v1/serializer/v3/schemas/definitions/transaction-sign-request-ethereum-typed.d.ts +10 -0
  128. package/v1/serializer/v3/schemas/definitions/transaction-sign-request-ethereum-typed.js +3 -0
  129. package/v1/serializer/v3/schemas/definitions/transaction-sign-request-ethereum-typed.js.map +1 -0
  130. package/v1/serializer/v3/schemas/definitions/transaction-sign-request-ethereum.d.ts +14 -0
  131. package/v1/serializer/v3/schemas/definitions/transaction-sign-request-ethereum.js +3 -0
  132. package/v1/serializer/v3/schemas/definitions/transaction-sign-request-ethereum.js.map +1 -0
  133. package/v1/serializer/v3/schemas/definitions/transaction-sign-response-ethereum.d.ts +3 -0
  134. package/v1/serializer/v3/schemas/definitions/transaction-sign-response-ethereum.js +3 -0
  135. package/v1/serializer/v3/schemas/definitions/transaction-sign-response-ethereum.js.map +1 -0
  136. package/v1/serializer/v3/schemas/generated/transaction-sign-request-ethereum-typed.json +41 -0
  137. package/v1/serializer/v3/schemas/generated/transaction-sign-request-ethereum.json +58 -0
  138. package/v1/serializer/v3/schemas/generated/transaction-sign-response-ethereum.json +19 -0
  139. package/v1/serializer/v3/serializer-companion.d.ts +13 -0
  140. package/v1/serializer/v3/serializer-companion.js +190 -0
  141. package/v1/serializer/v3/serializer-companion.js.map +1 -0
  142. package/v1/serializer/v3/validators/transaction-validator.d.ts +7 -0
  143. package/v1/serializer/v3/validators/transaction-validator.js +71 -0
  144. package/v1/serializer/v3/validators/transaction-validator.js.map +1 -0
  145. package/v1/types/crypto.d.ts +2 -0
  146. package/v1/types/crypto.js +3 -0
  147. package/v1/types/crypto.js.map +1 -0
  148. package/v1/types/protocol.d.ts +32 -0
  149. package/v1/types/protocol.js +3 -0
  150. package/v1/types/protocol.js.map +1 -0
  151. package/v1/types/transaction.d.ts +24 -0
  152. package/v1/types/transaction.js +3 -0
  153. package/v1/types/transaction.js.map +1 -0
  154. package/v1/utils/EthereumUtils.d.ts +13 -0
  155. package/v1/utils/EthereumUtils.js +140 -0
  156. package/v1/utils/EthereumUtils.js.map +1 -0
  157. package/v1/utils/key.d.ts +5 -0
  158. package/v1/utils/key.js +101 -0
  159. package/v1/utils/key.js.map +1 -0
@@ -0,0 +1,147 @@
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 hex_1 = require("@airgap/coinlib-core/utils/hex");
84
+ var module_kit_1 = require("@airgap/module-kit");
85
+ var eth_sig_util_1 = require("@metamask/eth-sig-util");
86
+ var EthereumAddress_1 = require("../../data/EthereumAddress");
87
+ var EthereumCryptoClient = /** @class */ (function (_super) {
88
+ __extends(EthereumCryptoClient, _super);
89
+ function EthereumCryptoClient() {
90
+ return _super !== null && _super.apply(this, arguments) || this;
91
+ }
92
+ EthereumCryptoClient.prototype.signMessage = function (message, keypair) {
93
+ return __awaiter(this, void 0, void 0, function () {
94
+ var privateKey, msgParams_1, msgParams_2, msgParams, messageBuffer, signature;
95
+ return __generator(this, function (_a) {
96
+ if (!keypair.privateKey) {
97
+ throw new errors_1.NotFoundError(coinlib_error_1.Domain.ETHEREUM, "Private key not provided");
98
+ }
99
+ privateKey = Buffer.from(keypair.privateKey, 'hex');
100
+ try {
101
+ try {
102
+ msgParams_1 = JSON.parse(message) // TODO types
103
+ ;
104
+ return [2 /*return*/, (0, eth_sig_util_1.signTypedData)({ privateKey: privateKey, data: msgParams_1, version: eth_sig_util_1.SignTypedDataVersion.V4 })];
105
+ }
106
+ catch (e) { }
107
+ try {
108
+ msgParams_2 = JSON.parse(message) // TODO types
109
+ ;
110
+ return [2 /*return*/, (0, eth_sig_util_1.signTypedData)({ privateKey: privateKey, data: msgParams_2, version: eth_sig_util_1.SignTypedDataVersion.V3 })];
111
+ }
112
+ catch (e) { }
113
+ msgParams = JSON.parse(message);
114
+ return [2 /*return*/, (0, eth_sig_util_1.signTypedData)({ privateKey: privateKey, data: msgParams, version: eth_sig_util_1.SignTypedDataVersion.V1 })];
115
+ }
116
+ catch (error) {
117
+ messageBuffer = EthereumJSUtils.hashPersonalMessage(EthereumJSUtils.toBuffer(message));
118
+ signature = EthereumJSUtils.ecsign(messageBuffer, privateKey);
119
+ return [2 /*return*/, EthereumJSUtils.toRpcSig(signature.v, signature.r, signature.s)];
120
+ }
121
+ return [2 /*return*/];
122
+ });
123
+ });
124
+ };
125
+ EthereumCryptoClient.prototype.verifyMessage = function (message, signature, publicKey) {
126
+ return __awaiter(this, void 0, void 0, function () {
127
+ var msgBuffer, msgHash, signatureBuffer, signatureParams, recoveredPublicKey, recoveredAddressBuffer, recoveredAddress, hexPublicKey, address;
128
+ return __generator(this, function (_a) {
129
+ msgBuffer = EthereumJSUtils.toBuffer(message);
130
+ msgHash = EthereumJSUtils.hashPersonalMessage(msgBuffer);
131
+ signatureBuffer = EthereumJSUtils.toBuffer(signature);
132
+ signatureParams = EthereumJSUtils.fromRpcSig(signatureBuffer);
133
+ recoveredPublicKey = EthereumJSUtils.ecrecover(msgHash, signatureParams.v, signatureParams.r, signatureParams.s);
134
+ recoveredAddressBuffer = EthereumJSUtils.publicToAddress(recoveredPublicKey);
135
+ recoveredAddress = EthereumJSUtils.bufferToHex(recoveredAddressBuffer);
136
+ hexPublicKey = (0, hex_1.isHex)(publicKey)
137
+ ? (0, module_kit_1.newPublicKey)(publicKey, 'hex')
138
+ : (0, module_kit_1.newExtendedPublicKey)(publicKey, 'encoded');
139
+ address = EthereumAddress_1.EthereumAddress.from(hexPublicKey);
140
+ return [2 /*return*/, recoveredAddress.toLowerCase() === address.asString().toLowerCase()];
141
+ });
142
+ });
143
+ };
144
+ return EthereumCryptoClient;
145
+ }(Secp256k1CryptoClient_1.Secp256k1CryptoClient));
146
+ exports.EthereumCryptoClient = EthereumCryptoClient;
147
+ //# sourceMappingURL=EthereumCryptoClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EthereumCryptoClient.js","sourceRoot":"","sources":["../../../../src/v1/clients/crypto/EthereumCryptoClient.ts"],"names":[],"mappings":";;;;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,EAAE,KAAK,OAAO,CAAC,QAAQ,EAAE,CAAC,WAAW,EAAE,EAAA;;;KAC3E;IACH,2BAAC;AAAD,CAAC,AAhDD,CAA0C,6CAAqB,GAgD9D;AAhDY,oDAAoB"}
@@ -0,0 +1,15 @@
1
+ import { AirGapTransaction } from '@airgap/module-kit';
2
+ import { EthereumTransactionCursor } from '../../types/transaction';
3
+ export declare type EthereumInfoClientTransaction = Omit<AirGapTransaction, 'network'>;
4
+ export interface EthereumInfoClientTransactionsResult {
5
+ transactions: EthereumInfoClientTransaction[];
6
+ cursor: {
7
+ page: number;
8
+ };
9
+ }
10
+ export declare abstract class EthereumInfoClient {
11
+ baseURL: string;
12
+ constructor(baseURL: string);
13
+ abstract fetchTransactions(address: string, limit: number, cursor?: EthereumTransactionCursor): Promise<EthereumInfoClientTransactionsResult>;
14
+ abstract fetchContractTransactions(contractAddress: string, address: string, limit: number, cursor?: EthereumTransactionCursor): Promise<EthereumInfoClientTransactionsResult>;
15
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EthereumInfoClient = void 0;
4
+ var EthereumInfoClient = /** @class */ (function () {
5
+ function EthereumInfoClient(baseURL) {
6
+ this.baseURL = baseURL;
7
+ }
8
+ return EthereumInfoClient;
9
+ }());
10
+ exports.EthereumInfoClient = EthereumInfoClient;
11
+ //# sourceMappingURL=EthereumInfoClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EthereumInfoClient.js","sourceRoot":"","sources":["../../../../src/v1/clients/info/EthereumInfoClient.ts"],"names":[],"mappings":";;;AAYA;IAGE,4BAAY,OAAe;QACzB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;IAaH,yBAAC;AAAD,CAAC,AAlBD,IAkBC;AAlBqB,gDAAkB"}
@@ -0,0 +1,7 @@
1
+ import { EthereumTransactionCursor } from '../../types/transaction';
2
+ import { EthereumInfoClient, EthereumInfoClientTransactionsResult } from './EthereumInfoClient';
3
+ export declare class EtherscanInfoClient extends EthereumInfoClient {
4
+ constructor(baseURL: string);
5
+ fetchTransactions(address: string, limit: any, cursor?: EthereumTransactionCursor): Promise<EthereumInfoClientTransactionsResult>;
6
+ fetchContractTransactions(contractAddress: string, address: string, limit: number, cursor?: EthereumTransactionCursor): Promise<EthereumInfoClientTransactionsResult>;
7
+ }
@@ -0,0 +1,165 @@
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.EtherscanInfoClient = void 0;
58
+ var axios_0_19_0_1 = __importDefault(require("@airgap/coinlib-core/dependencies/src/axios-0.19.0"));
59
+ var bignumber_1 = require("@airgap/coinlib-core/dependencies/src/bignumber.js-9.0.0/bignumber");
60
+ var validate_1 = require("@airgap/coinlib-core/dependencies/src/validate.js-0.13.1/validate");
61
+ var errors_1 = require("@airgap/coinlib-core/errors");
62
+ var coinlib_error_1 = require("@airgap/coinlib-core/errors/coinlib-error");
63
+ var module_kit_1 = require("@airgap/module-kit");
64
+ var EthereumInfoClient_1 = require("./EthereumInfoClient");
65
+ var EtherscanInfoClient = /** @class */ (function (_super) {
66
+ __extends(EtherscanInfoClient, _super);
67
+ function EtherscanInfoClient(baseURL) {
68
+ return _super.call(this, baseURL) || this;
69
+ }
70
+ EtherscanInfoClient.prototype.fetchTransactions = function (address, limit, cursor) {
71
+ var _a;
72
+ return __awaiter(this, void 0, void 0, function () {
73
+ var airGapTransactions, page, url, response, transactionResponse, transactions, _i, transactions_1, transaction, fee, airGapTransaction;
74
+ return __generator(this, function (_b) {
75
+ switch (_b.label) {
76
+ case 0:
77
+ airGapTransactions = [];
78
+ page = (_a = cursor === null || cursor === void 0 ? void 0 : cursor.page) !== null && _a !== void 0 ? _a : 1;
79
+ url = "".concat(this.baseURL, "/api?module=account&action=txlist&address=").concat(address, "&page=").concat(page, "&offset=").concat(limit, "&sort=desc&apiKey=P63MEHEYBM5BGEG5WFN76VPNCET8B2MAP7");
80
+ return [4 /*yield*/, axios_0_19_0_1.default.get(url)];
81
+ case 1:
82
+ response = _b.sent();
83
+ transactionResponse = response.data;
84
+ transactions = transactionResponse.result;
85
+ if (transactionResponse.status === '0' && (transactions === undefined || !(0, validate_1.isArray)(transactions))) {
86
+ throw new errors_1.NetworkError(coinlib_error_1.Domain.ETHEREUM, { response: response });
87
+ }
88
+ for (_i = 0, transactions_1 = transactions; _i < transactions_1.length; _i++) {
89
+ transaction = transactions_1[_i];
90
+ fee = new bignumber_1.BigNumber(transaction.gas).times(new bignumber_1.BigNumber(transaction.gasPrice));
91
+ airGapTransaction = {
92
+ from: [transaction.from],
93
+ to: [transaction.to],
94
+ isInbound: transaction.to.toLowerCase() === address.toLowerCase(),
95
+ amount: (0, module_kit_1.newAmount)(new bignumber_1.BigNumber(transaction.value), 'blockchain'),
96
+ fee: (0, module_kit_1.newAmount)(fee, 'blockchain'),
97
+ timestamp: parseInt(transaction.timeStamp, 10),
98
+ status: {
99
+ type: transaction.txreceipt_status === undefined || transaction.txreceipt_status === '1' ? 'applied' : 'failed',
100
+ hash: new bignumber_1.BigNumber(transaction.hash).toString(10),
101
+ block: new bignumber_1.BigNumber(transaction.blockNumber).toString(10)
102
+ }
103
+ };
104
+ airGapTransactions.push(airGapTransaction);
105
+ }
106
+ return [2 /*return*/, {
107
+ transactions: airGapTransactions,
108
+ cursor: {
109
+ page: page + 1
110
+ }
111
+ }];
112
+ }
113
+ });
114
+ });
115
+ };
116
+ EtherscanInfoClient.prototype.fetchContractTransactions = function (contractAddress, address, limit, cursor) {
117
+ var _a;
118
+ return __awaiter(this, void 0, void 0, function () {
119
+ var airGapTransactions, page, url, response, transactionResponse, transactions, _i, transactions_2, transaction, fee, airGapTransaction;
120
+ return __generator(this, function (_b) {
121
+ switch (_b.label) {
122
+ case 0:
123
+ airGapTransactions = [];
124
+ page = (_a = cursor === null || cursor === void 0 ? void 0 : cursor.page) !== null && _a !== void 0 ? _a : 1;
125
+ url = "".concat(this.baseURL, "/api?module=account&action=tokentx&address=").concat(address, "&contractAddress=").concat(contractAddress, "&page=").concat(page, "&offset=").concat(limit, "&sort=desc&apiKey=P63MEHEYBM5BGEG5WFN76VPNCET8B2MAP7");
126
+ return [4 /*yield*/, axios_0_19_0_1.default.get(url)];
127
+ case 1:
128
+ response = _b.sent();
129
+ transactionResponse = response.data;
130
+ transactions = transactionResponse.result;
131
+ if (transactionResponse.status === '0' && (transactions === undefined || !(0, validate_1.isArray)(transactions))) {
132
+ throw new errors_1.NetworkError(coinlib_error_1.Domain.ETHEREUM, { response: response });
133
+ }
134
+ for (_i = 0, transactions_2 = transactions; _i < transactions_2.length; _i++) {
135
+ transaction = transactions_2[_i];
136
+ fee = new bignumber_1.BigNumber(transaction.gas).times(new bignumber_1.BigNumber(transaction.gasPrice));
137
+ airGapTransaction = {
138
+ from: [transaction.from],
139
+ to: [transaction.to],
140
+ isInbound: transaction.to.toLowerCase() === address.toLowerCase(),
141
+ amount: (0, module_kit_1.newAmount)(new bignumber_1.BigNumber(transaction.value), 'blockchain'),
142
+ fee: (0, module_kit_1.newAmount)(fee, 'blockchain'),
143
+ timestamp: parseInt(transaction.timeStamp, 10),
144
+ status: {
145
+ type: transaction.txreceipt_status === undefined || transaction.txreceipt_status === '1' ? 'applied' : 'failed',
146
+ hash: transaction.hash,
147
+ block: transaction.blockNumber
148
+ }
149
+ };
150
+ airGapTransactions.push(airGapTransaction);
151
+ }
152
+ return [2 /*return*/, {
153
+ transactions: airGapTransactions,
154
+ cursor: {
155
+ page: page + 1
156
+ }
157
+ }];
158
+ }
159
+ });
160
+ });
161
+ };
162
+ return EtherscanInfoClient;
163
+ }(EthereumInfoClient_1.EthereumInfoClient));
164
+ exports.EtherscanInfoClient = EtherscanInfoClient;
165
+ //# sourceMappingURL=EtherscanInfoClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EtherscanInfoClient.js","sourceRoot":"","sources":["../../../../src/v1/clients/info/EtherscanInfoClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oGAAsE;AACtE,gGAA8F;AAC9F,8FAA2F;AAC3F,sDAA0D;AAC1D,2EAAkE;AAClE,iDAA8C;AAI9C,2DAA8H;AAE9H;IAAyC,uCAAkB;IACzD,6BAAY,OAAe;eACzB,kBAAM,OAAO,CAAC;IAChB,CAAC;IAEY,+CAAiB,GAA9B,UACE,OAAe,EACf,KAAU,EACV,MAAkC;;;;;;;wBAE5B,kBAAkB,GAAoC,EAAE,CAAA;wBAExD,IAAI,GAAW,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,mCAAI,CAAC,CAAA;wBAChC,GAAG,GAAW,UAAG,IAAI,CAAC,OAAO,uDAA6C,OAAO,mBAAS,IAAI,qBAAW,KAAK,yDAAsD,CAAA;wBAEzJ,qBAAM,sBAAK,CAAC,GAAG,CAAC,GAAG,CAAC,EAAA;;wBAA/B,QAAQ,GAAG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,CAAC,CAAC,CAAA;4BAC1F,iBAAiB,GAAkC;gCACvD,IAAI,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC;gCACxB,EAAE,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC;gCACpB,SAAS,EAAE,WAAW,CAAC,EAAE,CAAC,WAAW,EAAE,KAAK,OAAO,CAAC,WAAW,EAAE;gCAEjE,MAAM,EAAE,IAAA,sBAAS,EAAC,IAAI,qBAAS,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,YAAY,CAAC;gCACjE,GAAG,EAAE,IAAA,sBAAS,EAAC,GAAG,EAAE,YAAY,CAAC;gCAEjC,SAAS,EAAE,QAAQ,CAAC,WAAW,CAAC,SAAS,EAAE,EAAE,CAAC;gCAC9C,MAAM,EAAE;oCACN,IAAI,EAAE,WAAW,CAAC,gBAAgB,KAAK,SAAS,IAAI,WAAW,CAAC,gBAAgB,KAAK,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ;oCAC/G,IAAI,EAAE,WAAW,CAAC,IAAI;oCACtB,KAAK,EAAE,WAAW,CAAC,WAAW;iCAC/B;6BACF,CAAA;4BAED,kBAAkB,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAA;yBAC3C;wBAED,sBAAO;gCACL,YAAY,EAAE,kBAAkB;gCAChC,MAAM,EAAE;oCACN,IAAI,EAAE,IAAI,GAAG,CAAC;iCACf;6BACF,EAAA;;;;KACF;IACH,0BAAC;AAAD,CAAC,AA/FD,CAAyC,uCAAkB,GA+F1D;AA/FY,kDAAmB"}
@@ -0,0 +1,41 @@
1
+ import { BigNumber } from '@airgap/coinlib-core/dependencies/src/bignumber.js-9.0.0/bignumber';
2
+ import { AirGapTransactionStatus } from '@airgap/module-kit';
3
+ import { EthereumNodeClient } from './EthereumNodeClient';
4
+ export declare class EthereumRPCData {
5
+ protected static parametersLength: number;
6
+ methodSignature: string;
7
+ constructor(methodSignature: string);
8
+ abiEncoded(): string;
9
+ static addLeadingZeroPadding(value: string, targetLength?: number): string;
10
+ static removeLeadingZeroPadding(value: string): string;
11
+ }
12
+ export declare class EthereumRPCDataBalanceOf extends EthereumRPCData {
13
+ static methodName: string;
14
+ address: string;
15
+ constructor(address: string);
16
+ abiEncoded(): string;
17
+ }
18
+ export declare class EthereumRPCDataTransfer extends EthereumRPCData {
19
+ static methodName: string;
20
+ recipient: string;
21
+ amount: string;
22
+ constructor(toAddressOrData: string, amount?: string);
23
+ abiEncoded(): string;
24
+ }
25
+ export declare class AirGapNodeClient extends EthereumNodeClient {
26
+ constructor(baseURL: string);
27
+ fetchBalance(address: string): Promise<BigNumber>;
28
+ fetchTransactionCount(address: string): Promise<number>;
29
+ sendSignedTransaction(transaction: string): Promise<string>;
30
+ getTransactionStatus(transactionHash: string): Promise<AirGapTransactionStatus>;
31
+ callBalanceOf(contractAddress: string, address: string): Promise<BigNumber>;
32
+ callBalanceOfOnContracts(contractAddresses: string[], address: string): Promise<{
33
+ [contractAddress: string]: BigNumber;
34
+ }>;
35
+ private balanceOfBody;
36
+ estimateTransactionGas(fromAddress: string, toAddress: string, amount?: string, data?: string, gas?: string): Promise<BigNumber>;
37
+ estimateTransferGas(contractAddress: string, fromAddress: string, toAddress: string, hexAmount: string): Promise<BigNumber>;
38
+ getGasPrice(): Promise<BigNumber>;
39
+ private send;
40
+ private batchSend;
41
+ }