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

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 +67 -34
  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 +79 -30
  11. package/dist/cjs/xcs/autochoice.js +255 -0
  12. package/dist/esm/_polyfill.js +143 -0
  13. package/dist/esm/data/chaindata.js +67 -34
  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 +79 -30
  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();
@@ -536,6 +536,27 @@ const RawData = [
536
536
  },
537
537
  ],
538
538
  },
539
+ {
540
+ Universe: 0,
541
+ ChainID32: "0x000000000000000000000000000000000000000000000000000000000000008f",
542
+ Currencies: [
543
+ {
544
+ CurrencyID: 1,
545
+ TokenContractAddress: "0x000000000000000000000000754704Bc059F8C67012fEd69BC8A327a5aafb603",
546
+ PermitVariant: permitutils_1.PermitVariant.EIP2612Canonical,
547
+ PermitContractVersion: 2,
548
+ TokenDecimals: 6,
549
+ IsGasToken: false,
550
+ },
551
+ {
552
+ CurrencyID: 20,
553
+ TokenContractAddress: "0x0000000000000000000000000000000000000000000000000000000000000000",
554
+ PermitVariant: permitutils_1.PermitVariant.Unsupported,
555
+ TokenDecimals: 18,
556
+ IsGasToken: true,
557
+ },
558
+ ],
559
+ },
539
560
  {
540
561
  Universe: 3,
541
562
  ChainID32: "0x0000000000000000000000000000000000000000000000000000000094a9059e",
@@ -578,17 +599,32 @@ const RawData = [
578
599
  },
579
600
  {
580
601
  Universe: 0,
581
- ChainID32: "0x0000000000000000000000000000000000000000000000000000000000000237",
602
+ ChainID32: "0x00000000000000000000000000000000000000000000000000000000000010e6",
603
+ Currencies: [
604
+ {
605
+ CurrencyID: 3,
606
+ TokenContractAddress: "0x0000000000000000000000000000000000000000000000000000000000000000",
607
+ PermitVariant: permitutils_1.PermitVariant.Unsupported,
608
+ TokenDecimals: 18,
609
+ IsGasToken: true,
610
+ },
611
+ ],
612
+ },
613
+ // Citrea Testnet
614
+ {
615
+ Universe: 0,
616
+ ChainID32: "0x00000000000000000000000000000000000000000000000000000000000013fb",
582
617
  Currencies: [
583
618
  {
584
619
  CurrencyID: 1,
585
- TokenContractAddress: "0x0000000000000000000000008Cf5f629Bb26FC3F92144e72bC4A3719A7DF07F3",
620
+ TokenContractAddress: "0x000000000000000000000000b669dC8cC6D044307Ba45366C0c836eC3c7e31AA",
586
621
  PermitVariant: permitutils_1.PermitVariant.EIP2612Canonical,
622
+ PermitContractVersion: 2,
587
623
  TokenDecimals: 6,
588
624
  IsGasToken: false,
589
625
  },
590
626
  {
591
- CurrencyID: 64,
627
+ CurrencyID: 21,
592
628
  TokenContractAddress: "0x0000000000000000000000000000000000000000000000000000000000000000",
593
629
  PermitVariant: permitutils_1.PermitVariant.Unsupported,
594
630
  TokenDecimals: 18,
@@ -626,79 +662,76 @@ exports.ChaindataMap = new chainid_1.ChainIDKeyedMap(exports.Chaindata.map((ch)
626
662
  exports.RPCURLMap = new chainid_1.ChainIDKeyedMap([
627
663
  [
628
664
  new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 421614),
629
- "https://arb-sepolia.g.alchemy.com/v2/PfaswrKq0rjOrfYWHfE9uLQKhiD4JCdq",
665
+ "https://rpcs.avail.so/arbitrumsepolia",
630
666
  ],
631
667
  [
632
668
  new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 11155420),
633
- "https://opt-sepolia.g.alchemy.com/v2/PfaswrKq0rjOrfYWHfE9uLQKhiD4JCdq",
669
+ "https://rpcs.avail.so/optimismsepolia",
634
670
  ],
635
671
  [
636
672
  new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 80002),
637
- "https://polygon-amoy.g.alchemy.com/v2/PfaswrKq0rjOrfYWHfE9uLQKhiD4JCdq",
673
+ "https://rpcs.avail.so/polygonamoy",
638
674
  ],
639
675
  [
640
676
  new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 84532),
641
- "https://base-sepolia.g.alchemy.com/v2/PfaswrKq0rjOrfYWHfE9uLQKhiD4JCdq",
677
+ "https://rpcs.avail.so/basesepolia",
642
678
  ],
643
679
  [
644
680
  new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 11155111),
645
- "https://eth-sepolia.g.alchemy.com/v2/PfaswrKq0rjOrfYWHfE9uLQKhiD4JCdq",
681
+ "https://rpcs.avail.so/sepolia",
646
682
  ],
647
683
  [
648
684
  new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 137),
649
- "https://polygon-mainnet.g.alchemy.com/v2/PfaswrKq0rjOrfYWHfE9uLQKhiD4JCdq",
685
+ "https://rpcs.avail.so/polygon",
650
686
  ],
651
687
  [
652
688
  new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 42161),
653
- "https://arb-mainnet.g.alchemy.com/v2/PfaswrKq0rjOrfYWHfE9uLQKhiD4JCdq",
689
+ "https://rpcs.avail.so/arbitrum",
654
690
  ],
655
691
  [
656
692
  new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 10),
657
- "https://opt-mainnet.g.alchemy.com/v2/PfaswrKq0rjOrfYWHfE9uLQKhiD4JCdq",
693
+ "https://rpcs.avail.so/optimism",
658
694
  ],
