@pump-fun/pump-sdk 1.28.0-devnet.2 → 1.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -46
- package/dist/esm/index.js +28 -193
- package/dist/index.d.mts +4 -92
- package/dist/index.d.ts +4 -92
- package/dist/index.js +28 -193
- package/package.json +1 -1
- package/src/index.ts +0 -4
- package/src/pda.ts +7 -8
- package/src/sdk.ts +22 -217
- package/src/state.ts +0 -36
package/README.md
CHANGED
|
@@ -163,49 +163,3 @@ const tx = new Transaction().add(...instructions);
|
|
|
163
163
|
```
|
|
164
164
|
|
|
165
165
|
This method automatically handles graduated tokens by including the `transferCreatorFeesToPump` instruction to consolidate fees from the AMM vault before distributing.
|
|
166
|
-
|
|
167
|
-
## GitHub Recipient and Social Fee PDA Requirements
|
|
168
|
-
|
|
169
|
-
If you are adding a **GitHub recipient** as a fee recipient in sharing config, make sure to initialize the social fee pda before adding it as a recipient. Use one of these methods:
|
|
170
|
-
|
|
171
|
-
```ts
|
|
172
|
-
import {
|
|
173
|
-
Platform,
|
|
174
|
-
PUMP_SDK,
|
|
175
|
-
} from "@pump-fun/pump-sdk";
|
|
176
|
-
|
|
177
|
-
// 1) Update an existing sharing config
|
|
178
|
-
await PUMP_SDK.updateSharingConfigWithSocialRecipients({
|
|
179
|
-
authority,
|
|
180
|
-
mint,
|
|
181
|
-
currentShareholders,
|
|
182
|
-
newShareholders: [
|
|
183
|
-
{ address: authority, shareBps: 7000 },
|
|
184
|
-
{ userId: "1234567", platform: Platform.GitHub, shareBps: 3000 },
|
|
185
|
-
],
|
|
186
|
-
});
|
|
187
|
-
|
|
188
|
-
// 2) Create sharing config + set social recipients in one flow
|
|
189
|
-
// - Use pool for graduated coins
|
|
190
|
-
// - Use null for ungraduated coins
|
|
191
|
-
await PUMP_SDK.createSharingConfigWithSocialRecipients({
|
|
192
|
-
creator,
|
|
193
|
-
mint,
|
|
194
|
-
pool,
|
|
195
|
-
newShareholders: [
|
|
196
|
-
{ address: creator, shareBps: 7000 },
|
|
197
|
-
{ userId: "1234567", platform: Platform.GitHub, shareBps: 3000 },
|
|
198
|
-
],
|
|
199
|
-
});
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
Method selection:
|
|
203
|
-
- `updateSharingConfigWithSocialRecipients`: use when sharing config already exists.
|
|
204
|
-
- `createSharingConfigWithSocialRecipients`: use for first-time setup (creates config, then updates shares).
|
|
205
|
-
|
|
206
|
-
✅ Checklist
|
|
207
|
-
|
|
208
|
-
- [ ] The GitHub user must be able to log in to claim fees. **GitHub organizations are not supported** for social fee recipients; adding an organization account can result in fees being permanently lost.
|
|
209
|
-
- [ ] Only `Platform.GitHub` is supported. Any attempt to use a different platform value can result in the coin being banned or **fees lost**.
|
|
210
|
-
- [ ] Fees in a GitHub vault can only be claimed by the linked GitHub user, and only through Pump.fun (web or mobile). You are responsible for directing users to claim there; we do not support any claim flow outside our apps.
|
|
211
|
-
- [ ] You have initialized the social fee recipient pda by using one of the above helper or `createSocialFeePda`
|
package/dist/esm/index.js
CHANGED
|
@@ -19910,35 +19910,6 @@ var OnlinePumpSdk = class {
|
|
|
19910
19910
|
}
|
|
19911
19911
|
};
|
|
19912
19912
|
|
|
19913
|
-
// src/state.ts
|
|
19914
|
-
var Platform = /* @__PURE__ */ ((Platform3) => {
|
|
19915
|
-
Platform3[Platform3["Pump"] = 0] = "Pump";
|
|
19916
|
-
Platform3[Platform3["X"] = 1] = "X";
|
|
19917
|
-
Platform3[Platform3["GitHub"] = 2] = "GitHub";
|
|
19918
|
-
return Platform3;
|
|
19919
|
-
})(Platform || {});
|
|
19920
|
-
var SUPPORTED_SOCIAL_PLATFORMS = [2 /* GitHub */];
|
|
19921
|
-
var stringToPlatform = (value) => {
|
|
19922
|
-
const normalized = value.trim().toUpperCase();
|
|
19923
|
-
const entry = Object.entries(Platform).find(
|
|
19924
|
-
([key, val]) => typeof val === "number" && key.toUpperCase() === normalized
|
|
19925
|
-
);
|
|
19926
|
-
if (entry) {
|
|
19927
|
-
return entry[1];
|
|
19928
|
-
}
|
|
19929
|
-
const validNames = Object.entries(Platform).filter(([, val]) => typeof val === "number").map(([key]) => key.toUpperCase()).join(", ");
|
|
19930
|
-
throw new Error(
|
|
19931
|
-
`Unknown platform "${value}". Expected one of: ${validNames}`
|
|
19932
|
-
);
|
|
19933
|
-
};
|
|
19934
|
-
var platformToString = (platform) => {
|
|
19935
|
-
const name = Platform[platform];
|
|
19936
|
-
if (name !== void 0) {
|
|
19937
|
-
return name;
|
|
19938
|
-
}
|
|
19939
|
-
throw new Error(`Unknown platform value: ${platform}`);
|
|
19940
|
-
};
|
|
19941
|
-
|
|
19942
19913
|
// src/sdk.ts
|
|
19943
19914
|
function getPumpProgram(connection) {
|
|
19944
19915
|
return new Program(
|
|
@@ -20407,7 +20378,13 @@ var PumpSdk = class {
|
|
|
20407
20378
|
user,
|
|
20408
20379
|
creatorVault: creatorVaultPda(creator),
|
|
20409
20380
|
tokenProgram
|
|
20410
|
-
}).
|
|
20381
|
+
}).remainingAccounts([
|
|
20382
|
+
{
|
|
20383
|
+
pubkey: bondingCurveV2Pda(mint),
|
|
20384
|
+
isWritable: false,
|
|
20385
|
+
isSigner: false
|
|
20386
|
+
}
|
|
20387
|
+
]).instruction();
|
|
20411
20388
|
}
|
|
20412
20389
|
async getSellInstructionRaw({
|
|
20413
20390
|
user,
|
|
@@ -20459,17 +20436,28 @@ var PumpSdk = class {
|
|
|
20459
20436
|
pubkey: userVolumeAccumulator,
|
|
20460
20437
|
isWritable: true,
|
|
20461
20438
|
isSigner: false
|
|
20439
|
+
},
|
|
20440
|
+
{
|
|
20441
|
+
pubkey: bondingCurveV2Pda(mint),
|
|
20442
|
+
isWritable: false,
|
|
20443
|
+
isSigner: false
|
|
20444
|
+
}
|
|
20445
|
+
] : [
|
|
20446
|
+
{
|
|
20447
|
+
pubkey: bondingCurveV2Pda(mint),
|
|
20448
|
+
isWritable: false,
|
|
20449
|
+
isSigner: false
|
|
20462
20450
|
}
|
|
20463
|
-
]
|
|
20451
|
+
]
|
|
20464
20452
|
).instruction();
|
|
20465
20453
|
}
|
|
20466
20454
|
/**
|
|
20467
20455
|
* Creates a fee sharing configuration for a token.
|
|
20468
20456
|
*
|
|
20469
20457
|
* @param params - Parameters for creating a fee sharing configuration
|
|
20470
|
-
* @param params.creator - The creator of the token
|
|
20458
|
+
* @param params.creator - The creator of the token
|
|
20471
20459
|
* @param params.mint - The mint address of the token
|
|
20472
|
-
* @param params.pool - The pool address of the token
|
|
20460
|
+
* @param params.pool - The pool address of the token (null for ungraduated coins)
|
|
20473
20461
|
*/
|
|
20474
20462
|
async createFeeSharingConfig({
|
|
20475
20463
|
creator,
|
|
@@ -20620,154 +20608,6 @@ var PumpSdk = class {
|
|
|
20620
20608
|
user
|
|
20621
20609
|
}).instruction();
|
|
20622
20610
|
}
|
|
20623
|
-
/**
|
|
20624
|
-
* Creates a social fee PDA that can accumulate fees for a social media user.
|
|
20625
|
-
*
|
|
20626
|
-
* @param params.payer - Any signer account that pays for the transaction.
|
|
20627
|
-
* @param params.userId - Must be the GitHub user id returned by `https://api.github.com/users/<github-username>`.
|
|
20628
|
-
* The target must be a real user account with a login. E.g: Organizations are not supported.
|
|
20629
|
-
* @param params.platform - Only `github` is supported at the moment, any attempt to use other platforms will result in fee loss.
|
|
20630
|
-
* In doubt check `SUPPORTED_SOCIAL_PLATFORMS`
|
|
20631
|
-
*/
|
|
20632
|
-
async createSocialFeePda({
|
|
20633
|
-
payer,
|
|
20634
|
-
userId,
|
|
20635
|
-
platform
|
|
20636
|
-
}) {
|
|
20637
|
-
if (!SUPPORTED_SOCIAL_PLATFORMS.includes(platform)) {
|
|
20638
|
-
const supportedPlatformNames = SUPPORTED_SOCIAL_PLATFORMS.map(
|
|
20639
|
-
(supportedPlatform) => platformToString(supportedPlatform)
|
|
20640
|
-
).join(", ");
|
|
20641
|
-
throw new Error(
|
|
20642
|
-
`Unsupported platform "${platform}" for userId "${userId}". Supported platforms: ${supportedPlatformNames}.`
|
|
20643
|
-
);
|
|
20644
|
-
}
|
|
20645
|
-
return await this.offlinePumpFeeProgram.methods.createSocialFeePda(userId, platform).accountsPartial({
|
|
20646
|
-
payer,
|
|
20647
|
-
socialFeePda: socialFeePda(userId, platform)
|
|
20648
|
-
}).instruction();
|
|
20649
|
-
}
|
|
20650
|
-
normalizeSocialShareholders({
|
|
20651
|
-
newShareholders
|
|
20652
|
-
}) {
|
|
20653
|
-
const socialRecipientsToCreate = /* @__PURE__ */ new Map();
|
|
20654
|
-
const normalizedShareholders = newShareholders.map(
|
|
20655
|
-
(shareholder) => {
|
|
20656
|
-
if (shareholder.address) {
|
|
20657
|
-
return {
|
|
20658
|
-
address: shareholder.address,
|
|
20659
|
-
shareBps: shareholder.shareBps
|
|
20660
|
-
};
|
|
20661
|
-
}
|
|
20662
|
-
if (typeof shareholder.userId === "string" && typeof shareholder.platform === "number") {
|
|
20663
|
-
if (!SUPPORTED_SOCIAL_PLATFORMS.includes(shareholder.platform)) {
|
|
20664
|
-
const supportedPlatformNames = SUPPORTED_SOCIAL_PLATFORMS.map(
|
|
20665
|
-
(platform) => platformToString(platform)
|
|
20666
|
-
).join(", ");
|
|
20667
|
-
throw new Error(
|
|
20668
|
-
`Unsupported platform "${shareholder.platform}" for userId "${shareholder.userId}". Supported platforms: ${supportedPlatformNames}.`
|
|
20669
|
-
);
|
|
20670
|
-
}
|
|
20671
|
-
const recipientPda = socialFeePda(shareholder.userId, shareholder.platform);
|
|
20672
|
-
socialRecipientsToCreate.set(recipientPda.toBase58(), {
|
|
20673
|
-
userId: shareholder.userId,
|
|
20674
|
-
platform: shareholder.platform
|
|
20675
|
-
});
|
|
20676
|
-
return {
|
|
20677
|
-
address: recipientPda,
|
|
20678
|
-
shareBps: shareholder.shareBps
|
|
20679
|
-
};
|
|
20680
|
-
}
|
|
20681
|
-
throw new Error(
|
|
20682
|
-
"Each new shareholder must provide either an address or both userId and platform."
|
|
20683
|
-
);
|
|
20684
|
-
}
|
|
20685
|
-
);
|
|
20686
|
-
return {
|
|
20687
|
-
normalizedShareholders,
|
|
20688
|
-
socialRecipientsToCreate
|
|
20689
|
-
};
|
|
20690
|
-
}
|
|
20691
|
-
/**
|
|
20692
|
-
* Wrapper around `updateSharingConfig` that resolves social recipients and
|
|
20693
|
-
* initializes any missing social recipient PDAs before updating fee shares.
|
|
20694
|
-
*
|
|
20695
|
-
* Requirements:
|
|
20696
|
-
* - `authority` must sign the transaction.
|
|
20697
|
-
*
|
|
20698
|
-
* Warning:
|
|
20699
|
-
* - sharing config must exist for that mint
|
|
20700
|
-
* - `userId` must be the GitHub user id returned by `https://api.github.com/users/<github-username>`.
|
|
20701
|
-
* The target must be a real user account with a login. E.g: Organizations are not supported.
|
|
20702
|
-
* - Only `github` is supported at the moment, any attempt to use other platforms will result in fee loss. In doubt check `SUPPORTED_SOCIAL_PLATFORMS`
|
|
20703
|
-
*/
|
|
20704
|
-
async updateSharingConfigWithSocialRecipients({
|
|
20705
|
-
authority,
|
|
20706
|
-
mint,
|
|
20707
|
-
currentShareholders,
|
|
20708
|
-
newShareholders
|
|
20709
|
-
}) {
|
|
20710
|
-
const instructions = [];
|
|
20711
|
-
const { normalizedShareholders, socialRecipientsToCreate } = this.normalizeSocialShareholders({ newShareholders });
|
|
20712
|
-
for (const recipient of socialRecipientsToCreate.values()) {
|
|
20713
|
-
instructions.push(
|
|
20714
|
-
await this.createSocialFeePda({
|
|
20715
|
-
payer: authority,
|
|
20716
|
-
userId: recipient.userId,
|
|
20717
|
-
platform: recipient.platform
|
|
20718
|
-
})
|
|
20719
|
-
);
|
|
20720
|
-
}
|
|
20721
|
-
instructions.push(
|
|
20722
|
-
await this.updateFeeShares({
|
|
20723
|
-
authority,
|
|
20724
|
-
mint,
|
|
20725
|
-
currentShareholders,
|
|
20726
|
-
newShareholders: normalizedShareholders
|
|
20727
|
-
})
|
|
20728
|
-
);
|
|
20729
|
-
return instructions;
|
|
20730
|
-
}
|
|
20731
|
-
/**
|
|
20732
|
-
* Wrapper around `createFeeSharingConfig` that resolves social recipients and
|
|
20733
|
-
* initializes any missing social recipient PDAs before updating fee shares.
|
|
20734
|
-
*
|
|
20735
|
-
* Requirements:
|
|
20736
|
-
* - `creator` must sign the transaction.
|
|
20737
|
-
* - `pool` must be provided for graduated coins; use `null` for ungraduated coins.
|
|
20738
|
-
*
|
|
20739
|
-
* Warning:
|
|
20740
|
-
* - `userId` must be the GitHub user id returned by `https://api.github.com/users/<github-username>`.
|
|
20741
|
-
* The target must be a real user account with a login. E.g: Organizations are not supported.
|
|
20742
|
-
* - Only `github` is supported at the moment, any attempt to use other platforms will result in fee loss. In doubt check `SUPPORTED_SOCIAL_PLATFORMS`
|
|
20743
|
-
*/
|
|
20744
|
-
async createSharingConfigWithSocialRecipients({
|
|
20745
|
-
creator,
|
|
20746
|
-
mint,
|
|
20747
|
-
pool,
|
|
20748
|
-
newShareholders
|
|
20749
|
-
}) {
|
|
20750
|
-
const instructions = [];
|
|
20751
|
-
instructions.push(
|
|
20752
|
-
await this.createFeeSharingConfig({
|
|
20753
|
-
creator,
|
|
20754
|
-
mint,
|
|
20755
|
-
pool
|
|
20756
|
-
})
|
|
20757
|
-
);
|
|
20758
|
-
instructions.push(
|
|
20759
|
-
...await this.updateSharingConfigWithSocialRecipients({
|
|
20760
|
-
authority: creator,
|
|
20761
|
-
mint,
|
|
20762
|
-
currentShareholders: [creator],
|
|
20763
|
-
newShareholders
|
|
20764
|
-
})
|
|
20765
|
-
);
|
|
20766
|
-
return instructions;
|
|
20767
|
-
}
|
|
20768
|
-
claimSocialFeePda() {
|
|
20769
|
-
throw new Error("This function can only be called by pump and is not supported");
|
|
20770
|
-
}
|
|
20771
20611
|
};
|
|
20772
20612
|
var PUMP_SDK = new PumpSdk();
|
|
20773
20613
|
function isCreatorUsingSharingConfig({
|
|
@@ -20805,6 +20645,12 @@ function bondingCurvePda(mint) {
|
|
|
20805
20645
|
new PublicKey5(mint).toBuffer()
|
|
20806
20646
|
]);
|
|
20807
20647
|
}
|
|
20648
|
+
function bondingCurveV2Pda(mint) {
|
|
20649
|
+
return pumpPda([
|
|
20650
|
+
import_buffer.Buffer.from("bonding-curve-v2"),
|
|
20651
|
+
new PublicKey5(mint).toBuffer()
|
|
20652
|
+
]);
|
|
20653
|
+
}
|
|
20808
20654
|
function creatorVaultPda(creator) {
|
|
20809
20655
|
return pumpPda([import_buffer.Buffer.from("creator-vault"), creator.toBuffer()]);
|
|
20810
20656
|
}
|
|
@@ -20858,13 +20704,6 @@ var ammCreatorVaultPda = (creator) => {
|
|
|
20858
20704
|
PUMP_AMM_PROGRAM_ID
|
|
20859
20705
|
)[0];
|
|
20860
20706
|
};
|
|
20861
|
-
var socialFeePda = (userId, platform) => {
|
|
20862
|
-
return pumpFeePda([
|
|
20863
|
-
import_buffer.Buffer.from("social-fee-pda"),
|
|
20864
|
-
import_buffer.Buffer.from(userId),
|
|
20865
|
-
import_buffer.Buffer.from([platform])
|
|
20866
|
-
]);
|
|
20867
|
-
};
|
|
20868
20707
|
export {
|
|
20869
20708
|
AMM_GLOBAL_PDA,
|
|
20870
20709
|
AMM_GLOBAL_VOLUME_ACCUMULATOR_PDA,
|
|
@@ -20885,16 +20724,15 @@ export {
|
|
|
20885
20724
|
PUMP_FEE_PROGRAM_ID,
|
|
20886
20725
|
PUMP_PROGRAM_ID,
|
|
20887
20726
|
PUMP_SDK,
|
|
20888
|
-
Platform,
|
|
20889
20727
|
PoolRequiredForGraduatedError,
|
|
20890
20728
|
PumpSdk,
|
|
20891
|
-
SUPPORTED_SOCIAL_PLATFORMS,
|
|
20892
20729
|
ShareCalculationOverflowError,
|
|
20893
20730
|
TooManyShareholdersError,
|
|
20894
20731
|
ZeroShareError,
|
|
20895
20732
|
ammCreatorVaultPda,
|
|
20896
20733
|
bondingCurveMarketCap,
|
|
20897
20734
|
bondingCurvePda,
|
|
20735
|
+
bondingCurveV2Pda,
|
|
20898
20736
|
canonicalPumpPoolPda,
|
|
20899
20737
|
creatorVaultPda,
|
|
20900
20738
|
currentDayTokens,
|
|
@@ -20912,11 +20750,8 @@ export {
|
|
|
20912
20750
|
getTokenVaultPda,
|
|
20913
20751
|
isCreatorUsingSharingConfig,
|
|
20914
20752
|
newBondingCurve,
|
|
20915
|
-
platformToString,
|
|
20916
20753
|
pump_default as pumpIdl,
|
|
20917
20754
|
pumpPoolAuthorityPda,
|
|
20918
|
-
socialFeePda,
|
|
20919
|
-
stringToPlatform,
|
|
20920
20755
|
totalUnclaimedTokens,
|
|
20921
20756
|
userVolumeAccumulatorPda
|
|
20922
20757
|
};
|
package/dist/index.d.mts
CHANGED
|
@@ -16814,17 +16814,6 @@ interface PumpFees {
|
|
|
16814
16814
|
];
|
|
16815
16815
|
}
|
|
16816
16816
|
|
|
16817
|
-
/**
|
|
16818
|
-
* Platform identifiers for social handle mappings.
|
|
16819
|
-
*/
|
|
16820
|
-
declare enum Platform {
|
|
16821
|
-
Pump = 0,
|
|
16822
|
-
X = 1,
|
|
16823
|
-
GitHub = 2
|
|
16824
|
-
}
|
|
16825
|
-
declare const SUPPORTED_SOCIAL_PLATFORMS: Platform[];
|
|
16826
|
-
declare const stringToPlatform: (value: string) => Platform;
|
|
16827
|
-
declare const platformToString: (platform: Platform) => string;
|
|
16828
16817
|
interface Global {
|
|
16829
16818
|
initialized: boolean;
|
|
16830
16819
|
authority: PublicKey;
|
|
@@ -16955,6 +16944,7 @@ declare const PUMP_AMM_EVENT_AUTHORITY_PDA: PublicKey;
|
|
|
16955
16944
|
declare const PUMP_FEE_EVENT_AUTHORITY_PDA: PublicKey;
|
|
16956
16945
|
declare function getEventAuthorityPda(programId: PublicKey): PublicKey;
|
|
16957
16946
|
declare function bondingCurvePda(mint: PublicKeyInitData): PublicKey;
|
|
16947
|
+
declare function bondingCurveV2Pda(mint: PublicKeyInitData): PublicKey;
|
|
16958
16948
|
declare function creatorVaultPda(creator: PublicKey): PublicKey;
|
|
16959
16949
|
declare function pumpPoolAuthorityPda(mint: PublicKey): PublicKey;
|
|
16960
16950
|
declare const CANONICAL_POOL_INDEX = 0;
|
|
@@ -16966,7 +16956,6 @@ declare const getSolVaultPda: () => PublicKey;
|
|
|
16966
16956
|
declare const getTokenVaultPda: (mintPubkey: PublicKey) => PublicKey;
|
|
16967
16957
|
declare const feeSharingConfigPda: (mint: PublicKey) => PublicKey;
|
|
16968
16958
|
declare const ammCreatorVaultPda: (creator: PublicKey) => PublicKey;
|
|
16969
|
-
declare const socialFeePda: (userId: string, platform: number) => PublicKey;
|
|
16970
16959
|
|
|
16971
16960
|
/**
|
|
16972
16961
|
* Program IDL in camelCase format in order to be used in JS/TS.
|
|
@@ -22739,9 +22728,9 @@ declare class PumpSdk {
|
|
|
22739
22728
|
* Creates a fee sharing configuration for a token.
|
|
22740
22729
|
*
|
|
22741
22730
|
* @param params - Parameters for creating a fee sharing configuration
|
|
22742
|
-
* @param params.creator - The creator of the token
|
|
22731
|
+
* @param params.creator - The creator of the token
|
|
22743
22732
|
* @param params.mint - The mint address of the token
|
|
22744
|
-
* @param params.pool - The pool address of the token
|
|
22733
|
+
* @param params.pool - The pool address of the token (null for ungraduated coins)
|
|
22745
22734
|
*/
|
|
22746
22735
|
createFeeSharingConfig({ creator, mint, pool, }: {
|
|
22747
22736
|
creator: PublicKey;
|
|
@@ -22803,83 +22792,6 @@ declare class PumpSdk {
|
|
|
22803
22792
|
claimCashbackInstruction({ user, }: {
|
|
22804
22793
|
user: PublicKey;
|
|
22805
22794
|
}): Promise<TransactionInstruction>;
|
|
22806
|
-
/**
|
|
22807
|
-
* Creates a social fee PDA that can accumulate fees for a social media user.
|
|
22808
|
-
*
|
|
22809
|
-
* @param params.payer - Any signer account that pays for the transaction.
|
|
22810
|
-
* @param params.userId - Must be the GitHub user id returned by `https://api.github.com/users/<github-username>`.
|
|
22811
|
-
* The target must be a real user account with a login. E.g: Organizations are not supported.
|
|
22812
|
-
* @param params.platform - Only `github` is supported at the moment, any attempt to use other platforms will result in fee loss.
|
|
22813
|
-
* In doubt check `SUPPORTED_SOCIAL_PLATFORMS`
|
|
22814
|
-
*/
|
|
22815
|
-
createSocialFeePda({ payer, userId, platform, }: {
|
|
22816
|
-
payer: PublicKey;
|
|
22817
|
-
userId: string;
|
|
22818
|
-
platform: Platform;
|
|
22819
|
-
}): Promise<TransactionInstruction>;
|
|
22820
|
-
normalizeSocialShareholders({ newShareholders, }: {
|
|
22821
|
-
newShareholders: Array<{
|
|
22822
|
-
shareBps: number;
|
|
22823
|
-
address?: PublicKey;
|
|
22824
|
-
userId?: string;
|
|
22825
|
-
platform?: Platform;
|
|
22826
|
-
}>;
|
|
22827
|
-
}): {
|
|
22828
|
-
normalizedShareholders: Shareholder[];
|
|
22829
|
-
socialRecipientsToCreate: Map<string, {
|
|
22830
|
-
userId: string;
|
|
22831
|
-
platform: Platform;
|
|
22832
|
-
}>;
|
|
22833
|
-
};
|
|
22834
|
-
/**
|
|
22835
|
-
* Wrapper around `updateSharingConfig` that resolves social recipients and
|
|
22836
|
-
* initializes any missing social recipient PDAs before updating fee shares.
|
|
22837
|
-
*
|
|
22838
|
-
* Requirements:
|
|
22839
|
-
* - `authority` must sign the transaction.
|
|
22840
|
-
*
|
|
22841
|
-
* Warning:
|
|
22842
|
-
* - sharing config must exist for that mint
|
|
22843
|
-
* - `userId` must be the GitHub user id returned by `https://api.github.com/users/<github-username>`.
|
|
22844
|
-
* The target must be a real user account with a login. E.g: Organizations are not supported.
|
|
22845
|
-
* - Only `github` is supported at the moment, any attempt to use other platforms will result in fee loss. In doubt check `SUPPORTED_SOCIAL_PLATFORMS`
|
|
22846
|
-
*/
|
|
22847
|
-
updateSharingConfigWithSocialRecipients({ authority, mint, currentShareholders, newShareholders, }: {
|
|
22848
|
-
authority: PublicKey;
|
|
22849
|
-
mint: PublicKey;
|
|
22850
|
-
currentShareholders: PublicKey[];
|
|
22851
|
-
newShareholders: Array<{
|
|
22852
|
-
shareBps: number;
|
|
22853
|
-
address?: PublicKey;
|
|
22854
|
-
userId?: string;
|
|
22855
|
-
platform?: Platform;
|
|
22856
|
-
}>;
|
|
22857
|
-
}): Promise<TransactionInstruction[]>;
|
|
22858
|
-
/**
|
|
22859
|
-
* Wrapper around `createFeeSharingConfig` that resolves social recipients and
|
|
22860
|
-
* initializes any missing social recipient PDAs before updating fee shares.
|
|
22861
|
-
*
|
|
22862
|
-
* Requirements:
|
|
22863
|
-
* - `creator` must sign the transaction.
|
|
22864
|
-
* - `pool` must be provided for graduated coins; use `null` for ungraduated coins.
|
|
22865
|
-
*
|
|
22866
|
-
* Warning:
|
|
22867
|
-
* - `userId` must be the GitHub user id returned by `https://api.github.com/users/<github-username>`.
|
|
22868
|
-
* The target must be a real user account with a login. E.g: Organizations are not supported.
|
|
22869
|
-
* - Only `github` is supported at the moment, any attempt to use other platforms will result in fee loss. In doubt check `SUPPORTED_SOCIAL_PLATFORMS`
|
|
22870
|
-
*/
|
|
22871
|
-
createSharingConfigWithSocialRecipients({ creator, mint, pool, newShareholders, }: {
|
|
22872
|
-
creator: PublicKey;
|
|
22873
|
-
mint: PublicKey;
|
|
22874
|
-
pool: PublicKey | null;
|
|
22875
|
-
newShareholders: Array<{
|
|
22876
|
-
shareBps: number;
|
|
22877
|
-
address?: PublicKey;
|
|
22878
|
-
userId?: string;
|
|
22879
|
-
platform?: Platform;
|
|
22880
|
-
}>;
|
|
22881
|
-
}): Promise<TransactionInstruction[]>;
|
|
22882
|
-
claimSocialFeePda(): void;
|
|
22883
22795
|
}
|
|
22884
22796
|
declare const PUMP_SDK: PumpSdk;
|
|
22885
22797
|
/**
|
|
@@ -23026,4 +22938,4 @@ declare class PoolRequiredForGraduatedError extends Error {
|
|
|
23026
22938
|
constructor();
|
|
23027
22939
|
}
|
|
23028
22940
|
|
|
23029
|
-
export { AMM_GLOBAL_PDA, AMM_GLOBAL_VOLUME_ACCUMULATOR_PDA, BONDING_CURVE_NEW_SIZE, type BondingCurve, CANONICAL_POOL_INDEX, type DistributeCreatorFeeResult, type DistributeCreatorFeesEvent, DuplicateShareholderError, type FeeConfig, GLOBAL_PDA, GLOBAL_VOLUME_ACCUMULATOR_PDA, type Global, type GlobalVolumeAccumulator, InvalidShareTotalError, MAYHEM_PROGRAM_ID, type MinimumDistributableFeeEvent, type MinimumDistributableFeeResult, NoShareholdersError, OnlinePumpSdk, PUMP_AMM_EVENT_AUTHORITY_PDA, PUMP_AMM_PROGRAM_ID, PUMP_EVENT_AUTHORITY_PDA, PUMP_FEE_CONFIG_PDA, PUMP_FEE_EVENT_AUTHORITY_PDA, PUMP_FEE_PROGRAM_ID, PUMP_PROGRAM_ID, PUMP_SDK,
|
|
22941
|
+
export { AMM_GLOBAL_PDA, AMM_GLOBAL_VOLUME_ACCUMULATOR_PDA, BONDING_CURVE_NEW_SIZE, type BondingCurve, CANONICAL_POOL_INDEX, type DistributeCreatorFeeResult, type DistributeCreatorFeesEvent, DuplicateShareholderError, type FeeConfig, GLOBAL_PDA, GLOBAL_VOLUME_ACCUMULATOR_PDA, type Global, type GlobalVolumeAccumulator, InvalidShareTotalError, MAYHEM_PROGRAM_ID, type MinimumDistributableFeeEvent, type MinimumDistributableFeeResult, NoShareholdersError, OnlinePumpSdk, PUMP_AMM_EVENT_AUTHORITY_PDA, PUMP_AMM_PROGRAM_ID, PUMP_EVENT_AUTHORITY_PDA, PUMP_FEE_CONFIG_PDA, PUMP_FEE_EVENT_AUTHORITY_PDA, PUMP_FEE_PROGRAM_ID, PUMP_PROGRAM_ID, PUMP_SDK, PoolRequiredForGraduatedError, type Pump, type PumpFees, PumpSdk, ShareCalculationOverflowError, type Shareholder, type SharingConfig, TooManyShareholdersError, type UserVolumeAccumulator, type UserVolumeAccumulatorTotalStats, ZeroShareError, ammCreatorVaultPda, bondingCurveMarketCap, bondingCurvePda, bondingCurveV2Pda, canonicalPumpPoolPda, creatorVaultPda, currentDayTokens, feeSharingConfigPda, getBuySolAmountFromTokenAmount, getBuyTokenAmountFromSolAmount, getEventAuthorityPda, getGlobalParamsPda, getMayhemStatePda, getPumpAmmProgram, getPumpFeeProgram, getPumpProgram, getSellSolAmountFromTokenAmount, getSolVaultPda, getTokenVaultPda, isCreatorUsingSharingConfig, newBondingCurve, pump as pumpIdl, pumpPoolAuthorityPda, totalUnclaimedTokens, userVolumeAccumulatorPda };
|
package/dist/index.d.ts
CHANGED
|
@@ -16814,17 +16814,6 @@ interface PumpFees {
|
|
|
16814
16814
|
];
|
|
16815
16815
|
}
|
|
16816
16816
|
|
|
16817
|
-
/**
|
|
16818
|
-
* Platform identifiers for social handle mappings.
|
|
16819
|
-
*/
|
|
16820
|
-
declare enum Platform {
|
|
16821
|
-
Pump = 0,
|
|
16822
|
-
X = 1,
|
|
16823
|
-
GitHub = 2
|
|
16824
|
-
}
|
|
16825
|
-
declare const SUPPORTED_SOCIAL_PLATFORMS: Platform[];
|
|
16826
|
-
declare const stringToPlatform: (value: string) => Platform;
|
|
16827
|
-
declare const platformToString: (platform: Platform) => string;
|
|
16828
16817
|
interface Global {
|
|
16829
16818
|
initialized: boolean;
|
|
16830
16819
|
authority: PublicKey;
|
|
@@ -16955,6 +16944,7 @@ declare const PUMP_AMM_EVENT_AUTHORITY_PDA: PublicKey;
|
|
|
16955
16944
|
declare const PUMP_FEE_EVENT_AUTHORITY_PDA: PublicKey;
|
|
16956
16945
|
declare function getEventAuthorityPda(programId: PublicKey): PublicKey;
|
|
16957
16946
|
declare function bondingCurvePda(mint: PublicKeyInitData): PublicKey;
|
|
16947
|
+
declare function bondingCurveV2Pda(mint: PublicKeyInitData): PublicKey;
|
|
16958
16948
|
declare function creatorVaultPda(creator: PublicKey): PublicKey;
|
|
16959
16949
|
declare function pumpPoolAuthorityPda(mint: PublicKey): PublicKey;
|
|
16960
16950
|
declare const CANONICAL_POOL_INDEX = 0;
|
|
@@ -16966,7 +16956,6 @@ declare const getSolVaultPda: () => PublicKey;
|
|
|
16966
16956
|
declare const getTokenVaultPda: (mintPubkey: PublicKey) => PublicKey;
|
|
16967
16957
|
declare const feeSharingConfigPda: (mint: PublicKey) => PublicKey;
|
|
16968
16958
|
declare const ammCreatorVaultPda: (creator: PublicKey) => PublicKey;
|
|
16969
|
-
declare const socialFeePda: (userId: string, platform: number) => PublicKey;
|
|
16970
16959
|
|
|
16971
16960
|
/**
|
|
16972
16961
|
* Program IDL in camelCase format in order to be used in JS/TS.
|
|
@@ -22739,9 +22728,9 @@ declare class PumpSdk {
|
|
|
22739
22728
|
* Creates a fee sharing configuration for a token.
|
|
22740
22729
|
*
|
|
22741
22730
|
* @param params - Parameters for creating a fee sharing configuration
|
|
22742
|
-
* @param params.creator - The creator of the token
|
|
22731
|
+
* @param params.creator - The creator of the token
|
|
22743
22732
|
* @param params.mint - The mint address of the token
|
|
22744
|
-
* @param params.pool - The pool address of the token
|
|
22733
|
+
* @param params.pool - The pool address of the token (null for ungraduated coins)
|
|
22745
22734
|
*/
|
|
22746
22735
|
createFeeSharingConfig({ creator, mint, pool, }: {
|
|
22747
22736
|
creator: PublicKey;
|
|
@@ -22803,83 +22792,6 @@ declare class PumpSdk {
|
|
|
22803
22792
|
claimCashbackInstruction({ user, }: {
|
|
22804
22793
|
user: PublicKey;
|
|
22805
22794
|
}): Promise<TransactionInstruction>;
|
|
22806
|
-
/**
|
|
22807
|
-
* Creates a social fee PDA that can accumulate fees for a social media user.
|
|
22808
|
-
*
|
|
22809
|
-
* @param params.payer - Any signer account that pays for the transaction.
|
|
22810
|
-
* @param params.userId - Must be the GitHub user id returned by `https://api.github.com/users/<github-username>`.
|
|
22811
|
-
* The target must be a real user account with a login. E.g: Organizations are not supported.
|
|
22812
|
-
* @param params.platform - Only `github` is supported at the moment, any attempt to use other platforms will result in fee loss.
|
|
22813
|
-
* In doubt check `SUPPORTED_SOCIAL_PLATFORMS`
|
|
22814
|
-
*/
|
|
22815
|
-
createSocialFeePda({ payer, userId, platform, }: {
|
|
22816
|
-
payer: PublicKey;
|
|
22817
|
-
userId: string;
|
|
22818
|
-
platform: Platform;
|
|
22819
|
-
}): Promise<TransactionInstruction>;
|
|
22820
|
-
normalizeSocialShareholders({ newShareholders, }: {
|
|
22821
|
-
newShareholders: Array<{
|
|
22822
|
-
shareBps: number;
|
|
22823
|
-
address?: PublicKey;
|
|
22824
|
-
userId?: string;
|
|
22825
|
-
platform?: Platform;
|
|
22826
|
-
}>;
|
|
22827
|
-
}): {
|
|
22828
|
-
normalizedShareholders: Shareholder[];
|
|
22829
|
-
socialRecipientsToCreate: Map<string, {
|
|
22830
|
-
userId: string;
|
|
22831
|
-
platform: Platform;
|
|
22832
|
-
}>;
|
|
22833
|
-
};
|
|
22834
|
-
/**
|
|
22835
|
-
* Wrapper around `updateSharingConfig` that resolves social recipients and
|
|
22836
|
-
* initializes any missing social recipient PDAs before updating fee shares.
|
|
22837
|
-
*
|
|
22838
|
-
* Requirements:
|
|
22839
|
-
* - `authority` must sign the transaction.
|
|
22840
|
-
*
|
|
22841
|
-
* Warning:
|
|
22842
|
-
* - sharing config must exist for that mint
|
|
22843
|
-
* - `userId` must be the GitHub user id returned by `https://api.github.com/users/<github-username>`.
|
|
22844
|
-
* The target must be a real user account with a login. E.g: Organizations are not supported.
|
|
22845
|
-
* - Only `github` is supported at the moment, any attempt to use other platforms will result in fee loss. In doubt check `SUPPORTED_SOCIAL_PLATFORMS`
|
|
22846
|
-
*/
|
|
22847
|
-
updateSharingConfigWithSocialRecipients({ authority, mint, currentShareholders, newShareholders, }: {
|
|
22848
|
-
authority: PublicKey;
|
|
22849
|
-
mint: PublicKey;
|
|
22850
|
-
currentShareholders: PublicKey[];
|
|
22851
|
-
newShareholders: Array<{
|
|
22852
|
-
shareBps: number;
|
|
22853
|
-
address?: PublicKey;
|
|
22854
|
-
userId?: string;
|
|
22855
|
-
platform?: Platform;
|
|
22856
|
-
}>;
|
|
22857
|
-
}): Promise<TransactionInstruction[]>;
|
|
22858
|
-
/**
|
|
22859
|
-
* Wrapper around `createFeeSharingConfig` that resolves social recipients and
|
|
22860
|
-
* initializes any missing social recipient PDAs before updating fee shares.
|
|
22861
|
-
*
|
|
22862
|
-
* Requirements:
|
|
22863
|
-
* - `creator` must sign the transaction.
|
|
22864
|
-
* - `pool` must be provided for graduated coins; use `null` for ungraduated coins.
|
|
22865
|
-
*
|
|
22866
|
-
* Warning:
|
|
22867
|
-
* - `userId` must be the GitHub user id returned by `https://api.github.com/users/<github-username>`.
|
|
22868
|
-
* The target must be a real user account with a login. E.g: Organizations are not supported.
|
|
22869
|
-
* - Only `github` is supported at the moment, any attempt to use other platforms will result in fee loss. In doubt check `SUPPORTED_SOCIAL_PLATFORMS`
|
|
22870
|
-
*/
|
|
22871
|
-
createSharingConfigWithSocialRecipients({ creator, mint, pool, newShareholders, }: {
|
|
22872
|
-
creator: PublicKey;
|
|
22873
|
-
mint: PublicKey;
|
|
22874
|
-
pool: PublicKey | null;
|
|
22875
|
-
newShareholders: Array<{
|
|
22876
|
-
shareBps: number;
|
|
22877
|
-
address?: PublicKey;
|
|
22878
|
-
userId?: string;
|
|
22879
|
-
platform?: Platform;
|
|
22880
|
-
}>;
|
|
22881
|
-
}): Promise<TransactionInstruction[]>;
|
|
22882
|
-
claimSocialFeePda(): void;
|
|
22883
22795
|
}
|
|
22884
22796
|
declare const PUMP_SDK: PumpSdk;
|
|
22885
22797
|
/**
|
|
@@ -23026,4 +22938,4 @@ declare class PoolRequiredForGraduatedError extends Error {
|
|
|
23026
22938
|
constructor();
|
|
23027
22939
|
}
|
|
23028
22940
|
|
|
23029
|
-
export { AMM_GLOBAL_PDA, AMM_GLOBAL_VOLUME_ACCUMULATOR_PDA, BONDING_CURVE_NEW_SIZE, type BondingCurve, CANONICAL_POOL_INDEX, type DistributeCreatorFeeResult, type DistributeCreatorFeesEvent, DuplicateShareholderError, type FeeConfig, GLOBAL_PDA, GLOBAL_VOLUME_ACCUMULATOR_PDA, type Global, type GlobalVolumeAccumulator, InvalidShareTotalError, MAYHEM_PROGRAM_ID, type MinimumDistributableFeeEvent, type MinimumDistributableFeeResult, NoShareholdersError, OnlinePumpSdk, PUMP_AMM_EVENT_AUTHORITY_PDA, PUMP_AMM_PROGRAM_ID, PUMP_EVENT_AUTHORITY_PDA, PUMP_FEE_CONFIG_PDA, PUMP_FEE_EVENT_AUTHORITY_PDA, PUMP_FEE_PROGRAM_ID, PUMP_PROGRAM_ID, PUMP_SDK,
|
|
22941
|
+
export { AMM_GLOBAL_PDA, AMM_GLOBAL_VOLUME_ACCUMULATOR_PDA, BONDING_CURVE_NEW_SIZE, type BondingCurve, CANONICAL_POOL_INDEX, type DistributeCreatorFeeResult, type DistributeCreatorFeesEvent, DuplicateShareholderError, type FeeConfig, GLOBAL_PDA, GLOBAL_VOLUME_ACCUMULATOR_PDA, type Global, type GlobalVolumeAccumulator, InvalidShareTotalError, MAYHEM_PROGRAM_ID, type MinimumDistributableFeeEvent, type MinimumDistributableFeeResult, NoShareholdersError, OnlinePumpSdk, PUMP_AMM_EVENT_AUTHORITY_PDA, PUMP_AMM_PROGRAM_ID, PUMP_EVENT_AUTHORITY_PDA, PUMP_FEE_CONFIG_PDA, PUMP_FEE_EVENT_AUTHORITY_PDA, PUMP_FEE_PROGRAM_ID, PUMP_PROGRAM_ID, PUMP_SDK, PoolRequiredForGraduatedError, type Pump, type PumpFees, PumpSdk, ShareCalculationOverflowError, type Shareholder, type SharingConfig, TooManyShareholdersError, type UserVolumeAccumulator, type UserVolumeAccumulatorTotalStats, ZeroShareError, ammCreatorVaultPda, bondingCurveMarketCap, bondingCurvePda, bondingCurveV2Pda, canonicalPumpPoolPda, creatorVaultPda, currentDayTokens, feeSharingConfigPda, getBuySolAmountFromTokenAmount, getBuyTokenAmountFromSolAmount, getEventAuthorityPda, getGlobalParamsPda, getMayhemStatePda, getPumpAmmProgram, getPumpFeeProgram, getPumpProgram, getSellSolAmountFromTokenAmount, getSolVaultPda, getTokenVaultPda, isCreatorUsingSharingConfig, newBondingCurve, pump as pumpIdl, pumpPoolAuthorityPda, totalUnclaimedTokens, userVolumeAccumulatorPda };
|
package/dist/index.js
CHANGED
|
@@ -1829,16 +1829,15 @@ __export(index_exports, {
|
|
|
1829
1829
|
PUMP_FEE_PROGRAM_ID: () => PUMP_FEE_PROGRAM_ID,
|
|
1830
1830
|
PUMP_PROGRAM_ID: () => PUMP_PROGRAM_ID,
|
|
1831
1831
|
PUMP_SDK: () => PUMP_SDK,
|
|
1832
|
-
Platform: () => Platform,
|
|
1833
1832
|
PoolRequiredForGraduatedError: () => PoolRequiredForGraduatedError,
|
|
1834
1833
|
PumpSdk: () => PumpSdk,
|
|
1835
|
-
SUPPORTED_SOCIAL_PLATFORMS: () => SUPPORTED_SOCIAL_PLATFORMS,
|
|
1836
1834
|
ShareCalculationOverflowError: () => ShareCalculationOverflowError,
|
|
1837
1835
|
TooManyShareholdersError: () => TooManyShareholdersError,
|
|
1838
1836
|
ZeroShareError: () => ZeroShareError,
|
|
1839
1837
|
ammCreatorVaultPda: () => ammCreatorVaultPda,
|
|
1840
1838
|
bondingCurveMarketCap: () => bondingCurveMarketCap,
|
|
1841
1839
|
bondingCurvePda: () => bondingCurvePda,
|
|
1840
|
+
bondingCurveV2Pda: () => bondingCurveV2Pda,
|
|
1842
1841
|
canonicalPumpPoolPda: () => canonicalPumpPoolPda,
|
|
1843
1842
|
creatorVaultPda: () => creatorVaultPda,
|
|
1844
1843
|
currentDayTokens: () => currentDayTokens,
|
|
@@ -1856,11 +1855,8 @@ __export(index_exports, {
|
|
|
1856
1855
|
getTokenVaultPda: () => getTokenVaultPda,
|
|
1857
1856
|
isCreatorUsingSharingConfig: () => isCreatorUsingSharingConfig,
|
|
1858
1857
|
newBondingCurve: () => newBondingCurve,
|
|
1859
|
-
platformToString: () => platformToString,
|
|
1860
1858
|
pumpIdl: () => pump_default,
|
|
1861
1859
|
pumpPoolAuthorityPda: () => pumpPoolAuthorityPda,
|
|
1862
|
-
socialFeePda: () => socialFeePda,
|
|
1863
|
-
stringToPlatform: () => stringToPlatform,
|
|
1864
1860
|
totalUnclaimedTokens: () => totalUnclaimedTokens,
|
|
1865
1861
|
userVolumeAccumulatorPda: () => userVolumeAccumulatorPda
|
|
1866
1862
|
});
|
|
@@ -19940,35 +19936,6 @@ var OnlinePumpSdk = class {
|
|
|
19940
19936
|
}
|
|
19941
19937
|
};
|
|
19942
19938
|
|
|
19943
|
-
// src/state.ts
|
|
19944
|
-
var Platform = /* @__PURE__ */ ((Platform3) => {
|
|
19945
|
-
Platform3[Platform3["Pump"] = 0] = "Pump";
|
|
19946
|
-
Platform3[Platform3["X"] = 1] = "X";
|
|
19947
|
-
Platform3[Platform3["GitHub"] = 2] = "GitHub";
|
|
19948
|
-
return Platform3;
|
|
19949
|
-
})(Platform || {});
|
|
19950
|
-
var SUPPORTED_SOCIAL_PLATFORMS = [2 /* GitHub */];
|
|
19951
|
-
var stringToPlatform = (value) => {
|
|
19952
|
-
const normalized = value.trim().toUpperCase();
|
|
19953
|
-
const entry = Object.entries(Platform).find(
|
|
19954
|
-
([key, val]) => typeof val === "number" && key.toUpperCase() === normalized
|
|
19955
|
-
);
|
|
19956
|
-
if (entry) {
|
|
19957
|
-
return entry[1];
|
|
19958
|
-
}
|
|
19959
|
-
const validNames = Object.entries(Platform).filter(([, val]) => typeof val === "number").map(([key]) => key.toUpperCase()).join(", ");
|
|
19960
|
-
throw new Error(
|
|
19961
|
-
`Unknown platform "${value}". Expected one of: ${validNames}`
|
|
19962
|
-
);
|
|
19963
|
-
};
|
|
19964
|
-
var platformToString = (platform) => {
|
|
19965
|
-
const name = Platform[platform];
|
|
19966
|
-
if (name !== void 0) {
|
|
19967
|
-
return name;
|
|
19968
|
-
}
|
|
19969
|
-
throw new Error(`Unknown platform value: ${platform}`);
|
|
19970
|
-
};
|
|
19971
|
-
|
|
19972
19939
|
// src/sdk.ts
|
|
19973
19940
|
function getPumpProgram(connection) {
|
|
19974
19941
|
return new import_anchor.Program(
|
|
@@ -20437,7 +20404,13 @@ var PumpSdk = class {
|
|
|
20437
20404
|
user,
|
|
20438
20405
|
creatorVault: creatorVaultPda(creator),
|
|
20439
20406
|
tokenProgram
|
|
20440
|
-
}).
|
|
20407
|
+
}).remainingAccounts([
|
|
20408
|
+
{
|
|
20409
|
+
pubkey: bondingCurveV2Pda(mint),
|
|
20410
|
+
isWritable: false,
|
|
20411
|
+
isSigner: false
|
|
20412
|
+
}
|
|
20413
|
+
]).instruction();
|
|
20441
20414
|
}
|
|
20442
20415
|
async getSellInstructionRaw({
|
|
20443
20416
|
user,
|
|
@@ -20489,17 +20462,28 @@ var PumpSdk = class {
|
|
|
20489
20462
|
pubkey: userVolumeAccumulator,
|
|
20490
20463
|
isWritable: true,
|
|
20491
20464
|
isSigner: false
|
|
20465
|
+
},
|
|
20466
|
+
{
|
|
20467
|
+
pubkey: bondingCurveV2Pda(mint),
|
|
20468
|
+
isWritable: false,
|
|
20469
|
+
isSigner: false
|
|
20470
|
+
}
|
|
20471
|
+
] : [
|
|
20472
|
+
{
|
|
20473
|
+
pubkey: bondingCurveV2Pda(mint),
|
|
20474
|
+
isWritable: false,
|
|
20475
|
+
isSigner: false
|
|
20492
20476
|
}
|
|
20493
|
-
]
|
|
20477
|
+
]
|
|
20494
20478
|
).instruction();
|
|
20495
20479
|
}
|
|
20496
20480
|
/**
|
|
20497
20481
|
* Creates a fee sharing configuration for a token.
|
|
20498
20482
|
*
|
|
20499
20483
|
* @param params - Parameters for creating a fee sharing configuration
|
|
20500
|
-
* @param params.creator - The creator of the token
|
|
20484
|
+
* @param params.creator - The creator of the token
|
|
20501
20485
|
* @param params.mint - The mint address of the token
|
|
20502
|
-
* @param params.pool - The pool address of the token
|
|
20486
|
+
* @param params.pool - The pool address of the token (null for ungraduated coins)
|
|
20503
20487
|
*/
|
|
20504
20488
|
async createFeeSharingConfig({
|
|
20505
20489
|
creator,
|
|
@@ -20650,154 +20634,6 @@ var PumpSdk = class {
|
|
|
20650
20634
|
user
|
|
20651
20635
|
}).instruction();
|
|
20652
20636
|
}
|
|
20653
|
-
/**
|
|
20654
|
-
* Creates a social fee PDA that can accumulate fees for a social media user.
|
|
20655
|
-
*
|
|
20656
|
-
* @param params.payer - Any signer account that pays for the transaction.
|
|
20657
|
-
* @param params.userId - Must be the GitHub user id returned by `https://api.github.com/users/<github-username>`.
|
|
20658
|
-
* The target must be a real user account with a login. E.g: Organizations are not supported.
|
|
20659
|
-
* @param params.platform - Only `github` is supported at the moment, any attempt to use other platforms will result in fee loss.
|
|
20660
|
-
* In doubt check `SUPPORTED_SOCIAL_PLATFORMS`
|
|
20661
|
-
*/
|
|
20662
|
-
async createSocialFeePda({
|
|
20663
|
-
payer,
|
|
20664
|
-
userId,
|
|
20665
|
-
platform
|
|
20666
|
-
}) {
|
|
20667
|
-
if (!SUPPORTED_SOCIAL_PLATFORMS.includes(platform)) {
|
|
20668
|
-
const supportedPlatformNames = SUPPORTED_SOCIAL_PLATFORMS.map(
|
|
20669
|
-
(supportedPlatform) => platformToString(supportedPlatform)
|
|
20670
|
-
).join(", ");
|
|
20671
|
-
throw new Error(
|
|
20672
|
-
`Unsupported platform "${platform}" for userId "${userId}". Supported platforms: ${supportedPlatformNames}.`
|
|
20673
|
-
);
|
|
20674
|
-
}
|
|
20675
|
-
return await this.offlinePumpFeeProgram.methods.createSocialFeePda(userId, platform).accountsPartial({
|
|
20676
|
-
payer,
|
|
20677
|
-
socialFeePda: socialFeePda(userId, platform)
|
|
20678
|
-
}).instruction();
|
|
20679
|
-
}
|
|
20680
|
-
normalizeSocialShareholders({
|
|
20681
|
-
newShareholders
|
|
20682
|
-
}) {
|
|
20683
|
-
const socialRecipientsToCreate = /* @__PURE__ */ new Map();
|
|
20684
|
-
const normalizedShareholders = newShareholders.map(
|
|
20685
|
-
(shareholder) => {
|
|
20686
|
-
if (shareholder.address) {
|
|
20687
|
-
return {
|
|
20688
|
-
address: shareholder.address,
|
|
20689
|
-
shareBps: shareholder.shareBps
|
|
20690
|
-
};
|
|
20691
|
-
}
|
|
20692
|
-
if (typeof shareholder.userId === "string" && typeof shareholder.platform === "number") {
|
|
20693
|
-
if (!SUPPORTED_SOCIAL_PLATFORMS.includes(shareholder.platform)) {
|
|
20694
|
-
const supportedPlatformNames = SUPPORTED_SOCIAL_PLATFORMS.map(
|
|
20695
|
-
(platform) => platformToString(platform)
|
|
20696
|
-
).join(", ");
|
|
20697
|
-
throw new Error(
|
|
20698
|
-
`Unsupported platform "${shareholder.platform}" for userId "${shareholder.userId}". Supported platforms: ${supportedPlatformNames}.`
|
|
20699
|
-
);
|
|
20700
|
-
}
|
|
20701
|
-
const recipientPda = socialFeePda(shareholder.userId, shareholder.platform);
|
|
20702
|
-
socialRecipientsToCreate.set(recipientPda.toBase58(), {
|
|
20703
|
-
userId: shareholder.userId,
|
|
20704
|
-
platform: shareholder.platform
|
|
20705
|
-
});
|
|
20706
|
-
return {
|
|
20707
|
-
address: recipientPda,
|
|
20708
|
-
shareBps: shareholder.shareBps
|
|
20709
|
-
};
|
|
20710
|
-
}
|
|
20711
|
-
throw new Error(
|
|
20712
|
-
"Each new shareholder must provide either an address or both userId and platform."
|
|
20713
|
-
);
|
|
20714
|
-
}
|
|
20715
|
-
);
|
|
20716
|
-
return {
|
|
20717
|
-
normalizedShareholders,
|
|
20718
|
-
socialRecipientsToCreate
|
|
20719
|
-
};
|
|
20720
|
-
}
|
|
20721
|
-
/**
|
|
20722
|
-
* Wrapper around `updateSharingConfig` that resolves social recipients and
|
|
20723
|
-
* initializes any missing social recipient PDAs before updating fee shares.
|
|
20724
|
-
*
|
|
20725
|
-
* Requirements:
|
|
20726
|
-
* - `authority` must sign the transaction.
|
|
20727
|
-
*
|
|
20728
|
-
* Warning:
|
|
20729
|
-
* - sharing config must exist for that mint
|
|
20730
|
-
* - `userId` must be the GitHub user id returned by `https://api.github.com/users/<github-username>`.
|
|
20731
|
-
* The target must be a real user account with a login. E.g: Organizations are not supported.
|
|
20732
|
-
* - Only `github` is supported at the moment, any attempt to use other platforms will result in fee loss. In doubt check `SUPPORTED_SOCIAL_PLATFORMS`
|
|
20733
|
-
*/
|
|
20734
|
-
async updateSharingConfigWithSocialRecipients({
|
|
20735
|
-
authority,
|
|
20736
|
-
mint,
|
|
20737
|
-
currentShareholders,
|
|
20738
|
-
newShareholders
|
|
20739
|
-
}) {
|
|
20740
|
-
const instructions = [];
|
|
20741
|
-
const { normalizedShareholders, socialRecipientsToCreate } = this.normalizeSocialShareholders({ newShareholders });
|
|
20742
|
-
for (const recipient of socialRecipientsToCreate.values()) {
|
|
20743
|
-
instructions.push(
|
|
20744
|
-
await this.createSocialFeePda({
|
|
20745
|
-
payer: authority,
|
|
20746
|
-
userId: recipient.userId,
|
|
20747
|
-
platform: recipient.platform
|
|
20748
|
-
})
|
|
20749
|
-
);
|
|
20750
|
-
}
|
|
20751
|
-
instructions.push(
|
|
20752
|
-
await this.updateFeeShares({
|
|
20753
|
-
authority,
|
|
20754
|
-
mint,
|
|
20755
|
-
currentShareholders,
|
|
20756
|
-
newShareholders: normalizedShareholders
|
|
20757
|
-
})
|
|
20758
|
-
);
|
|
20759
|
-
return instructions;
|
|
20760
|
-
}
|
|
20761
|
-
/**
|
|
20762
|
-
* Wrapper around `createFeeSharingConfig` that resolves social recipients and
|
|
20763
|
-
* initializes any missing social recipient PDAs before updating fee shares.
|
|
20764
|
-
*
|
|
20765
|
-
* Requirements:
|
|
20766
|
-
* - `creator` must sign the transaction.
|
|
20767
|
-
* - `pool` must be provided for graduated coins; use `null` for ungraduated coins.
|
|
20768
|
-
*
|
|
20769
|
-
* Warning:
|
|
20770
|
-
* - `userId` must be the GitHub user id returned by `https://api.github.com/users/<github-username>`.
|
|
20771
|
-
* The target must be a real user account with a login. E.g: Organizations are not supported.
|
|
20772
|
-
* - Only `github` is supported at the moment, any attempt to use other platforms will result in fee loss. In doubt check `SUPPORTED_SOCIAL_PLATFORMS`
|
|
20773
|
-
*/
|
|
20774
|
-
async createSharingConfigWithSocialRecipients({
|
|
20775
|
-
creator,
|
|
20776
|
-
mint,
|
|
20777
|
-
pool,
|
|
20778
|
-
newShareholders
|
|
20779
|
-
}) {
|
|
20780
|
-
const instructions = [];
|
|
20781
|
-
instructions.push(
|
|
20782
|
-
await this.createFeeSharingConfig({
|
|
20783
|
-
creator,
|
|
20784
|
-
mint,
|
|
20785
|
-
pool
|
|
20786
|
-
})
|
|
20787
|
-
);
|
|
20788
|
-
instructions.push(
|
|
20789
|
-
...await this.updateSharingConfigWithSocialRecipients({
|
|
20790
|
-
authority: creator,
|
|
20791
|
-
mint,
|
|
20792
|
-
currentShareholders: [creator],
|
|
20793
|
-
newShareholders
|
|
20794
|
-
})
|
|
20795
|
-
);
|
|
20796
|
-
return instructions;
|
|
20797
|
-
}
|
|
20798
|
-
claimSocialFeePda() {
|
|
20799
|
-
throw new Error("This function can only be called by pump and is not supported");
|
|
20800
|
-
}
|
|
20801
20637
|
};
|
|
20802
20638
|
var PUMP_SDK = new PumpSdk();
|
|
20803
20639
|
function isCreatorUsingSharingConfig({
|
|
@@ -20835,6 +20671,12 @@ function bondingCurvePda(mint) {
|
|
|
20835
20671
|
new import_web35.PublicKey(mint).toBuffer()
|
|
20836
20672
|
]);
|
|
20837
20673
|
}
|
|
20674
|
+
function bondingCurveV2Pda(mint) {
|
|
20675
|
+
return (0, import_pump_swap_sdk3.pumpPda)([
|
|
20676
|
+
import_buffer.Buffer.from("bonding-curve-v2"),
|
|
20677
|
+
new import_web35.PublicKey(mint).toBuffer()
|
|
20678
|
+
]);
|
|
20679
|
+
}
|
|
20838
20680
|
function creatorVaultPda(creator) {
|
|
20839
20681
|
return (0, import_pump_swap_sdk3.pumpPda)([import_buffer.Buffer.from("creator-vault"), creator.toBuffer()]);
|
|
20840
20682
|
}
|
|
@@ -20888,13 +20730,6 @@ var ammCreatorVaultPda = (creator) => {
|
|
|
20888
20730
|
PUMP_AMM_PROGRAM_ID
|
|
20889
20731
|
)[0];
|
|
20890
20732
|
};
|
|
20891
|
-
var socialFeePda = (userId, platform) => {
|
|
20892
|
-
return (0, import_pump_swap_sdk3.pumpFeePda)([
|
|
20893
|
-
import_buffer.Buffer.from("social-fee-pda"),
|
|
20894
|
-
import_buffer.Buffer.from(userId),
|
|
20895
|
-
import_buffer.Buffer.from([platform])
|
|
20896
|
-
]);
|
|
20897
|
-
};
|
|
20898
20733
|
/*! Bundled license information:
|
|
20899
20734
|
|
|
20900
20735
|
ieee754/index.js:
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -38,10 +38,6 @@ export {
|
|
|
38
38
|
SharingConfig,
|
|
39
39
|
DistributeCreatorFeesEvent,
|
|
40
40
|
MinimumDistributableFeeEvent,
|
|
41
|
-
Platform,
|
|
42
|
-
SUPPORTED_SOCIAL_PLATFORMS,
|
|
43
|
-
platformToString,
|
|
44
|
-
stringToPlatform
|
|
45
41
|
} from "./state";
|
|
46
42
|
export { totalUnclaimedTokens, currentDayTokens } from "./tokenIncentives";
|
|
47
43
|
export * from "./errors";
|
package/src/pda.ts
CHANGED
|
@@ -56,6 +56,13 @@ export function bondingCurvePda(mint: PublicKeyInitData): PublicKey {
|
|
|
56
56
|
]);
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
export function bondingCurveV2Pda(mint: PublicKeyInitData): PublicKey {
|
|
60
|
+
return pumpPda([
|
|
61
|
+
Buffer.from("bonding-curve-v2"),
|
|
62
|
+
new PublicKey(mint).toBuffer(),
|
|
63
|
+
]);
|
|
64
|
+
}
|
|
65
|
+
|
|
59
66
|
export function creatorVaultPda(creator: PublicKey) {
|
|
60
67
|
return pumpPda([Buffer.from("creator-vault"), creator.toBuffer()]);
|
|
61
68
|
}
|
|
@@ -121,11 +128,3 @@ export const ammCreatorVaultPda = (creator: PublicKey): PublicKey => {
|
|
|
121
128
|
PUMP_AMM_PROGRAM_ID,
|
|
122
129
|
)[0];
|
|
123
130
|
};
|
|
124
|
-
|
|
125
|
-
export const socialFeePda = (userId: string, platform: number): PublicKey => {
|
|
126
|
-
return pumpFeePda([
|
|
127
|
-
Buffer.from("social-fee-pda"),
|
|
128
|
-
Buffer.from(userId),
|
|
129
|
-
Buffer.from([platform]),
|
|
130
|
-
]);
|
|
131
|
-
};
|
package/src/sdk.ts
CHANGED
|
@@ -45,7 +45,7 @@ import {
|
|
|
45
45
|
pumpPoolAuthorityPda,
|
|
46
46
|
feeSharingConfigPda,
|
|
47
47
|
userVolumeAccumulatorPda,
|
|
48
|
-
|
|
48
|
+
bondingCurveV2Pda,
|
|
49
49
|
} from "./pda";
|
|
50
50
|
import {
|
|
51
51
|
BondingCurve,
|
|
@@ -57,9 +57,6 @@ import {
|
|
|
57
57
|
SharingConfig,
|
|
58
58
|
DistributeCreatorFeesEvent,
|
|
59
59
|
MinimumDistributableFeeEvent,
|
|
60
|
-
Platform,
|
|
61
|
-
SUPPORTED_SOCIAL_PLATFORMS,
|
|
62
|
-
platformToString,
|
|
63
60
|
} from "./state";
|
|
64
61
|
|
|
65
62
|
export function getPumpProgram(connection: Connection): Program<Pump> {
|
|
@@ -722,6 +719,13 @@ export class PumpSdk {
|
|
|
722
719
|
creatorVault: creatorVaultPda(creator),
|
|
723
720
|
tokenProgram,
|
|
724
721
|
})
|
|
722
|
+
.remainingAccounts([
|
|
723
|
+
{
|
|
724
|
+
pubkey: bondingCurveV2Pda(mint),
|
|
725
|
+
isWritable: false,
|
|
726
|
+
isSigner: false,
|
|
727
|
+
},
|
|
728
|
+
])
|
|
725
729
|
.instruction();
|
|
726
730
|
}
|
|
727
731
|
|
|
@@ -799,8 +803,19 @@ export class PumpSdk {
|
|
|
799
803
|
isWritable: true,
|
|
800
804
|
isSigner: false,
|
|
801
805
|
},
|
|
806
|
+
{
|
|
807
|
+
pubkey: bondingCurveV2Pda(mint),
|
|
808
|
+
isWritable: false,
|
|
809
|
+
isSigner: false,
|
|
810
|
+
},
|
|
802
811
|
]
|
|
803
|
-
: [
|
|
812
|
+
: [
|
|
813
|
+
{
|
|
814
|
+
pubkey: bondingCurveV2Pda(mint),
|
|
815
|
+
isWritable: false,
|
|
816
|
+
isSigner: false,
|
|
817
|
+
},
|
|
818
|
+
],
|
|
804
819
|
)
|
|
805
820
|
.instruction();
|
|
806
821
|
}
|
|
@@ -809,9 +824,9 @@ export class PumpSdk {
|
|
|
809
824
|
* Creates a fee sharing configuration for a token.
|
|
810
825
|
*
|
|
811
826
|
* @param params - Parameters for creating a fee sharing configuration
|
|
812
|
-
* @param params.creator - The creator of the token
|
|
827
|
+
* @param params.creator - The creator of the token
|
|
813
828
|
* @param params.mint - The mint address of the token
|
|
814
|
-
* @param params.pool - The pool address of the token
|
|
829
|
+
* @param params.pool - The pool address of the token (null for ungraduated coins)
|
|
815
830
|
*/
|
|
816
831
|
async createFeeSharingConfig({
|
|
817
832
|
creator,
|
|
@@ -1014,218 +1029,8 @@ export class PumpSdk {
|
|
|
1014
1029
|
})
|
|
1015
1030
|
.instruction();
|
|
1016
1031
|
}
|
|
1017
|
-
|
|
1018
|
-
/**
|
|
1019
|
-
* Creates a social fee PDA that can accumulate fees for a social media user.
|
|
1020
|
-
*
|
|
1021
|
-
* @param params.payer - Any signer account that pays for the transaction.
|
|
1022
|
-
* @param params.userId - Must be the GitHub user id returned by `https://api.github.com/users/<github-username>`.
|
|
1023
|
-
* The target must be a real user account with a login. E.g: Organizations are not supported.
|
|
1024
|
-
* @param params.platform - Only `github` is supported at the moment, any attempt to use other platforms will result in fee loss.
|
|
1025
|
-
* In doubt check `SUPPORTED_SOCIAL_PLATFORMS`
|
|
1026
|
-
*/
|
|
1027
|
-
async createSocialFeePda({
|
|
1028
|
-
payer,
|
|
1029
|
-
userId,
|
|
1030
|
-
platform,
|
|
1031
|
-
}: {
|
|
1032
|
-
payer: PublicKey;
|
|
1033
|
-
userId: string;
|
|
1034
|
-
platform: Platform;
|
|
1035
|
-
}): Promise<TransactionInstruction> {
|
|
1036
|
-
if (!SUPPORTED_SOCIAL_PLATFORMS.includes(platform)) {
|
|
1037
|
-
const supportedPlatformNames = SUPPORTED_SOCIAL_PLATFORMS.map((supportedPlatform) =>
|
|
1038
|
-
platformToString(supportedPlatform),
|
|
1039
|
-
).join(", ");
|
|
1040
|
-
throw new Error(
|
|
1041
|
-
`Unsupported platform "${platform}" for userId "${userId}". Supported platforms: ${supportedPlatformNames}.`,
|
|
1042
|
-
);
|
|
1043
|
-
}
|
|
1044
|
-
|
|
1045
|
-
return await this.offlinePumpFeeProgram.methods
|
|
1046
|
-
.createSocialFeePda(userId, platform)
|
|
1047
|
-
.accountsPartial({
|
|
1048
|
-
payer,
|
|
1049
|
-
socialFeePda: socialFeePda(userId, platform),
|
|
1050
|
-
})
|
|
1051
|
-
.instruction();
|
|
1052
|
-
}
|
|
1053
|
-
|
|
1054
|
-
normalizeSocialShareholders({
|
|
1055
|
-
newShareholders,
|
|
1056
|
-
}: {
|
|
1057
|
-
newShareholders: Array<{
|
|
1058
|
-
shareBps: number;
|
|
1059
|
-
address?: PublicKey;
|
|
1060
|
-
userId?: string;
|
|
1061
|
-
platform?: Platform;
|
|
1062
|
-
}>;
|
|
1063
|
-
}): {
|
|
1064
|
-
normalizedShareholders: Shareholder[];
|
|
1065
|
-
socialRecipientsToCreate: Map<string, { userId: string; platform: Platform }>;
|
|
1066
|
-
} {
|
|
1067
|
-
const socialRecipientsToCreate = new Map<
|
|
1068
|
-
string,
|
|
1069
|
-
{ userId: string; platform: Platform }
|
|
1070
|
-
>();
|
|
1071
|
-
const normalizedShareholders: Shareholder[] = newShareholders.map(
|
|
1072
|
-
(shareholder) => {
|
|
1073
|
-
if (shareholder.address) {
|
|
1074
|
-
return {
|
|
1075
|
-
address: shareholder.address,
|
|
1076
|
-
shareBps: shareholder.shareBps,
|
|
1077
|
-
};
|
|
1078
|
-
}
|
|
1079
|
-
|
|
1080
|
-
if (
|
|
1081
|
-
typeof shareholder.userId === "string" &&
|
|
1082
|
-
typeof shareholder.platform === "number"
|
|
1083
|
-
) {
|
|
1084
|
-
if (!SUPPORTED_SOCIAL_PLATFORMS.includes(shareholder.platform)) {
|
|
1085
|
-
const supportedPlatformNames = SUPPORTED_SOCIAL_PLATFORMS.map((platform) =>
|
|
1086
|
-
platformToString(platform),
|
|
1087
|
-
).join(", ");
|
|
1088
|
-
throw new Error(
|
|
1089
|
-
`Unsupported platform "${shareholder.platform}" for userId "${shareholder.userId}". Supported platforms: ${supportedPlatformNames}.`,
|
|
1090
|
-
);
|
|
1091
|
-
}
|
|
1092
|
-
|
|
1093
|
-
const recipientPda = socialFeePda(shareholder.userId, shareholder.platform);
|
|
1094
|
-
socialRecipientsToCreate.set(recipientPda.toBase58(), {
|
|
1095
|
-
userId: shareholder.userId,
|
|
1096
|
-
platform: shareholder.platform,
|
|
1097
|
-
});
|
|
1098
|
-
|
|
1099
|
-
return {
|
|
1100
|
-
address: recipientPda,
|
|
1101
|
-
shareBps: shareholder.shareBps,
|
|
1102
|
-
};
|
|
1103
|
-
}
|
|
1104
|
-
|
|
1105
|
-
throw new Error(
|
|
1106
|
-
"Each new shareholder must provide either an address or both userId and platform.",
|
|
1107
|
-
);
|
|
1108
|
-
},
|
|
1109
|
-
);
|
|
1110
|
-
|
|
1111
|
-
return {
|
|
1112
|
-
normalizedShareholders,
|
|
1113
|
-
socialRecipientsToCreate,
|
|
1114
|
-
};
|
|
1115
|
-
}
|
|
1116
|
-
|
|
1117
|
-
/**
|
|
1118
|
-
* Wrapper around `updateSharingConfig` that resolves social recipients and
|
|
1119
|
-
* initializes any missing social recipient PDAs before updating fee shares.
|
|
1120
|
-
*
|
|
1121
|
-
* Requirements:
|
|
1122
|
-
* - `authority` must sign the transaction.
|
|
1123
|
-
*
|
|
1124
|
-
* Warning:
|
|
1125
|
-
* - sharing config must exist for that mint
|
|
1126
|
-
* - `userId` must be the GitHub user id returned by `https://api.github.com/users/<github-username>`.
|
|
1127
|
-
* The target must be a real user account with a login. E.g: Organizations are not supported.
|
|
1128
|
-
* - Only `github` is supported at the moment, any attempt to use other platforms will result in fee loss. In doubt check `SUPPORTED_SOCIAL_PLATFORMS`
|
|
1129
|
-
*/
|
|
1130
|
-
async updateSharingConfigWithSocialRecipients({
|
|
1131
|
-
authority,
|
|
1132
|
-
mint,
|
|
1133
|
-
currentShareholders,
|
|
1134
|
-
newShareholders,
|
|
1135
|
-
}: {
|
|
1136
|
-
authority: PublicKey;
|
|
1137
|
-
mint: PublicKey;
|
|
1138
|
-
currentShareholders: PublicKey[];
|
|
1139
|
-
newShareholders: Array<{
|
|
1140
|
-
shareBps: number;
|
|
1141
|
-
address?: PublicKey;
|
|
1142
|
-
userId?: string;
|
|
1143
|
-
platform?: Platform;
|
|
1144
|
-
}>;
|
|
1145
|
-
}): Promise<TransactionInstruction[]> {
|
|
1146
|
-
const instructions: TransactionInstruction[] = [];
|
|
1147
|
-
const { normalizedShareholders, socialRecipientsToCreate } =
|
|
1148
|
-
this.normalizeSocialShareholders({ newShareholders });
|
|
1149
|
-
|
|
1150
|
-
for (const recipient of socialRecipientsToCreate.values()) {
|
|
1151
|
-
instructions.push(
|
|
1152
|
-
await this.createSocialFeePda({
|
|
1153
|
-
payer: authority,
|
|
1154
|
-
userId: recipient.userId,
|
|
1155
|
-
platform: recipient.platform,
|
|
1156
|
-
}),
|
|
1157
|
-
);
|
|
1158
|
-
}
|
|
1159
|
-
|
|
1160
|
-
instructions.push(
|
|
1161
|
-
await this.updateFeeShares({
|
|
1162
|
-
authority,
|
|
1163
|
-
mint,
|
|
1164
|
-
currentShareholders,
|
|
1165
|
-
newShareholders: normalizedShareholders,
|
|
1166
|
-
}),
|
|
1167
|
-
);
|
|
1168
|
-
|
|
1169
|
-
return instructions;
|
|
1170
|
-
}
|
|
1171
|
-
|
|
1172
|
-
/**
|
|
1173
|
-
* Wrapper around `createFeeSharingConfig` that resolves social recipients and
|
|
1174
|
-
* initializes any missing social recipient PDAs before updating fee shares.
|
|
1175
|
-
*
|
|
1176
|
-
* Requirements:
|
|
1177
|
-
* - `creator` must sign the transaction.
|
|
1178
|
-
* - `pool` must be provided for graduated coins; use `null` for ungraduated coins.
|
|
1179
|
-
*
|
|
1180
|
-
* Warning:
|
|
1181
|
-
* - `userId` must be the GitHub user id returned by `https://api.github.com/users/<github-username>`.
|
|
1182
|
-
* The target must be a real user account with a login. E.g: Organizations are not supported.
|
|
1183
|
-
* - Only `github` is supported at the moment, any attempt to use other platforms will result in fee loss. In doubt check `SUPPORTED_SOCIAL_PLATFORMS`
|
|
1184
|
-
*/
|
|
1185
|
-
async createSharingConfigWithSocialRecipients({
|
|
1186
|
-
creator,
|
|
1187
|
-
mint,
|
|
1188
|
-
pool,
|
|
1189
|
-
newShareholders,
|
|
1190
|
-
}: {
|
|
1191
|
-
creator: PublicKey;
|
|
1192
|
-
mint: PublicKey;
|
|
1193
|
-
pool: PublicKey | null;
|
|
1194
|
-
newShareholders: Array<{
|
|
1195
|
-
shareBps: number;
|
|
1196
|
-
address?: PublicKey;
|
|
1197
|
-
userId?: string;
|
|
1198
|
-
platform?: Platform;
|
|
1199
|
-
}>;
|
|
1200
|
-
}): Promise<TransactionInstruction[]> {
|
|
1201
|
-
const instructions: TransactionInstruction[] = [];
|
|
1202
|
-
|
|
1203
|
-
instructions.push(
|
|
1204
|
-
await this.createFeeSharingConfig({
|
|
1205
|
-
creator,
|
|
1206
|
-
mint,
|
|
1207
|
-
pool,
|
|
1208
|
-
}),
|
|
1209
|
-
);
|
|
1210
|
-
|
|
1211
|
-
instructions.push(
|
|
1212
|
-
...(await this.updateSharingConfigWithSocialRecipients({
|
|
1213
|
-
authority: creator,
|
|
1214
|
-
mint,
|
|
1215
|
-
currentShareholders: [creator],
|
|
1216
|
-
newShareholders,
|
|
1217
|
-
})),
|
|
1218
|
-
);
|
|
1219
|
-
|
|
1220
|
-
return instructions;
|
|
1221
|
-
}
|
|
1222
|
-
|
|
1223
|
-
claimSocialFeePda() {
|
|
1224
|
-
throw new Error("This function can only be called by pump and is not supported");
|
|
1225
|
-
}
|
|
1226
1032
|
}
|
|
1227
1033
|
|
|
1228
|
-
|
|
1229
1034
|
export const PUMP_SDK = new PumpSdk();
|
|
1230
1035
|
|
|
1231
1036
|
/**
|
package/src/state.ts
CHANGED
|
@@ -1,42 +1,6 @@
|
|
|
1
1
|
import { PublicKey } from "@solana/web3.js";
|
|
2
2
|
import BN from "bn.js";
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
* Platform identifiers for social handle mappings.
|
|
6
|
-
*/
|
|
7
|
-
export enum Platform {
|
|
8
|
-
Pump = 0,
|
|
9
|
-
X = 1,
|
|
10
|
-
GitHub = 2,
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export const SUPPORTED_SOCIAL_PLATFORMS = [Platform.GitHub];
|
|
14
|
-
|
|
15
|
-
export const stringToPlatform = (value: string): Platform => {
|
|
16
|
-
const normalized = value.trim().toUpperCase();
|
|
17
|
-
const entry = Object.entries(Platform).find(
|
|
18
|
-
([key, val]) => typeof val === "number" && key.toUpperCase() === normalized,
|
|
19
|
-
);
|
|
20
|
-
if (entry) {
|
|
21
|
-
return entry[1] as Platform;
|
|
22
|
-
}
|
|
23
|
-
const validNames = Object.entries(Platform)
|
|
24
|
-
.filter(([, val]) => typeof val === "number")
|
|
25
|
-
.map(([key]) => key.toUpperCase())
|
|
26
|
-
.join(", ");
|
|
27
|
-
throw new Error(
|
|
28
|
-
`Unknown platform "${value}". Expected one of: ${validNames}`,
|
|
29
|
-
);
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export const platformToString = (platform: Platform): string => {
|
|
33
|
-
const name = Platform[platform];
|
|
34
|
-
if (name !== undefined) {
|
|
35
|
-
return name;
|
|
36
|
-
}
|
|
37
|
-
throw new Error(`Unknown platform value: ${platform}`);
|
|
38
|
-
};
|
|
39
|
-
|
|
40
4
|
export interface Global {
|
|
41
5
|
// unused
|
|
42
6
|
initialized: boolean;
|