Skip to content

Commit

Permalink
fix(sdk): Fix getOriginFeeDetails API disconnect 🛠️
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeldev5 authored and dudo50 committed Nov 19, 2024
1 parent 50735d5 commit 346ecd0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/sdk/src/pallets/assets/getOriginFeeDetails.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import type { Extrinsic } from '../../pjs/types'
const apiMock = {
init: vi.fn(),
calculateTransactionFee: vi.fn().mockResolvedValue(BigInt('1000000000')),
disconnect: vi.fn()
disconnect: vi.fn(),
setDisconnectAllowed: vi.fn()
} as unknown as IPolkadotApi<ApiPromise, Extrinsic>

describe('getOriginFeeDetails', () => {
Expand Down
3 changes: 2 additions & 1 deletion packages/sdk/src/pallets/assets/getOriginFeeDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,11 @@ export const getOriginFeeDetails = async <TApi, TRes>(
options: TGetOriginFeeDetailsOptions<TApi, TRes>
): Promise<TOriginFeeDetails> => {
const { api } = options

api.setDisconnectAllowed(false)
try {
return await getOriginFeeDetailsInternal(options)
} finally {
api.setDisconnectAllowed(true)
await api.disconnect()
}
}

0 comments on commit 346ecd0

Please sign in to comment.