@avail-project/ca-common 1.0.0-beta.1 → 1.0.0-beta.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/_polyfill.js +147 -0
- package/dist/cjs/data/chaindata.js +131 -28
- package/dist/cjs/data/chainid.js +4 -2
- package/dist/cjs/data/currency.js +1 -0
- package/dist/cjs/index.js +4 -4
- package/dist/cjs/proto/client.js +48 -0
- package/dist/cjs/proto/definition.js +167 -448
- package/dist/cjs/proto/grpc.js +4 -9
- package/dist/cjs/rff/rff.js +0 -35
- package/dist/cjs/vaultcontracts/vaultcontracts.js +100 -31
- package/dist/cjs/xcs/autochoice.js +255 -0
- package/dist/esm/_polyfill.js +143 -0
- package/dist/esm/data/chaindata.js +131 -28
- package/dist/esm/data/chainid.js +4 -2
- package/dist/esm/data/currency.js +1 -0
- package/dist/esm/index.js +13 -12
- package/dist/esm/proto/client.js +11 -0
- package/dist/esm/proto/definition.js +167 -448
- package/dist/esm/proto/grpc.js +4 -9
- package/dist/esm/rff/rff.js +0 -35
- package/dist/esm/vaultcontracts/vaultcontracts.js +100 -31
- package/dist/esm/xcs/autochoice.js +254 -0
- package/dist/types/_polyfill.d.ts +1 -0
- package/dist/types/data/currency.d.ts +2 -1
- package/dist/types/index.d.ts +13 -12
- package/dist/types/proto/client.d.ts +2 -0
- package/dist/types/rff/rff.d.ts +0 -3
- package/dist/types/xcs/autochoice.d.ts +17 -0
- package/package.json +16 -10
- package/dist/cjs/fuelcontracts/ArcanaVault.js +0 -2407
- package/dist/cjs/fuelcontracts/ArcanaVaultFactory.js +0 -18
- package/dist/cjs/fuelcontracts/common.js +0 -3
- package/dist/cjs/fuelcontracts/index.js +0 -5
- package/dist/cjs/rff/fuel.js +0 -27
- package/dist/esm/fuelcontracts/ArcanaVault.js +0 -2402
- package/dist/esm/fuelcontracts/ArcanaVaultFactory.js +0 -14
- package/dist/esm/fuelcontracts/common.js +0 -2
- package/dist/esm/fuelcontracts/index.js +0 -2
- package/dist/esm/rff/fuel.js +0 -23
- package/dist/types/fuelcontracts/ArcanaVault.d.ts +0 -448
- package/dist/types/fuelcontracts/ArcanaVaultFactory.d.ts +0 -8
- package/dist/types/fuelcontracts/common.d.ts +0 -23
- package/dist/types/fuelcontracts/index.d.ts +0 -2
- 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",
|
|
@@ -576,6 +597,80 @@ const RawData = [
|
|
|
576
597
|
},
|
|
577
598
|
],
|
|
578
599
|
},
|
|
600
|
+
//megaeth mainnet
|
|
601
|
+
{
|
|
602
|
+
Universe: 0,
|
|
603
|
+
ChainID32: "0x00000000000000000000000000000000000000000000000000000000000010e6",
|
|
604
|
+
Currencies: [
|
|
605
|
+
{
|
|
606
|
+
CurrencyID: 1,
|
|
607
|
+
TokenContractAddress: "0x000000000000000000000000590cb8868c6DeBc12CCd42E837042659cfB91504",
|
|
608
|
+
PermitVariant: permitutils_1.PermitVariant.EIP2612Canonical,
|
|
609
|
+
PermitContractVersion: 2,
|
|
610
|
+
TokenDecimals: 6,
|
|
611
|
+
IsGasToken: false,
|
|
612
|
+
},
|
|
613
|
+
{
|
|
614
|
+
CurrencyID: 3,
|
|
615
|
+
TokenContractAddress: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
616
|
+
PermitVariant: permitutils_1.PermitVariant.Unsupported,
|
|
617
|
+
TokenDecimals: 18,
|
|
618
|
+
IsGasToken: true,
|
|
619
|
+
},
|
|
620
|
+
],
|
|
621
|
+
},
|
|
622
|
+
//citrea mainnet
|
|
623
|
+
{
|
|
624
|
+
Universe: 0,
|
|
625
|
+
ChainID32: "0x0000000000000000000000000000000000000000000000000000000000001012",
|
|
626
|
+
Currencies: [
|
|
627
|
+
{
|
|
628
|
+
CurrencyID: 1,
|
|
629
|
+
TokenContractAddress: "0x000000000000000000000000E045e6c36cF77FAA2CfB54466D71A3aEF7bbE839",
|
|
630
|
+
PermitVariant: permitutils_1.PermitVariant.EIP2612Canonical,
|
|
631
|
+
PermitContractVersion: 2,
|
|
632
|
+
TokenDecimals: 6,
|
|
633
|
+
IsGasToken: false,
|
|
634
|
+
},
|
|
635
|
+
{
|
|
636
|
+
CurrencyID: 2,
|
|
637
|
+
PermitVariant: permitutils_1.PermitVariant.EIP2612Canonical,
|
|
638
|
+
PermitContractVersion: 1,
|
|
639
|
+
TokenContractAddress: "0x0000000000000000000000009f3096Bac87e7F03DC09b0B416eB0DF837304dc4",
|
|
640
|
+
TokenDecimals: 6,
|
|
641
|
+
IsGasToken: false,
|
|
642
|
+
},
|
|
643
|
+
{
|
|
644
|
+
CurrencyID: 21,
|
|
645
|
+
TokenContractAddress: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
646
|
+
PermitVariant: permitutils_1.PermitVariant.Unsupported,
|
|
647
|
+
TokenDecimals: 18,
|
|
648
|
+
IsGasToken: true,
|
|
649
|
+
},
|
|
650
|
+
],
|
|
651
|
+
},
|
|
652
|
+
// Citrea Testnet
|
|
653
|
+
{
|
|
654
|
+
Universe: 0,
|
|
655
|
+
ChainID32: "0x00000000000000000000000000000000000000000000000000000000000013fb",
|
|
656
|
+
Currencies: [
|
|
657
|
+
{
|
|
658
|
+
CurrencyID: 1,
|
|
659
|
+
TokenContractAddress: "0x000000000000000000000000b669dC8cC6D044307Ba45366C0c836eC3c7e31AA",
|
|
660
|
+
PermitVariant: permitutils_1.PermitVariant.EIP2612Canonical,
|
|
661
|
+
PermitContractVersion: 2,
|
|
662
|
+
TokenDecimals: 6,
|
|
663
|
+
IsGasToken: false,
|
|
664
|
+
},
|
|
665
|
+
{
|
|
666
|
+
CurrencyID: 21,
|
|
667
|
+
TokenContractAddress: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
668
|
+
PermitVariant: permitutils_1.PermitVariant.Unsupported,
|
|
669
|
+
TokenDecimals: 18,
|
|
670
|
+
IsGasToken: true,
|
|
671
|
+
},
|
|
672
|
+
],
|
|
673
|
+
},
|
|
579
674
|
];
|
|
580
675
|
class CurrencyMap {
|
|
581
676
|
map = new Map();
|
|
@@ -606,75 +701,83 @@ exports.ChaindataMap = new chainid_1.ChainIDKeyedMap(exports.Chaindata.map((ch)
|
|
|
606
701
|
exports.RPCURLMap = new chainid_1.ChainIDKeyedMap([
|
|
607
702
|
[
|
|
608
703
|
new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 421614),
|
|
609
|
-
"https://
|
|
704
|
+
"https://rpcs.avail.so/arbitrumsepolia",
|
|
610
705
|
],
|
|
611
706
|
[
|
|
612
707
|
new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 11155420),
|
|
613
|
-
"https://
|
|
708
|
+
"https://rpcs.avail.so/optimismsepolia",
|
|
614
709
|
],
|
|
615
710
|
[
|
|
616
711
|
new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 80002),
|
|
617
|
-
"https://
|
|
712
|
+
"https://rpcs.avail.so/polygonamoy",
|
|
618
713
|
],
|
|
619
714
|
[
|
|
620
715
|
new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 84532),
|
|
621
|
-
"https://
|
|
716
|
+
"https://rpcs.avail.so/basesepolia",
|
|
622
717
|
],
|
|
623
718
|
[
|
|
624
719
|
new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 11155111),
|
|
625
|
-
"https://
|
|
720
|
+
"https://rpcs.avail.so/sepolia",
|
|
626
721
|
],
|
|
627
722
|
[
|
|
628
723
|
new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 137),
|
|
629
|
-
"https://
|
|
724
|
+
"https://rpcs.avail.so/polygon",
|
|
630
725
|
],
|
|
631
726
|
[
|
|
632
727
|
new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 42161),
|
|
633
|
-
"https://
|
|
728
|
+
"https://rpcs.avail.so/arbitrum",
|
|
634
729
|
],
|
|
635
730
|
[
|
|
636
731
|
new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 10),
|
|
637
|
-
"https://
|
|
732
|
+
"https://rpcs.avail.so/optimism",
|
|
638
733
|
],
|
|
639
734
|
[
|
|
640
735
|
new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 8453),
|
|
641
|
-
"https://
|
|
642
|
-
],
|
|
643
|
-
[
|
|
644
|
-
new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 1),
|
|
645
|
-
"https://eth-mainnet.g.alchemy.com/v2/PfaswrKq0rjOrfYWHfE9uLQKhiD4JCdq",
|
|
736
|
+
"https://rpcs.avail.so/base",
|
|
646
737
|
],
|
|
738
|
+
[new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 1), "https://rpcs.avail.so/eth"],
|
|
647
739
|
[
|
|
648
740
|
new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 534352),
|
|
649
|
-
"https://
|
|
650
|
-
],
|
|
651
|
-
[
|
|
652
|
-
new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 59144),
|
|
653
|
-
"https://linea-mainnet.g.alchemy.com/v2/PfaswrKq0rjOrfYWHfE9uLQKhiD4JCdq",
|
|
741
|
+
"https://rpcs.avail.so/scroll",
|
|
654
742
|
],
|
|
655
743
|
[
|
|
656
744
|
new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 43114),
|
|
657
|
-
"https://
|
|
745
|
+
"https://rpcs.avail.so/avalanche",
|
|
658
746
|
],
|
|
659
747
|
[
|
|
660
748
|
new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 999),
|
|
661
|
-
"https://
|
|
662
|
-
],
|
|
749
|
+
"https://rpcs.avail.so/hyperevm",
|
|
750
|
+
],
|
|
663
751
|
[
|
|
664
752
|
new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 8217),
|
|
665
|
-
"https://
|
|
666
|
-
],
|
|
667
|
-
[
|
|
753
|
+
"https://rpcs.avail.so/kaia",
|
|
754
|
+
],
|
|
755
|
+
[
|
|
756
|
+
new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 50104),
|
|
757
|
+
"https://sophon.gateway.tenderly.co/1d4STFT7zmG0vM5QowibCw",
|
|
758
|
+
],
|
|
668
759
|
[
|
|
669
760
|
new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 56),
|
|
670
|
-
"https://
|
|
761
|
+
"https://rpcs.avail.so/bsc",
|
|
671
762
|
],
|
|
672
763
|
[
|
|
673
764
|
new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 10143),
|
|
674
|
-
"https://
|
|
765
|
+
"https://rpcs.avail.so/monadtestnet",
|
|
766
|
+
],
|
|
767
|
+
[
|
|
768
|
+
new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 143),
|
|
769
|
+
"https://rpcs.avail.so/monad",
|
|
770
|
+
],
|
|
771
|
+
[
|
|
772
|
+
new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 4326),
|
|
773
|
+
"https://rpcs.avail.so/megaeth",
|
|
774
|
+
],
|
|
775
|
+
[
|
|
776
|
+
new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 4114),
|
|
777
|
+
"https://rpcs.avail.so/citrea",
|
|
675
778
|
],
|
|
676
779
|
[
|
|
677
|
-
new chainid_1.OmniversalChainID(definition_1.Universe.
|
|
678
|
-
"https://
|
|
780
|
+
new chainid_1.OmniversalChainID(definition_1.Universe.ETHEREUM, 5115),
|
|
781
|
+
"https://rpcs.avail.so/citrea-testnet",
|
|
679
782
|
],
|
|
680
783
|
]);
|
package/dist/cjs/data/chainid.js
CHANGED
|
@@ -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.
|
|
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.
|
|
54
|
+
const univID = input.readUInt32BE(0);
|
|
53
55
|
const rest = input.subarray(4);
|
|
54
56
|
return new OmniversalChainID(univID, rest);
|
|
55
57
|
}
|
|
@@ -18,6 +18,7 @@ var CurrencyID;
|
|
|
18
18
|
CurrencyID[CurrencyID["SOPH"] = 18] = "SOPH";
|
|
19
19
|
CurrencyID[CurrencyID["TRX"] = 19] = "TRX";
|
|
20
20
|
CurrencyID[CurrencyID["MON"] = 20] = "MON";
|
|
21
|
+
CurrencyID[CurrencyID["CBTC"] = 21] = "CBTC";
|
|
21
22
|
})(CurrencyID || (exports.CurrencyID = CurrencyID = {}));
|
|
22
23
|
class Currency {
|
|
23
24
|
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.
|
|
3
|
+
exports.createGrpcWebImpl = exports.GrpcWebImpl = exports.GrpcWebError = exports.QueryClientImpl = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
|
|
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;
|