@airgap/optimism 0.13.45-beta.3 → 0.13.45-beta.4

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.
@@ -1,15 +1,62 @@
1
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
+ };
2
49
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
50
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
51
  };
5
52
  Object.defineProperty(exports, "__esModule", { value: true });
6
53
  exports.OptimismBaseProtocolImpl = void 0;
7
- const bignumber_1 = __importDefault(require("@airgap/coinlib-core/dependencies/src/bignumber.js-9.0.0/bignumber"));
8
- const v1_1 = require("@airgap/ethereum/v1");
9
- const module_kit_1 = require("@airgap/module-kit");
54
+ var bignumber_1 = __importDefault(require("@airgap/coinlib-core/dependencies/src/bignumber.js-9.0.0/bignumber"));
55
+ var v1_1 = require("@airgap/ethereum/v1");
56
+ var module_kit_1 = require("@airgap/module-kit");
10
57
  // Implementation
11
- class OptimismBaseProtocolImpl {
12
- constructor(ethereumProtocol, nodeClient, infoClient, options) {
58
+ var OptimismBaseProtocolImpl = /** @class */ (function () {
59
+ function OptimismBaseProtocolImpl(ethereumProtocol, nodeClient, infoClient, options) {
13
60
  this.ethereumProtocol = ethereumProtocol;
14
61
  this.nodeClient = nodeClient;
15
62
  this.infoClient = infoClient;
@@ -17,159 +64,310 @@ class OptimismBaseProtocolImpl {
17
64
  this.units = this.ethereumProtocol.units;
18
65
  this.feeUnits = this.ethereumProtocol.feeUnits;
19
66
  }
20
- async getMetadata() {
21
- return this.ethereumProtocol.getMetadata();
22
- }
23
- async getAddressFromPublicKey(publicKey) {
24
- return this.ethereumProtocol.getAddressFromPublicKey(publicKey);
25
- }
26
- async deriveFromExtendedPublicKey(extendedPublicKey, visibilityIndex, addressIndex) {
27
- return this.ethereumProtocol.deriveFromExtendedPublicKey(extendedPublicKey, visibilityIndex, addressIndex);
28
- }
29
- async getDetailsFromTransaction(transaction, publicKey) {
30
- const ethereumDetails = await this.ethereumProtocol.getDetailsFromTransaction(transaction, publicKey);
31
- const l1DataFee = transaction.type === 'signed' ? transaction.l1DataFee : transaction.ethereumType === 'raw' ? transaction.l1DataFee : undefined;
32
- if (l1DataFee === undefined) {
33
- return ethereumDetails;
34
- }
35
- const l1DataFeePerTransaction = new bignumber_1.default(l1DataFee).div(ethereumDetails.length);
36
- return ethereumDetails.map((details) => {
37
- const feeBlockchain = (0, module_kit_1.newAmount)(details.fee).blockchain(this.feeUnits);
38
- return {
39
- ...details,
40
- fee: (0, module_kit_1.newAmount)(l1DataFeePerTransaction.plus(feeBlockchain.value), 'blockchain')
41
- };
67
+ OptimismBaseProtocolImpl.prototype.getMetadata = function () {
68
+ return __awaiter(this, void 0, void 0, function () {
69
+ return __generator(this, function (_a) {
70
+ return [2 /*return*/, this.ethereumProtocol.getMetadata()];
71
+ });
42
72
  });
43
- }
44
- async verifyMessageWithPublicKey(message, signature, publicKey) {
45
- return this.ethereumProtocol.verifyMessageWithPublicKey(message, signature, publicKey);
46
- }
47
- async encryptAsymmetricWithPublicKey(payload, publicKey) {
48
- return this.ethereumProtocol.encryptAsymmetricWithPublicKey(payload, publicKey);
49
- }
73
+ };
74
+ OptimismBaseProtocolImpl.prototype.getAddressFromPublicKey = function (publicKey) {
75
+ return __awaiter(this, void 0, void 0, function () {
76
+ return __generator(this, function (_a) {
77
+ return [2 /*return*/, this.ethereumProtocol.getAddressFromPublicKey(publicKey)];
78
+ });
79
+ });
80
+ };
81
+ OptimismBaseProtocolImpl.prototype.deriveFromExtendedPublicKey = function (extendedPublicKey, visibilityIndex, addressIndex) {
82
+ return __awaiter(this, void 0, void 0, function () {
83
+ return __generator(this, function (_a) {
84
+ return [2 /*return*/, this.ethereumProtocol.deriveFromExtendedPublicKey(extendedPublicKey, visibilityIndex, addressIndex)];
85
+ });
86
+ });
87
+ };
88
+ OptimismBaseProtocolImpl.prototype.getDetailsFromTransaction = function (transaction, publicKey) {
89
+ return __awaiter(this, void 0, void 0, function () {
90
+ var ethereumDetails, l1DataFee, l1DataFeePerTransaction;
91
+ var _this = this;
92
+ return __generator(this, function (_a) {
93
+ switch (_a.label) {
94
+ case 0: return [4 /*yield*/, this.ethereumProtocol.getDetailsFromTransaction(transaction, publicKey)];
95
+ case 1:
96
+ ethereumDetails = _a.sent();
97
+ l1DataFee = transaction.type === 'signed' ? transaction.l1DataFee : transaction.ethereumType === 'raw' ? transaction.l1DataFee : undefined;
98
+ if (l1DataFee === undefined) {
99
+ return [2 /*return*/, ethereumDetails];
100
+ }
101
+ l1DataFeePerTransaction = new bignumber_1.default(l1DataFee).div(ethereumDetails.length);
102
+ return [2 /*return*/, ethereumDetails.map(function (details) {
103
+ var feeBlockchain = (0, module_kit_1.newAmount)(details.fee).blockchain(_this.feeUnits);
104
+ return __assign(__assign({}, details), { fee: (0, module_kit_1.newAmount)(l1DataFeePerTransaction.plus(feeBlockchain.value), 'blockchain') });
105
+ })];
106
+ }
107
+ });
108
+ });
109
+ };
110
+ OptimismBaseProtocolImpl.prototype.verifyMessageWithPublicKey = function (message, signature, publicKey) {
111
+ return __awaiter(this, void 0, void 0, function () {
112
+ return __generator(this, function (_a) {
113
+ return [2 /*return*/, this.ethereumProtocol.verifyMessageWithPublicKey(message, signature, publicKey)];
114
+ });
115
+ });
116
+ };
117
+ OptimismBaseProtocolImpl.prototype.encryptAsymmetricWithPublicKey = function (payload, publicKey) {
118
+ return __awaiter(this, void 0, void 0, function () {
119
+ return __generator(this, function (_a) {
120
+ return [2 /*return*/, this.ethereumProtocol.encryptAsymmetricWithPublicKey(payload, publicKey)];
121
+ });
122
+ });
123
+ };
50
124
  // Offline
51
- async getCryptoConfiguration() {
52
- return this.ethereumProtocol.getCryptoConfiguration();
53
- }
54
- async getKeyPairFromDerivative(derivative) {
55
- return this.ethereumProtocol.getKeyPairFromDerivative(derivative);
56
- }
57
- async getExtendedKeyPairFromDerivative(derivative) {
58
- return this.ethereumProtocol.getExtendedKeyPairFromDerivative(derivative);
59
- }
60
- async deriveFromExtendedSecretKey(extendedSecretKey, visibilityIndex, addressIndex) {
61
- return this.ethereumProtocol.deriveFromExtendedSecretKey(extendedSecretKey, visibilityIndex, addressIndex);
62
- }
63
- async signTransactionWithSecretKey(transaction, secretKey) {
64
- const ethereumTransaction = await this.ethereumProtocol.signTransactionWithSecretKey(transaction, secretKey);
65
- return transaction.ethereumType === 'raw'
66
- ? (0, module_kit_1.newSignedTransaction)({
67
- ...ethereumTransaction,
68
- l1DataFee: transaction.l1DataFee
69
- })
70
- : ethereumTransaction;
71
- }
72
- async signMessageWithKeyPair(message, keyPair) {
73
- return this.ethereumProtocol.signMessageWithKeyPair(message, keyPair);
74
- }
75
- async decryptAsymmetricWithKeyPair(payload, keyPair) {
76
- return this.ethereumProtocol.decryptAsymmetricWithKeyPair(payload, keyPair);
77
- }
78
- async encryptAESWithSecretKey(payload, secretKey) {
79
- return this.ethereumProtocol.encryptAESWithSecretKey(payload, secretKey);
80
- }
81
- async decryptAESWithSecretKey(payload, secretKey) {
82
- return this.ethereumProtocol.decryptAESWithSecretKey(payload, secretKey);
83
- }
125
+ OptimismBaseProtocolImpl.prototype.getCryptoConfiguration = function () {
126
+ return __awaiter(this, void 0, void 0, function () {
127
+ return __generator(this, function (_a) {
128
+ return [2 /*return*/, this.ethereumProtocol.getCryptoConfiguration()];
129
+ });
130
+ });
131
+ };
132
+ OptimismBaseProtocolImpl.prototype.getKeyPairFromDerivative = function (derivative) {
133
+ return __awaiter(this, void 0, void 0, function () {
134
+ return __generator(this, function (_a) {
135
+ return [2 /*return*/, this.ethereumProtocol.getKeyPairFromDerivative(derivative)];
136
+ });
137
+ });
138
+ };
139
+ OptimismBaseProtocolImpl.prototype.getExtendedKeyPairFromDerivative = function (derivative) {
140
+ return __awaiter(this, void 0, void 0, function () {
141
+ return __generator(this, function (_a) {
142
+ return [2 /*return*/, this.ethereumProtocol.getExtendedKeyPairFromDerivative(derivative)];
143
+ });
144
+ });
145
+ };
146
+ OptimismBaseProtocolImpl.prototype.deriveFromExtendedSecretKey = function (extendedSecretKey, visibilityIndex, addressIndex) {
147
+ return __awaiter(this, void 0, void 0, function () {
148
+ return __generator(this, function (_a) {
149
+ return [2 /*return*/, this.ethereumProtocol.deriveFromExtendedSecretKey(extendedSecretKey, visibilityIndex, addressIndex)];
150
+ });
151
+ });
152
+ };
153
+ OptimismBaseProtocolImpl.prototype.signTransactionWithSecretKey = function (transaction, secretKey) {
154
+ return __awaiter(this, void 0, void 0, function () {
155
+ var ethereumTransaction;
156
+ return __generator(this, function (_a) {
157
+ switch (_a.label) {
158
+ case 0: return [4 /*yield*/, this.ethereumProtocol.signTransactionWithSecretKey(transaction, secretKey)];
159
+ case 1:
160
+ ethereumTransaction = _a.sent();
161
+ return [2 /*return*/, transaction.ethereumType === 'raw'
162
+ ? (0, module_kit_1.newSignedTransaction)(__assign(__assign({}, ethereumTransaction), { l1DataFee: transaction.l1DataFee }))
163
+ : ethereumTransaction];
164
+ }
165
+ });
166
+ });
167
+ };
168
+ OptimismBaseProtocolImpl.prototype.signMessageWithKeyPair = function (message, keyPair) {
169
+ return __awaiter(this, void 0, void 0, function () {
170
+ return __generator(this, function (_a) {
171
+ return [2 /*return*/, this.ethereumProtocol.signMessageWithKeyPair(message, keyPair)];
172
+ });
173
+ });
174
+ };
175
+ OptimismBaseProtocolImpl.prototype.decryptAsymmetricWithKeyPair = function (payload, keyPair) {
176
+ return __awaiter(this, void 0, void 0, function () {
177
+ return __generator(this, function (_a) {
178
+ return [2 /*return*/, this.ethereumProtocol.decryptAsymmetricWithKeyPair(payload, keyPair)];
179
+ });
180
+ });
181
+ };
182
+ OptimismBaseProtocolImpl.prototype.encryptAESWithSecretKey = function (payload, secretKey) {
183
+ return __awaiter(this, void 0, void 0, function () {
184
+ return __generator(this, function (_a) {
185
+ return [2 /*return*/, this.ethereumProtocol.encryptAESWithSecretKey(payload, secretKey)];
186
+ });
187
+ });
188
+ };
189
+ OptimismBaseProtocolImpl.prototype.decryptAESWithSecretKey = function (payload, secretKey) {
190
+ return __awaiter(this, void 0, void 0, function () {
191
+ return __generator(this, function (_a) {
192
+ return [2 /*return*/, this.ethereumProtocol.decryptAESWithSecretKey(payload, secretKey)];
193
+ });
194
+ });
195
+ };
84
196
  // Online
85
- async getNetwork() {
86
- return this.ethereumProtocol.getNetwork();
87
- }
88
- async getTransactionsForPublicKey(publicKey, limit, cursor) {
89
- return this.ethereumProtocol.getTransactionsForPublicKey(publicKey, limit, cursor);
90
- }
91
- async getTransactionsForAddress(address, limit, cursor) {
92
- return this.ethereumProtocol.getTransactionsForAddress(address, limit, cursor);
93
- }
94
- async getTransactionsForAddresses(addresses, limit, cursor) {
95
- return this.ethereumProtocol.getTransactionsForAddresses(addresses, limit, cursor);
96
- }
97
- async getTransactionStatus(transactionIds) {
98
- return this.ethereumProtocol.getTransactionStatus(transactionIds);
99
- }
100
- async getBalanceOfPublicKey(publicKey) {
101
- return this.ethereumProtocol.getBalanceOfPublicKey(publicKey);
102
- }
103
- async getBalanceOfAddress(address) {
104
- return this.ethereumProtocol.getBalanceOfAddress(address);
105
- }
106
- async getBalanceOfAddresses(addresses) {
107
- return this.ethereumProtocol.getBalanceOfAddresses(addresses);
108
- }
109
- async getTokenBalancesOfPublicKey(publicKey, tokens) {
110
- return this.ethereumProtocol.getTokenBalancesOfPublicKey(publicKey, tokens);
111
- }
112
- async getTransactionMaxAmountWithPublicKey(publicKey, to, configuration) {
113
- const [metadata, ethereumMaxAmount] = await Promise.all([
114
- this.getMetadata(),
115
- this.ethereumProtocol.getTransactionMaxAmountWithPublicKey(publicKey, to, configuration)
116
- ]);
117
- const maxAmountBlockchain = new bignumber_1.default((0, module_kit_1.newAmount)(ethereumMaxAmount).blockchain(metadata.units).value);
118
- const maxAmountPerRecipient = maxAmountBlockchain.div(to.length);
119
- const ethereumTransaction = await this.ethereumProtocol.prepareTransactionWithPublicKey(publicKey, to.map((recipient) => ({
120
- to: recipient,
121
- amount: (0, module_kit_1.newAmount)(maxAmountPerRecipient, 'blockchain')
122
- })), configuration);
123
- const l1Fee = await this.nodeClient.getL1Fee(this.options.network.gasPriceOracleAddress, ethereumTransaction);
124
- if (maxAmountBlockchain.lte(l1Fee)) {
125
- return (0, module_kit_1.newAmount)(0, 'blockchain');
126
- }
127
- return (0, module_kit_1.newAmount)(maxAmountBlockchain.minus(l1Fee), 'blockchain');
128
- }
129
- async getTransactionFeeWithPublicKey(publicKey, details) {
130
- const l2Fee = await this.ethereumProtocol.getTransactionFeeWithPublicKey(publicKey, details);
131
- const ethereumTransaction = await this.ethereumProtocol.prepareTransactionWithPublicKey(publicKey, details, { fee: l2Fee.medium });
132
- const l1Fee = await this.nodeClient.getL1Fee(this.options.network.gasPriceOracleAddress, ethereumTransaction);
133
- return {
134
- low: (0, module_kit_1.newAmount)(l1Fee.plus((0, module_kit_1.newAmount)(l2Fee.low).blockchain(this.feeUnits).value), 'blockchain'),
135
- medium: (0, module_kit_1.newAmount)(l1Fee.plus((0, module_kit_1.newAmount)(l2Fee.medium).blockchain(this.feeUnits).value), 'blockchain'),
136
- high: (0, module_kit_1.newAmount)(l1Fee.plus((0, module_kit_1.newAmount)(l2Fee.high).blockchain(this.feeUnits).value), 'blockchain')
137
- };
138
- }
139
- async prepareTransactionWithPublicKey(publicKey, details, configuration) {
140
- const ethereumTransaction = await this.ethereumProtocol.prepareTransactionWithPublicKey(publicKey, details, configuration);
141
- if (ethereumTransaction.ethereumType === 'typed') {
142
- return ethereumTransaction;
143
- }
144
- const l1Gas = await this.nodeClient.getL1Fee(this.options.network.gasPriceOracleAddress, ethereumTransaction);
145
- const gasLimit = v1_1.EthereumUtils.hexToNumber(ethereumTransaction.gasLimit);
146
- const gasPrice = v1_1.EthereumUtils.hexToNumber(ethereumTransaction.gasPrice);
147
- const totalGas = gasPrice.times(gasLimit);
148
- const l2Gas = totalGas.minus(l1Gas).abs();
149
- const newGasPrice = l2Gas.div(gasLimit).integerValue(bignumber_1.default.ROUND_CEIL);
150
- return (0, module_kit_1.newUnsignedTransaction)({
151
- ...ethereumTransaction,
152
- gasPrice: v1_1.EthereumUtils.toHex(newGasPrice.toFixed()),
153
- l1DataFee: l1Gas.toFixed()
197
+ OptimismBaseProtocolImpl.prototype.getNetwork = function () {
198
+ return __awaiter(this, void 0, void 0, function () {
199
+ return __generator(this, function (_a) {
200
+ return [2 /*return*/, this.ethereumProtocol.getNetwork()];
201
+ });
154
202
  });
155
- }
156
- async getWalletConnectChain() {
157
- return this.ethereumProtocol.getWalletConnectChain();
158
- }
159
- async prepareWalletConnectTransactionWithPublicKey(publicKey, request) {
160
- const ethereumTransaction = await this.ethereumProtocol.prepareWalletConnectTransactionWithPublicKey(publicKey, request);
161
- if (ethereumTransaction.ethereumType === 'typed') {
162
- return ethereumTransaction;
163
- }
164
- const l1Gas = await this.nodeClient.getL1Fee(this.options.network.gasPriceOracleAddress, ethereumTransaction);
165
- return (0, module_kit_1.newUnsignedTransaction)({
166
- ...ethereumTransaction,
167
- l1DataFee: l1Gas.toFixed()
203
+ };
204
+ OptimismBaseProtocolImpl.prototype.getTransactionsForPublicKey = function (publicKey, limit, cursor) {
205
+ return __awaiter(this, void 0, void 0, function () {
206
+ return __generator(this, function (_a) {
207
+ return [2 /*return*/, this.ethereumProtocol.getTransactionsForPublicKey(publicKey, limit, cursor)];
208
+ });
168
209
  });
169
- }
170
- async broadcastTransaction(transaction) {
171
- return this.ethereumProtocol.broadcastTransaction(transaction);
172
- }
173
- }
210
+ };
211
+ OptimismBaseProtocolImpl.prototype.getTransactionsForAddress = function (address, limit, cursor) {
212
+ return __awaiter(this, void 0, void 0, function () {
213
+ return __generator(this, function (_a) {
214
+ return [2 /*return*/, this.ethereumProtocol.getTransactionsForAddress(address, limit, cursor)];
215
+ });
216
+ });
217
+ };
218
+ OptimismBaseProtocolImpl.prototype.getTransactionsForAddresses = function (addresses, limit, cursor) {
219
+ return __awaiter(this, void 0, void 0, function () {
220
+ return __generator(this, function (_a) {
221
+ return [2 /*return*/, this.ethereumProtocol.getTransactionsForAddresses(addresses, limit, cursor)];
222
+ });
223
+ });
224
+ };
225
+ OptimismBaseProtocolImpl.prototype.getTransactionStatus = function (transactionIds) {
226
+ return __awaiter(this, void 0, void 0, function () {
227
+ return __generator(this, function (_a) {
228
+ return [2 /*return*/, this.ethereumProtocol.getTransactionStatus(transactionIds)];
229
+ });
230
+ });
231
+ };
232
+ OptimismBaseProtocolImpl.prototype.getBalanceOfPublicKey = function (publicKey) {
233
+ return __awaiter(this, void 0, void 0, function () {
234
+ return __generator(this, function (_a) {
235
+ return [2 /*return*/, this.ethereumProtocol.getBalanceOfPublicKey(publicKey)];
236
+ });
237
+ });
238
+ };
239
+ OptimismBaseProtocolImpl.prototype.getBalanceOfAddress = function (address) {
240
+ return __awaiter(this, void 0, void 0, function () {
241
+ return __generator(this, function (_a) {
242
+ return [2 /*return*/, this.ethereumProtocol.getBalanceOfAddress(address)];
243
+ });
244
+ });
245
+ };
246
+ OptimismBaseProtocolImpl.prototype.getBalanceOfAddresses = function (addresses) {
247
+ return __awaiter(this, void 0, void 0, function () {
248
+ return __generator(this, function (_a) {
249
+ return [2 /*return*/, this.ethereumProtocol.getBalanceOfAddresses(addresses)];
250
+ });
251
+ });
252
+ };
253
+ OptimismBaseProtocolImpl.prototype.getTokenBalancesOfPublicKey = function (publicKey, tokens) {
254
+ return __awaiter(this, void 0, void 0, function () {
255
+ return __generator(this, function (_a) {
256
+ return [2 /*return*/, this.ethereumProtocol.getTokenBalancesOfPublicKey(publicKey, tokens)];
257
+ });
258
+ });
259
+ };
260
+ OptimismBaseProtocolImpl.prototype.getTransactionMaxAmountWithPublicKey = function (publicKey, to, configuration) {
261
+ return __awaiter(this, void 0, void 0, function () {
262
+ var _a, metadata, ethereumMaxAmount, maxAmountBlockchain, maxAmountPerRecipient, ethereumTransaction, l1Fee;
263
+ return __generator(this, function (_b) {
264
+ switch (_b.label) {
265
+ case 0: return [4 /*yield*/, Promise.all([
266
+ this.getMetadata(),
267
+ this.ethereumProtocol.getTransactionMaxAmountWithPublicKey(publicKey, to, configuration)
268
+ ])];
269
+ case 1:
270
+ _a = _b.sent(), metadata = _a[0], ethereumMaxAmount = _a[1];
271
+ maxAmountBlockchain = new bignumber_1.default((0, module_kit_1.newAmount)(ethereumMaxAmount).blockchain(metadata.units).value);
272
+ maxAmountPerRecipient = maxAmountBlockchain.div(to.length);
273
+ return [4 /*yield*/, this.ethereumProtocol.prepareTransactionWithPublicKey(publicKey, to.map(function (recipient) { return ({
274
+ to: recipient,
275
+ amount: (0, module_kit_1.newAmount)(maxAmountPerRecipient, 'blockchain')
276
+ }); }), configuration)];
277
+ case 2:
278
+ ethereumTransaction = _b.sent();
279
+ return [4 /*yield*/, this.nodeClient.getL1Fee(this.options.network.gasPriceOracleAddress, ethereumTransaction)];
280
+ case 3:
281
+ l1Fee = _b.sent();
282
+ if (maxAmountBlockchain.lte(l1Fee)) {
283
+ return [2 /*return*/, (0, module_kit_1.newAmount)(0, 'blockchain')];
284
+ }
285
+ return [2 /*return*/, (0, module_kit_1.newAmount)(maxAmountBlockchain.minus(l1Fee), 'blockchain')];
286
+ }
287
+ });
288
+ });
289
+ };
290
+ OptimismBaseProtocolImpl.prototype.getTransactionFeeWithPublicKey = function (publicKey, details) {
291
+ return __awaiter(this, void 0, void 0, function () {
292
+ var l2Fee, ethereumTransaction, l1Fee;
293
+ return __generator(this, function (_a) {
294
+ switch (_a.label) {
295
+ case 0: return [4 /*yield*/, this.ethereumProtocol.getTransactionFeeWithPublicKey(publicKey, details)];
296
+ case 1:
297
+ l2Fee = _a.sent();
298
+ return [4 /*yield*/, this.ethereumProtocol.prepareTransactionWithPublicKey(publicKey, details, { fee: l2Fee.medium })];
299
+ case 2:
300
+ ethereumTransaction = _a.sent();
301
+ return [4 /*yield*/, this.nodeClient.getL1Fee(this.options.network.gasPriceOracleAddress, ethereumTransaction)];
302
+ case 3:
303
+ l1Fee = _a.sent();
304
+ return [2 /*return*/, {
305
+ low: (0, module_kit_1.newAmount)(l1Fee.plus((0, module_kit_1.newAmount)(l2Fee.low).blockchain(this.feeUnits).value), 'blockchain'),
306
+ medium: (0, module_kit_1.newAmount)(l1Fee.plus((0, module_kit_1.newAmount)(l2Fee.medium).blockchain(this.feeUnits).value), 'blockchain'),
307
+ high: (0, module_kit_1.newAmount)(l1Fee.plus((0, module_kit_1.newAmount)(l2Fee.high).blockchain(this.feeUnits).value), 'blockchain')
308
+ }];
309
+ }
310
+ });
311
+ });
312
+ };
313
+ OptimismBaseProtocolImpl.prototype.prepareTransactionWithPublicKey = function (publicKey, details, configuration) {
314
+ return __awaiter(this, void 0, void 0, function () {
315
+ var ethereumTransaction, l1Gas, gasLimit, gasPrice, totalGas, l2Gas, newGasPrice;
316
+ return __generator(this, function (_a) {
317
+ switch (_a.label) {
318
+ case 0: return [4 /*yield*/, this.ethereumProtocol.prepareTransactionWithPublicKey(publicKey, details, configuration)];
319
+ case 1:
320
+ ethereumTransaction = _a.sent();
321
+ if (ethereumTransaction.ethereumType === 'typed') {
322
+ return [2 /*return*/, ethereumTransaction];
323
+ }
324
+ return [4 /*yield*/, this.nodeClient.getL1Fee(this.options.network.gasPriceOracleAddress, ethereumTransaction)];
325
+ case 2:
326
+ l1Gas = _a.sent();
327
+ gasLimit = v1_1.EthereumUtils.hexToNumber(ethereumTransaction.gasLimit);
328
+ gasPrice = v1_1.EthereumUtils.hexToNumber(ethereumTransaction.gasPrice);
329
+ totalGas = gasPrice.times(gasLimit);
330
+ l2Gas = totalGas.minus(l1Gas).abs();
331
+ newGasPrice = l2Gas.div(gasLimit).integerValue(bignumber_1.default.ROUND_CEIL);
332
+ return [2 /*return*/, (0, module_kit_1.newUnsignedTransaction)(__assign(__assign({}, ethereumTransaction), { gasPrice: v1_1.EthereumUtils.toHex(newGasPrice.toFixed()), l1DataFee: l1Gas.toFixed() }))];
333
+ }
334
+ });
335
+ });
336
+ };
337
+ OptimismBaseProtocolImpl.prototype.getWalletConnectChain = function () {
338
+ return __awaiter(this, void 0, void 0, function () {
339
+ return __generator(this, function (_a) {
340
+ return [2 /*return*/, this.ethereumProtocol.getWalletConnectChain()];
341
+ });
342
+ });
343
+ };
344
+ OptimismBaseProtocolImpl.prototype.prepareWalletConnectTransactionWithPublicKey = function (publicKey, request) {
345
+ return __awaiter(this, void 0, void 0, function () {
346
+ var ethereumTransaction, l1Gas;
347
+ return __generator(this, function (_a) {
348
+ switch (_a.label) {
349
+ case 0: return [4 /*yield*/, this.ethereumProtocol.prepareWalletConnectTransactionWithPublicKey(publicKey, request)];
350
+ case 1:
351
+ ethereumTransaction = _a.sent();
352
+ if (ethereumTransaction.ethereumType === 'typed') {
353
+ return [2 /*return*/, ethereumTransaction];
354
+ }
355
+ return [4 /*yield*/, this.nodeClient.getL1Fee(this.options.network.gasPriceOracleAddress, ethereumTransaction)];
356
+ case 2:
357
+ l1Gas = _a.sent();
358
+ return [2 /*return*/, (0, module_kit_1.newUnsignedTransaction)(__assign(__assign({}, ethereumTransaction), { l1DataFee: l1Gas.toFixed() }))];
359
+ }
360
+ });
361
+ });
362
+ };
363
+ OptimismBaseProtocolImpl.prototype.broadcastTransaction = function (transaction) {
364
+ return __awaiter(this, void 0, void 0, function () {
365
+ return __generator(this, function (_a) {
366
+ return [2 /*return*/, this.ethereumProtocol.broadcastTransaction(transaction)];
367
+ });
368
+ });
369
+ };
370
+ return OptimismBaseProtocolImpl;
371
+ }());
174
372
  exports.OptimismBaseProtocolImpl = OptimismBaseProtocolImpl;
175
373
  //# sourceMappingURL=OptimismBaseProtocol.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"OptimismBaseProtocol.js","sourceRoot":"","sources":["../../../src/v1/protocol/OptimismBaseProtocol.ts"],"names":[],"mappings":";;;;;;AAAA,mHAA0F;AAC1F,4CAA4F;AAC5F,mDA0B2B;AAqC3B,iBAAiB;AAEjB,MAAsB,wBAAwB;IAS5C,YACqB,gBAAmC,EACnC,UAA8B,EAC9B,UAA8B,EAC9B,OAAiB;QAHjB,qBAAgB,GAAhB,gBAAgB,CAAmB;QACnC,eAAU,GAAV,UAAU,CAAoB;QAC9B,eAAU,GAAV,UAAU,CAAoB;QAC9B,YAAO,GAAP,OAAO,CAAU;QAEpC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAA;QACxC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAA;IAChD,CAAC;IAOM,KAAK,CAAC,WAAW;QACtB,OAAO,IAAI,CAAC,gBAAgB,CAAC,WAAW,EAAE,CAAA;IAC5C,CAAC;IAEM,KAAK,CAAC,uBAAuB,CAAC,SAAwC;QAC3E,OAAO,IAAI,CAAC,gBAAgB,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAA;IACjE,CAAC;IAEM,KAAK,CAAC,2BAA2B,CACtC,iBAAoC,EACpC,eAAuB,EACvB,YAAoB;QAEpB,OAAO,IAAI,CAAC,gBAAgB,CAAC,2BAA2B,CAAC,iBAAiB,EAAE,eAAe,EAAE,YAAY,CAAC,CAAA;IAC5G,CAAC;IAEM,KAAK,CAAC,yBAAyB,CACpC,WAAoE,EACpE,SAAwC;QAExC,MAAM,eAAe,GAA+C,MAAM,IAAI,CAAC,gBAAgB,CAAC,yBAAyB,CACvH,WAAW,EACX,SAAS,CACV,CAAA;QAED,MAAM,SAAS,GACb,WAAW,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,SAAS,CAA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