659
695
  [
660
696
  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",
697
+ "https://rpcs.avail.so/base",
666
698
  ],
699
+ [new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 1), "https://rpcs.avail.so/eth"],
667
700
  [
668
701
  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",
702
+ "https://rpcs.avail.so/scroll",
674
703
  ],
675
704
  [
676
705
  new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 43114),
677
- "https://avax-mainnet.g.alchemy.com/v2/PfaswrKq0rjOrfYWHfE9uLQKhiD4JCdq",
706
+ "https://rpcs.avail.so/avalanche",
678
707
  ],
679
708
  [
680
709
  new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 999),
681
- "https://rpc.hyperliquid.xyz/evm",
682
- ], // Alchemy doesn't support this.
710
+ "https://rpcs.avail.so/hyperevm",
711
+ ],
683
712
  [
684
713
  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.
714
+ "https://rpcs.avail.so/kaia",
715
+ ],
688
716
  [
689
- new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 56),
690
- "https://bnb-mainnet.g.alchemy.com/v2/PfaswrKq0rjOrfYWHfE9uLQKhiD4JCdq",
717
+ new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 50104),
718
+ "https://sophon.gateway.tenderly.co/1d4STFT7zmG0vM5QowibCw",
691
719
  ],
720
+ [new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 56), "https://rpcs.avail.so/bsc"],
692
721
  [
693
722
  new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 10143),
694
- "https://lb.drpc.org/monad-testnet/Am5nENoJmEuovqui8_LMxzp4ChJzW7kR8JfPrqRhf0fE",
723
+ "https://rpcs.avail.so/monadtestnet",
724
+ ],
725
+ [
726
+ new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 143),
727
+ "https://rpcs.avail.so/monad",
695
728
  ],
696
729
  [
697
- new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 567),
698
- "https://testnet.l2.rpc.validium.network",
730
+ new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 4326),
731
+ "https://rpcs.avail.so/megeth",
699
732
  ],
700
733
  [
701
- new chainid_1.OmniversalChainID(definition_1.Universe.FUEL, 9889),
702
- "https://omniscient-fittest-pallet.fuel-mainnet.quiknode.pro/3193ae52f2522af1a4357a482e475e019857f02b/v1/graphql",
734
+ new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 5115),
735
+ "https://rpcs.avail.so/citrea-testnet",
703
736
  ],
704
737
  ]);
@@ -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;