@avail-project/ca-common 1.0.0-dev.4 → 1.0.1-beta1

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.
Files changed (36) hide show
  1. package/dist/cjs/data/chaindata.js +110 -28
  2. package/dist/cjs/index.js +3 -4
  3. package/dist/cjs/proto/client.js +48 -0
  4. package/dist/cjs/proto/definition.js +167 -448
  5. package/dist/cjs/proto/grpc.js +4 -9
  6. package/dist/cjs/rff/rff.js +0 -34
  7. package/dist/cjs/vaultcontracts/vaultcontracts.js +15 -11
  8. package/dist/cjs/xcs/autochoice.js +255 -0
  9. package/dist/esm/data/chaindata.js +110 -28
  10. package/dist/esm/index.js +12 -12
  11. package/dist/esm/proto/client.js +11 -0
  12. package/dist/esm/proto/definition.js +167 -448
  13. package/dist/esm/proto/grpc.js +4 -9
  14. package/dist/esm/rff/rff.js +0 -34
  15. package/dist/esm/vaultcontracts/vaultcontracts.js +15 -11
  16. package/dist/esm/xcs/autochoice.js +254 -0
  17. package/dist/types/index.d.ts +12 -12
  18. package/dist/types/proto/client.d.ts +2 -0
  19. package/dist/types/rff/rff.d.ts +0 -3
  20. package/dist/types/xcs/autochoice.d.ts +17 -0
  21. package/package.json +11 -10
  22. package/dist/cjs/fuelcontracts/ArcanaVault.js +0 -2407
  23. package/dist/cjs/fuelcontracts/ArcanaVaultFactory.js +0 -18
  24. package/dist/cjs/fuelcontracts/common.js +0 -3
  25. package/dist/cjs/fuelcontracts/index.js +0 -6
  26. package/dist/cjs/rff/fuel.js +0 -27
  27. package/dist/esm/fuelcontracts/ArcanaVault.js +0 -2402
  28. package/dist/esm/fuelcontracts/ArcanaVaultFactory.js +0 -14
  29. package/dist/esm/fuelcontracts/common.js +0 -2
  30. package/dist/esm/fuelcontracts/index.js +0 -3
  31. package/dist/esm/rff/fuel.js +0 -23
  32. package/dist/types/fuelcontracts/ArcanaVault.d.ts +0 -448
  33. package/dist/types/fuelcontracts/ArcanaVaultFactory.d.ts +0 -8
  34. package/dist/types/fuelcontracts/common.d.ts +0 -23
  35. package/dist/types/fuelcontracts/index.d.ts +0 -3
  36. package/dist/types/rff/fuel.d.ts +0 -4
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
3
3
  // versions:
4
- // protoc-gen-ts_proto v2.7.5
4
+ // protoc-gen-ts_proto v2.8.3
5
5
  // protoc v6.32.1
