diff --git a/.yarnrc.yml b/.yarnrc.yml
index 3186f3f..dc61281 100644
--- a/.yarnrc.yml
+++ b/.yarnrc.yml
@@ -1 +1,6 @@
+approvedGitRepositories:
+ - "**"
+
+enableScripts: true
+
nodeLinker: node-modules
diff --git a/package.json b/package.json
index 7ef0cc1..46cad62 100644
--- a/package.json
+++ b/package.json
@@ -1,21 +1,16 @@
{
"name": "solisting",
"license": "ISC",
+ "private": true,
+ "workspaces": [
+ "sdk",
+ "app"
+ ],
"scripts": {
"lint:fix": "prettier */*.js \"*/**/*{.js,.ts}\" -w",
"lint": "prettier */*.js \"*/**/*{.js,.ts}\" --check"
},
- "dependencies": {
- "@anchor-lang/core": "^1.0.2"
- },
"devDependencies": {
- "@types/bn.js": "^5.2.0",
- "@types/chai": "^5.2.3",
- "@types/mocha": "^10.0.10",
- "chai": "^6.2.2",
- "mocha": "^11.7.6",
- "prettier": "^3.8.3",
- "ts-mocha": "^11.1.0",
- "typescript": "^6.0.3"
+ "prettier": "^3.8.3"
}
}
diff --git a/sdk/codama.solisting.json b/sdk/codama.solisting.json
new file mode 100644
index 0000000..2461223
--- /dev/null
+++ b/sdk/codama.solisting.json
@@ -0,0 +1,11 @@
+{
+ "idl": "./src/idl/solisting.json",
+ "scripts": {
+ "js": [
+ {
+ "from": "@codama/renderers-js",
+ "args": ["./src/generated/solisting"]
+ }
+ ]
+ }
+}
diff --git a/sdk/package.json b/sdk/package.json
new file mode 100644
index 0000000..60d0389
--- /dev/null
+++ b/sdk/package.json
@@ -0,0 +1,23 @@
+{
+ "name": "@solisting/sdk",
+ "version": "0.1.0",
+ "private": true,
+ "main": "./src/index.ts",
+ "types": "./src/index.ts",
+ "scripts": {
+ "generate": "codama run js --config codama.solisting.json",
+ "test": "vitest run",
+ "typecheck": "tsc --noEmit"
+ },
+ "dependencies": {
+ "@solana/kit": "^6.0.0",
+ "@solana/program-client-core": "^6.4.0"
+ },
+ "devDependencies": {
+ "@codama/nodes-from-anchor": "^1.4.1",
+ "@codama/renderers-js": "^2.2.0",
+ "codama": "^1.6.0",
+ "typescript": "^6.0.3",
+ "vitest": "^3.0.0"
+ }
+}
diff --git a/sdk/src/__tests__/pda.test.ts b/sdk/src/__tests__/pda.test.ts
new file mode 100644
index 0000000..2221078
--- /dev/null
+++ b/sdk/src/__tests__/pda.test.ts
@@ -0,0 +1,36 @@
+import { describe, it, expect } from 'vitest'
+import { address } from '@solana/kit'
+import { deriveEscrowId, findListingPda } from '../pda.js'
+
+const SELLER = address('11111111111111111111111111111112')
+
+describe('deriveEscrowId', () => {
+ it('returns a bigint from the first 8 bytes of the order PDA', () => {
+ const fakeOrderPda = address('So11111111111111111111111111111111111111112')
+ const id1 = deriveEscrowId(fakeOrderPda)
+ const id2 = deriveEscrowId(fakeOrderPda)
+ expect(id1).toBe(id2)
+ expect(typeof id1).toBe('bigint')
+ })
+
+ it('returns different ids for different PDAs', () => {
+ const pda1 = address('So11111111111111111111111111111111111111112')
+ const pda2 = address('TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA')
+ expect(deriveEscrowId(pda1)).not.toBe(deriveEscrowId(pda2))
+ })
+})
+
+describe('findListingPda', () => {
+ it('derives a deterministic PDA for a given seller + listingId', async () => {
+ const [pda1] = await findListingPda(SELLER, 1001n)
+ const [pda2] = await findListingPda(SELLER, 1001n)
+ expect(pda1).toBe(pda2)
+ expect(pda1).toHaveLength(44) // base58 encoded 32-byte pubkey
+ })
+
+ it('produces different PDAs for different listing ids', async () => {
+ const [pda1] = await findListingPda(SELLER, 1001n)
+ const [pda2] = await findListingPda(SELLER, 1002n)
+ expect(pda1).not.toBe(pda2)
+ })
+})
diff --git a/sdk/src/generated/solisting/package.json b/sdk/src/generated/solisting/package.json
new file mode 100644
index 0000000..e4687c9
--- /dev/null
+++ b/sdk/src/generated/solisting/package.json
@@ -0,0 +1,22 @@
+{
+ "name": "js-client",
+ "version": "1.0.0",
+ "description": "",
+ "main": "src/index.ts",
+ "files": [
+ "./dist/src",
+ "./dist/types",
+ "./src/"
+ ],
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "keywords": [],
+ "author": "",
+ "peerDependencies": {
+ "@solana/kit": "^6.10.0"
+ },
+ "dependencies": {
+ "@solana/program-client-core": "^6.10.0"
+ }
+}
diff --git a/sdk/src/generated/solisting/src/generated/accounts/index.ts b/sdk/src/generated/solisting/src/generated/accounts/index.ts
new file mode 100644
index 0000000..8108f37
--- /dev/null
+++ b/sdk/src/generated/solisting/src/generated/accounts/index.ts
@@ -0,0 +1,10 @@
+/**
+ * This code was AUTOGENERATED using the Codama library.
+ * Please DO NOT EDIT THIS FILE, instead use visitors
+ * to add features, then rerun Codama to update it.
+ *
+ * @see https://github.com/codama-idl/codama
+ */
+
+export * from "./solistingStateListingAccount";
+export * from "./solistingStateOrderAccount";
diff --git a/sdk/src/generated/solisting/src/generated/accounts/solistingStateListingAccount.ts b/sdk/src/generated/solisting/src/generated/accounts/solistingStateListingAccount.ts
new file mode 100644
index 0000000..6c877ce
--- /dev/null
+++ b/sdk/src/generated/solisting/src/generated/accounts/solistingStateListingAccount.ts
@@ -0,0 +1,268 @@
+/**
+ * This code was AUTOGENERATED using the Codama library.
+ * Please DO NOT EDIT THIS FILE, instead use visitors
+ * to add features, then rerun Codama to update it.
+ *
+ * @see https://github.com/codama-idl/codama
+ */
+
+import {
+ addDecoderSizePrefix,
+ addEncoderSizePrefix,
+ assertAccountExists,
+ assertAccountsExist,
+ combineCodec,
+ decodeAccount,
+ fetchEncodedAccount,
+ fetchEncodedAccounts,
+ fixDecoderSize,
+ fixEncoderSize,
+ getAddressDecoder,
+ getAddressEncoder,
+ getArrayDecoder,
+ getArrayEncoder,
+ getBooleanDecoder,
+ getBooleanEncoder,
+ getBytesDecoder,
+ getBytesEncoder,
+ getOptionDecoder,
+ getOptionEncoder,
+ getStructDecoder,
+ getStructEncoder,
+ getU32Decoder,
+ getU32Encoder,
+ getU64Decoder,
+ getU64Encoder,
+ getU8Decoder,
+ getU8Encoder,
+ getUtf8Decoder,
+ getUtf8Encoder,
+ transformEncoder,
+ type Account,
+ type Address,
+ type Codec,
+ type Decoder,
+ type EncodedAccount,
+ type Encoder,
+ type FetchAccountConfig,
+ type FetchAccountsConfig,
+ type MaybeAccount,
+ type MaybeEncodedAccount,
+ type Option,
+ type OptionOrNullable,
+ type ReadonlyUint8Array,
+} from "@solana/kit";
+import {
+ getSolistingStateAltCurrencyConfigDecoder,
+ getSolistingStateAltCurrencyConfigEncoder,
+ getSolistingStateCurrencyDecoder,
+ getSolistingStateCurrencyEncoder,
+ type SolistingStateAltCurrencyConfig,
+ type SolistingStateAltCurrencyConfigArgs,
+ type SolistingStateCurrency,
+ type SolistingStateCurrencyArgs,
+} from "../types";
+
+export const SOLISTING_STATE_LISTING_ACCOUNT_DISCRIMINATOR: ReadonlyUint8Array =
+ new Uint8Array([59, 89, 136, 25, 21, 196, 183, 13]);
+
+export function getSolistingStateListingAccountDiscriminatorBytes(): ReadonlyUint8Array {
+ return fixEncoderSize(getBytesEncoder(), 8).encode(
+ SOLISTING_STATE_LISTING_ACCOUNT_DISCRIMINATOR,
+ );
+}
+
+export type SolistingStateListingAccount = {
+ discriminator: ReadonlyUint8Array;
+ seller: Address;
+ /** Sole source of truth for price. All alt_currencies are derived from this via oracle. */
+ canonicalCurrency: SolistingStateCurrency;
+ /** Price in canonical_currency's smallest unit. */
+ price: bigint;
+ /**
+ * Pyth V2 PriceFeedAccount for the canonical currency priced in USD.
+ * `None` = canonical is a $1.00 USD stablecoin.
+ * For Sol canonical: set to the SOL/USD Pyth feed.
+ */
+ canonicalOracle: Option
;
+ /**
+ * Alt currencies the seller accepts. Amounts are oracle-computed at create_order time.
+ * Empty = no oracle ever needed.
+ */
+ altCurrencies: Array;
+ /** Resolvers the seller accepts for dispute resolution. Empty = any resolver ok. */
+ acceptedResolvers: Array;
+ /** Total units the seller offers (includes quantity_reserved). */
+ quantity: number;
+ /** Units held by pending orders. available = quantity - quantity_reserved. */
+ quantityReserved: number;
+ metadataUri: string;
+ listingId: bigint;
+ isActive: boolean;
+ bump: number;
+};
+
+export type SolistingStateListingAccountArgs = {
+ seller: Address;
+ /** Sole source of truth for price. All alt_currencies are derived from this via oracle. */
+ canonicalCurrency: SolistingStateCurrencyArgs;
+ /** Price in canonical_currency's smallest unit. */
+ price: number | bigint;
+ /**
+ * Pyth V2 PriceFeedAccount for the canonical currency priced in USD.
+ * `None` = canonical is a $1.00 USD stablecoin.
+ * For Sol canonical: set to the SOL/USD Pyth feed.
+ */
+ canonicalOracle: OptionOrNullable;
+ /**
+ * Alt currencies the seller accepts. Amounts are oracle-computed at create_order time.
+ * Empty = no oracle ever needed.
+ */
+ altCurrencies: Array;
+ /** Resolvers the seller accepts for dispute resolution. Empty = any resolver ok. */
+ acceptedResolvers: Array;
+ /** Total units the seller offers (includes quantity_reserved). */
+ quantity: number;
+ /** Units held by pending orders. available = quantity - quantity_reserved. */
+ quantityReserved: number;
+ metadataUri: string;
+ listingId: number | bigint;
+ isActive: boolean;
+ bump: number;
+};
+
+/** Gets the encoder for {@link SolistingStateListingAccountArgs} account data. */
+export function getSolistingStateListingAccountEncoder(): Encoder {
+ return transformEncoder(
+ getStructEncoder([
+ ["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
+ ["seller", getAddressEncoder()],
+ ["canonicalCurrency", getSolistingStateCurrencyEncoder()],
+ ["price", getU64Encoder()],
+ ["canonicalOracle", getOptionEncoder(getAddressEncoder())],
+ [
+ "altCurrencies",
+ getArrayEncoder(getSolistingStateAltCurrencyConfigEncoder()),
+ ],
+ ["acceptedResolvers", getArrayEncoder(getAddressEncoder())],
+ ["quantity", getU32Encoder()],
+ ["quantityReserved", getU32Encoder()],
+ ["metadataUri", addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())],
+ ["listingId", getU64Encoder()],
+ ["isActive", getBooleanEncoder()],
+ ["bump", getU8Encoder()],
+ ]),
+ (value) => ({
+ ...value,
+ discriminator: SOLISTING_STATE_LISTING_ACCOUNT_DISCRIMINATOR,
+ }),
+ );
+}
+
+/** Gets the decoder for {@link SolistingStateListingAccount} account data. */
+export function getSolistingStateListingAccountDecoder(): Decoder {
+ return getStructDecoder([
+ ["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
+ ["seller", getAddressDecoder()],
+ ["canonicalCurrency", getSolistingStateCurrencyDecoder()],
+ ["price", getU64Decoder()],
+ ["canonicalOracle", getOptionDecoder(getAddressDecoder())],
+ [
+ "altCurrencies",
+ getArrayDecoder(getSolistingStateAltCurrencyConfigDecoder()),
+ ],
+ ["acceptedResolvers", getArrayDecoder(getAddressDecoder())],
+ ["quantity", getU32Decoder()],
+ ["quantityReserved", getU32Decoder()],
+ ["metadataUri", addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())],
+ ["listingId", getU64Decoder()],
+ ["isActive", getBooleanDecoder()],
+ ["bump", getU8Decoder()],
+ ]);
+}
+
+/** Gets the codec for {@link SolistingStateListingAccount} account data. */
+export function getSolistingStateListingAccountCodec(): Codec<
+ SolistingStateListingAccountArgs,
+ SolistingStateListingAccount
+> {
+ return combineCodec(
+ getSolistingStateListingAccountEncoder(),
+ getSolistingStateListingAccountDecoder(),
+ );
+}
+
+export function decodeSolistingStateListingAccount<
+ TAddress extends string = string,
+>(
+ encodedAccount: EncodedAccount,
+): Account;
+export function decodeSolistingStateListingAccount<
+ TAddress extends string = string,
+>(
+ encodedAccount: MaybeEncodedAccount,
+): MaybeAccount;
+export function decodeSolistingStateListingAccount<
+ TAddress extends string = string,
+>(
+ encodedAccount: EncodedAccount | MaybeEncodedAccount,
+):
+ | Account
+ | MaybeAccount {
+ return decodeAccount(
+ encodedAccount as MaybeEncodedAccount,
+ getSolistingStateListingAccountDecoder(),
+ );
+}
+
+export async function fetchSolistingStateListingAccount<
+ TAddress extends string = string,
+>(
+ rpc: Parameters[0],
+ address: Address,
+ config?: FetchAccountConfig,
+): Promise> {
+ const maybeAccount = await fetchMaybeSolistingStateListingAccount(
+ rpc,
+ address,
+ config,
+ );
+ assertAccountExists(maybeAccount);
+ return maybeAccount;
+}
+
+export async function fetchMaybeSolistingStateListingAccount<
+ TAddress extends string = string,
+>(
+ rpc: Parameters[0],
+ address: Address,
+ config?: FetchAccountConfig,
+): Promise> {
+ const maybeAccount = await fetchEncodedAccount(rpc, address, config);
+ return decodeSolistingStateListingAccount(maybeAccount);
+}
+
+export async function fetchAllSolistingStateListingAccount(
+ rpc: Parameters[0],
+ addresses: Array,
+ config?: FetchAccountsConfig,
+): Promise[]> {
+ const maybeAccounts = await fetchAllMaybeSolistingStateListingAccount(
+ rpc,
+ addresses,
+ config,
+ );
+ assertAccountsExist(maybeAccounts);
+ return maybeAccounts;
+}
+
+export async function fetchAllMaybeSolistingStateListingAccount(
+ rpc: Parameters[0],
+ addresses: Array,
+ config?: FetchAccountsConfig,
+): Promise[]> {
+ const maybeAccounts = await fetchEncodedAccounts(rpc, addresses, config);
+ return maybeAccounts.map((maybeAccount) =>
+ decodeSolistingStateListingAccount(maybeAccount),
+ );
+}
diff --git a/sdk/src/generated/solisting/src/generated/accounts/solistingStateOrderAccount.ts b/sdk/src/generated/solisting/src/generated/accounts/solistingStateOrderAccount.ts
new file mode 100644
index 0000000..33bb7fc
--- /dev/null
+++ b/sdk/src/generated/solisting/src/generated/accounts/solistingStateOrderAccount.ts
@@ -0,0 +1,222 @@
+/**
+ * This code was AUTOGENERATED using the Codama library.
+ * Please DO NOT EDIT THIS FILE, instead use visitors
+ * to add features, then rerun Codama to update it.
+ *
+ * @see https://github.com/codama-idl/codama
+ */
+
+import {
+ assertAccountExists,
+ assertAccountsExist,
+ combineCodec,
+ decodeAccount,
+ fetchEncodedAccount,
+ fetchEncodedAccounts,
+ fixDecoderSize,
+ fixEncoderSize,
+ getAddressDecoder,
+ getAddressEncoder,
+ getBytesDecoder,
+ getBytesEncoder,
+ getI64Decoder,
+ getI64Encoder,
+ getStructDecoder,
+ getStructEncoder,
+ getU64Decoder,
+ getU64Encoder,
+ getU8Decoder,
+ getU8Encoder,
+ transformEncoder,
+ type Account,
+ type Address,
+ type Codec,
+ type Decoder,
+ type EncodedAccount,
+ type Encoder,
+ type FetchAccountConfig,
+ type FetchAccountsConfig,
+ type MaybeAccount,
+ type MaybeEncodedAccount,
+ type ReadonlyUint8Array,
+} from "@solana/kit";
+import {
+ getSolistingStateCurrencyDecoder,
+ getSolistingStateCurrencyEncoder,
+ type SolistingStateCurrency,
+ type SolistingStateCurrencyArgs,
+} from "../types";
+
+export const SOLISTING_STATE_ORDER_ACCOUNT_DISCRIMINATOR: ReadonlyUint8Array =
+ new Uint8Array([79, 67, 112, 155, 214, 14, 32, 55]);
+
+export function getSolistingStateOrderAccountDiscriminatorBytes(): ReadonlyUint8Array {
+ return fixEncoderSize(getBytesEncoder(), 8).encode(
+ SOLISTING_STATE_ORDER_ACCOUNT_DISCRIMINATOR,
+ );
+}
+
+export type SolistingStateOrderAccount = {
+ discriminator: ReadonlyUint8Array;
+ listing: Address;
+ buyer: Address;
+ seller: Address;
+ resolver: Address;
+ /** The currency the buyer chose to pay in. */
+ paymentCurrency: SolistingStateCurrency;
+ /** Actual amount paid (may differ from price when oracle-converted). */
+ amount: bigint;
+ /** The descro EscrowAccount PDA for this order. */
+ escrowAccount: Address;
+ /** Derived from order_account PDA bytes[0..8]; used as descro escrow_id seed. */
+ escrowId: bigint;
+ orderId: bigint;
+ createdAt: bigint;
+ bump: number;
+};
+
+export type SolistingStateOrderAccountArgs = {
+ listing: Address;
+ buyer: Address;
+ seller: Address;
+ resolver: Address;
+ /** The currency the buyer chose to pay in. */
+ paymentCurrency: SolistingStateCurrencyArgs;
+ /** Actual amount paid (may differ from price when oracle-converted). */
+ amount: number | bigint;
+ /** The descro EscrowAccount PDA for this order. */
+ escrowAccount: Address;
+ /** Derived from order_account PDA bytes[0..8]; used as descro escrow_id seed. */
+ escrowId: number | bigint;
+ orderId: number | bigint;
+ createdAt: number | bigint;
+ bump: number;
+};
+
+/** Gets the encoder for {@link SolistingStateOrderAccountArgs} account data. */
+export function getSolistingStateOrderAccountEncoder(): Encoder {
+ return transformEncoder(
+ getStructEncoder([
+ ["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
+ ["listing", getAddressEncoder()],
+ ["buyer", getAddressEncoder()],
+ ["seller", getAddressEncoder()],
+ ["resolver", getAddressEncoder()],
+ ["paymentCurrency", getSolistingStateCurrencyEncoder()],
+ ["amount", getU64Encoder()],
+ ["escrowAccount", getAddressEncoder()],
+ ["escrowId", getU64Encoder()],
+ ["orderId", getU64Encoder()],
+ ["createdAt", getI64Encoder()],
+ ["bump", getU8Encoder()],
+ ]),
+ (value) => ({
+ ...value,
+ discriminator: SOLISTING_STATE_ORDER_ACCOUNT_DISCRIMINATOR,
+ }),
+ );
+}
+
+/** Gets the decoder for {@link SolistingStateOrderAccount} account data. */
+export function getSolistingStateOrderAccountDecoder(): Decoder {
+ return getStructDecoder([
+ ["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
+ ["listing", getAddressDecoder()],
+ ["buyer", getAddressDecoder()],
+ ["seller", getAddressDecoder()],
+ ["resolver", getAddressDecoder()],
+ ["paymentCurrency", getSolistingStateCurrencyDecoder()],
+ ["amount", getU64Decoder()],
+ ["escrowAccount", getAddressDecoder()],
+ ["escrowId", getU64Decoder()],
+ ["orderId", getU64Decoder()],
+ ["createdAt", getI64Decoder()],
+ ["bump", getU8Decoder()],
+ ]);
+}
+
+/** Gets the codec for {@link SolistingStateOrderAccount} account data. */
+export function getSolistingStateOrderAccountCodec(): Codec<
+ SolistingStateOrderAccountArgs,
+ SolistingStateOrderAccount
+> {
+ return combineCodec(
+ getSolistingStateOrderAccountEncoder(),
+ getSolistingStateOrderAccountDecoder(),
+ );
+}
+
+export function decodeSolistingStateOrderAccount<
+ TAddress extends string = string,
+>(
+ encodedAccount: EncodedAccount,
+): Account;
+export function decodeSolistingStateOrderAccount<
+ TAddress extends string = string,
+>(
+ encodedAccount: MaybeEncodedAccount,
+): MaybeAccount;
+export function decodeSolistingStateOrderAccount<
+ TAddress extends string = string,
+>(
+ encodedAccount: EncodedAccount | MaybeEncodedAccount,
+):
+ | Account
+ | MaybeAccount {
+ return decodeAccount(
+ encodedAccount as MaybeEncodedAccount,
+ getSolistingStateOrderAccountDecoder(),
+ );
+}
+
+export async function fetchSolistingStateOrderAccount<
+ TAddress extends string = string,
+>(
+ rpc: Parameters[0],
+ address: Address,
+ config?: FetchAccountConfig,
+): Promise> {
+ const maybeAccount = await fetchMaybeSolistingStateOrderAccount(
+ rpc,
+ address,
+ config,
+ );
+ assertAccountExists(maybeAccount);
+ return maybeAccount;
+}
+
+export async function fetchMaybeSolistingStateOrderAccount<
+ TAddress extends string = string,
+>(
+ rpc: Parameters[0],
+ address: Address,
+ config?: FetchAccountConfig,
+): Promise> {
+ const maybeAccount = await fetchEncodedAccount(rpc, address, config);
+ return decodeSolistingStateOrderAccount(maybeAccount);
+}
+
+export async function fetchAllSolistingStateOrderAccount(
+ rpc: Parameters[0],
+ addresses: Array,
+ config?: FetchAccountsConfig,
+): Promise[]> {
+ const maybeAccounts = await fetchAllMaybeSolistingStateOrderAccount(
+ rpc,
+ addresses,
+ config,
+ );
+ assertAccountsExist(maybeAccounts);
+ return maybeAccounts;
+}
+
+export async function fetchAllMaybeSolistingStateOrderAccount(
+ rpc: Parameters[0],
+ addresses: Array,
+ config?: FetchAccountsConfig,
+): Promise[]> {
+ const maybeAccounts = await fetchEncodedAccounts(rpc, addresses, config);
+ return maybeAccounts.map((maybeAccount) =>
+ decodeSolistingStateOrderAccount(maybeAccount),
+ );
+}
diff --git a/sdk/src/generated/solisting/src/generated/index.ts b/sdk/src/generated/solisting/src/generated/index.ts
new file mode 100644
index 0000000..af1e907
--- /dev/null
+++ b/sdk/src/generated/solisting/src/generated/index.ts
@@ -0,0 +1,13 @@
+/**
+ * This code was AUTOGENERATED using the Codama library.
+ * Please DO NOT EDIT THIS FILE, instead use visitors
+ * to add features, then rerun Codama to update it.
+ *
+ * @see https://github.com/codama-idl/codama
+ */
+
+export * from "./accounts";
+export * from "./instructions";
+export * from "./pdas";
+export * from "./programs";
+export * from "./types";
diff --git a/sdk/src/generated/solisting/src/generated/instructions/acceptOrder.ts b/sdk/src/generated/solisting/src/generated/instructions/acceptOrder.ts
new file mode 100644
index 0000000..cd063bb
--- /dev/null
+++ b/sdk/src/generated/solisting/src/generated/instructions/acceptOrder.ts
@@ -0,0 +1,283 @@
+/**
+ * This code was AUTOGENERATED using the Codama library.
+ * Please DO NOT EDIT THIS FILE, instead use visitors
+ * to add features, then rerun Codama to update it.
+ *
+ * @see https://github.com/codama-idl/codama
+ */
+
+import {
+ combineCodec,
+ fixDecoderSize,
+ fixEncoderSize,
+ getBytesDecoder,
+ getBytesEncoder,
+ getStructDecoder,
+ getStructEncoder,
+ SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
+ SolanaError,
+ transformEncoder,
+ type AccountMeta,
+ type AccountSignerMeta,
+ type Address,
+ type FixedSizeCodec,
+ type FixedSizeDecoder,
+ type FixedSizeEncoder,
+ type Instruction,
+ type InstructionWithAccounts,
+ type InstructionWithData,
+ type ReadonlyAccount,
+ type ReadonlyUint8Array,
+ type TransactionSigner,
+ type WritableAccount,
+ type WritableSignerAccount,
+} from "@solana/kit";
+import {
+ getAccountMetaFactory,
+ type ResolvedInstructionAccount,
+} from "@solana/program-client-core";
+import { SOLISTING_PROGRAM_ADDRESS } from "../programs";
+
+export const ACCEPT_ORDER_DISCRIMINATOR: ReadonlyUint8Array = new Uint8Array([
+ 118, 157, 62, 39, 239, 234, 231, 193,
+]);
+
+export function getAcceptOrderDiscriminatorBytes(): ReadonlyUint8Array {
+ return fixEncoderSize(getBytesEncoder(), 8).encode(
+ ACCEPT_ORDER_DISCRIMINATOR,
+ );
+}
+
+export type AcceptOrderInstruction<
+ TProgram extends string = typeof SOLISTING_PROGRAM_ADDRESS,
+ TAccountSeller extends string | AccountMeta = string,
+ TAccountResolver extends string | AccountMeta = string,
+ TAccountListingAccount extends string | AccountMeta = string,
+ TAccountOrderAccount extends string | AccountMeta = string,
+ TAccountEscrowAccount extends string | AccountMeta = string,
+ TAccountResolverEntry extends string | AccountMeta = string,
+ TAccountDescroProgram extends string | AccountMeta = string,
+ TAccountSystemProgram extends string | AccountMeta =
+ "11111111111111111111111111111111",
+ TRemainingAccounts extends readonly AccountMeta[] = [],
+> = Instruction &
+ InstructionWithData &
+ InstructionWithAccounts<
+ [
+ TAccountSeller extends string
+ ? WritableSignerAccount &
+ AccountSignerMeta
+ : TAccountSeller,
+ TAccountResolver extends string
+ ? ReadonlyAccount
+ : TAccountResolver,
+ TAccountListingAccount extends string
+ ? WritableAccount
+ : TAccountListingAccount,
+ TAccountOrderAccount extends string
+ ? WritableAccount
+ : TAccountOrderAccount,
+ TAccountEscrowAccount extends string
+ ? WritableAccount
+ : TAccountEscrowAccount,
+ TAccountResolverEntry extends string
+ ? ReadonlyAccount
+ : TAccountResolverEntry,
+ TAccountDescroProgram extends string
+ ? ReadonlyAccount
+ : TAccountDescroProgram,
+ TAccountSystemProgram extends string
+ ? ReadonlyAccount
+ : TAccountSystemProgram,
+ ...TRemainingAccounts,
+ ]
+ >;
+
+export type AcceptOrderInstructionData = { discriminator: ReadonlyUint8Array };
+
+export type AcceptOrderInstructionDataArgs = {};
+
+export function getAcceptOrderInstructionDataEncoder(): FixedSizeEncoder {
+ return transformEncoder(
+ getStructEncoder([["discriminator", fixEncoderSize(getBytesEncoder(), 8)]]),
+ (value) => ({ ...value, discriminator: ACCEPT_ORDER_DISCRIMINATOR }),
+ );
+}
+
+export function getAcceptOrderInstructionDataDecoder(): FixedSizeDecoder {
+ return getStructDecoder([
+ ["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
+ ]);
+}
+
+export function getAcceptOrderInstructionDataCodec(): FixedSizeCodec<
+ AcceptOrderInstructionDataArgs,
+ AcceptOrderInstructionData
+> {
+ return combineCodec(
+ getAcceptOrderInstructionDataEncoder(),
+ getAcceptOrderInstructionDataDecoder(),
+ );
+}
+
+export type AcceptOrderInput<
+ TAccountSeller extends string = string,
+ TAccountResolver extends string = string,
+ TAccountListingAccount extends string = string,
+ TAccountOrderAccount extends string = string,
+ TAccountEscrowAccount extends string = string,
+ TAccountResolverEntry extends string = string,
+ TAccountDescroProgram extends string = string,
+ TAccountSystemProgram extends string = string,
+> = {
+ seller: TransactionSigner;
+ resolver: Address;
+ listingAccount: Address;
+ orderAccount: Address;
+ escrowAccount: Address;
+ resolverEntry: Address;
+ descroProgram: Address;
+ systemProgram?: Address;
+};
+
+export function getAcceptOrderInstruction<
+ TAccountSeller extends string,
+ TAccountResolver extends string,
+ TAccountListingAccount extends string,
+ TAccountOrderAccount extends string,
+ TAccountEscrowAccount extends string,
+ TAccountResolverEntry extends string,
+ TAccountDescroProgram extends string,
+ TAccountSystemProgram extends string,
+ TProgramAddress extends Address = typeof SOLISTING_PROGRAM_ADDRESS,
+>(
+ input: AcceptOrderInput<
+ TAccountSeller,
+ TAccountResolver,
+ TAccountListingAccount,
+ TAccountOrderAccount,
+ TAccountEscrowAccount,
+ TAccountResolverEntry,
+ TAccountDescroProgram,
+ TAccountSystemProgram
+ >,
+ config?: { programAddress?: TProgramAddress },
+): AcceptOrderInstruction<
+ TProgramAddress,
+ TAccountSeller,
+ TAccountResolver,
+ TAccountListingAccount,
+ TAccountOrderAccount,
+ TAccountEscrowAccount,
+ TAccountResolverEntry,
+ TAccountDescroProgram,
+ TAccountSystemProgram
+> {
+ // Program address.
+ const programAddress = config?.programAddress ?? SOLISTING_PROGRAM_ADDRESS;
+
+ // Original accounts.
+ const originalAccounts = {
+ seller: { value: input.seller ?? null, isWritable: true },
+ resolver: { value: input.resolver ?? null, isWritable: false },
+ listingAccount: { value: input.listingAccount ?? null, isWritable: true },
+ orderAccount: { value: input.orderAccount ?? null, isWritable: true },
+ escrowAccount: { value: input.escrowAccount ?? null, isWritable: true },
+ resolverEntry: { value: input.resolverEntry ?? null, isWritable: false },
+ descroProgram: { value: input.descroProgram ?? null, isWritable: false },
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false },
+ };
+ const accounts = originalAccounts as Record<
+ keyof typeof originalAccounts,
+ ResolvedInstructionAccount
+ >;
+
+ // Resolve default values.
+ if (!accounts.systemProgram.value) {
+ accounts.systemProgram.value =
+ "11111111111111111111111111111111" as Address<"11111111111111111111111111111111">;
+ }
+
+ const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
+ return Object.freeze({
+ accounts: [
+ getAccountMeta("seller", accounts.seller),
+ getAccountMeta("resolver", accounts.resolver),
+ getAccountMeta("listingAccount", accounts.listingAccount),
+ getAccountMeta("orderAccount", accounts.orderAccount),
+ getAccountMeta("escrowAccount", accounts.escrowAccount),
+ getAccountMeta("resolverEntry", accounts.resolverEntry),
+ getAccountMeta("descroProgram", accounts.descroProgram),
+ getAccountMeta("systemProgram", accounts.systemProgram),
+ ],
+ data: getAcceptOrderInstructionDataEncoder().encode({}),
+ programAddress,
+ } as AcceptOrderInstruction<
+ TProgramAddress,
+ TAccountSeller,
+ TAccountResolver,
+ TAccountListingAccount,
+ TAccountOrderAccount,
+ TAccountEscrowAccount,
+ TAccountResolverEntry,
+ TAccountDescroProgram,
+ TAccountSystemProgram
+ >);
+}
+
+export type ParsedAcceptOrderInstruction<
+ TProgram extends string = typeof SOLISTING_PROGRAM_ADDRESS,
+ TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[],
+> = {
+ programAddress: Address;
+ accounts: {
+ seller: TAccountMetas[0];
+ resolver: TAccountMetas[1];
+ listingAccount: TAccountMetas[2];
+ orderAccount: TAccountMetas[3];
+ escrowAccount: TAccountMetas[4];
+ resolverEntry: TAccountMetas[5];
+ descroProgram: TAccountMetas[6];
+ systemProgram: TAccountMetas[7];
+ };
+ data: AcceptOrderInstructionData;
+};
+
+export function parseAcceptOrderInstruction<
+ TProgram extends string,
+ TAccountMetas extends readonly AccountMeta[],
+>(
+ instruction: Instruction &
+ InstructionWithAccounts &
+ InstructionWithData,
+): ParsedAcceptOrderInstruction {
+ if (instruction.accounts.length < 8) {
+ throw new SolanaError(
+ SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
+ {
+ actualAccountMetas: instruction.accounts.length,
+ expectedAccountMetas: 8,
+ },
+ );
+ }
+ let accountIndex = 0;
+ const getNextAccount = () => {
+ const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!;
+ accountIndex += 1;
+ return accountMeta;
+ };
+ return {
+ programAddress: instruction.programAddress,
+ accounts: {
+ seller: getNextAccount(),
+ resolver: getNextAccount(),
+ listingAccount: getNextAccount(),
+ orderAccount: getNextAccount(),
+ escrowAccount: getNextAccount(),
+ resolverEntry: getNextAccount(),
+ descroProgram: getNextAccount(),
+ systemProgram: getNextAccount(),
+ },
+ data: getAcceptOrderInstructionDataDecoder().decode(instruction.data),
+ };
+}
diff --git a/sdk/src/generated/solisting/src/generated/instructions/cancelOrder.ts b/sdk/src/generated/solisting/src/generated/instructions/cancelOrder.ts
new file mode 100644
index 0000000..95cbaa2
--- /dev/null
+++ b/sdk/src/generated/solisting/src/generated/instructions/cancelOrder.ts
@@ -0,0 +1,386 @@
+/**
+ * This code was AUTOGENERATED using the Codama library.
+ * Please DO NOT EDIT THIS FILE, instead use visitors
+ * to add features, then rerun Codama to update it.
+ *
+ * @see https://github.com/codama-idl/codama
+ */
+
+import {
+ combineCodec,
+ fixDecoderSize,
+ fixEncoderSize,
+ getAddressEncoder,
+ getBytesDecoder,
+ getBytesEncoder,
+ getProgramDerivedAddress,
+ getStructDecoder,
+ getStructEncoder,
+ SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
+ SolanaError,
+ transformEncoder,
+ type AccountMeta,
+ type AccountSignerMeta,
+ type Address,
+ type FixedSizeCodec,
+ type FixedSizeDecoder,
+ type FixedSizeEncoder,
+ type Instruction,
+ type InstructionWithAccounts,
+ type InstructionWithData,
+ type ReadonlyAccount,
+ type ReadonlyUint8Array,
+ type TransactionSigner,
+ type WritableAccount,
+ type WritableSignerAccount,
+} from "@solana/kit";
+import {
+ getAccountMetaFactory,
+ getAddressFromResolvedInstructionAccount,
+ type ResolvedInstructionAccount,
+} from "@solana/program-client-core";
+import { SOLISTING_PROGRAM_ADDRESS } from "../programs";
+
+export const CANCEL_ORDER_DISCRIMINATOR: ReadonlyUint8Array = new Uint8Array([
+ 95, 129, 237, 240, 8, 49, 223, 132,
+]);
+
+export function getCancelOrderDiscriminatorBytes(): ReadonlyUint8Array {
+ return fixEncoderSize(getBytesEncoder(), 8).encode(
+ CANCEL_ORDER_DISCRIMINATOR,
+ );
+}
+
+export type CancelOrderInstruction<
+ TProgram extends string = typeof SOLISTING_PROGRAM_ADDRESS,
+ TAccountBuyer extends string | AccountMeta = string,
+ TAccountListingAccount extends string | AccountMeta = string,
+ TAccountOrderAccount extends string | AccountMeta = string,
+ TAccountEscrowAccount extends string | AccountMeta = string,
+ TAccountVault extends string | AccountMeta = string,
+ TAccountDescroProgram extends string | AccountMeta = string,
+ TAccountSystemProgram extends string | AccountMeta =
+ "11111111111111111111111111111111",
+ TRemainingAccounts extends readonly AccountMeta[] = [],
+> = Instruction &
+ InstructionWithData &
+ InstructionWithAccounts<
+ [
+ TAccountBuyer extends string
+ ? WritableSignerAccount &
+ AccountSignerMeta
+ : TAccountBuyer,
+ TAccountListingAccount extends string
+ ? WritableAccount
+ : TAccountListingAccount,
+ TAccountOrderAccount extends string
+ ? WritableAccount
+ : TAccountOrderAccount,
+ TAccountEscrowAccount extends string
+ ? WritableAccount
+ : TAccountEscrowAccount,
+ TAccountVault extends string
+ ? WritableAccount
+ : TAccountVault,
+ TAccountDescroProgram extends string
+ ? ReadonlyAccount
+ : TAccountDescroProgram,
+ TAccountSystemProgram extends string
+ ? ReadonlyAccount
+ : TAccountSystemProgram,
+ ...TRemainingAccounts,
+ ]
+ >;
+
+export type CancelOrderInstructionData = { discriminator: ReadonlyUint8Array };
+
+export type CancelOrderInstructionDataArgs = {};
+
+export function getCancelOrderInstructionDataEncoder(): FixedSizeEncoder {
+ return transformEncoder(
+ getStructEncoder([["discriminator", fixEncoderSize(getBytesEncoder(), 8)]]),
+ (value) => ({ ...value, discriminator: CANCEL_ORDER_DISCRIMINATOR }),
+ );
+}
+
+export function getCancelOrderInstructionDataDecoder(): FixedSizeDecoder {
+ return getStructDecoder([
+ ["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
+ ]);
+}
+
+export function getCancelOrderInstructionDataCodec(): FixedSizeCodec<
+ CancelOrderInstructionDataArgs,
+ CancelOrderInstructionData
+> {
+ return combineCodec(
+ getCancelOrderInstructionDataEncoder(),
+ getCancelOrderInstructionDataDecoder(),
+ );
+}
+
+export type CancelOrderAsyncInput<
+ TAccountBuyer extends string = string,
+ TAccountListingAccount extends string = string,
+ TAccountOrderAccount extends string = string,
+ TAccountEscrowAccount extends string = string,
+ TAccountVault extends string = string,
+ TAccountDescroProgram extends string = string,
+ TAccountSystemProgram extends string = string,
+> = {
+ buyer: TransactionSigner;
+ listingAccount: Address;
+ orderAccount: Address;
+ escrowAccount: Address;
+ vault?: Address;
+ descroProgram: Address;
+ systemProgram?: Address;
+};
+
+export async function getCancelOrderInstructionAsync<
+ TAccountBuyer extends string,
+ TAccountListingAccount extends string,
+ TAccountOrderAccount extends string,
+ TAccountEscrowAccount extends string,
+ TAccountVault extends string,
+ TAccountDescroProgram extends string,
+ TAccountSystemProgram extends string,
+ TProgramAddress extends Address = typeof SOLISTING_PROGRAM_ADDRESS,
+>(
+ input: CancelOrderAsyncInput<
+ TAccountBuyer,
+ TAccountListingAccount,
+ TAccountOrderAccount,
+ TAccountEscrowAccount,
+ TAccountVault,
+ TAccountDescroProgram,
+ TAccountSystemProgram
+ >,
+ config?: { programAddress?: TProgramAddress },
+): Promise<
+ CancelOrderInstruction<
+ TProgramAddress,
+ TAccountBuyer,
+ TAccountListingAccount,
+ TAccountOrderAccount,
+ TAccountEscrowAccount,
+ TAccountVault,
+ TAccountDescroProgram,
+ TAccountSystemProgram
+ >
+> {
+ // Program address.
+ const programAddress = config?.programAddress ?? SOLISTING_PROGRAM_ADDRESS;
+
+ // Original accounts.
+ const originalAccounts = {
+ buyer: { value: input.buyer ?? null, isWritable: true },
+ listingAccount: { value: input.listingAccount ?? null, isWritable: true },
+ orderAccount: { value: input.orderAccount ?? null, isWritable: true },
+ escrowAccount: { value: input.escrowAccount ?? null, isWritable: true },
+ vault: { value: input.vault ?? null, isWritable: true },
+ descroProgram: { value: input.descroProgram ?? null, isWritable: false },
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false },
+ };
+ const accounts = originalAccounts as Record<
+ keyof typeof originalAccounts,
+ ResolvedInstructionAccount
+ >;
+
+ // Resolve default values.
+ if (!accounts.vault.value) {
+ accounts.vault.value = await getProgramDerivedAddress({
+ programAddress:
+ "DjVR4EuYV6USMJFfsGZwhZ3y8rtWsmG8EvDY96GTqqi3" as Address<"DjVR4EuYV6USMJFfsGZwhZ3y8rtWsmG8EvDY96GTqqi3">,
+ seeds: [
+ getBytesEncoder().encode(new Uint8Array([118, 97, 117, 108, 116])),
+ getAddressEncoder().encode(
+ getAddressFromResolvedInstructionAccount(
+ "escrowAccount",
+ accounts.escrowAccount.value,
+ ),
+ ),
+ ],
+ });
+ }
+ if (!accounts.systemProgram.value) {
+ accounts.systemProgram.value =
+ "11111111111111111111111111111111" as Address<"11111111111111111111111111111111">;
+ }
+
+ const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
+ return Object.freeze({
+ accounts: [
+ getAccountMeta("buyer", accounts.buyer),
+ getAccountMeta("listingAccount", accounts.listingAccount),
+ getAccountMeta("orderAccount", accounts.orderAccount),
+ getAccountMeta("escrowAccount", accounts.escrowAccount),
+ getAccountMeta("vault", accounts.vault),
+ getAccountMeta("descroProgram", accounts.descroProgram),
+ getAccountMeta("systemProgram", accounts.systemProgram),
+ ],
+ data: getCancelOrderInstructionDataEncoder().encode({}),
+ programAddress,
+ } as CancelOrderInstruction<
+ TProgramAddress,
+ TAccountBuyer,
+ TAccountListingAccount,
+ TAccountOrderAccount,
+ TAccountEscrowAccount,
+ TAccountVault,
+ TAccountDescroProgram,
+ TAccountSystemProgram
+ >);
+}
+
+export type CancelOrderInput<
+ TAccountBuyer extends string = string,
+ TAccountListingAccount extends string = string,
+ TAccountOrderAccount extends string = string,
+ TAccountEscrowAccount extends string = string,
+ TAccountVault extends string = string,
+ TAccountDescroProgram extends string = string,
+ TAccountSystemProgram extends string = string,
+> = {
+ buyer: TransactionSigner;
+ listingAccount: Address;
+ orderAccount: Address;
+ escrowAccount: Address;
+ vault: Address;
+ descroProgram: Address;
+ systemProgram?: Address;
+};
+
+export function getCancelOrderInstruction<
+ TAccountBuyer extends string,
+ TAccountListingAccount extends string,
+ TAccountOrderAccount extends string,
+ TAccountEscrowAccount extends string,
+ TAccountVault extends string,
+ TAccountDescroProgram extends string,
+ TAccountSystemProgram extends string,
+ TProgramAddress extends Address = typeof SOLISTING_PROGRAM_ADDRESS,
+>(
+ input: CancelOrderInput<
+ TAccountBuyer,
+ TAccountListingAccount,
+ TAccountOrderAccount,
+ TAccountEscrowAccount,
+ TAccountVault,
+ TAccountDescroProgram,
+ TAccountSystemProgram
+ >,
+ config?: { programAddress?: TProgramAddress },
+): CancelOrderInstruction<
+ TProgramAddress,
+ TAccountBuyer,
+ TAccountListingAccount,
+ TAccountOrderAccount,
+ TAccountEscrowAccount,
+ TAccountVault,
+ TAccountDescroProgram,
+ TAccountSystemProgram
+> {
+ // Program address.
+ const programAddress = config?.programAddress ?? SOLISTING_PROGRAM_ADDRESS;
+
+ // Original accounts.
+ const originalAccounts = {
+ buyer: { value: input.buyer ?? null, isWritable: true },
+ listingAccount: { value: input.listingAccount ?? null, isWritable: true },
+ orderAccount: { value: input.orderAccount ?? null, isWritable: true },
+ escrowAccount: { value: input.escrowAccount ?? null, isWritable: true },
+ vault: { value: input.vault ?? null, isWritable: true },
+ descroProgram: { value: input.descroProgram ?? null, isWritable: false },
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false },
+ };
+ const accounts = originalAccounts as Record<
+ keyof typeof originalAccounts,
+ ResolvedInstructionAccount
+ >;
+
+ // Resolve default values.
+ if (!accounts.systemProgram.value) {
+ accounts.systemProgram.value =
+ "11111111111111111111111111111111" as Address<"11111111111111111111111111111111">;
+ }
+
+ const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
+ return Object.freeze({
+ accounts: [
+ getAccountMeta("buyer", accounts.buyer),
+ getAccountMeta("listingAccount", accounts.listingAccount),
+ getAccountMeta("orderAccount", accounts.orderAccount),
+ getAccountMeta("escrowAccount", accounts.escrowAccount),
+ getAccountMeta("vault", accounts.vault),
+ getAccountMeta("descroProgram", accounts.descroProgram),
+ getAccountMeta("systemProgram", accounts.systemProgram),
+ ],
+ data: getCancelOrderInstructionDataEncoder().encode({}),
+ programAddress,
+ } as CancelOrderInstruction<
+ TProgramAddress,
+ TAccountBuyer,
+ TAccountListingAccount,
+ TAccountOrderAccount,
+ TAccountEscrowAccount,
+ TAccountVault,
+ TAccountDescroProgram,
+ TAccountSystemProgram
+ >);
+}
+
+export type ParsedCancelOrderInstruction<
+ TProgram extends string = typeof SOLISTING_PROGRAM_ADDRESS,
+ TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[],
+> = {
+ programAddress: Address;
+ accounts: {
+ buyer: TAccountMetas[0];
+ listingAccount: TAccountMetas[1];
+ orderAccount: TAccountMetas[2];
+ escrowAccount: TAccountMetas[3];
+ vault: TAccountMetas[4];
+ descroProgram: TAccountMetas[5];
+ systemProgram: TAccountMetas[6];
+ };
+ data: CancelOrderInstructionData;
+};
+
+export function parseCancelOrderInstruction<
+ TProgram extends string,
+ TAccountMetas extends readonly AccountMeta[],
+>(
+ instruction: Instruction &
+ InstructionWithAccounts &
+ InstructionWithData,
+): ParsedCancelOrderInstruction {
+ if (instruction.accounts.length < 7) {
+ throw new SolanaError(
+ SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
+ {
+ actualAccountMetas: instruction.accounts.length,
+ expectedAccountMetas: 7,
+ },
+ );
+ }
+ let accountIndex = 0;
+ const getNextAccount = () => {
+ const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!;
+ accountIndex += 1;
+ return accountMeta;
+ };
+ return {
+ programAddress: instruction.programAddress,
+ accounts: {
+ buyer: getNextAccount(),
+ listingAccount: getNextAccount(),
+ orderAccount: getNextAccount(),
+ escrowAccount: getNextAccount(),
+ vault: getNextAccount(),
+ descroProgram: getNextAccount(),
+ systemProgram: getNextAccount(),
+ },
+ data: getCancelOrderInstructionDataDecoder().decode(instruction.data),
+ };
+}
diff --git a/sdk/src/generated/solisting/src/generated/instructions/closeListing.ts b/sdk/src/generated/solisting/src/generated/instructions/closeListing.ts
new file mode 100644
index 0000000..29abf8c
--- /dev/null
+++ b/sdk/src/generated/solisting/src/generated/instructions/closeListing.ts
@@ -0,0 +1,185 @@
+/**
+ * This code was AUTOGENERATED using the Codama library.
+ * Please DO NOT EDIT THIS FILE, instead use visitors
+ * to add features, then rerun Codama to update it.
+ *
+ * @see https://github.com/codama-idl/codama
+ */
+
+import {
+ combineCodec,
+ fixDecoderSize,
+ fixEncoderSize,
+ getBytesDecoder,
+ getBytesEncoder,
+ getStructDecoder,
+ getStructEncoder,
+ SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
+ SolanaError,
+ transformEncoder,
+ type AccountMeta,
+ type AccountSignerMeta,
+ type Address,
+ type FixedSizeCodec,
+ type FixedSizeDecoder,
+ type FixedSizeEncoder,
+ type Instruction,
+ type InstructionWithAccounts,
+ type InstructionWithData,
+ type ReadonlyUint8Array,
+ type TransactionSigner,
+ type WritableAccount,
+ type WritableSignerAccount,
+} from "@solana/kit";
+import {
+ getAccountMetaFactory,
+ type ResolvedInstructionAccount,
+} from "@solana/program-client-core";
+import { SOLISTING_PROGRAM_ADDRESS } from "../programs";
+
+export const CLOSE_LISTING_DISCRIMINATOR: ReadonlyUint8Array = new Uint8Array([
+ 33, 15, 192, 81, 78, 175, 159, 97,
+]);
+
+export function getCloseListingDiscriminatorBytes(): ReadonlyUint8Array {
+ return fixEncoderSize(getBytesEncoder(), 8).encode(
+ CLOSE_LISTING_DISCRIMINATOR,
+ );
+}
+
+export type CloseListingInstruction<
+ TProgram extends string = typeof SOLISTING_PROGRAM_ADDRESS,
+ TAccountSeller extends string | AccountMeta = string,
+ TAccountListingAccount extends string | AccountMeta = string,
+ TRemainingAccounts extends readonly AccountMeta[] = [],
+> = Instruction &
+ InstructionWithData &
+ InstructionWithAccounts<
+ [
+ TAccountSeller extends string
+ ? WritableSignerAccount &
+ AccountSignerMeta
+ : TAccountSeller,
+ TAccountListingAccount extends string
+ ? WritableAccount
+ : TAccountListingAccount,
+ ...TRemainingAccounts,
+ ]
+ >;
+
+export type CloseListingInstructionData = { discriminator: ReadonlyUint8Array };
+
+export type CloseListingInstructionDataArgs = {};
+
+export function getCloseListingInstructionDataEncoder(): FixedSizeEncoder {
+ return transformEncoder(
+ getStructEncoder([["discriminator", fixEncoderSize(getBytesEncoder(), 8)]]),
+ (value) => ({ ...value, discriminator: CLOSE_LISTING_DISCRIMINATOR }),
+ );
+}
+
+export function getCloseListingInstructionDataDecoder(): FixedSizeDecoder {
+ return getStructDecoder([
+ ["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
+ ]);
+}
+
+export function getCloseListingInstructionDataCodec(): FixedSizeCodec<
+ CloseListingInstructionDataArgs,
+ CloseListingInstructionData
+> {
+ return combineCodec(
+ getCloseListingInstructionDataEncoder(),
+ getCloseListingInstructionDataDecoder(),
+ );
+}
+
+export type CloseListingInput<
+ TAccountSeller extends string = string,
+ TAccountListingAccount extends string = string,
+> = {
+ seller: TransactionSigner;
+ listingAccount: Address;
+};
+
+export function getCloseListingInstruction<
+ TAccountSeller extends string,
+ TAccountListingAccount extends string,
+ TProgramAddress extends Address = typeof SOLISTING_PROGRAM_ADDRESS,
+>(
+ input: CloseListingInput,
+ config?: { programAddress?: TProgramAddress },
+): CloseListingInstruction<
+ TProgramAddress,
+ TAccountSeller,
+ TAccountListingAccount
+> {
+ // Program address.
+ const programAddress = config?.programAddress ?? SOLISTING_PROGRAM_ADDRESS;
+
+ // Original accounts.
+ const originalAccounts = {
+ seller: { value: input.seller ?? null, isWritable: true },
+ listingAccount: { value: input.listingAccount ?? null, isWritable: true },
+ };
+ const accounts = originalAccounts as Record<
+ keyof typeof originalAccounts,
+ ResolvedInstructionAccount
+ >;
+
+ const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
+ return Object.freeze({
+ accounts: [
+ getAccountMeta("seller", accounts.seller),
+ getAccountMeta("listingAccount", accounts.listingAccount),
+ ],
+ data: getCloseListingInstructionDataEncoder().encode({}),
+ programAddress,
+ } as CloseListingInstruction<
+ TProgramAddress,
+ TAccountSeller,
+ TAccountListingAccount
+ >);
+}
+
+export type ParsedCloseListingInstruction<
+ TProgram extends string = typeof SOLISTING_PROGRAM_ADDRESS,
+ TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[],
+> = {
+ programAddress: Address;
+ accounts: {
+ seller: TAccountMetas[0];
+ listingAccount: TAccountMetas[1];
+ };
+ data: CloseListingInstructionData;
+};
+
+export function parseCloseListingInstruction<
+ TProgram extends string,
+ TAccountMetas extends readonly AccountMeta[],
+>(
+ instruction: Instruction &
+ InstructionWithAccounts &
+ InstructionWithData,
+): ParsedCloseListingInstruction {
+ if (instruction.accounts.length < 2) {
+ throw new SolanaError(
+ SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
+ {
+ actualAccountMetas: instruction.accounts.length,
+ expectedAccountMetas: 2,
+ },
+ );
+ }
+ let accountIndex = 0;
+ const getNextAccount = () => {
+ const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!;
+ accountIndex += 1;
+ return accountMeta;
+ };
+ return {
+ programAddress: instruction.programAddress,
+ accounts: { seller: getNextAccount(), listingAccount: getNextAccount() },
+ data: getCloseListingInstructionDataDecoder().decode(instruction.data),
+ };
+}
diff --git a/sdk/src/generated/solisting/src/generated/instructions/closeStaleOrder.ts b/sdk/src/generated/solisting/src/generated/instructions/closeStaleOrder.ts
new file mode 100644
index 0000000..ae54369
--- /dev/null
+++ b/sdk/src/generated/solisting/src/generated/instructions/closeStaleOrder.ts
@@ -0,0 +1,207 @@
+/**
+ * This code was AUTOGENERATED using the Codama library.
+ * Please DO NOT EDIT THIS FILE, instead use visitors
+ * to add features, then rerun Codama to update it.
+ *
+ * @see https://github.com/codama-idl/codama
+ */
+
+import {
+ combineCodec,
+ fixDecoderSize,
+ fixEncoderSize,
+ getBytesDecoder,
+ getBytesEncoder,
+ getStructDecoder,
+ getStructEncoder,
+ SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
+ SolanaError,
+ transformEncoder,
+ type AccountMeta,
+ type AccountSignerMeta,
+ type Address,
+ type FixedSizeCodec,
+ type FixedSizeDecoder,
+ type FixedSizeEncoder,
+ type Instruction,
+ type InstructionWithAccounts,
+ type InstructionWithData,
+ type ReadonlyAccount,
+ type ReadonlyUint8Array,
+ type TransactionSigner,
+ type WritableAccount,
+ type WritableSignerAccount,
+} from "@solana/kit";
+import {
+ getAccountMetaFactory,
+ type ResolvedInstructionAccount,
+} from "@solana/program-client-core";
+import { SOLISTING_PROGRAM_ADDRESS } from "../programs";
+
+export const CLOSE_STALE_ORDER_DISCRIMINATOR: ReadonlyUint8Array =
+ new Uint8Array([167, 12, 32, 252, 132, 106, 131, 250]);
+
+export function getCloseStaleOrderDiscriminatorBytes(): ReadonlyUint8Array {
+ return fixEncoderSize(getBytesEncoder(), 8).encode(
+ CLOSE_STALE_ORDER_DISCRIMINATOR,
+ );
+}
+
+export type CloseStaleOrderInstruction<
+ TProgram extends string = typeof SOLISTING_PROGRAM_ADDRESS,
+ TAccountCaller extends string | AccountMeta = string,
+ TAccountOrderAccount extends string | AccountMeta = string,
+ TAccountEscrowAccount extends string | AccountMeta = string,
+ TRemainingAccounts extends readonly AccountMeta[] = [],
+> = Instruction &
+ InstructionWithData &
+ InstructionWithAccounts<
+ [
+ TAccountCaller extends string
+ ? WritableSignerAccount &
+ AccountSignerMeta
+ : TAccountCaller,
+ TAccountOrderAccount extends string
+ ? WritableAccount
+ : TAccountOrderAccount,
+ TAccountEscrowAccount extends string
+ ? ReadonlyAccount
+ : TAccountEscrowAccount,
+ ...TRemainingAccounts,
+ ]
+ >;
+
+export type CloseStaleOrderInstructionData = {
+ discriminator: ReadonlyUint8Array;
+};
+
+export type CloseStaleOrderInstructionDataArgs = {};
+
+export function getCloseStaleOrderInstructionDataEncoder(): FixedSizeEncoder {
+ return transformEncoder(
+ getStructEncoder([["discriminator", fixEncoderSize(getBytesEncoder(), 8)]]),
+ (value) => ({ ...value, discriminator: CLOSE_STALE_ORDER_DISCRIMINATOR }),
+ );
+}
+
+export function getCloseStaleOrderInstructionDataDecoder(): FixedSizeDecoder {
+ return getStructDecoder([
+ ["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
+ ]);
+}
+
+export function getCloseStaleOrderInstructionDataCodec(): FixedSizeCodec<
+ CloseStaleOrderInstructionDataArgs,
+ CloseStaleOrderInstructionData
+> {
+ return combineCodec(
+ getCloseStaleOrderInstructionDataEncoder(),
+ getCloseStaleOrderInstructionDataDecoder(),
+ );
+}
+
+export type CloseStaleOrderInput<
+ TAccountCaller extends string = string,
+ TAccountOrderAccount extends string = string,
+ TAccountEscrowAccount extends string = string,
+> = {
+ caller: TransactionSigner;
+ orderAccount: Address;
+ escrowAccount: Address;
+};
+
+export function getCloseStaleOrderInstruction<
+ TAccountCaller extends string,
+ TAccountOrderAccount extends string,
+ TAccountEscrowAccount extends string,
+ TProgramAddress extends Address = typeof SOLISTING_PROGRAM_ADDRESS,
+>(
+ input: CloseStaleOrderInput<
+ TAccountCaller,
+ TAccountOrderAccount,
+ TAccountEscrowAccount
+ >,
+ config?: { programAddress?: TProgramAddress },
+): CloseStaleOrderInstruction<
+ TProgramAddress,
+ TAccountCaller,
+ TAccountOrderAccount,
+ TAccountEscrowAccount
+> {
+ // Program address.
+ const programAddress = config?.programAddress ?? SOLISTING_PROGRAM_ADDRESS;
+
+ // Original accounts.
+ const originalAccounts = {
+ caller: { value: input.caller ?? null, isWritable: true },
+ orderAccount: { value: input.orderAccount ?? null, isWritable: true },
+ escrowAccount: { value: input.escrowAccount ?? null, isWritable: false },
+ };
+ const accounts = originalAccounts as Record<
+ keyof typeof originalAccounts,
+ ResolvedInstructionAccount
+ >;
+
+ const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
+ return Object.freeze({
+ accounts: [
+ getAccountMeta("caller", accounts.caller),
+ getAccountMeta("orderAccount", accounts.orderAccount),
+ getAccountMeta("escrowAccount", accounts.escrowAccount),
+ ],
+ data: getCloseStaleOrderInstructionDataEncoder().encode({}),
+ programAddress,
+ } as CloseStaleOrderInstruction<
+ TProgramAddress,
+ TAccountCaller,
+ TAccountOrderAccount,
+ TAccountEscrowAccount
+ >);
+}
+
+export type ParsedCloseStaleOrderInstruction<
+ TProgram extends string = typeof SOLISTING_PROGRAM_ADDRESS,
+ TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[],
+> = {
+ programAddress: Address;
+ accounts: {
+ caller: TAccountMetas[0];
+ orderAccount: TAccountMetas[1];
+ escrowAccount: TAccountMetas[2];
+ };
+ data: CloseStaleOrderInstructionData;
+};
+
+export function parseCloseStaleOrderInstruction<
+ TProgram extends string,
+ TAccountMetas extends readonly AccountMeta[],
+>(
+ instruction: Instruction &
+ InstructionWithAccounts &
+ InstructionWithData,
+): ParsedCloseStaleOrderInstruction {
+ if (instruction.accounts.length < 3) {
+ throw new SolanaError(
+ SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
+ {
+ actualAccountMetas: instruction.accounts.length,
+ expectedAccountMetas: 3,
+ },
+ );
+ }
+ let accountIndex = 0;
+ const getNextAccount = () => {
+ const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!;
+ accountIndex += 1;
+ return accountMeta;
+ };
+ return {
+ programAddress: instruction.programAddress,
+ accounts: {
+ caller: getNextAccount(),
+ orderAccount: getNextAccount(),
+ escrowAccount: getNextAccount(),
+ },
+ data: getCloseStaleOrderInstructionDataDecoder().decode(instruction.data),
+ };
+}
diff --git a/sdk/src/generated/solisting/src/generated/instructions/createListing.ts b/sdk/src/generated/solisting/src/generated/instructions/createListing.ts
new file mode 100644
index 0000000..e0668ff
--- /dev/null
+++ b/sdk/src/generated/solisting/src/generated/instructions/createListing.ts
@@ -0,0 +1,390 @@
+/**
+ * This code was AUTOGENERATED using the Codama library.
+ * Please DO NOT EDIT THIS FILE, instead use visitors
+ * to add features, then rerun Codama to update it.
+ *
+ * @see https://github.com/codama-idl/codama
+ */
+
+import {
+ addDecoderSizePrefix,
+ addEncoderSizePrefix,
+ combineCodec,
+ fixDecoderSize,
+ fixEncoderSize,
+ getAddressDecoder,
+ getAddressEncoder,
+ getArrayDecoder,
+ getArrayEncoder,
+ getBytesDecoder,
+ getBytesEncoder,
+ getOptionDecoder,
+ getOptionEncoder,
+ getStructDecoder,
+ getStructEncoder,
+ getU32Decoder,
+ getU32Encoder,
+ getU64Decoder,
+ getU64Encoder,
+ getUtf8Decoder,
+ getUtf8Encoder,
+ SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
+ SolanaError,
+ transformEncoder,
+ type AccountMeta,
+ type AccountSignerMeta,
+ type Address,
+ type Codec,
+ type Decoder,
+ type Encoder,
+ type Instruction,
+ type InstructionWithAccounts,
+ type InstructionWithData,
+ type Option,
+ type OptionOrNullable,
+ type ReadonlyAccount,
+ type ReadonlyUint8Array,
+ type TransactionSigner,
+ type WritableAccount,
+ type WritableSignerAccount,
+} from "@solana/kit";
+import {
+ getAccountMetaFactory,
+ getAddressFromResolvedInstructionAccount,
+ getNonNullResolvedInstructionInput,
+ type ResolvedInstructionAccount,
+} from "@solana/program-client-core";
+import { findListingAccountPda } from "../pdas";
+import { SOLISTING_PROGRAM_ADDRESS } from "../programs";
+import {
+ getSolistingStateAltCurrencyConfigDecoder,
+ getSolistingStateAltCurrencyConfigEncoder,
+ getSolistingStateCurrencyDecoder,
+ getSolistingStateCurrencyEncoder,
+ type SolistingStateAltCurrencyConfig,
+ type SolistingStateAltCurrencyConfigArgs,
+ type SolistingStateCurrency,
+ type SolistingStateCurrencyArgs,
+} from "../types";
+
+export const CREATE_LISTING_DISCRIMINATOR: ReadonlyUint8Array = new Uint8Array([
+ 18, 168, 45, 24, 191, 31, 117, 54,
+]);
+
+export function getCreateListingDiscriminatorBytes(): ReadonlyUint8Array {
+ return fixEncoderSize(getBytesEncoder(), 8).encode(
+ CREATE_LISTING_DISCRIMINATOR,
+ );
+}
+
+export type CreateListingInstruction<
+ TProgram extends string = typeof SOLISTING_PROGRAM_ADDRESS,
+ TAccountSeller extends string | AccountMeta = string,
+ TAccountListingAccount extends string | AccountMeta = string,
+ TAccountSystemProgram extends string | AccountMeta =
+ "11111111111111111111111111111111",
+ TRemainingAccounts extends readonly AccountMeta[] = [],
+> = Instruction &
+ InstructionWithData &
+ InstructionWithAccounts<
+ [
+ TAccountSeller extends string
+ ? WritableSignerAccount &
+ AccountSignerMeta
+ : TAccountSeller,
+ TAccountListingAccount extends string
+ ? WritableAccount
+ : TAccountListingAccount,
+ TAccountSystemProgram extends string
+ ? ReadonlyAccount
+ : TAccountSystemProgram,
+ ...TRemainingAccounts,
+ ]
+ >;
+
+export type CreateListingInstructionData = {
+ discriminator: ReadonlyUint8Array;
+ listingId: bigint;
+ canonicalCurrency: SolistingStateCurrency;
+ price: bigint;
+ canonicalOracle: Option;
+ altCurrencies: Array;
+ acceptedResolvers: Array;
+ quantity: number;
+ metadataUri: string;
+};
+
+export type CreateListingInstructionDataArgs = {
+ listingId: number | bigint;
+ canonicalCurrency: SolistingStateCurrencyArgs;
+ price: number | bigint;
+ canonicalOracle: OptionOrNullable;
+ altCurrencies: Array;
+ acceptedResolvers: Array;
+ quantity: number;
+ metadataUri: string;
+};
+
+export function getCreateListingInstructionDataEncoder(): Encoder {
+ return transformEncoder(
+ getStructEncoder([
+ ["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
+ ["listingId", getU64Encoder()],
+ ["canonicalCurrency", getSolistingStateCurrencyEncoder()],
+ ["price", getU64Encoder()],
+ ["canonicalOracle", getOptionEncoder(getAddressEncoder())],
+ [
+ "altCurrencies",
+ getArrayEncoder(getSolistingStateAltCurrencyConfigEncoder()),
+ ],
+ ["acceptedResolvers", getArrayEncoder(getAddressEncoder())],
+ ["quantity", getU32Encoder()],
+ ["metadataUri", addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())],
+ ]),
+ (value) => ({ ...value, discriminator: CREATE_LISTING_DISCRIMINATOR }),
+ );
+}
+
+export function getCreateListingInstructionDataDecoder(): Decoder {
+ return getStructDecoder([
+ ["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
+ ["listingId", getU64Decoder()],
+ ["canonicalCurrency", getSolistingStateCurrencyDecoder()],
+ ["price", getU64Decoder()],
+ ["canonicalOracle", getOptionDecoder(getAddressDecoder())],
+ [
+ "altCurrencies",
+ getArrayDecoder(getSolistingStateAltCurrencyConfigDecoder()),
+ ],
+ ["acceptedResolvers", getArrayDecoder(getAddressDecoder())],
+ ["quantity", getU32Decoder()],
+ ["metadataUri", addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())],
+ ]);
+}
+
+export function getCreateListingInstructionDataCodec(): Codec<
+ CreateListingInstructionDataArgs,
+ CreateListingInstructionData
+> {
+ return combineCodec(
+ getCreateListingInstructionDataEncoder(),
+ getCreateListingInstructionDataDecoder(),
+ );
+}
+
+export type CreateListingAsyncInput<
+ TAccountSeller extends string = string,
+ TAccountListingAccount extends string = string,
+ TAccountSystemProgram extends string = string,
+> = {
+ seller: TransactionSigner;
+ listingAccount?: Address;
+ systemProgram?: Address;
+ listingId: CreateListingInstructionDataArgs["listingId"];
+ canonicalCurrency: CreateListingInstructionDataArgs["canonicalCurrency"];
+ price: CreateListingInstructionDataArgs["price"];
+ canonicalOracle: CreateListingInstructionDataArgs["canonicalOracle"];
+ altCurrencies: CreateListingInstructionDataArgs["altCurrencies"];
+ acceptedResolvers: CreateListingInstructionDataArgs["acceptedResolvers"];
+ quantity: CreateListingInstructionDataArgs["quantity"];
+ metadataUri: CreateListingInstructionDataArgs["metadataUri"];
+};
+
+export async function getCreateListingInstructionAsync<
+ TAccountSeller extends string,
+ TAccountListingAccount extends string,
+ TAccountSystemProgram extends string,
+ TProgramAddress extends Address = typeof SOLISTING_PROGRAM_ADDRESS,
+>(
+ input: CreateListingAsyncInput<
+ TAccountSeller,
+ TAccountListingAccount,
+ TAccountSystemProgram
+ >,
+ config?: { programAddress?: TProgramAddress },
+): Promise<
+ CreateListingInstruction<
+ TProgramAddress,
+ TAccountSeller,
+ TAccountListingAccount,
+ TAccountSystemProgram
+ >
+> {
+ // Program address.
+ const programAddress = config?.programAddress ?? SOLISTING_PROGRAM_ADDRESS;
+
+ // Original accounts.
+ const originalAccounts = {
+ seller: { value: input.seller ?? null, isWritable: true },
+ listingAccount: { value: input.listingAccount ?? null, isWritable: true },
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false },
+ };
+ const accounts = originalAccounts as Record<
+ keyof typeof originalAccounts,
+ ResolvedInstructionAccount
+ >;
+
+ // Original args.
+ const args = { ...input };
+
+ // Resolve default values.
+ if (!accounts.listingAccount.value) {
+ accounts.listingAccount.value = await findListingAccountPda({
+ seller: getAddressFromResolvedInstructionAccount(
+ "seller",
+ accounts.seller.value,
+ ),
+ listingId: getNonNullResolvedInstructionInput(
+ "listingId",
+ args.listingId,
+ ),
+ });
+ }
+ if (!accounts.systemProgram.value) {
+ accounts.systemProgram.value =
+ "11111111111111111111111111111111" as Address<"11111111111111111111111111111111">;
+ }
+
+ const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
+ return Object.freeze({
+ accounts: [
+ getAccountMeta("seller", accounts.seller),
+ getAccountMeta("listingAccount", accounts.listingAccount),
+ getAccountMeta("systemProgram", accounts.systemProgram),
+ ],
+ data: getCreateListingInstructionDataEncoder().encode(
+ args as CreateListingInstructionDataArgs,
+ ),
+ programAddress,
+ } as CreateListingInstruction<
+ TProgramAddress,
+ TAccountSeller,
+ TAccountListingAccount,
+ TAccountSystemProgram
+ >);
+}
+
+export type CreateListingInput<
+ TAccountSeller extends string = string,
+ TAccountListingAccount extends string = string,
+ TAccountSystemProgram extends string = string,
+> = {
+ seller: TransactionSigner;
+ listingAccount: Address;
+ systemProgram?: Address;
+ listingId: CreateListingInstructionDataArgs["listingId"];
+ canonicalCurrency: CreateListingInstructionDataArgs["canonicalCurrency"];
+ price: CreateListingInstructionDataArgs["price"];
+ canonicalOracle: CreateListingInstructionDataArgs["canonicalOracle"];
+ altCurrencies: CreateListingInstructionDataArgs["altCurrencies"];
+ acceptedResolvers: CreateListingInstructionDataArgs["acceptedResolvers"];
+ quantity: CreateListingInstructionDataArgs["quantity"];
+ metadataUri: CreateListingInstructionDataArgs["metadataUri"];
+};
+
+export function getCreateListingInstruction<
+ TAccountSeller extends string,
+ TAccountListingAccount extends string,
+ TAccountSystemProgram extends string,
+ TProgramAddress extends Address = typeof SOLISTING_PROGRAM_ADDRESS,
+>(
+ input: CreateListingInput<
+ TAccountSeller,
+ TAccountListingAccount,
+ TAccountSystemProgram
+ >,
+ config?: { programAddress?: TProgramAddress },
+): CreateListingInstruction<
+ TProgramAddress,
+ TAccountSeller,
+ TAccountListingAccount,
+ TAccountSystemProgram
+> {
+ // Program address.
+ const programAddress = config?.programAddress ?? SOLISTING_PROGRAM_ADDRESS;
+
+ // Original accounts.
+ const originalAccounts = {
+ seller: { value: input.seller ?? null, isWritable: true },
+ listingAccount: { value: input.listingAccount ?? null, isWritable: true },
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false },
+ };
+ const accounts = originalAccounts as Record<
+ keyof typeof originalAccounts,
+ ResolvedInstructionAccount
+ >;
+
+ // Original args.
+ const args = { ...input };
+
+ // Resolve default values.
+ if (!accounts.systemProgram.value) {
+ accounts.systemProgram.value =
+ "11111111111111111111111111111111" as Address<"11111111111111111111111111111111">;
+ }
+
+ const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
+ return Object.freeze({
+ accounts: [
+ getAccountMeta("seller", accounts.seller),
+ getAccountMeta("listingAccount", accounts.listingAccount),
+ getAccountMeta("systemProgram", accounts.systemProgram),
+ ],
+ data: getCreateListingInstructionDataEncoder().encode(
+ args as CreateListingInstructionDataArgs,
+ ),
+ programAddress,
+ } as CreateListingInstruction<
+ TProgramAddress,
+ TAccountSeller,
+ TAccountListingAccount,
+ TAccountSystemProgram
+ >);
+}
+
+export type ParsedCreateListingInstruction<
+ TProgram extends string = typeof SOLISTING_PROGRAM_ADDRESS,
+ TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[],
+> = {
+ programAddress: Address;
+ accounts: {
+ seller: TAccountMetas[0];
+ listingAccount: TAccountMetas[1];
+ systemProgram: TAccountMetas[2];
+ };
+ data: CreateListingInstructionData;
+};
+
+export function parseCreateListingInstruction<
+ TProgram extends string,
+ TAccountMetas extends readonly AccountMeta[],
+>(
+ instruction: Instruction &
+ InstructionWithAccounts &
+ InstructionWithData,
+): ParsedCreateListingInstruction {
+ if (instruction.accounts.length < 3) {
+ throw new SolanaError(
+ SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
+ {
+ actualAccountMetas: instruction.accounts.length,
+ expectedAccountMetas: 3,
+ },
+ );
+ }
+ let accountIndex = 0;
+ const getNextAccount = () => {
+ const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!;
+ accountIndex += 1;
+ return accountMeta;
+ };
+ return {
+ programAddress: instruction.programAddress,
+ accounts: {
+ seller: getNextAccount(),
+ listingAccount: getNextAccount(),
+ systemProgram: getNextAccount(),
+ },
+ data: getCreateListingInstructionDataDecoder().decode(instruction.data),
+ };
+}
diff --git a/sdk/src/generated/solisting/src/generated/instructions/createOrder.ts b/sdk/src/generated/solisting/src/generated/instructions/createOrder.ts
new file mode 100644
index 0000000..26b7b6b
--- /dev/null
+++ b/sdk/src/generated/solisting/src/generated/instructions/createOrder.ts
@@ -0,0 +1,559 @@
+/**
+ * This code was AUTOGENERATED using the Codama library.
+ * Please DO NOT EDIT THIS FILE, instead use visitors
+ * to add features, then rerun Codama to update it.
+ *
+ * @see https://github.com/codama-idl/codama
+ */
+
+import {
+ combineCodec,
+ fixDecoderSize,
+ fixEncoderSize,
+ getAddressDecoder,
+ getAddressEncoder,
+ getBytesDecoder,
+ getBytesEncoder,
+ getProgramDerivedAddress,
+ getStructDecoder,
+ getStructEncoder,
+ getU16Decoder,
+ getU16Encoder,
+ getU64Decoder,
+ getU64Encoder,
+ SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
+ SolanaError,
+ transformEncoder,
+ type AccountMeta,
+ type AccountSignerMeta,
+ type Address,
+ type Codec,
+ type Decoder,
+ type Encoder,
+ type Instruction,
+ type InstructionWithAccounts,
+ type InstructionWithData,
+ type ReadonlyAccount,
+ type ReadonlyUint8Array,
+ type TransactionSigner,
+ type WritableAccount,
+ type WritableSignerAccount,
+} from "@solana/kit";
+import {
+ getAccountMetaFactory,
+ getAddressFromResolvedInstructionAccount,
+ getNonNullResolvedInstructionInput,
+ type ResolvedInstructionAccount,
+} from "@solana/program-client-core";
+import { findOrderAccountPda } from "../pdas";
+import { SOLISTING_PROGRAM_ADDRESS } from "../programs";
+import {
+ getSolistingStateCurrencyDecoder,
+ getSolistingStateCurrencyEncoder,
+ type SolistingStateCurrency,
+ type SolistingStateCurrencyArgs,
+} from "../types";
+
+export const CREATE_ORDER_DISCRIMINATOR: ReadonlyUint8Array = new Uint8Array([
+ 141, 54, 37, 207, 237, 210, 250, 215,
+]);
+
+export function getCreateOrderDiscriminatorBytes(): ReadonlyUint8Array {
+ return fixEncoderSize(getBytesEncoder(), 8).encode(
+ CREATE_ORDER_DISCRIMINATOR,
+ );
+}
+
+export type CreateOrderInstruction<
+ TProgram extends string = typeof SOLISTING_PROGRAM_ADDRESS,
+ TAccountBuyer extends string | AccountMeta = string,
+ TAccountSeller extends string | AccountMeta = string,
+ TAccountListingAccount extends string | AccountMeta = string,
+ TAccountOrderAccount extends string | AccountMeta = string,
+ TAccountEscrowAccount extends string | AccountMeta = string,
+ TAccountDescroVault extends string | AccountMeta = string,
+ TAccountCanonicalOracle extends string | AccountMeta = string,
+ TAccountTargetOracle extends string | AccountMeta = string,
+ TAccountDescroProgram extends string | AccountMeta = string,
+ TAccountSystemProgram extends string | AccountMeta =
+ "11111111111111111111111111111111",
+ TRemainingAccounts extends readonly AccountMeta[] = [],
+> = Instruction &
+ InstructionWithData &
+ InstructionWithAccounts<
+ [
+ TAccountBuyer extends string
+ ? WritableSignerAccount &
+ AccountSignerMeta
+ : TAccountBuyer,
+ TAccountSeller extends string
+ ? ReadonlyAccount
+ : TAccountSeller,
+ TAccountListingAccount extends string
+ ? WritableAccount
+ : TAccountListingAccount,
+ TAccountOrderAccount extends string
+ ? WritableAccount
+ : TAccountOrderAccount,
+ TAccountEscrowAccount extends string
+ ? WritableAccount
+ : TAccountEscrowAccount,
+ TAccountDescroVault extends string
+ ? WritableAccount
+ : TAccountDescroVault,
+ TAccountCanonicalOracle extends string
+ ? ReadonlyAccount
+ : TAccountCanonicalOracle,
+ TAccountTargetOracle extends string
+ ? ReadonlyAccount
+ : TAccountTargetOracle,
+ TAccountDescroProgram extends string
+ ? ReadonlyAccount
+ : TAccountDescroProgram,
+ TAccountSystemProgram extends string
+ ? ReadonlyAccount
+ : TAccountSystemProgram,
+ ...TRemainingAccounts,
+ ]
+ >;
+
+export type CreateOrderInstructionData = {
+ discriminator: ReadonlyUint8Array;
+ orderId: bigint;
+ escrowId: bigint;
+ resolver: Address;
+ paymentCurrency: SolistingStateCurrency;
+ expectedAmount: bigint;
+ maxSlippageBps: number;
+};
+
+export type CreateOrderInstructionDataArgs = {
+ orderId: number | bigint;
+ escrowId: number | bigint;
+ resolver: Address;
+ paymentCurrency: SolistingStateCurrencyArgs;
+ expectedAmount: number | bigint;
+ maxSlippageBps: number;
+};
+
+export function getCreateOrderInstructionDataEncoder(): Encoder {
+ return transformEncoder(
+ getStructEncoder([
+ ["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
+ ["orderId", getU64Encoder()],
+ ["escrowId", getU64Encoder()],
+ ["resolver", getAddressEncoder()],
+ ["paymentCurrency", getSolistingStateCurrencyEncoder()],
+ ["expectedAmount", getU64Encoder()],
+ ["maxSlippageBps", getU16Encoder()],
+ ]),
+ (value) => ({ ...value, discriminator: CREATE_ORDER_DISCRIMINATOR }),
+ );
+}
+
+export function getCreateOrderInstructionDataDecoder(): Decoder {
+ return getStructDecoder([
+ ["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
+ ["orderId", getU64Decoder()],
+ ["escrowId", getU64Decoder()],
+ ["resolver", getAddressDecoder()],
+ ["paymentCurrency", getSolistingStateCurrencyDecoder()],
+ ["expectedAmount", getU64Decoder()],
+ ["maxSlippageBps", getU16Decoder()],
+ ]);
+}
+
+export function getCreateOrderInstructionDataCodec(): Codec<
+ CreateOrderInstructionDataArgs,
+ CreateOrderInstructionData
+> {
+ return combineCodec(
+ getCreateOrderInstructionDataEncoder(),
+ getCreateOrderInstructionDataDecoder(),
+ );
+}
+
+export type CreateOrderAsyncInput<
+ TAccountBuyer extends string = string,
+ TAccountSeller extends string = string,
+ TAccountListingAccount extends string = string,
+ TAccountOrderAccount extends string = string,
+ TAccountEscrowAccount extends string = string,
+ TAccountDescroVault extends string = string,
+ TAccountCanonicalOracle extends string = string,
+ TAccountTargetOracle extends string = string,
+ TAccountDescroProgram extends string = string,
+ TAccountSystemProgram extends string = string,
+> = {
+ buyer: TransactionSigner;
+ seller: Address;
+ listingAccount: Address;
+ orderAccount?: Address;
+ escrowAccount?: Address;
+ descroVault?: Address;
+ /** Pass SystemProgram as placeholder when canonical_oracle is None (stablecoin). */
+ canonicalOracle: Address;
+ /** Pass SystemProgram as placeholder when usd_oracle is None or paying canonical. */
+ targetOracle: Address;
+ descroProgram: Address;
+ systemProgram?: Address;
+ orderId: CreateOrderInstructionDataArgs["orderId"];
+ escrowId: CreateOrderInstructionDataArgs["escrowId"];
+ resolver: CreateOrderInstructionDataArgs["resolver"];
+ paymentCurrency: CreateOrderInstructionDataArgs["paymentCurrency"];
+ expectedAmount: CreateOrderInstructionDataArgs["expectedAmount"];
+ maxSlippageBps: CreateOrderInstructionDataArgs["maxSlippageBps"];
+};
+
+export async function getCreateOrderInstructionAsync<
+ TAccountBuyer extends string,
+ TAccountSeller extends string,
+ TAccountListingAccount extends string,
+ TAccountOrderAccount extends string,
+ TAccountEscrowAccount extends string,
+ TAccountDescroVault extends string,
+ TAccountCanonicalOracle extends string,
+ TAccountTargetOracle extends string,
+ TAccountDescroProgram extends string,
+ TAccountSystemProgram extends string,
+ TProgramAddress extends Address = typeof SOLISTING_PROGRAM_ADDRESS,
+>(
+ input: CreateOrderAsyncInput<
+ TAccountBuyer,
+ TAccountSeller,
+ TAccountListingAccount,
+ TAccountOrderAccount,
+ TAccountEscrowAccount,
+ TAccountDescroVault,
+ TAccountCanonicalOracle,
+ TAccountTargetOracle,
+ TAccountDescroProgram,
+ TAccountSystemProgram
+ >,
+ config?: { programAddress?: TProgramAddress },
+): Promise<
+ CreateOrderInstruction<
+ TProgramAddress,
+ TAccountBuyer,
+ TAccountSeller,
+ TAccountListingAccount,
+ TAccountOrderAccount,
+ TAccountEscrowAccount,
+ TAccountDescroVault,
+ TAccountCanonicalOracle,
+ TAccountTargetOracle,
+ TAccountDescroProgram,
+ TAccountSystemProgram
+ >
+> {
+ // Program address.
+ const programAddress = config?.programAddress ?? SOLISTING_PROGRAM_ADDRESS;
+
+ // Original accounts.
+ const originalAccounts = {
+ buyer: { value: input.buyer ?? null, isWritable: true },
+ seller: { value: input.seller ?? null, isWritable: false },
+ listingAccount: { value: input.listingAccount ?? null, isWritable: true },
+ orderAccount: { value: input.orderAccount ?? null, isWritable: true },
+ escrowAccount: { value: input.escrowAccount ?? null, isWritable: true },
+ descroVault: { value: input.descroVault ?? null, isWritable: true },
+ canonicalOracle: {
+ value: input.canonicalOracle ?? null,
+ isWritable: false,
+ },
+ targetOracle: { value: input.targetOracle ?? null, isWritable: false },
+ descroProgram: { value: input.descroProgram ?? null, isWritable: false },
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false },
+ };
+ const accounts = originalAccounts as Record<
+ keyof typeof originalAccounts,
+ ResolvedInstructionAccount
+ >;
+
+ // Original args.
+ const args = { ...input };
+
+ // Resolve default values.
+ if (!accounts.orderAccount.value) {
+ accounts.orderAccount.value = await findOrderAccountPda({
+ listingAccount: getAddressFromResolvedInstructionAccount(
+ "listingAccount",
+ accounts.listingAccount.value,
+ ),
+ buyer: getAddressFromResolvedInstructionAccount(
+ "buyer",
+ accounts.buyer.value,
+ ),
+ orderId: getNonNullResolvedInstructionInput("orderId", args.orderId),
+ });
+ }
+ if (!accounts.escrowAccount.value) {
+ accounts.escrowAccount.value = await getProgramDerivedAddress({
+ programAddress:
+ "DjVR4EuYV6USMJFfsGZwhZ3y8rtWsmG8EvDY96GTqqi3" as Address<"DjVR4EuYV6USMJFfsGZwhZ3y8rtWsmG8EvDY96GTqqi3">,
+ seeds: [
+ getBytesEncoder().encode(new Uint8Array([101, 115, 99, 114, 111, 119])),
+ getAddressEncoder().encode(
+ getAddressFromResolvedInstructionAccount(
+ "seller",
+ accounts.seller.value,
+ ),
+ ),
+ getU64Encoder().encode(
+ getNonNullResolvedInstructionInput("escrowId", args.escrowId),
+ ),
+ ],
+ });
+ }
+ if (!accounts.descroVault.value) {
+ accounts.descroVault.value = await getProgramDerivedAddress({
+ programAddress:
+ "DjVR4EuYV6USMJFfsGZwhZ3y8rtWsmG8EvDY96GTqqi3" as Address<"DjVR4EuYV6USMJFfsGZwhZ3y8rtWsmG8EvDY96GTqqi3">,
+ seeds: [
+ getBytesEncoder().encode(new Uint8Array([118, 97, 117, 108, 116])),
+ getAddressEncoder().encode(
+ getAddressFromResolvedInstructionAccount(
+ "escrowAccount",
+ accounts.escrowAccount.value,
+ ),
+ ),
+ ],
+ });
+ }
+ if (!accounts.systemProgram.value) {
+ accounts.systemProgram.value =
+ "11111111111111111111111111111111" as Address<"11111111111111111111111111111111">;
+ }
+
+ const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
+ return Object.freeze({
+ accounts: [
+ getAccountMeta("buyer", accounts.buyer),
+ getAccountMeta("seller", accounts.seller),
+ getAccountMeta("listingAccount", accounts.listingAccount),
+ getAccountMeta("orderAccount", accounts.orderAccount),
+ getAccountMeta("escrowAccount", accounts.escrowAccount),
+ getAccountMeta("descroVault", accounts.descroVault),
+ getAccountMeta("canonicalOracle", accounts.canonicalOracle),
+ getAccountMeta("targetOracle", accounts.targetOracle),
+ getAccountMeta("descroProgram", accounts.descroProgram),
+ getAccountMeta("systemProgram", accounts.systemProgram),
+ ],
+ data: getCreateOrderInstructionDataEncoder().encode(
+ args as CreateOrderInstructionDataArgs,
+ ),
+ programAddress,
+ } as CreateOrderInstruction<
+ TProgramAddress,
+ TAccountBuyer,
+ TAccountSeller,
+ TAccountListingAccount,
+ TAccountOrderAccount,
+ TAccountEscrowAccount,
+ TAccountDescroVault,
+ TAccountCanonicalOracle,
+ TAccountTargetOracle,
+ TAccountDescroProgram,
+ TAccountSystemProgram
+ >);
+}
+
+export type CreateOrderInput<
+ TAccountBuyer extends string = string,
+ TAccountSeller extends string = string,
+ TAccountListingAccount extends string = string,
+ TAccountOrderAccount extends string = string,
+ TAccountEscrowAccount extends string = string,
+ TAccountDescroVault extends string = string,
+ TAccountCanonicalOracle extends string = string,
+ TAccountTargetOracle extends string = string,
+ TAccountDescroProgram extends string = string,
+ TAccountSystemProgram extends string = string,
+> = {
+ buyer: TransactionSigner;
+ seller: Address;
+ listingAccount: Address;
+ orderAccount: Address;
+ escrowAccount: Address;
+ descroVault: Address;
+ /** Pass SystemProgram as placeholder when canonical_oracle is None (stablecoin). */
+ canonicalOracle: Address;
+ /** Pass SystemProgram as placeholder when usd_oracle is None or paying canonical. */
+ targetOracle: Address;
+ descroProgram: Address;
+ systemProgram?: Address;
+ orderId: CreateOrderInstructionDataArgs["orderId"];
+ escrowId: CreateOrderInstructionDataArgs["escrowId"];
+ resolver: CreateOrderInstructionDataArgs["resolver"];
+ paymentCurrency: CreateOrderInstructionDataArgs["paymentCurrency"];
+ expectedAmount: CreateOrderInstructionDataArgs["expectedAmount"];
+ maxSlippageBps: CreateOrderInstructionDataArgs["maxSlippageBps"];
+};
+
+export function getCreateOrderInstruction<
+ TAccountBuyer extends string,
+ TAccountSeller extends string,
+ TAccountListingAccount extends string,
+ TAccountOrderAccount extends string,
+ TAccountEscrowAccount extends string,
+ TAccountDescroVault extends string,
+ TAccountCanonicalOracle extends string,
+ TAccountTargetOracle extends string,
+ TAccountDescroProgram extends string,
+ TAccountSystemProgram extends string,
+ TProgramAddress extends Address = typeof SOLISTING_PROGRAM_ADDRESS,
+>(
+ input: CreateOrderInput<
+ TAccountBuyer,
+ TAccountSeller,
+ TAccountListingAccount,
+ TAccountOrderAccount,
+ TAccountEscrowAccount,
+ TAccountDescroVault,
+ TAccountCanonicalOracle,
+ TAccountTargetOracle,
+ TAccountDescroProgram,
+ TAccountSystemProgram
+ >,
+ config?: { programAddress?: TProgramAddress },
+): CreateOrderInstruction<
+ TProgramAddress,
+ TAccountBuyer,
+ TAccountSeller,
+ TAccountListingAccount,
+ TAccountOrderAccount,
+ TAccountEscrowAccount,
+ TAccountDescroVault,
+ TAccountCanonicalOracle,
+ TAccountTargetOracle,
+ TAccountDescroProgram,
+ TAccountSystemProgram
+> {
+ // Program address.
+ const programAddress = config?.programAddress ?? SOLISTING_PROGRAM_ADDRESS;
+
+ // Original accounts.
+ const originalAccounts = {
+ buyer: { value: input.buyer ?? null, isWritable: true },
+ seller: { value: input.seller ?? null, isWritable: false },
+ listingAccount: { value: input.listingAccount ?? null, isWritable: true },
+ orderAccount: { value: input.orderAccount ?? null, isWritable: true },
+ escrowAccount: { value: input.escrowAccount ?? null, isWritable: true },
+ descroVault: { value: input.descroVault ?? null, isWritable: true },
+ canonicalOracle: {
+ value: input.canonicalOracle ?? null,
+ isWritable: false,
+ },
+ targetOracle: { value: input.targetOracle ?? null, isWritable: false },
+ descroProgram: { value: input.descroProgram ?? null, isWritable: false },
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false },
+ };
+ const accounts = originalAccounts as Record<
+ keyof typeof originalAccounts,
+ ResolvedInstructionAccount
+ >;
+
+ // Original args.
+ const args = { ...input };
+
+ // Resolve default values.
+ if (!accounts.systemProgram.value) {
+ accounts.systemProgram.value =
+ "11111111111111111111111111111111" as Address<"11111111111111111111111111111111">;
+ }
+
+ const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
+ return Object.freeze({
+ accounts: [
+ getAccountMeta("buyer", accounts.buyer),
+ getAccountMeta("seller", accounts.seller),
+ getAccountMeta("listingAccount", accounts.listingAccount),
+ getAccountMeta("orderAccount", accounts.orderAccount),
+ getAccountMeta("escrowAccount", accounts.escrowAccount),
+ getAccountMeta("descroVault", accounts.descroVault),
+ getAccountMeta("canonicalOracle", accounts.canonicalOracle),
+ getAccountMeta("targetOracle", accounts.targetOracle),
+ getAccountMeta("descroProgram", accounts.descroProgram),
+ getAccountMeta("systemProgram", accounts.systemProgram),
+ ],
+ data: getCreateOrderInstructionDataEncoder().encode(
+ args as CreateOrderInstructionDataArgs,
+ ),
+ programAddress,
+ } as CreateOrderInstruction<
+ TProgramAddress,
+ TAccountBuyer,
+ TAccountSeller,
+ TAccountListingAccount,
+ TAccountOrderAccount,
+ TAccountEscrowAccount,
+ TAccountDescroVault,
+ TAccountCanonicalOracle,
+ TAccountTargetOracle,
+ TAccountDescroProgram,
+ TAccountSystemProgram
+ >);
+}
+
+export type ParsedCreateOrderInstruction<
+ TProgram extends string = typeof SOLISTING_PROGRAM_ADDRESS,
+ TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[],
+> = {
+ programAddress: Address;
+ accounts: {
+ buyer: TAccountMetas[0];
+ seller: TAccountMetas[1];
+ listingAccount: TAccountMetas[2];
+ orderAccount: TAccountMetas[3];
+ escrowAccount: TAccountMetas[4];
+ descroVault: TAccountMetas[5];
+ /** Pass SystemProgram as placeholder when canonical_oracle is None (stablecoin). */
+ canonicalOracle: TAccountMetas[6];
+ /** Pass SystemProgram as placeholder when usd_oracle is None or paying canonical. */
+ targetOracle: TAccountMetas[7];
+ descroProgram: TAccountMetas[8];
+ systemProgram: TAccountMetas[9];
+ };
+ data: CreateOrderInstructionData;
+};
+
+export function parseCreateOrderInstruction<
+ TProgram extends string,
+ TAccountMetas extends readonly AccountMeta[],
+>(
+ instruction: Instruction &
+ InstructionWithAccounts &
+ InstructionWithData,
+): ParsedCreateOrderInstruction {
+ if (instruction.accounts.length < 10) {
+ throw new SolanaError(
+ SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
+ {
+ actualAccountMetas: instruction.accounts.length,
+ expectedAccountMetas: 10,
+ },
+ );
+ }
+ let accountIndex = 0;
+ const getNextAccount = () => {
+ const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!;
+ accountIndex += 1;
+ return accountMeta;
+ };
+ return {
+ programAddress: instruction.programAddress,
+ accounts: {
+ buyer: getNextAccount(),
+ seller: getNextAccount(),
+ listingAccount: getNextAccount(),
+ orderAccount: getNextAccount(),
+ escrowAccount: getNextAccount(),
+ descroVault: getNextAccount(),
+ canonicalOracle: getNextAccount(),
+ targetOracle: getNextAccount(),
+ descroProgram: getNextAccount(),
+ systemProgram: getNextAccount(),
+ },
+ data: getCreateOrderInstructionDataDecoder().decode(instruction.data),
+ };
+}
diff --git a/sdk/src/generated/solisting/src/generated/instructions/index.ts b/sdk/src/generated/solisting/src/generated/instructions/index.ts
new file mode 100644
index 0000000..6b42259
--- /dev/null
+++ b/sdk/src/generated/solisting/src/generated/instructions/index.ts
@@ -0,0 +1,17 @@
+/**
+ * This code was AUTOGENERATED using the Codama library.
+ * Please DO NOT EDIT THIS FILE, instead use visitors
+ * to add features, then rerun Codama to update it.
+ *
+ * @see https://github.com/codama-idl/codama
+ */
+
+export * from "./acceptOrder";
+export * from "./cancelOrder";
+export * from "./closeListing";
+export * from "./closeStaleOrder";
+export * from "./createListing";
+export * from "./createOrder";
+export * from "./initialize";
+export * from "./rejectOrder";
+export * from "./updateListing";
diff --git a/sdk/src/generated/solisting/src/generated/instructions/initialize.ts b/sdk/src/generated/solisting/src/generated/instructions/initialize.ts
new file mode 100644
index 0000000..f579383
--- /dev/null
+++ b/sdk/src/generated/solisting/src/generated/instructions/initialize.ts
@@ -0,0 +1,99 @@
+/**
+ * This code was AUTOGENERATED using the Codama library.
+ * Please DO NOT EDIT THIS FILE, instead use visitors
+ * to add features, then rerun Codama to update it.
+ *
+ * @see https://github.com/codama-idl/codama
+ */
+
+import {
+ combineCodec,
+ fixDecoderSize,
+ fixEncoderSize,
+ getBytesDecoder,
+ getBytesEncoder,
+ getStructDecoder,
+ getStructEncoder,
+ transformEncoder,
+ type AccountMeta,
+ type Address,
+ type FixedSizeCodec,
+ type FixedSizeDecoder,
+ type FixedSizeEncoder,
+ type Instruction,
+ type InstructionWithAccounts,
+ type InstructionWithData,
+ type ReadonlyUint8Array,
+} from "@solana/kit";
+import { SOLISTING_PROGRAM_ADDRESS } from "../programs";
+
+export const INITIALIZE_DISCRIMINATOR: ReadonlyUint8Array = new Uint8Array([
+ 175, 175, 109, 31, 13, 152, 155, 237,
+]);
+
+export function getInitializeDiscriminatorBytes(): ReadonlyUint8Array {
+ return fixEncoderSize(getBytesEncoder(), 8).encode(INITIALIZE_DISCRIMINATOR);
+}
+
+export type InitializeInstruction<
+ TProgram extends string = typeof SOLISTING_PROGRAM_ADDRESS,
+ TRemainingAccounts extends readonly AccountMeta[] = [],
+> = Instruction &
+ InstructionWithData &
+ InstructionWithAccounts;
+
+export type InitializeInstructionData = { discriminator: ReadonlyUint8Array };
+
+export type InitializeInstructionDataArgs = {};
+
+export function getInitializeInstructionDataEncoder(): FixedSizeEncoder {
+ return transformEncoder(
+ getStructEncoder([["discriminator", fixEncoderSize(getBytesEncoder(), 8)]]),
+ (value) => ({ ...value, discriminator: INITIALIZE_DISCRIMINATOR }),
+ );
+}
+
+export function getInitializeInstructionDataDecoder(): FixedSizeDecoder {
+ return getStructDecoder([
+ ["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
+ ]);
+}
+
+export function getInitializeInstructionDataCodec(): FixedSizeCodec<
+ InitializeInstructionDataArgs,
+ InitializeInstructionData
+> {
+ return combineCodec(
+ getInitializeInstructionDataEncoder(),
+ getInitializeInstructionDataDecoder(),
+ );
+}
+
+export type InitializeInput = {};
+
+export function getInitializeInstruction<
+ TProgramAddress extends Address = typeof SOLISTING_PROGRAM_ADDRESS,
+>(config?: {
+ programAddress?: TProgramAddress;
+}): InitializeInstruction {
+ // Program address.
+ const programAddress = config?.programAddress ?? SOLISTING_PROGRAM_ADDRESS;
+
+ return Object.freeze({
+ data: getInitializeInstructionDataEncoder().encode({}),
+ programAddress,
+ } as InitializeInstruction);
+}
+
+export type ParsedInitializeInstruction<
+ TProgram extends string = typeof SOLISTING_PROGRAM_ADDRESS,
+> = { programAddress: Address; data: InitializeInstructionData };
+
+export function parseInitializeInstruction