remove payer
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
This commit is contained in:
parent
c7c2c548e9
commit
8835191f1f
|
@ -1,5 +1,4 @@
|
|||
import {
|
||||
Keypair,
|
||||
PublicKey,
|
||||
SYSVAR_RENT_PUBKEY,
|
||||
Transaction,
|
||||
|
@ -88,22 +87,19 @@ export async function registerToken(
|
|||
adminPk: PublicKey,
|
||||
mintPk: PublicKey,
|
||||
oraclePk: PublicKey,
|
||||
payer: Keypair,
|
||||
tokenIndex: number,
|
||||
): Promise<void> {
|
||||
const tx = new Transaction();
|
||||
const signers = [payer];
|
||||
const ix = await registerTokenIx(
|
||||
client,
|
||||
groupPk,
|
||||
adminPk,
|
||||
mintPk,
|
||||
oraclePk,
|
||||
payer,
|
||||
tokenIndex,
|
||||
);
|
||||
tx.add(ix);
|
||||
await client.program.provider.send(tx, signers);
|
||||
await client.program.provider.send(tx);
|
||||
}
|
||||
|
||||
export async function registerTokenIx(
|
||||
|
@ -112,7 +108,6 @@ export async function registerTokenIx(
|
|||
adminPk: PublicKey,
|
||||
mintPk: PublicKey,
|
||||
oraclePk: PublicKey,
|
||||
payer: Keypair,
|
||||
tokenIndex: number,
|
||||
): Promise<TransactionInstruction> {
|
||||
return await client.program.methods
|
||||
|
@ -122,10 +117,9 @@ export async function registerTokenIx(
|
|||
admin: adminPk,
|
||||
mint: mintPk,
|
||||
oracle: oraclePk,
|
||||
payer: payer.publicKey,
|
||||
payer: adminPk,
|
||||
rent: SYSVAR_RENT_PUBKEY,
|
||||
})
|
||||
.signers([payer])
|
||||
.instruction();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import {
|
||||
Keypair,
|
||||
PublicKey,
|
||||
Transaction,
|
||||
TransactionInstruction,
|
||||
|
@ -17,27 +16,23 @@ export class Group {
|
|||
export async function createGroup(
|
||||
client: MangoClient,
|
||||
adminPk: PublicKey,
|
||||
payer: Keypair,
|
||||
): Promise<void> {
|
||||
const tx = new Transaction();
|
||||
const signers = [payer];
|
||||
const ix = await createGroupIx(client, adminPk, payer);
|
||||
const ix = await createGroupIx(client, adminPk);
|
||||
tx.add(ix);
|
||||
await client.program.provider.send(tx, signers);
|
||||
await client.program.provider.send(tx);
|
||||
}
|
||||
|
||||
export async function createGroupIx(
|
||||
client: MangoClient,
|
||||
adminPk: PublicKey,
|
||||
payer: Keypair,
|
||||
): Promise<TransactionInstruction> {
|
||||
return await client.program.methods
|
||||
.createGroup()
|
||||
.accounts({
|
||||
admin: adminPk,
|
||||
payer: payer.publicKey,
|
||||
payer: adminPk,
|
||||
})
|
||||
.signers([payer])
|
||||
.instruction();
|
||||
}
|
||||
|
||||
|
|
|
@ -137,29 +137,26 @@ export async function createMangoAccount(
|
|||
client: MangoClient,
|
||||
groupPk: PublicKey,
|
||||
ownerPk: PublicKey,
|
||||
payer: Keypair,
|
||||
): Promise<void> {
|
||||
const tx = new Transaction();
|
||||
const signers = [payer];
|
||||
const ix = await createMangoAccountIx(client, groupPk, ownerPk, payer);
|
||||
const ix = await createMangoAccountIx(client, groupPk, ownerPk);
|
||||
tx.add(ix);
|
||||
await client.program.provider.send(tx, signers);
|
||||
await client.program.provider.send(tx);
|
||||
}
|
||||
|
||||
export async function createMangoAccountIx(
|
||||
client: MangoClient,
|
||||
groupPk: PublicKey,
|
||||
ownerPk: PublicKey,
|
||||
payer: Keypair,
|
||||
): Promise<TransactionInstruction> {
|
||||
return await client.program.methods
|
||||
.createAccount(11)
|
||||
.accounts({
|
||||
group: groupPk,
|
||||
owner: ownerPk,
|
||||
payer: payer.publicKey,
|
||||
payer: ownerPk
|
||||
})
|
||||
.signers([payer])
|
||||
.signers()
|
||||
.instruction();
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,6 @@ export async function createStubOracle(
|
|||
groupPk: PublicKey,
|
||||
adminPk: PublicKey,
|
||||
tokenMintPk: PublicKey,
|
||||
payer: Keypair,
|
||||
staticPrice: number,
|
||||
): Promise<void> {
|
||||
return await client.program.methods
|
||||
|
@ -52,9 +51,8 @@ export async function createStubOracle(
|
|||
group: groupPk,
|
||||
admin: adminPk,
|
||||
tokenMint: tokenMintPk,
|
||||
payer: payer.publicKey,
|
||||
payer: adminPk
|
||||
})
|
||||
.signers([payer])
|
||||
.rpc();
|
||||
}
|
||||
|
||||
|
@ -63,7 +61,6 @@ export async function setStubOracle(
|
|||
groupPk: PublicKey,
|
||||
adminPk: PublicKey,
|
||||
tokenMintPk: PublicKey,
|
||||
payer: Keypair,
|
||||
staticPrice: number,
|
||||
): Promise<void> {
|
||||
return await client.program.methods
|
||||
|
@ -72,9 +69,8 @@ export async function setStubOracle(
|
|||
group: groupPk,
|
||||
admin: adminPk,
|
||||
tokenMint: tokenMintPk,
|
||||
payer: payer.publicKey,
|
||||
payer: adminPk
|
||||
})
|
||||
.signers([payer])
|
||||
.rpc();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import {
|
||||
AccountMeta,
|
||||
Keypair,
|
||||
PublicKey,
|
||||
Transaction,
|
||||
TransactionInstruction,
|
||||
|
@ -53,7 +52,6 @@ export async function serum3RegisterMarket(
|
|||
serumMarketExternalPk: PublicKey,
|
||||
quoteBankPk: PublicKey,
|
||||
baseBankPk: PublicKey,
|
||||
payer: Keypair,
|
||||
marketIndex: number,
|
||||
): Promise<void> {
|
||||
const tx = new Transaction();
|
||||
|
@ -65,11 +63,10 @@ export async function serum3RegisterMarket(
|
|||
serumMarketExternalPk,
|
||||
quoteBankPk,
|
||||
baseBankPk,
|
||||
payer,
|
||||
marketIndex,
|
||||
);
|
||||
tx.add(ix);
|
||||
await client.program.provider.send(tx, [payer]);
|
||||
await client.program.provider.send(tx);
|
||||
}
|
||||
|
||||
export async function serum3RegisterMarketIx(
|
||||
|
@ -80,7 +77,6 @@ export async function serum3RegisterMarketIx(
|
|||
serumMarketExternalPk: PublicKey,
|
||||
quoteBankPk: PublicKey,
|
||||
baseBankPk: PublicKey,
|
||||
payer: Keypair,
|
||||
marketIndex: number,
|
||||
): Promise<TransactionInstruction> {
|
||||
return await client.program.methods
|
||||
|
@ -92,7 +88,7 @@ export async function serum3RegisterMarketIx(
|
|||
serumMarketExternal: serumMarketExternalPk,
|
||||
quoteBank: quoteBankPk,
|
||||
baseBank: baseBankPk,
|
||||
payer: payer.publicKey,
|
||||
payer: adminPk,
|
||||
})
|
||||
.instruction();
|
||||
}
|
||||
|
@ -144,7 +140,6 @@ export async function serum3CreateOpenOrders(
|
|||
serumProgramPk: PublicKey,
|
||||
serumMarketExternalPk: PublicKey,
|
||||
ownerPk: PublicKey,
|
||||
payer: Keypair,
|
||||
): Promise<void> {
|
||||
return await client.program.methods
|
||||
.serum3CreateOpenOrders()
|
||||
|
@ -155,9 +150,8 @@ export async function serum3CreateOpenOrders(
|
|||
serumProgram: serumProgramPk,
|
||||
serumMarketExternal: serumMarketExternalPk,
|
||||
owner: ownerPk,
|
||||
payer: payer.publicKey,
|
||||
payer: ownerPk,
|
||||
})
|
||||
.signers([payer])
|
||||
.rpc();
|
||||
}
|
||||
export class Serum3SelfTradeBehavior {
|
||||
|
|
|
@ -57,12 +57,12 @@ async function main() {
|
|||
const adminProvider = new Provider(connection, adminWallet, options);
|
||||
const adminClient = await MangoClient.connect(adminProvider, true);
|
||||
|
||||
const payer = Keypair.fromSecretKey(
|
||||
Buffer.from(
|
||||
JSON.parse(fs.readFileSync(process.env.PAYER_KEYPAIR!, 'utf-8')),
|
||||
),
|
||||
);
|
||||
console.log(`Payer ${payer.publicKey.toBase58()}`);
|
||||
// const payer = Keypair.fromSecretKey(
|
||||
// Buffer.from(
|
||||
// JSON.parse(fs.readFileSync(process.env.PAYER_KEYPAIR!, 'utf-8')),
|
||||
// ),
|
||||
// );
|
||||
// console.log(`Payer ${payer.publicKey.toBase58()}`);
|
||||
//
|
||||
// Find existing or create a new group
|
||||
//
|
||||
|
@ -71,7 +71,7 @@ async function main() {
|
|||
getGroupForAdmin,
|
||||
[adminClient, admin.publicKey],
|
||||
createGroup,
|
||||
[adminClient, admin.publicKey, payer],
|
||||
[adminClient, admin.publicKey],
|
||||
);
|
||||
console.log(`Group ${group.publicKey}`);
|
||||
|
||||
|
@ -86,7 +86,7 @@ async function main() {
|
|||
getStubOracleForGroupAndMint,
|
||||
[adminClient, group.publicKey, usdcDevnetMint],
|
||||
createStubOracle,
|
||||
[adminClient, group.publicKey, admin.publicKey, usdcDevnetMint, payer, 1],
|
||||
[adminClient, group.publicKey, admin.publicKey, usdcDevnetMint, 1],
|
||||
);
|
||||
console.log(
|
||||
`usdcDevnetStubOracle ${usdcDevnetStubOracle.publicKey.toBase58()}`,
|
||||
|
@ -114,7 +114,7 @@ async function main() {
|
|||
admin.publicKey,
|
||||
btcDevnetMint,
|
||||
btcDevnetOracle,
|
||||
payer,
|
||||
|
||||
0,
|
||||
],
|
||||
);
|
||||
|
@ -130,7 +130,7 @@ async function main() {
|
|||
admin.publicKey,
|
||||
usdcDevnetMint,
|
||||
usdcDevnetStubOracle.publicKey,
|
||||
payer,
|
||||
|
||||
1,
|
||||
],
|
||||
);
|
||||
|
@ -158,7 +158,7 @@ async function main() {
|
|||
getMangoAccountsForGroupAndOwner,
|
||||
[userClient, group.publicKey, user.publicKey],
|
||||
createMangoAccount,
|
||||
[userClient, group.publicKey, user.publicKey, payer],
|
||||
[userClient, group.publicKey, user.publicKey],
|
||||
);
|
||||
console.log(`MangoAccount ${mangoAccount.publicKey}`);
|
||||
|
||||
|
@ -196,7 +196,6 @@ async function main() {
|
|||
serumMarketExternalPk,
|
||||
usdcBank.publicKey,
|
||||
btcBank.publicKey,
|
||||
payer,
|
||||
0,
|
||||
],
|
||||
);
|
||||
|
@ -215,7 +214,6 @@ async function main() {
|
|||
serumProgramId,
|
||||
serumMarketExternalPk,
|
||||
user.publicKey,
|
||||
payer,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue