@pina-rs/amm 0.0.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -2
- package/dist/index.cjs +1744 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +2192 -0
- package/dist/index.d.ts +2192 -0
- package/dist/index.js +1507 -0
- package/dist/index.js.map +1 -0
- package/package.json +55 -5
- package/src/generated/accounts/ammConfig.ts +197 -0
- package/src/generated/accounts/index.ts +10 -0
- package/src/generated/accounts/pool.ts +274 -0
- package/src/generated/errors/index.ts +9 -0
- package/src/generated/errors/pinaAmm.ts +66 -0
- package/src/generated/events/configCreated.ts +80 -0
- package/src/generated/events/configUpdated.ts +64 -0
- package/src/generated/events/feesCollected.ts +64 -0
- package/src/generated/events/index.ts +18 -0
- package/src/generated/events/liquidityChanged.ts +72 -0
- package/src/generated/events/logs.ts +732 -0
- package/src/generated/events/poolCreated.ts +80 -0
- package/src/generated/events/poolCreatorChanged.ts +56 -0
- package/src/generated/events/poolSynced.ts +78 -0
- package/src/generated/events/poolSyncedV0.ts +44 -0
- package/src/generated/events/swapped.ts +100 -0
- package/src/generated/index.ts +14 -0
- package/src/generated/instructions/collectCreatorFees.ts +119 -0
- package/src/generated/instructions/collectProtocolFees.ts +123 -0
- package/src/generated/instructions/createConfig.ts +142 -0
- package/src/generated/instructions/createPool.ts +291 -0
- package/src/generated/instructions/deposit.ts +139 -0
- package/src/generated/instructions/index.ts +20 -0
- package/src/generated/instructions/migrate.ts +155 -0
- package/src/generated/instructions/setPoolCreator.ts +90 -0
- package/src/generated/instructions/swapExactIn.ts +119 -0
- package/src/generated/instructions/swapExactOut.ts +119 -0
- package/src/generated/instructions/syncPool.ts +93 -0
- package/src/generated/instructions/updateConfig.ts +105 -0
- package/src/generated/instructions/withdraw.ts +139 -0
- package/src/generated/pdas/ammConfig.ts +18 -0
- package/src/generated/pdas/index.ts +12 -0
- package/src/generated/pdas/pool.ts +20 -0
- package/src/generated/pdas/poolLpMint.ts +18 -0
- package/src/generated/pdas/poolVault.ts +19 -0
- package/src/generated/pinaPodCodecs.ts +232 -0
- package/src/generated/programs/index.ts +9 -0
- package/src/generated/programs/pinaAmm.ts +124 -0
- package/src/index.ts +11 -0
- package/CHANGELOG.md +0 -5
package/package.json
CHANGED
|
@@ -1,10 +1,60 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pina-rs/amm",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
5
|
-
"
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "TypeScript client for the Pina AMM: instruction builders, account decoders, PDAs, events, and errors for @solana/kit",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"solana",
|
|
7
|
+
"amm",
|
|
8
|
+
"pina",
|
|
9
|
+
"defi",
|
|
10
|
+
"solana-kit"
|
|
11
|
+
],
|
|
12
|
+
"homepage": "https://github.com/pina-rs/amm/tree/main/clients/typescript/pina_amm",
|
|
6
13
|
"repository": {
|
|
7
14
|
"type": "git",
|
|
8
|
-
"url": "git+https://github.com/pina-rs/amm.git"
|
|
15
|
+
"url": "git+https://github.com/pina-rs/amm.git",
|
|
16
|
+
"directory": "clients/typescript/pina_amm"
|
|
17
|
+
},
|
|
18
|
+
"license": "Apache-2.0",
|
|
19
|
+
"type": "module",
|
|
20
|
+
"sideEffects": false,
|
|
21
|
+
"main": "./dist/index.cjs",
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"exports": {
|
|
24
|
+
".": {
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"import": "./dist/index.js",
|
|
27
|
+
"require": "./dist/index.cjs"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"dist",
|
|
32
|
+
"src",
|
|
33
|
+
"README.md",
|
|
34
|
+
"LICENSE"
|
|
35
|
+
],
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@solana/program-client-core": "^8.3.0"
|
|
38
|
+
},
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"@solana/kit": "^8.3.0"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@solana/kit": "^8.3.0",
|
|
44
|
+
"@types/node": "^24.6.0",
|
|
45
|
+
"tsup": "^8.5.0",
|
|
46
|
+
"tsx": "^4.20.0",
|
|
47
|
+
"typescript": "^5.9.3"
|
|
48
|
+
},
|
|
49
|
+
"publishConfig": {
|
|
50
|
+
"access": "public",
|
|
51
|
+
"provenance": true
|
|
52
|
+
},
|
|
53
|
+
"module": "./dist/index.js",
|
|
54
|
+
"scripts": {
|
|
55
|
+
"build": "tsup",
|
|
56
|
+
"check": "tsc --noEmit --project tsconfig.json",
|
|
57
|
+
"journey": "tsx journeys/surfpool.journey.ts",
|
|
58
|
+
"test": "pnpm build && node --test test/*.test.mjs"
|
|
9
59
|
}
|
|
10
|
-
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun Codama to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/codama-idl/codama
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { getPinaPodDiscriminatorDecoder, getPinaPodMigrationVersionDecoder } from "../pinaPodCodecs";
|
|
10
|
+
import { assertAccountExists, assertAccountsExist, combineCodec, decodeAccount, fetchEncodedAccount, fetchEncodedAccounts, getAddressDecoder, getAddressEncoder, getStructDecoder, getStructEncoder, getU16Decoder, getU16Encoder, getU32Decoder, getU32Encoder, getU8Decoder, getU8Encoder, transformEncoder, type Account, type Address, type EncodedAccount, type FetchAccountConfig, type FetchAccountsConfig, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, type MaybeAccount, type MaybeEncodedAccount, type ReadonlyUint8Array } from '@solana/kit';
|
|
11
|
+
import { findAmmConfigPda, type AmmConfigSeeds } from '../pdas';
|
|
12
|
+
|
|
13
|
+
export const AMM_CONFIG_DISCRIMINATOR = 1;
|
|
14
|
+
|
|
15
|
+
export function getAmmConfigDiscriminatorBytes(): ReadonlyUint8Array { return getU8Encoder().encode(AMM_CONFIG_DISCRIMINATOR); }
|
|
16
|
+
|
|
17
|
+
export const AMM_CONFIG_DISCRIMINATOR2 = 0;
|
|
18
|
+
|
|
19
|
+
export function getAmmConfigDiscriminator2Bytes(): ReadonlyUint8Array { return getU8Encoder().encode(AMM_CONFIG_DISCRIMINATOR2); }
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* A fee tier, created by the program's upgrade authority.
|
|
23
|
+
*
|
|
24
|
+
* Pools snapshot `trade_fee_rate`, `protocol_fee_rate`, and
|
|
25
|
+
* `creator_fee_rate` when they are created; later updates only affect new
|
|
26
|
+
* pools. `pool_creator_authority` is fixed for the life of the tier.
|
|
27
|
+
*/
|
|
28
|
+
export type AmmConfig = { discriminator: number; migrationVersion: number;
|
|
29
|
+
/**
|
|
30
|
+
* Signer that may update this tier and collect protocol fees from every
|
|
31
|
+
* pool created under it.
|
|
32
|
+
*/
|
|
33
|
+
authority: Address;
|
|
34
|
+
/**
|
|
35
|
+
* When not the default address, the only signer allowed to create pools
|
|
36
|
+
* under this tier. The default address leaves pool creation open to
|
|
37
|
+
* anyone.
|
|
38
|
+
*/
|
|
39
|
+
poolCreatorAuthority: Address;
|
|
40
|
+
/**
|
|
41
|
+
* Fee charged on every swap, in parts per million of the fee base. The
|
|
42
|
+
* LPs keep everything the protocol does not take.
|
|
43
|
+
*/
|
|
44
|
+
tradeFeeRate: number;
|
|
45
|
+
/**
|
|
46
|
+
* Share of the trade fee paid to the protocol, in parts per million of
|
|
47
|
+
* the trade fee.
|
|
48
|
+
*/
|
|
49
|
+
protocolFeeRate: number;
|
|
50
|
+
/**
|
|
51
|
+
* Additional fee paid to the pool's creator, in parts per million of the
|
|
52
|
+
* fee base.
|
|
53
|
+
*/
|
|
54
|
+
creatorFeeRate: number;
|
|
55
|
+
/** Tier index used as the PDA seed. */
|
|
56
|
+
index: number;
|
|
57
|
+
/** Canonical bump of this tier's PDA. */
|
|
58
|
+
bump: number; };
|
|
59
|
+
|
|
60
|
+
export type AmmConfigArgs = {
|
|
61
|
+
/**
|
|
62
|
+
* Signer that may update this tier and collect protocol fees from every
|
|
63
|
+
* pool created under it.
|
|
64
|
+
*/
|
|
65
|
+
authority: Address;
|
|
66
|
+
/**
|
|
67
|
+
* When not the default address, the only signer allowed to create pools
|
|
68
|
+
* under this tier. The default address leaves pool creation open to
|
|
69
|
+
* anyone.
|
|
70
|
+
*/
|
|
71
|
+
poolCreatorAuthority: Address;
|
|
72
|
+
/**
|
|
73
|
+
* Fee charged on every swap, in parts per million of the fee base. The
|
|
74
|
+
* LPs keep everything the protocol does not take.
|
|
75
|
+
*/
|
|
76
|
+
tradeFeeRate: number;
|
|
77
|
+
/**
|
|
78
|
+
* Share of the trade fee paid to the protocol, in parts per million of
|
|
79
|
+
* the trade fee.
|
|
80
|
+
*/
|
|
81
|
+
protocolFeeRate: number;
|
|
82
|
+
/**
|
|
83
|
+
* Additional fee paid to the pool's creator, in parts per million of the
|
|
84
|
+
* fee base.
|
|
85
|
+
*/
|
|
86
|
+
creatorFeeRate: number;
|
|
87
|
+
/** Tier index used as the PDA seed. */
|
|
88
|
+
index: number;
|
|
89
|
+
/** Canonical bump of this tier's PDA. */
|
|
90
|
+
bump: number; };
|
|
91
|
+
|
|
92
|
+
/** Gets the encoder for {@link AmmConfigArgs} account data. */
|
|
93
|
+
export function getAmmConfigEncoder(): FixedSizeEncoder<AmmConfigArgs> {
|
|
94
|
+
return transformEncoder(getStructEncoder([['discriminator', getU8Encoder()], ['migrationVersion', getU8Encoder()], ['authority', getAddressEncoder()], ['poolCreatorAuthority', getAddressEncoder()], ['tradeFeeRate', getU32Encoder()], ['protocolFeeRate', getU32Encoder()], ['creatorFeeRate', getU32Encoder()], ['index', getU16Encoder()], ['bump', getU8Encoder()]]), (value) => ({ ...value, discriminator: 1, migrationVersion: 0 }));
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** Gets the decoder for {@link AmmConfig} account data. */
|
|
98
|
+
export function getAmmConfigDecoder(): FixedSizeDecoder<AmmConfig> {
|
|
99
|
+
return getStructDecoder([['discriminator', getPinaPodDiscriminatorDecoder(AMM_CONFIG_DISCRIMINATOR, getU8Decoder())], ['migrationVersion', getPinaPodMigrationVersionDecoder(0, getU8Decoder())], ['authority', getAddressDecoder()], ['poolCreatorAuthority', getAddressDecoder()], ['tradeFeeRate', getU32Decoder()], ['protocolFeeRate', getU32Decoder()], ['creatorFeeRate', getU32Decoder()], ['index', getU16Decoder()], ['bump', getU8Decoder()]]);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** Gets the codec for {@link AmmConfig} account data. */
|
|
103
|
+
export function getAmmConfigCodec(): FixedSizeCodec<AmmConfigArgs, AmmConfig> {
|
|
104
|
+
return combineCodec(getAmmConfigEncoder(), getAmmConfigDecoder());
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export function decodeAmmConfig<TAddress extends string = string>(encodedAccount: EncodedAccount<TAddress>): Account<AmmConfig, TAddress>;
|
|
108
|
+
export function decodeAmmConfig<TAddress extends string = string>(encodedAccount: MaybeEncodedAccount<TAddress>): MaybeAccount<AmmConfig, TAddress>;
|
|
109
|
+
export function decodeAmmConfig<TAddress extends string = string>(encodedAccount: EncodedAccount<TAddress> | MaybeEncodedAccount<TAddress>): Account<AmmConfig, TAddress> | MaybeAccount<AmmConfig, TAddress> {
|
|
110
|
+
return decodeAccount(encodedAccount as MaybeEncodedAccount<TAddress>, getAmmConfigDecoder());
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export async function fetchAmmConfig<TAddress extends string = string>(
|
|
114
|
+
rpc: Parameters<typeof fetchEncodedAccount>[0],
|
|
115
|
+
address: Address<TAddress>,
|
|
116
|
+
config?: FetchAccountConfig,
|
|
117
|
+
): Promise<Account<AmmConfig, TAddress>> {
|
|
118
|
+
const maybeAccount = await fetchMaybeAmmConfig(rpc, address, config);
|
|
119
|
+
assertAccountExists(maybeAccount);
|
|
120
|
+
return maybeAccount;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export async function fetchMaybeAmmConfig<TAddress extends string = string>(
|
|
124
|
+
rpc: Parameters<typeof fetchEncodedAccount>[0],
|
|
125
|
+
address: Address<TAddress>,
|
|
126
|
+
config?: FetchAccountConfig,
|
|
127
|
+
): Promise<MaybeAccount<AmmConfig, TAddress>> {
|
|
128
|
+
const maybeAccount = await fetchEncodedAccount(rpc, address, config);
|
|
129
|
+
return decodeAmmConfig(maybeAccount);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export async function fetchAllAmmConfig(
|
|
133
|
+
rpc: Parameters<typeof fetchEncodedAccounts>[0],
|
|
134
|
+
addresses: Array<Address>,
|
|
135
|
+
config?: FetchAccountsConfig,
|
|
136
|
+
): Promise<Account<AmmConfig>[]> {
|
|
137
|
+
const maybeAccounts = await fetchAllMaybeAmmConfig(rpc, addresses, config);
|
|
138
|
+
assertAccountsExist(maybeAccounts);
|
|
139
|
+
return maybeAccounts;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export async function fetchAllMaybeAmmConfig(
|
|
143
|
+
rpc: Parameters<typeof fetchEncodedAccounts>[0],
|
|
144
|
+
addresses: Array<Address>,
|
|
145
|
+
config?: FetchAccountsConfig,
|
|
146
|
+
): Promise<MaybeAccount<AmmConfig>[]> {
|
|
147
|
+
const maybeAccounts = await fetchEncodedAccounts(rpc, addresses, config);
|
|
148
|
+
return maybeAccounts.map((maybeAccount) => decodeAmmConfig(maybeAccount));
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export async function fetchAmmConfigFromSeeds(
|
|
152
|
+
rpc: Parameters<typeof fetchEncodedAccount>[0],
|
|
153
|
+
seeds: AmmConfigSeeds,
|
|
154
|
+
config: FetchAccountConfig & { programAddress?: Address } = {},
|
|
155
|
+
): Promise<Account<AmmConfig>> {
|
|
156
|
+
const maybeAccount = await fetchMaybeAmmConfigFromSeeds(rpc, seeds, config);
|
|
157
|
+
assertAccountExists(maybeAccount);
|
|
158
|
+
return maybeAccount;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export async function fetchMaybeAmmConfigFromSeeds(
|
|
162
|
+
rpc: Parameters<typeof fetchEncodedAccount>[0],
|
|
163
|
+
seeds: AmmConfigSeeds,
|
|
164
|
+
config: FetchAccountConfig & { programAddress?: Address } = {},
|
|
165
|
+
): Promise<MaybeAccount<AmmConfig>> {
|
|
166
|
+
const { programAddress, ...fetchConfig } = config;
|
|
167
|
+
const [address] = await findAmmConfigPda(seeds, { programAddress });
|
|
168
|
+
return await fetchMaybeAmmConfig(rpc, address, fetchConfig);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/** The account schema version this client was generated from. */
|
|
172
|
+
export const AMM_CONFIG_MIGRATION_VERSION = 0;
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Cheap envelope check for a fetched `AmmConfig` account: `true` only when the
|
|
176
|
+
* bytes name this account's discriminator and a migration version older than
|
|
177
|
+
* this client's schema. Those are exactly the accounts
|
|
178
|
+
* {@link getMigrateInstruction} can bring current; every other mismatch is
|
|
179
|
+
* reported by the decoder when the account is decoded.
|
|
180
|
+
*
|
|
181
|
+
* ```ts
|
|
182
|
+
* const account = await fetchEncodedAccount(rpc, address);
|
|
183
|
+
* if (account.exists && ammConfigNeedsMigration(account.data)) {
|
|
184
|
+
* // Migrate first, then retry the instruction that failed.
|
|
185
|
+
* await send(getMigrateInstruction({ ammConfig: address, payer }));
|
|
186
|
+
* }
|
|
187
|
+
* ```
|
|
188
|
+
*/
|
|
189
|
+
export function ammConfigNeedsMigration(data: ReadonlyUint8Array): boolean {
|
|
190
|
+
if (data.length < 2) {
|
|
191
|
+
return false;
|
|
192
|
+
}
|
|
193
|
+
if (data[0] !== 1) {
|
|
194
|
+
return false;
|
|
195
|
+
}
|
|
196
|
+
return data[1]! < 0;
|
|
197
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun Codama to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/codama-idl/codama
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export * from './ammConfig';
|
|
10
|
+
export * from './pool';
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun Codama to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/codama-idl/codama
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { getPinaPodDiscriminatorDecoder, getPinaPodMigrationVersionDecoder } from "../pinaPodCodecs";
|
|
10
|
+
import { assertAccountExists, assertAccountsExist, combineCodec, decodeAccount, fetchEncodedAccount, fetchEncodedAccounts, getAddressDecoder, getAddressEncoder, getStructDecoder, getStructEncoder, getU128Decoder, getU128Encoder, getU32Decoder, getU32Encoder, getU64Decoder, getU64Encoder, getU8Decoder, getU8Encoder, transformEncoder, type Account, type Address, type EncodedAccount, type FetchAccountConfig, type FetchAccountsConfig, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, type MaybeAccount, type MaybeEncodedAccount, type ReadonlyUint8Array } from '@solana/kit';
|
|
11
|
+
import { findPoolPda, type PoolSeeds } from '../pdas';
|
|
12
|
+
|
|
13
|
+
export const POOL_DISCRIMINATOR = 2;
|
|
14
|
+
|
|
15
|
+
export function getPoolDiscriminatorBytes(): ReadonlyUint8Array { return getU8Encoder().encode(POOL_DISCRIMINATOR); }
|
|
16
|
+
|
|
17
|
+
export const POOL_DISCRIMINATOR2 = 1;
|
|
18
|
+
|
|
19
|
+
export function getPoolDiscriminator2Bytes(): ReadonlyUint8Array { return getU8Encoder().encode(POOL_DISCRIMINATOR2); }
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* A constant-product pool for one token pair under one fee tier.
|
|
23
|
+
*
|
|
24
|
+
* `mint_0` is always the byte-wise smaller mint address, so every pair has
|
|
25
|
+
* exactly one canonical pool per tier.
|
|
26
|
+
*/
|
|
27
|
+
export type Pool = { discriminator: number; migrationVersion: number;
|
|
28
|
+
/** Fee tier this pool was created under. */
|
|
29
|
+
ammConfig: Address;
|
|
30
|
+
/** Recipient of this pool's creator fees. */
|
|
31
|
+
creator: Address;
|
|
32
|
+
/** Smaller mint of the pair. */
|
|
33
|
+
mint0: Address;
|
|
34
|
+
/** Larger mint of the pair. */
|
|
35
|
+
mint1: Address;
|
|
36
|
+
/** Pool-owned token account holding token 0. */
|
|
37
|
+
vault0: Address;
|
|
38
|
+
/** Pool-owned token account holding token 1. */
|
|
39
|
+
vault1: Address;
|
|
40
|
+
/** LP mint whose mint authority is this pool. */
|
|
41
|
+
lpMint: Address;
|
|
42
|
+
/**
|
|
43
|
+
* Economic LP supply, including `MINIMUM_LIQUIDITY` and any LP burned
|
|
44
|
+
* outside the program. Only deposits and withdrawals change it, so LP
|
|
45
|
+
* burned directly through the token program stays locked forever.
|
|
46
|
+
*/
|
|
47
|
+
lpSupply: bigint;
|
|
48
|
+
/** Accrued, unpaid protocol fees held in vault 0. */
|
|
49
|
+
protocolFees0: bigint;
|
|
50
|
+
/** Accrued, unpaid protocol fees held in vault 1. */
|
|
51
|
+
protocolFees1: bigint;
|
|
52
|
+
/** Accrued, unpaid creator fees held in vault 0. */
|
|
53
|
+
creatorFees0: bigint;
|
|
54
|
+
/** Accrued, unpaid creator fees held in vault 1. */
|
|
55
|
+
creatorFees1: bigint;
|
|
56
|
+
/** Trade fee rate snapshotted from the tier, in parts per million. */
|
|
57
|
+
tradeFeeRate: number;
|
|
58
|
+
/**
|
|
59
|
+
* Protocol share of the trade fee snapshotted from the tier, in parts per
|
|
60
|
+
* million.
|
|
61
|
+
*/
|
|
62
|
+
protocolFeeRate: number;
|
|
63
|
+
/** Creator fee rate snapshotted from the tier, in parts per million. */
|
|
64
|
+
creatorFeeRate: number;
|
|
65
|
+
/** `CreatorFeeMode` wire value. */
|
|
66
|
+
creatorFeeMode: number;
|
|
67
|
+
/** Canonical bump of this pool's PDA. */
|
|
68
|
+
bump: number;
|
|
69
|
+
/**
|
|
70
|
+
* Low 128 bits of the Q64.64 price-time integral. Combine with
|
|
71
|
+
* `price_0_cumulative_high_last` as `low + high * 2^128`. Every swap, deposit,
|
|
72
|
+
* withdrawal, and `SyncPool` advances it with `reserve_0_last` and
|
|
73
|
+
* `reserve_1_last` before changing the reserves.
|
|
74
|
+
*/
|
|
75
|
+
price0CumulativeLast: bigint;
|
|
76
|
+
/**
|
|
77
|
+
* High 128 bits of the Q64.64 price-time integral. Together the limbs
|
|
78
|
+
* retain every bit for all supported reserve ratios and timestamp windows.
|
|
79
|
+
*/
|
|
80
|
+
price0CumulativeHighLast: bigint;
|
|
81
|
+
/** Unix second of the last accumulator advance; zero before the first. */
|
|
82
|
+
lastUpdateTimestamp: bigint;
|
|
83
|
+
/**
|
|
84
|
+
* Token 0 reserve at the end of the last instruction that changed or
|
|
85
|
+
* observed the reserves: `CreatePool`, a swap, a deposit, a withdrawal,
|
|
86
|
+
* or `SyncPool`. It prices the accumulator's next interval and nothing
|
|
87
|
+
* else: trades and liquidity always price from the live vault balances.
|
|
88
|
+
*/
|
|
89
|
+
reserve0Last: bigint;
|
|
90
|
+
/**
|
|
91
|
+
* Token 1 reserve at the end of the last instruction that changed or
|
|
92
|
+
* observed the reserves: `CreatePool`, a swap, a deposit, a withdrawal,
|
|
93
|
+
* or `SyncPool`. It prices the accumulator's next interval and nothing
|
|
94
|
+
* else: trades and liquidity always price from the live vault balances.
|
|
95
|
+
*/
|
|
96
|
+
reserve1Last: bigint; };
|
|
97
|
+
|
|
98
|
+
export type PoolArgs = {
|
|
99
|
+
/** Fee tier this pool was created under. */
|
|
100
|
+
ammConfig: Address;
|
|
101
|
+
/** Recipient of this pool's creator fees. */
|
|
102
|
+
creator: Address;
|
|
103
|
+
/** Smaller mint of the pair. */
|
|
104
|
+
mint0: Address;
|
|
105
|
+
/** Larger mint of the pair. */
|
|
106
|
+
mint1: Address;
|
|
107
|
+
/** Pool-owned token account holding token 0. */
|
|
108
|
+
vault0: Address;
|
|
109
|
+
/** Pool-owned token account holding token 1. */
|
|
110
|
+
vault1: Address;
|
|
111
|
+
/** LP mint whose mint authority is this pool. */
|
|
112
|
+
lpMint: Address;
|
|
113
|
+
/**
|
|
114
|
+
* Economic LP supply, including `MINIMUM_LIQUIDITY` and any LP burned
|
|
115
|
+
* outside the program. Only deposits and withdrawals change it, so LP
|
|
116
|
+
* burned directly through the token program stays locked forever.
|
|
117
|
+
*/
|
|
118
|
+
lpSupply: number | bigint;
|
|
119
|
+
/** Accrued, unpaid protocol fees held in vault 0. */
|
|
120
|
+
protocolFees0: number | bigint;
|
|
121
|
+
/** Accrued, unpaid protocol fees held in vault 1. */
|
|
122
|
+
protocolFees1: number | bigint;
|
|
123
|
+
/** Accrued, unpaid creator fees held in vault 0. */
|
|
124
|
+
creatorFees0: number | bigint;
|
|
125
|
+
/** Accrued, unpaid creator fees held in vault 1. */
|
|
126
|
+
creatorFees1: number | bigint;
|
|
127
|
+
/** Trade fee rate snapshotted from the tier, in parts per million. */
|
|
128
|
+
tradeFeeRate: number;
|
|
129
|
+
/**
|
|
130
|
+
* Protocol share of the trade fee snapshotted from the tier, in parts per
|
|
131
|
+
* million.
|
|
132
|
+
*/
|
|
133
|
+
protocolFeeRate: number;
|
|
134
|
+
/** Creator fee rate snapshotted from the tier, in parts per million. */
|
|
135
|
+
creatorFeeRate: number;
|
|
136
|
+
/** `CreatorFeeMode` wire value. */
|
|
137
|
+
creatorFeeMode: number;
|
|
138
|
+
/** Canonical bump of this pool's PDA. */
|
|
139
|
+
bump: number;
|
|
140
|
+
/**
|
|
141
|
+
* Low 128 bits of the Q64.64 price-time integral. Combine with
|
|
142
|
+
* `price_0_cumulative_high_last` as `low + high * 2^128`. Every swap, deposit,
|
|
143
|
+
* withdrawal, and `SyncPool` advances it with `reserve_0_last` and
|
|
144
|
+
* `reserve_1_last` before changing the reserves.
|
|
145
|
+
*/
|
|
146
|
+
price0CumulativeLast: number | bigint;
|
|
147
|
+
/**
|
|
148
|
+
* High 128 bits of the Q64.64 price-time integral. Together the limbs
|
|
149
|
+
* retain every bit for all supported reserve ratios and timestamp windows.
|
|
150
|
+
*/
|
|
151
|
+
price0CumulativeHighLast: number | bigint;
|
|
152
|
+
/** Unix second of the last accumulator advance; zero before the first. */
|
|
153
|
+
lastUpdateTimestamp: number | bigint;
|
|
154
|
+
/**
|
|
155
|
+
* Token 0 reserve at the end of the last instruction that changed or
|
|
156
|
+
* observed the reserves: `CreatePool`, a swap, a deposit, a withdrawal,
|
|
157
|
+
* or `SyncPool`. It prices the accumulator's next interval and nothing
|
|
158
|
+
* else: trades and liquidity always price from the live vault balances.
|
|
159
|
+
*/
|
|
160
|
+
reserve0Last: number | bigint;
|
|
161
|
+
/**
|
|
162
|
+
* Token 1 reserve at the end of the last instruction that changed or
|
|
163
|
+
* observed the reserves: `CreatePool`, a swap, a deposit, a withdrawal,
|
|
164
|
+
* or `SyncPool`. It prices the accumulator's next interval and nothing
|
|
165
|
+
* else: trades and liquidity always price from the live vault balances.
|
|
166
|
+
*/
|
|
167
|
+
reserve1Last: number | bigint; };
|
|
168
|
+
|
|
169
|
+
/** Gets the encoder for {@link PoolArgs} account data. */
|
|
170
|
+
export function getPoolEncoder(): FixedSizeEncoder<PoolArgs> {
|
|
171
|
+
return transformEncoder(getStructEncoder([['discriminator', getU8Encoder()], ['migrationVersion', getU8Encoder()], ['ammConfig', getAddressEncoder()], ['creator', getAddressEncoder()], ['mint0', getAddressEncoder()], ['mint1', getAddressEncoder()], ['vault0', getAddressEncoder()], ['vault1', getAddressEncoder()], ['lpMint', getAddressEncoder()], ['lpSupply', getU64Encoder()], ['protocolFees0', getU64Encoder()], ['protocolFees1', getU64Encoder()], ['creatorFees0', getU64Encoder()], ['creatorFees1', getU64Encoder()], ['tradeFeeRate', getU32Encoder()], ['protocolFeeRate', getU32Encoder()], ['creatorFeeRate', getU32Encoder()], ['creatorFeeMode', getU8Encoder()], ['bump', getU8Encoder()], ['price0CumulativeLast', getU128Encoder()], ['price0CumulativeHighLast', getU128Encoder()], ['lastUpdateTimestamp', getU64Encoder()], ['reserve0Last', getU64Encoder()], ['reserve1Last', getU64Encoder()]]), (value) => ({ ...value, discriminator: 2, migrationVersion: 1 }));
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/** Gets the decoder for {@link Pool} account data. */
|
|
175
|
+
export function getPoolDecoder(): FixedSizeDecoder<Pool> {
|
|
176
|
+
return getStructDecoder([['discriminator', getPinaPodDiscriminatorDecoder(POOL_DISCRIMINATOR, getU8Decoder())], ['migrationVersion', getPinaPodMigrationVersionDecoder(1, getU8Decoder())], ['ammConfig', getAddressDecoder()], ['creator', getAddressDecoder()], ['mint0', getAddressDecoder()], ['mint1', getAddressDecoder()], ['vault0', getAddressDecoder()], ['vault1', getAddressDecoder()], ['lpMint', getAddressDecoder()], ['lpSupply', getU64Decoder()], ['protocolFees0', getU64Decoder()], ['protocolFees1', getU64Decoder()], ['creatorFees0', getU64Decoder()], ['creatorFees1', getU64Decoder()], ['tradeFeeRate', getU32Decoder()], ['protocolFeeRate', getU32Decoder()], ['creatorFeeRate', getU32Decoder()], ['creatorFeeMode', getU8Decoder()], ['bump', getU8Decoder()], ['price0CumulativeLast', getU128Decoder()], ['price0CumulativeHighLast', getU128Decoder()], ['lastUpdateTimestamp', getU64Decoder()], ['reserve0Last', getU64Decoder()], ['reserve1Last', getU64Decoder()]]);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/** Gets the codec for {@link Pool} account data. */
|
|
180
|
+
export function getPoolCodec(): FixedSizeCodec<PoolArgs, Pool> {
|
|
181
|
+
return combineCodec(getPoolEncoder(), getPoolDecoder());
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export function decodePool<TAddress extends string = string>(encodedAccount: EncodedAccount<TAddress>): Account<Pool, TAddress>;
|
|
185
|
+
export function decodePool<TAddress extends string = string>(encodedAccount: MaybeEncodedAccount<TAddress>): MaybeAccount<Pool, TAddress>;
|
|
186
|
+
export function decodePool<TAddress extends string = string>(encodedAccount: EncodedAccount<TAddress> | MaybeEncodedAccount<TAddress>): Account<Pool, TAddress> | MaybeAccount<Pool, TAddress> {
|
|
187
|
+
return decodeAccount(encodedAccount as MaybeEncodedAccount<TAddress>, getPoolDecoder());
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export async function fetchPool<TAddress extends string = string>(
|
|
191
|
+
rpc: Parameters<typeof fetchEncodedAccount>[0],
|
|
192
|
+
address: Address<TAddress>,
|
|
193
|
+
config?: FetchAccountConfig,
|
|
194
|
+
): Promise<Account<Pool, TAddress>> {
|
|
195
|
+
const maybeAccount = await fetchMaybePool(rpc, address, config);
|
|
196
|
+
assertAccountExists(maybeAccount);
|
|
197
|
+
return maybeAccount;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export async function fetchMaybePool<TAddress extends string = string>(
|
|
201
|
+
rpc: Parameters<typeof fetchEncodedAccount>[0],
|
|
202
|
+
address: Address<TAddress>,
|
|
203
|
+
config?: FetchAccountConfig,
|
|
204
|
+
): Promise<MaybeAccount<Pool, TAddress>> {
|
|
205
|
+
const maybeAccount = await fetchEncodedAccount(rpc, address, config);
|
|
206
|
+
return decodePool(maybeAccount);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
export async function fetchAllPool(
|
|
210
|
+
rpc: Parameters<typeof fetchEncodedAccounts>[0],
|
|
211
|
+
addresses: Array<Address>,
|
|
212
|
+
config?: FetchAccountsConfig,
|
|
213
|
+
): Promise<Account<Pool>[]> {
|
|
214
|
+
const maybeAccounts = await fetchAllMaybePool(rpc, addresses, config);
|
|
215
|
+
assertAccountsExist(maybeAccounts);
|
|
216
|
+
return maybeAccounts;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export async function fetchAllMaybePool(
|
|
220
|
+
rpc: Parameters<typeof fetchEncodedAccounts>[0],
|
|
221
|
+
addresses: Array<Address>,
|
|
222
|
+
config?: FetchAccountsConfig,
|
|
223
|
+
): Promise<MaybeAccount<Pool>[]> {
|
|
224
|
+
const maybeAccounts = await fetchEncodedAccounts(rpc, addresses, config);
|
|
225
|
+
return maybeAccounts.map((maybeAccount) => decodePool(maybeAccount));
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export async function fetchPoolFromSeeds(
|
|
229
|
+
rpc: Parameters<typeof fetchEncodedAccount>[0],
|
|
230
|
+
seeds: PoolSeeds,
|
|
231
|
+
config: FetchAccountConfig & { programAddress?: Address } = {},
|
|
232
|
+
): Promise<Account<Pool>> {
|
|
233
|
+
const maybeAccount = await fetchMaybePoolFromSeeds(rpc, seeds, config);
|
|
234
|
+
assertAccountExists(maybeAccount);
|
|
235
|
+
return maybeAccount;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export async function fetchMaybePoolFromSeeds(
|
|
239
|
+
rpc: Parameters<typeof fetchEncodedAccount>[0],
|
|
240
|
+
seeds: PoolSeeds,
|
|
241
|
+
config: FetchAccountConfig & { programAddress?: Address } = {},
|
|
242
|
+
): Promise<MaybeAccount<Pool>> {
|
|
243
|
+
const { programAddress, ...fetchConfig } = config;
|
|
244
|
+
const [address] = await findPoolPda(seeds, { programAddress });
|
|
245
|
+
return await fetchMaybePool(rpc, address, fetchConfig);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/** The account schema version this client was generated from. */
|
|
249
|
+
export const POOL_MIGRATION_VERSION = 1;
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Cheap envelope check for a fetched `Pool` account: `true` only when the
|
|
253
|
+
* bytes name this account's discriminator and a migration version older than
|
|
254
|
+
* this client's schema. Those are exactly the accounts
|
|
255
|
+
* {@link getMigrateInstruction} can bring current; every other mismatch is
|
|
256
|
+
* reported by the decoder when the account is decoded.
|
|
257
|
+
*
|
|
258
|
+
* ```ts
|
|
259
|
+
* const account = await fetchEncodedAccount(rpc, address);
|
|
260
|
+
* if (account.exists && poolNeedsMigration(account.data)) {
|
|
261
|
+
* // Migrate first, then retry the instruction that failed.
|
|
262
|
+
* await send(getMigrateInstruction({ pool: address, payer }));
|
|
263
|
+
* }
|
|
264
|
+
* ```
|
|
265
|
+
*/
|
|
266
|
+
export function poolNeedsMigration(data: ReadonlyUint8Array): boolean {
|
|
267
|
+
if (data.length < 2) {
|
|
268
|
+
return false;
|
|
269
|
+
}
|
|
270
|
+
if (data[0] !== 2) {
|
|
271
|
+
return false;
|
|
272
|
+
}
|
|
273
|
+
return data[1]! < 1;
|
|
274
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun Codama to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/codama-idl/codama
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { isProgramError, type Address, type SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM, type SolanaError } from '@solana/kit';
|
|
10
|
+
import { PINA_AMM_PROGRAM_ADDRESS } from '../programs';
|
|
11
|
+
|
|
12
|
+
/** Fee rates are out of range: trade plus creator fee above 10% or protocol share above 100%. */
|
|
13
|
+
export const PINA_AMM_ERROR__INVALID_FEE_RATES = 0x0; // 0
|
|
14
|
+
/** The signer is not the authority this instruction requires. */
|
|
15
|
+
export const PINA_AMM_ERROR__UNAUTHORIZED = 0x1; // 1
|
|
16
|
+
/** The program-data account is not this program's, or the program is not upgradeable. */
|
|
17
|
+
export const PINA_AMM_ERROR__INVALID_PROGRAM_DATA = 0x2; // 2
|
|
18
|
+
/** Pool mints must be distinct and passed in ascending byte order. */
|
|
19
|
+
export const PINA_AMM_ERROR__INVALID_MINT_ORDER = 0x3; // 3
|
|
20
|
+
/** The mint's token program or Token-2022 extensions are not supported. */
|
|
21
|
+
export const PINA_AMM_ERROR__UNSUPPORTED_MINT = 0x4; // 4
|
|
22
|
+
/** A vault, LP mint, or fee tier account does not belong to this pool. */
|
|
23
|
+
export const PINA_AMM_ERROR__POOL_ACCOUNT_MISMATCH = 0x5; // 5
|
|
24
|
+
/** The creator fee mode must be 0 (input token), 1 (token 0), or 2 (token 1). */
|
|
25
|
+
export const PINA_AMM_ERROR__INVALID_CREATOR_FEE_MODE = 0x6; // 6
|
|
26
|
+
/** The initial deposit must mint more LP than the permanently locked minimum. */
|
|
27
|
+
export const PINA_AMM_ERROR__INSUFFICIENT_INITIAL_LIQUIDITY = 0x7; // 7
|
|
28
|
+
/** An amount is zero or the trade rounds down to nothing. */
|
|
29
|
+
export const PINA_AMM_ERROR__ZERO_AMOUNT = 0x8; // 8
|
|
30
|
+
/** The result is worse than the caller's slippage limit. */
|
|
31
|
+
export const PINA_AMM_ERROR__SLIPPAGE_EXCEEDED = 0x9; // 9
|
|
32
|
+
/** The pool cannot pay this amount from its reserves. */
|
|
33
|
+
export const PINA_AMM_ERROR__INSUFFICIENT_LIQUIDITY = 0xa; // 10
|
|
34
|
+
/** An intermediate value overflowed or did not fit its type. */
|
|
35
|
+
export const PINA_AMM_ERROR__MATH_OVERFLOW = 0xb; // 11
|
|
36
|
+
/** The trade would decrease the pool's constant product. */
|
|
37
|
+
export const PINA_AMM_ERROR__INVARIANT_VIOLATION = 0xc; // 12
|
|
38
|
+
/** A vault holds less than the fees accrued against it. */
|
|
39
|
+
export const PINA_AMM_ERROR__VAULT_ACCOUNTING_MISMATCH = 0xd; // 13
|
|
40
|
+
/** This fee tier only lets its pool-creator authority create pools. */
|
|
41
|
+
export const PINA_AMM_ERROR__POOL_CREATOR_NOT_AUTHORIZED = 0xe; // 14
|
|
42
|
+
/** The pool creator may not be the default address, which can never sign or collect. */
|
|
43
|
+
export const PINA_AMM_ERROR__DEFAULT_CREATOR = 0xf; // 15
|
|
44
|
+
|
|
45
|
+
export type PinaAmmError = typeof PINA_AMM_ERROR__DEFAULT_CREATOR | typeof PINA_AMM_ERROR__INSUFFICIENT_INITIAL_LIQUIDITY | typeof PINA_AMM_ERROR__INSUFFICIENT_LIQUIDITY | typeof PINA_AMM_ERROR__INVALID_CREATOR_FEE_MODE | typeof PINA_AMM_ERROR__INVALID_FEE_RATES | typeof PINA_AMM_ERROR__INVALID_MINT_ORDER | typeof PINA_AMM_ERROR__INVALID_PROGRAM_DATA | typeof PINA_AMM_ERROR__INVARIANT_VIOLATION | typeof PINA_AMM_ERROR__MATH_OVERFLOW | typeof PINA_AMM_ERROR__POOL_ACCOUNT_MISMATCH | typeof PINA_AMM_ERROR__POOL_CREATOR_NOT_AUTHORIZED | typeof PINA_AMM_ERROR__SLIPPAGE_EXCEEDED | typeof PINA_AMM_ERROR__UNAUTHORIZED | typeof PINA_AMM_ERROR__UNSUPPORTED_MINT | typeof PINA_AMM_ERROR__VAULT_ACCOUNTING_MISMATCH | typeof PINA_AMM_ERROR__ZERO_AMOUNT;
|
|
46
|
+
|
|
47
|
+
let pinaAmmErrorMessages: Record<PinaAmmError, string> | undefined;
|
|
48
|
+
if (process.env['NODE_ENV'] !== 'production') {
|
|
49
|
+
pinaAmmErrorMessages = { [PINA_AMM_ERROR__DEFAULT_CREATOR]: `The pool creator may not be the default address, which can never sign or collect.`, [PINA_AMM_ERROR__INSUFFICIENT_INITIAL_LIQUIDITY]: `The initial deposit must mint more LP than the permanently locked minimum.`, [PINA_AMM_ERROR__INSUFFICIENT_LIQUIDITY]: `The pool cannot pay this amount from its reserves.`, [PINA_AMM_ERROR__INVALID_CREATOR_FEE_MODE]: `The creator fee mode must be 0 (input token), 1 (token 0), or 2 (token 1).`, [PINA_AMM_ERROR__INVALID_FEE_RATES]: `Fee rates are out of range: trade plus creator fee above 10% or protocol share above 100%.`, [PINA_AMM_ERROR__INVALID_MINT_ORDER]: `Pool mints must be distinct and passed in ascending byte order.`, [PINA_AMM_ERROR__INVALID_PROGRAM_DATA]: `The program-data account is not this program's, or the program is not upgradeable.`, [PINA_AMM_ERROR__INVARIANT_VIOLATION]: `The trade would decrease the pool's constant product.`, [PINA_AMM_ERROR__MATH_OVERFLOW]: `An intermediate value overflowed or did not fit its type.`, [PINA_AMM_ERROR__POOL_ACCOUNT_MISMATCH]: `A vault, LP mint, or fee tier account does not belong to this pool.`, [PINA_AMM_ERROR__POOL_CREATOR_NOT_AUTHORIZED]: `This fee tier only lets its pool-creator authority create pools.`, [PINA_AMM_ERROR__SLIPPAGE_EXCEEDED]: `The result is worse than the caller's slippage limit.`, [PINA_AMM_ERROR__UNAUTHORIZED]: `The signer is not the authority this instruction requires.`, [PINA_AMM_ERROR__UNSUPPORTED_MINT]: `The mint's token program or Token-2022 extensions are not supported.`, [PINA_AMM_ERROR__VAULT_ACCOUNTING_MISMATCH]: `A vault holds less than the fees accrued against it.`, [PINA_AMM_ERROR__ZERO_AMOUNT]: `An amount is zero or the trade rounds down to nothing.` };
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function getPinaAmmErrorMessage(code: PinaAmmError): string {
|
|
53
|
+
if (process.env['NODE_ENV'] !== 'production') {
|
|
54
|
+
return (pinaAmmErrorMessages as Record<PinaAmmError, string>)[code];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return 'Error message not available in production bundles.';
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function isPinaAmmError<TProgramErrorCode extends PinaAmmError>(
|
|
61
|
+
error: unknown,
|
|
62
|
+
transactionMessage: { instructions: Record<number, { programAddress: Address }> },
|
|
63
|
+
code?: TProgramErrorCode,
|
|
64
|
+
): error is SolanaError<typeof SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM> & Readonly<{ context: Readonly<{ code: TProgramErrorCode }> }> {
|
|
65
|
+
return isProgramError<TProgramErrorCode>(error, transactionMessage, PINA_AMM_PROGRAM_ADDRESS, code);
|
|
66
|
+
}
|