veilix-sdk 0.0.6 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -348,18 +348,6 @@ var veilix_devnet_default = {
348
348
  ]
349
349
  }
350
350
  },
351
- {
352
- name: "queue",
353
- address: "A43DyUGA7s8eXPxqEjJY6EBu1KKbNgfxF8h17VAHn13w"
354
- },
355
- {
356
- name: "slot_hashes",
357
- address: "SysvarS1otHashes111111111111111111111111111"
358
- },
359
- {
360
- name: "instructions",
361
- address: "Sysvar1nstructions1111111111111111111111111"
362
- },
363
351
  {
364
352
  name: "system_program",
365
353
  address: "11111111111111111111111111111111"
@@ -716,18 +704,6 @@ var veilix_devnet_default = {
716
704
  ]
717
705
  }
718
706
  },
719
- {
720
- name: "queue",
721
- address: "A43DyUGA7s8eXPxqEjJY6EBu1KKbNgfxF8h17VAHn13w"
722
- },
723
- {
724
- name: "slot_hashes",
725
- address: "SysvarS1otHashes111111111111111111111111111"
726
- },
727
- {
728
- name: "instructions",
729
- address: "Sysvar1nstructions1111111111111111111111111"
730
- },
731
707
  {
732
708
  name: "mint"
733
709
  },
@@ -2117,18 +2093,6 @@ var veilix_default = {
2117
2093
  ]
2118
2094
  }
2119
2095
  },
2120
- {
2121
- name: "queue",
2122
- address: "A43DyUGA7s8eXPxqEjJY6EBu1KKbNgfxF8h17VAHn13w"
2123
- },
2124
- {
2125
- name: "slot_hashes",
2126
- address: "SysvarS1otHashes111111111111111111111111111"
2127
- },
2128
- {
2129
- name: "instructions",
2130
- address: "Sysvar1nstructions1111111111111111111111111"
2131
- },
2132
2096
  {
2133
2097
  name: "system_program",
2134
2098
  address: "11111111111111111111111111111111"
@@ -2485,18 +2449,6 @@ var veilix_default = {
2485
2449
  ]
2486
2450
  }
2487
2451
  },
2488
- {
2489
- name: "queue",
2490
- address: "A43DyUGA7s8eXPxqEjJY6EBu1KKbNgfxF8h17VAHn13w"
2491
- },
2492
- {
2493
- name: "slot_hashes",
2494
- address: "SysvarS1otHashes111111111111111111111111111"
2495
- },
2496
- {
2497
- name: "instructions",
2498
- address: "Sysvar1nstructions1111111111111111111111111"
2499
- },
2500
2452
  {
2501
2453
  name: "mint"
2502
2454
  },
@@ -12573,52 +12525,6 @@ function formatNoteForDisplay(note, segmentLen = 8) {
12573
12525
  (p) => p.length > segmentLen * 2 ? p.slice(0, segmentLen) + "\u2026" + p.slice(-segmentLen) : p
12574
12526
  ).join("-");
12575
12527
  }
