Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions sdk/src/driftClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1102,7 +1102,7 @@ export class DriftClient {
this.wallet.publicKey // only allow payer to initialize own user stats account
),
authority: this.wallet.publicKey,
payer: this.wallet.payer?.publicKey ?? this.wallet.publicKey,
payer: this.wallet.publicKey,
rent: anchor.web3.SYSVAR_RENT_PUBKEY,
systemProgram: anchor.web3.SystemProgram.programId,
state: await this.getStatePublicKey(),
Expand Down Expand Up @@ -1142,7 +1142,7 @@ export class DriftClient {
accounts: {
signedMsgUserOrders: signedMsgUserAccountPublicKey,
authority,
payer: this.wallet.payer?.publicKey ?? this.wallet.publicKey,
payer: this.wallet.publicKey,
rent: anchor.web3.SYSVAR_RENT_PUBKEY,
systemProgram: anchor.web3.SystemProgram.programId,
},
Expand Down Expand Up @@ -1183,7 +1183,7 @@ export class DriftClient {
accounts: {
signedMsgUserOrders: signedMsgUserAccountPublicKey,
authority,
payer: this.wallet.payer?.publicKey ?? this.wallet.publicKey,
payer: this.wallet.publicKey,
systemProgram: anchor.web3.SystemProgram.programId,
user: await getUserAccountPublicKey(
this.program.programId,
Expand Down Expand Up @@ -1321,7 +1321,7 @@ export class DriftClient {
authority ?? this.wallet.publicKey
),
authority: authority ?? this.wallet.publicKey,
payer: this.wallet.payer?.publicKey ?? this.wallet.publicKey,
payer: this.wallet.publicKey,
rent: anchor.web3.SYSVAR_RENT_PUBKEY,
systemProgram: anchor.web3.SystemProgram.programId,
},
Expand Down Expand Up @@ -1407,7 +1407,7 @@ export class DriftClient {
user: userAccountPublicKey,
userStats: this.getUserStatsAccountPublicKey(),
authority: this.wallet.publicKey,
payer: this.wallet.payer?.publicKey ?? this.wallet.publicKey,
payer: this.wallet.publicKey,
rent: anchor.web3.SYSVAR_RENT_PUBKEY,
systemProgram: anchor.web3.SystemProgram.programId,
state: await this.getStatePublicKey(),
Expand Down Expand Up @@ -1457,7 +1457,7 @@ export class DriftClient {
user: userAccountPublicKey,
authority: this.wallet.publicKey,
userStats: this.getUserStatsAccountPublicKey(),
payer: this.wallet.payer?.publicKey ?? this.wallet.publicKey,
payer: this.wallet.publicKey,
rent: anchor.web3.SYSVAR_RENT_PUBKEY,
systemProgram: anchor.web3.SystemProgram.programId,
},
Expand Down Expand Up @@ -8630,7 +8630,7 @@ export class DriftClient {
this.wallet.publicKey // only allow payer to initialize own insurance fund stake account
),
authority: this.wallet.publicKey,
payer: this.wallet.payer?.publicKey ?? this.wallet.publicKey,
payer: this.wallet.publicKey,
rent: anchor.web3.SYSVAR_RENT_PUBKEY,
systemProgram: anchor.web3.SystemProgram.programId,
state: await this.getStatePublicKey(),
Expand Down Expand Up @@ -9743,7 +9743,7 @@ export class DriftClient {
const tx = await asV0Tx({
connection: this.connection,
ixs: [pullIx],
payer: this.wallet.payer?.publicKey ?? this.wallet.publicKey,
payer: this.wallet.publicKey,
computeUnitLimitMultiple: 1.3,
lookupTables: await this.fetchAllLookupTableAccounts(),
});
Expand Down
10 changes: 5 additions & 5 deletions sdk/src/tx/baseTxSender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,18 +173,18 @@ export abstract class BaseTxSender implements TxSender {

if (preSigned) {
signedTx = tx;
// @ts-ignore
} else if (this.wallet.payer) {
// @ts-ignore
tx.sign((additionalSigners ?? []).concat(this.wallet.payer));
signedTx = tx;
} else {
// Sign with user first for instruction authorities
signedTx = await this.txHandler.signVersionedTx(
tx,
additionalSigners,
undefined,
this.wallet
);
// Add payer signature if available
if (this.wallet.payer) {
signedTx.sign([this.wallet.payer]);
}
}

if (opts === undefined) {
Expand Down
12 changes: 5 additions & 7 deletions sdk/src/tx/txHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export class TxHandler {

[wallet, confirmationOpts] = this.getProps(wallet, confirmationOpts);

tx.feePayer = wallet.payer?.publicKey ?? wallet.publicKey;
tx.feePayer = wallet.publicKey;
recentBlockhash = recentBlockhash
? recentBlockhash
: await this.getLatestBlockhashForTransaction();
Expand Down Expand Up @@ -398,7 +398,7 @@ export class TxHandler {
[wallet] = this.getProps(wallet);

const message = new TransactionMessage({
payerKey: wallet.payer?.publicKey ?? wallet.publicKey,
payerKey: wallet.publicKey,
recentBlockhash: recentBlockhash.blockhash,
instructions: ixs,
}).compileToLegacyMessage();
Expand All @@ -420,7 +420,7 @@ export class TxHandler {
[wallet] = this.getProps(wallet);

const message = new TransactionMessage({
payerKey: wallet.payer?.publicKey ?? wallet.publicKey,
payerKey: wallet.publicKey,
recentBlockhash: recentBlockhash.blockhash,
instructions: ixs,
}).compileToV0Message(lookupTableAccounts);
Expand Down Expand Up @@ -649,8 +649,7 @@ export class TxHandler {
for (const tx of Object.values(txsMap)) {
if (!tx) continue;
tx.recentBlockhash = recentBlockhash.blockhash;
tx.feePayer =
wallet?.payer?.publicKey ?? wallet?.publicKey ?? this.wallet?.publicKey;
tx.feePayer = wallet?.publicKey ?? this.wallet?.publicKey;

// @ts-ignore
tx.SIGNATURE_BLOCK_AND_EXPIRY = recentBlockhash;
Expand Down Expand Up @@ -690,8 +689,7 @@ export class TxHandler {
// Extra handling for legacy transactions
for (const [_key, tx] of filteredTxEntries) {
if (this.isLegacyTransaction(tx)) {
(tx as Transaction).feePayer =
wallet.payer?.publicKey ?? wallet.publicKey;
(tx as Transaction).feePayer = wallet.publicKey;
}
}

Expand Down
Loading