testsetset
Version:
A Typescript SDK for interacting with the Dynamic Bonding Curve on Meteora.
1,440 lines (1,438 loc) • 594 kB
text/typescript
import { Connection, PublicKey, Commitment, TransactionInstruction, Transaction, Keypair, GetProgramAccountsFilter } from '@solana/web3.js';
import { Program, Accounts, IdlTypes, BN, IdlAccounts, ProgramAccount } from '@coral-xyz/anchor';
import BN$1 from 'bn.js';
import Decimal from 'decimal.js';
/**
* Program IDL in camelCase format in order to be used in JS/TS.
*
* Note that this is only a type helper and is not the actual IDL. The original
* IDL can be found at `target/idl/dynamic_bonding_curve.json`.
*/
type DynamicBondingCurve = {
address: 'dbcij3LWUppWqq96dh6gJWwBifmcGfLSB5D4DuSMaqN';
metadata: {
name: 'dynamicBondingCurve';
version: '0.1.6';
spec: '0.1.0';
description: 'Created with Anchor';
};
instructions: [
{
name: 'claimCreatorTradingFee';
discriminator: [82, 220, 250, 189, 3, 85, 107, 45];
accounts: [
{
name: 'poolAuthority';
address: 'FhVo3mqL8PW5pH5U2CN4XE33DokiyZnUwuGpH2hmHLuM';
},
{
name: 'pool';
writable: true;
},
{
name: 'tokenAAccount';
docs: ['The treasury token a account'];
writable: true;
},
{
name: 'tokenBAccount';
docs: ['The treasury token b account'];
writable: true;
},
{
name: 'baseVault';
docs: ['The vault token account for input token'];
writable: true;
relations: ['pool'];
},
{
name: 'quoteVault';
docs: ['The vault token account for output token'];
writable: true;
relations: ['pool'];
},
{
name: 'baseMint';
docs: ['The mint of token a'];
relations: ['pool'];
},
{
name: 'quoteMint';
docs: ['The mint of token b'];
},
{
name: 'creator';
signer: true;
relations: ['pool'];
},
{
name: 'tokenBaseProgram';
docs: ['Token a program'];
},
{
name: 'tokenQuoteProgram';
docs: ['Token b program'];
},
{
name: 'eventAuthority';
pda: {
seeds: [
{
kind: 'const';
value: [
95,
95,
101,
118,
101,
110,
116,
95,
97,
117,
116,
104,
111,
114,
105,
116,
121
];
}
];
};
},
{
name: 'program';
}
];
args: [
{
name: 'maxBaseAmount';
type: 'u64';
},
{
name: 'maxQuoteAmount';
type: 'u64';
}
];
},
{
name: 'claimProtocolFee';
discriminator: [165, 228, 133, 48, 99, 249, 255, 33];
accounts: [
{
name: 'poolAuthority';
address: 'FhVo3mqL8PW5pH5U2CN4XE33DokiyZnUwuGpH2hmHLuM';
},
{
name: 'config';
relations: ['pool'];
},
{
name: 'pool';
writable: true;
},
{
name: 'baseVault';
docs: ['The vault token account for input token'];
writable: true;
relations: ['pool'];
},
{
name: 'quoteVault';
docs: ['The vault token account for output token'];
writable: true;
relations: ['pool'];
},
{
name: 'baseMint';
docs: ['The mint of token a'];
relations: ['pool'];
},
{
name: 'quoteMint';
docs: ['The mint of token b'];
relations: ['config'];
},
{
name: 'tokenBaseAccount';
docs: ['The treasury token a account'];
writable: true;
pda: {
seeds: [
{
kind: 'const';
value: [
48,
9,
89,
123,
106,
114,
131,
251,
50,
173,
254,
250,
10,
80,
160,
84,
143,
100,
81,
249,
134,
112,
30,
213,
50,
166,
239,
78,
53,
175,
188,
85
];
},
{
kind: 'account';
path: 'tokenBaseProgram';
},
{
kind: 'account';
path: 'baseMint';
}
];
program: {
kind: 'const';
value: [
140,
151,
37,
143,
78,
36,
137,
241,
187,
61,
16,
41,
20,
142,
13,
131,
11,
90,
19,
153,
218,
255,
16,
132,
4,
142,
123,
216,
219,
233,
248,
89
];
};
};
},
{
name: 'tokenQuoteAccount';
docs: ['The treasury token b account'];
writable: true;
pda: {
seeds: [
{
kind: 'const';
value: [
48,
9,
89,
123,
106,
114,
131,
251,
50,
173,
254,
250,
10,
80,
160,
84,
143,
100,
81,
249,
134,
112,
30,
213,
50,
166,
239,
78,
53,
175,
188,
85
];
},
{
kind: 'account';
path: 'tokenQuoteProgram';
},
{
kind: 'account';
path: 'quoteMint';
}
];
program: {
kind: 'const';
value: [
140,
151,
37,
143,
78,
36,
137,
241,
187,
61,
16,
41,
20,
142,
13,
131,
11,
90,
19,
153,
218,
255,
16,
132,
4,
142,
123,
216,
219,
233,
248,
89
];
};
};
},
{
name: 'claimFeeOperator';
docs: ['Claim fee operator'];
},
{
name: 'operator';
docs: ['Operator'];
signer: true;
relations: ['claimFeeOperator'];
},
{
name: 'tokenBaseProgram';
docs: ['Token a program'];
},
{
name: 'tokenQuoteProgram';
docs: ['Token b program'];
},
{
name: 'eventAuthority';
pda: {
seeds: [
{
kind: 'const';
value: [
95,
95,
101,
118,
101,
110,
116,
95,
97,
117,
116,
104,
111,
114,
105,
116,
121
];
}
];
};
},
{
name: 'program';
}
];
args: [];
},
{
name: 'claimTradingFee';
discriminator: [8, 236, 89, 49, 152, 125, 177, 81];
accounts: [
{
name: 'poolAuthority';
address: 'FhVo3mqL8PW5pH5U2CN4XE33DokiyZnUwuGpH2hmHLuM';
},
{
name: 'config';
relations: ['pool'];
},
{
name: 'pool';
writable: true;
},
{
name: 'tokenAAccount';
docs: ['The treasury token a account'];
writable: true;
},
{
name: 'tokenBAccount';
docs: ['The treasury token b account'];
writable: true;
},
{
name: 'baseVault';
docs: ['The vault token account for input token'];
writable: true;
relations: ['pool'];
},
{
name: 'quoteVault';
docs: ['The vault token account for output token'];
writable: true;
relations: ['pool'];
},
{
name: 'baseMint';
docs: ['The mint of token a'];
relations: ['pool'];
},
{
name: 'quoteMint';
docs: ['The mint of token b'];
relations: ['config'];
},
{
name: 'feeClaimer';
signer: true;
relations: ['config'];
},
{
name: 'tokenBaseProgram';
docs: ['Token a program'];
},
{
name: 'tokenQuoteProgram';
docs: ['Token b program'];
},
{
name: 'eventAuthority';
pda: {
seeds: [
{
kind: 'const';
value: [
95,
95,
101,
118,
101,
110,
116,
95,
97,
117,
116,
104,
111,
114,
105,
116,
121
];
}
];
};
},
{
name: 'program';
}
];
args: [
{
name: 'maxAmountA';
type: 'u64';
},
{
name: 'maxAmountB';
type: 'u64';
}
];
},
{
name: 'closeClaimFeeOperator';
discriminator: [38, 134, 82, 216, 95, 124, 17, 99];
accounts: [
{
name: 'claimFeeOperator';
writable: true;
},
{
name: 'rentReceiver';
writable: true;
},
{
name: 'admin';
signer: true;
},
{
name: 'eventAuthority';
pda: {
seeds: [
{
kind: 'const';
value: [
95,
95,
101,
118,
101,
110,
116,
95,
97,
117,
116,
104,
111,
114,
105,
116,
121
];
}
];
};
},
{
name: 'program';
}
];
args: [];
},
{
name: 'createClaimFeeOperator';
docs: ['ADMIN FUNCTIONS_ ///'];
discriminator: [169, 62, 207, 107, 58, 187, 162, 109];
accounts: [
{
name: 'claimFeeOperator';
writable: true;
pda: {
seeds: [
{
kind: 'const';
value: [
99,
102,
95,
111,
112,
101,
114,
97,
116,
111,
114
];
},
{
kind: 'account';
path: 'operator';
}
];
};
},
{
name: 'operator';
},
{
name: 'admin';
writable: true;
signer: true;
},
{
name: 'systemProgram';
address: '11111111111111111111111111111111';
},
{
name: 'eventAuthority';
pda: {
seeds: [
{
kind: 'const';
value: [
95,
95,
101,
118,
101,
110,
116,
95,
97,
117,
116,
104,
111,
114,
105,
116,
121
];
}
];
};
},
{
name: 'program';
}
];
args: [];
},
{
name: 'createConfig';
discriminator: [201, 207, 243, 114, 75, 111, 47, 189];
accounts: [
{
name: 'config';
writable: true;
signer: true;
},
{
name: 'feeClaimer';
},
{
name: 'leftoverReceiver';
},
{
name: 'quoteMint';
docs: ['quote mint'];
},
{
name: 'payer';
writable: true;
signer: true;
},
{
name: 'systemProgram';
address: '11111111111111111111111111111111';
},
{
name: 'eventAuthority';
pda: {
seeds: [
{
kind: 'const';
value: [
95,
95,
101,
118,
101,
110,
116,
95,
97,
117,
116,
104,
111,
114,
105,
116,
121
];
}
];
};
},
{
name: 'program';
}
];
args: [
{
name: 'configParameters';
type: {
defined: {
name: 'configParameters';
};
};
}
];
},
{
name: 'createLocker';
docs: ['PERMISSIONLESS FUNCTIONS ///', 'create locker'];
discriminator: [167, 90, 137, 154, 75, 47, 17, 84];
accounts: [
{
name: 'virtualPool';
docs: ['Virtual pool'];
writable: true;
},
{
name: 'config';
docs: ['config'];
relations: ['virtualPool'];
},
{
name: 'poolAuthority';
writable: true;
address: 'FhVo3mqL8PW5pH5U2CN4XE33DokiyZnUwuGpH2hmHLuM';
},
{
name: 'baseVault';
writable: true;
relations: ['virtualPool'];
},
{
name: 'baseMint';
writable: true;
relations: ['virtualPool'];
},
{
name: 'base';
writable: true;
pda: {
seeds: [
{
kind: 'const';
value: [
98,
97,
115,
101,
95,
108,
111,
99,
107,
101,
114
];
},
{
kind: 'account';
path: 'virtualPool';
}
];
};
},
{
name: 'creator';
relations: ['virtualPool'];
},
{
name: 'escrow';
writable: true;
},
{
name: 'escrowToken';
writable: true;
},
{
name: 'payer';
writable: true;
signer: true;
},
{
name: 'tokenProgram';
},
{
name: 'lockerProgram';
address: 'LocpQgucEQHbqNABEYvBvwoxCPsSbG91A1QaQhQQqjn';
},
{
name: 'lockerEventAuthority';
},
{
name: 'systemProgram';
docs: ['System program.'];
address: '11111111111111111111111111111111';
}
];
args: [];
},
{
name: 'createPartnerMetadata';
docs: ['PARTNER FUNCTIONS ////'];
discriminator: [192, 168, 234, 191, 188, 226, 227, 255];
accounts: [
{
name: 'partnerMetadata';
docs: ['Partner metadata'];
writable: true;
pda: {
seeds: [
{
kind: 'const';
value: [
112,
97,
114,
116,
110,
101,
114,
95,
109,
101,
116,
97,
100,
97,
116,
97
];
},
{
kind: 'account';
path: 'feeClaimer';
}
];
};
},
{
name: 'payer';
docs: ['Payer of the partner metadata.'];
writable: true;
signer: true;
},
{
name: 'feeClaimer';
docs: ['Fee claimer for partner'];
signer: true;
},
{
name: 'systemProgram';
docs: ['System program.'];
address: '11111111111111111111111111111111';
},
{
name: 'eventAuthority';
pda: {
seeds: [
{
kind: 'const';
value: [
95,
95,
101,
118,
101,
110,
116,
95,
97,
117,
116,
104,
111,
114,
105,
116,
121
];
}
];
};
},
{
name: 'program';
}
];
args: [
{
name: 'metadata';
type: {
defined: {
name: 'createPartnerMetadataParameters';
};
};
}
];
},
{
name: 'createVirtualPoolMetadata';
discriminator: [45, 97, 187, 103, 254, 109, 124, 134];
accounts: [
{
name: 'virtualPool';
writable: true;
},
{
name: 'virtualPoolMetadata';
docs: ['Virtual pool metadata'];
writable: true;
pda: {
seeds: [
{
kind: 'const';
value: [
118,
105,
114,
116,
117,
97,
108,
95,
112,
111,
111,
108,
95,
109,
101,
116,
97,
100,
97,
116,
97
];
},
{
kind: 'account';
path: 'virtualPool';
}
];
};
},
{
name: 'creator';
signer: true;
relations: ['virtualPool'];
},
{
name: 'payer';
docs: ['Payer of the virtual pool metadata.'];
writable: true;
signer: true;
},
{
name: 'systemProgram';
docs: ['System program.'];
address: '11111111111111111111111111111111';
},
{
name: 'eventAuthority';
pda: {
seeds: [
{
kind: 'const';
value: [
95,
95,
101,
118,
101,
110,
116,
95,
97,
117,
116,
104,
111,
114,
105,
116,
121
];
}
];
};
},
{
name: 'program';
}
];
args: [
{
name: 'metadata';
type: {
defined: {
name: 'createVirtualPoolMetadataParameters';
};
};
}
];
},
{
name: 'creatorWithdrawSurplus';
discriminator: [165, 3, 137, 7, 28, 134, 76, 80];
accounts: [
{
name: 'poolAuthority';
address: 'FhVo3mqL8PW5pH5U2CN4XE33DokiyZnUwuGpH2hmHLuM';
},
{
name: 'config';
relations: ['virtualPool'];
},
{
name: 'virtualPool';
writable: true;
},
{
name: 'tokenQuoteAccount';
docs: ['The receiver token account'];
writable: true;
},
{
name: 'quoteVault';
docs: ['The vault token account for output token'];
writable: true;
relations: ['virtualPool'];
},
{
name: 'quoteMint';
docs: ['The mint of quote token'];
relations: ['config'];
},
{
name: 'creator';
signer: true;
relations: ['virtualPool'];
},
{
name: 'tokenQuoteProgram';
docs: ['Token b program'];
},
{
name: 'eventAuthority';
pda: {
seeds: [
{
kind: 'const';
value: [
95,
95,
101,
118,
101,
110,
116,
95,
97,
117,
116,
104,
111,
114,
105,
116,
121
];
}
];
};
},
{
name: 'program';
}
];
args: [];
},
{
name: 'initializeVirtualPoolWithSplToken';
docs: ['POOL CREATOR FUNCTIONS ////'];
discriminator: [140, 85, 215, 176, 102, 54, 104, 79];
accounts: [
{
name: 'config';
docs: ['Which config the pool belongs to.'];
},
{
name: 'poolAuthority';
address: 'FhVo3mqL8PW5pH5U2CN4XE33DokiyZnUwuGpH2hmHLuM';
},
{
name: 'creator';
signer: true;
},
{
name: 'baseMint';
writable: true;
signer: true;
},
{
name: 'quoteMint';
relations: ['config'];
},
{
name: 'pool';
docs: ['Initialize an account to store the pool state'];
writable: true;
},
{
name: 'baseVault';
docs: ['Token a vault for the pool'];
writable: true;
pda: {
seeds: [
{
kind: 'const';
value: [
116,
111,
107,
101,
110,
95,
118,
97,
117,
108,
116
];
},
{
kind: 'account';
path: 'baseMint';
},
{
kind: 'account';
path: 'pool';
}
];
};
},
{
name: 'quoteVault';
docs: ['Token b vault for the pool'];
writable: true;
pda: {
seeds: [
{
kind: 'const';
value: [
116,
111,
107,
101,
110,
95,
118,
97,
117,
108,
116
];
},
{
kind: 'account';
path: 'quoteMint';
},
{
kind: 'account';
path: 'pool';
}
];
};
},
{
name: 'mintMetadata';
writable: true;
},
{
name: 'metadataProgram';
address: 'metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s';
},
{
name: 'payer';
docs: ['Address paying to create the pool. Can be anyone'];
writable: true;
signer: true;
},
{
name: 'tokenQuoteProgram';
docs: ['Program to create mint account and mint tokens'];
},
{
name: 'tokenProgram';
address: 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
},
{
name: 'systemProgram';
address: '11111111111111111111111111111111';
},
{
name: 'eventAuthority';
pda: {
seeds: [
{
kind: 'const';
value: [
95,
95,
101,
118,
101,
110,
116,
95,
97,
117,
116,
104,
111,
114,
105,
116,
121
];
}
];
};
},
{
name: 'program';
}
];
args: [
{
name: 'params';
type: {
defined: {
name: 'initializePoolParameters';
};
};
}
];
},
{
name: 'initializeVirtualPoolWithToken2022';
discriminator: [169, 118, 51, 78, 145, 110, 220, 155];
accounts: [
{
name: 'config';
docs: ['Which config the pool belongs to.'];
},
{
name: 'poolAuthority';
address: 'FhVo3mqL8PW5pH5U2CN4XE33DokiyZnUwuGpH2hmHLuM';
},
{
name: 'creator';
signer: true;
},
{
name: 'baseMint';
docs: ['Unique token mint address, initialize in contract'];
writable: true;
signer: true;
},
{
name: 'quoteMint';
relations: ['config'];
},
{
name: 'pool';
docs: ['Initialize an account to store the pool state'];
writable: true;
},
{
name: 'baseVault';
writable: true;
pda: {
seeds: [
{
kind: 'const';
value: [
116,
111,
107,
101,
110,
95,
118,
97,
117,
108,
116
];
},
{
kind: 'account';
path: 'baseMint';
},
{
kind: 'account';
path: 'pool';
}
];
};
},
{
name: 'quoteVault';
docs: ['Token quote vault for the pool'];
writable: true;
pda: {
seeds: [
{
kind: 'const';
value: [
116,
111,
107,
101,
110,
95,
118,
97,
117,
108,
116
];
},
{
kind: 'account';
path: 'quoteMint';
},
{
kind: 'account';
path: 'pool';
}
];
};
},
{
name: 'payer';
docs: ['Address paying to create the pool. Can be anyone'];
writable: true;
signer: true;
},
{
name: 'tokenQuoteProgram';
docs: ['Program to create mint account and mint tokens'];
},
{
name: 'tokenProgram';
docs: ['token program for base mint'];
address: 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb';
},
{
name: 'systemProgram';
address: '11111111111111111111111111111111';
},
{
name: 'eventAuthority';
pda: {
seeds: [
{
kind: 'const';
value: [
95,
95,
101,
118,
101,
110,
116,
95,
97,
117,
116,
104,
111,
114,
105,
116,
121
];
}
];
};
},
{
name: 'program';
}
];
args: [
{
name: 'params';
type: {
defined: {
name: 'initializePoolParameters';
};
};
}
];
},
{
name: 'migrateMeteoraDamm';
discriminator: [27, 1, 48, 22, 180, 63, 118, 217];
accounts: [
{
name: 'virtualPool';
docs: ['virtual pool'];
writable: true;
relations: ['migrationMetadata'];
},
{
name: 'migrationMetadata';
writable: true;
},
{
name: 'config';
relations: ['virtualPool'];
},
{
name: 'poolAuthority';
writable: true;
address: 'FhVo3mqL8PW5pH5U2CN4XE33DokiyZnUwuGpH2hmHLuM';
},
{
name: 'pool';
writable: true;
},
{
name: 'dammConfig';
docs: ['pool config'];
},
{
name: 'lpMint';
writable: true;
},
{
name: 'tokenAMint';