@dexterai/vault 0.2.1 → 0.3.1

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.
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/instructions/index.ts
31
31
  var instructions_exports = {};
32
32
  __export(instructions_exports, {
33
+ SET_SWIG_ATOMIC_DISCRIMINATOR: () => SET_SWIG_ATOMIC_DISCRIMINATOR,
33
34
  SWIG_PROGRAM_EXEC_MARKERS: () => SWIG_PROGRAM_EXEC_MARKERS,
34
35
  SWIG_PROGRAM_EXEC_PREFIX: () => SWIG_PROGRAM_EXEC_PREFIX,
35
36
  SWIG_PROGRAM_EXEC_PREFIX_SETTLE_TAB: () => SWIG_PROGRAM_EXEC_PREFIX_SETTLE_TAB,
@@ -42,6 +43,7 @@ __export(instructions_exports, {
42
43
  buildRevokeSessionKeyInstruction: () => buildRevokeSessionKeyInstruction,
43
44
  buildRotateDexterAuthorityInstruction: () => buildRotateDexterAuthorityInstruction,
44
45
  buildRotatePasskeyInstruction: () => buildRotatePasskeyInstruction,
46
+ buildSetSwigAtomicInstruction: () => buildSetSwigAtomicInstruction,
45
47
  buildSetSwigInstruction: () => buildSetSwigInstruction,
46
48
  buildSettleTabVoucherInstruction: () => buildSettleTabVoucherInstruction,
47
49
  buildSettleVoucherInstruction: () => buildSettleVoucherInstruction,
@@ -159,8 +161,71 @@ function buildSetSwigInstruction(p) {
159
161
  });
160
162
  }
161
163
 
162
- // src/instructions/registerSession.ts
164
+ // src/instructions/setSwigAtomic.ts
163
165
  var import_web34 = require("@solana/web3.js");
166
+ var SET_SWIG_ATOMIC_DISCRIMINATOR = new Uint8Array([
167
+ 119,
168
+ 111,
169
+ 247,
170
+ 215,
171
+ 190,
172
+ 3,
173
+ 170,
174
+ 23
175
+ ]);
176
+ function buildSetSwigAtomicInstruction(params) {
177
+ if (params.swigId.length !== 32) {
178
+ throw new Error(`swigId must be 32 bytes, got ${params.swigId.length}`);
179
+ }
180
+ if (params.authenticatorData.length < 37) {
181
+ throw new Error(`authenticatorData must be at least 37 bytes`);
182
+ }
183
+ const cdj = params.clientDataJSON;
184
+ const ad = params.authenticatorData;
185
+ const dataLen = 8 + // discriminator
186
+ 32 + // swig_id
187
+ 1 + // swig_account_bump
188
+ 1 + // swig_wallet_address_bump
189
+ 32 + // dexter_master_pubkey
190
+ 4 + cdj.length + // client_data_json (len-prefixed)
191
+ 4 + ad.length;
192
+ const data = new Uint8Array(dataLen);
193
+ const view = new DataView(data.buffer);
194
+ let off = 0;
195
+ data.set(SET_SWIG_ATOMIC_DISCRIMINATOR, off);
196
+ off += 8;
197
+ data.set(params.swigId, off);
198
+ off += 32;
199
+ data[off++] = params.swigAccountBump;
200
+ data[off++] = params.swigWalletAddressBump;
201
+ data.set(params.dexterMasterPubkey.toBytes(), off);
202
+ off += 32;
203
+ view.setUint32(off, cdj.length, true);
204
+ off += 4;
205
+ data.set(cdj, off);
206
+ off += cdj.length;
207
+ view.setUint32(off, ad.length, true);
208
+ off += 4;
209
+ data.set(ad, off);
210
+ off += ad.length;
211
+ if (off !== dataLen) throw new Error(`internal: byte offset mismatch (${off} vs ${dataLen})`);
212
+ return new import_web34.TransactionInstruction({
213
+ programId: DEXTER_VAULT_PROGRAM_ID,
214
+ keys: [
215
+ { pubkey: params.vaultPda, isSigner: false, isWritable: true },
216
+ { pubkey: params.feePayer, isSigner: true, isWritable: true },
217
+ { pubkey: params.swigAddress, isSigner: false, isWritable: true },
218
+ { pubkey: params.swigWalletAddress, isSigner: false, isWritable: true },
219
+ { pubkey: SWIG_PROGRAM_ID, isSigner: false, isWritable: false },
220
+ { pubkey: import_web34.SystemProgram.programId, isSigner: false, isWritable: false },
221
+ { pubkey: import_web34.SYSVAR_INSTRUCTIONS_PUBKEY, isSigner: false, isWritable: false }
222
+ ],
223
+ data: Buffer.from(data)
224
+ });
225
+ }
226
+
227
+ // src/instructions/registerSession.ts
228
+ var import_web35 = require("@solana/web3.js");
164
229
  function encodeU64LE(value) {
165
230
  const buf = new Uint8Array(8);
166
231
  new DataView(buf.buffer).setBigUint64(0, value, true);
@@ -206,7 +271,7 @@ function buildRegisterSessionKeyInstruction(args) {
206
271
  encodeVecU8(args.clientDataJSON),
207
272
  encodeVecU8(args.authenticatorData)
208
273
  );
209
- return new import_web34.TransactionInstruction({
274
+ return new import_web35.TransactionInstruction({
210
275
  keys: [
211
276
  { pubkey: args.vaultPda, isSigner: false, isWritable: true },
212
277
  { pubkey: INSTRUCTIONS_SYSVAR_ID, isSigner: false, isWritable: false }
@@ -217,7 +282,7 @@ function buildRegisterSessionKeyInstruction(args) {
217
282
  }
218
283
 
219
284
  // src/instructions/revokeSession.ts
220
- var import_web35 = require("@solana/web3.js");
285
+ var import_web36 = require("@solana/web3.js");
221
286
  function encodeVecU82(bytes) {
222
287
  const out = new Uint8Array(4 + bytes.length);
223
288
  new DataView(out.buffer).setUint32(0, bytes.length >>> 0, true);
@@ -240,7 +305,7 @@ function buildRevokeSessionKeyInstruction(args) {
240
305
  encodeVecU82(args.clientDataJSON),
241
306
  encodeVecU82(args.authenticatorData)
242
307
  );
243
- return new import_web35.TransactionInstruction({
308
+ return new import_web36.TransactionInstruction({
244
309
  keys: [
245
310
  { pubkey: args.vaultPda, isSigner: false, isWritable: true },
246
311
  { pubkey: INSTRUCTIONS_SYSVAR_ID, isSigner: false, isWritable: false }
@@ -251,7 +316,7 @@ function buildRevokeSessionKeyInstruction(args) {
251
316
  }
252
317
 
253
318
  // src/instructions/settleVoucher.ts
254
- var import_web36 = require("@solana/web3.js");
319
+ var import_web37 = require("@solana/web3.js");
255
320
  function encodeU64(value) {
256
321
  const out = Buffer.alloc(8);
257
322
  out.writeBigUInt64LE(value, 0);
@@ -263,7 +328,7 @@ function encodeBool(value) {
263
328
  function buildSettleVoucherInstruction(p) {
264
329
  const argsBuf = Buffer.concat([encodeU64(p.amount), encodeBool(p.increment)]);
265
330
  const data = Buffer.concat([Buffer.from(DISCRIMINATORS.settle_voucher), argsBuf]);
266
- return new import_web36.TransactionInstruction({
331
+ return new import_web37.TransactionInstruction({
267
332
  programId: DEXTER_VAULT_PROGRAM_ID,
268
333
  keys: [
269
334
  { pubkey: p.vaultPda, isSigner: false, isWritable: true },
@@ -274,10 +339,10 @@ function buildSettleVoucherInstruction(p) {
274
339
  }
275
340
 
276
341
  // src/instructions/settleTabVoucher.ts
277
- var import_web38 = require("@solana/web3.js");
342
+ var import_web39 = require("@solana/web3.js");
278
343
 
279
344
  // src/instructions/withdraw.ts
280
- var import_web37 = require("@solana/web3.js");
345
+ var import_web38 = require("@solana/web3.js");
281
346
  function encodeBytesVec2(buf) {
282
347
  const out = Buffer.alloc(4 + buf.length);
283
348
  out.writeUInt32LE(buf.length, 0);
@@ -298,7 +363,7 @@ function encodePubkey2(key) {
298
363
  return Buffer.from(key.toBytes());
299
364
  }
300
365
  function deriveSwigWalletAddress(swigAddress) {
301
- const [pda] = import_web37.PublicKey.findProgramAddressSync(
366
+ const [pda] = import_web38.PublicKey.findProgramAddressSync(
302
367
  [Buffer.from("swig-wallet-address"), swigAddress.toBuffer()],
303
368
  SWIG_PROGRAM_ID
304
369
  );
@@ -313,11 +378,11 @@ function buildRequestWithdrawalInstruction(p) {
313
378
  encodeBytesVec2(p.authenticatorData)
314
379
  ]);
315
380
  const data = Buffer.concat([Buffer.from(DISCRIMINATORS.request_withdrawal), argsBuf]);
316
- return new import_web37.TransactionInstruction({
381
+ return new import_web38.TransactionInstruction({
317
382
  programId: DEXTER_VAULT_PROGRAM_ID,
318
383
  keys: [
319
384
  { pubkey: p.vaultPda, isSigner: false, isWritable: true },
320
- { pubkey: import_web37.SYSVAR_INSTRUCTIONS_PUBKEY, isSigner: false, isWritable: false }
385
+ { pubkey: import_web38.SYSVAR_INSTRUCTIONS_PUBKEY, isSigner: false, isWritable: false }
321
386
  ],
322
387
  data
323
388
  });
@@ -329,13 +394,13 @@ function buildFinalizeWithdrawalInstruction(p) {
329
394
  ]);
330
395
  const data = Buffer.concat([Buffer.from(DISCRIMINATORS.finalize_withdrawal), argsBuf]);
331
396
  const swigWalletAddress = deriveSwigWalletAddress(p.swigAddress);
332
- return new import_web37.TransactionInstruction({
397
+ return new import_web38.TransactionInstruction({
333
398
  programId: DEXTER_VAULT_PROGRAM_ID,
334
399
  keys: [
335
400
  { pubkey: p.swigAddress, isSigner: false, isWritable: false },
336
401
  { pubkey: swigWalletAddress, isSigner: false, isWritable: false },
337
402
  { pubkey: p.vaultPda, isSigner: false, isWritable: true },
338
- { pubkey: import_web37.SYSVAR_INSTRUCTIONS_PUBKEY, isSigner: false, isWritable: false }
403
+ { pubkey: import_web38.SYSVAR_INSTRUCTIONS_PUBKEY, isSigner: false, isWritable: false }
339
404
  ],
340
405
  data
341
406
  });
@@ -346,11 +411,11 @@ function buildForceReleaseInstruction(p) {
346
411
  encodeBytesVec2(p.authenticatorData)
347
412
  ]);
348
413
  const data = Buffer.concat([Buffer.from(DISCRIMINATORS.force_release), argsBuf]);
349
- return new import_web37.TransactionInstruction({
414
+ return new import_web38.TransactionInstruction({
350
415
  programId: DEXTER_VAULT_PROGRAM_ID,
351
416
  keys: [
352
417
  { pubkey: p.vaultPda, isSigner: false, isWritable: true },
353
- { pubkey: import_web37.SYSVAR_INSTRUCTIONS_PUBKEY, isSigner: false, isWritable: false }
418
+ { pubkey: import_web38.SYSVAR_INSTRUCTIONS_PUBKEY, isSigner: false, isWritable: false }
354
419
  ],
355
420
  data
356
421
  });
@@ -384,21 +449,21 @@ function buildSettleTabVoucherInstruction(p) {
384
449
  ]);
385
450
  const data = Buffer.concat([Buffer.from(DISCRIMINATORS.settle_tab_voucher), argsBuf]);
386
451
  const swigWalletAddress = deriveSwigWalletAddress(p.swigAddress);
387
- return new import_web38.TransactionInstruction({
452
+ return new import_web39.TransactionInstruction({
388
453
  programId: DEXTER_VAULT_PROGRAM_ID,
389
454
  keys: [
390
455
  { pubkey: p.swigAddress, isSigner: false, isWritable: false },
391
456
  { pubkey: swigWalletAddress, isSigner: false, isWritable: false },
392
457
  { pubkey: p.vaultPda, isSigner: false, isWritable: true },
393
458
  { pubkey: p.dexterAuthority, isSigner: true, isWritable: false },
394
- { pubkey: import_web38.SYSVAR_INSTRUCTIONS_PUBKEY, isSigner: false, isWritable: false }
459
+ { pubkey: import_web39.SYSVAR_INSTRUCTIONS_PUBKEY, isSigner: false, isWritable: false }
395
460
  ],
396
461
  data
397
462
  });
398
463
  }
399
464
 
400
465
  // src/instructions/rotate.ts
401
- var import_web39 = require("@solana/web3.js");
466
+ var import_web310 = require("@solana/web3.js");
402
467
  function encodeBytesVec3(buf) {
403
468
  const out = Buffer.alloc(4 + buf.length);
404
469
  out.writeUInt32LE(buf.length, 0);
@@ -421,11 +486,11 @@ function buildRotatePasskeyInstruction(p) {
421
486
  encodeBytesVec3(p.authenticatorData)
422
487
  ]);
423
488
  const data = Buffer.concat([Buffer.from(DISCRIMINATORS.rotate_passkey), argsBuf]);
424
- return new import_web39.TransactionInstruction({
489
+ return new import_web310.TransactionInstruction({
425
490
  programId: DEXTER_VAULT_PROGRAM_ID,
426
491
  keys: [
427
492
  { pubkey: p.vaultPda, isSigner: false, isWritable: true },
428
- { pubkey: import_web39.SYSVAR_INSTRUCTIONS_PUBKEY, isSigner: false, isWritable: false }
493
+ { pubkey: import_web310.SYSVAR_INSTRUCTIONS_PUBKEY, isSigner: false, isWritable: false }
429
494
  ],
430
495
  data
431
496
  });
@@ -435,7 +500,7 @@ function buildRotateDexterAuthorityInstruction(p) {
435
500
  Buffer.from(DISCRIMINATORS.rotate_dexter_authority),
436
501
  encodePubkey3(p.newDexterAuthority)
437
502
  ]);
438
- return new import_web39.TransactionInstruction({
503
+ return new import_web310.TransactionInstruction({
439
504
  programId: DEXTER_VAULT_PROGRAM_ID,
440
505
  keys: [
441
506
  { pubkey: p.vaultPda, isSigner: false, isWritable: true },
@@ -446,7 +511,7 @@ function buildRotateDexterAuthorityInstruction(p) {
446
511
  }
447
512
 
448
513
  // src/instructions/provePasskey.ts
449
- var import_web310 = require("@solana/web3.js");
514
+ var import_web311 = require("@solana/web3.js");
450
515
  function encodeBytesVec4(buf) {
451
516
  const out = Buffer.alloc(4 + buf.length);
452
517
  out.writeUInt32LE(buf.length, 0);
@@ -466,11 +531,11 @@ function buildProvePasskeyInstruction(p) {
466
531
  encodeBytesVec4(p.authenticatorData)
467
532
  ]);
468
533
  const data = Buffer.concat([Buffer.from(DISCRIMINATORS.prove_passkey), argsBuf]);
469
- return new import_web310.TransactionInstruction({
534
+ return new import_web311.TransactionInstruction({
470
535
  programId: DEXTER_VAULT_PROGRAM_ID,
471
536
  keys: [
472
537
  { pubkey: p.vaultPda, isSigner: false, isWritable: false },
473
- { pubkey: import_web310.SYSVAR_INSTRUCTIONS_PUBKEY, isSigner: false, isWritable: false }
538
+ { pubkey: import_web311.SYSVAR_INSTRUCTIONS_PUBKEY, isSigner: false, isWritable: false }
474
539
  ],
475
540
  data
476
541
  });
@@ -4870,7 +4935,7 @@ function createSolanaRpcFromTransport(transport) {
4870
4935
 
4871
4936
  // src/instructions/swigBundle.ts
4872
4937
  var bs58Module = __toESM(require("bs58"), 1);
4873
- var import_web311 = require("@solana/web3.js");
4938
+ var import_web312 = require("@solana/web3.js");
4874
4939
  var bs58 = bs58Module.default ?? bs58Module;
4875
4940
  var SWIG_ID_DOMAIN = "dexter-swig-id:v1:";
4876
4941
  var DEFAULT_SESSION_TTL_SECONDS = BigInt(30 * 24 * 60 * 60);
@@ -4986,7 +5051,7 @@ function deriveVaultPda(supabaseUserId) {
4986
5051
  if (supabaseUserId.length !== 16) {
4987
5052
  throw new Error("supabaseUserId must be 16 bytes (UUID v4)");
4988
5053
  }
4989
- const [pda, bump] = import_web311.PublicKey.findProgramAddressSync(
5054
+ const [pda, bump] = import_web312.PublicKey.findProgramAddressSync(
4990
5055
  [Buffer.from("vault"), Buffer.from(supabaseUserId)],
4991
5056
  DEXTER_VAULT_PROGRAM_ID
4992
5057
  );
@@ -4994,6 +5059,7 @@ function deriveVaultPda(supabaseUserId) {
4994
5059
  }
4995
5060
  // Annotate the CommonJS export names for ESM import in node:
4996
5061
  0 && (module.exports = {
5062
+ SET_SWIG_ATOMIC_DISCRIMINATOR,
4997
5063
  SWIG_PROGRAM_EXEC_MARKERS,
4998
5064
  SWIG_PROGRAM_EXEC_PREFIX,
4999
5065
  SWIG_PROGRAM_EXEC_PREFIX_SETTLE_TAB,
@@ -5006,6 +5072,7 @@ function deriveVaultPda(supabaseUserId) {
5006
5072
  buildRevokeSessionKeyInstruction,
5007
5073
  buildRotateDexterAuthorityInstruction,
5008
5074
  buildRotatePasskeyInstruction,
5075
+ buildSetSwigAtomicInstruction,
5009
5076
  buildSetSwigInstruction,
5010
5077
  buildSettleTabVoucherInstruction,
5011
5078
  buildSettleVoucherInstruction,
@@ -38,6 +38,54 @@ interface SetSwigParams {
38
38
  }
39
39
  declare function buildSetSwigInstruction(p: SetSwigParams): TransactionInstruction;
40
40
 
41
+ /**
42
+ * buildSetSwigAtomicInstruction — single-tx warmup builder.
43
+ *
44
+ * Companion of buildSetSwigInstruction. Where set_swig binds a pre-existing
45
+ * Swig to a vault, set_swig_atomic CREATES the Swig (with the 4-role layout
46
+ * buildSwigCreationBundle produces) AND binds it — all in one ix that the
47
+ * vault program executes via Swig CPIs.
48
+ *
49
+ * Wire format matches the on-chain Anchor handler's SetSwigAtomicArgs layout:
50
+ *
51
+ * discriminator (8)
52
+ * || swig_id (32)
53
+ * || swig_account_bump (1)
54
+ * || swig_wallet_address_bump (1)
55
+ * || dexter_master_pubkey (32)
56
+ * || client_data_json_len (4 LE) || client_data_json (variable)
57
+ * || authenticator_data_len (4 LE) || authenticator_data (variable)
58
+ *
59
+ * Discriminator (locked by Anchor's sha256("global:set_swig_atomic")[0..8]):
60
+ * 77 6f f7 d7 be 03 aa 17
61
+ */
62
+
63
+ /** Anchor instruction discriminator = sha256("global:set_swig_atomic")[0..8].
64
+ * Captured from target/idl/dexter_vault.json after `anchor build` on commit 49aae30. */
65
+ declare const SET_SWIG_ATOMIC_DISCRIMINATOR: Uint8Array<ArrayBuffer>;
66
+ interface BuildSetSwigAtomicParams {
67
+ /** dexter-vault PDA — written to (vault.swig_address is updated). */
68
+ vaultPda: PublicKey;
69
+ /** Swig state account PDA (derived from swig_id + Swig program). */
70
+ swigAddress: PublicKey;
71
+ /** Swig wallet PDA (different from swigAddress — it's the spending authority address). */
72
+ swigWalletAddress: PublicKey;
73
+ /** Outer-tx signer + role-0 bootstrap authority + rent payer for the new Swig. */
74
+ feePayer: PublicKey;
75
+ /** Becomes role-2 (Ed25519Session) authority. */
76
+ dexterMasterPubkey: PublicKey;
77
+ /** 32-byte Swig ID (the seed used to derive swigAddress). */
78
+ swigId: Uint8Array;
79
+ /** Bump for swigAddress = findProgramAddress(swig_account_seeds(swigId), SWIG_PROGRAM_ID). */
80
+ swigAccountBump: number;
81
+ /** Bump for swigWalletAddress PDA. */
82
+ swigWalletAddressBump: number;
83
+ /** WebAuthn ceremony output. */
84
+ clientDataJSON: Uint8Array;
85
+ authenticatorData: Uint8Array;
86
+ }
87
+ declare function buildSetSwigAtomicInstruction(params: BuildSetSwigAtomicParams): TransactionInstruction;
88
+
41
89
  /**
42
90
  * register_session_key — authorize a session ed25519 key under a vault.
43
91
  *
@@ -287,4 +335,4 @@ declare function deriveVaultPda(supabaseUserId: Uint8Array): {
287
335
  bump: number;
288
336
  };
289
337
 
290
- export { type BuildRegisterSessionKeyArgs, type BuildRevokeSessionKeyArgs, type BuildSwigCreationBundleParams, type FinalizeWithdrawalParams, type ForceReleaseParams, type InitializeVaultParams, type ProvePasskeyParams, type RequestWithdrawalParams, type RotateDexterAuthorityParams, type RotatePasskeyParams, SWIG_PROGRAM_EXEC_MARKERS, SWIG_PROGRAM_EXEC_PREFIX, SWIG_PROGRAM_EXEC_PREFIX_SETTLE_TAB, type SetSwigParams, type SettleTabVoucherParams, type SettleVoucherParams, type SwigCreationBundleOutput, type SwigOwnershipCheck, buildFinalizeWithdrawalInstruction, buildForceReleaseInstruction, buildInitializeVaultInstruction, buildProvePasskeyInstruction, buildRegisterSessionKeyInstruction, buildRequestWithdrawalInstruction, buildRevokeSessionKeyInstruction, buildRotateDexterAuthorityInstruction, buildRotatePasskeyInstruction, buildSetSwigInstruction, buildSettleTabVoucherInstruction, buildSettleVoucherInstruction, buildSwigCreationBundle, deriveSwigWalletAddress, deriveVaultPda, expectedSwigAddressFor, verifySwigIsOurs };
338
+ export { type BuildRegisterSessionKeyArgs, type BuildRevokeSessionKeyArgs, type BuildSetSwigAtomicParams, type BuildSwigCreationBundleParams, type FinalizeWithdrawalParams, type ForceReleaseParams, type InitializeVaultParams, type ProvePasskeyParams, type RequestWithdrawalParams, type RotateDexterAuthorityParams, type RotatePasskeyParams, SET_SWIG_ATOMIC_DISCRIMINATOR, SWIG_PROGRAM_EXEC_MARKERS, SWIG_PROGRAM_EXEC_PREFIX, SWIG_PROGRAM_EXEC_PREFIX_SETTLE_TAB, type SetSwigParams, type SettleTabVoucherParams, type SettleVoucherParams, type SwigCreationBundleOutput, type SwigOwnershipCheck, buildFinalizeWithdrawalInstruction, buildForceReleaseInstruction, buildInitializeVaultInstruction, buildProvePasskeyInstruction, buildRegisterSessionKeyInstruction, buildRequestWithdrawalInstruction, buildRevokeSessionKeyInstruction, buildRotateDexterAuthorityInstruction, buildRotatePasskeyInstruction, buildSetSwigAtomicInstruction, buildSetSwigInstruction, buildSettleTabVoucherInstruction, buildSettleVoucherInstruction, buildSwigCreationBundle, deriveSwigWalletAddress, deriveVaultPda, expectedSwigAddressFor, verifySwigIsOurs };
@@ -38,6 +38,54 @@ interface SetSwigParams {
38
38
  }
39
39
  declare function buildSetSwigInstruction(p: SetSwigParams): TransactionInstruction;
40
40
 
41
+ /**
42
+ * buildSetSwigAtomicInstruction — single-tx warmup builder.
43
+ *
44
+ * Companion of buildSetSwigInstruction. Where set_swig binds a pre-existing
45
+ * Swig to a vault, set_swig_atomic CREATES the Swig (with the 4-role layout
46
+ * buildSwigCreationBundle produces) AND binds it — all in one ix that the
47
+ * vault program executes via Swig CPIs.
48
+ *
49
+ * Wire format matches the on-chain Anchor handler's SetSwigAtomicArgs layout:
50
+ *
51
+ * discriminator (8)
52
+ * || swig_id (32)
53
+ * || swig_account_bump (1)
54
+ * || swig_wallet_address_bump (1)
55
+ * || dexter_master_pubkey (32)
56
+ * || client_data_json_len (4 LE) || client_data_json (variable)
57
+ * || authenticator_data_len (4 LE) || authenticator_data (variable)
58
+ *
59
+ * Discriminator (locked by Anchor's sha256("global:set_swig_atomic")[0..8]):
60
+ * 77 6f f7 d7 be 03 aa 17
61
+ */
62
+
63
+ /** Anchor instruction discriminator = sha256("global:set_swig_atomic")[0..8].
64
+ * Captured from target/idl/dexter_vault.json after `anchor build` on commit 49aae30. */
65
+ declare const SET_SWIG_ATOMIC_DISCRIMINATOR: Uint8Array<ArrayBuffer>;
66
+ interface BuildSetSwigAtomicParams {
67
+ /** dexter-vault PDA — written to (vault.swig_address is updated). */
68
+ vaultPda: PublicKey;
69
+ /** Swig state account PDA (derived from swig_id + Swig program). */
70
+ swigAddress: PublicKey;
71
+ /** Swig wallet PDA (different from swigAddress — it's the spending authority address). */
72
+ swigWalletAddress: PublicKey;
73
+ /** Outer-tx signer + role-0 bootstrap authority + rent payer for the new Swig. */
74
+ feePayer: PublicKey;
75
+ /** Becomes role-2 (Ed25519Session) authority. */
76
+ dexterMasterPubkey: PublicKey;
77
+ /** 32-byte Swig ID (the seed used to derive swigAddress). */
78
+ swigId: Uint8Array;
79
+ /** Bump for swigAddress = findProgramAddress(swig_account_seeds(swigId), SWIG_PROGRAM_ID). */
80
+ swigAccountBump: number;
81
+ /** Bump for swigWalletAddress PDA. */
82
+ swigWalletAddressBump: number;
83
+ /** WebAuthn ceremony output. */
84
+ clientDataJSON: Uint8Array;
85
+ authenticatorData: Uint8Array;
86
+ }
87
+ declare function buildSetSwigAtomicInstruction(params: BuildSetSwigAtomicParams): TransactionInstruction;
88
+
41
89
  /**
42
90
  * register_session_key — authorize a session ed25519 key under a vault.
43
91
  *
@@ -287,4 +335,4 @@ declare function deriveVaultPda(supabaseUserId: Uint8Array): {
287
335
  bump: number;
288
336
  };
289
337
 
290
- export { type BuildRegisterSessionKeyArgs, type BuildRevokeSessionKeyArgs, type BuildSwigCreationBundleParams, type FinalizeWithdrawalParams, type ForceReleaseParams, type InitializeVaultParams, type ProvePasskeyParams, type RequestWithdrawalParams, type RotateDexterAuthorityParams, type RotatePasskeyParams, SWIG_PROGRAM_EXEC_MARKERS, SWIG_PROGRAM_EXEC_PREFIX, SWIG_PROGRAM_EXEC_PREFIX_SETTLE_TAB, type SetSwigParams, type SettleTabVoucherParams, type SettleVoucherParams, type SwigCreationBundleOutput, type SwigOwnershipCheck, buildFinalizeWithdrawalInstruction, buildForceReleaseInstruction, buildInitializeVaultInstruction, buildProvePasskeyInstruction, buildRegisterSessionKeyInstruction, buildRequestWithdrawalInstruction, buildRevokeSessionKeyInstruction, buildRotateDexterAuthorityInstruction, buildRotatePasskeyInstruction, buildSetSwigInstruction, buildSettleTabVoucherInstruction, buildSettleVoucherInstruction, buildSwigCreationBundle, deriveSwigWalletAddress, deriveVaultPda, expectedSwigAddressFor, verifySwigIsOurs };
338
+ export { type BuildRegisterSessionKeyArgs, type BuildRevokeSessionKeyArgs, type BuildSetSwigAtomicParams, type BuildSwigCreationBundleParams, type FinalizeWithdrawalParams, type ForceReleaseParams, type InitializeVaultParams, type ProvePasskeyParams, type RequestWithdrawalParams, type RotateDexterAuthorityParams, type RotatePasskeyParams, SET_SWIG_ATOMIC_DISCRIMINATOR, SWIG_PROGRAM_EXEC_MARKERS, SWIG_PROGRAM_EXEC_PREFIX, SWIG_PROGRAM_EXEC_PREFIX_SETTLE_TAB, type SetSwigParams, type SettleTabVoucherParams, type SettleVoucherParams, type SwigCreationBundleOutput, type SwigOwnershipCheck, buildFinalizeWithdrawalInstruction, buildForceReleaseInstruction, buildInitializeVaultInstruction, buildProvePasskeyInstruction, buildRegisterSessionKeyInstruction, buildRequestWithdrawalInstruction, buildRevokeSessionKeyInstruction, buildRotateDexterAuthorityInstruction, buildRotatePasskeyInstruction, buildSetSwigAtomicInstruction, buildSetSwigInstruction, buildSettleTabVoucherInstruction, buildSettleVoucherInstruction, buildSwigCreationBundle, deriveSwigWalletAddress, deriveVaultPda, expectedSwigAddressFor, verifySwigIsOurs };