@blockchainbros/vidar-amm-sdk
Version:
TypeScript SDK for Vidar AMM on Solana
1,588 lines (1,587 loc) • 81 kB
JSON
{
"address": "ViDArcFahV8Csf8wQomc8kvCLmXxF8d1hV5FaYX68yQ",
"metadata": {
"name": "vidar_amm",
"version": "0.1.0",
"spec": "0.1.0",
"description": "Created with Anchor"
},
"instructions": [
{
"name": "add_liquidity",
"discriminator": [
181,
157,
89,
67,
143,
182,
52,
72
],
"accounts": [
{
"name": "user",
"writable": true,
"signer": true
},
{
"name": "pool",
"writable": true
},
{
"name": "user_token_a",
"writable": true
},
{
"name": "user_token_b",
"writable": true
},
{
"name": "vault_a",
"writable": true
},
{
"name": "vault_b",
"writable": true
},
{
"name": "lp_mint",
"writable": true
},
{
"name": "user_lp_token",
"writable": true
},
{
"name": "authority",
"pda": {
"seeds": [
{
"kind": "const",
"value": [
97,
117,
116,
104,
111,
114,
105,
116,
121
]
},
{
"kind": "account",
"path": "pool"
}
]
}
},
{
"name": "position",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
112,
111,
115,
105,
116,
105,
111,
110
]
},
{
"kind": "account",
"path": "pool"
},
{
"kind": "account",
"path": "user"
}
]
}
},
{
"name": "token_program",
"address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
},
{
"name": "system_program",
"address": "11111111111111111111111111111111"
},
{
"name": "rent",
"address": "SysvarRent111111111111111111111111111111111"
}
],
"args": [
{
"name": "amount_a",
"type": "u64"
},
{
"name": "amount_b",
"type": "u64"
}
]
},
{
"name": "calculate_swap_output",
"discriminator": [
152,
241,
173,
58,
148,
31,
156,
19
],
"accounts": [
{
"name": "pool"
},
{
"name": "vault_source"
},
{
"name": "vault_destination"
}
],
"args": [
{
"name": "args",
"type": {
"defined": {
"name": "CalculateSwapArgs"
}
}
}
]
},
{
"name": "cancel_commit",
"discriminator": [
158,
121,
111,
125,
253,
235,
148,
78
],
"accounts": [
{
"name": "caller",
"writable": true,
"signer": true
},
{
"name": "commit",
"writable": true
},
{
"name": "pool",
"writable": true
},
{
"name": "commit_index",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
99,
111,
109,
109,
105,
116,
95,
105,
110,
100,
101,
120
]
},
{
"kind": "account",
"path": "pool"
},
{
"kind": "account",
"path": "user"
}
]
}
},
{
"name": "refund_to"
},
{
"name": "user"
}
],
"args": []
},
{
"name": "claim_fees",
"discriminator": [
82,
251,
233,
156,
12,
52,
184,
202
],
"accounts": [
{
"name": "user",
"writable": true,
"signer": true
},
{
"name": "stake_account",
"writable": true
},
{
"name": "pool",
"writable": true
},
{
"name": "reward_vault",
"writable": true
},
{
"name": "user_reward_account",
"writable": true
},
{
"name": "authority",
"pda": {
"seeds": [
{
"kind": "const",
"value": [
97,
117,
116,
104,
111,
114,
105,
116,
121
]
},
{
"kind": "account",
"path": "pool"
}
]
}
},
{
"name": "token_program",
"address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
}
],
"args": []
},
{
"name": "claim_protocol_fees",
"discriminator": [
34,
142,
219,
112,
109,
54,
133,
23
],
"accounts": [
{
"name": "pool",
"writable": true
},
{
"name": "fee_vault",
"writable": true
},
{
"name": "treasury",
"writable": true
},
{
"name": "authority",
"pda": {
"seeds": [
{
"kind": "const",
"value": [
97,
117,
116,
104,
111,
114,
105,
116,
121
]
},
{
"kind": "account",
"path": "pool"
}
]
}
},
{
"name": "token_program",
"address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
}
],
"args": []
},
{
"name": "claim_rewards",
"discriminator": [
4,
144,
132,
71,
116,
23,
151,
80
],
"accounts": [
{
"name": "user",
"writable": true,
"signer": true
},
{
"name": "pool",
"writable": true
},
{
"name": "stake_account",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
115,
116,
97,
107,
101
]
},
{
"kind": "account",
"path": "pool"
},
{
"kind": "account",
"path": "user"
}
]
}
},
{
"name": "staking_reward_vault",
"writable": true
},
{
"name": "lp_stake_vault",
"writable": true
},
{
"name": "user_reward_account",
"writable": true
},
{
"name": "authority",
"pda": {
"seeds": [
{
"kind": "const",
"value": [
97,
117,
116,
104,
111,
114,
105,
116,
121
]
},
{
"kind": "account",
"path": "pool"
}
]
}
},
{
"name": "token_program",
"address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
}
],
"args": []
},
{
"name": "claim_staking_fees",
"discriminator": [
41,
122,
96,
254,
10,
172,
37,
75
],
"accounts": [
{
"name": "user",
"writable": true,
"signer": true
},
{
"name": "pool",
"writable": true
},
{
"name": "stake_account",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
115,
116,
97,
107,
101
]
},
{
"kind": "account",
"path": "pool"
},
{
"kind": "account",
"path": "user"
}
]
}
},
{
"name": "staking_reward_vault",
"writable": true
},
{
"name": "user_reward_account",
"writable": true
},
{
"name": "authority",
"pda": {
"seeds": [
{
"kind": "const",
"value": [
97,
117,
116,
104,
111,
114,
105,
116,
121
]
},
{
"kind": "account",
"path": "pool"
}
]
}
},
{
"name": "token_program",
"address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
}
],
"args": []
},
{
"name": "configure_pool",
"discriminator": [
122,
51,
212,
114,
239,
222,
177,
163
],
"accounts": [
{
"name": "pool",
"writable": true
},
{
"name": "admin",
"signer": true,
"relations": [
"pool"
]
}
],
"args": [
{
"name": "fee_basis_points",
"type": "u16"
},
{
"name": "is_stable",
"type": "u8"
},
{
"name": "pause",
"type": "u8"
}
]
},
{
"name": "create_liquidity_position",
"discriminator": [
139,
114,
205,
81,
29,
227,
80,
50
],
"accounts": [
{
"name": "user",
"writable": true,
"signer": true
},
{
"name": "pool",
"writable": true
},
{
"name": "position",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
112,
111,
115,
105,
116,
105,
111,
110
]
},
{
"kind": "account",
"path": "pool"
},
{
"kind": "account",
"path": "user"
}
]
}
},
{
"name": "system_program",
"address": "11111111111111111111111111111111"
},
{
"name": "rent",
"address": "SysvarRent111111111111111111111111111111111"
}
],
"args": []
},
{
"name": "emergency_withdraw",
"discriminator": [
239,
45,
203,
64,
150,
73,
218,
92
],
"accounts": [
{
"name": "user",
"writable": true,
"signer": true
},
{
"name": "stake_account",
"writable": true
},
{
"name": "pool",
"writable": true
},
{
"name": "stake_vault",
"writable": true
},
{
"name": "user_lp_token",
"writable": true
},
{
"name": "authority",
"pda": {
"seeds": [
{
"kind": "const",
"value": [
97,
117,
116,
104,
111,
114,
105,
116,
121
]
},
{
"kind": "account",
"path": "pool"
}
]
}
},
{
"name": "token_program",
"address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
}
],
"args": []
},
{
"name": "init_pool",
"discriminator": [
116,
233,
199,
204,
115,
159,
171,
36
],
"accounts": [
{
"name": "pool",
"writable": true
},
{
"name": "admin",
"signer": true
},
{
"name": "authority"
},
{
"name": "vault_a"
},
{
"name": "vault_b"
},
{
"name": "fee_vault"
},
{
"name": "staking_reward_vault"
},
{
"name": "lp_stake_vault"
}
],
"args": []
},
{
"name": "init_pool_meta",
"discriminator": [
122,
252,
178,
102,
28,
97,
101,
127
],
"accounts": [
{
"name": "payer",
"writable": true,
"signer": true
},
{
"name": "pool",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
112,
111,
111,
108
]
},
{
"kind": "account",
"path": "token_a"
},
{
"kind": "account",
"path": "token_b"
},
{
"kind": "arg",
"path": "params.fee_basis_points"
}
]
}
},
{
"name": "authority",
"pda": {
"seeds": [
{
"kind": "const",
"value": [
97,
117,
116,
104,
111,
114,
105,
116,
121
]
},
{
"kind": "account",
"path": "pool"
}
]
}
},
{
"name": "token_a"
},
{
"name": "token_b"
},
{
"name": "lp_mint",
"writable": true
},
{
"name": "system_program",
"address": "11111111111111111111111111111111"
},
{
"name": "rent",
"address": "SysvarRent111111111111111111111111111111111"
}
],
"args": [
{
"name": "params",
"type": {
"defined": {
"name": "PoolParams"
}
}
}
]
},
{
"name": "initialize_stake",
"discriminator": [
33,
175,
216,
4,
116,
130,
164,
177
],
"accounts": [
{
"name": "user",
"writable": true,
"signer": true
},
{
"name": "pool",
"writable": true
},
{
"name": "stake_vault",
"writable": true
},
{
"name": "user_lp_token",
"writable": true
},
{
"name": "authority",
"pda": {
"seeds": [
{
"kind": "const",
"value": [
97,
117,
116,
104,
111,
114,
105,
116,
121
]
},
{
"kind": "account",
"path": "pool"
}
]
}
},
{
"name": "stake_account",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
115,
116,
97,
107,
101
]
},
{
"kind": "account",
"path": "pool"
},
{
"kind": "account",
"path": "user"
}
]
}
},
{
"name": "token_program",
"address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
},
{
"name": "system_program",
"address": "11111111111111111111111111111111"
},
{
"name": "rent",
"address": "SysvarRent111111111111111111111111111111111"
}
],
"args": []
},
{
"name": "refresh_oracle",
"discriminator": [
110,
168,
158,
3,
43,
46,
41,
91
],
"accounts": [
{
"name": "pool",
"writable": true
},
{
"name": "vault_a"
},
{
"name": "vault_b"
}
],
"args": [
{
"name": "args",
"type": {
"defined": {
"name": "RefreshOracleArgs"
}
}
}
]
},
{
"name": "remove_liquidity",
"discriminator": [
80,
85,
209,
72,
24,
206,
177,
108
],
"accounts": [
{
"name": "user",
"writable": true,
"signer": true
},
{
"name": "pool",
"writable": true
},
{
"name": "vault_a",
"writable": true
},
{
"name": "vault_b",
"writable": true
},
{
"name": "user_token_a",
"writable": true
},
{
"name": "user_token_b",
"writable": true
},
{
"name": "lp_mint",
"writable": true
},
{
"name": "user_lp_token",
"writable": true
},
{
"name": "position",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
112,
111,
115,
105,
116,
105,
111,
110
]
},
{
"kind": "account",
"path": "pool"
},
{
"kind": "account",
"path": "user"
}
]
}
},
{
"name": "authority",
"pda": {
"seeds": [
{
"kind": "const",
"value": [
97,
117,
116,
104,
111,
114,
105,
116,
121
]
},
{
"kind": "account",
"path": "pool"
}
]
}
},
{
"name": "token_program",
"address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
}
],
"args": [
{
"name": "lp_amount",
"type": "u64"
}
]
},
{
"name": "stake",
"discriminator": [
206,
176,
202,
18,
200,
209,
179,
108
],
"accounts": [
{
"name": "user",
"writable": true,
"signer": true
},
{
"name": "pool",
"writable": true
},
{
"name": "stake_vault",
"writable": true
},
{
"name": "user_lp_token",
"writable": true
},
{
"name": "authority",
"pda": {
"seeds": [
{
"kind": "const",
"value": [
97,
117,
116,
104,
111,
114,
105,
116,
121
]
},
{
"kind": "account",
"path": "pool"
}
]
}
},
{
"name": "stake_account",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
115,
116,
97,
107,
101
]
},
{
"kind": "account",
"path": "pool"
},
{
"kind": "account",
"path": "user"
}
]
}
},
{
"name": "token_program",
"address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
},
{
"name": "system_program",
"address": "11111111111111111111111111111111"
},
{
"name": "rent",
"address": "SysvarRent111111111111111111111111111111111"
}
],
"args": [
{
"name": "amount",
"type": "u64"
}
]
},
{
"name": "swap",
"discriminator": [
248,
198,
158,
145,
225,
117,
135,
200
],
"accounts": [
{
"name": "user",
"writable": true,
"signer": true
},
{
"name": "pool",
"writable": true
},
{
"name": "user_source",
"writable": true
},
{
"name": "user_destination",
"writable": true,
"pda": {
"seeds": [
{
"kind": "account",
"path": "user"
},
{
"kind": "const",
"value": [
6,
221,
246,
225,
215,
101,
161,
147,
217,
203,
225,
70,
206,
235,
121,
172,
28,
180,
133,
237,
95,
91,
55,
145,
58,
140,
245,
133,
126,
255,
0,
169
]
},
{
"kind": "account",
"path": "vault_destination_mint"
}
],
"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": "vault_destination_mint",
"writable": true
},
{
"name": "vault_source",
"writable": true
},
{
"name": "vault_destination",
"writable": true
},
{
"name": "fee_vault",
"writable": true
},
{
"name": "staking_reward_vault",
"writable": true
},
{
"name": "authority",
"pda": {
"seeds": [
{
"kind": "const",
"value": [
97,
117,
116,
104,
111,
114,
105,
116,
121
]
},
{
"kind": "account",
"path": "pool"
}
]
}
},
{
"name": "vault_source_mint"
},
{
"name": "associated_token_program",
"address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
},
{
"name": "token_program",
"address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
},
{
"name": "system_program",
"address": "11111111111111111111111111111111"
}
],
"args": [
{
"name": "args",
"type": {
"defined": {
"name": "SwapArgs"
}
}
}
]
},
{
"name": "swap_commit",
"discriminator": [
90,
50,
217,
183,
180,
248,
122,
157
],
"accounts": [
{
"name": "user",
"writable": true,
"signer": true
},
{
"name": "pool",
"writable": true
},
{
"name": "commit",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
99,
111,
109,
109,
105,
116
]
},
{
"kind": "account",
"path": "pool"
},
{
"kind": "account",
"path": "user"
},
{
"kind": "arg",
"path": "order_hash"
}
]
}
},
{
"name": "commit_index",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
99,
111,
109,
109,
105,
116,
95,
105,
110,
100,
101,
120
]
},
{
"kind": "account",
"path": "pool"
},
{
"kind": "account",
"path": "user"
}
]
}
},
{
"name": "system_program",
"address": "11111111111111111111111111111111"
}
],
"args": [
{
"name": "order_hash",
"type": {
"array": [
"u8",
32
]
}
}
]
},
{
"name": "swap_reveal",
"discriminator": [
150,
100,
57,
83,
102,
81,
212,
250
],
"accounts": [
{
"name": "user",
"writable": true,
"signer": true
},
{
"name": "pool",
"writable": true
},
{
"name": "user_source",
"writable": true
},
{
"name": "user_dest",
"writable": true,
"pda": {
"seeds": [
{
"kind": "account",
"path": "user"
},
{
"kind": "const",
"value": [
6,
221,
246,
225,
215,
101,
161,
147,
217,
203,
225,
70,
206,
235,
121,
172,
28,
180,
133,
237,
95,
91,
55,
145,
58,
140,
245,
133,
126,
255,
0,
169
]
},
{
"kind": "account",
"path": "vault_destination_mint"
}
],
"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,