12576
- async function readOracleGatewayUrls(queue) {
12577
- const oracleKeys = await queue.fetchOracleKeys();
12578
- if (oracleKeys.length === 0) return [];
12579
- const rows = await sb.Oracle.loadMany(queue.program, oracleKeys);
12580
- return rows.map(
12581
- (row) => row ? Buffer.from(row.gatewayUri).toString("utf8").replace(/\0+$/, "").trim() : ""
12582
- ).filter((url) => url.length > 0);
12583
- }
12584
- async function firstHealthyGatewayUrl(urls) {
12585
- try {
12586
- return await Promise.any(
12587
- urls.map(async (url) => {
12588
- const response = await fetch(`${url.replace(/\/$/, "")}/gateway/api/v1/test`, {
12589
- signal: AbortSignal.timeout(8e3)
12590
- });
12591
- if (!response.ok) {
12592
- throw new Error(`gateway ${url} returned ${response.status}`);
12593
- }
12594
- return url;
12595
- })
12596
- );
12597
- } catch (error) {
12598
- const reason = error instanceof Error ? error.message : "unknown error";
12599
- throw new Error(`veilix-sdk: no healthy Switchboard gateway (${reason})`);
12600
- }
12601
- }
12602
- function crossbarForQueue(queue) {
12603
- const client = new CrossbarClient("https://crossbar.switchboard.xyz");
12604
- const fetchGateway = client.fetchGateway.bind(client);
12605
- client.fetchGateway = async (network) => {
12606
- try {
12607
- return await fetchGateway(network);
12608
- } catch (error) {
12609
- const message = error instanceof Error ? error.message : "";
12610
- if (!message.includes("No gateways available")) {
12611
- throw error;
12612
- }
12613
- const urls = await readOracleGatewayUrls(queue);
12614
- if (urls.length === 0) {
12615
- throw error;
12616
- }
12617
- return new sb.Gateway(await firstHealthyGatewayUrl(urls));
12618
- }
12619
- };
12620
- return client;
12621
- }
12622
12528
  function getRangeRiskScoreJob(address) {
12623
12529
  return OracleJob.fromObject({
12624
12530
  tasks: [
@@ -12647,7 +12553,7 @@ async function getOracleQuote(payer, addressToCheck) {
12647
12553
  solanaRPCUrl: rpcUrl,
12648
12554
  queueAddress: getDepositQueueAddress()
12649
12555
  });
12650
- const crossbarClient = crossbarForQueue(queue);
12556
+ const crossbarClient = CrossbarClient.default();
12651
12557
  const feed = {
12652
12558
  name: "Risk Score",
12653
12559
  jobs: [getRangeRiskScoreJob(addressToCheck)],
@@ -12720,7 +12626,6 @@ async function buildDepositIx(senderPubkey, commitmentBytes, denominationLamport
12720
12626
  [Buffer.from("commitment"), commitmentBuf],
12721
12627
  getProgramId()
12722
12628
  );
12723
- const queueAccount = new PublicKey(getDepositQueueAddress());
12724
12629
  const remainingAccounts = [];
12725
12630
  if (tempSigner) {
12726
12631
  remainingAccounts.push({
@@ -12736,9 +12641,9 @@ async function buildDepositIx(senderPubkey, commitmentBytes, denominationLamport
12736
12641
  pool: poolPDA,
12737
12642
  treasury: treasuryPDA,
12738
12643
  commitmentAccount: commitmentPDA,
12739
- queue: queueAccount,
12740
- slotHashes: anchor.web3.SYSVAR_SLOT_HASHES_PUBKEY,
12741
- instructions: anchor.web3.SYSVAR_INSTRUCTIONS_PUBKEY,
12644
+ // queue: queueAccount,
12645
+ // slotHashes: anchor.web3.SYSVAR_SLOT_HASHES_PUBKEY,
12646
+ // instructions: anchor.web3.SYSVAR_INSTRUCTIONS_PUBKEY,
12742
12647
  systemProgram: anchor.web3.SystemProgram.programId
12743
12648
  }).remainingAccounts(remainingAccounts).instruction();
12744
12649
  } else {
@@ -12845,8 +12750,6 @@ async function buildDepositTx({
12845
12750
  }).instruction()
12846
12751
  );
12847
12752
  }
12848
- const { sigVerifyIx } = await getOracleQuote(sender, sender.toBase58());
12849
- ixs.unshift(sigVerifyIx);
12850
12753
  const { blockhash } = await connection.getLatestBlockhash();
12851
12754
  const depositMessage = new TransactionMessage({
12852
12755
  payerKey: sender,
@@ -13750,11 +13653,14 @@ async function executeVeilixTransfer(items, tempKeypair) {
13750
13653
  const circuitArtifacts = await prepareWithdrawCircuitArtifacts();
13751
13654
  try {
13752
13655
  const extendBackupPdaNeeded = await isExtendBackupPdaNeeded2(senderPublicKey, allNotes.length);
13753
- const [{ sigVerifyIx }, depositInstructions, initNotesIx] = await Promise.all([
13754
- getOracleQuote(senderPublicKey, senderPublicKey.toBase58()),
13755
- buildDepositInstructionsForNotes2(senderPublicKey, allNotes, tempKeypair.publicKey),
13756
- buildInitNotesInstructionIfNeeded2(senderPublicKey)
13757
- ]);
13656
+ const [depositInstructions, initNotesIx] = (
13657
+ //{ sigVerifyIx },
13658
+ await Promise.all([
13659
+ // getOracleQuote(senderPublicKey, senderPublicKey.toBase58()),
13660
+ buildDepositInstructionsForNotes2(senderPublicKey, allNotes, tempKeypair.publicKey),
13661
+ buildInitNotesInstructionIfNeeded2(senderPublicKey)
13662
+ ])
13663
+ );
13758
13664
  const indexedDeposits = prepared.map((item, index) => ({
13759
13665
  item,
13760
13666
  depositIx: depositInstructions[index]
@@ -13765,7 +13671,7 @@ async function executeVeilixTransfer(items, tempKeypair) {
13765
13671
  Promise.all(
13766
13672
  depositChunks.map(async (batch, batchIndex) => {
13767
13673
  const instructions = [
13768
- sigVerifyIx,
13674
+ // sigVerifyIx,
13769
13675
  ...batch.map((entry) => entry.depositIx)
13770
13676
  ];
13771
13677
  instructions.map((ix) => {