@airgap/optimism 0.13.15-beta.12 → 0.13.16-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +7 -6
- package/v1/client/info/OptimismInfoClient.d.ts +2 -0
- package/v1/client/info/OptimismInfoClient.js +3 -0
- package/v1/client/info/OptimismInfoClient.js.map +1 -0
- package/v1/client/node/AirGapNodeClient.d.ts +21 -0
- package/v1/client/node/AirGapNodeClient.js +161 -0
- package/v1/client/node/AirGapNodeClient.js.map +1 -0
- package/v1/client/node/OptimismNodeClient.d.ts +5 -0
- package/v1/client/node/OptimismNodeClient.js +28 -0
- package/v1/client/node/OptimismNodeClient.js.map +1 -0
- package/v1/module/ERC20Tokens.js +82 -1
- package/v1/module/ERC20Tokens.js.map +1 -1
- package/v1/module/OptimismModule.js +4 -3
- package/v1/module/OptimismModule.js.map +1 -1
- package/v1/protocol/OptimismBaseProtocol.d.ts +55 -0
- package/v1/protocol/OptimismBaseProtocol.js +340 -0
- package/v1/protocol/OptimismBaseProtocol.js.map +1 -0
- package/v1/protocol/OptimismProtocol.d.ts +3 -3
- package/v1/protocol/OptimismProtocol.js +21 -16
- package/v1/protocol/OptimismProtocol.js.map +1 -1
- package/v1/protocol/erc20/ERC20Token.d.ts +9 -0
- package/v1/protocol/erc20/ERC20Token.js +131 -0
- package/v1/protocol/erc20/ERC20Token.js.map +1 -0
- package/v1/serializer/v3/schemas/converter/transaction-converter.js +37 -4
- package/v1/serializer/v3/schemas/converter/transaction-converter.js.map +1 -1
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-optimism.d.ts +14 -2
- package/v1/serializer/v3/schemas/generated/transaction-sign-request-optimism.json +4 -1
- package/v1/serializer/v3/serializer-companion.d.ts +1 -1
- package/v1/serializer/v3/serializer-companion.js +11 -11
- 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 +2 -4
- package/v1/types/transaction.d.ts +8 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@airgap/optimism",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.16-beta.1",
|
|
4
4
|
"description": "The @airgap/optimism is an Optimism implementation of the ICoinProtocol interface from @airgap/coinlib-core.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"airgap",
|
|
@@ -31,11 +31,12 @@
|
|
|
31
31
|
},
|
|
32
32
|
"author": "Papers AG <contact@papers.ch> (https://papers.ch)",
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@airgap/coinlib-core": "
|
|
35
|
-
"@airgap/crypto": "
|
|
36
|
-
"@airgap/ethereum": "
|
|
37
|
-
"@airgap/module-kit": "
|
|
38
|
-
"@airgap/serializer": "
|
|
34
|
+
"@airgap/coinlib-core": "^0.13.16-beta.1",
|
|
35
|
+
"@airgap/crypto": "^0.13.16-beta.1",
|
|
36
|
+
"@airgap/ethereum": "^0.13.16-beta.1",
|
|
37
|
+
"@airgap/module-kit": "^0.13.16-beta.1",
|
|
38
|
+
"@airgap/serializer": "^0.13.16-beta.1",
|
|
39
|
+
"@ethereumjs/tx": "3.4.0"
|
|
39
40
|
},
|
|
40
41
|
"nyc": {
|
|
41
42
|
"include": [
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OptimismInfoClient.js","sourceRoot":"","sources":["../../../../src/v1/client/info/OptimismInfoClient.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import BigNumber from '@airgap/coinlib-core/dependencies/src/bignumber.js-9.0.0/bignumber';
|
|
2
|
+
import { EthereumUnsignedTransaction } from '@airgap/ethereum/v1';
|
|
3
|
+
import { AirGapTransactionStatus } from '@airgap/module-kit';
|
|
4
|
+
import { OptimismNodeClient } from './OptimismNodeClient';
|
|
5
|
+
export declare class AirGapNodeClient extends OptimismNodeClient {
|
|
6
|
+
private readonly ethereumNodeClient;
|
|
7
|
+
constructor(baseURL: string);
|
|
8
|
+
getL1Fee(contractAddress: string, tx: EthereumUnsignedTransaction): Promise<BigNumber>;
|
|
9
|
+
fetchBalance(address: string): Promise<BigNumber>;
|
|
10
|
+
fetchTransactionCount(address: string): Promise<number>;
|
|
11
|
+
sendSignedTransaction(transaction: string): Promise<string>;
|
|
12
|
+
callBalanceOf(contractAddress: string, address: string): Promise<BigNumber>;
|
|
13
|
+
getTransactionStatus(transactionHash: string): Promise<AirGapTransactionStatus>;
|
|
14
|
+
estimateTransferGas(contractAddress: string, fromAddress: string, toAddress: string, hexAmount: string): Promise<BigNumber>;
|
|
15
|
+
estimateTransactionGas(fromAddress: string, toAddress: string, amount?: string, data?: string, gas?: string): Promise<BigNumber>;
|
|
16
|
+
getGasPrice(): Promise<BigNumber>;
|
|
17
|
+
callBalanceOfOnContracts(contractAddresses: string[], address: string): Promise<{
|
|
18
|
+
[contractAddress: string]: BigNumber;
|
|
19
|
+
}>;
|
|
20
|
+
private send;
|
|
21
|
+
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
+
function step(op) {
|
|
31
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
+
while (_) try {
|
|
33
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
+
switch (op[0]) {
|
|
36
|
+
case 0: case 1: t = op; break;
|
|
37
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
+
default:
|
|
41
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
+
if (t[2]) _.ops.pop();
|
|
46
|
+
_.trys.pop(); continue;
|
|
47
|
+
}
|
|
48
|
+
op = body.call(thisArg, _);
|
|
49
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
54
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
55
|
+
};
|
|
56
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
57
|
+
exports.AirGapNodeClient = void 0;
|
|
58
|
+
// tslint:disable: max-classes-per-file
|
|
59
|
+
var coinlib_core_1 = require("@airgap/coinlib-core");
|
|
60
|
+
var axios_0_19_0_1 = __importDefault(require("@airgap/coinlib-core/dependencies/src/axios-0.19.0"));
|
|
61
|
+
var bignumber_1 = __importDefault(require("@airgap/coinlib-core/dependencies/src/bignumber.js-9.0.0/bignumber"));
|
|
62
|
+
var v1_1 = require("@airgap/ethereum/v1");
|
|
63
|
+
var tx_1 = require("@ethereumjs/tx");
|
|
64
|
+
var OptimismNodeClient_1 = require("./OptimismNodeClient");
|
|
65
|
+
var OptimismRPCDataGetL1Fee = /** @class */ (function (_super) {
|
|
66
|
+
__extends(OptimismRPCDataGetL1Fee, _super);
|
|
67
|
+
function OptimismRPCDataGetL1Fee(tx) {
|
|
68
|
+
var _this = _super.call(this, "".concat(OptimismRPCDataGetL1Fee.methodName, "(bytes)")) || this;
|
|
69
|
+
_this.bytes =
|
|
70
|
+
tx.ethereumType === 'raw'
|
|
71
|
+
? tx_1.Transaction.fromTxData({
|
|
72
|
+
nonce: tx.nonce,
|
|
73
|
+
gasLimit: tx.gasLimit,
|
|
74
|
+
gasPrice: tx.gasPrice,
|
|
75
|
+
to: tx.to,
|
|
76
|
+
value: tx.value,
|
|
77
|
+
data: tx.data
|
|
78
|
+
}).serialize()
|
|
79
|
+
: Buffer.from(tx.serialized, 'hex');
|
|
80
|
+
return _this;
|
|
81
|
+
}
|
|
82
|
+
OptimismRPCDataGetL1Fee.prototype.abiEncoded = function () {
|
|
83
|
+
var bytesLength = v1_1.EthereumUtils.toHex(this.bytes.length);
|
|
84
|
+
if (bytesLength.startsWith('0x')) {
|
|
85
|
+
bytesLength = bytesLength.slice(2);
|
|
86
|
+
}
|
|
87
|
+
return _super.prototype.abiEncoded.call(this) + v1_1.EthereumRPCData.addLeadingZeroPadding(bytesLength + this.bytes.toString('hex'), 256);
|
|
88
|
+
};
|
|
89
|
+
OptimismRPCDataGetL1Fee.methodName = 'getL1Fee';
|
|
90
|
+
return OptimismRPCDataGetL1Fee;
|
|
91
|
+
}(v1_1.EthereumRPCData));
|
|
92
|
+
var AirGapNodeClient = /** @class */ (function (_super) {
|
|
93
|
+
__extends(AirGapNodeClient, _super);
|
|
94
|
+
function AirGapNodeClient(baseURL) {
|
|
95
|
+
var _this = _super.call(this, baseURL) || this;
|
|
96
|
+
_this.ethereumNodeClient = new v1_1.AirGapNodeClient(baseURL);
|
|
97
|
+
return _this;
|
|
98
|
+
}
|
|
99
|
+
AirGapNodeClient.prototype.getL1Fee = function (contractAddress, tx) {
|
|
100
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
101
|
+
var data, body, response, fee;
|
|
102
|
+
return __generator(this, function (_a) {
|
|
103
|
+
switch (_a.label) {
|
|
104
|
+
case 0:
|
|
105
|
+
data = new OptimismRPCDataGetL1Fee(tx);
|
|
106
|
+
body = new v1_1.EthereumRPCBody('eth_call', [{ to: contractAddress, data: data.abiEncoded() }]);
|
|
107
|
+
return [4 /*yield*/, this.send(body)];
|
|
108
|
+
case 1:
|
|
109
|
+
response = _a.sent();
|
|
110
|
+
fee = new bignumber_1.default(response.result);
|
|
111
|
+
return [2 /*return*/, fee.isNaN() ? new bignumber_1.default(0) : fee];
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
AirGapNodeClient.prototype.fetchBalance = function (address) {
|
|
117
|
+
return this.ethereumNodeClient.fetchBalance(address);
|
|
118
|
+
};
|
|
119
|
+
AirGapNodeClient.prototype.fetchTransactionCount = function (address) {
|
|
120
|
+
return this.ethereumNodeClient.fetchTransactionCount(address);
|
|
121
|
+
};
|
|
122
|
+
AirGapNodeClient.prototype.sendSignedTransaction = function (transaction) {
|
|
123
|
+
return this.ethereumNodeClient.sendSignedTransaction(transaction);
|
|
124
|
+
};
|
|
125
|
+
AirGapNodeClient.prototype.callBalanceOf = function (contractAddress, address) {
|
|
126
|
+
return this.ethereumNodeClient.callBalanceOf(contractAddress, address);
|
|
127
|
+
};
|
|
128
|
+
AirGapNodeClient.prototype.getTransactionStatus = function (transactionHash) {
|
|
129
|
+
return this.ethereumNodeClient.getTransactionStatus(transactionHash);
|
|
130
|
+
};
|
|
131
|
+
AirGapNodeClient.prototype.estimateTransferGas = function (contractAddress, fromAddress, toAddress, hexAmount) {
|
|
132
|
+
return this.ethereumNodeClient.estimateTransferGas(contractAddress, fromAddress, toAddress, hexAmount);
|
|
133
|
+
};
|
|
134
|
+
AirGapNodeClient.prototype.estimateTransactionGas = function (fromAddress, toAddress, amount, data, gas) {
|
|
135
|
+
return this.ethereumNodeClient.estimateTransactionGas(fromAddress, toAddress, amount, data, gas);
|
|
136
|
+
};
|
|
137
|
+
AirGapNodeClient.prototype.getGasPrice = function () {
|
|
138
|
+
return this.ethereumNodeClient.getGasPrice();
|
|
139
|
+
};
|
|
140
|
+
AirGapNodeClient.prototype.callBalanceOfOnContracts = function (contractAddresses, address) {
|
|
141
|
+
return this.ethereumNodeClient.callBalanceOfOnContracts(contractAddresses, address);
|
|
142
|
+
};
|
|
143
|
+
AirGapNodeClient.prototype.send = function (body) {
|
|
144
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
145
|
+
var response;
|
|
146
|
+
return __generator(this, function (_a) {
|
|
147
|
+
switch (_a.label) {
|
|
148
|
+
case 0: return [4 /*yield*/, axios_0_19_0_1.default.post(this.baseURL, body.toRPCBody()).catch(function (error) {
|
|
149
|
+
throw new coinlib_core_1.NetworkError(coinlib_core_1.Domain.ETHEREUM, error);
|
|
150
|
+
})];
|
|
151
|
+
case 1:
|
|
152
|
+
response = _a.sent();
|
|
153
|
+
return [2 /*return*/, response.data];
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
};
|
|
158
|
+
return AirGapNodeClient;
|
|
159
|
+
}(OptimismNodeClient_1.OptimismNodeClient));
|
|
160
|
+
exports.AirGapNodeClient = AirGapNodeClient;
|
|
161
|
+
//# sourceMappingURL=AirGapNodeClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AirGapNodeClient.js","sourceRoot":"","sources":["../../../../src/v1/client/node/AirGapNodeClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAuC;AACvC,qDAA2D;AAC3D,oGAAsF;AACtF,iHAA0F;AAC1F,0CAQ4B;AAE5B,qCAA4C;AAE5C,2DAAyD;AAEzD;IAAsC,2CAAe;IAInD,iCAAY,EAA+B;QAA3C,YACE,kBAAM,UAAG,uBAAuB,CAAC,UAAU,YAAS,CAAC,SAYtD;QAXC,KAAI,CAAC,KAAK;YACR,EAAE,CAAC,YAAY,KAAK,KAAK;gBACvB,CAAC,CAAC,gBAAW,CAAC,UAAU,CAAC;oBACrB,KAAK,EAAE,EAAE,CAAC,KAAK;oBACf,QAAQ,EAAE,EAAE,CAAC,QAAQ;oBACrB,QAAQ,EAAE,EAAE,CAAC,QAAQ;oBACrB,EAAE,EAAE,EAAE,CAAC,EAAE;oB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C,WAAW,EAAE,CAAA;IAC9C,CAAC;IAEM,mDAAwB,GAA/B,UAAgC,iBAA2B,EAAE,OAAe;QAC1E,OAAO,IAAI,CAAC,kBAAkB,CAAC,wBAAwB,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAA;IACrF,CAAC;IAEa,+BAAI,GAAlB,UAAmB,IAAqB;;;;;4BACrB,qBAAM,sBAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,UAAC,KAAK;4BAC5E,MAAM,IAAI,2BAAY,CAAC,qBAAM,CAAC,QAAQ,EAAE,KAAmB,CAAC,CAAA;wBAC9D,CAAC,CAAC,EAAA;;wBAFI,QAAQ,GAAG,SAEf;wBAEF,sBAAO,QAAQ,CAAC,IAAI,EAAA;;;;KACrB;IACH,uBAAC;AAAD,CAAC,AA7DD,CAAsC,uCAAkB,GA6DvD;AA7DY,4CAAgB"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import BigNumber from '@airgap/coinlib-core/dependencies/src/bignumber.js-9.0.0/bignumber';
|
|
2
|
+
import { EthereumNodeClient, EthereumUnsignedTransaction } from '@airgap/ethereum/v1';
|
|
3
|
+
export declare abstract class OptimismNodeClient extends EthereumNodeClient {
|
|
4
|
+
abstract getL1Fee(contractAddress: string, tx: EthereumUnsignedTransaction): Promise<BigNumber>;
|
|
5
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
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.OptimismNodeClient = void 0;
|
|
19
|
+
var v1_1 = require("@airgap/ethereum/v1");
|
|
20
|
+
var OptimismNodeClient = /** @class */ (function (_super) {
|
|
21
|
+
__extends(OptimismNodeClient, _super);
|
|
22
|
+
function OptimismNodeClient() {
|
|
23
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
24
|
+
}
|
|
25
|
+
return OptimismNodeClient;
|
|
26
|
+
}(v1_1.EthereumNodeClient));
|
|
27
|
+
exports.OptimismNodeClient = OptimismNodeClient;
|
|
28
|
+
//# sourceMappingURL=OptimismNodeClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OptimismNodeClient.js","sourceRoot":"","sources":["../../../../src/v1/client/node/OptimismNodeClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AACA,0CAAqF;AAErF;IAAiD,sCAAkB;IAAnE;;IAEA,CAAC;IAAD,yBAAC;AAAD,CAAC,AAFD,CAAiD,uBAAkB,GAElE;AAFqB,gDAAkB"}
|
package/v1/module/ERC20Tokens.js
CHANGED
|
@@ -1,6 +1,87 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.erc20TokensIdentifiers = exports.erc20Tokens = void 0;
|
|
4
|
-
exports.erc20Tokens = {
|
|
4
|
+
exports.erc20Tokens = {
|
|
5
|
+
'optimism-erc20-op': {
|
|
6
|
+
symbol: 'OP',
|
|
7
|
+
name: 'Optimism',
|
|
8
|
+
marketSymbol: 'op',
|
|
9
|
+
identifier: 'optimism-erc20-op',
|
|
10
|
+
contractAddress: '0x4200000000000000000000000000000000000042',
|
|
11
|
+
decimals: 18
|
|
12
|
+
},
|
|
13
|
+
'optimism-erc20-usdt': {
|
|
14
|
+
symbol: 'USDT',
|
|
15
|
+
name: 'USD Tether (erc20)',
|
|
16
|
+
marketSymbol: 'usdt',
|
|
17
|
+
identifier: 'optimism-erc20-usdt',
|
|
18
|
+
contractAddress: '0x94b008aA00579c1307B0EF2c499aD98a8ce58e58',
|
|
19
|
+
decimals: 6
|
|
20
|
+
},
|
|
21
|
+
'optimism-erc20-usdc': {
|
|
22
|
+
symbol: 'USDC',
|
|
23
|
+
name: 'USD Coin',
|
|
24
|
+
marketSymbol: 'usdc',
|
|
25
|
+
identifier: 'optimism-erc20-usdc',
|
|
26
|
+
contractAddress: '0x7F5c764cBc14f9669B88837ca1490cCa17c31607',
|
|
27
|
+
decimals: 6
|
|
28
|
+
},
|
|
29
|
+
'optimism-erc20-dai': {
|
|
30
|
+
symbol: 'DAI',
|
|
31
|
+
name: 'Dai Stablecoin',
|
|
32
|
+
marketSymbol: 'dai',
|
|
33
|
+
identifier: 'optimism-erc20-dai',
|
|
34
|
+
contractAddress: '0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1',
|
|
35
|
+
decimals: 18
|
|
36
|
+
},
|
|
37
|
+
'optimism-erc20-wbtc': {
|
|
38
|
+
symbol: 'WBTC',
|
|
39
|
+
name: 'Wrapped BTC',
|
|
40
|
+
marketSymbol: 'wbtc',
|
|
41
|
+
identifier: 'optimism-erc20-wbtc',
|
|
42
|
+
contractAddress: '0x68f180fcCe6836688e9084f035309E29Bf0A2095',
|
|
43
|
+
decimals: 8
|
|
44
|
+
},
|
|
45
|
+
'optimism-erc20-link': {
|
|
46
|
+
symbol: 'LINK',
|
|
47
|
+
name: 'Chainlink Token',
|
|
48
|
+
marketSymbol: 'link',
|
|
49
|
+
identifier: 'optimism-erc20-link',
|
|
50
|
+
contractAddress: '0x350a791Bfc2C21F9Ed5d10980Dad2e2638ffa7f6',
|
|
51
|
+
decimals: 18
|
|
52
|
+
},
|
|
53
|
+
'optimism-erc20-ldo': {
|
|
54
|
+
symbol: 'LDO',
|
|
55
|
+
name: 'Lido DAO Token',
|
|
56
|
+
marketSymbol: 'ldo',
|
|
57
|
+
identifier: 'optimism-erc20-ldo',
|
|
58
|
+
contractAddress: '0xFdb794692724153d1488CcdBE0C56c252596735F',
|
|
59
|
+
decimals: 18
|
|
60
|
+
},
|
|
61
|
+
'optimism-erc20-frax': {
|
|
62
|
+
symbol: 'FRAX',
|
|
63
|
+
name: 'Frax',
|
|
64
|
+
marketSymbol: 'frax',
|
|
65
|
+
identifier: 'optimism-erc20-frax',
|
|
66
|
+
contractAddress: '0x2E3D870790dC77A83DD1d18184Acc7439A53f475',
|
|
67
|
+
decimals: 18
|
|
68
|
+
},
|
|
69
|
+
'optimism-erc20-snx': {
|
|
70
|
+
symbol: 'SNX',
|
|
71
|
+
name: 'Synthetix Network Token',
|
|
72
|
+
marketSymbol: 'snx',
|
|
73
|
+
identifier: 'optimism-erc20-snx',
|
|
74
|
+
contractAddress: '0x8700dAec35aF8Ff88c16BdF0418774CB3D7599B4',
|
|
75
|
+
decimals: 18
|
|
76
|
+
},
|
|
77
|
+
'optimism-erc20-ust': {
|
|
78
|
+
symbol: 'UST',
|
|
79
|
+
name: 'TerraUSD',
|
|
80
|
+
marketSymbol: 'ust',
|
|
81
|
+
identifier: 'optimism-erc20-ust',
|
|
82
|
+
contractAddress: '0xFB21B70922B9f6e3C6274BcD6CB1aa8A0fe20B80',
|
|
83
|
+
decimals: 6
|
|
84
|
+
}
|
|
85
|
+
};
|
|
5
86
|
exports.erc20TokensIdentifiers = Object.keys(exports.erc20Tokens);
|
|
6
87
|
//# sourceMappingURL=ERC20Tokens.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ERC20Tokens.js","sourceRoot":"","sources":["../../../src/v1/module/ERC20Tokens.ts"],"names":[],"mappings":";;;AAGa,QAAA,WAAW,GAAuC,EAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"ERC20Tokens.js","sourceRoot":"","sources":["../../../src/v1/module/ERC20Tokens.ts"],"names":[],"mappings":";;;AAGa,QAAA,WAAW,GAAuC;IAC7D,mBAAmB,EAAE;QACnB,MAAM,EAAE,IAAI;QACZ,IAAI,EAAE,UAAU;QAChB,YAAY,EAAE,IAAI;QAClB,UAAU,EAAE,mBAAmB;QAC/B,eAAe,EAAE,4CAA4C;QAC7D,QAAQ,EAAE,EAAE;KACb;IACD,qBAAqB,EAAE;QACrB,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,oBAAoB;QAC1B,YAAY,EAAE,MAAM;QACpB,UAAU,EAAE,qBAAqB;QACjC,eAAe,EAAE,4CAA4C;QAC7D,QAAQ,EAAE,CAAC;KACZ;IACD,qBAAqB,EAAE;QACrB,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,UAAU;QAChB,YAAY,EAAE,MAAM;QACpB,UAAU,EAAE,qBAAqB;QACjC,eAAe,EAAE,4CAA4C;QAC7D,QAAQ,EAAE,CAAC;KACZ;IACD,oBAAoB,EAAE;QACpB,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,gBAAgB;QACtB,YAAY,EAAE,KAAK;QACnB,UAAU,EAAE,oBAAoB;QAChC,eAAe,EAAE,4CAA4C;QAC7D,QAAQ,EAAE,EAAE;KACb;IACD,qBAAqB,EAAE;QACrB,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,aAAa;QACnB,YAAY,EAAE,MAAM;QACpB,UAAU,EAAE,qBAAqB;QACjC,eAAe,EAAE,4CAA4C;QAC7D,QAAQ,EAAE,CAAC;KACZ;IACD,qBAAqB,EAAE;QACrB,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,iBAAiB;QACvB,YAAY,EAAE,MAAM;QACpB,UAAU,EAAE,qBAAqB;QACjC,eAAe,EAAE,4CAA4C;QAC7D,QAAQ,EAAE,EAAE;KACb;IACD,oBAAoB,EAAE;QACpB,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,gBAAgB;QACtB,YAAY,EAAE,KAAK;QACnB,UAAU,EAAE,oBAAoB;QAChC,eAAe,EAAE,4CAA4C;QAC7D,QAAQ,EAAE,EAAE;KACb;IACD,qBAAqB,EAAE;QACrB,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,MAAM;QACZ,YAAY,EAAE,MAAM;QACpB,UAAU,EAAE,qBAAqB;QACjC,eAAe,EAAE,4CAA4C;QAC7D,QAAQ,EAAE,EAAE;KACb;IACD,oBAAoB,EAAE;QACpB,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,yBAAyB;QAC/B,YAAY,EAAE,KAAK;QACnB,UAAU,EAAE,oBAAoB;QAChC,eAAe,EAAE,4CAA4C;QAC7D,QAAQ,EAAE,EAAE;KACb;IACD,oBAAoB,EAAE;QACpB,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,UAAU;QAChB,YAAY,EAAE,KAAK;QACnB,UAAU,EAAE,oBAAoB;QAChC,eAAe,EAAE,4CAA4C;QAC7D,QAAQ,EAAE,CAAC;KACZ;CACF,CAAA;AAEY,QAAA,sBAAsB,GAAa,MAAM,CAAC,IAAI,CAAC,mBAAW,CAAC,CAAA"}
|
|
@@ -52,6 +52,7 @@ var coinlib_core_1 = require("@airgap/coinlib-core");
|
|
|
52
52
|
var errors_1 = require("@airgap/coinlib-core/errors");
|
|
53
53
|
var v1_1 = require("@airgap/ethereum/v1");
|
|
54
54
|
var module_kit_1 = require("@airgap/module-kit");
|
|
55
|
+
var ERC20Token_1 = require("../protocol/erc20/ERC20Token");
|
|
55
56
|
var OptimismProtocol_1 = require("../protocol/OptimismProtocol");
|
|
56
57
|
var serializer_companion_1 = require("../serializer/v3/serializer-companion");
|
|
57
58
|
var ERC20Tokens_1 = require("./ERC20Tokens");
|
|
@@ -62,7 +63,7 @@ var OptimismModule = /** @class */ (function () {
|
|
|
62
63
|
supportedNetworks: [OptimismProtocol_1.OPTIMISM_MAINNET_PROTOCOL_NETWORK]
|
|
63
64
|
});
|
|
64
65
|
var erc20NetworkRegistry = new module_kit_1.ModuleNetworkRegistry({
|
|
65
|
-
supportedNetworks: [
|
|
66
|
+
supportedNetworks: [ERC20Token_1.OPTIMISM_ERC20_MAINNET_PROTOCOL_NETWORK]
|
|
66
67
|
});
|
|
67
68
|
this.networkRegistries = __assign((_a = {}, _a[coinlib_core_1.MainProtocolSymbols.OPTIMISM] = networkRegistry, _a), ERC20Tokens_1.erc20TokensIdentifiers.reduce(function (obj, next) {
|
|
68
69
|
var _a;
|
|
@@ -104,7 +105,7 @@ var OptimismModule = /** @class */ (function () {
|
|
|
104
105
|
OptimismModule.prototype.createV3SerializerCompanion = function () {
|
|
105
106
|
return __awaiter(this, void 0, void 0, function () {
|
|
106
107
|
return __generator(this, function (_a) {
|
|
107
|
-
return [2 /*return*/, new serializer_companion_1.
|
|
108
|
+
return [2 /*return*/, new serializer_companion_1.OptimismV3SerializerCompanion()];
|
|
108
109
|
});
|
|
109
110
|
});
|
|
110
111
|
};
|
|
@@ -114,7 +115,7 @@ var OptimismModule = /** @class */ (function () {
|
|
|
114
115
|
}
|
|
115
116
|
if (ERC20Tokens_1.erc20Tokens[identifier] !== undefined) {
|
|
116
117
|
var tokenMetadata = ERC20Tokens_1.erc20Tokens[identifier];
|
|
117
|
-
return (0,
|
|
118
|
+
return (0, ERC20Token_1.createERC20Token)(tokenMetadata);
|
|
118
119
|
}
|
|
119
120
|
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.OPTIMISM, "Protocol ".concat(identifier, " not supported."));
|
|
120
121
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OptimismModule.js","sourceRoot":"","sources":["../../../src/v1/module/OptimismModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAkE;AAClE,sDAAqE;AACrE,
|
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,CAAC,cAAc,CAAC,UAAU,EAAE,OAAO,CAAC,EAAA;;;KAChD;IAEY,4CAAmB,GAAhC,UAAiC,UAAkB,EAAE,SAAkB;;;;gBAC/D,OAAO,GAAgC,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC,WAAW,CAAC,SAAS,CAAC,CAAA;gBACtG,IAAI,OAAO,KAAK,SAAS,EAAE;oBACzB,MAAM,IAAI,gCAAuB,CAAC,qBAAM,CAAC,QAAQ,EAAE,4CAA4C,CAAC,CAAA;iBACjG;gBAED,sBAAO,IAAI,2BAAsB,EAAE,EAAA;;;KACpC;IAEY,oDAA2B,GAAxC;;;gBACE,sBAAO,IAAI,oDAA6B,EAAE,EAAA;;;KAC3C;IAEO,uCAAc,GAAtB,UAAuB,UAAkB,EAAE,OAAyB;QAClE,IAAI,UAAU,KAAK,kCAAmB,CAAC,QAAQ,EAAE;YAC/C,OAAO,IAAA,yCAAsB,EAAC,EAAE,OAAO,SAAA,EAAE,CAAC,CAAA;SAC3C;QAED,IAAI,yBAAW,CAAC,UAAU,CAAC,KAAK,SAAS,EAAE;YACzC,IAAM,aAAa,GAAuB,yBAAW,CAAC,UAAU,CAAC,CAAA;YAEjE,OAAO,IAAA,6BAAgB,EAAC,aAAa,CAAC,CAAA;SACvC;QAED,MAAM,IAAI,gCAAuB,CAAC,qBAAM,CAAC,QAAQ,EAAE,mBAAY,UAAU,oBAAiB,CAAC,CAAA;IAC7F,CAAC;IACH,qBAAC;AAAD,CAAC,AA7DD,IA6DC;AA7DY,wCAAc"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { EthereumBaseProtocolImpl, EthereumUnits } from '@airgap/ethereum/v1';
|
|
2
|
+
import { Address, AirGapProtocol, AirGapTransaction, AirGapTransactionStatus, AirGapTransactionsWithCursor, Amount, Balance, CryptoDerivative, ExtendedKeyPair, ExtendedPublicKey, ExtendedSecretKey, FeeDefaults, KeyPair, ProtocolMetadata, ProtocolUnitsMetadata, PublicKey, SecretKey, Signature, TransactionConfiguration, TransactionDetails } from '@airgap/module-kit';
|
|
3
|
+
import { OptimismInfoClient } from '../client/info/OptimismInfoClient';
|
|
4
|
+
import { OptimismNodeClient } from '../client/node/OptimismNodeClient';
|
|
5
|
+
import { OptimismCryptoConfiguration } from '../types/crypto';
|
|
6
|
+
import { OptimismProtocolNetwork, OptimismProtocolOptions } from '../types/protocol';
|
|
7
|
+
import { OptimismSignedTransaction, OptimismTransactionCursor, OptimismUnsignedTransaction } from '../types/transaction';
|
|
8
|
+
export interface OptimismBaseProtocol<_Units extends string = EthereumUnits> extends AirGapProtocol<{
|
|
9
|
+
AddressResult: Address;
|
|
10
|
+
ProtocolNetwork: OptimismProtocolNetwork;
|
|
11
|
+
CryptoConfiguration: OptimismCryptoConfiguration;
|
|
12
|
+
Units: _Units;
|
|
13
|
+
FeeUnits: EthereumUnits;
|
|
14
|
+
FeeEstimation: FeeDefaults<EthereumUnits>;
|
|
15
|
+
SignedTransaction: OptimismSignedTransaction;
|
|
16
|
+
UnsignedTransaction: OptimismUnsignedTransaction;
|
|
17
|
+
TransactionCursor: OptimismTransactionCursor;
|
|
18
|
+
}, 'Bip32', 'Crypto', 'FetchDataForAddress', 'FetchDataForMultipleAddresses', 'TransactionStatusChecker'> {
|
|
19
|
+
}
|
|
20
|
+
export declare abstract class OptimismBaseProtocolImpl<_Units extends string = EthereumUnits, _EthereumProtocol extends EthereumBaseProtocolImpl<_Units, OptimismProtocolNetwork> = EthereumBaseProtocolImpl<_Units, OptimismProtocolNetwork>> implements OptimismBaseProtocol<_Units> {
|
|
21
|
+
protected readonly ethereumProtocol: _EthereumProtocol;
|
|
22
|
+
protected readonly nodeClient: OptimismNodeClient;
|
|
23
|
+
protected readonly infoClient: OptimismInfoClient;
|
|
24
|
+
protected readonly options: OptimismProtocolOptions;
|
|
25
|
+
protected constructor(ethereumProtocol: _EthereumProtocol, nodeClient: OptimismNodeClient, infoClient: OptimismInfoClient, options: OptimismProtocolOptions);
|
|
26
|
+
protected readonly units: ProtocolUnitsMetadata<_Units>;
|
|
27
|
+
protected readonly feeUnits: ProtocolUnitsMetadata<EthereumUnits>;
|
|
28
|
+
getMetadata(): Promise<ProtocolMetadata<_Units, EthereumUnits>>;
|
|
29
|
+
getAddressFromPublicKey(publicKey: PublicKey | ExtendedPublicKey): Promise<string>;
|
|
30
|
+
deriveFromExtendedPublicKey(extendedPublicKey: ExtendedPublicKey, visibilityIndex: number, addressIndex: number): Promise<PublicKey>;
|
|
31
|
+
getDetailsFromTransaction(transaction: OptimismUnsignedTransaction | OptimismSignedTransaction, publicKey: PublicKey | ExtendedPublicKey): Promise<AirGapTransaction<_Units, EthereumUnits>[]>;
|
|
32
|
+
verifyMessageWithPublicKey(message: string, signature: Signature, publicKey: PublicKey | ExtendedPublicKey): Promise<boolean>;
|
|
33
|
+
encryptAsymmetricWithPublicKey(payload: string, publicKey: PublicKey | ExtendedPublicKey): Promise<string>;
|
|
34
|
+
getCryptoConfiguration(): Promise<OptimismCryptoConfiguration>;
|
|
35
|
+
getKeyPairFromDerivative(derivative: CryptoDerivative): Promise<KeyPair>;
|
|
36
|
+
getExtendedKeyPairFromDerivative(derivative: CryptoDerivative): Promise<ExtendedKeyPair>;
|
|
37
|
+
deriveFromExtendedSecretKey(extendedSecretKey: ExtendedSecretKey, visibilityIndex: number, addressIndex: number): Promise<SecretKey>;
|
|
38
|
+
signTransactionWithSecretKey(transaction: OptimismUnsignedTransaction, secretKey: SecretKey | ExtendedSecretKey): Promise<OptimismSignedTransaction>;
|
|
39
|
+
signMessageWithKeyPair(message: string, keyPair: KeyPair | ExtendedKeyPair): Promise<Signature>;
|
|
40
|
+
decryptAsymmetricWithKeyPair(payload: string, keyPair: KeyPair | ExtendedKeyPair): Promise<string>;
|
|
41
|
+
encryptAESWithSecretKey(payload: string, secretKey: SecretKey | ExtendedSecretKey): Promise<string>;
|
|
42
|
+
decryptAESWithSecretKey(payload: string, secretKey: SecretKey | ExtendedSecretKey): Promise<string>;
|
|
43
|
+
getNetwork(): Promise<OptimismProtocolNetwork>;
|
|
44
|
+
getTransactionsForPublicKey(publicKey: PublicKey | ExtendedPublicKey, limit: number, cursor?: OptimismTransactionCursor): Promise<AirGapTransactionsWithCursor<OptimismTransactionCursor, _Units, EthereumUnits>>;
|
|
45
|
+
getTransactionsForAddress(address: string, limit: number, cursor?: OptimismTransactionCursor): Promise<AirGapTransactionsWithCursor<OptimismTransactionCursor, _Units, EthereumUnits>>;
|
|
46
|
+
getTransactionsForAddresses(addresses: string[], limit: number, cursor?: OptimismTransactionCursor): Promise<AirGapTransactionsWithCursor<OptimismTransactionCursor, _Units, EthereumUnits>>;
|
|
47
|
+
getTransactionStatus(transactionIds: string[]): Promise<Record<string, AirGapTransactionStatus>>;
|
|
48
|
+
getBalanceOfPublicKey(publicKey: PublicKey | ExtendedPublicKey): Promise<Balance<_Units>>;
|
|
49
|
+
getBalanceOfAddress(address: string): Promise<Balance<_Units>>;
|
|
50
|
+
getBalanceOfAddresses(addresses: string[]): Promise<Balance<_Units>>;
|
|
51
|
+
getTransactionMaxAmountWithPublicKey(publicKey: PublicKey | ExtendedPublicKey, to: string[], configuration?: TransactionConfiguration<EthereumUnits>): Promise<Amount<_Units>>;
|
|
52
|
+
getTransactionFeeWithPublicKey(publicKey: PublicKey | ExtendedPublicKey, details: TransactionDetails<_Units>[]): Promise<FeeDefaults<EthereumUnits>>;
|
|
53
|
+
prepareTransactionWithPublicKey(publicKey: PublicKey | ExtendedPublicKey, details: TransactionDetails<_Units>[], configuration?: TransactionConfiguration<EthereumUnits>): Promise<OptimismUnsignedTransaction>;
|
|
54
|
+
broadcastTransaction(transaction: OptimismSignedTransaction): Promise<string>;
|
|
55
|
+
}
|