@whetstone-research/doppler-sdk 1.0.8 → 1.0.9
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-BXATWUGJ.cjs → chunk-I5JME35L.cjs} +39 -39
- package/dist/{chunk-BXATWUGJ.cjs.map → chunk-I5JME35L.cjs.map} +1 -1
- package/dist/{chunk-DPKVNI6Q.cjs → chunk-O6FR7TXY.cjs} +27 -3
- package/dist/chunk-O6FR7TXY.cjs.map +1 -0
- package/dist/{chunk-BSHIMMA4.js → chunk-RF4NM4ES.js} +3 -3
- package/dist/{chunk-BSHIMMA4.js.map → chunk-RF4NM4ES.js.map} +1 -1
- package/dist/{chunk-J57ROY36.js → chunk-YWZCHTXQ.js} +25 -4
- package/dist/chunk-YWZCHTXQ.js.map +1 -0
- package/dist/pda-NKKMVQ4N.js +4 -0
- package/dist/pda-NKKMVQ4N.js.map +1 -0
- package/dist/pda-UKFLYQGA.cjs +61 -0
- package/dist/pda-UKFLYQGA.cjs.map +1 -0
- package/dist/solana/index.cjs +428 -332
- package/dist/solana/index.cjs.map +1 -1
- package/dist/solana/index.d.cts +160 -118
- package/dist/solana/index.d.ts +160 -118
- package/dist/solana/index.js +208 -112
- package/dist/solana/index.js.map +1 -1
- package/dist/solana/react/index.cjs +45 -45
- package/dist/solana/react/index.js +3 -3
- package/package.json +1 -1
- package/dist/chunk-DPKVNI6Q.cjs.map +0 -1
- package/dist/chunk-J57ROY36.js.map +0 -1
- package/dist/pda-TXZDXZZ4.js +0 -4
- package/dist/pda-TXZDXZZ4.js.map +0 -1
- package/dist/pda-ZZMBZSFU.cjs +0 -53
- package/dist/pda-ZZMBZSFU.cjs.map +0 -1
package/dist/solana/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { transferAdminArgsCodec, swapExactInArgsCodec, sortPositionsByShares, sortPoolsByReserves, setSentinelArgsCodec, setRouteArgsCodec, 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, encodeSetSentinelArgs, encodeSetRouteArgs, encodeSetFeesArgs, encodeRemoveLiquidityArgs, encodeQuoteToNumeraireArgs, encodeOracleConsultArgs, encodeInstructionData, encodeInitializePoolArgs, encodeInitializeOracleArgs, encodeInitializeConfigArgs, encodeCreatePositionArgs, encodeCollectProtocolFeesArgs, encodeCollectFeesArgs, encodeAddLiquidityArgs, decodePosition, decodePool, decodeOracleState, decodeAmmConfig, createPositionArgsCodec, createCollectFeesInstruction, consultTwap, computePrice1Q64, computePrice0Q64, comparePoolAndOraclePrices, collectProtocolFeesArgsCodec, collectFeesArgsCodec, ceilDiv, calculateTwapNumber, calculateTwap, calculateAccruedFees, ammConfigDataCodec, addLiquidityArgsCodec, MAX_FEE_AMOUNT } from '../chunk-
|
|
2
|
-
import { sortMints, getSwapAddresses, getProtocolPositionAddress, getPositionAddress, getPoolInitAddresses, getPoolAuthorityAddress, getPoolAddress, getOracleAddress, getLiquidityAddresses, getConfigAddress, CPMM_PROGRAM_ID, areMintsOrdered, TOKEN_METADATA_PROGRAM_ID, SF_BEFORE_SWAP, SF_BEFORE_REMOVE_LIQ, SF_BEFORE_ADD_LIQ, SF_AFTER_SWAP, SF_AFTER_REMOVE_LIQ, SF_AFTER_ADD_LIQ, SENTINEL_NO_CHANGE, SEED_PROTOCOL_POSITION, SEED_POSITION, SEED_POOL, SEED_ORACLE, SEED_CONFIG, SEED_AUTHORITY, Q64_ONE, MAX_SENTINEL_ALLOWLIST, MAX_ORACLE_OBSERVATIONS, INSTRUCTION_DISCRIMINATORS, BPS_DENOM, ACCOUNT_VERSION, ACCOUNT_DISCRIMINATORS, SYSTEM_PROGRAM_ADDRESS, TOKEN_PROGRAM_ADDRESS } from '../chunk-
|
|
1
|
+
import { transferAdminArgsCodec, swapExactInArgsCodec, sortPositionsByShares, sortPoolsByReserves, setSentinelArgsCodec, setRouteArgsCodec, 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, encodeSetSentinelArgs, encodeSetRouteArgs, encodeSetFeesArgs, encodeRemoveLiquidityArgs, encodeQuoteToNumeraireArgs, encodeOracleConsultArgs, encodeInstructionData, encodeInitializePoolArgs, encodeInitializeOracleArgs, encodeInitializeConfigArgs, encodeCreatePositionArgs, encodeCollectProtocolFeesArgs, encodeCollectFeesArgs, encodeAddLiquidityArgs, decodePosition, decodePool, decodeOracleState, decodeAmmConfig, createPositionArgsCodec, createCollectFeesInstruction, consultTwap, computePrice1Q64, computePrice0Q64, comparePoolAndOraclePrices, collectProtocolFeesArgsCodec, collectFeesArgsCodec, ceilDiv, calculateTwapNumber, calculateTwap, calculateAccruedFees, ammConfigDataCodec, addLiquidityArgsCodec, MAX_FEE_AMOUNT } from '../chunk-RF4NM4ES.js';
|
|
2
|
+
import { sortMints, getSwapAddresses, getProtocolPositionAddress, getPositionAddress, getPoolVault1Address, getPoolVault0Address, getPoolInitAddresses, getPoolAuthorityAddress, getPoolAddress, getOracleAddress, getLiquidityAddresses, getConfigAddress, CPMM_PROGRAM_ID, areMintsOrdered, TOKEN_METADATA_PROGRAM_ID, SF_BEFORE_SWAP, SF_BEFORE_REMOVE_LIQ, SF_BEFORE_ADD_LIQ, SF_AFTER_SWAP, SF_AFTER_REMOVE_LIQ, SF_AFTER_ADD_LIQ, SENTINEL_NO_CHANGE, SEED_PROTOCOL_POSITION, SEED_POSITION, SEED_POOL, SEED_ORACLE, SEED_CONFIG, SEED_AUTHORITY, Q64_ONE, MAX_SENTINEL_ALLOWLIST, MAX_ORACLE_OBSERVATIONS, INSTRUCTION_DISCRIMINATORS, BPS_DENOM, ACCOUNT_VERSION, ACCOUNT_DISCRIMINATORS, SYSTEM_PROGRAM_ADDRESS, TOKEN_PROGRAM_ADDRESS, SYSVAR_INSTRUCTIONS_ADDRESS } from '../chunk-YWZCHTXQ.js';
|
|
3
3
|
import { __export } from '../chunk-PZ5AY32C.js';
|
|
4
4
|
import { getAddressCodec, getProgramDerivedAddress, AccountRole, getStructCodec, getU64Codec, getU128Codec, getBooleanCodec, getU8Codec, address, transformEncoder, getStructEncoder, fixEncoderSize, getAddressEncoder, getU8Encoder, getArrayEncoder, getBytesEncoder, getStructDecoder, fixDecoderSize, getAddressDecoder, getU8Decoder, getArrayDecoder, getBytesDecoder, combineCodec, getU64Encoder, getU16Encoder, addEncoderSizePrefix, getU32Encoder, getUtf8Encoder, getU64Decoder, getU16Decoder, addDecoderSizePrefix, getU32Decoder, getUtf8Decoder, getOptionEncoder, getU128Encoder, getOptionDecoder, getU128Decoder, getBooleanEncoder, getBooleanDecoder, mergeBytes, isProgramError, decodeAccount, assertAccountExists, fetchEncodedAccount, assertAccountsExist, fetchEncodedAccounts, SolanaError, SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, 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 } from '@solana/kit';
|
|
5
5
|
import { getAccountMetaFactory, addSelfPlanAndSendFunctions, addSelfFetchFunctions, getAddressFromResolvedInstructionAccount } from '@solana/program-client-core';
|
|
@@ -125,6 +125,8 @@ __export(cpmm_exports, {
|
|
|
125
125
|
getPoolAuthorityAddress: () => getPoolAuthorityAddress,
|
|
126
126
|
getPoolByMints: () => getPoolByMints,
|
|
127
127
|
getPoolInitAddresses: () => getPoolInitAddresses,
|
|
128
|
+
getPoolVault0Address: () => getPoolVault0Address,
|
|
129
|
+
getPoolVault1Address: () => getPoolVault1Address,
|
|
128
130
|
getPositionAddress: () => getPositionAddress,
|
|
129
131
|
getPositionAddressFromParams: () => getPositionAddressFromParams,
|
|
130
132
|
getPositionValue: () => getPositionValue,
|
|
@@ -508,23 +510,30 @@ function createInitializePoolInstruction(accounts, args, programId = CPMM_PROGRA
|
|
|
508
510
|
token0Mint,
|
|
509
511
|
token1Mint,
|
|
510
512
|
payer,
|
|
513
|
+
token0Program,
|
|
514
|
+
token1Program,
|
|
511
515
|
tokenProgram = TOKEN_PROGRAM_ADDRESS,
|
|
512
516
|
systemProgram = SYSTEM_PROGRAM_ADDRESS,
|
|
513
|
-
rent
|
|
517
|
+
rent,
|
|
518
|
+
migrationAuthority
|
|
514
519
|
} = accounts;
|
|
520
|
+
const resolvedToken0Program = token0Program ?? tokenProgram;
|
|
521
|
+
const resolvedToken1Program = token1Program ?? tokenProgram;
|
|
515
522
|
const keys = [
|
|
516
523
|
{ address: config, role: AccountRole.READONLY },
|
|
517
524
|
{ address: pool, role: AccountRole.WRITABLE },
|
|
518
525
|
{ address: protocolPosition, role: AccountRole.WRITABLE },
|
|
519
526
|
{ address: authority, role: AccountRole.READONLY },
|
|
520
|
-
|
|
521
|
-
|
|
527
|
+
{ address: vault0, role: AccountRole.WRITABLE },
|
|
528
|
+
{ address: vault1, role: AccountRole.WRITABLE },
|
|
522
529
|
{ address: token0Mint, role: AccountRole.READONLY },
|
|
523
530
|
{ address: token1Mint, role: AccountRole.READONLY },
|
|
524
531
|
createSignerAccountMeta(payer, AccountRole.WRITABLE_SIGNER),
|
|
525
|
-
{ address:
|
|
532
|
+
{ address: resolvedToken0Program, role: AccountRole.READONLY },
|
|
533
|
+
{ address: resolvedToken1Program, role: AccountRole.READONLY },
|
|
526
534
|
{ address: systemProgram, role: AccountRole.READONLY },
|
|
527
|
-
{ address: rent, role: AccountRole.READONLY }
|
|
535
|
+
{ address: rent, role: AccountRole.READONLY },
|
|
536
|
+
createSignerAccountMeta(migrationAuthority, AccountRole.READONLY_SIGNER)
|
|
528
537
|
];
|
|
529
538
|
const data = encodeInstructionData(
|
|
530
539
|
INSTRUCTION_DISCRIMINATORS.initializePool,
|
|
@@ -711,10 +720,15 @@ function createSwapExactInInstruction(accounts, args, programId = CPMM_PROGRAM_I
|
|
|
711
720
|
userIn,
|
|
712
721
|
userOut,
|
|
713
722
|
user,
|
|
723
|
+
token0Program,
|
|
724
|
+
token1Program,
|
|
714
725
|
tokenProgram = TOKEN_PROGRAM_ADDRESS,
|
|
726
|
+
instructionsSysvar = SYSVAR_INSTRUCTIONS_ADDRESS,
|
|
715
727
|
oracle,
|
|
716
728
|
remainingAccounts = []
|
|
717
729
|
} = accounts;
|
|
730
|
+
const resolvedToken0Program = token0Program ?? tokenProgram;
|
|
731
|
+
const resolvedToken1Program = token1Program ?? tokenProgram;
|
|
718
732
|
const keys = [
|
|
719
733
|
{ address: config, role: AccountRole.READONLY },
|
|
720
734
|
{ address: pool, role: AccountRole.WRITABLE },
|
|
@@ -726,7 +740,9 @@ function createSwapExactInInstruction(accounts, args, programId = CPMM_PROGRAM_I
|
|
|
726
740
|
{ address: userIn, role: AccountRole.WRITABLE },
|
|
727
741
|
{ address: userOut, role: AccountRole.WRITABLE },
|
|
728
742
|
{ address: user, role: AccountRole.READONLY_SIGNER },
|
|
729
|
-
{ address:
|
|
743
|
+
{ address: resolvedToken0Program, role: AccountRole.READONLY },
|
|
744
|
+
{ address: resolvedToken1Program, role: AccountRole.READONLY },
|
|
745
|
+
{ address: instructionsSysvar, role: AccountRole.READONLY }
|
|
730
746
|
];
|
|
731
747
|
if (oracle) {
|
|
732
748
|
keys.push({ address: oracle, role: AccountRole.WRITABLE });
|
|
@@ -763,6 +779,10 @@ function createSwapInstruction(params) {
|
|
|
763
779
|
oracle,
|
|
764
780
|
remainingAccounts,
|
|
765
781
|
updateOracle = false,
|
|
782
|
+
token0Program,
|
|
783
|
+
token1Program,
|
|
784
|
+
tokenProgram,
|
|
785
|
+
instructionsSysvar,
|
|
766
786
|
programId = CPMM_PROGRAM_ID
|
|
767
787
|
} = params;
|
|
768
788
|
const [vaultIn, vaultOut] = direction === 0 ? [vault0, vault1] : [vault1, vault0];
|
|
@@ -779,6 +799,10 @@ function createSwapInstruction(params) {
|
|
|
779
799
|
userIn,
|
|
780
800
|
userOut,
|
|
781
801
|
user,
|
|
802
|
+
token0Program,
|
|
803
|
+
token1Program,
|
|
804
|
+
tokenProgram,
|
|
805
|
+
instructionsSysvar,
|
|
782
806
|
oracle,
|
|
783
807
|
remainingAccounts
|
|
784
808
|
},
|
|
@@ -1101,7 +1125,6 @@ __export(initializer_exports, {
|
|
|
1101
1125
|
SF_AFTER_SWAP: () => SF_AFTER_SWAP2,
|
|
1102
1126
|
SF_BEFORE_SWAP: () => SF_BEFORE_SWAP2,
|
|
1103
1127
|
computeRemainingAccountsHash: () => computeRemainingAccountsHash,
|
|
1104
|
-
createAbortLaunchInstruction: () => createAbortLaunchInstruction,
|
|
1105
1128
|
createCurveSwapExactInInstruction: () => createCurveSwapExactInInstruction,
|
|
1106
1129
|
createInitializeConfigInstruction: () => createInitializeConfigInstruction2,
|
|
1107
1130
|
createInitializeLaunchInstruction: () => createInitializeLaunchInstruction,
|
|
@@ -1149,9 +1172,9 @@ var CPMM_SENTINEL_PROGRAM_ID = address(
|
|
|
1149
1172
|
var PREDICTION_SENTINEL_PROGRAM_ID = address(
|
|
1150
1173
|
"7QcQDANJVC17Jgc6KjjeagSkm2zAphgHVPK5agJzyihB"
|
|
1151
1174
|
);
|
|
1152
|
-
var SEED_CONFIG2 = "
|
|
1153
|
-
var SEED_LAUNCH = "
|
|
1154
|
-
var SEED_LAUNCH_AUTHORITY = "
|
|
1175
|
+
var SEED_CONFIG2 = "config";
|
|
1176
|
+
var SEED_LAUNCH = "launch";
|
|
1177
|
+
var SEED_LAUNCH_AUTHORITY = "launch_authority";
|
|
1155
1178
|
var EMPTY_REMAINING_ACCOUNTS_HASH = new Uint8Array([
|
|
1156
1179
|
232,
|
|
1157
1180
|
231,
|
|
@@ -1269,8 +1292,6 @@ var INITIALIZER_INSTRUCTION_DISCRIMINATORS = {
|
|
|
1269
1292
|
12,
|
|
1270
1293
|
205
|
|
1271
1294
|
]),
|
|
1272
|
-
// SHA256("global:abort_launch")[0:8]
|
|
1273
|
-
abortLaunch: new Uint8Array([44, 112, 192, 235, 227, 61, 179, 7]),
|
|
1274
1295
|
// SHA256("global:preview_swap_exact_in")[0:8]
|
|
1275
1296
|
previewSwapExactIn: new Uint8Array([
|
|
1276
1297
|
50,
|
|
@@ -1774,13 +1795,15 @@ function createInitializeConfigInstruction2(accounts, args, programId = INITIALI
|
|
|
1774
1795
|
admin,
|
|
1775
1796
|
config,
|
|
1776
1797
|
programData,
|
|
1777
|
-
systemProgram = SYSTEM_PROGRAM_ADDRESS
|
|
1798
|
+
systemProgram = SYSTEM_PROGRAM_ADDRESS,
|
|
1799
|
+
instructionsSysvar = SYSVAR_INSTRUCTIONS_ADDRESS
|
|
1778
1800
|
} = accounts;
|
|
1779
1801
|
const keys = [
|
|
1780
1802
|
createSignerAccountMeta2(admin, AccountRole.WRITABLE_SIGNER),
|
|
1781
1803
|
{ address: config, role: AccountRole.WRITABLE },
|
|
1782
1804
|
{ address: programData, role: AccountRole.READONLY },
|
|
1783
|
-
{ address: systemProgram, role: AccountRole.READONLY }
|
|
1805
|
+
{ address: systemProgram, role: AccountRole.READONLY },
|
|
1806
|
+
{ address: instructionsSysvar, role: AccountRole.READONLY }
|
|
1784
1807
|
];
|
|
1785
1808
|
const data = new Uint8Array(
|
|
1786
1809
|
getInitializeConfigInstructionDataEncoder().encode(args)
|
|
@@ -1831,6 +1854,7 @@ var CPMM_MIGRATOR_PROGRAM_ID = address(
|
|
|
1831
1854
|
"7WMUTNC41eMCo6eGH5Sy2xbgE3AycvLbFPo95AU9CSUd"
|
|
1832
1855
|
);
|
|
1833
1856
|
var SEED_STATE = "state";
|
|
1857
|
+
var SEED_MIGRATION_AUTHORITY = "migration_authority";
|
|
1834
1858
|
var MAX_RECIPIENTS = 2;
|
|
1835
1859
|
var CPMM_MIGRATOR_INSTRUCTION_DISCRIMINATORS = {
|
|
1836
1860
|
// SHA256("global:register_launch")[0:8]
|
|
@@ -1868,6 +1892,12 @@ async function getCpmmMigratorStateAddress(launch, programId = CPMM_MIGRATOR_PRO
|
|
|
1868
1892
|
seeds: [textEncoder3.encode(SEED_STATE), addressCodec3.encode(launch)]
|
|
1869
1893
|
});
|
|
1870
1894
|
}
|
|
1895
|
+
async function getCpmmMigrationAuthorityAddress(programId = CPMM_MIGRATOR_PROGRAM_ID) {
|
|
1896
|
+
return getProgramDerivedAddress({
|
|
1897
|
+
programAddress: programId,
|
|
1898
|
+
seeds: [textEncoder3.encode(SEED_MIGRATION_AUTHORITY)]
|
|
1899
|
+
});
|
|
1900
|
+
}
|
|
1871
1901
|
var CLAIM_RECEIPT_DISCRIMINATOR = new Uint8Array([
|
|
1872
1902
|
223,
|
|
1873
1903
|
233,
|
|
@@ -1955,7 +1985,7 @@ function getEntryEncoder() {
|
|
|
1955
1985
|
return transformEncoder(
|
|
1956
1986
|
getStructEncoder([
|
|
1957
1987
|
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
1958
|
-
["
|
|
1988
|
+
["market", getAddressEncoder()],
|
|
1959
1989
|
["entryId", fixEncoderSize(getBytesEncoder(), 32)],
|
|
1960
1990
|
["baseMint", getAddressEncoder()],
|
|
1961
1991
|
["contribution", getU64Encoder()],
|
|
@@ -1969,7 +1999,7 @@ function getEntryEncoder() {
|
|
|
1969
1999
|
function getEntryDecoder() {
|
|
1970
2000
|
return getStructDecoder([
|
|
1971
2001
|
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
1972
|
-
["
|
|
2002
|
+
["market", getAddressDecoder()],
|
|
1973
2003
|
["entryId", fixDecoderSize(getBytesDecoder(), 32)],
|
|
1974
2004
|
["baseMint", getAddressDecoder()],
|
|
1975
2005
|
["contribution", getU64Decoder()],
|
|
@@ -2027,7 +2057,7 @@ function getEntryByMintEncoder() {
|
|
|
2027
2057
|
return transformEncoder(
|
|
2028
2058
|
getStructEncoder([
|
|
2029
2059
|
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
2030
|
-
["
|
|
2060
|
+
["market", getAddressEncoder()],
|
|
2031
2061
|
["baseMint", getAddressEncoder()],
|
|
2032
2062
|
["entryId", fixEncoderSize(getBytesEncoder(), 32)],
|
|
2033
2063
|
["bump", getU8Encoder()],
|
|
@@ -2039,7 +2069,7 @@ function getEntryByMintEncoder() {
|
|
|
2039
2069
|
function getEntryByMintDecoder() {
|
|
2040
2070
|
return getStructDecoder([
|
|
2041
2071
|
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
2042
|
-
["
|
|
2072
|
+
["market", getAddressDecoder()],
|
|
2043
2073
|
["baseMint", getAddressDecoder()],
|
|
2044
2074
|
["entryId", fixDecoderSize(getBytesDecoder(), 32)],
|
|
2045
2075
|
["bump", getU8Decoder()],
|
|
@@ -2302,6 +2332,11 @@ function getLaunchEncoder2() {
|
|
|
2302
2332
|
["migratorProgram", getAddressEncoder()],
|
|
2303
2333
|
["migratorInitCalldata", getCalldataBufEncoder2()],
|
|
2304
2334
|
["migratorMigrateCalldata", getCalldataBufEncoder2()],
|
|
2335
|
+
["curveKind", getU8Encoder()],
|
|
2336
|
+
["swapLock", getU8Encoder()],
|
|
2337
|
+
["pad4", fixEncoderSize(getBytesEncoder(), 6)],
|
|
2338
|
+
["curveParams", getCalldataBufEncoder2()],
|
|
2339
|
+
["quoteDeposited", getU64Encoder()],
|
|
2305
2340
|
["reserved", fixEncoderSize(getBytesEncoder(), 64)]
|
|
2306
2341
|
]),
|
|
2307
2342
|
(value) => ({ ...value, discriminator: LAUNCH_DISCRIMINATOR2 })
|
|
@@ -2339,6 +2374,11 @@ function getLaunchDecoder2() {
|
|
|
2339
2374
|
["migratorProgram", getAddressDecoder()],
|
|
2340
2375
|
["migratorInitCalldata", getCalldataBufDecoder2()],
|
|
2341
2376
|
["migratorMigrateCalldata", getCalldataBufDecoder2()],
|
|
2377
|
+
["curveKind", getU8Decoder()],
|
|
2378
|
+
["swapLock", getU8Decoder()],
|
|
2379
|
+
["pad4", fixDecoderSize(getBytesDecoder(), 6)],
|
|
2380
|
+
["curveParams", getCalldataBufDecoder2()],
|
|
2381
|
+
["quoteDeposited", getU64Decoder()],
|
|
2342
2382
|
["reserved", fixDecoderSize(getBytesDecoder(), 64)]
|
|
2343
2383
|
]);
|
|
2344
2384
|
}
|
|
@@ -2370,7 +2410,7 @@ async function fetchAllMaybeLaunch(rpc, addresses, config) {
|
|
|
2370
2410
|
return maybeAccounts.map((maybeAccount) => decodeLaunch(maybeAccount));
|
|
2371
2411
|
}
|
|
2372
2412
|
function getLaunchSize() {
|
|
2373
|
-
return
|
|
2413
|
+
return 1488;
|
|
2374
2414
|
}
|
|
2375
2415
|
var MARKET_DISCRIMINATOR = new Uint8Array([
|
|
2376
2416
|
219,
|
|
@@ -2615,6 +2655,42 @@ async function getClaimInstructionAsync(input, config) {
|
|
|
2615
2655
|
]
|
|
2616
2656
|
});
|
|
2617
2657
|
}
|
|
2658
|
+
if (!accounts.entryByMint.value) {
|
|
2659
|
+
accounts.entryByMint.value = await getProgramDerivedAddress({
|
|
2660
|
+
programAddress,
|
|
2661
|
+
seeds: [
|
|
2662
|
+
getBytesEncoder().encode(
|
|
2663
|
+
new Uint8Array([
|
|
2664
|
+
101,
|
|
2665
|
+
110,
|
|
2666
|
+
116,
|
|
2667
|
+
114,
|
|
2668
|
+
121,
|
|
2669
|
+
95,
|
|
2670
|
+
98,
|
|
2671
|
+
121,
|
|
2672
|
+
95,
|
|
2673
|
+
109,
|
|
2674
|
+
105,
|
|
2675
|
+
110,
|
|
2676
|
+
116
|
|
2677
|
+
])
|
|
2678
|
+
),
|
|
2679
|
+
getAddressEncoder().encode(
|
|
2680
|
+
getAddressFromResolvedInstructionAccount(
|
|
2681
|
+
"market",
|
|
2682
|
+
accounts.market.value
|
|
2683
|
+
)
|
|
2684
|
+
),
|
|
2685
|
+
getAddressEncoder().encode(
|
|
2686
|
+
getAddressFromResolvedInstructionAccount(
|
|
2687
|
+
"winnerMint",
|
|
2688
|
+
accounts.winnerMint.value
|
|
2689
|
+
)
|
|
2690
|
+
)
|
|
2691
|
+
]
|
|
2692
|
+
});
|
|
2693
|
+
}
|
|
2618
2694
|
if (!accounts.receipt.value) {
|
|
2619
2695
|
accounts.receipt.value = await getProgramDerivedAddress({
|
|
2620
2696
|
programAddress,
|
|
@@ -2805,7 +2881,14 @@ async function getMigrateEntryInstructionAsync(input, config) {
|
|
|
2805
2881
|
baseVault: { value: input.baseVault ?? null, isWritable: true },
|
|
2806
2882
|
quoteVault: { value: input.quoteVault ?? null, isWritable: true },
|
|
2807
2883
|
payer: { value: input.payer ?? null, isWritable: true },
|
|
2808
|
-
|
|
2884
|
+
baseTokenProgram: {
|
|
2885
|
+
value: input.baseTokenProgram ?? null,
|
|
2886
|
+
isWritable: false
|
|
2887
|
+
},
|
|
2888
|
+
quoteTokenProgram: {
|
|
2889
|
+
value: input.quoteTokenProgram ?? null,
|
|
2890
|
+
isWritable: false
|
|
2891
|
+
},
|
|
2809
2892
|
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
2810
2893
|
rent: { value: input.rent ?? null, isWritable: false },
|
|
2811
2894
|
oracle: { value: input.oracle ?? null, isWritable: false },
|
|
@@ -2820,9 +2903,6 @@ async function getMigrateEntryInstructionAsync(input, config) {
|
|
|
2820
2903
|
};
|
|
2821
2904
|
const accounts = originalAccounts;
|
|
2822
2905
|
const args = { ...input };
|
|
2823
|
-
if (!accounts.tokenProgram.value) {
|
|
2824
|
-
accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
2825
|
-
}
|
|
2826
2906
|
if (!accounts.systemProgram.value) {
|
|
2827
2907
|
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
2828
2908
|
}
|
|
@@ -2839,6 +2919,12 @@ async function getMigrateEntryInstructionAsync(input, config) {
|
|
|
2839
2919
|
"oracle",
|
|
2840
2920
|
accounts.oracle.value
|
|
2841
2921
|
)
|
|
2922
|
+
),
|
|
2923
|
+
getAddressEncoder().encode(
|
|
2924
|
+
getAddressFromResolvedInstructionAccount(
|
|
2925
|
+
"quoteMint",
|
|
2926
|
+
accounts.quoteMint.value
|
|
2927
|
+
)
|
|
2842
2928
|
)
|
|
2843
2929
|
]
|
|
2844
2930
|
});
|
|
@@ -2899,8 +2985,8 @@ async function getMigrateEntryInstructionAsync(input, config) {
|
|
|
2899
2985
|
),
|
|
2900
2986
|
getAddressEncoder().encode(
|
|
2901
2987
|
getAddressFromResolvedInstructionAccount(
|
|
2902
|
-
"
|
|
2903
|
-
accounts.
|
|
2988
|
+
"market",
|
|
2989
|
+
accounts.market.value
|
|
2904
2990
|
)
|
|
2905
2991
|
),
|
|
2906
2992
|
getAddressEncoder().encode(
|
|
@@ -2923,7 +3009,8 @@ async function getMigrateEntryInstructionAsync(input, config) {
|
|
|
2923
3009
|
getAccountMeta("baseVault", accounts.baseVault),
|
|
2924
3010
|
getAccountMeta("quoteVault", accounts.quoteVault),
|
|
2925
3011
|
getAccountMeta("payer", accounts.payer),
|
|
2926
|
-
getAccountMeta("
|
|
3012
|
+
getAccountMeta("baseTokenProgram", accounts.baseTokenProgram),
|
|
3013
|
+
getAccountMeta("quoteTokenProgram", accounts.quoteTokenProgram),
|
|
2927
3014
|
getAccountMeta("systemProgram", accounts.systemProgram),
|
|
2928
3015
|
getAccountMeta("rent", accounts.rent),
|
|
2929
3016
|
getAccountMeta("oracle", accounts.oracle),
|
|
@@ -2956,7 +3043,14 @@ function getMigrateEntryInstruction(input, config) {
|
|
|
2956
3043
|
baseVault: { value: input.baseVault ?? null, isWritable: true },
|
|
2957
3044
|
quoteVault: { value: input.quoteVault ?? null, isWritable: true },
|
|
2958
3045
|
payer: { value: input.payer ?? null, isWritable: true },
|
|
2959
|
-
|
|
3046
|
+
baseTokenProgram: {
|
|
3047
|
+
value: input.baseTokenProgram ?? null,
|
|
3048
|
+
isWritable: false
|
|
3049
|
+
},
|
|
3050
|
+
quoteTokenProgram: {
|
|
3051
|
+
value: input.quoteTokenProgram ?? null,
|
|
3052
|
+
isWritable: false
|
|
3053
|
+
},
|
|
2960
3054
|
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
2961
3055
|
rent: { value: input.rent ?? null, isWritable: false },
|
|
2962
3056
|
oracle: { value: input.oracle ?? null, isWritable: false },
|
|
@@ -2971,9 +3065,6 @@ function getMigrateEntryInstruction(input, config) {
|
|
|
2971
3065
|
};
|
|
2972
3066
|
const accounts = originalAccounts;
|
|
2973
3067
|
const args = { ...input };
|
|
2974
|
-
if (!accounts.tokenProgram.value) {
|
|
2975
|
-
accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
2976
|
-
}
|
|
2977
3068
|
if (!accounts.systemProgram.value) {
|
|
2978
3069
|
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
2979
3070
|
}
|
|
@@ -2991,7 +3082,8 @@ function getMigrateEntryInstruction(input, config) {
|
|
|
2991
3082
|
getAccountMeta("baseVault", accounts.baseVault),
|
|
2992
3083
|
getAccountMeta("quoteVault", accounts.quoteVault),
|
|
2993
3084
|
getAccountMeta("payer", accounts.payer),
|
|
2994
|
-
getAccountMeta("
|
|
3085
|
+
getAccountMeta("baseTokenProgram", accounts.baseTokenProgram),
|
|
3086
|
+
getAccountMeta("quoteTokenProgram", accounts.quoteTokenProgram),
|
|
2995
3087
|
getAccountMeta("systemProgram", accounts.systemProgram),
|
|
2996
3088
|
getAccountMeta("rent", accounts.rent),
|
|
2997
3089
|
getAccountMeta("oracle", accounts.oracle),
|
|
@@ -3008,12 +3100,12 @@ function getMigrateEntryInstruction(input, config) {
|
|
|
3008
3100
|
});
|
|
3009
3101
|
}
|
|
3010
3102
|
function parseMigrateEntryInstruction(instruction) {
|
|
3011
|
-
if (instruction.accounts.length <
|
|
3103
|
+
if (instruction.accounts.length < 18) {
|
|
3012
3104
|
throw new SolanaError(
|
|
3013
3105
|
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
3014
3106
|
{
|
|
3015
3107
|
actualAccountMetas: instruction.accounts.length,
|
|
3016
|
-
expectedAccountMetas:
|
|
3108
|
+
expectedAccountMetas: 18
|
|
3017
3109
|
}
|
|
3018
3110
|
);
|
|
3019
3111
|
}
|
|
@@ -3034,7 +3126,8 @@ function parseMigrateEntryInstruction(instruction) {
|
|
|
3034
3126
|
baseVault: getNextAccount(),
|
|
3035
3127
|
quoteVault: getNextAccount(),
|
|
3036
3128
|
payer: getNextAccount(),
|
|
3037
|
-
|
|
3129
|
+
baseTokenProgram: getNextAccount(),
|
|
3130
|
+
quoteTokenProgram: getNextAccount(),
|
|
3038
3131
|
systemProgram: getNextAccount(),
|
|
3039
3132
|
rent: getNextAccount(),
|
|
3040
3133
|
oracle: getNextAccount(),
|
|
@@ -3185,7 +3278,14 @@ async function getRegisterEntryInstructionAsync(input, config) {
|
|
|
3185
3278
|
baseVault: { value: input.baseVault ?? null, isWritable: false },
|
|
3186
3279
|
quoteVault: { value: input.quoteVault ?? null, isWritable: false },
|
|
3187
3280
|
payer: { value: input.payer ?? null, isWritable: true },
|
|
3188
|
-
|
|
3281
|
+
baseTokenProgram: {
|
|
3282
|
+
value: input.baseTokenProgram ?? null,
|
|
3283
|
+
isWritable: false
|
|
3284
|
+
},
|
|
3285
|
+
quoteTokenProgram: {
|
|
3286
|
+
value: input.quoteTokenProgram ?? null,
|
|
3287
|
+
isWritable: false
|
|
3288
|
+
},
|
|
3189
3289
|
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
3190
3290
|
rent: { value: input.rent ?? null, isWritable: false },
|
|
3191
3291
|
oracle: { value: input.oracle ?? null, isWritable: false },
|
|
@@ -3200,9 +3300,6 @@ async function getRegisterEntryInstructionAsync(input, config) {
|
|
|
3200
3300
|
};
|
|
3201
3301
|
const accounts = originalAccounts;
|
|
3202
3302
|
const args = { ...input };
|
|
3203
|
-
if (!accounts.tokenProgram.value) {
|
|
3204
|
-
accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
3205
|
-
}
|
|
3206
3303
|
if (!accounts.systemProgram.value) {
|
|
3207
3304
|
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
3208
3305
|
}
|
|
@@ -3219,6 +3316,12 @@ async function getRegisterEntryInstructionAsync(input, config) {
|
|
|
3219
3316
|
"oracle",
|
|
3220
3317
|
accounts.oracle.value
|
|
3221
3318
|
)
|
|
3319
|
+
),
|
|
3320
|
+
getAddressEncoder().encode(
|
|
3321
|
+
getAddressFromResolvedInstructionAccount(
|
|
3322
|
+
"quoteMint",
|
|
3323
|
+
accounts.quoteMint.value
|
|
3324
|
+
)
|
|
3222
3325
|
)
|
|
3223
3326
|
]
|
|
3224
3327
|
});
|
|
@@ -3295,8 +3398,8 @@ async function getRegisterEntryInstructionAsync(input, config) {
|
|
|
3295
3398
|
),
|
|
3296
3399
|
getAddressEncoder().encode(
|
|
3297
3400
|
getAddressFromResolvedInstructionAccount(
|
|
3298
|
-
"
|
|
3299
|
-
accounts.
|
|
3401
|
+
"market",
|
|
3402
|
+
accounts.market.value
|
|
3300
3403
|
)
|
|
3301
3404
|
),
|
|
3302
3405
|
getAddressEncoder().encode(
|
|
@@ -3319,7 +3422,8 @@ async function getRegisterEntryInstructionAsync(input, config) {
|
|
|
3319
3422
|
getAccountMeta("baseVault", accounts.baseVault),
|
|
3320
3423
|
getAccountMeta("quoteVault", accounts.quoteVault),
|
|
3321
3424
|
getAccountMeta("payer", accounts.payer),
|
|
3322
|
-
getAccountMeta("
|
|
3425
|
+
getAccountMeta("baseTokenProgram", accounts.baseTokenProgram),
|
|
3426
|
+
getAccountMeta("quoteTokenProgram", accounts.quoteTokenProgram),
|
|
3323
3427
|
getAccountMeta("systemProgram", accounts.systemProgram),
|
|
3324
3428
|
getAccountMeta("rent", accounts.rent),
|
|
3325
3429
|
getAccountMeta("oracle", accounts.oracle),
|
|
@@ -3352,7 +3456,14 @@ function getRegisterEntryInstruction(input, config) {
|
|
|
3352
3456
|
baseVault: { value: input.baseVault ?? null, isWritable: false },
|
|
3353
3457
|
quoteVault: { value: input.quoteVault ?? null, isWritable: false },
|
|
3354
3458
|
payer: { value: input.payer ?? null, isWritable: true },
|
|
3355
|
-
|
|
3459
|
+
baseTokenProgram: {
|
|
3460
|
+
value: input.baseTokenProgram ?? null,
|
|
3461
|
+
isWritable: false
|
|
3462
|
+
},
|
|
3463
|
+
quoteTokenProgram: {
|
|
3464
|
+
value: input.quoteTokenProgram ?? null,
|
|
3465
|
+
isWritable: false
|
|
3466
|
+
},
|
|
3356
3467
|
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
3357
3468
|
rent: { value: input.rent ?? null, isWritable: false },
|
|
3358
3469
|
oracle: { value: input.oracle ?? null, isWritable: false },
|
|
@@ -3367,9 +3478,6 @@ function getRegisterEntryInstruction(input, config) {
|
|
|
3367
3478
|
};
|
|
3368
3479
|
const accounts = originalAccounts;
|
|
3369
3480
|
const args = { ...input };
|
|
3370
|
-
if (!accounts.tokenProgram.value) {
|
|
3371
|
-
accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
3372
|
-
}
|
|
3373
3481
|
if (!accounts.systemProgram.value) {
|
|
3374
3482
|
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
3375
3483
|
}
|
|
@@ -3387,7 +3495,8 @@ function getRegisterEntryInstruction(input, config) {
|
|
|
3387
3495
|
getAccountMeta("baseVault", accounts.baseVault),
|
|
3388
3496
|
getAccountMeta("quoteVault", accounts.quoteVault),
|
|
3389
3497
|
getAccountMeta("payer", accounts.payer),
|
|
3390
|
-
getAccountMeta("
|
|
3498
|
+
getAccountMeta("baseTokenProgram", accounts.baseTokenProgram),
|
|
3499
|
+
getAccountMeta("quoteTokenProgram", accounts.quoteTokenProgram),
|
|
3391
3500
|
getAccountMeta("systemProgram", accounts.systemProgram),
|
|
3392
3501
|
getAccountMeta("rent", accounts.rent),
|
|
3393
3502
|
getAccountMeta("oracle", accounts.oracle),
|
|
@@ -3404,12 +3513,12 @@ function getRegisterEntryInstruction(input, config) {
|
|
|
3404
3513
|
});
|
|
3405
3514
|
}
|
|
3406
3515
|
function parseRegisterEntryInstruction(instruction) {
|
|
3407
|
-
if (instruction.accounts.length <
|
|
3516
|
+
if (instruction.accounts.length < 18) {
|
|
3408
3517
|
throw new SolanaError(
|
|
3409
3518
|
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
3410
3519
|
{
|
|
3411
3520
|
actualAccountMetas: instruction.accounts.length,
|
|
3412
|
-
expectedAccountMetas:
|
|
3521
|
+
expectedAccountMetas: 18
|
|
3413
3522
|
}
|
|
3414
3523
|
);
|
|
3415
3524
|
}
|
|
@@ -3430,7 +3539,8 @@ function parseRegisterEntryInstruction(instruction) {
|
|
|
3430
3539
|
baseVault: getNextAccount(),
|
|
3431
3540
|
quoteVault: getNextAccount(),
|
|
3432
3541
|
payer: getNextAccount(),
|
|
3433
|
-
|
|
3542
|
+
baseTokenProgram: getNextAccount(),
|
|
3543
|
+
quoteTokenProgram: getNextAccount(),
|
|
3434
3544
|
systemProgram: getNextAccount(),
|
|
3435
3545
|
rent: getNextAccount(),
|
|
3436
3546
|
oracle: getNextAccount(),
|
|
@@ -3653,10 +3763,14 @@ function predictionMigratorProgram() {
|
|
|
3653
3763
|
}
|
|
3654
3764
|
var addressCodec4 = getAddressCodec();
|
|
3655
3765
|
var textEncoder4 = new TextEncoder();
|
|
3656
|
-
async function getPredictionMarketAddress(oracleState, programId = PREDICTION_MIGRATOR_PROGRAM_ADDRESS) {
|
|
3766
|
+
async function getPredictionMarketAddress(oracleState, quoteMint, programId = PREDICTION_MIGRATOR_PROGRAM_ADDRESS) {
|
|
3657
3767
|
return getProgramDerivedAddress({
|
|
3658
3768
|
programAddress: programId,
|
|
3659
|
-
seeds: [
|
|
3769
|
+
seeds: [
|
|
3770
|
+
textEncoder4.encode("market"),
|
|
3771
|
+
addressCodec4.encode(oracleState),
|
|
3772
|
+
addressCodec4.encode(quoteMint)
|
|
3773
|
+
]
|
|
3660
3774
|
});
|
|
3661
3775
|
}
|
|
3662
3776
|
async function getPredictionMarketAuthorityAddress(market, programId = PREDICTION_MIGRATOR_PROGRAM_ADDRESS) {
|
|
@@ -3674,22 +3788,18 @@ async function getPredictionPotVaultAddress(market, programId = PREDICTION_MIGRA
|
|
|
3674
3788
|
seeds: [textEncoder4.encode("pot_vault"), addressCodec4.encode(market)]
|
|
3675
3789
|
});
|
|
3676
3790
|
}
|
|
3677
|
-
async function getPredictionEntryAddress(
|
|
3791
|
+
async function getPredictionEntryAddress(market, entryId, programId = PREDICTION_MIGRATOR_PROGRAM_ADDRESS) {
|
|
3678
3792
|
return getProgramDerivedAddress({
|
|
3679
3793
|
programAddress: programId,
|
|
3680
|
-
seeds: [
|
|
3681
|
-
textEncoder4.encode("entry"),
|
|
3682
|
-
addressCodec4.encode(oracleState),
|
|
3683
|
-
entryId
|
|
3684
|
-
]
|
|
3794
|
+
seeds: [textEncoder4.encode("entry"), addressCodec4.encode(market), entryId]
|
|
3685
3795
|
});
|
|
3686
3796
|
}
|
|
3687
|
-
async function getPredictionEntryByMintAddress(
|
|
3797
|
+
async function getPredictionEntryByMintAddress(market, mint, programId = PREDICTION_MIGRATOR_PROGRAM_ADDRESS) {
|
|
3688
3798
|
return getProgramDerivedAddress({
|
|
3689
3799
|
programAddress: programId,
|
|
3690
3800
|
seeds: [
|
|
3691
3801
|
textEncoder4.encode("entry_by_mint"),
|
|
3692
|
-
addressCodec4.encode(
|
|
3802
|
+
addressCodec4.encode(market),
|
|
3693
3803
|
addressCodec4.encode(mint)
|
|
3694
3804
|
]
|
|
3695
3805
|
});
|
|
@@ -3725,7 +3835,6 @@ var ALT_INDEX = {
|
|
|
3725
3835
|
[TOKEN_METADATA_PROGRAM_ID]: 4,
|
|
3726
3836
|
[CPMM_MIGRATOR_PROGRAM_ID]: 5,
|
|
3727
3837
|
So11111111111111111111111111111111111111112: 6,
|
|
3728
|
-
// index 7 = config PDA — resolved at call time from accounts.config
|
|
3729
3838
|
[PREDICTION_MIGRATOR_PROGRAM_ADDRESS]: 8
|
|
3730
3839
|
};
|
|
3731
3840
|
function validateInitializeLaunchCurveParams(args) {
|
|
@@ -3751,10 +3860,13 @@ async function createInitializeLaunchInstruction(accounts, args, programId = INI
|
|
|
3751
3860
|
payer,
|
|
3752
3861
|
authority,
|
|
3753
3862
|
migratorProgram,
|
|
3754
|
-
|
|
3863
|
+
baseTokenProgram = TOKEN_PROGRAM_ADDRESS,
|
|
3864
|
+
quoteTokenProgram = TOKEN_PROGRAM_ADDRESS,
|
|
3755
3865
|
systemProgram = SYSTEM_PROGRAM_ADDRESS,
|
|
3756
3866
|
rent,
|
|
3757
3867
|
metadataAccount,
|
|
3868
|
+
metadataProgram = TOKEN_METADATA_PROGRAM_ID,
|
|
3869
|
+
instructionsSysvar = SYSVAR_INSTRUCTIONS_ADDRESS,
|
|
3758
3870
|
addressLookupTable: alt
|
|
3759
3871
|
} = accounts;
|
|
3760
3872
|
const withMetadata = Boolean(
|
|
@@ -3765,7 +3877,7 @@ async function createInitializeLaunchInstruction(accounts, args, programId = INI
|
|
|
3765
3877
|
"metadataName is set but metadataAccount was not provided. Derive it with await initializer.getTokenMetadataAddress(baseMintAddress)."
|
|
3766
3878
|
);
|
|
3767
3879
|
}
|
|
3768
|
-
const altIndexMap = alt ?
|
|
3880
|
+
const altIndexMap = alt ? ALT_INDEX : {};
|
|
3769
3881
|
function staticOrLookup(addr, role) {
|
|
3770
3882
|
if (alt && altIndexMap[addr] !== void 0) {
|
|
3771
3883
|
return {
|
|
@@ -3793,13 +3905,18 @@ async function createInitializeLaunchInstruction(accounts, args, programId = INI
|
|
|
3793
3905
|
if (migratorProgram) {
|
|
3794
3906
|
keys.push(staticOrLookup(migratorProgram, AccountRole.READONLY));
|
|
3795
3907
|
}
|
|
3796
|
-
keys.push(staticOrLookup(
|
|
3908
|
+
keys.push(staticOrLookup(baseTokenProgram, AccountRole.READONLY));
|
|
3909
|
+
keys.push(staticOrLookup(quoteTokenProgram, AccountRole.READONLY));
|
|
3797
3910
|
keys.push(staticOrLookup(systemProgram, AccountRole.READONLY));
|
|
3798
3911
|
keys.push(staticOrLookup(rent, AccountRole.READONLY));
|
|
3799
3912
|
if (withMetadata) {
|
|
3800
3913
|
keys.push({ address: metadataAccount, role: AccountRole.WRITABLE });
|
|
3801
|
-
keys.push(staticOrLookup(
|
|
3914
|
+
keys.push(staticOrLookup(metadataProgram, AccountRole.READONLY));
|
|
3915
|
+
} else {
|
|
3916
|
+
keys.push({ address: programId, role: AccountRole.READONLY });
|
|
3917
|
+
keys.push({ address: programId, role: AccountRole.READONLY });
|
|
3802
3918
|
}
|
|
3919
|
+
keys.push({ address: instructionsSysvar, role: AccountRole.READONLY });
|
|
3803
3920
|
const encoderArgs = {
|
|
3804
3921
|
...args,
|
|
3805
3922
|
allowBuy: args.allowBuy ? 1 : 0,
|
|
@@ -3810,19 +3927,25 @@ async function createInitializeLaunchInstruction(accounts, args, programId = INI
|
|
|
3810
3927
|
getInitializeLaunchInstructionDataEncoder().encode(encoderArgs)
|
|
3811
3928
|
);
|
|
3812
3929
|
if (migratorProgram === CPMM_MIGRATOR_PROGRAM_ID) {
|
|
3930
|
+
if (!accounts.cpmmConfig) {
|
|
3931
|
+
throw new Error(
|
|
3932
|
+
"cpmmConfig is required when migratorProgram is CPMM_MIGRATOR_PROGRAM_ID"
|
|
3933
|
+
);
|
|
3934
|
+
}
|
|
3813
3935
|
const [cpmmMigratorState] = await getCpmmMigratorStateAddress(launch);
|
|
3814
3936
|
keys.push({ address: cpmmMigratorState, role: AccountRole.WRITABLE });
|
|
3937
|
+
keys.push({ address: accounts.cpmmConfig, role: AccountRole.READONLY });
|
|
3815
3938
|
}
|
|
3816
3939
|
if (migratorProgram === PREDICTION_MIGRATOR_PROGRAM_ADDRESS) {
|
|
3817
3940
|
const oracleState = args.namespace;
|
|
3818
3941
|
const entryId = args.launchId;
|
|
3819
3942
|
const baseMintAddress = isTransactionSigner5(baseMint) ? baseMint.address : baseMint;
|
|
3820
|
-
const [market] = await getPredictionMarketAddress(oracleState);
|
|
3943
|
+
const [market] = await getPredictionMarketAddress(oracleState, quoteMint);
|
|
3821
3944
|
const [potVault] = await getPredictionPotVaultAddress(market);
|
|
3822
3945
|
const [marketAuthority] = await getPredictionMarketAuthorityAddress(market);
|
|
3823
|
-
const [entry] = await getPredictionEntryAddress(
|
|
3946
|
+
const [entry] = await getPredictionEntryAddress(market, entryId);
|
|
3824
3947
|
const [entryByMint] = await getPredictionEntryByMintAddress(
|
|
3825
|
-
|
|
3948
|
+
market,
|
|
3826
3949
|
baseMintAddress
|
|
3827
3950
|
);
|
|
3828
3951
|
keys.push({ address: oracleState, role: AccountRole.READONLY });
|
|
@@ -3856,7 +3979,9 @@ function createCurveSwapExactInInstruction(accounts, args, programId = INITIALIZ
|
|
|
3856
3979
|
quoteMint,
|
|
3857
3980
|
user,
|
|
3858
3981
|
sentinelProgram = SYSTEM_PROGRAM_ADDRESS,
|
|
3859
|
-
|
|
3982
|
+
baseTokenProgram = TOKEN_PROGRAM_ADDRESS,
|
|
3983
|
+
quoteTokenProgram = TOKEN_PROGRAM_ADDRESS,
|
|
3984
|
+
instructionsSysvar = SYSVAR_INSTRUCTIONS_ADDRESS
|
|
3860
3985
|
} = accounts;
|
|
3861
3986
|
const keys = [
|
|
3862
3987
|
{ address: config, role: AccountRole.READONLY },
|
|
@@ -3873,7 +3998,9 @@ function createCurveSwapExactInInstruction(accounts, args, programId = INITIALIZ
|
|
|
3873
3998
|
// slot (token_program follows it). Always emit it — use SYSTEM_PROGRAM_ADDRESS as the
|
|
3874
3999
|
// no-op placeholder when no real sentinel is configured.
|
|
3875
4000
|
{ address: sentinelProgram, role: AccountRole.READONLY },
|
|
3876
|
-
{ address:
|
|
4001
|
+
{ address: baseTokenProgram, role: AccountRole.READONLY },
|
|
4002
|
+
{ address: quoteTokenProgram, role: AccountRole.READONLY },
|
|
4003
|
+
{ address: instructionsSysvar, role: AccountRole.READONLY }
|
|
3877
4004
|
];
|
|
3878
4005
|
const data = new Uint8Array(
|
|
3879
4006
|
getCurveSwapExactInInstructionDataEncoder().encode(args)
|
|
@@ -3900,9 +4027,11 @@ function createMigrateLaunchInstruction(accounts, programId = INITIALIZER_PROGRA
|
|
|
3900
4027
|
quoteVault,
|
|
3901
4028
|
migratorProgram,
|
|
3902
4029
|
payer,
|
|
3903
|
-
|
|
4030
|
+
baseTokenProgram = TOKEN_PROGRAM_ADDRESS,
|
|
4031
|
+
quoteTokenProgram = TOKEN_PROGRAM_ADDRESS,
|
|
3904
4032
|
systemProgram = SYSTEM_PROGRAM_ADDRESS,
|
|
3905
|
-
rent
|
|
4033
|
+
rent,
|
|
4034
|
+
instructionsSysvar = SYSVAR_INSTRUCTIONS_ADDRESS
|
|
3906
4035
|
} = accounts;
|
|
3907
4036
|
const keys = [
|
|
3908
4037
|
{ address: config, role: AccountRole.READONLY },
|
|
@@ -3914,52 +4043,17 @@ function createMigrateLaunchInstruction(accounts, programId = INITIALIZER_PROGRA
|
|
|
3914
4043
|
{ address: quoteVault, role: AccountRole.WRITABLE },
|
|
3915
4044
|
{ address: migratorProgram, role: AccountRole.READONLY },
|
|
3916
4045
|
createSignerAccountMeta5(payer, AccountRole.WRITABLE_SIGNER),
|
|
3917
|
-
{ address:
|
|
4046
|
+
{ address: baseTokenProgram, role: AccountRole.READONLY },
|
|
4047
|
+
{ address: quoteTokenProgram, role: AccountRole.READONLY },
|
|
3918
4048
|
{ address: systemProgram, role: AccountRole.READONLY },
|
|
3919
|
-
{ address: rent, role: AccountRole.READONLY }
|
|
4049
|
+
{ address: rent, role: AccountRole.READONLY },
|
|
4050
|
+
{ address: instructionsSysvar, role: AccountRole.READONLY }
|
|
3920
4051
|
];
|
|
3921
4052
|
const data = encodeInstructionData(
|
|
3922
4053
|
INITIALIZER_INSTRUCTION_DISCRIMINATORS.migrateLaunch
|
|
3923
4054
|
);
|
|
3924
4055
|
return { programAddress: programId, accounts: keys, data };
|
|
3925
4056
|
}
|
|
3926
|
-
function isTransactionSigner8(value) {
|
|
3927
|
-
return typeof value === "object" && value !== null && "address" in value && "signTransactions" in value;
|
|
3928
|
-
}
|
|
3929
|
-
function createAccountMeta3(value, role) {
|
|
3930
|
-
if (isTransactionSigner8(value)) {
|
|
3931
|
-
return { address: value.address, role, signer: value };
|
|
3932
|
-
}
|
|
3933
|
-
return { address: value, role };
|
|
3934
|
-
}
|
|
3935
|
-
function createAbortLaunchInstruction(accounts, programId = INITIALIZER_PROGRAM_ID) {
|
|
3936
|
-
const {
|
|
3937
|
-
config,
|
|
3938
|
-
launch,
|
|
3939
|
-
launchAuthority,
|
|
3940
|
-
baseVault,
|
|
3941
|
-
quoteVault,
|
|
3942
|
-
authority,
|
|
3943
|
-
authorityBaseAccount,
|
|
3944
|
-
baseMint,
|
|
3945
|
-
tokenProgram = TOKEN_PROGRAM_ADDRESS
|
|
3946
|
-
} = accounts;
|
|
3947
|
-
const keys = [
|
|
3948
|
-
{ address: config, role: AccountRole.READONLY },
|
|
3949
|
-
{ address: launch, role: AccountRole.WRITABLE },
|
|
3950
|
-
{ address: launchAuthority, role: AccountRole.READONLY },
|
|
3951
|
-
{ address: baseVault, role: AccountRole.WRITABLE },
|
|
3952
|
-
{ address: quoteVault, role: AccountRole.READONLY },
|
|
3953
|
-
createAccountMeta3(authority, AccountRole.READONLY_SIGNER),
|
|
3954
|
-
{ address: authorityBaseAccount, role: AccountRole.WRITABLE },
|
|
3955
|
-
{ address: baseMint, role: AccountRole.READONLY },
|
|
3956
|
-
{ address: tokenProgram, role: AccountRole.READONLY }
|
|
3957
|
-
];
|
|
3958
|
-
const data = encodeInstructionData(
|
|
3959
|
-
INITIALIZER_INSTRUCTION_DISCRIMINATORS.abortLaunch
|
|
3960
|
-
);
|
|
3961
|
-
return { programAddress: programId, accounts: keys, data };
|
|
3962
|
-
}
|
|
3963
4057
|
var previewSwapExactInResultCodec = getStructCodec([
|
|
3964
4058
|
["amountOut", getU64Codec()],
|
|
3965
4059
|
["feePaid", getU64Codec()]
|
|
@@ -4133,10 +4227,12 @@ __export(cpmmMigrator_exports, {
|
|
|
4133
4227
|
CPMM_MIGRATOR_INSTRUCTION_DISCRIMINATORS: () => CPMM_MIGRATOR_INSTRUCTION_DISCRIMINATORS,
|
|
4134
4228
|
CPMM_MIGRATOR_PROGRAM_ID: () => CPMM_MIGRATOR_PROGRAM_ID,
|
|
4135
4229
|
MAX_RECIPIENTS: () => MAX_RECIPIENTS,
|
|
4230
|
+
SEED_MIGRATION_AUTHORITY: () => SEED_MIGRATION_AUTHORITY,
|
|
4136
4231
|
SEED_STATE: () => SEED_STATE,
|
|
4137
4232
|
encodeMigrateCalldata: () => encodeMigrateCalldata,
|
|
4138
4233
|
encodeRegisterLaunchCalldata: () => encodeRegisterLaunchCalldata,
|
|
4139
4234
|
fetchCpmmMigratorState: () => fetchCpmmMigratorState,
|
|
4235
|
+
getCpmmMigrationAuthorityAddress: () => getCpmmMigrationAuthorityAddress,
|
|
4140
4236
|
getCpmmMigratorStateAddress: () => getCpmmMigratorStateAddress,
|
|
4141
4237
|
getCpmmMigratorStateCodec: () => getCpmmMigratorStateCodec,
|
|
4142
4238
|
getCpmmMigratorStateDecoder: () => getCpmmMigratorStateDecoder,
|