File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4346,7 +4346,9 @@ export class Wallet implements IWallet {
43464346
43474347 if (
43484348 typeof params . prebuildTx === 'string' ||
4349- ( params . prebuildTx ?. buildParams ?. type !== 'enabletoken' && params . prebuildTx ?. buildParams ?. type !== 'enableMpt' )
4349+ ( params . prebuildTx ?. buildParams ?. type !== 'enabletoken' &&
4350+ params . prebuildTx ?. buildParams ?. type !== 'enableMpt' &&
4351+ params . prebuildTx ?. buildParams ?. type !== 'disabletoken' )
43504352 ) {
43514353 throw new Error ( 'Invalid build of token enablement.' ) ;
43524354 }
Original file line number Diff line number Diff line change 11import sinon from 'sinon' ;
22import 'should' ;
3- import { BuildTokenApprovalResponse , Wallet } from '../../../../src' ;
3+ import { BuildTokenApprovalResponse , PrebuildTransactionResult , Wallet } from '../../../../src' ;
44
55describe ( 'Wallet - Token Approval' , function ( ) {
66 let wallet : Wallet ;
@@ -224,6 +224,18 @@ describe('Wallet - Token Approval', function () {
224224 sinon . assert . calledOnce ( initiateStub ) ;
225225 } ) ;
226226
227+ it ( 'should pass validation and proceed when buildParams.type is "disabletoken"' , async function ( ) {
228+ const initiateStub = sinon . stub ( teWallet , 'initiateTransaction' as keyof Wallet ) . resolves ( { txid : 'disable789' } ) ;
229+
230+ const result = await teWallet . sendTokenEnablement ( {
231+ // Partial fixture: only the fields sendTokenEnablement's validation guard reads.
232+ prebuildTx : { buildParams : { type : 'disabletoken' } } as unknown as PrebuildTransactionResult ,
233+ } ) ;
234+
235+ result . should . eql ( { txid : 'disable789' } ) ;
236+ sinon . assert . calledOnce ( initiateStub ) ;
237+ } ) ;
238+
227239 it ( 'should throw when the coin does not require token enablement' , async function ( ) {
228240 teBaseCoin . getTokenEnablementConfig . returns ( { requiresTokenEnablement : false } ) ;
229241
You can’t perform that action at this time.
0 commit comments