@avail-project/ca-common 1.0.0-beta.7 → 1.0.0-beta.8

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 (44) hide show
  1. package/dist/cjs/_polyfill.js +147 -0
  2. package/dist/cjs/data/chaindata.js +39 -49
  3. package/dist/cjs/data/chainid.js +4 -2
  4. package/dist/cjs/data/currency.js +1 -2
  5. package/dist/cjs/index.js +4 -4
  6. package/dist/cjs/proto/client.js +48 -0
  7. package/dist/cjs/proto/definition.js +167 -448
  8. package/dist/cjs/proto/grpc.js +4 -9
  9. package/dist/cjs/rff/rff.js +0 -35
  10. package/dist/cjs/vaultcontracts/vaultcontracts.js +64 -23
  11. package/dist/cjs/xcs/autochoice.js +255 -0
  12. package/dist/esm/_polyfill.js +143 -0
  13. package/dist/esm/data/chaindata.js +39 -49
  14. package/dist/esm/data/chainid.js +4 -2
  15. package/dist/esm/data/currency.js +1 -2
  16. package/dist/esm/index.js +13 -12
  17. package/dist/esm/proto/client.js +11 -0
  18. package/dist/esm/proto/definition.js +167 -448
  19. package/dist/esm/proto/grpc.js +4 -9
  20. package/dist/esm/rff/rff.js +0 -35
  21. package/dist/esm/vaultcontracts/vaultcontracts.js +64 -23
  22. package/dist/esm/xcs/autochoice.js +254 -0
  23. package/dist/types/_polyfill.d.ts +1 -0
  24. package/dist/types/data/currency.d.ts +1 -2
  25. package/dist/types/index.d.ts +13 -12
  26. package/dist/types/proto/client.d.ts +2 -0
  27. package/dist/types/rff/rff.d.ts +0 -3
  28. package/dist/types/xcs/autochoice.d.ts +17 -0
  29. package/package.json +16 -10
  30. package/dist/cjs/fuelcontracts/ArcanaVault.js +0 -2407
  31. package/dist/cjs/fuelcontracts/ArcanaVaultFactory.js +0 -18
  32. package/dist/cjs/fuelcontracts/common.js +0 -3
  33. package/dist/cjs/fuelcontracts/index.js +0 -5
  34. package/dist/cjs/rff/fuel.js +0 -27
  35. package/dist/esm/fuelcontracts/ArcanaVault.js +0 -2402
  36. package/dist/esm/fuelcontracts/ArcanaVaultFactory.js +0 -14
  37. package/dist/esm/fuelcontracts/common.js +0 -2
  38. package/dist/esm/fuelcontracts/index.js +0 -2
  39. package/dist/esm/rff/fuel.js +0 -23
  40. package/dist/types/fuelcontracts/ArcanaVault.d.ts +0 -448
  41. package/dist/types/fuelcontracts/ArcanaVaultFactory.d.ts +0 -8
  42. package/dist/types/fuelcontracts/common.d.ts +0 -23
  43. package/dist/types/fuelcontracts/index.d.ts +0 -2
  44. package/dist/types/rff/fuel.d.ts +0 -4
@@ -0,0 +1,147 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ensureBufferPolyfill = ensureBufferPolyfill;
4
+ const tslib_1 = require("tslib");
5
+ const bufferModule = tslib_1.__importStar(require("buffer"));
6
+ const buffer_1 = require("buffer");
7
+ const globalScope = globalThis;
8
+ let patched = false;
9
+ function collectBufferCtors() {
10
+ const candidates = new Set();
11
+ if (typeof buffer_1.Buffer === "function") {
12
+ candidates.add(buffer_1.Buffer);
13
+ }
14
+ const mod = bufferModule;
15
+ if (typeof mod?.Buffer === "function") {
16
+ candidates.add(mod.Buffer);
17
+ }
18
+ const defaultExport = mod?.default;
19
+ if (typeof defaultExport === "function") {
20
+ candidates.add(defaultExport);
21
+ }
22
+ else if (defaultExport &&
23
+ typeof defaultExport === "object" &&
24
+ typeof defaultExport.Buffer === "function") {
25
+ candidates.add(defaultExport.Buffer);
26
+ }
27
+ if (typeof globalScope.Buffer === "function") {
28
+ candidates.add(globalScope.Buffer);
29
+ }
30
+ return Array.from(candidates);
31
+ }
32
+ function assertOffset(buffer, offset) {
33
+ const numericOffset = Number(offset);
34
+ if (!Number.isFinite(numericOffset)) {
35
+ throw new TypeError("Offset must be a finite number");
36
+ }
37
+ const normalized = numericOffset >>> 0;
38
+ if (normalized !== numericOffset) {
39
+ throw new RangeError("Offset must be a non-negative integer");
40
+ }
41
+ if (normalized + 4 > buffer.length) {
42
+ throw new RangeError("Offset out of bounds");
43
+ }
44
+ return normalized;
45
+ }
46
+ function fallbackWriteUint32BE(value, offset = 0) {
47
+ const o = assertOffset(this, offset);
48
+ const normalized = Number(value) >>> 0;
49
+ this[o] = (normalized >>> 24) & 0xff;
50
+ this[o + 1] =
51
+ (normalized >>> 16) & 0xff;
52
+ this[o + 2] =
53
+ (normalized >>> 8) & 0xff;
54
+ this[o + 3] = normalized & 0xff;
55
+ return o + 4;
56
+ }
57
+ function fallbackWriteUint32LE(value, offset = 0) {
58
+ const o = assertOffset(this, offset);
59
+ const normalized = Number(value) >>> 0;
60
+ this[o] = normalized & 0xff;
61
+ this[o + 1] =
62
+ (normalized >>> 8) & 0xff;
63
+ this[o + 2] =
64
+ (normalized >>> 16) & 0xff;
65
+ this[o + 3] =
66
+ (normalized >>> 24) & 0xff;
67
+ return o + 4;
68
+ }
69
+ function fallbackReadUint32BE(offset = 0) {
70
+ const o = assertOffset(this, offset);
71
+ const store = this;
72
+ return ((store[o] * 0x1000000 +
73
+ ((store[o + 1] << 16) | (store[o + 2] << 8) | store[o + 3])) >>>
74
+ 0);
75
+ }
76
+ function fallbackReadUint32LE(offset = 0) {
77
+ const o = assertOffset(this, offset);
78
+ const store = this;
79
+ return ((store[o] |
80
+ (store[o + 1] << 8) |
81
+ (store[o + 2] << 16) |
82
+ (store[o + 3] * 0x1000000)) >>>
83
+ 0);
84
+ }
85
+ function aliasOrDefine(proto, alias, canonical, fallback) {
86
+ const aliasKey = alias;
87
+ const canonicalKey = canonical;
88
+ const existingAlias = proto[aliasKey];
89
+ if (typeof existingAlias === "function") {
90
+ return;
91
+ }
92
+ const canonicalFn = proto[canonicalKey];
93
+ if (typeof canonicalFn === "function") {
94
+ Object.defineProperty(proto, aliasKey, {
95
+ value: canonicalFn,
96
+ writable: true,
97
+ configurable: true,
98
+ });
99
+ return;
100
+ }
101
+ Object.defineProperty(proto, aliasKey, {
102
+ value: fallback,
103
+ writable: true,
104
+ configurable: true,
105
+ });
106
+ }
107
+ function patchPrototype(bufferCtor) {
108
+ const proto = bufferCtor.prototype;
109
+ if (!proto) {
110
+ return;
111
+ }
112
+ aliasOrDefine(proto, "writeUint32BE", "writeUInt32BE", fallbackWriteUint32BE);
113
+ aliasOrDefine(proto, "writeUint32LE", "writeUInt32LE", fallbackWriteUint32LE);
114
+ aliasOrDefine(proto, "readUint32BE", "readUInt32BE", fallbackReadUint32BE);
115
+ aliasOrDefine(proto, "readUint32LE", "readUInt32LE", fallbackReadUint32LE);
116
+ }
117
+ function ensureProcessEnv() {
118
+ if (!globalScope.process) {
119
+ globalScope.process = { env: { NODE_ENV: "production" } };
120
+ return;
121
+ }
122
+ const processValue = globalScope.process;
123
+ if (!processValue.env) {
124
+ processValue.env = { NODE_ENV: "production" };
125
+ return;
126
+ }
127
+ if (typeof processValue.env.NODE_ENV === "undefined") {
128
+ processValue.env.NODE_ENV = "production";
129
+ }
130
+ }
131
+ function ensureBufferPolyfill() {
132
+ if (patched) {
133
+ return;
134
+ }
135
+ const candidates = collectBufferCtors();
136
+ candidates.forEach(patchPrototype);
137
+ const preferred = candidates[0];
138
+ if (preferred &&
139
+ (typeof globalScope.Buffer !== "function" ||
140
+ typeof globalScope.Buffer.prototype?.writeUint32BE !==
141
+ "function")) {
142
+ globalScope.Buffer = preferred;
143
+ }
144
+ ensureProcessEnv();
145
+ patched = true;
146
+ }
147
+ ensureBufferPolyfill();
@@ -537,32 +537,33 @@ const RawData = [
537
537
  ],
538
538
  },
539
539
  {
540
- Universe: 3,
541
- ChainID32: "0x0000000000000000000000000000000000000000000000000000000094a9059e",
540
+ Universe: 0,
541
+ ChainID32: "0x000000000000000000000000000000000000000000000000000000000000008f",
542
542
  Currencies: [
543
543
  {
544
- CurrencyID: 2,
545
- TokenContractAddress: "0x00000000000000000000000042a1e39aefA49290F2B3F9ed688D7cecf86CD6E0",
546
- PermitVariant: permitutils_1.PermitVariant.Unsupported,
544
+ CurrencyID: 1,
545
+ TokenContractAddress: "0x000000000000000000000000754704Bc059F8C67012fEd69BC8A327a5aafb603",
546
+ PermitVariant: permitutils_1.PermitVariant.EIP2612Canonical,
547
+ PermitContractVersion: 2,
547
548
  TokenDecimals: 6,
548
549
  IsGasToken: false,
549
550
  },
550
551
  {
551
- CurrencyID: 13,
552
+ CurrencyID: 20,
552
553
  TokenContractAddress: "0x0000000000000000000000000000000000000000000000000000000000000000",
553
554
  PermitVariant: permitutils_1.PermitVariant.Unsupported,
554
- TokenDecimals: 6,
555
+ TokenDecimals: 18,
555
556
  IsGasToken: true,
556
557
  },
557
558
  ],
558
559
  },
559
560
  {
560
561
  Universe: 3,
561
- ChainID32: "0x000000000000000000000000000000000000000000000000000000002b6653dc",
562
+ ChainID32: "0x0000000000000000000000000000000000000000000000000000000094a9059e",
562
563
  Currencies: [
563
564
  {
564
565
  CurrencyID: 2,
565
- TokenContractAddress: "0x000000000000000000000000a614f803B6FD780986A42c78Ec9c7f77e6DeD13C",
566
+ TokenContractAddress: "0x00000000000000000000000042a1e39aefA49290F2B3F9ed688D7cecf86CD6E0",
566
567
  PermitVariant: permitutils_1.PermitVariant.Unsupported,
567
568
  TokenDecimals: 6,
568
569
  IsGasToken: false,
@@ -577,21 +578,21 @@ const RawData = [
577
578
  ],
578
579
  },
579
580
  {
580
- Universe: 0,
581
- ChainID32: "0x0000000000000000000000000000000000000000000000000000000000000237",
581
+ Universe: 3,
582
+ ChainID32: "0x000000000000000000000000000000000000000000000000000000002b6653dc",
582
583
  Currencies: [
583
584
  {
584
- CurrencyID: 1,
585
- TokenContractAddress: "0x0000000000000000000000008Cf5f629Bb26FC3F92144e72bC4A3719A7DF07F3",
586
- PermitVariant: permitutils_1.PermitVariant.EIP2612Canonical,
585
+ CurrencyID: 2,
586
+ TokenContractAddress: "0x000000000000000000000000a614f803B6FD780986A42c78Ec9c7f77e6DeD13C",
587
+ PermitVariant: permitutils_1.PermitVariant.Unsupported,
587
588
  TokenDecimals: 6,
588
589
  IsGasToken: false,
589
590
  },
590
591
  {
591
- CurrencyID: 64,
592
+ CurrencyID: 13,
592
593
  TokenContractAddress: "0x0000000000000000000000000000000000000000000000000000000000000000",
593
594
  PermitVariant: permitutils_1.PermitVariant.Unsupported,
594
- TokenDecimals: 18,
595
+ TokenDecimals: 6,
595
596
  IsGasToken: true,
596
597
  },
597
598
  ],
@@ -626,79 +627,68 @@ exports.ChaindataMap = new chainid_1.ChainIDKeyedMap(exports.Chaindata.map((ch)
626
627
  exports.RPCURLMap = new chainid_1.ChainIDKeyedMap([
627
628
  [
628
629
  new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 421614),
629
- "https://arb-sepolia.g.alchemy.com/v2/PfaswrKq0rjOrfYWHfE9uLQKhiD4JCdq",
630
+ "https://rpcs.avail.so/arbitrumsepolia",
630
631
  ],
631
632
  [
632
633
  new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 11155420),
633
- "https://opt-sepolia.g.alchemy.com/v2/PfaswrKq0rjOrfYWHfE9uLQKhiD4JCdq",
634
+ "https://rpcs.avail.so/optimismsepolia",
634
635
  ],
635
636
  [
636
637
  new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 80002),
637
- "https://polygon-amoy.g.alchemy.com/v2/PfaswrKq0rjOrfYWHfE9uLQKhiD4JCdq",
638
+ "https://rpcs.avail.so/polygonamoy",
638
639
  ],
639
640
  [
640
641
  new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 84532),
641
- "https://base-sepolia.g.alchemy.com/v2/PfaswrKq0rjOrfYWHfE9uLQKhiD4JCdq",
642
+ "https://rpcs.avail.so/basesepolia",
642
643
  ],
643
644
  [
644
645
  new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 11155111),
645
- "https://eth-sepolia.g.alchemy.com/v2/PfaswrKq0rjOrfYWHfE9uLQKhiD4JCdq",
646
+ "https://rpcs.avail.so/sepolia",
646
647
  ],
647
648
  [
648
649
  new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 137),
649
- "https://polygon-mainnet.g.alchemy.com/v2/PfaswrKq0rjOrfYWHfE9uLQKhiD4JCdq",
650
+ "https://rpcs.avail.so/polygon",
650
651
  ],
651
652
  [
652
653
  new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 42161),
653
- "https://arb-mainnet.g.alchemy.com/v2/PfaswrKq0rjOrfYWHfE9uLQKhiD4JCdq",
654
+ "https://rpcs.avail.so/arbitrum",
654
655
  ],
655
656
  [
656
657
  new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 10),
657
- "https://opt-mainnet.g.alchemy.com/v2/PfaswrKq0rjOrfYWHfE9uLQKhiD4JCdq",
658
+ "https://rpcs.avail.so/optimism",
658
659
  ],
659
660
  [
660
661
  new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 8453),
661
- "https://base-mainnet.g.alchemy.com/v2/PfaswrKq0rjOrfYWHfE9uLQKhiD4JCdq",
662
- ],
663
- [
664
- new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 1),
665
- "https://eth-mainnet.g.alchemy.com/v2/PfaswrKq0rjOrfYWHfE9uLQKhiD4JCdq",
662
+ "https://rpcs.avail.so/base",
666
663
  ],
664
+ [new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 1), "https://rpcs.avail.so/eth"],
667
665
  [
668
666
  new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 534352),
669
- "https://scroll-mainnet.g.alchemy.com/v2/PfaswrKq0rjOrfYWHfE9uLQKhiD4JCdq",
670
- ],
671
- [
672
- new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 59144),
673
- "https://linea-mainnet.g.alchemy.com/v2/PfaswrKq0rjOrfYWHfE9uLQKhiD4JCdq",
667
+ "https://rpcs.avail.so/scroll",
674
668
  ],
675
669
  [
676
670
  new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 43114),
677
- "https://avax-mainnet.g.alchemy.com/v2/PfaswrKq0rjOrfYWHfE9uLQKhiD4JCdq",
671
+ "https://rpcs.avail.so/avalanche",
678
672
  ],
679
673
  [
680
674
  new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 999),
681
- "https://rpc.hyperliquid.xyz/evm",
682
- ], // Alchemy doesn't support this.
675
+ "https://rpcs.avail.so/hyperevm",
676
+ ],
683
677
  [
684
678
  new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 8217),
685
- "https://go.getblock.io/d7094dbd80ab474ba7042603fe912332",
686
- ], // Alchemy doesn't support this.
687
- [new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 50104), "https://rpc.sophon.xyz"], // Alchemy doesn't support this.
688
- [
689
- new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 56),
690
- "https://bnb-mainnet.g.alchemy.com/v2/PfaswrKq0rjOrfYWHfE9uLQKhiD4JCdq",
679
+ "https://rpcs.avail.so/kaia",
691
680
  ],
692
681
  [
693
- new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 10143),
694
- "https://lb.drpc.org/monad-testnet/Am5nENoJmEuovqui8_LMxzp4ChJzW7kR8JfPrqRhf0fE",
682
+ new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 50104),
683
+ "https://sophon.gateway.tenderly.co/1d4STFT7zmG0vM5QowibCw",
695
684
  ],
685
+ [new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 56), "https://rpcs.avail.so/bsc"],
696
686
  [
697
- new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 567),
698
- "https://testnet.l2.rpc.validium.network",
687
+ new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 10143),
688
+ "https://rpcs.avail.so/monadtestnet",
699
689
  ],
700
690
  [
701
- new chainid_1.OmniversalChainID(definition_1.Universe.FUEL, 9889),
702
- "https://omniscient-fittest-pallet.fuel-mainnet.quiknode.pro/3193ae52f2522af1a4357a482e475e019857f02b/v1/graphql",
691
+ new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 143),
692
+ "https://rpcs.avail.so/monad",
703
693
  ],
704
694
  ]);
@@ -2,9 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ChainIDKeyedMap = exports.OmniversalChainID = void 0;
4
4
  exports.encodeChainID36 = encodeChainID36;
5
+ const _polyfill_1 = require("../_polyfill");
5
6
  const viem_1 = require("viem");
6
7
  const definition_1 = require("../proto/definition");
7
8
  const utils_1 = require("./utils");
