@airgap/ethereum 0.13.8-beta.6 → 0.13.8-beta.8
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 +4 -4
- package/v1/index.d.ts +3 -1
- package/v1/index.js +5 -1
- package/v1/index.js.map +1 -1
- package/v1/module/ERC20Module.d.ts +9 -0
- package/v1/module/ERC20Module.js +69 -0
- package/v1/module/ERC20Module.js.map +1 -0
- package/v1/module/EthereumBaseModule.d.ts +13 -0
- package/v1/module/EthereumBaseModule.js +83 -0
- package/v1/module/EthereumBaseModule.js.map +1 -0
- package/v1/module/EthereumClassicModule.d.ts +7 -0
- package/v1/module/EthereumClassicModule.js +32 -0
- package/v1/module/EthereumClassicModule.js.map +1 -0
- package/v1/module/EthereumModule.d.ts +5 -10
- package/v1/module/EthereumModule.js +21 -107
- package/v1/module/EthereumModule.js.map +1 -1
- package/v1/module/EthereumRopstenModule.d.ts +7 -0
- package/v1/module/EthereumRopstenModule.js +32 -0
- package/v1/module/EthereumRopstenModule.js.map +1 -0
- package/v1/protocol/EthereumBaseProtocol.js +3 -5
- package/v1/protocol/EthereumBaseProtocol.js.map +1 -1
- package/v1/protocol/EthereumProtocol.js +0 -7
- package/v1/protocol/EthereumProtocol.js.map +1 -1
- package/v1/protocol/erc20/ERC20Token.js +0 -7
- package/v1/protocol/erc20/ERC20Token.js.map +1 -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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@airgap/ethereum",
|
|
3
|
-
"version": "0.13.8-beta.
|
|
3
|
+
"version": "0.13.8-beta.8",
|
|
4
4
|
"description": "The @airgap/ethereum is an Ethereum implementation of the ICoinProtocol interface from @airgap/coinlib-core.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"airgap",
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
"@metamask/eth-sig-util": "4.0.0"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"@airgap/coinlib-core": "^0.13.
|
|
40
|
-
"@airgap/module-kit": "^0.13.
|
|
41
|
-
"@airgap/serializer": "^0.13.
|
|
39
|
+
"@airgap/coinlib-core": "^0.13.8-beta.7",
|
|
40
|
+
"@airgap/module-kit": "^0.13.8-beta.7",
|
|
41
|
+
"@airgap/serializer": "^0.13.8-beta.7"
|
|
42
42
|
},
|
|
43
43
|
"localDependencies": {
|
|
44
44
|
"ethereumjs-tx": "1.3.7",
|
package/v1/index.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { EtherscanBlockExplorer } from './block-explorer/EtherscanBlockExplorer';
|
|
2
|
+
import { EthereumClassicModule } from './module/EthereumClassicModule';
|
|
2
3
|
import { EthereumModule } from './module/EthereumModule';
|
|
4
|
+
import { EthereumRopstenModule } from './module/EthereumRopstenModule';
|
|
3
5
|
import { createERC20Token, ERC20Token } from './protocol/erc20/ERC20Token';
|
|
4
6
|
import { createEthereumClassicProtocol, createEthereumClassicProtocolOptions, EthereumClassicProtocol } from './protocol/EthereumClassicProtocol';
|
|
5
7
|
import { createEthereumProtocol, createEthereumProtocolOptions, EthereumProtocol } from './protocol/EthereumProtocol';
|
|
6
8
|
import { createEthereumRopstenProtocol, createEthereumRopstenProtocolOptions, EthereumRopstenProtocol } from './protocol/EthereumRopstenProtocol';
|
|
7
9
|
import { ERC20TokenMetadata, EthereumProtocolNetwork, EthereumProtocolOptions, EthereumUnits } from './types/protocol';
|
|
8
10
|
import { EthereumRawUnsignedTransaction, EthereumSignedTransaction, EthereumTransactionCursor, EthereumTypedUnsignedTransaction, EthereumUnsignedTransaction } from './types/transaction';
|
|
9
|
-
export { EthereumModule };
|
|
11
|
+
export { EthereumModule, EthereumClassicModule, EthereumRopstenModule };
|
|
10
12
|
export { EthereumProtocol, createEthereumProtocol, createEthereumProtocolOptions, EthereumClassicProtocol, createEthereumClassicProtocol, createEthereumClassicProtocolOptions, EthereumRopstenProtocol, createEthereumRopstenProtocol, createEthereumRopstenProtocolOptions, ERC20Token, createERC20Token };
|
|
11
13
|
export { EtherscanBlockExplorer };
|
|
12
14
|
export { EthereumUnits, EthereumProtocolNetwork, EthereumProtocolOptions, ERC20TokenMetadata, EthereumUnsignedTransaction, EthereumTypedUnsignedTransaction, EthereumRawUnsignedTransaction, EthereumSignedTransaction, EthereumTransactionCursor };
|
package/v1/index.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EtherscanBlockExplorer = exports.createERC20Token = exports.createEthereumRopstenProtocolOptions = exports.createEthereumRopstenProtocol = exports.createEthereumClassicProtocolOptions = exports.createEthereumClassicProtocol = exports.createEthereumProtocolOptions = exports.createEthereumProtocol = exports.EthereumModule = void 0;
|
|
3
|
+
exports.EtherscanBlockExplorer = exports.createERC20Token = exports.createEthereumRopstenProtocolOptions = exports.createEthereumRopstenProtocol = exports.createEthereumClassicProtocolOptions = exports.createEthereumClassicProtocol = exports.createEthereumProtocolOptions = exports.createEthereumProtocol = exports.EthereumRopstenModule = exports.EthereumClassicModule = exports.EthereumModule = void 0;
|
|
4
4
|
var EtherscanBlockExplorer_1 = require("./block-explorer/EtherscanBlockExplorer");
|
|
5
5
|
Object.defineProperty(exports, "EtherscanBlockExplorer", { enumerable: true, get: function () { return EtherscanBlockExplorer_1.EtherscanBlockExplorer; } });
|
|
6
|
+
var EthereumClassicModule_1 = require("./module/EthereumClassicModule");
|
|
7
|
+
Object.defineProperty(exports, "EthereumClassicModule", { enumerable: true, get: function () { return EthereumClassicModule_1.EthereumClassicModule; } });
|
|
6
8
|
var EthereumModule_1 = require("./module/EthereumModule");
|
|
7
9
|
Object.defineProperty(exports, "EthereumModule", { enumerable: true, get: function () { return EthereumModule_1.EthereumModule; } });
|
|
10
|
+
var EthereumRopstenModule_1 = require("./module/EthereumRopstenModule");
|
|
11
|
+
Object.defineProperty(exports, "EthereumRopstenModule", { enumerable: true, get: function () { return EthereumRopstenModule_1.EthereumRopstenModule; } });
|
|
8
12
|
var ERC20Token_1 = require("./protocol/erc20/ERC20Token");
|
|
9
13
|
Object.defineProperty(exports, "createERC20Token", { enumerable: true, get: function () { return ERC20Token_1.createERC20Token; } });
|
|
10
14
|
var EthereumClassicProtocol_1 = require("./protocol/EthereumClassicProtocol");
|
package/v1/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/v1/index.ts"],"names":[],"mappings":";;;AAAA,kFAAgF;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/v1/index.ts"],"names":[],"mappings":";;;AAAA,kFAAgF;AA+CvE,uGA/CA,+CAAsB,OA+CA;AA9C/B,wEAAsE;AA0B7C,sGA1BhB,6CAAqB,OA0BgB;AAzB9C,0DAAwD;AAyB/C,+FAzBA,+BAAc,OAyBA;AAxBvB,wEAAsE;AAwBtB,sGAxBvC,6CAAqB,OAwBuC;AAvBrE,0DAA0E;AAsCxE,iGAtCO,6BAAgB,OAsCP;AArClB,8EAI2C;AA2BzC,8GA9BA,uDAA6B,OA8BA;AAC7B,qHA9BA,8DAAoC,OA8BA;AA3BtC,gEAAqH;AAuBnH,uGAvBO,yCAAsB,OAuBP;AACtB,8GAxB+B,gDAA6B,OAwB/B;AAvB/B,8EAI2C;AAwBzC,8GA3BA,uDAA6B,OA2BA;AAC7B,qHA3BA,8DAAoC,OA2BA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AirGapModule, ProtocolNetwork } from '@airgap/module-kit';
|
|
2
|
+
import { BlockExplorer } from '@airgap/module-kit/block-explorer/block-explorer';
|
|
3
|
+
import { OfflineProtocol, OnlineProtocol } from '@airgap/module-kit/protocol/protocol';
|
|
4
|
+
export declare class ERC20Module implements AirGapModule {
|
|
5
|
+
readonly supportedNetworks: Record<string, ProtocolNetwork>;
|
|
6
|
+
createOfflineProtocol(): Promise<OfflineProtocol | undefined>;
|
|
7
|
+
createOnlineProtocol(networkId?: string | undefined): Promise<OnlineProtocol | undefined>;
|
|
8
|
+
createBlockExplorer(networkId?: string | undefined): Promise<BlockExplorer | undefined>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
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;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.ERC20Module = void 0;
|
|
40
|
+
var ERC20Module = /** @class */ (function () {
|
|
41
|
+
function ERC20Module() {
|
|
42
|
+
// TODO: figure out what to do with modules that should create generic protocols instances
|
|
43
|
+
this.supportedNetworks = {};
|
|
44
|
+
}
|
|
45
|
+
ERC20Module.prototype.createOfflineProtocol = function () {
|
|
46
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
47
|
+
return __generator(this, function (_a) {
|
|
48
|
+
throw new Error('Method not implemented.');
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
ERC20Module.prototype.createOnlineProtocol = function (networkId) {
|
|
53
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
54
|
+
return __generator(this, function (_a) {
|
|
55
|
+
throw new Error('Method not implemented.');
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
ERC20Module.prototype.createBlockExplorer = function (networkId) {
|
|
60
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
61
|
+
return __generator(this, function (_a) {
|
|
62
|
+
throw new Error('Method not implemented.');
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
return ERC20Module;
|
|
67
|
+
}());
|
|
68
|
+
exports.ERC20Module = ERC20Module;
|
|
69
|
+
//# sourceMappingURL=ERC20Module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ERC20Module.js","sourceRoot":"","sources":["../../../src/v1/module/ERC20Module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA;IAAA;QACE,0FAA0F;QAE1E,sBAAiB,GAAoC,EAAE,CAAA;IAazE,CAAC;IAXc,2CAAqB,GAAlC;;;gBACE,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAA;;;KAC3C;IAEY,0CAAoB,GAAjC,UAAkC,SAA8B;;;gBAC9D,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAA;;;KAC3C;IAEY,yCAAmB,GAAhC,UAAiC,SAA8B;;;gBAC7D,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAA;;;KAC3C;IACH,kBAAC;AAAD,CAAC,AAhBD,IAgBC;AAhBY,kCAAW"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AirGapModule, ProtocolNetwork } from '@airgap/module-kit';
|
|
2
|
+
import { BlockExplorer } from '@airgap/module-kit/block-explorer/block-explorer';
|
|
3
|
+
import { OfflineProtocol, OnlineProtocol } from '@airgap/module-kit/protocol/protocol';
|
|
4
|
+
import { EthereumBaseProtocol } from '../protocol/EthereumBaseProtocol';
|
|
5
|
+
export declare abstract class EthereumBaseModule implements AirGapModule {
|
|
6
|
+
readonly supportedNetworks: Record<string, ProtocolNetwork>;
|
|
7
|
+
private readonly networkRegistry;
|
|
8
|
+
protected constructor(supportedNetworks: ProtocolNetwork[], defaultNetwork?: ProtocolNetwork);
|
|
9
|
+
abstract createEthereumProtocol(network?: ProtocolNetwork): EthereumBaseProtocol;
|
|
10
|
+
createOfflineProtocol(): Promise<OfflineProtocol | undefined>;
|
|
11
|
+
createOnlineProtocol(networkId?: string | undefined): Promise<OnlineProtocol | undefined>;
|
|
12
|
+
createBlockExplorer(networkId?: string | undefined): Promise<BlockExplorer | undefined>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
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;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.EthereumBaseModule = void 0;
|
|
40
|
+
var coinlib_core_1 = require("@airgap/coinlib-core");
|
|
41
|
+
var errors_1 = require("@airgap/coinlib-core/errors");
|
|
42
|
+
var module_kit_1 = require("@airgap/module-kit");
|
|
43
|
+
var EtherscanBlockExplorer_1 = require("../block-explorer/EtherscanBlockExplorer");
|
|
44
|
+
var EthereumBaseModule = /** @class */ (function () {
|
|
45
|
+
function EthereumBaseModule(supportedNetworks, defaultNetwork) {
|
|
46
|
+
this.networkRegistry = new module_kit_1.ModuleNetworkRegistry({ supportedNetworks: supportedNetworks, defaultNetwork: defaultNetwork });
|
|
47
|
+
this.supportedNetworks = this.networkRegistry.supportedNetworks;
|
|
48
|
+
}
|
|
49
|
+
EthereumBaseModule.prototype.createOfflineProtocol = function () {
|
|
50
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
51
|
+
return __generator(this, function (_a) {
|
|
52
|
+
return [2 /*return*/, this.createEthereumProtocol()];
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
EthereumBaseModule.prototype.createOnlineProtocol = function (networkId) {
|
|
57
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
58
|
+
var network;
|
|
59
|
+
return __generator(this, function (_a) {
|
|
60
|
+
network = this.networkRegistry.findNetwork(networkId);
|
|
61
|
+
if (network === undefined) {
|
|
62
|
+
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.ETHEREUM, 'Protocol network type not supported.');
|
|
63
|
+
}
|
|
64
|
+
return [2 /*return*/, this.createEthereumProtocol(network)];
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
EthereumBaseModule.prototype.createBlockExplorer = function (networkId) {
|
|
69
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
70
|
+
var network;
|
|
71
|
+
return __generator(this, function (_a) {
|
|
72
|
+
network = this.networkRegistry.findNetwork(networkId);
|
|
73
|
+
if (network === undefined) {
|
|
74
|
+
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.ETHEREUM, 'Block Explorer network type not supported.');
|
|
75
|
+
}
|
|
76
|
+
return [2 /*return*/, new EtherscanBlockExplorer_1.EtherscanBlockExplorer()];
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
return EthereumBaseModule;
|
|
81
|
+
}());
|
|
82
|
+
exports.EthereumBaseModule = EthereumBaseModule;
|
|
83
|
+
//# sourceMappingURL=EthereumBaseModule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EthereumBaseModule.js","sourceRoot":"","sources":["../../../src/v1/module/EthereumBaseModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAA6C;AAC7C,sDAAqE;AACrE,iDAAyF;AAIzF,mFAAiF;AAGjF;IAKE,4BAAsB,iBAAoC,EAAE,cAAgC;QAC1F,IAAI,CAAC,eAAe,GAAG,IAAI,kCAAqB,CAAC,EAAE,iBAAiB,mBAAA,EAAE,cAAc,gBAAA,EAAE,CAAC,CAAA;QACvF,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,eAAe,CAAC,iBAAiB,CAAA;IACjE,CAAC;IAIY,kDAAqB,GAAlC;;;gBACE,sBAAO,IAAI,CAAC,sBAAsB,EAAE,EAAA;;;KACrC;IAEY,iDAAoB,GAAjC,UAAkC,SAA8B;;;;gBACxD,OAAO,GAAgC,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,SAAS,CAAC,CAAA;gBACxF,IAAI,OAAO,KAAK,SAAS,EAAE;oBACzB,MAAM,IAAI,gCAAuB,CAAC,qBAAM,CAAC,QAAQ,EAAE,sCAAsC,CAAC,CAAA;iBAC3F;gBAED,sBAAO,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC,EAAA;;;KAC5C;IAEY,gDAAmB,GAAhC,UAAiC,SAA8B;;;;gBACvD,OAAO,GAAgC,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,SAAS,CAAC,CAAA;gBACxF,IAAI,OAAO,KAAK,SAAS,EAAE;oBACzB,MAAM,IAAI,gCAAuB,CAAC,qBAAM,CAAC,QAAQ,EAAE,4CAA4C,CAAC,CAAA;iBACjG;gBAED,sBAAO,IAAI,+CAAsB,EAAE,EAAA;;;KACpC;IACH,yBAAC;AAAD,CAAC,AAjCD,IAiCC;AAjCqB,gDAAkB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ProtocolNetwork } from '@airgap/module-kit';
|
|
2
|
+
import { EthereumBaseProtocol } from '../protocol/EthereumBaseProtocol';
|
|
3
|
+
import { EthereumBaseModule } from './EthereumBaseModule';
|
|
4
|
+
export declare class EthereumClassicModule extends EthereumBaseModule {
|
|
5
|
+
constructor();
|
|
6
|
+
createEthereumProtocol(network?: ProtocolNetwork | undefined): EthereumBaseProtocol;
|
|
7
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
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.EthereumClassicModule = void 0;
|
|
19
|
+
var EthereumClassicProtocol_1 = require("../protocol/EthereumClassicProtocol");
|
|
20
|
+
var EthereumBaseModule_1 = require("./EthereumBaseModule");
|
|
21
|
+
var EthereumClassicModule = /** @class */ (function (_super) {
|
|
22
|
+
__extends(EthereumClassicModule, _super);
|
|
23
|
+
function EthereumClassicModule() {
|
|
24
|
+
return _super.call(this, [EthereumClassicProtocol_1.ETHEREUM_CLASSIC_MAINNET_PROTOCOL_NETWORK]) || this;
|
|
25
|
+
}
|
|
26
|
+
EthereumClassicModule.prototype.createEthereumProtocol = function (network) {
|
|
27
|
+
return (0, EthereumClassicProtocol_1.createEthereumClassicProtocol)({ network: network });
|
|
28
|
+
};
|
|
29
|
+
return EthereumClassicModule;
|
|
30
|
+
}(EthereumBaseModule_1.EthereumBaseModule));
|
|
31
|
+
exports.EthereumClassicModule = EthereumClassicModule;
|
|
32
|
+
//# sourceMappingURL=EthereumClassicModule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EthereumClassicModule.js","sourceRoot":"","sources":["../../../src/v1/module/EthereumClassicModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAGA,+EAA8H;AAE9H,2DAAyD;AAEzD;IAA2C,yCAAkB;IAC3D;eACE,kBAAM,CAAC,mEAAyC,CAAC,CAAC;IACpD,CAAC;IAEM,sDAAsB,GAA7B,UAA8B,OAAqC;QACjE,OAAO,IAAA,uDAA6B,EAAC,EAAE,OAAO,SAAA,EAAE,CAAC,CAAA;IACnD,CAAC;IACH,4BAAC;AAAD,CAAC,AARD,CAA2C,uCAAkB,GAQ5D;AARY,sDAAqB"}
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
export declare class EthereumModule
|
|
5
|
-
private readonly networkRegistries;
|
|
6
|
-
readonly supportedProtocols: Record<string, ProtocolConfiguration>;
|
|
1
|
+
import { ProtocolNetwork } from '@airgap/module-kit';
|
|
2
|
+
import { EthereumBaseProtocol } from '../protocol/EthereumBaseProtocol';
|
|
3
|
+
import { EthereumBaseModule } from './EthereumBaseModule';
|
|
4
|
+
export declare class EthereumModule extends EthereumBaseModule {
|
|
7
5
|
constructor();
|
|
8
|
-
|
|
9
|
-
createOnlineProtocol(identifier: string, networkId?: string): Promise<OnlineProtocol | undefined>;
|
|
10
|
-
createBlockExplorer(identifier: string, networkId?: string): Promise<BlockExplorer | undefined>;
|
|
11
|
-
createProtocol(identifier: string, network?: ProtocolNetwork): AirGapProtocol;
|
|
6
|
+
createEthereumProtocol(network?: ProtocolNetwork | undefined): EthereumBaseProtocol;
|
|
12
7
|
}
|
|
@@ -1,118 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
for (var p in
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
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);
|
|
10
8
|
};
|
|
11
|
-
return
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
-
function step(op) {
|
|
27
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (_) try {
|
|
29
|
-
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;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
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
|
+
})();
|
|
49
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
18
|
exports.EthereumModule = void 0;
|
|
51
|
-
var coinlib_core_1 = require("@airgap/coinlib-core");
|
|
52
|
-
var errors_1 = require("@airgap/coinlib-core/errors");
|
|
53
|
-
var module_kit_1 = require("@airgap/module-kit");
|
|
54
|
-
var EtherscanBlockExplorer_1 = require("../block-explorer/EtherscanBlockExplorer");
|
|
55
|
-
var ERC20Token_1 = require("../protocol/erc20/ERC20Token");
|
|
56
19
|
var EthereumProtocol_1 = require("../protocol/EthereumProtocol");
|
|
57
|
-
var
|
|
58
|
-
var
|
|
59
|
-
|
|
20
|
+
var EthereumBaseModule_1 = require("./EthereumBaseModule");
|
|
21
|
+
var EthereumModule = /** @class */ (function (_super) {
|
|
22
|
+
__extends(EthereumModule, _super);
|
|
60
23
|
function EthereumModule() {
|
|
61
|
-
|
|
62
|
-
var networkRegistry = new module_kit_1.ModuleNetworkRegistry({
|
|
63
|
-
supportedNetworks: [EthereumProtocol_1.ETHEREUM_MAINNET_PROTOCOL_NETWORK]
|
|
64
|
-
});
|
|
65
|
-
var ropstenNetworkRegistry = new module_kit_1.ModuleNetworkRegistry({
|
|
66
|
-
supportedNetworks: [EthereumRopstenProtocol_1.ETHEREUM_ROPSTEN_MAINNET_PROTOCOL_NETWORK]
|
|
67
|
-
});
|
|
68
|
-
this.networkRegistries = __assign((_a = {}, _a[coinlib_core_1.MainProtocolSymbols.ETH] = networkRegistry, _a), ERC20Tokens_1.erc20TokensIdentifiers.reduce(function (obj, next) {
|
|
69
|
-
var _a;
|
|
70
|
-
return Object.assign(obj, (_a = {}, _a[next] = ropstenNetworkRegistry, _a));
|
|
71
|
-
}, {}));
|
|
72
|
-
this.supportedProtocols = (0, module_kit_1.createSupportedProtocols)(this.networkRegistries);
|
|
24
|
+
return _super.call(this, [EthereumProtocol_1.ETHEREUM_MAINNET_PROTOCOL_NETWORK]) || this;
|
|
73
25
|
}
|
|
74
|
-
EthereumModule.prototype.
|
|
75
|
-
return
|
|
76
|
-
return __generator(this, function (_a) {
|
|
77
|
-
return [2 /*return*/, this.createProtocol(identifier)];
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
};
|
|
81
|
-
EthereumModule.prototype.createOnlineProtocol = function (identifier, networkId) {
|
|
82
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
83
|
-
var network;
|
|
84
|
-
return __generator(this, function (_a) {
|
|
85
|
-
network = this.networkRegistries[identifier].findNetwork(networkId);
|
|
86
|
-
if (network === undefined) {
|
|
87
|
-
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.ETHEREUM, 'Protocol network type not supported.');
|
|
88
|
-
}
|
|
89
|
-
return [2 /*return*/, this.createProtocol(identifier, network)];
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
};
|
|
93
|
-
EthereumModule.prototype.createBlockExplorer = function (identifier, networkId) {
|
|
94
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
95
|
-
var network;
|
|
96
|
-
return __generator(this, function (_a) {
|
|
97
|
-
network = this.networkRegistries[identifier].findNetwork(networkId);
|
|
98
|
-
if (network === undefined) {
|
|
99
|
-
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.ETHEREUM, 'Block Explorer network type not supported.');
|
|
100
|
-
}
|
|
101
|
-
return [2 /*return*/, new EtherscanBlockExplorer_1.EtherscanBlockExplorer()];
|
|
102
|
-
});
|
|
103
|
-
});
|
|
104
|
-
};
|
|
105
|
-
EthereumModule.prototype.createProtocol = function (identifier, network) {
|
|
106
|
-
if (identifier === coinlib_core_1.MainProtocolSymbols.ETH) {
|
|
107
|
-
return (0, EthereumProtocol_1.createEthereumProtocol)({ network: network });
|
|
108
|
-
}
|
|
109
|
-
if (ERC20Tokens_1.erc20Tokens[identifier] !== undefined) {
|
|
110
|
-
var tokenMetadata = ERC20Tokens_1.erc20Tokens[identifier];
|
|
111
|
-
return (0, ERC20Token_1.createERC20Token)(tokenMetadata);
|
|
112
|
-
}
|
|
113
|
-
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.ETHEREUM, "Protocol ".concat(identifier, " not supported."));
|
|
26
|
+
EthereumModule.prototype.createEthereumProtocol = function (network) {
|
|
27
|
+
return (0, EthereumProtocol_1.createEthereumProtocol)({ network: network });
|
|
114
28
|
};
|
|
115
29
|
return EthereumModule;
|
|
116
|
-
}());
|
|
30
|
+
}(EthereumBaseModule_1.EthereumBaseModule));
|
|
117
31
|
exports.EthereumModule = EthereumModule;
|
|
118
32
|
//# sourceMappingURL=EthereumModule.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EthereumModule.js","sourceRoot":"","sources":["../../../src/v1/module/EthereumModule.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EthereumModule.js","sourceRoot":"","sources":["../../../src/v1/module/EthereumModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAGA,iEAAwG;AAExG,2DAAyD;AAEzD;IAAoC,kCAAkB;IACpD;eACE,kBAAM,CAAC,oDAAiC,CAAC,CAAC;IAC5C,CAAC;IAEM,+CAAsB,GAA7B,UAA8B,OAAqC;QACjE,OAAO,IAAA,yCAAsB,EAAC,EAAE,OAAO,SAAA,EAAE,CAAC,CAAA;IAC5C,CAAC;IACH,qBAAC;AAAD,CAAC,AARD,CAAoC,uCAAkB,GAQrD;AARY,wCAAc"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ProtocolNetwork } from '@airgap/module-kit';
|
|
2
|
+
import { EthereumBaseProtocol } from '../protocol/EthereumBaseProtocol';
|
|
3
|
+
import { EthereumBaseModule } from './EthereumBaseModule';
|
|
4
|
+
export declare class EthereumRopstenModule extends EthereumBaseModule {
|
|
5
|
+
constructor();
|
|
6
|
+
createEthereumProtocol(network?: ProtocolNetwork | undefined): EthereumBaseProtocol;
|
|
7
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
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.EthereumRopstenModule = void 0;
|
|
19
|
+
var EthereumRopstenProtocol_1 = require("../protocol/EthereumRopstenProtocol");
|
|
20
|
+
var EthereumBaseModule_1 = require("./EthereumBaseModule");
|
|
21
|
+
var EthereumRopstenModule = /** @class */ (function (_super) {
|
|
22
|
+
__extends(EthereumRopstenModule, _super);
|
|
23
|
+
function EthereumRopstenModule() {
|
|
24
|
+
return _super.call(this, [EthereumRopstenProtocol_1.ETHEREUM_ROPSTEN_MAINNET_PROTOCOL_NETWORK]) || this;
|
|
25
|
+
}
|
|
26
|
+
EthereumRopstenModule.prototype.createEthereumProtocol = function (network) {
|
|
27
|
+
return (0, EthereumRopstenProtocol_1.createEthereumRopstenProtocol)({ network: network });
|
|
28
|
+
};
|
|
29
|
+
return EthereumRopstenModule;
|
|
30
|
+
}(EthereumBaseModule_1.EthereumBaseModule));
|
|
31
|
+
exports.EthereumRopstenModule = EthereumRopstenModule;
|
|
32
|
+
//# sourceMappingURL=EthereumRopstenModule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EthereumRopstenModule.js","sourceRoot":"","sources":["../../../src/v1/module/EthereumRopstenModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAGA,+EAA8H;AAE9H,2DAAyD;AAEzD;IAA2C,yCAAkB;IAC3D;eACE,kBAAM,CAAC,mEAAyC,CAAC,CAAC;IACpD,CAAC;IAEM,sDAAsB,GAA7B,UAA8B,OAAqC;QACjE,OAAO,IAAA,uDAA6B,EAAC,EAAE,OAAO,SAAA,EAAE,CAAC,CAAA;IACnD,CAAC;IACH,4BAAC;AAAD,CAAC,AARD,CAA2C,uCAAkB,GAQ5D;AARY,sDAAqB"}
|
|
@@ -148,9 +148,7 @@ var EthereumBaseProtocolImpl = /** @class */ (function () {
|
|
|
148
148
|
units: options.units,
|
|
149
149
|
mainUnit: options.mainUnit,
|
|
150
150
|
fee: {
|
|
151
|
-
defaults: this.feeDefaults
|
|
152
|
-
units: this.feeUnits,
|
|
153
|
-
mainUnit: 'ETH'
|
|
151
|
+
defaults: this.feeDefaults
|
|
154
152
|
},
|
|
155
153
|
account: {
|
|
156
154
|
standardDerivationPath: (_b = options.standardDerivationPath) !== null && _b !== void 0 ? _b : "m/44'/60'/0'/0/0",
|
|
@@ -241,7 +239,7 @@ var EthereumBaseProtocolImpl = /** @class */ (function () {
|
|
|
241
239
|
hash: "0x".concat(tx.hash().toString('hex'))
|
|
242
240
|
},
|
|
243
241
|
arbitraryData: "0x".concat(tx.data.toString('hex')),
|
|
244
|
-
|
|
242
|
+
json: {
|
|
245
243
|
chainId: chainId,
|
|
246
244
|
nonce: parseInt(hexNonce, 16)
|
|
247
245
|
}
|
|
@@ -259,7 +257,7 @@ var EthereumBaseProtocolImpl = /** @class */ (function () {
|
|
|
259
257
|
fee: (0, module_kit_1.newAmount)(new bignumber_1.BigNumber(feeTx.gasLimit.toString(10)).multipliedBy(feeTx.maxFeePerGas.toString(10)), 'blockchain'),
|
|
260
258
|
network: this.options.network,
|
|
261
259
|
arbitraryData: feeTx.data.toString('hex'),
|
|
262
|
-
|
|
260
|
+
json: {
|
|
263
261
|
chainId: feeTx.chainId.toNumber(),
|
|
264
262
|
nonce: feeTx.nonce.toNumber()
|
|
265
263
|
}
|