@bagsfm/bags-sdk 1.3.2 → 1.3.3
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/services/fees.d.ts
CHANGED
|
@@ -4,6 +4,6 @@ import { BagsClaimablePosition } from '../types/meteora';
|
|
|
4
4
|
export declare class FeesService extends BaseService {
|
|
5
5
|
constructor(apiKey: string, connection: Connection, commitment?: Commitment);
|
|
6
6
|
getAllClaimablePositions(wallet: PublicKey): Promise<Array<BagsClaimablePosition>>;
|
|
7
|
-
|
|
7
|
+
getClaimTransactions(wallet: PublicKey, tokenMint: PublicKey): Promise<Array<Transaction>>;
|
|
8
8
|
}
|
|
9
9
|
//# sourceMappingURL=fees.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fees.d.ts","sourceRoot":"","sources":["../../src/services/fees.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACjF,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,EAAE,qBAAqB,
|
|
1
|
+
{"version":3,"file":"fees.d.ts","sourceRoot":"","sources":["../../src/services/fees.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACjF,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAIzD,qBAAa,WAAY,SAAQ,WAAW;gBAC/B,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,GAAE,UAAwB;IAUlF,wBAAwB,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;IAiBlF,oBAAoB,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;CAahG"}
|
package/dist/services/fees.js
CHANGED
|
@@ -6,8 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.FeesService = void 0;
|
|
7
7
|
const web3_js_1 = require("@solana/web3.js");
|
|
8
8
|
const base_1 = require("./base");
|
|
9
|
-
const fee_claim_1 = require("../utils/fee-claim");
|
|
10
|
-
const constants_1 = require("../constants");
|
|
11
9
|
const bs58_1 = __importDefault(require("bs58"));
|
|
12
10
|
class FeesService extends base_1.BaseService {
|
|
13
11
|
constructor(apiKey, connection, commitment = 'processed') {
|
|
@@ -21,79 +19,11 @@ class FeesService extends base_1.BaseService {
|
|
|
21
19
|
});
|
|
22
20
|
return response;
|
|
23
21
|
}
|
|
24
|
-
async
|
|
25
|
-
const
|
|
22
|
+
async getClaimTransactions(wallet, tokenMint) {
|
|
23
|
+
const response = await this.bagsApiClient.post('/token-launch/claim-txs/v3', {
|
|
26
24
|
feeClaimer: wallet.toBase58(),
|
|
27
|
-
tokenMint:
|
|
28
|
-
};
|
|
29
|
-
if (position.isCustomFeeVault === false) {
|
|
30
|
-
if (position.virtualPoolClaimableAmount) {
|
|
31
|
-
params.claimVirtualPoolFees = true;
|
|
32
|
-
params.virtualPoolAddress = position.virtualPoolAddress;
|
|
33
|
-
}
|
|
34
|
-
if (position.dammPoolClaimableAmount) {
|
|
35
|
-
params.claimDammV2Fees = true;
|
|
36
|
-
params.dammV2Position = position.dammPositionInfo.position;
|
|
37
|
-
params.dammV2Pool = position.dammPositionInfo.pool;
|
|
38
|
-
params.dammV2PositionNftAccount = position.dammPositionInfo.positionNftAccount;
|
|
39
|
-
params.tokenAMint = position.dammPositionInfo.tokenAMint;
|
|
40
|
-
params.tokenBMint = position.dammPositionInfo.tokenBMint;
|
|
41
|
-
params.tokenAVault = position.dammPositionInfo.tokenAVault;
|
|
42
|
-
params.tokenBVault = position.dammPositionInfo.tokenBVault;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
else if (position.programId === constants_1.BAGS_FEE_SHARE_V1_PROGRAM_ID) {
|
|
46
|
-
params.feeShareProgramId = position.programId;
|
|
47
|
-
params.isCustomFeeVault = true;
|
|
48
|
-
if (position.virtualPoolClaimableAmount) {
|
|
49
|
-
params.claimVirtualPoolFees = true;
|
|
50
|
-
params.virtualPoolAddress = position.virtualPoolAddress;
|
|
51
|
-
}
|
|
52
|
-
if (position.dammPoolClaimableAmount) {
|
|
53
|
-
params.claimDammV2Fees = true;
|
|
54
|
-
params.dammV2Position = position.dammPositionInfo.position;
|
|
55
|
-
params.dammV2Pool = position.dammPositionInfo.pool;
|
|
56
|
-
params.dammV2PositionNftAccount = position.dammPositionInfo.positionNftAccount;
|
|
57
|
-
params.tokenAMint = position.dammPositionInfo.tokenAMint;
|
|
58
|
-
params.tokenBMint = position.dammPositionInfo.tokenBMint;
|
|
59
|
-
params.tokenAVault = position.dammPositionInfo.tokenAVault;
|
|
60
|
-
params.tokenBVault = position.dammPositionInfo.tokenBVault;
|
|
61
|
-
}
|
|
62
|
-
params.customFeeVaultClaimerA = position.customFeeVaultClaimerA;
|
|
63
|
-
params.customFeeVaultClaimerB = position.customFeeVaultClaimerB;
|
|
64
|
-
params.customFeeVaultClaimerSide = position.customFeeVaultClaimerSide;
|
|
65
|
-
const userFeeVaultPda = (0, fee_claim_1.getFeeVaultPda)(position.customFeeVaultClaimerSide === 'A' ? new web3_js_1.PublicKey(position.customFeeVaultClaimerA) : new web3_js_1.PublicKey(position.customFeeVaultClaimerB), new web3_js_1.PublicKey(position.baseMint), new web3_js_1.PublicKey(position.programId));
|
|
66
|
-
const userFeeVaultPdaBalance = await this.connection.getBalance(userFeeVaultPda, this.commitment);
|
|
67
|
-
const hasFeesInVault = userFeeVaultPdaBalance >= constants_1.BAGS_METEORA_FEE_CLAIMER_VAULT_RENT_EXCEMPT_AMOUNT;
|
|
68
|
-
if (hasFeesInVault) {
|
|
69
|
-
params.claimVirtualPoolFees = true;
|
|
70
|
-
params.virtualPoolAddress = position.virtualPoolAddress;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
else if (position.programId === constants_1.BAGS_FEE_SHARE_V2_PROGRAM_ID) {
|
|
74
|
-
params.feeShareProgramId = position.programId;
|
|
75
|
-
params.isCustomFeeVault = true;
|
|
76
|
-
params.tokenAMint = position.baseMint;
|
|
77
|
-
params.tokenBMint = position.quoteMint;
|
|
78
|
-
if (position.virtualPoolClaimableLamportsUserShare) {
|
|
79
|
-
params.claimVirtualPoolFees = true;
|
|
80
|
-
params.virtualPoolAddress = position.virtualPool;
|
|
81
|
-
}
|
|
82
|
-
if (position.isMigrated && position.dammPoolClaimableLamportsUserShare) {
|
|
83
|
-
params.claimDammV2Fees = true;
|
|
84
|
-
params.dammV2Pool = position.dammPositionInfo.pool;
|
|
85
|
-
params.dammV2Position = position.dammPositionInfo.position;
|
|
86
|
-
params.dammV2PositionNftAccount = position.dammPositionInfo.positionNftAccount;
|
|
87
|
-
params.tokenAMint = position.dammPositionInfo.tokenAMint;
|
|
88
|
-
params.tokenBMint = position.dammPositionInfo.tokenBMint;
|
|
89
|
-
params.tokenAVault = position.dammPositionInfo.tokenAVault;
|
|
90
|
-
params.tokenBVault = position.dammPositionInfo.tokenBVault;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
throw new Error(`Unsupported program ID: ${position.programId}. Expected '${constants_1.BAGS_FEE_SHARE_V1_PROGRAM_ID}' or '${constants_1.BAGS_FEE_SHARE_V2_PROGRAM_ID}'`);
|
|
95
|
-
}
|
|
96
|
-
const response = await this.bagsApiClient.post('/token-launch/claim-txs/v2', params);
|
|
25
|
+
tokenMint: tokenMint.toBase58(),
|
|
26
|
+
});
|
|
97
27
|
const deserializedTransactions = response.map((tx) => {
|
|
98
28
|
const decodedTransaction = bs58_1.default.decode(tx.tx);
|
|
99
29
|
return web3_js_1.Transaction.from(decodedTransaction);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fees.js","sourceRoot":"","sources":["../../src/services/fees.ts"],"names":[],"mappings":";;;;;;AAAA,6CAAiF;AACjF,iCAAqC;
|
|
1
|
+
{"version":3,"file":"fees.js","sourceRoot":"","sources":["../../src/services/fees.ts"],"names":[],"mappings":";;;;;;AAAA,6CAAiF;AACjF,iCAAqC;AAGrC,gDAAwB;AAExB,MAAa,WAAY,SAAQ,kBAAW;IAC3C,YAAY,MAAc,EAAE,UAAsB,EAAE,aAAyB,WAAW;QACvF,KAAK,CAAC,MAAM,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;IACvC,CAAC;IAQD,KAAK,CAAC,wBAAwB,CAAC,MAAiB;QAC/C,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,GAAG,CAA+B,mCAAmC,EAAE;YAChH,MAAM,EAAE;gBACP,MAAM,EAAE,MAAM,CAAC,QAAQ,EAAE;aACzB;SACD,CAAC,CAAC;QAEH,OAAO,QAAQ,CAAC;IACjB,CAAC;IASD,KAAK,CAAC,oBAAoB,CAAC,MAAiB,EAAE,SAAoB;QACjE,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,IAAI,CAA8B,4BAA4B,EAAE;YACzG,UAAU,EAAE,MAAM,CAAC,QAAQ,EAAE;YAC7B,SAAS,EAAE,SAAS,CAAC,QAAQ,EAAE;SAC/B,CAAC,CAAC;QAEH,MAAM,wBAAwB,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE;YACpD,MAAM,kBAAkB,GAAG,cAAI,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;YAC9C,OAAO,qBAAW,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QAC7C,CAAC,CAAC,CAAC;QAEH,OAAO,wBAAwB,CAAC;IACjC,CAAC;CACD;AAzCD,kCAyCC"}
|