6
6
  // source: grpc.proto
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -263,19 +263,14 @@ class GrpcWebImpl {
263
263
  unary(methodDesc, _request, metadata) {
264
264
  const request = { ..._request, ...methodDesc.requestType };
265
265
  const maybeCombinedMetadata = metadata && this.options.metadata
266
- ? new browser_headers_1.BrowserHeaders({
267
- ...this.options?.metadata.headersMap,
268
- ...metadata?.headersMap,
269
- })
270
- : (metadata ?? this.options.metadata);
266
+ ? new browser_headers_1.BrowserHeaders({ ...this.options?.metadata.headersMap, ...metadata?.headersMap })
267
+ : metadata ?? this.options.metadata;
271
268
  return new Promise((resolve, reject) => {
272
269
  grpc_web_1.grpc.unary(methodDesc, {
273
270
  request,
274
271
  host: this.host,
275
272
  metadata: maybeCombinedMetadata ?? {},
276
- ...(this.options.transport !== undefined
277
- ? { transport: this.options.transport }
278
- : {}),
273
+ ...(this.options.transport !== undefined ? { transport: this.options.transport } : {}),
279
274
  debug: this.options.debug ?? false,
280
275
  onEnd: function (response) {
281
276
  if (response.status === grpc_web_1.grpc.Code.OK) {
@@ -2,13 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.OmniversalRFF = void 0;
4
4
  const viem_1 = require("viem");
5
- const fuels_1 = require("fuels");
6
5
  const data_1 = require("../data");
7
- const fuel_1 = require("./fuel");
8
6
  class OmniversalRFF {
9
7
  protobufRFF;
10
8
  evmRFF;
11
- fuelRFF;
12
9
  constructor(protobufRFF) {
13
10
  this.protobufRFF = protobufRFF;
14
11
  }
@@ -38,37 +35,6 @@ class OmniversalRFF {
38
35
  }
39
36
  return this.evmRFF;
40
37
  }
41
- asFuelRFF() {
42
- if (this.fuelRFF == null) {
43
- this.fuelRFF = {
44
- sources: this.protobufRFF.sources.map((s) => ({
45
- universe: (0, fuel_1.protobufUniverseToFuelUniverse)(s.universe),
46
- chain_id: new fuels_1.BN(s.chainID),
47
- asset_id: {
48
- bits: (0, data_1.ezPadTo32Hex)(s.contractAddress),
49
- },
50
- value: new fuels_1.BN(s.value),
51
- })),
52
- destination_chain_id: new fuels_1.BN(this.protobufRFF.destinationChainID),
53
- destination_universe: (0, fuel_1.protobufUniverseToFuelUniverse)(this.protobufRFF.destinationUniverse),
54
- destinations: this.protobufRFF.destinations.map((d) => ({
55
- asset_id: {
56
- bits: (0, data_1.ezPadTo32Hex)(d.contractAddress),
57
- },
58
- value: new fuels_1.BN(d.value),
59
- })),
60
- expiry: new fuels_1.BN(this.protobufRFF.expiry.toBytesBE()),
61
- nonce: new fuels_1.BN(this.protobufRFF.nonce),
62
- parties: this.protobufRFF.signatureData.map((sd) => ({
63
- universe: (0, fuel_1.protobufUniverseToFuelUniverse)(sd.universe),
64
- address: {
65
- bits: (0, data_1.ezPadTo32Hex)(sd.address),
66
- },
67
- })),
68
- };
69
- }
70
- return this.fuelRFF;
71
- }
72
38
  asProtobufRFF() {
73
39
  return this.protobufRFF;
74
40
  }
@@ -16,24 +16,28 @@ const dataSets = new Map([
16
16
  [
17
17
  Environment.FOLLY,
18
18
  [
19
+ [
20
+ new data_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 11155111),
21
+ "0xd579B76e3f51884c50eB8e8efdef5C593666B8fb",
22
+ ],
19
23
  [
20
24
  new data_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 421614),
21
- "0xEFF0C81eC6D7c2a3B924e98B65303DDaa3030a81",
25
+ "0x10B69f0E3c21C1187526940A615959E9ee6012F9",
22
26
  ],
23
27
  [
24
28
  new data_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 11155420),
25
- "0xEFF0C81eC6D7c2a3B924e98B65303DDaa3030a81",
29
+ "0x10B69f0E3c21C1187526940A615959E9ee6012F9",
26
30
  ],
27
31
  [
28
- new data_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 80002),
29
- "0xEFF0C81eC6D7c2a3B924e98B65303DDaa3030a81",
32
+ new data_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 84532),
33
+ "0xA7458040272226378397C3036eda862D60C3b307",
30
34
  ],
31
35
  [
32
- new data_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 84532),
33
- "0xEFF0C81eC6D7c2a3B924e98B65303DDaa3030a81",
36
+ new data_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 5115),
37
+ "0x10B69f0E3c21C1187526940A615959E9ee6012F9",
34
38
  ],
35
39
  [
36
- new data_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 11155111),
40
+ new data_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 80002),
37
41
  "0xEFF0C81eC6D7c2a3B924e98B65303DDaa3030a81",
38
42
  ],
39
43
  [
@@ -61,6 +65,10 @@ const dataSets = new Map([
61
65
  new data_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 8453),
62
66
  "0x111111eA4f8BdfB5AE22c37ebC3eE17b82072F57",
63
67
  ],
68
+ [
69
+ new data_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 4326),
70
+ "0x10B69f0E3c21C1187526940A615959E9ee6012F9",
71
+ ],
64
72
  [
65
73
  new data_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 534352),
66
74
  "0x111111eA4f8BdfB5AE22c37ebC3eE17b82072F57",
@@ -126,10 +134,6 @@ const dataSets = new Map([
126
134
  new data_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 143),
127
135
  "0xC0DED5d7F424276c821AF21F68E1e663bC671C3D",
128
136
  ],
129
- [
130
- new data_1.OmniversalChainID(definition_1.Universe.FUEL, 9889),
131
- "0xe2586f908cc885e630cec6d8d578f02e6ade66983baf23f82757be502127dfb1",
132
- ],
133
137
  ],
134
138
  ],
135
139
  [
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AutoSelectionError = void 0;
4
4
  exports.aggregateAggregators = aggregateAggregators;
5
+ exports.autoSelectSourcesV2 = autoSelectSourcesV2;
5
6
  exports.autoSelectSources = autoSelectSources;
6
7
  exports.determineDestinationSwaps = determineDestinationSwaps;
7
8
  exports.liquidateInputHoldings = liquidateInputHoldings;
@@ -66,6 +67,259 @@ async function aggregateAggregators(requests, aggregators, mode) {
66
67
  }
67
68
  return final;
68
69
  }
70
+ /*
71
+ In original autoSelectSources:
72
+ Assets = [1 ETH, 1 COT, 1 ETH, 1 USDT, 1 COT]
73
+ Output = 4
74
+
75
+ First loop that just removes cot:
76
+ quoteAssets = [1 ETH, 1 ETH, 1 USDT]
77
+ Output = 4
78
+
79
+ Outside the function we can just remove all COT's and assume those as being used
80
+ but that's incorrect as we want to use assets in exact order as holdings array.
81
+ We can't remove only COT's that are going to be used because we don't know which ones are going
82
+ to get used.
83
+
84
+ Proposed solution:
85
+ It should actually use assets in exact order, so it cant be done outside the function
86
+ 1. The function has to keep an order of assets, separate out COT and non-COT assets.
87
+ 2. Get quote for non-COT assets, then loop over the original order
88
+ 3. Used either COT or quote depending on original order
89
+ 4. Send back quotes and COT's used
90
+
91
+ Alg:
92
+ Assets = [1 ETH, 1 COT, 1 ETH, 1 USDT, 1 COT]
93
+ Output = 4
94
+
95
+ 1. separate into two with indexes:
96
+ quotes = [(1 ETH, 0), (1 ETH, 2), (1 USDT, 3)]
97
+ cots = [(1 COT, 1), (1 COT, 4)]
98
+
99
+ 2. Get quotes using only quotes
100
+ 3. merge quote cots and sort by order
101
+ 4. loop assets (original order):
102
+ if a quote:
103
+ output = output - quote_output_amount
104
+ if a cot:
105
+ output = output - cot_amount
106
+ if output <= 0:
107
+ break
108
+ 5. return quotes and assets used.
109
+ */
110
+ async function autoSelectSourcesV2(userAddress, holdings, outputRequired, aggregators, commonCurrencyID = data_1.CurrencyID.USDC) {
111
+ // Assumption: Holding is already sorted in usage priority
112
+ console.log("XCS | SSV2:", {
113
+ holdings,
114
+ outputRequired: outputRequired.toFixed(),
115
+ });
116
+ const fullLiquidationQuotes = [];
117
+ const cotList = [];
118
+ for (const [idx, holding] of holdings.entries()) {
119
+ const chain = data_1.ChaindataMap.get(holding.chainID);
120
+ if (chain == null) {
121
+ throw new AutoSelectionError("Chain not found");
122
+ }
123
+ const correspondingCurrency = chain.Currencies.find((cur) => cur.currencyID === commonCurrencyID);
124
+ if (correspondingCurrency == null) {
125
+ console.log("XCS | SS | Skipping because correspondingCurrency is null", {
126
+ chain,
127
+ correspondingCurrency,
128
+ });
129
+ continue;
130
+ }
131
+ if (Buffer.compare(holding.tokenAddress, correspondingCurrency.tokenAddress) === 0) {
132
+ const normalizedAmount = new decimal_js_1.default(holding.amount).div(decimal_js_1.default.pow(10, correspondingCurrency.decimals));
133
+ cotList.push({
134
+ amount: normalizedAmount,
135
+ idx,
136
+ chainID: holding.chainID,
137
+ currency: correspondingCurrency,
138
+ originalHolding: holding,
139
+ });
140
+ }
141
+ else {
142
+ fullLiquidationQuotes.push({
143
+ req: {
144
+ userAddress,
145
+ type: iface_1.QuoteType.EXACT_IN,
146
+ chain: chain.ChainID,
147
+ inputToken: holding.tokenAddress,
148
+ inputAmount: holding.amount,
149
+ outputToken: correspondingCurrency.tokenAddress,
150
+ seriousness: iface_1.QuoteSeriousness.PRICE_SURVEY,
151
+ },
152
+ originalHolding: holding,
153
+ cur: correspondingCurrency,
154
+ idx,
155
+ });
156
+ }
157
+ }
158
+ // Check if continuous COTs from the start can cover the entire requirement
159
+ // We can skip quoting unused holdings
160
+ if (cotList.length > 0 && cotList[0].idx === 0) {
161
+ let continuousCOTAmount = new decimal_js_1.default(0);
162
+ let continuousCount = 0;
163
+ for (const cot of cotList) {
164
+ // only consecutive cots allowed, otherwise we need to go to quoting
165
+ if (cot.idx !== continuousCount)
166
+ break;
167
+ continuousCOTAmount = continuousCOTAmount.add(cot.amount);
168
+ continuousCount++;
169
+ if (continuousCOTAmount.gte(outputRequired)) {
170
+ console.log("XCS | SS | Continuous COTs can satisfy requirement, skipping quotes");
171
+ const usedCOTs = [];
172
+ let remainder = outputRequired;
173
+ for (let i = 0; i < continuousCount; i++) {
174
+ const cot = cotList[i];
175
+ const amountToUse = decimal_js_1.default.min(remainder, cot.amount);
176
+ usedCOTs.push({
177
+ originalHolding: cot.originalHolding,
178
+ amountUsed: amountToUse,
179
+ idx: cot.idx,
180
+ cur: cot.currency,
181
+ });
182
+ remainder = remainder.minus(amountToUse);
183
+ if (remainder.lte(0))
184
+ break;
185
+ }
186
+ console.log("XCS | SS | Early return with continuous COTs:", {
187
+ cots: usedCOTs,
188
+ });
189
+ return { quotes: [], usedCOTs };
190
+ }
191
+ }
192
+ }
193
+ const processingQueue = [];
194
+ // Add COT holdings
195
+ for (const cot of cotList) {
196
+ processingQueue.push({
197
+ idx: cot.idx,
198
+ isCOT: true,
199
+ cotData: cot,
200
+ });
201
+ }
202
+ // Add non-COT holdings
203
+ for (let i = 0; i < fullLiquidationQuotes.length; i++) {
204
+ processingQueue.push({
205
+ idx: fullLiquidationQuotes[i].idx,
206
+ isCOT: false,
207
+ quoteData: fullLiquidationQuotes[i],
208
+ responseIdx: i,
209
+ });
210
+ }
211
+ // Sort by original index to maintain priority
212
+ processingQueue.sort((a, b) => a.idx - b.idx);
213
+ const responses = await aggregateAggregators(fullLiquidationQuotes.map((fq) => fq.req), aggregators, 0 /* AggregateAggregatorsMode.MaximizeOutput */);
214
+ console.log("XCS | SS | Responses:", responses);
215
+ const final = [];
216
+ const usedCOTs = [];
217
+ let remainder = outputRequired;
218
+ for (const item of processingQueue) {
219
+ if (remainder.lte(0)) {
220
+ break;
221
+ }
222
+ if (item.isCOT) {
223
+ // Process COT holding - direct usage, no quote
224
+ const { cotData } = item;
225
+ const amountToUse = decimal_js_1.default.min(remainder, cotData.amount);
226
+ usedCOTs.push({
227
+ originalHolding: cotData.originalHolding,
228
+ amountUsed: amountToUse,
229
+ idx: cotData.idx,
230
+ cur: cotData.currency,
231
+ });
232
+ remainder = remainder.minus(amountToUse);
233
+ console.log("XCS | SS | Used COT", {
234
+ idx: cotData.idx,
235
+ amountToUse: amountToUse.toFixed(),
236
+ remainder: remainder.toFixed(),
237
+ });
238
+ }
239
+ else {
240
+ // Process non-COT holding - use existing quote logic
241
+ const { quoteData, responseIdx } = item;
242
+ const { quote: resp, aggregator: agg } = responses[responseIdx];
243
+ if (resp == null) {
244
+ continue;
245
+ }
246
+ console.log("XCS | SS | 1", {
247
+ i: responseIdx,
248
+ idx: quoteData.idx,
249
+ remainder,
250
+ q: quoteData,
251
+ resp,
252
+ agg,
253
+ });
254
+ const divisor = decimal_js_1.default.pow(10, quoteData.cur.decimals);
255
+ const oamD = decimal_js_1.default.div(resp.outputAmountMinimum, divisor);
256
+ if (oamD.gt(remainder)) {
257
+ const indicativePrice = decimal_js_1.default.div(resp.inputAmount, resp.outputAmountMinimum);
258
+ const userBal = new decimal_js_1.default(quoteData.originalHolding.amount);
259
+ // remainder is the output we want, so the input amount is remainder × indicativePrice
260
+ let expectedInput = decimal_js_1.default.min(remainder.mul(divisor).mul(indicativePrice).mul(safetyMultiplier), userBal);
261
+ while (true) {
262
+ console.log("XCS | SS | 2⒜", {
263
+ indicativePrice,
264
+ expectedInput,
265
+ userBal,
266
+ });
267
+ const adequateQuoteResult = await aggregateAggregators([
268
+ {
269
+ ...quoteData.req,
270
+ seriousness: iface_1.QuoteSeriousness.SERIOUS,
271
+ inputAmount: (0, data_1.convertDecimalToBigInt)(expectedInput),
272
+ },
273
+ ], aggregators, 0 /* AggregateAggregatorsMode.MaximizeOutput */);
274
+ if (adequateQuoteResult.length !== 1) {
275
+ throw new AutoSelectionError("???");
276
+ }
277
+ const adequateQuote = adequateQuoteResult[0];
278
+ if (adequateQuote.quote == null) {
279
+ throw new AutoSelectionError("Couldn't get buy quote");
280
+ }
281
+ console.log("XCS | SS | 2⒜⑴", {
282
+ adequateQuote,
283
+ });
284
+ const oam2D = decimal_js_1.default.div(adequateQuote.quote.outputAmountMinimum, divisor);
285
+ if (oam2D.gte(remainder)) {
286
+ final.push({
287
+ ...quoteData,
288
+ quote: adequateQuote.quote,
289
+ agg: adequateQuote.aggregator,
290
+ });
291
+ remainder = remainder.minus(oam2D);
292
+ break;
293
+ }
294
+ else if (expectedInput.eq(userBal)) {
295
+ throw new AutoSelectionError("Holding was supposedly enough to meet the full requirement but ceased to be so subsequently");
296
+ }
297
+ else {
298
+ expectedInput = decimal_js_1.default.min(expectedInput.mul(safetyMultiplier), userBal); // try again with higher amount
299
+ }
300
+ }
301
+ }
302
+ else {
303
+ console.log("XCS | SS | 2⒝", resp);
304
+ final.push({
305
+ ...quoteData,
306
+ quote: resp,
307
+ agg,
308
+ });
309
+ remainder = remainder.minus((0, data_1.convertBigIntToDecimal)(resp.outputAmountMinimum).div(divisor));
310
+ }
311
+ }
312
+ }
313
+ console.log("XCS | SS | 3⒜", {
314
+ remainder,
315
+ final,
316
+ });
317
+ if (remainder.gt(0)) {
318
+ throw new AutoSelectionError("Failed to accumulate enough swaps to meet requirement");
319
+ }
320
+ console.log("XCS | SS | Final:", { quotes: final, cots: usedCOTs });
321
+ return { quotes: final, usedCOTs };
322
+ }
69
323
  async function autoSelectSources(userAddress, holdings, outputRequired, aggregators, collectionFees, commonCurrencyID = data_1.CurrencyID.USDC) {
70
324
  console.log("XCS | SS | Holdings:", holdings);
71
325
  const groupedByChainID = (0, es_toolkit_1.groupBy)(holdings, (h) => (0, viem_1.bytesToHex)(h.chainID.toBytes()));
@@ -215,6 +469,7 @@ async function determineDestinationSwaps(userAddress, chainID, requirement, aggr
215
469
  if (COT == null) {
216
470
  throw new AutoSelectionError("COT not present on the destination chain");
217
471
  }
472
+ // FIXME: Replace with oracle usage - should reduce time.
218
473
  // what happens if we happen to sell the requirement for the COT, what would the amount be?
219
474
  const fullLiquidationQR = {
220
475
  type: iface_1.QuoteType.EXACT_IN,
@@ -594,6 +594,80 @@ const RawData = [
594
594
  },
595
595
  ],
596
596
  },
597
+ //megaeth mainnet
598
+ {
599
+ Universe: 0,
600
+ ChainID32: "0x00000000000000000000000000000000000000000000000000000000000010e6",
601
+ Currencies: [
602
+ {
603
+ CurrencyID: 1,
604
+ TokenContractAddress: "0x000000000000000000000000590cb8868c6DeBc12CCd42E837042659cfB91504",
605
+ PermitVariant: PermitVariant.EIP2612Canonical,
606
+ PermitContractVersion: 2,
607
+ TokenDecimals: 6,
608
+ IsGasToken: false,
609
+ },
610
+ {
611
+ CurrencyID: 3,
612
+ TokenContractAddress: "0x0000000000000000000000000000000000000000000000000000000000000000",
613
+ PermitVariant: PermitVariant.Unsupported,
614
+ TokenDecimals: 18,
615
+ IsGasToken: true,
616
+ },
617
+ ],
618
+ },
619
+ //citrea mainnet
620
+ {
621
+ Universe: 0,
622
+ ChainID32: "0x0000000000000000000000000000000000000000000000000000000000001012",
623
+ Currencies: [
624
+ {
625
+ CurrencyID: 1,
626
+ TokenContractAddress: "0x000000000000000000000000E045e6c36cF77FAA2CfB54466D71A3aEF7bbE839",
627
+ PermitVariant: PermitVariant.EIP2612Canonical,
628
+ PermitContractVersion: 2,
629
+ TokenDecimals: 6,
630
+ IsGasToken: false,
631
+ },
632
+ {
633
+ CurrencyID: 2,
634
+ PermitVariant: PermitVariant.EIP2612Canonical,
635
+ PermitContractVersion: 1,
636
+ TokenContractAddress: "0x0000000000000000000000009f3096Bac87e7F03DC09b0B416eB0DF837304dc4",
637
+ TokenDecimals: 6,
638
+ IsGasToken: false,
639
+ },
640
+ {
641
+ CurrencyID: 3,
642
+ TokenContractAddress: "0x0000000000000000000000000000000000000000000000000000000000000000",
643
+ PermitVariant: PermitVariant.Unsupported,
644
+ TokenDecimals: 18,
645
+ IsGasToken: true,
646
+ },
647
+ ],
648
+ },
649
+ // Citrea Testnet
650
+ {
651
+ Universe: 0,
652
+ ChainID32: "0x00000000000000000000000000000000000000000000000000000000000013fb",
653
+ Currencies: [
654
+ {
655
+ CurrencyID: 1,
656
+ TokenContractAddress: "0x000000000000000000000000b669dC8cC6D044307Ba45366C0c836eC3c7e31AA",
657
+ PermitVariant: PermitVariant.EIP2612Canonical,
658
+ PermitContractVersion: 2,
659
+ TokenDecimals: 6,
660
+ IsGasToken: false,
661
+ },
662
+ {
663
+ CurrencyID: 21,
664
+ TokenContractAddress: "0x0000000000000000000000000000000000000000000000000000000000000000",
665
+ PermitVariant: PermitVariant.Unsupported,
666
+ TokenDecimals: 18,
667
+ IsGasToken: true,
668
+ },
669
+ ],
670
+ },
597
671
  ];
598
672
  class CurrencyMap {
599
673
  map = new Map();
@@ -624,75 +698,83 @@ export const ChaindataMap = new ChainIDKeyedMap(Chaindata.map((ch) => [ch.ChainI
624
698
  export const RPCURLMap = new ChainIDKeyedMap([
625
699
  [
626
700
  new OmniversalChainID(Universe.ETHEREUM, 421614),
627
- "https://arb-sepolia.g.alchemy.com/v2/PfaswrKq0rjOrfYWHfE9uLQKhiD4JCdq",
701
+ "https://rpcs.avail.so/arbitrumsepolia",
628
702
  ],
629
703
  [
630
704
  new OmniversalChainID(Universe.ETHEREUM, 11155420),
631
- "https://opt-sepolia.g.alchemy.com/v2/PfaswrKq0rjOrfYWHfE9uLQKhiD4JCdq",
705
+ "https://rpcs.avail.so/optimismsepolia",
632
706
  ],
633
707
  [
634
708
  new OmniversalChainID(Universe.ETHEREUM, 80002),
635
- "https://polygon-amoy.g.alchemy.com/v2/PfaswrKq0rjOrfYWHfE9uLQKhiD4JCdq",
709
+ "https://rpcs.avail.so/polygonamoy",
636
710
  ],
637
711
  [
638
712
  new OmniversalChainID(Universe.ETHEREUM, 84532),
639
- "https://base-sepolia.g.alchemy.com/v2/PfaswrKq0rjOrfYWHfE9uLQKhiD4JCdq",
713
+ "https://rpcs.avail.so/basesepolia",
640
714
  ],
641
715
  [
642
716
  new OmniversalChainID(Universe.ETHEREUM, 11155111),
643
- "https://eth-sepolia.g.alchemy.com/v2/PfaswrKq0rjOrfYWHfE9uLQKhiD4JCdq",
717
+ "https://rpcs.avail.so/sepolia",
644
718
  ],
645
719
  [
646
720
  new OmniversalChainID(Universe.ETHEREUM, 137),
647
- "https://polygon-mainnet.g.alchemy.com/v2/PfaswrKq0rjOrfYWHfE9uLQKhiD4JCdq",
721
+ "https://rpcs.avail.so/polygon",
648
722
  ],
649
723
  [
650
724
  new OmniversalChainID(Universe.ETHEREUM, 42161),
651
- "https://arb-mainnet.g.alchemy.com/v2/PfaswrKq0rjOrfYWHfE9uLQKhiD4JCdq",
725
+ "https://rpcs.avail.so/arbitrum",
652
726
  ],
653
727
  [
654
728
  new OmniversalChainID(Universe.ETHEREUM, 10),
655
- "https://opt-mainnet.g.alchemy.com/v2/PfaswrKq0rjOrfYWHfE9uLQKhiD4JCdq",
729
+ "https://rpcs.avail.so/optimism",
656
730
  ],
657
731
  [
658
732
  new OmniversalChainID(Universe.ETHEREUM, 8453),
659
- "https://base-mainnet.g.alchemy.com/v2/PfaswrKq0rjOrfYWHfE9uLQKhiD4JCdq",
660
- ],
661
- [
662
- new OmniversalChainID(Universe.ETHEREUM, 1),
663
- "https://eth-mainnet.g.alchemy.com/v2/PfaswrKq0rjOrfYWHfE9uLQKhiD4JCdq",
733
+ "https://rpcs.avail.so/base",
664
734
  ],
735
+ [new OmniversalChainID(Universe.ETHEREUM, 1), "https://rpcs.avail.so/eth"],
665
736
  [
666
737
  new OmniversalChainID(Universe.ETHEREUM, 534352),
667
- "https://scroll-mainnet.g.alchemy.com/v2/PfaswrKq0rjOrfYWHfE9uLQKhiD4JCdq",
668
- ],
669
- [
670
- new OmniversalChainID(Universe.ETHEREUM, 59144),
671
- "https://linea-mainnet.g.alchemy.com/v2/PfaswrKq0rjOrfYWHfE9uLQKhiD4JCdq",
738
+ "https://rpcs.avail.so/scroll",
672
739
  ],
673
740
  [
674
741
  new OmniversalChainID(Universe.ETHEREUM, 43114),
675
- "https://avax-mainnet.g.alchemy.com/v2/PfaswrKq0rjOrfYWHfE9uLQKhiD4JCdq",
742
+ "https://rpcs.avail.so/avalanche",
676
743
  ],
677
744
  [
678
745
  new OmniversalChainID(Universe.ETHEREUM, 999),
679
- "https://rpc.hyperliquid.xyz/evm",
680
- ], // Alchemy doesn't support this.
746
+ "https://rpcs.avail.so/hyperevm",
747
+ ],
681
748
  [
682
749
  new OmniversalChainID(Universe.ETHEREUM, 8217),
683
- "https://go.getblock.io/d7094dbd80ab474ba7042603fe912332",
684
- ], // Alchemy doesn't support this.
685
- [new OmniversalChainID(Universe.ETHEREUM, 50104), "https://rpc.sophon.xyz"], // Alchemy doesn't support this.
750
+ "https://rpcs.avail.so/kaia",
751
+ ],
752
+ [
753
+ new OmniversalChainID(Universe.ETHEREUM, 50104),
754
+ "https://sophon.gateway.tenderly.co/1d4STFT7zmG0vM5QowibCw",
755
+ ],
686
756
  [
687
757
  new OmniversalChainID(Universe.ETHEREUM, 56),
688
- "https://bnb-mainnet.g.alchemy.com/v2/PfaswrKq0rjOrfYWHfE9uLQKhiD4JCdq",
758
+ "https://rpcs.avail.so/bsc",
689
759
  ],
690
760
  [
691
761
  new OmniversalChainID(Universe.ETHEREUM, 10143),
692
- "https://lb.drpc.org/monad-testnet/Am5nENoJmEuovqui8_LMxzp4ChJzW7kR8JfPrqRhf0fE",
762
+ "https://rpcs.avail.so/monadtestnet",
763
+ ],
764
+ [
765
+ new OmniversalChainID(Universe.ETHEREUM, 143),
766
+ "https://rpcs.avail.so/monad",
767
+ ],
768
+ [
769
+ new OmniversalChainID(Universe.ETHEREUM, 4326),
770
+ "https://rpcs.avail.so/megaeth",
771
+ ],
772
+ [
773
+ new OmniversalChainID(Universe.ETHEREUM, 4114),
774
+ "https://rpcs.avail.so/citrea",
693
775
  ],
694
776
  [
695
- new OmniversalChainID(Universe.FUEL, 9889),
696
- "https://omniscient-fittest-pallet.fuel-mainnet.quiknode.pro/3193ae52f2522af1a4357a482e475e019857f02b/v1/graphql",
777
+ new OmniversalChainID(Universe.ETHEREUM, 5115),
778
+ "https://rpcs.avail.so/citrea-testnet",
697
779
  ],
698
780
  ]);
package/dist/esm/index.js CHANGED
@@ -1,13 +1,13 @@
1
1
  import "./_polyfill";
2
- export { ArcanaVault, ArcanaVaultFactory } from './fuelcontracts';
3
- export * from './proto/definition';
4
- export { QueryClientImpl, GrpcWebError, GrpcWebImpl } from './proto/grpc';
5
- export * from './data';
6
- export * from './vaultcontracts';
7
- export * from './permitutils';
8
- export * from './xcs';
9
- export * from './cosmos';
10
- export * from './rff/rff';
11
- export * from './types';
12
- export * from './balances/ub-api';
13
- export * from './evmabi';
2
+ export * from "./proto/definition";
3
+ export { QueryClientImpl, GrpcWebError, GrpcWebImpl, } from "./proto/grpc";
4
+ export { createGrpcWebImpl } from "./proto/client";
5
+ export * from "./data";
6
+ export * from "./vaultcontracts";
7
+ export * from "./permitutils";
8
+ export * from "./xcs";
9
+ export * from "./cosmos";
10
+ export * from "./rff/rff";
11
+ export * from "./types";
12
+ export * from "./balances/ub-api";
13
+ export * from "./evmabi";
@@ -0,0 +1,11 @@
1
+ import { GrpcWebImpl } from "./grpc";
2
+ export const createGrpcWebImpl = async (url) => {
3
+ const options = {};
4
+ // eslint-disable-next-line no-constant-binary-expression, valid-typeof
5
+ if (typeof window == undefined) {
6
+ const lib = await import("@improbable-eng/grpc-web-node-http-transport");
7
+ options.transport = lib.NodeHttpTransport();
8
+ }
9
+ const impl = new GrpcWebImpl(url, options);
10
+ return impl;
11
+ };