use custom sendTransaction in the client

This commit is contained in:
tjs 2022-08-16 00:27:06 -04:00
parent 4ee4ab829f
commit a9c4f54917
1 changed files with 30 additions and 6 deletions

View File

@ -537,14 +537,22 @@ export class MangoClient {
accountNumber?: number,
name?: string,
): Promise<TransactionSignature> {
return await this.program.methods
const transaction = await this.program.methods
.accountCreate(accountNumber ?? 0, 8, 0, 0, 0, name ?? '')
.accounts({
group: group.publicKey,
owner: (this.program.provider as AnchorProvider).wallet.publicKey,
payer: (this.program.provider as AnchorProvider).wallet.publicKey,
})
.rpc({ skipPreflight: true });
.transaction();
return await sendTransaction(
this.program.provider as AnchorProvider,
transaction,
{
postSendTxCallback: this.postSendTxCallback,
},
);
}
public async expandMangoAccount(
@ -572,14 +580,22 @@ export class MangoClient {
name?: string,
delegate?: PublicKey,
): Promise<TransactionSignature> {
return await this.program.methods
const transaction = await this.program.methods
.accountEdit(name ?? null, delegate ?? null)
.accounts({
group: group.publicKey,
account: mangoAccount.publicKey,
owner: (this.program.provider as AnchorProvider).wallet.publicKey,
})
.rpc({ skipPreflight: true });
.transaction();
return await sendTransaction(
this.program.provider as AnchorProvider,
transaction,
{
postSendTxCallback: this.postSendTxCallback,
},
);
}
public async getMangoAccount(mangoAccount: MangoAccount) {
@ -762,7 +778,7 @@ export class MangoClient {
[bank],
);
return await this.program.methods
const transaction = await this.program.methods
.tokenDeposit(new BN(nativeAmount))
.accounts({
group: group.publicKey,
@ -781,7 +797,15 @@ export class MangoClient {
.preInstructions(preInstructions)
.postInstructions(postInstructions)
.signers(additionalSigners)
.rpc({ skipPreflight: true });
.transaction();
return await sendTransaction(
this.program.provider as AnchorProvider,
transaction,
{
postSendTxCallback: this.postSendTxCallback,
},
);
}
public async tokenWithdraw(