@drift-labs/sdk
Version:
SDK for Drift Protocol
1,600 lines (1,599 loc) • 808 kB
JSON
{
"address": "vELoC1audYbSYVRXn1vPaV8Axoa9oU6BYmNGZZBDZ1P",
"metadata": {
"name": "drift",
"version": "2.162.0",
"spec": "0.1.0",
"description": "Created with Anchor"
},
"instructions": [
{
"name": "add_amm_constituent_mapping_data",
"discriminator": [
164,
236,
130,
40,
118,
179,
46,
235
],
"accounts": [
{
"name": "admin",
"writable": true,
"signer": true
},
{
"name": "lp_pool"
},
{
"name": "amm_constituent_mapping",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
65,
77,
77,
95,
77,
65,
80
]
},
{
"kind": "account",
"path": "lp_pool"
}
]
}
},
{
"name": "constituent_target_base",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
99,
111,
110,
115,
116,
105,
116,
117,
101,
110,
116,
95,
116,
97,
114,
103,
101,
116,
95,
98,
97,
115,
101,
95,
115,
101,
101,
100
]
},
{
"kind": "account",
"path": "lp_pool"
}
]
}
},
{
"name": "state"
},
{
"name": "system_program",
"address": "11111111111111111111111111111111"
}
],
"args": [
{
"name": "amm_constituent_mapping_data",
"type": {
"vec": {
"defined": {
"name": "AddAmmConstituentMappingDatum"
}
}
}
}
]
},
{
"name": "add_insurance_fund_stake",
"discriminator": [
251,
144,
115,
11,
222,
47,
62,
236
],
"accounts": [
{
"name": "state"
},
{
"name": "spot_market",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
115,
112,
111,
116,
95,
109,
97,
114,
107,
101,
116
]
},
{
"kind": "arg",
"path": "market_index"
}
]
}
},
{
"name": "insurance_fund_stake",
"writable": true
},
{
"name": "user_stats",
"writable": true
},
{
"name": "authority",
"signer": true,
"relations": [
"insurance_fund_stake",
"user_stats"
]
},
{
"name": "spot_market_vault",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
115,
112,
111,
116,
95,
109,
97,
114,
107,
101,
116,
95,
118,
97,
117,
108,
116
]
},
{
"kind": "arg",
"path": "market_index"
}
]
}
},
{
"name": "insurance_fund_vault",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
105,
110,
115,
117,
114,
97,
110,
99,
101,
95,
102,
117,
110,
100,
95,
118,
97,
117,
108,
116
]
},
{
"kind": "arg",
"path": "market_index"
}
]
}
},
{
"name": "drift_signer"
},
{
"name": "user_token_account",
"writable": true
},
{
"name": "token_program"
}
],
"args": [
{
"name": "market_index",
"type": "u16"
},
{
"name": "amount",
"type": "u64"
}
]
},
{
"name": "add_market_to_amm_cache",
"discriminator": [
112,
149,
195,
222,
124,
7,
87,
237
],
"accounts": [
{
"name": "admin",
"writable": true,
"signer": true
},
{
"name": "state"
},
{
"name": "amm_cache",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
97,
109,
109,
95,
99,
97,
99,
104,
101,
95,
115,
101,
101,
100
]
}
]
}
},
{
"name": "perp_market"
},
{
"name": "rent",
"address": "SysvarRent111111111111111111111111111111111"
},
{
"name": "system_program",
"address": "11111111111111111111111111111111"
}
],
"args": []
},
{
"name": "admin_deposit",
"discriminator": [
210,
66,
65,
182,
102,
214,
176,
30
],
"accounts": [
{
"name": "state"
},
{
"name": "user",
"writable": true
},
{
"name": "admin",
"writable": true,
"signer": true
},
{
"name": "spot_market_vault",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
115,
112,
111,
116,
95,
109,
97,
114,
107,
101,
116,
95,
118,
97,
117,
108,
116
]
},
{
"kind": "arg",
"path": "market_index"
}
]
}
},
{
"name": "admin_token_account",
"writable": true
},
{
"name": "token_program"
}
],
"args": [
{
"name": "market_index",
"type": "u16"
},
{
"name": "amount",
"type": "u64"
}
]
},
{
"name": "admin_update_user_stats_paused_operations",
"discriminator": [
183,
104,
63,
150,
240,
199,
3,
10
],
"accounts": [
{
"name": "admin",
"signer": true
},
{
"name": "state"
},
{
"name": "user_stats",
"writable": true
}
],
"args": [
{
"name": "paused_operations",
"type": "u8"
}
]
},
{
"name": "admin_withdraw_from_insurance_fund_vault",
"discriminator": [
228,
208,
191,
246,
169,
58,
189,
213
],
"accounts": [
{
"name": "state"
},
{
"name": "authority",
"writable": true,
"signer": true
},
{
"name": "spot_market",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
115,
112,
111,
116,
95,
109,
97,
114,
107,
101,
116
]
},
{
"kind": "arg",
"path": "market_index"
}
]
}
},
{
"name": "insurance_fund_vault",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
105,
110,
115,
117,
114,
97,
110,
99,
101,
95,
102,
117,
110,
100,
95,
118,
97,
117,
108,
116
]
},
{
"kind": "arg",
"path": "market_index"
}
]
}
},
{
"name": "recipient_token_account",
"writable": true
},
{
"name": "token_program"
},
{
"name": "drift_signer"
}
],
"args": [
{
"name": "market_index",
"type": "u16"
},
{
"name": "amount",
"type": "u64"
}
]
},
{
"name": "begin_insurance_fund_swap",
"discriminator": [
176,
69,
143,
205,
32,
132,
163,
0
],
"accounts": [
{
"name": "state"
},
{
"name": "authority",
"writable": true,
"signer": true
},
{
"name": "out_insurance_fund_vault",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
105,
110,
115,
117,
114,
97,
110,
99,
101,
95,
102,
117,
110,
100,
95,
118,
97,
117,
108,
116
]
},
{
"kind": "arg",
"path": "out_market_index"
}
]
}
},
{
"name": "in_insurance_fund_vault",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
105,
110,
115,
117,
114,
97,
110,
99,
101,
95,
102,
117,
110,
100,
95,
118,
97,
117,
108,
116
]
},
{
"kind": "arg",
"path": "in_market_index"
}
]
}
},
{
"name": "out_token_account",
"writable": true
},
{
"name": "in_token_account",
"writable": true
},
{
"name": "if_rebalance_config",
"writable": true
},
{
"name": "token_program"
},
{
"name": "drift_signer"
},
{
"name": "instructions",
"docs": [
"Instructions Sysvar for instruction introspection"
],
"address": "Sysvar1nstructions1111111111111111111111111"
}
],
"args": [
{
"name": "in_market_index",
"type": "u16"
},
{
"name": "out_market_index",
"type": "u16"
},
{
"name": "amount_in",
"type": "u64"
}
]
},
{
"name": "begin_lp_swap",
"discriminator": [
64,
44,
24,
199,
48,
125,
67,
91
],
"accounts": [
{
"name": "state"
},
{
"name": "admin",
"writable": true,
"signer": true
},
{
"name": "signer_out_token_account",
"docs": [
"Signer token accounts"
],
"writable": true
},
{
"name": "signer_in_token_account",
"writable": true
},
{
"name": "constituent_out_token_account",
"docs": [
"Constituent token accounts"
],
"writable": true
},
{
"name": "constituent_in_token_account",
"writable": true
},
{
"name": "out_constituent",
"docs": [
"Constituents"
],
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
67,
79,
78,
83,
84,
73,
84,
85,
69,
78,
84
]
},
{
"kind": "account",
"path": "lp_pool"
},
{
"kind": "arg",
"path": "out_market_index"
}
]
}
},
{
"name": "in_constituent",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
67,
79,
78,
83,
84,
73,
84,
85,
69,
78,
84
]
},
{
"kind": "account",
"path": "lp_pool"
},
{
"kind": "arg",
"path": "in_market_index"
}
]
}
},
{
"name": "lp_pool"
},
{
"name": "instructions",
"docs": [
"Instructions Sysvar for instruction introspection"
],
"address": "Sysvar1nstructions1111111111111111111111111"
},
{
"name": "token_program"
}
],
"args": [
{
"name": "in_market_index",
"type": "u16"
},
{
"name": "out_market_index",
"type": "u16"
},
{
"name": "amount_in",
"type": "u64"
}
]
},
{
"name": "begin_swap",
"discriminator": [
174,
109,
228,
1,
242,
105,
232,
105
],
"accounts": [
{
"name": "state"
},
{
"name": "user",
"writable": true
},
{
"name": "user_stats",
"writable": true
},
{
"name": "authority",
"signer": true
},
{
"name": "out_spot_market_vault",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
115,
112,
111,
116,
95,
109,
97,
114,
107,
101,
116,
95,
118,
97,
117,
108,
116
]
},
{
"kind": "arg",
"path": "out_market_index"
}
]
}
},
{
"name": "in_spot_market_vault",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
115,
112,
111,
116,
95,
109,
97,
114,
107,
101,
116,
95,
118,
97,
117,
108,
116
]
},
{
"kind": "arg",
"path": "in_market_index"
}
]
}
},
{
"name": "out_token_account",
"writable": true
},
{
"name": "in_token_account",
"writable": true
},
{
"name": "token_program"
},
{
"name": "drift_signer"
},
{
"name": "instructions",
"docs": [
"Instructions Sysvar for instruction introspection"
],
"address": "Sysvar1nstructions1111111111111111111111111"
}
],
"args": [
{
"name": "in_market_index",
"type": "u16"
},
{
"name": "out_market_index",
"type": "u16"
},
{
"name": "amount_in",
"type": "u64"
}
]
},
{
"name": "cancel_order",
"discriminator": [
95,
129,
237,
240,
8,
49,
223,
132
],
"accounts": [
{
"name": "state"
},
{
"name": "user",
"writable": true
},
{
"name": "authority",
"signer": true
}
],
"args": [
{
"name": "order_id",
"type": {
"option": "u32"
}
}
]
},
{
"name": "cancel_order_by_user_id",
"discriminator": [
107,
211,
250,
133,
18,
37,
57,
100
],
"accounts": [
{
"name": "state"
},
{
"name": "user",
"writable": true
},
{
"name": "authority",
"signer": true
}
],
"args": [
{
"name": "user_order_id",
"type": "u8"
}
]
},
{
"name": "cancel_orders",
"discriminator": [
238,
225,
95,
158,
227,
103,
8,
194
],
"accounts": [
{
"name": "state"
},
{
"name": "user",
"writable": true
},
{
"name": "authority",
"signer": true
}
],
"args": [
{
"name": "market_type",
"type": {
"option": {
"defined": {
"name": "MarketType"
}
}
}
},
{
"name": "market_index",
"type": {
"option": "u16"
}
},
{
"name": "direction",
"type": {
"option": {
"defined": {
"name": "PositionDirection"
}
}
}
}
]
},
{
"name": "cancel_orders_by_ids",
"discriminator": [
134,
19,
144,
165,
94,
240,
210,
94
],
"accounts": [
{
"name": "state"
},
{
"name": "user",
"writable": true
},
{
"name": "authority",
"signer": true
}
],
"args": [
{
"name": "order_ids",
"type": {
"vec": "u32"
}
}
]
},
{
"name": "cancel_request_remove_insurance_fund_stake",
"discriminator": [
97,
235,
78,
62,
212,
42,
241,
127
],
"accounts": [
{
"name": "spot_market",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
115,
112,
111,
116,
95,
109,
97,
114,
107,
101,
116
]
},
{
"kind": "arg",
"path": "market_index"
}
]
}
},
{
"name": "insurance_fund_stake",
"writable": true
},
{
"name": "user_stats",
"writable": true
},
{
"name": "authority",
"signer": true,
"relations": [
"insurance_fund_stake",
"user_stats"
]
},
{
"name": "insurance_fund_vault",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
105,
110,
115,
117,
114,
97,
110,
99,
101,
95,
102,
117,
110,
100,
95,
118,
97,
117,
108,
116
]
},
{
"kind": "arg",
"path": "market_index"
}
]
}
}
],
"args": [
{
"name": "market_index",
"type": "u16"
}
]
},
{
"name": "change_approved_builder",
"discriminator": [
179,
134,
211,
45,
195,
5,
189,
173
],
"accounts": [
{
"name": "escrow",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
82,
69,
86,
95,
69,
83,
67,
82,
79,
87
]
},
{
"kind": "account",
"path": "authority"
}
]
}
},
{
"name": "authority",
"signer": true,
"relations": [
"escrow"
]
},
{
"name": "payer",
"writable": true,
"signer": true
},
{
"name": "system_program",
"address": "11111111111111111111111111111111"
}
],
"args": [
{
"name": "builder",
"type": "pubkey"
},
{
"name": "max_fee_bps",
"type": "u16"
},
{
"name": "add",
"type": "bool"
}
]
},
{
"name": "change_signed_msg_ws_delegate_status",
"discriminator": [
252,
202,
252,
219,
179,
27,
84,
138
],
"accounts": [
{
"name": "signed_msg_ws_delegates",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
83,
73,
71,
78,
69,
68,
95,
77,
83,
71,
95,
87,
83
]
},
{
"kind": "account",
"path": "authority"
}
]
}
},
{
"name": "authority",
"writable": true,
"signer": true
},
{
"name": "system_program",
"address": "11111111111111111111111111111111"
}
],
"args": [
{
"name": "delegate",
"type": "pubkey"
},
{
"name": "add",
"type": "bool"
}
]
},
{
"name": "delete_amm_cache",
"discriminator": [
216,
130,
215,
206,
233,
232,
191,
88
],
"accounts": [
{
"name": "admin",
"writable": true,
"signer": true
},
{
"name": "state"
},
{
"name": "amm_cache",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
97,
109,
109,
95,
99,
97,
99,
104,
101,
95,
115,
101,
101,
100
]
}
]
}
}
],
"args": []
},
{
"name": "delete_initialized_perp_market",
"discriminator": [
91,
154,
24,
87,
106,
59,
190,
66
],
"accounts": [
{
"name": "admin",
"writable": true,
"signer": true,
"relations": [
"state"
]
},
{
"name": "state",
"writable": true
},
{
"name": "perp_market",
"writable": true
}
],
"args": [
{
"name": "market_index",
"type": "u16"
}
]
},
{
"name": "delete_initialized_spot_market",
"discriminator": [
31,
140,
67,
191,
189,
20,
101,
221
],
"accounts": [
{
"name": "admin",
"writable": true,
"signer": true,
"relations": [
"state"
]
},
{
"name": "state",
"writable": true
},
{
"name": "spot_market",
"writable": true
},
{
"name": "spot_market_vault",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
115,
112,
111,
116,
95,
109,
97,
114,
107,
101,
116,
95,
118,
97,
117,
108,
116
]
},
{
"kind": "arg",
"path": "market_index"
}
]
}
},
{
"name": "insurance_fund_vault",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
105,
110,
115,
117,
114,
97,
110,
99,
101,
95,
102,
117,
110,
100,
95,
118,
97,
117,
108,
116
]
},
{
"kind": "arg",
"path": "market_index"
}
]
}
},
{
"name": "drift_signer"
},
{
"name": "token_program"
}
],
"args": [
{
"name": "market_index",
"type": "u16"
}
]
},
{
"name": "delete_openbook_v2_fulfillment_config",
"discriminator": [
18,
198,
138,
142,
138,
48,
79,
187
],
"accounts": [
{
"name": "state"
},
{
"name": "openbook_v2_fulfillment_config",
"writable": true
},
{
"name": "admin",
"writable": true,
"signer": true
}
],
"args": []
},
{
"name": "delete_prelaunch_oracle",
"discriminator": [
59,
169,
100,
49,
69,
17,
173,
253
],
"accounts": [
{
"name": "admin",
"writable": true,