@cypher-zk/sdk 0.7.0 → 0.7.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.
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import { __commonJS, __toESM } from './chunk-5WRI5ZAA.js';
2
2
  import idlJson from './cypher-G57ZWFM3.json';
3
3
  import { PublicKey, AddressLookupTableProgram, SystemProgram, Transaction } from '@solana/web3.js';
4
4
  import { BN, AnchorProvider, Program, BorshCoder, EventParser } from '@anchor-lang/core';
5
- import { getAssociatedTokenAddressSync, TOKEN_PROGRAM_ID } from '@solana/spl-token';
5
+ import { getAssociatedTokenAddressSync, TOKEN_PROGRAM_ID, ASSOCIATED_TOKEN_PROGRAM_ID, createAssociatedTokenAccountIdempotentInstruction } from '@solana/spl-token';
6
6
  export { ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_PROGRAM_ID, getAssociatedTokenAddressSync } from '@solana/spl-token';
7
7
  import { getCompDefAccOffset, getMXEAccAddress, getCompDefAccAddress, getArciumProgramId, getLookupTableAddress, getClockAccAddress, getFeePoolAccAddress, getExecutingPoolAccAddress, getMempoolAccAddress, getClusterAccAddress, getComputationAccAddress, awaitComputationFinalization, x25519, RescueCipher, getMXEPublicKey } from '@arcium-hq/client';
8
8
 
@@ -3093,8 +3093,6 @@ function rethrowCypher(err) {
3093
3093
  }
3094
3094
  throw err;
3095
3095
  }
3096
-
3097
- // src/actions/createMarket.ts
3098
3096
  async function createMarketCommon(client, inputs) {
3099
3097
  emitProgress(inputs.onProgress, "validating", {
3100
3098
  message: "Validating market draft"
@@ -3110,6 +3108,28 @@ async function createMarketCommon(client, inputs) {
3110
3108
  const expectedMarketId = gs.marketCounter;
3111
3109
  const challengePeriod = inputs.challengePeriod ?? MIN_CHALLENGE_PERIOD_SECS;
3112
3110
  const bondAmount = inputs.bondAmount ?? MIN_CREATOR_BOND;
3111
+ const creatorAta = getAssociatedTokenAddressSync(
3112
+ acceptedMint,
3113
+ inputs.creator,
3114
+ false,
3115
+ TOKEN_PROGRAM_ID,
3116
+ ASSOCIATED_TOKEN_PROGRAM_ID
3117
+ );
3118
+ const ataInfo = await client.connection.getAccountInfo(creatorAta);
3119
+ if (!ataInfo) {
3120
+ emitProgress(inputs.onProgress, "validating", {
3121
+ message: "Initializing token account for accepted mint..."
3122
+ });
3123
+ const createAtaIx = createAssociatedTokenAccountIdempotentInstruction(
3124
+ inputs.creator,
3125
+ creatorAta,
3126
+ inputs.creator,
3127
+ acceptedMint,
3128
+ TOKEN_PROGRAM_ID,
3129
+ ASSOCIATED_TOKEN_PROGRAM_ID
3130
+ );
3131
+ await sendIx(client, createAtaIx);
3132
+ }
3113
3133
  const ix = inputs.kind === "yesno" ? await createMarketIx(client, {
3114
3134
  ...inputs,
3115
3135
  acceptedMint,