@whetstone-research/doppler-sdk 1.0.15 → 1.0.17
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/{chunk-TVBSIQIX.js → chunk-6TOPYGOG.js} +4 -3
- package/dist/chunk-6TOPYGOG.js.map +1 -0
- package/dist/{chunk-3BW6IVP3.cjs → chunk-AKLS6T3R.cjs} +4 -3
- package/dist/chunk-AKLS6T3R.cjs.map +1 -0
- package/dist/{chunk-NMTYI3TB.js → chunk-C2D7CIXP.js} +6 -4
- package/dist/{chunk-NMTYI3TB.js.map → chunk-C2D7CIXP.js.map} +1 -1
- package/dist/{chunk-W5TMS4RD.cjs → chunk-GUGN3EYX.cjs} +39 -37
- package/dist/{chunk-W5TMS4RD.cjs.map → chunk-GUGN3EYX.cjs.map} +1 -1
- package/dist/evm/index.cjs +4 -3
- package/dist/evm/index.cjs.map +1 -1
- package/dist/evm/index.js +4 -3
- package/dist/evm/index.js.map +1 -1
- package/dist/{oracle-DN8BrGPh.d.ts → oracle-7PmpwwPx.d.cts} +2 -0
- package/dist/{oracle-DN8BrGPh.d.cts → oracle-7PmpwwPx.d.ts} +2 -0
- package/dist/{pda-5D3GD5S6.js → pda-N6ULJYLG.js} +3 -3
- package/dist/pda-N6ULJYLG.js.map +1 -0
- package/dist/{pda-GNZYNRUH.cjs → pda-PZRHQJMK.cjs} +16 -16
- package/dist/pda-PZRHQJMK.cjs.map +1 -0
- package/dist/solana/index.cjs +2004 -450
- package/dist/solana/index.cjs.map +1 -1
- package/dist/solana/index.d.cts +1306 -511
- package/dist/solana/index.d.ts +1306 -511
- package/dist/solana/index.js +1847 -294
- package/dist/solana/index.js.map +1 -1
- package/dist/solana/react/index.cjs +47 -47
- package/dist/solana/react/index.d.cts +1 -1
- package/dist/solana/react/index.d.ts +1 -1
- package/dist/solana/react/index.js +3 -3
- package/package.json +1 -1
- package/dist/chunk-3BW6IVP3.cjs.map +0 -1
- package/dist/chunk-TVBSIQIX.js.map +0 -1
- package/dist/pda-5D3GD5S6.js.map +0 -1
- package/dist/pda-GNZYNRUH.cjs.map +0 -1
package/dist/solana/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { transferAdminArgsCodec, swapExactInArgsCodec, sortPositionsByShares, sortPoolsByReserves, setRouteArgsCodec, setHookArgsCodec, setFeesArgsCodec, removeLiquidityArgsCodec, ratioToNumber, quoteToNumeraireArgsCodec, q64ToNumber, q64Mul, q64Div, positionDataCodec, poolExists, poolDataCodec, oracleStateDataCodec, oracleConsultArgsCodec, observationCodec, numberToQ64, minBigInt, maxBigInt, isqrt, isOracleStale, initializePoolArgsCodec, initializeOracleArgsCodec, initializeConfigArgsCodec, getTvl, getSwapQuoteExactOut, getSwapQuote, getSpotPrice1, getSpotPrice0, getRemoveLiquidityQuote, getPositionValue, getPositionAddressFromParams, getPoolByMints, getPoolAddressFromMints, getPendingFees, getOracleSpotPrices, getOracleForPool, getOracleDeviation, getOracleBufferStats, getOracleAge, getOracleAddressFromPool, getK, getAddLiquidityQuote, filterPoolsByMint, filterActivePositions, fetchUserPositions, fetchPositionsBatch, fetchPositionByParams, fetchPosition, fetchPoolsBatch, fetchPoolPositions, fetchPool, fetchOraclesBatch, fetchOracle, fetchAllPools, encodeTransferAdminArgs, encodeSwapExactInArgs, encodeSetRouteArgs, encodeSetHookArgs, encodeSetFeesArgs, encodeRemoveLiquidityArgs, encodeQuoteToNumeraireArgs, encodeOracleConsultArgs, encodeInstructionData, encodeInitializePoolArgs, encodeInitializeOracleArgs, encodeInitializeConfigArgs, encodeCreatePositionArgs, encodeCollectProtocolFeesArgs, encodeCollectFeesArgs, encodeAddLiquidityArgs, decodePosition, decodePool, decodeOracleState, decodeAmmConfig, createPositionArgsCodec, consultTwap, computePrice1Q64, computePrice0Q64, comparePoolAndOraclePrices, collectProtocolFeesArgsCodec, collectFeesArgsCodec, ceilDiv, calculateTwapNumber, calculateTwap, calculateAccruedFees, ammConfigDataCodec, addLiquidityArgsCodec } from '../chunk-
|
|
2
|
-
import { sortMints, getSwapAddresses, getProtocolFeePositionAddress, getPositionAddress, getPoolVault1Address, getPoolVault0Address, getPoolInitAddresses, getPoolAuthorityAddress, getPoolAddress, getOracleAddress, getLiquidityAddresses, getConfigAddress, CPMM_PROGRAM_ID, areMintsOrdered, TOKEN_METADATA_PROGRAM_ID, SEED_PROTOCOL_FEE_POSITION, SEED_POSITION, SEED_POOL, SEED_ORACLE, SEED_CONFIG, SEED_AUTHORITY, Q64_ONE, MAX_ORACLE_OBSERVATIONS, MAX_HOOK_ALLOWLIST, INSTRUCTION_DISCRIMINATORS, HOOK_NO_CHANGE, HF_REQUIRE_ORACLE, HF_FORWARD_READONLY_SIGNERS, HF_BEFORE_SWAP, HF_BEFORE_REMOVE_LIQ, HF_BEFORE_ADD_LIQ, HF_AFTER_SWAP, HF_AFTER_REMOVE_LIQ, HF_AFTER_ADD_LIQ, BPS_DENOM, ACCOUNT_VERSION, ACCOUNT_DISCRIMINATORS, TOKEN_PROGRAM_ADDRESS, SYSTEM_PROGRAM_ADDRESS } from '../chunk-
|
|
1
|
+
import { transferAdminArgsCodec, swapExactInArgsCodec, sortPositionsByShares, sortPoolsByReserves, setRouteArgsCodec, setHookArgsCodec, setFeesArgsCodec, removeLiquidityArgsCodec, ratioToNumber, quoteToNumeraireArgsCodec, q64ToNumber, q64Mul, q64Div, positionDataCodec, poolExists, poolDataCodec, oracleStateDataCodec, oracleConsultArgsCodec, observationCodec, numberToQ64, minBigInt, maxBigInt, isqrt, isOracleStale, initializePoolArgsCodec, initializeOracleArgsCodec, initializeConfigArgsCodec, getTvl, getSwapQuoteExactOut, getSwapQuote, getSpotPrice1, getSpotPrice0, getRemoveLiquidityQuote, getPositionValue, getPositionAddressFromParams, getPoolByMints, getPoolAddressFromMints, getPendingFees, getOracleSpotPrices, getOracleForPool, getOracleDeviation, getOracleBufferStats, getOracleAge, getOracleAddressFromPool, getK, getAddLiquidityQuote, filterPoolsByMint, filterActivePositions, fetchUserPositions, fetchPositionsBatch, fetchPositionByParams, fetchPosition, fetchPoolsBatch, fetchPoolPositions, fetchPool, fetchOraclesBatch, fetchOracle, fetchAllPools, encodeTransferAdminArgs, encodeSwapExactInArgs, encodeSetRouteArgs, encodeSetHookArgs, encodeSetFeesArgs, encodeRemoveLiquidityArgs, encodeQuoteToNumeraireArgs, encodeOracleConsultArgs, encodeInstructionData, encodeInitializePoolArgs, encodeInitializeOracleArgs, encodeInitializeConfigArgs, encodeCreatePositionArgs, encodeCollectProtocolFeesArgs, encodeCollectFeesArgs, encodeAddLiquidityArgs, decodePosition, decodePool, decodeOracleState, decodeAmmConfig, createPositionArgsCodec, consultTwap, computePrice1Q64, computePrice0Q64, comparePoolAndOraclePrices, collectProtocolFeesArgsCodec, collectFeesArgsCodec, ceilDiv, calculateTwapNumber, calculateTwap, calculateAccruedFees, ammConfigDataCodec, addLiquidityArgsCodec } from '../chunk-C2D7CIXP.js';
|
|
2
|
+
import { sortMints, getSwapAddresses, getProtocolFeePositionAddress, getPositionAddress, getPoolVault1Address, getPoolVault0Address, getPoolInitAddresses, getPoolAuthorityAddress, getPoolAddress, getOracleAddress, getLiquidityAddresses, getConfigAddress, CPMM_PROGRAM_ID, areMintsOrdered, TOKEN_METADATA_PROGRAM_ID, SEED_PROTOCOL_FEE_POSITION, SEED_POSITION, SEED_POOL, SEED_ORACLE, SEED_CONFIG, SEED_AUTHORITY, Q64_ONE, MAX_ORACLE_OBSERVATIONS, MAX_HOOK_ALLOWLIST, INSTRUCTION_DISCRIMINATORS, HOOK_NO_CHANGE, HF_REQUIRE_ORACLE, HF_FORWARD_READONLY_SIGNERS, HF_BEFORE_SWAP, HF_BEFORE_REMOVE_LIQ, HF_BEFORE_ADD_LIQ, HF_AFTER_SWAP, HF_AFTER_REMOVE_LIQ, HF_AFTER_ADD_LIQ, BPS_DENOM, ACCOUNT_VERSION, ACCOUNT_DISCRIMINATORS, TOKEN_PROGRAM_ADDRESS, SYSTEM_PROGRAM_ADDRESS } from '../chunk-6TOPYGOG.js';
|
|
3
3
|
import { __export } from '../chunk-PZ5AY32C.js';
|
|
4
|
-
import { getAddressCodec, getProgramDerivedAddress, fixEncoderSize, getBytesEncoder, transformEncoder, getStructEncoder, getU64Encoder, getU128Encoder, getBooleanEncoder, getStructDecoder, fixDecoderSize, getU64Decoder, getU128Decoder, getBooleanDecoder, getBytesDecoder, combineCodec, getAddressEncoder, SolanaError, SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, getU16Encoder, getU8Encoder, getArrayEncoder, getAddressDecoder, getU16Decoder, getU8Decoder, getArrayDecoder, getU32Encoder, getU32Decoder, getOptionEncoder, getOptionDecoder, createNoopSigner,
|
|
4
|
+
import { getAddressCodec, getProgramDerivedAddress, fixEncoderSize, getBytesEncoder, transformEncoder, getStructEncoder, getU64Encoder, getU128Encoder, getBooleanEncoder, getStructDecoder, fixDecoderSize, getU64Decoder, getU128Decoder, getBooleanDecoder, getBytesDecoder, combineCodec, getAddressEncoder, SolanaError, SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, getU16Encoder, getU8Encoder, getArrayEncoder, getAddressDecoder, getU16Decoder, getU8Decoder, getArrayDecoder, getU32Encoder, getU32Decoder, getOptionEncoder, getOptionDecoder, createNoopSigner, decodeAccount, assertAccountExists, fetchEncodedAccount, assertAccountsExist, fetchEncodedAccounts, containsBytes, SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_ACCOUNT, SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION, SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE, assertIsInstructionWithAccounts, isProgramError, address, addEncoderSizePrefix, getUtf8Encoder, addDecoderSizePrefix, getUtf8Decoder, AccountRole, getStructCodec, getU64Codec, compressTransactionMessageUsingAddressLookupTables, mergeBytes } from '@solana/kit';
|
|
5
5
|
import { getAddressFromResolvedInstructionAccount, getAccountMetaFactory, getNonNullResolvedInstructionInput, addSelfPlanAndSendFunctions, addSelfFetchFunctions } from '@solana/program-client-core';
|
|
6
6
|
import { keccak_256 } from '@noble/hashes/sha3.js';
|
|
7
7
|
import { findAddressLookupTablePda, getCreateLookupTableInstruction, getExtendLookupTableInstruction } from '@solana-program/address-lookup-table';
|
|
@@ -1714,7 +1714,9 @@ function getInitializePoolInstructionDataEncoder() {
|
|
|
1714
1714
|
["initialSwapFeeBps", getU16Encoder()],
|
|
1715
1715
|
["initialFeeSplitBps", getU16Encoder()],
|
|
1716
1716
|
["liquidityMeasureTokenIndex", getU8Encoder()],
|
|
1717
|
-
["numeraireMintOverride", getOptionEncoder(getAddressEncoder())]
|
|
1717
|
+
["numeraireMintOverride", getOptionEncoder(getAddressEncoder())],
|
|
1718
|
+
["hookProgram", getAddressEncoder()],
|
|
1719
|
+
["hookFlags", getU32Encoder()]
|
|
1718
1720
|
]),
|
|
1719
1721
|
(value) => ({ ...value, discriminator: INITIALIZE_POOL_DISCRIMINATOR })
|
|
1720
1722
|
);
|
|
@@ -1727,7 +1729,9 @@ function getInitializePoolInstructionDataDecoder() {
|
|
|
1727
1729
|
["initialSwapFeeBps", getU16Decoder()],
|
|
1728
1730
|
["initialFeeSplitBps", getU16Decoder()],
|
|
1729
1731
|
["liquidityMeasureTokenIndex", getU8Decoder()],
|
|
1730
|
-
["numeraireMintOverride", getOptionDecoder(getAddressDecoder())]
|
|
1732
|
+
["numeraireMintOverride", getOptionDecoder(getAddressDecoder())],
|
|
1733
|
+
["hookProgram", getAddressDecoder()],
|
|
1734
|
+
["hookFlags", getU32Decoder()]
|
|
1731
1735
|
]);
|
|
1732
1736
|
}
|
|
1733
1737
|
function getInitializePoolInstructionDataCodec() {
|
|
@@ -3601,296 +3605,1281 @@ async function fetchConfigWithAddress(rpc, programId = CPMM_PROGRAM_ID, commitme
|
|
|
3601
3605
|
return { address: configAddress, account };
|
|
3602
3606
|
}
|
|
3603
3607
|
|
|
3604
|
-
// src/solana/
|
|
3605
|
-
var
|
|
3606
|
-
__export(
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
decodePreviewMigrationResult: () => decodePreviewMigrationResult,
|
|
3647
|
-
decodePreviewSwapExactInResult: () => decodePreviewSwapExactInResult,
|
|
3648
|
-
encodeU64LE: () => encodeU64LE,
|
|
3649
|
-
fetchAllLaunches: () => fetchAllLaunches,
|
|
3650
|
-
fetchLaunch: () => fetchLaunch2,
|
|
3651
|
-
fetchLaunchesByAuthority: () => fetchLaunchesByAuthority,
|
|
3652
|
-
getConfigAddress: () => getConfigAddress2,
|
|
3653
|
-
getInitConfigCodec: () => getInitConfigCodec,
|
|
3654
|
-
getInitConfigDecoder: () => getInitConfigDecoder,
|
|
3655
|
-
getInitConfigEncoder: () => getInitConfigEncoder,
|
|
3608
|
+
// src/solana/cosignerHook/index.ts
|
|
3609
|
+
var cosignerHook_exports = {};
|
|
3610
|
+
__export(cosignerHook_exports, {
|
|
3611
|
+
ADD_COSIGNER_DISCRIMINATOR: () => ADD_COSIGNER_DISCRIMINATOR,
|
|
3612
|
+
COSIGNER_CONFIG_DISCRIMINATOR: () => COSIGNER_CONFIG_DISCRIMINATOR,
|
|
3613
|
+
COSIGNER_HOOK_ERROR__COSIGNER_ALREADY_EXISTS: () => COSIGNER_HOOK_ERROR__COSIGNER_ALREADY_EXISTS,
|
|
3614
|
+
COSIGNER_HOOK_ERROR__COSIGNER_LIST_FULL: () => COSIGNER_HOOK_ERROR__COSIGNER_LIST_FULL,
|
|
3615
|
+
COSIGNER_HOOK_ERROR__COSIGNER_NOT_FOUND: () => COSIGNER_HOOK_ERROR__COSIGNER_NOT_FOUND,
|
|
3616
|
+
COSIGNER_HOOK_ERROR__INVALID_AUTHORITY: () => COSIGNER_HOOK_ERROR__INVALID_AUTHORITY,
|
|
3617
|
+
COSIGNER_HOOK_ERROR__INVALID_CONFIG: () => COSIGNER_HOOK_ERROR__INVALID_CONFIG,
|
|
3618
|
+
COSIGNER_HOOK_ERROR__INVALID_COSIGNER: () => COSIGNER_HOOK_ERROR__INVALID_COSIGNER,
|
|
3619
|
+
COSIGNER_HOOK_PROGRAM_ADDRESS: () => COSIGNER_HOOK_PROGRAM_ADDRESS,
|
|
3620
|
+
COSIGNER_HOOK_PROGRAM_ID: () => COSIGNER_HOOK_PROGRAM_ID,
|
|
3621
|
+
CosignerHookAccount: () => CosignerHookAccount,
|
|
3622
|
+
CosignerHookInstruction: () => CosignerHookInstruction,
|
|
3623
|
+
INITIALIZE_CONFIG_DISCRIMINATOR: () => INITIALIZE_CONFIG_DISCRIMINATOR2,
|
|
3624
|
+
MAX_COSIGNERS: () => MAX_COSIGNERS,
|
|
3625
|
+
REMOVE_COSIGNER_DISCRIMINATOR: () => REMOVE_COSIGNER_DISCRIMINATOR,
|
|
3626
|
+
SEED_COSIGNER_HOOK_CONFIG: () => SEED_COSIGNER_HOOK_CONFIG,
|
|
3627
|
+
SET_AUTHORITY_DISCRIMINATOR: () => SET_AUTHORITY_DISCRIMINATOR,
|
|
3628
|
+
cosignerHookProgram: () => cosignerHookProgram,
|
|
3629
|
+
decodeCosignerConfig: () => decodeCosignerConfig,
|
|
3630
|
+
fetchAllCosignerConfig: () => fetchAllCosignerConfig,
|
|
3631
|
+
fetchAllMaybeCosignerConfig: () => fetchAllMaybeCosignerConfig,
|
|
3632
|
+
fetchCosignerConfig: () => fetchCosignerConfig,
|
|
3633
|
+
fetchMaybeCosignerConfig: () => fetchMaybeCosignerConfig,
|
|
3634
|
+
getAddCosignerDiscriminatorBytes: () => getAddCosignerDiscriminatorBytes,
|
|
3635
|
+
getAddCosignerInstruction: () => getAddCosignerInstruction,
|
|
3636
|
+
getAddCosignerInstructionAsync: () => getAddCosignerInstructionAsync,
|
|
3637
|
+
getAddCosignerInstructionDataCodec: () => getAddCosignerInstructionDataCodec,
|
|
3638
|
+
getAddCosignerInstructionDataDecoder: () => getAddCosignerInstructionDataDecoder,
|
|
3639
|
+
getAddCosignerInstructionDataEncoder: () => getAddCosignerInstructionDataEncoder,
|
|
3640
|
+
getCosignerArgCodec: () => getCosignerArgCodec,
|
|
3641
|
+
getCosignerArgDecoder: () => getCosignerArgDecoder,
|
|
3642
|
+
getCosignerArgEncoder: () => getCosignerArgEncoder,
|
|
3643
|
+
getCosignerConfigCodec: () => getCosignerConfigCodec,
|
|
3644
|
+
getCosignerConfigDecoder: () => getCosignerConfigDecoder,
|
|
3645
|
+
getCosignerConfigDiscriminatorBytes: () => getCosignerConfigDiscriminatorBytes,
|
|
3646
|
+
getCosignerConfigEncoder: () => getCosignerConfigEncoder,
|
|
3647
|
+
getCosignerConfigSize: () => getCosignerConfigSize,
|
|
3648
|
+
getCosignerHookConfigAddress: () => getCosignerHookConfigAddress,
|
|
3649
|
+
getCosignerHookErrorMessage: () => getCosignerHookErrorMessage,
|
|
3656
3650
|
getInitializeConfigArgsCodec: () => getInitializeConfigArgsCodec,
|
|
3657
3651
|
getInitializeConfigArgsDecoder: () => getInitializeConfigArgsDecoder,
|
|
3658
3652
|
getInitializeConfigArgsEncoder: () => getInitializeConfigArgsEncoder,
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3653
|
+
getInitializeConfigDiscriminatorBytes: () => getInitializeConfigDiscriminatorBytes2,
|
|
3654
|
+
getInitializeConfigInstruction: () => getInitializeConfigInstruction2,
|
|
3655
|
+
getInitializeConfigInstructionAsync: () => getInitializeConfigInstructionAsync2,
|
|
3656
|
+
getInitializeConfigInstructionDataCodec: () => getInitializeConfigInstructionDataCodec2,
|
|
3657
|
+
getInitializeConfigInstructionDataDecoder: () => getInitializeConfigInstructionDataDecoder2,
|
|
3658
|
+
getInitializeConfigInstructionDataEncoder: () => getInitializeConfigInstructionDataEncoder2,
|
|
3659
|
+
getRemoveCosignerDiscriminatorBytes: () => getRemoveCosignerDiscriminatorBytes,
|
|
3660
|
+
getRemoveCosignerInstruction: () => getRemoveCosignerInstruction,
|
|
3661
|
+
getRemoveCosignerInstructionAsync: () => getRemoveCosignerInstructionAsync,
|
|
3662
|
+
getRemoveCosignerInstructionDataCodec: () => getRemoveCosignerInstructionDataCodec,
|
|
3663
|
+
getRemoveCosignerInstructionDataDecoder: () => getRemoveCosignerInstructionDataDecoder,
|
|
3664
|
+
getRemoveCosignerInstructionDataEncoder: () => getRemoveCosignerInstructionDataEncoder,
|
|
3665
|
+
getSetAuthorityArgsCodec: () => getSetAuthorityArgsCodec,
|
|
3666
|
+
getSetAuthorityArgsDecoder: () => getSetAuthorityArgsDecoder,
|
|
3667
|
+
getSetAuthorityArgsEncoder: () => getSetAuthorityArgsEncoder,
|
|
3668
|
+
getSetAuthorityDiscriminatorBytes: () => getSetAuthorityDiscriminatorBytes,
|
|
3669
|
+
getSetAuthorityInstruction: () => getSetAuthorityInstruction,
|
|
3670
|
+
getSetAuthorityInstructionAsync: () => getSetAuthorityInstructionAsync,
|
|
3671
|
+
getSetAuthorityInstructionDataCodec: () => getSetAuthorityInstructionDataCodec,
|
|
3672
|
+
getSetAuthorityInstructionDataDecoder: () => getSetAuthorityInstructionDataDecoder,
|
|
3673
|
+
getSetAuthorityInstructionDataEncoder: () => getSetAuthorityInstructionDataEncoder,
|
|
3674
|
+
identifyCosignerHookAccount: () => identifyCosignerHookAccount,
|
|
3675
|
+
identifyCosignerHookInstruction: () => identifyCosignerHookInstruction,
|
|
3676
|
+
isCosignerHookError: () => isCosignerHookError,
|
|
3677
|
+
parseAddCosignerInstruction: () => parseAddCosignerInstruction,
|
|
3678
|
+
parseCosignerHookInstruction: () => parseCosignerHookInstruction,
|
|
3679
|
+
parseInitializeConfigInstruction: () => parseInitializeConfigInstruction2,
|
|
3680
|
+
parseRemoveCosignerInstruction: () => parseRemoveCosignerInstruction,
|
|
3681
|
+
parseSetAuthorityInstruction: () => parseSetAuthorityInstruction
|
|
3673
3682
|
});
|
|
3674
|
-
var
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
var BPF_LOADER_UPGRADEABLE_PROGRAM_ID = address(
|
|
3678
|
-
"BPFLoaderUpgradeab1e11111111111111111111111"
|
|
3679
|
-
);
|
|
3680
|
-
var CPMM_HOOK_PROGRAM_ID = address(
|
|
3681
|
-
"2vJ1c62knEwZbxp3XdHB4RSmCfz55pA6tRkCho63gW7u"
|
|
3682
|
-
);
|
|
3683
|
-
var PREDICTION_HOOK_PROGRAM_ID = address(
|
|
3684
|
-
"7QcQDANJVC17Jgc6KjjeagSkm2zAphgHVPK5agJzyihB"
|
|
3685
|
-
);
|
|
3686
|
-
var SEED_CONFIG2 = "config";
|
|
3687
|
-
var SEED_LAUNCH = "launch";
|
|
3688
|
-
var SEED_LAUNCH_AUTHORITY = "launch_authority";
|
|
3689
|
-
var EMPTY_REMAINING_ACCOUNTS_HASH = new Uint8Array([
|
|
3690
|
-
232,
|
|
3691
|
-
231,
|
|
3692
|
-
118,
|
|
3693
|
-
38,
|
|
3694
|
-
88,
|
|
3695
|
-
111,
|
|
3696
|
-
115,
|
|
3697
|
-
185,
|
|
3698
|
-
85,
|
|
3699
|
-
54,
|
|
3700
|
-
76,
|
|
3701
|
-
123,
|
|
3702
|
-
75,
|
|
3703
|
-
191,
|
|
3704
|
-
11,
|
|
3705
|
-
183,
|
|
3706
|
-
247,
|
|
3707
|
-
104,
|
|
3708
|
-
94,
|
|
3709
|
-
189,
|
|
3710
|
-
64,
|
|
3711
|
-
232,
|
|
3712
|
-
82,
|
|
3683
|
+
var COSIGNER_CONFIG_DISCRIMINATOR = new Uint8Array([
|
|
3684
|
+
133,
|
|
3685
|
+
227,
|
|
3713
3686
|
177,
|
|
3714
|
-
100,
|
|
3715
|
-
99,
|
|
3716
|
-
58,
|
|
3717
3687
|
74,
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
]);
|
|
3723
|
-
var MAX_MIGRATOR_ALLOWLIST = 32;
|
|
3724
|
-
var MAX_HOOK_ALLOWLIST2 = 32;
|
|
3725
|
-
var MAX_PAYLOAD = 256;
|
|
3726
|
-
var PHASE_TRADING = 0;
|
|
3727
|
-
var PHASE_MIGRATED = 1;
|
|
3728
|
-
var PHASE_ABORTED = 2;
|
|
3729
|
-
var TRADE_DIRECTION_BUY = 0;
|
|
3730
|
-
var TRADE_DIRECTION_SELL = 1;
|
|
3731
|
-
var CURVE_KIND_XYK = 0;
|
|
3732
|
-
var CURVE_PARAMS_FORMAT_XYK_V0 = 0;
|
|
3733
|
-
var HF_BEFORE_SWAP2 = 1 << 0;
|
|
3734
|
-
var HF_AFTER_SWAP2 = 1 << 1;
|
|
3735
|
-
var HF_BEFORE_CREATE = 1 << 2;
|
|
3736
|
-
var HF_AFTER_CREATE = 1 << 3;
|
|
3737
|
-
var HF_BEFORE_MIGRATE = 1 << 4;
|
|
3738
|
-
var HF_AFTER_MIGRATE = 1 << 5;
|
|
3739
|
-
var HOOK_NO_CHANGE2 = 65535;
|
|
3740
|
-
var INITIALIZER_INSTRUCTION_DISCRIMINATORS = {
|
|
3741
|
-
// SHA256("global:initialize_config")[0:8]
|
|
3742
|
-
initializeConfig: new Uint8Array([
|
|
3743
|
-
208,
|
|
3744
|
-
127,
|
|
3745
|
-
21,
|
|
3746
|
-
1,
|
|
3747
|
-
194,
|
|
3748
|
-
190,
|
|
3749
|
-
196,
|
|
3750
|
-
70
|
|
3751
|
-
]),
|
|
3752
|
-
// SHA256("global:set_migrator_allowlist")[0:8]
|
|
3753
|
-
setMigratorAllowlist: new Uint8Array([
|
|
3754
|
-
209,
|
|
3755
|
-
90,
|
|
3756
|
-
181,
|
|
3757
|
-
104,
|
|
3758
|
-
99,
|
|
3759
|
-
108,
|
|
3760
|
-
233,
|
|
3761
|
-
168
|
|
3762
|
-
]),
|
|
3763
|
-
// SHA256("global:set_hook_allowlist")[0:8]
|
|
3764
|
-
setHookAllowlist: new Uint8Array([
|
|
3765
|
-
232,
|
|
3766
|
-
28,
|
|
3767
|
-
40,
|
|
3768
|
-
143,
|
|
3769
|
-
121,
|
|
3770
|
-
182,
|
|
3771
|
-
77,
|
|
3772
|
-
103
|
|
3773
|
-
]),
|
|
3774
|
-
// SHA256("global:initialize_launch")[0:8]
|
|
3775
|
-
initializeLaunch: new Uint8Array([
|
|
3776
|
-
90,
|
|
3777
|
-
201,
|
|
3778
|
-
220,
|
|
3779
|
-
142,
|
|
3780
|
-
112,
|
|
3781
|
-
253,
|
|
3782
|
-
100,
|
|
3783
|
-
13
|
|
3784
|
-
]),
|
|
3785
|
-
// SHA256("global:curve_swap_exact_in")[0:8]
|
|
3786
|
-
curveSwapExactIn: new Uint8Array([
|
|
3787
|
-
196,
|
|
3788
|
-
247,
|
|
3789
|
-
195,
|
|
3790
|
-
126,
|
|
3791
|
-
227,
|
|
3792
|
-
27,
|
|
3793
|
-
166,
|
|
3794
|
-
93
|
|
3795
|
-
]),
|
|
3796
|
-
// SHA256("global:migrate_launch")[0:8]
|
|
3797
|
-
migrateLaunch: new Uint8Array([
|
|
3798
|
-
19,
|
|
3799
|
-
199,
|
|
3800
|
-
119,
|
|
3801
|
-
103,
|
|
3802
|
-
13,
|
|
3803
|
-
30,
|
|
3804
|
-
12,
|
|
3805
|
-
205
|
|
3806
|
-
]),
|
|
3807
|
-
// SHA256("global:preview_swap_exact_in")[0:8]
|
|
3808
|
-
previewSwapExactIn: new Uint8Array([
|
|
3809
|
-
50,
|
|
3810
|
-
130,
|
|
3811
|
-
31,
|
|
3812
|
-
69,
|
|
3813
|
-
147,
|
|
3814
|
-
58,
|
|
3815
|
-
222,
|
|
3816
|
-
178
|
|
3817
|
-
]),
|
|
3818
|
-
// SHA256("global:preview_migration")[0:8]
|
|
3819
|
-
previewMigration: new Uint8Array([
|
|
3820
|
-
216,
|
|
3821
|
-
180,
|
|
3822
|
-
209,
|
|
3823
|
-
112,
|
|
3824
|
-
62,
|
|
3825
|
-
16,
|
|
3826
|
-
15,
|
|
3827
|
-
63
|
|
3828
|
-
])
|
|
3829
|
-
};
|
|
3830
|
-
var INITIALIZER_ACCOUNT_DISCRIMINATORS = {
|
|
3831
|
-
// SHA256("account:InitConfig")[0:8]
|
|
3832
|
-
InitConfig: new Uint8Array([97, 166, 35, 7, 20, 2, 164, 126]),
|
|
3833
|
-
// SHA256("account:Launch")[0:8]
|
|
3834
|
-
Launch: new Uint8Array([144, 51, 51, 163, 206, 85, 213, 38])
|
|
3835
|
-
};
|
|
3836
|
-
var INIT_CONFIG_DISCRIMINATOR = new Uint8Array([
|
|
3837
|
-
97,
|
|
3838
|
-
166,
|
|
3839
|
-
35,
|
|
3840
|
-
7,
|
|
3841
|
-
20,
|
|
3842
|
-
2,
|
|
3843
|
-
164,
|
|
3844
|
-
126
|
|
3688
|
+
145,
|
|
3689
|
+
74,
|
|
3690
|
+
247,
|
|
3691
|
+
183
|
|
3845
3692
|
]);
|
|
3846
|
-
function
|
|
3693
|
+
function getCosignerConfigDiscriminatorBytes() {
|
|
3694
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
3695
|
+
COSIGNER_CONFIG_DISCRIMINATOR
|
|
3696
|
+
);
|
|
3697
|
+
}
|
|
3698
|
+
function getCosignerConfigEncoder() {
|
|
3847
3699
|
return transformEncoder(
|
|
3848
3700
|
getStructEncoder([
|
|
3849
3701
|
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
3850
|
-
["
|
|
3851
|
-
["
|
|
3852
|
-
["migratorAllowlist", getArrayEncoder(getAddressEncoder(), { size: 32 })],
|
|
3853
|
-
["hookAllowlistLen", getU8Encoder()],
|
|
3854
|
-
["hookAllowlist", getArrayEncoder(getAddressEncoder(), { size: 32 })],
|
|
3702
|
+
["adminAuthority", getAddressEncoder()],
|
|
3703
|
+
["cosignerCount", getU8Encoder()],
|
|
3855
3704
|
["bump", getU8Encoder()],
|
|
3856
3705
|
["version", getU8Encoder()],
|
|
3857
|
-
["reserved", fixEncoderSize(getBytesEncoder(),
|
|
3706
|
+
["reserved", fixEncoderSize(getBytesEncoder(), 37)],
|
|
3707
|
+
["cosigners", getArrayEncoder(getAddressEncoder(), { size: 32 })]
|
|
3858
3708
|
]),
|
|
3859
|
-
(value) => ({ ...value, discriminator:
|
|
3709
|
+
(value) => ({ ...value, discriminator: COSIGNER_CONFIG_DISCRIMINATOR })
|
|
3860
3710
|
);
|
|
3861
3711
|
}
|
|
3862
|
-
function
|
|
3712
|
+
function getCosignerConfigDecoder() {
|
|
3863
3713
|
return getStructDecoder([
|
|
3864
3714
|
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
3865
|
-
["
|
|
3866
|
-
["
|
|
3867
|
-
["
|
|
3715
|
+
["adminAuthority", getAddressDecoder()],
|
|
3716
|
+
["cosignerCount", getU8Decoder()],
|
|
3717
|
+
["bump", getU8Decoder()],
|
|
3718
|
+
["version", getU8Decoder()],
|
|
3719
|
+
["reserved", fixDecoderSize(getBytesDecoder(), 37)],
|
|
3720
|
+
["cosigners", getArrayDecoder(getAddressDecoder(), { size: 32 })]
|
|
3721
|
+
]);
|
|
3722
|
+
}
|
|
3723
|
+
function getCosignerConfigCodec() {
|
|
3724
|
+
return combineCodec(getCosignerConfigEncoder(), getCosignerConfigDecoder());
|
|
3725
|
+
}
|
|
3726
|
+
function decodeCosignerConfig(encodedAccount) {
|
|
3727
|
+
return decodeAccount(
|
|
3728
|
+
encodedAccount,
|
|
3729
|
+
getCosignerConfigDecoder()
|
|
3730
|
+
);
|
|
3731
|
+
}
|
|
3732
|
+
async function fetchCosignerConfig(rpc, address3, config) {
|
|
3733
|
+
const maybeAccount = await fetchMaybeCosignerConfig(rpc, address3, config);
|
|
3734
|
+
assertAccountExists(maybeAccount);
|
|
3735
|
+
return maybeAccount;
|
|
3736
|
+
}
|
|
3737
|
+
async function fetchMaybeCosignerConfig(rpc, address3, config) {
|
|
3738
|
+
const maybeAccount = await fetchEncodedAccount(rpc, address3, config);
|
|
3739
|
+
return decodeCosignerConfig(maybeAccount);
|
|
3740
|
+
}
|
|
3741
|
+
async function fetchAllCosignerConfig(rpc, addresses, config) {
|
|
3742
|
+
const maybeAccounts = await fetchAllMaybeCosignerConfig(
|
|
3743
|
+
rpc,
|
|
3744
|
+
addresses,
|
|
3745
|
+
config
|
|
3746
|
+
);
|
|
3747
|
+
assertAccountsExist(maybeAccounts);
|
|
3748
|
+
return maybeAccounts;
|
|
3749
|
+
}
|
|
3750
|
+
async function fetchAllMaybeCosignerConfig(rpc, addresses, config) {
|
|
3751
|
+
const maybeAccounts = await fetchEncodedAccounts(rpc, addresses, config);
|
|
3752
|
+
return maybeAccounts.map(
|
|
3753
|
+
(maybeAccount) => decodeCosignerConfig(maybeAccount)
|
|
3754
|
+
);
|
|
3755
|
+
}
|
|
3756
|
+
function getCosignerConfigSize() {
|
|
3757
|
+
return 1104;
|
|
3758
|
+
}
|
|
3759
|
+
var ADD_COSIGNER_DISCRIMINATOR = new Uint8Array([
|
|
3760
|
+
17,
|
|
3761
|
+
34,
|
|
3762
|
+
183,
|
|
3763
|
+
119,
|
|
3764
|
+
202,
|
|
3765
|
+
255,
|
|
3766
|
+
218,
|
|
3767
|
+
233
|
|
3768
|
+
]);
|
|
3769
|
+
function getAddCosignerDiscriminatorBytes() {
|
|
3770
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
3771
|
+
ADD_COSIGNER_DISCRIMINATOR
|
|
3772
|
+
);
|
|
3773
|
+
}
|
|
3774
|
+
function getAddCosignerInstructionDataEncoder() {
|
|
3775
|
+
return transformEncoder(
|
|
3776
|
+
getStructEncoder([
|
|
3777
|
+
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
3778
|
+
["cosigner", getAddressEncoder()]
|
|
3779
|
+
]),
|
|
3780
|
+
(value) => ({ ...value, discriminator: ADD_COSIGNER_DISCRIMINATOR })
|
|
3781
|
+
);
|
|
3782
|
+
}
|
|
3783
|
+
function getAddCosignerInstructionDataDecoder() {
|
|
3784
|
+
return getStructDecoder([
|
|
3785
|
+
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
3786
|
+
["cosigner", getAddressDecoder()]
|
|
3787
|
+
]);
|
|
3788
|
+
}
|
|
3789
|
+
function getAddCosignerInstructionDataCodec() {
|
|
3790
|
+
return combineCodec(
|
|
3791
|
+
getAddCosignerInstructionDataEncoder(),
|
|
3792
|
+
getAddCosignerInstructionDataDecoder()
|
|
3793
|
+
);
|
|
3794
|
+
}
|
|
3795
|
+
async function getAddCosignerInstructionAsync(input, config) {
|
|
3796
|
+
const programAddress = config?.programAddress ?? COSIGNER_HOOK_PROGRAM_ADDRESS;
|
|
3797
|
+
const originalAccounts = {
|
|
3798
|
+
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
3799
|
+
config: { value: input.config ?? null, isWritable: true }
|
|
3800
|
+
};
|
|
3801
|
+
const accounts = originalAccounts;
|
|
3802
|
+
const args = { ...input };
|
|
3803
|
+
if (!accounts.config.value) {
|
|
3804
|
+
accounts.config.value = await getProgramDerivedAddress({
|
|
3805
|
+
programAddress,
|
|
3806
|
+
seeds: [
|
|
3807
|
+
getBytesEncoder().encode(
|
|
3808
|
+
new Uint8Array([
|
|
3809
|
+
99,
|
|
3810
|
+
111,
|
|
3811
|
+
115,
|
|
3812
|
+
105,
|
|
3813
|
+
103,
|
|
3814
|
+
110,
|
|
3815
|
+
101,
|
|
3816
|
+
114,
|
|
3817
|
+
95,
|
|
3818
|
+
104,
|
|
3819
|
+
111,
|
|
3820
|
+
111,
|
|
3821
|
+
107,
|
|
3822
|
+
95,
|
|
3823
|
+
99,
|
|
3824
|
+
111,
|
|
3825
|
+
110,
|
|
3826
|
+
102,
|
|
3827
|
+
105,
|
|
3828
|
+
103
|
|
3829
|
+
])
|
|
3830
|
+
)
|
|
3831
|
+
]
|
|
3832
|
+
});
|
|
3833
|
+
}
|
|
3834
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
3835
|
+
return Object.freeze({
|
|
3836
|
+
accounts: [
|
|
3837
|
+
getAccountMeta("adminAuthority", accounts.adminAuthority),
|
|
3838
|
+
getAccountMeta("config", accounts.config)
|
|
3839
|
+
],
|
|
3840
|
+
data: getAddCosignerInstructionDataEncoder().encode(
|
|
3841
|
+
args
|
|
3842
|
+
),
|
|
3843
|
+
programAddress
|
|
3844
|
+
});
|
|
3845
|
+
}
|
|
3846
|
+
function getAddCosignerInstruction(input, config) {
|
|
3847
|
+
const programAddress = config?.programAddress ?? COSIGNER_HOOK_PROGRAM_ADDRESS;
|
|
3848
|
+
const originalAccounts = {
|
|
3849
|
+
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
3850
|
+
config: { value: input.config ?? null, isWritable: true }
|
|
3851
|
+
};
|
|
3852
|
+
const accounts = originalAccounts;
|
|
3853
|
+
const args = { ...input };
|
|
3854
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
3855
|
+
return Object.freeze({
|
|
3856
|
+
accounts: [
|
|
3857
|
+
getAccountMeta("adminAuthority", accounts.adminAuthority),
|
|
3858
|
+
getAccountMeta("config", accounts.config)
|
|
3859
|
+
],
|
|
3860
|
+
data: getAddCosignerInstructionDataEncoder().encode(
|
|
3861
|
+
args
|
|
3862
|
+
),
|
|
3863
|
+
programAddress
|
|
3864
|
+
});
|
|
3865
|
+
}
|
|
3866
|
+
function parseAddCosignerInstruction(instruction) {
|
|
3867
|
+
if (instruction.accounts.length < 2) {
|
|
3868
|
+
throw new SolanaError(
|
|
3869
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
3870
|
+
{
|
|
3871
|
+
actualAccountMetas: instruction.accounts.length,
|
|
3872
|
+
expectedAccountMetas: 2
|
|
3873
|
+
}
|
|
3874
|
+
);
|
|
3875
|
+
}
|
|
3876
|
+
let accountIndex = 0;
|
|
3877
|
+
const getNextAccount = () => {
|
|
3878
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
3879
|
+
accountIndex += 1;
|
|
3880
|
+
return accountMeta;
|
|
3881
|
+
};
|
|
3882
|
+
return {
|
|
3883
|
+
programAddress: instruction.programAddress,
|
|
3884
|
+
accounts: { adminAuthority: getNextAccount(), config: getNextAccount() },
|
|
3885
|
+
data: getAddCosignerInstructionDataDecoder().decode(instruction.data)
|
|
3886
|
+
};
|
|
3887
|
+
}
|
|
3888
|
+
var INITIALIZE_CONFIG_DISCRIMINATOR2 = new Uint8Array([
|
|
3889
|
+
208,
|
|
3890
|
+
127,
|
|
3891
|
+
21,
|
|
3892
|
+
1,
|
|
3893
|
+
194,
|
|
3894
|
+
190,
|
|
3895
|
+
196,
|
|
3896
|
+
70
|
|
3897
|
+
]);
|
|
3898
|
+
function getInitializeConfigDiscriminatorBytes2() {
|
|
3899
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
3900
|
+
INITIALIZE_CONFIG_DISCRIMINATOR2
|
|
3901
|
+
);
|
|
3902
|
+
}
|
|
3903
|
+
function getInitializeConfigInstructionDataEncoder2() {
|
|
3904
|
+
return transformEncoder(
|
|
3905
|
+
getStructEncoder([
|
|
3906
|
+
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
3907
|
+
["cosigners", getArrayEncoder(getAddressEncoder())]
|
|
3908
|
+
]),
|
|
3909
|
+
(value) => ({ ...value, discriminator: INITIALIZE_CONFIG_DISCRIMINATOR2 })
|
|
3910
|
+
);
|
|
3911
|
+
}
|
|
3912
|
+
function getInitializeConfigInstructionDataDecoder2() {
|
|
3913
|
+
return getStructDecoder([
|
|
3914
|
+
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
3915
|
+
["cosigners", getArrayDecoder(getAddressDecoder())]
|
|
3916
|
+
]);
|
|
3917
|
+
}
|
|
3918
|
+
function getInitializeConfigInstructionDataCodec2() {
|
|
3919
|
+
return combineCodec(
|
|
3920
|
+
getInitializeConfigInstructionDataEncoder2(),
|
|
3921
|
+
getInitializeConfigInstructionDataDecoder2()
|
|
3922
|
+
);
|
|
3923
|
+
}
|
|
3924
|
+
async function getInitializeConfigInstructionAsync2(input, config) {
|
|
3925
|
+
const programAddress = config?.programAddress ?? COSIGNER_HOOK_PROGRAM_ADDRESS;
|
|
3926
|
+
const originalAccounts = {
|
|
3927
|
+
payer: { value: input.payer ?? null, isWritable: true },
|
|
3928
|
+
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
3929
|
+
config: { value: input.config ?? null, isWritable: true },
|
|
3930
|
+
programData: { value: input.programData ?? null, isWritable: false },
|
|
3931
|
+
systemProgram: { value: input.systemProgram ?? null, isWritable: false }
|
|
3932
|
+
};
|
|
3933
|
+
const accounts = originalAccounts;
|
|
3934
|
+
const args = { ...input };
|
|
3935
|
+
if (!accounts.config.value) {
|
|
3936
|
+
accounts.config.value = await getProgramDerivedAddress({
|
|
3937
|
+
programAddress,
|
|
3938
|
+
seeds: [
|
|
3939
|
+
getBytesEncoder().encode(
|
|
3940
|
+
new Uint8Array([
|
|
3941
|
+
99,
|
|
3942
|
+
111,
|
|
3943
|
+
115,
|
|
3944
|
+
105,
|
|
3945
|
+
103,
|
|
3946
|
+
110,
|
|
3947
|
+
101,
|
|
3948
|
+
114,
|
|
3949
|
+
95,
|
|
3950
|
+
104,
|
|
3951
|
+
111,
|
|
3952
|
+
111,
|
|
3953
|
+
107,
|
|
3954
|
+
95,
|
|
3955
|
+
99,
|
|
3956
|
+
111,
|
|
3957
|
+
110,
|
|
3958
|
+
102,
|
|
3959
|
+
105,
|
|
3960
|
+
103
|
|
3961
|
+
])
|
|
3962
|
+
)
|
|
3963
|
+
]
|
|
3964
|
+
});
|
|
3965
|
+
}
|
|
3966
|
+
if (!accounts.systemProgram.value) {
|
|
3967
|
+
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
3968
|
+
}
|
|
3969
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
3970
|
+
return Object.freeze({
|
|
3971
|
+
accounts: [
|
|
3972
|
+
getAccountMeta("payer", accounts.payer),
|
|
3973
|
+
getAccountMeta("adminAuthority", accounts.adminAuthority),
|
|
3974
|
+
getAccountMeta("config", accounts.config),
|
|
3975
|
+
getAccountMeta("programData", accounts.programData),
|
|
3976
|
+
getAccountMeta("systemProgram", accounts.systemProgram)
|
|
3977
|
+
],
|
|
3978
|
+
data: getInitializeConfigInstructionDataEncoder2().encode(
|
|
3979
|
+
args
|
|
3980
|
+
),
|
|
3981
|
+
programAddress
|
|
3982
|
+
});
|
|
3983
|
+
}
|
|
3984
|
+
function getInitializeConfigInstruction2(input, config) {
|
|
3985
|
+
const programAddress = config?.programAddress ?? COSIGNER_HOOK_PROGRAM_ADDRESS;
|
|
3986
|
+
const originalAccounts = {
|
|
3987
|
+
payer: { value: input.payer ?? null, isWritable: true },
|
|
3988
|
+
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
3989
|
+
config: { value: input.config ?? null, isWritable: true },
|
|
3990
|
+
programData: { value: input.programData ?? null, isWritable: false },
|
|
3991
|
+
systemProgram: { value: input.systemProgram ?? null, isWritable: false }
|
|
3992
|
+
};
|
|
3993
|
+
const accounts = originalAccounts;
|
|
3994
|
+
const args = { ...input };
|
|
3995
|
+
if (!accounts.systemProgram.value) {
|
|
3996
|
+
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
3997
|
+
}
|
|
3998
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
3999
|
+
return Object.freeze({
|
|
4000
|
+
accounts: [
|
|
4001
|
+
getAccountMeta("payer", accounts.payer),
|
|
4002
|
+
getAccountMeta("adminAuthority", accounts.adminAuthority),
|
|
4003
|
+
getAccountMeta("config", accounts.config),
|
|
4004
|
+
getAccountMeta("programData", accounts.programData),
|
|
4005
|
+
getAccountMeta("systemProgram", accounts.systemProgram)
|
|
4006
|
+
],
|
|
4007
|
+
data: getInitializeConfigInstructionDataEncoder2().encode(
|
|
4008
|
+
args
|
|
4009
|
+
),
|
|
4010
|
+
programAddress
|
|
4011
|
+
});
|
|
4012
|
+
}
|
|
4013
|
+
function parseInitializeConfigInstruction2(instruction) {
|
|
4014
|
+
if (instruction.accounts.length < 5) {
|
|
4015
|
+
throw new SolanaError(
|
|
4016
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
4017
|
+
{
|
|
4018
|
+
actualAccountMetas: instruction.accounts.length,
|
|
4019
|
+
expectedAccountMetas: 5
|
|
4020
|
+
}
|
|
4021
|
+
);
|
|
4022
|
+
}
|
|
4023
|
+
let accountIndex = 0;
|
|
4024
|
+
const getNextAccount = () => {
|
|
4025
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
4026
|
+
accountIndex += 1;
|
|
4027
|
+
return accountMeta;
|
|
4028
|
+
};
|
|
4029
|
+
return {
|
|
4030
|
+
programAddress: instruction.programAddress,
|
|
4031
|
+
accounts: {
|
|
4032
|
+
payer: getNextAccount(),
|
|
4033
|
+
adminAuthority: getNextAccount(),
|
|
4034
|
+
config: getNextAccount(),
|
|
4035
|
+
programData: getNextAccount(),
|
|
4036
|
+
systemProgram: getNextAccount()
|
|
4037
|
+
},
|
|
4038
|
+
data: getInitializeConfigInstructionDataDecoder2().decode(instruction.data)
|
|
4039
|
+
};
|
|
4040
|
+
}
|
|
4041
|
+
var REMOVE_COSIGNER_DISCRIMINATOR = new Uint8Array([
|
|
4042
|
+
174,
|
|
4043
|
+
11,
|
|
4044
|
+
171,
|
|
4045
|
+
252,
|
|
4046
|
+
179,
|
|
4047
|
+
99,
|
|
4048
|
+
220,
|
|
4049
|
+
27
|
|
4050
|
+
]);
|
|
4051
|
+
function getRemoveCosignerDiscriminatorBytes() {
|
|
4052
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
4053
|
+
REMOVE_COSIGNER_DISCRIMINATOR
|
|
4054
|
+
);
|
|
4055
|
+
}
|
|
4056
|
+
function getRemoveCosignerInstructionDataEncoder() {
|
|
4057
|
+
return transformEncoder(
|
|
4058
|
+
getStructEncoder([
|
|
4059
|
+
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
4060
|
+
["cosigner", getAddressEncoder()]
|
|
4061
|
+
]),
|
|
4062
|
+
(value) => ({ ...value, discriminator: REMOVE_COSIGNER_DISCRIMINATOR })
|
|
4063
|
+
);
|
|
4064
|
+
}
|
|
4065
|
+
function getRemoveCosignerInstructionDataDecoder() {
|
|
4066
|
+
return getStructDecoder([
|
|
4067
|
+
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
4068
|
+
["cosigner", getAddressDecoder()]
|
|
4069
|
+
]);
|
|
4070
|
+
}
|
|
4071
|
+
function getRemoveCosignerInstructionDataCodec() {
|
|
4072
|
+
return combineCodec(
|
|
4073
|
+
getRemoveCosignerInstructionDataEncoder(),
|
|
4074
|
+
getRemoveCosignerInstructionDataDecoder()
|
|
4075
|
+
);
|
|
4076
|
+
}
|
|
4077
|
+
async function getRemoveCosignerInstructionAsync(input, config) {
|
|
4078
|
+
const programAddress = config?.programAddress ?? COSIGNER_HOOK_PROGRAM_ADDRESS;
|
|
4079
|
+
const originalAccounts = {
|
|
4080
|
+
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
4081
|
+
config: { value: input.config ?? null, isWritable: true }
|
|
4082
|
+
};
|
|
4083
|
+
const accounts = originalAccounts;
|
|
4084
|
+
const args = { ...input };
|
|
4085
|
+
if (!accounts.config.value) {
|
|
4086
|
+
accounts.config.value = await getProgramDerivedAddress({
|
|
4087
|
+
programAddress,
|
|
4088
|
+
seeds: [
|
|
4089
|
+
getBytesEncoder().encode(
|
|
4090
|
+
new Uint8Array([
|
|
4091
|
+
99,
|
|
4092
|
+
111,
|
|
4093
|
+
115,
|
|
4094
|
+
105,
|
|
4095
|
+
103,
|
|
4096
|
+
110,
|
|
4097
|
+
101,
|
|
4098
|
+
114,
|
|
4099
|
+
95,
|
|
4100
|
+
104,
|
|
4101
|
+
111,
|
|
4102
|
+
111,
|
|
4103
|
+
107,
|
|
4104
|
+
95,
|
|
4105
|
+
99,
|
|
4106
|
+
111,
|
|
4107
|
+
110,
|
|
4108
|
+
102,
|
|
4109
|
+
105,
|
|
4110
|
+
103
|
|
4111
|
+
])
|
|
4112
|
+
)
|
|
4113
|
+
]
|
|
4114
|
+
});
|
|
4115
|
+
}
|
|
4116
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
4117
|
+
return Object.freeze({
|
|
4118
|
+
accounts: [
|
|
4119
|
+
getAccountMeta("adminAuthority", accounts.adminAuthority),
|
|
4120
|
+
getAccountMeta("config", accounts.config)
|
|
4121
|
+
],
|
|
4122
|
+
data: getRemoveCosignerInstructionDataEncoder().encode(
|
|
4123
|
+
args
|
|
4124
|
+
),
|
|
4125
|
+
programAddress
|
|
4126
|
+
});
|
|
4127
|
+
}
|
|
4128
|
+
function getRemoveCosignerInstruction(input, config) {
|
|
4129
|
+
const programAddress = config?.programAddress ?? COSIGNER_HOOK_PROGRAM_ADDRESS;
|
|
4130
|
+
const originalAccounts = {
|
|
4131
|
+
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
4132
|
+
config: { value: input.config ?? null, isWritable: true }
|
|
4133
|
+
};
|
|
4134
|
+
const accounts = originalAccounts;
|
|
4135
|
+
const args = { ...input };
|
|
4136
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
4137
|
+
return Object.freeze({
|
|
4138
|
+
accounts: [
|
|
4139
|
+
getAccountMeta("adminAuthority", accounts.adminAuthority),
|
|
4140
|
+
getAccountMeta("config", accounts.config)
|
|
4141
|
+
],
|
|
4142
|
+
data: getRemoveCosignerInstructionDataEncoder().encode(
|
|
4143
|
+
args
|
|
4144
|
+
),
|
|
4145
|
+
programAddress
|
|
4146
|
+
});
|
|
4147
|
+
}
|
|
4148
|
+
function parseRemoveCosignerInstruction(instruction) {
|
|
4149
|
+
if (instruction.accounts.length < 2) {
|
|
4150
|
+
throw new SolanaError(
|
|
4151
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
4152
|
+
{
|
|
4153
|
+
actualAccountMetas: instruction.accounts.length,
|
|
4154
|
+
expectedAccountMetas: 2
|
|
4155
|
+
}
|
|
4156
|
+
);
|
|
4157
|
+
}
|
|
4158
|
+
let accountIndex = 0;
|
|
4159
|
+
const getNextAccount = () => {
|
|
4160
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
4161
|
+
accountIndex += 1;
|
|
4162
|
+
return accountMeta;
|
|
4163
|
+
};
|
|
4164
|
+
return {
|
|
4165
|
+
programAddress: instruction.programAddress,
|
|
4166
|
+
accounts: { adminAuthority: getNextAccount(), config: getNextAccount() },
|
|
4167
|
+
data: getRemoveCosignerInstructionDataDecoder().decode(instruction.data)
|
|
4168
|
+
};
|
|
4169
|
+
}
|
|
4170
|
+
var SET_AUTHORITY_DISCRIMINATOR = new Uint8Array([
|
|
4171
|
+
133,
|
|
4172
|
+
250,
|
|
4173
|
+
37,
|
|
4174
|
+
21,
|
|
4175
|
+
110,
|
|
4176
|
+
163,
|
|
4177
|
+
26,
|
|
4178
|
+
121
|
|
4179
|
+
]);
|
|
4180
|
+
function getSetAuthorityDiscriminatorBytes() {
|
|
4181
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
4182
|
+
SET_AUTHORITY_DISCRIMINATOR
|
|
4183
|
+
);
|
|
4184
|
+
}
|
|
4185
|
+
function getSetAuthorityInstructionDataEncoder() {
|
|
4186
|
+
return transformEncoder(
|
|
4187
|
+
getStructEncoder([
|
|
4188
|
+
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
4189
|
+
["adminAuthority", getAddressEncoder()]
|
|
4190
|
+
]),
|
|
4191
|
+
(value) => ({ ...value, discriminator: SET_AUTHORITY_DISCRIMINATOR })
|
|
4192
|
+
);
|
|
4193
|
+
}
|
|
4194
|
+
function getSetAuthorityInstructionDataDecoder() {
|
|
4195
|
+
return getStructDecoder([
|
|
4196
|
+
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
4197
|
+
["adminAuthority", getAddressDecoder()]
|
|
4198
|
+
]);
|
|
4199
|
+
}
|
|
4200
|
+
function getSetAuthorityInstructionDataCodec() {
|
|
4201
|
+
return combineCodec(
|
|
4202
|
+
getSetAuthorityInstructionDataEncoder(),
|
|
4203
|
+
getSetAuthorityInstructionDataDecoder()
|
|
4204
|
+
);
|
|
4205
|
+
}
|
|
4206
|
+
async function getSetAuthorityInstructionAsync(input, config) {
|
|
4207
|
+
const programAddress = config?.programAddress ?? COSIGNER_HOOK_PROGRAM_ADDRESS;
|
|
4208
|
+
const originalAccounts = {
|
|
4209
|
+
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
4210
|
+
config: { value: input.config ?? null, isWritable: true }
|
|
4211
|
+
};
|
|
4212
|
+
const accounts = originalAccounts;
|
|
4213
|
+
const args = { ...input, adminAuthority: input.adminAuthorityArg };
|
|
4214
|
+
if (!accounts.config.value) {
|
|
4215
|
+
accounts.config.value = await getProgramDerivedAddress({
|
|
4216
|
+
programAddress,
|
|
4217
|
+
seeds: [
|
|
4218
|
+
getBytesEncoder().encode(
|
|
4219
|
+
new Uint8Array([
|
|
4220
|
+
99,
|
|
4221
|
+
111,
|
|
4222
|
+
115,
|
|
4223
|
+
105,
|
|
4224
|
+
103,
|
|
4225
|
+
110,
|
|
4226
|
+
101,
|
|
4227
|
+
114,
|
|
4228
|
+
95,
|
|
4229
|
+
104,
|
|
4230
|
+
111,
|
|
4231
|
+
111,
|
|
4232
|
+
107,
|
|
4233
|
+
95,
|
|
4234
|
+
99,
|
|
4235
|
+
111,
|
|
4236
|
+
110,
|
|
4237
|
+
102,
|
|
4238
|
+
105,
|
|
4239
|
+
103
|
|
4240
|
+
])
|
|
4241
|
+
)
|
|
4242
|
+
]
|
|
4243
|
+
});
|
|
4244
|
+
}
|
|
4245
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
4246
|
+
return Object.freeze({
|
|
4247
|
+
accounts: [
|
|
4248
|
+
getAccountMeta("adminAuthority", accounts.adminAuthority),
|
|
4249
|
+
getAccountMeta("config", accounts.config)
|
|
4250
|
+
],
|
|
4251
|
+
data: getSetAuthorityInstructionDataEncoder().encode(
|
|
4252
|
+
args
|
|
4253
|
+
),
|
|
4254
|
+
programAddress
|
|
4255
|
+
});
|
|
4256
|
+
}
|
|
4257
|
+
function getSetAuthorityInstruction(input, config) {
|
|
4258
|
+
const programAddress = config?.programAddress ?? COSIGNER_HOOK_PROGRAM_ADDRESS;
|
|
4259
|
+
const originalAccounts = {
|
|
4260
|
+
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
4261
|
+
config: { value: input.config ?? null, isWritable: true }
|
|
4262
|
+
};
|
|
4263
|
+
const accounts = originalAccounts;
|
|
4264
|
+
const args = { ...input, adminAuthority: input.adminAuthorityArg };
|
|
4265
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
4266
|
+
return Object.freeze({
|
|
4267
|
+
accounts: [
|
|
4268
|
+
getAccountMeta("adminAuthority", accounts.adminAuthority),
|
|
4269
|
+
getAccountMeta("config", accounts.config)
|
|
4270
|
+
],
|
|
4271
|
+
data: getSetAuthorityInstructionDataEncoder().encode(
|
|
4272
|
+
args
|
|
4273
|
+
),
|
|
4274
|
+
programAddress
|
|
4275
|
+
});
|
|
4276
|
+
}
|
|
4277
|
+
function parseSetAuthorityInstruction(instruction) {
|
|
4278
|
+
if (instruction.accounts.length < 2) {
|
|
4279
|
+
throw new SolanaError(
|
|
4280
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
4281
|
+
{
|
|
4282
|
+
actualAccountMetas: instruction.accounts.length,
|
|
4283
|
+
expectedAccountMetas: 2
|
|
4284
|
+
}
|
|
4285
|
+
);
|
|
4286
|
+
}
|
|
4287
|
+
let accountIndex = 0;
|
|
4288
|
+
const getNextAccount = () => {
|
|
4289
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
4290
|
+
accountIndex += 1;
|
|
4291
|
+
return accountMeta;
|
|
4292
|
+
};
|
|
4293
|
+
return {
|
|
4294
|
+
programAddress: instruction.programAddress,
|
|
4295
|
+
accounts: { adminAuthority: getNextAccount(), config: getNextAccount() },
|
|
4296
|
+
data: getSetAuthorityInstructionDataDecoder().decode(instruction.data)
|
|
4297
|
+
};
|
|
4298
|
+
}
|
|
4299
|
+
|
|
4300
|
+
// src/solana/generated/cosignerHook/programs/cosignerHook.ts
|
|
4301
|
+
var COSIGNER_HOOK_PROGRAM_ADDRESS = "JDwnBoYE2NsmkQjQLHi1btQxeHirtJ9XjU1dM641QZt";
|
|
4302
|
+
var CosignerHookAccount = /* @__PURE__ */ ((CosignerHookAccount2) => {
|
|
4303
|
+
CosignerHookAccount2[CosignerHookAccount2["CosignerConfig"] = 0] = "CosignerConfig";
|
|
4304
|
+
return CosignerHookAccount2;
|
|
4305
|
+
})(CosignerHookAccount || {});
|
|
4306
|
+
function identifyCosignerHookAccount(account) {
|
|
4307
|
+
const data = "data" in account ? account.data : account;
|
|
4308
|
+
if (containsBytes(
|
|
4309
|
+
data,
|
|
4310
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
4311
|
+
new Uint8Array([133, 227, 177, 74, 145, 74, 247, 183])
|
|
4312
|
+
),
|
|
4313
|
+
0
|
|
4314
|
+
)) {
|
|
4315
|
+
return 0 /* CosignerConfig */;
|
|
4316
|
+
}
|
|
4317
|
+
throw new SolanaError(
|
|
4318
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_ACCOUNT,
|
|
4319
|
+
{ accountData: data, programName: "cosignerHook" }
|
|
4320
|
+
);
|
|
4321
|
+
}
|
|
4322
|
+
var CosignerHookInstruction = /* @__PURE__ */ ((CosignerHookInstruction2) => {
|
|
4323
|
+
CosignerHookInstruction2[CosignerHookInstruction2["AddCosigner"] = 0] = "AddCosigner";
|
|
4324
|
+
CosignerHookInstruction2[CosignerHookInstruction2["InitializeConfig"] = 1] = "InitializeConfig";
|
|
4325
|
+
CosignerHookInstruction2[CosignerHookInstruction2["RemoveCosigner"] = 2] = "RemoveCosigner";
|
|
4326
|
+
CosignerHookInstruction2[CosignerHookInstruction2["SetAuthority"] = 3] = "SetAuthority";
|
|
4327
|
+
return CosignerHookInstruction2;
|
|
4328
|
+
})(CosignerHookInstruction || {});
|
|
4329
|
+
function identifyCosignerHookInstruction(instruction) {
|
|
4330
|
+
const data = "data" in instruction ? instruction.data : instruction;
|
|
4331
|
+
if (containsBytes(
|
|
4332
|
+
data,
|
|
4333
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
4334
|
+
new Uint8Array([17, 34, 183, 119, 202, 255, 218, 233])
|
|
4335
|
+
),
|
|
4336
|
+
0
|
|
4337
|
+
)) {
|
|
4338
|
+
return 0 /* AddCosigner */;
|
|
4339
|
+
}
|
|
4340
|
+
if (containsBytes(
|
|
4341
|
+
data,
|
|
4342
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
4343
|
+
new Uint8Array([208, 127, 21, 1, 194, 190, 196, 70])
|
|
4344
|
+
),
|
|
4345
|
+
0
|
|
4346
|
+
)) {
|
|
4347
|
+
return 1 /* InitializeConfig */;
|
|
4348
|
+
}
|
|
4349
|
+
if (containsBytes(
|
|
4350
|
+
data,
|
|
4351
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
4352
|
+
new Uint8Array([174, 11, 171, 252, 179, 99, 220, 27])
|
|
4353
|
+
),
|
|
4354
|
+
0
|
|
4355
|
+
)) {
|
|
4356
|
+
return 2 /* RemoveCosigner */;
|
|
4357
|
+
}
|
|
4358
|
+
if (containsBytes(
|
|
4359
|
+
data,
|
|
4360
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
4361
|
+
new Uint8Array([133, 250, 37, 21, 110, 163, 26, 121])
|
|
4362
|
+
),
|
|
4363
|
+
0
|
|
4364
|
+
)) {
|
|
4365
|
+
return 3 /* SetAuthority */;
|
|
4366
|
+
}
|
|
4367
|
+
throw new SolanaError(
|
|
4368
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION,
|
|
4369
|
+
{ instructionData: data, programName: "cosignerHook" }
|
|
4370
|
+
);
|
|
4371
|
+
}
|
|
4372
|
+
function parseCosignerHookInstruction(instruction) {
|
|
4373
|
+
const instructionType = identifyCosignerHookInstruction(instruction);
|
|
4374
|
+
switch (instructionType) {
|
|
4375
|
+
case 0 /* AddCosigner */: {
|
|
4376
|
+
assertIsInstructionWithAccounts(instruction);
|
|
4377
|
+
return {
|
|
4378
|
+
instructionType: 0 /* AddCosigner */,
|
|
4379
|
+
...parseAddCosignerInstruction(instruction)
|
|
4380
|
+
};
|
|
4381
|
+
}
|
|
4382
|
+
case 1 /* InitializeConfig */: {
|
|
4383
|
+
assertIsInstructionWithAccounts(instruction);
|
|
4384
|
+
return {
|
|
4385
|
+
instructionType: 1 /* InitializeConfig */,
|
|
4386
|
+
...parseInitializeConfigInstruction2(instruction)
|
|
4387
|
+
};
|
|
4388
|
+
}
|
|
4389
|
+
case 2 /* RemoveCosigner */: {
|
|
4390
|
+
assertIsInstructionWithAccounts(instruction);
|
|
4391
|
+
return {
|
|
4392
|
+
instructionType: 2 /* RemoveCosigner */,
|
|
4393
|
+
...parseRemoveCosignerInstruction(instruction)
|
|
4394
|
+
};
|
|
4395
|
+
}
|
|
4396
|
+
case 3 /* SetAuthority */: {
|
|
4397
|
+
assertIsInstructionWithAccounts(instruction);
|
|
4398
|
+
return {
|
|
4399
|
+
instructionType: 3 /* SetAuthority */,
|
|
4400
|
+
...parseSetAuthorityInstruction(instruction)
|
|
4401
|
+
};
|
|
4402
|
+
}
|
|
4403
|
+
default:
|
|
4404
|
+
throw new SolanaError(
|
|
4405
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE,
|
|
4406
|
+
{
|
|
4407
|
+
instructionType,
|
|
4408
|
+
programName: "cosignerHook"
|
|
4409
|
+
}
|
|
4410
|
+
);
|
|
4411
|
+
}
|
|
4412
|
+
}
|
|
4413
|
+
function cosignerHookProgram() {
|
|
4414
|
+
return (client) => {
|
|
4415
|
+
return {
|
|
4416
|
+
...client,
|
|
4417
|
+
cosignerHook: {
|
|
4418
|
+
accounts: {
|
|
4419
|
+
cosignerConfig: addSelfFetchFunctions(
|
|
4420
|
+
client,
|
|
4421
|
+
getCosignerConfigCodec()
|
|
4422
|
+
)
|
|
4423
|
+
},
|
|
4424
|
+
instructions: {
|
|
4425
|
+
addCosigner: (input) => addSelfPlanAndSendFunctions(
|
|
4426
|
+
client,
|
|
4427
|
+
getAddCosignerInstructionAsync(input)
|
|
4428
|
+
),
|
|
4429
|
+
initializeConfig: (input) => addSelfPlanAndSendFunctions(
|
|
4430
|
+
client,
|
|
4431
|
+
getInitializeConfigInstructionAsync2({
|
|
4432
|
+
...input,
|
|
4433
|
+
payer: input.payer ?? client.payer
|
|
4434
|
+
})
|
|
4435
|
+
),
|
|
4436
|
+
removeCosigner: (input) => addSelfPlanAndSendFunctions(
|
|
4437
|
+
client,
|
|
4438
|
+
getRemoveCosignerInstructionAsync(input)
|
|
4439
|
+
),
|
|
4440
|
+
setAuthority: (input) => addSelfPlanAndSendFunctions(
|
|
4441
|
+
client,
|
|
4442
|
+
getSetAuthorityInstructionAsync(input)
|
|
4443
|
+
)
|
|
4444
|
+
}
|
|
4445
|
+
}
|
|
4446
|
+
};
|
|
4447
|
+
};
|
|
4448
|
+
}
|
|
4449
|
+
|
|
4450
|
+
// src/solana/generated/cosignerHook/errors/cosignerHook.ts
|
|
4451
|
+
var COSIGNER_HOOK_ERROR__INVALID_CONFIG = 6e3;
|
|
4452
|
+
var COSIGNER_HOOK_ERROR__INVALID_AUTHORITY = 6001;
|
|
4453
|
+
var COSIGNER_HOOK_ERROR__INVALID_COSIGNER = 6002;
|
|
4454
|
+
var COSIGNER_HOOK_ERROR__COSIGNER_ALREADY_EXISTS = 6003;
|
|
4455
|
+
var COSIGNER_HOOK_ERROR__COSIGNER_NOT_FOUND = 6004;
|
|
4456
|
+
var COSIGNER_HOOK_ERROR__COSIGNER_LIST_FULL = 6005;
|
|
4457
|
+
var cosignerHookErrorMessages;
|
|
4458
|
+
if (process.env.NODE_ENV !== "production") {
|
|
4459
|
+
cosignerHookErrorMessages = {
|
|
4460
|
+
[COSIGNER_HOOK_ERROR__COSIGNER_ALREADY_EXISTS]: `Cosigner already exists`,
|
|
4461
|
+
[COSIGNER_HOOK_ERROR__COSIGNER_LIST_FULL]: `Cosigner list is full`,
|
|
4462
|
+
[COSIGNER_HOOK_ERROR__COSIGNER_NOT_FOUND]: `Cosigner not found`,
|
|
4463
|
+
[COSIGNER_HOOK_ERROR__INVALID_AUTHORITY]: `Invalid cosigner hook authority`,
|
|
4464
|
+
[COSIGNER_HOOK_ERROR__INVALID_CONFIG]: `Invalid cosigner hook config`,
|
|
4465
|
+
[COSIGNER_HOOK_ERROR__INVALID_COSIGNER]: `Invalid cosigner key`
|
|
4466
|
+
};
|
|
4467
|
+
}
|
|
4468
|
+
function getCosignerHookErrorMessage(code) {
|
|
4469
|
+
if (process.env.NODE_ENV !== "production") {
|
|
4470
|
+
return cosignerHookErrorMessages[code];
|
|
4471
|
+
}
|
|
4472
|
+
return "Error message not available in production bundles.";
|
|
4473
|
+
}
|
|
4474
|
+
function isCosignerHookError(error, transactionMessage, code) {
|
|
4475
|
+
return isProgramError(
|
|
4476
|
+
error,
|
|
4477
|
+
transactionMessage,
|
|
4478
|
+
COSIGNER_HOOK_PROGRAM_ADDRESS,
|
|
4479
|
+
code
|
|
4480
|
+
);
|
|
4481
|
+
}
|
|
4482
|
+
function getCosignerArgEncoder() {
|
|
4483
|
+
return getStructEncoder([["cosigner", getAddressEncoder()]]);
|
|
4484
|
+
}
|
|
4485
|
+
function getCosignerArgDecoder() {
|
|
4486
|
+
return getStructDecoder([["cosigner", getAddressDecoder()]]);
|
|
4487
|
+
}
|
|
4488
|
+
function getCosignerArgCodec() {
|
|
4489
|
+
return combineCodec(getCosignerArgEncoder(), getCosignerArgDecoder());
|
|
4490
|
+
}
|
|
4491
|
+
function getInitializeConfigArgsEncoder() {
|
|
4492
|
+
return getStructEncoder([
|
|
4493
|
+
["cosigners", getArrayEncoder(getAddressEncoder())]
|
|
4494
|
+
]);
|
|
4495
|
+
}
|
|
4496
|
+
function getInitializeConfigArgsDecoder() {
|
|
4497
|
+
return getStructDecoder([
|
|
4498
|
+
["cosigners", getArrayDecoder(getAddressDecoder())]
|
|
4499
|
+
]);
|
|
4500
|
+
}
|
|
4501
|
+
function getInitializeConfigArgsCodec() {
|
|
4502
|
+
return combineCodec(
|
|
4503
|
+
getInitializeConfigArgsEncoder(),
|
|
4504
|
+
getInitializeConfigArgsDecoder()
|
|
4505
|
+
);
|
|
4506
|
+
}
|
|
4507
|
+
function getSetAuthorityArgsEncoder() {
|
|
4508
|
+
return getStructEncoder([["adminAuthority", getAddressEncoder()]]);
|
|
4509
|
+
}
|
|
4510
|
+
function getSetAuthorityArgsDecoder() {
|
|
4511
|
+
return getStructDecoder([["adminAuthority", getAddressDecoder()]]);
|
|
4512
|
+
}
|
|
4513
|
+
function getSetAuthorityArgsCodec() {
|
|
4514
|
+
return combineCodec(
|
|
4515
|
+
getSetAuthorityArgsEncoder(),
|
|
4516
|
+
getSetAuthorityArgsDecoder()
|
|
4517
|
+
);
|
|
4518
|
+
}
|
|
4519
|
+
|
|
4520
|
+
// src/solana/cosignerHook/constants.ts
|
|
4521
|
+
var COSIGNER_HOOK_PROGRAM_ID = COSIGNER_HOOK_PROGRAM_ADDRESS;
|
|
4522
|
+
var SEED_COSIGNER_HOOK_CONFIG = "cosigner_hook_config";
|
|
4523
|
+
var MAX_COSIGNERS = 32;
|
|
4524
|
+
var textEncoder2 = new TextEncoder();
|
|
4525
|
+
async function getCosignerHookConfigAddress(programId = COSIGNER_HOOK_PROGRAM_ID) {
|
|
4526
|
+
return getProgramDerivedAddress({
|
|
4527
|
+
programAddress: programId,
|
|
4528
|
+
seeds: [textEncoder2.encode(SEED_COSIGNER_HOOK_CONFIG)]
|
|
4529
|
+
});
|
|
4530
|
+
}
|
|
4531
|
+
|
|
4532
|
+
// src/solana/initializer/index.ts
|
|
4533
|
+
var initializer_exports = {};
|
|
4534
|
+
__export(initializer_exports, {
|
|
4535
|
+
BPF_LOADER_UPGRADEABLE_PROGRAM_ID: () => BPF_LOADER_UPGRADEABLE_PROGRAM_ID,
|
|
4536
|
+
CPMM_HOOK_PROGRAM_ID: () => CPMM_HOOK_PROGRAM_ID,
|
|
4537
|
+
CURVE_KIND_XYK: () => CURVE_KIND_XYK,
|
|
4538
|
+
CURVE_PARAMS_FORMAT_XYK_V0: () => CURVE_PARAMS_FORMAT_XYK_V0,
|
|
4539
|
+
DEFAULT_LOOKUP_TABLE_ADDRESSES_PER_EXTEND: () => DEFAULT_LOOKUP_TABLE_ADDRESSES_PER_EXTEND,
|
|
4540
|
+
EMPTY_REMAINING_ACCOUNTS_HASH: () => EMPTY_REMAINING_ACCOUNTS_HASH,
|
|
4541
|
+
HF_AFTER_CREATE: () => HF_AFTER_CREATE,
|
|
4542
|
+
HF_AFTER_MIGRATE: () => HF_AFTER_MIGRATE,
|
|
4543
|
+
HF_AFTER_SWAP: () => HF_AFTER_SWAP2,
|
|
4544
|
+
HF_BEFORE_CREATE: () => HF_BEFORE_CREATE,
|
|
4545
|
+
HF_BEFORE_MIGRATE: () => HF_BEFORE_MIGRATE,
|
|
4546
|
+
HF_BEFORE_SWAP: () => HF_BEFORE_SWAP2,
|
|
4547
|
+
HF_FORWARD_READONLY_SIGNERS: () => HF_FORWARD_READONLY_SIGNERS2,
|
|
4548
|
+
HOOK_NO_CHANGE: () => HOOK_NO_CHANGE2,
|
|
4549
|
+
INITIALIZER_ACCOUNT_DISCRIMINATORS: () => INITIALIZER_ACCOUNT_DISCRIMINATORS,
|
|
4550
|
+
INITIALIZER_INSTRUCTION_DISCRIMINATORS: () => INITIALIZER_INSTRUCTION_DISCRIMINATORS,
|
|
4551
|
+
INITIALIZER_PROGRAM_ID: () => INITIALIZER_PROGRAM_ID,
|
|
4552
|
+
MAX_HOOK_ALLOWLIST: () => MAX_HOOK_ALLOWLIST2,
|
|
4553
|
+
MAX_MIGRATOR_ALLOWLIST: () => MAX_MIGRATOR_ALLOWLIST,
|
|
4554
|
+
MAX_PAYLOAD: () => MAX_PAYLOAD,
|
|
4555
|
+
PHASE_ABORTED: () => PHASE_ABORTED,
|
|
4556
|
+
PHASE_MIGRATED: () => PHASE_MIGRATED,
|
|
4557
|
+
PHASE_TRADING: () => PHASE_TRADING,
|
|
4558
|
+
PREDICTION_HOOK_PROGRAM_ID: () => PREDICTION_HOOK_PROGRAM_ID,
|
|
4559
|
+
SEED_CONFIG: () => SEED_CONFIG2,
|
|
4560
|
+
SEED_LAUNCH: () => SEED_LAUNCH,
|
|
4561
|
+
SEED_LAUNCH_AUTHORITY: () => SEED_LAUNCH_AUTHORITY,
|
|
4562
|
+
SEED_LAUNCH_FEE_STATE: () => SEED_LAUNCH_FEE_STATE,
|
|
4563
|
+
TRADE_DIRECTION_BUY: () => TRADE_DIRECTION_BUY,
|
|
4564
|
+
TRADE_DIRECTION_SELL: () => TRADE_DIRECTION_SELL,
|
|
4565
|
+
buildAddressLookupTableSetupInstructions: () => buildAddressLookupTableSetupInstructions,
|
|
4566
|
+
compressTransactionMessageWithLookupTable: () => compressTransactionMessageWithLookupTable,
|
|
4567
|
+
computeRemainingAccountsHash: () => computeRemainingAccountsHash,
|
|
4568
|
+
createCurveSwapExactInInstruction: () => createCurveSwapExactInInstruction,
|
|
4569
|
+
createInitializeConfigInstruction: () => createInitializeConfigInstruction,
|
|
4570
|
+
createInitializeLaunchInstruction: () => createInitializeLaunchInstruction,
|
|
4571
|
+
createMigrateLaunchInstruction: () => createMigrateLaunchInstruction,
|
|
4572
|
+
createPreviewMigrationInstruction: () => createPreviewMigrationInstruction,
|
|
4573
|
+
createPreviewSwapExactInInstruction: () => createPreviewSwapExactInInstruction,
|
|
4574
|
+
createSetHookAllowlistInstruction: () => createSetHookAllowlistInstruction,
|
|
4575
|
+
createSetMigratorAllowlistInstruction: () => createSetMigratorAllowlistInstruction,
|
|
4576
|
+
decodePreviewMigrationResult: () => decodePreviewMigrationResult,
|
|
4577
|
+
decodePreviewSwapExactInResult: () => decodePreviewSwapExactInResult,
|
|
4578
|
+
encodeU64LE: () => encodeU64LE,
|
|
4579
|
+
fetchAllLaunches: () => fetchAllLaunches,
|
|
4580
|
+
fetchLaunch: () => fetchLaunch2,
|
|
4581
|
+
fetchLaunchesByAuthority: () => fetchLaunchesByAuthority,
|
|
4582
|
+
getClaimFeesInstructionAsync: () => getClaimFeesInstructionAsync,
|
|
4583
|
+
getConfigAddress: () => getConfigAddress2,
|
|
4584
|
+
getHarvestMigratedFeesInstructionAsync: () => getHarvestMigratedFeesInstructionAsync,
|
|
4585
|
+
getInitConfigCodec: () => getInitConfigCodec,
|
|
4586
|
+
getInitConfigDecoder: () => getInitConfigDecoder,
|
|
4587
|
+
getInitConfigEncoder: () => getInitConfigEncoder,
|
|
4588
|
+
getInitializeConfigArgsCodec: () => getInitializeConfigArgsCodec2,
|
|
4589
|
+
getInitializeConfigArgsDecoder: () => getInitializeConfigArgsDecoder2,
|
|
4590
|
+
getInitializeConfigArgsEncoder: () => getInitializeConfigArgsEncoder2,
|
|
4591
|
+
getInitializeLaunchArgsCodec: () => getInitializeLaunchArgsCodec,
|
|
4592
|
+
getInitializeLaunchArgsDecoder: () => getInitializeLaunchArgsDecoder,
|
|
4593
|
+
getInitializeLaunchArgsEncoder: () => getInitializeLaunchArgsEncoder,
|
|
4594
|
+
getInstructionLookupTableAddresses: () => getInstructionLookupTableAddresses,
|
|
4595
|
+
getLaunchAddress: () => getLaunchAddress,
|
|
4596
|
+
getLaunchAuthorityAddress: () => getLaunchAuthorityAddress,
|
|
4597
|
+
getLaunchCodec: () => getLaunchCodec,
|
|
4598
|
+
getLaunchDecoder: () => getLaunchDecoder,
|
|
4599
|
+
getLaunchEncoder: () => getLaunchEncoder,
|
|
4600
|
+
getLaunchFeeStateAddress: () => getLaunchFeeStateAddress,
|
|
4601
|
+
getLaunchFeeStateCodec: () => getLaunchFeeStateCodec,
|
|
4602
|
+
getLaunchFeeStateDecoder: () => getLaunchFeeStateDecoder,
|
|
4603
|
+
getLaunchFeeStateEncoder: () => getLaunchFeeStateEncoder,
|
|
4604
|
+
getProgramDataAddress: () => getProgramDataAddress,
|
|
4605
|
+
getReplaceFeeBeneficiaryInstructionAsync: () => getReplaceFeeBeneficiaryInstructionAsync,
|
|
4606
|
+
getSetFeePolicyInstructionAsync: () => getSetFeePolicyInstructionAsync,
|
|
4607
|
+
getTokenMetadataAddress: () => getTokenMetadataAddress,
|
|
4608
|
+
launchExists: () => launchExists,
|
|
4609
|
+
launchIdFromU64: () => launchIdFromU64,
|
|
4610
|
+
phaseLabel: () => phaseLabel
|
|
4611
|
+
});
|
|
4612
|
+
var INITIALIZER_PROGRAM_ID = address(
|
|
4613
|
+
"4h3Dqyo5qmteJoMxXt3tdtfXELDB6pdRTPU9mWruiKp1"
|
|
4614
|
+
);
|
|
4615
|
+
var BPF_LOADER_UPGRADEABLE_PROGRAM_ID = address(
|
|
4616
|
+
"BPFLoaderUpgradeab1e11111111111111111111111"
|
|
4617
|
+
);
|
|
4618
|
+
var CPMM_HOOK_PROGRAM_ID = address(
|
|
4619
|
+
"2vJ1c62knEwZbxp3XdHB4RSmCfz55pA6tRkCho63gW7u"
|
|
4620
|
+
);
|
|
4621
|
+
var PREDICTION_HOOK_PROGRAM_ID = address(
|
|
4622
|
+
"7QcQDANJVC17Jgc6KjjeagSkm2zAphgHVPK5agJzyihB"
|
|
4623
|
+
);
|
|
4624
|
+
var SEED_CONFIG2 = "config";
|
|
4625
|
+
var SEED_LAUNCH = "launch";
|
|
4626
|
+
var SEED_LAUNCH_AUTHORITY = "launch_authority";
|
|
4627
|
+
var SEED_LAUNCH_FEE_STATE = "launch_fee_state";
|
|
4628
|
+
var EMPTY_REMAINING_ACCOUNTS_HASH = new Uint8Array([
|
|
4629
|
+
232,
|
|
4630
|
+
231,
|
|
4631
|
+
118,
|
|
4632
|
+
38,
|
|
4633
|
+
88,
|
|
4634
|
+
111,
|
|
4635
|
+
115,
|
|
4636
|
+
185,
|
|
4637
|
+
85,
|
|
4638
|
+
54,
|
|
4639
|
+
76,
|
|
4640
|
+
123,
|
|
4641
|
+
75,
|
|
4642
|
+
191,
|
|
4643
|
+
11,
|
|
4644
|
+
183,
|
|
4645
|
+
247,
|
|
4646
|
+
104,
|
|
4647
|
+
94,
|
|
4648
|
+
189,
|
|
4649
|
+
64,
|
|
4650
|
+
232,
|
|
4651
|
+
82,
|
|
4652
|
+
177,
|
|
4653
|
+
100,
|
|
4654
|
+
99,
|
|
4655
|
+
58,
|
|
4656
|
+
74,
|
|
4657
|
+
203,
|
|
4658
|
+
211,
|
|
4659
|
+
36,
|
|
4660
|
+
76
|
|
4661
|
+
]);
|
|
4662
|
+
var MAX_MIGRATOR_ALLOWLIST = 32;
|
|
4663
|
+
var MAX_HOOK_ALLOWLIST2 = 32;
|
|
4664
|
+
var MAX_PAYLOAD = 256;
|
|
4665
|
+
var PHASE_TRADING = 0;
|
|
4666
|
+
var PHASE_MIGRATED = 1;
|
|
4667
|
+
var PHASE_ABORTED = 2;
|
|
4668
|
+
var TRADE_DIRECTION_BUY = 0;
|
|
4669
|
+
var TRADE_DIRECTION_SELL = 1;
|
|
4670
|
+
var CURVE_KIND_XYK = 0;
|
|
4671
|
+
var CURVE_PARAMS_FORMAT_XYK_V0 = 0;
|
|
4672
|
+
var HF_BEFORE_SWAP2 = 1 << 0;
|
|
4673
|
+
var HF_AFTER_SWAP2 = 1 << 1;
|
|
4674
|
+
var HF_BEFORE_CREATE = 1 << 2;
|
|
4675
|
+
var HF_AFTER_CREATE = 1 << 3;
|
|
4676
|
+
var HF_BEFORE_MIGRATE = 1 << 4;
|
|
4677
|
+
var HF_AFTER_MIGRATE = 1 << 5;
|
|
4678
|
+
var HF_FORWARD_READONLY_SIGNERS2 = 1 << 6;
|
|
4679
|
+
var HOOK_NO_CHANGE2 = 65535;
|
|
4680
|
+
var INITIALIZER_INSTRUCTION_DISCRIMINATORS = {
|
|
4681
|
+
// SHA256("global:initialize_config")[0:8]
|
|
4682
|
+
initializeConfig: new Uint8Array([
|
|
4683
|
+
208,
|
|
4684
|
+
127,
|
|
4685
|
+
21,
|
|
4686
|
+
1,
|
|
4687
|
+
194,
|
|
4688
|
+
190,
|
|
4689
|
+
196,
|
|
4690
|
+
70
|
|
4691
|
+
]),
|
|
4692
|
+
// SHA256("global:set_migrator_allowlist")[0:8]
|
|
4693
|
+
setMigratorAllowlist: new Uint8Array([
|
|
4694
|
+
209,
|
|
4695
|
+
90,
|
|
4696
|
+
181,
|
|
4697
|
+
104,
|
|
4698
|
+
99,
|
|
4699
|
+
108,
|
|
4700
|
+
233,
|
|
4701
|
+
168
|
|
4702
|
+
]),
|
|
4703
|
+
// SHA256("global:set_hook_allowlist")[0:8]
|
|
4704
|
+
setHookAllowlist: new Uint8Array([
|
|
4705
|
+
232,
|
|
4706
|
+
28,
|
|
4707
|
+
40,
|
|
4708
|
+
143,
|
|
4709
|
+
121,
|
|
4710
|
+
182,
|
|
4711
|
+
77,
|
|
4712
|
+
103
|
|
4713
|
+
]),
|
|
4714
|
+
// SHA256("global:initialize_launch")[0:8]
|
|
4715
|
+
initializeLaunch: new Uint8Array([
|
|
4716
|
+
90,
|
|
4717
|
+
201,
|
|
4718
|
+
220,
|
|
4719
|
+
142,
|
|
4720
|
+
112,
|
|
4721
|
+
253,
|
|
4722
|
+
100,
|
|
4723
|
+
13
|
|
4724
|
+
]),
|
|
4725
|
+
// SHA256("global:curve_swap_exact_in")[0:8]
|
|
4726
|
+
curveSwapExactIn: new Uint8Array([
|
|
4727
|
+
196,
|
|
4728
|
+
247,
|
|
4729
|
+
195,
|
|
4730
|
+
126,
|
|
4731
|
+
227,
|
|
4732
|
+
27,
|
|
4733
|
+
166,
|
|
4734
|
+
93
|
|
4735
|
+
]),
|
|
4736
|
+
// SHA256("global:migrate_launch")[0:8]
|
|
4737
|
+
migrateLaunch: new Uint8Array([
|
|
4738
|
+
19,
|
|
4739
|
+
199,
|
|
4740
|
+
119,
|
|
4741
|
+
103,
|
|
4742
|
+
13,
|
|
4743
|
+
30,
|
|
4744
|
+
12,
|
|
4745
|
+
205
|
|
4746
|
+
]),
|
|
4747
|
+
// SHA256("global:preview_swap_exact_in")[0:8]
|
|
4748
|
+
previewSwapExactIn: new Uint8Array([
|
|
4749
|
+
50,
|
|
4750
|
+
130,
|
|
4751
|
+
31,
|
|
4752
|
+
69,
|
|
4753
|
+
147,
|
|
4754
|
+
58,
|
|
4755
|
+
222,
|
|
4756
|
+
178
|
|
4757
|
+
]),
|
|
4758
|
+
// SHA256("global:preview_migration")[0:8]
|
|
4759
|
+
previewMigration: new Uint8Array([
|
|
4760
|
+
216,
|
|
4761
|
+
180,
|
|
4762
|
+
209,
|
|
4763
|
+
112,
|
|
4764
|
+
62,
|
|
4765
|
+
16,
|
|
4766
|
+
15,
|
|
4767
|
+
63
|
|
4768
|
+
])
|
|
4769
|
+
};
|
|
4770
|
+
var INITIALIZER_ACCOUNT_DISCRIMINATORS = {
|
|
4771
|
+
// SHA256("account:InitConfig")[0:8]
|
|
4772
|
+
InitConfig: new Uint8Array([97, 166, 35, 7, 20, 2, 164, 126]),
|
|
4773
|
+
// SHA256("account:Launch")[0:8]
|
|
4774
|
+
Launch: new Uint8Array([144, 51, 51, 163, 206, 85, 213, 38]),
|
|
4775
|
+
// SHA256("account:LaunchFeeState")[0:8]
|
|
4776
|
+
LaunchFeeState: new Uint8Array([
|
|
4777
|
+
1,
|
|
4778
|
+
106,
|
|
4779
|
+
55,
|
|
4780
|
+
241,
|
|
4781
|
+
179,
|
|
4782
|
+
18,
|
|
4783
|
+
230,
|
|
4784
|
+
232
|
|
4785
|
+
])
|
|
4786
|
+
};
|
|
4787
|
+
var INIT_CONFIG_DISCRIMINATOR = new Uint8Array([
|
|
4788
|
+
97,
|
|
4789
|
+
166,
|
|
4790
|
+
35,
|
|
4791
|
+
7,
|
|
4792
|
+
20,
|
|
4793
|
+
2,
|
|
4794
|
+
164,
|
|
4795
|
+
126
|
|
4796
|
+
]);
|
|
4797
|
+
function getInitConfigEncoder() {
|
|
4798
|
+
return transformEncoder(
|
|
4799
|
+
getStructEncoder([
|
|
4800
|
+
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
4801
|
+
["admin", getAddressEncoder()],
|
|
4802
|
+
["migratorAllowlistLen", getU8Encoder()],
|
|
4803
|
+
["migratorAllowlist", getArrayEncoder(getAddressEncoder(), { size: 32 })],
|
|
4804
|
+
["hookAllowlistLen", getU8Encoder()],
|
|
4805
|
+
["hookAllowlist", getArrayEncoder(getAddressEncoder(), { size: 32 })],
|
|
4806
|
+
["bump", getU8Encoder()],
|
|
4807
|
+
["version", getU8Encoder()],
|
|
4808
|
+
["protocolFeeBps", getU16Encoder()],
|
|
4809
|
+
["minSwapFeeBps", getU16Encoder()],
|
|
4810
|
+
["maxSwapFeeBps", getU16Encoder()],
|
|
4811
|
+
["reserved", fixEncoderSize(getBytesEncoder(), 24)]
|
|
4812
|
+
]),
|
|
4813
|
+
(value) => ({ ...value, discriminator: INIT_CONFIG_DISCRIMINATOR })
|
|
4814
|
+
);
|
|
4815
|
+
}
|
|
4816
|
+
function getInitConfigDecoder() {
|
|
4817
|
+
return getStructDecoder([
|
|
4818
|
+
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
4819
|
+
["admin", getAddressDecoder()],
|
|
4820
|
+
["migratorAllowlistLen", getU8Decoder()],
|
|
4821
|
+
["migratorAllowlist", getArrayDecoder(getAddressDecoder(), { size: 32 })],
|
|
3868
4822
|
["hookAllowlistLen", getU8Decoder()],
|
|
3869
4823
|
["hookAllowlist", getArrayDecoder(getAddressDecoder(), { size: 32 })],
|
|
3870
4824
|
["bump", getU8Decoder()],
|
|
3871
4825
|
["version", getU8Decoder()],
|
|
3872
|
-
["
|
|
4826
|
+
["protocolFeeBps", getU16Decoder()],
|
|
4827
|
+
["minSwapFeeBps", getU16Decoder()],
|
|
4828
|
+
["maxSwapFeeBps", getU16Decoder()],
|
|
4829
|
+
["reserved", fixDecoderSize(getBytesDecoder(), 24)]
|
|
3873
4830
|
]);
|
|
3874
4831
|
}
|
|
3875
4832
|
function getInitConfigCodec() {
|
|
3876
4833
|
return combineCodec(getInitConfigEncoder(), getInitConfigDecoder());
|
|
3877
4834
|
}
|
|
3878
|
-
function
|
|
4835
|
+
function getFeeBeneficiaryEncoder() {
|
|
4836
|
+
return getStructEncoder([
|
|
4837
|
+
["wallet", getAddressEncoder()],
|
|
4838
|
+
["shareBps", getU16Encoder()],
|
|
4839
|
+
["pad", fixEncoderSize(getBytesEncoder(), 6)]
|
|
4840
|
+
]);
|
|
4841
|
+
}
|
|
4842
|
+
function getFeeBeneficiaryDecoder() {
|
|
4843
|
+
return getStructDecoder([
|
|
4844
|
+
["wallet", getAddressDecoder()],
|
|
4845
|
+
["shareBps", getU16Decoder()],
|
|
4846
|
+
["pad", fixDecoderSize(getBytesDecoder(), 6)]
|
|
4847
|
+
]);
|
|
4848
|
+
}
|
|
4849
|
+
function getFeeBeneficiaryInputEncoder() {
|
|
4850
|
+
return getStructEncoder([
|
|
4851
|
+
["wallet", getAddressEncoder()],
|
|
4852
|
+
["shareBps", getU16Encoder()]
|
|
4853
|
+
]);
|
|
4854
|
+
}
|
|
4855
|
+
function getFeeBeneficiaryInputDecoder() {
|
|
4856
|
+
return getStructDecoder([
|
|
4857
|
+
["wallet", getAddressDecoder()],
|
|
4858
|
+
["shareBps", getU16Decoder()]
|
|
4859
|
+
]);
|
|
4860
|
+
}
|
|
4861
|
+
function getInitializeConfigArgsEncoder2() {
|
|
3879
4862
|
return getStructEncoder([
|
|
3880
4863
|
["migratorAllowlist", getArrayEncoder(getAddressEncoder())],
|
|
3881
|
-
["hookAllowlist", getArrayEncoder(getAddressEncoder())]
|
|
4864
|
+
["hookAllowlist", getArrayEncoder(getAddressEncoder())],
|
|
4865
|
+
["protocolFeeBps", getU16Encoder()],
|
|
4866
|
+
["minSwapFeeBps", getU16Encoder()],
|
|
4867
|
+
["maxSwapFeeBps", getU16Encoder()]
|
|
3882
4868
|
]);
|
|
3883
4869
|
}
|
|
3884
|
-
function
|
|
4870
|
+
function getInitializeConfigArgsDecoder2() {
|
|
3885
4871
|
return getStructDecoder([
|
|
3886
4872
|
["migratorAllowlist", getArrayDecoder(getAddressDecoder())],
|
|
3887
|
-
["hookAllowlist", getArrayDecoder(getAddressDecoder())]
|
|
4873
|
+
["hookAllowlist", getArrayDecoder(getAddressDecoder())],
|
|
4874
|
+
["protocolFeeBps", getU16Decoder()],
|
|
4875
|
+
["minSwapFeeBps", getU16Decoder()],
|
|
4876
|
+
["maxSwapFeeBps", getU16Decoder()]
|
|
3888
4877
|
]);
|
|
3889
4878
|
}
|
|
3890
|
-
function
|
|
4879
|
+
function getInitializeConfigArgsCodec2() {
|
|
3891
4880
|
return combineCodec(
|
|
3892
|
-
|
|
3893
|
-
|
|
4881
|
+
getInitializeConfigArgsEncoder2(),
|
|
4882
|
+
getInitializeConfigArgsDecoder2()
|
|
3894
4883
|
);
|
|
3895
4884
|
}
|
|
3896
4885
|
function getInitializeLaunchArgsEncoder() {
|
|
@@ -3903,7 +4892,7 @@ function getInitializeLaunchArgsEncoder() {
|
|
|
3903
4892
|
["baseForLiquidity", getU64Encoder()],
|
|
3904
4893
|
["curveVirtualBase", getU64Encoder()],
|
|
3905
4894
|
["curveVirtualQuote", getU64Encoder()],
|
|
3906
|
-
["
|
|
4895
|
+
["swapFeeBps", getU16Encoder()],
|
|
3907
4896
|
["curveKind", getU8Encoder()],
|
|
3908
4897
|
["curveParams", addEncoderSizePrefix(getBytesEncoder(), getU32Encoder())],
|
|
3909
4898
|
["allowBuy", getU8Encoder()],
|
|
@@ -3930,7 +4919,8 @@ function getInitializeLaunchArgsEncoder() {
|
|
|
3930
4919
|
["migratorRemainingAccountsHash", fixEncoderSize(getBytesEncoder(), 32)],
|
|
3931
4920
|
["metadataName", addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())],
|
|
3932
4921
|
["metadataSymbol", addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())],
|
|
3933
|
-
["metadataUri", addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())]
|
|
4922
|
+
["metadataUri", addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())],
|
|
4923
|
+
["feeBeneficiaries", getArrayEncoder(getFeeBeneficiaryInputEncoder())]
|
|
3934
4924
|
]);
|
|
3935
4925
|
}
|
|
3936
4926
|
function getInitializeLaunchArgsDecoder() {
|
|
@@ -3943,7 +4933,7 @@ function getInitializeLaunchArgsDecoder() {
|
|
|
3943
4933
|
["baseForLiquidity", getU64Decoder()],
|
|
3944
4934
|
["curveVirtualBase", getU64Decoder()],
|
|
3945
4935
|
["curveVirtualQuote", getU64Decoder()],
|
|
3946
|
-
["
|
|
4936
|
+
["swapFeeBps", getU16Decoder()],
|
|
3947
4937
|
["curveKind", getU8Decoder()],
|
|
3948
4938
|
["curveParams", addDecoderSizePrefix(getBytesDecoder(), getU32Decoder())],
|
|
3949
4939
|
["allowBuy", getU8Decoder()],
|
|
@@ -3970,7 +4960,8 @@ function getInitializeLaunchArgsDecoder() {
|
|
|
3970
4960
|
["migratorRemainingAccountsHash", fixDecoderSize(getBytesDecoder(), 32)],
|
|
3971
4961
|
["metadataName", addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())],
|
|
3972
4962
|
["metadataSymbol", addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())],
|
|
3973
|
-
["metadataUri", addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())]
|
|
4963
|
+
["metadataUri", addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())],
|
|
4964
|
+
["feeBeneficiaries", getArrayDecoder(getFeeBeneficiaryInputDecoder())]
|
|
3974
4965
|
]);
|
|
3975
4966
|
}
|
|
3976
4967
|
function getInitializeLaunchArgsCodec() {
|
|
@@ -4024,7 +5015,7 @@ function getLaunchEncoder() {
|
|
|
4024
5015
|
["baseForCurve", getU64Encoder()],
|
|
4025
5016
|
["curveVirtualBase", getU64Encoder()],
|
|
4026
5017
|
["curveVirtualQuote", getU64Encoder()],
|
|
4027
|
-
["
|
|
5018
|
+
["swapFeeBps", getU16Encoder()],
|
|
4028
5019
|
["pad1", fixEncoderSize(getBytesEncoder(), 6)],
|
|
4029
5020
|
["allowBuy", getU8Encoder()],
|
|
4030
5021
|
["allowSell", getU8Encoder()],
|
|
@@ -4066,7 +5057,7 @@ function getLaunchDecoder() {
|
|
|
4066
5057
|
["baseForCurve", getU64Decoder()],
|
|
4067
5058
|
["curveVirtualBase", getU64Decoder()],
|
|
4068
5059
|
["curveVirtualQuote", getU64Decoder()],
|
|
4069
|
-
["
|
|
5060
|
+
["swapFeeBps", getU16Decoder()],
|
|
4070
5061
|
["pad1", fixDecoderSize(getBytesDecoder(), 6)],
|
|
4071
5062
|
["allowBuy", getU8Decoder()],
|
|
4072
5063
|
["allowSell", getU8Decoder()],
|
|
@@ -4089,6 +5080,217 @@ function getLaunchDecoder() {
|
|
|
4089
5080
|
function getLaunchCodec() {
|
|
4090
5081
|
return combineCodec(getLaunchEncoder(), getLaunchDecoder());
|
|
4091
5082
|
}
|
|
5083
|
+
var LAUNCH_FEE_STATE_DISCRIMINATOR = new Uint8Array([
|
|
5084
|
+
1,
|
|
5085
|
+
106,
|
|
5086
|
+
55,
|
|
5087
|
+
241,
|
|
5088
|
+
179,
|
|
5089
|
+
18,
|
|
5090
|
+
230,
|
|
5091
|
+
232
|
|
5092
|
+
]);
|
|
5093
|
+
function getLaunchFeeStateEncoder() {
|
|
5094
|
+
return transformEncoder(
|
|
5095
|
+
getStructEncoder([
|
|
5096
|
+
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
5097
|
+
["launch", getAddressEncoder()],
|
|
5098
|
+
["protocolBeneficiary", getAddressEncoder()],
|
|
5099
|
+
["beneficiaryLen", getU8Encoder()],
|
|
5100
|
+
["bump", getU8Encoder()],
|
|
5101
|
+
["protocolFeeBps", getU16Encoder()],
|
|
5102
|
+
["swapFeeBps", getU16Encoder()],
|
|
5103
|
+
["version", getU8Encoder()],
|
|
5104
|
+
["pad0", fixEncoderSize(getBytesEncoder(), 1)],
|
|
5105
|
+
[
|
|
5106
|
+
"beneficiaries",
|
|
5107
|
+
getArrayEncoder(getFeeBeneficiaryEncoder(), { size: 8 })
|
|
5108
|
+
],
|
|
5109
|
+
["cumulatedBaseFees", getU64Encoder()],
|
|
5110
|
+
["cumulatedQuoteFees", getU64Encoder()],
|
|
5111
|
+
["distributedProtocolBaseFees", getU64Encoder()],
|
|
5112
|
+
["distributedProtocolQuoteFees", getU64Encoder()],
|
|
5113
|
+
[
|
|
5114
|
+
"distributedBaseByBeneficiary",
|
|
5115
|
+
getArrayEncoder(getU64Encoder(), { size: 8 })
|
|
5116
|
+
],
|
|
5117
|
+
[
|
|
5118
|
+
"distributedQuoteByBeneficiary",
|
|
5119
|
+
getArrayEncoder(getU64Encoder(), { size: 8 })
|
|
5120
|
+
],
|
|
5121
|
+
["migratedPool", getAddressEncoder()],
|
|
5122
|
+
["migratedPosition", getAddressEncoder()],
|
|
5123
|
+
["reserved", fixEncoderSize(getBytesEncoder(), 64)]
|
|
5124
|
+
]),
|
|
5125
|
+
(value) => ({ ...value, discriminator: LAUNCH_FEE_STATE_DISCRIMINATOR })
|
|
5126
|
+
);
|
|
5127
|
+
}
|
|
5128
|
+
function getLaunchFeeStateDecoder() {
|
|
5129
|
+
return getStructDecoder([
|
|
5130
|
+
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
5131
|
+
["launch", getAddressDecoder()],
|
|
5132
|
+
["protocolBeneficiary", getAddressDecoder()],
|
|
5133
|
+
["beneficiaryLen", getU8Decoder()],
|
|
5134
|
+
["bump", getU8Decoder()],
|
|
5135
|
+
["protocolFeeBps", getU16Decoder()],
|
|
5136
|
+
["swapFeeBps", getU16Decoder()],
|
|
5137
|
+
["version", getU8Decoder()],
|
|
5138
|
+
["pad0", fixDecoderSize(getBytesDecoder(), 1)],
|
|
5139
|
+
["beneficiaries", getArrayDecoder(getFeeBeneficiaryDecoder(), { size: 8 })],
|
|
5140
|
+
["cumulatedBaseFees", getU64Decoder()],
|
|
5141
|
+
["cumulatedQuoteFees", getU64Decoder()],
|
|
5142
|
+
["distributedProtocolBaseFees", getU64Decoder()],
|
|
5143
|
+
["distributedProtocolQuoteFees", getU64Decoder()],
|
|
5144
|
+
[
|
|
5145
|
+
"distributedBaseByBeneficiary",
|
|
5146
|
+
getArrayDecoder(getU64Decoder(), { size: 8 })
|
|
5147
|
+
],
|
|
5148
|
+
[
|
|
5149
|
+
"distributedQuoteByBeneficiary",
|
|
5150
|
+
getArrayDecoder(getU64Decoder(), { size: 8 })
|
|
5151
|
+
],
|
|
5152
|
+
["migratedPool", getAddressDecoder()],
|
|
5153
|
+
["migratedPosition", getAddressDecoder()],
|
|
5154
|
+
["reserved", fixDecoderSize(getBytesDecoder(), 64)]
|
|
5155
|
+
]);
|
|
5156
|
+
}
|
|
5157
|
+
function getLaunchFeeStateCodec() {
|
|
5158
|
+
return combineCodec(getLaunchFeeStateEncoder(), getLaunchFeeStateDecoder());
|
|
5159
|
+
}
|
|
5160
|
+
var CLAIM_FEES_DISCRIMINATOR = new Uint8Array([
|
|
5161
|
+
82,
|
|
5162
|
+
251,
|
|
5163
|
+
233,
|
|
5164
|
+
156,
|
|
5165
|
+
12,
|
|
5166
|
+
52,
|
|
5167
|
+
184,
|
|
5168
|
+
202
|
|
5169
|
+
]);
|
|
5170
|
+
function getClaimFeesInstructionDataEncoder() {
|
|
5171
|
+
return transformEncoder(
|
|
5172
|
+
getStructEncoder([["discriminator", fixEncoderSize(getBytesEncoder(), 8)]]),
|
|
5173
|
+
(value) => ({ ...value, discriminator: CLAIM_FEES_DISCRIMINATOR })
|
|
5174
|
+
);
|
|
5175
|
+
}
|
|
5176
|
+
async function getClaimFeesInstructionAsync(input, config) {
|
|
5177
|
+
const programAddress = config?.programAddress ?? INITIALIZER_PROGRAM_ADDRESS;
|
|
5178
|
+
const originalAccounts = {
|
|
5179
|
+
launch: { value: input.launch ?? null, isWritable: false },
|
|
5180
|
+
launchFeeState: { value: input.launchFeeState ?? null, isWritable: true },
|
|
5181
|
+
launchAuthority: {
|
|
5182
|
+
value: input.launchAuthority ?? null,
|
|
5183
|
+
isWritable: false
|
|
5184
|
+
},
|
|
5185
|
+
recipient: { value: input.recipient ?? null, isWritable: false },
|
|
5186
|
+
baseMint: { value: input.baseMint ?? null, isWritable: false },
|
|
5187
|
+
quoteMint: { value: input.quoteMint ?? null, isWritable: false },
|
|
5188
|
+
baseVault: { value: input.baseVault ?? null, isWritable: true },
|
|
5189
|
+
quoteVault: { value: input.quoteVault ?? null, isWritable: true },
|
|
5190
|
+
recipientBaseAta: {
|
|
5191
|
+
value: input.recipientBaseAta ?? null,
|
|
5192
|
+
isWritable: true
|
|
5193
|
+
},
|
|
5194
|
+
recipientQuoteAta: {
|
|
5195
|
+
value: input.recipientQuoteAta ?? null,
|
|
5196
|
+
isWritable: true
|
|
5197
|
+
},
|
|
5198
|
+
baseTokenProgram: {
|
|
5199
|
+
value: input.baseTokenProgram ?? null,
|
|
5200
|
+
isWritable: false
|
|
5201
|
+
},
|
|
5202
|
+
quoteTokenProgram: {
|
|
5203
|
+
value: input.quoteTokenProgram ?? null,
|
|
5204
|
+
isWritable: false
|
|
5205
|
+
}
|
|
5206
|
+
};
|
|
5207
|
+
const accounts = originalAccounts;
|
|
5208
|
+
if (!accounts.launchFeeState.value) {
|
|
5209
|
+
accounts.launchFeeState.value = await getProgramDerivedAddress({
|
|
5210
|
+
programAddress,
|
|
5211
|
+
seeds: [
|
|
5212
|
+
getBytesEncoder().encode(
|
|
5213
|
+
new Uint8Array([
|
|
5214
|
+
108,
|
|
5215
|
+
97,
|
|
5216
|
+
117,
|
|
5217
|
+
110,
|
|
5218
|
+
99,
|
|
5219
|
+
104,
|
|
5220
|
+
95,
|
|
5221
|
+
102,
|
|
5222
|
+
101,
|
|
5223
|
+
101,
|
|
5224
|
+
95,
|
|
5225
|
+
115,
|
|
5226
|
+
116,
|
|
5227
|
+
97,
|
|
5228
|
+
116,
|
|
5229
|
+
101
|
|
5230
|
+
])
|
|
5231
|
+
),
|
|
5232
|
+
getAddressEncoder().encode(
|
|
5233
|
+
getAddressFromResolvedInstructionAccount(
|
|
5234
|
+
"launch",
|
|
5235
|
+
accounts.launch.value
|
|
5236
|
+
)
|
|
5237
|
+
)
|
|
5238
|
+
]
|
|
5239
|
+
});
|
|
5240
|
+
}
|
|
5241
|
+
if (!accounts.launchAuthority.value) {
|
|
5242
|
+
accounts.launchAuthority.value = await getProgramDerivedAddress({
|
|
5243
|
+
programAddress,
|
|
5244
|
+
seeds: [
|
|
5245
|
+
getBytesEncoder().encode(
|
|
5246
|
+
new Uint8Array([
|
|
5247
|
+
108,
|
|
5248
|
+
97,
|
|
5249
|
+
117,
|
|
5250
|
+
110,
|
|
5251
|
+
99,
|
|
5252
|
+
104,
|
|
5253
|
+
95,
|
|
5254
|
+
97,
|
|
5255
|
+
117,
|
|
5256
|
+
116,
|
|
5257
|
+
104,
|
|
5258
|
+
111,
|
|
5259
|
+
114,
|
|
5260
|
+
105,
|
|
5261
|
+
116,
|
|
5262
|
+
121
|
|
5263
|
+
])
|
|
5264
|
+
),
|
|
5265
|
+
getAddressEncoder().encode(
|
|
5266
|
+
getAddressFromResolvedInstructionAccount(
|
|
5267
|
+
"launch",
|
|
5268
|
+
accounts.launch.value
|
|
5269
|
+
)
|
|
5270
|
+
)
|
|
5271
|
+
]
|
|
5272
|
+
});
|
|
5273
|
+
}
|
|
5274
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
5275
|
+
return Object.freeze({
|
|
5276
|
+
accounts: [
|
|
5277
|
+
getAccountMeta("launch", accounts.launch),
|
|
5278
|
+
getAccountMeta("launchFeeState", accounts.launchFeeState),
|
|
5279
|
+
getAccountMeta("launchAuthority", accounts.launchAuthority),
|
|
5280
|
+
getAccountMeta("recipient", accounts.recipient),
|
|
5281
|
+
getAccountMeta("baseMint", accounts.baseMint),
|
|
5282
|
+
getAccountMeta("quoteMint", accounts.quoteMint),
|
|
5283
|
+
getAccountMeta("baseVault", accounts.baseVault),
|
|
5284
|
+
getAccountMeta("quoteVault", accounts.quoteVault),
|
|
5285
|
+
getAccountMeta("recipientBaseAta", accounts.recipientBaseAta),
|
|
5286
|
+
getAccountMeta("recipientQuoteAta", accounts.recipientQuoteAta),
|
|
5287
|
+
getAccountMeta("baseTokenProgram", accounts.baseTokenProgram),
|
|
5288
|
+
getAccountMeta("quoteTokenProgram", accounts.quoteTokenProgram)
|
|
5289
|
+
],
|
|
5290
|
+
data: getClaimFeesInstructionDataEncoder().encode({}),
|
|
5291
|
+
programAddress
|
|
5292
|
+
});
|
|
5293
|
+
}
|
|
4092
5294
|
var CURVE_SWAP_EXACT_IN_DISCRIMINATOR = new Uint8Array([
|
|
4093
5295
|
196,
|
|
4094
5296
|
247,
|
|
@@ -4110,7 +5312,154 @@ function getCurveSwapExactInInstructionDataEncoder() {
|
|
|
4110
5312
|
(value) => ({ ...value, discriminator: CURVE_SWAP_EXACT_IN_DISCRIMINATOR })
|
|
4111
5313
|
);
|
|
4112
5314
|
}
|
|
4113
|
-
var
|
|
5315
|
+
var HARVEST_MIGRATED_FEES_DISCRIMINATOR = new Uint8Array([
|
|
5316
|
+
63,
|
|
5317
|
+
77,
|
|
5318
|
+
73,
|
|
5319
|
+
117,
|
|
5320
|
+
2,
|
|
5321
|
+
43,
|
|
5322
|
+
255,
|
|
5323
|
+
176
|
|
5324
|
+
]);
|
|
5325
|
+
function getHarvestMigratedFeesInstructionDataEncoder() {
|
|
5326
|
+
return transformEncoder(
|
|
5327
|
+
getStructEncoder([["discriminator", fixEncoderSize(getBytesEncoder(), 8)]]),
|
|
5328
|
+
(value) => ({
|
|
5329
|
+
...value,
|
|
5330
|
+
discriminator: HARVEST_MIGRATED_FEES_DISCRIMINATOR
|
|
5331
|
+
})
|
|
5332
|
+
);
|
|
5333
|
+
}
|
|
5334
|
+
async function getHarvestMigratedFeesInstructionAsync(input, config) {
|
|
5335
|
+
const programAddress = config?.programAddress ?? INITIALIZER_PROGRAM_ADDRESS;
|
|
5336
|
+
const originalAccounts = {
|
|
5337
|
+
launch: { value: input.launch ?? null, isWritable: false },
|
|
5338
|
+
launchFeeState: { value: input.launchFeeState ?? null, isWritable: true },
|
|
5339
|
+
launchAuthority: {
|
|
5340
|
+
value: input.launchAuthority ?? null,
|
|
5341
|
+
isWritable: false
|
|
5342
|
+
},
|
|
5343
|
+
baseMint: { value: input.baseMint ?? null, isWritable: false },
|
|
5344
|
+
quoteMint: { value: input.quoteMint ?? null, isWritable: false },
|
|
5345
|
+
baseVault: { value: input.baseVault ?? null, isWritable: true },
|
|
5346
|
+
quoteVault: { value: input.quoteVault ?? null, isWritable: true },
|
|
5347
|
+
pool: { value: input.pool ?? null, isWritable: true },
|
|
5348
|
+
launchLpPosition: {
|
|
5349
|
+
value: input.launchLpPosition ?? null,
|
|
5350
|
+
isWritable: true
|
|
5351
|
+
},
|
|
5352
|
+
poolAuthority: { value: input.poolAuthority ?? null, isWritable: false },
|
|
5353
|
+
poolVault0: { value: input.poolVault0 ?? null, isWritable: true },
|
|
5354
|
+
poolVault1: { value: input.poolVault1 ?? null, isWritable: true },
|
|
5355
|
+
token0Mint: { value: input.token0Mint ?? null, isWritable: false },
|
|
5356
|
+
token1Mint: { value: input.token1Mint ?? null, isWritable: false },
|
|
5357
|
+
cpmmProgram: { value: input.cpmmProgram ?? null, isWritable: false },
|
|
5358
|
+
baseTokenProgram: {
|
|
5359
|
+
value: input.baseTokenProgram ?? null,
|
|
5360
|
+
isWritable: false
|
|
5361
|
+
},
|
|
5362
|
+
quoteTokenProgram: {
|
|
5363
|
+
value: input.quoteTokenProgram ?? null,
|
|
5364
|
+
isWritable: false
|
|
5365
|
+
}
|
|
5366
|
+
};
|
|
5367
|
+
const accounts = originalAccounts;
|
|
5368
|
+
if (!accounts.launchFeeState.value) {
|
|
5369
|
+
accounts.launchFeeState.value = await getProgramDerivedAddress({
|
|
5370
|
+
programAddress,
|
|
5371
|
+
seeds: [
|
|
5372
|
+
getBytesEncoder().encode(
|
|
5373
|
+
new Uint8Array([
|
|
5374
|
+
108,
|
|
5375
|
+
97,
|
|
5376
|
+
117,
|
|
5377
|
+
110,
|
|
5378
|
+
99,
|
|
5379
|
+
104,
|
|
5380
|
+
95,
|
|
5381
|
+
102,
|
|
5382
|
+
101,
|
|
5383
|
+
101,
|
|
5384
|
+
95,
|
|
5385
|
+
115,
|
|
5386
|
+
116,
|
|
5387
|
+
97,
|
|
5388
|
+
116,
|
|
5389
|
+
101
|
|
5390
|
+
])
|
|
5391
|
+
),
|
|
5392
|
+
getAddressEncoder().encode(
|
|
5393
|
+
getAddressFromResolvedInstructionAccount(
|
|
5394
|
+
"launch",
|
|
5395
|
+
accounts.launch.value
|
|
5396
|
+
)
|
|
5397
|
+
)
|
|
5398
|
+
]
|
|
5399
|
+
});
|
|
5400
|
+
}
|
|
5401
|
+
if (!accounts.launchAuthority.value) {
|
|
5402
|
+
accounts.launchAuthority.value = await getProgramDerivedAddress({
|
|
5403
|
+
programAddress,
|
|
5404
|
+
seeds: [
|
|
5405
|
+
getBytesEncoder().encode(
|
|
5406
|
+
new Uint8Array([
|
|
5407
|
+
108,
|
|
5408
|
+
97,
|
|
5409
|
+
117,
|
|
5410
|
+
110,
|
|
5411
|
+
99,
|
|
5412
|
+
104,
|
|
5413
|
+
95,
|
|
5414
|
+
97,
|
|
5415
|
+
117,
|
|
5416
|
+
116,
|
|
5417
|
+
104,
|
|
5418
|
+
111,
|
|
5419
|
+
114,
|
|
5420
|
+
105,
|
|
5421
|
+
116,
|
|
5422
|
+
121
|
|
5423
|
+
])
|
|
5424
|
+
),
|
|
5425
|
+
getAddressEncoder().encode(
|
|
5426
|
+
getAddressFromResolvedInstructionAccount(
|
|
5427
|
+
"launch",
|
|
5428
|
+
accounts.launch.value
|
|
5429
|
+
)
|
|
5430
|
+
)
|
|
5431
|
+
]
|
|
5432
|
+
});
|
|
5433
|
+
}
|
|
5434
|
+
if (!accounts.cpmmProgram.value) {
|
|
5435
|
+
accounts.cpmmProgram.value = "9PSxVPoPfnbZ8Q1uQhgS6ZxvBjFboZtebNsu34umxkgQ";
|
|
5436
|
+
}
|
|
5437
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
5438
|
+
return Object.freeze({
|
|
5439
|
+
accounts: [
|
|
5440
|
+
getAccountMeta("launch", accounts.launch),
|
|
5441
|
+
getAccountMeta("launchFeeState", accounts.launchFeeState),
|
|
5442
|
+
getAccountMeta("launchAuthority", accounts.launchAuthority),
|
|
5443
|
+
getAccountMeta("baseMint", accounts.baseMint),
|
|
5444
|
+
getAccountMeta("quoteMint", accounts.quoteMint),
|
|
5445
|
+
getAccountMeta("baseVault", accounts.baseVault),
|
|
5446
|
+
getAccountMeta("quoteVault", accounts.quoteVault),
|
|
5447
|
+
getAccountMeta("pool", accounts.pool),
|
|
5448
|
+
getAccountMeta("launchLpPosition", accounts.launchLpPosition),
|
|
5449
|
+
getAccountMeta("poolAuthority", accounts.poolAuthority),
|
|
5450
|
+
getAccountMeta("poolVault0", accounts.poolVault0),
|
|
5451
|
+
getAccountMeta("poolVault1", accounts.poolVault1),
|
|
5452
|
+
getAccountMeta("token0Mint", accounts.token0Mint),
|
|
5453
|
+
getAccountMeta("token1Mint", accounts.token1Mint),
|
|
5454
|
+
getAccountMeta("cpmmProgram", accounts.cpmmProgram),
|
|
5455
|
+
getAccountMeta("baseTokenProgram", accounts.baseTokenProgram),
|
|
5456
|
+
getAccountMeta("quoteTokenProgram", accounts.quoteTokenProgram)
|
|
5457
|
+
],
|
|
5458
|
+
data: getHarvestMigratedFeesInstructionDataEncoder().encode({}),
|
|
5459
|
+
programAddress
|
|
5460
|
+
});
|
|
5461
|
+
}
|
|
5462
|
+
var INITIALIZE_CONFIG_DISCRIMINATOR3 = new Uint8Array([
|
|
4114
5463
|
208,
|
|
4115
5464
|
127,
|
|
4116
5465
|
21,
|
|
@@ -4120,14 +5469,17 @@ var INITIALIZE_CONFIG_DISCRIMINATOR2 = new Uint8Array([
|
|
|
4120
5469
|
196,
|
|
4121
5470
|
70
|
|
4122
5471
|
]);
|
|
4123
|
-
function
|
|
5472
|
+
function getInitializeConfigInstructionDataEncoder3() {
|
|
4124
5473
|
return transformEncoder(
|
|
4125
5474
|
getStructEncoder([
|
|
4126
5475
|
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
4127
5476
|
["migratorAllowlist", getArrayEncoder(getAddressEncoder())],
|
|
4128
|
-
["hookAllowlist", getArrayEncoder(getAddressEncoder())]
|
|
5477
|
+
["hookAllowlist", getArrayEncoder(getAddressEncoder())],
|
|
5478
|
+
["protocolFeeBps", getU16Encoder()],
|
|
5479
|
+
["minSwapFeeBps", getU16Encoder()],
|
|
5480
|
+
["maxSwapFeeBps", getU16Encoder()]
|
|
4129
5481
|
]),
|
|
4130
|
-
(value) => ({ ...value, discriminator:
|
|
5482
|
+
(value) => ({ ...value, discriminator: INITIALIZE_CONFIG_DISCRIMINATOR3 })
|
|
4131
5483
|
);
|
|
4132
5484
|
}
|
|
4133
5485
|
var INITIALIZE_LAUNCH_DISCRIMINATOR = new Uint8Array([
|
|
@@ -4152,7 +5504,7 @@ function getInitializeLaunchInstructionDataEncoder() {
|
|
|
4152
5504
|
["baseForLiquidity", getU64Encoder()],
|
|
4153
5505
|
["curveVirtualBase", getU64Encoder()],
|
|
4154
5506
|
["curveVirtualQuote", getU64Encoder()],
|
|
4155
|
-
["
|
|
5507
|
+
["swapFeeBps", getU16Encoder()],
|
|
4156
5508
|
["curveKind", getU8Encoder()],
|
|
4157
5509
|
["curveParams", addEncoderSizePrefix(getBytesEncoder(), getU32Encoder())],
|
|
4158
5510
|
["allowBuy", getU8Encoder()],
|
|
@@ -4185,7 +5537,8 @@ function getInitializeLaunchInstructionDataEncoder() {
|
|
|
4185
5537
|
"metadataSymbol",
|
|
4186
5538
|
addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())
|
|
4187
5539
|
],
|
|
4188
|
-
["metadataUri", addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())]
|
|
5540
|
+
["metadataUri", addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())],
|
|
5541
|
+
["feeBeneficiaries", getArrayEncoder(getFeeBeneficiaryInputEncoder())]
|
|
4189
5542
|
]),
|
|
4190
5543
|
(value) => ({ ...value, discriminator: INITIALIZE_LAUNCH_DISCRIMINATOR })
|
|
4191
5544
|
);
|
|
@@ -4213,6 +5566,135 @@ function getPreviewSwapExactInInstructionDataEncoder2() {
|
|
|
4213
5566
|
})
|
|
4214
5567
|
);
|
|
4215
5568
|
}
|
|
5569
|
+
var REPLACE_FEE_BENEFICIARY_DISCRIMINATOR = new Uint8Array([
|
|
5570
|
+
125,
|
|
5571
|
+
194,
|
|
5572
|
+
227,
|
|
5573
|
+
81,
|
|
5574
|
+
175,
|
|
5575
|
+
100,
|
|
5576
|
+
78,
|
|
5577
|
+
200
|
|
5578
|
+
]);
|
|
5579
|
+
function getReplaceFeeBeneficiaryInstructionDataEncoder() {
|
|
5580
|
+
return transformEncoder(
|
|
5581
|
+
getStructEncoder([
|
|
5582
|
+
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
5583
|
+
["newBeneficiary", getAddressEncoder()]
|
|
5584
|
+
]),
|
|
5585
|
+
(value) => ({
|
|
5586
|
+
...value,
|
|
5587
|
+
discriminator: REPLACE_FEE_BENEFICIARY_DISCRIMINATOR
|
|
5588
|
+
})
|
|
5589
|
+
);
|
|
5590
|
+
}
|
|
5591
|
+
async function getReplaceFeeBeneficiaryInstructionAsync(input, config) {
|
|
5592
|
+
const programAddress = config?.programAddress ?? INITIALIZER_PROGRAM_ADDRESS;
|
|
5593
|
+
const originalAccounts = {
|
|
5594
|
+
launch: { value: input.launch ?? null, isWritable: false },
|
|
5595
|
+
launchFeeState: { value: input.launchFeeState ?? null, isWritable: true },
|
|
5596
|
+
currentBeneficiary: {
|
|
5597
|
+
value: input.currentBeneficiary ?? null,
|
|
5598
|
+
isWritable: false
|
|
5599
|
+
}
|
|
5600
|
+
};
|
|
5601
|
+
const accounts = originalAccounts;
|
|
5602
|
+
const args = { ...input };
|
|
5603
|
+
if (!accounts.launchFeeState.value) {
|
|
5604
|
+
accounts.launchFeeState.value = await getProgramDerivedAddress({
|
|
5605
|
+
programAddress,
|
|
5606
|
+
seeds: [
|
|
5607
|
+
getBytesEncoder().encode(
|
|
5608
|
+
new Uint8Array([
|
|
5609
|
+
108,
|
|
5610
|
+
97,
|
|
5611
|
+
117,
|
|
5612
|
+
110,
|
|
5613
|
+
99,
|
|
5614
|
+
104,
|
|
5615
|
+
95,
|
|
5616
|
+
102,
|
|
5617
|
+
101,
|
|
5618
|
+
101,
|
|
5619
|
+
95,
|
|
5620
|
+
115,
|
|
5621
|
+
116,
|
|
5622
|
+
97,
|
|
5623
|
+
116,
|
|
5624
|
+
101
|
|
5625
|
+
])
|
|
5626
|
+
),
|
|
5627
|
+
getAddressEncoder().encode(
|
|
5628
|
+
getAddressFromResolvedInstructionAccount(
|
|
5629
|
+
"launch",
|
|
5630
|
+
accounts.launch.value
|
|
5631
|
+
)
|
|
5632
|
+
)
|
|
5633
|
+
]
|
|
5634
|
+
});
|
|
5635
|
+
}
|
|
5636
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
5637
|
+
return Object.freeze({
|
|
5638
|
+
accounts: [
|
|
5639
|
+
getAccountMeta("launch", accounts.launch),
|
|
5640
|
+
getAccountMeta("launchFeeState", accounts.launchFeeState),
|
|
5641
|
+
getAccountMeta("currentBeneficiary", accounts.currentBeneficiary)
|
|
5642
|
+
],
|
|
5643
|
+
data: getReplaceFeeBeneficiaryInstructionDataEncoder().encode(
|
|
5644
|
+
args
|
|
5645
|
+
),
|
|
5646
|
+
programAddress
|
|
5647
|
+
});
|
|
5648
|
+
}
|
|
5649
|
+
var SET_FEE_POLICY_DISCRIMINATOR = new Uint8Array([
|
|
5650
|
+
91,
|
|
5651
|
+
32,
|
|
5652
|
+
224,
|
|
5653
|
+
109,
|
|
5654
|
+
147,
|
|
5655
|
+
98,
|
|
5656
|
+
71,
|
|
5657
|
+
132
|
|
5658
|
+
]);
|
|
5659
|
+
function getSetFeePolicyInstructionDataEncoder() {
|
|
5660
|
+
return transformEncoder(
|
|
5661
|
+
getStructEncoder([
|
|
5662
|
+
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
5663
|
+
["protocolFeeBps", getU16Encoder()],
|
|
5664
|
+
["minSwapFeeBps", getU16Encoder()],
|
|
5665
|
+
["maxSwapFeeBps", getU16Encoder()]
|
|
5666
|
+
]),
|
|
5667
|
+
(value) => ({ ...value, discriminator: SET_FEE_POLICY_DISCRIMINATOR })
|
|
5668
|
+
);
|
|
5669
|
+
}
|
|
5670
|
+
async function getSetFeePolicyInstructionAsync(input, config) {
|
|
5671
|
+
const programAddress = config?.programAddress ?? INITIALIZER_PROGRAM_ADDRESS;
|
|
5672
|
+
const originalAccounts = {
|
|
5673
|
+
config: { value: input.config ?? null, isWritable: true },
|
|
5674
|
+
admin: { value: input.admin ?? null, isWritable: false }
|
|
5675
|
+
};
|
|
5676
|
+
const accounts = originalAccounts;
|
|
5677
|
+
const args = { ...input };
|
|
5678
|
+
if (!accounts.config.value) {
|
|
5679
|
+
accounts.config.value = await getProgramDerivedAddress({
|
|
5680
|
+
programAddress,
|
|
5681
|
+
seeds: [
|
|
5682
|
+
getBytesEncoder().encode(new Uint8Array([99, 111, 110, 102, 105, 103]))
|
|
5683
|
+
]
|
|
5684
|
+
});
|
|
5685
|
+
}
|
|
5686
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
5687
|
+
return Object.freeze({
|
|
5688
|
+
accounts: [
|
|
5689
|
+
getAccountMeta("config", accounts.config),
|
|
5690
|
+
getAccountMeta("admin", accounts.admin)
|
|
5691
|
+
],
|
|
5692
|
+
data: getSetFeePolicyInstructionDataEncoder().encode(
|
|
5693
|
+
args
|
|
5694
|
+
),
|
|
5695
|
+
programAddress
|
|
5696
|
+
});
|
|
5697
|
+
}
|
|
4216
5698
|
var SET_HOOK_ALLOWLIST_DISCRIMINATOR = new Uint8Array([
|
|
4217
5699
|
232,
|
|
4218
5700
|
28,
|
|
@@ -4254,9 +5736,12 @@ function getSetMigratorAllowlistInstructionDataEncoder() {
|
|
|
4254
5736
|
})
|
|
4255
5737
|
);
|
|
4256
5738
|
}
|
|
5739
|
+
|
|
5740
|
+
// src/solana/generated/initializer/programs/initializer.ts
|
|
5741
|
+
var INITIALIZER_PROGRAM_ADDRESS = "4h3Dqyo5qmteJoMxXt3tdtfXELDB6pdRTPU9mWruiKp1";
|
|
4257
5742
|
if (process.env.NODE_ENV !== "production") ;
|
|
4258
5743
|
var addressCodec2 = getAddressCodec();
|
|
4259
|
-
var
|
|
5744
|
+
var textEncoder3 = new TextEncoder();
|
|
4260
5745
|
function encodeU64LE(value) {
|
|
4261
5746
|
const bytes = new Uint8Array(8);
|
|
4262
5747
|
const view = new DataView(bytes.buffer);
|
|
@@ -4266,7 +5751,7 @@ function encodeU64LE(value) {
|
|
|
4266
5751
|
async function getConfigAddress2(programId = INITIALIZER_PROGRAM_ID) {
|
|
4267
5752
|
return getProgramDerivedAddress({
|
|
4268
5753
|
programAddress: programId,
|
|
4269
|
-
seeds: [
|
|
5754
|
+
seeds: [textEncoder3.encode(SEED_CONFIG2)]
|
|
4270
5755
|
});
|
|
4271
5756
|
}
|
|
4272
5757
|
async function getProgramDataAddress(programId = INITIALIZER_PROGRAM_ID) {
|
|
@@ -4282,7 +5767,7 @@ async function getLaunchAddress(namespace, launchId, programId = INITIALIZER_PRO
|
|
|
4282
5767
|
return getProgramDerivedAddress({
|
|
4283
5768
|
programAddress: programId,
|
|
4284
5769
|
seeds: [
|
|
4285
|
-
|
|
5770
|
+
textEncoder3.encode(SEED_LAUNCH),
|
|
4286
5771
|
addressCodec2.encode(namespace),
|
|
4287
5772
|
launchId
|
|
4288
5773
|
]
|
|
@@ -4292,7 +5777,16 @@ async function getLaunchAuthorityAddress(launch, programId = INITIALIZER_PROGRAM
|
|
|
4292
5777
|
return getProgramDerivedAddress({
|
|
4293
5778
|
programAddress: programId,
|
|
4294
5779
|
seeds: [
|
|
4295
|
-
|
|
5780
|
+
textEncoder3.encode(SEED_LAUNCH_AUTHORITY),
|
|
5781
|
+
addressCodec2.encode(launch)
|
|
5782
|
+
]
|
|
5783
|
+
});
|
|
5784
|
+
}
|
|
5785
|
+
async function getLaunchFeeStateAddress(launch, programId = INITIALIZER_PROGRAM_ID) {
|
|
5786
|
+
return getProgramDerivedAddress({
|
|
5787
|
+
programAddress: programId,
|
|
5788
|
+
seeds: [
|
|
5789
|
+
textEncoder3.encode(SEED_LAUNCH_FEE_STATE),
|
|
4296
5790
|
addressCodec2.encode(launch)
|
|
4297
5791
|
]
|
|
4298
5792
|
});
|
|
@@ -4325,7 +5819,7 @@ function createInitializeConfigInstruction(accounts, args, programId = INITIALIZ
|
|
|
4325
5819
|
{ address: systemProgram, role: AccountRole.READONLY }
|
|
4326
5820
|
];
|
|
4327
5821
|
const data = new Uint8Array(
|
|
4328
|
-
|
|
5822
|
+
getInitializeConfigInstructionDataEncoder3().encode(args)
|
|
4329
5823
|
);
|
|
4330
5824
|
return { programAddress: programId, accounts: keys, data };
|
|
4331
5825
|
}
|
|
@@ -4425,17 +5919,17 @@ var CPMM_MIGRATOR_ACCOUNT_DISCRIMINATORS = {
|
|
|
4425
5919
|
])
|
|
4426
5920
|
};
|
|
4427
5921
|
var addressCodec3 = getAddressCodec();
|
|
4428
|
-
var
|
|
5922
|
+
var textEncoder4 = new TextEncoder();
|
|
4429
5923
|
async function getCpmmMigratorStateAddress(launch, programId = CPMM_MIGRATOR_PROGRAM_ID) {
|
|
4430
5924
|
return getProgramDerivedAddress({
|
|
4431
5925
|
programAddress: programId,
|
|
4432
|
-
seeds: [
|
|
5926
|
+
seeds: [textEncoder4.encode(SEED_STATE), addressCodec3.encode(launch)]
|
|
4433
5927
|
});
|
|
4434
5928
|
}
|
|
4435
5929
|
async function getCpmmMigrationAuthorityAddress(programId = CPMM_MIGRATOR_PROGRAM_ID) {
|
|
4436
5930
|
return getProgramDerivedAddress({
|
|
4437
5931
|
programAddress: programId,
|
|
4438
|
-
seeds: [
|
|
5932
|
+
seeds: [textEncoder4.encode(SEED_MIGRATION_AUTHORITY)]
|
|
4439
5933
|
});
|
|
4440
5934
|
}
|
|
4441
5935
|
var CLAIM_RECEIPT_DISCRIMINATOR = new Uint8Array([
|
|
@@ -4860,7 +6354,7 @@ function getLaunchEncoder2() {
|
|
|
4860
6354
|
["baseForCurve", getU64Encoder()],
|
|
4861
6355
|
["curveVirtualBase", getU64Encoder()],
|
|
4862
6356
|
["curveVirtualQuote", getU64Encoder()],
|
|
4863
|
-
["
|
|
6357
|
+
["swapFeeBps", getU16Encoder()],
|
|
4864
6358
|
["pad1", fixEncoderSize(getBytesEncoder(), 6)],
|
|
4865
6359
|
["allowBuy", getU8Encoder()],
|
|
4866
6360
|
["allowSell", getU8Encoder()],
|
|
@@ -4902,7 +6396,7 @@ function getLaunchDecoder2() {
|
|
|
4902
6396
|
["baseForCurve", getU64Decoder()],
|
|
4903
6397
|
["curveVirtualBase", getU64Decoder()],
|
|
4904
6398
|
["curveVirtualQuote", getU64Decoder()],
|
|
4905
|
-
["
|
|
6399
|
+
["swapFeeBps", getU16Decoder()],
|
|
4906
6400
|
["pad1", fixDecoderSize(getBytesDecoder(), 6)],
|
|
4907
6401
|
["allowBuy", getU8Decoder()],
|
|
4908
6402
|
["allowSell", getU8Decoder()],
|
|
@@ -6318,12 +7812,12 @@ function predictionMigratorProgram() {
|
|
|
6318
7812
|
};
|
|
6319
7813
|
}
|
|
6320
7814
|
var addressCodec4 = getAddressCodec();
|
|
6321
|
-
var
|
|
7815
|
+
var textEncoder5 = new TextEncoder();
|
|
6322
7816
|
async function getPredictionMarketAddress(oracleState, quoteMint, programId = PREDICTION_MIGRATOR_PROGRAM_ADDRESS) {
|
|
6323
7817
|
return getProgramDerivedAddress({
|
|
6324
7818
|
programAddress: programId,
|
|
6325
7819
|
seeds: [
|
|
6326
|
-
|
|
7820
|
+
textEncoder5.encode("market"),
|
|
6327
7821
|
addressCodec4.encode(oracleState),
|
|
6328
7822
|
addressCodec4.encode(quoteMint)
|
|
6329
7823
|
]
|
|
@@ -6333,7 +7827,7 @@ async function getPredictionMarketAuthorityAddress(market, programId = PREDICTIO
|
|
|
6333
7827
|
return getProgramDerivedAddress({
|
|
6334
7828
|
programAddress: programId,
|
|
6335
7829
|
seeds: [
|
|
6336
|
-
|
|
7830
|
+
textEncoder5.encode("market_authority"),
|
|
6337
7831
|
addressCodec4.encode(market)
|
|
6338
7832
|
]
|
|
6339
7833
|
});
|
|
@@ -6341,20 +7835,20 @@ async function getPredictionMarketAuthorityAddress(market, programId = PREDICTIO
|
|
|
6341
7835
|
async function getPredictionPotVaultAddress(market, programId = PREDICTION_MIGRATOR_PROGRAM_ADDRESS) {
|
|
6342
7836
|
return getProgramDerivedAddress({
|
|
6343
7837
|
programAddress: programId,
|
|
6344
|
-
seeds: [
|
|
7838
|
+
seeds: [textEncoder5.encode("pot_vault"), addressCodec4.encode(market)]
|
|
6345
7839
|
});
|
|
6346
7840
|
}
|
|
6347
7841
|
async function getPredictionEntryAddress(market, entryId, programId = PREDICTION_MIGRATOR_PROGRAM_ADDRESS) {
|
|
6348
7842
|
return getProgramDerivedAddress({
|
|
6349
7843
|
programAddress: programId,
|
|
6350
|
-
seeds: [
|
|
7844
|
+
seeds: [textEncoder5.encode("entry"), addressCodec4.encode(market), entryId]
|
|
6351
7845
|
});
|
|
6352
7846
|
}
|
|
6353
7847
|
async function getPredictionEntryByMintAddress(market, mint, programId = PREDICTION_MIGRATOR_PROGRAM_ADDRESS) {
|
|
6354
7848
|
return getProgramDerivedAddress({
|
|
6355
7849
|
programAddress: programId,
|
|
6356
7850
|
seeds: [
|
|
6357
|
-
|
|
7851
|
+
textEncoder5.encode("entry_by_mint"),
|
|
6358
7852
|
addressCodec4.encode(market),
|
|
6359
7853
|
addressCodec4.encode(mint)
|
|
6360
7854
|
]
|
|
@@ -6403,6 +7897,7 @@ async function createInitializeLaunchInstruction(accounts, args, programId = INI
|
|
|
6403
7897
|
quoteMint,
|
|
6404
7898
|
baseVault,
|
|
6405
7899
|
quoteVault,
|
|
7900
|
+
launchFeeState,
|
|
6406
7901
|
payer,
|
|
6407
7902
|
authority,
|
|
6408
7903
|
hookProgram,
|
|
@@ -6427,6 +7922,10 @@ async function createInitializeLaunchInstruction(accounts, args, programId = INI
|
|
|
6427
7922
|
const hookCreateRemainingAccountAddresses = hookCreateRemainingAccounts.map(
|
|
6428
7923
|
(account) => isTransactionSigner5(account) ? account.address : account
|
|
6429
7924
|
);
|
|
7925
|
+
const swapFeeBps = args.swapFeeBps ?? args.curveFeeBps;
|
|
7926
|
+
if (swapFeeBps === void 0) {
|
|
7927
|
+
throw new Error("swapFeeBps is required");
|
|
7928
|
+
}
|
|
6430
7929
|
const keys = [
|
|
6431
7930
|
{ address: config, role: AccountRole.READONLY },
|
|
6432
7931
|
{ address: launch, role: AccountRole.WRITABLE },
|
|
@@ -6435,6 +7934,10 @@ async function createInitializeLaunchInstruction(accounts, args, programId = INI
|
|
|
6435
7934
|
{ address: quoteMint, role: AccountRole.READONLY },
|
|
6436
7935
|
createAccountMeta(baseVault, AccountRole.WRITABLE_SIGNER),
|
|
6437
7936
|
createAccountMeta(quoteVault, AccountRole.WRITABLE_SIGNER),
|
|
7937
|
+
{
|
|
7938
|
+
address: launchFeeState ?? (await getLaunchFeeStateAddress(launch, programId))[0],
|
|
7939
|
+
role: AccountRole.WRITABLE
|
|
7940
|
+
},
|
|
6438
7941
|
createAccountMeta(payer, AccountRole.WRITABLE_SIGNER)
|
|
6439
7942
|
];
|
|
6440
7943
|
keys.push(
|
|
@@ -6459,6 +7962,8 @@ async function createInitializeLaunchInstruction(accounts, args, programId = INI
|
|
|
6459
7962
|
}
|
|
6460
7963
|
const encoderArgs = {
|
|
6461
7964
|
...args,
|
|
7965
|
+
swapFeeBps,
|
|
7966
|
+
feeBeneficiaries: args.feeBeneficiaries ?? [],
|
|
6462
7967
|
allowBuy: args.allowBuy ? 1 : 0,
|
|
6463
7968
|
allowSell: args.allowSell ? 1 : 0,
|
|
6464
7969
|
hookProgram: args.hookProgram ?? hookProgram ?? SYSTEM_PROGRAM_ADDRESS,
|
|
@@ -6524,6 +8029,19 @@ function createAccountMeta2(value, role) {
|
|
|
6524
8029
|
}
|
|
6525
8030
|
return { address: value, role };
|
|
6526
8031
|
}
|
|
8032
|
+
function createRemainingAccountMeta(value) {
|
|
8033
|
+
if (typeof value === "string") {
|
|
8034
|
+
return { address: value, role: AccountRole.READONLY };
|
|
8035
|
+
}
|
|
8036
|
+
if (isTransactionSigner6(value)) {
|
|
8037
|
+
return {
|
|
8038
|
+
address: value.address,
|
|
8039
|
+
role: AccountRole.READONLY_SIGNER,
|
|
8040
|
+
signer: value
|
|
8041
|
+
};
|
|
8042
|
+
}
|
|
8043
|
+
return value;
|
|
8044
|
+
}
|
|
6527
8045
|
function createCurveSwapExactInInstruction(accounts, args, programId = INITIALIZER_PROGRAM_ID) {
|
|
6528
8046
|
const {
|
|
6529
8047
|
config,
|
|
@@ -6537,8 +8055,10 @@ function createCurveSwapExactInInstruction(accounts, args, programId = INITIALIZ
|
|
|
6537
8055
|
quoteMint,
|
|
6538
8056
|
user,
|
|
6539
8057
|
hookProgram = SYSTEM_PROGRAM_ADDRESS,
|
|
8058
|
+
launchFeeState,
|
|
6540
8059
|
baseTokenProgram = TOKEN_PROGRAM_ADDRESS,
|
|
6541
|
-
quoteTokenProgram = TOKEN_PROGRAM_ADDRESS
|
|
8060
|
+
quoteTokenProgram = TOKEN_PROGRAM_ADDRESS,
|
|
8061
|
+
remainingAccounts = []
|
|
6542
8062
|
} = accounts;
|
|
6543
8063
|
const keys = [
|
|
6544
8064
|
{ address: config, role: AccountRole.READONLY },
|
|
@@ -6555,8 +8075,10 @@ function createCurveSwapExactInInstruction(accounts, args, programId = INITIALIZ
|
|
|
6555
8075
|
// slot (token_program follows it). Always emit it — use SYSTEM_PROGRAM_ADDRESS as the
|
|
6556
8076
|
// no-op placeholder when no real hook is configured.
|
|
6557
8077
|
{ address: hookProgram, role: AccountRole.READONLY },
|
|
8078
|
+
{ address: launchFeeState, role: AccountRole.WRITABLE },
|
|
6558
8079
|
{ address: baseTokenProgram, role: AccountRole.READONLY },
|
|
6559
|
-
{ address: quoteTokenProgram, role: AccountRole.READONLY }
|
|
8080
|
+
{ address: quoteTokenProgram, role: AccountRole.READONLY },
|
|
8081
|
+
...remainingAccounts.map(createRemainingAccountMeta)
|
|
6560
8082
|
];
|
|
6561
8083
|
const data = new Uint8Array(
|
|
6562
8084
|
getCurveSwapExactInInstructionDataEncoder().encode(args)
|
|
@@ -6581,6 +8103,7 @@ function createMigrateLaunchInstruction(accounts, programId = INITIALIZER_PROGRA
|
|
|
6581
8103
|
quoteMint,
|
|
6582
8104
|
baseVault,
|
|
6583
8105
|
quoteVault,
|
|
8106
|
+
launchFeeState,
|
|
6584
8107
|
migratorProgram,
|
|
6585
8108
|
payer,
|
|
6586
8109
|
baseTokenProgram = TOKEN_PROGRAM_ADDRESS,
|
|
@@ -6596,6 +8119,7 @@ function createMigrateLaunchInstruction(accounts, programId = INITIALIZER_PROGRA
|
|
|
6596
8119
|
{ address: quoteMint, role: AccountRole.READONLY },
|
|
6597
8120
|
{ address: baseVault, role: AccountRole.WRITABLE },
|
|
6598
8121
|
{ address: quoteVault, role: AccountRole.WRITABLE },
|
|
8122
|
+
{ address: launchFeeState, role: AccountRole.READONLY },
|
|
6599
8123
|
{ address: migratorProgram, role: AccountRole.READONLY },
|
|
6600
8124
|
createSignerAccountMeta4(payer, AccountRole.WRITABLE_SIGNER),
|
|
6601
8125
|
{ address: baseTokenProgram, role: AccountRole.READONLY },
|
|
@@ -6608,22 +8132,50 @@ function createMigrateLaunchInstruction(accounts, programId = INITIALIZER_PROGRA
|
|
|
6608
8132
|
);
|
|
6609
8133
|
return { programAddress: programId, accounts: keys, data };
|
|
6610
8134
|
}
|
|
8135
|
+
function isTransactionSigner8(value) {
|
|
8136
|
+
return typeof value === "object" && value !== null && "address" in value && "signTransactions" in value;
|
|
8137
|
+
}
|
|
8138
|
+
function createRemainingAccountMeta2(value) {
|
|
8139
|
+
if (typeof value === "string") {
|
|
8140
|
+
return { address: value, role: AccountRole.READONLY };
|
|
8141
|
+
}
|
|
8142
|
+
if (isTransactionSigner8(value)) {
|
|
8143
|
+
return {
|
|
8144
|
+
address: value.address,
|
|
8145
|
+
role: AccountRole.READONLY_SIGNER,
|
|
8146
|
+
signer: value
|
|
8147
|
+
};
|
|
8148
|
+
}
|
|
8149
|
+
return value;
|
|
8150
|
+
}
|
|
6611
8151
|
var previewSwapExactInResultCodec = getStructCodec([
|
|
6612
8152
|
["amountOut", getU64Codec()],
|
|
6613
8153
|
["feePaid", getU64Codec()]
|
|
6614
8154
|
]);
|
|
6615
8155
|
function createPreviewSwapExactInInstruction(accounts, args, programId = INITIALIZER_PROGRAM_ID) {
|
|
6616
|
-
const {
|
|
8156
|
+
const {
|
|
8157
|
+
launch,
|
|
8158
|
+
launchFeeState,
|
|
8159
|
+
baseVault,
|
|
8160
|
+
quoteVault,
|
|
8161
|
+
hookProgram,
|
|
8162
|
+
remainingAccounts = []
|
|
8163
|
+
} = accounts;
|
|
6617
8164
|
const keys = [
|
|
6618
8165
|
{ address: launch, role: AccountRole.READONLY },
|
|
8166
|
+
{ address: launchFeeState, role: AccountRole.READONLY },
|
|
6619
8167
|
{ address: baseVault, role: AccountRole.READONLY },
|
|
6620
8168
|
{ address: quoteVault, role: AccountRole.READONLY }
|
|
6621
8169
|
];
|
|
6622
8170
|
const accountsList = hookProgram ? [...keys, { address: hookProgram, role: AccountRole.READONLY }] : keys;
|
|
8171
|
+
const accountsWithRemaining = [
|
|
8172
|
+
...accountsList,
|
|
8173
|
+
...remainingAccounts.map(createRemainingAccountMeta2)
|
|
8174
|
+
];
|
|
6623
8175
|
const data = new Uint8Array(
|
|
6624
8176
|
getPreviewSwapExactInInstructionDataEncoder2().encode(args)
|
|
6625
8177
|
);
|
|
6626
|
-
return { programAddress: programId, accounts:
|
|
8178
|
+
return { programAddress: programId, accounts: accountsWithRemaining, data };
|
|
6627
8179
|
}
|
|
6628
8180
|
function decodePreviewSwapExactInResult(data) {
|
|
6629
8181
|
return previewSwapExactInResultCodec.decode(data);
|
|
@@ -7775,7 +9327,8 @@ var DOPPLER_SOLANA_DEVNET_PROGRAM_ADDRESSES = {
|
|
|
7775
9327
|
cpmmProgram: CPMM_PROGRAM_ID,
|
|
7776
9328
|
initializerProgram: INITIALIZER_PROGRAM_ID,
|
|
7777
9329
|
cpmmMigratorProgram: CPMM_MIGRATOR_PROGRAM_ID,
|
|
7778
|
-
cpmmHookProgram: CPMM_HOOK_PROGRAM_ID
|
|
9330
|
+
cpmmHookProgram: CPMM_HOOK_PROGRAM_ID,
|
|
9331
|
+
cosignerHookProgram: COSIGNER_HOOK_PROGRAM_ID
|
|
7779
9332
|
};
|
|
7780
9333
|
async function deriveSolanaCpmmDeployment(programs = DOPPLER_SOLANA_DEVNET_PROGRAM_ADDRESSES) {
|
|
7781
9334
|
const [cpmmConfig] = await getConfigAddress(programs.cpmmProgram);
|
|
@@ -7789,6 +9342,6 @@ async function deriveSolanaCpmmDeployment(programs = DOPPLER_SOLANA_DEVNET_PROGR
|
|
|
7789
9342
|
};
|
|
7790
9343
|
}
|
|
7791
9344
|
|
|
7792
|
-
export { DOPPLER_SOLANA_DEVNET_PROGRAM_ADDRESSES, cpmm_exports as cpmm, cpmmMigrator_exports as cpmmMigrator, deriveSolanaCpmmDeployment, initializer_exports as initializer, predictionMigrator_exports as predictionMigrator, trustedOracle_exports as trustedOracle };
|
|
9345
|
+
export { DOPPLER_SOLANA_DEVNET_PROGRAM_ADDRESSES, cosignerHook_exports as cosignerHook, cpmm_exports as cpmm, cpmmMigrator_exports as cpmmMigrator, deriveSolanaCpmmDeployment, initializer_exports as initializer, predictionMigrator_exports as predictionMigrator, trustedOracle_exports as trustedOracle };
|
|
7793
9346
|
//# sourceMappingURL=index.js.map
|
|
7794
9347
|
//# sourceMappingURL=index.js.map
|