@airgap/optimism 0.13.15-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +7 -0
- package/index.d.ts +1 -0
- package/index.js +18 -0
- package/index.js.map +1 -0
- package/package.json +62 -0
- package/readme.md +121 -0
- package/v1/index.d.ts +2 -0
- package/v1/index.js +6 -0
- package/v1/index.js.map +1 -0
- package/v1/module/ERC20Tokens.d.ts +3 -0
- package/v1/module/ERC20Tokens.js +6 -0
- package/v1/module/ERC20Tokens.js.map +1 -0
- package/v1/module/OptimismModule.d.ts +13 -0
- package/v1/module/OptimismModule.js +124 -0
- package/v1/module/OptimismModule.js.map +1 -0
- package/v1/module.d.ts +3 -0
- package/v1/module.js +24 -0
- package/v1/module.js.map +1 -0
- package/v1/protocol/OptimismProtocol.d.ts +8 -0
- package/v1/protocol/OptimismProtocol.js +77 -0
- package/v1/protocol/OptimismProtocol.js.map +1 -0
- package/v1/serializer/v3/schemas/converter/transaction-converter.d.ts +8 -0
- package/v1/serializer/v3/schemas/converter/transaction-converter.js +21 -0
- package/v1/serializer/v3/schemas/converter/transaction-converter.js.map +1 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-optimism-typed.d.ts +3 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-optimism-typed.js +3 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-optimism-typed.js.map +1 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-optimism.d.ts +3 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-optimism.js +3 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-optimism.js.map +1 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-response-optimism.d.ts +3 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-response-optimism.js +3 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-response-optimism.js.map +1 -0
- package/v1/serializer/v3/schemas/generated/transaction-sign-request-optimism-typed.json +42 -0
- package/v1/serializer/v3/schemas/generated/transaction-sign-request-optimism.json +59 -0
- package/v1/serializer/v3/schemas/generated/transaction-sign-response-optimism.json +19 -0
- package/v1/serializer/v3/serializer-companion.d.ts +13 -0
- package/v1/serializer/v3/serializer-companion.js +190 -0
- package/v1/serializer/v3/serializer-companion.js.map +1 -0
- package/v1/serializer/v3/validators/transaction-validator.d.ts +4 -0
- package/v1/serializer/v3/validators/transaction-validator.js +29 -0
- package/v1/serializer/v3/validators/transaction-validator.js.map +1 -0
- package/v1/types/protocol.d.ts +8 -0
- package/v1/types/protocol.js +3 -0
- package/v1/types/protocol.js.map +1 -0
- package/v1/types/transaction.d.ts +4 -0
- package/v1/types/transaction.js +3 -0
- package/v1/types/transaction.js.map +1 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright 2019 Papers AG
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './v1';
|
package/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./v1"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
package/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uCAAoB"}
|
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@airgap/optimism",
|
|
3
|
+
"version": "0.13.15-beta.11",
|
|
4
|
+
"description": "The @airgap/optimism is an Optimism implementation of the ICoinProtocol interface from @airgap/coinlib-core.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"airgap",
|
|
7
|
+
"blockchain",
|
|
8
|
+
"crypto",
|
|
9
|
+
"ethereum",
|
|
10
|
+
"optimism"
|
|
11
|
+
],
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"homepage": "https://www.airgap.it",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/airgap-it/airgap-coin-lib"
|
|
17
|
+
},
|
|
18
|
+
"publishConfig": {
|
|
19
|
+
"access": "public"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "rm -rf ./dist && tsc && node scripts/copy-files-after-build.js",
|
|
23
|
+
"build-scripts": "tsc scripts/*.ts",
|
|
24
|
+
"lint": "tslint -c ./tslint.json --project ./tsconfig.json --format stylish --fix",
|
|
25
|
+
"lint:prettier": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
|
|
26
|
+
"lint-ci": "tslint -t json -o ../../lint-reports/optimism.json --project . || true",
|
|
27
|
+
"lint-ci:prettier": "prettier \"src/**/*.ts\" \"test/**/*.ts\" --list-different",
|
|
28
|
+
"test": "",
|
|
29
|
+
"test-ci": "",
|
|
30
|
+
"browserify": "browserify ./dist/index.js -s airgapCoinLibOptimism > ./dist/airgap-coinlib-optimism.min.js"
|
|
31
|
+
},
|
|
32
|
+
"author": "Papers AG <contact@papers.ch> (https://papers.ch)",
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@airgap/coinlib-core": "*",
|
|
35
|
+
"@airgap/crypto": "*",
|
|
36
|
+
"@airgap/ethereum": "*",
|
|
37
|
+
"@airgap/module-kit": "*",
|
|
38
|
+
"@airgap/serializer": "*"
|
|
39
|
+
},
|
|
40
|
+
"nyc": {
|
|
41
|
+
"include": [
|
|
42
|
+
"src/**/*.ts"
|
|
43
|
+
],
|
|
44
|
+
"exclude": [
|
|
45
|
+
"test/**/*.spec.ts"
|
|
46
|
+
],
|
|
47
|
+
"extension": [
|
|
48
|
+
".ts"
|
|
49
|
+
],
|
|
50
|
+
"require": [
|
|
51
|
+
"ts-node/register"
|
|
52
|
+
],
|
|
53
|
+
"reporter": [
|
|
54
|
+
"text",
|
|
55
|
+
"text-summary"
|
|
56
|
+
],
|
|
57
|
+
"report-dir": "../../coverage/optimism",
|
|
58
|
+
"sourceMap": true,
|
|
59
|
+
"instrument": true
|
|
60
|
+
},
|
|
61
|
+
"gitHead": "8e8feb6788204501b7173aa825f5456c2a5f185b"
|
|
62
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# AirGap Coin Library
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/airgap-coin-lib)
|
|
4
|
+
[](https://airgap-it.github.io/airgap-coin-lib/)
|
|
5
|
+
[](https://travis-ci.org/airgap-it/airgap-coin-lib/)
|
|
6
|
+
[](https://codecov.io/gh/airgap-it/airgap-coin-lib/)
|
|
7
|
+
|
|
8
|
+
The `airgap-coin-lib` is a protocol-agnostic library that allows easy handling of the most important tasks relating cryptocurrencies and blockchains.
|
|
9
|
+
|
|
10
|
+
It implements operations such as preparing, signing and broadcasting transactions for a range of protocols.
|
|
11
|
+
|
|
12
|
+
The library consists of a shared interface for all implemented protocols. This is especially useful in the context of AirGap because methods are designed to support offline key management and signing. The following core operations are specified:
|
|
13
|
+
|
|
14
|
+
- `prepareTransaction` - This is done on AirGap Wallet (online) side. Either a public key or extended public key is used and will fetch the required information from the network.
|
|
15
|
+
- `signTransaction` - This is done in AirGap Vault (offline) side. The output of "prepareTransaction" is the input for this method (hence the output of "prepareTransaction" is transferred via URL scheme (same-device) or QR code (2-device-setup)).
|
|
16
|
+
- `broadcastTransaction` - This is done in AirGap Wallet (online) side. The output of "signTransaction" is the input for this method (hence the output of "signTransaction" is transferred via URL scheme (same-device) or QR code (2-device-setup)).
|
|
17
|
+
|
|
18
|
+
## Supported Protocols
|
|
19
|
+
|
|
20
|
+
The modular design used in this library allows you to simply add new protocols with special logic. Adding a new Bitcoin-like protocol basically means:
|
|
21
|
+
|
|
22
|
+
1. select the correct network parameters (see `src/networks.ts`)
|
|
23
|
+
2. set the Insight API URL to communicate with the blockchain
|
|
24
|
+
|
|
25
|
+
Adding a new Ethereum-like protocol means:
|
|
26
|
+
|
|
27
|
+
1. set the correct chain id
|
|
28
|
+
2. set the JSON RPC URL
|
|
29
|
+
|
|
30
|
+
Currently supported are:
|
|
31
|
+
|
|
32
|
+
- Bitcoin
|
|
33
|
+
- Ethereum
|
|
34
|
+
- Generic ERC20 Tokens
|
|
35
|
+
- Aeternity
|
|
36
|
+
- Tezos
|
|
37
|
+
- FA1.2 tokens
|
|
38
|
+
- tzBTC
|
|
39
|
+
- USDtz
|
|
40
|
+
- FA2 tokens
|
|
41
|
+
- Groestlcoin
|
|
42
|
+
- Cosmos
|
|
43
|
+
- Polkadot
|
|
44
|
+
- Kusama
|
|
45
|
+
|
|
46
|
+
## Features
|
|
47
|
+
|
|
48
|
+
### Protocols
|
|
49
|
+
|
|
50
|
+
The way the interface was designed is to allow stateless calls. This means the class stores very little state itself.
|
|
51
|
+
All required input comes from the method params (public key, extended public key, etc...)
|
|
52
|
+
|
|
53
|
+
Currently we support for Bitcoin-like (UTXO) protocols:
|
|
54
|
+
|
|
55
|
+
- Single Address Wallets (deprecated)
|
|
56
|
+
- HD Wallets
|
|
57
|
+
|
|
58
|
+
Currently we support for Ethereum-like (Account-based) protocols:
|
|
59
|
+
|
|
60
|
+
- Single Address Wallets
|
|
61
|
+
|
|
62
|
+
### Delegation
|
|
63
|
+
|
|
64
|
+
There is a different interface that can be implemented if the protocol supports delegation. The delegation flow usually requires some changes in the user interface of the AirGap Wallet as well.
|
|
65
|
+
|
|
66
|
+
### Inter App Communication
|
|
67
|
+
|
|
68
|
+
A serializer is included that encodes JSON structures with RLP and base58check. Those strings can then be sent to the other app, either through QR codes or a URL. The serializer can only serialize messages in predefined formats, so new message types have to be added when new protocols are added.
|
|
69
|
+
|
|
70
|
+
### Tezos FA1.2 and FA2 tokens
|
|
71
|
+
|
|
72
|
+
It is possible to interact (fetch balances, create transfers, etc.) with an FA1.2 and FA2 smart contracts using the `TezosFA12Protocol` and `TezosFA2Protocol` classes. An example on how to use them can be found in `examples/custom/protocols/tezos/fa2-smart-contract.ts`.
|
|
73
|
+
|
|
74
|
+
## Synchronising information between wallet and vault
|
|
75
|
+
|
|
76
|
+
Such that the system works we need to be able to synchronise wallets. A wallet can be:
|
|
77
|
+
|
|
78
|
+
- Single Address Wallet
|
|
79
|
+
- HD Wallet
|
|
80
|
+
|
|
81
|
+
For the single address wallet we only need to share the public key. For HD Wallet we need to share the extended public key.
|
|
82
|
+
|
|
83
|
+
## Getting started
|
|
84
|
+
|
|
85
|
+
### Requirements
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
npm >= 6
|
|
89
|
+
NodeJS >= 12
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Build dependencies get installed using `npm install`.
|
|
93
|
+
|
|
94
|
+
### Clone and Run
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
$ git clone https://github.com/airgap-it/airgap-coin-lib.git
|
|
98
|
+
$ cd airgap-coin-lib
|
|
99
|
+
$ npm install
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
To run the tests, you will have to install the test dependencies
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
$ npm run install-test-dependencies
|
|
106
|
+
$ npm test
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
To remove the test dependencies and clean up the `package.json` and `package-lock.json`, execute this command
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
$ npm run install-build-dependencies
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Contributing
|
|
116
|
+
|
|
117
|
+
We welcome contributions from the community. Simple readme updates or bugfixes can be addressed with a PR directly.
|
|
118
|
+
|
|
119
|
+
For larger changes like new protocols, new features or larger refactorings, please contact us first by opening an issue. This project is under constant development and until version `1.x.x` has been reached, there will be frequent breaking changes. So make sure to take a look at the `develop` branch.
|
|
120
|
+
|
|
121
|
+
Regarding new protocols / currencies, we cannot guarantee that they will be merged, but we're more than happy to discuss the details of a specific integration in a github issue.
|
package/v1/index.d.ts
ADDED
package/v1/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OptimismModule = void 0;
|
|
4
|
+
var OptimismModule_1 = require("./module/OptimismModule");
|
|
5
|
+
Object.defineProperty(exports, "OptimismModule", { enumerable: true, get: function () { return OptimismModule_1.OptimismModule; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
package/v1/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/v1/index.ts"],"names":[],"mappings":";;;AAAA,0DAAwD;AAI/C,+FAJA,+BAAc,OAIA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.erc20TokensIdentifiers = exports.erc20Tokens = void 0;
|
|
4
|
+
exports.erc20Tokens = {};
|
|
5
|
+
exports.erc20TokensIdentifiers = Object.keys(exports.erc20Tokens);
|
|
6
|
+
//# sourceMappingURL=ERC20Tokens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ERC20Tokens.js","sourceRoot":"","sources":["../../../src/v1/module/ERC20Tokens.ts"],"names":[],"mappings":";;;AAGa,QAAA,WAAW,GAAuC,EAAE,CAAA;AAEpD,QAAA,sBAAsB,GAAa,MAAM,CAAC,IAAI,CAAC,mBAAW,CAAC,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AirGapModule, AirGapV3SerializerCompanion, ProtocolConfiguration } 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 OptimismModule implements AirGapModule {
|
|
5
|
+
private readonly networkRegistries;
|
|
6
|
+
readonly supportedProtocols: Record<string, ProtocolConfiguration>;
|
|
7
|
+
constructor();
|
|
8
|
+
createOfflineProtocol(identifier: string): Promise<OfflineProtocol | undefined>;
|
|
9
|
+
createOnlineProtocol(identifier: string, networkId?: string): Promise<OnlineProtocol | undefined>;
|
|
10
|
+
createBlockExplorer(identifier: string, networkId?: string): Promise<BlockExplorer | undefined>;
|
|
11
|
+
createV3SerializerCompanion(): Promise<AirGapV3SerializerCompanion>;
|
|
12
|
+
private createProtocol;
|
|
13
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
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
|
+
};
|
|
49
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
+
exports.OptimismModule = void 0;
|
|
51
|
+
var coinlib_core_1 = require("@airgap/coinlib-core");
|
|
52
|
+
var errors_1 = require("@airgap/coinlib-core/errors");
|
|
53
|
+
var v1_1 = require("@airgap/ethereum/v1");
|
|
54
|
+
var module_kit_1 = require("@airgap/module-kit");
|
|
55
|
+
var OptimismProtocol_1 = require("../protocol/OptimismProtocol");
|
|
56
|
+
var serializer_companion_1 = require("../serializer/v3/serializer-companion");
|
|
57
|
+
var ERC20Tokens_1 = require("./ERC20Tokens");
|
|
58
|
+
var OptimismModule = /** @class */ (function () {
|
|
59
|
+
function OptimismModule() {
|
|
60
|
+
var _a;
|
|
61
|
+
var networkRegistry = new module_kit_1.ModuleNetworkRegistry({
|
|
62
|
+
supportedNetworks: [OptimismProtocol_1.OPTIMISM_MAINNET_PROTOCOL_NETWORK]
|
|
63
|
+
});
|
|
64
|
+
var erc20NetworkRegistry = new module_kit_1.ModuleNetworkRegistry({
|
|
65
|
+
supportedNetworks: [OptimismProtocol_1.OPTIMISM_MAINNET_PROTOCOL_NETWORK]
|
|
66
|
+
});
|
|
67
|
+
this.networkRegistries = __assign((_a = {}, _a[coinlib_core_1.MainProtocolSymbols.OPTIMISM] = networkRegistry, _a), ERC20Tokens_1.erc20TokensIdentifiers.reduce(function (obj, next) {
|
|
68
|
+
var _a;
|
|
69
|
+
return Object.assign(obj, (_a = {}, _a[next] = erc20NetworkRegistry, _a));
|
|
70
|
+
}, {}));
|
|
71
|
+
this.supportedProtocols = (0, module_kit_1.createSupportedProtocols)(this.networkRegistries);
|
|
72
|
+
}
|
|
73
|
+
OptimismModule.prototype.createOfflineProtocol = function (identifier) {
|
|
74
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
75
|
+
return __generator(this, function (_a) {
|
|
76
|
+
return [2 /*return*/, this.createProtocol(identifier)];
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
OptimismModule.prototype.createOnlineProtocol = function (identifier, networkId) {
|
|
81
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
82
|
+
var network;
|
|
83
|
+
return __generator(this, function (_a) {
|
|
84
|
+
network = this.networkRegistries[identifier].findNetwork(networkId);
|
|
85
|
+
if (network === undefined) {
|
|
86
|
+
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.OPTIMISM, 'Protocol network type not supported.');
|
|
87
|
+
}
|
|
88
|
+
return [2 /*return*/, this.createProtocol(identifier, network)];
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
OptimismModule.prototype.createBlockExplorer = function (identifier, networkId) {
|
|
93
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
94
|
+
var network;
|
|
95
|
+
return __generator(this, function (_a) {
|
|
96
|
+
network = this.networkRegistries[identifier].findNetwork(networkId);
|
|
97
|
+
if (network === undefined) {
|
|
98
|
+
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.OPTIMISM, 'Block Explorer network type not supported.');
|
|
99
|
+
}
|
|
100
|
+
return [2 /*return*/, new v1_1.EtherscanBlockExplorer()];
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
OptimismModule.prototype.createV3SerializerCompanion = function () {
|
|
105
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
106
|
+
return __generator(this, function (_a) {
|
|
107
|
+
return [2 /*return*/, new serializer_companion_1.EthereumV3SerializerCompanion()];
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
OptimismModule.prototype.createProtocol = function (identifier, network) {
|
|
112
|
+
if (identifier === coinlib_core_1.MainProtocolSymbols.OPTIMISM) {
|
|
113
|
+
return (0, OptimismProtocol_1.createOptimismProtocol)({ network: network });
|
|
114
|
+
}
|
|
115
|
+
if (ERC20Tokens_1.erc20Tokens[identifier] !== undefined) {
|
|
116
|
+
var tokenMetadata = ERC20Tokens_1.erc20Tokens[identifier];
|
|
117
|
+
return (0, v1_1.createERC20Token)(tokenMetadata);
|
|
118
|
+
}
|
|
119
|
+
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.OPTIMISM, "Protocol ".concat(identifier, " not supported."));
|
|
120
|
+
};
|
|
121
|
+
return OptimismModule;
|
|
122
|
+
}());
|
|
123
|
+
exports.OptimismModule = OptimismModule;
|
|
124
|
+
//# sourceMappingURL=OptimismModule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OptimismModule.js","sourceRoot":"","sources":["../../../src/v1/module/OptimismModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAkE;AAClE,sDAAqE;AACrE,0CAAkG;AAClG,iDAO2B;AAI3B,iEAAwG;AACxG,8EAAqF;AAErF,6CAAmE;AAEnE;IAIE;;QACE,IAAM,eAAe,GAA0B,IAAI,kCAAqB,CAAC;YACvE,iBAAiB,EAAE,CAAC,oDAAiC,CAAC;SACvD,CAAC,CAAA;QACF,IAAM,oBAAoB,GAA0B,IAAI,kCAAqB,CAAC;YAC5E,iBAAiB,EAAE,CAAC,oDAAiC,CAAC;SACvD,CAAC,CAAA;QAEF,IAAI,CAAC,iBAAiB,yBACnB,kCAAmB,CAAC,QAAQ,IAAG,eAAe,OAC5C,oCAAsB,CAAC,MAAM,CAC9B,UAAC,GAA0C,EAAE,IAAY;;YAAK,OAAA,MAAM,CAAC,MAAM,CAAC,GAAG,YAAI,GAAC,IAAI,IAAG,oBAAoB,MAAG;QAApD,CAAoD,EAClH,EAAE,CACH,CACF,CAAA;QACD,IAAI,CAAC,kBAAkB,GAAG,IAAA,qCAAwB,EAAC,IAAI,CAAC,iBAAiB,CAAC,CAAA;IAC5E,CAAC;IAEY,8CAAqB,GAAlC,UAAmC,UAAkB;;;gBACnD,sBAAO,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,EAAA;;;KACvC;IAEY,6CAAoB,GAAjC,UAAkC,UAAkB,EAAE,SAAkB;;;;gBAChE,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,sCAAsC,CAAC,CAAA;iBAC3F;gBAED,sBAAO,IAAI,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,qBAAgB,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"}
|
package/v1/module.d.ts
ADDED
package/v1/module.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.create = void 0;
|
|
18
|
+
var OptimismModule_1 = require("./module/OptimismModule");
|
|
19
|
+
__exportStar(require("./index"), exports);
|
|
20
|
+
function create() {
|
|
21
|
+
return new OptimismModule_1.OptimismModule();
|
|
22
|
+
}
|
|
23
|
+
exports.create = create;
|
|
24
|
+
//# sourceMappingURL=module.js.map
|
package/v1/module.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/v1/module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,0DAAwD;AAExD,0CAAuB;AAEvB,SAAgB,MAAM;IACpB,OAAO,IAAI,+BAAc,EAAE,CAAA;AAC7B,CAAC;AAFD,wBAEC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ERC20Protocol } from '@airgap/ethereum/v1';
|
|
2
|
+
import { RecursivePartial } from '@airgap/module-kit';
|
|
3
|
+
import { OptimismProtocolNetwork, OptimismProtocolOptions, OptimismUnits } from '../types/protocol';
|
|
4
|
+
export interface OptimismProtocol extends ERC20Protocol<OptimismUnits> {
|
|
5
|
+
}
|
|
6
|
+
export declare function createOptimismProtocol(options?: RecursivePartial<OptimismProtocolOptions>): OptimismProtocol;
|
|
7
|
+
export declare const OPTIMISM_MAINNET_PROTOCOL_NETWORK: OptimismProtocolNetwork;
|
|
8
|
+
export declare function createOptimismProtocolOptions(network?: Partial<OptimismProtocolNetwork>): OptimismProtocolOptions;
|
|
@@ -0,0 +1,77 @@
|
|
|
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 __assign = (this && this.__assign) || function () {
|
|
18
|
+
__assign = Object.assign || function(t) {
|
|
19
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
20
|
+
s = arguments[i];
|
|
21
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
22
|
+
t[p] = s[p];
|
|
23
|
+
}
|
|
24
|
+
return t;
|
|
25
|
+
};
|
|
26
|
+
return __assign.apply(this, arguments);
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.createOptimismProtocolOptions = exports.OPTIMISM_MAINNET_PROTOCOL_NETWORK = exports.createOptimismProtocol = void 0;
|
|
30
|
+
var coinlib_core_1 = require("@airgap/coinlib-core");
|
|
31
|
+
var v1_1 = require("@airgap/ethereum/v1");
|
|
32
|
+
// Implementation
|
|
33
|
+
var OptimismProtocolImpl = /** @class */ (function (_super) {
|
|
34
|
+
__extends(OptimismProtocolImpl, _super);
|
|
35
|
+
function OptimismProtocolImpl(options) {
|
|
36
|
+
var completeOptions = createOptimismProtocolOptions(options.network);
|
|
37
|
+
var nodeClient = new v1_1.AirGapNodeClient(completeOptions.network.rpcUrl);
|
|
38
|
+
var infoClient = new v1_1.EtherscanInfoClient(completeOptions.network.blockExplorerApi);
|
|
39
|
+
return _super.call(this, nodeClient, infoClient, {
|
|
40
|
+
network: completeOptions.network,
|
|
41
|
+
contractAddress: completeOptions.network.contractAddress,
|
|
42
|
+
name: 'Optimism',
|
|
43
|
+
identifier: coinlib_core_1.MainProtocolSymbols.OPTIMISM,
|
|
44
|
+
units: {
|
|
45
|
+
OP: {
|
|
46
|
+
symbol: { value: 'OP' },
|
|
47
|
+
decimals: 18
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
mainUnit: 'OP'
|
|
51
|
+
}) || this;
|
|
52
|
+
}
|
|
53
|
+
return OptimismProtocolImpl;
|
|
54
|
+
}(v1_1.ERC20ProtocolImpl));
|
|
55
|
+
// Factory
|
|
56
|
+
function createOptimismProtocol(options) {
|
|
57
|
+
if (options === void 0) { options = {}; }
|
|
58
|
+
return new OptimismProtocolImpl(options);
|
|
59
|
+
}
|
|
60
|
+
exports.createOptimismProtocol = createOptimismProtocol;
|
|
61
|
+
exports.OPTIMISM_MAINNET_PROTOCOL_NETWORK = {
|
|
62
|
+
name: 'Mainnet',
|
|
63
|
+
type: 'mainnet',
|
|
64
|
+
rpcUrl: 'https://mainnet.optimism.io',
|
|
65
|
+
chainId: 10,
|
|
66
|
+
contractAddress: '0x4200000000000000000000000000000000000042',
|
|
67
|
+
blockExplorerApi: 'https://explorer.optimism.io'
|
|
68
|
+
};
|
|
69
|
+
var DEFAULT_OPTIMISM_PROTOCOL_NETWORK = exports.OPTIMISM_MAINNET_PROTOCOL_NETWORK;
|
|
70
|
+
function createOptimismProtocolOptions(network) {
|
|
71
|
+
if (network === void 0) { network = {}; }
|
|
72
|
+
return {
|
|
73
|
+
network: __assign(__assign({}, DEFAULT_OPTIMISM_PROTOCOL_NETWORK), network)
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
exports.createOptimismProtocolOptions = createOptimismProtocolOptions;
|
|
77
|
+
//# sourceMappingURL=OptimismProtocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OptimismProtocol.js","sourceRoot":"","sources":["../../../src/v1/protocol/OptimismProtocol.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAA0D;AAC1D,0CAA6G;AAS7G,iBAAiB;AAEjB;IAAmC,wCAAgC;IACjE,8BAAmB,OAAkD;QACnE,IAAM,eAAe,GAAG,6BAA6B,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;QAEtE,IAAM,UAAU,GAAG,IAAI,qBAAgB,CAAC,eAAe,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QACvE,IAAM,UAAU,GAAG,IAAI,wBAAmB,CAAC,eAAe,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAA;eAEpF,kBAAM,UAAU,EAAE,UAAU,EAAE;YAC5B,OAAO,EAAE,eAAe,CAAC,OAAO;YAChC,eAAe,EAAE,eAAe,CAAC,OAAO,CAAC,eAAe;YAExD,IAAI,EAAE,UAAU;YAChB,UAAU,EAAE,kCAAmB,CAAC,QAAQ;YAExC,KAAK,EAAE;gBACL,EAAE,EAAE;oBACF,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE;oBACvB,QAAQ,EAAE,EAAE;iBACb;aACF;YACD,QAAQ,EAAE,IAAI;SACf,CAAC;IACJ,CAAC;IACH,2BAAC;AAAD,CAAC,AAvBD,CAAmC,sBAAiB,GAuBnD;AAED,UAAU;AAEV,SAAgB,sBAAsB,CAAC,OAAuD;IAAvD,wBAAA,EAAA,YAAuD;IAC5F,OAAO,IAAI,oBAAoB,CAAC,OAAO,CAAC,CAAA;AAC1C,CAAC;AAFD,wDAEC;AAEY,QAAA,iCAAiC,GAA4B;IACxE,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,SAAS;IACf,MAAM,EAAE,6BAA6B;IACrC,OAAO,EAAE,EAAE;IACX,eAAe,EAAE,4CAA4C;IAC7D,gBAAgB,EAAE,8BAA8B;CACjD,CAAA;AAED,IAAM,iCAAiC,GAA4B,yCAAiC,CAAA;AAEpG,SAAgB,6BAA6B,CAAC,OAA8C;IAA9C,wBAAA,EAAA,YAA8C;IAC1F,OAAO;QACL,OAAO,wBAAO,iCAAiC,GAAK,OAAO,CAAE;KAC9D,CAAA;AACH,CAAC;AAJD,sEAIC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { OptimismSignedTransaction, OptimismUnsignedTransaction } from '../../../../types/transaction';
|
|
2
|
+
import { OptimismTransactionSignRequest } from '../definitions/transaction-sign-request-optimism';
|
|
3
|
+
import { OptimismTypedTransactionSignRequest } from '../definitions/transaction-sign-request-optimism-typed';
|
|
4
|
+
import { OptimismTransactionSignResponse } from '../definitions/transaction-sign-response-optimism';
|
|
5
|
+
export declare function optimismUnsignedTransactionToRequest(unsigned: OptimismUnsignedTransaction, publicKey: string, callbackUrl?: string): OptimismTransactionSignRequest | OptimismTypedTransactionSignRequest;
|
|
6
|
+
export declare function optimismSignedTransactionToResponse(signed: OptimismSignedTransaction, accountIdentifier: string): OptimismTransactionSignResponse;
|
|
7
|
+
export declare function optimismTransactionSignRequestToUnsigned(request: OptimismTransactionSignRequest | OptimismTypedTransactionSignRequest): OptimismUnsignedTransaction;
|
|
8
|
+
export declare function optimismTransactionSignResponseToSigned(response: OptimismTransactionSignResponse): OptimismSignedTransaction;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.optimismTransactionSignResponseToSigned = exports.optimismTransactionSignRequestToUnsigned = exports.optimismSignedTransactionToResponse = exports.optimismUnsignedTransactionToRequest = void 0;
|
|
4
|
+
var v1_1 = require("@airgap/ethereum/v1");
|
|
5
|
+
function optimismUnsignedTransactionToRequest(unsigned, publicKey, callbackUrl) {
|
|
6
|
+
return (0, v1_1.ethereumUnsignedTransactionToRequest)(unsigned, publicKey, callbackUrl);
|
|
7
|
+
}
|
|
8
|
+
exports.optimismUnsignedTransactionToRequest = optimismUnsignedTransactionToRequest;
|
|
9
|
+
function optimismSignedTransactionToResponse(signed, accountIdentifier) {
|
|
10
|
+
return (0, v1_1.ethereumSignedTransactionToResponse)(signed, accountIdentifier);
|
|
11
|
+
}
|
|
12
|
+
exports.optimismSignedTransactionToResponse = optimismSignedTransactionToResponse;
|
|
13
|
+
function optimismTransactionSignRequestToUnsigned(request) {
|
|
14
|
+
return (0, v1_1.ethereumTransactionSignRequestToUnsigned)(request);
|
|
15
|
+
}
|
|
16
|
+
exports.optimismTransactionSignRequestToUnsigned = optimismTransactionSignRequestToUnsigned;
|
|
17
|
+
function optimismTransactionSignResponseToSigned(response) {
|
|
18
|
+
return (0, v1_1.ethereumTransactionSignResponseToSigned)(response);
|
|
19
|
+
}
|
|
20
|
+
exports.optimismTransactionSignResponseToSigned = optimismTransactionSignResponseToSigned;
|
|
21
|
+
//# sourceMappingURL=transaction-converter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction-converter.js","sourceRoot":"","sources":["../../../../../../src/v1/serializer/v3/schemas/converter/transaction-converter.ts"],"names":[],"mappings":";;;AAAA,0CAK4B;AAO5B,SAAgB,oCAAoC,CAClD,QAAqC,EACrC,SAAiB,EACjB,WAAoB;IAEpB,OAAO,IAAA,yCAAoC,EAAC,QAAQ,EAAE,SAAS,EAAE,WAAW,CAAC,CAAA;AAC/E,CAAC;AAND,oFAMC;AAED,SAAgB,mCAAmC,CACjD,MAAiC,EACjC,iBAAyB;IAEzB,OAAO,IAAA,wCAAmC,EAAC,MAAM,EAAE,iBAAiB,CAAC,CAAA;AACvE,CAAC;AALD,kFAKC;AAED,SAAgB,wCAAwC,CACtD,OAA6E;IAE7E,OAAO,IAAA,6CAAwC,EAAC,OAAO,CAAC,CAAA;AAC1D,CAAC;AAJD,4FAIC;AAED,SAAgB,uCAAuC,CAAC,QAAyC;IAC/F,OAAO,IAAA,4CAAuC,EAAC,QAAQ,CAAC,CAAA;AAC1D,CAAC;AAFD,0FAEC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction-sign-request-optimism-typed.js","sourceRoot":"","sources":["../../../../../../src/v1/serializer/v3/schemas/definitions/transaction-sign-request-optimism-typed.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction-sign-request-optimism.js","sourceRoot":"","sources":["../../../../../../src/v1/serializer/v3/schemas/definitions/transaction-sign-request-optimism.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction-sign-response-optimism.js","sourceRoot":"","sources":["../../../../../../src/v1/serializer/v3/schemas/definitions/transaction-sign-response-optimism.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$ref": "#/definitions/OptimismTypedTransactionSignRequest",
|
|
3
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
|
+
"definitions": {
|
|
5
|
+
"HexString": {
|
|
6
|
+
"type": "string"
|
|
7
|
+
},
|
|
8
|
+
"OptimismTypedTransactionSignRequest": {
|
|
9
|
+
"additionalProperties": false,
|
|
10
|
+
"properties": {
|
|
11
|
+
"callbackURL": {
|
|
12
|
+
"type": "string"
|
|
13
|
+
},
|
|
14
|
+
"publicKey": {
|
|
15
|
+
"type": "string"
|
|
16
|
+
},
|
|
17
|
+
"transaction": {
|
|
18
|
+
"$ref": "#/definitions/SerializableEthereumTypedUnsignedTransaction"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"required": ["publicKey", "transaction"],
|
|
22
|
+
"type": "object"
|
|
23
|
+
},
|
|
24
|
+
"SerializableEthereumTypedUnsignedTransaction": {
|
|
25
|
+
"additionalProperties": false,
|
|
26
|
+
"properties": {
|
|
27
|
+
"derivationPath": {
|
|
28
|
+
"type": "string"
|
|
29
|
+
},
|
|
30
|
+
"masterFingerprint": {
|
|
31
|
+
"type": "string"
|
|
32
|
+
},
|
|
33
|
+
"serialized": {
|
|
34
|
+
"$ref": "#/definitions/HexString",
|
|
35
|
+
"type": "string"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"required": ["derivationPath", "masterFingerprint", "serialized"],
|
|
39
|
+
"type": "object"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$ref": "#/definitions/OptimismTransactionSignRequest",
|
|
3
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
|
+
"definitions": {
|
|
5
|
+
"HexString": {
|
|
6
|
+
"type": "string"
|
|
7
|
+
},
|
|
8
|
+
"OptimismTransactionSignRequest": {
|
|
9
|
+
"additionalProperties": false,
|
|
10
|
+
"properties": {
|
|
11
|
+
"callbackURL": {
|
|
12
|
+
"type": "string"
|
|
13
|
+
},
|
|
14
|
+
"publicKey": {
|
|
15
|
+
"type": "string"
|
|
16
|
+
},
|
|
17
|
+
"transaction": {
|
|
18
|
+
"$ref": "#/definitions/SerializableEthereumRawUnsignedTransaction"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"required": ["publicKey", "transaction"],
|
|
22
|
+
"type": "object"
|
|
23
|
+
},
|
|
24
|
+
"SerializableEthereumRawUnsignedTransaction": {
|
|
25
|
+
"additionalProperties": false,
|
|
26
|
+
"properties": {
|
|
27
|
+
"chainId": {
|
|
28
|
+
"type": "number"
|
|
29
|
+
},
|
|
30
|
+
"data": {
|
|
31
|
+
"$ref": "#/definitions/HexString",
|
|
32
|
+
"type": "string"
|
|
33
|
+
},
|
|
34
|
+
"gasLimit": {
|
|
35
|
+
"$ref": "#/definitions/HexString",
|
|
36
|
+
"type": "string"
|
|
37
|
+
},
|
|
38
|
+
"gasPrice": {
|
|
39
|
+
"$ref": "#/definitions/HexString",
|
|
40
|
+
"type": "string"
|
|
41
|
+
},
|
|
42
|
+
"nonce": {
|
|
43
|
+
"$ref": "#/definitions/HexString",
|
|
44
|
+
"type": "string"
|
|
45
|
+
},
|
|
46
|
+
"to": {
|
|
47
|
+
"$ref": "#/definitions/HexString",
|
|
48
|
+
"type": "string"
|
|
49
|
+
},
|
|
50
|
+
"value": {
|
|
51
|
+
"$ref": "#/definitions/HexString",
|
|
52
|
+
"type": "string"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"required": ["chainId", "data", "gasLimit", "gasPrice", "nonce", "to", "value"],
|
|
56
|
+
"type": "object"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$ref": "#/definitions/OptimismTransactionSignResponse",
|
|
3
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
|
+
"definitions": {
|
|
5
|
+
"OptimismTransactionSignResponse": {
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"properties": {
|
|
8
|
+
"accountIdentifier": {
|
|
9
|
+
"type": "string"
|
|
10
|
+
},
|
|
11
|
+
"transaction": {
|
|
12
|
+
"type": "string"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"required": ["accountIdentifier", "transaction"],
|
|
16
|
+
"type": "object"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AirGapV3SerializerCompanion, SignedTransaction, UnsignedTransaction } from '@airgap/module-kit';
|
|
2
|
+
import { V3SchemaConfiguration } from '@airgap/module-kit/types/serializer';
|
|
3
|
+
import { TransactionSignRequest, TransactionSignResponse } from '@airgap/serializer';
|
|
4
|
+
export declare class EthereumV3SerializerCompanion implements AirGapV3SerializerCompanion {
|
|
5
|
+
readonly schemas: V3SchemaConfiguration[];
|
|
6
|
+
private readonly ethereumTransactionValidator;
|
|
7
|
+
toTransactionSignRequest(identifier: string, unsignedTransaction: UnsignedTransaction, publicKey: string, callbackUrl?: string): Promise<TransactionSignRequest>;
|
|
8
|
+
fromTransactionSignRequest(identifier: string, transactionSignRequest: TransactionSignRequest): Promise<UnsignedTransaction>;
|
|
9
|
+
validateTransactionSignRequest(identifier: string, transactionSignRequest: TransactionSignRequest): Promise<boolean>;
|
|
10
|
+
toTransactionSignResponse(identifier: string, signedTransaction: SignedTransaction, accountIdentifier: string): Promise<TransactionSignResponse>;
|
|
11
|
+
fromTransactionSignResponse(identifier: string, transactionSignResponse: TransactionSignResponse): Promise<SignedTransaction>;
|
|
12
|
+
validateTransactionSignResponse(identifier: string, transactionSignResponse: TransactionSignResponse): Promise<boolean>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,190 @@
|
|
|
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.EthereumV3SerializerCompanion = void 0;
|
|
40
|
+
var coinlib_core_1 = require("@airgap/coinlib-core");
|
|
41
|
+
var errors_1 = require("@airgap/coinlib-core/errors");
|
|
42
|
+
var serializer_1 = require("@airgap/serializer");
|
|
43
|
+
var transaction_converter_1 = require("./schemas/converter/transaction-converter");
|
|
44
|
+
var transaction_validator_1 = require("./validators/transaction-validator");
|
|
45
|
+
var ethereumTransactionSignRequest = require('./schemas/generated/transaction-sign-request-optimism.json');
|
|
46
|
+
var ethereumTypedTransactionSignRequest = require('./schemas/generated/transaction-sign-request-optimism-typed.json');
|
|
47
|
+
var ethereumTransactionSignResponse = require('./schemas/generated/transaction-sign-response-optimism.json');
|
|
48
|
+
var EthereumV3SerializerCompanion = /** @class */ (function () {
|
|
49
|
+
function EthereumV3SerializerCompanion() {
|
|
50
|
+
this.schemas = [
|
|
51
|
+
{
|
|
52
|
+
type: serializer_1.IACMessageType.TransactionSignRequest,
|
|
53
|
+
schema: { schema: ethereumTransactionSignRequest },
|
|
54
|
+
protocolIdentifier: coinlib_core_1.MainProtocolSymbols.OPTIMISM
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
type: serializer_1.IACMessageType.TransactionSignRequest,
|
|
58
|
+
schema: { schema: ethereumTypedTransactionSignRequest },
|
|
59
|
+
protocolIdentifier: coinlib_core_1.MainProtocolSymbols.OPTIMISM
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
type: serializer_1.IACMessageType.TransactionSignResponse,
|
|
63
|
+
schema: { schema: ethereumTransactionSignResponse },
|
|
64
|
+
protocolIdentifier: coinlib_core_1.MainProtocolSymbols.OPTIMISM
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
type: serializer_1.IACMessageType.TransactionSignRequest,
|
|
68
|
+
schema: { schema: ethereumTransactionSignRequest },
|
|
69
|
+
protocolIdentifier: coinlib_core_1.SubProtocolSymbols.OPTIMISM_ERC20
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
type: serializer_1.IACMessageType.TransactionSignResponse,
|
|
73
|
+
schema: { schema: ethereumTransactionSignResponse },
|
|
74
|
+
protocolIdentifier: coinlib_core_1.SubProtocolSymbols.OPTIMISM_ERC20
|
|
75
|
+
}
|
|
76
|
+
];
|
|
77
|
+
this.ethereumTransactionValidator = new transaction_validator_1.OptimismTransactionValidator();
|
|
78
|
+
}
|
|
79
|
+
EthereumV3SerializerCompanion.prototype.toTransactionSignRequest = function (identifier, unsignedTransaction, publicKey, callbackUrl) {
|
|
80
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
81
|
+
return __generator(this, function (_a) {
|
|
82
|
+
switch (identifier) {
|
|
83
|
+
case coinlib_core_1.MainProtocolSymbols.OPTIMISM:
|
|
84
|
+
case coinlib_core_1.SubProtocolSymbols.OPTIMISM_ERC20:
|
|
85
|
+
return [2 /*return*/, (0, transaction_converter_1.optimismUnsignedTransactionToRequest)(unsignedTransaction, publicKey, callbackUrl)];
|
|
86
|
+
default:
|
|
87
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.OPTIMISM, "Protocol ".concat(identifier, " not supported"));
|
|
88
|
+
}
|
|
89
|
+
return [2 /*return*/];
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
EthereumV3SerializerCompanion.prototype.fromTransactionSignRequest = function (identifier, transactionSignRequest) {
|
|
94
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
95
|
+
return __generator(this, function (_a) {
|
|
96
|
+
switch (identifier) {
|
|
97
|
+
case coinlib_core_1.MainProtocolSymbols.OPTIMISM:
|
|
98
|
+
case coinlib_core_1.SubProtocolSymbols.OPTIMISM_ERC20:
|
|
99
|
+
return [2 /*return*/, (0, transaction_converter_1.optimismTransactionSignRequestToUnsigned)(transactionSignRequest)];
|
|
100
|
+
default:
|
|
101
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.OPTIMISM, "Protocol ".concat(identifier, " not supported"));
|
|
102
|
+
}
|
|
103
|
+
return [2 /*return*/];
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
EthereumV3SerializerCompanion.prototype.validateTransactionSignRequest = function (identifier, transactionSignRequest) {
|
|
108
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
109
|
+
var _a, _b;
|
|
110
|
+
return __generator(this, function (_c) {
|
|
111
|
+
switch (_c.label) {
|
|
112
|
+
case 0:
|
|
113
|
+
_a = identifier;
|
|
114
|
+
switch (_a) {
|
|
115
|
+
case coinlib_core_1.MainProtocolSymbols.OPTIMISM: return [3 /*break*/, 1];
|
|
116
|
+
case coinlib_core_1.SubProtocolSymbols.OPTIMISM_ERC20: return [3 /*break*/, 1];
|
|
117
|
+
}
|
|
118
|
+
return [3 /*break*/, 4];
|
|
119
|
+
case 1:
|
|
120
|
+
_c.trys.push([1, 3, , 4]);
|
|
121
|
+
return [4 /*yield*/, this.ethereumTransactionValidator.validateUnsignedTransaction(transactionSignRequest)];
|
|
122
|
+
case 2:
|
|
123
|
+
_c.sent();
|
|
124
|
+
return [2 /*return*/, true];
|
|
125
|
+
case 3:
|
|
126
|
+
_b = _c.sent();
|
|
127
|
+
return [2 /*return*/, false];
|
|
128
|
+
case 4: throw new errors_1.UnsupportedError(coinlib_core_1.Domain.OPTIMISM, "Protocol ".concat(identifier, " not supported"));
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
};
|
|
133
|
+
EthereumV3SerializerCompanion.prototype.toTransactionSignResponse = function (identifier, signedTransaction, accountIdentifier) {
|
|
134
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
135
|
+
return __generator(this, function (_a) {
|
|
136
|
+
switch (identifier) {
|
|
137
|
+
case coinlib_core_1.MainProtocolSymbols.OPTIMISM:
|
|
138
|
+
case coinlib_core_1.SubProtocolSymbols.OPTIMISM_ERC20:
|
|
139
|
+
return [2 /*return*/, (0, transaction_converter_1.optimismSignedTransactionToResponse)(signedTransaction, accountIdentifier)];
|
|
140
|
+
default:
|
|
141
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.OPTIMISM, "Protocol ".concat(identifier, " not supported"));
|
|
142
|
+
}
|
|
143
|
+
return [2 /*return*/];
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
};
|
|
147
|
+
EthereumV3SerializerCompanion.prototype.fromTransactionSignResponse = function (identifier, transactionSignResponse) {
|
|
148
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
149
|
+
return __generator(this, function (_a) {
|
|
150
|
+
switch (identifier) {
|
|
151
|
+
case coinlib_core_1.MainProtocolSymbols.OPTIMISM:
|
|
152
|
+
case coinlib_core_1.SubProtocolSymbols.OPTIMISM_ERC20:
|
|
153
|
+
return [2 /*return*/, (0, transaction_converter_1.optimismTransactionSignResponseToSigned)(transactionSignResponse)];
|
|
154
|
+
default:
|
|
155
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.OPTIMISM, "Protocol ".concat(identifier, " not supported"));
|
|
156
|
+
}
|
|
157
|
+
return [2 /*return*/];
|
|
158
|
+
});
|
|
159
|
+
});
|
|
160
|
+
};
|
|
161
|
+
EthereumV3SerializerCompanion.prototype.validateTransactionSignResponse = function (identifier, transactionSignResponse) {
|
|
162
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
163
|
+
var _a, _b;
|
|
164
|
+
return __generator(this, function (_c) {
|
|
165
|
+
switch (_c.label) {
|
|
166
|
+
case 0:
|
|
167
|
+
_a = identifier;
|
|
168
|
+
switch (_a) {
|
|
169
|
+
case coinlib_core_1.MainProtocolSymbols.OPTIMISM: return [3 /*break*/, 1];
|
|
170
|
+
case coinlib_core_1.SubProtocolSymbols.OPTIMISM_ERC20: return [3 /*break*/, 1];
|
|
171
|
+
}
|
|
172
|
+
return [3 /*break*/, 4];
|
|
173
|
+
case 1:
|
|
174
|
+
_c.trys.push([1, 3, , 4]);
|
|
175
|
+
return [4 /*yield*/, this.ethereumTransactionValidator.validateSignedTransaction(transactionSignResponse)];
|
|
176
|
+
case 2:
|
|
177
|
+
_c.sent();
|
|
178
|
+
return [2 /*return*/, true];
|
|
179
|
+
case 3:
|
|
180
|
+
_b = _c.sent();
|
|
181
|
+
return [2 /*return*/, false];
|
|
182
|
+
case 4: throw new errors_1.UnsupportedError(coinlib_core_1.Domain.OPTIMISM, "Protocol ".concat(identifier, " not supported"));
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
});
|
|
186
|
+
};
|
|
187
|
+
return EthereumV3SerializerCompanion;
|
|
188
|
+
}());
|
|
189
|
+
exports.EthereumV3SerializerCompanion = EthereumV3SerializerCompanion;
|
|
190
|
+
//# sourceMappingURL=serializer-companion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serializer-companion.js","sourceRoot":"","sources":["../../../../src/v1/serializer/v3/serializer-companion.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,29 @@
|
|
|
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.OptimismTransactionValidator = void 0;
|
|
19
|
+
// tslint:disable: max-classes-per-file
|
|
20
|
+
var v1_1 = require("@airgap/ethereum/v1");
|
|
21
|
+
var OptimismTransactionValidator = /** @class */ (function (_super) {
|
|
22
|
+
__extends(OptimismTransactionValidator, _super);
|
|
23
|
+
function OptimismTransactionValidator() {
|
|
24
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
25
|
+
}
|
|
26
|
+
return OptimismTransactionValidator;
|
|
27
|
+
}(v1_1.EthereumTransactionValidator));
|
|
28
|
+
exports.OptimismTransactionValidator = OptimismTransactionValidator;
|
|
29
|
+
//# sourceMappingURL=transaction-validator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction-validator.js","sourceRoot":"","sources":["../../../../../src/v1/serializer/v3/validators/transaction-validator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,uCAAuC;AACvC,0CAAkE;AAGlE;IAAkD,gDAA4B;IAA9E;;IAAgH,CAAC;IAAD,mCAAC;AAAD,CAAC,AAAjH,CAAkD,iCAA4B,GAAmC;AAApG,oEAA4B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { EthereumProtocolNetwork, EthereumProtocolOptions } from '@airgap/ethereum/v1';
|
|
2
|
+
export declare type OptimismUnits = 'OP';
|
|
3
|
+
export interface OptimismProtocolNetwork extends EthereumProtocolNetwork {
|
|
4
|
+
contractAddress: string;
|
|
5
|
+
}
|
|
6
|
+
export interface OptimismProtocolOptions extends EthereumProtocolOptions {
|
|
7
|
+
network: OptimismProtocolNetwork;
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../../src/v1/types/protocol.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../../src/v1/types/transaction.ts"],"names":[],"mappings":""}
|