From 3f72439685c19ca07bc940da6641aa720586ad3a Mon Sep 17 00:00:00 2001 From: Jun Jiang Date: Mon, 24 Jun 2024 02:01:41 +0800 Subject: [PATCH] misc update --- .github/actions/setup/action.yml | 31 +++ .github/workflows/main.yml | 196 +++++++++++++++++ Cargo.lock | 17 +- Cargo.toml | 4 +- clients/js/dist/src/index.js.map | 2 +- clients/js/dist/src/index.mjs.map | 2 +- clients/js/dist/test/_setup.js | 15 -- clients/js/dist/test/_setup.js.map | 2 +- clients/js/dist/test/create.test.js | 51 ----- clients/js/dist/test/create.test.js.map | 1 - clients/js/dist/test/increment.test.js | 122 ----------- clients/js/dist/test/increment.test.js.map | 1 - clients/js/test/_setup.ts | 20 -- clients/js/test/create.test.ts | 42 ---- clients/js/test/increment.test.ts | 141 ------------ package.json | 6 +- pnpm-lock.yaml | 238 +++++++++------------ scripts/generate-idls.mjs | 3 - 18 files changed, 339 insertions(+), 555 deletions(-) create mode 100644 .github/actions/setup/action.yml create mode 100644 .github/workflows/main.yml delete mode 100644 clients/js/dist/test/create.test.js delete mode 100644 clients/js/dist/test/create.test.js.map delete mode 100644 clients/js/dist/test/increment.test.js delete mode 100644 clients/js/dist/test/increment.test.js.map delete mode 100644 clients/js/test/create.test.ts delete mode 100644 clients/js/test/increment.test.ts diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml new file mode 100644 index 0000000..b0592f5 --- /dev/null +++ b/.github/actions/setup/action.yml @@ -0,0 +1,31 @@ +name: Setup environment + +inputs: + cache: + description: Enable caching + default: "true" + node: + description: The Node.js version to install + required: true + solana: + description: The Solana version to install + +runs: + using: "composite" + steps: + - name: Setup pnpm + uses: pnpm/action-setup@v3 + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ inputs.node }} + cache: "pnpm" + - name: Install dependencies + run: pnpm install --frozen-lockfile + shell: bash + - name: Install Solana + if: ${{ inputs.solana != '' }} + uses: metaplex-foundation/actions/install-solana@v1 + with: + version: ${{ inputs.solana }} + cache: ${{ inputs.cache }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..30317e4 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,196 @@ +name: Main + +on: + push: + branches: [main] + pull_request: + branches: [main] + +env: + NODE_VERSION: 20 + SOLANA_VERSION: 1.18.15 + CARGO_CACHE: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + +jobs: + build_programs: + name: Build programs + runs-on: ubuntu-latest + steps: + - name: Git checkout + uses: actions/checkout@v4 + - name: Setup environment + uses: ./.github/actions/setup + with: + node: ${{ env.NODE_VERSION }} + solana: ${{ env.SOLANA_VERSION }} + - name: Cache cargo dependencies + uses: actions/cache@v4 + with: + path: ${{ env.CARGO_CACHE }} + key: ${{ runner.os }}-cargo-programs-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo-programs + - name: Build programs + run: pnpm programs:build + - name: Upload program builds + uses: actions/upload-artifact@v4 + with: + name: program-builds + path: ./target/deploy/*.so + if-no-files-found: error + - name: Save all builds for clients + uses: actions/cache/save@v4 + with: + path: ./**/*.so + key: ${{ runner.os }}-builds-${{ github.sha }} + + test_programs: + name: Test programs + runs-on: ubuntu-latest + steps: + - name: Git checkout + uses: actions/checkout@v4 + - name: Setup environment + uses: ./.github/actions/setup + with: + node: ${{ env.NODE_VERSION }} + solana: ${{ env.SOLANA_VERSION }} + - name: Cache test cargo dependencies + uses: actions/cache@v4 + with: + path: ${{ env.CARGO_CACHE }} + key: ${{ runner.os }}-cargo-program-tests-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-program-tests + ${{ runner.os }}-cargo-programs-${{ hashFiles('**/Cargo.lock') }} + ${{ runner.os }}-cargo-programs + - name: Test programs + run: pnpm programs:test + +# generate_idls: +# name: Check IDL generation +# needs: build_programs +# runs-on: ubuntu-latest +# steps: +# - name: Git checkout +# uses: actions/checkout@v4 +# - name: Setup environment +# uses: ./.github/actions/setup +# with: +# node: ${{ env.NODE_VERSION }} +# solana: ${{ env.SOLANA_VERSION }} +# - name: Cache cargo dependencies +# uses: actions/cache@v4 +# with: +# path: ${{ env.CARGO_CACHE }} +# key: ${{ runner.os }}-cargo-programs-${{ hashFiles('**/Cargo.lock') }} +# restore-keys: ${{ runner.os }}-cargo-programs +# - name: Cache local cargo dependencies +# uses: actions/cache@v4 +# with: +# path: | +# .cargo/bin/ +# .cargo/registry/index/ +# .cargo/registry/cache/ +# .cargo/git/db/ +# key: ${{ runner.os }}-cargo-local-${{ hashFiles('**/Cargo.lock') }} +# restore-keys: ${{ runner.os }}-cargo-local +# - name: Generate IDLs +# run: pnpm generate:idls +# - name: Ensure working directory is clean +# run: test -z "$(git status --porcelain)" +# +# generate_clients: +# name: Check client generation +# needs: build_programs +# runs-on: ubuntu-latest +# steps: +# - name: Git checkout +# uses: actions/checkout@v4 +# - name: Setup environment +# uses: ./.github/actions/setup +# with: +# node: ${{ env.NODE_VERSION }} +# solana: ${{ env.SOLANA_VERSION }} +# - name: Generate clients +# run: pnpm generate:clients +# - name: Ensure working directory is clean +# run: test -z "$(git status --porcelain)" +# +# test_js: +# name: Test JS client +# needs: build_programs +# runs-on: ubuntu-latest +# steps: +# - name: Git checkout +# uses: actions/checkout@v4 +# - name: Setup environment +# uses: ./.github/actions/setup +# with: +# node: ${{ env.NODE_VERSION }} +# solana: ${{ env.SOLANA_VERSION }} +# - name: Restore all builds +# uses: actions/cache/restore@v4 +# with: +# path: ./**/*.so +# key: ${{ runner.os }}-builds-${{ github.sha }} +# - name: Test JS client +# run: pnpm clients:js:test +# +# lint_js: +# name: Lint JS client +# needs: build_programs +# runs-on: ubuntu-latest +# steps: +# - name: Git checkout +# uses: actions/checkout@v4 +# - name: Setup environment +# uses: ./.github/actions/setup +# with: +# node: ${{ env.NODE_VERSION }} +# - name: Lint JS client +# run: pnpm clients:js:lint +# +# test_rust: +# name: Test Rust client +# needs: build_programs +# runs-on: ubuntu-latest +# steps: +# - name: Git checkout +# uses: actions/checkout@v4 +# - name: Setup environment +# uses: ./.github/actions/setup +# with: +# node: ${{ env.NODE_VERSION }} +# solana: ${{ env.SOLANA_VERSION }} +# - name: Cache Rust client dependencies +# uses: actions/cache@v4 +# with: +# path: ${{ env.CARGO_CACHE }} +# key: ${{ runner.os }}-cargo-rust-client-${{ hashFiles('**/Cargo.lock') }} +# restore-keys: ${{ runner.os }}-cargo-rust-client +# - name: Restore all builds +# uses: actions/cache/restore@v4 +# with: +# path: ./**/*.so +# key: ${{ runner.os }}-builds-${{ github.sha }} +# - name: Test Rust client +# run: pnpm clients:rust:test +# +# lint_rust: +# name: Lint Rust client +# needs: build_programs +# runs-on: ubuntu-latest +# steps: +# - name: Git checkout +# uses: actions/checkout@v4 +# - name: Setup environment +# uses: ./.github/actions/setup +# with: +# node: ${{ env.NODE_VERSION }} +# - name: Lint Rust client +# run: pnpm clients:rust:lint diff --git a/Cargo.lock b/Cargo.lock index d881291..025f57b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -728,9 +728,9 @@ dependencies = [ [[package]] name = "bytemuck" -version = "1.16.0" +version = "1.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78834c15cb5d5efe3452d58b1e8ba890dd62d21907f867f383358198e56ebca5" +checksum = "b236fc92302c97ed75b38da1f4917b5cdda4984745740f153a5d3059e48d725e" dependencies = [ "bytemuck_derive", ] @@ -1117,16 +1117,15 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "4.1.2" +version = "4.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a677b8922c94e01bdbb12126b0bc852f00447528dee1782229af9c720c3f348" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" dependencies = [ "cfg-if", "cpufeatures", "curve25519-dalek-derive", "digest 0.10.7", "fiat-crypto", - "platforms", "rustc_version", "subtle", ] @@ -1203,7 +1202,7 @@ version = "0.0.1" dependencies = [ "arrayref", "borsh 1.5.1", - "curve25519-dalek 4.1.2", + "curve25519-dalek 4.1.3", "ed25519-dalek", "libsecp256k1 0.7.1", "num-derive 0.4.2", @@ -3001,12 +3000,6 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" -[[package]] -name = "platforms" -version = "3.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db23d408679286588f4d4644f965003d056e3dd5abcaaa938116871d7ce2fee7" - [[package]] name = "polyval" version = "0.5.3" diff --git a/Cargo.toml b/Cargo.toml index 292da2d..6a00416 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,11 +18,11 @@ borsh = "1.5.1" shank = "0.4.2" num-derive = "0.4.2" num-traits = "0.2.19" -solana-program = "1.18.16" thiserror = "1.0.61" serde = "1.0.202" serde_with = "3.8.1" assert_matches = "1.5.0" +solana-program = "1.18.16" solana-program-test = "1.18.16" solana-sdk = "1.18.16" solana-client = "1.18.16" @@ -34,6 +34,6 @@ ed25519-dalek = "1.0.1" libsecp256k1 = "0.7.1" clap = "4.5.4" arrayref = "*" -curve25519-dalek = { version = "4.1.2", default-features = false } +curve25519-dalek = { version = "4.1.3", default-features = false } sha2 = "0.10.8" hex = "0.4.3" diff --git a/clients/js/dist/src/index.js.map b/clients/js/dist/src/index.js.map index 21f7c6a..299aa40 100644 --- a/clients/js/dist/src/index.js.map +++ b/clients/js/dist/src/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../../env-shim.ts","../../src/generated/accounts/programDataAccount.ts","../../src/generated/pdas/deviceMint.ts","../../src/generated/pdas/productMint.ts","../../src/generated/pdas/programDataAccount.ts","../../src/generated/types/deviceActivationSignature.ts","../../src/generated/types/deviceSigningAlgorithm.ts","../../src/generated/types/key.ts","../../src/generated/types/programData.ts","../../src/generated/errors/dephyId.ts","../../src/generated/instructions/activateDevice.ts","../../src/generated/programs/dephyId.ts","../../src/generated/shared/index.ts","../../src/generated/instructions/createDevice.ts","../../src/generated/instructions/createProduct.ts","../../src/generated/instructions/initialize.ts"],"names":["combineCodec","getAddressEncoder","getStructDecoder","getStructEncoder","getProgramDerivedAddress","getUtf8Encoder","DeviceSigningAlgorithm","getEnumDecoder","getEnumEncoder","Key","getU8Decoder","getU8Encoder","transformEncoder","DephyIdAccount","DephyIdInstruction","getTupleDecoder","getTupleEncoder","addDecoderSizePrefix","addEncoderSizePrefix","getArrayDecoder","getArrayEncoder","getU32Decoder","getU32Encoder","getUtf8Decoder"],"mappings":";AACO,IAAM,UAA2B,uBACrC,QAAgB,KAAU,EAAE,aAAa,eAAe;;;ACM3D;AAAA,EACE;AAAA,EACA;AAAA,EACA,gBAAAA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,qBAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,oBAAAC;AAAA,EACA;AAAA,OAWK;;;ACtBP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AAQP,eAAsB,kBACpB,OACA,SAAmD,CAAC,GACpB;AAChC,QAAM;AAAA,IACJ,iBAAiB;AAAA,EACnB,IAAI;AACJ,SAAO,MAAM,yBAAyB;AAAA,IACpC;AAAA,IACA,OAAO;AAAA,MACL,eAAe,EAAE,OAAO,iBAAiB;AAAA,MACzC,kBAAkB,EAAE,OAAO,MAAM,iBAAiB;AAAA,MAClD,kBAAkB,EAAE,OAAO,MAAM,YAAY;AAAA,IAC/C;AAAA,EACF,CAAC;AACH;;;AC7BA;AAAA,EACE,qBAAAF;AAAA,EACA,4BAAAG;AAAA,EACA,kBAAAC;AAAA,OAGK;AAQP,eAAsB,mBACpB,OACA,SAAmD,CAAC,GACpB;AAChC,QAAM;AAAA,IACJ,iBAAiB;AAAA,EACnB,IAAI;AACJ,SAAO,MAAMD,0BAAyB;AAAA,IACpC;AAAA,IACA,OAAO;AAAA,MACLC,gBAAe,EAAE,OAAO,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BAAiB;AAGvB,QAAM,mBAAmB;AAAA,IACvB,eAAe,EAAE,OAAO,MAAM,iBAAiB,MAAM,YAAY,MAAM;AAAA,IACvE,OAAO,EAAE,OAAO,MAAM,SAAS,MAAM,YAAY,KAAK;AAAA,IACtD,aAAa,EAAE,OAAO,MAAM,eAAe,MAAM,YAAY,KAAK;AAAA,IAClE,WAAW,EAAE,OAAO,MAAM,aAAa,MAAM,YAAY,MAAM;AAAA,EACjE;AACA,QAAM,WAAW;AAMjB,QAAM,OAAO,EAAE,GAAG,MAAM;AAGxB,MAAI,CAAC,SAAS,cAAc,OAAO;AACjC,aAAS,cAAc,QACrB;AAAA,EACJ;AAEA,QAAM,iBAAiB,sBAAsB,gBAAgB,WAAW;AACxE,QAAM,cAAc;AAAA,IAClB,UAAU;AAAA,MACR,eAAe,SAAS,aAAa;AAAA,MACrC,eAAe,SAAS,KAAK;AAAA,MAC7B,eAAe,SAAS,WAAW;AAAA,MACnC,eAAe,SAAS,SAAS;AAAA,IACnC;AAAA,IACA;AAAA,IACA,MAAM,oCAAoC,EAAE;AAAA,MAC1C;AAAA,IACF;AAAA,EACF;AAQA,SAAO;AACT;AAoBO,SAAS,2BAId,aAGsD;AACtD,MAAI,YAAY,SAAS,SAAS,GAAG;AAEnC,UAAM,IAAI,MAAM,qBAAqB;AAAA,EACvC;AACA,MAAI,eAAe;AACnB,QAAM,iBAAiB,MAAM;AAC3B,UAAM,cAAc,YAAY,SAAU,YAAY;AACtD,oBAAgB;AAChB,WAAO;AAAA,EACT;AACA,SAAO;AAAA,IACL,gBAAgB,YAAY;AAAA,IAC5B,UAAU;AAAA,MACR,eAAe,eAAe;AAAA,MAC9B,OAAO,eAAe;AAAA,MACtB,aAAa,eAAe;AAAA,MAC5B,WAAW,eAAe;AAAA,IAC5B;AAAA,IACA,MAAM,oCAAoC,EAAE,OAAO,YAAY,IAAI;AAAA,EACrE;AACF","sourcesContent":["// Clever obfuscation to prevent the build system from inlining the value of `NODE_ENV`\nexport const __DEV__ = /* @__PURE__ */ (() =>\n (process as any)['en' + 'v'].NODE_ENV === 'development')();\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport {\n assertAccountExists,\n assertAccountsExist,\n combineCodec,\n decodeAccount,\n fetchEncodedAccount,\n fetchEncodedAccounts,\n getAddressDecoder,\n getAddressEncoder,\n getStructDecoder,\n getStructEncoder,\n transformEncoder,\n type Account,\n type Address,\n type Codec,\n type Decoder,\n type EncodedAccount,\n type Encoder,\n type FetchAccountConfig,\n type FetchAccountsConfig,\n type MaybeAccount,\n type MaybeEncodedAccount,\n} from '@solana/web3.js';\nimport { findProgramDataAccountPda } from '../pdas';\nimport {\n Key,\n getKeyDecoder,\n getKeyEncoder,\n getProgramDataDecoder,\n getProgramDataEncoder,\n type ProgramData,\n type ProgramDataArgs,\n} from '../types';\n\nexport type ProgramDataAccount = {\n key: Key;\n authority: Address;\n data: ProgramData;\n};\n\nexport type ProgramDataAccountArgs = {\n authority: Address;\n data: ProgramDataArgs;\n};\n\nexport function getProgramDataAccountEncoder(): Encoder {\n return transformEncoder(\n getStructEncoder([\n ['key', getKeyEncoder()],\n ['authority', getAddressEncoder()],\n ['data', getProgramDataEncoder()],\n ]),\n (value) => ({ ...value, key: Key.ProgramDataAccount })\n );\n}\n\nexport function getProgramDataAccountDecoder(): Decoder {\n return getStructDecoder([\n ['key', getKeyDecoder()],\n ['authority', getAddressDecoder()],\n ['data', getProgramDataDecoder()],\n ]);\n}\n\nexport function getProgramDataAccountCodec(): Codec<\n ProgramDataAccountArgs,\n ProgramDataAccount\n> {\n return combineCodec(\n getProgramDataAccountEncoder(),\n getProgramDataAccountDecoder()\n );\n}\n\nexport function decodeProgramDataAccount(\n encodedAccount: EncodedAccount\n): Account;\nexport function decodeProgramDataAccount(\n encodedAccount: MaybeEncodedAccount\n): MaybeAccount;\nexport function decodeProgramDataAccount(\n encodedAccount: EncodedAccount | MaybeEncodedAccount\n):\n | Account\n | MaybeAccount {\n return decodeAccount(\n encodedAccount as MaybeEncodedAccount,\n getProgramDataAccountDecoder()\n );\n}\n\nexport async function fetchProgramDataAccount(\n rpc: Parameters[0],\n address: Address,\n config?: FetchAccountConfig\n): Promise> {\n const maybeAccount = await fetchMaybeProgramDataAccount(rpc, address, config);\n assertAccountExists(maybeAccount);\n return maybeAccount;\n}\n\nexport async function fetchMaybeProgramDataAccount<\n TAddress extends string = string,\n>(\n rpc: Parameters[0],\n address: Address,\n config?: FetchAccountConfig\n): Promise> {\n const maybeAccount = await fetchEncodedAccount(rpc, address, config);\n return decodeProgramDataAccount(maybeAccount);\n}\n\nexport async function fetchAllProgramDataAccount(\n rpc: Parameters[0],\n addresses: Array
,\n config?: FetchAccountsConfig\n): Promise[]> {\n const maybeAccounts = await fetchAllMaybeProgramDataAccount(\n rpc,\n addresses,\n config\n );\n assertAccountsExist(maybeAccounts);\n return maybeAccounts;\n}\n\nexport async function fetchAllMaybeProgramDataAccount(\n rpc: Parameters[0],\n addresses: Array
,\n config?: FetchAccountsConfig\n): Promise[]> {\n const maybeAccounts = await fetchEncodedAccounts(rpc, addresses, config);\n return maybeAccounts.map((maybeAccount) =>\n decodeProgramDataAccount(maybeAccount)\n );\n}\n\nexport function getProgramDataAccountSize(): number {\n return 34;\n}\n\nexport async function fetchProgramDataAccountFromSeeds(\n rpc: Parameters[0],\n config: FetchAccountConfig & { programAddress?: Address } = {}\n): Promise> {\n const maybeAccount = await fetchMaybeProgramDataAccountFromSeeds(rpc, config);\n assertAccountExists(maybeAccount);\n return maybeAccount;\n}\n\nexport async function fetchMaybeProgramDataAccountFromSeeds(\n rpc: Parameters[0],\n config: FetchAccountConfig & { programAddress?: Address } = {}\n): Promise> {\n const { programAddress, ...fetchConfig } = config;\n const [address] = await findProgramDataAccountPda({ programAddress });\n return await fetchMaybeProgramDataAccount(rpc, address, fetchConfig);\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport {\n getAddressEncoder,\n getProgramDerivedAddress,\n getUtf8Encoder,\n type Address,\n type ProgramDerivedAddress,\n} from '@solana/web3.js';\n\nexport type DeviceMintSeeds = {\n productMintPubkey: Address;\n\n devicePubkey: Address;\n};\n\nexport async function findDeviceMintPda(\n seeds: DeviceMintSeeds,\n config: { programAddress?: Address | undefined } = {}\n): Promise {\n const {\n programAddress = 'hdMghjD73uASxgJXi6e1mGPsXqnADMsrqB1bveqABP1' as Address<'hdMghjD73uASxgJXi6e1mGPsXqnADMsrqB1bveqABP1'>,\n } = config;\n return await getProgramDerivedAddress({\n programAddress,\n seeds: [\n getUtf8Encoder().encode('DePHY_ID-DEVICE'),\n getAddressEncoder().encode(seeds.productMintPubkey),\n getAddressEncoder().encode(seeds.devicePubkey),\n ],\n });\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport {\n getAddressEncoder,\n getProgramDerivedAddress,\n getUtf8Encoder,\n type Address,\n type ProgramDerivedAddress,\n} from '@solana/web3.js';\n\nexport type ProductMintSeeds = {\n vendorPubkey: Address;\n\n productName: string;\n};\n\nexport async function findProductMintPda(\n seeds: ProductMintSeeds,\n config: { programAddress?: Address | undefined } = {}\n): Promise {\n const {\n programAddress = 'hdMghjD73uASxgJXi6e1mGPsXqnADMsrqB1bveqABP1' as Address<'hdMghjD73uASxgJXi6e1mGPsXqnADMsrqB1bveqABP1'>,\n } = config;\n return await getProgramDerivedAddress({\n programAddress,\n seeds: [\n getUtf8Encoder().encode('DePHY_ID-PRODUCT'),\n getAddressEncoder().encode(seeds.vendorPubkey),\n getUtf8Encoder().encode(seeds.productName),\n ],\n });\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport {\n getProgramDerivedAddress,\n getUtf8Encoder,\n type Address,\n type ProgramDerivedAddress,\n} from '@solana/web3.js';\n\nexport async function findProgramDataAccountPda(\n config: { programAddress?: Address | undefined } = {}\n): Promise {\n const {\n programAddress = 'hdMghjD73uASxgJXi6e1mGPsXqnADMsrqB1bveqABP1' as Address<'hdMghjD73uASxgJXi6e1mGPsXqnADMsrqB1bveqABP1'>,\n } = config;\n return await getProgramDerivedAddress({\n programAddress,\n seeds: [getUtf8Encoder().encode('DePHY_ID')],\n });\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport {\n combineCodec,\n fixDecoderSize,\n fixEncoderSize,\n getBytesDecoder,\n getBytesEncoder,\n getDiscriminatedUnionDecoder,\n getDiscriminatedUnionEncoder,\n getStructDecoder,\n getStructEncoder,\n getTupleDecoder,\n getTupleEncoder,\n getU8Decoder,\n getU8Encoder,\n type Codec,\n type Decoder,\n type Encoder,\n type GetDiscriminatedUnionVariant,\n type GetDiscriminatedUnionVariantContent,\n type ReadonlyUint8Array,\n} from '@solana/web3.js';\n\nexport type DeviceActivationSignature =\n | { __kind: 'Ed25519'; fields: readonly [ReadonlyUint8Array] }\n | { __kind: 'Secp256k1'; fields: readonly [ReadonlyUint8Array, number] }\n | { __kind: 'EthSecp256k1'; fields: readonly [ReadonlyUint8Array, number] };\n\nexport type DeviceActivationSignatureArgs = DeviceActivationSignature;\n\nexport function getDeviceActivationSignatureEncoder(): Encoder {\n return getDiscriminatedUnionEncoder([\n [\n 'Ed25519',\n getStructEncoder([\n ['fields', getTupleEncoder([fixEncoderSize(getBytesEncoder(), 64)])],\n ]),\n ],\n [\n 'Secp256k1',\n getStructEncoder([\n [\n 'fields',\n getTupleEncoder([\n fixEncoderSize(getBytesEncoder(), 64),\n getU8Encoder(),\n ]),\n ],\n ]),\n ],\n [\n 'EthSecp256k1',\n getStructEncoder([\n [\n 'fields',\n getTupleEncoder([\n fixEncoderSize(getBytesEncoder(), 64),\n getU8Encoder(),\n ]),\n ],\n ]),\n ],\n ]);\n}\n\nexport function getDeviceActivationSignatureDecoder(): Decoder {\n return getDiscriminatedUnionDecoder([\n [\n 'Ed25519',\n getStructDecoder([\n ['fields', getTupleDecoder([fixDecoderSize(getBytesDecoder(), 64)])],\n ]),\n ],\n [\n 'Secp256k1',\n getStructDecoder([\n [\n 'fields',\n getTupleDecoder([\n fixDecoderSize(getBytesDecoder(), 64),\n getU8Decoder(),\n ]),\n ],\n ]),\n ],\n [\n 'EthSecp256k1',\n getStructDecoder([\n [\n 'fields',\n getTupleDecoder([\n fixDecoderSize(getBytesDecoder(), 64),\n getU8Decoder(),\n ]),\n ],\n ]),\n ],\n ]);\n}\n\nexport function getDeviceActivationSignatureCodec(): Codec<\n DeviceActivationSignatureArgs,\n DeviceActivationSignature\n> {\n return combineCodec(\n getDeviceActivationSignatureEncoder(),\n getDeviceActivationSignatureDecoder()\n );\n}\n\n// Data Enum Helpers.\nexport function deviceActivationSignature(\n kind: 'Ed25519',\n data: GetDiscriminatedUnionVariantContent<\n DeviceActivationSignatureArgs,\n '__kind',\n 'Ed25519'\n >['fields']\n): GetDiscriminatedUnionVariant<\n DeviceActivationSignatureArgs,\n '__kind',\n 'Ed25519'\n>;\nexport function deviceActivationSignature(\n kind: 'Secp256k1',\n data: GetDiscriminatedUnionVariantContent<\n DeviceActivationSignatureArgs,\n '__kind',\n 'Secp256k1'\n >['fields']\n): GetDiscriminatedUnionVariant<\n DeviceActivationSignatureArgs,\n '__kind',\n 'Secp256k1'\n>;\nexport function deviceActivationSignature(\n kind: 'EthSecp256k1',\n data: GetDiscriminatedUnionVariantContent<\n DeviceActivationSignatureArgs,\n '__kind',\n 'EthSecp256k1'\n >['fields']\n): GetDiscriminatedUnionVariant<\n DeviceActivationSignatureArgs,\n '__kind',\n 'EthSecp256k1'\n>;\nexport function deviceActivationSignature<\n K extends DeviceActivationSignatureArgs['__kind'],\n Data,\n>(kind: K, data?: Data) {\n return Array.isArray(data)\n ? { __kind: kind, fields: data }\n : { __kind: kind, ...(data ?? {}) };\n}\n\nexport function isDeviceActivationSignature<\n K extends DeviceActivationSignature['__kind'],\n>(\n kind: K,\n value: DeviceActivationSignature\n): value is DeviceActivationSignature & { __kind: K } {\n return value.__kind === kind;\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport {\n combineCodec,\n getEnumDecoder,\n getEnumEncoder,\n type Codec,\n type Decoder,\n type Encoder,\n} from '@solana/web3.js';\n\nexport enum DeviceSigningAlgorithm {\n Ed25519,\n Secp256k1,\n}\n\nexport type DeviceSigningAlgorithmArgs = DeviceSigningAlgorithm;\n\nexport function getDeviceSigningAlgorithmEncoder(): Encoder {\n return getEnumEncoder(DeviceSigningAlgorithm);\n}\n\nexport function getDeviceSigningAlgorithmDecoder(): Decoder {\n return getEnumDecoder(DeviceSigningAlgorithm);\n}\n\nexport function getDeviceSigningAlgorithmCodec(): Codec<\n DeviceSigningAlgorithmArgs,\n DeviceSigningAlgorithm\n> {\n return combineCodec(\n getDeviceSigningAlgorithmEncoder(),\n getDeviceSigningAlgorithmDecoder()\n );\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport {\n combineCodec,\n getEnumDecoder,\n getEnumEncoder,\n type Codec,\n type Decoder,\n type Encoder,\n} from '@solana/web3.js';\n\nexport enum Key {\n Uninitialized,\n ProgramDataAccount,\n}\n\nexport type KeyArgs = Key;\n\nexport function getKeyEncoder(): Encoder {\n return getEnumEncoder(Key);\n}\n\nexport function getKeyDecoder(): Decoder {\n return getEnumDecoder(Key);\n}\n\nexport function getKeyCodec(): Codec {\n return combineCodec(getKeyEncoder(), getKeyDecoder());\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport {\n combineCodec,\n getStructDecoder,\n getStructEncoder,\n getU8Decoder,\n getU8Encoder,\n type Codec,\n type Decoder,\n type Encoder,\n} from '@solana/web3.js';\n\nexport type ProgramData = { bump: number };\n\nexport type ProgramDataArgs = ProgramData;\n\nexport function getProgramDataEncoder(): Encoder {\n return getStructEncoder([['bump', getU8Encoder()]]);\n}\n\nexport function getProgramDataDecoder(): Decoder {\n return getStructDecoder([['bump', getU8Decoder()]]);\n}\n\nexport function getProgramDataCodec(): Codec {\n return combineCodec(getProgramDataEncoder(), getProgramDataDecoder());\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\n/** DeserializationError: Error deserializing an account */\nexport const DEPHY_ID_ERROR__DESERIALIZATION_ERROR = 0x0; // 0\n/** SerializationError: Error serializing an account */\nexport const DEPHY_ID_ERROR__SERIALIZATION_ERROR = 0x1; // 1\n/** InvalidProgramOwner: Invalid program owner. This likely mean the provided account does not exist */\nexport const DEPHY_ID_ERROR__INVALID_PROGRAM_OWNER = 0x2; // 2\n/** InvalidPda: Invalid PDA derivation */\nexport const DEPHY_ID_ERROR__INVALID_PDA = 0x3; // 3\n/** ExpectedEmptyAccount: Expected empty account */\nexport const DEPHY_ID_ERROR__EXPECTED_EMPTY_ACCOUNT = 0x4; // 4\n/** ExpectedNonEmptyAccount: Expected non empty account */\nexport const DEPHY_ID_ERROR__EXPECTED_NON_EMPTY_ACCOUNT = 0x5; // 5\n/** ExpectedSignerAccount: Expected signer account */\nexport const DEPHY_ID_ERROR__EXPECTED_SIGNER_ACCOUNT = 0x6; // 6\n/** ExpectedWritableAccount: Expected writable account */\nexport const DEPHY_ID_ERROR__EXPECTED_WRITABLE_ACCOUNT = 0x7; // 7\n/** AccountMismatch: Account mismatch */\nexport const DEPHY_ID_ERROR__ACCOUNT_MISMATCH = 0x8; // 8\n/** InvalidAccountKey: Invalid account key */\nexport const DEPHY_ID_ERROR__INVALID_ACCOUNT_KEY = 0x9; // 9\n/** NumericalOverflow: Numerical overflow */\nexport const DEPHY_ID_ERROR__NUMERICAL_OVERFLOW = 0xa; // 10\n/** MissingInstruction: Missing instruction */\nexport const DEPHY_ID_ERROR__MISSING_INSTRUCTION = 0xb; // 11\n/** SignatureMismatch: Signature mismatch */\nexport const DEPHY_ID_ERROR__SIGNATURE_MISMATCH = 0xc; // 12\n\nexport type DephyIdError =\n | typeof DEPHY_ID_ERROR__ACCOUNT_MISMATCH\n | typeof DEPHY_ID_ERROR__DESERIALIZATION_ERROR\n | typeof DEPHY_ID_ERROR__EXPECTED_EMPTY_ACCOUNT\n | typeof DEPHY_ID_ERROR__EXPECTED_NON_EMPTY_ACCOUNT\n | typeof DEPHY_ID_ERROR__EXPECTED_SIGNER_ACCOUNT\n | typeof DEPHY_ID_ERROR__EXPECTED_WRITABLE_ACCOUNT\n | typeof DEPHY_ID_ERROR__INVALID_ACCOUNT_KEY\n | typeof DEPHY_ID_ERROR__INVALID_PDA\n | typeof DEPHY_ID_ERROR__INVALID_PROGRAM_OWNER\n | typeof DEPHY_ID_ERROR__MISSING_INSTRUCTION\n | typeof DEPHY_ID_ERROR__NUMERICAL_OVERFLOW\n | typeof DEPHY_ID_ERROR__SERIALIZATION_ERROR\n | typeof DEPHY_ID_ERROR__SIGNATURE_MISMATCH;\n\nlet dephyIdErrorMessages: Record | undefined;\nif (__DEV__) {\n dephyIdErrorMessages = {\n [DEPHY_ID_ERROR__ACCOUNT_MISMATCH]: `Account mismatch`,\n [DEPHY_ID_ERROR__DESERIALIZATION_ERROR]: `Error deserializing an account`,\n [DEPHY_ID_ERROR__EXPECTED_EMPTY_ACCOUNT]: `Expected empty account`,\n [DEPHY_ID_ERROR__EXPECTED_NON_EMPTY_ACCOUNT]: `Expected non empty account`,\n [DEPHY_ID_ERROR__EXPECTED_SIGNER_ACCOUNT]: `Expected signer account`,\n [DEPHY_ID_ERROR__EXPECTED_WRITABLE_ACCOUNT]: `Expected writable account`,\n [DEPHY_ID_ERROR__INVALID_ACCOUNT_KEY]: `Invalid account key`,\n [DEPHY_ID_ERROR__INVALID_PDA]: `Invalid PDA derivation`,\n [DEPHY_ID_ERROR__INVALID_PROGRAM_OWNER]: `Invalid program owner. This likely mean the provided account does not exist`,\n [DEPHY_ID_ERROR__MISSING_INSTRUCTION]: `Missing instruction`,\n [DEPHY_ID_ERROR__NUMERICAL_OVERFLOW]: `Numerical overflow`,\n [DEPHY_ID_ERROR__SERIALIZATION_ERROR]: `Error serializing an account`,\n [DEPHY_ID_ERROR__SIGNATURE_MISMATCH]: `Signature mismatch`,\n };\n}\n\nexport function getDephyIdErrorMessage(code: DephyIdError): string {\n if (__DEV__) {\n return (dephyIdErrorMessages as Record)[code];\n }\n\n return 'Error message not available in production bundles. Compile with `__DEV__` set to true to see more information.';\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport {\n combineCodec,\n getStructDecoder,\n getStructEncoder,\n getU64Decoder,\n getU64Encoder,\n getU8Decoder,\n getU8Encoder,\n transformEncoder,\n type Address,\n type Codec,\n type Decoder,\n type Encoder,\n type IAccountMeta,\n type IAccountSignerMeta,\n type IInstruction,\n type IInstructionWithAccounts,\n type IInstructionWithData,\n type ReadonlyAccount,\n type TransactionSigner,\n type WritableAccount,\n type WritableSignerAccount,\n} from '@solana/web3.js';\nimport { DEPHY_ID_PROGRAM_ADDRESS } from '../programs';\nimport { getAccountMetaFactory, type ResolvedAccount } from '../shared';\nimport {\n getDeviceActivationSignatureDecoder,\n getDeviceActivationSignatureEncoder,\n type DeviceActivationSignature,\n type DeviceActivationSignatureArgs,\n} from '../types';\n\nexport type ActivateDeviceInstruction<\n TProgram extends string = typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountSystemProgram extends\n | string\n | IAccountMeta = '11111111111111111111111111111111',\n TAccountToken2022Program extends string | IAccountMeta = string,\n TAccountAtaProgram extends\n | string\n | IAccountMeta = 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL',\n TAccountPayer extends string | IAccountMeta = string,\n TAccountVendor extends string | IAccountMeta = string,\n TAccountProductMint extends string | IAccountMeta = string,\n TAccountProductAssociatedToken extends string | IAccountMeta = string,\n TAccountDevice extends string | IAccountMeta = string,\n TAccountDeviceMint extends string | IAccountMeta = string,\n TAccountDeviceAssociatedToken extends string | IAccountMeta = string,\n TAccountOwner extends string | IAccountMeta = string,\n TRemainingAccounts extends readonly IAccountMeta[] = [],\n> = IInstruction &\n IInstructionWithData &\n IInstructionWithAccounts<\n [\n TAccountSystemProgram extends string\n ? ReadonlyAccount\n : TAccountSystemProgram,\n TAccountToken2022Program extends string\n ? ReadonlyAccount\n : TAccountToken2022Program,\n TAccountAtaProgram extends string\n ? ReadonlyAccount\n : TAccountAtaProgram,\n TAccountPayer extends string\n ? WritableSignerAccount &\n IAccountSignerMeta\n : TAccountPayer,\n TAccountVendor extends string\n ? ReadonlyAccount\n : TAccountVendor,\n TAccountProductMint extends string\n ? ReadonlyAccount\n : TAccountProductMint,\n TAccountProductAssociatedToken extends string\n ? ReadonlyAccount\n : TAccountProductAssociatedToken,\n TAccountDevice extends string\n ? ReadonlyAccount\n : TAccountDevice,\n TAccountDeviceMint extends string\n ? WritableAccount\n : TAccountDeviceMint,\n TAccountDeviceAssociatedToken extends string\n ? WritableAccount\n : TAccountDeviceAssociatedToken,\n TAccountOwner extends string\n ? ReadonlyAccount\n : TAccountOwner,\n ...TRemainingAccounts,\n ]\n >;\n\nexport type ActivateDeviceInstructionData = {\n discriminator: number;\n signature: DeviceActivationSignature;\n timestamp: bigint;\n};\n\nexport type ActivateDeviceInstructionDataArgs = {\n signature: DeviceActivationSignatureArgs;\n timestamp: number | bigint;\n};\n\nexport function getActivateDeviceInstructionDataEncoder(): Encoder {\n return transformEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['signature', getDeviceActivationSignatureEncoder()],\n ['timestamp', getU64Encoder()],\n ]),\n (value) => ({ ...value, discriminator: 3 })\n );\n}\n\nexport function getActivateDeviceInstructionDataDecoder(): Decoder {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['signature', getDeviceActivationSignatureDecoder()],\n ['timestamp', getU64Decoder()],\n ]);\n}\n\nexport function getActivateDeviceInstructionDataCodec(): Codec<\n ActivateDeviceInstructionDataArgs,\n ActivateDeviceInstructionData\n> {\n return combineCodec(\n getActivateDeviceInstructionDataEncoder(),\n getActivateDeviceInstructionDataDecoder()\n );\n}\n\nexport type ActivateDeviceInput<\n TAccountSystemProgram extends string = string,\n TAccountToken2022Program extends string = string,\n TAccountAtaProgram extends string = string,\n TAccountPayer extends string = string,\n TAccountVendor extends string = string,\n TAccountProductMint extends string = string,\n TAccountProductAssociatedToken extends string = string,\n TAccountDevice extends string = string,\n TAccountDeviceMint extends string = string,\n TAccountDeviceAssociatedToken extends string = string,\n TAccountOwner extends string = string,\n> = {\n /** The system program */\n systemProgram?: Address;\n /** The SPL Token 2022 program */\n token2022Program: Address;\n /** The associated token program */\n ataProgram?: Address;\n /** The account paying for the storage fees */\n payer: TransactionSigner;\n /** The vendor */\n vendor: Address;\n /** The mint account for the product */\n productMint: Address;\n /** The associated token account for the product */\n productAssociatedToken: Address;\n /** The device */\n device: Address;\n /** The mint account for the device */\n deviceMint: Address;\n /** The associated token account for the device */\n deviceAssociatedToken: Address;\n /** The device's owner */\n owner: Address;\n signature: ActivateDeviceInstructionDataArgs['signature'];\n timestamp: ActivateDeviceInstructionDataArgs['timestamp'];\n};\n\nexport function getActivateDeviceInstruction<\n TAccountSystemProgram extends string,\n TAccountToken2022Program extends string,\n TAccountAtaProgram extends string,\n TAccountPayer extends string,\n TAccountVendor extends string,\n TAccountProductMint extends string,\n TAccountProductAssociatedToken extends string,\n TAccountDevice extends string,\n TAccountDeviceMint extends string,\n TAccountDeviceAssociatedToken extends string,\n TAccountOwner extends string,\n>(\n input: ActivateDeviceInput<\n TAccountSystemProgram,\n TAccountToken2022Program,\n TAccountAtaProgram,\n TAccountPayer,\n TAccountVendor,\n TAccountProductMint,\n TAccountProductAssociatedToken,\n TAccountDevice,\n TAccountDeviceMint,\n TAccountDeviceAssociatedToken,\n TAccountOwner\n >\n): ActivateDeviceInstruction<\n typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountSystemProgram,\n TAccountToken2022Program,\n TAccountAtaProgram,\n TAccountPayer,\n TAccountVendor,\n TAccountProductMint,\n TAccountProductAssociatedToken,\n TAccountDevice,\n TAccountDeviceMint,\n TAccountDeviceAssociatedToken,\n TAccountOwner\n> {\n // Program address.\n const programAddress = DEPHY_ID_PROGRAM_ADDRESS;\n\n // Original accounts.\n const originalAccounts = {\n systemProgram: { value: input.systemProgram ?? null, isWritable: false },\n token2022Program: {\n value: input.token2022Program ?? null,\n isWritable: false,\n },\n ataProgram: { value: input.ataProgram ?? null, isWritable: false },\n payer: { value: input.payer ?? null, isWritable: true },\n vendor: { value: input.vendor ?? null, isWritable: false },\n productMint: { value: input.productMint ?? null, isWritable: false },\n productAssociatedToken: {\n value: input.productAssociatedToken ?? null,\n isWritable: false,\n },\n device: { value: input.device ?? null, isWritable: false },\n deviceMint: { value: input.deviceMint ?? null, isWritable: true },\n deviceAssociatedToken: {\n value: input.deviceAssociatedToken ?? null,\n isWritable: true,\n },\n owner: { value: input.owner ?? null, isWritable: false },\n };\n const accounts = originalAccounts as Record<\n keyof typeof originalAccounts,\n ResolvedAccount\n >;\n\n // Original args.\n const args = { ...input };\n\n // Resolve default values.\n if (!accounts.systemProgram.value) {\n accounts.systemProgram.value =\n '11111111111111111111111111111111' as Address<'11111111111111111111111111111111'>;\n }\n if (!accounts.ataProgram.value) {\n accounts.ataProgram.value =\n 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL' as Address<'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL'>;\n }\n\n const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');\n const instruction = {\n accounts: [\n getAccountMeta(accounts.systemProgram),\n getAccountMeta(accounts.token2022Program),\n getAccountMeta(accounts.ataProgram),\n getAccountMeta(accounts.payer),\n getAccountMeta(accounts.vendor),\n getAccountMeta(accounts.productMint),\n getAccountMeta(accounts.productAssociatedToken),\n getAccountMeta(accounts.device),\n getAccountMeta(accounts.deviceMint),\n getAccountMeta(accounts.deviceAssociatedToken),\n getAccountMeta(accounts.owner),\n ],\n programAddress,\n data: getActivateDeviceInstructionDataEncoder().encode(\n args as ActivateDeviceInstructionDataArgs\n ),\n } as ActivateDeviceInstruction<\n typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountSystemProgram,\n TAccountToken2022Program,\n TAccountAtaProgram,\n TAccountPayer,\n TAccountVendor,\n TAccountProductMint,\n TAccountProductAssociatedToken,\n TAccountDevice,\n TAccountDeviceMint,\n TAccountDeviceAssociatedToken,\n TAccountOwner\n >;\n\n return instruction;\n}\n\nexport type ParsedActivateDeviceInstruction<\n TProgram extends string = typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[],\n> = {\n programAddress: Address;\n accounts: {\n /** The system program */\n systemProgram: TAccountMetas[0];\n /** The SPL Token 2022 program */\n token2022Program: TAccountMetas[1];\n /** The associated token program */\n ataProgram: TAccountMetas[2];\n /** The account paying for the storage fees */\n payer: TAccountMetas[3];\n /** The vendor */\n vendor: TAccountMetas[4];\n /** The mint account for the product */\n productMint: TAccountMetas[5];\n /** The associated token account for the product */\n productAssociatedToken: TAccountMetas[6];\n /** The device */\n device: TAccountMetas[7];\n /** The mint account for the device */\n deviceMint: TAccountMetas[8];\n /** The associated token account for the device */\n deviceAssociatedToken: TAccountMetas[9];\n /** The device's owner */\n owner: TAccountMetas[10];\n };\n data: ActivateDeviceInstructionData;\n};\n\nexport function parseActivateDeviceInstruction<\n TProgram extends string,\n TAccountMetas extends readonly IAccountMeta[],\n>(\n instruction: IInstruction &\n IInstructionWithAccounts &\n IInstructionWithData\n): ParsedActivateDeviceInstruction {\n if (instruction.accounts.length < 11) {\n // TODO: Coded error.\n throw new Error('Not enough accounts');\n }\n let accountIndex = 0;\n const getNextAccount = () => {\n const accountMeta = instruction.accounts![accountIndex]!;\n accountIndex += 1;\n return accountMeta;\n };\n return {\n programAddress: instruction.programAddress,\n accounts: {\n systemProgram: getNextAccount(),\n token2022Program: getNextAccount(),\n ataProgram: getNextAccount(),\n payer: getNextAccount(),\n vendor: getNextAccount(),\n productMint: getNextAccount(),\n productAssociatedToken: getNextAccount(),\n device: getNextAccount(),\n deviceMint: getNextAccount(),\n deviceAssociatedToken: getNextAccount(),\n owner: getNextAccount(),\n },\n data: getActivateDeviceInstructionDataDecoder().decode(instruction.data),\n };\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport { containsBytes, getU8Encoder, type Address } from '@solana/web3.js';\nimport {\n type ParsedActivateDeviceInstruction,\n type ParsedCreateDeviceInstruction,\n type ParsedCreateProductInstruction,\n type ParsedInitializeInstruction,\n} from '../instructions';\nimport { Key, getKeyEncoder } from '../types';\n\nexport const DEPHY_ID_PROGRAM_ADDRESS =\n 'hdMghjD73uASxgJXi6e1mGPsXqnADMsrqB1bveqABP1' as Address<'hdMghjD73uASxgJXi6e1mGPsXqnADMsrqB1bveqABP1'>;\n\nexport enum DephyIdAccount {\n ProgramDataAccount,\n}\n\nexport function identifyDephyIdAccount(\n account: { data: Uint8Array } | Uint8Array\n): DephyIdAccount {\n const data = account instanceof Uint8Array ? account : account.data;\n if (containsBytes(data, getKeyEncoder().encode(Key.ProgramDataAccount), 0)) {\n return DephyIdAccount.ProgramDataAccount;\n }\n throw new Error(\n 'The provided account could not be identified as a dephyId account.'\n );\n}\n\nexport enum DephyIdInstruction {\n Initialize,\n CreateProduct,\n CreateDevice,\n ActivateDevice,\n}\n\nexport function identifyDephyIdInstruction(\n instruction: { data: Uint8Array } | Uint8Array\n): DephyIdInstruction {\n const data =\n instruction instanceof Uint8Array ? instruction : instruction.data;\n if (containsBytes(data, getU8Encoder().encode(0), 0)) {\n return DephyIdInstruction.Initialize;\n }\n if (containsBytes(data, getU8Encoder().encode(1), 0)) {\n return DephyIdInstruction.CreateProduct;\n }\n if (containsBytes(data, getU8Encoder().encode(2), 0)) {\n return DephyIdInstruction.CreateDevice;\n }\n if (containsBytes(data, getU8Encoder().encode(3), 0)) {\n return DephyIdInstruction.ActivateDevice;\n }\n throw new Error(\n 'The provided instruction could not be identified as a dephyId instruction.'\n );\n}\n\nexport type ParsedDephyIdInstruction<\n TProgram extends string = 'hdMghjD73uASxgJXi6e1mGPsXqnADMsrqB1bveqABP1',\n> =\n | ({\n instructionType: DephyIdInstruction.Initialize;\n } & ParsedInitializeInstruction)\n | ({\n instructionType: DephyIdInstruction.CreateProduct;\n } & ParsedCreateProductInstruction)\n | ({\n instructionType: DephyIdInstruction.CreateDevice;\n } & ParsedCreateDeviceInstruction)\n | ({\n instructionType: DephyIdInstruction.ActivateDevice;\n } & ParsedActivateDeviceInstruction);\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport {\n AccountRole,\n isProgramDerivedAddress,\n isTransactionSigner as web3JsIsTransactionSigner,\n type Address,\n type IAccountMeta,\n type IAccountSignerMeta,\n type ProgramDerivedAddress,\n type TransactionSigner,\n upgradeRoleToSigner,\n} from '@solana/web3.js';\n\n/**\n * Asserts that the given value is not null or undefined.\n * @internal\n */\nexport function expectSome(value: T | null | undefined): T {\n if (value == null) {\n throw new Error('Expected a value but received null or undefined.');\n }\n return value;\n}\n\n/**\n * Asserts that the given value is a PublicKey.\n * @internal\n */\nexport function expectAddress(\n value:\n | Address\n | ProgramDerivedAddress\n | TransactionSigner\n | null\n | undefined\n): Address {\n if (!value) {\n throw new Error('Expected a Address.');\n }\n if (typeof value === 'object' && 'address' in value) {\n return value.address;\n }\n if (Array.isArray(value)) {\n return value[0];\n }\n return value as Address;\n}\n\n/**\n * Asserts that the given value is a PDA.\n * @internal\n */\nexport function expectProgramDerivedAddress(\n value:\n | Address\n | ProgramDerivedAddress\n | TransactionSigner\n | null\n | undefined\n): ProgramDerivedAddress {\n if (!value || !Array.isArray(value) || !isProgramDerivedAddress(value)) {\n throw new Error('Expected a ProgramDerivedAddress.');\n }\n return value;\n}\n\n/**\n * Asserts that the given value is a TransactionSigner.\n * @internal\n */\nexport function expectTransactionSigner(\n value:\n | Address\n | ProgramDerivedAddress\n | TransactionSigner\n | null\n | undefined\n): TransactionSigner {\n if (!value || !isTransactionSigner(value)) {\n throw new Error('Expected a TransactionSigner.');\n }\n return value;\n}\n\n/**\n * Defines an instruction account to resolve.\n * @internal\n */\nexport type ResolvedAccount<\n T extends string = string,\n U extends\n | Address\n | ProgramDerivedAddress\n | TransactionSigner\n | null =\n | Address\n | ProgramDerivedAddress\n | TransactionSigner\n | null,\n> = {\n isWritable: boolean;\n value: U;\n};\n\n/**\n * Defines an instruction that stores additional bytes on-chain.\n * @internal\n */\nexport type IInstructionWithByteDelta = {\n byteDelta: number;\n};\n\n/**\n * Get account metas and signers from resolved accounts.\n * @internal\n */\nexport function getAccountMetaFactory(\n programAddress: Address,\n optionalAccountStrategy: 'omitted' | 'programId'\n) {\n return (\n account: ResolvedAccount\n ): IAccountMeta | IAccountSignerMeta | undefined => {\n if (!account.value) {\n if (optionalAccountStrategy === 'omitted') return;\n return Object.freeze({\n address: programAddress,\n role: AccountRole.READONLY,\n });\n }\n\n const writableRole = account.isWritable\n ? AccountRole.WRITABLE\n : AccountRole.READONLY;\n return Object.freeze({\n address: expectAddress(account.value),\n role: isTransactionSigner(account.value)\n ? upgradeRoleToSigner(writableRole)\n : writableRole,\n ...(isTransactionSigner(account.value) ? { signer: account.value } : {}),\n });\n };\n}\n\nexport function isTransactionSigner(\n value:\n | Address\n | ProgramDerivedAddress\n | TransactionSigner\n): value is TransactionSigner {\n return (\n !!value &&\n typeof value === 'object' &&\n 'address' in value &&\n web3JsIsTransactionSigner(value)\n );\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport {\n addDecoderSizePrefix,\n addEncoderSizePrefix,\n combineCodec,\n getArrayDecoder,\n getArrayEncoder,\n getStructDecoder,\n getStructEncoder,\n getTupleDecoder,\n getTupleEncoder,\n getU32Decoder,\n getU32Encoder,\n getU8Decoder,\n getU8Encoder,\n getUtf8Decoder,\n getUtf8Encoder,\n transformEncoder,\n type Address,\n type Codec,\n type Decoder,\n type Encoder,\n type IAccountMeta,\n type IAccountSignerMeta,\n type IInstruction,\n type IInstructionWithAccounts,\n type IInstructionWithData,\n type ReadonlyAccount,\n type ReadonlySignerAccount,\n type TransactionSigner,\n type WritableAccount,\n type WritableSignerAccount,\n} from '@solana/web3.js';\nimport { DEPHY_ID_PROGRAM_ADDRESS } from '../programs';\nimport { getAccountMetaFactory, type ResolvedAccount } from '../shared';\nimport {\n getDeviceSigningAlgorithmDecoder,\n getDeviceSigningAlgorithmEncoder,\n type DeviceSigningAlgorithm,\n type DeviceSigningAlgorithmArgs,\n} from '../types';\n\nexport type CreateDeviceInstruction<\n TProgram extends string = typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountSystemProgram extends\n | string\n | IAccountMeta = '11111111111111111111111111111111',\n TAccountToken2022Program extends\n | string\n | IAccountMeta = 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb',\n TAccountAtaProgram extends\n | string\n | IAccountMeta = 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL',\n TAccountPayer extends string | IAccountMeta = string,\n TAccountVendor extends string | IAccountMeta = string,\n TAccountProductMint extends string | IAccountMeta = string,\n TAccountProductAssociatedToken extends string | IAccountMeta = string,\n TAccountDevice extends string | IAccountMeta = string,\n TAccountDeviceMint extends string | IAccountMeta = string,\n TRemainingAccounts extends readonly IAccountMeta[] = [],\n> = IInstruction &\n IInstructionWithData &\n IInstructionWithAccounts<\n [\n TAccountSystemProgram extends string\n ? ReadonlyAccount\n : TAccountSystemProgram,\n TAccountToken2022Program extends string\n ? ReadonlyAccount\n : TAccountToken2022Program,\n TAccountAtaProgram extends string\n ? ReadonlyAccount\n : TAccountAtaProgram,\n TAccountPayer extends string\n ? WritableSignerAccount &\n IAccountSignerMeta\n : TAccountPayer,\n TAccountVendor extends string\n ? ReadonlySignerAccount &\n IAccountSignerMeta\n : TAccountVendor,\n TAccountProductMint extends string\n ? WritableAccount\n : TAccountProductMint,\n TAccountProductAssociatedToken extends string\n ? WritableAccount\n : TAccountProductAssociatedToken,\n TAccountDevice extends string\n ? ReadonlyAccount\n : TAccountDevice,\n TAccountDeviceMint extends string\n ? WritableAccount\n : TAccountDeviceMint,\n ...TRemainingAccounts,\n ]\n >;\n\nexport type CreateDeviceInstructionData = {\n discriminator: number;\n name: string;\n uri: string;\n additionalMetadata: Array;\n signingAlg: DeviceSigningAlgorithm;\n};\n\nexport type CreateDeviceInstructionDataArgs = {\n name: string;\n uri: string;\n additionalMetadata: Array;\n signingAlg: DeviceSigningAlgorithmArgs;\n};\n\nexport function getCreateDeviceInstructionDataEncoder(): Encoder {\n return transformEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['name', addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())],\n ['uri', addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())],\n [\n 'additionalMetadata',\n getArrayEncoder(\n getTupleEncoder([\n addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder()),\n addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder()),\n ])\n ),\n ],\n ['signingAlg', getDeviceSigningAlgorithmEncoder()],\n ]),\n (value) => ({ ...value, discriminator: 2 })\n );\n}\n\nexport function getCreateDeviceInstructionDataDecoder(): Decoder {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['name', addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())],\n ['uri', addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())],\n [\n 'additionalMetadata',\n getArrayDecoder(\n getTupleDecoder([\n addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder()),\n addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder()),\n ])\n ),\n ],\n ['signingAlg', getDeviceSigningAlgorithmDecoder()],\n ]);\n}\n\nexport function getCreateDeviceInstructionDataCodec(): Codec<\n CreateDeviceInstructionDataArgs,\n CreateDeviceInstructionData\n> {\n return combineCodec(\n getCreateDeviceInstructionDataEncoder(),\n getCreateDeviceInstructionDataDecoder()\n );\n}\n\nexport type CreateDeviceInput<\n TAccountSystemProgram extends string = string,\n TAccountToken2022Program extends string = string,\n TAccountAtaProgram extends string = string,\n TAccountPayer extends string = string,\n TAccountVendor extends string = string,\n TAccountProductMint extends string = string,\n TAccountProductAssociatedToken extends string = string,\n TAccountDevice extends string = string,\n TAccountDeviceMint extends string = string,\n> = {\n /** The system program */\n systemProgram?: Address;\n /** The SPL Token 2022 program */\n token2022Program?: Address;\n /** The associated token program */\n ataProgram?: Address;\n /** The account paying for the storage fees */\n payer: TransactionSigner;\n /** The vendor */\n vendor: TransactionSigner;\n /** The mint account of the product */\n productMint: Address;\n /** The associated token account of the product */\n productAssociatedToken: Address;\n /** The device */\n device: Address;\n /** The mint account of the device */\n deviceMint: Address;\n name: CreateDeviceInstructionDataArgs['name'];\n uri: CreateDeviceInstructionDataArgs['uri'];\n additionalMetadata: CreateDeviceInstructionDataArgs['additionalMetadata'];\n signingAlg: CreateDeviceInstructionDataArgs['signingAlg'];\n};\n\nexport function getCreateDeviceInstruction<\n TAccountSystemProgram extends string,\n TAccountToken2022Program extends string,\n TAccountAtaProgram extends string,\n TAccountPayer extends string,\n TAccountVendor extends string,\n TAccountProductMint extends string,\n TAccountProductAssociatedToken extends string,\n TAccountDevice extends string,\n TAccountDeviceMint extends string,\n>(\n input: CreateDeviceInput<\n TAccountSystemProgram,\n TAccountToken2022Program,\n TAccountAtaProgram,\n TAccountPayer,\n TAccountVendor,\n TAccountProductMint,\n TAccountProductAssociatedToken,\n TAccountDevice,\n TAccountDeviceMint\n >\n): CreateDeviceInstruction<\n typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountSystemProgram,\n TAccountToken2022Program,\n TAccountAtaProgram,\n TAccountPayer,\n TAccountVendor,\n TAccountProductMint,\n TAccountProductAssociatedToken,\n TAccountDevice,\n TAccountDeviceMint\n> {\n // Program address.\n const programAddress = DEPHY_ID_PROGRAM_ADDRESS;\n\n // Original accounts.\n const originalAccounts = {\n systemProgram: { value: input.systemProgram ?? null, isWritable: false },\n token2022Program: {\n value: input.token2022Program ?? null,\n isWritable: false,\n },\n ataProgram: { value: input.ataProgram ?? null, isWritable: false },\n payer: { value: input.payer ?? null, isWritable: true },\n vendor: { value: input.vendor ?? null, isWritable: false },\n productMint: { value: input.productMint ?? null, isWritable: true },\n productAssociatedToken: {\n value: input.productAssociatedToken ?? null,\n isWritable: true,\n },\n device: { value: input.device ?? null, isWritable: false },\n deviceMint: { value: input.deviceMint ?? null, isWritable: true },\n };\n const accounts = originalAccounts as Record<\n keyof typeof originalAccounts,\n ResolvedAccount\n >;\n\n // Original args.\n const args = { ...input };\n\n // Resolve default values.\n if (!accounts.systemProgram.value) {\n accounts.systemProgram.value =\n '11111111111111111111111111111111' as Address<'11111111111111111111111111111111'>;\n }\n if (!accounts.token2022Program.value) {\n accounts.token2022Program.value =\n 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb' as Address<'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb'>;\n }\n if (!accounts.ataProgram.value) {\n accounts.ataProgram.value =\n 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL' as Address<'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL'>;\n }\n\n const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');\n const instruction = {\n accounts: [\n getAccountMeta(accounts.systemProgram),\n getAccountMeta(accounts.token2022Program),\n getAccountMeta(accounts.ataProgram),\n getAccountMeta(accounts.payer),\n getAccountMeta(accounts.vendor),\n getAccountMeta(accounts.productMint),\n getAccountMeta(accounts.productAssociatedToken),\n getAccountMeta(accounts.device),\n getAccountMeta(accounts.deviceMint),\n ],\n programAddress,\n data: getCreateDeviceInstructionDataEncoder().encode(\n args as CreateDeviceInstructionDataArgs\n ),\n } as CreateDeviceInstruction<\n typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountSystemProgram,\n TAccountToken2022Program,\n TAccountAtaProgram,\n TAccountPayer,\n TAccountVendor,\n TAccountProductMint,\n TAccountProductAssociatedToken,\n TAccountDevice,\n TAccountDeviceMint\n >;\n\n return instruction;\n}\n\nexport type ParsedCreateDeviceInstruction<\n TProgram extends string = typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[],\n> = {\n programAddress: Address;\n accounts: {\n /** The system program */\n systemProgram: TAccountMetas[0];\n /** The SPL Token 2022 program */\n token2022Program: TAccountMetas[1];\n /** The associated token program */\n ataProgram: TAccountMetas[2];\n /** The account paying for the storage fees */\n payer: TAccountMetas[3];\n /** The vendor */\n vendor: TAccountMetas[4];\n /** The mint account of the product */\n productMint: TAccountMetas[5];\n /** The associated token account of the product */\n productAssociatedToken: TAccountMetas[6];\n /** The device */\n device: TAccountMetas[7];\n /** The mint account of the device */\n deviceMint: TAccountMetas[8];\n };\n data: CreateDeviceInstructionData;\n};\n\nexport function parseCreateDeviceInstruction<\n TProgram extends string,\n TAccountMetas extends readonly IAccountMeta[],\n>(\n instruction: IInstruction &\n IInstructionWithAccounts &\n IInstructionWithData\n): ParsedCreateDeviceInstruction {\n if (instruction.accounts.length < 9) {\n // TODO: Coded error.\n throw new Error('Not enough accounts');\n }\n let accountIndex = 0;\n const getNextAccount = () => {\n const accountMeta = instruction.accounts![accountIndex]!;\n accountIndex += 1;\n return accountMeta;\n };\n return {\n programAddress: instruction.programAddress,\n accounts: {\n systemProgram: getNextAccount(),\n token2022Program: getNextAccount(),\n ataProgram: getNextAccount(),\n payer: getNextAccount(),\n vendor: getNextAccount(),\n productMint: getNextAccount(),\n productAssociatedToken: getNextAccount(),\n device: getNextAccount(),\n deviceMint: getNextAccount(),\n },\n data: getCreateDeviceInstructionDataDecoder().decode(instruction.data),\n };\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport {\n addDecoderSizePrefix,\n addEncoderSizePrefix,\n combineCodec,\n getArrayDecoder,\n getArrayEncoder,\n getStructDecoder,\n getStructEncoder,\n getTupleDecoder,\n getTupleEncoder,\n getU32Decoder,\n getU32Encoder,\n getU8Decoder,\n getU8Encoder,\n getUtf8Decoder,\n getUtf8Encoder,\n transformEncoder,\n type Address,\n type Codec,\n type Decoder,\n type Encoder,\n type IAccountMeta,\n type IAccountSignerMeta,\n type IInstruction,\n type IInstructionWithAccounts,\n type IInstructionWithData,\n type ReadonlyAccount,\n type ReadonlySignerAccount,\n type TransactionSigner,\n type WritableAccount,\n type WritableSignerAccount,\n} from '@solana/web3.js';\nimport { DEPHY_ID_PROGRAM_ADDRESS } from '../programs';\nimport { getAccountMetaFactory, type ResolvedAccount } from '../shared';\n\nexport type CreateProductInstruction<\n TProgram extends string = typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountSystemProgram extends\n | string\n | IAccountMeta = '11111111111111111111111111111111',\n TAccountToken2022Program extends\n | string\n | IAccountMeta = 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb',\n TAccountPayer extends string | IAccountMeta = string,\n TAccountVendor extends string | IAccountMeta = string,\n TAccountProductMint extends string | IAccountMeta = string,\n TRemainingAccounts extends readonly IAccountMeta[] = [],\n> = IInstruction &\n IInstructionWithData &\n IInstructionWithAccounts<\n [\n TAccountSystemProgram extends string\n ? ReadonlyAccount\n : TAccountSystemProgram,\n TAccountToken2022Program extends string\n ? ReadonlyAccount\n : TAccountToken2022Program,\n TAccountPayer extends string\n ? WritableSignerAccount &\n IAccountSignerMeta\n : TAccountPayer,\n TAccountVendor extends string\n ? ReadonlySignerAccount &\n IAccountSignerMeta\n : TAccountVendor,\n TAccountProductMint extends string\n ? WritableAccount\n : TAccountProductMint,\n ...TRemainingAccounts,\n ]\n >;\n\nexport type CreateProductInstructionData = {\n discriminator: number;\n name: string;\n symbol: string;\n uri: string;\n additionalMetadata: Array;\n};\n\nexport type CreateProductInstructionDataArgs = {\n name: string;\n symbol: string;\n uri: string;\n additionalMetadata: Array;\n};\n\nexport function getCreateProductInstructionDataEncoder(): Encoder {\n return transformEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['name', addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())],\n ['symbol', addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())],\n ['uri', addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())],\n [\n 'additionalMetadata',\n getArrayEncoder(\n getTupleEncoder([\n addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder()),\n addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder()),\n ])\n ),\n ],\n ]),\n (value) => ({ ...value, discriminator: 1 })\n );\n}\n\nexport function getCreateProductInstructionDataDecoder(): Decoder {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['name', addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())],\n ['symbol', addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())],\n ['uri', addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())],\n [\n 'additionalMetadata',\n getArrayDecoder(\n getTupleDecoder([\n addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder()),\n addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder()),\n ])\n ),\n ],\n ]);\n}\n\nexport function getCreateProductInstructionDataCodec(): Codec<\n CreateProductInstructionDataArgs,\n CreateProductInstructionData\n> {\n return combineCodec(\n getCreateProductInstructionDataEncoder(),\n getCreateProductInstructionDataDecoder()\n );\n}\n\nexport type CreateProductInput<\n TAccountSystemProgram extends string = string,\n TAccountToken2022Program extends string = string,\n TAccountPayer extends string = string,\n TAccountVendor extends string = string,\n TAccountProductMint extends string = string,\n> = {\n /** The system program */\n systemProgram?: Address;\n /** The SPL Token 2022 program */\n token2022Program?: Address;\n /** The account paying for the storage fees */\n payer: TransactionSigner;\n /** The vendor */\n vendor: TransactionSigner;\n /** The mint account of the product */\n productMint: Address;\n name: CreateProductInstructionDataArgs['name'];\n symbol: CreateProductInstructionDataArgs['symbol'];\n uri: CreateProductInstructionDataArgs['uri'];\n additionalMetadata: CreateProductInstructionDataArgs['additionalMetadata'];\n};\n\nexport function getCreateProductInstruction<\n TAccountSystemProgram extends string,\n TAccountToken2022Program extends string,\n TAccountPayer extends string,\n TAccountVendor extends string,\n TAccountProductMint extends string,\n>(\n input: CreateProductInput<\n TAccountSystemProgram,\n TAccountToken2022Program,\n TAccountPayer,\n TAccountVendor,\n TAccountProductMint\n >\n): CreateProductInstruction<\n typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountSystemProgram,\n TAccountToken2022Program,\n TAccountPayer,\n TAccountVendor,\n TAccountProductMint\n> {\n // Program address.\n const programAddress = DEPHY_ID_PROGRAM_ADDRESS;\n\n // Original accounts.\n const originalAccounts = {\n systemProgram: { value: input.systemProgram ?? null, isWritable: false },\n token2022Program: {\n value: input.token2022Program ?? null,\n isWritable: false,\n },\n payer: { value: input.payer ?? null, isWritable: true },\n vendor: { value: input.vendor ?? null, isWritable: false },\n productMint: { value: input.productMint ?? null, isWritable: true },\n };\n const accounts = originalAccounts as Record<\n keyof typeof originalAccounts,\n ResolvedAccount\n >;\n\n // Original args.\n const args = { ...input };\n\n // Resolve default values.\n if (!accounts.systemProgram.value) {\n accounts.systemProgram.value =\n '11111111111111111111111111111111' as Address<'11111111111111111111111111111111'>;\n }\n if (!accounts.token2022Program.value) {\n accounts.token2022Program.value =\n 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb' as Address<'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb'>;\n }\n\n const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');\n const instruction = {\n accounts: [\n getAccountMeta(accounts.systemProgram),\n getAccountMeta(accounts.token2022Program),\n getAccountMeta(accounts.payer),\n getAccountMeta(accounts.vendor),\n getAccountMeta(accounts.productMint),\n ],\n programAddress,\n data: getCreateProductInstructionDataEncoder().encode(\n args as CreateProductInstructionDataArgs\n ),\n } as CreateProductInstruction<\n typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountSystemProgram,\n TAccountToken2022Program,\n TAccountPayer,\n TAccountVendor,\n TAccountProductMint\n >;\n\n return instruction;\n}\n\nexport type ParsedCreateProductInstruction<\n TProgram extends string = typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[],\n> = {\n programAddress: Address;\n accounts: {\n /** The system program */\n systemProgram: TAccountMetas[0];\n /** The SPL Token 2022 program */\n token2022Program: TAccountMetas[1];\n /** The account paying for the storage fees */\n payer: TAccountMetas[2];\n /** The vendor */\n vendor: TAccountMetas[3];\n /** The mint account of the product */\n productMint: TAccountMetas[4];\n };\n data: CreateProductInstructionData;\n};\n\nexport function parseCreateProductInstruction<\n TProgram extends string,\n TAccountMetas extends readonly IAccountMeta[],\n>(\n instruction: IInstruction &\n IInstructionWithAccounts &\n IInstructionWithData\n): ParsedCreateProductInstruction {\n if (instruction.accounts.length < 5) {\n // TODO: Coded error.\n throw new Error('Not enough accounts');\n }\n let accountIndex = 0;\n const getNextAccount = () => {\n const accountMeta = instruction.accounts![accountIndex]!;\n accountIndex += 1;\n return accountMeta;\n };\n return {\n programAddress: instruction.programAddress,\n accounts: {\n systemProgram: getNextAccount(),\n token2022Program: getNextAccount(),\n payer: getNextAccount(),\n vendor: getNextAccount(),\n productMint: getNextAccount(),\n },\n data: getCreateProductInstructionDataDecoder().decode(instruction.data),\n };\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport {\n combineCodec,\n getStructDecoder,\n getStructEncoder,\n getU8Decoder,\n getU8Encoder,\n transformEncoder,\n type Address,\n type Codec,\n type Decoder,\n type Encoder,\n type IAccountMeta,\n type IAccountSignerMeta,\n type IInstruction,\n type IInstructionWithAccounts,\n type IInstructionWithData,\n type ReadonlyAccount,\n type ReadonlySignerAccount,\n type TransactionSigner,\n type WritableAccount,\n type WritableSignerAccount,\n} from '@solana/web3.js';\nimport { DEPHY_ID_PROGRAM_ADDRESS } from '../programs';\nimport { getAccountMetaFactory, type ResolvedAccount } from '../shared';\n\nexport type InitializeInstruction<\n TProgram extends string = typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountSystemProgram extends\n | string\n | IAccountMeta = '11111111111111111111111111111111',\n TAccountPayer extends string | IAccountMeta = string,\n TAccountProgramData extends string | IAccountMeta = string,\n TAccountAuthority extends string | IAccountMeta = string,\n TRemainingAccounts extends readonly IAccountMeta[] = [],\n> = IInstruction &\n IInstructionWithData &\n IInstructionWithAccounts<\n [\n TAccountSystemProgram extends string\n ? ReadonlyAccount\n : TAccountSystemProgram,\n TAccountPayer extends string\n ? WritableSignerAccount &\n IAccountSignerMeta\n : TAccountPayer,\n TAccountProgramData extends string\n ? WritableAccount\n : TAccountProgramData,\n TAccountAuthority extends string\n ? ReadonlySignerAccount &\n IAccountSignerMeta\n : TAccountAuthority,\n ...TRemainingAccounts,\n ]\n >;\n\nexport type InitializeInstructionData = { discriminator: number; bump: number };\n\nexport type InitializeInstructionDataArgs = { bump: number };\n\nexport function getInitializeInstructionDataEncoder(): Encoder {\n return transformEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['bump', getU8Encoder()],\n ]),\n (value) => ({ ...value, discriminator: 0 })\n );\n}\n\nexport function getInitializeInstructionDataDecoder(): Decoder {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['bump', getU8Decoder()],\n ]);\n}\n\nexport function getInitializeInstructionDataCodec(): Codec<\n InitializeInstructionDataArgs,\n InitializeInstructionData\n> {\n return combineCodec(\n getInitializeInstructionDataEncoder(),\n getInitializeInstructionDataDecoder()\n );\n}\n\nexport type InitializeInput<\n TAccountSystemProgram extends string = string,\n TAccountPayer extends string = string,\n TAccountProgramData extends string = string,\n TAccountAuthority extends string = string,\n> = {\n /** The system program */\n systemProgram?: Address;\n /** The account paying for the storage fees */\n payer: TransactionSigner;\n /** The program data account for the program */\n programData: Address;\n /** The authority account of the program */\n authority: TransactionSigner;\n bump: InitializeInstructionDataArgs['bump'];\n};\n\nexport function getInitializeInstruction<\n TAccountSystemProgram extends string,\n TAccountPayer extends string,\n TAccountProgramData extends string,\n TAccountAuthority extends string,\n>(\n input: InitializeInput<\n TAccountSystemProgram,\n TAccountPayer,\n TAccountProgramData,\n TAccountAuthority\n >\n): InitializeInstruction<\n typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountSystemProgram,\n TAccountPayer,\n TAccountProgramData,\n TAccountAuthority\n> {\n // Program address.\n const programAddress = DEPHY_ID_PROGRAM_ADDRESS;\n\n // Original accounts.\n const originalAccounts = {\n systemProgram: { value: input.systemProgram ?? null, isWritable: false },\n payer: { value: input.payer ?? null, isWritable: true },\n programData: { value: input.programData ?? null, isWritable: true },\n authority: { value: input.authority ?? null, isWritable: false },\n };\n const accounts = originalAccounts as Record<\n keyof typeof originalAccounts,\n ResolvedAccount\n >;\n\n // Original args.\n const args = { ...input };\n\n // Resolve default values.\n if (!accounts.systemProgram.value) {\n accounts.systemProgram.value =\n '11111111111111111111111111111111' as Address<'11111111111111111111111111111111'>;\n }\n\n const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');\n const instruction = {\n accounts: [\n getAccountMeta(accounts.systemProgram),\n getAccountMeta(accounts.payer),\n getAccountMeta(accounts.programData),\n getAccountMeta(accounts.authority),\n ],\n programAddress,\n data: getInitializeInstructionDataEncoder().encode(\n args as InitializeInstructionDataArgs\n ),\n } as InitializeInstruction<\n typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountSystemProgram,\n TAccountPayer,\n TAccountProgramData,\n TAccountAuthority\n >;\n\n return instruction;\n}\n\nexport type ParsedInitializeInstruction<\n TProgram extends string = typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[],\n> = {\n programAddress: Address;\n accounts: {\n /** The system program */\n systemProgram: TAccountMetas[0];\n /** The account paying for the storage fees */\n payer: TAccountMetas[1];\n /** The program data account for the program */\n programData: TAccountMetas[2];\n /** The authority account of the program */\n authority: TAccountMetas[3];\n };\n data: InitializeInstructionData;\n};\n\nexport function parseInitializeInstruction<\n TProgram extends string,\n TAccountMetas extends readonly IAccountMeta[],\n>(\n instruction: IInstruction &\n IInstructionWithAccounts &\n IInstructionWithData\n): ParsedInitializeInstruction {\n if (instruction.accounts.length < 4) {\n // TODO: Coded error.\n throw new Error('Not enough accounts');\n }\n let accountIndex = 0;\n const getNextAccount = () => {\n const accountMeta = instruction.accounts![accountIndex]!;\n accountIndex += 1;\n return accountMeta;\n };\n return {\n programAddress: instruction.programAddress,\n accounts: {\n systemProgram: getNextAccount(),\n payer: getNextAccount(),\n programData: getNextAccount(),\n authority: getNextAccount(),\n },\n data: getInitializeInstructionDataDecoder().decode(instruction.data),\n };\n}\n"]} \ No newline at end of file +{"version":3,"sources":["../../env-shim.ts","../../src/generated/accounts/programDataAccount.ts","../../src/generated/pdas/deviceMint.ts","../../src/generated/pdas/productMint.ts","../../src/generated/pdas/programDataAccount.ts","../../src/generated/types/deviceActivationSignature.ts","../../src/generated/types/deviceSigningAlgorithm.ts","../../src/generated/types/key.ts","../../src/generated/types/programData.ts","../../src/generated/errors/dephyId.ts","../../src/generated/instructions/activateDevice.ts","../../src/generated/programs/dephyId.ts","../../src/generated/shared/index.ts","../../src/generated/instructions/createDevice.ts","../../src/generated/instructions/createProduct.ts","../../src/generated/instructions/initialize.ts"],"names":["combineCodec","getAddressEncoder","getStructDecoder","getStructEncoder","getProgramDerivedAddress","getUtf8Encoder","DeviceSigningAlgorithm","getEnumDecoder","getEnumEncoder","Key","getU8Decoder","getU8Encoder","transformEncoder","DephyIdAccount","DephyIdInstruction","getTupleDecoder","getTupleEncoder","addDecoderSizePrefix","addEncoderSizePrefix","getArrayDecoder","getArrayEncoder","getU32Decoder","getU32Encoder","getUtf8Decoder"],"mappings":";AACO,IAAM,UAA2B,uBACrC,QAAgB,KAAU,EAAE,aAAa,eAAe;;;ACM3D;AAAA,EACE;AAAA,EACA;AAAA,EACA,gBAAAA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,qBAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,oBAAAC;AAAA,EACA;AAAA,OAWK;;;ACtBP;AAAA,EACE;AAAA,EACA;AAAA,E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IACA,MAAM,oCAAoC,EAAE;AAAA,MAC1C;AAAA,IACF;AAAA,EACF;AAQA,SAAO;AACT;AAoBO,SAAS,2BAId,aAGsD;AACtD,MAAI,YAAY,SAAS,SAAS,GAAG;AAEnC,UAAM,IAAI,MAAM,qBAAqB;AAAA,EACvC;AACA,MAAI,eAAe;AACnB,QAAM,iBAAiB,MAAM;AAC3B,UAAM,cAAc,YAAY,SAAU,YAAY;AACtD,oBAAgB;AAChB,WAAO;AAAA,EACT;AACA,SAAO;AAAA,IACL,gBAAgB,YAAY;AAAA,IAC5B,UAAU;AAAA,MACR,eAAe,eAAe;AAAA,MAC9B,OAAO,eAAe;AAAA,MACtB,aAAa,eAAe;AAAA,MAC5B,WAAW,eAAe;AAAA,IAC5B;AAAA,IACA,MAAM,oCAAoC,EAAE,OAAO,YAAY,IAAI;AAAA,EACrE;AACF","sourcesContent":["// Clever obfuscation to prevent the build system from inlining the value of `NODE_ENV`\nexport const __DEV__ = /* @__PURE__ */ (() =>\n (process as any)['en' + 'v'].NODE_ENV === 'development')();\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport {\n assertAccountExists,\n assertAccountsExist,\n combineCodec,\n decodeAccount,\n fetchEncodedAccount,\n fetchEncodedAccounts,\n getAddressDecoder,\n getAddressEncoder,\n getStructDecoder,\n getStructEncoder,\n transformEncoder,\n type Account,\n type Address,\n type Codec,\n type Decoder,\n type EncodedAccount,\n type Encoder,\n type FetchAccountConfig,\n type FetchAccountsConfig,\n type MaybeAccount,\n type MaybeEncodedAccount,\n} from '@solana/web3.js';\nimport { findProgramDataAccountPda } from '../pdas';\nimport {\n Key,\n getKeyDecoder,\n getKeyEncoder,\n getProgramDataDecoder,\n getProgramDataEncoder,\n type ProgramData,\n type ProgramDataArgs,\n} from '../types';\n\nexport type ProgramDataAccount = {\n key: Key;\n authority: Address;\n data: ProgramData;\n};\n\nexport type ProgramDataAccountArgs = {\n authority: Address;\n data: ProgramDataArgs;\n};\n\nexport function getProgramDataAccountEncoder(): Encoder {\n return transformEncoder(\n getStructEncoder([\n ['key', getKeyEncoder()],\n ['authority', getAddressEncoder()],\n ['data', getProgramDataEncoder()],\n ]),\n (value) => ({ ...value, key: Key.ProgramDataAccount })\n );\n}\n\nexport function getProgramDataAccountDecoder(): Decoder {\n return getStructDecoder([\n ['key', getKeyDecoder()],\n ['authority', getAddressDecoder()],\n ['data', getProgramDataDecoder()],\n ]);\n}\n\nexport function getProgramDataAccountCodec(): Codec<\n ProgramDataAccountArgs,\n ProgramDataAccount\n> {\n return combineCodec(\n getProgramDataAccountEncoder(),\n getProgramDataAccountDecoder()\n );\n}\n\nexport function decodeProgramDataAccount(\n encodedAccount: EncodedAccount\n): Account;\nexport function decodeProgramDataAccount(\n encodedAccount: MaybeEncodedAccount\n): MaybeAccount;\nexport function decodeProgramDataAccount(\n encodedAccount: EncodedAccount | MaybeEncodedAccount\n):\n | Account\n | MaybeAccount {\n return decodeAccount(\n encodedAccount as MaybeEncodedAccount,\n getProgramDataAccountDecoder()\n );\n}\n\nexport async function fetchProgramDataAccount(\n rpc: Parameters[0],\n address: Address,\n config?: FetchAccountConfig\n): Promise> {\n const maybeAccount = await fetchMaybeProgramDataAccount(rpc, address, config);\n assertAccountExists(maybeAccount);\n return maybeAccount;\n}\n\nexport async function fetchMaybeProgramDataAccount<\n TAddress extends string = string,\n>(\n rpc: Parameters[0],\n address: Address,\n config?: FetchAccountConfig\n): Promise> {\n const maybeAccount = await fetchEncodedAccount(rpc, address, config);\n return decodeProgramDataAccount(maybeAccount);\n}\n\nexport async function fetchAllProgramDataAccount(\n rpc: Parameters[0],\n addresses: Array
,\n config?: FetchAccountsConfig\n): Promise[]> {\n const maybeAccounts = await fetchAllMaybeProgramDataAccount(\n rpc,\n addresses,\n config\n );\n assertAccountsExist(maybeAccounts);\n return maybeAccounts;\n}\n\nexport async function fetchAllMaybeProgramDataAccount(\n rpc: Parameters[0],\n addresses: Array
,\n config?: FetchAccountsConfig\n): Promise[]> {\n const maybeAccounts = await fetchEncodedAccounts(rpc, addresses, config);\n return maybeAccounts.map((maybeAccount) =>\n decodeProgramDataAccount(maybeAccount)\n );\n}\n\nexport function getProgramDataAccountSize(): number {\n return 34;\n}\n\nexport async function fetchProgramDataAccountFromSeeds(\n rpc: Parameters[0],\n config: FetchAccountConfig & { programAddress?: Address } = {}\n): Promise> {\n const maybeAccount = await fetchMaybeProgramDataAccountFromSeeds(rpc, config);\n assertAccountExists(maybeAccount);\n return maybeAccount;\n}\n\nexport async function fetchMaybeProgramDataAccountFromSeeds(\n rpc: Parameters[0],\n config: FetchAccountConfig & { programAddress?: Address } = {}\n): Promise> {\n const { programAddress, ...fetchConfig } = config;\n const [address] = await findProgramDataAccountPda({ programAddress });\n return await fetchMaybeProgramDataAccount(rpc, address, fetchConfig);\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport {\n getAddressEncoder,\n getProgramDerivedAddress,\n getUtf8Encoder,\n type Address,\n type ProgramDerivedAddress,\n} from '@solana/web3.js';\n\nexport type DeviceMintSeeds = {\n productMintPubkey: Address;\n\n devicePubkey: Address;\n};\n\nexport async function findDeviceMintPda(\n seeds: DeviceMintSeeds,\n config: { programAddress?: Address | undefined } = {}\n): Promise {\n const {\n programAddress = 'hdMghjD73uASxgJXi6e1mGPsXqnADMsrqB1bveqABP1' as Address<'hdMghjD73uASxgJXi6e1mGPsXqnADMsrqB1bveqABP1'>,\n } = config;\n return await getProgramDerivedAddress({\n programAddress,\n seeds: [\n getUtf8Encoder().encode('DePHY_ID-DEVICE'),\n getAddressEncoder().encode(seeds.productMintPubkey),\n getAddressEncoder().encode(seeds.devicePubkey),\n ],\n });\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport {\n getAddressEncoder,\n getProgramDerivedAddress,\n getUtf8Encoder,\n type Address,\n type ProgramDerivedAddress,\n} from '@solana/web3.js';\n\nexport type ProductMintSeeds = {\n vendorPubkey: Address;\n\n productName: string;\n};\n\nexport async function findProductMintPda(\n seeds: ProductMintSeeds,\n config: { programAddress?: Address | undefined } = {}\n): Promise {\n const {\n programAddress = 'hdMghjD73uASxgJXi6e1mGPsXqnADMsrqB1bveqABP1' as Address<'hdMghjD73uASxgJXi6e1mGPsXqnADMsrqB1bveqABP1'>,\n } = config;\n return await getProgramDerivedAddress({\n programAddress,\n seeds: [\n getUtf8Encoder().encode('DePHY_ID-PRODUCT'),\n getAddressEncoder().encode(seeds.vendorPubkey),\n getUtf8Encoder().encode(seeds.productName),\n ],\n });\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport {\n getProgramDerivedAddress,\n getUtf8Encoder,\n type Address,\n type ProgramDerivedAddress,\n} from '@solana/web3.js';\n\nexport async function findProgramDataAccountPda(\n config: { programAddress?: Address | undefined } = {}\n): Promise {\n const {\n programAddress = 'hdMghjD73uASxgJXi6e1mGPsXqnADMsrqB1bveqABP1' as Address<'hdMghjD73uASxgJXi6e1mGPsXqnADMsrqB1bveqABP1'>,\n } = config;\n return await getProgramDerivedAddress({\n programAddress,\n seeds: [getUtf8Encoder().encode('DePHY_ID')],\n });\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport {\n combineCodec,\n fixDecoderSize,\n fixEncoderSize,\n getBytesDecoder,\n getBytesEncoder,\n getDiscriminatedUnionDecoder,\n getDiscriminatedUnionEncoder,\n getStructDecoder,\n getStructEncoder,\n getTupleDecoder,\n getTupleEncoder,\n getU8Decoder,\n getU8Encoder,\n type Codec,\n type Decoder,\n type Encoder,\n type GetDiscriminatedUnionVariant,\n type GetDiscriminatedUnionVariantContent,\n type ReadonlyUint8Array,\n} from '@solana/web3.js';\n\nexport type DeviceActivationSignature =\n | { __kind: 'Ed25519'; fields: readonly [ReadonlyUint8Array] }\n | { __kind: 'Secp256k1'; fields: readonly [ReadonlyUint8Array, number] }\n | { __kind: 'EthSecp256k1'; fields: readonly [ReadonlyUint8Array, number] };\n\nexport type DeviceActivationSignatureArgs = DeviceActivationSignature;\n\nexport function getDeviceActivationSignatureEncoder(): Encoder {\n return getDiscriminatedUnionEncoder([\n [\n 'Ed25519',\n getStructEncoder([\n ['fields', getTupleEncoder([fixEncoderSize(getBytesEncoder(), 64)])],\n ]),\n ],\n [\n 'Secp256k1',\n getStructEncoder([\n [\n 'fields',\n getTupleEncoder([\n fixEncoderSize(getBytesEncoder(), 64),\n getU8Encoder(),\n ]),\n ],\n ]),\n ],\n [\n 'EthSecp256k1',\n getStructEncoder([\n [\n 'fields',\n getTupleEncoder([\n fixEncoderSize(getBytesEncoder(), 64),\n getU8Encoder(),\n ]),\n ],\n ]),\n ],\n ]);\n}\n\nexport function getDeviceActivationSignatureDecoder(): Decoder {\n return getDiscriminatedUnionDecoder([\n [\n 'Ed25519',\n getStructDecoder([\n ['fields', getTupleDecoder([fixDecoderSize(getBytesDecoder(), 64)])],\n ]),\n ],\n [\n 'Secp256k1',\n getStructDecoder([\n [\n 'fields',\n getTupleDecoder([\n fixDecoderSize(getBytesDecoder(), 64),\n getU8Decoder(),\n ]),\n ],\n ]),\n ],\n [\n 'EthSecp256k1',\n getStructDecoder([\n [\n 'fields',\n getTupleDecoder([\n fixDecoderSize(getBytesDecoder(), 64),\n getU8Decoder(),\n ]),\n ],\n ]),\n ],\n ]);\n}\n\nexport function getDeviceActivationSignatureCodec(): Codec<\n DeviceActivationSignatureArgs,\n DeviceActivationSignature\n> {\n return combineCodec(\n getDeviceActivationSignatureEncoder(),\n getDeviceActivationSignatureDecoder()\n );\n}\n\n// Data Enum Helpers.\nexport function deviceActivationSignature(\n kind: 'Ed25519',\n data: GetDiscriminatedUnionVariantContent<\n DeviceActivationSignatureArgs,\n '__kind',\n 'Ed25519'\n >['fields']\n): GetDiscriminatedUnionVariant<\n DeviceActivationSignatureArgs,\n '__kind',\n 'Ed25519'\n>;\nexport function deviceActivationSignature(\n kind: 'Secp256k1',\n data: GetDiscriminatedUnionVariantContent<\n DeviceActivationSignatureArgs,\n '__kind',\n 'Secp256k1'\n >['fields']\n): GetDiscriminatedUnionVariant<\n DeviceActivationSignatureArgs,\n '__kind',\n 'Secp256k1'\n>;\nexport function deviceActivationSignature(\n kind: 'EthSecp256k1',\n data: GetDiscriminatedUnionVariantContent<\n DeviceActivationSignatureArgs,\n '__kind',\n 'EthSecp256k1'\n >['fields']\n): GetDiscriminatedUnionVariant<\n DeviceActivationSignatureArgs,\n '__kind',\n 'EthSecp256k1'\n>;\nexport function deviceActivationSignature<\n K extends DeviceActivationSignatureArgs['__kind'],\n Data,\n>(kind: K, data?: Data) {\n return Array.isArray(data)\n ? { __kind: kind, fields: data }\n : { __kind: kind, ...(data ?? {}) };\n}\n\nexport function isDeviceActivationSignature<\n K extends DeviceActivationSignature['__kind'],\n>(\n kind: K,\n value: DeviceActivationSignature\n): value is DeviceActivationSignature & { __kind: K } {\n return value.__kind === kind;\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport {\n combineCodec,\n getEnumDecoder,\n getEnumEncoder,\n type Codec,\n type Decoder,\n type Encoder,\n} from '@solana/web3.js';\n\nexport enum DeviceSigningAlgorithm {\n Ed25519,\n Secp256k1,\n}\n\nexport type DeviceSigningAlgorithmArgs = DeviceSigningAlgorithm;\n\nexport function getDeviceSigningAlgorithmEncoder(): Encoder {\n return getEnumEncoder(DeviceSigningAlgorithm);\n}\n\nexport function getDeviceSigningAlgorithmDecoder(): Decoder {\n return getEnumDecoder(DeviceSigningAlgorithm);\n}\n\nexport function getDeviceSigningAlgorithmCodec(): Codec<\n DeviceSigningAlgorithmArgs,\n DeviceSigningAlgorithm\n> {\n return combineCodec(\n getDeviceSigningAlgorithmEncoder(),\n getDeviceSigningAlgorithmDecoder()\n );\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport {\n combineCodec,\n getEnumDecoder,\n getEnumEncoder,\n type Codec,\n type Decoder,\n type Encoder,\n} from '@solana/web3.js';\n\nexport enum Key {\n Uninitialized,\n ProgramDataAccount,\n}\n\nexport type KeyArgs = Key;\n\nexport function getKeyEncoder(): Encoder {\n return getEnumEncoder(Key);\n}\n\nexport function getKeyDecoder(): Decoder {\n return getEnumDecoder(Key);\n}\n\nexport function getKeyCodec(): Codec {\n return combineCodec(getKeyEncoder(), getKeyDecoder());\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport {\n combineCodec,\n getStructDecoder,\n getStructEncoder,\n getU8Decoder,\n getU8Encoder,\n type Codec,\n type Decoder,\n type Encoder,\n} from '@solana/web3.js';\n\nexport type ProgramData = { bump: number };\n\nexport type ProgramDataArgs = ProgramData;\n\nexport function getProgramDataEncoder(): Encoder {\n return getStructEncoder([['bump', getU8Encoder()]]);\n}\n\nexport function getProgramDataDecoder(): Decoder {\n return getStructDecoder([['bump', getU8Decoder()]]);\n}\n\nexport function getProgramDataCodec(): Codec {\n return combineCodec(getProgramDataEncoder(), getProgramDataDecoder());\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\n/** DeserializationError: Error deserializing an account */\nexport const DEPHY_ID_ERROR__DESERIALIZATION_ERROR = 0x0; // 0\n/** SerializationError: Error serializing an account */\nexport const DEPHY_ID_ERROR__SERIALIZATION_ERROR = 0x1; // 1\n/** InvalidProgramOwner: Invalid program owner. This likely mean the provided account does not exist */\nexport const DEPHY_ID_ERROR__INVALID_PROGRAM_OWNER = 0x2; // 2\n/** InvalidPda: Invalid PDA derivation */\nexport const DEPHY_ID_ERROR__INVALID_PDA = 0x3; // 3\n/** ExpectedEmptyAccount: Expected empty account */\nexport const DEPHY_ID_ERROR__EXPECTED_EMPTY_ACCOUNT = 0x4; // 4\n/** ExpectedNonEmptyAccount: Expected non empty account */\nexport const DEPHY_ID_ERROR__EXPECTED_NON_EMPTY_ACCOUNT = 0x5; // 5\n/** ExpectedSignerAccount: Expected signer account */\nexport const DEPHY_ID_ERROR__EXPECTED_SIGNER_ACCOUNT = 0x6; // 6\n/** ExpectedWritableAccount: Expected writable account */\nexport const DEPHY_ID_ERROR__EXPECTED_WRITABLE_ACCOUNT = 0x7; // 7\n/** AccountMismatch: Account mismatch */\nexport const DEPHY_ID_ERROR__ACCOUNT_MISMATCH = 0x8; // 8\n/** InvalidAccountKey: Invalid account key */\nexport const DEPHY_ID_ERROR__INVALID_ACCOUNT_KEY = 0x9; // 9\n/** NumericalOverflow: Numerical overflow */\nexport const DEPHY_ID_ERROR__NUMERICAL_OVERFLOW = 0xa; // 10\n/** MissingInstruction: Missing instruction */\nexport const DEPHY_ID_ERROR__MISSING_INSTRUCTION = 0xb; // 11\n/** SignatureMismatch: Signature mismatch */\nexport const DEPHY_ID_ERROR__SIGNATURE_MISMATCH = 0xc; // 12\n\nexport type DephyIdError =\n | typeof DEPHY_ID_ERROR__ACCOUNT_MISMATCH\n | typeof DEPHY_ID_ERROR__DESERIALIZATION_ERROR\n | typeof DEPHY_ID_ERROR__EXPECTED_EMPTY_ACCOUNT\n | typeof DEPHY_ID_ERROR__EXPECTED_NON_EMPTY_ACCOUNT\n | typeof DEPHY_ID_ERROR__EXPECTED_SIGNER_ACCOUNT\n | typeof DEPHY_ID_ERROR__EXPECTED_WRITABLE_ACCOUNT\n | typeof DEPHY_ID_ERROR__INVALID_ACCOUNT_KEY\n | typeof DEPHY_ID_ERROR__INVALID_PDA\n | typeof DEPHY_ID_ERROR__INVALID_PROGRAM_OWNER\n | typeof DEPHY_ID_ERROR__MISSING_INSTRUCTION\n | typeof DEPHY_ID_ERROR__NUMERICAL_OVERFLOW\n | typeof DEPHY_ID_ERROR__SERIALIZATION_ERROR\n | typeof DEPHY_ID_ERROR__SIGNATURE_MISMATCH;\n\nlet dephyIdErrorMessages: Record | undefined;\nif (__DEV__) {\n dephyIdErrorMessages = {\n [DEPHY_ID_ERROR__ACCOUNT_MISMATCH]: `Account mismatch`,\n [DEPHY_ID_ERROR__DESERIALIZATION_ERROR]: `Error deserializing an account`,\n [DEPHY_ID_ERROR__EXPECTED_EMPTY_ACCOUNT]: `Expected empty account`,\n [DEPHY_ID_ERROR__EXPECTED_NON_EMPTY_ACCOUNT]: `Expected non empty account`,\n [DEPHY_ID_ERROR__EXPECTED_SIGNER_ACCOUNT]: `Expected signer account`,\n [DEPHY_ID_ERROR__EXPECTED_WRITABLE_ACCOUNT]: `Expected writable account`,\n [DEPHY_ID_ERROR__INVALID_ACCOUNT_KEY]: `Invalid account key`,\n [DEPHY_ID_ERROR__INVALID_PDA]: `Invalid PDA derivation`,\n [DEPHY_ID_ERROR__INVALID_PROGRAM_OWNER]: `Invalid program owner. This likely mean the provided account does not exist`,\n [DEPHY_ID_ERROR__MISSING_INSTRUCTION]: `Missing instruction`,\n [DEPHY_ID_ERROR__NUMERICAL_OVERFLOW]: `Numerical overflow`,\n [DEPHY_ID_ERROR__SERIALIZATION_ERROR]: `Error serializing an account`,\n [DEPHY_ID_ERROR__SIGNATURE_MISMATCH]: `Signature mismatch`,\n };\n}\n\nexport function getDephyIdErrorMessage(code: DephyIdError): string {\n if (__DEV__) {\n return (dephyIdErrorMessages as Record)[code];\n }\n\n return 'Error message not available in production bundles. Compile with `__DEV__` set to true to see more information.';\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport {\n combineCodec,\n getStructDecoder,\n getStructEncoder,\n getU64Decoder,\n getU64Encoder,\n getU8Decoder,\n getU8Encoder,\n transformEncoder,\n type Address,\n type Codec,\n type Decoder,\n type Encoder,\n type IAccountMeta,\n type IAccountSignerMeta,\n type IInstruction,\n type IInstructionWithAccounts,\n type IInstructionWithData,\n type ReadonlyAccount,\n type TransactionSigner,\n type WritableAccount,\n type WritableSignerAccount,\n} from '@solana/web3.js';\nimport { DEPHY_ID_PROGRAM_ADDRESS } from '../programs';\nimport { getAccountMetaFactory, type ResolvedAccount } from '../shared';\nimport {\n getDeviceActivationSignatureDecoder,\n getDeviceActivationSignatureEncoder,\n type DeviceActivationSignature,\n type DeviceActivationSignatureArgs,\n} from '../types';\n\nexport type ActivateDeviceInstruction<\n TProgram extends string = typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountSystemProgram extends\n | string\n | IAccountMeta = '11111111111111111111111111111111',\n TAccountToken2022Program extends string | IAccountMeta = string,\n TAccountAtaProgram extends\n | string\n | IAccountMeta = 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL',\n TAccountPayer extends string | IAccountMeta = string,\n TAccountVendor extends string | IAccountMeta = string,\n TAccountProductMint extends string | IAccountMeta = string,\n TAccountProductAssociatedToken extends string | IAccountMeta = string,\n TAccountDevice extends string | IAccountMeta = string,\n TAccountDeviceMint extends string | IAccountMeta = string,\n TAccountDeviceAssociatedToken extends string | IAccountMeta = string,\n TAccountOwner extends string | IAccountMeta = string,\n TRemainingAccounts extends readonly IAccountMeta[] = [],\n> = IInstruction &\n IInstructionWithData &\n IInstructionWithAccounts<\n [\n TAccountSystemProgram extends string\n ? ReadonlyAccount\n : TAccountSystemProgram,\n TAccountToken2022Program extends string\n ? ReadonlyAccount\n : TAccountToken2022Program,\n TAccountAtaProgram extends string\n ? ReadonlyAccount\n : TAccountAtaProgram,\n TAccountPayer extends string\n ? WritableSignerAccount &\n IAccountSignerMeta\n : TAccountPayer,\n TAccountVendor extends string\n ? ReadonlyAccount\n : TAccountVendor,\n TAccountProductMint extends string\n ? ReadonlyAccount\n : TAccountProductMint,\n TAccountProductAssociatedToken extends string\n ? ReadonlyAccount\n : TAccountProductAssociatedToken,\n TAccountDevice extends string\n ? ReadonlyAccount\n : TAccountDevice,\n TAccountDeviceMint extends string\n ? WritableAccount\n : TAccountDeviceMint,\n TAccountDeviceAssociatedToken extends string\n ? WritableAccount\n : TAccountDeviceAssociatedToken,\n TAccountOwner extends string\n ? ReadonlyAccount\n : TAccountOwner,\n ...TRemainingAccounts,\n ]\n >;\n\nexport type ActivateDeviceInstructionData = {\n discriminator: number;\n signature: DeviceActivationSignature;\n timestamp: bigint;\n};\n\nexport type ActivateDeviceInstructionDataArgs = {\n signature: DeviceActivationSignatureArgs;\n timestamp: number | bigint;\n};\n\nexport function getActivateDeviceInstructionDataEncoder(): Encoder {\n return transformEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['signature', getDeviceActivationSignatureEncoder()],\n ['timestamp', getU64Encoder()],\n ]),\n (value) => ({ ...value, discriminator: 3 })\n );\n}\n\nexport function getActivateDeviceInstructionDataDecoder(): Decoder {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['signature', getDeviceActivationSignatureDecoder()],\n ['timestamp', getU64Decoder()],\n ]);\n}\n\nexport function getActivateDeviceInstructionDataCodec(): Codec<\n ActivateDeviceInstructionDataArgs,\n ActivateDeviceInstructionData\n> {\n return combineCodec(\n getActivateDeviceInstructionDataEncoder(),\n getActivateDeviceInstructionDataDecoder()\n );\n}\n\nexport type ActivateDeviceInput<\n TAccountSystemProgram extends string = string,\n TAccountToken2022Program extends string = string,\n TAccountAtaProgram extends string = string,\n TAccountPayer extends string = string,\n TAccountVendor extends string = string,\n TAccountProductMint extends string = string,\n TAccountProductAssociatedToken extends string = string,\n TAccountDevice extends string = string,\n TAccountDeviceMint extends string = string,\n TAccountDeviceAssociatedToken extends string = string,\n TAccountOwner extends string = string,\n> = {\n /** The system program */\n systemProgram?: Address;\n /** The SPL Token 2022 program */\n token2022Program: Address;\n /** The associated token program */\n ataProgram?: Address;\n /** The account paying for the storage fees */\n payer: TransactionSigner;\n /** The vendor */\n vendor: Address;\n /** The mint account for the product */\n productMint: Address;\n /** The associated token account for the product */\n productAssociatedToken: Address;\n /** The device */\n device: Address;\n /** The mint account for the device */\n deviceMint: Address;\n /** The associated token account for the device */\n deviceAssociatedToken: Address;\n /** The device's owner */\n owner: Address;\n signature: ActivateDeviceInstructionDataArgs['signature'];\n timestamp: ActivateDeviceInstructionDataArgs['timestamp'];\n};\n\nexport function getActivateDeviceInstruction<\n TAccountSystemProgram extends string,\n TAccountToken2022Program extends string,\n TAccountAtaProgram extends string,\n TAccountPayer extends string,\n TAccountVendor extends string,\n TAccountProductMint extends string,\n TAccountProductAssociatedToken extends string,\n TAccountDevice extends string,\n TAccountDeviceMint extends string,\n TAccountDeviceAssociatedToken extends string,\n TAccountOwner extends string,\n>(\n input: ActivateDeviceInput<\n TAccountSystemProgram,\n TAccountToken2022Program,\n TAccountAtaProgram,\n TAccountPayer,\n TAccountVendor,\n TAccountProductMint,\n TAccountProductAssociatedToken,\n TAccountDevice,\n TAccountDeviceMint,\n TAccountDeviceAssociatedToken,\n TAccountOwner\n >\n): ActivateDeviceInstruction<\n typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountSystemProgram,\n TAccountToken2022Program,\n TAccountAtaProgram,\n TAccountPayer,\n TAccountVendor,\n TAccountProductMint,\n TAccountProductAssociatedToken,\n TAccountDevice,\n TAccountDeviceMint,\n TAccountDeviceAssociatedToken,\n TAccountOwner\n> {\n // Program address.\n const programAddress = DEPHY_ID_PROGRAM_ADDRESS;\n\n // Original accounts.\n const originalAccounts = {\n systemProgram: { value: input.systemProgram ?? null, isWritable: false },\n token2022Program: {\n value: input.token2022Program ?? null,\n isWritable: false,\n },\n ataProgram: { value: input.ataProgram ?? null, isWritable: false },\n payer: { value: input.payer ?? null, isWritable: true },\n vendor: { value: input.vendor ?? null, isWritable: false },\n productMint: { value: input.productMint ?? null, isWritable: false },\n productAssociatedToken: {\n value: input.productAssociatedToken ?? null,\n isWritable: false,\n },\n device: { value: input.device ?? null, isWritable: false },\n deviceMint: { value: input.deviceMint ?? null, isWritable: true },\n deviceAssociatedToken: {\n value: input.deviceAssociatedToken ?? null,\n isWritable: true,\n },\n owner: { value: input.owner ?? null, isWritable: false },\n };\n const accounts = originalAccounts as Record<\n keyof typeof originalAccounts,\n ResolvedAccount\n >;\n\n // Original args.\n const args = { ...input };\n\n // Resolve default values.\n if (!accounts.systemProgram.value) {\n accounts.systemProgram.value =\n '11111111111111111111111111111111' as Address<'11111111111111111111111111111111'>;\n }\n if (!accounts.ataProgram.value) {\n accounts.ataProgram.value =\n 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL' as Address<'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL'>;\n }\n\n const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');\n const instruction = {\n accounts: [\n getAccountMeta(accounts.systemProgram),\n getAccountMeta(accounts.token2022Program),\n getAccountMeta(accounts.ataProgram),\n getAccountMeta(accounts.payer),\n getAccountMeta(accounts.vendor),\n getAccountMeta(accounts.productMint),\n getAccountMeta(accounts.productAssociatedToken),\n getAccountMeta(accounts.device),\n getAccountMeta(accounts.deviceMint),\n getAccountMeta(accounts.deviceAssociatedToken),\n getAccountMeta(accounts.owner),\n ],\n programAddress,\n data: getActivateDeviceInstructionDataEncoder().encode(\n args as ActivateDeviceInstructionDataArgs\n ),\n } as ActivateDeviceInstruction<\n typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountSystemProgram,\n TAccountToken2022Program,\n TAccountAtaProgram,\n TAccountPayer,\n TAccountVendor,\n TAccountProductMint,\n TAccountProductAssociatedToken,\n TAccountDevice,\n TAccountDeviceMint,\n TAccountDeviceAssociatedToken,\n TAccountOwner\n >;\n\n return instruction;\n}\n\nexport type ParsedActivateDeviceInstruction<\n TProgram extends string = typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[],\n> = {\n programAddress: Address;\n accounts: {\n /** The system program */\n systemProgram: TAccountMetas[0];\n /** The SPL Token 2022 program */\n token2022Program: TAccountMetas[1];\n /** The associated token program */\n ataProgram: TAccountMetas[2];\n /** The account paying for the storage fees */\n payer: TAccountMetas[3];\n /** The vendor */\n vendor: TAccountMetas[4];\n /** The mint account for the product */\n productMint: TAccountMetas[5];\n /** The associated token account for the product */\n productAssociatedToken: TAccountMetas[6];\n /** The device */\n device: TAccountMetas[7];\n /** The mint account for the device */\n deviceMint: TAccountMetas[8];\n /** The associated token account for the device */\n deviceAssociatedToken: TAccountMetas[9];\n /** The device's owner */\n owner: TAccountMetas[10];\n };\n data: ActivateDeviceInstructionData;\n};\n\nexport function parseActivateDeviceInstruction<\n TProgram extends string,\n TAccountMetas extends readonly IAccountMeta[],\n>(\n instruction: IInstruction &\n IInstructionWithAccounts &\n IInstructionWithData\n): ParsedActivateDeviceInstruction {\n if (instruction.accounts.length < 11) {\n // TODO: Coded error.\n throw new Error('Not enough accounts');\n }\n let accountIndex = 0;\n const getNextAccount = () => {\n const accountMeta = instruction.accounts![accountIndex]!;\n accountIndex += 1;\n return accountMeta;\n };\n return {\n programAddress: instruction.programAddress,\n accounts: {\n systemProgram: getNextAccount(),\n token2022Program: getNextAccount(),\n ataProgram: getNextAccount(),\n payer: getNextAccount(),\n vendor: getNextAccount(),\n productMint: getNextAccount(),\n productAssociatedToken: getNextAccount(),\n device: getNextAccount(),\n deviceMint: getNextAccount(),\n deviceAssociatedToken: getNextAccount(),\n owner: getNextAccount(),\n },\n data: getActivateDeviceInstructionDataDecoder().decode(instruction.data),\n };\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport { containsBytes, getU8Encoder, type Address } from '@solana/web3.js';\nimport {\n type ParsedActivateDeviceInstruction,\n type ParsedCreateDeviceInstruction,\n type ParsedCreateProductInstruction,\n type ParsedInitializeInstruction,\n} from '../instructions';\nimport { Key, getKeyEncoder } from '../types';\n\nexport const DEPHY_ID_PROGRAM_ADDRESS =\n 'hdMghjD73uASxgJXi6e1mGPsXqnADMsrqB1bveqABP1' as Address<'hdMghjD73uASxgJXi6e1mGPsXqnADMsrqB1bveqABP1'>;\n\nexport enum DephyIdAccount {\n ProgramDataAccount,\n}\n\nexport function identifyDephyIdAccount(\n account: { data: Uint8Array } | Uint8Array\n): DephyIdAccount {\n const data = account instanceof Uint8Array ? account : account.data;\n if (containsBytes(data, getKeyEncoder().encode(Key.ProgramDataAccount), 0)) {\n return DephyIdAccount.ProgramDataAccount;\n }\n throw new Error(\n 'The provided account could not be identified as a dephyId account.'\n );\n}\n\nexport enum DephyIdInstruction {\n Initialize,\n CreateProduct,\n CreateDevice,\n ActivateDevice,\n}\n\nexport function identifyDephyIdInstruction(\n instruction: { data: Uint8Array } | Uint8Array\n): DephyIdInstruction {\n const data =\n instruction instanceof Uint8Array ? instruction : instruction.data;\n if (containsBytes(data, getU8Encoder().encode(0), 0)) {\n return DephyIdInstruction.Initialize;\n }\n if (containsBytes(data, getU8Encoder().encode(1), 0)) {\n return DephyIdInstruction.CreateProduct;\n }\n if (containsBytes(data, getU8Encoder().encode(2), 0)) {\n return DephyIdInstruction.CreateDevice;\n }\n if (containsBytes(data, getU8Encoder().encode(3), 0)) {\n return DephyIdInstruction.ActivateDevice;\n }\n throw new Error(\n 'The provided instruction could not be identified as a dephyId instruction.'\n );\n}\n\nexport type ParsedDephyIdInstruction<\n TProgram extends string = 'hdMghjD73uASxgJXi6e1mGPsXqnADMsrqB1bveqABP1',\n> =\n | ({\n instructionType: DephyIdInstruction.Initialize;\n } & ParsedInitializeInstruction)\n | ({\n instructionType: DephyIdInstruction.CreateProduct;\n } & ParsedCreateProductInstruction)\n | ({\n instructionType: DephyIdInstruction.CreateDevice;\n } & ParsedCreateDeviceInstruction)\n | ({\n instructionType: DephyIdInstruction.ActivateDevice;\n } & ParsedActivateDeviceInstruction);\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport {\n AccountRole,\n isProgramDerivedAddress,\n isTransactionSigner as web3JsIsTransactionSigner,\n type Address,\n type IAccountMeta,\n type IAccountSignerMeta,\n type ProgramDerivedAddress,\n type TransactionSigner,\n upgradeRoleToSigner,\n} from '@solana/web3.js';\n\n/**\n * Asserts that the given value is not null or undefined.\n * @internal\n */\nexport function expectSome(value: T | null | undefined): T {\n if (value == null) {\n throw new Error('Expected a value but received null or undefined.');\n }\n return value;\n}\n\n/**\n * Asserts that the given value is a PublicKey.\n * @internal\n */\nexport function expectAddress(\n value:\n | Address\n | ProgramDerivedAddress\n | TransactionSigner\n | null\n | undefined\n): Address {\n if (!value) {\n throw new Error('Expected a Address.');\n }\n if (typeof value === 'object' && 'address' in value) {\n return value.address;\n }\n if (Array.isArray(value)) {\n return value[0];\n }\n return value as Address;\n}\n\n/**\n * Asserts that the given value is a PDA.\n * @internal\n */\nexport function expectProgramDerivedAddress(\n value:\n | Address\n | ProgramDerivedAddress\n | TransactionSigner\n | null\n | undefined\n): ProgramDerivedAddress {\n if (!value || !Array.isArray(value) || !isProgramDerivedAddress(value)) {\n throw new Error('Expected a ProgramDerivedAddress.');\n }\n return value;\n}\n\n/**\n * Asserts that the given value is a TransactionSigner.\n * @internal\n */\nexport function expectTransactionSigner(\n value:\n | Address\n | ProgramDerivedAddress\n | TransactionSigner\n | null\n | undefined\n): TransactionSigner {\n if (!value || !isTransactionSigner(value)) {\n throw new Error('Expected a TransactionSigner.');\n }\n return value;\n}\n\n/**\n * Defines an instruction account to resolve.\n * @internal\n */\nexport type ResolvedAccount<\n T extends string = string,\n U extends\n | Address\n | ProgramDerivedAddress\n | TransactionSigner\n | null =\n | Address\n | ProgramDerivedAddress\n | TransactionSigner\n | null,\n> = {\n isWritable: boolean;\n value: U;\n};\n\n/**\n * Defines an instruction that stores additional bytes on-chain.\n * @internal\n */\nexport type IInstructionWithByteDelta = {\n byteDelta: number;\n};\n\n/**\n * Get account metas and signers from resolved accounts.\n * @internal\n */\nexport function getAccountMetaFactory(\n programAddress: Address,\n optionalAccountStrategy: 'omitted' | 'programId'\n) {\n return (\n account: ResolvedAccount\n ): IAccountMeta | IAccountSignerMeta | undefined => {\n if (!account.value) {\n if (optionalAccountStrategy === 'omitted') return;\n return Object.freeze({\n address: programAddress,\n role: AccountRole.READONLY,\n });\n }\n\n const writableRole = account.isWritable\n ? AccountRole.WRITABLE\n : AccountRole.READONLY;\n return Object.freeze({\n address: expectAddress(account.value),\n role: isTransactionSigner(account.value)\n ? upgradeRoleToSigner(writableRole)\n : writableRole,\n ...(isTransactionSigner(account.value) ? { signer: account.value } : {}),\n });\n };\n}\n\nexport function isTransactionSigner(\n value:\n | Address\n | ProgramDerivedAddress\n | TransactionSigner\n): value is TransactionSigner {\n return (\n !!value &&\n typeof value === 'object' &&\n 'address' in value &&\n web3JsIsTransactionSigner(value)\n );\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport {\n addDecoderSizePrefix,\n addEncoderSizePrefix,\n combineCodec,\n getArrayDecoder,\n getArrayEncoder,\n getStructDecoder,\n getStructEncoder,\n getTupleDecoder,\n getTupleEncoder,\n getU32Decoder,\n getU32Encoder,\n getU8Decoder,\n getU8Encoder,\n getUtf8Decoder,\n getUtf8Encoder,\n transformEncoder,\n type Address,\n type Codec,\n type Decoder,\n type Encoder,\n type IAccountMeta,\n type IAccountSignerMeta,\n type IInstruction,\n type IInstructionWithAccounts,\n type IInstructionWithData,\n type ReadonlyAccount,\n type ReadonlySignerAccount,\n type TransactionSigner,\n type WritableAccount,\n type WritableSignerAccount,\n} from '@solana/web3.js';\nimport { DEPHY_ID_PROGRAM_ADDRESS } from '../programs';\nimport { getAccountMetaFactory, type ResolvedAccount } from '../shared';\nimport {\n getDeviceSigningAlgorithmDecoder,\n getDeviceSigningAlgorithmEncoder,\n type DeviceSigningAlgorithm,\n type DeviceSigningAlgorithmArgs,\n} from '../types';\n\nexport type CreateDeviceInstruction<\n TProgram extends string = typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountSystemProgram extends\n | string\n | IAccountMeta = '11111111111111111111111111111111',\n TAccountToken2022Program extends\n | string\n | IAccountMeta = 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb',\n TAccountAtaProgram extends\n | string\n | IAccountMeta = 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL',\n TAccountPayer extends string | IAccountMeta = string,\n TAccountVendor extends string | IAccountMeta = string,\n TAccountProductMint extends string | IAccountMeta = string,\n TAccountProductAssociatedToken extends string | IAccountMeta = string,\n TAccountDevice extends string | IAccountMeta = string,\n TAccountDeviceMint extends string | IAccountMeta = string,\n TRemainingAccounts extends readonly IAccountMeta[] = [],\n> = IInstruction &\n IInstructionWithData &\n IInstructionWithAccounts<\n [\n TAccountSystemProgram extends string\n ? ReadonlyAccount\n : TAccountSystemProgram,\n TAccountToken2022Program extends string\n ? ReadonlyAccount\n : TAccountToken2022Program,\n TAccountAtaProgram extends string\n ? ReadonlyAccount\n : TAccountAtaProgram,\n TAccountPayer extends string\n ? WritableSignerAccount &\n IAccountSignerMeta\n : TAccountPayer,\n TAccountVendor extends string\n ? ReadonlySignerAccount &\n IAccountSignerMeta\n : TAccountVendor,\n TAccountProductMint extends string\n ? WritableAccount\n : TAccountProductMint,\n TAccountProductAssociatedToken extends string\n ? WritableAccount\n : TAccountProductAssociatedToken,\n TAccountDevice extends string\n ? ReadonlyAccount\n : TAccountDevice,\n TAccountDeviceMint extends string\n ? WritableAccount\n : TAccountDeviceMint,\n ...TRemainingAccounts,\n ]\n >;\n\nexport type CreateDeviceInstructionData = {\n discriminator: number;\n name: string;\n uri: string;\n additionalMetadata: Array;\n signingAlg: DeviceSigningAlgorithm;\n};\n\nexport type CreateDeviceInstructionDataArgs = {\n name: string;\n uri: string;\n additionalMetadata: Array;\n signingAlg: DeviceSigningAlgorithmArgs;\n};\n\nexport function getCreateDeviceInstructionDataEncoder(): Encoder {\n return transformEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['name', addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())],\n ['uri', addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())],\n [\n 'additionalMetadata',\n getArrayEncoder(\n getTupleEncoder([\n addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder()),\n addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder()),\n ])\n ),\n ],\n ['signingAlg', getDeviceSigningAlgorithmEncoder()],\n ]),\n (value) => ({ ...value, discriminator: 2 })\n );\n}\n\nexport function getCreateDeviceInstructionDataDecoder(): Decoder {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['name', addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())],\n ['uri', addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())],\n [\n 'additionalMetadata',\n getArrayDecoder(\n getTupleDecoder([\n addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder()),\n addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder()),\n ])\n ),\n ],\n ['signingAlg', getDeviceSigningAlgorithmDecoder()],\n ]);\n}\n\nexport function getCreateDeviceInstructionDataCodec(): Codec<\n CreateDeviceInstructionDataArgs,\n CreateDeviceInstructionData\n> {\n return combineCodec(\n getCreateDeviceInstructionDataEncoder(),\n getCreateDeviceInstructionDataDecoder()\n );\n}\n\nexport type CreateDeviceInput<\n TAccountSystemProgram extends string = string,\n TAccountToken2022Program extends string = string,\n TAccountAtaProgram extends string = string,\n TAccountPayer extends string = string,\n TAccountVendor extends string = string,\n TAccountProductMint extends string = string,\n TAccountProductAssociatedToken extends string = string,\n TAccountDevice extends string = string,\n TAccountDeviceMint extends string = string,\n> = {\n /** The system program */\n systemProgram?: Address;\n /** The SPL Token 2022 program */\n token2022Program?: Address;\n /** The associated token program */\n ataProgram?: Address;\n /** The account paying for the storage fees */\n payer: TransactionSigner;\n /** The vendor */\n vendor: TransactionSigner;\n /** The mint account of the product */\n productMint: Address;\n /** The associated token account of the product */\n productAssociatedToken: Address;\n /** The device */\n device: Address;\n /** The mint account of the device */\n deviceMint: Address;\n name: CreateDeviceInstructionDataArgs['name'];\n uri: CreateDeviceInstructionDataArgs['uri'];\n additionalMetadata: CreateDeviceInstructionDataArgs['additionalMetadata'];\n signingAlg: CreateDeviceInstructionDataArgs['signingAlg'];\n};\n\nexport function getCreateDeviceInstruction<\n TAccountSystemProgram extends string,\n TAccountToken2022Program extends string,\n TAccountAtaProgram extends string,\n TAccountPayer extends string,\n TAccountVendor extends string,\n TAccountProductMint extends string,\n TAccountProductAssociatedToken extends string,\n TAccountDevice extends string,\n TAccountDeviceMint extends string,\n>(\n input: CreateDeviceInput<\n TAccountSystemProgram,\n TAccountToken2022Program,\n TAccountAtaProgram,\n TAccountPayer,\n TAccountVendor,\n TAccountProductMint,\n TAccountProductAssociatedToken,\n TAccountDevice,\n TAccountDeviceMint\n >\n): CreateDeviceInstruction<\n typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountSystemProgram,\n TAccountToken2022Program,\n TAccountAtaProgram,\n TAccountPayer,\n TAccountVendor,\n TAccountProductMint,\n TAccountProductAssociatedToken,\n TAccountDevice,\n TAccountDeviceMint\n> {\n // Program address.\n const programAddress = DEPHY_ID_PROGRAM_ADDRESS;\n\n // Original accounts.\n const originalAccounts = {\n systemProgram: { value: input.systemProgram ?? null, isWritable: false },\n token2022Program: {\n value: input.token2022Program ?? null,\n isWritable: false,\n },\n ataProgram: { value: input.ataProgram ?? null, isWritable: false },\n payer: { value: input.payer ?? null, isWritable: true },\n vendor: { value: input.vendor ?? null, isWritable: false },\n productMint: { value: input.productMint ?? null, isWritable: true },\n productAssociatedToken: {\n value: input.productAssociatedToken ?? null,\n isWritable: true,\n },\n device: { value: input.device ?? null, isWritable: false },\n deviceMint: { value: input.deviceMint ?? null, isWritable: true },\n };\n const accounts = originalAccounts as Record<\n keyof typeof originalAccounts,\n ResolvedAccount\n >;\n\n // Original args.\n const args = { ...input };\n\n // Resolve default values.\n if (!accounts.systemProgram.value) {\n accounts.systemProgram.value =\n '11111111111111111111111111111111' as Address<'11111111111111111111111111111111'>;\n }\n if (!accounts.token2022Program.value) {\n accounts.token2022Program.value =\n 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb' as Address<'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb'>;\n }\n if (!accounts.ataProgram.value) {\n accounts.ataProgram.value =\n 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL' as Address<'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL'>;\n }\n\n const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');\n const instruction = {\n accounts: [\n getAccountMeta(accounts.systemProgram),\n getAccountMeta(accounts.token2022Program),\n getAccountMeta(accounts.ataProgram),\n getAccountMeta(accounts.payer),\n getAccountMeta(accounts.vendor),\n getAccountMeta(accounts.productMint),\n getAccountMeta(accounts.productAssociatedToken),\n getAccountMeta(accounts.device),\n getAccountMeta(accounts.deviceMint),\n ],\n programAddress,\n data: getCreateDeviceInstructionDataEncoder().encode(\n args as CreateDeviceInstructionDataArgs\n ),\n } as CreateDeviceInstruction<\n typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountSystemProgram,\n TAccountToken2022Program,\n TAccountAtaProgram,\n TAccountPayer,\n TAccountVendor,\n TAccountProductMint,\n TAccountProductAssociatedToken,\n TAccountDevice,\n TAccountDeviceMint\n >;\n\n return instruction;\n}\n\nexport type ParsedCreateDeviceInstruction<\n TProgram extends string = typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[],\n> = {\n programAddress: Address;\n accounts: {\n /** The system program */\n systemProgram: TAccountMetas[0];\n /** The SPL Token 2022 program */\n token2022Program: TAccountMetas[1];\n /** The associated token program */\n ataProgram: TAccountMetas[2];\n /** The account paying for the storage fees */\n payer: TAccountMetas[3];\n /** The vendor */\n vendor: TAccountMetas[4];\n /** The mint account of the product */\n productMint: TAccountMetas[5];\n /** The associated token account of the product */\n productAssociatedToken: TAccountMetas[6];\n /** The device */\n device: TAccountMetas[7];\n /** The mint account of the device */\n deviceMint: TAccountMetas[8];\n };\n data: CreateDeviceInstructionData;\n};\n\nexport function parseCreateDeviceInstruction<\n TProgram extends string,\n TAccountMetas extends readonly IAccountMeta[],\n>(\n instruction: IInstruction &\n IInstructionWithAccounts &\n IInstructionWithData\n): ParsedCreateDeviceInstruction {\n if (instruction.accounts.length < 9) {\n // TODO: Coded error.\n throw new Error('Not enough accounts');\n }\n let accountIndex = 0;\n const getNextAccount = () => {\n const accountMeta = instruction.accounts![accountIndex]!;\n accountIndex += 1;\n return accountMeta;\n };\n return {\n programAddress: instruction.programAddress,\n accounts: {\n systemProgram: getNextAccount(),\n token2022Program: getNextAccount(),\n ataProgram: getNextAccount(),\n payer: getNextAccount(),\n vendor: getNextAccount(),\n productMint: getNextAccount(),\n productAssociatedToken: getNextAccount(),\n device: getNextAccount(),\n deviceMint: getNextAccount(),\n },\n data: getCreateDeviceInstructionDataDecoder().decode(instruction.data),\n };\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport {\n addDecoderSizePrefix,\n addEncoderSizePrefix,\n combineCodec,\n getArrayDecoder,\n getArrayEncoder,\n getStructDecoder,\n getStructEncoder,\n getTupleDecoder,\n getTupleEncoder,\n getU32Decoder,\n getU32Encoder,\n getU8Decoder,\n getU8Encoder,\n getUtf8Decoder,\n getUtf8Encoder,\n transformEncoder,\n type Address,\n type Codec,\n type Decoder,\n type Encoder,\n type IAccountMeta,\n type IAccountSignerMeta,\n type IInstruction,\n type IInstructionWithAccounts,\n type IInstructionWithData,\n type ReadonlyAccount,\n type ReadonlySignerAccount,\n type TransactionSigner,\n type WritableAccount,\n type WritableSignerAccount,\n} from '@solana/web3.js';\nimport { DEPHY_ID_PROGRAM_ADDRESS } from '../programs';\nimport { getAccountMetaFactory, type ResolvedAccount } from '../shared';\n\nexport type CreateProductInstruction<\n TProgram extends string = typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountSystemProgram extends\n | string\n | IAccountMeta = '11111111111111111111111111111111',\n TAccountToken2022Program extends\n | string\n | IAccountMeta = 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb',\n TAccountPayer extends string | IAccountMeta = string,\n TAccountVendor extends string | IAccountMeta = string,\n TAccountProductMint extends string | IAccountMeta = string,\n TRemainingAccounts extends readonly IAccountMeta[] = [],\n> = IInstruction &\n IInstructionWithData &\n IInstructionWithAccounts<\n [\n TAccountSystemProgram extends string\n ? ReadonlyAccount\n : TAccountSystemProgram,\n TAccountToken2022Program extends string\n ? ReadonlyAccount\n : TAccountToken2022Program,\n TAccountPayer extends string\n ? WritableSignerAccount &\n IAccountSignerMeta\n : TAccountPayer,\n TAccountVendor extends string\n ? ReadonlySignerAccount &\n IAccountSignerMeta\n : TAccountVendor,\n TAccountProductMint extends string\n ? WritableAccount\n : TAccountProductMint,\n ...TRemainingAccounts,\n ]\n >;\n\nexport type CreateProductInstructionData = {\n discriminator: number;\n name: string;\n symbol: string;\n uri: string;\n additionalMetadata: Array;\n};\n\nexport type CreateProductInstructionDataArgs = {\n name: string;\n symbol: string;\n uri: string;\n additionalMetadata: Array;\n};\n\nexport function getCreateProductInstructionDataEncoder(): Encoder {\n return transformEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['name', addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())],\n ['symbol', addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())],\n ['uri', addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())],\n [\n 'additionalMetadata',\n getArrayEncoder(\n getTupleEncoder([\n addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder()),\n addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder()),\n ])\n ),\n ],\n ]),\n (value) => ({ ...value, discriminator: 1 })\n );\n}\n\nexport function getCreateProductInstructionDataDecoder(): Decoder {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['name', addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())],\n ['symbol', addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())],\n ['uri', addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())],\n [\n 'additionalMetadata',\n getArrayDecoder(\n getTupleDecoder([\n addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder()),\n addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder()),\n ])\n ),\n ],\n ]);\n}\n\nexport function getCreateProductInstructionDataCodec(): Codec<\n CreateProductInstructionDataArgs,\n CreateProductInstructionData\n> {\n return combineCodec(\n getCreateProductInstructionDataEncoder(),\n getCreateProductInstructionDataDecoder()\n );\n}\n\nexport type CreateProductInput<\n TAccountSystemProgram extends string = string,\n TAccountToken2022Program extends string = string,\n TAccountPayer extends string = string,\n TAccountVendor extends string = string,\n TAccountProductMint extends string = string,\n> = {\n /** The system program */\n systemProgram?: Address;\n /** The SPL Token 2022 program */\n token2022Program?: Address;\n /** The account paying for the storage fees */\n payer: TransactionSigner;\n /** The vendor */\n vendor: TransactionSigner;\n /** The mint account of the product */\n productMint: Address;\n name: CreateProductInstructionDataArgs['name'];\n symbol: CreateProductInstructionDataArgs['symbol'];\n uri: CreateProductInstructionDataArgs['uri'];\n additionalMetadata: CreateProductInstructionDataArgs['additionalMetadata'];\n};\n\nexport function getCreateProductInstruction<\n TAccountSystemProgram extends string,\n TAccountToken2022Program extends string,\n TAccountPayer extends string,\n TAccountVendor extends string,\n TAccountProductMint extends string,\n>(\n input: CreateProductInput<\n TAccountSystemProgram,\n TAccountToken2022Program,\n TAccountPayer,\n TAccountVendor,\n TAccountProductMint\n >\n): CreateProductInstruction<\n typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountSystemProgram,\n TAccountToken2022Program,\n TAccountPayer,\n TAccountVendor,\n TAccountProductMint\n> {\n // Program address.\n const programAddress = DEPHY_ID_PROGRAM_ADDRESS;\n\n // Original accounts.\n const originalAccounts = {\n systemProgram: { value: input.systemProgram ?? null, isWritable: false },\n token2022Program: {\n value: input.token2022Program ?? null,\n isWritable: false,\n },\n payer: { value: input.payer ?? null, isWritable: true },\n vendor: { value: input.vendor ?? null, isWritable: false },\n productMint: { value: input.productMint ?? null, isWritable: true },\n };\n const accounts = originalAccounts as Record<\n keyof typeof originalAccounts,\n ResolvedAccount\n >;\n\n // Original args.\n const args = { ...input };\n\n // Resolve default values.\n if (!accounts.systemProgram.value) {\n accounts.systemProgram.value =\n '11111111111111111111111111111111' as Address<'11111111111111111111111111111111'>;\n }\n if (!accounts.token2022Program.value) {\n accounts.token2022Program.value =\n 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb' as Address<'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb'>;\n }\n\n const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');\n const instruction = {\n accounts: [\n getAccountMeta(accounts.systemProgram),\n getAccountMeta(accounts.token2022Program),\n getAccountMeta(accounts.payer),\n getAccountMeta(accounts.vendor),\n getAccountMeta(accounts.productMint),\n ],\n programAddress,\n data: getCreateProductInstructionDataEncoder().encode(\n args as CreateProductInstructionDataArgs\n ),\n } as CreateProductInstruction<\n typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountSystemProgram,\n TAccountToken2022Program,\n TAccountPayer,\n TAccountVendor,\n TAccountProductMint\n >;\n\n return instruction;\n}\n\nexport type ParsedCreateProductInstruction<\n TProgram extends string = typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[],\n> = {\n programAddress: Address;\n accounts: {\n /** The system program */\n systemProgram: TAccountMetas[0];\n /** The SPL Token 2022 program */\n token2022Program: TAccountMetas[1];\n /** The account paying for the storage fees */\n payer: TAccountMetas[2];\n /** The vendor */\n vendor: TAccountMetas[3];\n /** The mint account of the product */\n productMint: TAccountMetas[4];\n };\n data: CreateProductInstructionData;\n};\n\nexport function parseCreateProductInstruction<\n TProgram extends string,\n TAccountMetas extends readonly IAccountMeta[],\n>(\n instruction: IInstruction &\n IInstructionWithAccounts &\n IInstructionWithData\n): ParsedCreateProductInstruction {\n if (instruction.accounts.length < 5) {\n // TODO: Coded error.\n throw new Error('Not enough accounts');\n }\n let accountIndex = 0;\n const getNextAccount = () => {\n const accountMeta = instruction.accounts![accountIndex]!;\n accountIndex += 1;\n return accountMeta;\n };\n return {\n programAddress: instruction.programAddress,\n accounts: {\n systemProgram: getNextAccount(),\n token2022Program: getNextAccount(),\n payer: getNextAccount(),\n vendor: getNextAccount(),\n productMint: getNextAccount(),\n },\n data: getCreateProductInstructionDataDecoder().decode(instruction.data),\n };\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport {\n combineCodec,\n getStructDecoder,\n getStructEncoder,\n getU8Decoder,\n getU8Encoder,\n transformEncoder,\n type Address,\n type Codec,\n type Decoder,\n type Encoder,\n type IAccountMeta,\n type IAccountSignerMeta,\n type IInstruction,\n type IInstructionWithAccounts,\n type IInstructionWithData,\n type ReadonlyAccount,\n type ReadonlySignerAccount,\n type TransactionSigner,\n type WritableAccount,\n type WritableSignerAccount,\n} from '@solana/web3.js';\nimport { DEPHY_ID_PROGRAM_ADDRESS } from '../programs';\nimport { getAccountMetaFactory, type ResolvedAccount } from '../shared';\n\nexport type InitializeInstruction<\n TProgram extends string = typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountSystemProgram extends\n | string\n | IAccountMeta = '11111111111111111111111111111111',\n TAccountPayer extends string | IAccountMeta = string,\n TAccountProgramData extends string | IAccountMeta = string,\n TAccountAuthority extends string | IAccountMeta = string,\n TRemainingAccounts extends readonly IAccountMeta[] = [],\n> = IInstruction &\n IInstructionWithData &\n IInstructionWithAccounts<\n [\n TAccountSystemProgram extends string\n ? ReadonlyAccount\n : TAccountSystemProgram,\n TAccountPayer extends string\n ? WritableSignerAccount &\n IAccountSignerMeta\n : TAccountPayer,\n TAccountProgramData extends string\n ? WritableAccount\n : TAccountProgramData,\n TAccountAuthority extends string\n ? ReadonlySignerAccount &\n IAccountSignerMeta\n : TAccountAuthority,\n ...TRemainingAccounts,\n ]\n >;\n\nexport type InitializeInstructionData = { discriminator: number; bump: number };\n\nexport type InitializeInstructionDataArgs = { bump: number };\n\nexport function getInitializeInstructionDataEncoder(): Encoder {\n return transformEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['bump', getU8Encoder()],\n ]),\n (value) => ({ ...value, discriminator: 0 })\n );\n}\n\nexport function getInitializeInstructionDataDecoder(): Decoder {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['bump', getU8Decoder()],\n ]);\n}\n\nexport function getInitializeInstructionDataCodec(): Codec<\n InitializeInstructionDataArgs,\n InitializeInstructionData\n> {\n return combineCodec(\n getInitializeInstructionDataEncoder(),\n getInitializeInstructionDataDecoder()\n );\n}\n\nexport type InitializeInput<\n TAccountSystemProgram extends string = string,\n TAccountPayer extends string = string,\n TAccountProgramData extends string = string,\n TAccountAuthority extends string = string,\n> = {\n /** The system program */\n systemProgram?: Address;\n /** The account paying for the storage fees */\n payer: TransactionSigner;\n /** The program data account for the program */\n programData: Address;\n /** The authority account of the program */\n authority: TransactionSigner;\n bump: InitializeInstructionDataArgs['bump'];\n};\n\nexport function getInitializeInstruction<\n TAccountSystemProgram extends string,\n TAccountPayer extends string,\n TAccountProgramData extends string,\n TAccountAuthority extends string,\n>(\n input: InitializeInput<\n TAccountSystemProgram,\n TAccountPayer,\n TAccountProgramData,\n TAccountAuthority\n >\n): InitializeInstruction<\n typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountSystemProgram,\n TAccountPayer,\n TAccountProgramData,\n TAccountAuthority\n> {\n // Program address.\n const programAddress = DEPHY_ID_PROGRAM_ADDRESS;\n\n // Original accounts.\n const originalAccounts = {\n systemProgram: { value: input.systemProgram ?? null, isWritable: false },\n payer: { value: input.payer ?? null, isWritable: true },\n programData: { value: input.programData ?? null, isWritable: true },\n authority: { value: input.authority ?? null, isWritable: false },\n };\n const accounts = originalAccounts as Record<\n keyof typeof originalAccounts,\n ResolvedAccount\n >;\n\n // Original args.\n const args = { ...input };\n\n // Resolve default values.\n if (!accounts.systemProgram.value) {\n accounts.systemProgram.value =\n '11111111111111111111111111111111' as Address<'11111111111111111111111111111111'>;\n }\n\n const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');\n const instruction = {\n accounts: [\n getAccountMeta(accounts.systemProgram),\n getAccountMeta(accounts.payer),\n getAccountMeta(accounts.programData),\n getAccountMeta(accounts.authority),\n ],\n programAddress,\n data: getInitializeInstructionDataEncoder().encode(\n args as InitializeInstructionDataArgs\n ),\n } as InitializeInstruction<\n typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountSystemProgram,\n TAccountPayer,\n TAccountProgramData,\n TAccountAuthority\n >;\n\n return instruction;\n}\n\nexport type ParsedInitializeInstruction<\n TProgram extends string = typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[],\n> = {\n programAddress: Address;\n accounts: {\n /** The system program */\n systemProgram: TAccountMetas[0];\n /** The account paying for the storage fees */\n payer: TAccountMetas[1];\n /** The program data account for the program */\n programData: TAccountMetas[2];\n /** The authority account of the program */\n authority: TAccountMetas[3];\n };\n data: InitializeInstructionData;\n};\n\nexport function parseInitializeInstruction<\n TProgram extends string,\n TAccountMetas extends readonly IAccountMeta[],\n>(\n instruction: IInstruction &\n IInstructionWithAccounts &\n IInstructionWithData\n): ParsedInitializeInstruction {\n if (instruction.accounts.length < 4) {\n // TODO: Coded error.\n throw new Error('Not enough accounts');\n }\n let accountIndex = 0;\n const getNextAccount = () => {\n const accountMeta = instruction.accounts![accountIndex]!;\n accountIndex += 1;\n return accountMeta;\n };\n return {\n programAddress: instruction.programAddress,\n accounts: {\n systemProgram: getNextAccount(),\n payer: getNextAccount(),\n programData: getNextAccount(),\n authority: getNextAccount(),\n },\n data: getInitializeInstructionDataDecoder().decode(instruction.data),\n };\n}\n"]} \ No newline at end of file diff --git a/clients/js/dist/src/index.mjs.map b/clients/js/dist/src/index.mjs.map index 21f7c6a..299aa40 100644 --- a/clients/js/dist/src/index.mjs.map +++ b/clients/js/dist/src/index.mjs.map @@ -1 +1 @@ -{"version":3,"sources":["../../env-shim.ts","../../src/generated/accounts/programDataAccount.ts","../../src/generated/pdas/deviceMint.ts","../../src/generated/pdas/productMint.ts","../../src/generated/pdas/programDataAccount.ts","../../src/generated/types/deviceActivationSignature.ts","../../src/generated/types/deviceSigningAlgorithm.ts","../../src/generated/types/key.ts","../../src/generated/types/programData.ts","../../src/generated/errors/dephyId.ts","../../src/generated/instructions/activateDevice.ts","../../src/generated/programs/dephyId.ts","../../src/generated/shared/index.ts","../../src/generated/instructions/createDevice.ts","../../src/generated/instructions/createProduct.ts","../../src/generated/instructions/initialize.ts"],"names":["combineCodec","getAddressEncoder","getStructDecoder","getStructEncoder","getProgramDerivedAddress","getUtf8Encoder","DeviceSigningAlgorithm","getEnumDecoder","getEnumEncoder","Key","getU8Decoder","getU8Encoder","transformEncoder","DephyIdAccount","DephyIdInstruction","getTupleDecoder","getTupleEncoder","addDecoderSizePrefix","addEncoderSizePrefix","getArrayDecoder","getArrayEncoder","getU32Decoder","getU32Encoder","getUtf8Decoder"],"mappings":";AACO,IAAM,UAA2B,uBACrC,QAAgB,KAAU,EAAE,aAAa,eAAe;;;ACM3D;AAAA,EACE;AAAA,EACA;AAAA,EACA,gBAAAA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,qBAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,oBAAAC;AAAA,EACA;AAAA,OAWK;;;ACtBP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AAQP,eAAsB,kBACpB,OACA,SAAmD,CAAC,GACpB;AAChC,QAAM;AAAA,IACJ,iBAAiB;AAAA,EACnB,IAAI;AACJ,SAAO,MAAM,yBAAyB;AAAA,IACpC;AAAA,IACA,OAAO;AAAA,MACL,eAAe,EAAE,OAAO,iBAAiB;AAAA,MACzC,kBAAkB,EAAE,OAAO,MAAM,iBAAiB;AAAA,MAClD,kBAAkB,EAAE,OAAO,MAAM,YAAY;AAAA,IAC/C;AAAA,EACF,CAAC;AACH;;;AC7BA;AAAA,EACE,qBAAAF;AAAA,EACA,4BAAAG;AAAA,EACA,kBAAAC;AAAA,OAGK;AAQP,eAAsB,mBACpB,OACA,SAAmD,CAAC,GACpB;AAChC,QAAM;AAAA,IACJ,iBAAiB;AAAA,EACnB,IAAI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AO,YAAY,IAAI;AAAA,EACrE;AACF","sourcesContent":["// Clever obfuscation to prevent the build system from inlining the value of `NODE_ENV`\nexport const __DEV__ = /* @__PURE__ */ (() =>\n (process as any)['en' + 'v'].NODE_ENV === 'development')();\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport {\n assertAccountExists,\n assertAccountsExist,\n combineCodec,\n decodeAccount,\n fetchEncodedAccount,\n fetchEncodedAccounts,\n getAddressDecoder,\n getAddressEncoder,\n getStructDecoder,\n getStructEncoder,\n transformEncoder,\n type Account,\n type Address,\n type Codec,\n type Decoder,\n type EncodedAccount,\n type Encoder,\n type FetchAccountConfig,\n type FetchAccountsConfig,\n type MaybeAccount,\n type MaybeEncodedAccount,\n} from '@solana/web3.js';\nimport { findProgramDataAccountPda } from '../pdas';\nimport {\n Key,\n getKeyDecoder,\n getKeyEncoder,\n getProgramDataDecoder,\n getProgramDataEncoder,\n type ProgramData,\n type ProgramDataArgs,\n} from '../types';\n\nexport type ProgramDataAccount = {\n key: Key;\n authority: Address;\n data: ProgramData;\n};\n\nexport type ProgramDataAccountArgs = {\n authority: Address;\n data: ProgramDataArgs;\n};\n\nexport function getProgramDataAccountEncoder(): Encoder {\n return transformEncoder(\n getStructEncoder([\n ['key', getKeyEncoder()],\n ['authority', getAddressEncoder()],\n ['data', getProgramDataEncoder()],\n ]),\n (value) => ({ ...value, key: Key.ProgramDataAccount })\n );\n}\n\nexport function getProgramDataAccountDecoder(): Decoder {\n return getStructDecoder([\n ['key', getKeyDecoder()],\n ['authority', getAddressDecoder()],\n ['data', getProgramDataDecoder()],\n ]);\n}\n\nexport function getProgramDataAccountCodec(): Codec<\n ProgramDataAccountArgs,\n ProgramDataAccount\n> {\n return combineCodec(\n getProgramDataAccountEncoder(),\n getProgramDataAccountDecoder()\n );\n}\n\nexport function decodeProgramDataAccount(\n encodedAccount: EncodedAccount\n): Account;\nexport function decodeProgramDataAccount(\n encodedAccount: MaybeEncodedAccount\n): MaybeAccount;\nexport function decodeProgramDataAccount(\n encodedAccount: EncodedAccount | MaybeEncodedAccount\n):\n | Account\n | MaybeAccount {\n return decodeAccount(\n encodedAccount as MaybeEncodedAccount,\n getProgramDataAccountDecoder()\n );\n}\n\nexport async function fetchProgramDataAccount(\n rpc: Parameters[0],\n address: Address,\n config?: FetchAccountConfig\n): Promise> {\n const maybeAccount = await fetchMaybeProgramDataAccount(rpc, address, config);\n assertAccountExists(maybeAccount);\n return maybeAccount;\n}\n\nexport async function fetchMaybeProgramDataAccount<\n TAddress extends string = string,\n>(\n rpc: Parameters[0],\n address: Address,\n config?: FetchAccountConfig\n): Promise> {\n const maybeAccount = await fetchEncodedAccount(rpc, address, config);\n return decodeProgramDataAccount(maybeAccount);\n}\n\nexport async function fetchAllProgramDataAccount(\n rpc: Parameters[0],\n addresses: Array
,\n config?: FetchAccountsConfig\n): Promise[]> {\n const maybeAccounts = await fetchAllMaybeProgramDataAccount(\n rpc,\n addresses,\n config\n );\n assertAccountsExist(maybeAccounts);\n return maybeAccounts;\n}\n\nexport async function fetchAllMaybeProgramDataAccount(\n rpc: Parameters[0],\n addresses: Array
,\n config?: FetchAccountsConfig\n): Promise[]> {\n const maybeAccounts = await fetchEncodedAccounts(rpc, addresses, config);\n return maybeAccounts.map((maybeAccount) =>\n decodeProgramDataAccount(maybeAccount)\n );\n}\n\nexport function getProgramDataAccountSize(): number {\n return 34;\n}\n\nexport async function fetchProgramDataAccountFromSeeds(\n rpc: Parameters[0],\n config: FetchAccountConfig & { programAddress?: Address } = {}\n): Promise> {\n const maybeAccount = await fetchMaybeProgramDataAccountFromSeeds(rpc, config);\n assertAccountExists(maybeAccount);\n return maybeAccount;\n}\n\nexport async function fetchMaybeProgramDataAccountFromSeeds(\n rpc: Parameters[0],\n config: FetchAccountConfig & { programAddress?: Address } = {}\n): Promise> {\n const { programAddress, ...fetchConfig } = config;\n const [address] = await findProgramDataAccountPda({ programAddress });\n return await fetchMaybeProgramDataAccount(rpc, address, fetchConfig);\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport {\n getAddressEncoder,\n getProgramDerivedAddress,\n getUtf8Encoder,\n type Address,\n type ProgramDerivedAddress,\n} from '@solana/web3.js';\n\nexport type DeviceMintSeeds = {\n productMintPubkey: Address;\n\n devicePubkey: Address;\n};\n\nexport async function findDeviceMintPda(\n seeds: DeviceMintSeeds,\n config: { programAddress?: Address | undefined } = {}\n): Promise {\n const {\n programAddress = 'hdMghjD73uASxgJXi6e1mGPsXqnADMsrqB1bveqABP1' as Address<'hdMghjD73uASxgJXi6e1mGPsXqnADMsrqB1bveqABP1'>,\n } = config;\n return await getProgramDerivedAddress({\n programAddress,\n seeds: [\n getUtf8Encoder().encode('DePHY_ID-DEVICE'),\n getAddressEncoder().encode(seeds.productMintPubkey),\n getAddressEncoder().encode(seeds.devicePubkey),\n ],\n });\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport {\n getAddressEncoder,\n getProgramDerivedAddress,\n getUtf8Encoder,\n type Address,\n type ProgramDerivedAddress,\n} from '@solana/web3.js';\n\nexport type ProductMintSeeds = {\n vendorPubkey: Address;\n\n productName: string;\n};\n\nexport async function findProductMintPda(\n seeds: ProductMintSeeds,\n config: { programAddress?: Address | undefined } = {}\n): Promise {\n const {\n programAddress = 'hdMghjD73uASxgJXi6e1mGPsXqnADMsrqB1bveqABP1' as Address<'hdMghjD73uASxgJXi6e1mGPsXqnADMsrqB1bveqABP1'>,\n } = config;\n return await getProgramDerivedAddress({\n programAddress,\n seeds: [\n getUtf8Encoder().encode('DePHY_ID-PRODUCT'),\n getAddressEncoder().encode(seeds.vendorPubkey),\n getUtf8Encoder().encode(seeds.productName),\n ],\n });\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport {\n getProgramDerivedAddress,\n getUtf8Encoder,\n type Address,\n type ProgramDerivedAddress,\n} from '@solana/web3.js';\n\nexport async function findProgramDataAccountPda(\n config: { programAddress?: Address | undefined } = {}\n): Promise {\n const {\n programAddress = 'hdMghjD73uASxgJXi6e1mGPsXqnADMsrqB1bveqABP1' as Address<'hdMghjD73uASxgJXi6e1mGPsXqnADMsrqB1bveqABP1'>,\n } = config;\n return await getProgramDerivedAddress({\n programAddress,\n seeds: [getUtf8Encoder().encode('DePHY_ID')],\n });\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport {\n combineCodec,\n fixDecoderSize,\n fixEncoderSize,\n getBytesDecoder,\n getBytesEncoder,\n getDiscriminatedUnionDecoder,\n getDiscriminatedUnionEncoder,\n getStructDecoder,\n getStructEncoder,\n getTupleDecoder,\n getTupleEncoder,\n getU8Decoder,\n getU8Encoder,\n type Codec,\n type Decoder,\n type Encoder,\n type GetDiscriminatedUnionVariant,\n type GetDiscriminatedUnionVariantContent,\n type ReadonlyUint8Array,\n} from '@solana/web3.js';\n\nexport type DeviceActivationSignature =\n | { __kind: 'Ed25519'; fields: readonly [ReadonlyUint8Array] }\n | { __kind: 'Secp256k1'; fields: readonly [ReadonlyUint8Array, number] }\n | { __kind: 'EthSecp256k1'; fields: readonly [ReadonlyUint8Array, number] };\n\nexport type DeviceActivationSignatureArgs = DeviceActivationSignature;\n\nexport function getDeviceActivationSignatureEncoder(): Encoder {\n return getDiscriminatedUnionEncoder([\n [\n 'Ed25519',\n getStructEncoder([\n ['fields', getTupleEncoder([fixEncoderSize(getBytesEncoder(), 64)])],\n ]),\n ],\n [\n 'Secp256k1',\n getStructEncoder([\n [\n 'fields',\n getTupleEncoder([\n fixEncoderSize(getBytesEncoder(), 64),\n getU8Encoder(),\n ]),\n ],\n ]),\n ],\n [\n 'EthSecp256k1',\n getStructEncoder([\n [\n 'fields',\n getTupleEncoder([\n fixEncoderSize(getBytesEncoder(), 64),\n getU8Encoder(),\n ]),\n ],\n ]),\n ],\n ]);\n}\n\nexport function getDeviceActivationSignatureDecoder(): Decoder {\n return getDiscriminatedUnionDecoder([\n [\n 'Ed25519',\n getStructDecoder([\n ['fields', getTupleDecoder([fixDecoderSize(getBytesDecoder(), 64)])],\n ]),\n ],\n [\n 'Secp256k1',\n getStructDecoder([\n [\n 'fields',\n getTupleDecoder([\n fixDecoderSize(getBytesDecoder(), 64),\n getU8Decoder(),\n ]),\n ],\n ]),\n ],\n [\n 'EthSecp256k1',\n getStructDecoder([\n [\n 'fields',\n getTupleDecoder([\n fixDecoderSize(getBytesDecoder(), 64),\n getU8Decoder(),\n ]),\n ],\n ]),\n ],\n ]);\n}\n\nexport function getDeviceActivationSignatureCodec(): Codec<\n DeviceActivationSignatureArgs,\n DeviceActivationSignature\n> {\n return combineCodec(\n getDeviceActivationSignatureEncoder(),\n getDeviceActivationSignatureDecoder()\n );\n}\n\n// Data Enum Helpers.\nexport function deviceActivationSignature(\n kind: 'Ed25519',\n data: GetDiscriminatedUnionVariantContent<\n DeviceActivationSignatureArgs,\n '__kind',\n 'Ed25519'\n >['fields']\n): GetDiscriminatedUnionVariant<\n DeviceActivationSignatureArgs,\n '__kind',\n 'Ed25519'\n>;\nexport function deviceActivationSignature(\n kind: 'Secp256k1',\n data: GetDiscriminatedUnionVariantContent<\n DeviceActivationSignatureArgs,\n '__kind',\n 'Secp256k1'\n >['fields']\n): GetDiscriminatedUnionVariant<\n DeviceActivationSignatureArgs,\n '__kind',\n 'Secp256k1'\n>;\nexport function deviceActivationSignature(\n kind: 'EthSecp256k1',\n data: GetDiscriminatedUnionVariantContent<\n DeviceActivationSignatureArgs,\n '__kind',\n 'EthSecp256k1'\n >['fields']\n): GetDiscriminatedUnionVariant<\n DeviceActivationSignatureArgs,\n '__kind',\n 'EthSecp256k1'\n>;\nexport function deviceActivationSignature<\n K extends DeviceActivationSignatureArgs['__kind'],\n Data,\n>(kind: K, data?: Data) {\n return Array.isArray(data)\n ? { __kind: kind, fields: data }\n : { __kind: kind, ...(data ?? {}) };\n}\n\nexport function isDeviceActivationSignature<\n K extends DeviceActivationSignature['__kind'],\n>(\n kind: K,\n value: DeviceActivationSignature\n): value is DeviceActivationSignature & { __kind: K } {\n return value.__kind === kind;\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport {\n combineCodec,\n getEnumDecoder,\n getEnumEncoder,\n type Codec,\n type Decoder,\n type Encoder,\n} from '@solana/web3.js';\n\nexport enum DeviceSigningAlgorithm {\n Ed25519,\n Secp256k1,\n}\n\nexport type DeviceSigningAlgorithmArgs = DeviceSigningAlgorithm;\n\nexport function getDeviceSigningAlgorithmEncoder(): Encoder {\n return getEnumEncoder(DeviceSigningAlgorithm);\n}\n\nexport function getDeviceSigningAlgorithmDecoder(): Decoder {\n return getEnumDecoder(DeviceSigningAlgorithm);\n}\n\nexport function getDeviceSigningAlgorithmCodec(): Codec<\n DeviceSigningAlgorithmArgs,\n DeviceSigningAlgorithm\n> {\n return combineCodec(\n getDeviceSigningAlgorithmEncoder(),\n getDeviceSigningAlgorithmDecoder()\n );\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport {\n combineCodec,\n getEnumDecoder,\n getEnumEncoder,\n type Codec,\n type Decoder,\n type Encoder,\n} from '@solana/web3.js';\n\nexport enum Key {\n Uninitialized,\n ProgramDataAccount,\n}\n\nexport type KeyArgs = Key;\n\nexport function getKeyEncoder(): Encoder {\n return getEnumEncoder(Key);\n}\n\nexport function getKeyDecoder(): Decoder {\n return getEnumDecoder(Key);\n}\n\nexport function getKeyCodec(): Codec {\n return combineCodec(getKeyEncoder(), getKeyDecoder());\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport {\n combineCodec,\n getStructDecoder,\n getStructEncoder,\n getU8Decoder,\n getU8Encoder,\n type Codec,\n type Decoder,\n type Encoder,\n} from '@solana/web3.js';\n\nexport type ProgramData = { bump: number };\n\nexport type ProgramDataArgs = ProgramData;\n\nexport function getProgramDataEncoder(): Encoder {\n return getStructEncoder([['bump', getU8Encoder()]]);\n}\n\nexport function getProgramDataDecoder(): Decoder {\n return getStructDecoder([['bump', getU8Decoder()]]);\n}\n\nexport function getProgramDataCodec(): Codec {\n return combineCodec(getProgramDataEncoder(), getProgramDataDecoder());\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\n/** DeserializationError: Error deserializing an account */\nexport const DEPHY_ID_ERROR__DESERIALIZATION_ERROR = 0x0; // 0\n/** SerializationError: Error serializing an account */\nexport const DEPHY_ID_ERROR__SERIALIZATION_ERROR = 0x1; // 1\n/** InvalidProgramOwner: Invalid program owner. This likely mean the provided account does not exist */\nexport const DEPHY_ID_ERROR__INVALID_PROGRAM_OWNER = 0x2; // 2\n/** InvalidPda: Invalid PDA derivation */\nexport const DEPHY_ID_ERROR__INVALID_PDA = 0x3; // 3\n/** ExpectedEmptyAccount: Expected empty account */\nexport const DEPHY_ID_ERROR__EXPECTED_EMPTY_ACCOUNT = 0x4; // 4\n/** ExpectedNonEmptyAccount: Expected non empty account */\nexport const DEPHY_ID_ERROR__EXPECTED_NON_EMPTY_ACCOUNT = 0x5; // 5\n/** ExpectedSignerAccount: Expected signer account */\nexport const DEPHY_ID_ERROR__EXPECTED_SIGNER_ACCOUNT = 0x6; // 6\n/** ExpectedWritableAccount: Expected writable account */\nexport const DEPHY_ID_ERROR__EXPECTED_WRITABLE_ACCOUNT = 0x7; // 7\n/** AccountMismatch: Account mismatch */\nexport const DEPHY_ID_ERROR__ACCOUNT_MISMATCH = 0x8; // 8\n/** InvalidAccountKey: Invalid account key */\nexport const DEPHY_ID_ERROR__INVALID_ACCOUNT_KEY = 0x9; // 9\n/** NumericalOverflow: Numerical overflow */\nexport const DEPHY_ID_ERROR__NUMERICAL_OVERFLOW = 0xa; // 10\n/** MissingInstruction: Missing instruction */\nexport const DEPHY_ID_ERROR__MISSING_INSTRUCTION = 0xb; // 11\n/** SignatureMismatch: Signature mismatch */\nexport const DEPHY_ID_ERROR__SIGNATURE_MISMATCH = 0xc; // 12\n\nexport type DephyIdError =\n | typeof DEPHY_ID_ERROR__ACCOUNT_MISMATCH\n | typeof DEPHY_ID_ERROR__DESERIALIZATION_ERROR\n | typeof DEPHY_ID_ERROR__EXPECTED_EMPTY_ACCOUNT\n | typeof DEPHY_ID_ERROR__EXPECTED_NON_EMPTY_ACCOUNT\n | typeof DEPHY_ID_ERROR__EXPECTED_SIGNER_ACCOUNT\n | typeof DEPHY_ID_ERROR__EXPECTED_WRITABLE_ACCOUNT\n | typeof DEPHY_ID_ERROR__INVALID_ACCOUNT_KEY\n | typeof DEPHY_ID_ERROR__INVALID_PDA\n | typeof DEPHY_ID_ERROR__INVALID_PROGRAM_OWNER\n | typeof DEPHY_ID_ERROR__MISSING_INSTRUCTION\n | typeof DEPHY_ID_ERROR__NUMERICAL_OVERFLOW\n | typeof DEPHY_ID_ERROR__SERIALIZATION_ERROR\n | typeof DEPHY_ID_ERROR__SIGNATURE_MISMATCH;\n\nlet dephyIdErrorMessages: Record | undefined;\nif (__DEV__) {\n dephyIdErrorMessages = {\n [DEPHY_ID_ERROR__ACCOUNT_MISMATCH]: `Account mismatch`,\n [DEPHY_ID_ERROR__DESERIALIZATION_ERROR]: `Error deserializing an account`,\n [DEPHY_ID_ERROR__EXPECTED_EMPTY_ACCOUNT]: `Expected empty account`,\n [DEPHY_ID_ERROR__EXPECTED_NON_EMPTY_ACCOUNT]: `Expected non empty account`,\n [DEPHY_ID_ERROR__EXPECTED_SIGNER_ACCOUNT]: `Expected signer account`,\n [DEPHY_ID_ERROR__EXPECTED_WRITABLE_ACCOUNT]: `Expected writable account`,\n [DEPHY_ID_ERROR__INVALID_ACCOUNT_KEY]: `Invalid account key`,\n [DEPHY_ID_ERROR__INVALID_PDA]: `Invalid PDA derivation`,\n [DEPHY_ID_ERROR__INVALID_PROGRAM_OWNER]: `Invalid program owner. This likely mean the provided account does not exist`,\n [DEPHY_ID_ERROR__MISSING_INSTRUCTION]: `Missing instruction`,\n [DEPHY_ID_ERROR__NUMERICAL_OVERFLOW]: `Numerical overflow`,\n [DEPHY_ID_ERROR__SERIALIZATION_ERROR]: `Error serializing an account`,\n [DEPHY_ID_ERROR__SIGNATURE_MISMATCH]: `Signature mismatch`,\n };\n}\n\nexport function getDephyIdErrorMessage(code: DephyIdError): string {\n if (__DEV__) {\n return (dephyIdErrorMessages as Record)[code];\n }\n\n return 'Error message not available in production bundles. Compile with `__DEV__` set to true to see more information.';\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport {\n combineCodec,\n getStructDecoder,\n getStructEncoder,\n getU64Decoder,\n getU64Encoder,\n getU8Decoder,\n getU8Encoder,\n transformEncoder,\n type Address,\n type Codec,\n type Decoder,\n type Encoder,\n type IAccountMeta,\n type IAccountSignerMeta,\n type IInstruction,\n type IInstructionWithAccounts,\n type IInstructionWithData,\n type ReadonlyAccount,\n type TransactionSigner,\n type WritableAccount,\n type WritableSignerAccount,\n} from '@solana/web3.js';\nimport { DEPHY_ID_PROGRAM_ADDRESS } from '../programs';\nimport { getAccountMetaFactory, type ResolvedAccount } from '../shared';\nimport {\n getDeviceActivationSignatureDecoder,\n getDeviceActivationSignatureEncoder,\n type DeviceActivationSignature,\n type DeviceActivationSignatureArgs,\n} from '../types';\n\nexport type ActivateDeviceInstruction<\n TProgram extends string = typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountSystemProgram extends\n | string\n | IAccountMeta = '11111111111111111111111111111111',\n TAccountToken2022Program extends string | IAccountMeta = string,\n TAccountAtaProgram extends\n | string\n | IAccountMeta = 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL',\n TAccountPayer extends string | IAccountMeta = string,\n TAccountVendor extends string | IAccountMeta = string,\n TAccountProductMint extends string | IAccountMeta = string,\n TAccountProductAssociatedToken extends string | IAccountMeta = string,\n TAccountDevice extends string | IAccountMeta = string,\n TAccountDeviceMint extends string | IAccountMeta = string,\n TAccountDeviceAssociatedToken extends string | IAccountMeta = string,\n TAccountOwner extends string | IAccountMeta = string,\n TRemainingAccounts extends readonly IAccountMeta[] = [],\n> = IInstruction &\n IInstructionWithData &\n IInstructionWithAccounts<\n [\n TAccountSystemProgram extends string\n ? ReadonlyAccount\n : TAccountSystemProgram,\n TAccountToken2022Program extends string\n ? ReadonlyAccount\n : TAccountToken2022Program,\n TAccountAtaProgram extends string\n ? ReadonlyAccount\n : TAccountAtaProgram,\n TAccountPayer extends string\n ? WritableSignerAccount &\n IAccountSignerMeta\n : TAccountPayer,\n TAccountVendor extends string\n ? ReadonlyAccount\n : TAccountVendor,\n TAccountProductMint extends string\n ? ReadonlyAccount\n : TAccountProductMint,\n TAccountProductAssociatedToken extends string\n ? ReadonlyAccount\n : TAccountProductAssociatedToken,\n TAccountDevice extends string\n ? ReadonlyAccount\n : TAccountDevice,\n TAccountDeviceMint extends string\n ? WritableAccount\n : TAccountDeviceMint,\n TAccountDeviceAssociatedToken extends string\n ? WritableAccount\n : TAccountDeviceAssociatedToken,\n TAccountOwner extends string\n ? ReadonlyAccount\n : TAccountOwner,\n ...TRemainingAccounts,\n ]\n >;\n\nexport type ActivateDeviceInstructionData = {\n discriminator: number;\n signature: DeviceActivationSignature;\n timestamp: bigint;\n};\n\nexport type ActivateDeviceInstructionDataArgs = {\n signature: DeviceActivationSignatureArgs;\n timestamp: number | bigint;\n};\n\nexport function getActivateDeviceInstructionDataEncoder(): Encoder {\n return transformEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['signature', getDeviceActivationSignatureEncoder()],\n ['timestamp', getU64Encoder()],\n ]),\n (value) => ({ ...value, discriminator: 3 })\n );\n}\n\nexport function getActivateDeviceInstructionDataDecoder(): Decoder {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['signature', getDeviceActivationSignatureDecoder()],\n ['timestamp', getU64Decoder()],\n ]);\n}\n\nexport function getActivateDeviceInstructionDataCodec(): Codec<\n ActivateDeviceInstructionDataArgs,\n ActivateDeviceInstructionData\n> {\n return combineCodec(\n getActivateDeviceInstructionDataEncoder(),\n getActivateDeviceInstructionDataDecoder()\n );\n}\n\nexport type ActivateDeviceInput<\n TAccountSystemProgram extends string = string,\n TAccountToken2022Program extends string = string,\n TAccountAtaProgram extends string = string,\n TAccountPayer extends string = string,\n TAccountVendor extends string = string,\n TAccountProductMint extends string = string,\n TAccountProductAssociatedToken extends string = string,\n TAccountDevice extends string = string,\n TAccountDeviceMint extends string = string,\n TAccountDeviceAssociatedToken extends string = string,\n TAccountOwner extends string = string,\n> = {\n /** The system program */\n systemProgram?: Address;\n /** The SPL Token 2022 program */\n token2022Program: Address;\n /** The associated token program */\n ataProgram?: Address;\n /** The account paying for the storage fees */\n payer: TransactionSigner;\n /** The vendor */\n vendor: Address;\n /** The mint account for the product */\n productMint: Address;\n /** The associated token account for the product */\n productAssociatedToken: Address;\n /** The device */\n device: Address;\n /** The mint account for the device */\n deviceMint: Address;\n /** The associated token account for the device */\n deviceAssociatedToken: Address;\n /** The device's owner */\n owner: Address;\n signature: ActivateDeviceInstructionDataArgs['signature'];\n timestamp: ActivateDeviceInstructionDataArgs['timestamp'];\n};\n\nexport function getActivateDeviceInstruction<\n TAccountSystemProgram extends string,\n TAccountToken2022Program extends string,\n TAccountAtaProgram extends string,\n TAccountPayer extends string,\n TAccountVendor extends string,\n TAccountProductMint extends string,\n TAccountProductAssociatedToken extends string,\n TAccountDevice extends string,\n TAccountDeviceMint extends string,\n TAccountDeviceAssociatedToken extends string,\n TAccountOwner extends string,\n>(\n input: ActivateDeviceInput<\n TAccountSystemProgram,\n TAccountToken2022Program,\n TAccountAtaProgram,\n TAccountPayer,\n TAccountVendor,\n TAccountProductMint,\n TAccountProductAssociatedToken,\n TAccountDevice,\n TAccountDeviceMint,\n TAccountDeviceAssociatedToken,\n TAccountOwner\n >\n): ActivateDeviceInstruction<\n typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountSystemProgram,\n TAccountToken2022Program,\n TAccountAtaProgram,\n TAccountPayer,\n TAccountVendor,\n TAccountProductMint,\n TAccountProductAssociatedToken,\n TAccountDevice,\n TAccountDeviceMint,\n TAccountDeviceAssociatedToken,\n TAccountOwner\n> {\n // Program address.\n const programAddress = DEPHY_ID_PROGRAM_ADDRESS;\n\n // Original accounts.\n const originalAccounts = {\n systemProgram: { value: input.systemProgram ?? null, isWritable: false },\n token2022Program: {\n value: input.token2022Program ?? null,\n isWritable: false,\n },\n ataProgram: { value: input.ataProgram ?? null, isWritable: false },\n payer: { value: input.payer ?? null, isWritable: true },\n vendor: { value: input.vendor ?? null, isWritable: false },\n productMint: { value: input.productMint ?? null, isWritable: false },\n productAssociatedToken: {\n value: input.productAssociatedToken ?? null,\n isWritable: false,\n },\n device: { value: input.device ?? null, isWritable: false },\n deviceMint: { value: input.deviceMint ?? null, isWritable: true },\n deviceAssociatedToken: {\n value: input.deviceAssociatedToken ?? null,\n isWritable: true,\n },\n owner: { value: input.owner ?? null, isWritable: false },\n };\n const accounts = originalAccounts as Record<\n keyof typeof originalAccounts,\n ResolvedAccount\n >;\n\n // Original args.\n const args = { ...input };\n\n // Resolve default values.\n if (!accounts.systemProgram.value) {\n accounts.systemProgram.value =\n '11111111111111111111111111111111' as Address<'11111111111111111111111111111111'>;\n }\n if (!accounts.ataProgram.value) {\n accounts.ataProgram.value =\n 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL' as Address<'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL'>;\n }\n\n const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');\n const instruction = {\n accounts: [\n getAccountMeta(accounts.systemProgram),\n getAccountMeta(accounts.token2022Program),\n getAccountMeta(accounts.ataProgram),\n getAccountMeta(accounts.payer),\n getAccountMeta(accounts.vendor),\n getAccountMeta(accounts.productMint),\n getAccountMeta(accounts.productAssociatedToken),\n getAccountMeta(accounts.device),\n getAccountMeta(accounts.deviceMint),\n getAccountMeta(accounts.deviceAssociatedToken),\n getAccountMeta(accounts.owner),\n ],\n programAddress,\n data: getActivateDeviceInstructionDataEncoder().encode(\n args as ActivateDeviceInstructionDataArgs\n ),\n } as ActivateDeviceInstruction<\n typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountSystemProgram,\n TAccountToken2022Program,\n TAccountAtaProgram,\n TAccountPayer,\n TAccountVendor,\n TAccountProductMint,\n TAccountProductAssociatedToken,\n TAccountDevice,\n TAccountDeviceMint,\n TAccountDeviceAssociatedToken,\n TAccountOwner\n >;\n\n return instruction;\n}\n\nexport type ParsedActivateDeviceInstruction<\n TProgram extends string = typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[],\n> = {\n programAddress: Address;\n accounts: {\n /** The system program */\n systemProgram: TAccountMetas[0];\n /** The SPL Token 2022 program */\n token2022Program: TAccountMetas[1];\n /** The associated token program */\n ataProgram: TAccountMetas[2];\n /** The account paying for the storage fees */\n payer: TAccountMetas[3];\n /** The vendor */\n vendor: TAccountMetas[4];\n /** The mint account for the product */\n productMint: TAccountMetas[5];\n /** The associated token account for the product */\n productAssociatedToken: TAccountMetas[6];\n /** The device */\n device: TAccountMetas[7];\n /** The mint account for the device */\n deviceMint: TAccountMetas[8];\n /** The associated token account for the device */\n deviceAssociatedToken: TAccountMetas[9];\n /** The device's owner */\n owner: TAccountMetas[10];\n };\n data: ActivateDeviceInstructionData;\n};\n\nexport function parseActivateDeviceInstruction<\n TProgram extends string,\n TAccountMetas extends readonly IAccountMeta[],\n>(\n instruction: IInstruction &\n IInstructionWithAccounts &\n IInstructionWithData\n): ParsedActivateDeviceInstruction {\n if (instruction.accounts.length < 11) {\n // TODO: Coded error.\n throw new Error('Not enough accounts');\n }\n let accountIndex = 0;\n const getNextAccount = () => {\n const accountMeta = instruction.accounts![accountIndex]!;\n accountIndex += 1;\n return accountMeta;\n };\n return {\n programAddress: instruction.programAddress,\n accounts: {\n systemProgram: getNextAccount(),\n token2022Program: getNextAccount(),\n ataProgram: getNextAccount(),\n payer: getNextAccount(),\n vendor: getNextAccount(),\n productMint: getNextAccount(),\n productAssociatedToken: getNextAccount(),\n device: getNextAccount(),\n deviceMint: getNextAccount(),\n deviceAssociatedToken: getNextAccount(),\n owner: getNextAccount(),\n },\n data: getActivateDeviceInstructionDataDecoder().decode(instruction.data),\n };\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport { containsBytes, getU8Encoder, type Address } from '@solana/web3.js';\nimport {\n type ParsedActivateDeviceInstruction,\n type ParsedCreateDeviceInstruction,\n type ParsedCreateProductInstruction,\n type ParsedInitializeInstruction,\n} from '../instructions';\nimport { Key, getKeyEncoder } from '../types';\n\nexport const DEPHY_ID_PROGRAM_ADDRESS =\n 'hdMghjD73uASxgJXi6e1mGPsXqnADMsrqB1bveqABP1' as Address<'hdMghjD73uASxgJXi6e1mGPsXqnADMsrqB1bveqABP1'>;\n\nexport enum DephyIdAccount {\n ProgramDataAccount,\n}\n\nexport function identifyDephyIdAccount(\n account: { data: Uint8Array } | Uint8Array\n): DephyIdAccount {\n const data = account instanceof Uint8Array ? account : account.data;\n if (containsBytes(data, getKeyEncoder().encode(Key.ProgramDataAccount), 0)) {\n return DephyIdAccount.ProgramDataAccount;\n }\n throw new Error(\n 'The provided account could not be identified as a dephyId account.'\n );\n}\n\nexport enum DephyIdInstruction {\n Initialize,\n CreateProduct,\n CreateDevice,\n ActivateDevice,\n}\n\nexport function identifyDephyIdInstruction(\n instruction: { data: Uint8Array } | Uint8Array\n): DephyIdInstruction {\n const data =\n instruction instanceof Uint8Array ? instruction : instruction.data;\n if (containsBytes(data, getU8Encoder().encode(0), 0)) {\n return DephyIdInstruction.Initialize;\n }\n if (containsBytes(data, getU8Encoder().encode(1), 0)) {\n return DephyIdInstruction.CreateProduct;\n }\n if (containsBytes(data, getU8Encoder().encode(2), 0)) {\n return DephyIdInstruction.CreateDevice;\n }\n if (containsBytes(data, getU8Encoder().encode(3), 0)) {\n return DephyIdInstruction.ActivateDevice;\n }\n throw new Error(\n 'The provided instruction could not be identified as a dephyId instruction.'\n );\n}\n\nexport type ParsedDephyIdInstruction<\n TProgram extends string = 'hdMghjD73uASxgJXi6e1mGPsXqnADMsrqB1bveqABP1',\n> =\n | ({\n instructionType: DephyIdInstruction.Initialize;\n } & ParsedInitializeInstruction)\n | ({\n instructionType: DephyIdInstruction.CreateProduct;\n } & ParsedCreateProductInstruction)\n | ({\n instructionType: DephyIdInstruction.CreateDevice;\n } & ParsedCreateDeviceInstruction)\n | ({\n instructionType: DephyIdInstruction.ActivateDevice;\n } & ParsedActivateDeviceInstruction);\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport {\n AccountRole,\n isProgramDerivedAddress,\n isTransactionSigner as web3JsIsTransactionSigner,\n type Address,\n type IAccountMeta,\n type IAccountSignerMeta,\n type ProgramDerivedAddress,\n type TransactionSigner,\n upgradeRoleToSigner,\n} from '@solana/web3.js';\n\n/**\n * Asserts that the given value is not null or undefined.\n * @internal\n */\nexport function expectSome(value: T | null | undefined): T {\n if (value == null) {\n throw new Error('Expected a value but received null or undefined.');\n }\n return value;\n}\n\n/**\n * Asserts that the given value is a PublicKey.\n * @internal\n */\nexport function expectAddress(\n value:\n | Address\n | ProgramDerivedAddress\n | TransactionSigner\n | null\n | undefined\n): Address {\n if (!value) {\n throw new Error('Expected a Address.');\n }\n if (typeof value === 'object' && 'address' in value) {\n return value.address;\n }\n if (Array.isArray(value)) {\n return value[0];\n }\n return value as Address;\n}\n\n/**\n * Asserts that the given value is a PDA.\n * @internal\n */\nexport function expectProgramDerivedAddress(\n value:\n | Address\n | ProgramDerivedAddress\n | TransactionSigner\n | null\n | undefined\n): ProgramDerivedAddress {\n if (!value || !Array.isArray(value) || !isProgramDerivedAddress(value)) {\n throw new Error('Expected a ProgramDerivedAddress.');\n }\n return value;\n}\n\n/**\n * Asserts that the given value is a TransactionSigner.\n * @internal\n */\nexport function expectTransactionSigner(\n value:\n | Address\n | ProgramDerivedAddress\n | TransactionSigner\n | null\n | undefined\n): TransactionSigner {\n if (!value || !isTransactionSigner(value)) {\n throw new Error('Expected a TransactionSigner.');\n }\n return value;\n}\n\n/**\n * Defines an instruction account to resolve.\n * @internal\n */\nexport type ResolvedAccount<\n T extends string = string,\n U extends\n | Address\n | ProgramDerivedAddress\n | TransactionSigner\n | null =\n | Address\n | ProgramDerivedAddress\n | TransactionSigner\n | null,\n> = {\n isWritable: boolean;\n value: U;\n};\n\n/**\n * Defines an instruction that stores additional bytes on-chain.\n * @internal\n */\nexport type IInstructionWithByteDelta = {\n byteDelta: number;\n};\n\n/**\n * Get account metas and signers from resolved accounts.\n * @internal\n */\nexport function getAccountMetaFactory(\n programAddress: Address,\n optionalAccountStrategy: 'omitted' | 'programId'\n) {\n return (\n account: ResolvedAccount\n ): IAccountMeta | IAccountSignerMeta | undefined => {\n if (!account.value) {\n if (optionalAccountStrategy === 'omitted') return;\n return Object.freeze({\n address: programAddress,\n role: AccountRole.READONLY,\n });\n }\n\n const writableRole = account.isWritable\n ? AccountRole.WRITABLE\n : AccountRole.READONLY;\n return Object.freeze({\n address: expectAddress(account.value),\n role: isTransactionSigner(account.value)\n ? upgradeRoleToSigner(writableRole)\n : writableRole,\n ...(isTransactionSigner(account.value) ? { signer: account.value } : {}),\n });\n };\n}\n\nexport function isTransactionSigner(\n value:\n | Address\n | ProgramDerivedAddress\n | TransactionSigner\n): value is TransactionSigner {\n return (\n !!value &&\n typeof value === 'object' &&\n 'address' in value &&\n web3JsIsTransactionSigner(value)\n );\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport {\n addDecoderSizePrefix,\n addEncoderSizePrefix,\n combineCodec,\n getArrayDecoder,\n getArrayEncoder,\n getStructDecoder,\n getStructEncoder,\n getTupleDecoder,\n getTupleEncoder,\n getU32Decoder,\n getU32Encoder,\n getU8Decoder,\n getU8Encoder,\n getUtf8Decoder,\n getUtf8Encoder,\n transformEncoder,\n type Address,\n type Codec,\n type Decoder,\n type Encoder,\n type IAccountMeta,\n type IAccountSignerMeta,\n type IInstruction,\n type IInstructionWithAccounts,\n type IInstructionWithData,\n type ReadonlyAccount,\n type ReadonlySignerAccount,\n type TransactionSigner,\n type WritableAccount,\n type WritableSignerAccount,\n} from '@solana/web3.js';\nimport { DEPHY_ID_PROGRAM_ADDRESS } from '../programs';\nimport { getAccountMetaFactory, type ResolvedAccount } from '../shared';\nimport {\n getDeviceSigningAlgorithmDecoder,\n getDeviceSigningAlgorithmEncoder,\n type DeviceSigningAlgorithm,\n type DeviceSigningAlgorithmArgs,\n} from '../types';\n\nexport type CreateDeviceInstruction<\n TProgram extends string = typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountSystemProgram extends\n | string\n | IAccountMeta = '11111111111111111111111111111111',\n TAccountToken2022Program extends\n | string\n | IAccountMeta = 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb',\n TAccountAtaProgram extends\n | string\n | IAccountMeta = 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL',\n TAccountPayer extends string | IAccountMeta = string,\n TAccountVendor extends string | IAccountMeta = string,\n TAccountProductMint extends string | IAccountMeta = string,\n TAccountProductAssociatedToken extends string | IAccountMeta = string,\n TAccountDevice extends string | IAccountMeta = string,\n TAccountDeviceMint extends string | IAccountMeta = string,\n TRemainingAccounts extends readonly IAccountMeta[] = [],\n> = IInstruction &\n IInstructionWithData &\n IInstructionWithAccounts<\n [\n TAccountSystemProgram extends string\n ? ReadonlyAccount\n : TAccountSystemProgram,\n TAccountToken2022Program extends string\n ? ReadonlyAccount\n : TAccountToken2022Program,\n TAccountAtaProgram extends string\n ? ReadonlyAccount\n : TAccountAtaProgram,\n TAccountPayer extends string\n ? WritableSignerAccount &\n IAccountSignerMeta\n : TAccountPayer,\n TAccountVendor extends string\n ? ReadonlySignerAccount &\n IAccountSignerMeta\n : TAccountVendor,\n TAccountProductMint extends string\n ? WritableAccount\n : TAccountProductMint,\n TAccountProductAssociatedToken extends string\n ? WritableAccount\n : TAccountProductAssociatedToken,\n TAccountDevice extends string\n ? ReadonlyAccount\n : TAccountDevice,\n TAccountDeviceMint extends string\n ? WritableAccount\n : TAccountDeviceMint,\n ...TRemainingAccounts,\n ]\n >;\n\nexport type CreateDeviceInstructionData = {\n discriminator: number;\n name: string;\n uri: string;\n additionalMetadata: Array;\n signingAlg: DeviceSigningAlgorithm;\n};\n\nexport type CreateDeviceInstructionDataArgs = {\n name: string;\n uri: string;\n additionalMetadata: Array;\n signingAlg: DeviceSigningAlgorithmArgs;\n};\n\nexport function getCreateDeviceInstructionDataEncoder(): Encoder {\n return transformEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['name', addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())],\n ['uri', addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())],\n [\n 'additionalMetadata',\n getArrayEncoder(\n getTupleEncoder([\n addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder()),\n addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder()),\n ])\n ),\n ],\n ['signingAlg', getDeviceSigningAlgorithmEncoder()],\n ]),\n (value) => ({ ...value, discriminator: 2 })\n );\n}\n\nexport function getCreateDeviceInstructionDataDecoder(): Decoder {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['name', addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())],\n ['uri', addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())],\n [\n 'additionalMetadata',\n getArrayDecoder(\n getTupleDecoder([\n addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder()),\n addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder()),\n ])\n ),\n ],\n ['signingAlg', getDeviceSigningAlgorithmDecoder()],\n ]);\n}\n\nexport function getCreateDeviceInstructionDataCodec(): Codec<\n CreateDeviceInstructionDataArgs,\n CreateDeviceInstructionData\n> {\n return combineCodec(\n getCreateDeviceInstructionDataEncoder(),\n getCreateDeviceInstructionDataDecoder()\n );\n}\n\nexport type CreateDeviceInput<\n TAccountSystemProgram extends string = string,\n TAccountToken2022Program extends string = string,\n TAccountAtaProgram extends string = string,\n TAccountPayer extends string = string,\n TAccountVendor extends string = string,\n TAccountProductMint extends string = string,\n TAccountProductAssociatedToken extends string = string,\n TAccountDevice extends string = string,\n TAccountDeviceMint extends string = string,\n> = {\n /** The system program */\n systemProgram?: Address;\n /** The SPL Token 2022 program */\n token2022Program?: Address;\n /** The associated token program */\n ataProgram?: Address;\n /** The account paying for the storage fees */\n payer: TransactionSigner;\n /** The vendor */\n vendor: TransactionSigner;\n /** The mint account of the product */\n productMint: Address;\n /** The associated token account of the product */\n productAssociatedToken: Address;\n /** The device */\n device: Address;\n /** The mint account of the device */\n deviceMint: Address;\n name: CreateDeviceInstructionDataArgs['name'];\n uri: CreateDeviceInstructionDataArgs['uri'];\n additionalMetadata: CreateDeviceInstructionDataArgs['additionalMetadata'];\n signingAlg: CreateDeviceInstructionDataArgs['signingAlg'];\n};\n\nexport function getCreateDeviceInstruction<\n TAccountSystemProgram extends string,\n TAccountToken2022Program extends string,\n TAccountAtaProgram extends string,\n TAccountPayer extends string,\n TAccountVendor extends string,\n TAccountProductMint extends string,\n TAccountProductAssociatedToken extends string,\n TAccountDevice extends string,\n TAccountDeviceMint extends string,\n>(\n input: CreateDeviceInput<\n TAccountSystemProgram,\n TAccountToken2022Program,\n TAccountAtaProgram,\n TAccountPayer,\n TAccountVendor,\n TAccountProductMint,\n TAccountProductAssociatedToken,\n TAccountDevice,\n TAccountDeviceMint\n >\n): CreateDeviceInstruction<\n typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountSystemProgram,\n TAccountToken2022Program,\n TAccountAtaProgram,\n TAccountPayer,\n TAccountVendor,\n TAccountProductMint,\n TAccountProductAssociatedToken,\n TAccountDevice,\n TAccountDeviceMint\n> {\n // Program address.\n const programAddress = DEPHY_ID_PROGRAM_ADDRESS;\n\n // Original accounts.\n const originalAccounts = {\n systemProgram: { value: input.systemProgram ?? null, isWritable: false },\n token2022Program: {\n value: input.token2022Program ?? null,\n isWritable: false,\n },\n ataProgram: { value: input.ataProgram ?? null, isWritable: false },\n payer: { value: input.payer ?? null, isWritable: true },\n vendor: { value: input.vendor ?? null, isWritable: false },\n productMint: { value: input.productMint ?? null, isWritable: true },\n productAssociatedToken: {\n value: input.productAssociatedToken ?? null,\n isWritable: true,\n },\n device: { value: input.device ?? null, isWritable: false },\n deviceMint: { value: input.deviceMint ?? null, isWritable: true },\n };\n const accounts = originalAccounts as Record<\n keyof typeof originalAccounts,\n ResolvedAccount\n >;\n\n // Original args.\n const args = { ...input };\n\n // Resolve default values.\n if (!accounts.systemProgram.value) {\n accounts.systemProgram.value =\n '11111111111111111111111111111111' as Address<'11111111111111111111111111111111'>;\n }\n if (!accounts.token2022Program.value) {\n accounts.token2022Program.value =\n 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb' as Address<'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb'>;\n }\n if (!accounts.ataProgram.value) {\n accounts.ataProgram.value =\n 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL' as Address<'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL'>;\n }\n\n const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');\n const instruction = {\n accounts: [\n getAccountMeta(accounts.systemProgram),\n getAccountMeta(accounts.token2022Program),\n getAccountMeta(accounts.ataProgram),\n getAccountMeta(accounts.payer),\n getAccountMeta(accounts.vendor),\n getAccountMeta(accounts.productMint),\n getAccountMeta(accounts.productAssociatedToken),\n getAccountMeta(accounts.device),\n getAccountMeta(accounts.deviceMint),\n ],\n programAddress,\n data: getCreateDeviceInstructionDataEncoder().encode(\n args as CreateDeviceInstructionDataArgs\n ),\n } as CreateDeviceInstruction<\n typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountSystemProgram,\n TAccountToken2022Program,\n TAccountAtaProgram,\n TAccountPayer,\n TAccountVendor,\n TAccountProductMint,\n TAccountProductAssociatedToken,\n TAccountDevice,\n TAccountDeviceMint\n >;\n\n return instruction;\n}\n\nexport type ParsedCreateDeviceInstruction<\n TProgram extends string = typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[],\n> = {\n programAddress: Address;\n accounts: {\n /** The system program */\n systemProgram: TAccountMetas[0];\n /** The SPL Token 2022 program */\n token2022Program: TAccountMetas[1];\n /** The associated token program */\n ataProgram: TAccountMetas[2];\n /** The account paying for the storage fees */\n payer: TAccountMetas[3];\n /** The vendor */\n vendor: TAccountMetas[4];\n /** The mint account of the product */\n productMint: TAccountMetas[5];\n /** The associated token account of the product */\n productAssociatedToken: TAccountMetas[6];\n /** The device */\n device: TAccountMetas[7];\n /** The mint account of the device */\n deviceMint: TAccountMetas[8];\n };\n data: CreateDeviceInstructionData;\n};\n\nexport function parseCreateDeviceInstruction<\n TProgram extends string,\n TAccountMetas extends readonly IAccountMeta[],\n>(\n instruction: IInstruction &\n IInstructionWithAccounts &\n IInstructionWithData\n): ParsedCreateDeviceInstruction {\n if (instruction.accounts.length < 9) {\n // TODO: Coded error.\n throw new Error('Not enough accounts');\n }\n let accountIndex = 0;\n const getNextAccount = () => {\n const accountMeta = instruction.accounts![accountIndex]!;\n accountIndex += 1;\n return accountMeta;\n };\n return {\n programAddress: instruction.programAddress,\n accounts: {\n systemProgram: getNextAccount(),\n token2022Program: getNextAccount(),\n ataProgram: getNextAccount(),\n payer: getNextAccount(),\n vendor: getNextAccount(),\n productMint: getNextAccount(),\n productAssociatedToken: getNextAccount(),\n device: getNextAccount(),\n deviceMint: getNextAccount(),\n },\n data: getCreateDeviceInstructionDataDecoder().decode(instruction.data),\n };\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport {\n addDecoderSizePrefix,\n addEncoderSizePrefix,\n combineCodec,\n getArrayDecoder,\n getArrayEncoder,\n getStructDecoder,\n getStructEncoder,\n getTupleDecoder,\n getTupleEncoder,\n getU32Decoder,\n getU32Encoder,\n getU8Decoder,\n getU8Encoder,\n getUtf8Decoder,\n getUtf8Encoder,\n transformEncoder,\n type Address,\n type Codec,\n type Decoder,\n type Encoder,\n type IAccountMeta,\n type IAccountSignerMeta,\n type IInstruction,\n type IInstructionWithAccounts,\n type IInstructionWithData,\n type ReadonlyAccount,\n type ReadonlySignerAccount,\n type TransactionSigner,\n type WritableAccount,\n type WritableSignerAccount,\n} from '@solana/web3.js';\nimport { DEPHY_ID_PROGRAM_ADDRESS } from '../programs';\nimport { getAccountMetaFactory, type ResolvedAccount } from '../shared';\n\nexport type CreateProductInstruction<\n TProgram extends string = typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountSystemProgram extends\n | string\n | IAccountMeta = '11111111111111111111111111111111',\n TAccountToken2022Program extends\n | string\n | IAccountMeta = 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb',\n TAccountPayer extends string | IAccountMeta = string,\n TAccountVendor extends string | IAccountMeta = string,\n TAccountProductMint extends string | IAccountMeta = string,\n TRemainingAccounts extends readonly IAccountMeta[] = [],\n> = IInstruction &\n IInstructionWithData &\n IInstructionWithAccounts<\n [\n TAccountSystemProgram extends string\n ? ReadonlyAccount\n : TAccountSystemProgram,\n TAccountToken2022Program extends string\n ? ReadonlyAccount\n : TAccountToken2022Program,\n TAccountPayer extends string\n ? WritableSignerAccount &\n IAccountSignerMeta\n : TAccountPayer,\n TAccountVendor extends string\n ? ReadonlySignerAccount &\n IAccountSignerMeta\n : TAccountVendor,\n TAccountProductMint extends string\n ? WritableAccount\n : TAccountProductMint,\n ...TRemainingAccounts,\n ]\n >;\n\nexport type CreateProductInstructionData = {\n discriminator: number;\n name: string;\n symbol: string;\n uri: string;\n additionalMetadata: Array;\n};\n\nexport type CreateProductInstructionDataArgs = {\n name: string;\n symbol: string;\n uri: string;\n additionalMetadata: Array;\n};\n\nexport function getCreateProductInstructionDataEncoder(): Encoder {\n return transformEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['name', addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())],\n ['symbol', addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())],\n ['uri', addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())],\n [\n 'additionalMetadata',\n getArrayEncoder(\n getTupleEncoder([\n addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder()),\n addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder()),\n ])\n ),\n ],\n ]),\n (value) => ({ ...value, discriminator: 1 })\n );\n}\n\nexport function getCreateProductInstructionDataDecoder(): Decoder {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['name', addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())],\n ['symbol', addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())],\n ['uri', addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())],\n [\n 'additionalMetadata',\n getArrayDecoder(\n getTupleDecoder([\n addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder()),\n addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder()),\n ])\n ),\n ],\n ]);\n}\n\nexport function getCreateProductInstructionDataCodec(): Codec<\n CreateProductInstructionDataArgs,\n CreateProductInstructionData\n> {\n return combineCodec(\n getCreateProductInstructionDataEncoder(),\n getCreateProductInstructionDataDecoder()\n );\n}\n\nexport type CreateProductInput<\n TAccountSystemProgram extends string = string,\n TAccountToken2022Program extends string = string,\n TAccountPayer extends string = string,\n TAccountVendor extends string = string,\n TAccountProductMint extends string = string,\n> = {\n /** The system program */\n systemProgram?: Address;\n /** The SPL Token 2022 program */\n token2022Program?: Address;\n /** The account paying for the storage fees */\n payer: TransactionSigner;\n /** The vendor */\n vendor: TransactionSigner;\n /** The mint account of the product */\n productMint: Address;\n name: CreateProductInstructionDataArgs['name'];\n symbol: CreateProductInstructionDataArgs['symbol'];\n uri: CreateProductInstructionDataArgs['uri'];\n additionalMetadata: CreateProductInstructionDataArgs['additionalMetadata'];\n};\n\nexport function getCreateProductInstruction<\n TAccountSystemProgram extends string,\n TAccountToken2022Program extends string,\n TAccountPayer extends string,\n TAccountVendor extends string,\n TAccountProductMint extends string,\n>(\n input: CreateProductInput<\n TAccountSystemProgram,\n TAccountToken2022Program,\n TAccountPayer,\n TAccountVendor,\n TAccountProductMint\n >\n): CreateProductInstruction<\n typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountSystemProgram,\n TAccountToken2022Program,\n TAccountPayer,\n TAccountVendor,\n TAccountProductMint\n> {\n // Program address.\n const programAddress = DEPHY_ID_PROGRAM_ADDRESS;\n\n // Original accounts.\n const originalAccounts = {\n systemProgram: { value: input.systemProgram ?? null, isWritable: false },\n token2022Program: {\n value: input.token2022Program ?? null,\n isWritable: false,\n },\n payer: { value: input.payer ?? null, isWritable: true },\n vendor: { value: input.vendor ?? null, isWritable: false },\n productMint: { value: input.productMint ?? null, isWritable: true },\n };\n const accounts = originalAccounts as Record<\n keyof typeof originalAccounts,\n ResolvedAccount\n >;\n\n // Original args.\n const args = { ...input };\n\n // Resolve default values.\n if (!accounts.systemProgram.value) {\n accounts.systemProgram.value =\n '11111111111111111111111111111111' as Address<'11111111111111111111111111111111'>;\n }\n if (!accounts.token2022Program.value) {\n accounts.token2022Program.value =\n 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb' as Address<'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb'>;\n }\n\n const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');\n const instruction = {\n accounts: [\n getAccountMeta(accounts.systemProgram),\n getAccountMeta(accounts.token2022Program),\n getAccountMeta(accounts.payer),\n getAccountMeta(accounts.vendor),\n getAccountMeta(accounts.productMint),\n ],\n programAddress,\n data: getCreateProductInstructionDataEncoder().encode(\n args as CreateProductInstructionDataArgs\n ),\n } as CreateProductInstruction<\n typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountSystemProgram,\n TAccountToken2022Program,\n TAccountPayer,\n TAccountVendor,\n TAccountProductMint\n >;\n\n return instruction;\n}\n\nexport type ParsedCreateProductInstruction<\n TProgram extends string = typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[],\n> = {\n programAddress: Address;\n accounts: {\n /** The system program */\n systemProgram: TAccountMetas[0];\n /** The SPL Token 2022 program */\n token2022Program: TAccountMetas[1];\n /** The account paying for the storage fees */\n payer: TAccountMetas[2];\n /** The vendor */\n vendor: TAccountMetas[3];\n /** The mint account of the product */\n productMint: TAccountMetas[4];\n };\n data: CreateProductInstructionData;\n};\n\nexport function parseCreateProductInstruction<\n TProgram extends string,\n TAccountMetas extends readonly IAccountMeta[],\n>(\n instruction: IInstruction &\n IInstructionWithAccounts &\n IInstructionWithData\n): ParsedCreateProductInstruction {\n if (instruction.accounts.length < 5) {\n // TODO: Coded error.\n throw new Error('Not enough accounts');\n }\n let accountIndex = 0;\n const getNextAccount = () => {\n const accountMeta = instruction.accounts![accountIndex]!;\n accountIndex += 1;\n return accountMeta;\n };\n return {\n programAddress: instruction.programAddress,\n accounts: {\n systemProgram: getNextAccount(),\n token2022Program: getNextAccount(),\n payer: getNextAccount(),\n vendor: getNextAccount(),\n productMint: getNextAccount(),\n },\n data: getCreateProductInstructionDataDecoder().decode(instruction.data),\n };\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport {\n combineCodec,\n getStructDecoder,\n getStructEncoder,\n getU8Decoder,\n getU8Encoder,\n transformEncoder,\n type Address,\n type Codec,\n type Decoder,\n type Encoder,\n type IAccountMeta,\n type IAccountSignerMeta,\n type IInstruction,\n type IInstructionWithAccounts,\n type IInstructionWithData,\n type ReadonlyAccount,\n type ReadonlySignerAccount,\n type TransactionSigner,\n type WritableAccount,\n type WritableSignerAccount,\n} from '@solana/web3.js';\nimport { DEPHY_ID_PROGRAM_ADDRESS } from '../programs';\nimport { getAccountMetaFactory, type ResolvedAccount } from '../shared';\n\nexport type InitializeInstruction<\n TProgram extends string = typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountSystemProgram extends\n | string\n | IAccountMeta = '11111111111111111111111111111111',\n TAccountPayer extends string | IAccountMeta = string,\n TAccountProgramData extends string | IAccountMeta = string,\n TAccountAuthority extends string | IAccountMeta = string,\n TRemainingAccounts extends readonly IAccountMeta[] = [],\n> = IInstruction &\n IInstructionWithData &\n IInstructionWithAccounts<\n [\n TAccountSystemProgram extends string\n ? ReadonlyAccount\n : TAccountSystemProgram,\n TAccountPayer extends string\n ? WritableSignerAccount &\n IAccountSignerMeta\n : TAccountPayer,\n TAccountProgramData extends string\n ? WritableAccount\n : TAccountProgramData,\n TAccountAuthority extends string\n ? ReadonlySignerAccount &\n IAccountSignerMeta\n : TAccountAuthority,\n ...TRemainingAccounts,\n ]\n >;\n\nexport type InitializeInstructionData = { discriminator: number; bump: number };\n\nexport type InitializeInstructionDataArgs = { bump: number };\n\nexport function getInitializeInstructionDataEncoder(): Encoder {\n return transformEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['bump', getU8Encoder()],\n ]),\n (value) => ({ ...value, discriminator: 0 })\n );\n}\n\nexport function getInitializeInstructionDataDecoder(): Decoder {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['bump', getU8Decoder()],\n ]);\n}\n\nexport function getInitializeInstructionDataCodec(): Codec<\n InitializeInstructionDataArgs,\n InitializeInstructionData\n> {\n return combineCodec(\n getInitializeInstructionDataEncoder(),\n getInitializeInstructionDataDecoder()\n );\n}\n\nexport type InitializeInput<\n TAccountSystemProgram extends string = string,\n TAccountPayer extends string = string,\n TAccountProgramData extends string = string,\n TAccountAuthority extends string = string,\n> = {\n /** The system program */\n systemProgram?: Address;\n /** The account paying for the storage fees */\n payer: TransactionSigner;\n /** The program data account for the program */\n programData: Address;\n /** The authority account of the program */\n authority: TransactionSigner;\n bump: InitializeInstructionDataArgs['bump'];\n};\n\nexport function getInitializeInstruction<\n TAccountSystemProgram extends string,\n TAccountPayer extends string,\n TAccountProgramData extends string,\n TAccountAuthority extends string,\n>(\n input: InitializeInput<\n TAccountSystemProgram,\n TAccountPayer,\n TAccountProgramData,\n TAccountAuthority\n >\n): InitializeInstruction<\n typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountSystemProgram,\n TAccountPayer,\n TAccountProgramData,\n TAccountAuthority\n> {\n // Program address.\n const programAddress = DEPHY_ID_PROGRAM_ADDRESS;\n\n // Original accounts.\n const originalAccounts = {\n systemProgram: { value: input.systemProgram ?? null, isWritable: false },\n payer: { value: input.payer ?? null, isWritable: true },\n programData: { value: input.programData ?? null, isWritable: true },\n authority: { value: input.authority ?? null, isWritable: false },\n };\n const accounts = originalAccounts as Record<\n keyof typeof originalAccounts,\n ResolvedAccount\n >;\n\n // Original args.\n const args = { ...input };\n\n // Resolve default values.\n if (!accounts.systemProgram.value) {\n accounts.systemProgram.value =\n '11111111111111111111111111111111' as Address<'11111111111111111111111111111111'>;\n }\n\n const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');\n const instruction = {\n accounts: [\n getAccountMeta(accounts.systemProgram),\n getAccountMeta(accounts.payer),\n getAccountMeta(accounts.programData),\n getAccountMeta(accounts.authority),\n ],\n programAddress,\n data: getInitializeInstructionDataEncoder().encode(\n args as InitializeInstructionDataArgs\n ),\n } as InitializeInstruction<\n typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountSystemProgram,\n TAccountPayer,\n TAccountProgramData,\n TAccountAuthority\n >;\n\n return instruction;\n}\n\nexport type ParsedInitializeInstruction<\n TProgram extends string = typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[],\n> = {\n programAddress: Address;\n accounts: {\n /** The system program */\n systemProgram: TAccountMetas[0];\n /** The account paying for the storage fees */\n payer: TAccountMetas[1];\n /** The program data account for the program */\n programData: TAccountMetas[2];\n /** The authority account of the program */\n authority: TAccountMetas[3];\n };\n data: InitializeInstructionData;\n};\n\nexport function parseInitializeInstruction<\n TProgram extends string,\n TAccountMetas extends readonly IAccountMeta[],\n>(\n instruction: IInstruction &\n IInstructionWithAccounts &\n IInstructionWithData\n): ParsedInitializeInstruction {\n if (instruction.accounts.length < 4) {\n // TODO: Coded error.\n throw new Error('Not enough accounts');\n }\n let accountIndex = 0;\n const getNextAccount = () => {\n const accountMeta = instruction.accounts![accountIndex]!;\n accountIndex += 1;\n return accountMeta;\n };\n return {\n programAddress: instruction.programAddress,\n accounts: {\n systemProgram: getNextAccount(),\n payer: getNextAccount(),\n programData: getNextAccount(),\n authority: getNextAccount(),\n },\n data: getInitializeInstructionDataDecoder().decode(instruction.data),\n };\n}\n"]} \ No newline at end of file +{"version":3,"sources":["../../env-shim.ts","../../src/generated/accounts/programDataAccount.ts","../../src/generated/pdas/deviceMint.ts","../../src/generated/pdas/productMint.ts","../../src/generated/pdas/programDataAccount.ts","../../src/generated/types/deviceActivationSignature.ts","../../src/generated/types/deviceSigningAlgorithm.ts","../../src/generated/types/key.ts","../../src/generated/types/programData.ts","../../src/generated/errors/dephyId.ts","../../src/generated/instructions/activateDevice.ts","../../src/generated/programs/dephyId.ts","../../src/generated/shared/index.ts","../../src/generated/instructions/createDevice.ts","../../src/generated/instructions/createProduct.ts","../../src/generated/instructions/initialize.ts"],"names":["combineCodec","getAddressEncoder","getStructDecoder","getStructEncoder","getProgramDerivedAddress","getUtf8Encoder","DeviceSigningAlgorithm","getEnumDecoder","getEnumEncoder","Key","getU8Decoder","getU8Encoder","transformEncoder","DephyIdAccount","DephyIdInstruction","getTupleDecoder","getTupleEncoder","addDecoderSizePrefix","addEncoderSizePrefix","getArrayDecoder","getArrayEncoder","getU32Decoder","getU32Encoder","getUtf8Decoder"],"mappings":";AACO,IAAM,UAA2B,uBACrC,QAAgB,KAAU,EAAE,aAAa,eAAe;;;ACM3D;AAAA,EACE;AAAA,EACA;AAAA,EACA,gBAAAA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,qBAAAC;AAAA,EACA,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AAA,MAC7B,eAAe,SAAS,WAAW;AAAA,MACnC,eAAe,SAAS,SAAS;AAAA,IACnC;AAAA,IACA;AAAA,IACA,MAAM,oCAAoC,EAAE;AAAA,MAC1C;AAAA,IACF;AAAA,EACF;AAQA,SAAO;AACT;AAoBO,SAAS,2BAId,aAGsD;AACtD,MAAI,YAAY,SAAS,SAAS,GAAG;AAEnC,UAAM,IAAI,MAAM,qBAAqB;AAAA,EACvC;AACA,MAAI,eAAe;AACnB,QAAM,iBAAiB,MAAM;AAC3B,UAAM,cAAc,YAAY,SAAU,YAAY;AACtD,oBAAgB;AAChB,WAAO;AAAA,EACT;AACA,SAAO;AAAA,IACL,gBAAgB,YAAY;AAAA,IAC5B,UAAU;AAAA,MACR,eAAe,eAAe;AAAA,MAC9B,OAAO,eAAe;AAAA,MACtB,aAAa,eAAe;AAAA,MAC5B,WAAW,eAAe;AAAA,IAC5B;AAAA,IACA,MAAM,oCAAoC,EAAE,OAAO,YAAY,IAAI;AAAA,EACrE;AACF","sourcesContent":["// Clever obfuscation to prevent the build system from inlining the value of `NODE_ENV`\nexport const __DEV__ = /* @__PURE__ */ (() =>\n (process as any)['en' + 'v'].NODE_ENV === 'development')();\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport {\n assertAccountExists,\n assertAccountsExist,\n combineCodec,\n decodeAccount,\n fetchEncodedAccount,\n fetchEncodedAccounts,\n getAddressDecoder,\n getAddressEncoder,\n getStructDecoder,\n getStructEncoder,\n transformEncoder,\n type Account,\n type Address,\n type Codec,\n type Decoder,\n type EncodedAccount,\n type Encoder,\n type FetchAccountConfig,\n type FetchAccountsConfig,\n type MaybeAccount,\n type MaybeEncodedAccount,\n} from '@solana/web3.js';\nimport { findProgramDataAccountPda } from '../pdas';\nimport {\n Key,\n getKeyDecoder,\n getKeyEncoder,\n getProgramDataDecoder,\n getProgramDataEncoder,\n type ProgramData,\n type ProgramDataArgs,\n} from '../types';\n\nexport type ProgramDataAccount = {\n key: Key;\n authority: Address;\n data: ProgramData;\n};\n\nexport type ProgramDataAccountArgs = {\n authority: Address;\n data: ProgramDataArgs;\n};\n\nexport function getProgramDataAccountEncoder(): Encoder {\n return transformEncoder(\n getStructEncoder([\n ['key', getKeyEncoder()],\n ['authority', getAddressEncoder()],\n ['data', getProgramDataEncoder()],\n ]),\n (value) => ({ ...value, key: Key.ProgramDataAccount })\n );\n}\n\nexport function getProgramDataAccountDecoder(): Decoder {\n return getStructDecoder([\n ['key', getKeyDecoder()],\n ['authority', getAddressDecoder()],\n ['data', getProgramDataDecoder()],\n ]);\n}\n\nexport function getProgramDataAccountCodec(): Codec<\n ProgramDataAccountArgs,\n ProgramDataAccount\n> {\n return combineCodec(\n getProgramDataAccountEncoder(),\n getProgramDataAccountDecoder()\n );\n}\n\nexport function decodeProgramDataAccount(\n encodedAccount: EncodedAccount\n): Account;\nexport function decodeProgramDataAccount(\n encodedAccount: MaybeEncodedAccount\n): MaybeAccount;\nexport function decodeProgramDataAccount(\n encodedAccount: EncodedAccount | MaybeEncodedAccount\n):\n | Account\n | MaybeAccount {\n return decodeAccount(\n encodedAccount as MaybeEncodedAccount,\n getProgramDataAccountDecoder()\n );\n}\n\nexport async function fetchProgramDataAccount(\n rpc: Parameters[0],\n address: Address,\n config?: FetchAccountConfig\n): Promise> {\n const maybeAccount = await fetchMaybeProgramDataAccount(rpc, address, config);\n assertAccountExists(maybeAccount);\n return maybeAccount;\n}\n\nexport async function fetchMaybeProgramDataAccount<\n TAddress extends string = string,\n>(\n rpc: Parameters[0],\n address: Address,\n config?: FetchAccountConfig\n): Promise> {\n const maybeAccount = await fetchEncodedAccount(rpc, address, config);\n return decodeProgramDataAccount(maybeAccount);\n}\n\nexport async function fetchAllProgramDataAccount(\n rpc: Parameters[0],\n addresses: Array
,\n config?: FetchAccountsConfig\n): Promise[]> {\n const maybeAccounts = await fetchAllMaybeProgramDataAccount(\n rpc,\n addresses,\n config\n );\n assertAccountsExist(maybeAccounts);\n return maybeAccounts;\n}\n\nexport async function fetchAllMaybeProgramDataAccount(\n rpc: Parameters[0],\n addresses: Array
,\n config?: FetchAccountsConfig\n): Promise[]> {\n const maybeAccounts = await fetchEncodedAccounts(rpc, addresses, config);\n return maybeAccounts.map((maybeAccount) =>\n decodeProgramDataAccount(maybeAccount)\n );\n}\n\nexport function getProgramDataAccountSize(): number {\n return 34;\n}\n\nexport async function fetchProgramDataAccountFromSeeds(\n rpc: Parameters[0],\n config: FetchAccountConfig & { programAddress?: Address } = {}\n): Promise> {\n const maybeAccount = await fetchMaybeProgramDataAccountFromSeeds(rpc, config);\n assertAccountExists(maybeAccount);\n return maybeAccount;\n}\n\nexport async function fetchMaybeProgramDataAccountFromSeeds(\n rpc: Parameters[0],\n config: FetchAccountConfig & { programAddress?: Address } = {}\n): Promise> {\n const { programAddress, ...fetchConfig } = config;\n const [address] = await findProgramDataAccountPda({ programAddress });\n return await fetchMaybeProgramDataAccount(rpc, address, fetchConfig);\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport {\n getAddressEncoder,\n getProgramDerivedAddress,\n getUtf8Encoder,\n type Address,\n type ProgramDerivedAddress,\n} from '@solana/web3.js';\n\nexport type DeviceMintSeeds = {\n productMintPubkey: Address;\n\n devicePubkey: Address;\n};\n\nexport async function findDeviceMintPda(\n seeds: DeviceMintSeeds,\n config: { programAddress?: Address | undefined } = {}\n): Promise {\n const {\n programAddress = 'hdMghjD73uASxgJXi6e1mGPsXqnADMsrqB1bveqABP1' as Address<'hdMghjD73uASxgJXi6e1mGPsXqnADMsrqB1bveqABP1'>,\n } = config;\n return await getProgramDerivedAddress({\n programAddress,\n seeds: [\n getUtf8Encoder().encode('DePHY_ID-DEVICE'),\n getAddressEncoder().encode(seeds.productMintPubkey),\n getAddressEncoder().encode(seeds.devicePubkey),\n ],\n });\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport {\n getAddressEncoder,\n getProgramDerivedAddress,\n getUtf8Encoder,\n type Address,\n type ProgramDerivedAddress,\n} from '@solana/web3.js';\n\nexport type ProductMintSeeds = {\n vendorPubkey: Address;\n\n productName: string;\n};\n\nexport async function findProductMintPda(\n seeds: ProductMintSeeds,\n config: { programAddress?: Address | undefined } = {}\n): Promise {\n const {\n programAddress = 'hdMghjD73uASxgJXi6e1mGPsXqnADMsrqB1bveqABP1' as Address<'hdMghjD73uASxgJXi6e1mGPsXqnADMsrqB1bveqABP1'>,\n } = config;\n return await getProgramDerivedAddress({\n programAddress,\n seeds: [\n getUtf8Encoder().encode('DePHY_ID-PRODUCT'),\n getAddressEncoder().encode(seeds.vendorPubkey),\n getUtf8Encoder().encode(seeds.productName),\n ],\n });\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport {\n getProgramDerivedAddress,\n getUtf8Encoder,\n type Address,\n type ProgramDerivedAddress,\n} from '@solana/web3.js';\n\nexport async function findProgramDataAccountPda(\n config: { programAddress?: Address | undefined } = {}\n): Promise {\n const {\n programAddress = 'hdMghjD73uASxgJXi6e1mGPsXqnADMsrqB1bveqABP1' as Address<'hdMghjD73uASxgJXi6e1mGPsXqnADMsrqB1bveqABP1'>,\n } = config;\n return await getProgramDerivedAddress({\n programAddress,\n seeds: [getUtf8Encoder().encode('DePHY_ID')],\n });\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport {\n combineCodec,\n fixDecoderSize,\n fixEncoderSize,\n getBytesDecoder,\n getBytesEncoder,\n getDiscriminatedUnionDecoder,\n getDiscriminatedUnionEncoder,\n getStructDecoder,\n getStructEncoder,\n getTupleDecoder,\n getTupleEncoder,\n getU8Decoder,\n getU8Encoder,\n type Codec,\n type Decoder,\n type Encoder,\n type GetDiscriminatedUnionVariant,\n type GetDiscriminatedUnionVariantContent,\n type ReadonlyUint8Array,\n} from '@solana/web3.js';\n\nexport type DeviceActivationSignature =\n | { __kind: 'Ed25519'; fields: readonly [ReadonlyUint8Array] }\n | { __kind: 'Secp256k1'; fields: readonly [ReadonlyUint8Array, number] }\n | { __kind: 'EthSecp256k1'; fields: readonly [ReadonlyUint8Array, number] };\n\nexport type DeviceActivationSignatureArgs = DeviceActivationSignature;\n\nexport function getDeviceActivationSignatureEncoder(): Encoder {\n return getDiscriminatedUnionEncoder([\n [\n 'Ed25519',\n getStructEncoder([\n ['fields', getTupleEncoder([fixEncoderSize(getBytesEncoder(), 64)])],\n ]),\n ],\n [\n 'Secp256k1',\n getStructEncoder([\n [\n 'fields',\n getTupleEncoder([\n fixEncoderSize(getBytesEncoder(), 64),\n getU8Encoder(),\n ]),\n ],\n ]),\n ],\n [\n 'EthSecp256k1',\n getStructEncoder([\n [\n 'fields',\n getTupleEncoder([\n fixEncoderSize(getBytesEncoder(), 64),\n getU8Encoder(),\n ]),\n ],\n ]),\n ],\n ]);\n}\n\nexport function getDeviceActivationSignatureDecoder(): Decoder {\n return getDiscriminatedUnionDecoder([\n [\n 'Ed25519',\n getStructDecoder([\n ['fields', getTupleDecoder([fixDecoderSize(getBytesDecoder(), 64)])],\n ]),\n ],\n [\n 'Secp256k1',\n getStructDecoder([\n [\n 'fields',\n getTupleDecoder([\n fixDecoderSize(getBytesDecoder(), 64),\n getU8Decoder(),\n ]),\n ],\n ]),\n ],\n [\n 'EthSecp256k1',\n getStructDecoder([\n [\n 'fields',\n getTupleDecoder([\n fixDecoderSize(getBytesDecoder(), 64),\n getU8Decoder(),\n ]),\n ],\n ]),\n ],\n ]);\n}\n\nexport function getDeviceActivationSignatureCodec(): Codec<\n DeviceActivationSignatureArgs,\n DeviceActivationSignature\n> {\n return combineCodec(\n getDeviceActivationSignatureEncoder(),\n getDeviceActivationSignatureDecoder()\n );\n}\n\n// Data Enum Helpers.\nexport function deviceActivationSignature(\n kind: 'Ed25519',\n data: GetDiscriminatedUnionVariantContent<\n DeviceActivationSignatureArgs,\n '__kind',\n 'Ed25519'\n >['fields']\n): GetDiscriminatedUnionVariant<\n DeviceActivationSignatureArgs,\n '__kind',\n 'Ed25519'\n>;\nexport function deviceActivationSignature(\n kind: 'Secp256k1',\n data: GetDiscriminatedUnionVariantContent<\n DeviceActivationSignatureArgs,\n '__kind',\n 'Secp256k1'\n >['fields']\n): GetDiscriminatedUnionVariant<\n DeviceActivationSignatureArgs,\n '__kind',\n 'Secp256k1'\n>;\nexport function deviceActivationSignature(\n kind: 'EthSecp256k1',\n data: GetDiscriminatedUnionVariantContent<\n DeviceActivationSignatureArgs,\n '__kind',\n 'EthSecp256k1'\n >['fields']\n): GetDiscriminatedUnionVariant<\n DeviceActivationSignatureArgs,\n '__kind',\n 'EthSecp256k1'\n>;\nexport function deviceActivationSignature<\n K extends DeviceActivationSignatureArgs['__kind'],\n Data,\n>(kind: K, data?: Data) {\n return Array.isArray(data)\n ? { __kind: kind, fields: data }\n : { __kind: kind, ...(data ?? {}) };\n}\n\nexport function isDeviceActivationSignature<\n K extends DeviceActivationSignature['__kind'],\n>(\n kind: K,\n value: DeviceActivationSignature\n): value is DeviceActivationSignature & { __kind: K } {\n return value.__kind === kind;\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport {\n combineCodec,\n getEnumDecoder,\n getEnumEncoder,\n type Codec,\n type Decoder,\n type Encoder,\n} from '@solana/web3.js';\n\nexport enum DeviceSigningAlgorithm {\n Ed25519,\n Secp256k1,\n}\n\nexport type DeviceSigningAlgorithmArgs = DeviceSigningAlgorithm;\n\nexport function getDeviceSigningAlgorithmEncoder(): Encoder {\n return getEnumEncoder(DeviceSigningAlgorithm);\n}\n\nexport function getDeviceSigningAlgorithmDecoder(): Decoder {\n return getEnumDecoder(DeviceSigningAlgorithm);\n}\n\nexport function getDeviceSigningAlgorithmCodec(): Codec<\n DeviceSigningAlgorithmArgs,\n DeviceSigningAlgorithm\n> {\n return combineCodec(\n getDeviceSigningAlgorithmEncoder(),\n getDeviceSigningAlgorithmDecoder()\n );\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport {\n combineCodec,\n getEnumDecoder,\n getEnumEncoder,\n type Codec,\n type Decoder,\n type Encoder,\n} from '@solana/web3.js';\n\nexport enum Key {\n Uninitialized,\n ProgramDataAccount,\n}\n\nexport type KeyArgs = Key;\n\nexport function getKeyEncoder(): Encoder {\n return getEnumEncoder(Key);\n}\n\nexport function getKeyDecoder(): Decoder {\n return getEnumDecoder(Key);\n}\n\nexport function getKeyCodec(): Codec {\n return combineCodec(getKeyEncoder(), getKeyDecoder());\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport {\n combineCodec,\n getStructDecoder,\n getStructEncoder,\n getU8Decoder,\n getU8Encoder,\n type Codec,\n type Decoder,\n type Encoder,\n} from '@solana/web3.js';\n\nexport type ProgramData = { bump: number };\n\nexport type ProgramDataArgs = ProgramData;\n\nexport function getProgramDataEncoder(): Encoder {\n return getStructEncoder([['bump', getU8Encoder()]]);\n}\n\nexport function getProgramDataDecoder(): Decoder {\n return getStructDecoder([['bump', getU8Decoder()]]);\n}\n\nexport function getProgramDataCodec(): Codec {\n return combineCodec(getProgramDataEncoder(), getProgramDataDecoder());\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\n/** DeserializationError: Error deserializing an account */\nexport const DEPHY_ID_ERROR__DESERIALIZATION_ERROR = 0x0; // 0\n/** SerializationError: Error serializing an account */\nexport const DEPHY_ID_ERROR__SERIALIZATION_ERROR = 0x1; // 1\n/** InvalidProgramOwner: Invalid program owner. This likely mean the provided account does not exist */\nexport const DEPHY_ID_ERROR__INVALID_PROGRAM_OWNER = 0x2; // 2\n/** InvalidPda: Invalid PDA derivation */\nexport const DEPHY_ID_ERROR__INVALID_PDA = 0x3; // 3\n/** ExpectedEmptyAccount: Expected empty account */\nexport const DEPHY_ID_ERROR__EXPECTED_EMPTY_ACCOUNT = 0x4; // 4\n/** ExpectedNonEmptyAccount: Expected non empty account */\nexport const DEPHY_ID_ERROR__EXPECTED_NON_EMPTY_ACCOUNT = 0x5; // 5\n/** ExpectedSignerAccount: Expected signer account */\nexport const DEPHY_ID_ERROR__EXPECTED_SIGNER_ACCOUNT = 0x6; // 6\n/** ExpectedWritableAccount: Expected writable account */\nexport const DEPHY_ID_ERROR__EXPECTED_WRITABLE_ACCOUNT = 0x7; // 7\n/** AccountMismatch: Account mismatch */\nexport const DEPHY_ID_ERROR__ACCOUNT_MISMATCH = 0x8; // 8\n/** InvalidAccountKey: Invalid account key */\nexport const DEPHY_ID_ERROR__INVALID_ACCOUNT_KEY = 0x9; // 9\n/** NumericalOverflow: Numerical overflow */\nexport const DEPHY_ID_ERROR__NUMERICAL_OVERFLOW = 0xa; // 10\n/** MissingInstruction: Missing instruction */\nexport const DEPHY_ID_ERROR__MISSING_INSTRUCTION = 0xb; // 11\n/** SignatureMismatch: Signature mismatch */\nexport const DEPHY_ID_ERROR__SIGNATURE_MISMATCH = 0xc; // 12\n\nexport type DephyIdError =\n | typeof DEPHY_ID_ERROR__ACCOUNT_MISMATCH\n | typeof DEPHY_ID_ERROR__DESERIALIZATION_ERROR\n | typeof DEPHY_ID_ERROR__EXPECTED_EMPTY_ACCOUNT\n | typeof DEPHY_ID_ERROR__EXPECTED_NON_EMPTY_ACCOUNT\n | typeof DEPHY_ID_ERROR__EXPECTED_SIGNER_ACCOUNT\n | typeof DEPHY_ID_ERROR__EXPECTED_WRITABLE_ACCOUNT\n | typeof DEPHY_ID_ERROR__INVALID_ACCOUNT_KEY\n | typeof DEPHY_ID_ERROR__INVALID_PDA\n | typeof DEPHY_ID_ERROR__INVALID_PROGRAM_OWNER\n | typeof DEPHY_ID_ERROR__MISSING_INSTRUCTION\n | typeof DEPHY_ID_ERROR__NUMERICAL_OVERFLOW\n | typeof DEPHY_ID_ERROR__SERIALIZATION_ERROR\n | typeof DEPHY_ID_ERROR__SIGNATURE_MISMATCH;\n\nlet dephyIdErrorMessages: Record | undefined;\nif (__DEV__) {\n dephyIdErrorMessages = {\n [DEPHY_ID_ERROR__ACCOUNT_MISMATCH]: `Account mismatch`,\n [DEPHY_ID_ERROR__DESERIALIZATION_ERROR]: `Error deserializing an account`,\n [DEPHY_ID_ERROR__EXPECTED_EMPTY_ACCOUNT]: `Expected empty account`,\n [DEPHY_ID_ERROR__EXPECTED_NON_EMPTY_ACCOUNT]: `Expected non empty account`,\n [DEPHY_ID_ERROR__EXPECTED_SIGNER_ACCOUNT]: `Expected signer account`,\n [DEPHY_ID_ERROR__EXPECTED_WRITABLE_ACCOUNT]: `Expected writable account`,\n [DEPHY_ID_ERROR__INVALID_ACCOUNT_KEY]: `Invalid account key`,\n [DEPHY_ID_ERROR__INVALID_PDA]: `Invalid PDA derivation`,\n [DEPHY_ID_ERROR__INVALID_PROGRAM_OWNER]: `Invalid program owner. This likely mean the provided account does not exist`,\n [DEPHY_ID_ERROR__MISSING_INSTRUCTION]: `Missing instruction`,\n [DEPHY_ID_ERROR__NUMERICAL_OVERFLOW]: `Numerical overflow`,\n [DEPHY_ID_ERROR__SERIALIZATION_ERROR]: `Error serializing an account`,\n [DEPHY_ID_ERROR__SIGNATURE_MISMATCH]: `Signature mismatch`,\n };\n}\n\nexport function getDephyIdErrorMessage(code: DephyIdError): string {\n if (__DEV__) {\n return (dephyIdErrorMessages as Record)[code];\n }\n\n return 'Error message not available in production bundles. Compile with `__DEV__` set to true to see more information.';\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport {\n combineCodec,\n getStructDecoder,\n getStructEncoder,\n getU64Decoder,\n getU64Encoder,\n getU8Decoder,\n getU8Encoder,\n transformEncoder,\n type Address,\n type Codec,\n type Decoder,\n type Encoder,\n type IAccountMeta,\n type IAccountSignerMeta,\n type IInstruction,\n type IInstructionWithAccounts,\n type IInstructionWithData,\n type ReadonlyAccount,\n type TransactionSigner,\n type WritableAccount,\n type WritableSignerAccount,\n} from '@solana/web3.js';\nimport { DEPHY_ID_PROGRAM_ADDRESS } from '../programs';\nimport { getAccountMetaFactory, type ResolvedAccount } from '../shared';\nimport {\n getDeviceActivationSignatureDecoder,\n getDeviceActivationSignatureEncoder,\n type DeviceActivationSignature,\n type DeviceActivationSignatureArgs,\n} from '../types';\n\nexport type ActivateDeviceInstruction<\n TProgram extends string = typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountSystemProgram extends\n | string\n | IAccountMeta = '11111111111111111111111111111111',\n TAccountToken2022Program extends string | IAccountMeta = string,\n TAccountAtaProgram extends\n | string\n | IAccountMeta = 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL',\n TAccountPayer extends string | IAccountMeta = string,\n TAccountVendor extends string | IAccountMeta = string,\n TAccountProductMint extends string | IAccountMeta = string,\n TAccountProductAssociatedToken extends string | IAccountMeta = string,\n TAccountDevice extends string | IAccountMeta = string,\n TAccountDeviceMint extends string | IAccountMeta = string,\n TAccountDeviceAssociatedToken extends string | IAccountMeta = string,\n TAccountOwner extends string | IAccountMeta = string,\n TRemainingAccounts extends readonly IAccountMeta[] = [],\n> = IInstruction &\n IInstructionWithData &\n IInstructionWithAccounts<\n [\n TAccountSystemProgram extends string\n ? ReadonlyAccount\n : TAccountSystemProgram,\n TAccountToken2022Program extends string\n ? ReadonlyAccount\n : TAccountToken2022Program,\n TAccountAtaProgram extends string\n ? ReadonlyAccount\n : TAccountAtaProgram,\n TAccountPayer extends string\n ? WritableSignerAccount &\n IAccountSignerMeta\n : TAccountPayer,\n TAccountVendor extends string\n ? ReadonlyAccount\n : TAccountVendor,\n TAccountProductMint extends string\n ? ReadonlyAccount\n : TAccountProductMint,\n TAccountProductAssociatedToken extends string\n ? ReadonlyAccount\n : TAccountProductAssociatedToken,\n TAccountDevice extends string\n ? ReadonlyAccount\n : TAccountDevice,\n TAccountDeviceMint extends string\n ? WritableAccount\n : TAccountDeviceMint,\n TAccountDeviceAssociatedToken extends string\n ? WritableAccount\n : TAccountDeviceAssociatedToken,\n TAccountOwner extends string\n ? ReadonlyAccount\n : TAccountOwner,\n ...TRemainingAccounts,\n ]\n >;\n\nexport type ActivateDeviceInstructionData = {\n discriminator: number;\n signature: DeviceActivationSignature;\n timestamp: bigint;\n};\n\nexport type ActivateDeviceInstructionDataArgs = {\n signature: DeviceActivationSignatureArgs;\n timestamp: number | bigint;\n};\n\nexport function getActivateDeviceInstructionDataEncoder(): Encoder {\n return transformEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['signature', getDeviceActivationSignatureEncoder()],\n ['timestamp', getU64Encoder()],\n ]),\n (value) => ({ ...value, discriminator: 3 })\n );\n}\n\nexport function getActivateDeviceInstructionDataDecoder(): Decoder {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['signature', getDeviceActivationSignatureDecoder()],\n ['timestamp', getU64Decoder()],\n ]);\n}\n\nexport function getActivateDeviceInstructionDataCodec(): Codec<\n ActivateDeviceInstructionDataArgs,\n ActivateDeviceInstructionData\n> {\n return combineCodec(\n getActivateDeviceInstructionDataEncoder(),\n getActivateDeviceInstructionDataDecoder()\n );\n}\n\nexport type ActivateDeviceInput<\n TAccountSystemProgram extends string = string,\n TAccountToken2022Program extends string = string,\n TAccountAtaProgram extends string = string,\n TAccountPayer extends string = string,\n TAccountVendor extends string = string,\n TAccountProductMint extends string = string,\n TAccountProductAssociatedToken extends string = string,\n TAccountDevice extends string = string,\n TAccountDeviceMint extends string = string,\n TAccountDeviceAssociatedToken extends string = string,\n TAccountOwner extends string = string,\n> = {\n /** The system program */\n systemProgram?: Address;\n /** The SPL Token 2022 program */\n token2022Program: Address;\n /** The associated token program */\n ataProgram?: Address;\n /** The account paying for the storage fees */\n payer: TransactionSigner;\n /** The vendor */\n vendor: Address;\n /** The mint account for the product */\n productMint: Address;\n /** The associated token account for the product */\n productAssociatedToken: Address;\n /** The device */\n device: Address;\n /** The mint account for the device */\n deviceMint: Address;\n /** The associated token account for the device */\n deviceAssociatedToken: Address;\n /** The device's owner */\n owner: Address;\n signature: ActivateDeviceInstructionDataArgs['signature'];\n timestamp: ActivateDeviceInstructionDataArgs['timestamp'];\n};\n\nexport function getActivateDeviceInstruction<\n TAccountSystemProgram extends string,\n TAccountToken2022Program extends string,\n TAccountAtaProgram extends string,\n TAccountPayer extends string,\n TAccountVendor extends string,\n TAccountProductMint extends string,\n TAccountProductAssociatedToken extends string,\n TAccountDevice extends string,\n TAccountDeviceMint extends string,\n TAccountDeviceAssociatedToken extends string,\n TAccountOwner extends string,\n>(\n input: ActivateDeviceInput<\n TAccountSystemProgram,\n TAccountToken2022Program,\n TAccountAtaProgram,\n TAccountPayer,\n TAccountVendor,\n TAccountProductMint,\n TAccountProductAssociatedToken,\n TAccountDevice,\n TAccountDeviceMint,\n TAccountDeviceAssociatedToken,\n TAccountOwner\n >\n): ActivateDeviceInstruction<\n typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountSystemProgram,\n TAccountToken2022Program,\n TAccountAtaProgram,\n TAccountPayer,\n TAccountVendor,\n TAccountProductMint,\n TAccountProductAssociatedToken,\n TAccountDevice,\n TAccountDeviceMint,\n TAccountDeviceAssociatedToken,\n TAccountOwner\n> {\n // Program address.\n const programAddress = DEPHY_ID_PROGRAM_ADDRESS;\n\n // Original accounts.\n const originalAccounts = {\n systemProgram: { value: input.systemProgram ?? null, isWritable: false },\n token2022Program: {\n value: input.token2022Program ?? null,\n isWritable: false,\n },\n ataProgram: { value: input.ataProgram ?? null, isWritable: false },\n payer: { value: input.payer ?? null, isWritable: true },\n vendor: { value: input.vendor ?? null, isWritable: false },\n productMint: { value: input.productMint ?? null, isWritable: false },\n productAssociatedToken: {\n value: input.productAssociatedToken ?? null,\n isWritable: false,\n },\n device: { value: input.device ?? null, isWritable: false },\n deviceMint: { value: input.deviceMint ?? null, isWritable: true },\n deviceAssociatedToken: {\n value: input.deviceAssociatedToken ?? null,\n isWritable: true,\n },\n owner: { value: input.owner ?? null, isWritable: false },\n };\n const accounts = originalAccounts as Record<\n keyof typeof originalAccounts,\n ResolvedAccount\n >;\n\n // Original args.\n const args = { ...input };\n\n // Resolve default values.\n if (!accounts.systemProgram.value) {\n accounts.systemProgram.value =\n '11111111111111111111111111111111' as Address<'11111111111111111111111111111111'>;\n }\n if (!accounts.ataProgram.value) {\n accounts.ataProgram.value =\n 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL' as Address<'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL'>;\n }\n\n const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');\n const instruction = {\n accounts: [\n getAccountMeta(accounts.systemProgram),\n getAccountMeta(accounts.token2022Program),\n getAccountMeta(accounts.ataProgram),\n getAccountMeta(accounts.payer),\n getAccountMeta(accounts.vendor),\n getAccountMeta(accounts.productMint),\n getAccountMeta(accounts.productAssociatedToken),\n getAccountMeta(accounts.device),\n getAccountMeta(accounts.deviceMint),\n getAccountMeta(accounts.deviceAssociatedToken),\n getAccountMeta(accounts.owner),\n ],\n programAddress,\n data: getActivateDeviceInstructionDataEncoder().encode(\n args as ActivateDeviceInstructionDataArgs\n ),\n } as ActivateDeviceInstruction<\n typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountSystemProgram,\n TAccountToken2022Program,\n TAccountAtaProgram,\n TAccountPayer,\n TAccountVendor,\n TAccountProductMint,\n TAccountProductAssociatedToken,\n TAccountDevice,\n TAccountDeviceMint,\n TAccountDeviceAssociatedToken,\n TAccountOwner\n >;\n\n return instruction;\n}\n\nexport type ParsedActivateDeviceInstruction<\n TProgram extends string = typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[],\n> = {\n programAddress: Address;\n accounts: {\n /** The system program */\n systemProgram: TAccountMetas[0];\n /** The SPL Token 2022 program */\n token2022Program: TAccountMetas[1];\n /** The associated token program */\n ataProgram: TAccountMetas[2];\n /** The account paying for the storage fees */\n payer: TAccountMetas[3];\n /** The vendor */\n vendor: TAccountMetas[4];\n /** The mint account for the product */\n productMint: TAccountMetas[5];\n /** The associated token account for the product */\n productAssociatedToken: TAccountMetas[6];\n /** The device */\n device: TAccountMetas[7];\n /** The mint account for the device */\n deviceMint: TAccountMetas[8];\n /** The associated token account for the device */\n deviceAssociatedToken: TAccountMetas[9];\n /** The device's owner */\n owner: TAccountMetas[10];\n };\n data: ActivateDeviceInstructionData;\n};\n\nexport function parseActivateDeviceInstruction<\n TProgram extends string,\n TAccountMetas extends readonly IAccountMeta[],\n>(\n instruction: IInstruction &\n IInstructionWithAccounts &\n IInstructionWithData\n): ParsedActivateDeviceInstruction {\n if (instruction.accounts.length < 11) {\n // TODO: Coded error.\n throw new Error('Not enough accounts');\n }\n let accountIndex = 0;\n const getNextAccount = () => {\n const accountMeta = instruction.accounts![accountIndex]!;\n accountIndex += 1;\n return accountMeta;\n };\n return {\n programAddress: instruction.programAddress,\n accounts: {\n systemProgram: getNextAccount(),\n token2022Program: getNextAccount(),\n ataProgram: getNextAccount(),\n payer: getNextAccount(),\n vendor: getNextAccount(),\n productMint: getNextAccount(),\n productAssociatedToken: getNextAccount(),\n device: getNextAccount(),\n deviceMint: getNextAccount(),\n deviceAssociatedToken: getNextAccount(),\n owner: getNextAccount(),\n },\n data: getActivateDeviceInstructionDataDecoder().decode(instruction.data),\n };\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport { containsBytes, getU8Encoder, type Address } from '@solana/web3.js';\nimport {\n type ParsedActivateDeviceInstruction,\n type ParsedCreateDeviceInstruction,\n type ParsedCreateProductInstruction,\n type ParsedInitializeInstruction,\n} from '../instructions';\nimport { Key, getKeyEncoder } from '../types';\n\nexport const DEPHY_ID_PROGRAM_ADDRESS =\n 'hdMghjD73uASxgJXi6e1mGPsXqnADMsrqB1bveqABP1' as Address<'hdMghjD73uASxgJXi6e1mGPsXqnADMsrqB1bveqABP1'>;\n\nexport enum DephyIdAccount {\n ProgramDataAccount,\n}\n\nexport function identifyDephyIdAccount(\n account: { data: Uint8Array } | Uint8Array\n): DephyIdAccount {\n const data = account instanceof Uint8Array ? account : account.data;\n if (containsBytes(data, getKeyEncoder().encode(Key.ProgramDataAccount), 0)) {\n return DephyIdAccount.ProgramDataAccount;\n }\n throw new Error(\n 'The provided account could not be identified as a dephyId account.'\n );\n}\n\nexport enum DephyIdInstruction {\n Initialize,\n CreateProduct,\n CreateDevice,\n ActivateDevice,\n}\n\nexport function identifyDephyIdInstruction(\n instruction: { data: Uint8Array } | Uint8Array\n): DephyIdInstruction {\n const data =\n instruction instanceof Uint8Array ? instruction : instruction.data;\n if (containsBytes(data, getU8Encoder().encode(0), 0)) {\n return DephyIdInstruction.Initialize;\n }\n if (containsBytes(data, getU8Encoder().encode(1), 0)) {\n return DephyIdInstruction.CreateProduct;\n }\n if (containsBytes(data, getU8Encoder().encode(2), 0)) {\n return DephyIdInstruction.CreateDevice;\n }\n if (containsBytes(data, getU8Encoder().encode(3), 0)) {\n return DephyIdInstruction.ActivateDevice;\n }\n throw new Error(\n 'The provided instruction could not be identified as a dephyId instruction.'\n );\n}\n\nexport type ParsedDephyIdInstruction<\n TProgram extends string = 'hdMghjD73uASxgJXi6e1mGPsXqnADMsrqB1bveqABP1',\n> =\n | ({\n instructionType: DephyIdInstruction.Initialize;\n } & ParsedInitializeInstruction)\n | ({\n instructionType: DephyIdInstruction.CreateProduct;\n } & ParsedCreateProductInstruction)\n | ({\n instructionType: DephyIdInstruction.CreateDevice;\n } & ParsedCreateDeviceInstruction)\n | ({\n instructionType: DephyIdInstruction.ActivateDevice;\n } & ParsedActivateDeviceInstruction);\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport {\n AccountRole,\n isProgramDerivedAddress,\n isTransactionSigner as web3JsIsTransactionSigner,\n type Address,\n type IAccountMeta,\n type IAccountSignerMeta,\n type ProgramDerivedAddress,\n type TransactionSigner,\n upgradeRoleToSigner,\n} from '@solana/web3.js';\n\n/**\n * Asserts that the given value is not null or undefined.\n * @internal\n */\nexport function expectSome(value: T | null | undefined): T {\n if (value == null) {\n throw new Error('Expected a value but received null or undefined.');\n }\n return value;\n}\n\n/**\n * Asserts that the given value is a PublicKey.\n * @internal\n */\nexport function expectAddress(\n value:\n | Address\n | ProgramDerivedAddress\n | TransactionSigner\n | null\n | undefined\n): Address {\n if (!value) {\n throw new Error('Expected a Address.');\n }\n if (typeof value === 'object' && 'address' in value) {\n return value.address;\n }\n if (Array.isArray(value)) {\n return value[0];\n }\n return value as Address;\n}\n\n/**\n * Asserts that the given value is a PDA.\n * @internal\n */\nexport function expectProgramDerivedAddress(\n value:\n | Address\n | ProgramDerivedAddress\n | TransactionSigner\n | null\n | undefined\n): ProgramDerivedAddress {\n if (!value || !Array.isArray(value) || !isProgramDerivedAddress(value)) {\n throw new Error('Expected a ProgramDerivedAddress.');\n }\n return value;\n}\n\n/**\n * Asserts that the given value is a TransactionSigner.\n * @internal\n */\nexport function expectTransactionSigner(\n value:\n | Address\n | ProgramDerivedAddress\n | TransactionSigner\n | null\n | undefined\n): TransactionSigner {\n if (!value || !isTransactionSigner(value)) {\n throw new Error('Expected a TransactionSigner.');\n }\n return value;\n}\n\n/**\n * Defines an instruction account to resolve.\n * @internal\n */\nexport type ResolvedAccount<\n T extends string = string,\n U extends\n | Address\n | ProgramDerivedAddress\n | TransactionSigner\n | null =\n | Address\n | ProgramDerivedAddress\n | TransactionSigner\n | null,\n> = {\n isWritable: boolean;\n value: U;\n};\n\n/**\n * Defines an instruction that stores additional bytes on-chain.\n * @internal\n */\nexport type IInstructionWithByteDelta = {\n byteDelta: number;\n};\n\n/**\n * Get account metas and signers from resolved accounts.\n * @internal\n */\nexport function getAccountMetaFactory(\n programAddress: Address,\n optionalAccountStrategy: 'omitted' | 'programId'\n) {\n return (\n account: ResolvedAccount\n ): IAccountMeta | IAccountSignerMeta | undefined => {\n if (!account.value) {\n if (optionalAccountStrategy === 'omitted') return;\n return Object.freeze({\n address: programAddress,\n role: AccountRole.READONLY,\n });\n }\n\n const writableRole = account.isWritable\n ? AccountRole.WRITABLE\n : AccountRole.READONLY;\n return Object.freeze({\n address: expectAddress(account.value),\n role: isTransactionSigner(account.value)\n ? upgradeRoleToSigner(writableRole)\n : writableRole,\n ...(isTransactionSigner(account.value) ? { signer: account.value } : {}),\n });\n };\n}\n\nexport function isTransactionSigner(\n value:\n | Address\n | ProgramDerivedAddress\n | TransactionSigner\n): value is TransactionSigner {\n return (\n !!value &&\n typeof value === 'object' &&\n 'address' in value &&\n web3JsIsTransactionSigner(value)\n );\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport {\n addDecoderSizePrefix,\n addEncoderSizePrefix,\n combineCodec,\n getArrayDecoder,\n getArrayEncoder,\n getStructDecoder,\n getStructEncoder,\n getTupleDecoder,\n getTupleEncoder,\n getU32Decoder,\n getU32Encoder,\n getU8Decoder,\n getU8Encoder,\n getUtf8Decoder,\n getUtf8Encoder,\n transformEncoder,\n type Address,\n type Codec,\n type Decoder,\n type Encoder,\n type IAccountMeta,\n type IAccountSignerMeta,\n type IInstruction,\n type IInstructionWithAccounts,\n type IInstructionWithData,\n type ReadonlyAccount,\n type ReadonlySignerAccount,\n type TransactionSigner,\n type WritableAccount,\n type WritableSignerAccount,\n} from '@solana/web3.js';\nimport { DEPHY_ID_PROGRAM_ADDRESS } from '../programs';\nimport { getAccountMetaFactory, type ResolvedAccount } from '../shared';\nimport {\n getDeviceSigningAlgorithmDecoder,\n getDeviceSigningAlgorithmEncoder,\n type DeviceSigningAlgorithm,\n type DeviceSigningAlgorithmArgs,\n} from '../types';\n\nexport type CreateDeviceInstruction<\n TProgram extends string = typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountSystemProgram extends\n | string\n | IAccountMeta = '11111111111111111111111111111111',\n TAccountToken2022Program extends\n | string\n | IAccountMeta = 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb',\n TAccountAtaProgram extends\n | string\n | IAccountMeta = 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL',\n TAccountPayer extends string | IAccountMeta = string,\n TAccountVendor extends string | IAccountMeta = string,\n TAccountProductMint extends string | IAccountMeta = string,\n TAccountProductAssociatedToken extends string | IAccountMeta = string,\n TAccountDevice extends string | IAccountMeta = string,\n TAccountDeviceMint extends string | IAccountMeta = string,\n TRemainingAccounts extends readonly IAccountMeta[] = [],\n> = IInstruction &\n IInstructionWithData &\n IInstructionWithAccounts<\n [\n TAccountSystemProgram extends string\n ? ReadonlyAccount\n : TAccountSystemProgram,\n TAccountToken2022Program extends string\n ? ReadonlyAccount\n : TAccountToken2022Program,\n TAccountAtaProgram extends string\n ? ReadonlyAccount\n : TAccountAtaProgram,\n TAccountPayer extends string\n ? WritableSignerAccount &\n IAccountSignerMeta\n : TAccountPayer,\n TAccountVendor extends string\n ? ReadonlySignerAccount &\n IAccountSignerMeta\n : TAccountVendor,\n TAccountProductMint extends string\n ? WritableAccount\n : TAccountProductMint,\n TAccountProductAssociatedToken extends string\n ? WritableAccount\n : TAccountProductAssociatedToken,\n TAccountDevice extends string\n ? ReadonlyAccount\n : TAccountDevice,\n TAccountDeviceMint extends string\n ? WritableAccount\n : TAccountDeviceMint,\n ...TRemainingAccounts,\n ]\n >;\n\nexport type CreateDeviceInstructionData = {\n discriminator: number;\n name: string;\n uri: string;\n additionalMetadata: Array;\n signingAlg: DeviceSigningAlgorithm;\n};\n\nexport type CreateDeviceInstructionDataArgs = {\n name: string;\n uri: string;\n additionalMetadata: Array;\n signingAlg: DeviceSigningAlgorithmArgs;\n};\n\nexport function getCreateDeviceInstructionDataEncoder(): Encoder {\n return transformEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['name', addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())],\n ['uri', addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())],\n [\n 'additionalMetadata',\n getArrayEncoder(\n getTupleEncoder([\n addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder()),\n addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder()),\n ])\n ),\n ],\n ['signingAlg', getDeviceSigningAlgorithmEncoder()],\n ]),\n (value) => ({ ...value, discriminator: 2 })\n );\n}\n\nexport function getCreateDeviceInstructionDataDecoder(): Decoder {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['name', addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())],\n ['uri', addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())],\n [\n 'additionalMetadata',\n getArrayDecoder(\n getTupleDecoder([\n addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder()),\n addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder()),\n ])\n ),\n ],\n ['signingAlg', getDeviceSigningAlgorithmDecoder()],\n ]);\n}\n\nexport function getCreateDeviceInstructionDataCodec(): Codec<\n CreateDeviceInstructionDataArgs,\n CreateDeviceInstructionData\n> {\n return combineCodec(\n getCreateDeviceInstructionDataEncoder(),\n getCreateDeviceInstructionDataDecoder()\n );\n}\n\nexport type CreateDeviceInput<\n TAccountSystemProgram extends string = string,\n TAccountToken2022Program extends string = string,\n TAccountAtaProgram extends string = string,\n TAccountPayer extends string = string,\n TAccountVendor extends string = string,\n TAccountProductMint extends string = string,\n TAccountProductAssociatedToken extends string = string,\n TAccountDevice extends string = string,\n TAccountDeviceMint extends string = string,\n> = {\n /** The system program */\n systemProgram?: Address;\n /** The SPL Token 2022 program */\n token2022Program?: Address;\n /** The associated token program */\n ataProgram?: Address;\n /** The account paying for the storage fees */\n payer: TransactionSigner;\n /** The vendor */\n vendor: TransactionSigner;\n /** The mint account of the product */\n productMint: Address;\n /** The associated token account of the product */\n productAssociatedToken: Address;\n /** The device */\n device: Address;\n /** The mint account of the device */\n deviceMint: Address;\n name: CreateDeviceInstructionDataArgs['name'];\n uri: CreateDeviceInstructionDataArgs['uri'];\n additionalMetadata: CreateDeviceInstructionDataArgs['additionalMetadata'];\n signingAlg: CreateDeviceInstructionDataArgs['signingAlg'];\n};\n\nexport function getCreateDeviceInstruction<\n TAccountSystemProgram extends string,\n TAccountToken2022Program extends string,\n TAccountAtaProgram extends string,\n TAccountPayer extends string,\n TAccountVendor extends string,\n TAccountProductMint extends string,\n TAccountProductAssociatedToken extends string,\n TAccountDevice extends string,\n TAccountDeviceMint extends string,\n>(\n input: CreateDeviceInput<\n TAccountSystemProgram,\n TAccountToken2022Program,\n TAccountAtaProgram,\n TAccountPayer,\n TAccountVendor,\n TAccountProductMint,\n TAccountProductAssociatedToken,\n TAccountDevice,\n TAccountDeviceMint\n >\n): CreateDeviceInstruction<\n typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountSystemProgram,\n TAccountToken2022Program,\n TAccountAtaProgram,\n TAccountPayer,\n TAccountVendor,\n TAccountProductMint,\n TAccountProductAssociatedToken,\n TAccountDevice,\n TAccountDeviceMint\n> {\n // Program address.\n const programAddress = DEPHY_ID_PROGRAM_ADDRESS;\n\n // Original accounts.\n const originalAccounts = {\n systemProgram: { value: input.systemProgram ?? null, isWritable: false },\n token2022Program: {\n value: input.token2022Program ?? null,\n isWritable: false,\n },\n ataProgram: { value: input.ataProgram ?? null, isWritable: false },\n payer: { value: input.payer ?? null, isWritable: true },\n vendor: { value: input.vendor ?? null, isWritable: false },\n productMint: { value: input.productMint ?? null, isWritable: true },\n productAssociatedToken: {\n value: input.productAssociatedToken ?? null,\n isWritable: true,\n },\n device: { value: input.device ?? null, isWritable: false },\n deviceMint: { value: input.deviceMint ?? null, isWritable: true },\n };\n const accounts = originalAccounts as Record<\n keyof typeof originalAccounts,\n ResolvedAccount\n >;\n\n // Original args.\n const args = { ...input };\n\n // Resolve default values.\n if (!accounts.systemProgram.value) {\n accounts.systemProgram.value =\n '11111111111111111111111111111111' as Address<'11111111111111111111111111111111'>;\n }\n if (!accounts.token2022Program.value) {\n accounts.token2022Program.value =\n 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb' as Address<'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb'>;\n }\n if (!accounts.ataProgram.value) {\n accounts.ataProgram.value =\n 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL' as Address<'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL'>;\n }\n\n const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');\n const instruction = {\n accounts: [\n getAccountMeta(accounts.systemProgram),\n getAccountMeta(accounts.token2022Program),\n getAccountMeta(accounts.ataProgram),\n getAccountMeta(accounts.payer),\n getAccountMeta(accounts.vendor),\n getAccountMeta(accounts.productMint),\n getAccountMeta(accounts.productAssociatedToken),\n getAccountMeta(accounts.device),\n getAccountMeta(accounts.deviceMint),\n ],\n programAddress,\n data: getCreateDeviceInstructionDataEncoder().encode(\n args as CreateDeviceInstructionDataArgs\n ),\n } as CreateDeviceInstruction<\n typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountSystemProgram,\n TAccountToken2022Program,\n TAccountAtaProgram,\n TAccountPayer,\n TAccountVendor,\n TAccountProductMint,\n TAccountProductAssociatedToken,\n TAccountDevice,\n TAccountDeviceMint\n >;\n\n return instruction;\n}\n\nexport type ParsedCreateDeviceInstruction<\n TProgram extends string = typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[],\n> = {\n programAddress: Address;\n accounts: {\n /** The system program */\n systemProgram: TAccountMetas[0];\n /** The SPL Token 2022 program */\n token2022Program: TAccountMetas[1];\n /** The associated token program */\n ataProgram: TAccountMetas[2];\n /** The account paying for the storage fees */\n payer: TAccountMetas[3];\n /** The vendor */\n vendor: TAccountMetas[4];\n /** The mint account of the product */\n productMint: TAccountMetas[5];\n /** The associated token account of the product */\n productAssociatedToken: TAccountMetas[6];\n /** The device */\n device: TAccountMetas[7];\n /** The mint account of the device */\n deviceMint: TAccountMetas[8];\n };\n data: CreateDeviceInstructionData;\n};\n\nexport function parseCreateDeviceInstruction<\n TProgram extends string,\n TAccountMetas extends readonly IAccountMeta[],\n>(\n instruction: IInstruction &\n IInstructionWithAccounts &\n IInstructionWithData\n): ParsedCreateDeviceInstruction {\n if (instruction.accounts.length < 9) {\n // TODO: Coded error.\n throw new Error('Not enough accounts');\n }\n let accountIndex = 0;\n const getNextAccount = () => {\n const accountMeta = instruction.accounts![accountIndex]!;\n accountIndex += 1;\n return accountMeta;\n };\n return {\n programAddress: instruction.programAddress,\n accounts: {\n systemProgram: getNextAccount(),\n token2022Program: getNextAccount(),\n ataProgram: getNextAccount(),\n payer: getNextAccount(),\n vendor: getNextAccount(),\n productMint: getNextAccount(),\n productAssociatedToken: getNextAccount(),\n device: getNextAccount(),\n deviceMint: getNextAccount(),\n },\n data: getCreateDeviceInstructionDataDecoder().decode(instruction.data),\n };\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport {\n addDecoderSizePrefix,\n addEncoderSizePrefix,\n combineCodec,\n getArrayDecoder,\n getArrayEncoder,\n getStructDecoder,\n getStructEncoder,\n getTupleDecoder,\n getTupleEncoder,\n getU32Decoder,\n getU32Encoder,\n getU8Decoder,\n getU8Encoder,\n getUtf8Decoder,\n getUtf8Encoder,\n transformEncoder,\n type Address,\n type Codec,\n type Decoder,\n type Encoder,\n type IAccountMeta,\n type IAccountSignerMeta,\n type IInstruction,\n type IInstructionWithAccounts,\n type IInstructionWithData,\n type ReadonlyAccount,\n type ReadonlySignerAccount,\n type TransactionSigner,\n type WritableAccount,\n type WritableSignerAccount,\n} from '@solana/web3.js';\nimport { DEPHY_ID_PROGRAM_ADDRESS } from '../programs';\nimport { getAccountMetaFactory, type ResolvedAccount } from '../shared';\n\nexport type CreateProductInstruction<\n TProgram extends string = typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountSystemProgram extends\n | string\n | IAccountMeta = '11111111111111111111111111111111',\n TAccountToken2022Program extends\n | string\n | IAccountMeta = 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb',\n TAccountPayer extends string | IAccountMeta = string,\n TAccountVendor extends string | IAccountMeta = string,\n TAccountProductMint extends string | IAccountMeta = string,\n TRemainingAccounts extends readonly IAccountMeta[] = [],\n> = IInstruction &\n IInstructionWithData &\n IInstructionWithAccounts<\n [\n TAccountSystemProgram extends string\n ? ReadonlyAccount\n : TAccountSystemProgram,\n TAccountToken2022Program extends string\n ? ReadonlyAccount\n : TAccountToken2022Program,\n TAccountPayer extends string\n ? WritableSignerAccount &\n IAccountSignerMeta\n : TAccountPayer,\n TAccountVendor extends string\n ? ReadonlySignerAccount &\n IAccountSignerMeta\n : TAccountVendor,\n TAccountProductMint extends string\n ? WritableAccount\n : TAccountProductMint,\n ...TRemainingAccounts,\n ]\n >;\n\nexport type CreateProductInstructionData = {\n discriminator: number;\n name: string;\n symbol: string;\n uri: string;\n additionalMetadata: Array;\n};\n\nexport type CreateProductInstructionDataArgs = {\n name: string;\n symbol: string;\n uri: string;\n additionalMetadata: Array;\n};\n\nexport function getCreateProductInstructionDataEncoder(): Encoder {\n return transformEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['name', addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())],\n ['symbol', addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())],\n ['uri', addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())],\n [\n 'additionalMetadata',\n getArrayEncoder(\n getTupleEncoder([\n addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder()),\n addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder()),\n ])\n ),\n ],\n ]),\n (value) => ({ ...value, discriminator: 1 })\n );\n}\n\nexport function getCreateProductInstructionDataDecoder(): Decoder {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['name', addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())],\n ['symbol', addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())],\n ['uri', addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())],\n [\n 'additionalMetadata',\n getArrayDecoder(\n getTupleDecoder([\n addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder()),\n addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder()),\n ])\n ),\n ],\n ]);\n}\n\nexport function getCreateProductInstructionDataCodec(): Codec<\n CreateProductInstructionDataArgs,\n CreateProductInstructionData\n> {\n return combineCodec(\n getCreateProductInstructionDataEncoder(),\n getCreateProductInstructionDataDecoder()\n );\n}\n\nexport type CreateProductInput<\n TAccountSystemProgram extends string = string,\n TAccountToken2022Program extends string = string,\n TAccountPayer extends string = string,\n TAccountVendor extends string = string,\n TAccountProductMint extends string = string,\n> = {\n /** The system program */\n systemProgram?: Address;\n /** The SPL Token 2022 program */\n token2022Program?: Address;\n /** The account paying for the storage fees */\n payer: TransactionSigner;\n /** The vendor */\n vendor: TransactionSigner;\n /** The mint account of the product */\n productMint: Address;\n name: CreateProductInstructionDataArgs['name'];\n symbol: CreateProductInstructionDataArgs['symbol'];\n uri: CreateProductInstructionDataArgs['uri'];\n additionalMetadata: CreateProductInstructionDataArgs['additionalMetadata'];\n};\n\nexport function getCreateProductInstruction<\n TAccountSystemProgram extends string,\n TAccountToken2022Program extends string,\n TAccountPayer extends string,\n TAccountVendor extends string,\n TAccountProductMint extends string,\n>(\n input: CreateProductInput<\n TAccountSystemProgram,\n TAccountToken2022Program,\n TAccountPayer,\n TAccountVendor,\n TAccountProductMint\n >\n): CreateProductInstruction<\n typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountSystemProgram,\n TAccountToken2022Program,\n TAccountPayer,\n TAccountVendor,\n TAccountProductMint\n> {\n // Program address.\n const programAddress = DEPHY_ID_PROGRAM_ADDRESS;\n\n // Original accounts.\n const originalAccounts = {\n systemProgram: { value: input.systemProgram ?? null, isWritable: false },\n token2022Program: {\n value: input.token2022Program ?? null,\n isWritable: false,\n },\n payer: { value: input.payer ?? null, isWritable: true },\n vendor: { value: input.vendor ?? null, isWritable: false },\n productMint: { value: input.productMint ?? null, isWritable: true },\n };\n const accounts = originalAccounts as Record<\n keyof typeof originalAccounts,\n ResolvedAccount\n >;\n\n // Original args.\n const args = { ...input };\n\n // Resolve default values.\n if (!accounts.systemProgram.value) {\n accounts.systemProgram.value =\n '11111111111111111111111111111111' as Address<'11111111111111111111111111111111'>;\n }\n if (!accounts.token2022Program.value) {\n accounts.token2022Program.value =\n 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb' as Address<'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb'>;\n }\n\n const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');\n const instruction = {\n accounts: [\n getAccountMeta(accounts.systemProgram),\n getAccountMeta(accounts.token2022Program),\n getAccountMeta(accounts.payer),\n getAccountMeta(accounts.vendor),\n getAccountMeta(accounts.productMint),\n ],\n programAddress,\n data: getCreateProductInstructionDataEncoder().encode(\n args as CreateProductInstructionDataArgs\n ),\n } as CreateProductInstruction<\n typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountSystemProgram,\n TAccountToken2022Program,\n TAccountPayer,\n TAccountVendor,\n TAccountProductMint\n >;\n\n return instruction;\n}\n\nexport type ParsedCreateProductInstruction<\n TProgram extends string = typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[],\n> = {\n programAddress: Address;\n accounts: {\n /** The system program */\n systemProgram: TAccountMetas[0];\n /** The SPL Token 2022 program */\n token2022Program: TAccountMetas[1];\n /** The account paying for the storage fees */\n payer: TAccountMetas[2];\n /** The vendor */\n vendor: TAccountMetas[3];\n /** The mint account of the product */\n productMint: TAccountMetas[4];\n };\n data: CreateProductInstructionData;\n};\n\nexport function parseCreateProductInstruction<\n TProgram extends string,\n TAccountMetas extends readonly IAccountMeta[],\n>(\n instruction: IInstruction &\n IInstructionWithAccounts &\n IInstructionWithData\n): ParsedCreateProductInstruction {\n if (instruction.accounts.length < 5) {\n // TODO: Coded error.\n throw new Error('Not enough accounts');\n }\n let accountIndex = 0;\n const getNextAccount = () => {\n const accountMeta = instruction.accounts![accountIndex]!;\n accountIndex += 1;\n return accountMeta;\n };\n return {\n programAddress: instruction.programAddress,\n accounts: {\n systemProgram: getNextAccount(),\n token2022Program: getNextAccount(),\n payer: getNextAccount(),\n vendor: getNextAccount(),\n productMint: getNextAccount(),\n },\n data: getCreateProductInstructionDataDecoder().decode(instruction.data),\n };\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/kinobi-so/kinobi\n */\n\nimport {\n combineCodec,\n getStructDecoder,\n getStructEncoder,\n getU8Decoder,\n getU8Encoder,\n transformEncoder,\n type Address,\n type Codec,\n type Decoder,\n type Encoder,\n type IAccountMeta,\n type IAccountSignerMeta,\n type IInstruction,\n type IInstructionWithAccounts,\n type IInstructionWithData,\n type ReadonlyAccount,\n type ReadonlySignerAccount,\n type TransactionSigner,\n type WritableAccount,\n type WritableSignerAccount,\n} from '@solana/web3.js';\nimport { DEPHY_ID_PROGRAM_ADDRESS } from '../programs';\nimport { getAccountMetaFactory, type ResolvedAccount } from '../shared';\n\nexport type InitializeInstruction<\n TProgram extends string = typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountSystemProgram extends\n | string\n | IAccountMeta = '11111111111111111111111111111111',\n TAccountPayer extends string | IAccountMeta = string,\n TAccountProgramData extends string | IAccountMeta = string,\n TAccountAuthority extends string | IAccountMeta = string,\n TRemainingAccounts extends readonly IAccountMeta[] = [],\n> = IInstruction &\n IInstructionWithData &\n IInstructionWithAccounts<\n [\n TAccountSystemProgram extends string\n ? ReadonlyAccount\n : TAccountSystemProgram,\n TAccountPayer extends string\n ? WritableSignerAccount &\n IAccountSignerMeta\n : TAccountPayer,\n TAccountProgramData extends string\n ? WritableAccount\n : TAccountProgramData,\n TAccountAuthority extends string\n ? ReadonlySignerAccount &\n IAccountSignerMeta\n : TAccountAuthority,\n ...TRemainingAccounts,\n ]\n >;\n\nexport type InitializeInstructionData = { discriminator: number; bump: number };\n\nexport type InitializeInstructionDataArgs = { bump: number };\n\nexport function getInitializeInstructionDataEncoder(): Encoder {\n return transformEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['bump', getU8Encoder()],\n ]),\n (value) => ({ ...value, discriminator: 0 })\n );\n}\n\nexport function getInitializeInstructionDataDecoder(): Decoder {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['bump', getU8Decoder()],\n ]);\n}\n\nexport function getInitializeInstructionDataCodec(): Codec<\n InitializeInstructionDataArgs,\n InitializeInstructionData\n> {\n return combineCodec(\n getInitializeInstructionDataEncoder(),\n getInitializeInstructionDataDecoder()\n );\n}\n\nexport type InitializeInput<\n TAccountSystemProgram extends string = string,\n TAccountPayer extends string = string,\n TAccountProgramData extends string = string,\n TAccountAuthority extends string = string,\n> = {\n /** The system program */\n systemProgram?: Address;\n /** The account paying for the storage fees */\n payer: TransactionSigner;\n /** The program data account for the program */\n programData: Address;\n /** The authority account of the program */\n authority: TransactionSigner;\n bump: InitializeInstructionDataArgs['bump'];\n};\n\nexport function getInitializeInstruction<\n TAccountSystemProgram extends string,\n TAccountPayer extends string,\n TAccountProgramData extends string,\n TAccountAuthority extends string,\n>(\n input: InitializeInput<\n TAccountSystemProgram,\n TAccountPayer,\n TAccountProgramData,\n TAccountAuthority\n >\n): InitializeInstruction<\n typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountSystemProgram,\n TAccountPayer,\n TAccountProgramData,\n TAccountAuthority\n> {\n // Program address.\n const programAddress = DEPHY_ID_PROGRAM_ADDRESS;\n\n // Original accounts.\n const originalAccounts = {\n systemProgram: { value: input.systemProgram ?? null, isWritable: false },\n payer: { value: input.payer ?? null, isWritable: true },\n programData: { value: input.programData ?? null, isWritable: true },\n authority: { value: input.authority ?? null, isWritable: false },\n };\n const accounts = originalAccounts as Record<\n keyof typeof originalAccounts,\n ResolvedAccount\n >;\n\n // Original args.\n const args = { ...input };\n\n // Resolve default values.\n if (!accounts.systemProgram.value) {\n accounts.systemProgram.value =\n '11111111111111111111111111111111' as Address<'11111111111111111111111111111111'>;\n }\n\n const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');\n const instruction = {\n accounts: [\n getAccountMeta(accounts.systemProgram),\n getAccountMeta(accounts.payer),\n getAccountMeta(accounts.programData),\n getAccountMeta(accounts.authority),\n ],\n programAddress,\n data: getInitializeInstructionDataEncoder().encode(\n args as InitializeInstructionDataArgs\n ),\n } as InitializeInstruction<\n typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountSystemProgram,\n TAccountPayer,\n TAccountProgramData,\n TAccountAuthority\n >;\n\n return instruction;\n}\n\nexport type ParsedInitializeInstruction<\n TProgram extends string = typeof DEPHY_ID_PROGRAM_ADDRESS,\n TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[],\n> = {\n programAddress: Address;\n accounts: {\n /** The system program */\n systemProgram: TAccountMetas[0];\n /** The account paying for the storage fees */\n payer: TAccountMetas[1];\n /** The program data account for the program */\n programData: TAccountMetas[2];\n /** The authority account of the program */\n authority: TAccountMetas[3];\n };\n data: InitializeInstructionData;\n};\n\nexport function parseInitializeInstruction<\n TProgram extends string,\n TAccountMetas extends readonly IAccountMeta[],\n>(\n instruction: IInstruction &\n IInstructionWithAccounts &\n IInstructionWithData\n): ParsedInitializeInstruction {\n if (instruction.accounts.length < 4) {\n // TODO: Coded error.\n throw new Error('Not enough accounts');\n }\n let accountIndex = 0;\n const getNextAccount = () => {\n const accountMeta = instruction.accounts![accountIndex]!;\n accountIndex += 1;\n return accountMeta;\n };\n return {\n programAddress: instruction.programAddress,\n accounts: {\n systemProgram: getNextAccount(),\n payer: getNextAccount(),\n programData: getNextAccount(),\n authority: getNextAccount(),\n },\n data: getInitializeInstructionDataDecoder().decode(instruction.data),\n };\n}\n"]} \ No newline at end of file diff --git a/clients/js/dist/test/_setup.js b/clients/js/dist/test/_setup.js index 8c24d02..d3eda65 100644 --- a/clients/js/dist/test/_setup.js +++ b/clients/js/dist/test/_setup.js @@ -1,7 +1,6 @@ 'use strict'; var web3_js = require('@solana/web3.js'); -var src = require('../src'); const createDefaultSolanaClient = () => { const rpc = web3_js.createSolanaRpc("http://127.0.0.1:8899"); @@ -34,21 +33,7 @@ const signAndSendTransaction = async (client, transactionMessage, commitment = " return signature; }; const getBalance = async (client, address) => (await client.rpc.getBalance(address, { commitment: "confirmed" }).send()).value; -const createCounterForAuthority = async (client, authority) => { - const [transaction, counterPda, createIx] = await Promise.all([ - createDefaultTransaction(client, authority), - src.findCounterPda({ authority: authority.address }), - src.getCreateInstructionAsync({ authority }) - ]); - await web3_js.pipe( - transaction, - (tx) => web3_js.appendTransactionMessageInstruction(createIx, tx), - (tx) => signAndSendTransaction(client, tx) - ); - return counterPda; -}; -exports.createCounterForAuthority = createCounterForAuthority; exports.createDefaultSolanaClient = createDefaultSolanaClient; exports.createDefaultTransaction = createDefaultTransaction; exports.generateKeyPairSignerWithSol = generateKeyPairSignerWithSol; diff --git a/clients/js/dist/test/_setup.js.map b/clients/js/dist/test/_setup.js.map index 353eea9..1df374a 100644 --- a/clients/js/dist/test/_setup.js.map +++ b/clients/js/dist/test/_setup.js.map @@ -1 +1 @@ -{"version":3,"sources":["../../test/_setup.ts"],"names":[],"mappings":"AAAA;AAAA,EAWE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,gBAAgB,iCAAiC;AAOnD,MAAM,4BAA4B,MAAc;AACrD,QAAM,MAAM,gBAAgB,uBAAuB;AACnD,QAAM,mBAAmB,6BAA6B,qBAAqB;AAC3E,SAAO,EAAE,KAAK,iBAAiB;AACjC;AAEO,MAAM,+BAA+B,OAC1C,QACA,mBAA2B,gBACxB;AACH,QAAM,SAAS,MAAM,sBAAsB;AAC3C,QAAM,eAAe,MAAM,EAAE;AAAA,IAC3B,kBAAkB,OAAO;AAAA,IACzB,UAAU,SAAS,gBAAgB;AAAA,IACnC,YAAY;AAAA,EACd,CAAC;AACD,SAAO;AACT;AAEO,MAAM,2BAA2B,OACtC,QACA,aACG;AACH,QAAM,EAAE,OAAO,gBAAgB,IAAI,MAAM,OAAO,IAC7C,mBAAmB,EACnB,KAAK;AACR,SAAO;AAAA,IACL,yBAAyB,EAAE,SAAS,EAAE,CAAC;AAAA,IACvC,CAAC,OAAO,oCAAoC,UAAU,EAAE;AAAA,IACxD,CAAC,OAAO,4CAA4C,iBAAiB,EAAE;AAAA,EACzE;AACF;AAEO,MAAM,yBAAyB,OACpC,QACA,oBAEA,aAAyB,gBACtB;AACH,QAAM,oBACJ,MAAM,kCAAkC,kBAAkB;AAC5D,QAAM,YAAY,4BAA4B,iBAAiB;AAC/D,QAAM,iCAAiC,MAAM,EAAE,mBAAmB;AAAA,IAChE;AAAA,EACF,CAAC;AACD,SAAO;AACT;AAEO,MAAM,aAAa,OAAO,QAAgB,aAC9C,MAAM,OAAO,IAAI,WAAW,SAAS,EAAE,YAAY,YAAY,CAAC,EAAE,KAAK,GACrE;AAEE,MAAM,4BAA4B,OACvC,QACA,cACmC;AACnC,QAAM,CAAC,aAAa,YAAY,QAAQ,IAAI,MAAM,QAAQ,IAAI;AAAA,IAC5D,yBAAyB,QAAQ,SAAS;AAAA,IAC1C,eAAe,EAAE,WAAW,UAAU,QAAQ,CAAC;AAAA,IAC/C,0BAA0B,EAAE,UAAU,CAAC;AAAA,EACzC,CAAC;AACD,QAAM;AAAA,IACJ;AAAA,IACA,CAAC,OAAO,oCAAoC,UAAU,EAAE;AAAA,IACxD,CAAC,OAAO,uBAAuB,QAAQ,EAAE;AAAA,EAC3C;AACA,SAAO;AACT","sourcesContent":["import {\n Address,\n Commitment,\n CompilableTransactionMessage,\n TransactionMessageWithBlockhashLifetime,\n ProgramDerivedAddress,\n Rpc,\n RpcSubscriptions,\n SolanaRpcApi,\n SolanaRpcSubscriptionsApi,\n TransactionSigner,\n airdropFactory,\n appendTransactionMessageInstruction,\n createSolanaRpc,\n createSolanaRpcSubscriptions,\n createTransactionMessage,\n generateKeyPairSigner,\n getSignatureFromTransaction,\n lamports,\n pipe,\n sendAndConfirmTransactionFactory,\n setTransactionMessageFeePayerSigner,\n setTransactionMessageLifetimeUsingBlockhash,\n signTransactionMessageWithSigners,\n} from '@solana/web3.js';\nimport { findCounterPda, getCreateInstructionAsync } from '../src';\n\ntype Client = {\n rpc: Rpc;\n rpcSubscriptions: RpcSubscriptions;\n};\n\nexport const createDefaultSolanaClient = (): Client => {\n const rpc = createSolanaRpc('http://127.0.0.1:8899');\n const rpcSubscriptions = createSolanaRpcSubscriptions('ws://127.0.0.1:8900');\n return { rpc, rpcSubscriptions };\n};\n\nexport const generateKeyPairSignerWithSol = async (\n client: Client,\n putativeLamports: bigint = 1_000_000_000n\n) => {\n const signer = await generateKeyPairSigner();\n await airdropFactory(client)({\n recipientAddress: signer.address,\n lamports: lamports(putativeLamports),\n commitment: 'confirmed',\n });\n return signer;\n};\n\nexport const createDefaultTransaction = async (\n client: Client,\n feePayer: TransactionSigner\n) => {\n const { value: latestBlockhash } = await client.rpc\n .getLatestBlockhash()\n .send();\n return pipe(\n createTransactionMessage({ version: 0 }),\n (tx) => setTransactionMessageFeePayerSigner(feePayer, tx),\n (tx) => setTransactionMessageLifetimeUsingBlockhash(latestBlockhash, tx)\n );\n};\n\nexport const signAndSendTransaction = async (\n client: Client,\n transactionMessage: CompilableTransactionMessage &\n TransactionMessageWithBlockhashLifetime,\n commitment: Commitment = 'confirmed'\n) => {\n const signedTransaction =\n await signTransactionMessageWithSigners(transactionMessage);\n const signature = getSignatureFromTransaction(signedTransaction);\n await sendAndConfirmTransactionFactory(client)(signedTransaction, {\n commitment,\n });\n return signature;\n};\n\nexport const getBalance = async (client: Client, address: Address) =>\n (await client.rpc.getBalance(address, { commitment: 'confirmed' }).send())\n .value;\n\nexport const createCounterForAuthority = async (\n client: Client,\n authority: TransactionSigner\n): Promise => {\n const [transaction, counterPda, createIx] = await Promise.all([\n createDefaultTransaction(client, authority),\n findCounterPda({ authority: authority.address }),\n getCreateInstructionAsync({ authority }),\n ]);\n await pipe(\n transaction,\n (tx) => appendTransactionMessageInstruction(createIx, tx),\n (tx) => signAndSendTransaction(client, tx)\n );\n return counterPda;\n};\n"]} \ No newline at end of file +{"version":3,"sources":["../../test/_setup.ts"],"names":[],"mappings":"AAAA;AAAA,EAUE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAOA,MAAM,4BAA4B,MAAc;AACrD,QAAM,MAAM,gBAAgB,uBAAuB;AACnD,QAAM,mBAAmB,6BAA6B,qBAAqB;AAC3E,SAAO,EAAE,KAAK,iBAAiB;AACjC;AAEO,MAAM,+BAA+B,OAC1C,QACA,mBAA2B,gBACxB;AACH,QAAM,SAAS,MAAM,sBAAsB;AAC3C,QAAM,eAAe,MAAM,EAAE;AAAA,IAC3B,kBAAkB,OAAO;AAAA,IACzB,UAAU,SAAS,gBAAgB;AAAA,IACnC,YAAY;AAAA,EACd,CAAC;AACD,SAAO;AACT;AAEO,MAAM,2BAA2B,OACtC,QACA,aACG;AACH,QAAM,EAAE,OAAO,gBAAgB,IAAI,MAAM,OAAO,IAC7C,mBAAmB,EACnB,KAAK;AACR,SAAO;AAAA,IACL,yBAAyB,EAAE,SAAS,EAAE,CAAC;AAAA,IACvC,CAAC,OAAO,oCAAoC,UAAU,EAAE;AAAA,IACxD,CAAC,OAAO,4CAA4C,iBAAiB,EAAE;AAAA,EACzE;AACF;AAEO,MAAM,yBAAyB,OACpC,QACA,oBAEA,aAAyB,gBACtB;AACH,QAAM,oBACJ,MAAM,kCAAkC,kBAAkB;AAC5D,QAAM,YAAY,4BAA4B,iBAAiB;AAC/D,QAAM,iCAAiC,MAAM,EAAE,mBAAmB;AAAA,IAChE;AAAA,EACF,CAAC;AACD,SAAO;AACT;AAEO,MAAM,aAAa,OAAO,QAAgB,aAC9C,MAAM,OAAO,IAAI,WAAW,SAAS,EAAE,YAAY,YAAY,CAAC,EAAE,KAAK,GACrE","sourcesContent":["import {\n Address,\n Commitment,\n CompilableTransactionMessage,\n TransactionMessageWithBlockhashLifetime,\n Rpc,\n RpcSubscriptions,\n SolanaRpcApi,\n SolanaRpcSubscriptionsApi,\n TransactionSigner,\n airdropFactory,\n createSolanaRpc,\n createSolanaRpcSubscriptions,\n createTransactionMessage,\n generateKeyPairSigner,\n getSignatureFromTransaction,\n lamports,\n pipe,\n sendAndConfirmTransactionFactory,\n setTransactionMessageFeePayerSigner,\n setTransactionMessageLifetimeUsingBlockhash,\n signTransactionMessageWithSigners,\n} from '@solana/web3.js';\n\ntype Client = {\n rpc: Rpc;\n rpcSubscriptions: RpcSubscriptions;\n};\n\nexport const createDefaultSolanaClient = (): Client => {\n const rpc = createSolanaRpc('http://127.0.0.1:8899');\n const rpcSubscriptions = createSolanaRpcSubscriptions('ws://127.0.0.1:8900');\n return { rpc, rpcSubscriptions };\n};\n\nexport const generateKeyPairSignerWithSol = async (\n client: Client,\n putativeLamports: bigint = 1_000_000_000n\n) => {\n const signer = await generateKeyPairSigner();\n await airdropFactory(client)({\n recipientAddress: signer.address,\n lamports: lamports(putativeLamports),\n commitment: 'confirmed',\n });\n return signer;\n};\n\nexport const createDefaultTransaction = async (\n client: Client,\n feePayer: TransactionSigner\n) => {\n const { value: latestBlockhash } = await client.rpc\n .getLatestBlockhash()\n .send();\n return pipe(\n createTransactionMessage({ version: 0 }),\n (tx) => setTransactionMessageFeePayerSigner(feePayer, tx),\n (tx) => setTransactionMessageLifetimeUsingBlockhash(latestBlockhash, tx)\n );\n};\n\nexport const signAndSendTransaction = async (\n client: Client,\n transactionMessage: CompilableTransactionMessage &\n TransactionMessageWithBlockhashLifetime,\n commitment: Commitment = 'confirmed'\n) => {\n const signedTransaction =\n await signTransactionMessageWithSigners(transactionMessage);\n const signature = getSignatureFromTransaction(signedTransaction);\n await sendAndConfirmTransactionFactory(client)(signedTransaction, {\n commitment,\n });\n return signature;\n};\n\nexport const getBalance = async (client: Client, address: Address) =>\n (await client.rpc.getBalance(address, { commitment: 'confirmed' }).send())\n .value;\n"]} \ No newline at end of file diff --git a/clients/js/dist/test/create.test.js b/clients/js/dist/test/create.test.js deleted file mode 100644 index bbfb8c7..0000000 --- a/clients/js/dist/test/create.test.js +++ /dev/null @@ -1,51 +0,0 @@ -'use strict'; - -var web3_js = require('@solana/web3.js'); -var test = require('ava'); -var src = require('../src'); -var _setup = require('./_setup'); - -function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; } - -var test__default = /*#__PURE__*/_interopDefault(test); - -var __getOwnPropNames = Object.getOwnPropertyNames; -var __esm = (fn, res) => function __init() { - return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res; -}; -var __commonJS = (cb, mod) => function __require() { - return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; -}; -var init_env_shim = __esm({ - "env-shim.ts"() { - } -}); -var require_create_test = __commonJS({ - "test/create.test.ts"() { - init_env_shim(); - test__default.default("it creates a new counter account", async (t) => { - const client = _setup.createDefaultSolanaClient(); - const authority = await _setup.generateKeyPairSignerWithSol(client); - const createIx = await src.getCreateInstructionAsync({ authority }); - await web3_js.pipe( - await _setup.createDefaultTransaction(client, authority), - (tx) => web3_js.appendTransactionMessageInstruction(createIx, tx), - (tx) => _setup.signAndSendTransaction(client, tx) - ); - const counter = await src.fetchCounterFromSeeds(client.rpc, { - authority: authority.address - }); - t.like(counter, { - data: { - authority: authority.address, - value: 0 - } - }); - }); - } -}); -var create_test = require_create_test(); - -module.exports = create_test; -//# sourceMappingURL=out.js.map -//# sourceMappingURL=create.test.js.map \ No newline at end of file diff --git a/clients/js/dist/test/create.test.js.map b/clients/js/dist/test/create.test.js.map deleted file mode 100644 index b1ba729..0000000 --- a/clients/js/dist/test/create.test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../../env-shim.ts","../../test/create.test.ts"],"names":[],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA;AAAA,EAEE;AAAA,EACA;AAAA,OACK;AACP,OAAO,UAAU;AACjB;AAAA,EAEE;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAhBP;AAAA;AAAA;AAkBA,SAAK,oCAAoC,OAAO,MAAM;AAEpD,YAAM,SAAS,0BAA0B;AACzC,YAAM,YAAY,MAAM,6BAA6B,MAAM;AAG3D,YAAM,WAAW,MAAM,0BAA0B,EAAE,UAAU,CAAC;AAC9D,YAAM;AAAA,QACJ,MAAM,yBAAyB,QAAQ,SAAS;AAAA,QAChD,CAAC,OAAO,oCAAoC,UAAU,EAAE;AAAA,QACxD,CAAC,OAAO,uBAAuB,QAAQ,EAAE;AAAA,MAC3C;AAGA,YAAM,UAAU,MAAM,sBAAsB,OAAO,KAAK;AAAA,QACtD,WAAW,UAAU;AAAA,MACvB,CAAC;AACD,QAAE,KAAK,SAA2B;AAAA,QAChC,MAAM;AAAA,UACJ,WAAW,UAAU;AAAA,UACrB,OAAO;AAAA,QACT;AAAA,MACF,CAAC;AAAA,IACH,CAAC;AAAA;AAAA","sourcesContent":["// Clever obfuscation to prevent the build system from inlining the value of `NODE_ENV`\nexport const __DEV__ = /* @__PURE__ */ (() =>\n (process as any)['en' + 'v'].NODE_ENV === 'development')();\n","import {\n Account,\n appendTransactionMessageInstruction,\n pipe,\n} from '@solana/web3.js';\nimport test from 'ava';\nimport {\n Counter,\n fetchCounterFromSeeds,\n getCreateInstructionAsync,\n} from '../src';\nimport {\n createDefaultSolanaClient,\n createDefaultTransaction,\n generateKeyPairSignerWithSol,\n signAndSendTransaction,\n} from './_setup';\n\ntest('it creates a new counter account', async (t) => {\n // Given an authority key pair with some SOL.\n const client = createDefaultSolanaClient();\n const authority = await generateKeyPairSignerWithSol(client);\n\n // When we create a new counter account.\n const createIx = await getCreateInstructionAsync({ authority });\n await pipe(\n await createDefaultTransaction(client, authority),\n (tx) => appendTransactionMessageInstruction(createIx, tx),\n (tx) => signAndSendTransaction(client, tx)\n );\n\n // Then we expect the counter account to exist and have a value of 0.\n const counter = await fetchCounterFromSeeds(client.rpc, {\n authority: authority.address,\n });\n t.like(counter, >{\n data: {\n authority: authority.address,\n value: 0,\n },\n });\n});\n"]} \ No newline at end of file diff --git a/clients/js/dist/test/increment.test.js b/clients/js/dist/test/increment.test.js deleted file mode 100644 index 828918c..0000000 --- a/clients/js/dist/test/increment.test.js +++ /dev/null @@ -1,122 +0,0 @@ -'use strict'; - -var web3_js = require('@solana/web3.js'); -var test = require('ava'); -var src = require('../src'); -var _setup = require('./_setup'); - -function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; } - -var test__default = /*#__PURE__*/_interopDefault(test); - -var __getOwnPropNames = Object.getOwnPropertyNames; -var __esm = (fn, res) => function __init() { - return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res; -}; -var __commonJS = (cb, mod) => function __require() { - return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; -}; -var init_env_shim = __esm({ - "env-shim.ts"() { - } -}); -var require_increment_test = __commonJS({ - "test/increment.test.ts"() { - init_env_shim(); - test__default.default("it increments an existing counter by 1 by default", async (t) => { - const client = _setup.createDefaultSolanaClient(); - const authority = await _setup.generateKeyPairSignerWithSol(client); - const [counterPda] = await _setup.createCounterForAuthority(client, authority); - t.is((await src.fetchCounter(client.rpc, counterPda)).data.value, 0); - const incrementIx = await src.getIncrementInstructionAsync({ authority }); - await web3_js.pipe( - await _setup.createDefaultTransaction(client, authority), - (tx) => web3_js.appendTransactionMessageInstruction(incrementIx, tx), - (tx) => _setup.signAndSendTransaction(client, tx) - ); - const counter = await src.fetchCounter(client.rpc, counterPda); - t.is(counter.data.value, 1); - }); - test__default.default("it can increment an existing counter by a specified amount", async (t) => { - const client = _setup.createDefaultSolanaClient(); - const authority = await _setup.generateKeyPairSignerWithSol(client); - const [counterPda] = await _setup.createCounterForAuthority(client, authority); - t.is((await src.fetchCounter(client.rpc, counterPda)).data.value, 0); - const incrementIx = await src.getIncrementInstructionAsync({ - authority, - amount: 5 - }); - await web3_js.pipe( - await _setup.createDefaultTransaction(client, authority), - (tx) => web3_js.appendTransactionMessageInstruction(incrementIx, tx), - (tx) => _setup.signAndSendTransaction(client, tx) - ); - const counter = await src.fetchCounter(client.rpc, counterPda); - t.is(counter.data.value, 5); - }); - test__default.default("it cannot increment a counter that does not exist", async (t) => { - const client = _setup.createDefaultSolanaClient(); - const authority = await _setup.generateKeyPairSignerWithSol(client); - const [counterPda] = await src.findCounterPda({ authority: authority.address }); - t.is(await _setup.getBalance(client, counterPda), web3_js.lamports(0n)); - const incrementIx = await src.getIncrementInstructionAsync({ authority }); - const transactionMessage = web3_js.pipe( - await _setup.createDefaultTransaction(client, authority), - (tx) => web3_js.appendTransactionMessageInstruction(incrementIx, tx) - ); - const promise = _setup.signAndSendTransaction(client, transactionMessage); - const error = await t.throwsAsync(promise); - t.true( - web3_js.isSolanaError( - error, - web3_js.SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE - ) - ); - t.true( - web3_js.isProgramError( - error.cause, - transactionMessage, - src.DEPHY_ID_PROGRAM_ADDRESS, - src.DEPHY_ID_ERROR__INVALID_PROGRAM_OWNER - ) - ); - }); - test__default.default("it cannot increment a counter that belongs to another authority", async (t) => { - const client = _setup.createDefaultSolanaClient(); - const [authorityA, authorityB] = await Promise.all([ - _setup.generateKeyPairSignerWithSol(client), - _setup.generateKeyPairSignerWithSol(client) - ]); - const [counterPda] = await _setup.createCounterForAuthority(client, authorityA); - const incrementIx = src.getIncrementInstruction({ - authority: authorityB, - counter: counterPda - }); - const transactionMessage = web3_js.pipe( - await _setup.createDefaultTransaction(client, authorityB), - (tx) => web3_js.appendTransactionMessageInstruction(incrementIx, tx) - ); - const promise = _setup.signAndSendTransaction(client, transactionMessage); - const error = await t.throwsAsync(promise); - t.true( - web3_js.isSolanaError( - error, - web3_js.SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE - ) - ); - t.true( - web3_js.isProgramError( - error.cause, - transactionMessage, - src.DEPHY_ID_PROGRAM_ADDRESS, - src.DEPHY_ID_ERROR__INVALID_PDA - ) - ); - }); - } -}); -var increment_test = require_increment_test(); - -module.exports = increment_test; -//# sourceMappingURL=out.js.map -//# sourceMappingURL=increment.test.js.map \ No newline at end of file diff --git a/clients/js/dist/test/increment.test.js.map b/clients/js/dist/test/increment.test.js.map deleted file mode 100644 index 8f8fea8..0000000 --- a/clients/js/dist/test/increment.test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../../env-shim.ts","../../test/increment.test.ts"],"names":[],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,OAAO,UAAU;AACjB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAzBP;AAAA;AAAA;AA2BA,SAAK,qDAAqD,OAAO,MAAM;AAErE,YAAM,SAAS,0BAA0B;AACzC,YAAM,YAAY,MAAM,6BAA6B,MAAM;AAC3D,YAAM,CAAC,UAAU,IAAI,MAAM,0BAA0B,QAAQ,SAAS;AACtE,QAAE,IAAI,MAAM,aAAa,OAAO,KAAK,UAAU,GAAG,KAAK,OAAO,CAAC;AAG/D,YAAM,cAAc,MAAM,6BAA6B,EAAE,UAAU,CAAC;AACpE,YAAM;AAAA,QACJ,MAAM,yBAAyB,QAAQ,SAAS;AAAA,QAChD,CAAC,OAAO,oCAAoC,aAAa,EAAE;AAAA,QAC3D,CAAC,OAAO,uBAAuB,QAAQ,EA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AAA,UACA;AAAA,QACF;AAAA,MACF;AACA,QAAE;AAAA,QACA;AAAA,UACE,MAAM;AAAA,UACN;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,MACF;AAAA,IACF,CAAC;AAED,SAAK,mEAAmE,OAAO,MAAM;AAGnF,YAAM,SAAS,0BAA0B;AACzC,YAAM,CAAC,YAAY,UAAU,IAAI,MAAM,QAAQ,IAAI;AAAA,QACjD,6BAA6B,MAAM;AAAA,QACnC,6BAA6B,MAAM;AAAA,MACrC,CAAC;AACD,YAAM,CAAC,UAAU,IAAI,MAAM,0BAA0B,QAAQ,UAAU;AAGvE,YAAM,cAAc,wBAAwB;AAAA,QAC1C,WAAW;AAAA,QACX,SAAS;AAAA,MACX,CAAC;AACD,YAAM,qBAAqB;AAAA,QACzB,MAAM,yBAAyB,QAAQ,UAAU;AAAA,QACjD,CAAC,OAAO,oCAAoC,aAAa,EAAE;AAAA,MAC7D;AACA,YAAM,UAAU,uBAAuB,QAAQ,kBAAkB;AAGjE,YAAM,QAAQ,MAAM,EAAE,YAAY,OAAO;AACzC,QAAE;AAAA,QACA;AAAA,UACE;AAAA,UACA;AAAA,QACF;AAAA,MACF;AACA,QAAE;AAAA,QACA;AAAA,UACE,MAAM;AAAA,UACN;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,MACF;AAAA,IACF,CAAC;AAAA;AAAA","sourcesContent":["// Clever obfuscation to prevent the build system from inlining the value of `NODE_ENV`\nexport const __DEV__ = /* @__PURE__ */ (() =>\n (process as any)['en' + 'v'].NODE_ENV === 'development')();\n","import {\n SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE,\n appendTransactionMessageInstruction,\n isProgramError,\n isSolanaError,\n lamports,\n pipe,\n} from '@solana/web3.js';\nimport test from 'ava';\nimport {\n DEPHY_ID_ERROR__INVALID_PDA,\n DEPHY_ID_ERROR__INVALID_PROGRAM_OWNER,\n DEPHY_ID_PROGRAM_ADDRESS,\n fetchCounter,\n findCounterPda,\n getIncrementInstruction,\n getIncrementInstructionAsync,\n} from '../src';\nimport {\n createCounterForAuthority,\n createDefaultSolanaClient,\n createDefaultTransaction,\n generateKeyPairSignerWithSol,\n getBalance,\n signAndSendTransaction,\n} from './_setup';\n\ntest('it increments an existing counter by 1 by default', async (t) => {\n // Given an authority key pair with an associated counter account of value 0.\n const client = createDefaultSolanaClient();\n const authority = await generateKeyPairSignerWithSol(client);\n const [counterPda] = await createCounterForAuthority(client, authority);\n t.is((await fetchCounter(client.rpc, counterPda)).data.value, 0);\n\n // When we increment the counter account.\n const incrementIx = await getIncrementInstructionAsync({ authority });\n await pipe(\n await createDefaultTransaction(client, authority),\n (tx) => appendTransactionMessageInstruction(incrementIx, tx),\n (tx) => signAndSendTransaction(client, tx)\n );\n\n // Then we expect the counter account to have a value of 1.\n const counter = await fetchCounter(client.rpc, counterPda);\n t.is(counter.data.value, 1);\n});\n\ntest('it can increment an existing counter by a specified amount', async (t) => {\n // Given an authority key pair with an associated counter account of value 0.\n const client = createDefaultSolanaClient();\n const authority = await generateKeyPairSignerWithSol(client);\n const [counterPda] = await createCounterForAuthority(client, authority);\n t.is((await fetchCounter(client.rpc, counterPda)).data.value, 0);\n\n // When we increment the counter account by 5.\n const incrementIx = await getIncrementInstructionAsync({\n authority,\n amount: 5,\n });\n await pipe(\n await createDefaultTransaction(client, authority),\n (tx) => appendTransactionMessageInstruction(incrementIx, tx),\n (tx) => signAndSendTransaction(client, tx)\n );\n\n // Then we expect the counter account to have a value of 5.\n const counter = await fetchCounter(client.rpc, counterPda);\n t.is(counter.data.value, 5);\n});\n\ntest('it cannot increment a counter that does not exist', async (t) => {\n // Given an authority key pair with no associated counter account.\n const client = createDefaultSolanaClient();\n const authority = await generateKeyPairSignerWithSol(client);\n const [counterPda] = await findCounterPda({ authority: authority.address });\n t.is(await getBalance(client, counterPda), lamports(0n));\n\n // When we try to increment the inexistent counter account.\n const incrementIx = await getIncrementInstructionAsync({ authority });\n const transactionMessage = pipe(\n await createDefaultTransaction(client, authority),\n (tx) => appendTransactionMessageInstruction(incrementIx, tx)\n );\n const promise = signAndSendTransaction(client, transactionMessage);\n\n // Then we expect the program to throw an error.\n const error = await t.throwsAsync(promise);\n t.true(\n isSolanaError(\n error,\n SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE\n )\n );\n t.true(\n isProgramError(\n error.cause,\n transactionMessage,\n DEPHY_ID_PROGRAM_ADDRESS,\n DEPHY_ID_ERROR__INVALID_PROGRAM_OWNER\n )\n );\n});\n\ntest('it cannot increment a counter that belongs to another authority', async (t) => {\n // Given two authority key pairs such that\n // only one of them (authority A) is associated with a counter account.\n const client = createDefaultSolanaClient();\n const [authorityA, authorityB] = await Promise.all([\n generateKeyPairSignerWithSol(client),\n generateKeyPairSignerWithSol(client),\n ]);\n const [counterPda] = await createCounterForAuthority(client, authorityA);\n\n // When authority B tries to increment the counter account of authority A.\n const incrementIx = getIncrementInstruction({\n authority: authorityB,\n counter: counterPda,\n });\n const transactionMessage = pipe(\n await createDefaultTransaction(client, authorityB),\n (tx) => appendTransactionMessageInstruction(incrementIx, tx)\n );\n const promise = signAndSendTransaction(client, transactionMessage);\n\n // Then we expect the program to throw an error.\n const error = await t.throwsAsync(promise);\n t.true(\n isSolanaError(\n error,\n SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE\n )\n );\n t.true(\n isProgramError(\n error.cause,\n transactionMessage,\n DEPHY_ID_PROGRAM_ADDRESS,\n DEPHY_ID_ERROR__INVALID_PDA\n )\n );\n});\n"]} \ No newline at end of file diff --git a/clients/js/test/_setup.ts b/clients/js/test/_setup.ts index aaabfc2..344e5fe 100644 --- a/clients/js/test/_setup.ts +++ b/clients/js/test/_setup.ts @@ -3,14 +3,12 @@ import { Commitment, CompilableTransactionMessage, TransactionMessageWithBlockhashLifetime, - ProgramDerivedAddress, Rpc, RpcSubscriptions, SolanaRpcApi, SolanaRpcSubscriptionsApi, TransactionSigner, airdropFactory, - appendTransactionMessageInstruction, createSolanaRpc, createSolanaRpcSubscriptions, createTransactionMessage, @@ -23,7 +21,6 @@ import { setTransactionMessageLifetimeUsingBlockhash, signTransactionMessageWithSigners, } from '@solana/web3.js'; -import { findCounterPda, getCreateInstructionAsync } from '../src'; type Client = { rpc: Rpc; @@ -81,20 +78,3 @@ export const signAndSendTransaction = async ( export const getBalance = async (client: Client, address: Address) => (await client.rpc.getBalance(address, { commitment: 'confirmed' }).send()) .value; - -export const createCounterForAuthority = async ( - client: Client, - authority: TransactionSigner -): Promise => { - const [transaction, counterPda, createIx] = await Promise.all([ - createDefaultTransaction(client, authority), - findCounterPda({ authority: authority.address }), - getCreateInstructionAsync({ authority }), - ]); - await pipe( - transaction, - (tx) => appendTransactionMessageInstruction(createIx, tx), - (tx) => signAndSendTransaction(client, tx) - ); - return counterPda; -}; diff --git a/clients/js/test/create.test.ts b/clients/js/test/create.test.ts deleted file mode 100644 index b1a5376..0000000 --- a/clients/js/test/create.test.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { - Account, - appendTransactionMessageInstruction, - pipe, -} from '@solana/web3.js'; -import test from 'ava'; -import { - Counter, - fetchCounterFromSeeds, - getCreateInstructionAsync, -} from '../src'; -import { - createDefaultSolanaClient, - createDefaultTransaction, - generateKeyPairSignerWithSol, - signAndSendTransaction, -} from './_setup'; - -test('it creates a new counter account', async (t) => { - // Given an authority key pair with some SOL. - const client = createDefaultSolanaClient(); - const authority = await generateKeyPairSignerWithSol(client); - - // When we create a new counter account. - const createIx = await getCreateInstructionAsync({ authority }); - await pipe( - await createDefaultTransaction(client, authority), - (tx) => appendTransactionMessageInstruction(createIx, tx), - (tx) => signAndSendTransaction(client, tx) - ); - - // Then we expect the counter account to exist and have a value of 0. - const counter = await fetchCounterFromSeeds(client.rpc, { - authority: authority.address, - }); - t.like(counter, >{ - data: { - authority: authority.address, - value: 0, - }, - }); -}); diff --git a/clients/js/test/increment.test.ts b/clients/js/test/increment.test.ts deleted file mode 100644 index 228c4a1..0000000 --- a/clients/js/test/increment.test.ts +++ /dev/null @@ -1,141 +0,0 @@ -import { - SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE, - appendTransactionMessageInstruction, - isProgramError, - isSolanaError, - lamports, - pipe, -} from '@solana/web3.js'; -import test from 'ava'; -import { - DEPHY_ID_ERROR__INVALID_PDA, - DEPHY_ID_ERROR__INVALID_PROGRAM_OWNER, - DEPHY_ID_PROGRAM_ADDRESS, - fetchCounter, - findCounterPda, - getIncrementInstruction, - getIncrementInstructionAsync, -} from '../src'; -import { - createCounterForAuthority, - createDefaultSolanaClient, - createDefaultTransaction, - generateKeyPairSignerWithSol, - getBalance, - signAndSendTransaction, -} from './_setup'; - -test('it increments an existing counter by 1 by default', async (t) => { - // Given an authority key pair with an associated counter account of value 0. - const client = createDefaultSolanaClient(); - const authority = await generateKeyPairSignerWithSol(client); - const [counterPda] = await createCounterForAuthority(client, authority); - t.is((await fetchCounter(client.rpc, counterPda)).data.value, 0); - - // When we increment the counter account. - const incrementIx = await getIncrementInstructionAsync({ authority }); - await pipe( - await createDefaultTransaction(client, authority), - (tx) => appendTransactionMessageInstruction(incrementIx, tx), - (tx) => signAndSendTransaction(client, tx) - ); - - // Then we expect the counter account to have a value of 1. - const counter = await fetchCounter(client.rpc, counterPda); - t.is(counter.data.value, 1); -}); - -test('it can increment an existing counter by a specified amount', async (t) => { - // Given an authority key pair with an associated counter account of value 0. - const client = createDefaultSolanaClient(); - const authority = await generateKeyPairSignerWithSol(client); - const [counterPda] = await createCounterForAuthority(client, authority); - t.is((await fetchCounter(client.rpc, counterPda)).data.value, 0); - - // When we increment the counter account by 5. - const incrementIx = await getIncrementInstructionAsync({ - authority, - amount: 5, - }); - await pipe( - await createDefaultTransaction(client, authority), - (tx) => appendTransactionMessageInstruction(incrementIx, tx), - (tx) => signAndSendTransaction(client, tx) - ); - - // Then we expect the counter account to have a value of 5. - const counter = await fetchCounter(client.rpc, counterPda); - t.is(counter.data.value, 5); -}); - -test('it cannot increment a counter that does not exist', async (t) => { - // Given an authority key pair with no associated counter account. - const client = createDefaultSolanaClient(); - const authority = await generateKeyPairSignerWithSol(client); - const [counterPda] = await findCounterPda({ authority: authority.address }); - t.is(await getBalance(client, counterPda), lamports(0n)); - - // When we try to increment the inexistent counter account. - const incrementIx = await getIncrementInstructionAsync({ authority }); - const transactionMessage = pipe( - await createDefaultTransaction(client, authority), - (tx) => appendTransactionMessageInstruction(incrementIx, tx) - ); - const promise = signAndSendTransaction(client, transactionMessage); - - // Then we expect the program to throw an error. - const error = await t.throwsAsync(promise); - t.true( - isSolanaError( - error, - SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE - ) - ); - t.true( - isProgramError( - error.cause, - transactionMessage, - DEPHY_ID_PROGRAM_ADDRESS, - DEPHY_ID_ERROR__INVALID_PROGRAM_OWNER - ) - ); -}); - -test('it cannot increment a counter that belongs to another authority', async (t) => { - // Given two authority key pairs such that - // only one of them (authority A) is associated with a counter account. - const client = createDefaultSolanaClient(); - const [authorityA, authorityB] = await Promise.all([ - generateKeyPairSignerWithSol(client), - generateKeyPairSignerWithSol(client), - ]); - const [counterPda] = await createCounterForAuthority(client, authorityA); - - // When authority B tries to increment the counter account of authority A. - const incrementIx = getIncrementInstruction({ - authority: authorityB, - counter: counterPda, - }); - const transactionMessage = pipe( - await createDefaultTransaction(client, authorityB), - (tx) => appendTransactionMessageInstruction(incrementIx, tx) - ); - const promise = signAndSendTransaction(client, transactionMessage); - - // Then we expect the program to throw an error. - const error = await t.throwsAsync(promise); - t.true( - isSolanaError( - error, - SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE - ) - ); - t.true( - isProgramError( - error.cause, - transactionMessage, - DEPHY_ID_PROGRAM_ADDRESS, - DEPHY_ID_ERROR__INVALID_PDA - ) - ); -}); diff --git a/package.json b/package.json index 637c405..857c1cc 100644 --- a/package.json +++ b/package.json @@ -6,8 +6,8 @@ "programs:clean": "zx ./scripts/program/clean.mjs", "programs:format": "zx ./scripts/program/format.mjs", "programs:lint": "zx ./scripts/program/lint.mjs", - "generate:idls": "bun ./scripts/generate-idls.mjs", - "generate": "bun generate:idls && bun generate:clients", + "generate:idls": "zx ./scripts/generate-idls.mjs", + "generate": "pnpm generate:idls && pnpm generate:clients", "generate:clients": "zx ./scripts/generate-clients.mjs", "validator:start": "zx ./scripts/start-validator.mjs", "validator:restart": "pnpm validator:start --restart", @@ -27,5 +27,5 @@ "typescript": "^5.5.2", "zx": "^7.2.3" }, - "packageManager": "pnpm@9.1.2" + "packageManager": "pnpm@9.4.0" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 529c4fe..be33a37 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,23 +12,23 @@ importers: specifier: ^2.2.5 version: 2.2.5 '@kinobi-so/nodes-from-anchor': - specifier: ^0.20.5 - version: 0.20.5 + specifier: ^0.20.6 + version: 0.20.6 '@kinobi-so/renderers-js': - specifier: ^0.20.5 - version: 0.20.5(fastestsmallesttextencoderdecoder@1.0.22) - '@kinobi-so/renderers-rust': + specifier: ^0.20.9 + version: 0.20.9(fastestsmallesttextencoderdecoder@1.0.22) + '@kinobi-so/renderers-js-umi': specifier: ^0.20.6 version: 0.20.6(fastestsmallesttextencoderdecoder@1.0.22) - '@metaplex-foundation/shank-js': - specifier: ^0.1.7 - version: 0.1.7 + '@kinobi-so/renderers-rust': + specifier: ^0.20.10 + version: 0.20.10(fastestsmallesttextencoderdecoder@1.0.22) kinobi: - specifier: ^0.20.3 - version: 0.20.3 + specifier: ^0.20.4 + version: 0.20.4 typescript: - specifier: ^5.4.5 - version: 5.4.5 + specifier: ^5.5.2 + version: 5.5.2 zx: specifier: ^7.2.3 version: 7.2.3 @@ -38,42 +38,39 @@ packages: '@iarna/toml@2.2.5': resolution: {integrity: sha512-trnsAYxU3xnS1gPHPyU961coFyLkh4gAD/0zQ5mymY4yOZ+CYvsPqUbOFSw0aDM4y0tV7tiFxL/1XfXPNC6IPg==} - '@kinobi-so/errors@0.20.3': - resolution: {integrity: sha512-A/syulumI3rTFJi8Us8sdMK2AAwL7ks3tsYuOe1cqmwdmTcg11Mgl8dRMZrJZfVxbxZRefniodoY/IFvV0xoVw==} + '@kinobi-so/errors@0.20.4': + resolution: {integrity: sha512-5GWQPiqLOngZFxMCTnF0rGsCc9LXUHXX+zBzbXBjhsdyQm8OSFpVFZtwiBkF+jsOBQPrLv26dFlkWJgBiq2jXQ==} hasBin: true - '@kinobi-so/node-types@0.20.3': - resolution: {integrity: sha512-wIk3UrHPOkwlfxjk49nXttnXYBmghpw/JvmwSswjKe136pmZ6vsfxFVtt5O+MFBKgOcsGs0jgk2a24wJGeRYeA==} + '@kinobi-so/node-types@0.20.4': + resolution: {integrity: sha512-kFFXMC9nSemDj2itNeSj4VR9R6QTz0z7v3niwxHHq9IJ4TFPwpcZAt7aH++SGlCUeHG3iOHC2ZngFMhv+Ks/Fw==} - '@kinobi-so/nodes-from-anchor@0.20.5': - resolution: {integrity: sha512-clzkou5DtF8IztNMODeCi+W4gLBBihD4z9KA8hTxaUoJpZ183Kwgv5/bByBZ74ZyJwqPmVhJVgraRAVPfa7TvA==} + '@kinobi-so/nodes-from-anchor@0.20.6': + resolution: {integrity: sha512-2ad1ILvnul1PqqlCkQ2uii9KCgcR9ne5jxXsxiTKUHhab6LmI6sCTR15FO4T+ZzgMVsvAe3ySrOmgDICUHr4eA==} - '@kinobi-so/nodes@0.20.3': - resolution: {integrity: sha512-EdPRrlm5OHVYHpF1vBY60ivNvcB6Z4xhnfE3wNTATRD7D7VJmen6TyiixeUt2OW2vbFGxvDE7/Ibjx0nRLvQUQ==} + '@kinobi-so/nodes@0.20.4': + resolution: {integrity: sha512-zeGOOdOaKbMxqiZWNJx/JVGVWp4mzCkwDp3bG4J+x9+mQ1nQcyuPvHXeHmtBXa9IWp7AScXlyn5HddVzK/8ZRQ==} - '@kinobi-so/renderers-core@0.20.3': - resolution: {integrity: sha512-1SYc8jxnybYH9IZPCoy0rw4i4Z3zduTyXRpf/WpixUdPWY4uqthXBIfhhP6sOugJfyBsonVy5Hfse7gHLraJCA==} + '@kinobi-so/renderers-core@0.20.4': + resolution: {integrity: sha512-feb0Fsw7UIj14JZ2LmHYyosT07K/Jrs7CvNYD2YF4g6WQz9mmy1l8Fa+gpVtoDdSHvfXrgzv8193p0QkRRBWmA==} - '@kinobi-so/renderers-js@0.20.5': - resolution: {integrity: sha512-qA+dhg6vBuSaFdWzXUcgT0rxw0zWb3pqnyVGiU57/TBEumW+njyrJhhSGb3YX89kYbXAe1/0OfJuJ7nctpZbmg==} + '@kinobi-so/renderers-js-umi@0.20.6': + resolution: {integrity: sha512-s7BN7Fa7VAr6tuTyLJVp6ceftFMqMRTopIAD4QyYGrJVoM+KLA0W7MpGo/pE61jRUCE24MZIJJjkX1qbuL4hfA==} - '@kinobi-so/renderers-rust@0.20.6': - resolution: {integrity: sha512-LHDlPB2PdAg9our2OrCJK8VMRnqa0KJMnZ1fP8mla9fv1EQMjM4hfkdWpyydNb6fb7Qx6LEKTunzAsjeCy96Rg==} + '@kinobi-so/renderers-js@0.20.9': + resolution: {integrity: sha512-wrduoNFTvR23Gr+oMB1sFjhv6lvh3DHqDR7B5+MownuGsM1FG6iszSw3hZIbpOetKBjhWYNjHfE5QOZG56Wadg==} - '@kinobi-so/validators@0.20.3': - resolution: {integrity: sha512-qocYZ4PzjAV8LntQeS0SwBfl+TWA2GMCJ/4IensaHCtOuCOjtmb4rniNxsbdtUuEfUtKVKvkT5C4DykAWce/cA==} + '@kinobi-so/renderers-rust@0.20.10': + resolution: {integrity: sha512-I4NINXbUJR3gPKoS/fNQ92YuCGFtKd+Ca+nxY+5qmVl9ctB3wIrFvUoNMq0eES8Xh6jyBtF73ocBFKBzFfn1NQ==} - '@kinobi-so/visitors-core@0.20.3': - resolution: {integrity: sha512-cL5gP8QrkK65UJdeaM8FWdUaDAmlbS0UqyAXhP1owilBzXYMufKPWCNtqbOARb4yHpPlK/8K7/qV2mmqcNubdQ==} + '@kinobi-so/validators@0.20.4': + resolution: {integrity: sha512-PyhfM1fgsAPrDgMOB1VjvW+CytPTtLMLB0bSCU+0GRm8IoZ8pj74cIcB5XPjai3N5dU7kDMYz1nZLnCFsoXfLg==} - '@kinobi-so/visitors@0.20.3': - resolution: {integrity: sha512-z4Shd6V1kulwK3xi8VENxQZCMyIJ0HUNU0MOgFw6tEwzJg6dD+/WJdddyxcIJMUs9KwE3BB2oQhSqn0r5IKznw==} + '@kinobi-so/visitors-core@0.20.4': + resolution: {integrity: sha512-l4LCAOKL35tXn4jDZ4/gNdBeJYB5ACE4lgKQxL6oyII36hPe8pwCihIpjzHKDm9S93o9pKFN76ay5S3NnWANRw==} - '@metaplex-foundation/rustbin@0.3.5': - resolution: {integrity: sha512-m0wkRBEQB/8krwMwKBvFugufZtYwMXiGHud2cTDAv+aGXK4M90y0Hx67/wpu+AqqoQfdV8VM9YezUOHKD+Z5kA==} - - '@metaplex-foundation/shank-js@0.1.7': - resolution: {integrity: sha512-tSAipn8Ho1UxlMC3jwJ5Opl+Y3lRm60VTkgRDfvzydb57lXW5G+K5MrZhEmhrFUuRYziV+e34CTo+ybpMp1Eqg==} + '@kinobi-so/visitors@0.20.4': + resolution: {integrity: sha512-sr+1qiU4sN5OfrVI//RqqHMKl5VapugkO3f/MHXGmFBDWANXJCIMmAXMMARzk/h6v76zswJ+NOHe0C3FLYb1xg==} '@noble/hashes@1.4.0': resolution: {integrity: sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==} @@ -127,10 +124,6 @@ packages: a-sync-waterfall@1.0.1: resolution: {integrity: sha512-RYTOHHdWipFUliRFMCS4X2Yn2X8M87V/OpSqWzKKOGhzqyUxzyVmhHDH9sAvG+ZuQf/TAOFsLCpMw09I1ufUnA==} - ansi-colors@4.1.3: - resolution: {integrity: sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==} - engines: {node: '>=6'} - asap@2.0.6: resolution: {integrity: sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==} @@ -158,15 +151,6 @@ packages: resolution: {integrity: sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==} engines: {node: '>= 12'} - debug@4.3.4: - resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} - engines: {node: '>=6.0'} - peerDependencies: - supports-color: '*' - peerDependenciesMeta: - supports-color: - optional: true - define-data-property@1.1.4: resolution: {integrity: sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==} engines: {node: '>= 0.4'} @@ -290,8 +274,8 @@ packages: jsonify@0.0.1: resolution: {integrity: sha512-2/Ki0GcmuqSrgFyelQq9M05y7PS0mEwuIzrf3f1fPqkVDVRvZrPZtVSMHxdgo8Aq0sxAOb/cr2aqqA3LeWHVPg==} - kinobi@0.20.3: - resolution: {integrity: sha512-uOL+/2fYV01Gl1gKBiGSlMNg5NIHnUOZ5LIrv0Y8GHuYS/umEk3VQxZt/k0r2CPH676WadAFyM4og9wD+XwB9Q==} + kinobi@0.20.4: + resolution: {integrity: sha512-/EkPQV1jVK4PkSWbdFb12EO7QMMkhNaoVaA0Le6MheCcnCHcWlLsz4Un/5eqSa/NNM8kCivGsEg/n9qDeKddTA==} map-stream@0.1.0: resolution: {integrity: sha512-CkYQrPYZfWnu/DAmVCpTSX/xHpKZ80eKh2lAkyA6AJTef6bW+6JpbQZN5rofum7da+SyN1bi5ctTm+lTfcCW3g==} @@ -307,9 +291,6 @@ packages: minimist@1.2.8: resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} - ms@2.1.2: - resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} - node-domexception@1.0.0: resolution: {integrity: sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==} engines: {node: '>=10.5.0'} @@ -348,6 +329,11 @@ packages: engines: {node: '>=14'} hasBin: true + prettier@3.3.2: + resolution: {integrity: sha512-rAVeHYMcv8ATV5d508CFdn+8/pHPpXeIid1DdrPwXnaAdH7cqjVbpJaT5eq4yRAFU/lsbwYwSF/n5iNrdJHPQA==} + engines: {node: '>=14'} + hasBin: true + ps-tree@1.2.0: resolution: {integrity: sha512-0VnamPPYHl4uaU/nSFeZZpR21QAWRz+sRv4iW9+v/GS/J5U5iZB5BNN6J0RMoOvdx2gWM2+ZFMIm58q24e4UYA==} engines: {node: '>= 0.10'} @@ -363,11 +349,6 @@ packages: run-parallel@1.2.0: resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} - semver@7.6.2: - resolution: {integrity: sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==} - engines: {node: '>=10'} - hasBin: true - set-function-length@1.2.2: resolution: {integrity: sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==} engines: {node: '>= 0.4'} @@ -382,9 +363,6 @@ packages: stream-combiner@0.0.4: resolution: {integrity: sha512-rT00SPnTVyRsaSz5zgSPma/aHSOic5U1prhYdRy5HS2kTZviFpmDgzilbtsJsxiroqACmayynDN/9VzIbX5DOw==} - text-table@0.2.0: - resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==} - through@2.3.8: resolution: {integrity: sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==} @@ -392,11 +370,8 @@ packages: resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} engines: {node: '>=8.0'} - toml@3.0.0: - resolution: {integrity: sha512-y/mWCZinnvxjTKYhJ+pYxwD0mRLVvOtdS2Awbgxln6iEnt4rk0yBxeSBHkGJcPucRiG0e55mwWp+g/05rsrd6w==} - - typescript@5.4.5: - resolution: {integrity: sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==} + typescript@5.5.2: + resolution: {integrity: sha512-NcRtPEOsPFFWjobJEtfihkLCZCXZt/os3zf8nTxjVH3RvTSxjrCamJpbExGvYOF+tFHc3pA65qpdwPbzjohhew==} engines: {node: '>=14.17'} hasBin: true @@ -434,38 +409,39 @@ snapshots: '@iarna/toml@2.2.5': {} - '@kinobi-so/errors@0.20.3': + '@kinobi-so/errors@0.20.4': dependencies: - '@kinobi-so/node-types': 0.20.3 + '@kinobi-so/node-types': 0.20.4 chalk: 5.3.0 commander: 12.1.0 - '@kinobi-so/node-types@0.20.3': {} + '@kinobi-so/node-types@0.20.4': {} - '@kinobi-so/nodes-from-anchor@0.20.5': + '@kinobi-so/nodes-from-anchor@0.20.6': dependencies: - '@kinobi-so/errors': 0.20.3 - '@kinobi-so/nodes': 0.20.3 - '@kinobi-so/visitors': 0.20.3 + '@kinobi-so/errors': 0.20.4 + '@kinobi-so/nodes': 0.20.4 + '@kinobi-so/visitors': 0.20.4 '@noble/hashes': 1.4.0 - '@kinobi-so/nodes@0.20.3': + '@kinobi-so/nodes@0.20.4': dependencies: - '@kinobi-so/errors': 0.20.3 - '@kinobi-so/node-types': 0.20.3 + '@kinobi-so/errors': 0.20.4 + '@kinobi-so/node-types': 0.20.4 - '@kinobi-so/renderers-core@0.20.3': + '@kinobi-so/renderers-core@0.20.4': dependencies: - '@kinobi-so/errors': 0.20.3 - '@kinobi-so/nodes': 0.20.3 - '@kinobi-so/visitors-core': 0.20.3 + '@kinobi-so/errors': 0.20.4 + '@kinobi-so/nodes': 0.20.4 + '@kinobi-so/visitors-core': 0.20.4 - '@kinobi-so/renderers-js@0.20.5(fastestsmallesttextencoderdecoder@1.0.22)': + '@kinobi-so/renderers-js-umi@0.20.6(fastestsmallesttextencoderdecoder@1.0.22)': dependencies: - '@kinobi-so/errors': 0.20.3 - '@kinobi-so/nodes': 0.20.3 - '@kinobi-so/renderers-core': 0.20.3 - '@kinobi-so/visitors-core': 0.20.3 + '@kinobi-so/errors': 0.20.4 + '@kinobi-so/nodes': 0.20.4 + '@kinobi-so/renderers-core': 0.20.4 + '@kinobi-so/validators': 0.20.4 + '@kinobi-so/visitors-core': 0.20.4 '@solana/codecs-strings': 2.0.0-preview.2(fastestsmallesttextencoderdecoder@1.0.22) nunjucks: 3.2.4 prettier: 3.2.5 @@ -473,52 +449,48 @@ snapshots: - chokidar - fastestsmallesttextencoderdecoder - '@kinobi-so/renderers-rust@0.20.6(fastestsmallesttextencoderdecoder@1.0.22)': + '@kinobi-so/renderers-js@0.20.9(fastestsmallesttextencoderdecoder@1.0.22)': dependencies: - '@kinobi-so/errors': 0.20.3 - '@kinobi-so/nodes': 0.20.3 - '@kinobi-so/renderers-core': 0.20.3 - '@kinobi-so/visitors-core': 0.20.3 + '@kinobi-so/errors': 0.20.4 + '@kinobi-so/nodes': 0.20.4 + '@kinobi-so/renderers-core': 0.20.4 + '@kinobi-so/visitors-core': 0.20.4 '@solana/codecs-strings': 2.0.0-preview.2(fastestsmallesttextencoderdecoder@1.0.22) nunjucks: 3.2.4 + prettier: 3.3.2 transitivePeerDependencies: - chokidar - fastestsmallesttextencoderdecoder - '@kinobi-so/validators@0.20.3': - dependencies: - '@kinobi-so/errors': 0.20.3 - '@kinobi-so/nodes': 0.20.3 - '@kinobi-so/visitors-core': 0.20.3 - - '@kinobi-so/visitors-core@0.20.3': + '@kinobi-so/renderers-rust@0.20.10(fastestsmallesttextencoderdecoder@1.0.22)': dependencies: - '@kinobi-so/errors': 0.20.3 - '@kinobi-so/nodes': 0.20.3 - json-stable-stringify: 1.1.1 + '@kinobi-so/errors': 0.20.4 + '@kinobi-so/nodes': 0.20.4 + '@kinobi-so/renderers-core': 0.20.4 + '@kinobi-so/visitors-core': 0.20.4 + '@solana/codecs-strings': 2.0.0-preview.2(fastestsmallesttextencoderdecoder@1.0.22) + nunjucks: 3.2.4 + transitivePeerDependencies: + - chokidar + - fastestsmallesttextencoderdecoder - '@kinobi-so/visitors@0.20.3': + '@kinobi-so/validators@0.20.4': dependencies: - '@kinobi-so/errors': 0.20.3 - '@kinobi-so/nodes': 0.20.3 - '@kinobi-so/visitors-core': 0.20.3 + '@kinobi-so/errors': 0.20.4 + '@kinobi-so/nodes': 0.20.4 + '@kinobi-so/visitors-core': 0.20.4 - '@metaplex-foundation/rustbin@0.3.5': + '@kinobi-so/visitors-core@0.20.4': dependencies: - debug: 4.3.4 - semver: 7.6.2 - text-table: 0.2.0 - toml: 3.0.0 - transitivePeerDependencies: - - supports-color + '@kinobi-so/errors': 0.20.4 + '@kinobi-so/nodes': 0.20.4 + json-stable-stringify: 1.1.1 - '@metaplex-foundation/shank-js@0.1.7': + '@kinobi-so/visitors@0.20.4': dependencies: - '@metaplex-foundation/rustbin': 0.3.5 - ansi-colors: 4.1.3 - debug: 4.3.4 - transitivePeerDependencies: - - supports-color + '@kinobi-so/errors': 0.20.4 + '@kinobi-so/nodes': 0.20.4 + '@kinobi-so/visitors-core': 0.20.4 '@noble/hashes@1.4.0': {} @@ -576,8 +548,6 @@ snapshots: a-sync-waterfall@1.0.1: {} - ansi-colors@4.1.3: {} - asap@2.0.6: {} braces@3.0.2: @@ -600,10 +570,6 @@ snapshots: data-uri-to-buffer@4.0.1: {} - debug@4.3.4: - dependencies: - ms: 2.1.2 - define-data-property@1.1.4: dependencies: es-define-property: 1.0.0 @@ -738,12 +704,12 @@ snapshots: jsonify@0.0.1: {} - kinobi@0.20.3: + kinobi@0.20.4: dependencies: - '@kinobi-so/errors': 0.20.3 - '@kinobi-so/nodes': 0.20.3 - '@kinobi-so/validators': 0.20.3 - '@kinobi-so/visitors': 0.20.3 + '@kinobi-so/errors': 0.20.4 + '@kinobi-so/nodes': 0.20.4 + '@kinobi-so/validators': 0.20.4 + '@kinobi-so/visitors': 0.20.4 map-stream@0.1.0: {} @@ -756,8 +722,6 @@ snapshots: minimist@1.2.8: {} - ms@2.1.2: {} - node-domexception@1.0.0: {} node-fetch@3.3.1: @@ -784,6 +748,8 @@ snapshots: prettier@3.2.5: {} + prettier@3.3.2: {} + ps-tree@1.2.0: dependencies: event-stream: 3.3.4 @@ -796,8 +762,6 @@ snapshots: dependencies: queue-microtask: 1.2.3 - semver@7.6.2: {} - set-function-length@1.2.2: dependencies: define-data-property: 1.1.4 @@ -817,17 +781,13 @@ snapshots: dependencies: duplexer: 0.1.2 - text-table@0.2.0: {} - through@2.3.8: {} to-regex-range@5.0.1: dependencies: is-number: 7.0.0 - toml@3.0.0: {} - - typescript@5.4.5: {} + typescript@5.5.2: {} undici-types@5.26.5: {} diff --git a/scripts/generate-idls.mjs b/scripts/generate-idls.mjs index e108ff7..42e571d 100644 --- a/scripts/generate-idls.mjs +++ b/scripts/generate-idls.mjs @@ -1,9 +1,6 @@ #!/usr/bin/env zx import 'zx/globals'; import { getCargo, getProgramFolders } from './utils.mjs'; -import { $ } from "bun" - -const binaryInstallDir = path.join(__dirname, '..', '.cargo'); getProgramFolders().forEach(async (folder) => { const cargo = getCargo(folder);