@send-fun/sdk 1.2.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +281 -365
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +125 -166
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +125 -166
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +281 -365
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -7
- package/src/dex/generated/accounts/pool.ts +19 -7
- package/src/dex/generated/errors/sendDex.ts +16 -8
- package/src/dex/generated/events/creatorClaimEvent.ts +3 -2
- package/src/dex/generated/events/poolCreateEvent.ts +8 -2
- package/src/dex/generated/events/tokenCreateEvent.ts +8 -9
- package/src/dex/generated/events/tradeEvent.ts +9 -2
- package/src/dex/generated/instructions/claimCreatorFees.ts +21 -5
- package/src/{nexus → dex}/generated/pdas/creatorFeeConfig.ts +6 -6
- package/src/dex/generated/pdas/index.ts +1 -0
- package/src/dex/generated/plugins/sendDex.ts +3 -0
- package/src/launchpad/create.ts +9 -34
- package/src/launchpad/generated/accounts/bondingCurve.ts +23 -7
- package/src/launchpad/generated/errors/sendLaunchpad.ts +12 -4
- package/src/launchpad/generated/events/completeEvent.ts +3 -2
- package/src/launchpad/generated/events/creatorClaimEvent.ts +3 -2
- package/src/launchpad/generated/events/migrateEvent.ts +3 -2
- package/src/launchpad/generated/events/tokenCreateEvent.ts +10 -9
- package/src/launchpad/generated/events/tradeEvent.ts +9 -2
- package/src/launchpad/generated/instructions/claimCreatorFees.ts +17 -4
- package/src/launchpad/generated/instructions/createToken.ts +32 -50
- package/src/launchpad/generated/instructions/migrate.ts +79 -12
- package/src/launchpad/generated/pdas/creatorFeeConfig.ts +39 -0
- package/src/launchpad/generated/pdas/index.ts +1 -0
- package/src/launchpad/generated/plugins/sendLaunchpad.ts +3 -0
- package/src/launchpad/migrate.ts +7 -4
- package/src/nexus/fee-helpers.ts +8 -5
- package/src/nexus/generated/accounts/feePreset.ts +2 -2
- package/src/nexus/generated/accounts/index.ts +0 -1
- package/src/nexus/generated/accounts/partnerConfig.ts +9 -3
- package/src/nexus/generated/accounts/sendNexus.accounts.ts +0 -5
- package/src/nexus/generated/accounts/userRewardDebt.ts +3 -3
- package/src/nexus/generated/accounts/userStakePosition.ts +3 -3
- package/src/nexus/generated/errors/sendNexus.ts +12 -4
- package/src/nexus/generated/pdas/index.ts +0 -1
- package/src/nexus/generated/plugins/sendNexus.ts +0 -35
- package/src/nexus/generated/types/dexFees.ts +4 -4
- package/src/nexus/generated/types/index.ts +0 -1
- package/src/nexus/generated/types/launchpadFees.ts +4 -4
- package/src/utils/index.ts +0 -5
- package/src/nexus/generated/accounts/creatorFeeConfig.ts +0 -237
- package/src/nexus/generated/types/callerType.ts +0 -38
- package/src/utils/creator-hash.ts +0 -60
package/dist/index.mjs
CHANGED
|
@@ -264,7 +264,7 @@ function getPoolEncoder() {
|
|
|
264
264
|
["quoteMint", getAddressEncoder()],
|
|
265
265
|
["quoteDecimals", getU8Encoder()],
|
|
266
266
|
["coinCreator", getAddressEncoder()],
|
|
267
|
-
["
|
|
267
|
+
["padding0", getArrayEncoder(getU64Encoder(), { size: 4 })],
|
|
268
268
|
["baseVault", getAddressEncoder()],
|
|
269
269
|
["quoteVault", getAddressEncoder()],
|
|
270
270
|
["lpMint", getAddressEncoder()],
|
|
@@ -276,7 +276,9 @@ function getPoolEncoder() {
|
|
|
276
276
|
["protocolOwed", getU64Encoder()],
|
|
277
277
|
["creatorOwed", getU64Encoder()],
|
|
278
278
|
["platformConfig", getAddressEncoder()],
|
|
279
|
-
["
|
|
279
|
+
["creatorFeeMode", getU8Encoder()],
|
|
280
|
+
["creatorFeeBps", getU16Encoder()],
|
|
281
|
+
["reserved", fixEncoderSize(getBytesEncoder(), 256)]
|
|
280
282
|
]), (value) => ({
|
|
281
283
|
...value,
|
|
282
284
|
discriminator: POOL_DISCRIMINATOR
|
|
@@ -294,7 +296,7 @@ function getPoolDecoder() {
|
|
|
294
296
|
["quoteMint", getAddressDecoder()],
|
|
295
297
|
["quoteDecimals", getU8Decoder()],
|
|
296
298
|
["coinCreator", getAddressDecoder()],
|
|
297
|
-
["
|
|
299
|
+
["padding0", getArrayDecoder(getU64Decoder(), { size: 4 })],
|
|
298
300
|
["baseVault", getAddressDecoder()],
|
|
299
301
|
["quoteVault", getAddressDecoder()],
|
|
300
302
|
["lpMint", getAddressDecoder()],
|
|
@@ -306,7 +308,9 @@ function getPoolDecoder() {
|
|
|
306
308
|
["protocolOwed", getU64Decoder()],
|
|
307
309
|
["creatorOwed", getU64Decoder()],
|
|
308
310
|
["platformConfig", getAddressDecoder()],
|
|
309
|
-
["
|
|
311
|
+
["creatorFeeMode", getU8Decoder()],
|
|
312
|
+
["creatorFeeBps", getU16Decoder()],
|
|
313
|
+
["reserved", fixDecoderSize(getBytesDecoder(), 256)]
|
|
310
314
|
]);
|
|
311
315
|
}
|
|
312
316
|
/** Gets the codec for {@link Pool} account data. */
|
|
@@ -364,7 +368,7 @@ async function fetchAllMaybePool(rpc, addresses, config) {
|
|
|
364
368
|
}));
|
|
365
369
|
}
|
|
366
370
|
function getPoolSize() {
|
|
367
|
-
return
|
|
371
|
+
return 584;
|
|
368
372
|
}
|
|
369
373
|
//#endregion
|
|
370
374
|
//#region src/dex/generated/accounts/rewardAccrual.ts
|
|
@@ -562,8 +566,8 @@ const SEND_DEX_ERROR__INVALID_POOL_BALANCE = 6008;
|
|
|
562
566
|
const SEND_DEX_ERROR__INSUFFICIENT_POOL_BALANCE = 6009;
|
|
563
567
|
/** InvalidAuthority: Invalid authority */
|
|
564
568
|
const SEND_DEX_ERROR__INVALID_AUTHORITY = 6010;
|
|
565
|
-
/**
|
|
566
|
-
const
|
|
569
|
+
/** InvalidCoinCreator: Invalid coin creator */
|
|
570
|
+
const SEND_DEX_ERROR__INVALID_COIN_CREATOR = 6011;
|
|
567
571
|
/** InvalidPlatformConfig: Platform config cannot be the default address */
|
|
568
572
|
const SEND_DEX_ERROR__INVALID_PLATFORM_CONFIG = 6012;
|
|
569
573
|
/** ProgramPaused: Program is paused */
|
|
@@ -590,26 +594,31 @@ const SEND_DEX_ERROR__USER_TOKEN_ACCOUNT_WRONG_MINT = 7009;
|
|
|
590
594
|
const SEND_DEX_ERROR__USER_TOKEN_ACCOUNT_WRONG_AUTHORITY = 7010;
|
|
591
595
|
/** NothingToClaim: Nothing to claim */
|
|
592
596
|
const SEND_DEX_ERROR__NOTHING_TO_CLAIM = 7011;
|
|
593
|
-
/**
|
|
594
|
-
const
|
|
597
|
+
/** Unused7012: Unused */
|
|
598
|
+
const SEND_DEX_ERROR__UNUSED7012 = 7012;
|
|
595
599
|
/** QuoteMintPriceUnset: Quote mint has no USDC price on its nexus reward state */
|
|
596
600
|
const SEND_DEX_ERROR__QUOTE_MINT_PRICE_UNSET = 7013;
|
|
597
601
|
/** TransferFeeNotSettleable: Token-2022 transfer fee schedule cannot settle the exact amount */
|
|
598
602
|
const SEND_DEX_ERROR__TRANSFER_FEE_NOT_SETTLEABLE = 7014;
|
|
603
|
+
/** CreatorFeeTooHigh: Creator fee exceeds the partner's maximum */
|
|
604
|
+
const SEND_DEX_ERROR__CREATOR_FEE_TOO_HIGH = 7015;
|
|
605
|
+
/** CreatorFeeModeNotAllowed: Creator fee mode is not allowed by the partner config */
|
|
606
|
+
const SEND_DEX_ERROR__CREATOR_FEE_MODE_NOT_ALLOWED = 7016;
|
|
599
607
|
/** InsufficientLiquidity: Insufficient liquidity */
|
|
600
608
|
const SEND_DEX_ERROR__INSUFFICIENT_LIQUIDITY = 7100;
|
|
601
609
|
/** InvalidAmount: Invalid amount */
|
|
602
610
|
const SEND_DEX_ERROR__INVALID_AMOUNT = 7101;
|
|
603
611
|
const sendDexErrorMessages = {
|
|
604
612
|
[SEND_DEX_ERROR__ARITHMETIC_OVERFLOW]: `Arithmetic overflow`,
|
|
613
|
+
[SEND_DEX_ERROR__CREATOR_FEE_MODE_NOT_ALLOWED]: `Creator fee mode is not allowed by the partner config`,
|
|
614
|
+
[SEND_DEX_ERROR__CREATOR_FEE_TOO_HIGH]: `Creator fee exceeds the partner's maximum`,
|
|
605
615
|
[SEND_DEX_ERROR__INSUFFICIENT_BALANCE]: `Insufficient balance in source account`,
|
|
606
616
|
[SEND_DEX_ERROR__INSUFFICIENT_LIQUIDITY]: `Insufficient liquidity`,
|
|
607
617
|
[SEND_DEX_ERROR__INSUFFICIENT_POOL_BALANCE]: `Insufficient pool balance`,
|
|
608
618
|
[SEND_DEX_ERROR__INVALID_AMOUNT]: `Invalid amount`,
|
|
609
619
|
[SEND_DEX_ERROR__INVALID_AUTHORITY]: `Invalid authority`,
|
|
610
620
|
[SEND_DEX_ERROR__INVALID_BASE_MINT]: `Invalid base mint`,
|
|
611
|
-
[
|
|
612
|
-
[SEND_DEX_ERROR__INVALID_CREATOR_ID]: `Creator identity is not a decodable wallet address`,
|
|
621
|
+
[SEND_DEX_ERROR__INVALID_COIN_CREATOR]: `Invalid coin creator`,
|
|
613
622
|
[SEND_DEX_ERROR__INVALID_DEPOSIT]: `Invalid deposit`,
|
|
614
623
|
[SEND_DEX_ERROR__INVALID_PLATFORM_CONFIG]: `Platform config cannot be the default address`,
|
|
615
624
|
[SEND_DEX_ERROR__INVALID_POOL_BALANCE]: `Invalid pool balance`,
|
|
@@ -627,6 +636,7 @@ const sendDexErrorMessages = {
|
|
|
627
636
|
[SEND_DEX_ERROR__TEXT_TOO_LONG]: `Text too long`,
|
|
628
637
|
[SEND_DEX_ERROR__TRANSFER_FEE_NOT_SETTLEABLE]: `Token-2022 transfer fee schedule cannot settle the exact amount`,
|
|
629
638
|
[SEND_DEX_ERROR__UNAUTHORIZED]: `Unauthorized`,
|
|
639
|
+
[SEND_DEX_ERROR__UNUSED7012]: `Unused`,
|
|
630
640
|
[SEND_DEX_ERROR__USER_TOKEN_ACCOUNT_INVALID]: `User token account is not an initialized token account`,
|
|
631
641
|
[SEND_DEX_ERROR__USER_TOKEN_ACCOUNT_WRONG_AUTHORITY]: `User token account is not owned by the trading user`,
|
|
632
642
|
[SEND_DEX_ERROR__USER_TOKEN_ACCOUNT_WRONG_MINT]: `User token account mint does not match the trade`,
|
|
@@ -642,14 +652,15 @@ function isSendDexError(error, transactionMessage, code) {
|
|
|
642
652
|
//#region src/dex/generated/errors/index.ts
|
|
643
653
|
var errors_exports$2 = /* @__PURE__ */ __exportAll({
|
|
644
654
|
SEND_DEX_ERROR__ARITHMETIC_OVERFLOW: () => SEND_DEX_ERROR__ARITHMETIC_OVERFLOW,
|
|
655
|
+
SEND_DEX_ERROR__CREATOR_FEE_MODE_NOT_ALLOWED: () => SEND_DEX_ERROR__CREATOR_FEE_MODE_NOT_ALLOWED,
|
|
656
|
+
SEND_DEX_ERROR__CREATOR_FEE_TOO_HIGH: () => SEND_DEX_ERROR__CREATOR_FEE_TOO_HIGH,
|
|
645
657
|
SEND_DEX_ERROR__INSUFFICIENT_BALANCE: () => SEND_DEX_ERROR__INSUFFICIENT_BALANCE,
|
|
646
658
|
SEND_DEX_ERROR__INSUFFICIENT_LIQUIDITY: () => SEND_DEX_ERROR__INSUFFICIENT_LIQUIDITY,
|
|
647
659
|
SEND_DEX_ERROR__INSUFFICIENT_POOL_BALANCE: () => SEND_DEX_ERROR__INSUFFICIENT_POOL_BALANCE,
|
|
648
660
|
SEND_DEX_ERROR__INVALID_AMOUNT: () => SEND_DEX_ERROR__INVALID_AMOUNT,
|
|
649
661
|
SEND_DEX_ERROR__INVALID_AUTHORITY: () => SEND_DEX_ERROR__INVALID_AUTHORITY,
|
|
650
662
|
SEND_DEX_ERROR__INVALID_BASE_MINT: () => SEND_DEX_ERROR__INVALID_BASE_MINT,
|
|
651
|
-
|
|
652
|
-
SEND_DEX_ERROR__INVALID_CREATOR_ID: () => SEND_DEX_ERROR__INVALID_CREATOR_ID,
|
|
663
|
+
SEND_DEX_ERROR__INVALID_COIN_CREATOR: () => SEND_DEX_ERROR__INVALID_COIN_CREATOR,
|
|
653
664
|
SEND_DEX_ERROR__INVALID_DEPOSIT: () => SEND_DEX_ERROR__INVALID_DEPOSIT,
|
|
654
665
|
SEND_DEX_ERROR__INVALID_PLATFORM_CONFIG: () => SEND_DEX_ERROR__INVALID_PLATFORM_CONFIG,
|
|
655
666
|
SEND_DEX_ERROR__INVALID_POOL_BALANCE: () => SEND_DEX_ERROR__INVALID_POOL_BALANCE,
|
|
@@ -667,6 +678,7 @@ var errors_exports$2 = /* @__PURE__ */ __exportAll({
|
|
|
667
678
|
SEND_DEX_ERROR__TEXT_TOO_LONG: () => SEND_DEX_ERROR__TEXT_TOO_LONG,
|
|
668
679
|
SEND_DEX_ERROR__TRANSFER_FEE_NOT_SETTLEABLE: () => SEND_DEX_ERROR__TRANSFER_FEE_NOT_SETTLEABLE,
|
|
669
680
|
SEND_DEX_ERROR__UNAUTHORIZED: () => SEND_DEX_ERROR__UNAUTHORIZED,
|
|
681
|
+
SEND_DEX_ERROR__UNUSED7012: () => SEND_DEX_ERROR__UNUSED7012,
|
|
670
682
|
SEND_DEX_ERROR__USER_TOKEN_ACCOUNT_INVALID: () => SEND_DEX_ERROR__USER_TOKEN_ACCOUNT_INVALID,
|
|
671
683
|
SEND_DEX_ERROR__USER_TOKEN_ACCOUNT_WRONG_AUTHORITY: () => SEND_DEX_ERROR__USER_TOKEN_ACCOUNT_WRONG_AUTHORITY,
|
|
672
684
|
SEND_DEX_ERROR__USER_TOKEN_ACCOUNT_WRONG_MINT: () => SEND_DEX_ERROR__USER_TOKEN_ACCOUNT_WRONG_MINT,
|
|
@@ -676,6 +688,44 @@ var errors_exports$2 = /* @__PURE__ */ __exportAll({
|
|
|
676
688
|
sendDexErrorMessages: () => sendDexErrorMessages
|
|
677
689
|
});
|
|
678
690
|
//#endregion
|
|
691
|
+
//#region src/dex/generated/pdas/creatorFeeConfig.ts
|
|
692
|
+
/**
|
|
693
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
694
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
695
|
+
* to add features, then rerun Codama to update it.
|
|
696
|
+
*
|
|
697
|
+
* @see https://github.com/codama-idl/codama
|
|
698
|
+
*/
|
|
699
|
+
async function findCreatorFeeConfigPda$1(seeds) {
|
|
700
|
+
return await getProgramDerivedAddress({
|
|
701
|
+
programAddress: SEND_DEX_PROGRAM_ADDRESS,
|
|
702
|
+
seeds: [
|
|
703
|
+
getBytesEncoder().encode(new Uint8Array([
|
|
704
|
+
99,
|
|
705
|
+
114,
|
|
706
|
+
101,
|
|
707
|
+
97,
|
|
708
|
+
116,
|
|
709
|
+
111,
|
|
710
|
+
114,
|
|
711
|
+
95,
|
|
712
|
+
102,
|
|
713
|
+
101,
|
|
714
|
+
101,
|
|
715
|
+
95,
|
|
716
|
+
99,
|
|
717
|
+
111,
|
|
718
|
+
110,
|
|
719
|
+
102,
|
|
720
|
+
105,
|
|
721
|
+
103
|
|
722
|
+
])),
|
|
723
|
+
getAddressEncoder().encode(seeds.baseMint),
|
|
724
|
+
getAddressEncoder().encode(seeds.quoteMint)
|
|
725
|
+
]
|
|
726
|
+
});
|
|
727
|
+
}
|
|
728
|
+
//#endregion
|
|
679
729
|
//#region src/dex/generated/pdas/eventAuthority.ts
|
|
680
730
|
const EVENT_AUTHORITY_PDA_ADDRESS$2 = "4pTDYKRFdmxTQYFceGZkzPGd3kb8ShMA9n6XKRaPZn8t";
|
|
681
731
|
function findEventAuthorityPda$2() {
|
|
@@ -780,6 +830,7 @@ var pdas_exports$2 = /* @__PURE__ */ __exportAll({
|
|
|
780
830
|
EVENT_AUTHORITY_PDA_ADDRESS: () => EVENT_AUTHORITY_PDA_ADDRESS$2,
|
|
781
831
|
GLOBAL_CONFIG_PDA_ADDRESS: () => GLOBAL_CONFIG_PDA_ADDRESS$2,
|
|
782
832
|
WSOL_REWARD_ACCRUAL_PDA_ADDRESS: () => WSOL_REWARD_ACCRUAL_PDA_ADDRESS$1,
|
|
833
|
+
findCreatorFeeConfigPda: () => findCreatorFeeConfigPda$1,
|
|
783
834
|
findEventAuthorityPda: () => findEventAuthorityPda$2,
|
|
784
835
|
findGlobalConfigPda: () => findGlobalConfigPda$2,
|
|
785
836
|
findLpMintPda: () => findLpMintPda,
|
|
@@ -845,7 +896,7 @@ function getCreatorClaimEventDecoder$1() {
|
|
|
845
896
|
["quoteMint", getAddressDecoder()],
|
|
846
897
|
["platformConfig", getAddressDecoder()],
|
|
847
898
|
["coinCreator", getAddressDecoder()],
|
|
848
|
-
["
|
|
899
|
+
["padding0", getArrayDecoder(getU64Decoder(), { size: 4 })],
|
|
849
900
|
["claimer", getAddressDecoder()],
|
|
850
901
|
["destinationOwner", getAddressDecoder()],
|
|
851
902
|
["amount", getU64Decoder()],
|
|
@@ -988,7 +1039,7 @@ function getPoolCreateEventDecoder() {
|
|
|
988
1039
|
["quoteMint", getAddressDecoder()],
|
|
989
1040
|
["quoteDecimals", getU8Decoder()],
|
|
990
1041
|
["coinCreator", getAddressDecoder()],
|
|
991
|
-
["
|
|
1042
|
+
["padding0", getArrayDecoder(getU64Decoder(), { size: 4 })],
|
|
992
1043
|
["platformConfig", getAddressDecoder()],
|
|
993
1044
|
["baseVault", getAddressDecoder()],
|
|
994
1045
|
["quoteVault", getAddressDecoder()],
|
|
@@ -996,7 +1047,9 @@ function getPoolCreateEventDecoder() {
|
|
|
996
1047
|
["lpMinted", getU64Decoder()],
|
|
997
1048
|
["baseReserves", getU64Decoder()],
|
|
998
1049
|
["quoteReserves", getU64Decoder()],
|
|
999
|
-
["timestamp", getI64Decoder()]
|
|
1050
|
+
["timestamp", getI64Decoder()],
|
|
1051
|
+
["creatorFeeMode", getU8Decoder()],
|
|
1052
|
+
["creatorFeeBps", getU16Decoder()]
|
|
1000
1053
|
]);
|
|
1001
1054
|
}
|
|
1002
1055
|
/**
|
|
@@ -1133,9 +1186,7 @@ function getTokenCreateEventDecoder$1() {
|
|
|
1133
1186
|
["quoteMint", getAddressDecoder()],
|
|
1134
1187
|
["quoteDecimals", getU8Decoder()],
|
|
1135
1188
|
["coinCreator", getAddressDecoder()],
|
|
1136
|
-
["
|
|
1137
|
-
["creatorId", addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())],
|
|
1138
|
-
["creatorFeeConfig", getAddressDecoder()],
|
|
1189
|
+
["padding0", getArrayDecoder(getU64Decoder(), { size: 5 })],
|
|
1139
1190
|
["platformConfig", getAddressDecoder()],
|
|
1140
1191
|
["name", addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())],
|
|
1141
1192
|
["symbol", addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())],
|
|
@@ -1145,7 +1196,9 @@ function getTokenCreateEventDecoder$1() {
|
|
|
1145
1196
|
["creationFee", getU64Decoder()],
|
|
1146
1197
|
["baseReserves", getU64Decoder()],
|
|
1147
1198
|
["quoteReserves", getU64Decoder()],
|
|
1148
|
-
["timestamp", getI64Decoder()]
|
|
1199
|
+
["timestamp", getI64Decoder()],
|
|
1200
|
+
["creatorFeeMode", getU8Decoder()],
|
|
1201
|
+
["creatorFeeBps", getU16Decoder()]
|
|
1149
1202
|
]);
|
|
1150
1203
|
}
|
|
1151
1204
|
/**
|
|
@@ -1212,7 +1265,7 @@ function getTradeEventDecoder$1() {
|
|
|
1212
1265
|
["quoteMint", getAddressDecoder()],
|
|
1213
1266
|
["user", getAddressDecoder()],
|
|
1214
1267
|
["coinCreator", getAddressDecoder()],
|
|
1215
|
-
["
|
|
1268
|
+
["padding0", getArrayDecoder(getU64Decoder(), { size: 4 })],
|
|
1216
1269
|
["platformConfig", getAddressDecoder()],
|
|
1217
1270
|
["baseAmount", getU64Decoder()],
|
|
1218
1271
|
["quoteAmountGross", getU64Decoder()],
|
|
@@ -1227,7 +1280,9 @@ function getTradeEventDecoder$1() {
|
|
|
1227
1280
|
["quoteTransferFee", getU64Decoder()],
|
|
1228
1281
|
["baseReserves", getU64Decoder()],
|
|
1229
1282
|
["quoteReserves", getU64Decoder()],
|
|
1230
|
-
["timestamp", getI64Decoder()]
|
|
1283
|
+
["timestamp", getI64Decoder()],
|
|
1284
|
+
["creatorFeeMode", getU8Decoder()],
|
|
1285
|
+
["creatorFeeBps", getU16Decoder()]
|
|
1231
1286
|
]);
|
|
1232
1287
|
}
|
|
1233
1288
|
/**
|
|
@@ -2106,7 +2161,7 @@ async function getClaimCreatorFeesInstructionAsync$1(input) {
|
|
|
2106
2161
|
},
|
|
2107
2162
|
creatorFeeConfig: {
|
|
2108
2163
|
value: input.creatorFeeConfig ?? null,
|
|
2109
|
-
isWritable:
|
|
2164
|
+
isWritable: true
|
|
2110
2165
|
},
|
|
2111
2166
|
nexusGlobalConfig: {
|
|
2112
2167
|
value: null,
|
|
@@ -2157,6 +2212,10 @@ async function getClaimCreatorFeesInstructionAsync$1(input) {
|
|
|
2157
2212
|
baseMint: getAddressFromResolvedInstructionAccount("baseMint", accounts.baseMint.value),
|
|
2158
2213
|
quoteMint: getAddressFromResolvedInstructionAccount("quoteMint", accounts.quoteMint.value)
|
|
2159
2214
|
});
|
|
2215
|
+
if (!accounts.creatorFeeConfig.value) accounts.creatorFeeConfig.value = await findCreatorFeeConfigPda$1({
|
|
2216
|
+
baseMint: getAddressFromResolvedInstructionAccount("baseMint", accounts.baseMint.value),
|
|
2217
|
+
quoteMint: getAddressFromResolvedInstructionAccount("quoteMint", accounts.quoteMint.value)
|
|
2218
|
+
});
|
|
2160
2219
|
if (!accounts.nexusGlobalConfig.value) accounts.nexusGlobalConfig.value = "3bycfBeRULfXYqcg3DmiYFBjv6mMVidMuqKdFZJTGdNr";
|
|
2161
2220
|
if (!accounts.quoteVault.value) accounts.quoteVault.value = await getProgramDerivedAddress({
|
|
2162
2221
|
programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
|
|
@@ -2218,7 +2277,7 @@ function getClaimCreatorFeesInstruction$1(input) {
|
|
|
2218
2277
|
},
|
|
2219
2278
|
creatorFeeConfig: {
|
|
2220
2279
|
value: input.creatorFeeConfig ?? null,
|
|
2221
|
-
isWritable:
|
|
2280
|
+
isWritable: true
|
|
2222
2281
|
},
|
|
2223
2282
|
nexusGlobalConfig: {
|
|
2224
2283
|
value: null,
|
|
@@ -3481,6 +3540,7 @@ function sendDexProgram() {
|
|
|
3481
3540
|
pdas: {
|
|
3482
3541
|
pool: findPoolPda,
|
|
3483
3542
|
eventAuthority: findEventAuthorityPda$2,
|
|
3543
|
+
creatorFeeConfig: findCreatorFeeConfigPda$1,
|
|
3484
3544
|
rewardAccrual: findRewardAccrualPda$1,
|
|
3485
3545
|
globalConfig: findGlobalConfigPda$2,
|
|
3486
3546
|
lpMint: findLpMintPda,
|
|
@@ -4043,7 +4103,7 @@ function getBondingCurveEncoder() {
|
|
|
4043
4103
|
["quoteMint", getAddressEncoder()],
|
|
4044
4104
|
["quoteDecimals", getU8Encoder()],
|
|
4045
4105
|
["coinCreator", getAddressEncoder()],
|
|
4046
|
-
["
|
|
4106
|
+
["padding0", getArrayEncoder(getU64Encoder(), { size: 4 })],
|
|
4047
4107
|
["partner", getAddressEncoder()],
|
|
4048
4108
|
["baseVault", getAddressEncoder()],
|
|
4049
4109
|
["quoteVault", getAddressEncoder()],
|
|
@@ -4055,7 +4115,10 @@ function getBondingCurveEncoder() {
|
|
|
4055
4115
|
["protocolOwed", getU64Encoder()],
|
|
4056
4116
|
["creatorOwed", getU64Encoder()],
|
|
4057
4117
|
["platformConfig", getAddressEncoder()],
|
|
4058
|
-
["
|
|
4118
|
+
["creatorFeeMode", getU8Encoder()],
|
|
4119
|
+
["creatorFeeBps", getU16Encoder()],
|
|
4120
|
+
["dexCreatorFeeBps", getU16Encoder()],
|
|
4121
|
+
["reserved", fixEncoderSize(getBytesEncoder(), 256)]
|
|
4059
4122
|
]), (value) => ({
|
|
4060
4123
|
...value,
|
|
4061
4124
|
discriminator: BONDING_CURVE_DISCRIMINATOR
|
|
@@ -4077,7 +4140,7 @@ function getBondingCurveDecoder() {
|
|
|
4077
4140
|
["quoteMint", getAddressDecoder()],
|
|
4078
4141
|
["quoteDecimals", getU8Decoder()],
|
|
4079
4142
|
["coinCreator", getAddressDecoder()],
|
|
4080
|
-
["
|
|
4143
|
+
["padding0", getArrayDecoder(getU64Decoder(), { size: 4 })],
|
|
4081
4144
|
["partner", getAddressDecoder()],
|
|
4082
4145
|
["baseVault", getAddressDecoder()],
|
|
4083
4146
|
["quoteVault", getAddressDecoder()],
|
|
@@ -4089,7 +4152,10 @@ function getBondingCurveDecoder() {
|
|
|
4089
4152
|
["protocolOwed", getU64Decoder()],
|
|
4090
4153
|
["creatorOwed", getU64Decoder()],
|
|
4091
4154
|
["platformConfig", getAddressDecoder()],
|
|
4092
|
-
["
|
|
4155
|
+
["creatorFeeMode", getU8Decoder()],
|
|
4156
|
+
["creatorFeeBps", getU16Decoder()],
|
|
4157
|
+
["dexCreatorFeeBps", getU16Decoder()],
|
|
4158
|
+
["reserved", fixDecoderSize(getBytesDecoder(), 256)]
|
|
4093
4159
|
]);
|
|
4094
4160
|
}
|
|
4095
4161
|
/** Gets the codec for {@link BondingCurve} account data. */
|
|
@@ -4147,7 +4213,7 @@ async function fetchAllMaybeBondingCurve(rpc, addresses, config) {
|
|
|
4147
4213
|
}));
|
|
4148
4214
|
}
|
|
4149
4215
|
function getBondingCurveSize() {
|
|
4150
|
-
return
|
|
4216
|
+
return 618;
|
|
4151
4217
|
}
|
|
4152
4218
|
//#endregion
|
|
4153
4219
|
//#region src/launchpad/generated/accounts/globalConfig.ts
|
|
@@ -4495,12 +4561,16 @@ const SEND_LAUNCHPAD_ERROR__USER_TOKEN_ACCOUNT_WRONG_MINT = 7009;
|
|
|
4495
4561
|
const SEND_LAUNCHPAD_ERROR__USER_TOKEN_ACCOUNT_WRONG_AUTHORITY = 7010;
|
|
4496
4562
|
/** NothingToClaim: Nothing to claim */
|
|
4497
4563
|
const SEND_LAUNCHPAD_ERROR__NOTHING_TO_CLAIM = 7011;
|
|
4498
|
-
/**
|
|
4499
|
-
const
|
|
4564
|
+
/** Unused7012: Unused */
|
|
4565
|
+
const SEND_LAUNCHPAD_ERROR__UNUSED7012 = 7012;
|
|
4500
4566
|
/** QuoteMintPriceUnset: Quote mint has no USDC price on its nexus reward state */
|
|
4501
4567
|
const SEND_LAUNCHPAD_ERROR__QUOTE_MINT_PRICE_UNSET = 7013;
|
|
4502
4568
|
/** TransferFeeNotSettleable: Token-2022 transfer fee schedule cannot settle the exact amount */
|
|
4503
4569
|
const SEND_LAUNCHPAD_ERROR__TRANSFER_FEE_NOT_SETTLEABLE = 7014;
|
|
4570
|
+
/** CreatorFeeTooHigh: Creator fee exceeds the partner's maximum */
|
|
4571
|
+
const SEND_LAUNCHPAD_ERROR__CREATOR_FEE_TOO_HIGH = 7015;
|
|
4572
|
+
/** CreatorFeeModeNotAllowed: Creator fee mode is not allowed by the partner config */
|
|
4573
|
+
const SEND_LAUNCHPAD_ERROR__CREATOR_FEE_MODE_NOT_ALLOWED = 7016;
|
|
4504
4574
|
/** InsufficientLiquidity: Insufficient liquidity */
|
|
4505
4575
|
const SEND_LAUNCHPAD_ERROR__INSUFFICIENT_LIQUIDITY = 7100;
|
|
4506
4576
|
/** InvalidAmount: Invalid amount */
|
|
@@ -4510,6 +4580,8 @@ const sendLaunchpadErrorMessages = {
|
|
|
4510
4580
|
[SEND_LAUNCHPAD_ERROR__ARITHMETIC_OVERFLOW]: `Arithmetic overflow`,
|
|
4511
4581
|
[SEND_LAUNCHPAD_ERROR__BASE_MINT_NOT_FOUND]: `Base mint not found`,
|
|
4512
4582
|
[SEND_LAUNCHPAD_ERROR__BLOCKED_BY_HELD_SUPPLY]: `Blocked by held supply`,
|
|
4583
|
+
[SEND_LAUNCHPAD_ERROR__CREATOR_FEE_MODE_NOT_ALLOWED]: `Creator fee mode is not allowed by the partner config`,
|
|
4584
|
+
[SEND_LAUNCHPAD_ERROR__CREATOR_FEE_TOO_HIGH]: `Creator fee exceeds the partner's maximum`,
|
|
4513
4585
|
[SEND_LAUNCHPAD_ERROR__CURVE_IS_LIVE]: `Curve is live`,
|
|
4514
4586
|
[SEND_LAUNCHPAD_ERROR__INSUFFICIENT_BALANCE]: `Insufficient balance in source account`,
|
|
4515
4587
|
[SEND_LAUNCHPAD_ERROR__INSUFFICIENT_LIQUIDITY]: `Insufficient liquidity`,
|
|
@@ -4517,7 +4589,6 @@ const sendLaunchpadErrorMessages = {
|
|
|
4517
4589
|
[SEND_LAUNCHPAD_ERROR__INVALID_AUTHORITY]: `Invalid authority`,
|
|
4518
4590
|
[SEND_LAUNCHPAD_ERROR__INVALID_BASE_MINT]: `Invalid base mint`,
|
|
4519
4591
|
[SEND_LAUNCHPAD_ERROR__INVALID_COIN_CREATOR]: `Invalid coin creator`,
|
|
4520
|
-
[SEND_LAUNCHPAD_ERROR__INVALID_CREATOR_ID]: `Creator identity is not a decodable wallet address`,
|
|
4521
4592
|
[SEND_LAUNCHPAD_ERROR__INVALID_PYTH_ACCOUNT]: `Invalid Pyth price account`,
|
|
4522
4593
|
[SEND_LAUNCHPAD_ERROR__INVALID_PYTH_FEED]: `Invalid Pyth feed ID`,
|
|
4523
4594
|
[SEND_LAUNCHPAD_ERROR__INVALID_QUOTE_MINT]: `Invalid quote mint`,
|
|
@@ -4535,6 +4606,7 @@ const sendLaunchpadErrorMessages = {
|
|
|
4535
4606
|
[SEND_LAUNCHPAD_ERROR__TOKEN_CREATION_DISABLED]: `Token creation is disabled`,
|
|
4536
4607
|
[SEND_LAUNCHPAD_ERROR__TRANSFER_FEE_NOT_SETTLEABLE]: `Token-2022 transfer fee schedule cannot settle the exact amount`,
|
|
4537
4608
|
[SEND_LAUNCHPAD_ERROR__UNAUTHORIZED]: `Unauthorized`,
|
|
4609
|
+
[SEND_LAUNCHPAD_ERROR__UNUSED7012]: `Unused`,
|
|
4538
4610
|
[SEND_LAUNCHPAD_ERROR__USER_TOKEN_ACCOUNT_INVALID]: `User token account is not an initialized token account`,
|
|
4539
4611
|
[SEND_LAUNCHPAD_ERROR__USER_TOKEN_ACCOUNT_WRONG_AUTHORITY]: `User token account is not owned by the trading user`,
|
|
4540
4612
|
[SEND_LAUNCHPAD_ERROR__USER_TOKEN_ACCOUNT_WRONG_MINT]: `User token account mint does not match the trade`,
|
|
@@ -4553,6 +4625,8 @@ var errors_exports$1 = /* @__PURE__ */ __exportAll({
|
|
|
4553
4625
|
SEND_LAUNCHPAD_ERROR__ARITHMETIC_OVERFLOW: () => SEND_LAUNCHPAD_ERROR__ARITHMETIC_OVERFLOW,
|
|
4554
4626
|
SEND_LAUNCHPAD_ERROR__BASE_MINT_NOT_FOUND: () => SEND_LAUNCHPAD_ERROR__BASE_MINT_NOT_FOUND,
|
|
4555
4627
|
SEND_LAUNCHPAD_ERROR__BLOCKED_BY_HELD_SUPPLY: () => SEND_LAUNCHPAD_ERROR__BLOCKED_BY_HELD_SUPPLY,
|
|
4628
|
+
SEND_LAUNCHPAD_ERROR__CREATOR_FEE_MODE_NOT_ALLOWED: () => SEND_LAUNCHPAD_ERROR__CREATOR_FEE_MODE_NOT_ALLOWED,
|
|
4629
|
+
SEND_LAUNCHPAD_ERROR__CREATOR_FEE_TOO_HIGH: () => SEND_LAUNCHPAD_ERROR__CREATOR_FEE_TOO_HIGH,
|
|
4556
4630
|
SEND_LAUNCHPAD_ERROR__CURVE_IS_LIVE: () => SEND_LAUNCHPAD_ERROR__CURVE_IS_LIVE,
|
|
4557
4631
|
SEND_LAUNCHPAD_ERROR__INSUFFICIENT_BALANCE: () => SEND_LAUNCHPAD_ERROR__INSUFFICIENT_BALANCE,
|
|
4558
4632
|
SEND_LAUNCHPAD_ERROR__INSUFFICIENT_LIQUIDITY: () => SEND_LAUNCHPAD_ERROR__INSUFFICIENT_LIQUIDITY,
|
|
@@ -4560,7 +4634,6 @@ var errors_exports$1 = /* @__PURE__ */ __exportAll({
|
|
|
4560
4634
|
SEND_LAUNCHPAD_ERROR__INVALID_AUTHORITY: () => SEND_LAUNCHPAD_ERROR__INVALID_AUTHORITY,
|
|
4561
4635
|
SEND_LAUNCHPAD_ERROR__INVALID_BASE_MINT: () => SEND_LAUNCHPAD_ERROR__INVALID_BASE_MINT,
|
|
4562
4636
|
SEND_LAUNCHPAD_ERROR__INVALID_COIN_CREATOR: () => SEND_LAUNCHPAD_ERROR__INVALID_COIN_CREATOR,
|
|
4563
|
-
SEND_LAUNCHPAD_ERROR__INVALID_CREATOR_ID: () => SEND_LAUNCHPAD_ERROR__INVALID_CREATOR_ID,
|
|
4564
4637
|
SEND_LAUNCHPAD_ERROR__INVALID_PYTH_ACCOUNT: () => SEND_LAUNCHPAD_ERROR__INVALID_PYTH_ACCOUNT,
|
|
4565
4638
|
SEND_LAUNCHPAD_ERROR__INVALID_PYTH_FEED: () => SEND_LAUNCHPAD_ERROR__INVALID_PYTH_FEED,
|
|
4566
4639
|
SEND_LAUNCHPAD_ERROR__INVALID_QUOTE_MINT: () => SEND_LAUNCHPAD_ERROR__INVALID_QUOTE_MINT,
|
|
@@ -4578,6 +4651,7 @@ var errors_exports$1 = /* @__PURE__ */ __exportAll({
|
|
|
4578
4651
|
SEND_LAUNCHPAD_ERROR__TOKEN_CREATION_DISABLED: () => SEND_LAUNCHPAD_ERROR__TOKEN_CREATION_DISABLED,
|
|
4579
4652
|
SEND_LAUNCHPAD_ERROR__TRANSFER_FEE_NOT_SETTLEABLE: () => SEND_LAUNCHPAD_ERROR__TRANSFER_FEE_NOT_SETTLEABLE,
|
|
4580
4653
|
SEND_LAUNCHPAD_ERROR__UNAUTHORIZED: () => SEND_LAUNCHPAD_ERROR__UNAUTHORIZED,
|
|
4654
|
+
SEND_LAUNCHPAD_ERROR__UNUSED7012: () => SEND_LAUNCHPAD_ERROR__UNUSED7012,
|
|
4581
4655
|
SEND_LAUNCHPAD_ERROR__USER_TOKEN_ACCOUNT_INVALID: () => SEND_LAUNCHPAD_ERROR__USER_TOKEN_ACCOUNT_INVALID,
|
|
4582
4656
|
SEND_LAUNCHPAD_ERROR__USER_TOKEN_ACCOUNT_WRONG_AUTHORITY: () => SEND_LAUNCHPAD_ERROR__USER_TOKEN_ACCOUNT_WRONG_AUTHORITY,
|
|
4583
4657
|
SEND_LAUNCHPAD_ERROR__USER_TOKEN_ACCOUNT_WRONG_MINT: () => SEND_LAUNCHPAD_ERROR__USER_TOKEN_ACCOUNT_WRONG_MINT,
|
|
@@ -4620,6 +4694,44 @@ async function findBondingCurvePda(seeds) {
|
|
|
4620
4694
|
});
|
|
4621
4695
|
}
|
|
4622
4696
|
//#endregion
|
|
4697
|
+
//#region src/launchpad/generated/pdas/creatorFeeConfig.ts
|
|
4698
|
+
/**
|
|
4699
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
4700
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4701
|
+
* to add features, then rerun Codama to update it.
|
|
4702
|
+
*
|
|
4703
|
+
* @see https://github.com/codama-idl/codama
|
|
4704
|
+
*/
|
|
4705
|
+
async function findCreatorFeeConfigPda(seeds) {
|
|
4706
|
+
return await getProgramDerivedAddress({
|
|
4707
|
+
programAddress: SEND_LAUNCHPAD_PROGRAM_ADDRESS,
|
|
4708
|
+
seeds: [
|
|
4709
|
+
getBytesEncoder().encode(new Uint8Array([
|
|
4710
|
+
99,
|
|
4711
|
+
114,
|
|
4712
|
+
101,
|
|
4713
|
+
97,
|
|
4714
|
+
116,
|
|
4715
|
+
111,
|
|
4716
|
+
114,
|
|
4717
|
+
95,
|
|
4718
|
+
102,
|
|
4719
|
+
101,
|
|
4720
|
+
101,
|
|
4721
|
+
95,
|
|
4722
|
+
99,
|
|
4723
|
+
111,
|
|
4724
|
+
110,
|
|
4725
|
+
102,
|
|
4726
|
+
105,
|
|
4727
|
+
103
|
|
4728
|
+
])),
|
|
4729
|
+
getAddressEncoder().encode(seeds.baseMint),
|
|
4730
|
+
getAddressEncoder().encode(seeds.quoteMint)
|
|
4731
|
+
]
|
|
4732
|
+
});
|
|
4733
|
+
}
|
|
4734
|
+
//#endregion
|
|
4623
4735
|
//#region src/launchpad/generated/pdas/eventAuthority.ts
|
|
4624
4736
|
const EVENT_AUTHORITY_PDA_ADDRESS$1 = "FJVebqCthxH6JM8vvkJb7yRYA7Emsib1C1vu4ZePSP3T";
|
|
4625
4737
|
function findEventAuthorityPda$1() {
|
|
@@ -4681,6 +4793,7 @@ var pdas_exports$1 = /* @__PURE__ */ __exportAll({
|
|
|
4681
4793
|
MIGRATION_AUTHORITY_PDA_ADDRESS: () => MIGRATION_AUTHORITY_PDA_ADDRESS,
|
|
4682
4794
|
WSOL_REWARD_ACCRUAL_PDA_ADDRESS: () => WSOL_REWARD_ACCRUAL_PDA_ADDRESS,
|
|
4683
4795
|
findBondingCurvePda: () => findBondingCurvePda,
|
|
4796
|
+
findCreatorFeeConfigPda: () => findCreatorFeeConfigPda,
|
|
4684
4797
|
findEventAuthorityPda: () => findEventAuthorityPda$1,
|
|
4685
4798
|
findGlobalConfigPda: () => findGlobalConfigPda$1,
|
|
4686
4799
|
findMigrationAuthorityPda: () => findMigrationAuthorityPda,
|
|
@@ -4688,83 +4801,6 @@ var pdas_exports$1 = /* @__PURE__ */ __exportAll({
|
|
|
4688
4801
|
findWsolRewardAccrualPda: () => findWsolRewardAccrualPda
|
|
4689
4802
|
});
|
|
4690
4803
|
//#endregion
|
|
4691
|
-
//#region src/utils/creator-hash.ts
|
|
4692
|
-
const MAX_CREATOR_PLATFORM_LEN = 32;
|
|
4693
|
-
/** Returns the SHA-256 of `creatorPlatform` and `creatorId`, each prefixed with its byte length as a
|
|
4694
|
-
* little-endian u32. Throws `RangeError` if `creatorPlatform` is more than 32 bytes. */
|
|
4695
|
-
async function creatorHashFromId(creatorPlatform, creatorId) {
|
|
4696
|
-
const encoder = new TextEncoder();
|
|
4697
|
-
const platformBuf = encoder.encode(creatorPlatform);
|
|
4698
|
-
const idBuf = encoder.encode(creatorId);
|
|
4699
|
-
if (platformBuf.length > MAX_CREATOR_PLATFORM_LEN) throw new RangeError(`creatorPlatform exceeds ${MAX_CREATOR_PLATFORM_LEN} bytes (got ${platformBuf.length})`);
|
|
4700
|
-
const platformLength = /* @__PURE__ */ new Uint8Array(4);
|
|
4701
|
-
new DataView(platformLength.buffer).setUint32(0, platformBuf.length, true);
|
|
4702
|
-
const idLength = /* @__PURE__ */ new Uint8Array(4);
|
|
4703
|
-
new DataView(idLength.buffer).setUint32(0, idBuf.length, true);
|
|
4704
|
-
const buf = new Uint8Array(4 + platformBuf.length + 4 + idBuf.length);
|
|
4705
|
-
buf.set(platformLength, 0);
|
|
4706
|
-
buf.set(platformBuf, 4);
|
|
4707
|
-
buf.set(idLength, 4 + platformBuf.length);
|
|
4708
|
-
buf.set(idBuf, 4 + platformBuf.length + 4);
|
|
4709
|
-
const hash = new Uint8Array(await crypto.subtle.digest("SHA-256", buf));
|
|
4710
|
-
return getAddressDecoder().decode(hash);
|
|
4711
|
-
}
|
|
4712
|
-
/** Pads `text` with NUL bytes to `length` bytes, the form of `CreatorFeeConfig.platformId`.
|
|
4713
|
-
* Throws `RangeError` if `text` is longer. */
|
|
4714
|
-
function encodeCreatorId(text, length) {
|
|
4715
|
-
const bytes = new TextEncoder().encode(text);
|
|
4716
|
-
if (bytes.length > length) throw new RangeError(`text exceeds ${length} bytes (got ${bytes.length})`);
|
|
4717
|
-
const out = new Uint8Array(length);
|
|
4718
|
-
out.set(bytes, 0);
|
|
4719
|
-
return out;
|
|
4720
|
-
}
|
|
4721
|
-
/** Removes the trailing NUL bytes and decodes the rest as UTF-8. Pass the result, not the padded
|
|
4722
|
-
* bytes, to {@link creatorHashFromId}. */
|
|
4723
|
-
function decodeCreatorId(bytes) {
|
|
4724
|
-
let end = bytes.length;
|
|
4725
|
-
while (end > 0 && bytes[end - 1] === 0) end -= 1;
|
|
4726
|
-
return new TextDecoder().decode(bytes.slice(0, end));
|
|
4727
|
-
}
|
|
4728
|
-
//#endregion
|
|
4729
|
-
//#region src/nexus/generated/pdas/creatorFeeConfig.ts
|
|
4730
|
-
/**
|
|
4731
|
-
* This code was AUTOGENERATED using the Codama library.
|
|
4732
|
-
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4733
|
-
* to add features, then rerun Codama to update it.
|
|
4734
|
-
*
|
|
4735
|
-
* @see https://github.com/codama-idl/codama
|
|
4736
|
-
*/
|
|
4737
|
-
async function findCreatorFeeConfigPda(seeds) {
|
|
4738
|
-
return await getProgramDerivedAddress({
|
|
4739
|
-
programAddress: SEND_NEXUS_PROGRAM_ADDRESS,
|
|
4740
|
-
seeds: [
|
|
4741
|
-
getBytesEncoder().encode(new Uint8Array([
|
|
4742
|
-
99,
|
|
4743
|
-
114,
|
|
4744
|
-
101,
|
|
4745
|
-
97,
|
|
4746
|
-
116,
|
|
4747
|
-
111,
|
|
4748
|
-
114,
|
|
4749
|
-
95,
|
|
4750
|
-
102,
|
|
4751
|
-
101,
|
|
4752
|
-
101,
|
|
4753
|
-
95,
|
|
4754
|
-
98,
|
|
4755
|
-
97,
|
|
4756
|
-
108,
|
|
4757
|
-
97,
|
|
4758
|
-
110,
|
|
4759
|
-
99,
|
|
4760
|
-
101
|
|
4761
|
-
])),
|
|
4762
|
-
getAddressEncoder().encode(seeds.creatorHash),
|
|
4763
|
-
getAddressEncoder().encode(seeds.quoteMint)
|
|
4764
|
-
]
|
|
4765
|
-
});
|
|
4766
|
-
}
|
|
4767
|
-
//#endregion
|
|
4768
4804
|
//#region src/launchpad/generated/instructions/createToken.ts
|
|
4769
4805
|
/**
|
|
4770
4806
|
* This code was AUTOGENERATED using the Codama library.
|
|
@@ -4790,12 +4826,12 @@ function getCreateTokenInstructionDataEncoder() {
|
|
|
4790
4826
|
return transformEncoder(getStructEncoder([
|
|
4791
4827
|
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
4792
4828
|
["platformConfig", getAddressEncoder()],
|
|
4793
|
-
["creatorPlatform", addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())],
|
|
4794
|
-
["creatorId", addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())],
|
|
4795
|
-
["creatorHash", getAddressEncoder()],
|
|
4796
4829
|
["name", addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())],
|
|
4797
4830
|
["symbol", addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())],
|
|
4798
|
-
["uri", addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())]
|
|
4831
|
+
["uri", addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())],
|
|
4832
|
+
["creatorFeeMode", getU8Encoder()],
|
|
4833
|
+
["creatorFeeBps", getU16Encoder()],
|
|
4834
|
+
["dexCreatorFeeBps", getU16Encoder()]
|
|
4799
4835
|
]), (value) => ({
|
|
4800
4836
|
...value,
|
|
4801
4837
|
discriminator: CREATE_TOKEN_DISCRIMINATOR
|
|
@@ -4805,12 +4841,12 @@ function getCreateTokenInstructionDataDecoder() {
|
|
|
4805
4841
|
return getStructDecoder([
|
|
4806
4842
|
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
4807
4843
|
["platformConfig", getAddressDecoder()],
|
|
4808
|
-
["creatorPlatform", addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())],
|
|
4809
|
-
["creatorId", addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())],
|
|
4810
|
-
["creatorHash", getAddressDecoder()],
|
|
4811
4844
|
["name", addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())],
|
|
4812
4845
|
["symbol", addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())],
|
|
4813
|
-
["uri", addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())]
|
|
4846
|
+
["uri", addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())],
|
|
4847
|
+
["creatorFeeMode", getU8Decoder()],
|
|
4848
|
+
["creatorFeeBps", getU16Decoder()],
|
|
4849
|
+
["dexCreatorFeeBps", getU16Decoder()]
|
|
4814
4850
|
]);
|
|
4815
4851
|
}
|
|
4816
4852
|
function getCreateTokenInstructionDataCodec() {
|
|
@@ -4954,33 +4990,9 @@ async function getCreateTokenInstructionAsync(input) {
|
|
|
4954
4990
|
getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("quoteMint", accounts.quoteMint.value))
|
|
4955
4991
|
]
|
|
4956
4992
|
});
|
|
4957
|
-
if (!accounts.creatorFeeConfig.value) accounts.creatorFeeConfig.value = await
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
getBytesEncoder().encode(new Uint8Array([
|
|
4961
|
-
99,
|
|
4962
|
-
114,
|
|
4963
|
-
101,
|
|
4964
|
-
97,
|
|
4965
|
-
116,
|
|
4966
|
-
111,
|
|
4967
|
-
114,
|
|
4968
|
-
95,
|
|
4969
|
-
102,
|
|
4970
|
-
101,
|
|
4971
|
-
101,
|
|
4972
|
-
95,
|
|
4973
|
-
98,
|
|
4974
|
-
97,
|
|
4975
|
-
108,
|
|
4976
|
-
97,
|
|
4977
|
-
110,
|
|
4978
|
-
99,
|
|
4979
|
-
101
|
|
4980
|
-
])),
|
|
4981
|
-
getAddressEncoder().encode(getNonNullResolvedInstructionInput("creatorHash", args.creatorHash)),
|
|
4982
|
-
getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("quoteMint", accounts.quoteMint.value))
|
|
4983
|
-
]
|
|
4993
|
+
if (!accounts.creatorFeeConfig.value) accounts.creatorFeeConfig.value = await findCreatorFeeConfigPda({
|
|
4994
|
+
baseMint: getAddressFromResolvedInstructionAccount("baseMint", accounts.baseMint.value),
|
|
4995
|
+
quoteMint: getAddressFromResolvedInstructionAccount("quoteMint", accounts.quoteMint.value)
|
|
4984
4996
|
});
|
|
4985
4997
|
if (!accounts.nexusProgram.value) accounts.nexusProgram.value = "7rrCurqdWFesbzwtYPo95fM8waTtVXgXwCom45x1sfNX";
|
|
4986
4998
|
if (!accounts.nexusGlobalConfig.value) accounts.nexusGlobalConfig.value = "3bycfBeRULfXYqcg3DmiYFBjv6mMVidMuqKdFZJTGdNr";
|
|
@@ -6801,33 +6813,25 @@ var create_exports = /* @__PURE__ */ __exportAll({
|
|
|
6801
6813
|
buildCreateTokenInstruction: () => buildCreateTokenInstruction
|
|
6802
6814
|
});
|
|
6803
6815
|
async function buildCreateTokenInstruction(params) {
|
|
6804
|
-
return buildCreateTokenInstructionWithHash(params, await creatorHashFromId(params.creatorPlatform, params.creatorId));
|
|
6805
|
-
}
|
|
6806
|
-
async function buildCreateTokenInstructionWithHash(params, creatorHash) {
|
|
6807
|
-
const [creatorFeeConfig] = await findCreatorFeeConfigPda({
|
|
6808
|
-
creatorHash,
|
|
6809
|
-
quoteMint: params.quoteMint
|
|
6810
|
-
});
|
|
6811
6816
|
return getCreateTokenInstructionAsync({
|
|
6812
6817
|
user: params.user,
|
|
6813
6818
|
payer: params.payer ?? params.user,
|
|
6814
6819
|
coinCreator: params.coinCreator,
|
|
6815
6820
|
baseMint: params.baseMint,
|
|
6816
6821
|
quoteMint: params.quoteMint,
|
|
6817
|
-
creatorFeeConfig,
|
|
6818
6822
|
partner: params.partner,
|
|
6819
6823
|
platformConfig: params.platformConfig,
|
|
6820
6824
|
quoteTokenProgram: params.quoteTokenProgram,
|
|
6821
|
-
creatorPlatform: params.creatorPlatform,
|
|
6822
|
-
creatorId: params.creatorId,
|
|
6823
|
-
creatorHash,
|
|
6824
6825
|
name: params.name,
|
|
6825
6826
|
symbol: params.symbol,
|
|
6826
|
-
uri: params.uri
|
|
6827
|
+
uri: params.uri,
|
|
6828
|
+
creatorFeeMode: params.creatorFeeMode,
|
|
6829
|
+
creatorFeeBps: params.creatorFeeBps,
|
|
6830
|
+
dexCreatorFeeBps: params.dexCreatorFeeBps
|
|
6827
6831
|
});
|
|
6828
6832
|
}
|
|
6829
6833
|
async function buildCreateAndBuyInstructions(params) {
|
|
6830
|
-
const instructions = [await
|
|
6834
|
+
const instructions = [await buildCreateTokenInstruction(params)];
|
|
6831
6835
|
let quote;
|
|
6832
6836
|
if (params.buyQuoteAmount > 0n) {
|
|
6833
6837
|
const buyResult = await buyExactIn({
|
|
@@ -6911,7 +6915,7 @@ function getCompleteEventDecoder() {
|
|
|
6911
6915
|
["baseMint", getAddressDecoder()],
|
|
6912
6916
|
["quoteMint", getAddressDecoder()],
|
|
6913
6917
|
["coinCreator", getAddressDecoder()],
|
|
6914
|
-
["
|
|
6918
|
+
["padding0", getArrayDecoder(getU64Decoder(), { size: 4 })],
|
|
6915
6919
|
["platformConfig", getAddressDecoder()],
|
|
6916
6920
|
["curvePartner", getAddressDecoder()],
|
|
6917
6921
|
["isPartner", getBooleanDecoder()],
|
|
@@ -6983,7 +6987,7 @@ function getCreatorClaimEventDecoder() {
|
|
|
6983
6987
|
["quoteMint", getAddressDecoder()],
|
|
6984
6988
|
["platformConfig", getAddressDecoder()],
|
|
6985
6989
|
["coinCreator", getAddressDecoder()],
|
|
6986
|
-
["
|
|
6990
|
+
["padding0", getArrayDecoder(getU64Decoder(), { size: 4 })],
|
|
6987
6991
|
["claimer", getAddressDecoder()],
|
|
6988
6992
|
["destinationOwner", getAddressDecoder()],
|
|
6989
6993
|
["amount", getU64Decoder()],
|
|
@@ -7055,7 +7059,7 @@ function getMigrateEventDecoder() {
|
|
|
7055
7059
|
["quoteMint", getAddressDecoder()],
|
|
7056
7060
|
["pool", getAddressDecoder()],
|
|
7057
7061
|
["coinCreator", getAddressDecoder()],
|
|
7058
|
-
["
|
|
7062
|
+
["padding0", getArrayDecoder(getU64Decoder(), { size: 4 })],
|
|
7059
7063
|
["platformConfig", getAddressDecoder()],
|
|
7060
7064
|
["baseAmount", getU64Decoder()],
|
|
7061
7065
|
["quoteAmount", getU64Decoder()],
|
|
@@ -7268,9 +7272,7 @@ function getTokenCreateEventDecoder() {
|
|
|
7268
7272
|
["quoteMint", getAddressDecoder()],
|
|
7269
7273
|
["quoteDecimals", getU8Decoder()],
|
|
7270
7274
|
["coinCreator", getAddressDecoder()],
|
|
7271
|
-
["
|
|
7272
|
-
["creatorId", addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())],
|
|
7273
|
-
["creatorFeeConfig", getAddressDecoder()],
|
|
7275
|
+
["padding0", getArrayDecoder(getU64Decoder(), { size: 5 })],
|
|
7274
7276
|
["platformConfig", getAddressDecoder()],
|
|
7275
7277
|
["name", addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())],
|
|
7276
7278
|
["symbol", addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())],
|
|
@@ -7282,7 +7284,10 @@ function getTokenCreateEventDecoder() {
|
|
|
7282
7284
|
["virtualQuoteReserves", getU64Decoder()],
|
|
7283
7285
|
["realBaseReserves", getU64Decoder()],
|
|
7284
7286
|
["realQuoteReserves", getU64Decoder()],
|
|
7285
|
-
["timestamp", getI64Decoder()]
|
|
7287
|
+
["timestamp", getI64Decoder()],
|
|
7288
|
+
["creatorFeeMode", getU8Decoder()],
|
|
7289
|
+
["creatorFeeBps", getU16Decoder()],
|
|
7290
|
+
["dexCreatorFeeBps", getU16Decoder()]
|
|
7286
7291
|
]);
|
|
7287
7292
|
}
|
|
7288
7293
|
/**
|
|
@@ -7349,7 +7354,7 @@ function getTradeEventDecoder() {
|
|
|
7349
7354
|
["quoteMint", getAddressDecoder()],
|
|
7350
7355
|
["user", getAddressDecoder()],
|
|
7351
7356
|
["coinCreator", getAddressDecoder()],
|
|
7352
|
-
["
|
|
7357
|
+
["padding0", getArrayDecoder(getU64Decoder(), { size: 4 })],
|
|
7353
7358
|
["platformConfig", getAddressDecoder()],
|
|
7354
7359
|
["baseAmount", getU64Decoder()],
|
|
7355
7360
|
["quoteAmountGross", getU64Decoder()],
|
|
@@ -7365,7 +7370,9 @@ function getTradeEventDecoder() {
|
|
|
7365
7370
|
["virtualQuoteReserves", getU64Decoder()],
|
|
7366
7371
|
["realBaseReserves", getU64Decoder()],
|
|
7367
7372
|
["realQuoteReserves", getU64Decoder()],
|
|
7368
|
-
["timestamp", getI64Decoder()]
|
|
7373
|
+
["timestamp", getI64Decoder()],
|
|
7374
|
+
["creatorFeeMode", getU8Decoder()],
|
|
7375
|
+
["creatorFeeBps", getU16Decoder()]
|
|
7369
7376
|
]);
|
|
7370
7377
|
}
|
|
7371
7378
|
/**
|
|
@@ -7572,7 +7579,7 @@ async function getClaimCreatorFeesInstructionAsync(input) {
|
|
|
7572
7579
|
},
|
|
7573
7580
|
creatorFeeConfig: {
|
|
7574
7581
|
value: input.creatorFeeConfig ?? null,
|
|
7575
|
-
isWritable:
|
|
7582
|
+
isWritable: true
|
|
7576
7583
|
},
|
|
7577
7584
|
nexusGlobalConfig: {
|
|
7578
7585
|
value: null,
|
|
@@ -7623,6 +7630,10 @@ async function getClaimCreatorFeesInstructionAsync(input) {
|
|
|
7623
7630
|
baseMint: getAddressFromResolvedInstructionAccount("baseMint", accounts.baseMint.value),
|
|
7624
7631
|
quoteMint: getAddressFromResolvedInstructionAccount("quoteMint", accounts.quoteMint.value)
|
|
7625
7632
|
});
|
|
7633
|
+
if (!accounts.creatorFeeConfig.value) accounts.creatorFeeConfig.value = await findCreatorFeeConfigPda({
|
|
7634
|
+
baseMint: getAddressFromResolvedInstructionAccount("baseMint", accounts.baseMint.value),
|
|
7635
|
+
quoteMint: getAddressFromResolvedInstructionAccount("quoteMint", accounts.quoteMint.value)
|
|
7636
|
+
});
|
|
7626
7637
|
if (!accounts.nexusGlobalConfig.value) accounts.nexusGlobalConfig.value = "3bycfBeRULfXYqcg3DmiYFBjv6mMVidMuqKdFZJTGdNr";
|
|
7627
7638
|
if (!accounts.quoteVault.value) accounts.quoteVault.value = await getProgramDerivedAddress({
|
|
7628
7639
|
programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
|
|
@@ -7684,7 +7695,7 @@ function getClaimCreatorFeesInstruction(input) {
|
|
|
7684
7695
|
},
|
|
7685
7696
|
creatorFeeConfig: {
|
|
7686
7697
|
value: input.creatorFeeConfig ?? null,
|
|
7687
|
-
isWritable:
|
|
7698
|
+
isWritable: true
|
|
7688
7699
|
},
|
|
7689
7700
|
nexusGlobalConfig: {
|
|
7690
7701
|
value: null,
|
|
@@ -8166,7 +8177,7 @@ async function getMigrateInstructionAsync(input) {
|
|
|
8166
8177
|
},
|
|
8167
8178
|
creatorFeeConfig: {
|
|
8168
8179
|
value: input.creatorFeeConfig ?? null,
|
|
8169
|
-
isWritable:
|
|
8180
|
+
isWritable: true
|
|
8170
8181
|
},
|
|
8171
8182
|
baseTokenProgram: {
|
|
8172
8183
|
value: null,
|
|
@@ -8191,6 +8202,10 @@ async function getMigrateInstructionAsync(input) {
|
|
|
8191
8202
|
program: {
|
|
8192
8203
|
value: null,
|
|
8193
8204
|
isWritable: false
|
|
8205
|
+
},
|
|
8206
|
+
dexCreatorFeeConfig: {
|
|
8207
|
+
value: input.dexCreatorFeeConfig ?? null,
|
|
8208
|
+
isWritable: true
|
|
8194
8209
|
}
|
|
8195
8210
|
};
|
|
8196
8211
|
if (!accounts.bondingCurve.value) accounts.bondingCurve.value = await findBondingCurvePda({
|
|
@@ -8246,11 +8261,42 @@ async function getMigrateInstructionAsync(input) {
|
|
|
8246
8261
|
});
|
|
8247
8262
|
if (!accounts.dexEventAuthority.value) accounts.dexEventAuthority.value = "4pTDYKRFdmxTQYFceGZkzPGd3kb8ShMA9n6XKRaPZn8t";
|
|
8248
8263
|
if (!accounts.nexusProgram.value) accounts.nexusProgram.value = "7rrCurqdWFesbzwtYPo95fM8waTtVXgXwCom45x1sfNX";
|
|
8264
|
+
if (!accounts.creatorFeeConfig.value) accounts.creatorFeeConfig.value = await findCreatorFeeConfigPda({
|
|
8265
|
+
baseMint: getAddressFromResolvedInstructionAccount("baseMint", accounts.baseMint.value),
|
|
8266
|
+
quoteMint: getAddressFromResolvedInstructionAccount("quoteMint", accounts.quoteMint.value)
|
|
8267
|
+
});
|
|
8249
8268
|
if (!accounts.baseTokenProgram.value) accounts.baseTokenProgram.value = "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb";
|
|
8250
8269
|
if (!accounts.associatedTokenProgram.value) accounts.associatedTokenProgram.value = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
|
|
8251
8270
|
if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
8252
8271
|
if (!accounts.eventAuthority.value) accounts.eventAuthority.value = EVENT_AUTHORITY_PDA_ADDRESS$1;
|
|
8253
8272
|
if (!accounts.program.value) accounts.program.value = "5R1uFyEE4oxqkm7hJDqHq6gXaLVF9dxeF3LF4yz1sfLP";
|
|
8273
|
+
if (!accounts.dexCreatorFeeConfig.value) accounts.dexCreatorFeeConfig.value = await getProgramDerivedAddress({
|
|
8274
|
+
programAddress: "84qj5FPZZdXkQy8mfowyg6RBZ3XKuTds6XS4ZYT1sfDX",
|
|
8275
|
+
seeds: [
|
|
8276
|
+
getBytesEncoder().encode(new Uint8Array([
|
|
8277
|
+
99,
|
|
8278
|
+
114,
|
|
8279
|
+
101,
|
|
8280
|
+
97,
|
|
8281
|
+
116,
|
|
8282
|
+
111,
|
|
8283
|
+
114,
|
|
8284
|
+
95,
|
|
8285
|
+
102,
|
|
8286
|
+
101,
|
|
8287
|
+
101,
|
|
8288
|
+
95,
|
|
8289
|
+
99,
|
|
8290
|
+
111,
|
|
8291
|
+
110,
|
|
8292
|
+
102,
|
|
8293
|
+
105,
|
|
8294
|
+
103
|
|
8295
|
+
])),
|
|
8296
|
+
getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("baseMint", accounts.baseMint.value)),
|
|
8297
|
+
getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("quoteMint", accounts.quoteMint.value))
|
|
8298
|
+
]
|
|
8299
|
+
});
|
|
8254
8300
|
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
8255
8301
|
return Object.freeze({
|
|
8256
8302
|
accounts: [
|
|
@@ -8275,7 +8321,8 @@ async function getMigrateInstructionAsync(input) {
|
|
|
8275
8321
|
getAccountMeta("associatedTokenProgram", accounts.associatedTokenProgram),
|
|
8276
8322
|
getAccountMeta("systemProgram", accounts.systemProgram),
|
|
8277
8323
|
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
8278
|
-
getAccountMeta("program", accounts.program)
|
|
8324
|
+
getAccountMeta("program", accounts.program),
|
|
8325
|
+
getAccountMeta("dexCreatorFeeConfig", accounts.dexCreatorFeeConfig)
|
|
8279
8326
|
],
|
|
8280
8327
|
data: getMigrateInstructionDataEncoder().encode({}),
|
|
8281
8328
|
programAddress
|
|
@@ -8346,7 +8393,7 @@ function getMigrateInstruction(input) {
|
|
|
8346
8393
|
},
|
|
8347
8394
|
creatorFeeConfig: {
|
|
8348
8395
|
value: input.creatorFeeConfig ?? null,
|
|
8349
|
-
isWritable:
|
|
8396
|
+
isWritable: true
|
|
8350
8397
|
},
|
|
8351
8398
|
baseTokenProgram: {
|
|
8352
8399
|
value: null,
|
|
@@ -8371,6 +8418,10 @@ function getMigrateInstruction(input) {
|
|
|
8371
8418
|
program: {
|
|
8372
8419
|
value: null,
|
|
8373
8420
|
isWritable: false
|
|
8421
|
+
},
|
|
8422
|
+
dexCreatorFeeConfig: {
|
|
8423
|
+
value: input.dexCreatorFeeConfig ?? null,
|
|
8424
|
+
isWritable: true
|
|
8374
8425
|
}
|
|
8375
8426
|
};
|
|
8376
8427
|
if (!accounts.dexProgram.value) accounts.dexProgram.value = "84qj5FPZZdXkQy8mfowyg6RBZ3XKuTds6XS4ZYT1sfDX";
|
|
@@ -8406,7 +8457,8 @@ function getMigrateInstruction(input) {
|
|
|
8406
8457
|
getAccountMeta("associatedTokenProgram", accounts.associatedTokenProgram),
|
|
8407
8458
|
getAccountMeta("systemProgram", accounts.systemProgram),
|
|
8408
8459
|
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
8409
|
-
getAccountMeta("program", accounts.program)
|
|
8460
|
+
getAccountMeta("program", accounts.program),
|
|
8461
|
+
getAccountMeta("dexCreatorFeeConfig", accounts.dexCreatorFeeConfig)
|
|
8410
8462
|
],
|
|
8411
8463
|
data: getMigrateInstructionDataEncoder().encode({}),
|
|
8412
8464
|
programAddress
|
|
@@ -8419,9 +8471,9 @@ function parseMigrateInstruction(instruction) {
|
|
|
8419
8471
|
error.name = "InstructionDiscriminatorMismatchError";
|
|
8420
8472
|
throw error;
|
|
8421
8473
|
}
|
|
8422
|
-
if (instruction.accounts.length <
|
|
8474
|
+
if (instruction.accounts.length < 23) throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
8423
8475
|
actualAccountMetas: instruction.accounts.length,
|
|
8424
|
-
expectedAccountMetas:
|
|
8476
|
+
expectedAccountMetas: 23
|
|
8425
8477
|
});
|
|
8426
8478
|
let accountIndex = 0;
|
|
8427
8479
|
const getNextAccount = () => {
|
|
@@ -8453,7 +8505,8 @@ function parseMigrateInstruction(instruction) {
|
|
|
8453
8505
|
associatedTokenProgram: getNextAccount(),
|
|
8454
8506
|
systemProgram: getNextAccount(),
|
|
8455
8507
|
eventAuthority: getNextAccount(),
|
|
8456
|
-
program: getNextAccount()
|
|
8508
|
+
program: getNextAccount(),
|
|
8509
|
+
dexCreatorFeeConfig: getNextAccount()
|
|
8457
8510
|
},
|
|
8458
8511
|
data: getMigrateInstructionDataDecoder().decode(instruction.data)
|
|
8459
8512
|
};
|
|
@@ -8692,6 +8745,7 @@ function sendLaunchpadProgram() {
|
|
|
8692
8745
|
pdas: {
|
|
8693
8746
|
bondingCurve: findBondingCurvePda,
|
|
8694
8747
|
eventAuthority: findEventAuthorityPda$1,
|
|
8748
|
+
creatorFeeConfig: findCreatorFeeConfigPda,
|
|
8695
8749
|
rewardAccrual: findRewardAccrualPda,
|
|
8696
8750
|
globalConfig: findGlobalConfigPda$1,
|
|
8697
8751
|
wsolRewardAccrual: findWsolRewardAccrualPda,
|
|
@@ -8725,13 +8779,20 @@ async function findAssociatedTokenPda(wallet, mint, tokenProgram = TOKEN_PROGRAM
|
|
|
8725
8779
|
var migrate_exports = /* @__PURE__ */ __exportAll({ buildMigrateInstruction: () => buildMigrateInstruction });
|
|
8726
8780
|
async function buildMigrateInstruction(params) {
|
|
8727
8781
|
const { quoteTokenProgram } = params;
|
|
8728
|
-
const [[pool], [lpMint]] = await Promise.all([
|
|
8729
|
-
|
|
8730
|
-
|
|
8731
|
-
|
|
8732
|
-
|
|
8733
|
-
|
|
8734
|
-
|
|
8782
|
+
const [[pool], [lpMint], [dexCreatorFeeConfig]] = await Promise.all([
|
|
8783
|
+
findPoolPda({
|
|
8784
|
+
baseMint: params.baseMint,
|
|
8785
|
+
quoteMint: params.quoteMint
|
|
8786
|
+
}),
|
|
8787
|
+
findLpMintPda({
|
|
8788
|
+
baseMint: params.baseMint,
|
|
8789
|
+
quoteMint: params.quoteMint
|
|
8790
|
+
}),
|
|
8791
|
+
findCreatorFeeConfigPda$1({
|
|
8792
|
+
baseMint: params.baseMint,
|
|
8793
|
+
quoteMint: params.quoteMint
|
|
8794
|
+
})
|
|
8795
|
+
]);
|
|
8735
8796
|
const [[poolBaseVault], [poolQuoteVault], [poolLpAccount]] = await Promise.all([
|
|
8736
8797
|
findAssociatedTokenPda(pool, params.baseMint, TOKEN_2022_PROGRAM_ADDRESS),
|
|
8737
8798
|
findAssociatedTokenPda(pool, params.quoteMint, quoteTokenProgram),
|
|
@@ -8741,7 +8802,7 @@ async function buildMigrateInstruction(params) {
|
|
|
8741
8802
|
caller: params.caller,
|
|
8742
8803
|
baseMint: params.baseMint,
|
|
8743
8804
|
quoteMint: params.quoteMint,
|
|
8744
|
-
|
|
8805
|
+
dexCreatorFeeConfig,
|
|
8745
8806
|
poolBaseVault,
|
|
8746
8807
|
poolQuoteVault,
|
|
8747
8808
|
poolLpAccount,
|
|
@@ -8970,112 +9031,6 @@ function getAltRegistrySize() {
|
|
|
8970
9031
|
return 74;
|
|
8971
9032
|
}
|
|
8972
9033
|
//#endregion
|
|
8973
|
-
//#region src/nexus/generated/accounts/creatorFeeConfig.ts
|
|
8974
|
-
/**
|
|
8975
|
-
* This code was AUTOGENERATED using the Codama library.
|
|
8976
|
-
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
8977
|
-
* to add features, then rerun Codama to update it.
|
|
8978
|
-
*
|
|
8979
|
-
* @see https://github.com/codama-idl/codama
|
|
8980
|
-
*/
|
|
8981
|
-
const CREATOR_FEE_CONFIG_DISCRIMINATOR = new Uint8Array([
|
|
8982
|
-
160,
|
|
8983
|
-
88,
|
|
8984
|
-
34,
|
|
8985
|
-
74,
|
|
8986
|
-
215,
|
|
8987
|
-
196,
|
|
8988
|
-
130,
|
|
8989
|
-
32
|
|
8990
|
-
]);
|
|
8991
|
-
function getCreatorFeeConfigDiscriminatorBytes() {
|
|
8992
|
-
return fixEncoderSize(getBytesEncoder(), 8).encode(CREATOR_FEE_CONFIG_DISCRIMINATOR);
|
|
8993
|
-
}
|
|
8994
|
-
/** Gets the encoder for {@link CreatorFeeConfigArgs} account data. */
|
|
8995
|
-
function getCreatorFeeConfigEncoder() {
|
|
8996
|
-
return transformEncoder(getStructEncoder([
|
|
8997
|
-
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
8998
|
-
["version", getU8Encoder()],
|
|
8999
|
-
["bump", getU8Encoder()],
|
|
9000
|
-
["platformIndex", getU8Encoder()],
|
|
9001
|
-
["platformId", fixEncoderSize(getBytesEncoder(), 44)],
|
|
9002
|
-
["quoteMint", getAddressEncoder()],
|
|
9003
|
-
["reserved", fixEncoderSize(getBytesEncoder(), 64)]
|
|
9004
|
-
]), (value) => ({
|
|
9005
|
-
...value,
|
|
9006
|
-
discriminator: CREATOR_FEE_CONFIG_DISCRIMINATOR
|
|
9007
|
-
}));
|
|
9008
|
-
}
|
|
9009
|
-
/** Gets the decoder for {@link CreatorFeeConfig} account data. */
|
|
9010
|
-
function getCreatorFeeConfigDecoder() {
|
|
9011
|
-
return getStructDecoder([
|
|
9012
|
-
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
9013
|
-
["version", getU8Decoder()],
|
|
9014
|
-
["bump", getU8Decoder()],
|
|
9015
|
-
["platformIndex", getU8Decoder()],
|
|
9016
|
-
["platformId", fixDecoderSize(getBytesDecoder(), 44)],
|
|
9017
|
-
["quoteMint", getAddressDecoder()],
|
|
9018
|
-
["reserved", fixDecoderSize(getBytesDecoder(), 64)]
|
|
9019
|
-
]);
|
|
9020
|
-
}
|
|
9021
|
-
/** Gets the codec for {@link CreatorFeeConfig} account data. */
|
|
9022
|
-
function getCreatorFeeConfigCodec() {
|
|
9023
|
-
return combineCodec(getCreatorFeeConfigEncoder(), getCreatorFeeConfigDecoder());
|
|
9024
|
-
}
|
|
9025
|
-
function decodeCreatorFeeConfig(encodedAccount) {
|
|
9026
|
-
if (!("exists" in encodedAccount) || encodedAccount.exists) {
|
|
9027
|
-
if (encodedAccount.programAddress !== "7rrCurqdWFesbzwtYPo95fM8waTtVXgXwCom45x1sfNX") {
|
|
9028
|
-
const error = /* @__PURE__ */ new Error(`decodeCreatorFeeConfig: account ${encodedAccount.address} is owned by ${encodedAccount.programAddress}, expected ${SEND_NEXUS_PROGRAM_ADDRESS}`);
|
|
9029
|
-
error.name = "AccountOwnerMismatchError";
|
|
9030
|
-
throw error;
|
|
9031
|
-
}
|
|
9032
|
-
if (!containsBytes(encodedAccount.data, CREATOR_FEE_CONFIG_DISCRIMINATOR, 0)) {
|
|
9033
|
-
const error = /* @__PURE__ */ new Error(`decodeCreatorFeeConfig: account ${encodedAccount.address} does not match the CreatorFeeConfig discriminator`);
|
|
9034
|
-
error.name = "AccountDiscriminatorMismatchError";
|
|
9035
|
-
throw error;
|
|
9036
|
-
}
|
|
9037
|
-
}
|
|
9038
|
-
return decodeAccount(encodedAccount, getCreatorFeeConfigDecoder());
|
|
9039
|
-
}
|
|
9040
|
-
/** Fetches a `CreatorFeeConfig` account, throwing when it does not exist or only holds lamports. */
|
|
9041
|
-
async function fetchCreatorFeeConfig(rpc, address, config) {
|
|
9042
|
-
const maybeAccount = await fetchMaybeCreatorFeeConfig(rpc, address, config);
|
|
9043
|
-
assertAccountExists(maybeAccount);
|
|
9044
|
-
return maybeAccount;
|
|
9045
|
-
}
|
|
9046
|
-
/**
|
|
9047
|
-
* Fetches a `CreatorFeeConfig` account, or the non-existing variant when the address holds no
|
|
9048
|
-
* account or only lamports (see {@link accountIsCreated}).
|
|
9049
|
-
* {@link decodeCreatorFeeConfig} throws for a lamports-only account instead.
|
|
9050
|
-
*/
|
|
9051
|
-
async function fetchMaybeCreatorFeeConfig(rpc, address, config) {
|
|
9052
|
-
const maybeAccount = await fetchEncodedAccount(rpc, address, config);
|
|
9053
|
-
return decodeCreatorFeeConfig(accountIsCreated(maybeAccount) ? maybeAccount : {
|
|
9054
|
-
address,
|
|
9055
|
-
exists: false
|
|
9056
|
-
});
|
|
9057
|
-
}
|
|
9058
|
-
/** Fetches `CreatorFeeConfig` accounts, throwing when any does not exist or only holds lamports. */
|
|
9059
|
-
async function fetchAllCreatorFeeConfig(rpc, addresses, config) {
|
|
9060
|
-
const maybeAccounts = await fetchAllMaybeCreatorFeeConfig(rpc, addresses, config);
|
|
9061
|
-
assertAccountsExist(maybeAccounts);
|
|
9062
|
-
return maybeAccounts;
|
|
9063
|
-
}
|
|
9064
|
-
/**
|
|
9065
|
-
* Fetches `CreatorFeeConfig` accounts, with the non-existing variant for each address that holds
|
|
9066
|
-
* no account or only lamports (see {@link accountIsCreated}).
|
|
9067
|
-
* {@link decodeCreatorFeeConfig} throws for a lamports-only account instead.
|
|
9068
|
-
*/
|
|
9069
|
-
async function fetchAllMaybeCreatorFeeConfig(rpc, addresses, config) {
|
|
9070
|
-
return (await fetchEncodedAccounts(rpc, addresses, config)).map((maybeAccount) => decodeCreatorFeeConfig(accountIsCreated(maybeAccount) ? maybeAccount : {
|
|
9071
|
-
address: maybeAccount.address,
|
|
9072
|
-
exists: false
|
|
9073
|
-
}));
|
|
9074
|
-
}
|
|
9075
|
-
function getCreatorFeeConfigSize() {
|
|
9076
|
-
return 151;
|
|
9077
|
-
}
|
|
9078
|
-
//#endregion
|
|
9079
9034
|
//#region src/nexus/generated/types/authPlatformEntry.ts
|
|
9080
9035
|
/**
|
|
9081
9036
|
* This code was AUTOGENERATED using the Codama library.
|
|
@@ -9094,29 +9049,6 @@ function getAuthPlatformEntryCodec() {
|
|
|
9094
9049
|
return combineCodec(getAuthPlatformEntryEncoder(), getAuthPlatformEntryDecoder());
|
|
9095
9050
|
}
|
|
9096
9051
|
//#endregion
|
|
9097
|
-
//#region src/nexus/generated/types/callerType.ts
|
|
9098
|
-
/**
|
|
9099
|
-
* This code was AUTOGENERATED using the Codama library.
|
|
9100
|
-
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
9101
|
-
* to add features, then rerun Codama to update it.
|
|
9102
|
-
*
|
|
9103
|
-
* @see https://github.com/codama-idl/codama
|
|
9104
|
-
*/
|
|
9105
|
-
let CallerType = /* @__PURE__ */ function(CallerType) {
|
|
9106
|
-
CallerType[CallerType["PlatformBondingCurve"] = 0] = "PlatformBondingCurve";
|
|
9107
|
-
CallerType[CallerType["PlatformPool"] = 1] = "PlatformPool";
|
|
9108
|
-
return CallerType;
|
|
9109
|
-
}({});
|
|
9110
|
-
function getCallerTypeEncoder() {
|
|
9111
|
-
return getEnumEncoder(CallerType);
|
|
9112
|
-
}
|
|
9113
|
-
function getCallerTypeDecoder() {
|
|
9114
|
-
return getEnumDecoder(CallerType);
|
|
9115
|
-
}
|
|
9116
|
-
function getCallerTypeCodec() {
|
|
9117
|
-
return combineCodec(getCallerTypeEncoder(), getCallerTypeDecoder());
|
|
9118
|
-
}
|
|
9119
|
-
//#endregion
|
|
9120
9052
|
//#region src/nexus/generated/types/dexFees.ts
|
|
9121
9053
|
/**
|
|
9122
9054
|
* This code was AUTOGENERATED using the Codama library.
|
|
@@ -9130,7 +9062,7 @@ function getDexFeesEncoder() {
|
|
|
9130
9062
|
["creationFeeCents", getU64Encoder()],
|
|
9131
9063
|
["protocolFeeBps", getU16Encoder()],
|
|
9132
9064
|
["lpFeeBps", getU16Encoder()],
|
|
9133
|
-
["
|
|
9065
|
+
["maxCreatorFeeBps", getU16Encoder()],
|
|
9134
9066
|
["feeDecaySeconds", getU16Encoder()],
|
|
9135
9067
|
["feeDecayStartBps", getU16Encoder()]
|
|
9136
9068
|
]);
|
|
@@ -9140,7 +9072,7 @@ function getDexFeesDecoder() {
|
|
|
9140
9072
|
["creationFeeCents", getU64Decoder()],
|
|
9141
9073
|
["protocolFeeBps", getU16Decoder()],
|
|
9142
9074
|
["lpFeeBps", getU16Decoder()],
|
|
9143
|
-
["
|
|
9075
|
+
["maxCreatorFeeBps", getU16Decoder()],
|
|
9144
9076
|
["feeDecaySeconds", getU16Decoder()],
|
|
9145
9077
|
["feeDecayStartBps", getU16Decoder()]
|
|
9146
9078
|
]);
|
|
@@ -9189,7 +9121,7 @@ function getLaunchpadFeesEncoder() {
|
|
|
9189
9121
|
return getStructEncoder([
|
|
9190
9122
|
["creationFeeCents", getU64Encoder()],
|
|
9191
9123
|
["protocolFeeBps", getU16Encoder()],
|
|
9192
|
-
["
|
|
9124
|
+
["maxCreatorFeeBps", getU16Encoder()],
|
|
9193
9125
|
["feeDecaySeconds", getU16Encoder()],
|
|
9194
9126
|
["feeDecayStartBps", getU16Encoder()]
|
|
9195
9127
|
]);
|
|
@@ -9198,7 +9130,7 @@ function getLaunchpadFeesDecoder() {
|
|
|
9198
9130
|
return getStructDecoder([
|
|
9199
9131
|
["creationFeeCents", getU64Decoder()],
|
|
9200
9132
|
["protocolFeeBps", getU16Decoder()],
|
|
9201
|
-
["
|
|
9133
|
+
["maxCreatorFeeBps", getU16Decoder()],
|
|
9202
9134
|
["feeDecaySeconds", getU16Decoder()],
|
|
9203
9135
|
["feeDecayStartBps", getU16Decoder()]
|
|
9204
9136
|
]);
|
|
@@ -9209,13 +9141,9 @@ function getLaunchpadFeesCodec() {
|
|
|
9209
9141
|
//#endregion
|
|
9210
9142
|
//#region src/nexus/generated/types/index.ts
|
|
9211
9143
|
var types_exports = /* @__PURE__ */ __exportAll({
|
|
9212
|
-
CallerType: () => CallerType,
|
|
9213
9144
|
getAuthPlatformEntryCodec: () => getAuthPlatformEntryCodec,
|
|
9214
9145
|
getAuthPlatformEntryDecoder: () => getAuthPlatformEntryDecoder,
|
|
9215
9146
|
getAuthPlatformEntryEncoder: () => getAuthPlatformEntryEncoder,
|
|
9216
|
-
getCallerTypeCodec: () => getCallerTypeCodec,
|
|
9217
|
-
getCallerTypeDecoder: () => getCallerTypeDecoder,
|
|
9218
|
-
getCallerTypeEncoder: () => getCallerTypeEncoder,
|
|
9219
9147
|
getDexFeesCodec: () => getDexFeesCodec,
|
|
9220
9148
|
getDexFeesDecoder: () => getDexFeesDecoder,
|
|
9221
9149
|
getDexFeesEncoder: () => getDexFeesEncoder,
|
|
@@ -9259,7 +9187,7 @@ function getFeePresetEncoder() {
|
|
|
9259
9187
|
["launchpad", getLaunchpadFeesEncoder()],
|
|
9260
9188
|
["dex", getDexFeesEncoder()],
|
|
9261
9189
|
["platformConfig", getAddressEncoder()],
|
|
9262
|
-
["reserved", fixEncoderSize(getBytesEncoder(),
|
|
9190
|
+
["reserved", fixEncoderSize(getBytesEncoder(), 64)]
|
|
9263
9191
|
]), (value) => ({
|
|
9264
9192
|
...value,
|
|
9265
9193
|
discriminator: FEE_PRESET_DISCRIMINATOR
|
|
@@ -9276,7 +9204,7 @@ function getFeePresetDecoder() {
|
|
|
9276
9204
|
["launchpad", getLaunchpadFeesDecoder()],
|
|
9277
9205
|
["dex", getDexFeesDecoder()],
|
|
9278
9206
|
["platformConfig", getAddressDecoder()],
|
|
9279
|
-
["reserved", fixDecoderSize(getBytesDecoder(),
|
|
9207
|
+
["reserved", fixDecoderSize(getBytesDecoder(), 64)]
|
|
9280
9208
|
]);
|
|
9281
9209
|
}
|
|
9282
9210
|
/** Gets the codec for {@link FeePreset} account data. */
|
|
@@ -9470,7 +9398,8 @@ function getPartnerConfigEncoder() {
|
|
|
9470
9398
|
["launchpad", getLaunchpadFeesEncoder()],
|
|
9471
9399
|
["dex", getDexFeesEncoder()],
|
|
9472
9400
|
["platformConfig", getAddressEncoder()],
|
|
9473
|
-
["
|
|
9401
|
+
["allowedCreatorFeeModes", getU16Encoder()],
|
|
9402
|
+
["reserved", fixEncoderSize(getBytesEncoder(), 256)]
|
|
9474
9403
|
]), (value) => ({
|
|
9475
9404
|
...value,
|
|
9476
9405
|
discriminator: PARTNER_CONFIG_DISCRIMINATOR
|
|
@@ -9488,7 +9417,8 @@ function getPartnerConfigDecoder() {
|
|
|
9488
9417
|
["launchpad", getLaunchpadFeesDecoder()],
|
|
9489
9418
|
["dex", getDexFeesDecoder()],
|
|
9490
9419
|
["platformConfig", getAddressDecoder()],
|
|
9491
|
-
["
|
|
9420
|
+
["allowedCreatorFeeModes", getU16Decoder()],
|
|
9421
|
+
["reserved", fixDecoderSize(getBytesDecoder(), 256)]
|
|
9492
9422
|
]);
|
|
9493
9423
|
}
|
|
9494
9424
|
/** Gets the codec for {@link PartnerConfig} account data. */
|
|
@@ -9546,7 +9476,7 @@ async function fetchAllMaybePartnerConfig(rpc, addresses, config) {
|
|
|
9546
9476
|
}));
|
|
9547
9477
|
}
|
|
9548
9478
|
function getPartnerConfigSize() {
|
|
9549
|
-
return
|
|
9479
|
+
return 399;
|
|
9550
9480
|
}
|
|
9551
9481
|
//#endregion
|
|
9552
9482
|
//#region src/nexus/generated/accounts/partnerMetadata.ts
|
|
@@ -9917,7 +9847,7 @@ function getUserRewardDebtEncoder() {
|
|
|
9917
9847
|
["amountSnapshot", getU64Encoder()],
|
|
9918
9848
|
["settledVersion", getU32Encoder()],
|
|
9919
9849
|
["owed", getU64Encoder()],
|
|
9920
|
-
["reserved", fixEncoderSize(getBytesEncoder(),
|
|
9850
|
+
["reserved", fixEncoderSize(getBytesEncoder(), 64)]
|
|
9921
9851
|
]), (value) => ({
|
|
9922
9852
|
...value,
|
|
9923
9853
|
discriminator: USER_REWARD_DEBT_DISCRIMINATOR
|
|
@@ -9937,7 +9867,7 @@ function getUserRewardDebtDecoder() {
|
|
|
9937
9867
|
["amountSnapshot", getU64Decoder()],
|
|
9938
9868
|
["settledVersion", getU32Decoder()],
|
|
9939
9869
|
["owed", getU64Decoder()],
|
|
9940
|
-
["reserved", fixDecoderSize(getBytesDecoder(),
|
|
9870
|
+
["reserved", fixDecoderSize(getBytesDecoder(), 64)]
|
|
9941
9871
|
]);
|
|
9942
9872
|
}
|
|
9943
9873
|
/** Gets the codec for {@link UserRewardDebt} account data. */
|
|
@@ -9995,7 +9925,7 @@ async function fetchAllMaybeUserRewardDebt(rpc, addresses, config) {
|
|
|
9995
9925
|
}));
|
|
9996
9926
|
}
|
|
9997
9927
|
function getUserRewardDebtSize() {
|
|
9998
|
-
return
|
|
9928
|
+
return 214;
|
|
9999
9929
|
}
|
|
10000
9930
|
//#endregion
|
|
10001
9931
|
//#region src/nexus/generated/accounts/userStakePosition.ts
|
|
@@ -10030,7 +9960,7 @@ function getUserStakePositionEncoder() {
|
|
|
10030
9960
|
["amount", getU64Encoder()],
|
|
10031
9961
|
["stakeVersion", getU32Encoder()],
|
|
10032
9962
|
["settledCount", getU16Encoder()],
|
|
10033
|
-
["reserved", fixEncoderSize(getBytesEncoder(),
|
|
9963
|
+
["reserved", fixEncoderSize(getBytesEncoder(), 128)]
|
|
10034
9964
|
]), (value) => ({
|
|
10035
9965
|
...value,
|
|
10036
9966
|
discriminator: USER_STAKE_POSITION_DISCRIMINATOR
|
|
@@ -10047,7 +9977,7 @@ function getUserStakePositionDecoder() {
|
|
|
10047
9977
|
["amount", getU64Decoder()],
|
|
10048
9978
|
["stakeVersion", getU32Decoder()],
|
|
10049
9979
|
["settledCount", getU16Decoder()],
|
|
10050
|
-
["reserved", fixDecoderSize(getBytesDecoder(),
|
|
9980
|
+
["reserved", fixDecoderSize(getBytesDecoder(), 128)]
|
|
10051
9981
|
]);
|
|
10052
9982
|
}
|
|
10053
9983
|
/** Gets the codec for {@link UserStakePosition} account data. */
|
|
@@ -10105,7 +10035,7 @@ async function fetchAllMaybeUserStakePosition(rpc, addresses, config) {
|
|
|
10105
10035
|
}));
|
|
10106
10036
|
}
|
|
10107
10037
|
function getUserStakePositionSize() {
|
|
10108
|
-
return
|
|
10038
|
+
return 216;
|
|
10109
10039
|
}
|
|
10110
10040
|
//#endregion
|
|
10111
10041
|
//#region src/nexus/generated/accounts/sendNexus.accounts.ts
|
|
@@ -10124,7 +10054,6 @@ function identifySendNexusAccount(account) {
|
|
|
10124
10054
|
if ("data" in account && account.programAddress !== "7rrCurqdWFesbzwtYPo95fM8waTtVXgXwCom45x1sfNX") return null;
|
|
10125
10055
|
const data = "data" in account ? account.data : account;
|
|
10126
10056
|
if (containsBytes(data, ALT_REGISTRY_DISCRIMINATOR, 0)) return "altRegistry";
|
|
10127
|
-
if (containsBytes(data, CREATOR_FEE_CONFIG_DISCRIMINATOR, 0)) return "creatorFeeConfig";
|
|
10128
10057
|
if (containsBytes(data, FEE_PRESET_DISCRIMINATOR, 0)) return "feePreset";
|
|
10129
10058
|
if (containsBytes(data, GLOBAL_CONFIG_DISCRIMINATOR, 0)) return "globalConfig";
|
|
10130
10059
|
if (containsBytes(data, PARTNER_CONFIG_DISCRIMINATOR, 0)) return "partnerConfig";
|
|
@@ -10139,7 +10068,6 @@ function identifySendNexusAccount(account) {
|
|
|
10139
10068
|
//#region src/nexus/generated/accounts/index.ts
|
|
10140
10069
|
var accounts_exports = /* @__PURE__ */ __exportAll({
|
|
10141
10070
|
ALT_REGISTRY_DISCRIMINATOR: () => ALT_REGISTRY_DISCRIMINATOR,
|
|
10142
|
-
CREATOR_FEE_CONFIG_DISCRIMINATOR: () => CREATOR_FEE_CONFIG_DISCRIMINATOR,
|
|
10143
10071
|
FEE_PRESET_DISCRIMINATOR: () => FEE_PRESET_DISCRIMINATOR,
|
|
10144
10072
|
GLOBAL_CONFIG_DISCRIMINATOR: () => GLOBAL_CONFIG_DISCRIMINATOR,
|
|
10145
10073
|
PARTNER_CONFIG_DISCRIMINATOR: () => PARTNER_CONFIG_DISCRIMINATOR,
|
|
@@ -10149,7 +10077,6 @@ var accounts_exports = /* @__PURE__ */ __exportAll({
|
|
|
10149
10077
|
USER_REWARD_DEBT_DISCRIMINATOR: () => USER_REWARD_DEBT_DISCRIMINATOR,
|
|
10150
10078
|
USER_STAKE_POSITION_DISCRIMINATOR: () => USER_STAKE_POSITION_DISCRIMINATOR,
|
|
10151
10079
|
decodeAltRegistry: () => decodeAltRegistry,
|
|
10152
|
-
decodeCreatorFeeConfig: () => decodeCreatorFeeConfig,
|
|
10153
10080
|
decodeFeePreset: () => decodeFeePreset,
|
|
10154
10081
|
decodeGlobalConfig: () => decodeGlobalConfig,
|
|
10155
10082
|
decodePartnerConfig: () => decodePartnerConfig,
|
|
@@ -10159,11 +10086,9 @@ var accounts_exports = /* @__PURE__ */ __exportAll({
|
|
|
10159
10086
|
decodeUserRewardDebt: () => decodeUserRewardDebt,
|
|
10160
10087
|
decodeUserStakePosition: () => decodeUserStakePosition,
|
|
10161
10088
|
fetchAllAltRegistry: () => fetchAllAltRegistry,
|
|
10162
|
-
fetchAllCreatorFeeConfig: () => fetchAllCreatorFeeConfig,
|
|
10163
10089
|
fetchAllFeePreset: () => fetchAllFeePreset,
|
|
10164
10090
|
fetchAllGlobalConfig: () => fetchAllGlobalConfig,
|
|
10165
10091
|
fetchAllMaybeAltRegistry: () => fetchAllMaybeAltRegistry,
|
|
10166
|
-
fetchAllMaybeCreatorFeeConfig: () => fetchAllMaybeCreatorFeeConfig,
|
|
10167
10092
|
fetchAllMaybeFeePreset: () => fetchAllMaybeFeePreset,
|
|
10168
10093
|
fetchAllMaybeGlobalConfig: () => fetchAllMaybeGlobalConfig,
|
|
10169
10094
|
fetchAllMaybePartnerConfig: () => fetchAllMaybePartnerConfig,
|
|
@@ -10179,11 +10104,9 @@ var accounts_exports = /* @__PURE__ */ __exportAll({
|
|
|
10179
10104
|
fetchAllUserRewardDebt: () => fetchAllUserRewardDebt,
|
|
10180
10105
|
fetchAllUserStakePosition: () => fetchAllUserStakePosition,
|
|
10181
10106
|
fetchAltRegistry: () => fetchAltRegistry,
|
|
10182
|
-
fetchCreatorFeeConfig: () => fetchCreatorFeeConfig,
|
|
10183
10107
|
fetchFeePreset: () => fetchFeePreset,
|
|
10184
10108
|
fetchGlobalConfig: () => fetchGlobalConfig,
|
|
10185
10109
|
fetchMaybeAltRegistry: () => fetchMaybeAltRegistry,
|
|
10186
|
-
fetchMaybeCreatorFeeConfig: () => fetchMaybeCreatorFeeConfig,
|
|
10187
10110
|
fetchMaybeFeePreset: () => fetchMaybeFeePreset,
|
|
10188
10111
|
fetchMaybeGlobalConfig: () => fetchMaybeGlobalConfig,
|
|
10189
10112
|
fetchMaybePartnerConfig: () => fetchMaybePartnerConfig,
|
|
@@ -10203,11 +10126,6 @@ var accounts_exports = /* @__PURE__ */ __exportAll({
|
|
|
10203
10126
|
getAltRegistryDiscriminatorBytes: () => getAltRegistryDiscriminatorBytes,
|
|
10204
10127
|
getAltRegistryEncoder: () => getAltRegistryEncoder,
|
|
10205
10128
|
getAltRegistrySize: () => getAltRegistrySize,
|
|
10206
|
-
getCreatorFeeConfigCodec: () => getCreatorFeeConfigCodec,
|
|
10207
|
-
getCreatorFeeConfigDecoder: () => getCreatorFeeConfigDecoder,
|
|
10208
|
-
getCreatorFeeConfigDiscriminatorBytes: () => getCreatorFeeConfigDiscriminatorBytes,
|
|
10209
|
-
getCreatorFeeConfigEncoder: () => getCreatorFeeConfigEncoder,
|
|
10210
|
-
getCreatorFeeConfigSize: () => getCreatorFeeConfigSize,
|
|
10211
10129
|
getFeePresetCodec: () => getFeePresetCodec,
|
|
10212
10130
|
getFeePresetDecoder: () => getFeePresetDecoder,
|
|
10213
10131
|
getFeePresetDiscriminatorBytes: () => getFeePresetDiscriminatorBytes,
|
|
@@ -10645,12 +10563,16 @@ const SEND_NEXUS_ERROR__USER_TOKEN_ACCOUNT_WRONG_MINT = 7009;
|
|
|
10645
10563
|
const SEND_NEXUS_ERROR__USER_TOKEN_ACCOUNT_WRONG_AUTHORITY = 7010;
|
|
10646
10564
|
/** NothingToClaim: Nothing to claim */
|
|
10647
10565
|
const SEND_NEXUS_ERROR__NOTHING_TO_CLAIM = 7011;
|
|
10648
|
-
/**
|
|
10649
|
-
const
|
|
10566
|
+
/** Unused7012: Unused */
|
|
10567
|
+
const SEND_NEXUS_ERROR__UNUSED7012 = 7012;
|
|
10650
10568
|
/** QuoteMintPriceUnset: Quote mint has no USDC price on its nexus reward state */
|
|
10651
10569
|
const SEND_NEXUS_ERROR__QUOTE_MINT_PRICE_UNSET = 7013;
|
|
10652
10570
|
/** TransferFeeNotSettleable: Token-2022 transfer fee schedule cannot settle the exact amount */
|
|
10653
10571
|
const SEND_NEXUS_ERROR__TRANSFER_FEE_NOT_SETTLEABLE = 7014;
|
|
10572
|
+
/** CreatorFeeTooHigh: Creator fee exceeds the partner's maximum */
|
|
10573
|
+
const SEND_NEXUS_ERROR__CREATOR_FEE_TOO_HIGH = 7015;
|
|
10574
|
+
/** CreatorFeeModeNotAllowed: Creator fee mode is not allowed by the partner config */
|
|
10575
|
+
const SEND_NEXUS_ERROR__CREATOR_FEE_MODE_NOT_ALLOWED = 7016;
|
|
10654
10576
|
/** InsufficientLiquidity: Insufficient liquidity */
|
|
10655
10577
|
const SEND_NEXUS_ERROR__INSUFFICIENT_LIQUIDITY = 7100;
|
|
10656
10578
|
/** InvalidAmount: Invalid amount */
|
|
@@ -10658,6 +10580,8 @@ const SEND_NEXUS_ERROR__INVALID_AMOUNT = 7101;
|
|
|
10658
10580
|
const sendNexusErrorMessages = {
|
|
10659
10581
|
[SEND_NEXUS_ERROR__AMBIGUOUS_FEE_SOURCE]: `Cannot specify both fee_preset and custom_fees`,
|
|
10660
10582
|
[SEND_NEXUS_ERROR__ARITHMETIC_OVERFLOW]: `Arithmetic overflow`,
|
|
10583
|
+
[SEND_NEXUS_ERROR__CREATOR_FEE_MODE_NOT_ALLOWED]: `Creator fee mode is not allowed by the partner config`,
|
|
10584
|
+
[SEND_NEXUS_ERROR__CREATOR_FEE_TOO_HIGH]: `Creator fee exceeds the partner's maximum`,
|
|
10661
10585
|
[SEND_NEXUS_ERROR__DUPLICATE_AUTH_PLATFORM_NAME]: `Duplicate auth platform name`,
|
|
10662
10586
|
[SEND_NEXUS_ERROR__INSUFFICIENT_LIQUIDITY]: `Insufficient liquidity`,
|
|
10663
10587
|
[SEND_NEXUS_ERROR__INSUFFICIENT_STAKE]: `Insufficient stake balance`,
|
|
@@ -10665,7 +10589,6 @@ const sendNexusErrorMessages = {
|
|
|
10665
10589
|
[SEND_NEXUS_ERROR__INVALID_AUTHORITY]: `Invalid authority`,
|
|
10666
10590
|
[SEND_NEXUS_ERROR__INVALID_AUTH_PLATFORM_INDEX]: `Invalid auth platform index`,
|
|
10667
10591
|
[SEND_NEXUS_ERROR__INVALID_AUTH_PLATFORM_NAME]: `Invalid auth platform name`,
|
|
10668
|
-
[SEND_NEXUS_ERROR__INVALID_CREATOR_ID]: `Creator identity is not a decodable wallet address`,
|
|
10669
10592
|
[SEND_NEXUS_ERROR__INVALID_DESTINATION]: `Invalid destination account`,
|
|
10670
10593
|
[SEND_NEXUS_ERROR__INVALID_FEE_PRESET]: `Invalid fee configuration`,
|
|
10671
10594
|
[SEND_NEXUS_ERROR__INVALID_MINT]: `Invalid mint`,
|
|
@@ -10699,6 +10622,7 @@ const sendNexusErrorMessages = {
|
|
|
10699
10622
|
[SEND_NEXUS_ERROR__TOO_MANY_AUTH_PLATFORMS]: `Too many auth platforms (max 255)`,
|
|
10700
10623
|
[SEND_NEXUS_ERROR__TRANSFER_FEE_NOT_SETTLEABLE]: `Token-2022 transfer fee schedule cannot settle the exact amount`,
|
|
10701
10624
|
[SEND_NEXUS_ERROR__UNAUTHORIZED]: `Unauthorized`,
|
|
10625
|
+
[SEND_NEXUS_ERROR__UNUSED7012]: `Unused`,
|
|
10702
10626
|
[SEND_NEXUS_ERROR__USER_TOKEN_ACCOUNT_INVALID]: `User token account is not an initialized token account`,
|
|
10703
10627
|
[SEND_NEXUS_ERROR__USER_TOKEN_ACCOUNT_WRONG_AUTHORITY]: `User token account is not owned by the trading user`,
|
|
10704
10628
|
[SEND_NEXUS_ERROR__USER_TOKEN_ACCOUNT_WRONG_MINT]: `User token account mint does not match the trade`,
|
|
@@ -10715,6 +10639,8 @@ function isSendNexusError(error, transactionMessage, code) {
|
|
|
10715
10639
|
var errors_exports = /* @__PURE__ */ __exportAll({
|
|
10716
10640
|
SEND_NEXUS_ERROR__AMBIGUOUS_FEE_SOURCE: () => SEND_NEXUS_ERROR__AMBIGUOUS_FEE_SOURCE,
|
|
10717
10641
|
SEND_NEXUS_ERROR__ARITHMETIC_OVERFLOW: () => SEND_NEXUS_ERROR__ARITHMETIC_OVERFLOW,
|
|
10642
|
+
SEND_NEXUS_ERROR__CREATOR_FEE_MODE_NOT_ALLOWED: () => SEND_NEXUS_ERROR__CREATOR_FEE_MODE_NOT_ALLOWED,
|
|
10643
|
+
SEND_NEXUS_ERROR__CREATOR_FEE_TOO_HIGH: () => SEND_NEXUS_ERROR__CREATOR_FEE_TOO_HIGH,
|
|
10718
10644
|
SEND_NEXUS_ERROR__DUPLICATE_AUTH_PLATFORM_NAME: () => SEND_NEXUS_ERROR__DUPLICATE_AUTH_PLATFORM_NAME,
|
|
10719
10645
|
SEND_NEXUS_ERROR__INSUFFICIENT_LIQUIDITY: () => SEND_NEXUS_ERROR__INSUFFICIENT_LIQUIDITY,
|
|
10720
10646
|
SEND_NEXUS_ERROR__INSUFFICIENT_STAKE: () => SEND_NEXUS_ERROR__INSUFFICIENT_STAKE,
|
|
@@ -10722,7 +10648,6 @@ var errors_exports = /* @__PURE__ */ __exportAll({
|
|
|
10722
10648
|
SEND_NEXUS_ERROR__INVALID_AUTHORITY: () => SEND_NEXUS_ERROR__INVALID_AUTHORITY,
|
|
10723
10649
|
SEND_NEXUS_ERROR__INVALID_AUTH_PLATFORM_INDEX: () => SEND_NEXUS_ERROR__INVALID_AUTH_PLATFORM_INDEX,
|
|
10724
10650
|
SEND_NEXUS_ERROR__INVALID_AUTH_PLATFORM_NAME: () => SEND_NEXUS_ERROR__INVALID_AUTH_PLATFORM_NAME,
|
|
10725
|
-
SEND_NEXUS_ERROR__INVALID_CREATOR_ID: () => SEND_NEXUS_ERROR__INVALID_CREATOR_ID,
|
|
10726
10651
|
SEND_NEXUS_ERROR__INVALID_DESTINATION: () => SEND_NEXUS_ERROR__INVALID_DESTINATION,
|
|
10727
10652
|
SEND_NEXUS_ERROR__INVALID_FEE_PRESET: () => SEND_NEXUS_ERROR__INVALID_FEE_PRESET,
|
|
10728
10653
|
SEND_NEXUS_ERROR__INVALID_MINT: () => SEND_NEXUS_ERROR__INVALID_MINT,
|
|
@@ -10756,6 +10681,7 @@ var errors_exports = /* @__PURE__ */ __exportAll({
|
|
|
10756
10681
|
SEND_NEXUS_ERROR__TOO_MANY_AUTH_PLATFORMS: () => SEND_NEXUS_ERROR__TOO_MANY_AUTH_PLATFORMS,
|
|
10757
10682
|
SEND_NEXUS_ERROR__TRANSFER_FEE_NOT_SETTLEABLE: () => SEND_NEXUS_ERROR__TRANSFER_FEE_NOT_SETTLEABLE,
|
|
10758
10683
|
SEND_NEXUS_ERROR__UNAUTHORIZED: () => SEND_NEXUS_ERROR__UNAUTHORIZED,
|
|
10684
|
+
SEND_NEXUS_ERROR__UNUSED7012: () => SEND_NEXUS_ERROR__UNUSED7012,
|
|
10759
10685
|
SEND_NEXUS_ERROR__USER_TOKEN_ACCOUNT_INVALID: () => SEND_NEXUS_ERROR__USER_TOKEN_ACCOUNT_INVALID,
|
|
10760
10686
|
SEND_NEXUS_ERROR__USER_TOKEN_ACCOUNT_WRONG_AUTHORITY: () => SEND_NEXUS_ERROR__USER_TOKEN_ACCOUNT_WRONG_AUTHORITY,
|
|
10761
10687
|
SEND_NEXUS_ERROR__USER_TOKEN_ACCOUNT_WRONG_MINT: () => SEND_NEXUS_ERROR__USER_TOKEN_ACCOUNT_WRONG_MINT,
|
|
@@ -11142,7 +11068,6 @@ var pdas_exports = /* @__PURE__ */ __exportAll({
|
|
|
11142
11068
|
GLOBAL_CONFIG_PDA_ADDRESS: () => GLOBAL_CONFIG_PDA_ADDRESS,
|
|
11143
11069
|
STAKING_CONFIG_PDA_ADDRESS: () => STAKING_CONFIG_PDA_ADDRESS,
|
|
11144
11070
|
findAltRegistryPda: () => findAltRegistryPda,
|
|
11145
|
-
findCreatorFeeConfigPda: () => findCreatorFeeConfigPda,
|
|
11146
11071
|
findDefaultFeePresetPda: () => findDefaultFeePresetPda,
|
|
11147
11072
|
findDefaultPartnerMetadataPda: () => findDefaultPartnerMetadataPda,
|
|
11148
11073
|
findDefaultPartnerPda: () => findDefaultPartnerPda,
|
|
@@ -12556,13 +12481,6 @@ function sendNexusProgram() {
|
|
|
12556
12481
|
fetchAllMaybe: (addresses, config) => fetchAllMaybeAltRegistry(client.rpc, addresses, config),
|
|
12557
12482
|
fetchMaybe: (address, config) => fetchMaybeAltRegistry(client.rpc, address, config)
|
|
12558
12483
|
}),
|
|
12559
|
-
creatorFeeConfig: Object.freeze({
|
|
12560
|
-
...getCreatorFeeConfigCodec(),
|
|
12561
|
-
fetch: (address, config) => fetchCreatorFeeConfig(client.rpc, address, config),
|
|
12562
|
-
fetchAll: (addresses, config) => fetchAllCreatorFeeConfig(client.rpc, addresses, config),
|
|
12563
|
-
fetchAllMaybe: (addresses, config) => fetchAllMaybeCreatorFeeConfig(client.rpc, addresses, config),
|
|
12564
|
-
fetchMaybe: (address, config) => fetchMaybeCreatorFeeConfig(client.rpc, address, config)
|
|
12565
|
-
}),
|
|
12566
12484
|
feePreset: Object.freeze({
|
|
12567
12485
|
...getFeePresetCodec(),
|
|
12568
12486
|
fetch: (address, config) => fetchFeePreset(client.rpc, address, config),
|
|
@@ -12660,7 +12578,6 @@ function sendNexusProgram() {
|
|
|
12660
12578
|
userStakePosition: findUserStakePositionPda,
|
|
12661
12579
|
userRewardDebt: findUserRewardDebtPda,
|
|
12662
12580
|
eventAuthority: findEventAuthorityPda,
|
|
12663
|
-
creatorFeeConfig: findCreatorFeeConfigPda,
|
|
12664
12581
|
altRegistry: findAltRegistryPda
|
|
12665
12582
|
},
|
|
12666
12583
|
identifyAccount: identifySendNexusAccount,
|
|
@@ -12689,11 +12606,13 @@ async function fetchPartnerFees(rpc, partner, platformConfig) {
|
|
|
12689
12606
|
if (!maybeAccount.exists) throw new Error(`No fee config for partner ${partner} on platform ${platformConfig}`);
|
|
12690
12607
|
return maybeAccount.data;
|
|
12691
12608
|
}
|
|
12692
|
-
/** Returns the `feeBps` a trade pays: the standard rate plus the decay premium.
|
|
12693
|
-
*
|
|
12694
|
-
*
|
|
12695
|
-
|
|
12696
|
-
|
|
12609
|
+
/** Returns the `feeBps` a trade pays: the standard rate plus the decay premium. The standard rate
|
|
12610
|
+
* is the protocol and LP rates of `schedule` plus `creatorFeeBps`. `schedule` is the
|
|
12611
|
+
* `PartnerConfig`'s `launchpad` for a curve or `dex` for a pool. `creatorFeeBps` and `createdAt`
|
|
12612
|
+
* are the curve's or pool's. `schedule.maxCreatorFeeBps` has no effect. `createdAt` and `now`
|
|
12613
|
+
* are in unix seconds. */
|
|
12614
|
+
function effectiveFeeBps(schedule, createdAt, now, creatorFeeBps) {
|
|
12615
|
+
const standardFeeBps = schedule.protocolFeeBps + ("lpFeeBps" in schedule ? schedule.lpFeeBps : 0) + creatorFeeBps;
|
|
12697
12616
|
const premium = calculateFeeDecayPremium({
|
|
12698
12617
|
currentTimestamp: now,
|
|
12699
12618
|
createdAtTimestamp: createdAt,
|
|
@@ -13166,9 +13085,6 @@ async function fetchQuoteMintInfos(rpc, mints, commitment) {
|
|
|
13166
13085
|
//#region src/utils/index.ts
|
|
13167
13086
|
var utils_exports = /* @__PURE__ */ __exportAll({
|
|
13168
13087
|
accountIsCreated: () => accountIsCreated,
|
|
13169
|
-
creatorHashFromId: () => creatorHashFromId,
|
|
13170
|
-
decodeCreatorId: () => decodeCreatorId,
|
|
13171
|
-
encodeCreatorId: () => encodeCreatorId,
|
|
13172
13088
|
fetchQuoteMintInfo: () => fetchQuoteMintInfo,
|
|
13173
13089
|
fetchQuoteMintInfos: () => fetchQuoteMintInfos,
|
|
13174
13090
|
findAssociatedTokenPda: () => findAssociatedTokenPda
|