--wip-- [skip ci]
This commit is contained in:
parent
46d651f4c4
commit
30ab82ea32
|
@ -4,6 +4,7 @@ set -euo pipefail
|
||||||
|
|
||||||
# build program, TODO try removing --skip-lint
|
# build program, TODO try removing --skip-lint
|
||||||
anchor build --skip-lint
|
anchor build --skip-lint
|
||||||
|
./idl-fixup.sh
|
||||||
|
|
||||||
# update types in ts client package
|
# update types in ts client package
|
||||||
cp -v ./target/types/mango_v4.ts ./ts/mango_v4.ts
|
cp -v ./target/types/mango_v4.ts ./ts/mango_v4.ts
|
||||||
|
|
|
@ -75,6 +75,7 @@ async function main() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log(`Group address: ${group.publicKey.toBase58()}`);
|
console.log(`Group address: ${group.publicKey.toBase58()}`);
|
||||||
|
// console.log(group);
|
||||||
|
|
||||||
//
|
//
|
||||||
// check if token is already registered, iff not, then register
|
// check if token is already registered, iff not, then register
|
||||||
|
@ -137,6 +138,59 @@ async function main() {
|
||||||
bank = gpa[0];
|
bank = gpa[0];
|
||||||
}
|
}
|
||||||
console.log(`Bank address: ${bank.publicKey.toBase58()}`);
|
console.log(`Bank address: ${bank.publicKey.toBase58()}`);
|
||||||
|
// console.log(bank);
|
||||||
|
|
||||||
|
//
|
||||||
|
// mango account
|
||||||
|
//
|
||||||
|
|
||||||
|
let mangoAccount;
|
||||||
|
gpa = await client.program.account.mangoAccount.all([
|
||||||
|
{
|
||||||
|
memcmp: {
|
||||||
|
bytes: bs58.encode(group.publicKey.toBuffer()),
|
||||||
|
offset: 8,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
memcmp: {
|
||||||
|
bytes: bs58.encode(admin.publicKey.toBuffer()),
|
||||||
|
offset: 40,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
if (gpa.length > 0) {
|
||||||
|
mangoAccount = gpa[0];
|
||||||
|
} else {
|
||||||
|
await client.program.methods
|
||||||
|
.createAccount(0)
|
||||||
|
.accounts({
|
||||||
|
group: group.publicKey,
|
||||||
|
owner: admin.publicKey,
|
||||||
|
payer: payer.publicKey,
|
||||||
|
system_program: SystemProgram.programId,
|
||||||
|
})
|
||||||
|
.signers([admin, payer])
|
||||||
|
.rpc();
|
||||||
|
|
||||||
|
gpa = await client.program.account.mangoAccount.all([
|
||||||
|
{
|
||||||
|
memcmp: {
|
||||||
|
bytes: bs58.encode(group.publicKey.toBuffer()),
|
||||||
|
offset: 8,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
memcmp: {
|
||||||
|
bytes: bs58.encode(admin.publicKey.toBuffer()),
|
||||||
|
offset: 40,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
mangoAccount = gpa[0];
|
||||||
|
}
|
||||||
|
console.log(`Mango account address: ${mangoAccount.publicKey.toBase58()}`);
|
||||||
|
console.log(mangoAccount);
|
||||||
}
|
}
|
||||||
|
|
||||||
main();
|
main();
|
||||||
|
|
|
@ -1443,11 +1443,11 @@ export type MangoV4 = {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'beingLiquidated';
|
name: 'beingLiquidated';
|
||||||
type: 'bool';
|
type: 'u8';
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'isBankrupt';
|
name: 'isBankrupt';
|
||||||
type: 'bool';
|
type: 'u8';
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'accountNum';
|
name: 'accountNum';
|
||||||
|
@ -3605,11 +3605,11 @@ export const IDL: MangoV4 = {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'beingLiquidated',
|
name: 'beingLiquidated',
|
||||||
type: 'bool',
|
type: 'u8',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'isBankrupt',
|
name: 'isBankrupt',
|
||||||
type: 'bool',
|
type: 'u8',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'accountNum',
|
name: 'accountNum',
|
||||||
|
|
Loading…
Reference in New Issue