@drift-labs/sdk
Version:
SDK for Drift Protocol
1,541 lines (1,540 loc) • 695 kB
TypeScript
/**
* 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/drift.json`.
*/
export type Drift = {
address: 'vELoC1audYbSYVRXn1vPaV8Axoa9oU6BYmNGZZBDZ1P';
metadata: {
name: 'drift';
version: '2.162.0';
spec: '0.1.0';
description: 'Created with Anchor';
};
instructions: [
{
name: 'addAmmConstituentMappingData';
discriminator: [164, 236, 130, 40, 118, 179, 46, 235];
accounts: [
{
name: 'admin';
writable: true;
signer: true;
},
{
name: 'lpPool';
},
{
name: 'ammConstituentMapping';
writable: true;
pda: {
seeds: [
{
kind: 'const';
value: [65, 77, 77, 95, 77, 65, 80];
},
{
kind: 'account';
path: 'lpPool';
}
];
};
},
{
name: 'constituentTargetBase';
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: 'lpPool';
}
];
};
},
{
name: 'state';
},
{
name: 'systemProgram';
address: '11111111111111111111111111111111';
}
];
args: [
{
name: 'ammConstituentMappingData';
type: {
vec: {
defined: {
name: 'addAmmConstituentMappingDatum';
};
};
};
}
];
},
{
name: 'addInsuranceFundStake';
discriminator: [251, 144, 115, 11, 222, 47, 62, 236];
accounts: [
{
name: 'state';
},
{
name: 'spotMarket';
writable: true;
pda: {
seeds: [
{
kind: 'const';
value: [115, 112, 111, 116, 95, 109, 97, 114, 107, 101, 116];
},
{
kind: 'arg';
path: 'marketIndex';
}
];
};
},
{
name: 'insuranceFundStake';
writable: true;
},
{
name: 'userStats';
writable: true;
},
{
name: 'authority';
signer: true;
relations: ['insuranceFundStake', 'userStats'];
},
{
name: 'spotMarketVault';
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: 'marketIndex';
}
];
};
},
{
name: 'insuranceFundVault';
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: 'marketIndex';
}
];
};
},
{
name: 'driftSigner';
},
{
name: 'userTokenAccount';
writable: true;
},
{
name: 'tokenProgram';
}
];
args: [
{
name: 'marketIndex';
type: 'u16';
},
{
name: 'amount';
type: 'u64';
}
];
},
{
name: 'addMarketToAmmCache';
discriminator: [112, 149, 195, 222, 124, 7, 87, 237];
accounts: [
{
name: 'admin';
writable: true;
signer: true;
},
{
name: 'state';
},
{
name: 'ammCache';
writable: true;
pda: {
seeds: [
{
kind: 'const';
value: [
97,
109,
109,
95,
99,
97,
99,
104,
101,
95,
115,
101,
101,
100
];
}
];
};
},
{
name: 'perpMarket';
},
{
name: 'rent';
address: 'SysvarRent111111111111111111111111111111111';
},
{
name: 'systemProgram';
address: '11111111111111111111111111111111';
}
];
args: [];
},
{
name: 'adminDeposit';
discriminator: [210, 66, 65, 182, 102, 214, 176, 30];
accounts: [
{
name: 'state';
},
{
name: 'user';
writable: true;
},
{
name: 'admin';
writable: true;
signer: true;
},
{
name: 'spotMarketVault';
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: 'marketIndex';
}
];
};
},
{
name: 'adminTokenAccount';
writable: true;
},
{
name: 'tokenProgram';
}
];
args: [
{
name: 'marketIndex';
type: 'u16';
},
{
name: 'amount';
type: 'u64';
}
];
},
{
name: 'adminUpdateUserStatsPausedOperations';
discriminator: [183, 104, 63, 150, 240, 199, 3, 10];
accounts: [
{
name: 'admin';
signer: true;
},
{
name: 'state';
},
{
name: 'userStats';
writable: true;
}
];
args: [
{
name: 'pausedOperations';
type: 'u8';
}
];
},
{
name: 'adminWithdrawFromInsuranceFundVault';
discriminator: [228, 208, 191, 246, 169, 58, 189, 213];
accounts: [
{
name: 'state';
},
{
name: 'authority';
writable: true;
signer: true;
},
{
name: 'spotMarket';
writable: true;
pda: {
seeds: [
{
kind: 'const';
value: [115, 112, 111, 116, 95, 109, 97, 114, 107, 101, 116];
},
{
kind: 'arg';
path: 'marketIndex';
}
];
};
},
{
name: 'insuranceFundVault';
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: 'marketIndex';
}
];
};
},
{
name: 'recipientTokenAccount';
writable: true;
},
{
name: 'tokenProgram';
},
{
name: 'driftSigner';
}
];
args: [
{
name: 'marketIndex';
type: 'u16';
},
{
name: 'amount';
type: 'u64';
}
];
},
{
name: 'beginInsuranceFundSwap';
discriminator: [176, 69, 143, 205, 32, 132, 163, 0];
accounts: [
{
name: 'state';
},
{
name: 'authority';
writable: true;
signer: true;
},
{
name: 'outInsuranceFundVault';
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: 'outMarketIndex';
}
];
};
},
{
name: 'inInsuranceFundVault';
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: 'inMarketIndex';
}
];
};
},
{
name: 'outTokenAccount';
writable: true;
},
{
name: 'inTokenAccount';
writable: true;
},
{
name: 'ifRebalanceConfig';
writable: true;
},
{
name: 'tokenProgram';
},
{
name: 'driftSigner';
},
{
name: 'instructions';
docs: ['Instructions Sysvar for instruction introspection'];
address: 'Sysvar1nstructions1111111111111111111111111';
}
];
args: [
{
name: 'inMarketIndex';
type: 'u16';
},
{
name: 'outMarketIndex';
type: 'u16';
},
{
name: 'amountIn';
type: 'u64';
}
];
},
{
name: 'beginLpSwap';
discriminator: [64, 44, 24, 199, 48, 125, 67, 91];
accounts: [
{
name: 'state';
},
{
name: 'admin';
writable: true;
signer: true;
},
{
name: 'signerOutTokenAccount';
docs: ['Signer token accounts'];
writable: true;
},
{
name: 'signerInTokenAccount';
writable: true;
},
{
name: 'constituentOutTokenAccount';
docs: ['Constituent token accounts'];
writable: true;
},
{
name: 'constituentInTokenAccount';
writable: true;
},
{
name: 'outConstituent';
docs: ['Constituents'];
writable: true;
pda: {
seeds: [
{
kind: 'const';
value: [67, 79, 78, 83, 84, 73, 84, 85, 69, 78, 84];
},
{
kind: 'account';
path: 'lpPool';
},
{
kind: 'arg';
path: 'outMarketIndex';
}
];
};
},
{
name: 'inConstituent';
writable: true;
pda: {
seeds: [
{
kind: 'const';
value: [67, 79, 78, 83, 84, 73, 84, 85, 69, 78, 84];
},
{
kind: 'account';
path: 'lpPool';
},
{
kind: 'arg';
path: 'inMarketIndex';
}
];
};
},
{
name: 'lpPool';
},
{
name: 'instructions';
docs: ['Instructions Sysvar for instruction introspection'];
address: 'Sysvar1nstructions1111111111111111111111111';
},
{
name: 'tokenProgram';
}
];
args: [
{
name: 'inMarketIndex';
type: 'u16';
},
{
name: 'outMarketIndex';
type: 'u16';
},
{
name: 'amountIn';
type: 'u64';
}
];
},
{
name: 'beginSwap';
discriminator: [174, 109, 228, 1, 242, 105, 232, 105];
accounts: [
{
name: 'state';
},
{
name: 'user';
writable: true;
},
{
name: 'userStats';
writable: true;
},
{
name: 'authority';
signer: true;
},
{
name: 'outSpotMarketVault';
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: 'outMarketIndex';
}
];
};
},
{
name: 'inSpotMarketVault';
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: 'inMarketIndex';
}
];
};
},
{
name: 'outTokenAccount';
writable: true;
},
{
name: 'inTokenAccount';
writable: true;
},
{
name: 'tokenProgram';
},
{
name: 'driftSigner';
},
{
name: 'instructions';
docs: ['Instructions Sysvar for instruction introspection'];
address: 'Sysvar1nstructions1111111111111111111111111';
}
];
args: [
{
name: 'inMarketIndex';
type: 'u16';
},
{
name: 'outMarketIndex';
type: 'u16';
},
{
name: 'amountIn';
type: 'u64';
}
];
},
{
name: 'cancelOrder';
discriminator: [95, 129, 237, 240, 8, 49, 223, 132];
accounts: [
{
name: 'state';
},
{
name: 'user';
writable: true;
},
{
name: 'authority';
signer: true;
}
];
args: [
{
name: 'orderId';
type: {
option: 'u32';
};
}
];
},
{
name: 'cancelOrderByUserId';
discriminator: [107, 211, 250, 133, 18, 37, 57, 100];
accounts: [
{
name: 'state';
},
{
name: 'user';
writable: true;
},
{
name: 'authority';
signer: true;
}
];
args: [
{
name: 'userOrderId';
type: 'u8';
}
];
},
{
name: 'cancelOrders';
discriminator: [238, 225, 95, 158, 227, 103, 8, 194];
accounts: [
{
name: 'state';
},
{
name: 'user';
writable: true;
},
{
name: 'authority';
signer: true;
}
];
args: [
{
name: 'marketType';
type: {
option: {
defined: {
name: 'marketType';
};
};
};
},
{
name: 'marketIndex';
type: {
option: 'u16';
};
},
{
name: 'direction';
type: {
option: {
defined: {
name: 'positionDirection';
};
};
};
}
];
},
{
name: 'cancelOrdersByIds';
discriminator: [134, 19, 144, 165, 94, 240, 210, 94];
accounts: [
{
name: 'state';
},
{
name: 'user';
writable: true;
},
{
name: 'authority';
signer: true;
}
];
args: [
{
name: 'orderIds';
type: {
vec: 'u32';
};
}
];
},
{
name: 'cancelRequestRemoveInsuranceFundStake';
discriminator: [97, 235, 78, 62, 212, 42, 241, 127];
accounts: [
{
name: 'spotMarket';
writable: true;
pda: {
seeds: [
{
kind: 'const';
value: [115, 112, 111, 116, 95, 109, 97, 114, 107, 101, 116];
},
{
kind: 'arg';
path: 'marketIndex';
}
];
};
},
{
name: 'insuranceFundStake';
writable: true;
},
{
name: 'userStats';
writable: true;
},
{
name: 'authority';
signer: true;
relations: ['insuranceFundStake', 'userStats'];
},
{
name: 'insuranceFundVault';
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: 'marketIndex';
}
];
};
}
];
args: [
{
name: 'marketIndex';
type: 'u16';
}
];
},
{
name: 'changeApprovedBuilder';
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: 'systemProgram';
address: '11111111111111111111111111111111';
}
];
args: [
{
name: 'builder';
type: 'pubkey';
},
{
name: 'maxFeeBps';
type: 'u16';
},
{
name: 'add';
type: 'bool';
}
];
},
{
name: 'changeSignedMsgWsDelegateStatus';
discriminator: [252, 202, 252, 219, 179, 27, 84, 138];
accounts: [
{
name: 'signedMsgWsDelegates';
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: 'systemProgram';
address: '11111111111111111111111111111111';
}
];
args: [
{
name: 'delegate';
type: 'pubkey';
},
{
name: 'add';
type: 'bool';
}
];
},
{
name: 'deleteAmmCache';
discriminator: [216, 130, 215, 206, 233, 232, 191, 88];
accounts: [
{
name: 'admin';
writable: true;
signer: true;
},
{
name: 'state';
},
{
name: 'ammCache';
writable: true;
pda: {
seeds: [
{
kind: 'const';
value: [
97,
109,
109,
95,
99,
97,
99,
104,
101,
95,
115,
101,
101,
100
];
}
];
};
}
];
args: [];
},
{
name: 'deleteInitializedPerpMarket';
discriminator: [91, 154, 24, 87, 106, 59, 190, 66];
accounts: [
{
name: 'admin';
writable: true;
signer: true;
relations: ['state'];
},
{
name: 'state';
writable: true;
},
{
name: 'perpMarket';
writable: true;
}
];
args: [
{
name: 'marketIndex';
type: 'u16';
}
];
},
{
name: 'deleteInitializedSpotMarket';
discriminator: [31, 140, 67, 191, 189, 20, 101, 221];
accounts: [
{
name: 'admin';
writable: true;
signer: true;
relations: ['state'];
},
{
name: 'state';
writable: true;
},
{
name: 'spotMarket';
writable: true;
},
{
name: 'spotMarketVault';
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: 'marketIndex';
}
];
};
},
{
name: 'insuranceFundVault';
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: 'marketIndex';
}
];
};
},
{
name: 'driftSigner';
},
{
name: 'tokenProgram';
}
];
args: [
{
name: 'marketIndex';
type: 'u16';
}
];
},
{
name: 'deleteOpenbookV2FulfillmentConfig';
discriminator: [18, 198, 138, 142, 138, 48, 79, 187];
accounts: [
{
name: 'state';
},
{
name: 'openbookV2FulfillmentConfig';
writable: true;
},
{
name: 'admin';
writable: true;
signer: true;
}
];
args: [];
},
{
name: 'deletePrelaunchOracle';
discriminator: [59, 169, 100, 49, 69, 17, 173, 253];
accounts: [
{
name: 'admin';
writable: true;
signer: true;
relations: ['state'];
},
{
name: 'prelaunchOracle';
writable: true;
pda: {
seeds: [
{
kind: 'const';
value: [
112,
114,
101,
108,
97,
117,
110,
99,
104,
95,
111,
114,
97,
99,
108,
101
];
},
{
kind: 'arg';
path: 'perpMarketIndex';
}
];
};
},
{
name: 'perpMarket';
},
{
name: 'state';
}
];
args: [
{
name: 'perpMarketIndex';
type: 'u16';
}
];
},
{
name: 'deleteSerumFulfillmentConfig';
discriminator: [30, 143, 88, 48, 249, 103, 154, 255];
accounts: [
{
name: 'state';
},
{
name: 'serumFulfillmentConfig';
writable: true;
},
{
name: 'admin';
writable: true;
signer: true;
}
];
args: [];
},
{
name: 'deleteSignedMsgUserOrders';
discriminator: [221, 247, 128, 253, 212, 254, 46, 153];
accounts: [
{
name: 'signedMsgUserOrders';
writable: true;
pda: {
seeds: [
{
kind: 'const';
value: [83, 73, 71, 78, 69, 68, 95, 77, 83, 71];
},
{
kind: 'account';
path: 'authority';
}
];
};
},
{
name: 'state';
writable: true;
},
{
name: 'authority';
signer: true;
}
];
args: [];
},
{
name: 'deleteUser';
discriminator: [186, 85, 17, 249, 219, 231, 98, 251];
accounts: [
{
name: 'user';
writable: true;
},
{
name: 'userStats';
writable: true;
},
{
name: 'state';
writable: true;
},
{
name: 'authority';
writable: true;
signer: true;
relations: ['user', 'userStats'];
}
];
args: [];
},
{
name: 'deposit';
discriminator: [242, 35, 198, 137, 82, 225, 242, 182];
accounts: [
{
name: 'state';
},
{
name: 'user';
writable: true;
},
{
name: 'userStats';
writable: true;
},
{
name: 'authority';
signer: true;
},
{
name: 'spotMarketVault';
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: 'marketIndex';
}
];
};
},
{
name: 'userTokenAccount';
writable: true;
},
{
name: 'tokenProgram';
}
];
args: [
{
name: 'marketIndex';
type: 'u16';
},
{
name: 'amount';
type: 'u64';
},
{
name: 'reduceOnly';
type: 'bool';
}
];
},
{
name: 'depositIntoInsuranceFundStake';
discriminator: [4, 22, 226, 201, 124, 44, 82, 230];
accounts: [
{
name: 'signer';
signer: true;
},
{
name: 'state';
writable: true;
},
{
name: 'spotMarket';
writable: true;
pda: {
seeds: [
{
kind: 'const';
value: [115, 112, 111, 116, 95, 109, 97, 114, 107, 101, 116];
},
{
kind: 'arg';
path: 'marketIndex';
}
];
};
},
{
name: 'insuranceFundStake';
writable: true;
pda: {
seeds: [
{
kind: 'const';
value: [
105,
110,
115,
117,