--wip-- [skip ci]
This commit is contained in:
parent
70c8f49624
commit
c9ca8d5563
|
@ -14,11 +14,25 @@ async function main() {
|
||||||
options,
|
options,
|
||||||
);
|
);
|
||||||
|
|
||||||
const privateKeyPath = os.homedir() + '/.config/solana/dev.json';
|
const admin = Keypair.fromSecretKey(
|
||||||
const owner = Keypair.fromSecretKey(
|
Buffer.from(
|
||||||
Buffer.from(JSON.parse(fs.readFileSync(privateKeyPath, 'utf-8'))),
|
JSON.parse(
|
||||||
|
fs.readFileSync(os.homedir() + '/.config/solana/dev.json', 'utf-8'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
const wallet = new Wallet(admin);
|
||||||
|
|
||||||
|
const payer = Keypair.fromSecretKey(
|
||||||
|
Buffer.from(
|
||||||
|
JSON.parse(
|
||||||
|
fs.readFileSync(
|
||||||
|
os.homedir() + '/.config/solana/mango-devnet.json',
|
||||||
|
'utf-8',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
const wallet = new Wallet(owner);
|
|
||||||
|
|
||||||
const provider = new Provider(connection, wallet, options);
|
const provider = new Provider(connection, wallet, options);
|
||||||
const client = await MangoClient.connect(provider, true);
|
const client = await MangoClient.connect(provider, true);
|
||||||
|
@ -27,7 +41,7 @@ async function main() {
|
||||||
let gpa = await client.program.account.group.all([
|
let gpa = await client.program.account.group.all([
|
||||||
{
|
{
|
||||||
memcmp: {
|
memcmp: {
|
||||||
bytes: bs58.encode(owner.publicKey.toBuffer()),
|
bytes: bs58.encode(admin.publicKey.toBuffer()),
|
||||||
offset: 8,
|
offset: 8,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -38,17 +52,17 @@ async function main() {
|
||||||
await client.program.methods
|
await client.program.methods
|
||||||
.createGroup()
|
.createGroup()
|
||||||
.accounts({
|
.accounts({
|
||||||
admin: owner.publicKey,
|
admin: admin.publicKey,
|
||||||
payer: owner.publicKey,
|
payer: admin.publicKey,
|
||||||
system_program: SystemProgram.programId,
|
system_program: SystemProgram.programId,
|
||||||
})
|
})
|
||||||
.signers([owner])
|
.signers([admin])
|
||||||
.rpc();
|
.rpc();
|
||||||
|
|
||||||
gpa = await client.program.account.group.all([
|
gpa = await client.program.account.group.all([
|
||||||
{
|
{
|
||||||
memcmp: {
|
memcmp: {
|
||||||
bytes: bs58.encode(owner.publicKey.toBuffer()),
|
bytes: bs58.encode(admin.publicKey.toBuffer()),
|
||||||
offset: 8,
|
offset: 8,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -67,35 +81,20 @@ async function main() {
|
||||||
const mngoOracle = new web3.PublicKey(
|
const mngoOracle = new web3.PublicKey(
|
||||||
'8k7F9Xb36oFJsjpCKpsXvg4cgBRoZtwNTc3EzG5Ttd2o',
|
'8k7F9Xb36oFJsjpCKpsXvg4cgBRoZtwNTc3EzG5Ttd2o',
|
||||||
);
|
);
|
||||||
// some random address atm
|
|
||||||
const address_lookup_table = new web3.PublicKey(
|
|
||||||
'8k7F9Xb36oFJsjpCKpsXvg4cgBRoZtwNTc3EzG5Ttd2o',
|
|
||||||
);
|
|
||||||
const address_lookup_table_program = new web3.PublicKey(
|
|
||||||
'AddressLookupTab1e1111111111111111111111111',
|
|
||||||
);
|
|
||||||
await client.program.methods
|
await client.program.methods
|
||||||
.registerToken(
|
.registerToken(0, 0.8, 0.6, 1.2, 1.4, 0.02)
|
||||||
TokenIndex.fromValue(new BN(0)) as any,
|
|
||||||
0.8,
|
|
||||||
0.6,
|
|
||||||
1.2,
|
|
||||||
1.4,
|
|
||||||
0.02,
|
|
||||||
)
|
|
||||||
.accounts({
|
.accounts({
|
||||||
group: group.publicKey,
|
group: group.publicKey,
|
||||||
admin: owner.publicKey,
|
admin: admin.publicKey,
|
||||||
mint,
|
mint,
|
||||||
oracle: mngoOracle,
|
oracle: mngoOracle,
|
||||||
address_lookup_table,
|
payer: payer.publicKey,
|
||||||
payer: owner.publicKey,
|
|
||||||
token_program: TOKEN_PROGRAM_ID,
|
token_program: TOKEN_PROGRAM_ID,
|
||||||
system_program: SystemProgram.programId,
|
system_program: SystemProgram.programId,
|
||||||
address_lookup_table_program,
|
|
||||||
rent: web3.SYSVAR_RENT_PUBKEY,
|
rent: web3.SYSVAR_RENT_PUBKEY,
|
||||||
})
|
})
|
||||||
.signers([owner])
|
.signers([admin, payer])
|
||||||
.rpc();
|
.rpc();
|
||||||
|
|
||||||
gpa = await client.program.account.bank.all([
|
gpa = await client.program.account.bank.all([
|
||||||
|
|
6472
ts/mango_v4.ts
6472
ts/mango_v4.ts
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue