@hinkal/common 0.2.23 → 0.2.25

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.
@@ -59,33 +59,33 @@ import { updateDepositAndWithdrawStatus as ht, safeUpdateDepositAndWithdrawStatu
59
59
  const ft = async (t, r, p, d, l, u) => {
60
60
  const g = p.map((o) => o + nt(o, l)), {
61
61
  hinkalIdl: h,
62
- hinkalAddress: y,
62
+ hinkalAddress: S,
63
63
  originalDeployer: s
64
64
  } = $[t.getCurrentChainId()].contractData;
65
65
  if (!h)
66
66
  throw new Error("No IDL configured for Solana program on this network");
67
67
  if (!s)
68
68
  throw new Error("missing original deployer");
69
- const f = t.userKeys.getShieldedPrivateKey(), E = z.findCorrectRandomization(M(31), f), S = ct(E, f), e = t.getSolanaProgram(h), v = t.getSolanaPublicKey(), a = new W(s), A = new W(y), { mintPublicKey: c } = q(r), R = c.toString(), F = tt(A, a), b = ot(A, a), H = rt(A, a), x = et(S), I = t.getCurrentChainId(), D = g.reduce((o, n) => o + n, 0n), T = await pt(
69
+ const f = t.userKeys.getShieldedPrivateKey(), E = z.findCorrectRandomization(M(31), f), w = ct(E, f), e = t.getSolanaProgram(h), v = t.getSolanaPublicKey(), a = new W(s), A = new W(S), { mintPublicKey: c } = q(r), x = c.toString(), H = tt(A, a), R = ot(A, a), F = rt(A, a), b = et(w), T = t.getCurrentChainId(), D = g.reduce((o, n) => o + n, 0n), I = await pt(
70
70
  e,
71
71
  new W(a),
72
72
  [r],
73
73
  [D]
74
74
  ), K = g.map((o) => `${o}`);
75
75
  let i = "";
76
- const P = (await ht(I, {
76
+ const P = (await ht(T, {
77
77
  hashedEthereumAddress: u,
78
78
  phase: k.BEFORE_DEPOSIT
79
79
  })).id ?? void 0;
80
- if (T) {
81
- const { serializedTransaction: o, blockhash: n, lastValidBlockHeight: w } = await G.generateMultiPaymentDepositLimitless(
82
- I,
80
+ if (I) {
81
+ const { serializedTransaction: o, blockhash: n, lastValidBlockHeight: y } = await G.generateMultiPaymentDepositLimitless(
82
+ T,
83
83
  {
84
84
  amounts: K,
85
85
  payer: t.getSolanaPublicKey().toBase58(),
86
86
  ethereumAddress: await t.getEthereumAddress(),
87
87
  mint: r,
88
- stealthAddressStructure: x
88
+ stealthAddressStructure: b
89
89
  }
90
90
  ), { wallet: m } = e.provider;
91
91
  if (!m)
@@ -94,23 +94,23 @@ const ft = async (t, r, p, d, l, u) => {
94
94
  e.provider,
95
95
  o,
96
96
  n,
97
- w
97
+ y
98
98
  );
99
99
  } else {
100
- const o = at(e.programId, a, c), n = R === U ? null : c, w = R === U ? null : void 0;
100
+ const o = at(e.programId, a, c), n = x === U ? null : c, y = x === U ? null : void 0;
101
101
  i = await e.methods.multiPaymentDeposit(
102
102
  K.map((V) => new Q(V)),
103
- x
103
+ b
104
104
  ).accounts({
105
105
  mint: n,
106
106
  signer: v,
107
- signerAta: w,
107
+ signerAta: y,
108
108
  originalDeployer: a,
109
- storageAccount: F,
110
- storageVault: b,
111
- merkleAccount: H,
109
+ storageAccount: H,
110
+ storageVault: R,
111
+ merkleAccount: F,
112
112
  tokenLimitStorage: o,
113
- storageVaultAta: w,
113
+ storageVaultAta: y,
114
114
  accessTokenOwner: null
115
115
  }).rpc();
116
116
  const m = await e.provider.connection.getLatestBlockhash();
@@ -129,7 +129,7 @@ const ft = async (t, r, p, d, l, u) => {
129
129
  });
130
130
  if (!B)
131
131
  throw new Error("Transaction missing");
132
- await N(I, {
132
+ await N(T, {
133
133
  id: P,
134
134
  hashedEthereumAddress: u,
135
135
  phase: k.AFTER_DEPOSIT,
@@ -137,45 +137,45 @@ const ft = async (t, r, p, d, l, u) => {
137
137
  });
138
138
  const L = dt(B, e, t.userKeys), O = [], C = [...L];
139
139
  return d.forEach((o, n) => {
140
- const w = g[n], m = C.find((X) => X.amount === w);
140
+ const y = g[n], m = C.find((X) => X.amount === y);
141
141
  if (!m)
142
- throw new Error(`Could not find newly created UTXO with amount ${w} for recipient ${o}.`);
142
+ throw new Error(`Could not find newly created UTXO with amount ${y} for recipient ${o}.`);
143
143
  O.push({
144
144
  recipientAddress: o,
145
145
  utxo: m
146
146
  });
147
147
  const V = C.indexOf(m);
148
148
  C.splice(V, 1);
149
- }), { userDepositedUtxos: O, signature: i, statusId: P };
149
+ }), { userDepositedUtxos: O, depositTxHash: i, statusId: P };
150
150
  }, wt = async (t, r, p, d, l, u, g, h) => {
151
- const y = t.getCurrentChainId();
151
+ const S = t.getCurrentChainId();
152
152
  if (p.length === 0)
153
153
  throw new Error("userDepositedUtxos must not be empty");
154
154
  const { hinkalIdl: s, originalDeployer: f } = $[t.getCurrentChainId()].contractData;
155
155
  if (!f || !s)
156
156
  throw new Error("missing data");
157
- const E = t.getSolanaProgram(s), S = await t.getRandomRelay(!0);
158
- if (!S)
157
+ const E = t.getSolanaProgram(s), w = await t.getRandomRelay(!0);
158
+ if (!w)
159
159
  throw new Error(Y.RELAYER_NOT_AVAILABLE);
160
160
  const e = it().toString(), v = t.generateProofRemotely ? 5 : 1, a = [];
161
161
  for (let c = 0; c < p.length; c += v) {
162
- const R = p.slice(c, c + v), F = await Promise.all(
163
- R.map(async ({ recipientAddress: b, utxo: H }) => {
164
- const { compressedAddress: x } = q(U), I = new z({
162
+ const x = p.slice(c, c + v), H = await Promise.all(
163
+ x.map(async ({ recipientAddress: R, utxo: F }) => {
164
+ const { compressedAddress: b } = q(U), T = new z({
165
165
  amount: 0n,
166
166
  mintAddress: r,
167
- erc20TokenAddress: x,
167
+ erc20TokenAddress: b,
168
168
  shieldedPrivateKey: t.userKeys.getShieldedPrivateKey(),
169
169
  timeStamp: e,
170
170
  tokenId: 0
171
- }), D = [H, I], T = [I], K = z.findCorrectRandomization(
171
+ }), D = [F, T], I = [T], K = z.findCorrectRandomization(
172
172
  M(31),
173
173
  t.userKeys.getShieldedPrivateKey()
174
174
  ), i = {
175
175
  tokenNumber: 1,
176
176
  nullifierAmount: D.length,
177
- outputAmount: T.length
178
- }, _ = mt([T])[0][0], P = Array.from(Z.getBytes(_)), { proofAArr: B, proofBArr: L, proofCArr: O, publicInputsArr: C } = await lt(
177
+ outputAmount: I.length
178
+ }, _ = mt([I])[0][0], P = Array.from(Z.getBytes(_)), { proofAArr: B, proofBArr: L, proofCArr: O, publicInputsArr: C } = await lt(
179
179
  t.generateProofRemotely,
180
180
  f,
181
181
  t.merkleTreeHinkal,
@@ -184,12 +184,12 @@ const ft = async (t, r, p, d, l, u) => {
184
184
  E,
185
185
  [r],
186
186
  [D],
187
- [T],
187
+ [I],
188
188
  K,
189
189
  d.flatFee,
190
190
  d.variableRate,
191
- b,
192
- S,
191
+ R,
192
+ w,
193
193
  i,
194
194
  [P],
195
195
  t.getCurrentChainId(),
@@ -200,11 +200,11 @@ const ft = async (t, r, p, d, l, u) => {
200
200
  void 0,
201
201
  !1
202
202
  ), n = {
203
- recipient: b,
203
+ recipient: R,
204
204
  mint: r === U ? void 0 : r
205
205
  };
206
206
  return {
207
- relayAddress: S,
207
+ relayAddress: w,
208
208
  functionName: "transact",
209
209
  args: {
210
210
  proofAArr: B,
@@ -219,9 +219,9 @@ const ft = async (t, r, p, d, l, u) => {
219
219
  };
220
220
  })
221
221
  );
222
- a.push(...F);
222
+ a.push(...H);
223
223
  }
224
- await N(y, {
224
+ await N(S, {
225
225
  id: u,
226
226
  hashedEthereumAddress: l,
227
227
  phase: k.BEFORE_SCHEDULE_WITHDRAW
@@ -233,14 +233,14 @@ const ft = async (t, r, p, d, l, u) => {
233
233
  g,
234
234
  h
235
235
  );
236
- return await N(y, {
236
+ return await N(S, {
237
237
  id: u,
238
238
  hashedEthereumAddress: l,
239
239
  phase: k.AFTER_SCHEDULE_WITHDRAW,
240
240
  scheduleId: A
241
241
  }), A;
242
- }, To = async (t, r, p, d, l, u, g) => {
243
- const h = j(await t.getEthereumAddress()), y = t.getCurrentChainId(), s = u ?? await gt(y, r, [r], J.Transact, [], 0n), { userDepositedUtxos: f, statusId: E } = await ft(
242
+ }, Io = async (t, r, p, d, l, u, g) => {
243
+ const h = j(await t.getEthereumAddress()), S = t.getCurrentChainId(), s = u ?? await gt(S, r, [r], J.Transact, [], 0n), { userDepositedUtxos: f, statusId: E, depositTxHash: w } = await ft(
244
244
  t,
245
245
  r,
246
246
  p,
@@ -257,8 +257,8 @@ const ft = async (t, r, p, d, l, u) => {
257
257
  E,
258
258
  l,
259
259
  g
260
- );
260
+ ), w;
261
261
  };
262
262
  export {
263
- To as hinkalSolanaDepositAndWithdraw
263
+ Io as hinkalSolanaDepositAndWithdraw
264
264
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hinkal/common",
3
- "version": "0.2.23",
3
+ "version": "0.2.25",
4
4
  "homepage": "hinkal.io",
5
5
  "author": {
6
6
  "name": "Hinkal Protocol"