@airgap/ethereum 0.13.13-beta.1 → 0.13.13-beta.3
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@airgap/ethereum",
|
|
3
|
-
"version": "0.13.13-beta.
|
|
3
|
+
"version": "0.13.13-beta.3",
|
|
4
4
|
"description": "The @airgap/ethereum is an Ethereum implementation of the ICoinProtocol interface from @airgap/coinlib-core.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"airgap",
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
},
|
|
31
31
|
"author": "Papers AG <contact@papers.ch> (https://papers.ch)",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@airgap/coinlib-core": "^0.13.13-beta.
|
|
34
|
-
"@airgap/crypto": "^0.13.13-beta.
|
|
35
|
-
"@airgap/module-kit": "^0.13.13-beta.
|
|
36
|
-
"@airgap/serializer": "^0.13.13-beta.
|
|
33
|
+
"@airgap/coinlib-core": "^0.13.13-beta.3",
|
|
34
|
+
"@airgap/crypto": "^0.13.13-beta.3",
|
|
35
|
+
"@airgap/module-kit": "^0.13.13-beta.3",
|
|
36
|
+
"@airgap/serializer": "^0.13.13-beta.3",
|
|
37
37
|
"@ethereumjs/common": "2.6.0",
|
|
38
38
|
"@ethereumjs/tx": "3.4.0",
|
|
39
39
|
"@metamask/eth-sig-util": "4.0.0"
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { RecursivePartial } from '@airgap/module-kit';
|
|
2
|
-
import { EthereumProtocolNetwork, EthereumProtocolOptions } from '../types/protocol';
|
|
1
|
+
import { Amount, RecursivePartial } from '@airgap/module-kit';
|
|
2
|
+
import { EthereumProtocolNetwork, EthereumProtocolOptions, EthereumUnits } from '../types/protocol';
|
|
3
3
|
import { EthereumBaseProtocol } from './EthereumBaseProtocol';
|
|
4
4
|
export interface EthereumProtocol extends EthereumBaseProtocol {
|
|
5
|
+
getGasPrice(): Promise<Amount<EthereumUnits>>;
|
|
6
|
+
fetchTransactionCountForAddress(address: string): Promise<number>;
|
|
5
7
|
}
|
|
6
8
|
export declare function createEthereumProtocol(options?: RecursivePartial<EthereumProtocolOptions>): EthereumProtocol;
|
|
7
9
|
export declare const ETHEREUM_MAINNET_PROTOCOL_NETWORK: EthereumProtocolNetwork;
|
|
@@ -25,8 +25,45 @@ var __assign = (this && this.__assign) || function () {
|
|
|
25
25
|
};
|
|
26
26
|
return __assign.apply(this, arguments);
|
|
27
27
|
};
|
|
28
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
29
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
30
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
31
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
32
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
33
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
34
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
38
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
39
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
40
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
41
|
+
function step(op) {
|
|
42
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
43
|
+
while (_) try {
|
|
44
|
+
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;
|
|
45
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
46
|
+
switch (op[0]) {
|
|
47
|
+
case 0: case 1: t = op; break;
|
|
48
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
49
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
50
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
51
|
+
default:
|
|
52
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
53
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
54
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
55
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
56
|
+
if (t[2]) _.ops.pop();
|
|
57
|
+
_.trys.pop(); continue;
|
|
58
|
+
}
|
|
59
|
+
op = body.call(thisArg, _);
|
|
60
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
61
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
62
|
+
}
|
|
63
|
+
};
|
|
28
64
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
65
|
exports.createEthereumProtocolOptions = exports.ETHEREUM_MAINNET_PROTOCOL_NETWORK = exports.createEthereumProtocol = void 0;
|
|
66
|
+
var module_kit_1 = require("@airgap/module-kit");
|
|
30
67
|
var EtherscanInfoClient_1 = require("../clients/info/EtherscanInfoClient");
|
|
31
68
|
var AirGapNodeClient_1 = require("../clients/node/AirGapNodeClient");
|
|
32
69
|
var EthereumBaseProtocol_1 = require("./EthereumBaseProtocol");
|
|
@@ -38,6 +75,27 @@ var EthereumProtocolImpl = /** @class */ (function (_super) {
|
|
|
38
75
|
var completeOptions = createEthereumProtocolOptions(options.network);
|
|
39
76
|
return _super.call(this, new AirGapNodeClient_1.AirGapNodeClient(completeOptions.network.rpcUrl), new EtherscanInfoClient_1.EtherscanInfoClient(completeOptions.network.blockExplorerApi), completeOptions) || this;
|
|
40
77
|
}
|
|
78
|
+
// Custom
|
|
79
|
+
EthereumProtocolImpl.prototype.getGasPrice = function () {
|
|
80
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
81
|
+
var gasPrice;
|
|
82
|
+
return __generator(this, function (_a) {
|
|
83
|
+
switch (_a.label) {
|
|
84
|
+
case 0: return [4 /*yield*/, this.nodeClient.getGasPrice()];
|
|
85
|
+
case 1:
|
|
86
|
+
gasPrice = _a.sent();
|
|
87
|
+
return [2 /*return*/, (0, module_kit_1.newAmount)(gasPrice, 'blockchain')];
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
EthereumProtocolImpl.prototype.fetchTransactionCountForAddress = function (address) {
|
|
93
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
94
|
+
return __generator(this, function (_a) {
|
|
95
|
+
return [2 /*return*/, this.nodeClient.fetchTransactionCount(address)];
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
};
|
|
41
99
|
return EthereumProtocolImpl;
|
|
42
100
|
}(EthereumBaseProtocol_1.DefaultEthereumBaseProtocolImpl));
|
|
43
101
|
// Factory
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EthereumProtocol.js","sourceRoot":"","sources":["../../../src/v1/protocol/EthereumProtocol.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EthereumProtocol.js","sourceRoot":"","sources":["../../../src/v1/protocol/EthereumProtocol.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,iDAAwE;AAExE,2EAAyE;AACzE,qEAAmE;AAGnE,+DAA8F;AAU9F,iBAAiB;AAEjB;IAAmC,wCAA+B;IAChE,8BAAmB,OAAuD;QAAvD,wBAAA,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