9
+ (0, _polyfill_1.ensureBufferPolyfill)();
8
10
  function encodeChainID36(universe, chainID) {
9
11
  let chainIDB;
10
12
  if (Buffer.isBuffer(chainID) || chainID instanceof Uint8Array) {
@@ -14,7 +16,7 @@ function encodeChainID36(universe, chainID) {
14
16
  chainIDB = (0, viem_1.toBytes)(chainID);
15
17
  }
16
18
  const buf = Buffer.alloc(36);
17
- buf.writeUint32BE(universe);
19
+ buf.writeUInt32BE(universe);
18
20
  buf.set(chainIDB, 4 + (32 - chainIDB.length));
19
21
  return buf;
20
22
  }
@@ -49,7 +51,7 @@ class OmniversalChainID {
49
51
  }
50
52
  static fromChainID36(_input) {
51
53
  const input = (0, utils_1.convertToBufferIfNecessary)(_input);
52
- const univID = input.readUint32BE(0);
54
+ const univID = input.readUInt32BE(0);
53
55
  const rest = input.subarray(4);
54
56
  return new OmniversalChainID(univID, rest);
55
57
  }
@@ -17,8 +17,7 @@ var CurrencyID;
17
17
  CurrencyID[CurrencyID["KAIA"] = 17] = "KAIA";
18
18
  CurrencyID[CurrencyID["SOPH"] = 18] = "SOPH";
19
19
  CurrencyID[CurrencyID["TRX"] = 19] = "TRX";
20
- CurrencyID[CurrencyID["VLDM"] = 64] = "VLDM";
21
- CurrencyID[CurrencyID["MON"] = 65] = "MON";
20
+ CurrencyID[CurrencyID["MON"] = 20] = "MON";
22
21
  })(CurrencyID || (exports.CurrencyID = CurrencyID = {}));
23
22
  class Currency {
24
23
  currencyID;
package/dist/cjs/index.js CHANGED
@@ -1,15 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GrpcWebImpl = exports.GrpcWebError = exports.QueryClientImpl = exports.ArcanaVaultFactory = exports.ArcanaVault = void 0;
3
+ exports.createGrpcWebImpl = exports.GrpcWebImpl = exports.GrpcWebError = exports.QueryClientImpl = void 0;
4
4
  const tslib_1 = require("tslib");
5
- var fuelcontracts_1 = require("./fuelcontracts");
6
- Object.defineProperty(exports, "ArcanaVault", { enumerable: true, get: function () { return fuelcontracts_1.ArcanaVault; } });
7
- Object.defineProperty(exports, "ArcanaVaultFactory", { enumerable: true, get: function () { return fuelcontracts_1.ArcanaVaultFactory; } });
5
+ require("./_polyfill");
8
6
  tslib_1.__exportStar(require("./proto/definition"), exports);
9
7
  var grpc_1 = require("./proto/grpc");
10
8
  Object.defineProperty(exports, "QueryClientImpl", { enumerable: true, get: function () { return grpc_1.QueryClientImpl; } });
11
9
  Object.defineProperty(exports, "GrpcWebError", { enumerable: true, get: function () { return grpc_1.GrpcWebError; } });
12
10
  Object.defineProperty(exports, "GrpcWebImpl", { enumerable: true, get: function () { return grpc_1.GrpcWebImpl; } });
11
+ var client_1 = require("./proto/client");
12
+ Object.defineProperty(exports, "createGrpcWebImpl", { enumerable: true, get: function () { return client_1.createGrpcWebImpl; } });
13
13
  tslib_1.__exportStar(require("./data"), exports);
14
14
  tslib_1.__exportStar(require("./vaultcontracts"), exports);
15
15
  tslib_1.__exportStar(require("./permitutils"), exports);
@@ -0,0 +1,48 @@
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.createGrpcWebImpl = void 0;
37
+ const grpc_1 = require("./grpc");
38
+ const createGrpcWebImpl = async (url) => {
39
+ const options = {};
40
+ // eslint-disable-next-line no-constant-binary-expression, valid-typeof
41
+ if (typeof window == undefined) {
42
+ const lib = await Promise.resolve().then(() => __importStar(require("@improbable-eng/grpc-web-node-http-transport")));
43
+ options.transport = lib.NodeHttpTransport();
44
+ }
45
+ const impl = new grpc_1.GrpcWebImpl(url, options);
46
+ return impl;
47
+ };
48
+ exports.createGrpcWebImpl = createGrpcWebImpl;