Skip to content

Commit 957357e

Browse files
committed
chore: update explain transaction
Ticket: WIN-5679
1 parent 83bc52a commit 957357e

File tree

3 files changed

+60
-2
lines changed

3 files changed

+60
-2
lines changed

modules/sdk-coin-sol/src/lib/transaction.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,8 @@ export class Transaction extends BaseTransaction {
402402
const decodedInstructions = instructionParamsFactory(
403403
this._type,
404404
this._solTransaction.instructions,
405-
this._coinConfig.name
405+
this._coinConfig.name,
406+
this._instructionsData
406407
);
407408

408409
let memo: string | undefined = undefined;

modules/sdk-coin-sol/src/lib/transactionBuilder.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,12 @@ export abstract class TransactionBuilder extends BaseTransactionBuilder {
7575
this.sender(sender);
7676
this.feePayer(txData.feePayer as string);
7777
this.nonce(txData.nonce, txData.durableNonce);
78-
this._instructionsData = instructionParamsFactory(tx.type, tx.solTransaction.instructions, this._coinConfig.name);
78+
this._instructionsData = instructionParamsFactory(
79+
tx.type,
80+
tx.solTransaction.instructions,
81+
this._coinConfig.name,
82+
txData.instructionsData
83+
);
7984
// Parse priority fee instruction data
8085
const filteredPriorityFeeInstructionsData = txData.instructionsData.filter(
8186
(data) => data.type === InstructionBuilderTypes.SetPriorityFee

modules/sdk-coin-sol/test/unit/transaction.ts

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -823,6 +823,58 @@ describe('Sol Transaction', () => {
823823
});
824824
});
825825

826+
it('should explain single token transfer transaction with optional params', async function () {
827+
const tx = await factory
828+
.getTokenTransferBuilder()
829+
.nonce(blockHash)
830+
.sender(sender)
831+
.send({
832+
address,
833+
amount,
834+
tokenName: 'tsol:ams',
835+
tokenAddress: 'F4uLeXioFz3hw13MposuwaQbMcZbCjqvEGPPeRRB1Byf',
836+
programId: 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA',
837+
decimalPlaces: 9,
838+
})
839+
.fee({ amount: 5000 })
840+
.build();
841+
842+
const explainedTransaction = tx.explainTransaction();
843+
explainedTransaction.should.deepEqual({
844+
displayOrder: [
845+
'id',
846+
'type',
847+
'blockhash',
848+
'durableNonce',
849+
'outputAmount',
850+
'changeAmount',
851+
'outputs',
852+
'changeOutputs',
853+
'fee',
854+
'memo',
855+
],
856+
id: 'UNAVAILABLE',
857+
type: 'Send',
858+
changeOutputs: [],
859+
changeAmount: '0',
860+
outputAmount: '0',
861+
outputs: [
862+
{
863+
address: 'DesU7XscZjng8yj5VX6AZsk3hWSW4sQ3rTG2LuyQ2P4H',
864+
amount: '10000',
865+
tokenName: 'tsol:ams',
866+
},
867+
],
868+
fee: {
869+
fee: '5000',
870+
feeRate: 5000,
871+
},
872+
memo: undefined,
873+
blockhash: '5ne7phA48Jrvpn39AtupB8ZkCCAy8gLTfpGihZPuDqen',
874+
durableNonce: undefined,
875+
});
876+
});
877+
826878
it('should explain multi token transfer with durable nonce and memo transaction', async function () {
827879
const tx = await factory
828880
.getTokenTransferBuilder()

0 commit comments

Comments
 (0)