solana-presale-sdk
Version:
SDK for Solana Presale Program
1,230 lines (1,229 loc) • 41.7 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/terminus_presale.json`.
*/
export type TerminusPresale = {
address: "4NiRZQQ5Rgsoy2zZ7SWAJAvbCuimUH1nY1nwCFKnfPtz";
metadata: {
name: "terminusPresale";
version: "0.1.0";
spec: "0.1.0";
description: "Created with Anchor";
};
instructions: [
{
name: "buyToken";
discriminator: [138, 127, 14, 91, 38, 87, 115, 105];
accounts: [
{
name: "presaleInfo";
writable: true;
pda: {
seeds: [
{
kind: "const";
value: [112, 114, 101, 115, 97, 108, 101];
},
{
kind: "account";
path: "presale_info.authority";
account: "presaleInfo";
}
];
};
},
{
name: "userInfo";
writable: true;
pda: {
seeds: [
{
kind: "const";
value: [117, 115, 101, 114];
},
{
kind: "account";
path: "buyer";
}
];
};
},
{
name: "presaleVault";
writable: true;
pda: {
seeds: [
{
kind: "const";
value: [118, 97, 117, 108, 116];
}
];
};
},
{
name: "buyer";
writable: true;
signer: true;
},
{
name: "rent";
address: "SysvarRent111111111111111111111111111111111";
},
{
name: "systemProgram";
address: "11111111111111111111111111111111";
},
{
name: "tokenProgram";
address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
},
{
name: "associatedTokenProgram";
address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
}
];
args: [
{
name: "quoteAmount";
type: "u64";
}
];
},
{
name: "claimToken";
discriminator: [116, 206, 27, 191, 166, 19, 0, 73];
accounts: [
{
name: "tokenMint";
writable: true;
},
{
name: "tokenAccount";
writable: true;
pda: {
seeds: [
{
kind: "account";
path: "buyer";
},
{
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: "tokenMint";
}
];
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: "presaleAssociatedTokenAccount";
writable: true;
pda: {
seeds: [
{
kind: "account";
path: "presaleInfo";
},
{
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: "tokenMint";
}
];
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: "userInfo";
writable: true;
pda: {
seeds: [
{
kind: "const";
value: [117, 115, 101, 114];
},
{
kind: "account";
path: "buyer";
}
];
};
},
{
name: "presaleInfo";
writable: true;
pda: {
seeds: [
{
kind: "const";
value: [112, 114, 101, 115, 97, 108, 101];
},
{
kind: "account";
path: "presale_info.authority";
account: "presaleInfo";
}
];
};
},
{
name: "buyer";
writable: true;
signer: true;
},
{
name: "rent";
address: "SysvarRent111111111111111111111111111111111";
},
{
name: "systemProgram";
address: "11111111111111111111111111111111";
},
{
name: "tokenProgram";
address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
},
{
name: "associatedTokenProgram";
address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
}
];
args: [
{
name: "bump";
type: "u8";
}
];
},
{
name: "createPresale";
discriminator: [176, 144, 197, 158, 61, 119, 75, 135];
accounts: [
{
name: "presaleInfo";
writable: true;
pda: {
seeds: [
{
kind: "const";
value: [112, 114, 101, 115, 97, 108, 101];
},
{
kind: "account";
path: "authority";
}
];
};
},
{
name: "authority";
writable: true;
signer: true;
},
{
name: "systemProgram";
address: "11111111111111111111111111111111";
}
];
args: [
{
name: "tokenMintAddress";
type: "pubkey";
},
{
name: "softcapAmount";
type: "u64";
},
{
name: "hardcapAmount";
type: "u64";
},
{
name: "maxTokenAmountPerAddress";
type: "u64";
},
{
name: "pricePerToken";
type: "u64";
},
{
name: "startTime";
type: "u64";
},
{
name: "endTime";
type: "u64";
}
];
},
{
name: "depositToken";
discriminator: [11, 156, 96, 218, 39, 163, 180, 19];
accounts: [
{
name: "mintAccount";
writable: true;
},
{
name: "tokenAccount";
writable: true;
pda: {
seeds: [
{
kind: "account";
path: "admin";
},
{
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: "mintAccount";
}
];
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: "admin";
writable: true;
signer: true;
},
{
name: "toAssociatedTokenAccount";
writable: true;
pda: {
seeds: [
{
kind: "account";
path: "presaleInfo";
},
{
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: "mintAccount";
}
];
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: "presaleVault";
writable: true;
pda: {
seeds: [
{
kind: "const";
value: [118, 97, 117, 108, 116];
}
];
};
},
{
name: "presaleInfo";
writable: true;
pda: {
seeds: [
{
kind: "const";
value: [112, 114, 101, 115, 97, 108, 101];
},
{
kind: "account";
path: "presale_info.authority";
account: "presaleInfo";
}
];
};
},
{
name: "rent";
address: "SysvarRent111111111111111111111111111111111";
},
{
name: "systemProgram";
address: "11111111111111111111111111111111";
},
{
name: "tokenProgram";
address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
},
{
name: "associatedTokenProgram";
address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
}
];
args: [
{
name: "amount";
type: "u64";
}
];
},
{
name: "startPresale";
discriminator: [57, 19, 73, 191, 195, 254, 45, 223];
accounts: [
{
name: "presaleInfo";
writable: true;
pda: {
seeds: [
{
kind: "const";
value: [112, 114, 101, 115, 97, 108, 101];
},
{
kind: "account";
path: "presale_info.authority";
account: "presaleInfo";
}
];
};
},
{
name: "admin";
writable: true;
signer: true;
}
];
args: [
{
name: "startTime";
type: "u64";
},
{
name: "endTime";
type: "u64";
}
];
},
{
name: "updatePresale";
discriminator: [9, 223, 20, 184, 183, 199, 90, 226];
accounts: [
{
name: "presaleInfo";
writable: true;
pda: {
seeds: [
{
kind: "const";
value: [112, 114, 101, 115, 97, 108, 101];
},
{
kind: "account";
path: "presale_info.authority";
account: "presaleInfo";
}
];
};
},
{
name: "authority";
writable: true;
signer: true;
},
{
name: "systemProgram";
address: "11111111111111111111111111111111";
}
];
args: [
{
name: "maxTokenAmountPerAddress";
type: "u64";
},
{
name: "pricePerToken";
type: "u64";
},
{
name: "softcapAmount";
type: "u64";
},
{
name: "hardcapAmount";
type: "u64";
},
{
name: "startTime";
type: "u64";
},
{
name: "endTime";
type: "u64";
}
];
},
{
name: "withdrawSol";
discriminator: [145, 131, 74, 136, 65, 137, 42, 38];
accounts: [
{
name: "presaleInfo";
pda: {
seeds: [
{
kind: "const";
value: [112, 114, 101, 115, 97, 108, 101];
},
{
kind: "account";
path: "presale_info.authority";
account: "presaleInfo";
}
];
};
},
{
name: "presaleVault";
writable: true;
pda: {
seeds: [
{
kind: "const";
value: [118, 97, 117, 108, 116];
}
];
};
},
{
name: "admin";
writable: true;
signer: true;
},
{
name: "systemProgram";
address: "11111111111111111111111111111111";
}
];
args: [
{
name: "bump";
type: "u8";
}
];
},
{
name: "withdrawToken";
discriminator: [136, 235, 181, 5, 101, 109, 57, 81];
accounts: [
{
name: "mintAccount";
writable: true;
},
{
name: "adminAssociatedTokenAccount";
writable: true;
pda: {
seeds: [
{
kind: "account";
path: "admin";
},
{
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: "presaleTokenMintAccount";
}
];
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: "presaleAssociatedTokenAccount";
writable: true;
pda: {
seeds: [
{
kind: "account";
path: "presaleInfo";
},
{
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: "presaleTokenMintAccount";
}
];
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: "presaleTokenMintAccount";
writable: true;
},
{
name: "presaleInfo";
writable: true;
pda: {
seeds: [
{
kind: "const";
value: [112, 114, 101, 115, 97, 108, 101];
},
{
kind: "account";
path: "presale_info.authority";
account: "presaleInfo";
}
];
};
},
{
name: "admin";
writable: true;
signer: true;
},
{
name: "rent";
address: "SysvarRent111111111111111111111111111111111";
},
{
name: "systemProgram";
address: "11111111111111111111111111111111";
},
{
name: "tokenProgram";
address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
},
{
name: "associatedTokenProgram";
address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
}
];
args: [
{
name: "amount";
type: "u64";
},
{
name: "bump";
type: "u8";
}
];
}
];
accounts: [
{
name: "presaleInfo";
discriminator: [11, 19, 36, 47, 79, 104, 214, 40];
},
{
name: "userInfo";
discriminator: [83, 134, 200, 56, 144, 56, 10, 62];
}
];
errors: [
{
code: 6000;
name: "unauthorized";
msg: "You are not authorized to perform this action.";
},
{
code: 6001;
name: "notAllowed";
msg: "Not allowed";
},
{
code: 6002;
name: "mathOverflow";
msg: "Math operation overflow";
},
{
code: 6003;
name: "alreadyMarked";
msg: "Already marked";
},
{
code: 6004;
name: "presaleNotStarted";
msg: "Presale not started yet";
},
{
code: 6005;
name: "presaleEnded";
msg: "Presale already ended";
},
{
code: 6006;
name: "tokenAmountMismatch";
msg: "Token amount mismatch";
},
{
code: 6007;
name: "insufficientFund";
msg: "Insufficient Tokens";
},
{
code: 6008;
name: "exceedMaximumBuy";
msg: "Token purchase exceeds the maximum allowed per user!";
},
{
code: 6009;
name: "presaleNotEnded";
msg: "Presale not ended yet";
},
{
code: 6010;
name: "hardCapped";
msg: "Presale already ended HardCapped";
},
{
code: 6011;
name: "invalidPrice";
msg: "Price per token cannot be zero.";
},
{
code: 6012;
name: "invalidSoftcap";
msg: "Softcap amount must be greater than zero.";
},
{
code: 6013;
name: "invalidHardcap";
msg: "Hardcap must be greater than or equal to the softcap.";
},
{
code: 6014;
name: "invalidTimeRange";
msg: "Start time must be earlier than the end time.";
},
{
code: 6015;
name: "calculationError";
msg: "A calculation or division error occurred.";
},
{
code: 6016;
name: "emptyVault";
msg: "The vault is empty. No SOL to withdraw.";
}
];
types: [
{
name: "presaleInfo";
type: {
kind: "struct";
fields: [
{
name: "tokenMintAddress";
type: "pubkey";
},
{
name: "softcapAmount";
type: "u64";
},
{
name: "hardcapAmount";
type: "u64";
},
{
name: "depositTokenAmount";
type: "u64";
},
{
name: "soldTokenAmount";
type: "u64";
},
{
name: "startTime";
type: "u64";
},
{
name: "endTime";
type: "u64";
},
{
name: "maxTokenAmountPerAddress";
type: "u64";
},
{
name: "pricePerToken";
type: "u64";
},
{
name: "isLive";
type: "bool";
},
{
name: "authority";
type: "pubkey";
},
{
name: "isSoftCapped";
type: "bool";
},
{
name: "isHardCapped";
type: "bool";
}
];
};
},
{
name: "userInfo";
type: {
kind: "struct";
fields: [
{
name: "buyQuoteAmount";
type: "u64";
},
{
name: "buyTokenAmount";
type: "u64";
},
{
name: "buyTime";
type: "u64";
},
{
name: "claimTime";
type: "u64";
}
];
};
}
];
constants: [
{
name: "presaleSeed";
type: "bytes";
value: "[80, 82, 69, 83, 65, 76, 69, 95, 83, 69, 69, 68]";
}
];
};