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
1 change: 1 addition & 0 deletions modules/sdk-coin-sol/src/lib/iface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ export interface VersionedTransactionData {
numReadonlySignedAccounts: number;
numReadonlyUnsignedAccounts: number;
};
recentBlockhash?: string;
}

export interface AddressLookupTable {
Expand Down
8 changes: 5 additions & 3 deletions modules/sdk-coin-sol/src/lib/transactionBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,10 @@ export abstract class TransactionBuilder extends BaseTransactionBuilder {
data: Buffer.from(base58.decode(instruction.data)),
}));

if (!this._recentBlockhash) {
throw new BuildTransactionError('Missing nonce (recentBlockhash) for VersionedTransaction');
const recentBlockhash = data.recentBlockhash || this._recentBlockhash;

if (!recentBlockhash) {
throw new BuildTransactionError('Missing recent blockhash for VersionedTransaction');
}

if (!this._sender) {
Expand All @@ -269,7 +271,7 @@ export abstract class TransactionBuilder extends BaseTransactionBuilder {
const messageV0 = new MessageV0({
header: data.messageHeader,
staticAccountKeys,
recentBlockhash: this._recentBlockhash,
recentBlockhash: recentBlockhash,
compiledInstructions,
addressTableLookups,
});
Expand Down
4 changes: 3 additions & 1 deletion modules/sdk-coin-sol/test/unit/versionedTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ describe('Sol Jupiter Swap Transaction', () => {
addressLookupTables,
staticAccountKeys,
messageHeader: originalDeserialized.message.header,
recentBlockhash: originalDeserialized.message.recentBlockhash,
};

const factory = getBuilderFactory('tsol');
Expand Down Expand Up @@ -197,7 +198,7 @@ describe('Sol Jupiter Swap Transaction', () => {
);
});

it('should not inject nonce advance when using regular nonce (no durableNonceParams)', async function () {
it('should not inject nonce advance when using recentBlockhash (no durableNonceParams)', async function () {
const versionedTransactionData = {
versionedInstructions: [
{
Expand All @@ -213,6 +214,7 @@ describe('Sol Jupiter Swap Transaction', () => {
numReadonlySignedAccounts: 0,
numReadonlyUnsignedAccounts: 0,
},
recentBlockhash: testData.blockHashes.validBlockHashes[0],
};

const factory = getBuilderFactory('tsol');
Expand Down
1 change: 1 addition & 0 deletions modules/sdk-core/src/bitgo/utils/tss/baseTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export interface SolVersionedTransactionData {
numReadonlySignedAccounts: number;
numReadonlyUnsignedAccounts: number;
};
recentBlockhash?: string;
}

export interface aptosCustomTransactionParams {
Expand Down
1 change: 1 addition & 0 deletions modules/sdk-core/src/bitgo/wallet/iWallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ export interface PrebuildTransactionOptions {
numReadonlySignedAccounts: number;
numReadonlyUnsignedAccounts: number;
};
recentBlockhash?: string;
};
/**
* Custom transaction parameters for Aptos entry function calls.
Expand Down