@tari-project/ootle 0.18.0 → 0.19.0

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 (3) hide show
  1. package/dist/index.d.ts +110 -11
  2. package/dist/index.js +515 -450
  3. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -1,15 +1,16 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
- import { aggregateInputMasks as e, attachTransactionSignature as t, borEncodeTransaction as n, buildStealthInputsStatement as r, createStealthOutputWitness as i, encryptedDataDhKdfAead as a, generateKeypair as o, generateOotleAddress as s, generateStealthBalanceProofSignature as c, generateStealthOutputsStatement as l, hashUnsignedTransaction as ee, parseOotleAddress as te, sealTransaction as ne, stealthDhSecret as re, unblindOutput as ie, validateBalanceProofSignature as ae, validateStealthTransfer as oe } from "@tari-project/ootle-wasm";
5
- import { decodeEvent as se, decodeExecuteResult as ce, decodeResource as le, decodeSubstateValue as ue, decodeTransactionReceipt as de, decodeUtxo as fe } from "@tari-project/ootle-wasm-bor";
6
- var u = /* @__PURE__ */ (function(e11) {
4
+ import { aggregateInputMasks as e, attachTransactionSignature as t, borEncodeTransaction as n, buildStealthInputsStatement as r, createStealthOutputWitness as i, encryptedDataDhKdfAead as a, generateKeypair as o, generateOotleAddress as s, generateStealthBalanceProofSignature as c, generateStealthOutputsStatement as l, hashUnsignedTransaction as u, parseOotleAddress as d, sealTransaction as ee, stealthDhSecret as te, unblindOutput as ne, validateBalanceProofSignature as re, validateStealthTransfer as ie } from "@tari-project/ootle-wasm";
5
+ import { decodeEvent as ae, decodeExecuteResult as oe, decodeResource as se, decodeSubstateValue as ce, decodeTransactionReceipt as le, decodeUtxo as ue } from "@tari-project/ootle-wasm-bor";
6
+ import { transactionBody as de, transactionSchemaVersion as fe } from "@tari-project/ootle-ts-bindings";
7
+ var f = /* @__PURE__ */ (function(e11) {
7
8
  return e11[e11.MainNet = 0] = "MainNet", e11[e11.StageNet = 1] = "StageNet", e11[e11.NextNet = 2] = "NextNet", e11[e11.LocalNet = 16] = "LocalNet", e11[e11.Igor = 36] = "Igor", e11[e11.Esmeralda = 38] = "Esmeralda", e11;
8
- })({}), d = class extends Error {
9
+ })({}), p = class extends Error {
9
10
  constructor(e11, t2) {
10
11
  super(e11, t2), this.name = new.target.name;
11
12
  }
12
- }, pe = class extends d {
13
+ }, pe = class extends p {
13
14
  constructor(e11, t2) {
14
15
  super(e11, t2);
15
16
  __publicField(this, "status");
@@ -17,7 +18,7 @@ var u = /* @__PURE__ */ (function(e11) {
17
18
  __publicField(this, "url");
18
19
  this.status = t2 == null ? void 0 : t2.status, this.body = t2 == null ? void 0 : t2.body, this.url = t2 == null ? void 0 : t2.url;
19
20
  }
20
- }, f = class extends d {
21
+ }, m = class extends p {
21
22
  constructor(e11, t2) {
22
23
  super(e11, t2);
23
24
  __publicField(this, "txId");
@@ -25,224 +26,224 @@ var u = /* @__PURE__ */ (function(e11) {
25
26
  __publicField(this, "rejectReason");
26
27
  this.txId = t2.txId, this.reason = t2.reason, this.rejectReason = t2.rejectReason;
27
28
  }
28
- }, me = class extends d {
29
+ }, me = class extends p {
29
30
  constructor(e11, t2) {
30
31
  super(e11, t2);
31
32
  __publicField(this, "txId");
32
33
  this.txId = t2.txId;
33
34
  }
34
- }, p = class extends d {
35
- }, m = class extends p {
35
+ }, h = class extends p {
36
+ }, g = class extends h {
36
37
  constructor(e11, t2) {
37
38
  super(e11, t2);
38
39
  __publicField(this, "address");
39
40
  this.address = t2.address;
40
41
  }
41
- }, h = class extends p {
42
- }, g = class extends d {
43
- }, _ = class extends d {
42
+ }, _ = class extends h {
43
+ }, v = class extends p {
44
+ }, y = class extends p {
44
45
  constructor(e11, t2) {
45
46
  super(e11, t2);
46
47
  __publicField(this, "context");
47
48
  this.context = t2 == null ? void 0 : t2.context;
48
49
  }
49
- }, v = class extends d {
50
- }, he = class extends d {
50
+ }, b = class extends p {
51
+ }, he = class extends p {
51
52
  };
52
53
  function ge(e11, t2) {
53
- throw new v(`assertUnreachable${t2 ? ` (${t2})` : ""}: ${JSON.stringify(e11)}`);
54
+ throw new b(`assertUnreachable${t2 ? ` (${t2})` : ""}: ${JSON.stringify(e11)}`);
54
55
  }
55
- function y(e11, t2, n2) {
56
- if (e11.length !== t2) throw new v(`${n2} must be ${t2} bytes, got ${e11.length}`);
56
+ function x(e11, t2, n2) {
57
+ if (e11.length !== t2) throw new b(`${n2} must be ${t2} bytes, got ${e11.length}`);
57
58
  return e11;
58
59
  }
59
- function b(e11) {
60
+ function S(e11) {
60
61
  return Array.from(e11, (e12) => e12.toString(16).padStart(2, "0")).join("");
61
62
  }
62
63
  var _e = /^[0-9a-fA-F]*$/;
63
- function x(e11) {
64
- if (e11.length % 2 != 0) throw new v(`fromHexStr: hex string must have even length, got ${e11.length}`);
65
- if (!_e.test(e11)) throw new v("fromHexStr: hex string contains non-hex characters");
64
+ function C(e11) {
65
+ if (e11.length % 2 != 0) throw new b(`fromHexStr: hex string must have even length, got ${e11.length}`);
66
+ if (!_e.test(e11)) throw new b("fromHexStr: hex string contains non-hex characters");
66
67
  let t2 = new Uint8Array(e11.length / 2);
67
68
  for (let n2 = 0; n2 < t2.length; n2++) t2[n2] = parseInt(e11.substring(n2 * 2, n2 * 2 + 2), 16);
68
69
  return t2;
69
70
  }
70
- var S = (1n << 64n) - 1n, ve = 2n, C = 32, ye = C * 2, be = 32, xe = 128, Se = 129, Ce = 130, w = 131, we = 132, Te = 136, Ee = 138, De = 141, T = 0, Oe = 32, E = 64, ke = 96, D = 128, Ae = 160, O = 192;
71
+ var w = (1n << 64n) - 1n, ve = 2n, T = 32, ye = T * 2, be = 32, xe = 128, Se = 129, Ce = 130, E = 131, we = 132, Te = 136, Ee = 138, De = 141, D = 0, Oe = 32, O = 64, ke = 96, k = 128, Ae = 160, A = 192;
71
72
  function je(e11) {
72
73
  switch (typeof e11) {
73
74
  case "bigint":
74
- return k(e11);
75
+ return j(e11);
75
76
  case "string":
76
77
  return Pe(e11);
77
78
  case "boolean":
78
79
  return Fe(e11);
79
80
  default:
80
- if (e11 instanceof Uint8Array) return A(e11);
81
- throw new v(`literalArg: cannot CBOR-encode value of type ${typeof e11}`);
81
+ if (e11 instanceof Uint8Array) return M(e11);
82
+ throw new b(`literalArg: cannot CBOR-encode value of type ${typeof e11}`);
82
83
  }
83
84
  }
84
- function k(e11) {
85
- if (e11 < 0n) throw new v(`amountLiteral: amount must be non-negative, got ${e11}`);
86
- if (e11 >> 128n != 0n) throw new v(`amountLiteral: amount overflows u128: ${e11}`);
85
+ function j(e11) {
86
+ if (e11 < 0n) throw new b(`amountLiteral: amount must be non-negative, got ${e11}`);
87
+ if (e11 >> 128n != 0n) throw new b(`amountLiteral: amount overflows u128: ${e11}`);
87
88
  let t2 = [];
88
- return e11 <= S ? I(t2, T, e11) : Me(t2, e11), L(t2);
89
+ return e11 <= w ? L(t2, D, e11) : Me(t2, e11), R(t2);
89
90
  }
90
91
  function Me(e11, t2) {
91
92
  let n2 = [], r2 = t2;
92
93
  for (; r2 > 0n; ) n2.unshift(Number(r2 & 255n)), r2 >>= 8n;
93
- I(e11, O, ve), I(e11, E, BigInt(n2.length)), F(e11, n2);
94
+ L(e11, A, ve), L(e11, O, BigInt(n2.length)), I(e11, n2);
94
95
  }
95
96
  function Ne(e11) {
96
97
  let t2 = [];
97
98
  if (e11 >= 0n) {
98
- if (e11 > S) throw new v(`intLiteral: value exceeds the 64-bit CBOR integer range: ${e11}`);
99
- I(t2, T, e11);
99
+ if (e11 > w) throw new b(`intLiteral: value exceeds the 64-bit CBOR integer range: ${e11}`);
100
+ L(t2, D, e11);
100
101
  } else {
101
102
  let n2 = -1n - e11;
102
- if (n2 > S) throw new v(`intLiteral: value exceeds the 64-bit CBOR integer range: ${e11}`);
103
- I(t2, Oe, n2);
103
+ if (n2 > w) throw new b(`intLiteral: value exceeds the 64-bit CBOR integer range: ${e11}`);
104
+ L(t2, Oe, n2);
104
105
  }
105
- return L(t2);
106
+ return R(t2);
106
107
  }
107
108
  function Pe(e11) {
108
109
  let t2 = [];
109
- return P(t2, e11), L(t2);
110
+ return F(t2, e11), R(t2);
110
111
  }
111
- function A(e11) {
112
+ function M(e11) {
112
113
  let t2 = [];
113
- return I(t2, E, BigInt(e11.length)), F(t2, e11), L(t2);
114
+ return L(t2, O, BigInt(e11.length)), I(t2, e11), R(t2);
114
115
  }
115
116
  function Fe(e11) {
116
117
  return { Literal: e11 ? "f5" : "f4" };
117
118
  }
118
- function j(e11) {
119
- return M(w, e11, "resource_");
119
+ function N(e11) {
120
+ return P(E, e11, "resource_");
120
121
  }
121
122
  function Ie(e11) {
122
- return M(xe, e11, "component_");
123
+ return P(xe, e11, "component_");
123
124
  }
124
125
  function Le(e11) {
125
- let t2 = e11 instanceof Map ? e11 : new Map(Object.entries(e11)), n2 = new TextEncoder(), r2 = [...t2.entries()].sort(([e12], [t3]) => Je(n2.encode(e12), n2.encode(t3))), i2 = [];
126
- I(i2, O, BigInt(Se)), I(i2, Ae, BigInt(r2.length));
127
- for (let [e12, t3] of r2) P(i2, e12), P(i2, t3);
128
- return L(i2);
126
+ let t2 = e11 instanceof Map ? e11 : new Map(Object.entries(e11)), n2 = new TextEncoder(), r2 = [...t2.entries()].sort(([e12], [t3]) => Ye(n2.encode(e12), n2.encode(t3))), i2 = [];
127
+ L(i2, A, BigInt(Se)), L(i2, Ae, BigInt(r2.length));
128
+ for (let [e12, t3] of r2) F(i2, e12), F(i2, t3);
129
+ return R(i2);
129
130
  }
130
131
  function Re(e11) {
131
- return M(we, e11, "vault_");
132
+ return P(we, e11, "vault_");
132
133
  }
133
134
  function ze(e11) {
134
- return A(Ge(e11, "template_"));
135
+ return M(Ke(e11, "template_"));
135
136
  }
136
137
  function Be(e11) {
137
- return M(Te, e11, "tombstone_");
138
+ return P(Te, e11, "tombstone_");
138
139
  }
139
140
  function Ve(e11) {
140
- return M(Ee, e11, "vnfp_");
141
+ return P(Ee, e11, "vnfp_");
141
142
  }
142
143
  function He(e11) {
143
- let t2 = typeof e11 == "string" ? x(e11) : e11;
144
- return y(t2, be, "publicKeyLiteral"), A(t2);
144
+ let t2 = typeof e11 == "string" ? C(e11) : e11;
145
+ return x(t2, be, "publicKeyLiteral"), M(t2);
145
146
  }
146
147
  function Ue(e11) {
147
148
  let t2 = [];
148
- return I(t2, O, BigInt(Ce)), I(t2, D, 2n), N(t2, w, e11.resource_address, "resource_"), Ke(t2, e11.id), L(t2);
149
+ return L(t2, A, BigInt(Ce)), L(t2, k, 2n), Ge(t2, E, e11.resource_address, "resource_"), qe(t2, e11.id), R(t2);
149
150
  }
150
151
  function We(e11) {
151
152
  let t2 = [];
152
- I(t2, O, BigInt(De)), I(t2, D, 2n), N(t2, w, e11.resource_address, "resource_");
153
- let n2 = x(e11.id);
154
- return y(n2, C, "utxoAddressLiteral: id"), I(t2, E, BigInt(C)), F(t2, n2), L(t2);
153
+ L(t2, A, BigInt(De)), L(t2, k, 2n), Ge(t2, E, e11.resource_address, "resource_");
154
+ let n2 = C(e11.id);
155
+ return x(n2, T, "utxoAddressLiteral: id"), L(t2, O, BigInt(T)), I(t2, n2), R(t2);
155
156
  }
156
- function M(e11, t2, n2) {
157
+ function P(e11, t2, n2) {
157
158
  let r2 = [];
158
- return N(r2, e11, t2, n2), L(r2);
159
+ return Ge(r2, e11, t2, n2), R(r2);
159
160
  }
160
- function N(e11, t2, n2, r2) {
161
- let i2 = Ge(n2, r2);
162
- I(e11, O, BigInt(t2)), I(e11, E, BigInt(C)), F(e11, i2);
163
- }
164
- function Ge(e11, t2) {
165
- let n2 = e11.startsWith(t2) ? e11.slice(t2.length) : e11;
166
- if (n2.length !== ye) throw new v(`${t2}address must be 32 bytes (${ye} hex chars), got ${n2.length}`);
167
- return x(n2);
161
+ function Ge(e11, t2, n2, r2) {
162
+ let i2 = Ke(n2, r2);
163
+ L(e11, A, BigInt(t2)), L(e11, O, BigInt(T)), I(e11, i2);
168
164
  }
169
165
  function Ke(e11, t2) {
170
- if (I(e11, D, 2n), "U256" in t2) {
171
- I(e11, T, 0n), I(e11, D, 1n);
172
- let n2 = x(t2.U256);
173
- y(n2, C, "NonFungibleId.U256"), I(e11, E, BigInt(C)), F(e11, n2);
174
- } else if ("String" in t2) I(e11, T, 1n), I(e11, D, 1n), P(e11, t2.String);
175
- else if ("Uint32" in t2) I(e11, T, 2n), I(e11, D, 1n), qe(e11, t2.Uint32, "NonFungibleId.Uint32", (1n << 32n) - 1n);
176
- else if ("Uint64" in t2) I(e11, T, 3n), I(e11, D, 1n), qe(e11, t2.Uint64, "NonFungibleId.Uint64", S);
177
- else throw new v(`nonFungibleAddressLiteral: unrecognised NonFungibleId variant: ${JSON.stringify(t2)}`);
178
- }
179
- function qe(e11, t2, n2, r2) {
180
- if (!Number.isInteger(t2) || t2 < 0) throw new v(`${n2} must be a non-negative integer, got ${t2}`);
181
- if (r2 > BigInt(2 ** 53 - 1) && t2 > 2 ** 53 - 1) throw new v(`${n2} value ${t2} exceeds Number.MAX_SAFE_INTEGER (2^53-1) and cannot be encoded without precision loss \u2014 the binding types this id as a JS number. Use a U256/String id for large values.`);
166
+ let n2 = e11.startsWith(t2) ? e11.slice(t2.length) : e11;
167
+ if (n2.length !== ye) throw new b(`${t2}address must be 32 bytes (${ye} hex chars), got ${n2.length}`);
168
+ return C(n2);
169
+ }
170
+ function qe(e11, t2) {
171
+ if (L(e11, k, 2n), "U256" in t2) {
172
+ L(e11, D, 0n), L(e11, k, 1n);
173
+ let n2 = C(t2.U256);
174
+ x(n2, T, "NonFungibleId.U256"), L(e11, O, BigInt(T)), I(e11, n2);
175
+ } else if ("String" in t2) L(e11, D, 1n), L(e11, k, 1n), F(e11, t2.String);
176
+ else if ("Uint32" in t2) L(e11, D, 2n), L(e11, k, 1n), Je(e11, t2.Uint32, "NonFungibleId.Uint32", (1n << 32n) - 1n);
177
+ else if ("Uint64" in t2) L(e11, D, 3n), L(e11, k, 1n), Je(e11, t2.Uint64, "NonFungibleId.Uint64", w);
178
+ else throw new b(`nonFungibleAddressLiteral: unrecognised NonFungibleId variant: ${JSON.stringify(t2)}`);
179
+ }
180
+ function Je(e11, t2, n2, r2) {
181
+ if (!Number.isInteger(t2) || t2 < 0) throw new b(`${n2} must be a non-negative integer, got ${t2}`);
182
+ if (r2 > BigInt(2 ** 53 - 1) && t2 > 2 ** 53 - 1) throw new b(`${n2} value ${t2} exceeds Number.MAX_SAFE_INTEGER (2^53-1) and cannot be encoded without precision loss \u2014 the binding types this id as a JS number. Use a U256/String id for large values.`);
182
183
  let i2 = BigInt(t2);
183
- if (i2 > r2) throw new v(`${n2} value ${t2} exceeds its maximum of ${r2}`);
184
- I(e11, T, i2);
184
+ if (i2 > r2) throw new b(`${n2} value ${t2} exceeds its maximum of ${r2}`);
185
+ L(e11, D, i2);
185
186
  }
186
- function P(e11, t2) {
187
+ function F(e11, t2) {
187
188
  let n2 = new TextEncoder().encode(t2);
188
- I(e11, ke, BigInt(n2.length)), F(e11, n2);
189
+ L(e11, ke, BigInt(n2.length)), I(e11, n2);
189
190
  }
190
- function F(e11, t2) {
191
+ function I(e11, t2) {
191
192
  let n2 = e11.length;
192
193
  e11.length = n2 + t2.length;
193
194
  for (let r2 = 0; r2 < t2.length; r2++) e11[n2 + r2] = t2[r2];
194
195
  }
195
- function Je(e11, t2) {
196
+ function Ye(e11, t2) {
196
197
  let n2 = Math.min(e11.length, t2.length);
197
198
  for (let r2 = 0; r2 < n2; r2++) if (e11[r2] !== t2[r2]) return e11[r2] < t2[r2] ? -1 : 1;
198
199
  return e11.length - t2.length;
199
200
  }
200
- function I(e11, t2, n2) {
201
+ function L(e11, t2, n2) {
201
202
  n2 < 24n ? e11.push(t2 | Number(n2)) : n2 < 1n << 8n ? e11.push(t2 | 24, Number(n2)) : n2 < 1n << 16n ? e11.push(t2 | 25, Number(n2 >> 8n & 255n), Number(n2 & 255n)) : n2 < 1n << 32n ? e11.push(t2 | 26, Number(n2 >> 24n & 255n), Number(n2 >> 16n & 255n), Number(n2 >> 8n & 255n), Number(n2 & 255n)) : e11.push(t2 | 27, Number(n2 >> 56n & 255n), Number(n2 >> 48n & 255n), Number(n2 >> 40n & 255n), Number(n2 >> 32n & 255n), Number(n2 >> 24n & 255n), Number(n2 >> 16n & 255n), Number(n2 >> 8n & 255n), Number(n2 & 255n));
202
203
  }
203
- function L(e11) {
204
- return { Literal: b(Uint8Array.from(e11)) };
205
- }
206
204
  function R(e11) {
207
- return k(e11);
205
+ return { Literal: S(Uint8Array.from(e11)) };
208
206
  }
209
- function Ye(e11) {
210
- if (e11 < 0n) throw new v(`microTariString: amount must be non-negative, got ${e11}`);
211
- return e11.toString();
207
+ function z(e11) {
208
+ return j(e11);
212
209
  }
213
210
  function Xe(e11) {
211
+ if (e11 < 0n) throw new b(`microTariString: amount must be non-negative, got ${e11}`);
212
+ return e11.toString();
213
+ }
214
+ function Ze(e11) {
214
215
  let t2 = e11.split(".");
215
- if (t2.length > 2) throw new v("Invalid workspace key format. Only one dot is allowed.");
216
+ if (t2.length > 2) throw new b("Invalid workspace key format. Only one dot is allowed.");
216
217
  let n2 = t2[0];
217
218
  if (t2[1] === void 0) return {
218
219
  name: n2,
219
220
  offset: null
220
221
  };
221
222
  let r2 = Number.parseInt(t2[1], 10);
222
- if (Number.isNaN(r2) || r2 < 0 || String(r2) !== t2[1]) throw new v(`Invalid workspace key offset: "${t2[1]}"`);
223
+ if (Number.isNaN(r2) || r2 < 0 || String(r2) !== t2[1]) throw new b(`Invalid workspace key offset: "${t2[1]}"`);
223
224
  return {
224
225
  name: n2,
225
226
  offset: r2
226
227
  };
227
228
  }
228
- var Ze = 2160, Qe = 10;
229
- async function $e(e11, t2 = 10) {
230
- if (!Number.isInteger(t2) || t2 < 1) throw new v(`resolveMaxEpoch: leadEpochs must be a positive integer, got ${t2}`);
231
- if (t2 > 2160) throw new v(`resolveMaxEpoch: leadEpochs ${t2} exceeds the network's maximum validity window of ${Ze} epochs`);
229
+ var Qe = 2160, $e = 10;
230
+ async function et(e11, t2 = 10) {
231
+ if (!Number.isInteger(t2) || t2 < 1) throw new b(`resolveMaxEpoch: leadEpochs must be a positive integer, got ${t2}`);
232
+ if (t2 > 2160) throw new b(`resolveMaxEpoch: leadEpochs ${t2} exceeds the network's maximum validity window of ${Qe} epochs`);
232
233
  return await e11.getCurrentEpoch() + t2;
233
234
  }
234
- var et = (1n << 64n) - 1n;
235
- function z(e11, t2) {
236
- if (!Number.isInteger(e11) || e11 < 0) throw new v(`${t2} must be a non-negative integer epoch, got ${e11}`);
235
+ var tt = (1n << 64n) - 1n;
236
+ function B(e11, t2) {
237
+ if (!Number.isInteger(e11) || e11 < 0) throw new b(`${t2} must be a non-negative integer epoch, got ${e11}`);
237
238
  return e11;
238
239
  }
239
- function tt(e11) {
240
+ function nt(e11) {
240
241
  return e11.startsWith("template_") ? e11.slice(9) : e11;
241
242
  }
242
- function nt(e11) {
243
+ function rt(e11) {
243
244
  return typeof e11 != "object" || !e11 ? null : "PutLastInstructionOutputOnWorkspace" in e11 ? e11.PutLastInstructionOutputOnWorkspace.key : "TakeFromBucket" in e11 ? e11.TakeFromBucket.output_bucket : "AllocateAddress" in e11 ? e11.AllocateAddress.workspace_id : null;
244
245
  }
245
- var rt = class {
246
+ var it = class {
246
247
  constructor() {
247
248
  __publicField(this, "nextId", 0);
248
249
  __publicField(this, "ids", /* @__PURE__ */ new Map());
@@ -266,15 +267,15 @@ var rt = class {
266
267
  resetFrom(e11) {
267
268
  this.reset();
268
269
  for (let t2 of e11) {
269
- let e12 = nt(t2);
270
+ let e12 = rt(t2);
270
271
  e12 !== null && this.observeAllocated(e12);
271
272
  }
272
273
  }
273
274
  };
274
- function it(e11) {
275
- return new v(`No workspace variable named "${e11}" has been defined. Call builder.saveVar(${JSON.stringify(e11)}) on a preceding instruction whose output you want to reference.`);
275
+ function at(e11) {
276
+ return new b(`No workspace variable named "${e11}" has been defined. Call builder.saveVar(${JSON.stringify(e11)}) on a preceding instruction whose output you want to reference.`);
276
277
  }
277
- var B = class e2 {
278
+ var V = class e2 {
278
279
  constructor(e11, t2) {
279
280
  __publicField(this, "unsignedTransaction");
280
281
  __publicField(this, "workspaceIds");
@@ -285,12 +286,12 @@ var B = class e2 {
285
286
  instructions: [],
286
287
  inputs: [],
287
288
  min_epoch: null,
288
- max_epoch: z(t2, "maxEpoch"),
289
+ max_epoch: B(t2, "maxEpoch"),
289
290
  dry_run: false,
290
291
  main_signer: "None",
291
292
  blobs: [],
292
293
  nonce: 0
293
- }, this.workspaceIds = new rt(), this.feeWorkspaceIds = new rt();
294
+ }, this.workspaceIds = new it(), this.feeWorkspaceIds = new it();
294
295
  }
295
296
  static new(t2, n2) {
296
297
  return new e2(t2, n2);
@@ -298,7 +299,7 @@ var B = class e2 {
298
299
  callFunction(e11, t2) {
299
300
  let n2 = this.resolveArgs(t2);
300
301
  return this.addInstruction({ CallFunction: {
301
- address: tt(e11.templateAddress),
302
+ address: nt(e11.templateAddress),
302
303
  function: e11.functionName,
303
304
  args: n2
304
305
  } });
@@ -307,7 +308,7 @@ var B = class e2 {
307
308
  let n2;
308
309
  if (e11.componentAddress) n2 = { Address: e11.componentAddress };
309
310
  else if (e11.fromWorkspace) n2 = { Workspace: this.requireNamedId(e11.fromWorkspace) };
310
- else throw new v("callMethod requires either `componentAddress` or `fromWorkspace` to be set on the method definition. Use `fromWorkspace` to call a method on a component returned by a previous saveVar; use `componentAddress` for an on-chain component.");
311
+ else throw new b("callMethod requires either `componentAddress` or `fromWorkspace` to be set on the method definition. Use `fromWorkspace` to call a method on a component returned by a previous saveVar; use `componentAddress` for an on-chain component.");
311
312
  let r2 = this.resolveArgs(t2);
312
313
  return this.addInstruction({ CallMethod: {
313
314
  call: n2,
@@ -328,12 +329,24 @@ var B = class e2 {
328
329
  return this.addInstruction({ CallMethod: {
329
330
  call: { Address: e11 },
330
331
  method: "create_proof_for_resource",
331
- args: [j(t2)]
332
+ args: [N(t2)]
332
333
  } });
333
334
  }
334
335
  claimBurn(e11) {
335
336
  return this.addInstruction({ ClaimBurn: { claim: e11 } });
336
337
  }
338
+ setComponentAccessRules(e11, t2) {
339
+ return this.addInstruction({ SetComponentAccessRules: {
340
+ component: { Address: e11 },
341
+ access_rules: t2
342
+ } });
343
+ }
344
+ setComponentOwnerRule(e11, t2) {
345
+ return this.addInstruction({ SetComponentOwnerRule: {
346
+ component: { Address: e11 },
347
+ owner_rule: t2
348
+ } });
349
+ }
337
350
  allocateAddress(e11, t2) {
338
351
  let n2 = this.addNamedId(t2);
339
352
  return this.addInstruction({ AllocateAddress: {
@@ -349,11 +362,11 @@ var B = class e2 {
349
362
  return this.addFeeInstruction({ CallMethod: {
350
363
  call: { Address: e11 },
351
364
  method: "pay_fee",
352
- args: [R(t2)]
365
+ args: [z(t2)]
353
366
  } });
354
367
  }
355
368
  feeTransactionPayFromComponentConfidential(e11, t2) {
356
- throw new v("feeTransactionPayFromComponentConfidential is not implemented: a ConfidentialWithdrawProof Literal must be tari_bor-CBOR-encoded, which the TS SDK does not yet support.");
369
+ throw new b("feeTransactionPayFromComponentConfidential is not implemented: a ConfidentialWithdrawProof Literal must be tari_bor-CBOR-encoded, which the TS SDK does not yet support.");
357
370
  }
358
371
  dropAllProofsInWorkspace() {
359
372
  return this.addInstruction("DropAllProofsInWorkspace");
@@ -389,7 +402,7 @@ var B = class e2 {
389
402
  }
390
403
  observeAllocations(e11, t2) {
391
404
  for (let n2 of t2) {
392
- let t3 = nt(n2);
405
+ let t3 = rt(n2);
393
406
  t3 !== null && e11.observeAllocated(t3);
394
407
  }
395
408
  }
@@ -398,24 +411,24 @@ var B = class e2 {
398
411
  return this.unsignedTransaction.fee_instructions = n2.unsignedTransaction.instructions, this.feeWorkspaceIds.resetFrom(this.unsignedTransaction.fee_instructions), this;
399
412
  }
400
413
  addInput(e11) {
401
- return this.unsignedTransaction.inputs.push(at(e11)), this;
414
+ return this.unsignedTransaction.inputs.push(ot(e11)), this;
402
415
  }
403
416
  withInputs(e11) {
404
- return this.unsignedTransaction.inputs.push(...e11.map(at)), this;
417
+ return this.unsignedTransaction.inputs.push(...e11.map(ot)), this;
405
418
  }
406
419
  withMainSigner(e11) {
407
420
  return this.unsignedTransaction.main_signer = e11, this;
408
421
  }
409
422
  withMinEpoch(e11) {
410
- return this.unsignedTransaction.min_epoch = z(e11, "minEpoch"), this;
423
+ return this.unsignedTransaction.min_epoch = B(e11, "minEpoch"), this;
411
424
  }
412
425
  withMaxEpoch(e11) {
413
- return this.unsignedTransaction.max_epoch = z(e11, "maxEpoch"), this;
426
+ return this.unsignedTransaction.max_epoch = B(e11, "maxEpoch"), this;
414
427
  }
415
428
  withNonce(e11) {
416
- if (typeof e11 == "number" && !Number.isInteger(e11)) throw new v(`withNonce: nonce must be an integer, got ${e11}`);
429
+ if (typeof e11 == "number" && !Number.isInteger(e11)) throw new b(`withNonce: nonce must be an integer, got ${e11}`);
417
430
  let t2 = typeof e11 == "bigint" ? e11 : BigInt(e11);
418
- if (t2 < 0n || t2 > et) throw new v(`withNonce: nonce must fit an unsigned 64-bit integer, got ${e11}`);
431
+ if (t2 < 0n || t2 > tt) throw new b(`withNonce: nonce must fit an unsigned 64-bit integer, got ${e11}`);
419
432
  return this.unsignedTransaction.nonce = t2 > BigInt(2 ** 53 - 1) ? t2 : Number(t2), this;
420
433
  }
421
434
  withUnsignedTransaction(e11) {
@@ -426,7 +439,7 @@ var B = class e2 {
426
439
  inputs: [...e11.inputs],
427
440
  blobs: [...e11.blobs ?? []],
428
441
  nonce: e11.nonce ?? 0,
429
- max_epoch: z(e11.max_epoch, "withUnsignedTransaction: max_epoch")
442
+ max_epoch: B(e11.max_epoch, "withUnsignedTransaction: max_epoch")
430
443
  }, this.workspaceIds.resetFrom(this.unsignedTransaction.instructions), this.feeWorkspaceIds.resetFrom(this.unsignedTransaction.fee_instructions), this;
431
444
  }
432
445
  resolveWorkspaceOffsetId(e11) {
@@ -446,11 +459,11 @@ var B = class e2 {
446
459
  }
447
460
  requireNamedId(e11) {
448
461
  let t2 = this.workspaceIds.get(e11);
449
- if (t2 === void 0) throw it(e11);
462
+ if (t2 === void 0) throw at(e11);
450
463
  return t2;
451
464
  }
452
465
  getOffsetIdFromWorkspaceName(e11) {
453
- let t2 = Xe(e11);
466
+ let t2 = Ze(e11);
454
467
  return {
455
468
  id: this.requireNamedId(t2.name),
456
469
  offset: t2.offset
@@ -460,72 +473,72 @@ var B = class e2 {
460
473
  return e11.map((e12) => typeof e12 == "object" && e12 && "Workspace" in e12 && typeof e12.Workspace == "string" ? { Workspace: this.getOffsetIdFromWorkspaceName(e12.Workspace) } : e12);
461
474
  }
462
475
  };
463
- function at(e11) {
476
+ function ot(e11) {
464
477
  return {
465
478
  substate_id: e11.substate_id,
466
479
  version: e11.version,
467
480
  is_write: "is_write" in e11 ? e11.is_write : true
468
481
  };
469
482
  }
470
- var ot = 12n;
471
- function st(e11) {
483
+ var st = 12n;
484
+ function ct(e11) {
472
485
  let t2 = 0n;
473
486
  for (let n2 of Object.values(e11.cost_breakdown.breakdown)) n2 !== void 0 && (t2 += BigInt(n2));
474
487
  return t2;
475
488
  }
476
- function ct(e11) {
477
- return st(e11) + ot;
489
+ function lt(e11) {
490
+ return ct(e11) + st;
478
491
  }
479
- var lt = {
480
- [u.LocalNet]: "http://localhost:12500",
481
- [u.Esmeralda]: "https://ootle-indexer-a.tari.com"
492
+ var ut = {
493
+ [f.LocalNet]: "http://localhost:12500",
494
+ [f.Esmeralda]: "https://ootle-indexer-a.tari.com"
482
495
  };
483
- function ut(e11) {
484
- let t2 = lt[e11];
496
+ function dt(e11) {
497
+ let t2 = ut[e11];
485
498
  if (t2 !== void 0) return t2;
486
- throw new v(`No default indexer URL is configured for ${u[e11]}. Pass an explicit URL via ProviderBuilder.withUrl(...) or IndexerProvider.connect({ url, network: Network.${u[e11]} }).`);
499
+ throw new b(`No default indexer URL is configured for ${f[e11]}. Pass an explicit URL via ProviderBuilder.withUrl(...) or IndexerProvider.connect({ url, network: Network.${f[e11]} }).`);
487
500
  }
488
- function V(e11, t2, n2) {
501
+ function H(e11, t2, n2) {
489
502
  let r2;
490
503
  try {
491
504
  r2 = t2(n2);
492
505
  } catch (t3) {
493
- throw new _(`${e11}: value is not a valid CBOR encoding: ${String(t3)}`, {
506
+ throw new y(`${e11}: value is not a valid CBOR encoding: ${String(t3)}`, {
494
507
  cause: t3,
495
508
  context: e11
496
509
  });
497
510
  }
498
511
  return JSON.parse(r2);
499
512
  }
500
- function dt(e11) {
501
- return V("decodeSubstateValue", ue, e11);
502
- }
503
513
  function ft(e11) {
504
- return V("decodeExecuteResult", ce, e11);
514
+ return H("decodeSubstateValue", ce, e11);
505
515
  }
506
516
  function pt(e11) {
507
- return V("decodeTransactionReceipt", de, e11);
517
+ return H("decodeExecuteResult", oe, e11);
508
518
  }
509
519
  function mt(e11) {
510
- return V("decodeEvent", se, e11);
520
+ return H("decodeTransactionReceipt", le, e11);
511
521
  }
512
522
  function ht(e11) {
513
- return V("decodeResource", le, e11);
523
+ return H("decodeEvent", ae, e11);
514
524
  }
515
525
  function gt(e11) {
516
- return V("decodeUtxo", fe, e11);
526
+ return H("decodeResource", se, e11);
517
527
  }
518
- function H(e11) {
519
- return "up" in e11.state ? dt(e11.state.up.substate) : null;
528
+ function _t(e11) {
529
+ return H("decodeUtxo", ue, e11);
520
530
  }
521
- var _t = 132, vt = 32;
522
- function* yt(e11) {
531
+ function vt(e11) {
532
+ return "up" in e11.state ? ft(e11.state.up.substate) : null;
533
+ }
534
+ var yt = 132, bt = 32;
535
+ function* xt(e11) {
523
536
  let t2 = /* @__PURE__ */ new Set();
524
- for (let n2 of U(e11, _t)) n2.length === vt * 2 && !t2.has(n2) && (t2.add(n2), yield `vault_${n2}`);
537
+ for (let n2 of U(e11, yt)) n2.length === bt * 2 && !t2.has(n2) && (t2.add(n2), yield `vault_${n2}`);
525
538
  }
526
- async function bt(e11, t2) {
527
- let n2 = H(await e11.getSubstate(t2));
528
- return St(n2) ? Array.from(yt(n2.Component.body.state)) : [];
539
+ async function St(e11, t2) {
540
+ let n2 = vt(await e11.getSubstate(t2));
541
+ return wt(n2) ? Array.from(xt(n2.Component.body.state)) : [];
529
542
  }
530
543
  function* U(e11, t2) {
531
544
  if (Array.isArray(e11)) {
@@ -538,7 +551,7 @@ function* U(e11, t2) {
538
551
  if (r2 === "tag") {
539
552
  let e12 = n2.value;
540
553
  if (n2.tag === t2) {
541
- let t3 = xt(e12);
554
+ let t3 = Ct(e12);
542
555
  t3 !== null && (yield t3);
543
556
  }
544
557
  yield* U(e12, t2);
@@ -550,105 +563,124 @@ function* U(e11, t2) {
550
563
  }
551
564
  for (let e12 of Object.values(n2)) yield* U(e12, t2);
552
565
  }
553
- function xt(e11) {
566
+ function Ct(e11) {
554
567
  if (typeof e11 != "object" || !e11) return null;
555
568
  let t2 = e11;
556
569
  if (t2["@cbor"] !== "bytes") return null;
557
570
  let n2 = t2.hex;
558
571
  return typeof n2 == "string" ? n2 : null;
559
572
  }
560
- function St(e11) {
573
+ function wt(e11) {
561
574
  return typeof e11 == "object" && !!e11 && "Component" in e11;
562
575
  }
563
- var Ct = "resource_0101010101010101010101010101010101010101010101010101010101010101", wt = "component_0102030000000000000000000000000000000000000000000000000000000000", Tt = "vault_0102030000000000000000000000000000000000000000000000000000000001", Et = "resource_0102030000000000000000000000000000000000000000000000000000000002", Dt = "__ootleRawJson", Ot = "stealth_revealed_input", kt = "stealth_revealed_change";
564
- function At(e11, t2) {
576
+ var Tt = "resource_0101010101010101010101010101010101010101010101010101010101010101", Et = "component_0102030000000000000000000000000000000000000000000000000000000000", Dt = "vault_0102030000000000000000000000000000000000000000000000000000000001", Ot = "resource_0102030000000000000000000000000000000000000000000000000000000002", kt = "__ootleRawJson", At = "stealth_revealed_input", jt = "stealth_revealed_change";
577
+ function Mt(e11, t2) {
565
578
  let n2 = e11.revealedInputBucket === null ? null : t2(e11.revealedInputBucket);
566
579
  return { StealthTransfer: {
567
580
  resource_address_ref: { Address: e11.resourceAddress },
568
- statement: W(e11.statement),
581
+ statement: Nt(e11.statement),
569
582
  revealed_input_bucket: n2
570
583
  } };
571
584
  }
572
- function W(e11) {
573
- return { [Dt]: e11.toCompactJson() };
585
+ function Nt(e11) {
586
+ return { [kt]: e11.toCompactJson() };
574
587
  }
575
- function G(e11) {
588
+ function W(e11) {
576
589
  return typeof e11 == "object" && !!e11 && "StealthTransfer" in e11;
577
590
  }
578
- function K(e11) {
591
+ function G(e11) {
579
592
  let t2 = [], n2 = (e12) => `__ootleRawJson:${e12}__`, r2 = JSON.stringify(e11, (e12, r3) => {
580
593
  if (typeof r3 == "bigint") return r3.toString();
581
594
  if (typeof r3 == "object" && r3 && "__ootleRawJson" in r3) {
582
595
  let e13 = n2(t2.length);
583
- return t2.push(r3[Dt]), e13;
596
+ return t2.push(r3[kt]), e13;
584
597
  }
585
598
  return r3;
586
599
  });
587
600
  for (let e12 = 0; e12 < t2.length; e12++) {
588
601
  let i2 = JSON.stringify(n2(e12)), a2 = r2.indexOf(i2);
589
- if (a2 < 0) throw new v(`serializeUnsignedTx: raw-JSON placeholder ${e12} was not emitted`);
590
- if (r2.indexOf(i2, a2 + i2.length) >= 0) throw new v(`serializeUnsignedTx: raw-JSON placeholder ${e12} collided with transaction data`);
602
+ if (a2 < 0) throw new b(`serializeUnsignedTx: raw-JSON placeholder ${e12} was not emitted`);
603
+ if (r2.indexOf(i2, a2 + i2.length) >= 0) throw new b(`serializeUnsignedTx: raw-JSON placeholder ${e12} collided with transaction data`);
591
604
  r2 = r2.slice(0, a2) + t2[e12] + r2.slice(a2 + i2.length);
592
605
  }
593
606
  return r2;
594
607
  }
595
- async function q(e11, t2) {
608
+ async function K(e11, t2) {
596
609
  let n2 = await e11.resolveInputs(t2.inputs);
597
610
  return {
598
611
  ...t2,
599
612
  inputs: n2
600
613
  };
601
614
  }
602
- function jt() {
615
+ function Pt() {
603
616
  let { secret_key: e11, public_key: t2 } = o();
604
617
  return {
605
618
  secret_key: e11,
606
619
  public_key: t2
607
620
  };
608
621
  }
609
- function Mt(e11, t2) {
622
+ function Ft(e11, t2) {
610
623
  return {
611
- public_key: b(y(e11, 32, "publicKey")),
612
- signature: b(y(t2, 64, "sr25519 signature"))
624
+ public_key: S(x(e11, 32, "publicKey")),
625
+ signature: S(x(t2, 64, "sr25519 signature"))
613
626
  };
614
627
  }
615
- async function J(e11, t2) {
628
+ function q(e11) {
629
+ let t2 = /* @__PURE__ */ new Map();
630
+ for (let [n2, r2] of e11.entries()) t2.set(S(x(r2, 32, `authorizers[${n2}]`)), r2);
631
+ return [...t2.keys()].sort().map((e12) => t2.get(e12));
632
+ }
633
+ function It(e11) {
634
+ let t2 = q(e11), n2 = new Uint8Array(t2.length * 32);
635
+ return t2.forEach((e12, t3) => n2.set(e12, t3 * 32)), n2;
636
+ }
637
+ async function J(e11) {
638
+ let t2 = [];
639
+ for (let n2 of e11) n2.getAuthorizerPublicKeys === void 0 ? t2.push(await n2.getPublicKey()) : t2.push(...await n2.getAuthorizerPublicKeys());
640
+ return q(t2);
641
+ }
642
+ async function Y(e11, t2) {
616
643
  if (t2.main_signer !== "None" || e11.length === 0) return t2;
617
- let n2 = y(await e11[0].getPublicKey(), 32, "main signer public key");
644
+ let n2 = x(await e11[0].getPublicKey(), 32, "main signer public key");
618
645
  return {
619
646
  ...t2,
620
- main_signer: { Authorizer: b(n2) }
647
+ main_signer: { Authorizer: S(n2) }
621
648
  };
622
649
  }
623
- async function Nt(e11, t2, n2) {
624
- return Pt(e11, await J(e11, t2), n2);
650
+ async function Lt(e11, t2, n2) {
651
+ return Rt(e11, await Y(e11, t2), n2);
625
652
  }
626
- async function Pt(e11, t2, n2) {
627
- let r2 = n2 ?? o(), i2 = y(r2.secret_key, 32, "sealKeypair.secret_key"), a2 = y(r2.public_key, 32, "sealKeypair.public_key"), s2 = [];
653
+ async function Rt(e11, t2, n2, r2) {
654
+ let i2 = n2 ?? o(), a2 = x(i2.secret_key, 32, "sealKeypair.secret_key"), s2 = x(i2.public_key, 32, "sealKeypair.public_key"), c2 = r2 === void 0 ? await J(e11) : q(r2), l2 = [];
628
655
  for (let n3 of e11) {
629
- let e12 = await n3.signTransaction(t2, a2);
630
- s2.push(...e12);
656
+ let e12 = await n3.signTransaction(t2, s2, c2);
657
+ l2.push(...e12);
631
658
  }
632
- let c2 = ne(`{"transaction":${K(t2)},"signatures":${JSON.stringify(s2)}}`, i2);
659
+ let u2 = zt(l2, c2), d2 = ee(`{"transaction":${G(t2)},"signatures":${JSON.stringify(u2)}}`, a2);
633
660
  return {
634
- sealedJson: c2,
635
- transaction: JSON.parse(c2)
661
+ sealedJson: d2,
662
+ transaction: JSON.parse(d2)
636
663
  };
637
664
  }
638
- function Y(e11) {
665
+ function zt(e11, t2) {
666
+ let n2 = t2.map(S), r2 = [...e11].sort((e12, t3) => e12.public_key.toLowerCase() < t3.public_key.toLowerCase() ? -1 : e12.public_key.toLowerCase() > t3.public_key.toLowerCase() ? 1 : 0), i2 = r2.map((e12) => e12.public_key.toLowerCase());
667
+ if (i2.length !== n2.length || i2.some((e12, t3) => e12 !== n2[t3])) throw new v(`signTransaction: the signatures (${i2.join(", ") || "none"}) do not match the authorizer set (${n2.join(", ") || "none"}). Every authorizer must sign exactly once over the full set.`);
668
+ return r2;
669
+ }
670
+ function X(e11) {
639
671
  return n(e11.sealedJson);
640
672
  }
641
- async function Ft(e11, t2) {
673
+ async function Bt(e11, t2) {
642
674
  return (await e11.submitTransaction(t2)).transaction_id;
643
675
  }
644
- function It(e11) {
676
+ function Vt(e11) {
645
677
  var _a;
646
678
  if (e11 === "Pending" || !("Finalized" in e11)) return null;
647
679
  let t2 = e11.Finalized, n2 = t2.final_decision;
648
680
  if (n2 === null) return null;
649
681
  if (n2 === "Commit") return { outcome: n2 };
650
682
  if (typeof n2 == "object" && n2 && "Abort" in n2) {
651
- let e12 = t2.abort_details ?? JSON.stringify(n2.Abort), r2 = t2.execution_result === null ? void 0 : (_a = ft(t2.execution_result).finalize) == null ? void 0 : _a.result;
683
+ let e12 = t2.abort_details ?? JSON.stringify(n2.Abort), r2 = t2.execution_result === null ? void 0 : (_a = pt(t2.execution_result).finalize) == null ? void 0 : _a.result;
652
684
  return typeof r2 == "object" && r2 && "AcceptFeeRejectRest" in r2 ? {
653
685
  outcome: "FeeIntentCommit",
654
686
  reason: e12
@@ -657,19 +689,19 @@ function It(e11) {
657
689
  reason: e12
658
690
  };
659
691
  }
660
- throw new v(`Unexpected final_decision variant: ${JSON.stringify(n2)}`);
692
+ throw new b(`Unexpected final_decision variant: ${JSON.stringify(n2)}`);
661
693
  }
662
- async function Lt(e11, t2, n2) {
694
+ async function Ht(e11, t2, n2) {
663
695
  let r2 = (n2 == null ? void 0 : n2.pollIntervalMs) ?? 500, i2 = (n2 == null ? void 0 : n2.timeoutMs) ?? 6e4, a2 = Date.now() + i2;
664
696
  for (; ; ) {
665
697
  let n3 = await e11.getTransactionResult(t2), o2 = n3.result;
666
698
  if (o2 !== "Pending" && "Finalized" in o2) {
667
- let { outcome: e12, reason: r3 } = It(o2) ?? { outcome: "Reject" };
668
- if (e12 === "Reject") throw new f(`Transaction ${t2} was rejected: ${r3}`, {
699
+ let { outcome: e12, reason: r3 } = Vt(o2) ?? { outcome: "Reject" };
700
+ if (e12 === "Reject") throw new m(`Transaction ${t2} was rejected: ${r3}`, {
669
701
  txId: t2,
670
702
  reason: r3 ?? ""
671
703
  });
672
- if (e12 === "FeeIntentCommit") throw new f(`Transaction ${t2} only committed fees (execution aborted): ${r3}`, {
704
+ if (e12 === "FeeIntentCommit") throw new m(`Transaction ${t2} only committed fees (execution aborted): ${r3}`, {
673
705
  txId: t2,
674
706
  reason: `FeeIntentCommit: ${r3 ?? ""}`
675
707
  });
@@ -679,22 +711,22 @@ async function Lt(e11, t2, n2) {
679
711
  await new Promise((e12) => setTimeout(e12, r2));
680
712
  }
681
713
  }
682
- async function Rt(e11, t2, n2, r2) {
683
- let i2 = await q(e11, n2);
684
- return Lt(e11, await Ft(e11, Y(await Nt(Array.isArray(t2) ? t2 : [t2], i2))), r2);
714
+ async function Ut(e11, t2, n2, r2) {
715
+ let i2 = await K(e11, n2);
716
+ return Ht(e11, await Bt(e11, X(await Lt(Array.isArray(t2) ? t2 : [t2], i2))), r2);
685
717
  }
686
- async function zt(e11, t2, n2, r2) {
687
- return Rt(e11, t2, {
718
+ async function Wt(e11, t2, n2, r2) {
719
+ return Ut(e11, t2, {
688
720
  ...n2,
689
721
  dry_run: true
690
722
  }, r2);
691
723
  }
692
- var Bt = class {
724
+ var Gt = class {
693
725
  constructor(e11) {
694
726
  __publicField(this, "publicKey");
695
727
  __publicField(this, "sign");
696
728
  __publicField(this, "address");
697
- this.publicKey = y(e11.publicKey, 32, "ExternalKeySigner publicKey"), y(e11.viewPublicKey, 32, "ExternalKeySigner viewPublicKey"), this.sign = e11.sign, this.address = s(this.publicKey, e11.viewPublicKey, e11.network);
729
+ this.publicKey = x(e11.publicKey, 32, "ExternalKeySigner publicKey"), x(e11.viewPublicKey, 32, "ExternalKeySigner viewPublicKey"), this.sign = e11.sign, this.address = s(this.publicKey, e11.viewPublicKey, e11.network);
698
730
  }
699
731
  async getAddress() {
700
732
  return Promise.resolve(this.address);
@@ -702,30 +734,30 @@ var Bt = class {
702
734
  async getPublicKey() {
703
735
  return Promise.resolve(this.publicKey);
704
736
  }
705
- async signTransaction(e11, n2) {
706
- y(n2, 32, "ExternalKeySigner.signTransaction sealPublicKey");
707
- let r2 = K(e11), i2 = ee(r2, n2), a2;
737
+ async signTransaction(e11, n2, r2) {
738
+ x(n2, 32, "ExternalKeySigner.signTransaction sealPublicKey");
739
+ let i2 = G(e11), a2 = It(r2), o2 = u(i2, n2, a2), s2;
708
740
  try {
709
- a2 = await this.sign(i2);
741
+ s2 = await this.sign(o2);
710
742
  } catch (e12) {
711
- throw new g(`External signer failed: ${Vt(e12)}`, { cause: e12 });
743
+ throw new v(`External signer failed: ${Kt(e12)}`, { cause: e12 });
712
744
  }
713
- let o2;
745
+ let c2;
714
746
  try {
715
- o2 = t(r2, this.publicKey, a2, n2);
747
+ c2 = t(i2, this.publicKey, s2, n2, a2);
716
748
  } catch (e12) {
717
- throw new g(`External signature rejected: ${Vt(e12)}`, { cause: e12 });
749
+ throw new v(`External signature rejected: ${Kt(e12)}`, { cause: e12 });
718
750
  }
719
- return JSON.parse(o2).signatures;
751
+ return JSON.parse(c2).signatures;
720
752
  }
721
753
  };
722
- function Vt(e11) {
754
+ function Kt(e11) {
723
755
  return e11 instanceof Error ? e11.message : String(e11);
724
756
  }
725
- var Ht = class {
757
+ var qt = class {
726
758
  constructor(e11, t2) {
727
759
  __publicField(this, "builder");
728
- this.builder = B.new(e11, t2);
760
+ this.builder = V.new(e11, t2);
729
761
  }
730
762
  withInputs(e11) {
731
763
  return this.builder.withInputs(e11), this;
@@ -737,7 +769,7 @@ var Ht = class {
737
769
  return this.builder.callMethod({
738
770
  componentAddress: e11,
739
771
  methodName: "withdraw"
740
- }, [j(t2), R(n2)]).saveVar("bucket").callMethod({
772
+ }, [N(t2), z(n2)]).saveVar("bucket").callMethod({
741
773
  componentAddress: r2,
742
774
  methodName: "deposit"
743
775
  }, [{ Workspace: "bucket" }]), this;
@@ -748,11 +780,11 @@ var Ht = class {
748
780
  build() {
749
781
  return this.builder.buildUnsignedTransaction();
750
782
  }
751
- }, Ut = class {
783
+ }, Jt = class {
752
784
  constructor(e11, t2, n2) {
753
785
  __publicField(this, "builder");
754
786
  __publicField(this, "faucetAddress");
755
- this.builder = B.new(e11, t2), this.faucetAddress = n2;
787
+ this.builder = V.new(e11, t2), this.faucetAddress = n2;
756
788
  }
757
789
  feeTransactionPayFromComponent(e11, t2) {
758
790
  return this.builder.feeTransactionPayFromComponent(e11, t2), this;
@@ -761,7 +793,7 @@ var Ht = class {
761
793
  return this.builder.callMethod({
762
794
  componentAddress: this.faucetAddress,
763
795
  methodName: "take_free_coins"
764
- }, [R(t2)]).saveVar("faucet_bucket").callMethod({
796
+ }, [z(t2)]).saveVar("faucet_bucket").callMethod({
765
797
  componentAddress: e11,
766
798
  methodName: "deposit"
767
799
  }, [{ Workspace: "faucet_bucket" }]), this;
@@ -785,7 +817,7 @@ var Ht = class {
785
817
  build() {
786
818
  return this.builder.buildUnsignedTransaction();
787
819
  }
788
- }, Wt = class {
820
+ }, Yt = class {
789
821
  constructor() {
790
822
  __publicField(this, "keyProviders");
791
823
  __publicField(this, "defaultSignerAddress", null);
@@ -798,23 +830,27 @@ var Ht = class {
798
830
  return this.requireKeyProvider(e11, "explicit"), this.defaultSignerAddress = e11, this;
799
831
  }
800
832
  async getAddress() {
801
- if (!this.defaultSignerAddress) throw new h("No default signer address set. Call setDefaultSigner() first.");
833
+ if (!this.defaultSignerAddress) throw new _("No default signer address set. Call setDefaultSigner() first.");
802
834
  return Promise.resolve(this.defaultSignerAddress);
803
835
  }
804
836
  async getPublicKey() {
805
837
  return this.getSignerOrThrow().getPublicKey();
806
838
  }
807
- async signTransaction(e11, t2) {
808
- return this.getSignerOrThrow().signTransaction(e11, t2);
839
+ async signTransaction(e11, t2, n2) {
840
+ return this.getSignerOrThrow().signTransaction(e11, t2, n2);
841
+ }
842
+ async getAuthorizerPublicKeys() {
843
+ return J([this.getSignerOrThrow()]);
809
844
  }
810
- async authorizeTransaction(e11, t2, n2) {
845
+ async authorizeTransaction(e11, t2, n2, r2) {
811
846
  return {
812
847
  signerAddress: e11,
813
- signatures: await this.requireKeyProvider(e11, "explicit").signTransaction(t2, n2)
848
+ signatures: await this.requireKeyProvider(e11, "explicit").signTransaction(t2, n2, r2)
814
849
  };
815
850
  }
816
- async authorizeTransactionAll(e11, t2) {
817
- return Promise.all([...this.keyProviders.keys()].map((n2) => this.authorizeTransaction(n2, e11, t2)));
851
+ async authorizeTransactionAll(e11, t2, n2) {
852
+ let r2 = n2 ?? await J([...this.keyProviders.values()]);
853
+ return Promise.all([...this.keyProviders.keys()].map((n3) => this.authorizeTransaction(n3, e11, t2, r2)));
818
854
  }
819
855
  getKeyProvider(e11) {
820
856
  return this.keyProviders.get(e11);
@@ -823,26 +859,26 @@ var Ht = class {
823
859
  return [...this.keyProviders.keys()];
824
860
  }
825
861
  getSignerOrThrow() {
826
- if (!this.defaultSignerAddress) throw new h("No default signer address set. Call setDefaultSigner() first.");
862
+ if (!this.defaultSignerAddress) throw new _("No default signer address set. Call setDefaultSigner() first.");
827
863
  return this.requireKeyProvider(this.defaultSignerAddress, "default");
828
864
  }
829
865
  requireKeyProvider(e11, t2) {
830
866
  let n2 = this.keyProviders.get(e11);
831
- if (n2 === void 0) throw new m(t2 === "default" ? `No key provider registered for default address: ${e11}. Call wallet.registerKeyProvider(address, signer) for that address, or pick a different default with setDefaultSigner(otherAddress).` : `No key provider registered for address: ${e11}. Call wallet.registerKeyProvider(${JSON.stringify(e11)}, signer) before signing.`, { address: e11 });
867
+ if (n2 === void 0) throw new g(t2 === "default" ? `No key provider registered for default address: ${e11}. Call wallet.registerKeyProvider(address, signer) for that address, or pick a different default with setDefaultSigner(otherAddress).` : `No key provider registered for address: ${e11}. Call wallet.registerKeyProvider(${JSON.stringify(e11)}, signer) before signing.`, { address: e11 });
832
868
  return n2;
833
869
  }
834
- }, Gt = class {
870
+ }, Xt = class {
835
871
  constructor(e11, t2) {
836
872
  __publicField(this, "bytes");
837
- this.bytes = new Uint8Array(y(e11, 32, t2));
873
+ this.bytes = new Uint8Array(x(e11, 32, t2));
838
874
  }
839
875
  toBytes() {
840
876
  return new Uint8Array(this.bytes);
841
877
  }
842
878
  toHex() {
843
- return b(this.bytes);
879
+ return S(this.bytes);
844
880
  }
845
- }, X = class e3 extends Gt {
881
+ }, Z = class e3 extends Xt {
846
882
  constructor(e11) {
847
883
  super(e11, "Mask");
848
884
  }
@@ -853,44 +889,44 @@ var Ht = class {
853
889
  return new e3(t2);
854
890
  }
855
891
  static fromHex(t2) {
856
- return new e3(x(t2));
892
+ return new e3(C(t2));
857
893
  }
858
- }, Kt = class e4 {
894
+ }, Zt = class e4 {
859
895
  constructor(e11) {
860
896
  __publicField(this, "bytes");
861
897
  this.bytes = new Uint8Array(e11);
862
898
  }
863
899
  static fromHex(t2) {
864
- return new e4(x(t2));
900
+ return new e4(C(t2));
865
901
  }
866
902
  toBytes() {
867
903
  return new Uint8Array(this.bytes);
868
904
  }
869
905
  toHex() {
870
- return b(this.bytes);
906
+ return S(this.bytes);
871
907
  }
872
- }, qt = Object.freeze({ StealthPublicKey: Object.freeze({}) });
873
- function Jt(e11) {
874
- if (e11.amount <= 0n) throw new v(`Output amount must be > 0, got ${e11.amount}`);
908
+ }, Qt = Object.freeze({ StealthPublicKey: Object.freeze({}) });
909
+ function $t(e11) {
910
+ if (e11.amount <= 0n) throw new b(`Output amount must be > 0, got ${e11.amount}`);
875
911
  return {
876
912
  destination: e11.destination,
877
913
  amount: e11.amount,
878
914
  resourceAddress: e11.resourceAddress,
879
915
  resourceViewKey: e11.resourceViewKey === void 0 ? void 0 : new Uint8Array(e11.resourceViewKey),
880
916
  memo: e11.memo,
881
- payTo: e11.payTo ?? qt,
917
+ payTo: e11.payTo ?? Qt,
882
918
  minimumValuePromise: e11.minimumValuePromise ?? 0n
883
919
  };
884
920
  }
885
- function Yt(e11, t2) {
886
- if (e11.trim() === "") throw new v(`${t2} must be a non-empty decimal string`);
921
+ function en(e11, t2) {
922
+ if (e11.trim() === "") throw new b(`${t2} must be a non-empty decimal string`);
887
923
  return BigInt(e11);
888
924
  }
889
- function Xt(e11, t2) {
925
+ function tn(e11, t2) {
890
926
  let n2 = e11.trim();
891
- if (!n2.startsWith("{") || !n2.endsWith("}")) throw new v(`StealthTransferStatement.toCompactJson: ${t2} fragment is not a JSON object (got: ${e11.slice(0, 60)}...)`);
927
+ if (!n2.startsWith("{") || !n2.endsWith("}")) throw new b(`StealthTransferStatement.toCompactJson: ${t2} fragment is not a JSON object (got: ${e11.slice(0, 60)}...)`);
892
928
  }
893
- var Z = class e5 extends Gt {
929
+ var nn = class e5 extends Xt {
894
930
  constructor(e11) {
895
931
  super(e11, "StealthInput.commitment");
896
932
  }
@@ -901,13 +937,13 @@ var Z = class e5 extends Gt {
901
937
  return { commitment: this.toHex() };
902
938
  }
903
939
  static fromJSON(t2) {
904
- return new e5(x(t2.commitment));
940
+ return new e5(C(t2.commitment));
905
941
  }
906
- }, Q = class e6 {
942
+ }, rn = class e6 {
907
943
  constructor(e11, t2) {
908
944
  __publicField(this, "_publicNonce");
909
945
  __publicField(this, "_signature");
910
- this._publicNonce = new Uint8Array(y(e11, 32, "BalanceProofSignature.publicNonce")), this._signature = new Uint8Array(y(t2, 32, "BalanceProofSignature.signature"));
946
+ this._publicNonce = new Uint8Array(x(e11, 32, "BalanceProofSignature.publicNonce")), this._signature = new Uint8Array(x(t2, 32, "BalanceProofSignature.signature"));
911
947
  }
912
948
  get publicNonce() {
913
949
  return new Uint8Array(this._publicNonce);
@@ -917,14 +953,14 @@ var Z = class e5 extends Gt {
917
953
  }
918
954
  toJSON() {
919
955
  return {
920
- public_nonce: b(this._publicNonce),
921
- signature: b(this._signature)
956
+ public_nonce: S(this._publicNonce),
957
+ signature: S(this._signature)
922
958
  };
923
959
  }
924
960
  static fromJSON(t2) {
925
- return new e6(x(t2.public_nonce), x(t2.signature));
961
+ return new e6(C(t2.public_nonce), C(t2.signature));
926
962
  }
927
- }, Zt = class e7 {
963
+ }, an = class e7 {
928
964
  constructor(e11, t2, n2) {
929
965
  __publicField(this, "inputs");
930
966
  __publicField(this, "revealedAmount");
@@ -937,13 +973,13 @@ var Z = class e5 extends Gt {
937
973
  toJSON() {
938
974
  return {
939
975
  inputs: this.inputs.map((e11) => e11.toJSON()),
940
- revealed_amount: Ye(this.revealedAmount)
976
+ revealed_amount: Xe(this.revealedAmount)
941
977
  };
942
978
  }
943
979
  static fromJSON(t2) {
944
- return new e7(t2.inputs.map(Z.fromJSON), Yt(t2.revealed_amount, "revealed_amount"));
980
+ return new e7(t2.inputs.map(nn.fromJSON), en(t2.revealed_amount, "revealed_amount"));
945
981
  }
946
- }, Qt = class e8 {
982
+ }, on = class e8 {
947
983
  constructor(e11) {
948
984
  __publicField(this, "statementJson");
949
985
  this.statementJson = e11;
@@ -957,7 +993,7 @@ var Z = class e5 extends Gt {
957
993
  static fromJSON(t2) {
958
994
  return new e8(t2);
959
995
  }
960
- }, $ = class e9 {
996
+ }, Q = class e9 {
961
997
  constructor(e11, t2, n2) {
962
998
  __publicField(this, "inputsStatement");
963
999
  __publicField(this, "outputsStatement");
@@ -973,120 +1009,121 @@ var Z = class e5 extends Gt {
973
1009
  }
974
1010
  toCompactJson() {
975
1011
  let e11 = this.inputsStatement.statementJson ?? JSON.stringify(this.inputsStatement.toJSON()), t2 = this.outputsStatement.statementJson;
976
- Xt(e11, "inputs_statement"), Xt(t2, "outputs_statement");
1012
+ tn(e11, "inputs_statement"), tn(t2, "outputs_statement");
977
1013
  let n2 = `{"inputs_statement":${e11},"outputs_statement":${t2},"covenant_claims":[]`;
978
1014
  return this.balanceProof !== void 0 && (n2 += `,"balance_proof":${JSON.stringify(this.balanceProof.toJSON())}`), n2 + "}";
979
1015
  }
980
1016
  static fromJSON(t2) {
981
- return new e9(Zt.fromJSON(t2.inputs), Qt.fromJSON(t2.outputs), t2.balance_proof === void 0 ? void 0 : Q.fromJSON(t2.balance_proof));
1017
+ return new e9(an.fromJSON(t2.inputs), on.fromJSON(t2.outputs), t2.balance_proof === void 0 ? void 0 : rn.fromJSON(t2.balance_proof));
982
1018
  }
983
1019
  };
984
- function $t(e11, t2) {
1020
+ function sn(e11, t2) {
985
1021
  let n2 = new Uint8Array(e11.length * 32);
986
1022
  for (let r2 = 0; r2 < e11.length; r2++) {
987
1023
  let i2 = e11[r2];
988
- y(i2, 32, `${t2}[${r2}]`), n2.set(i2, r2 * 32);
1024
+ x(i2, 32, `${t2}[${r2}]`), n2.set(i2, r2 * 32);
989
1025
  }
990
1026
  return n2;
991
1027
  }
992
- var en = "[]", tn = class {
993
- constructor(e11 = u.LocalNet) {
1028
+ var cn = "[]", $ = class {
1029
+ constructor(e11 = f.LocalNet) {
994
1030
  __publicField(this, "network");
995
1031
  this.network = e11;
996
1032
  }
997
1033
  async generateOutputsStatement(e11, t2) {
998
1034
  let n2 = `[${e11.map((e12) => this.outputWitness(e12)).join(",")}]`, r2 = 0n, i2 = new Uint8Array(32);
999
- t2 !== null && (y(t2.receiver, 32, "revealed output receiver"), r2 = t2.amount, i2 = t2.receiver);
1035
+ t2 !== null && (x(t2.receiver, 32, "revealed output receiver"), r2 = t2.amount, i2 = t2.receiver);
1000
1036
  let a2 = l(n2, r2, i2);
1001
- return y(a2.aggregated_output_mask, 32, "StealthOutputsResult.aggregated_output_mask"), {
1002
- statement: Qt.fromJSON(a2.statement_json),
1003
- outputMask: X.fromBytes(a2.aggregated_output_mask)
1037
+ return x(a2.aggregated_output_mask, 32, "StealthOutputsResult.aggregated_output_mask"), {
1038
+ statement: on.fromJSON(a2.statement_json),
1039
+ outputMask: Z.fromBytes(a2.aggregated_output_mask)
1004
1040
  };
1005
1041
  }
1006
1042
  outputWitness(e11) {
1007
- let t2 = te(e11.destination), n2 = nn(e11.payTo) ? null : JSON.stringify(e11.payTo), r2 = e11.memo === void 0 ? null : JSON.stringify(e11.memo), a2 = e11.resourceViewKey ?? null;
1043
+ let t2 = d(e11.destination), n2 = ln(e11.payTo) ? null : JSON.stringify(e11.payTo), r2 = e11.memo === void 0 ? null : JSON.stringify(e11.memo), a2 = e11.resourceViewKey ?? null;
1008
1044
  return i(this.network, t2.owner_key, t2.view_key, e11.amount, e11.resourceAddress, a2, r2, n2, e11.minimumValuePromise);
1009
1045
  }
1010
1046
  async buildInputsStatement(e11, t2) {
1011
- return new Zt(e11, t2, r($t(e11.map((e12) => e12.commitment), "input commitment"), t2));
1047
+ return new an(e11, t2, r(sn(e11.map((e12) => e12.commitment), "input commitment"), t2));
1012
1048
  }
1013
1049
  async generateBalanceProofSignature(e11, t2, n2, r2) {
1014
- let i2 = c(e11.toBytes(), t2.toBytes(), n2, r2, en);
1015
- return y(i2.public_nonce, 32, "balance proof public_nonce"), y(i2.signature, 32, "balance proof signature"), new Q(i2.public_nonce, i2.signature);
1050
+ let i2 = c(e11.toBytes(), t2.toBytes(), n2, r2, cn);
1051
+ return x(i2.public_nonce, 32, "balance proof public_nonce"), x(i2.signature, 32, "balance proof signature"), new rn(i2.public_nonce, i2.signature);
1016
1052
  }
1017
1053
  async validateBalanceProofSignature(e11, t2, n2) {
1018
- return ae(e11.publicNonce, e11.signature, t2, n2, en);
1054
+ return re(e11.publicNonce, e11.signature, t2, n2, cn);
1019
1055
  }
1020
1056
  async deriveAeadKey(e11, t2) {
1021
- y(e11, 32, "deriveAeadKey privateKey"), y(t2, 32, "deriveAeadKey publicKey");
1057
+ x(e11, 32, "deriveAeadKey privateKey"), x(t2, 32, "deriveAeadKey publicKey");
1022
1058
  let n2 = a(e11, t2);
1023
- return y(n2, 32, "derived AEAD key"), n2;
1059
+ return x(n2, 32, "derived AEAD key"), n2;
1024
1060
  }
1025
1061
  async unblindOutput(e11, t2, n2, r2) {
1026
- y(e11, 32, "unblindOutput commitment"), y(n2, 32, "unblindOutput aeadKey");
1027
- let i2 = ie(e11, t2, n2, r2);
1062
+ x(e11, 32, "unblindOutput commitment"), x(n2, 32, "unblindOutput aeadKey");
1063
+ let i2 = ne(e11, t2, n2, r2);
1028
1064
  return {
1029
- mask: X.fromBytes(i2.mask),
1065
+ mask: Z.fromBytes(i2.mask),
1030
1066
  value: i2.value,
1031
1067
  memo: i2.memo_json ?? void 0
1032
1068
  };
1033
1069
  }
1034
1070
  async aggregateInputMasks(t2) {
1035
- let n2 = e($t(t2.map((e11) => e11.toBytes()), "input mask"));
1036
- return X.fromBytes(n2);
1071
+ let n2 = e(sn(t2.map((e11) => e11.toBytes()), "input mask"));
1072
+ return Z.fromBytes(n2);
1037
1073
  }
1038
1074
  async stealthDhSecret(e11, t2, n2, r2) {
1039
- y(t2, 32, "stealthDhSecret ownerSecret"), y(n2, 32, "stealthDhSecret viewSecret"), y(r2, 32, "stealthDhSecret publicNonce");
1040
- let i2 = re(e11, t2, n2, r2);
1041
- return y(i2, 32, "stealth DH secret"), i2;
1075
+ x(t2, 32, "stealthDhSecret ownerSecret"), x(n2, 32, "stealthDhSecret viewSecret"), x(r2, 32, "stealthDhSecret publicNonce");
1076
+ let i2 = te(e11, t2, n2, r2);
1077
+ return x(i2, 32, "stealth DH secret"), i2;
1042
1078
  }
1043
1079
  async validateTransfer(e11) {
1044
- oe(e11.toCompactJson(), null);
1080
+ ie(e11.toCompactJson(), null);
1045
1081
  }
1046
1082
  };
1047
- function nn(e11) {
1083
+ function ln(e11) {
1048
1084
  let t2 = Object.keys(e11);
1049
1085
  if (t2.length !== 1 || t2[0] !== "StealthPublicKey") return false;
1050
1086
  let n2 = e11.StealthPublicKey;
1051
1087
  return typeof n2 == "object" && !!n2 && Object.keys(n2).length === 0;
1052
1088
  }
1053
- var rn = "utxo";
1054
- function an(e11, t2) {
1055
- return `${rn}_${e11.startsWith("resource_") ? e11.slice(9) : e11}_${b(t2)}`;
1089
+ var un = "utxo";
1090
+ function dn(e11, t2) {
1091
+ return `${un}_${e11.startsWith("resource_") ? e11.slice(9) : e11}_${S(t2)}`;
1056
1092
  }
1057
- var on = 64;
1058
- function sn(e11) {
1093
+ var fn = 64;
1094
+ function pn(e11) {
1059
1095
  return typeof e11 == "object" && !!e11 && "Utxo" in e11;
1060
1096
  }
1061
- function cn(e11) {
1097
+ function mn(e11) {
1062
1098
  return e11.length > 0 && /^[0-9a-fA-F]+$/.test(e11);
1063
1099
  }
1064
- function ln(e11) {
1100
+ function hn(e11) {
1065
1101
  let t2 = e11.split("_");
1066
- if (t2.length < 3 || t2[0] !== rn) return null;
1102
+ if (t2.length < 3 || t2[0] !== un) return null;
1067
1103
  let n2 = t2[t2.length - 1];
1068
- return n2.length !== on || !cn(n2) ? null : x(n2);
1104
+ return n2.length !== fn || !mn(n2) ? null : C(n2);
1069
1105
  }
1070
- function un(e11, t2) {
1071
- let n2 = H(e11);
1072
- if (n2 === null || !sn(n2)) return null;
1106
+ function gn(e11, t2) {
1107
+ let n2 = vt(e11);
1108
+ if (n2 === null || !pn(n2)) return null;
1073
1109
  let r2 = n2.Utxo;
1074
1110
  if (r2.output === null || r2.is_frozen) return null;
1075
- let i2 = ln(t2);
1111
+ let i2 = hn(t2);
1076
1112
  return i2 === null ? null : {
1077
1113
  commitment: i2,
1078
- body: r2.output.output
1114
+ body: r2.output.output,
1115
+ auth: r2.output.auth
1079
1116
  };
1080
1117
  }
1081
- var dn = 0, fn = class {
1082
- constructor(e11, t2, n2 = new tn(e11.network())) {
1118
+ var _n = 0, vn = class {
1119
+ constructor(e11, t2, n2 = new $(e11.network())) {
1083
1120
  __publicField(this, "provider");
1084
1121
  __publicField(this, "crypto");
1085
1122
  __publicField(this, "builder");
1086
1123
  __publicField(this, "state");
1087
1124
  __publicField(this, "maxEpoch", null);
1088
1125
  __publicField(this, "prepared", false);
1089
- this.provider = e11, this.crypto = n2, this.builder = B.new(e11.network(), dn), this.state = {
1126
+ this.provider = e11, this.crypto = n2, this.builder = V.new(e11.network(), _n), this.state = {
1090
1127
  resource: t2,
1091
1128
  revealedInput: null,
1092
1129
  inputsToSpend: /* @__PURE__ */ new Map(),
@@ -1095,9 +1132,9 @@ var dn = 0, fn = class {
1095
1132
  };
1096
1133
  }
1097
1134
  spendRevealedInput(e11, t2) {
1098
- if (t2 <= 0n) throw new v(`spendRevealedInput amount must be > 0, got ${t2}`);
1135
+ if (t2 <= 0n) throw new b(`spendRevealedInput amount must be > 0, got ${t2}`);
1099
1136
  let n2 = this.state.revealedInput;
1100
- if (n2 !== null && n2.source !== e11) throw new v(`spendRevealedInput: all revealed input must come from one account (${n2.source} != ${e11})`);
1137
+ if (n2 !== null && n2.source !== e11) throw new b(`spendRevealedInput: all revealed input must come from one account (${n2.source} != ${e11})`);
1101
1138
  return this.state.revealedInput = {
1102
1139
  source: e11,
1103
1140
  amount: ((n2 == null ? void 0 : n2.amount) ?? 0n) + t2
@@ -1107,18 +1144,18 @@ var dn = 0, fn = class {
1107
1144
  return this.state.outputs.push(e11), this;
1108
1145
  }
1109
1146
  toRevealedOutput(e11, t2) {
1110
- if (e11 <= 0n) throw new v(`toRevealedOutput amount must be > 0, got ${e11}`);
1111
- y(t2, 32, "toRevealedOutput receiver");
1147
+ if (e11 <= 0n) throw new b(`toRevealedOutput amount must be > 0, got ${e11}`);
1148
+ x(t2, 32, "toRevealedOutput receiver");
1112
1149
  let n2 = this.state.revealedOutput;
1113
- if (n2 !== null && b(n2.receiver) !== b(t2)) throw new v(`toRevealedOutput: all revealed output must go to one receiver (${b(n2.receiver)} != ${b(t2)})`);
1150
+ if (n2 !== null && S(n2.receiver) !== S(t2)) throw new b(`toRevealedOutput: all revealed output must go to one receiver (${S(n2.receiver)} != ${S(t2)})`);
1114
1151
  return this.state.revealedOutput = {
1115
1152
  amount: ((n2 == null ? void 0 : n2.amount) ?? 0n) + e11,
1116
1153
  receiver: (n2 == null ? void 0 : n2.receiver) ?? new Uint8Array(t2)
1117
1154
  }, this;
1118
1155
  }
1119
1156
  payFeeFromRevealed(e11) {
1120
- if (this.state.revealedInput === null) throw new v("payFeeFromRevealed: call spendRevealedInput first to set the source account");
1121
- if (e11 <= 0n) throw new v(`payFeeFromRevealed amount must be > 0, got ${e11}`);
1157
+ if (this.state.revealedInput === null) throw new b("payFeeFromRevealed: call spendRevealedInput first to set the source account");
1158
+ if (e11 <= 0n) throw new b(`payFeeFromRevealed amount must be > 0, got ${e11}`);
1122
1159
  return this.builder.feeTransactionPayFromComponent(this.state.revealedInput.source, e11), this;
1123
1160
  }
1124
1161
  withMaxEpoch(e11) {
@@ -1128,8 +1165,8 @@ var dn = 0, fn = class {
1128
1165
  return this.builder = e11(this.builder), this;
1129
1166
  }
1130
1167
  spendStealthInput(e11, t2) {
1131
- let n2 = new Z(t2), r2 = b(n2.commitment), i2 = this.state.inputsToSpend.get(r2);
1132
- if (i2 !== void 0) throw new v(`spendStealthInput: duplicate commitment ${r2} \u2014 each commitment is one UTXO and may be spent once (already added for owner ${i2.owner}). A commitment uniquely identifies a UTXO; adding it again (even under a different owner) would self-double-spend.`);
1168
+ let n2 = new nn(t2), r2 = S(n2.commitment), i2 = this.state.inputsToSpend.get(r2);
1169
+ if (i2 !== void 0) throw new b(`spendStealthInput: duplicate commitment ${r2} \u2014 each commitment is one UTXO and may be spent once (already added for owner ${i2.owner}). A commitment uniquely identifies a UTXO; adding it again (even under a different owner) would self-double-spend.`);
1133
1170
  return this.state.inputsToSpend.set(r2, {
1134
1171
  input: n2,
1135
1172
  owner: e11
@@ -1137,10 +1174,10 @@ var dn = 0, fn = class {
1137
1174
  }
1138
1175
  async prepare() {
1139
1176
  var _a;
1140
- if (this.prepared) throw new v("StealthTransfer.prepare: already prepared \u2014 create a new StealthTransfer to build again");
1177
+ if (this.prepared) throw new b("StealthTransfer.prepare: already prepared \u2014 create a new StealthTransfer to build again");
1141
1178
  this.validate(), this.prepared = true;
1142
- let { statement: e11, outputMask: t2 } = await this.crypto.generateOutputsStatement(this.state.outputs, this.state.revealedOutput), n2 = new $(await this.crypto.buildInputsStatement([...this.state.inputsToSpend.values()].map((e12) => e12.input), ((_a = this.state.revealedInput) == null ? void 0 : _a.amount) ?? 0n), e11, void 0);
1143
- this.emitInstructions(n2), this.maxEpoch === null && this.builder.buildUnsignedTransaction().max_epoch === dn && this.builder.withMaxEpoch(await $e(this.provider));
1179
+ let { statement: e11, outputMask: t2 } = await this.crypto.generateOutputsStatement(this.state.outputs, this.state.revealedOutput), n2 = new Q(await this.crypto.buildInputsStatement([...this.state.inputsToSpend.values()].map((e12) => e12.input), ((_a = this.state.revealedInput) == null ? void 0 : _a.amount) ?? 0n), e11, void 0);
1180
+ this.emitInstructions(n2), this.maxEpoch === null && this.builder.buildUnsignedTransaction().max_epoch === _n && this.builder.withMaxEpoch(await et(this.provider));
1144
1181
  let r2 = /* @__PURE__ */ new Set();
1145
1182
  if (this.state.revealedInput !== null) {
1146
1183
  let e12 = this.state.revealedInput.source;
@@ -1148,20 +1185,20 @@ var dn = 0, fn = class {
1148
1185
  substate_id: e12,
1149
1186
  version: null
1150
1187
  }), r2.add(e12);
1151
- let t3 = await bt(this.provider, e12);
1188
+ let t3 = await St(this.provider, e12);
1152
1189
  for (let e13 of t3) r2.has(e13) || (this.builder.addInput({
1153
1190
  substate_id: e13,
1154
1191
  version: null
1155
1192
  }), r2.add(e13));
1156
1193
  }
1157
1194
  for (let { input: e12 } of this.state.inputsToSpend.values()) {
1158
- let t3 = an(this.state.resource, e12.commitment);
1195
+ let t3 = dn(this.state.resource, e12.commitment);
1159
1196
  r2.has(t3) || (this.builder.addInput({
1160
1197
  substate_id: t3,
1161
1198
  version: null
1162
1199
  }), r2.add(t3));
1163
1200
  }
1164
- let i2 = await q(this.provider, this.builder.buildUnsignedTransaction()), a2 = [...this.state.inputsToSpend.values()], o2 = this.collectRequiredSigners(a2);
1201
+ let i2 = await K(this.provider, this.builder.buildUnsignedTransaction()), a2 = [...this.state.inputsToSpend.values()], o2 = this.collectRequiredSigners(a2);
1165
1202
  return {
1166
1203
  unsignedTx: i2,
1167
1204
  statement: n2,
@@ -1180,13 +1217,13 @@ var dn = 0, fn = class {
1180
1217
  validate() {
1181
1218
  var _a, _b;
1182
1219
  let e11 = this.state.inputsToSpend.size > 0, t2 = ((_a = this.state.revealedInput) == null ? void 0 : _a.amount) ?? 0n, n2 = t2 > 0n || e11, r2 = ((_b = this.state.revealedOutput) == null ? void 0 : _b.amount) ?? 0n;
1183
- if (!n2) throw new v("StealthTransfer.prepare: no inputs \u2014 call spendRevealedInput or spendStealthInput first");
1184
- if (this.state.outputs.length === 0 && this.state.revealedOutput === null) throw new v("StealthTransfer.prepare: no outputs \u2014 call toStealthOutput or toRevealedOutput first");
1185
- if (this.state.outputs.length === 0) throw new v("StealthTransfer.prepare: at least one stealth output is required");
1186
- if (this.state.revealedOutput !== null && this.state.revealedInput === null) throw new v("StealthTransfer.prepare: revealed change requires a revealed source account to deposit into");
1220
+ if (!n2) throw new b("StealthTransfer.prepare: no inputs \u2014 call spendRevealedInput or spendStealthInput first");
1221
+ if (this.state.outputs.length === 0 && this.state.revealedOutput === null) throw new b("StealthTransfer.prepare: no outputs \u2014 call toStealthOutput or toRevealedOutput first");
1222
+ if (this.state.outputs.length === 0) throw new b("StealthTransfer.prepare: at least one stealth output is required");
1223
+ if (this.state.revealedOutput !== null && this.state.revealedInput === null) throw new b("StealthTransfer.prepare: revealed change requires a revealed source account to deposit into");
1187
1224
  if (!e11) {
1188
1225
  let e12 = this.state.outputs.reduce((e13, t3) => e13 + t3.amount, 0n), n3 = e12 + r2, i2 = t2;
1189
- if (i2 !== n3) throw new v(`StealthTransfer.prepare: unbalanced transfer \u2014 revealed input ${i2} != stealth out ${e12} + revealed out ${r2} (= ${n3})`);
1226
+ if (i2 !== n3) throw new b(`StealthTransfer.prepare: unbalanced transfer \u2014 revealed input ${i2} != stealth out ${e12} + revealed out ${r2} (= ${n3})`);
1190
1227
  }
1191
1228
  }
1192
1229
  emitInstructions(e11) {
@@ -1194,38 +1231,38 @@ var dn = 0, fn = class {
1194
1231
  t2 !== null && (this.builder.callMethod({
1195
1232
  componentAddress: t2.source,
1196
1233
  methodName: "withdraw"
1197
- }, [j(this.state.resource), k(t2.amount)]).saveVar(Ot), n2 = Ot), this.builder.addInstruction(At({
1234
+ }, [N(this.state.resource), j(t2.amount)]).saveVar(At), n2 = At), this.builder.addInstruction(Mt({
1198
1235
  resourceAddress: this.state.resource,
1199
1236
  revealedInputBucket: n2,
1200
1237
  statement: e11
1201
- }, (e12) => this.builder.resolveWorkspaceOffsetId(e12))), this.state.revealedOutput !== null && t2 !== null && this.builder.saveVar(kt).callMethod({
1238
+ }, (e12) => this.builder.resolveWorkspaceOffsetId(e12))), this.state.revealedOutput !== null && t2 !== null && this.builder.saveVar(jt).callMethod({
1202
1239
  componentAddress: t2.source,
1203
1240
  methodName: "deposit"
1204
- }, [{ Workspace: kt }]);
1241
+ }, [{ Workspace: jt }]);
1205
1242
  }
1206
1243
  };
1207
- function pn(e11) {
1208
- if (mn(e11) || e11.statementJson !== void 0) return e11.statementJson;
1209
- if (e11.inputs.length > 0) throw new _("inputs statement has confidential inputs but no WASM statementJson \u2014 call buildInputsStatement first", { context: "statementJsonFor" });
1244
+ function yn(e11) {
1245
+ if (bn(e11) || e11.statementJson !== void 0) return e11.statementJson;
1246
+ if (e11.inputs.length > 0) throw new y("inputs statement has confidential inputs but no WASM statementJson \u2014 call buildInputsStatement first", { context: "statementJsonFor" });
1210
1247
  return JSON.stringify(e11.toJSON());
1211
1248
  }
1212
- function mn(e11) {
1249
+ function bn(e11) {
1213
1250
  return !("inputs" in e11);
1214
1251
  }
1215
- async function hn(e11, t2, n2, r2, i2) {
1216
- let a2 = pn(r2), o2 = pn(i2);
1252
+ async function xn(e11, t2, n2, r2, i2) {
1253
+ let a2 = yn(r2), o2 = yn(i2);
1217
1254
  return e11.generateBalanceProofSignature(t2, n2, a2, o2);
1218
1255
  }
1219
- async function gn(e11, t2, n2, r2) {
1256
+ async function Sn(e11, t2, n2, r2) {
1220
1257
  let i2 = await e11.deriveAeadKey(r2.viewSecret, r2.senderPublicNonce);
1221
1258
  return e11.unblindOutput(t2, n2, i2, r2.skipMemo);
1222
1259
  }
1223
- async function _n(e11, t2, n2, r2) {
1224
- let i2 = un(n2, r2);
1260
+ async function Cn(e11, t2, n2, r2) {
1261
+ let i2 = gn(n2, r2);
1225
1262
  if (i2 === null) return null;
1226
- let a2 = x(i2.body.encrypted_data), o2 = x(i2.body.public_nonce);
1263
+ let a2 = C(i2.body.encrypted_data), o2 = C(i2.body.public_nonce);
1227
1264
  try {
1228
- return await gn(e11, i2.commitment, a2, {
1265
+ return await Sn(e11, i2.commitment, a2, {
1229
1266
  senderPublicNonce: o2,
1230
1267
  viewSecret: t2,
1231
1268
  skipMemo: false
@@ -1234,33 +1271,33 @@ async function _n(e11, t2, n2, r2) {
1234
1271
  return null;
1235
1272
  }
1236
1273
  }
1237
- async function vn(e11, t2, n2) {
1238
- if (t2.length === 0) throw new v("generateOutputsStatement: at least one stealth output is required");
1274
+ async function wn(e11, t2, n2) {
1275
+ if (t2.length === 0) throw new b("generateOutputsStatement: at least one stealth output is required");
1239
1276
  let { statement: r2, outputMask: i2 } = await e11.generateOutputsStatement(t2, n2), a2 = await e11.buildInputsStatement([], 0n);
1240
- return new $(a2, r2, await hn(e11, X.zero(), i2, a2, r2));
1277
+ return new Q(a2, r2, await xn(e11, Z.zero(), i2, a2, r2));
1241
1278
  }
1242
- var yn = class e10 {
1279
+ var Tn = class e10 {
1243
1280
  constructor(e11, t2, n2, r2, i2) {
1244
1281
  this.wallet = e11, this.spec = t2, this.crypto = n2, this.mustSignWithAccountKey = r2, this.viewSecret = i2;
1245
1282
  }
1246
1283
  static fromSpec(t2, n2, r2 = {}) {
1247
- return new e10(t2, n2, r2.crypto ?? new tn(), r2.mustSignWithAccountKey ?? true, r2.viewSecret);
1284
+ return new e10(t2, n2, r2.crypto ?? new $(), r2.mustSignWithAccountKey ?? true, r2.viewSecret);
1248
1285
  }
1249
1286
  async prepare(e11) {
1250
- let t2 = await this.resolveStealthInputs(e11), n2 = t2.length === 0 ? X.zero() : await this.crypto.aggregateInputMasks(t2.map((e12) => e12.mask)), r2 = await hn(this.crypto, n2, this.spec.outputMask, this.spec.statement.inputsStatement, this.spec.statement.outputsStatement), i2 = new $(this.spec.statement.inputsStatement, this.spec.statement.outputsStatement, r2);
1287
+ let t2 = await this.resolveStealthInputs(e11), n2 = t2.length === 0 ? Z.zero() : await this.crypto.aggregateInputMasks(t2.map((e12) => e12.mask)), r2 = await xn(this.crypto, n2, this.spec.outputMask, this.spec.statement.inputsStatement, this.spec.statement.outputsStatement), i2 = new Q(this.spec.statement.inputsStatement, this.spec.statement.outputsStatement, r2);
1251
1288
  await this.crypto.validateTransfer(i2);
1252
- let a2 = xn(this.spec.unsignedTx, i2), o2 = this.mustSignWithAccountKey ? await J([this.wallet], a2) : a2, s2 = {
1289
+ let a2 = Dn(this.spec.unsignedTx, i2), o2 = this.mustSignWithAccountKey ? await Y([this.wallet], a2) : a2, s2 = {
1253
1290
  ...this.spec,
1254
1291
  unsignedTx: o2,
1255
1292
  statement: i2
1256
1293
  };
1257
- return new bn({
1294
+ return new En({
1258
1295
  wallet: this.wallet,
1259
1296
  crypto: this.crypto,
1260
1297
  spec: s2,
1261
1298
  resolvedInputs: t2,
1262
1299
  mustSignWithAccountKey: this.mustSignWithAccountKey,
1263
- sealKeypair: jt()
1300
+ sealKeypair: Pt()
1264
1301
  });
1265
1302
  }
1266
1303
  async resolveViewSecret() {
@@ -1269,9 +1306,9 @@ var yn = class e10 {
1269
1306
  if ((e11 == null ? void 0 : e11.getViewSecret) !== void 0) try {
1270
1307
  return await e11.getViewSecret();
1271
1308
  } catch (e12) {
1272
- throw e12 instanceof p ? e12 : new p("WalletStealthAuthorizer: spending stealth inputs needs a view secret to unblind them, but the wallet's default signer could not provide one. Pass `fromSpec(wallet, spec, { viewSecret })` or use a SecretKeyWallet (created with a view key) as the default signer.", { cause: e12 });
1309
+ throw e12 instanceof h ? e12 : new h("WalletStealthAuthorizer: spending stealth inputs needs a view secret to unblind them, but the wallet's default signer could not provide one. Pass `fromSpec(wallet, spec, { viewSecret })` or use a SecretKeyWallet (created with a view key) as the default signer.", { cause: e12 });
1273
1310
  }
1274
- throw new p("WalletStealthAuthorizer: spending stealth inputs needs a view secret to unblind them, but none was supplied and the wallet's default signer cannot provide one. Pass `fromSpec(wallet, spec, { viewSecret })` or use a SecretKeyWallet (created with a view key) as the default signer.");
1311
+ throw new h("WalletStealthAuthorizer: spending stealth inputs needs a view secret to unblind them, but none was supplied and the wallet's default signer cannot provide one. Pass `fromSpec(wallet, spec, { viewSecret })` or use a SecretKeyWallet (created with a view key) as the default signer.");
1275
1312
  }
1276
1313
  async safeDefaultAddress() {
1277
1314
  try {
@@ -1283,35 +1320,38 @@ var yn = class e10 {
1283
1320
  async resolveStealthInputs(e11) {
1284
1321
  if (this.spec.inputs.length === 0) return [];
1285
1322
  let t2 = await this.resolveViewSecret(), n2 = this.spec.state.resource, r2 = await Promise.allSettled(this.spec.inputs.map(async ({ input: r3, owner: i3 }) => {
1286
- let a2 = b(r3.commitment), o2 = await e11.getStealthUtxo(n2, r3.commitment);
1287
- if (o2 === null) throw new p(`WalletStealthAuthorizer.prepare: stealth input UTXO not found (spent or never created) for ${a2}`);
1288
- let s2 = un(o2, an(n2, r3.commitment));
1289
- if (s2 === null) throw new p(`WalletStealthAuthorizer.prepare: stealth input ${a2} is not a live, spendable UTXO`);
1290
- let c2 = x(s2.body.public_nonce), l2;
1323
+ let a2 = S(r3.commitment), o2 = await e11.getStealthUtxo(n2, r3.commitment);
1324
+ if (o2 === null) throw new h(`WalletStealthAuthorizer.prepare: stealth input UTXO not found (spent or never created) for ${a2}`);
1325
+ let s2 = gn(o2, dn(n2, r3.commitment));
1326
+ if (s2 === null) throw new h(`WalletStealthAuthorizer.prepare: stealth input ${a2} is not a live, spendable UTXO`);
1327
+ let c2 = C(s2.body.public_nonce), l2;
1291
1328
  try {
1292
- l2 = await gn(this.crypto, s2.commitment, x(s2.body.encrypted_data), {
1329
+ l2 = await Sn(this.crypto, s2.commitment, C(s2.body.encrypted_data), {
1293
1330
  senderPublicNonce: c2,
1294
1331
  viewSecret: t2,
1295
1332
  skipMemo: true
1296
1333
  });
1297
1334
  } catch (e12) {
1298
- throw new _(`WalletStealthAuthorizer.prepare: failed to decrypt stealth input with commitment ${b(r3.commitment)} (owner ${i3}). This usually means the supplied view secret does not own this UTXO. Pass the correct \`viewSecret\` via \`fromSpec(wallet, spec, { viewSecret })\`, or use the owning SecretKeyWallet (with its view key) as the default signer. Note: a single view secret is resolved for all inputs \u2014 spending UTXOs owned by distinct view keys in one transfer is not supported.`, {
1335
+ throw new y(`WalletStealthAuthorizer.prepare: failed to decrypt stealth input with commitment ${S(r3.commitment)} (owner ${i3}). This usually means the supplied view secret does not own this UTXO. Pass the correct \`viewSecret\` via \`fromSpec(wallet, spec, { viewSecret })\`, or use the owning SecretKeyWallet (with its view key) as the default signer. Note: a single view secret is resolved for all inputs \u2014 spending UTXOs owned by distinct view keys in one transfer is not supported.`, {
1299
1336
  cause: e12,
1300
1337
  context: "unblindOutput"
1301
1338
  });
1302
1339
  }
1340
+ let u2 = kn(s2.auth);
1341
+ if (u2 === null) throw new h(`WalletStealthAuthorizer.prepare: stealth input ${a2} is spent by script only, which this authorizer does not support`);
1303
1342
  return {
1304
1343
  ownerAddr: i3,
1305
1344
  input: r3,
1306
1345
  mask: l2.mask,
1307
1346
  publicNonce: c2,
1308
- viewSecret: t2
1347
+ viewSecret: t2,
1348
+ oneTimePublicKey: u2
1309
1349
  };
1310
1350
  })), i2 = r2.find((e12) => e12.status === "rejected");
1311
1351
  if (i2 !== void 0) throw i2.reason;
1312
1352
  return r2.map((e12) => e12.value);
1313
1353
  }
1314
- }, bn = class {
1354
+ }, En = class {
1315
1355
  constructor(e11) {
1316
1356
  __publicField(this, "wallet");
1317
1357
  __publicField(this, "crypto");
@@ -1320,12 +1360,25 @@ var yn = class e10 {
1320
1360
  __publicField(this, "mustSignWithAccountKey");
1321
1361
  __publicField(this, "sealKeypair");
1322
1362
  __publicField(this, "extraSignatures", []);
1363
+ __publicField(this, "coSignerKeys", []);
1364
+ __publicField(this, "authorizerSet");
1323
1365
  __publicField(this, "cachedAuthorizations");
1324
1366
  this.wallet = e11.wallet, this.crypto = e11.crypto, this.spec = e11.spec, this.resolvedInputs = e11.resolvedInputs, this.mustSignWithAccountKey = e11.mustSignWithAccountKey, this.sealKeypair = e11.sealKeypair;
1325
1367
  }
1326
1368
  getSealPublicKey() {
1327
1369
  return this.sealKeypair.public_key;
1328
1370
  }
1371
+ addAuthorizer(e11) {
1372
+ if (this.authorizerSet !== void 0) throw new h("AuthorizedTransfer.addAuthorizer: the authorizer set is already fixed; declare co-signers before getAuthorizerPublicKeys(), createAuthorizations() or seal()");
1373
+ return this.coSignerKeys.push(e11), this;
1374
+ }
1375
+ async getAuthorizerPublicKeys() {
1376
+ return this.authorizerSet === void 0 && (this.authorizerSet = q([
1377
+ ...this.mustSignWithAccountKey ? await this.wallet.getAuthorizerPublicKeys() : [],
1378
+ ...this.resolvedInputs.map((e11) => e11.oneTimePublicKey),
1379
+ ...this.coSignerKeys
1380
+ ])), this.authorizerSet;
1381
+ }
1329
1382
  getSpec() {
1330
1383
  return this.spec;
1331
1384
  }
@@ -1334,21 +1387,22 @@ var yn = class e10 {
1334
1387
  }
1335
1388
  async computeAuthorizations() {
1336
1389
  if (this.resolvedInputs.length === 0) return [];
1337
- let e11 = K(this.spec.unsignedTx), t2 = this.sealKeypair.public_key, n2 = [];
1338
- for (let r2 of this.resolvedInputs) {
1339
- let i2 = this.wallet.getKeyProvider(r2.ownerAddr);
1340
- if (i2 === void 0) throw new m(`AuthorizedTransfer.createAuthorizations: no signer registered for stealth-input owner ${r2.ownerAddr}. Register it via wallet.registerKeyProvider(owner, signer).`, { address: r2.ownerAddr });
1341
- if (i2.addStealthSignature === void 0) throw new g(`AuthorizedTransfer.createAuthorizations: signer for ${r2.ownerAddr} cannot produce one-time stealth signatures. Use a SecretKeyWallet (which holds the owner secret).`);
1342
- let a2 = await i2.addStealthSignature(e11, r2.publicNonce, t2, {
1390
+ let e11 = G(this.spec.unsignedTx), t2 = this.sealKeypair.public_key, n2 = await this.getAuthorizerPublicKeys(), r2 = [];
1391
+ for (let i2 of this.resolvedInputs) {
1392
+ let a2 = this.wallet.getKeyProvider(i2.ownerAddr);
1393
+ if (a2 === void 0) throw new g(`AuthorizedTransfer.createAuthorizations: no signer registered for stealth-input owner ${i2.ownerAddr}. Register it via wallet.registerKeyProvider(owner, signer).`, { address: i2.ownerAddr });
1394
+ if (a2.addStealthSignature === void 0) throw new v(`AuthorizedTransfer.createAuthorizations: signer for ${i2.ownerAddr} cannot produce one-time stealth signatures. Use a SecretKeyWallet (which holds the owner secret).`);
1395
+ let o2 = await a2.addStealthSignature(e11, i2.publicNonce, t2, {
1343
1396
  crypto: this.crypto,
1344
- viewSecret: r2.viewSecret
1397
+ viewSecret: i2.viewSecret,
1398
+ authorizers: n2
1345
1399
  });
1346
- n2.push({
1347
- signerAddress: r2.ownerAddr,
1348
- signatures: [a2]
1400
+ r2.push({
1401
+ signerAddress: i2.ownerAddr,
1402
+ signatures: [o2]
1349
1403
  });
1350
1404
  }
1351
- return n2;
1405
+ return r2;
1352
1406
  }
1353
1407
  addSignature(e11) {
1354
1408
  return this.extraSignatures.push(e11), this;
@@ -1357,130 +1411,141 @@ var yn = class e10 {
1357
1411
  let e11 = (await this.createAuthorizations()).flatMap((e12) => e12.signatures), t2 = [];
1358
1412
  this.mustSignWithAccountKey && t2.push(this.wallet);
1359
1413
  let n2 = [...e11, ...this.extraSignatures];
1360
- return n2.length > 0 && t2.push(new Sn(n2)), Y(await Pt(t2, this.spec.unsignedTx, this.sealKeypair));
1414
+ return n2.length > 0 && t2.push(new On(n2)), X(await Rt(t2, this.spec.unsignedTx, this.sealKeypair, await this.getAuthorizerPublicKeys()));
1361
1415
  }
1362
1416
  };
1363
- function xn(e11, t2) {
1364
- let n2 = e11.instructions.findIndex(G);
1365
- if (n2 < 0) throw new v("patchStealthStatement: expected exactly one StealthTransfer instruction, found 0 (not a stealth tx)");
1366
- if (e11.instructions.slice(n2 + 1).findIndex(G) >= 0) throw new v("patchStealthStatement: expected exactly one StealthTransfer instruction, found more than one (malformed)");
1417
+ function Dn(e11, t2) {
1418
+ let n2 = e11.instructions.findIndex(W);
1419
+ if (n2 < 0) throw new b("patchStealthStatement: expected exactly one StealthTransfer instruction, found 0 (not a stealth tx)");
1420
+ if (e11.instructions.slice(n2 + 1).findIndex(W) >= 0) throw new b("patchStealthStatement: expected exactly one StealthTransfer instruction, found more than one (malformed)");
1367
1421
  let r2 = { StealthTransfer: {
1368
1422
  ...e11.instructions[n2].StealthTransfer,
1369
- statement: W(t2)
1423
+ statement: Nt(t2)
1370
1424
  } }, i2 = [...e11.instructions];
1371
1425
  return i2[n2] = r2, {
1372
1426
  ...e11,
1373
1427
  instructions: i2
1374
1428
  };
1375
1429
  }
1376
- var Sn = class {
1430
+ var On = class {
1377
1431
  constructor(e11) {
1378
1432
  this.signatures = e11;
1379
1433
  }
1380
1434
  async getAddress() {
1381
- throw new g("StaticSignatureSigner has no address");
1435
+ throw new v("StaticSignatureSigner has no address");
1382
1436
  }
1383
1437
  async getPublicKey() {
1384
- throw new g("StaticSignatureSigner has no public key");
1438
+ throw new v("StaticSignatureSigner has no public key");
1439
+ }
1440
+ async getAuthorizerPublicKeys() {
1441
+ return this.signatures.map((e11) => C(e11.public_key));
1385
1442
  }
1386
- async signTransaction(e11, t2) {
1443
+ async signTransaction(e11, t2, n2) {
1387
1444
  return this.signatures;
1388
1445
  }
1389
1446
  };
1447
+ function kn(e11) {
1448
+ return "Key" in e11 ? C(e11.Key) : "KeyAndScript" in e11 ? C(e11.KeyAndScript.spend_key) : null;
1449
+ }
1390
1450
  export {
1391
- Ht as AccountInvokeBuilder,
1392
- bn as AuthorizedTransfer,
1393
- Q as BalanceProofSignature,
1394
- _ as CryptoBridgeError,
1395
- Qe as DEFAULT_TRANSACTION_VALIDITY_EPOCHS,
1396
- h as DefaultSignerNotSetError,
1397
- Kt as EncryptedData,
1398
- Bt as ExternalKeySigner,
1399
- ot as FEE_ESTIMATE_ALLOWANCE,
1400
- Ut as FaucetInvokeBuilder,
1451
+ qt as AccountInvokeBuilder,
1452
+ En as AuthorizedTransfer,
1453
+ rn as BalanceProofSignature,
1454
+ y as CryptoBridgeError,
1455
+ $e as DEFAULT_TRANSACTION_VALIDITY_EPOCHS,
1456
+ _ as DefaultSignerNotSetError,
1457
+ Zt as EncryptedData,
1458
+ Gt as ExternalKeySigner,
1459
+ st as FEE_ESTIMATE_ALLOWANCE,
1460
+ Jt as FaucetInvokeBuilder,
1401
1461
  pe as IndexerClientError,
1402
- v as InvalidArgumentError,
1403
- m as KeyProviderNotFoundError,
1404
- Ze as MAX_TRANSACTION_VALIDITY_EPOCHS,
1405
- X as Mask,
1406
- u as Network,
1407
- d as OotleError,
1408
- Wt as OotleWallet,
1462
+ b as InvalidArgumentError,
1463
+ g as KeyProviderNotFoundError,
1464
+ Qe as MAX_TRANSACTION_VALIDITY_EPOCHS,
1465
+ Z as Mask,
1466
+ f as Network,
1467
+ p as OotleError,
1468
+ Yt as OotleWallet,
1409
1469
  he as OperationCancelledError,
1410
- g as SignerError,
1411
- Z as StealthInput,
1412
- Zt as StealthInputsStatement,
1413
- Qt as StealthOutputsStatement,
1414
- fn as StealthTransfer,
1415
- $ as StealthTransferStatement,
1416
- Ct as TARI_RESOURCE_ADDRESS,
1417
- B as TransactionBuilder,
1418
- f as TransactionRejectedError,
1470
+ v as SignerError,
1471
+ nn as StealthInput,
1472
+ an as StealthInputsStatement,
1473
+ on as StealthOutputsStatement,
1474
+ vn as StealthTransfer,
1475
+ Q as StealthTransferStatement,
1476
+ Tt as TARI_RESOURCE_ADDRESS,
1477
+ V as TransactionBuilder,
1478
+ m as TransactionRejectedError,
1419
1479
  me as TransactionTimeoutError,
1420
- p as WalletError,
1421
- yn as WalletStealthAuthorizer,
1422
- tn as WasmStealthCrypto,
1423
- Et as XTR_FAUCET_CLAIM_RESOURCE_ADDRESS,
1424
- wt as XTR_FAUCET_COMPONENT_ADDRESS,
1425
- Tt as XTR_FAUCET_VAULT_ADDRESS,
1426
- k as amountLiteral,
1427
- y as assertByteLength,
1480
+ h as WalletError,
1481
+ Tn as WalletStealthAuthorizer,
1482
+ $ as WasmStealthCrypto,
1483
+ Ot as XTR_FAUCET_CLAIM_RESOURCE_ADDRESS,
1484
+ Et as XTR_FAUCET_COMPONENT_ADDRESS,
1485
+ Dt as XTR_FAUCET_VAULT_ADDRESS,
1486
+ j as amountLiteral,
1487
+ x as assertByteLength,
1428
1488
  ge as assertUnreachable,
1429
1489
  Fe as boolLiteral,
1430
- Mt as buildTransactionSignature,
1431
- A as bytesLiteral,
1490
+ Ft as buildTransactionSignature,
1491
+ M as bytesLiteral,
1492
+ q as canonicalAuthorizers,
1432
1493
  Be as claimedOutputTombstoneAddressLiteral,
1433
- It as classifyOutcome,
1434
- ln as commitmentOf,
1494
+ Vt as classifyOutcome,
1495
+ J as collectAuthorizers,
1496
+ hn as commitmentOf,
1435
1497
  Ie as componentAddressLiteral,
1436
- Jt as createOutput,
1437
- mt as decodeEvent,
1438
- ft as decodeExecuteResult,
1439
- ht as decodeResource,
1440
- dt as decodeSubstateValue,
1441
- pt as decodeTransactionReceipt,
1442
- gt as decodeUtxo,
1443
- gn as decryptInputData,
1444
- _n as decryptOwnedUtxo,
1445
- ut as defaultIndexerUrl,
1446
- ct as estimatedFee,
1447
- st as feesCharged,
1448
- x as fromHexStr,
1449
- vn as generateOutputsStatement,
1450
- jt as generateSealKeypair,
1451
- bt as getVaultIdsForAccount,
1498
+ $t as createOutput,
1499
+ ht as decodeEvent,
1500
+ pt as decodeExecuteResult,
1501
+ gt as decodeResource,
1502
+ ft as decodeSubstateValue,
1503
+ mt as decodeTransactionReceipt,
1504
+ _t as decodeUtxo,
1505
+ Sn as decryptInputData,
1506
+ Cn as decryptOwnedUtxo,
1507
+ dt as defaultIndexerUrl,
1508
+ It as encodeAuthorizerSet,
1509
+ lt as estimatedFee,
1510
+ ct as feesCharged,
1511
+ C as fromHexStr,
1512
+ wn as generateOutputsStatement,
1513
+ Pt as generateSealKeypair,
1514
+ St as getVaultIdsForAccount,
1452
1515
  Ne as intLiteral,
1453
- G as isStealthTransferInstruction,
1454
- yt as iterVaultIdsInState,
1516
+ W as isStealthTransferInstruction,
1517
+ xt as iterVaultIdsInState,
1455
1518
  je as literalArg,
1456
1519
  Le as metadataLiteral,
1457
- R as microTariLiteral,
1458
- Ye as microTariString,
1520
+ z as microTariLiteral,
1521
+ Xe as microTariString,
1459
1522
  Ue as nonFungibleAddressLiteral,
1460
- un as parseSubstateUtxo,
1461
- Xe as parseWorkspaceStringKey,
1462
- xn as patchStealthStatement,
1523
+ gn as parseSubstateUtxo,
1524
+ Ze as parseWorkspaceStringKey,
1525
+ Dn as patchStealthStatement,
1463
1526
  He as publicKeyLiteral,
1464
- J as resolveMainSigner,
1465
- $e as resolveMaxEpoch,
1466
- q as resolveTransaction,
1467
- j as resourceAddressLiteral,
1468
- Y as sealTransaction,
1469
- zt as sendDryRun,
1470
- Rt as sendTransaction,
1471
- K as serializeUnsignedTx,
1472
- hn as signBalanceProof,
1473
- Nt as signTransaction,
1474
- W as statementAsWire,
1475
- At as stealthTransferInstruction,
1476
- an as stealthUtxoSubstateId,
1527
+ Y as resolveMainSigner,
1528
+ et as resolveMaxEpoch,
1529
+ K as resolveTransaction,
1530
+ N as resourceAddressLiteral,
1531
+ X as sealTransaction,
1532
+ Wt as sendDryRun,
1533
+ Ut as sendTransaction,
1534
+ G as serializeUnsignedTx,
1535
+ xn as signBalanceProof,
1536
+ Lt as signTransaction,
1537
+ Nt as statementAsWire,
1538
+ Mt as stealthTransferInstruction,
1539
+ dn as stealthUtxoSubstateId,
1477
1540
  Pe as stringLiteral,
1478
- Ft as submitTransaction,
1541
+ Bt as submitTransaction,
1479
1542
  ze as templateAddressLiteral,
1480
- b as toHexStr,
1481
- H as upSubstateValue,
1543
+ S as toHexStr,
1544
+ de as transactionBody,
1545
+ fe as transactionSchemaVersion,
1546
+ vt as upSubstateValue,
1482
1547
  We as utxoAddressLiteral,
1483
1548
  Ve as validatorFeePoolAddressLiteral,
1484
1549
  Re as vaultIdLiteral,
1485
- Lt as watchTransaction
1550
+ Ht as watchTransaction
1486
1551
  };