@meteora-ag/cp-amm-sdk 1.0.1-rc.7 → 1.0.1-rc.8
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.d.mts +13 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +39 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +39 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -6407,6 +6407,19 @@ declare class CpAmm {
|
|
|
6407
6407
|
fetchConfigState(config: PublicKey): Promise<ConfigState>;
|
|
6408
6408
|
fetchPoolState(pool: PublicKey): Promise<PoolState>;
|
|
6409
6409
|
fetchPositionState(position: PublicKey): Promise<PositionState>;
|
|
6410
|
+
getAllConfigs(): Promise<Array<{
|
|
6411
|
+
publicKey: PublicKey;
|
|
6412
|
+
account: ConfigState;
|
|
6413
|
+
}>>;
|
|
6414
|
+
getAllPools(): Promise<Array<{
|
|
6415
|
+
publicKey: PublicKey;
|
|
6416
|
+
account: PoolState;
|
|
6417
|
+
}>>;
|
|
6418
|
+
getAllPositions(): Promise<Array<{
|
|
6419
|
+
publicKey: PublicKey;
|
|
6420
|
+
account: PositionState;
|
|
6421
|
+
}>>;
|
|
6422
|
+
getPositionsByUser(user: PublicKey): Promise<any[]>;
|
|
6410
6423
|
getQuote(params: GetQuoteParams): Promise<{
|
|
6411
6424
|
swapInAmount: BN;
|
|
6412
6425
|
swapOutAmount: BN;
|
package/dist/index.d.ts
CHANGED
|
@@ -6407,6 +6407,19 @@ declare class CpAmm {
|
|
|
6407
6407
|
fetchConfigState(config: PublicKey): Promise<ConfigState>;
|
|
6408
6408
|
fetchPoolState(pool: PublicKey): Promise<PoolState>;
|
|
6409
6409
|
fetchPositionState(position: PublicKey): Promise<PositionState>;
|
|
6410
|
+
getAllConfigs(): Promise<Array<{
|
|
6411
|
+
publicKey: PublicKey;
|
|
6412
|
+
account: ConfigState;
|
|
6413
|
+
}>>;
|
|
6414
|
+
getAllPools(): Promise<Array<{
|
|
6415
|
+
publicKey: PublicKey;
|
|
6416
|
+
account: PoolState;
|
|
6417
|
+
}>>;
|
|
6418
|
+
getAllPositions(): Promise<Array<{
|
|
6419
|
+
publicKey: PublicKey;
|
|
6420
|
+
account: PositionState;
|
|
6421
|
+
}>>;
|
|
6422
|
+
getPositionsByUser(user: PublicKey): Promise<any[]>;
|
|
6410
6423
|
getQuote(params: GetQuoteParams): Promise<{
|
|
6411
6424
|
swapInAmount: BN;
|
|
6412
6425
|
swapOutAmount: BN;
|
package/dist/index.js
CHANGED
|
@@ -6177,6 +6177,7 @@ var cp_amm_default = {
|
|
|
6177
6177
|
// src/CpAmm.ts
|
|
6178
6178
|
|
|
6179
6179
|
|
|
6180
|
+
|
|
6180
6181
|
var _web3js = require('@solana/web3.js');
|
|
6181
6182
|
|
|
6182
6183
|
// src/constants.ts
|
|
@@ -6879,6 +6880,44 @@ var CpAmm = class {
|
|
|
6879
6880
|
return positionState;
|
|
6880
6881
|
});
|
|
6881
6882
|
}
|
|
6883
|
+
getAllConfigs() {
|
|
6884
|
+
return __async(this, null, function* () {
|
|
6885
|
+
const configAccounts = yield this._program.account.config.all();
|
|
6886
|
+
return configAccounts;
|
|
6887
|
+
});
|
|
6888
|
+
}
|
|
6889
|
+
getAllPools() {
|
|
6890
|
+
return __async(this, null, function* () {
|
|
6891
|
+
const poolAccounts = yield this._program.account.pool.all();
|
|
6892
|
+
return poolAccounts;
|
|
6893
|
+
});
|
|
6894
|
+
}
|
|
6895
|
+
getAllPositions() {
|
|
6896
|
+
return __async(this, null, function* () {
|
|
6897
|
+
const poolAccounts = yield this._program.account.position.all();
|
|
6898
|
+
return poolAccounts;
|
|
6899
|
+
});
|
|
6900
|
+
}
|
|
6901
|
+
getPositionsByUser(user) {
|
|
6902
|
+
return __async(this, null, function* () {
|
|
6903
|
+
const positions = yield this._program.account.position.all();
|
|
6904
|
+
const positionNftMints = positions.map((item) => item.account.nftMint);
|
|
6905
|
+
const result = [];
|
|
6906
|
+
for (const position of positions) {
|
|
6907
|
+
const largesTokenAccount = yield this._program.provider.connection.getTokenLargestAccounts(
|
|
6908
|
+
positionNftMints[0]
|
|
6909
|
+
);
|
|
6910
|
+
const accountInfo = yield this._program.provider.connection.getParsedAccountInfo(
|
|
6911
|
+
largesTokenAccount.value[0].address
|
|
6912
|
+
);
|
|
6913
|
+
const owner = new (0, _web3js.PublicKey)(accountInfo.value.data.parsed.info.owner);
|
|
6914
|
+
if (owner.equals(user)) {
|
|
6915
|
+
result.push(position);
|
|
6916
|
+
}
|
|
6917
|
+
}
|
|
6918
|
+
return result;
|
|
6919
|
+
});
|
|
6920
|
+
}
|
|
6882
6921
|
getQuote(params) {
|
|
6883
6922
|
return __async(this, null, function* () {
|
|
6884
6923
|
var _a;
|