@gardenfi/swap 0.0.2-beta.2 → 0.0.2-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.
- package/dist/index104.cjs +1 -1
- package/dist/index104.js +4 -4
- package/dist/index106.cjs +1 -1
- package/dist/index106.js +3 -3
- package/dist/index107.cjs +1 -1
- package/dist/index107.js +3 -3
- package/dist/index116.cjs +1 -1
- package/dist/index116.js +1 -1
- package/dist/index117.cjs +1 -1
- package/dist/index117.js +1 -1
- package/dist/index12.cjs +1 -1
- package/dist/index12.js +12 -12
- package/dist/index120.cjs +1 -1
- package/dist/index120.js +2 -2
- package/dist/index121.cjs +1 -1
- package/dist/index121.js +7 -7
- package/dist/index132.cjs +1 -1
- package/dist/index132.js +1 -1
- package/dist/index133.cjs +1 -1
- package/dist/index133.js +1 -1
- package/dist/index134.cjs +1 -1
- package/dist/index134.js +1 -1
- package/dist/index135.cjs +1 -1
- package/dist/index135.js +1 -1
- package/dist/index138.cjs +1 -1
- package/dist/index138.js +2 -2
- package/dist/index161.cjs +1 -1
- package/dist/index161.js +2 -2
- package/dist/index167.cjs +1 -1
- package/dist/index167.js +1 -1
- package/dist/index168.cjs +1 -1
- package/dist/index168.js +2 -2
- package/dist/index169.cjs +1 -1
- package/dist/index169.js +2 -2
- package/dist/index170.cjs +1 -1
- package/dist/index170.js +2 -2
- package/dist/index171.cjs +1 -1
- package/dist/index171.js +2 -2
- package/dist/index172.cjs +1 -1
- package/dist/index172.js +2 -2
- package/dist/index272.cjs +1 -1
- package/dist/index272.js +9 -174
- package/dist/index273.cjs +1 -2
- package/dist/index273.js +30 -91
- package/dist/index274.cjs +1 -1
- package/dist/index274.js +2 -41
- package/dist/index275.cjs +1 -1
- package/dist/index275.js +47 -4
- package/dist/index276.cjs +1 -1
- package/dist/index276.js +11 -9
- package/dist/index277.cjs +1 -1
- package/dist/index277.js +174 -30
- package/dist/index278.cjs +2 -1
- package/dist/index278.js +92 -2
- package/dist/index279.cjs +1 -1
- package/dist/index279.js +38 -45
- package/dist/index280.cjs +1 -1
- package/dist/index280.js +4 -11
- package/dist/index281.cjs +1 -1
- package/dist/index281.js +3 -3
- package/dist/index283.cjs +1 -2
- package/dist/index283.js +42 -41
- package/dist/index284.cjs +1 -1
- package/dist/index284.js +321 -2
- package/dist/index285.cjs +1 -1
- package/dist/index285.js +605 -5
- package/dist/index286.cjs +1 -1
- package/dist/index286.js +109 -10
- package/dist/index287.cjs +1 -1
- package/dist/index287.js +167 -19
- package/dist/index288.cjs +1 -1
- package/dist/index288.js +301 -8
- package/dist/index289.cjs +1 -1
- package/dist/index289.js +93 -72
- package/dist/index290.cjs +1 -1
- package/dist/index290.js +54 -63
- package/dist/index291.cjs +1 -1
- package/dist/index291.js +51 -186
- package/dist/index292.cjs +1 -1
- package/dist/index292.js +42 -20
- package/dist/index293.cjs +1 -1
- package/dist/index293.js +14 -41
- package/dist/index294.cjs +1 -1
- package/dist/index294.js +315 -23
- package/dist/index295.cjs +1 -1
- package/dist/index295.js +57 -88
- package/dist/index296.cjs +1 -1
- package/dist/index296.js +19 -40
- package/dist/index297.cjs +1 -1
- package/dist/index297.js +28 -15
- package/dist/index298.cjs +1 -1
- package/dist/index298.js +3 -13
- package/dist/index299.cjs +7 -1
- package/dist/index299.js +237 -7
- package/dist/index300.cjs +1 -1
- package/dist/index300.js +48 -38
- package/dist/index301.cjs +1 -1
- package/dist/index301.js +211 -14
- package/dist/index302.cjs +1 -1
- package/dist/index302.js +77 -38
- package/dist/index303.cjs +1 -1
- package/dist/index303.js +25 -316
- package/dist/index304.cjs +1 -1
- package/dist/index304.js +73 -602
- package/dist/index305.cjs +2 -1
- package/dist/index305.js +41 -109
- package/dist/index306.cjs +1 -1
- package/dist/index306.js +2 -168
- package/dist/index307.cjs +1 -1
- package/dist/index307.js +5 -301
- package/dist/index308.cjs +1 -1
- package/dist/index308.js +10 -93
- package/dist/index309.cjs +1 -1
- package/dist/index309.js +18 -55
- package/dist/index310.cjs +1 -1
- package/dist/index310.js +8 -53
- package/dist/index311.cjs +1 -1
- package/dist/index311.js +72 -44
- package/dist/index312.cjs +1 -1
- package/dist/index312.js +64 -14
- package/dist/index313.cjs +1 -1
- package/dist/index313.js +184 -313
- package/dist/index314.cjs +1 -1
- package/dist/index314.js +19 -56
- package/dist/index315.cjs +1 -1
- package/dist/index315.js +42 -19
- package/dist/index316.cjs +1 -1
- package/dist/index316.js +23 -27
- package/dist/index317.cjs +1 -1
- package/dist/index317.js +90 -3
- package/dist/index318.cjs +1 -7
- package/dist/index318.js +33 -230
- package/dist/index319.cjs +1 -1
- package/dist/index319.js +17 -48
- package/dist/index320.cjs +1 -1
- package/dist/index320.js +11 -210
- package/dist/index321.cjs +1 -1
- package/dist/index321.js +7 -81
- package/dist/index322.cjs +1 -1
- package/dist/index322.js +36 -28
- package/dist/index323.cjs +1 -1
- package/dist/index323.js +15 -76
- package/dist/index326.cjs +1 -1
- package/dist/index326.js +1 -1
- package/dist/index327.cjs +1 -1
- package/dist/index327.js +1 -1
- package/dist/index333.cjs +1 -1
- package/dist/index333.js +2 -2
- package/dist/index334.cjs +1 -1
- package/dist/index334.js +2 -2
- package/dist/index340.cjs +1 -1
- package/dist/index340.js +1 -1
- package/dist/index341.cjs +1 -1
- package/dist/index341.js +1 -1
- package/dist/index343.cjs +1 -1
- package/dist/index343.js +1 -1
- package/dist/index346.cjs +1 -1
- package/dist/index346.js +1 -1
- package/dist/index347.cjs +1 -1
- package/dist/index347.js +1 -1
- package/dist/index348.cjs +1 -1
- package/dist/index348.js +3 -3
- package/dist/index349.cjs +1 -2
- package/dist/index349.js +4 -193
- package/dist/index350.cjs +2 -1
- package/dist/index350.js +168 -52
- package/dist/index351.cjs +1 -1
- package/dist/index351.js +65 -331
- package/dist/index352.cjs +1 -1
- package/dist/index352.js +332 -149
- package/dist/index353.cjs +1 -1
- package/dist/index353.js +161 -5
- package/dist/index354.cjs +1 -1
- package/dist/index354.js +5 -5
- package/dist/index357.cjs +1 -1
- package/dist/index357.js +8 -205
- package/dist/index359.cjs +1 -1
- package/dist/index359.js +205 -8
- package/dist/index360.cjs +1 -1
- package/dist/index360.js +94 -68
- package/dist/index361.cjs +1 -1
- package/dist/index361.js +28 -94
- package/dist/index362.cjs +1 -1
- package/dist/index362.js +147 -27
- package/dist/index363.cjs +1 -1
- package/dist/index363.js +324 -118
- package/dist/index364.cjs +1 -1
- package/dist/index364.js +72 -353
- package/dist/index365.cjs +1 -1
- package/dist/index365.js +29 -71
- package/dist/index366.cjs +1 -1
- package/dist/index366.js +5 -31
- package/dist/index367.cjs +1 -1
- package/dist/index367.js +275 -5
- package/dist/index368.cjs +1 -1
- package/dist/index368.js +171 -4
- package/dist/index369.cjs +1 -1
- package/dist/index369.js +10 -141
- package/dist/index370.cjs +1 -1
- package/dist/index370.js +105 -273
- package/dist/index371.cjs +1 -1
- package/dist/index371.js +10 -171
- package/dist/index372.cjs +1 -1
- package/dist/index372.js +69 -10
- package/dist/index373.cjs +1 -1
- package/dist/index373.js +3 -107
- package/dist/index374.cjs +1 -1
- package/dist/index374.js +140 -9
- package/dist/index375.cjs +1 -1
- package/dist/index375.js +4 -4
- package/dist/index376.cjs +1 -1
- package/dist/index376.js +2 -79
- package/dist/index377.cjs +1 -1
- package/dist/index377.js +79 -2
- package/dist/index379.cjs +1 -1
- package/dist/index379.js +1 -1
- package/dist/index380.cjs +1 -1
- package/dist/index380.js +1 -1
- package/dist/index381.cjs +1 -1
- package/dist/index381.js +2 -22
- package/dist/index382.cjs +1 -1
- package/dist/index382.js +22 -2
- package/dist/index385.cjs +1 -1
- package/dist/index385.js +2 -2
- package/dist/index77.cjs +1 -1
- package/dist/index77.js +13 -13
- package/dist/index99.cjs +1 -1
- package/dist/index99.js +1 -1
- package/dist/src/lib/store/swapStore.d.ts +1 -1
- package/package.json +5 -5
package/dist/index313.js
CHANGED
|
@@ -1,320 +1,191 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
if (!e)
|
|
24
|
-
throw new Error("Unable to deserialize from bytes.");
|
|
25
|
-
return m.restore({
|
|
26
|
-
version: 2,
|
|
27
|
-
sender: null,
|
|
28
|
-
expiration: null,
|
|
29
|
-
gasData: {
|
|
30
|
-
budget: null,
|
|
31
|
-
owner: null,
|
|
32
|
-
payment: null,
|
|
33
|
-
price: null
|
|
34
|
-
},
|
|
35
|
-
inputs: e.inputs,
|
|
36
|
-
commands: e.commands
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
static fromBytes(t) {
|
|
40
|
-
const s = b.TransactionData.parse(t), e = s == null ? void 0 : s.V1, i = e.kind.ProgrammableTransaction;
|
|
41
|
-
if (!e || !i)
|
|
42
|
-
throw new Error("Unable to deserialize from bytes.");
|
|
43
|
-
return m.restore({
|
|
44
|
-
version: 2,
|
|
45
|
-
sender: e.sender,
|
|
46
|
-
expiration: e.expiration,
|
|
47
|
-
gasData: e.gasData,
|
|
48
|
-
inputs: i.inputs,
|
|
49
|
-
commands: i.commands
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
static restore(t) {
|
|
53
|
-
return t.version === 2 ? new m(h(f, t)) : new m(h(f, y(t)));
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Generate transaction digest.
|
|
57
|
-
*
|
|
58
|
-
* @param bytes BCS serialized transaction data
|
|
59
|
-
* @returns transaction digest.
|
|
60
|
-
*/
|
|
61
|
-
static getDigestFromBytes(t) {
|
|
62
|
-
const s = $("TransactionData", t);
|
|
63
|
-
return j(s);
|
|
64
|
-
}
|
|
65
|
-
// @deprecated use gasData instead
|
|
66
|
-
get gasConfig() {
|
|
67
|
-
return this.gasData;
|
|
68
|
-
}
|
|
69
|
-
// @deprecated use gasData instead
|
|
70
|
-
set gasConfig(t) {
|
|
71
|
-
this.gasData = t;
|
|
72
|
-
}
|
|
73
|
-
build({
|
|
74
|
-
maxSizeBytes: t = 1 / 0,
|
|
75
|
-
overrides: s,
|
|
76
|
-
onlyTransactionKind: e
|
|
77
|
-
} = {}) {
|
|
78
|
-
const i = this.inputs, n = this.commands, r = {
|
|
79
|
-
ProgrammableTransaction: {
|
|
80
|
-
inputs: i,
|
|
81
|
-
commands: n
|
|
82
|
-
}
|
|
1
|
+
import { execTyped as E, bytesRegex as x, integerRegex as $, isTupleRegex as P } from "./index310.js";
|
|
2
|
+
import { UnknownSolidityTypeError as M } from "./index315.js";
|
|
3
|
+
import { InvalidParameterError as R, SolidityProtectedKeywordError as k, InvalidModifierError as z, InvalidFunctionModifierError as A } from "./index317.js";
|
|
4
|
+
import { UnknownSignatureError as F, InvalidSignatureError as m } from "./index318.js";
|
|
5
|
+
import { InvalidParenthesisError as T } from "./index319.js";
|
|
6
|
+
import { getParameterCacheKey as _, parameterCache as p } from "./index372.js";
|
|
7
|
+
import { isFunctionSignature as C, isEventSignature as I, isErrorSignature as Z, isConstructorSignature as K, isFallbackSignature as L, isReceiveSignature as U, functionModifiers as h, execFunctionSignature as W, execEventSignature as D, eventModifiers as V, execErrorSignature as j, execConstructorSignature as q, execFallbackSignature as B } from "./index311.js";
|
|
8
|
+
function le(e, t = {}) {
|
|
9
|
+
if (C(e))
|
|
10
|
+
return G(e, t);
|
|
11
|
+
if (I(e))
|
|
12
|
+
return H(e, t);
|
|
13
|
+
if (Z(e))
|
|
14
|
+
return J(e, t);
|
|
15
|
+
if (K(e))
|
|
16
|
+
return N(e, t);
|
|
17
|
+
if (L(e))
|
|
18
|
+
return O(e);
|
|
19
|
+
if (U(e))
|
|
20
|
+
return {
|
|
21
|
+
type: "receive",
|
|
22
|
+
stateMutability: "payable"
|
|
83
23
|
};
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
24
|
+
throw new F({ signature: e });
|
|
25
|
+
}
|
|
26
|
+
function G(e, t = {}) {
|
|
27
|
+
const n = W(e);
|
|
28
|
+
if (!n)
|
|
29
|
+
throw new m({ signature: e, type: "function" });
|
|
30
|
+
const a = u(n.parameters), r = [], c = a.length;
|
|
31
|
+
for (let o = 0; o < c; o++)
|
|
32
|
+
r.push(l(a[o], {
|
|
33
|
+
modifiers: h,
|
|
34
|
+
structs: t,
|
|
35
|
+
type: "function"
|
|
36
|
+
}));
|
|
37
|
+
const i = [];
|
|
38
|
+
if (n.returns) {
|
|
39
|
+
const o = u(n.returns), s = o.length;
|
|
40
|
+
for (let f = 0; f < s; f++)
|
|
41
|
+
i.push(l(o[f], {
|
|
42
|
+
modifiers: h,
|
|
43
|
+
structs: t,
|
|
44
|
+
type: "function"
|
|
45
|
+
}));
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
name: n.name,
|
|
49
|
+
type: "function",
|
|
50
|
+
stateMutability: n.stateMutability ?? "nonpayable",
|
|
51
|
+
inputs: r,
|
|
52
|
+
outputs: i
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function H(e, t = {}) {
|
|
56
|
+
const n = D(e);
|
|
57
|
+
if (!n)
|
|
58
|
+
throw new m({ signature: e, type: "event" });
|
|
59
|
+
const a = u(n.parameters), r = [], c = a.length;
|
|
60
|
+
for (let i = 0; i < c; i++)
|
|
61
|
+
r.push(l(a[i], {
|
|
62
|
+
modifiers: V,
|
|
63
|
+
structs: t,
|
|
64
|
+
type: "event"
|
|
65
|
+
}));
|
|
66
|
+
return { name: n.name, type: "event", inputs: r };
|
|
67
|
+
}
|
|
68
|
+
function J(e, t = {}) {
|
|
69
|
+
const n = j(e);
|
|
70
|
+
if (!n)
|
|
71
|
+
throw new m({ signature: e, type: "error" });
|
|
72
|
+
const a = u(n.parameters), r = [], c = a.length;
|
|
73
|
+
for (let i = 0; i < c; i++)
|
|
74
|
+
r.push(l(a[i], { structs: t, type: "error" }));
|
|
75
|
+
return { name: n.name, type: "error", inputs: r };
|
|
76
|
+
}
|
|
77
|
+
function N(e, t = {}) {
|
|
78
|
+
const n = q(e);
|
|
79
|
+
if (!n)
|
|
80
|
+
throw new m({ signature: e, type: "constructor" });
|
|
81
|
+
const a = u(n.parameters), r = [], c = a.length;
|
|
82
|
+
for (let i = 0; i < c; i++)
|
|
83
|
+
r.push(l(a[i], { structs: t, type: "constructor" }));
|
|
84
|
+
return {
|
|
85
|
+
type: "constructor",
|
|
86
|
+
stateMutability: n.stateMutability ?? "nonpayable",
|
|
87
|
+
inputs: r
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
function O(e) {
|
|
91
|
+
const t = B(e);
|
|
92
|
+
if (!t)
|
|
93
|
+
throw new m({ signature: e, type: "fallback" });
|
|
94
|
+
return {
|
|
95
|
+
type: "fallback",
|
|
96
|
+
stateMutability: t.stateMutability ?? "nonpayable"
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
const Q = /^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*(?:\spayable)?)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/, X = /^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/, Y = /^u?int$/;
|
|
100
|
+
function l(e, t) {
|
|
101
|
+
var y, b;
|
|
102
|
+
const n = _(e, t == null ? void 0 : t.type, t == null ? void 0 : t.structs);
|
|
103
|
+
if (p.has(n))
|
|
104
|
+
return p.get(n);
|
|
105
|
+
const a = P.test(e), r = E(a ? X : Q, e);
|
|
106
|
+
if (!r)
|
|
107
|
+
throw new R({ param: e });
|
|
108
|
+
if (r.name && re(r.name))
|
|
109
|
+
throw new k({ param: e, name: r.name });
|
|
110
|
+
const c = r.name ? { name: r.name } : {}, i = r.modifier === "indexed" ? { indexed: !0 } : {}, o = (t == null ? void 0 : t.structs) ?? {};
|
|
111
|
+
let s, f = {};
|
|
112
|
+
if (a) {
|
|
113
|
+
s = "tuple";
|
|
114
|
+
const w = u(r.type), S = [], v = w.length;
|
|
115
|
+
for (let d = 0; d < v; d++)
|
|
116
|
+
S.push(l(w[d], { structs: o }));
|
|
117
|
+
f = { components: S };
|
|
118
|
+
} else if (r.type in o)
|
|
119
|
+
s = "tuple", f = { components: o[r.type] };
|
|
120
|
+
else if (Y.test(r.type))
|
|
121
|
+
s = `${r.type}256`;
|
|
122
|
+
else if (r.type === "address payable")
|
|
123
|
+
s = "address";
|
|
124
|
+
else if (s = r.type, (t == null ? void 0 : t.type) !== "struct" && !ee(s))
|
|
125
|
+
throw new M({ type: s });
|
|
126
|
+
if (r.modifier) {
|
|
127
|
+
if (!((b = (y = t == null ? void 0 : t.modifiers) == null ? void 0 : y.has) != null && b.call(y, r.modifier)))
|
|
128
|
+
throw new z({
|
|
129
|
+
param: e,
|
|
130
|
+
type: t == null ? void 0 : t.type,
|
|
131
|
+
modifier: r.modifier
|
|
132
|
+
});
|
|
133
|
+
if (h.has(r.modifier) && !ne(s, !!r.array))
|
|
134
|
+
throw new A({
|
|
135
|
+
param: e,
|
|
136
|
+
type: t == null ? void 0 : t.type,
|
|
137
|
+
modifier: r.modifier
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
const g = {
|
|
141
|
+
type: `${s}${r.array ?? ""}`,
|
|
142
|
+
...c,
|
|
143
|
+
...i,
|
|
144
|
+
...f
|
|
145
|
+
};
|
|
146
|
+
return p.set(n, g), g;
|
|
147
|
+
}
|
|
148
|
+
function u(e, t = [], n = "", a = 0) {
|
|
149
|
+
const r = e.trim().length;
|
|
150
|
+
for (let c = 0; c < r; c++) {
|
|
151
|
+
const i = e[c], o = e.slice(c + 1);
|
|
152
|
+
switch (i) {
|
|
153
|
+
case ",":
|
|
154
|
+
return a === 0 ? u(o, [...t, n.trim()]) : u(o, t, `${n}${i}`, a);
|
|
155
|
+
case "(":
|
|
156
|
+
return u(o, t, `${n}${i}`, a + 1);
|
|
157
|
+
case ")":
|
|
158
|
+
return u(o, t, `${n}${i}`, a - 1);
|
|
162
159
|
default:
|
|
163
|
-
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
mapArguments(t) {
|
|
167
|
-
for (const s of this.commands.keys())
|
|
168
|
-
this.mapCommandArguments(s, t);
|
|
169
|
-
}
|
|
170
|
-
replaceCommand(t, s, e = t) {
|
|
171
|
-
if (!Array.isArray(s)) {
|
|
172
|
-
this.commands[t] = s;
|
|
173
|
-
return;
|
|
174
|
-
}
|
|
175
|
-
const i = s.length - 1;
|
|
176
|
-
this.commands.splice(t, 1, ...structuredClone(s)), this.mapArguments((n, r, u) => {
|
|
177
|
-
if (u < t + s.length)
|
|
178
|
-
return n;
|
|
179
|
-
if (typeof e != "number" && (n.$kind === "Result" && n.Result === t || n.$kind === "NestedResult" && n.NestedResult[0] === t)) {
|
|
180
|
-
if (!("NestedResult" in n) || n.NestedResult[1] === 0)
|
|
181
|
-
return h(R, structuredClone(e));
|
|
182
|
-
throw new Error(
|
|
183
|
-
`Cannot replace command ${t} with a specific result type: NestedResult[${t}, ${n.NestedResult[1]}] references a nested element that cannot be mapped to the replacement result`
|
|
184
|
-
);
|
|
185
|
-
}
|
|
186
|
-
switch (n.$kind) {
|
|
187
|
-
case "Result":
|
|
188
|
-
n.Result === t && typeof e == "number" && (n.Result = e), n.Result > t && (n.Result += i);
|
|
189
|
-
break;
|
|
190
|
-
case "NestedResult":
|
|
191
|
-
if (n.NestedResult[0] === t && typeof e == "number")
|
|
192
|
-
return {
|
|
193
|
-
$kind: "NestedResult",
|
|
194
|
-
NestedResult: [e, n.NestedResult[1]]
|
|
195
|
-
};
|
|
196
|
-
n.NestedResult[0] > t && (n.NestedResult[0] += i);
|
|
197
|
-
break;
|
|
198
|
-
}
|
|
199
|
-
return n;
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
replaceCommandWithTransaction(t, s, e) {
|
|
203
|
-
if (e.$kind !== "Result" && e.$kind !== "NestedResult")
|
|
204
|
-
throw new Error("Result must be of kind Result or NestedResult");
|
|
205
|
-
this.insertTransaction(t, s), this.replaceCommand(
|
|
206
|
-
t + s.commands.length,
|
|
207
|
-
[],
|
|
208
|
-
"Result" in e ? { NestedResult: [e.Result + t, 0] } : {
|
|
209
|
-
NestedResult: [
|
|
210
|
-
e.NestedResult[0] + t,
|
|
211
|
-
e.NestedResult[1]
|
|
212
|
-
]
|
|
213
|
-
}
|
|
214
|
-
);
|
|
215
|
-
}
|
|
216
|
-
insertTransaction(t, s) {
|
|
217
|
-
var u, p;
|
|
218
|
-
const e = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
|
|
219
|
-
for (let a = 0; a < s.inputs.length; a++) {
|
|
220
|
-
const o = s.inputs[a], l = w(o);
|
|
221
|
-
let c = -1;
|
|
222
|
-
if (l !== void 0 && (c = this.inputs.findIndex((g) => w(g) === l), c !== -1 && ((u = this.inputs[c].Object) != null && u.SharedObject) && ((p = o.Object) != null && p.SharedObject) && (this.inputs[c].Object.SharedObject.mutable = this.inputs[c].Object.SharedObject.mutable || o.Object.SharedObject.mutable)), c !== -1)
|
|
223
|
-
e.set(a, c);
|
|
224
|
-
else {
|
|
225
|
-
const g = this.inputs.length;
|
|
226
|
-
this.inputs.push(o), e.set(a, g);
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
for (let a = 0; a < s.commands.length; a++)
|
|
230
|
-
i.set(a, t + a);
|
|
231
|
-
const n = [];
|
|
232
|
-
for (let a = 0; a < s.commands.length; a++) {
|
|
233
|
-
const o = structuredClone(s.commands[a]);
|
|
234
|
-
D(o, e, i), n.push(o);
|
|
235
|
-
}
|
|
236
|
-
this.commands.splice(t, 0, ...n);
|
|
237
|
-
const r = n.length;
|
|
238
|
-
r > 0 && this.mapArguments((a, o, l) => {
|
|
239
|
-
if (l >= t && l < t + n.length)
|
|
240
|
-
return a;
|
|
241
|
-
switch (a.$kind) {
|
|
242
|
-
case "Result":
|
|
243
|
-
a.Result >= t && (a.Result += r);
|
|
244
|
-
break;
|
|
245
|
-
case "NestedResult":
|
|
246
|
-
a.NestedResult[0] >= t && (a.NestedResult[0] += r);
|
|
247
|
-
break;
|
|
248
|
-
}
|
|
249
|
-
return a;
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
|
-
getDigest() {
|
|
253
|
-
const t = this.build({ onlyTransactionKind: !1 });
|
|
254
|
-
return m.getDigestFromBytes(t);
|
|
255
|
-
}
|
|
256
|
-
snapshot() {
|
|
257
|
-
return h(f, this);
|
|
258
|
-
}
|
|
259
|
-
shallowClone() {
|
|
260
|
-
return new m({
|
|
261
|
-
version: this.version,
|
|
262
|
-
sender: this.sender,
|
|
263
|
-
expiration: this.expiration,
|
|
264
|
-
gasData: {
|
|
265
|
-
...this.gasData
|
|
266
|
-
},
|
|
267
|
-
inputs: [...this.inputs],
|
|
268
|
-
commands: [...this.commands]
|
|
269
|
-
});
|
|
270
|
-
}
|
|
271
|
-
applyResolvedData(t) {
|
|
272
|
-
this.sender || (this.sender = t.sender ?? null), this.expiration || (this.expiration = t.expiration ?? null), this.gasData.budget || (this.gasData.budget = t.gasData.budget), this.gasData.owner || (this.gasData.owner = t.gasData.owner ?? null), this.gasData.payment || (this.gasData.payment = t.gasData.payment), this.gasData.price || (this.gasData.price = t.gasData.price);
|
|
273
|
-
for (let s = 0; s < this.inputs.length; s++) {
|
|
274
|
-
const e = this.inputs[s], i = t.inputs[s];
|
|
275
|
-
switch (e.$kind) {
|
|
276
|
-
case "UnresolvedPure":
|
|
277
|
-
if (i.$kind !== "Pure")
|
|
278
|
-
throw new Error(
|
|
279
|
-
`Expected input at index ${s} to resolve to a Pure argument, but got ${JSON.stringify(
|
|
280
|
-
i
|
|
281
|
-
)}`
|
|
282
|
-
);
|
|
283
|
-
this.inputs[s] = i;
|
|
284
|
-
break;
|
|
285
|
-
case "UnresolvedObject":
|
|
286
|
-
if (i.$kind !== "Object")
|
|
287
|
-
throw new Error(
|
|
288
|
-
`Expected input at index ${s} to resolve to an Object argument, but got ${JSON.stringify(
|
|
289
|
-
i
|
|
290
|
-
)}`
|
|
291
|
-
);
|
|
292
|
-
if (i.Object.$kind === "ImmOrOwnedObject" || i.Object.$kind === "Receiving") {
|
|
293
|
-
const n = e.UnresolvedObject, r = i.Object.ImmOrOwnedObject ?? i.Object.Receiving;
|
|
294
|
-
if (d(n.objectId) !== d(r.objectId) || n.version != null && n.version !== r.version || n.digest != null && n.digest !== r.digest || // Objects with shared object properties should not resolve to owned objects
|
|
295
|
-
n.mutable != null || n.initialSharedVersion != null)
|
|
296
|
-
throw new Error(
|
|
297
|
-
`Input at index ${s} did not match unresolved object. ${JSON.stringify(n)} is not compatible with ${JSON.stringify(r)}`
|
|
298
|
-
);
|
|
299
|
-
} else if (i.Object.$kind === "SharedObject") {
|
|
300
|
-
const n = e.UnresolvedObject, r = i.Object.SharedObject;
|
|
301
|
-
if (d(n.objectId) !== d(r.objectId) || n.initialSharedVersion != null && n.initialSharedVersion !== r.initialSharedVersion || n.mutable != null && n.mutable !== r.mutable || // Objects with owned object properties should not resolve to shared objects
|
|
302
|
-
n.version != null || n.digest != null)
|
|
303
|
-
throw new Error(
|
|
304
|
-
`Input at index ${s} did not match unresolved object. ${JSON.stringify(n)} is not compatible with ${JSON.stringify(r)}`
|
|
305
|
-
);
|
|
306
|
-
} else
|
|
307
|
-
throw new Error(
|
|
308
|
-
`Input at index ${s} resolved to an unexpected Object kind: ${JSON.stringify(
|
|
309
|
-
i.Object
|
|
310
|
-
)}`
|
|
311
|
-
);
|
|
312
|
-
this.inputs[s] = i;
|
|
313
|
-
break;
|
|
314
|
-
}
|
|
160
|
+
return u(o, t, `${n}${i}`, a);
|
|
315
161
|
}
|
|
316
162
|
}
|
|
163
|
+
if (n === "")
|
|
164
|
+
return t;
|
|
165
|
+
if (a !== 0)
|
|
166
|
+
throw new T({ current: n, depth: a });
|
|
167
|
+
return t.push(n.trim()), t;
|
|
168
|
+
}
|
|
169
|
+
function ee(e) {
|
|
170
|
+
return e === "address" || e === "bool" || e === "function" || e === "string" || x.test(e) || $.test(e);
|
|
171
|
+
}
|
|
172
|
+
const te = /^(?:after|alias|anonymous|apply|auto|byte|calldata|case|catch|constant|copyof|default|defined|error|event|external|false|final|function|immutable|implements|in|indexed|inline|internal|let|mapping|match|memory|mutable|null|of|override|partial|private|promise|public|pure|reference|relocatable|return|returns|sizeof|static|storage|struct|super|supports|switch|this|true|try|typedef|typeof|var|view|virtual)$/;
|
|
173
|
+
function re(e) {
|
|
174
|
+
return e === "address" || e === "bool" || e === "function" || e === "string" || e === "tuple" || x.test(e) || $.test(e) || te.test(e);
|
|
175
|
+
}
|
|
176
|
+
function ne(e, t) {
|
|
177
|
+
return t || e === "bytes" || e === "string" || e === "tuple";
|
|
317
178
|
}
|
|
318
179
|
export {
|
|
319
|
-
|
|
180
|
+
re as isSolidityKeyword,
|
|
181
|
+
ee as isSolidityType,
|
|
182
|
+
ne as isValidDataLocation,
|
|
183
|
+
l as parseAbiParameter,
|
|
184
|
+
N as parseConstructorSignature,
|
|
185
|
+
J as parseErrorSignature,
|
|
186
|
+
H as parseEventSignature,
|
|
187
|
+
O as parseFallbackSignature,
|
|
188
|
+
G as parseFunctionSignature,
|
|
189
|
+
le as parseSignature,
|
|
190
|
+
u as splitParameters
|
|
320
191
|
};
|
package/dist/index314.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index315.cjs"),u=require("./index311.cjs"),a=require("./index312.cjs"),s=require("./index313.cjs");function l(t){let e;if(typeof t=="string")e=s.parseSignature(t);else{const n=a.parseStructs(t),o=t.length;for(let r=0;r<o;r++){const i=t[r];if(!u.isStructSignature(i)){e=s.parseSignature(i,n);break}}}if(!e)throw new c.InvalidAbiItemError({signature:t});return e}exports.parseAbiItem=l;
|
package/dist/index314.js
CHANGED
|
@@ -1,62 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
if (
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
throw new Error(`Input ${t.Input} not found in input mapping`);
|
|
17
|
-
return { ...t, Input: n };
|
|
18
|
-
}
|
|
19
|
-
case "Result": {
|
|
20
|
-
const n = u.get(t.Result);
|
|
21
|
-
return n !== void 0 ? { ...t, Result: n } : t;
|
|
1
|
+
import { InvalidAbiItemError as f } from "./index315.js";
|
|
2
|
+
import { isStructSignature as p } from "./index311.js";
|
|
3
|
+
import { parseStructs as c } from "./index312.js";
|
|
4
|
+
import { parseSignature as i } from "./index313.js";
|
|
5
|
+
function u(t) {
|
|
6
|
+
let r;
|
|
7
|
+
if (typeof t == "string")
|
|
8
|
+
r = i(t);
|
|
9
|
+
else {
|
|
10
|
+
const m = c(t), n = t.length;
|
|
11
|
+
for (let o = 0; o < n; o++) {
|
|
12
|
+
const e = t[o];
|
|
13
|
+
if (!p(e)) {
|
|
14
|
+
r = i(e, m);
|
|
15
|
+
break;
|
|
22
16
|
}
|
|
23
|
-
case "NestedResult": {
|
|
24
|
-
const n = u.get(t.NestedResult[0]);
|
|
25
|
-
return n !== void 0 ? { ...t, NestedResult: [n, t.NestedResult[1]] } : t;
|
|
26
|
-
}
|
|
27
|
-
default:
|
|
28
|
-
return t;
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
switch (e.$kind) {
|
|
32
|
-
case "MoveCall":
|
|
33
|
-
e.MoveCall.arguments = e.MoveCall.arguments.map(s);
|
|
34
|
-
break;
|
|
35
|
-
case "TransferObjects":
|
|
36
|
-
e.TransferObjects.objects = e.TransferObjects.objects.map(s), e.TransferObjects.address = s(e.TransferObjects.address);
|
|
37
|
-
break;
|
|
38
|
-
case "SplitCoins":
|
|
39
|
-
e.SplitCoins.coin = s(e.SplitCoins.coin), e.SplitCoins.amounts = e.SplitCoins.amounts.map(s);
|
|
40
|
-
break;
|
|
41
|
-
case "MergeCoins":
|
|
42
|
-
e.MergeCoins.destination = s(e.MergeCoins.destination), e.MergeCoins.sources = e.MergeCoins.sources.map(s);
|
|
43
|
-
break;
|
|
44
|
-
case "MakeMoveVec":
|
|
45
|
-
e.MakeMoveVec.elements = e.MakeMoveVec.elements.map(s);
|
|
46
|
-
break;
|
|
47
|
-
case "Upgrade":
|
|
48
|
-
e.Upgrade.ticket = s(e.Upgrade.ticket);
|
|
49
|
-
break;
|
|
50
|
-
case "$Intent": {
|
|
51
|
-
const t = e.$Intent.inputs;
|
|
52
|
-
e.$Intent.inputs = {};
|
|
53
|
-
for (const [n, i] of Object.entries(t))
|
|
54
|
-
e.$Intent.inputs[n] = Array.isArray(i) ? i.map(s) : s(i);
|
|
55
|
-
break;
|
|
56
17
|
}
|
|
57
18
|
}
|
|
19
|
+
if (!r)
|
|
20
|
+
throw new f({ signature: t });
|
|
21
|
+
return r;
|
|
58
22
|
}
|
|
59
23
|
export {
|
|
60
|
-
|
|
61
|
-
p as remapCommandArguments
|
|
24
|
+
u as parseAbiItem
|
|
62
25
|
};
|
package/dist/index315.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index305.cjs");class n extends r.BaseError{constructor({signature:e}){super("Failed to parse ABI item.",{details:`parseAbiItem(${JSON.stringify(e,null,2)})`,docsPath:"/api/human#parseabiitem-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiItemError"})}}class o extends r.BaseError{constructor({type:e}){super("Unknown type.",{metaMessages:[`Type "${e}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}}class a extends r.BaseError{constructor({type:e}){super("Unknown type.",{metaMessages:[`Type "${e}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}exports.InvalidAbiItemError=n;exports.UnknownSolidityTypeError=a;exports.UnknownTypeError=o;
|