update
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
This commit is contained in:
parent
3e3b5be078
commit
6b31b6af48
|
@ -13,4 +13,15 @@ If there are no breaking changes, simply running `release-to-mainnet.sh` should
|
|||
- merge dev to main, and then `release-to-mainnet.sh` to deploy latest code to mainnet
|
||||
- setup group and banks, etc. using `ts/client/src/scripts/mb-example1-admin.ts`
|
||||
- update ids json `ts/client/src/scripts/mb-example1-ids-json.ts`
|
||||
- create mango account and deposit some tokens `ts/client/src/scripts/mb-example1-close-account.ts`
|
||||
- create mango account and deposit some tokens `ts/client/src/scripts/mb-example1-ids-json.ts`
|
||||
|
||||
tldr;
|
||||
|
||||
```
|
||||
yarn ts-node ts/client/src/scripts/mb-example1-close-account.ts
|
||||
yarn ts-node ts/client/src/scripts/mb-example1-admin-close.ts
|
||||
./release-to-mainnet.sh
|
||||
yarn ts-node ts/client/src/scripts/mb-example1-admin.ts
|
||||
yarn ts-node ts/client/src/scripts/mb-example1-ids-json.ts
|
||||
yarn ts-node ts/client/src/scripts/mb-example1-ids-json.ts
|
||||
```
|
||||
|
|
|
@ -37,19 +37,18 @@ async function main() {
|
|||
);
|
||||
console.log(`Admin ${admin.publicKey.toBase58()}`);
|
||||
|
||||
// fetch group
|
||||
const group = await client.getGroupForAdmin(admin.publicKey);
|
||||
console.log(`Found group ${group.publicKey.toBase58()}`);
|
||||
|
||||
// account
|
||||
const mangoAccount = (
|
||||
await client.getMangoAccountForOwner(group, user.publicKey)
|
||||
)[0];
|
||||
console.log(`...found mangoAccount ${mangoAccount.publicKey}`);
|
||||
console.log(mangoAccount.toString(group));
|
||||
|
||||
try {
|
||||
// fetch group
|
||||
const group = await client.getGroupForAdmin(admin.publicKey);
|
||||
console.log(`Found group ${group.publicKey.toBase58()}`);
|
||||
|
||||
// account
|
||||
console.log(`Creating mangoaccount...`);
|
||||
const mangoAccount = (
|
||||
await client.getMangoAccountForOwner(group, user.publicKey)
|
||||
)[0];
|
||||
console.log(`...created/found mangoAccount ${mangoAccount.publicKey}`);
|
||||
console.log(mangoAccount.toString(group));
|
||||
|
||||
// cancel serum3 accounts, closing might require cancelling orders and settling
|
||||
for (const serum3Account of mangoAccount.serum3Active()) {
|
||||
let orders = await client.getSerum3Orders(
|
||||
|
@ -104,17 +103,17 @@ async function main() {
|
|||
false,
|
||||
);
|
||||
}
|
||||
|
||||
await mangoAccount.reload(client, group);
|
||||
console.log(`...mangoAccount ${mangoAccount.publicKey}`);
|
||||
console.log(mangoAccount.toString());
|
||||
|
||||
console.log(`Close mango account...`);
|
||||
const res = await client.closeMangoAccount(group, mangoAccount);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
|
||||
await mangoAccount.reload(client, group);
|
||||
console.log(`...mangoAccount ${mangoAccount.publicKey}`);
|
||||
console.log(mangoAccount.toString());
|
||||
|
||||
console.log(`Close mango account...`);
|
||||
const res = await client.closeMangoAccount(group, mangoAccount);
|
||||
|
||||
process.exit();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue