@picon-finance/dlmm-sdk 1.10.0 → 1.11.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/dist/entities/pool.d.ts.map +1 -1
- package/dist/entities/pool.js +16 -9
- package/dist/entities/position.d.ts.map +1 -1
- package/dist/entities/position.js +2 -2
- package/dist/generated/errors/piconDlmm.d.ts +7 -1
- package/dist/generated/errors/piconDlmm.d.ts.map +1 -1
- package/dist/generated/errors/piconDlmm.js +9 -0
- package/dist/generated/instructions/swap.d.ts +8 -4
- package/dist/generated/instructions/swap.d.ts.map +1 -1
- package/dist/generated/instructions/swap.js +3 -0
- package/dist/generated/instructions/syncPool.d.ts +8 -4
- package/dist/generated/instructions/syncPool.d.ts.map +1 -1
- package/dist/generated/instructions/syncPool.js +3 -0
- package/dist/generated/types/accountGroup.d.ts +21 -0
- package/dist/generated/types/accountGroup.d.ts.map +1 -0
- package/dist/generated/types/accountGroup.js +24 -0
- package/dist/generated/types/accountKind.d.ts +16 -0
- package/dist/generated/types/accountKind.d.ts.map +1 -0
- package/dist/generated/types/accountKind.js +21 -0
- package/dist/generated/types/index.d.ts +3 -0
- package/dist/generated/types/index.d.ts.map +1 -1
- package/dist/generated/types/index.js +3 -0
- package/dist/generated/types/remainingAccountsScheme.d.ts +19 -0
- package/dist/generated/types/remainingAccountsScheme.d.ts.map +1 -0
- package/dist/generated/types/remainingAccountsScheme.js +22 -0
- package/dist/picon_dlmm.json +81 -6
- package/dist/utils/constants.d.ts +3 -5
- package/dist/utils/constants.d.ts.map +1 -1
- package/dist/utils/constants.js +3 -5
- package/dist/utils/transfer_hook.d.ts +17 -0
- package/dist/utils/transfer_hook.d.ts.map +1 -0
- package/dist/utils/transfer_hook.js +182 -0
- package/package.json +1 -1
- package/src/entities/pool.ts +17 -12
- package/src/entities/position.ts +2 -2
- package/src/generated/errors/piconDlmm.ts +12 -0
- package/src/generated/instructions/swap.ts +17 -6
- package/src/generated/instructions/syncPool.ts +20 -7
- package/src/generated/types/accountGroup.ts +49 -0
- package/src/generated/types/accountKind.ts +37 -0
- package/src/generated/types/index.ts +3 -0
- package/src/generated/types/remainingAccountsScheme.ts +50 -0
- package/src/picon_dlmm.json +81 -6
- package/src/utils/constants.ts +3 -5
- package/src/utils/transfer_hook.ts +269 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pool.d.ts","sourceRoot":"","sources":["../../src/entities/pool.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAEf,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACzB,MAAM,aAAa,CAAC;AAMrB,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAC/B,OAAO,EAGL,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,WAAW,EACjB,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"pool.d.ts","sourceRoot":"","sources":["../../src/entities/pool.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAEf,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACzB,MAAM,aAAa,CAAC;AAMrB,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAC/B,OAAO,EAGL,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,WAAW,EACjB,MAAM,UAAU,CAAC;AAclB,OAAO,EACL,QAAQ,EAKT,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,qBAAa,IAAI;;IAQf,OAAO,eAYN;IAED,IAAW,GAAG,+5nBAAwB;IAEtC,IAAW,cAAc,YAAmC;IAC5D,IAAW,OAAO,oBAAoC;IACtD,IAAW,IAAI,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aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,WAAW,CAAC,CAMtB;IAEY,gBAAgB,CAAC,SAAS,EAAE,iBAAiB,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAgClF;IAED,OAAoB,IAAI,CACtB,GAAG,EAAE,UAAU,CAAC,OAAO,eAAe,CAAC,EACvC,OAAO,EAAE,OAAO,EAChB,cAAc,EAAE,OAAO,EACvB,MAAM,CAAC,EAAE,kBAAkB,GAC1B,OAAO,CAAC,IAAI,CAAC,CAWf;CACF;AAED,wBAAsB,eAAe,CACnC,KAAK,EAAE;IAAE,UAAU,EAAE,OAAO,CAAC;IAAC,UAAU,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,EACrF,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,OAAO,CAAC,CAGlB;AAED,wBAAsB,UAAU,CAC9B,EACE,SAAS,EACT,OAAO,EACP,OAAO,EACP,aAAa,EACb,WAAW,EACX,UAAU,EACV,UAAU,EACV,aAAa,EACb,aAAa,GACd,EAAE;IACD,SAAS,EAAE,iBAAiB,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,OAAO,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;CACxB,EACD,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,WAAW,CAAC,CAkBtB"}
|
package/dist/entities/pool.js
CHANGED
|
@@ -8,7 +8,7 @@ import { resolveAdminConfigAddress } from "./admin_config";
|
|
|
8
8
|
import { processAssociatedTokenAccountPair } from "../utils/ata";
|
|
9
9
|
import { generateBinArrayIndicesForSwap, generateBinArrayIndicesForSync, } from "../utils/bin_location";
|
|
10
10
|
import { resolveTransferFee } from "../utils/transfer_fee";
|
|
11
|
-
import {
|
|
11
|
+
import { MAX_BIN_ARRAYS_PER_TRAVERSAL, MIN_BIN_ARRAYS_PER_TRAVERSAL, } from "../utils/constants";
|
|
12
12
|
import { Position, openPosition, closePosition, findPositionAddress, findAllPositionAddresses, } from "./position";
|
|
13
13
|
import { findAllBinArrayAddresses } from "./bin_array";
|
|
14
14
|
export class Pool {
|
|
@@ -70,8 +70,8 @@ export class Pool {
|
|
|
70
70
|
async closePosition(owner, positionMint) {
|
|
71
71
|
return await closePosition({ owner, positionMint }, { programAddress: this.#programAddress });
|
|
72
72
|
}
|
|
73
|
-
async swap(user, { xToY, amountIn, minAmountOut, binArrayCount =
|
|
74
|
-
assertInRange(binArrayCount,
|
|
73
|
+
async swap(user, { xToY, amountIn, minAmountOut, binArrayCount = MAX_BIN_ARRAYS_PER_TRAVERSAL, }) {
|
|
74
|
+
assertInRange(binArrayCount, MIN_BIN_ARRAYS_PER_TRAVERSAL, MAX_BIN_ARRAYS_PER_TRAVERSAL, "binArrayCount");
|
|
75
75
|
const indices = generateBinArrayIndicesForSwap(this.activeBinId, xToY, binArrayCount);
|
|
76
76
|
const [binArrayAddresses, { ataX: tokenUserAccountX, ataY: tokenUserAccountY, preInstructions, postInstructions, }] = await Promise.all([
|
|
77
77
|
findAllBinArrayAddresses({ pool: this.address, indices }, { programAddress: this.#programAddress }),
|
|
@@ -85,6 +85,9 @@ export class Pool {
|
|
|
85
85
|
amountY: xToY ? undefined : amountIn,
|
|
86
86
|
}),
|
|
87
87
|
]);
|
|
88
|
+
const remainingAccountsScheme = {
|
|
89
|
+
groups: [{ kind: generated.AccountKind.BinArray, count: binArrayAddresses.length }],
|
|
90
|
+
};
|
|
88
91
|
const swapIx = generated.getSwapInstruction({
|
|
89
92
|
user,
|
|
90
93
|
pool: this.address,
|
|
@@ -99,13 +102,14 @@ export class Pool {
|
|
|
99
102
|
amountIn,
|
|
100
103
|
minAmountOut,
|
|
101
104
|
xToY,
|
|
105
|
+
remainingAccountsScheme,
|
|
102
106
|
}, { programAddress: this.#programAddress });
|
|
103
107
|
const remainingAccounts = binArrayAddresses.map(address => ({ address, role: AccountRole.WRITABLE }));
|
|
104
108
|
const swapIxWithBinArrays = { ...swapIx, accounts: [...swapIx.accounts, ...remainingAccounts] };
|
|
105
109
|
return [...preInstructions, swapIxWithBinArrays, ...postInstructions];
|
|
106
110
|
}
|
|
107
|
-
async quote({ xToY, amountIn, slippageToleranceBps, binArrayCount =
|
|
108
|
-
assertInRange(binArrayCount,
|
|
111
|
+
async quote({ xToY, amountIn, slippageToleranceBps, binArrayCount = MAX_BIN_ARRAYS_PER_TRAVERSAL, }) {
|
|
112
|
+
assertInRange(binArrayCount, MIN_BIN_ARRAYS_PER_TRAVERSAL, MAX_BIN_ARRAYS_PER_TRAVERSAL, "binArrayCount");
|
|
109
113
|
const indices = generateBinArrayIndicesForSwap(this.activeBinId, xToY, binArrayCount);
|
|
110
114
|
const binArrayAddresses = await findAllBinArrayAddresses({ pool: this.address, indices }, { programAddress: this.#programAddress });
|
|
111
115
|
const [maybeBinArrays, { transferFeeX, transferFeeY }] = await Promise.all([
|
|
@@ -124,16 +128,19 @@ export class Pool {
|
|
|
124
128
|
binArrays,
|
|
125
129
|
});
|
|
126
130
|
}
|
|
127
|
-
async quoteAndSwap(user, { xToY, amountIn, slippageToleranceBps, binArrayCount =
|
|
131
|
+
async quoteAndSwap(user, { xToY, amountIn, slippageToleranceBps, binArrayCount = MAX_BIN_ARRAYS_PER_TRAVERSAL, }) {
|
|
128
132
|
const quoteOutput = await this.quote({ xToY, amountIn, slippageToleranceBps, binArrayCount });
|
|
129
133
|
const instructions = await this.swap(user, { xToY, amountIn, minAmountOut: quoteOutput.minAmountOut, binArrayCount });
|
|
130
134
|
return { quoteOutput, instructions };
|
|
131
135
|
}
|
|
132
|
-
async sync(user, desiredBinId, binArrayCount =
|
|
133
|
-
assertInRange(binArrayCount,
|
|
136
|
+
async sync(user, desiredBinId, binArrayCount = MAX_BIN_ARRAYS_PER_TRAVERSAL) {
|
|
137
|
+
assertInRange(binArrayCount, MIN_BIN_ARRAYS_PER_TRAVERSAL, MAX_BIN_ARRAYS_PER_TRAVERSAL, "binArrayCount");
|
|
134
138
|
const indices = generateBinArrayIndicesForSync(this.activeBinId, desiredBinId, binArrayCount);
|
|
135
139
|
const binArrayAddresses = await findAllBinArrayAddresses({ pool: this.address, indices }, { programAddress: this.#programAddress });
|
|
136
|
-
const
|
|
140
|
+
const remainingAccountsScheme = {
|
|
141
|
+
groups: [{ kind: generated.AccountKind.BinArray, count: binArrayAddresses.length }],
|
|
142
|
+
};
|
|
143
|
+
const syncPoolIx = generated.getSyncPoolInstruction({ user, pool: this.address, desiredBinId, remainingAccountsScheme }, { programAddress: this.#programAddress });
|
|
137
144
|
const remainingAccounts = binArrayAddresses.map(address => ({ address, role: AccountRole.READONLY }));
|
|
138
145
|
return [{ ...syncPoolIx, accounts: [...syncPoolIx.accounts, ...remainingAccounts] }];
|
|
139
146
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"position.d.ts","sourceRoot":"","sources":["../../src/entities/position.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EAGf,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EAEzB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAM/B,OAAO,EAIL,KAAK,UAAU,EAChB,MAAM,uBAAuB,CAAC;AAgB/B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EACL,QAAQ,EAIT,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,eAAe,EACrB,MAAM,SAAS,CAAC;AAEjB,qBAAa,QAAQ;;IAKnB,OAAO,eAQN;IAED,IAAW,OA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AM,EAAE,aAAa,GACpB,OAAO,CAAC,WAAW,EAAE,CAAC,CAyBxB;AAED,wBAAsB,aAAa,CACjC,EACE,KAAK,EACL,YAAY,EACZ,QAAQ,GACT,EAAE;IACD,KAAK,EAAE,iBAAiB,CAAC;IACzB,YAAY,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,EACD,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,WAAW,CAAC,CAWtB"}
|
|
@@ -7,7 +7,7 @@ import { assertRangeWithinRange, assertPositionBelongsToPool, } from "../utils/a
|
|
|
7
7
|
import { isUndefined } from "../utils/type_guards";
|
|
8
8
|
import { chunk, fetchInChunks, } from "../utils/chunk";
|
|
9
9
|
import { resolveAdminConfigAddress } from "./admin_config";
|
|
10
|
-
import {
|
|
10
|
+
import { DEFAULT_POSITIONS_PER_CLAIM, MAX_ACCOUNTS_PER_RPC_BATCH, } from "../utils/constants";
|
|
11
11
|
import { BinArray, decodeAllBinArrays, createAllBinArrays, fetchAllBinArraysChunked, } from "./bin_array";
|
|
12
12
|
export class Position {
|
|
13
13
|
#pool;
|
|
@@ -256,7 +256,7 @@ export class Position {
|
|
|
256
256
|
position.#binArrays.map(binArray => binArrayByAddress.get(binArray.address)),
|
|
257
257
|
])));
|
|
258
258
|
}
|
|
259
|
-
static async claimAllFees(owner, positions, positionsPerClaim =
|
|
259
|
+
static async claimAllFees(owner, positions, positionsPerClaim = DEFAULT_POSITIONS_PER_CLAIM) {
|
|
260
260
|
if (positions.length === 0) {
|
|
261
261
|
return [];
|
|
262
262
|
}
|
|
@@ -44,7 +44,13 @@ export declare const PICON_DLMM_ERROR__INSUFFICIENT_LIQUIDITY = 6016;
|
|
|
44
44
|
export declare const PICON_DLMM_ERROR__EXCEEDED_SWAP_SLIPPAGE_TOLERANCE = 6017;
|
|
45
45
|
/** InvalidPendingAuthority: Signer is not the pending authority */
|
|
46
46
|
export declare const PICON_DLMM_ERROR__INVALID_PENDING_AUTHORITY = 6018;
|
|
47
|
-
|
|
47
|
+
/** UnexpectedRemainingAccountsKind: Unexpected remaining accounts kind for this instruction */
|
|
48
|
+
export declare const PICON_DLMM_ERROR__UNEXPECTED_REMAINING_ACCOUNTS_KIND = 6019;
|
|
49
|
+
/** DuplicateRemainingAccountsKind: Duplicate remaining accounts kind */
|
|
50
|
+
export declare const PICON_DLMM_ERROR__DUPLICATE_REMAINING_ACCOUNTS_KIND = 6020;
|
|
51
|
+
/** InsufficientRemainingAccounts: Insufficient remaining accounts */
|
|
52
|
+
export declare const PICON_DLMM_ERROR__INSUFFICIENT_REMAINING_ACCOUNTS = 6021;
|
|
53
|
+
export type PiconDlmmError = typeof PICON_DLMM_ERROR__BIN_ARRAY_NOT_EMPTY | typeof PICON_DLMM_ERROR__DUPLICATE_REMAINING_ACCOUNTS_KIND | typeof PICON_DLMM_ERROR__EXCEEDED_BIN_SLIPPAGE_TOLERANCE | typeof PICON_DLMM_ERROR__EXCEEDED_SWAP_SLIPPAGE_TOLERANCE | typeof PICON_DLMM_ERROR__INSUFFICIENT_LIQUIDITY | typeof PICON_DLMM_ERROR__INSUFFICIENT_REMAINING_ACCOUNTS | typeof PICON_DLMM_ERROR__INVALID_ACTIVE_BIN | typeof PICON_DLMM_ERROR__INVALID_BIN_ARRAY | typeof PICON_DLMM_ERROR__INVALID_BIN_RANGE | typeof PICON_DLMM_ERROR__INVALID_BIN_WEIGHTS | typeof PICON_DLMM_ERROR__INVALID_BPS | typeof PICON_DLMM_ERROR__INVALID_DYNAMIC_FEE_CONFIG | typeof PICON_DLMM_ERROR__INVALID_PENDING_AUTHORITY | typeof PICON_DLMM_ERROR__INVALID_POSITION_OWNER | typeof PICON_DLMM_ERROR__INVALID_PROTOCOL_SHARE | typeof PICON_DLMM_ERROR__LIQUIDITY_ERROR | typeof PICON_DLMM_ERROR__POSITION_NOT_EMPTY | typeof PICON_DLMM_ERROR__UNEXPECTED_REMAINING_ACCOUNTS_KIND | typeof PICON_DLMM_ERROR__UNSUPPORTED_BIN_STEP | typeof PICON_DLMM_ERROR__UNSUPPORTED_FEE_RATE | typeof PICON_DLMM_ERROR__UNSUPPORTED_MINT_EXTENSION | typeof PICON_DLMM_ERROR__ZERO_SWAP_AMOUNT;
|
|
48
54
|
export declare function getPiconDlmmErrorMessage(code: PiconDlmmError): string;
|
|
49
55
|
export declare function isPiconDlmmError<TProgramErrorCode extends PiconDlmmError>(error: unknown, transactionMessage: {
|
|
50
56
|
instructions: Record<number, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"piconDlmm.d.ts","sourceRoot":"","sources":["../../../src/generated/errors/piconDlmm.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAEL,KAAK,OAAO,EACZ,KAAK,uCAAuC,EAC5C,KAAK,WAAW,EACjB,MAAM,aAAa,CAAC;AAGrB,sCAAsC;AACtC,eAAO,MAAM,iCAAiC,OAAS,CAAC;AACxD,yCAAyC;AACzC,eAAO,MAAM,mCAAmC,OAAS,CAAC;AAC1D,+CAA+C;AAC/C,eAAO,MAAM,qCAAqC,OAAS,CAAC;AAC5D,+CAA+C;AAC/C,eAAO,MAAM,sCAAsC,OAAS,CAAC;AAC7D,+CAA+C;AAC/C,eAAO,MAAM,sCAAsC,OAAS,CAAC;AAC7D,mDAAmD;AACnD,eAAO,MAAM,wCAAwC,OAAS,CAAC;AAC/D,2CAA2C;AAC3C,eAAO,MAAM,oCAAoC,OAAS,CAAC;AAC3D,2DAA2D;AAC3D,eAAO,MAAM,4CAA4C,OAAS,CAAC;AACnE,0DAA0D;AAC1D,eAAO,MAAM,4CAA4C,OAAS,CAAC;AACnE,yCAAyC;AACzC,eAAO,MAAM,mCAAmC,OAAS,CAAC;AAC1D,yDAAyD;AACzD,eAAO,MAAM,wCAAwC,OAAS,CAAC;AAC/D,6CAA6C;AAC7C,eAAO,MAAM,qCAAqC,OAAS,CAAC;AAC5D,8BAA8B;AAC9B,eAAO,MAAM,6BAA6B,OAAS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AE,CAAC,CAAC;CAC3D,EACD,IAAI,CAAC,EAAE,iBAAiB,GACvB,KAAK,IAAI,WAAW,CAAC,OAAO,uCAAuC,CAAC,GACrE,QAAQ,CAAC;IAAE,OAAO,EAAE,QAAQ,CAAC;QAAE,IAAI,EAAE,iBAAiB,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC,CAO7D"}
|
|
@@ -45,13 +45,21 @@ export const PICON_DLMM_ERROR__INSUFFICIENT_LIQUIDITY = 0x1780; // 6016
|
|
|
45
45
|
export const PICON_DLMM_ERROR__EXCEEDED_SWAP_SLIPPAGE_TOLERANCE = 0x1781; // 6017
|
|
46
46
|
/** InvalidPendingAuthority: Signer is not the pending authority */
|
|
47
47
|
export const PICON_DLMM_ERROR__INVALID_PENDING_AUTHORITY = 0x1782; // 6018
|
|
48
|
+
/** UnexpectedRemainingAccountsKind: Unexpected remaining accounts kind for this instruction */
|
|
49
|
+
export const PICON_DLMM_ERROR__UNEXPECTED_REMAINING_ACCOUNTS_KIND = 0x1783; // 6019
|
|
50
|
+
/** DuplicateRemainingAccountsKind: Duplicate remaining accounts kind */
|
|
51
|
+
export const PICON_DLMM_ERROR__DUPLICATE_REMAINING_ACCOUNTS_KIND = 0x1784; // 6020
|
|
52
|
+
/** InsufficientRemainingAccounts: Insufficient remaining accounts */
|
|
53
|
+
export const PICON_DLMM_ERROR__INSUFFICIENT_REMAINING_ACCOUNTS = 0x1785; // 6021
|
|
48
54
|
let piconDlmmErrorMessages;
|
|
49
55
|
if (process.env["NODE_ENV"] !== "production") {
|
|
50
56
|
piconDlmmErrorMessages = {
|
|
51
57
|
[PICON_DLMM_ERROR__BIN_ARRAY_NOT_EMPTY]: `Bin array is not empty`,
|
|
58
|
+
[PICON_DLMM_ERROR__DUPLICATE_REMAINING_ACCOUNTS_KIND]: `Duplicate remaining accounts kind`,
|
|
52
59
|
[PICON_DLMM_ERROR__EXCEEDED_BIN_SLIPPAGE_TOLERANCE]: `Exceeded bin slippage tolerance`,
|
|
53
60
|
[PICON_DLMM_ERROR__EXCEEDED_SWAP_SLIPPAGE_TOLERANCE]: `Exceeded swap slippage tolerance`,
|
|
54
61
|
[PICON_DLMM_ERROR__INSUFFICIENT_LIQUIDITY]: `Insufficient liquidity for swap`,
|
|
62
|
+
[PICON_DLMM_ERROR__INSUFFICIENT_REMAINING_ACCOUNTS]: `Insufficient remaining accounts`,
|
|
55
63
|
[PICON_DLMM_ERROR__INVALID_ACTIVE_BIN]: `Invalid active bin`,
|
|
56
64
|
[PICON_DLMM_ERROR__INVALID_BIN_ARRAY]: `Invalid bin array`,
|
|
57
65
|
[PICON_DLMM_ERROR__INVALID_BIN_RANGE]: `Invalid bin range`,
|
|
@@ -63,6 +71,7 @@ if (process.env["NODE_ENV"] !== "production") {
|
|
|
63
71
|
[PICON_DLMM_ERROR__INVALID_PROTOCOL_SHARE]: `Invalid protocol share`,
|
|
64
72
|
[PICON_DLMM_ERROR__LIQUIDITY_ERROR]: `Liquidity error`,
|
|
65
73
|
[PICON_DLMM_ERROR__POSITION_NOT_EMPTY]: `Position is not empty`,
|
|
74
|
+
[PICON_DLMM_ERROR__UNEXPECTED_REMAINING_ACCOUNTS_KIND]: `Unexpected remaining accounts kind for this instruction`,
|
|
66
75
|
[PICON_DLMM_ERROR__UNSUPPORTED_BIN_STEP]: `Unsupported bin step`,
|
|
67
76
|
[PICON_DLMM_ERROR__UNSUPPORTED_FEE_RATE]: `Unsupported fee rate`,
|
|
68
77
|
[PICON_DLMM_ERROR__UNSUPPORTED_MINT_EXTENSION]: `Unsupported mint extension`,
|
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @see https://github.com/codama-idl/codama
|
|
7
7
|
*/
|
|
8
|
-
import { type AccountMeta, type AccountSignerMeta, type Address, type
|
|
8
|
+
import { type AccountMeta, type AccountSignerMeta, type Address, type Codec, type Decoder, type Encoder, type Instruction, type InstructionWithAccounts, type InstructionWithData, type ReadonlyAccount, type ReadonlySignerAccount, type ReadonlyUint8Array, type TransactionSigner, type WritableAccount } from "@solana/kit";
|
|
9
9
|
import { PICON_DLMM_PROGRAM_ADDRESS } from "../programs";
|
|
10
|
+
import { type RemainingAccountsScheme, type RemainingAccountsSchemeArgs } from "../types";
|
|
10
11
|
export declare const SWAP_DISCRIMINATOR: ReadonlyUint8Array;
|
|
11
12
|
export declare function getSwapDiscriminatorBytes(): ReadonlyUint8Array;
|
|
12
13
|
export type SwapInstruction<TProgram extends string = typeof PICON_DLMM_PROGRAM_ADDRESS, TAccountUser extends string | AccountMeta<string> = string, TAccountPool extends string | AccountMeta<string> = string, TAccountTokenMintX extends string | AccountMeta<string> = string, TAccountTokenMintY extends string | AccountMeta<string> = string, TAccountTokenUserAccountX extends string | AccountMeta<string> = string, TAccountTokenUserAccountY extends string | AccountMeta<string> = string, TAccountTokenVaultX extends string | AccountMeta<string> = string, TAccountTokenVaultY extends string | AccountMeta<string> = string, TAccountTokenProgramX extends string | AccountMeta<string> = string, TAccountTokenProgramY extends string | AccountMeta<string> = string, TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
|
|
@@ -27,15 +28,17 @@ export type SwapInstructionData = {
|
|
|
27
28
|
amountIn: bigint;
|
|
28
29
|
minAmountOut: bigint;
|
|
29
30
|
xToY: boolean;
|
|
31
|
+
remainingAccountsScheme: RemainingAccountsScheme;
|
|
30
32
|
};
|
|
31
33
|
export type SwapInstructionDataArgs = {
|
|
32
34
|
amountIn: number | bigint;
|
|
33
35
|
minAmountOut: number | bigint;
|
|
34
36
|
xToY: boolean;
|
|
37
|
+
remainingAccountsScheme: RemainingAccountsSchemeArgs;
|
|
35
38
|
};
|
|
36
|
-
export declare function getSwapInstructionDataEncoder():
|
|
37
|
-
export declare function getSwapInstructionDataDecoder():
|
|
38
|
-
export declare function getSwapInstructionDataCodec():
|
|
39
|
+
export declare function getSwapInstructionDataEncoder(): Encoder<SwapInstructionDataArgs>;
|
|
40
|
+
export declare function getSwapInstructionDataDecoder(): Decoder<SwapInstructionData>;
|
|
41
|
+
export declare function getSwapInstructionDataCodec(): Codec<SwapInstructionDataArgs, SwapInstructionData>;
|
|
39
42
|
export type SwapInput<TAccountUser extends string = string, TAccountPool extends string = string, TAccountTokenMintX extends string = string, TAccountTokenMintY extends string = string, TAccountTokenUserAccountX extends string = string, TAccountTokenUserAccountY extends string = string, TAccountTokenVaultX extends string = string, TAccountTokenVaultY extends string = string, TAccountTokenProgramX extends string = string, TAccountTokenProgramY extends string = string> = {
|
|
40
43
|
user: TransactionSigner<TAccountUser>;
|
|
41
44
|
pool: Address<TAccountPool>;
|
|
@@ -50,6 +53,7 @@ export type SwapInput<TAccountUser extends string = string, TAccountPool extends
|
|
|
50
53
|
amountIn: SwapInstructionDataArgs["amountIn"];
|
|
51
54
|
minAmountOut: SwapInstructionDataArgs["minAmountOut"];
|
|
52
55
|
xToY: SwapInstructionDataArgs["xToY"];
|
|
56
|
+
remainingAccountsScheme: SwapInstructionDataArgs["remainingAccountsScheme"];
|
|
53
57
|
};
|
|
54
58
|
export declare function getSwapInstruction<TAccountUser extends string, TAccountPool extends string, TAccountTokenMintX extends string, TAccountTokenMintY extends string, TAccountTokenUserAccountX extends string, TAccountTokenUserAccountY extends string, TAccountTokenVaultX extends string, TAccountTokenVaultY extends string, TAccountTokenProgramX extends string, TAccountTokenProgramY extends string, TProgramAddress extends Address = typeof PICON_DLMM_PROGRAM_ADDRESS>(input: SwapInput<TAccountUser, TAccountPool, TAccountTokenMintX, TAccountTokenMintY, TAccountTokenUserAccountX, TAccountTokenUserAccountY, TAccountTokenVaultX, TAccountTokenVaultY, TAccountTokenProgramX, TAccountTokenProgramY>, config?: {
|
|
55
59
|
programAddress?: TProgramAddress;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"swap.d.ts","sourceRoot":"","sources":["../../../src/generated/instructions/swap.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO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CAC/B,QAAQ,SAAS,MAAM,GAAG,OAAO,0BAA0B,EAC3D,aAAa,SAAS,SAAS,WAAW,EAAE,GAAG,SAAS,WAAW,EAAE,IACnE;IACF,cAAc,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAClC,QAAQ,EAAE;QACR,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;QACvB,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;QACvB,UAAU,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;QAC7B,UAAU,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;QAC7B,iBAAiB,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;QACpC,iBAAiB,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;QACpC,WAAW,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;QAC9B,WAAW,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;QAC9B,aAAa,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;QAChC,aAAa,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;KACjC,CAAC;IACF,IAAI,EAAE,mBAAmB,CAAC;CAC3B,CAAC;AAEF,wBAAgB,oBAAoB,CAClC,QAAQ,SAAS,MAAM,EACvB,aAAa,SAAS,SAAS,WAAW,EAAE,EAE5C,WAAW,EAAE,WAAW,CAAC,QAAQ,CAAC,GAChC,uBAAuB,CAAC,aAAa,CAAC,GACtC,mBAAmB,CAAC,kBAAkB,CAAC,GACxC,qBAAqB,CAAC,QAAQ,EAAE,aAAa,CAAC,CAgChD"}
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
import { combineCodec, fixDecoderSize, fixEncoderSize, getBooleanDecoder, getBooleanEncoder, getBytesDecoder, getBytesEncoder, getStructDecoder, getStructEncoder, getU64Decoder, getU64Encoder, SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, SolanaError, transformEncoder, } from "@solana/kit";
|
|
9
9
|
import { getAccountMetaFactory, } from "@solana/program-client-core";
|
|
10
10
|
import { PICON_DLMM_PROGRAM_ADDRESS } from "../programs";
|
|
11
|
+
import { getRemainingAccountsSchemeDecoder, getRemainingAccountsSchemeEncoder, } from "../types";
|
|
11
12
|
export const SWAP_DISCRIMINATOR = new Uint8Array([
|
|
12
13
|
248, 198, 158, 145, 225, 117, 135, 200,
|
|
13
14
|
]);
|
|
@@ -20,6 +21,7 @@ export function getSwapInstructionDataEncoder() {
|
|
|
20
21
|
["amountIn", getU64Encoder()],
|
|
21
22
|
["minAmountOut", getU64Encoder()],
|
|
22
23
|
["xToY", getBooleanEncoder()],
|
|
24
|
+
["remainingAccountsScheme", getRemainingAccountsSchemeEncoder()],
|
|
23
25
|
]), (value) => ({ ...value, discriminator: SWAP_DISCRIMINATOR }));
|
|
24
26
|
}
|
|
25
27
|
export function getSwapInstructionDataDecoder() {
|
|
@@ -28,6 +30,7 @@ export function getSwapInstructionDataDecoder() {
|
|
|
28
30
|
["amountIn", getU64Decoder()],
|
|
29
31
|
["minAmountOut", getU64Decoder()],
|
|
30
32
|
["xToY", getBooleanDecoder()],
|
|
33
|
+
["remainingAccountsScheme", getRemainingAccountsSchemeDecoder()],
|
|
31
34
|
]);
|
|
32
35
|
}
|
|
33
36
|
export function getSwapInstructionDataCodec() {
|
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @see https://github.com/codama-idl/codama
|
|
7
7
|
*/
|
|
8
|
-
import { type AccountMeta, type AccountSignerMeta, type Address, type
|
|
8
|
+
import { type AccountMeta, type AccountSignerMeta, type Address, type Codec, type Decoder, type Encoder, type Instruction, type InstructionWithAccounts, type InstructionWithData, type ReadonlySignerAccount, type ReadonlyUint8Array, type TransactionSigner, type WritableAccount } from "@solana/kit";
|
|
9
9
|
import { PICON_DLMM_PROGRAM_ADDRESS } from "../programs";
|
|
10
|
+
import { type RemainingAccountsScheme, type RemainingAccountsSchemeArgs } from "../types";
|
|
10
11
|
export declare const SYNC_POOL_DISCRIMINATOR: ReadonlyUint8Array;
|
|
11
12
|
export declare function getSyncPoolDiscriminatorBytes(): ReadonlyUint8Array;
|
|
12
13
|
export type SyncPoolInstruction<TProgram extends string = typeof PICON_DLMM_PROGRAM_ADDRESS, TAccountUser extends string | AccountMeta<string> = string, TAccountPool extends string | AccountMeta<string> = string, TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
|
|
@@ -17,17 +18,20 @@ export type SyncPoolInstruction<TProgram extends string = typeof PICON_DLMM_PROG
|
|
|
17
18
|
export type SyncPoolInstructionData = {
|
|
18
19
|
discriminator: ReadonlyUint8Array;
|
|
19
20
|
desiredBinId: number;
|
|
21
|
+
remainingAccountsScheme: RemainingAccountsScheme;
|
|
20
22
|
};
|
|
21
23
|
export type SyncPoolInstructionDataArgs = {
|
|
22
24
|
desiredBinId: number;
|
|
25
|
+
remainingAccountsScheme: RemainingAccountsSchemeArgs;
|
|
23
26
|
};
|
|
24
|
-
export declare function getSyncPoolInstructionDataEncoder():
|
|
25
|
-
export declare function getSyncPoolInstructionDataDecoder():
|
|
26
|
-
export declare function getSyncPoolInstructionDataCodec():
|
|
27
|
+
export declare function getSyncPoolInstructionDataEncoder(): Encoder<SyncPoolInstructionDataArgs>;
|
|
28
|
+
export declare function getSyncPoolInstructionDataDecoder(): Decoder<SyncPoolInstructionData>;
|
|
29
|
+
export declare function getSyncPoolInstructionDataCodec(): Codec<SyncPoolInstructionDataArgs, SyncPoolInstructionData>;
|
|
27
30
|
export type SyncPoolInput<TAccountUser extends string = string, TAccountPool extends string = string> = {
|
|
28
31
|
user: TransactionSigner<TAccountUser>;
|
|
29
32
|
pool: Address<TAccountPool>;
|
|
30
33
|
desiredBinId: SyncPoolInstructionDataArgs["desiredBinId"];
|
|
34
|
+
remainingAccountsScheme: SyncPoolInstructionDataArgs["remainingAccountsScheme"];
|
|
31
35
|
};
|
|
32
36
|
export declare function getSyncPoolInstruction<TAccountUser extends string, TAccountPool extends string, TProgramAddress extends Address = typeof PICON_DLMM_PROGRAM_ADDRESS>(input: SyncPoolInput<TAccountUser, TAccountPool>, config?: {
|
|
33
37
|
programAddress?: TProgramAddress;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"syncPool.d.ts","sourceRoot":"","sources":["../../../src/generated/instructions/syncPool.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAaL,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,OAAO,EACZ,KAAK,
|
|
1
|
+
{"version":3,"file":"syncPool.d.ts","sourceRoot":"","sources":["../../../src/generated/instructions/syncPool.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAaL,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,OAAO,EACZ,KAAK,KAAK,EACV,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACrB,MAAM,aAAa,CAAC;AAKrB,OAAO,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAGL,KAAK,uBAAuB,EAC5B,KAAK,2BAA2B,EACjC,MAAM,UAAU,CAAC;AAElB,eAAO,MAAM,uBAAuB,EAAE,kBAEpC,CAAC;AAEH,wBAAgB,6BAA6B,IAAI,kBAAkB,CAElE;AAED,MAAM,MAAM,mBAAmB,CAC7B,QAAQ,SAAS,MAAM,GAAG,OAAO,0BAA0B,EAC3D,YAAY,SAAS,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,GAAG,MAAM,EAC1D,YAAY,SAAS,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,GAAG,MAAM,EAC1D,kBAAkB,SAAS,SAAS,WAAW,CAAC,MAAM,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AC,YAAY,EAAE,YAAY,CAAC,EAChD,MAAM,CAAC,EAAE;IAAE,cAAc,CAAC,EAAE,eAAe,CAAA;CAAE,GAC5C,mBAAmB,CAAC,eAAe,EAAE,YAAY,EAAE,YAAY,CAAC,CA4BlE;AAED,MAAM,MAAM,yBAAyB,CACnC,QAAQ,SAAS,MAAM,GAAG,OAAO,0BAA0B,EAC3D,aAAa,SAAS,SAAS,WAAW,EAAE,GAAG,SAAS,WAAW,EAAE,IACnE;IACF,cAAc,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAClC,QAAQ,EAAE;QACR,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;QACvB,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;KACxB,CAAC;IACF,IAAI,EAAE,uBAAuB,CAAC;CAC/B,CAAC;AAEF,wBAAgB,wBAAwB,CACtC,QAAQ,SAAS,MAAM,EACvB,aAAa,SAAS,SAAS,WAAW,EAAE,EAE5C,WAAW,EAAE,WAAW,CAAC,QAAQ,CAAC,GAChC,uBAAuB,CAAC,aAAa,CAAC,GACtC,mBAAmB,CAAC,kBAAkB,CAAC,GACxC,yBAAyB,CAAC,QAAQ,EAAE,aAAa,CAAC,CAqBpD"}
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
import { combineCodec, fixDecoderSize, fixEncoderSize, getBytesDecoder, getBytesEncoder, getI32Decoder, getI32Encoder, getStructDecoder, getStructEncoder, SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, SolanaError, transformEncoder, } from "@solana/kit";
|
|
9
9
|
import { getAccountMetaFactory, } from "@solana/program-client-core";
|
|
10
10
|
import { PICON_DLMM_PROGRAM_ADDRESS } from "../programs";
|
|
11
|
+
import { getRemainingAccountsSchemeDecoder, getRemainingAccountsSchemeEncoder, } from "../types";
|
|
11
12
|
export const SYNC_POOL_DISCRIMINATOR = new Uint8Array([
|
|
12
13
|
219, 251, 215, 251, 44, 37, 108, 102,
|
|
13
14
|
]);
|
|
@@ -18,12 +19,14 @@ export function getSyncPoolInstructionDataEncoder() {
|
|
|
18
19
|
return transformEncoder(getStructEncoder([
|
|
19
20
|
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
20
21
|
["desiredBinId", getI32Encoder()],
|
|
22
|
+
["remainingAccountsScheme", getRemainingAccountsSchemeEncoder()],
|
|
21
23
|
]), (value) => ({ ...value, discriminator: SYNC_POOL_DISCRIMINATOR }));
|
|
22
24
|
}
|
|
23
25
|
export function getSyncPoolInstructionDataDecoder() {
|
|
24
26
|
return getStructDecoder([
|
|
25
27
|
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
26
28
|
["desiredBinId", getI32Decoder()],
|
|
29
|
+
["remainingAccountsScheme", getRemainingAccountsSchemeDecoder()],
|
|
27
30
|
]);
|
|
28
31
|
}
|
|
29
32
|
export function getSyncPoolInstructionDataCodec() {
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
import { type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder } from "@solana/kit";
|
|
9
|
+
import { type AccountKind, type AccountKindArgs } from ".";
|
|
10
|
+
export type AccountGroup = {
|
|
11
|
+
kind: AccountKind;
|
|
12
|
+
count: number;
|
|
13
|
+
};
|
|
14
|
+
export type AccountGroupArgs = {
|
|
15
|
+
kind: AccountKindArgs;
|
|
16
|
+
count: number;
|
|
17
|
+
};
|
|
18
|
+
export declare function getAccountGroupEncoder(): FixedSizeEncoder<AccountGroupArgs>;
|
|
19
|
+
export declare function getAccountGroupDecoder(): FixedSizeDecoder<AccountGroup>;
|
|
20
|
+
export declare function getAccountGroupCodec(): FixedSizeCodec<AccountGroupArgs, AccountGroup>;
|
|
21
|
+
//# sourceMappingURL=accountGroup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accountGroup.d.ts","sourceRoot":"","sources":["../../../src/generated/types/accountGroup.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAML,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAGL,KAAK,WAAW,EAChB,KAAK,eAAe,EACrB,MAAM,GAAG,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhE,MAAM,MAAM,gBAAgB,GAAG;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAExE,wBAAgB,sBAAsB,IAAI,gBAAgB,CAAC,gBAAgB,CAAC,CAK3E;AAED,wBAAgB,sBAAsB,IAAI,gBAAgB,CAAC,YAAY,CAAC,CAKvE;AAED,wBAAgB,oBAAoB,IAAI,cAAc,CACpD,gBAAgB,EAChB,YAAY,CACb,CAEA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
import { combineCodec, getStructDecoder, getStructEncoder, getU8Decoder, getU8Encoder, } from "@solana/kit";
|
|
9
|
+
import { getAccountKindDecoder, getAccountKindEncoder, } from ".";
|
|
10
|
+
export function getAccountGroupEncoder() {
|
|
11
|
+
return getStructEncoder([
|
|
12
|
+
["kind", getAccountKindEncoder()],
|
|
13
|
+
["count", getU8Encoder()],
|
|
14
|
+
]);
|
|
15
|
+
}
|
|
16
|
+
export function getAccountGroupDecoder() {
|
|
17
|
+
return getStructDecoder([
|
|
18
|
+
["kind", getAccountKindDecoder()],
|
|
19
|
+
["count", getU8Decoder()],
|
|
20
|
+
]);
|
|
21
|
+
}
|
|
22
|
+
export function getAccountGroupCodec() {
|
|
23
|
+
return combineCodec(getAccountGroupEncoder(), getAccountGroupDecoder());
|
|
24
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
import { type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder } from "@solana/kit";
|
|
9
|
+
export declare enum AccountKind {
|
|
10
|
+
BinArray = 0
|
|
11
|
+
}
|
|
12
|
+
export type AccountKindArgs = AccountKind;
|
|
13
|
+
export declare function getAccountKindEncoder(): FixedSizeEncoder<AccountKindArgs>;
|
|
14
|
+
export declare function getAccountKindDecoder(): FixedSizeDecoder<AccountKind>;
|
|
15
|
+
export declare function getAccountKindCodec(): FixedSizeCodec<AccountKindArgs, AccountKind>;
|
|
16
|
+
//# sourceMappingURL=accountKind.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accountKind.d.ts","sourceRoot":"","sources":["../../../src/generated/types/accountKind.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAIL,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACtB,MAAM,aAAa,CAAC;AAErB,oBAAY,WAAW;IACrB,QAAQ,IAAA;CACT;AAED,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC;AAE1C,wBAAgB,qBAAqB,IAAI,gBAAgB,CAAC,eAAe,CAAC,CAEzE;AAED,wBAAgB,qBAAqB,IAAI,gBAAgB,CAAC,WAAW,CAAC,CAErE;AAED,wBAAgB,mBAAmB,IAAI,cAAc,CACnD,eAAe,EACf,WAAW,CACZ,CAEA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
import { combineCodec, getEnumDecoder, getEnumEncoder, } from "@solana/kit";
|
|
9
|
+
export var AccountKind;
|
|
10
|
+
(function (AccountKind) {
|
|
11
|
+
AccountKind[AccountKind["BinArray"] = 0] = "BinArray";
|
|
12
|
+
})(AccountKind || (AccountKind = {}));
|
|
13
|
+
export function getAccountKindEncoder() {
|
|
14
|
+
return getEnumEncoder(AccountKind);
|
|
15
|
+
}
|
|
16
|
+
export function getAccountKindDecoder() {
|
|
17
|
+
return getEnumDecoder(AccountKind);
|
|
18
|
+
}
|
|
19
|
+
export function getAccountKindCodec() {
|
|
20
|
+
return combineCodec(getAccountKindEncoder(), getAccountKindDecoder());
|
|
21
|
+
}
|
|
@@ -5,9 +5,12 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @see https://github.com/codama-idl/codama
|
|
7
7
|
*/
|
|
8
|
+
export * from "./accountGroup";
|
|
9
|
+
export * from "./accountKind";
|
|
8
10
|
export * from "./bin";
|
|
9
11
|
export * from "./distributionMode";
|
|
10
12
|
export * from "./dynamicFeeConfig";
|
|
11
13
|
export * from "./dynamicFeeState";
|
|
12
14
|
export * from "./feeState";
|
|
15
|
+
export * from "./remainingAccountsScheme";
|
|
13
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/generated/types/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,OAAO,CAAC;AACtB,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/generated/types/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,OAAO,CAAC;AACtB,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,2BAA2B,CAAC"}
|
|
@@ -5,8 +5,11 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @see https://github.com/codama-idl/codama
|
|
7
7
|
*/
|
|
8
|
+
export * from "./accountGroup";
|
|
9
|
+
export * from "./accountKind";
|
|
8
10
|
export * from "./bin";
|
|
9
11
|
export * from "./distributionMode";
|
|
10
12
|
export * from "./dynamicFeeConfig";
|
|
11
13
|
export * from "./dynamicFeeState";
|
|
12
14
|
export * from "./feeState";
|
|
15
|
+
export * from "./remainingAccountsScheme";
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
import { type Codec, type Decoder, type Encoder } from "@solana/kit";
|
|
9
|
+
import { type AccountGroup, type AccountGroupArgs } from ".";
|
|
10
|
+
export type RemainingAccountsScheme = {
|
|
11
|
+
groups: Array<AccountGroup>;
|
|
12
|
+
};
|
|
13
|
+
export type RemainingAccountsSchemeArgs = {
|
|
14
|
+
groups: Array<AccountGroupArgs>;
|
|
15
|
+
};
|
|
16
|
+
export declare function getRemainingAccountsSchemeEncoder(): Encoder<RemainingAccountsSchemeArgs>;
|
|
17
|
+
export declare function getRemainingAccountsSchemeDecoder(): Decoder<RemainingAccountsScheme>;
|
|
18
|
+
export declare function getRemainingAccountsSchemeCodec(): Codec<RemainingAccountsSchemeArgs, RemainingAccountsScheme>;
|
|
19
|
+
//# sourceMappingURL=remainingAccountsScheme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remainingAccountsScheme.d.ts","sourceRoot":"","sources":["../../../src/generated/types/remainingAccountsScheme.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAML,KAAK,KAAK,EACV,KAAK,OAAO,EACZ,KAAK,OAAO,EACb,MAAM,aAAa,CAAC;AACrB,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACtB,MAAM,GAAG,CAAC;AAEX,MAAM,MAAM,uBAAuB,GAAG;IAAE,MAAM,EAAE,KAAK,CAAC,YAAY,CAAC,CAAA;CAAE,CAAC;AAEtE,MAAM,MAAM,2BAA2B,GAAG;IAAE,MAAM,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAA;CAAE,CAAC;AAE9E,wBAAgB,iCAAiC,IAAI,OAAO,CAAC,2BAA2B,CAAC,CAIxF;AAED,wBAAgB,iCAAiC,IAAI,OAAO,CAAC,uBAAuB,CAAC,CAIpF;AAED,wBAAgB,+BAA+B,IAAI,KAAK,CACtD,2BAA2B,EAC3B,uBAAuB,CACxB,CAKA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
import { combineCodec, getArrayDecoder, getArrayEncoder, getStructDecoder, getStructEncoder, } from "@solana/kit";
|
|
9
|
+
import { getAccountGroupDecoder, getAccountGroupEncoder, } from ".";
|
|
10
|
+
export function getRemainingAccountsSchemeEncoder() {
|
|
11
|
+
return getStructEncoder([
|
|
12
|
+
["groups", getArrayEncoder(getAccountGroupEncoder())],
|
|
13
|
+
]);
|
|
14
|
+
}
|
|
15
|
+
export function getRemainingAccountsSchemeDecoder() {
|
|
16
|
+
return getStructDecoder([
|
|
17
|
+
["groups", getArrayDecoder(getAccountGroupDecoder())],
|
|
18
|
+
]);
|
|
19
|
+
}
|
|
20
|
+
export function getRemainingAccountsSchemeCodec() {
|
|
21
|
+
return combineCodec(getRemainingAccountsSchemeEncoder(), getRemainingAccountsSchemeDecoder());
|
|
22
|
+
}
|