Skip to content

Commit

Permalink
Add fee by default for readonly (#551)
Browse files Browse the repository at this point in the history
  • Loading branch information
AurelienFT authored Apr 9, 2024
1 parent df39410 commit 8511026
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/massa-web3/src/web3/SmartContractsClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ export class SmartContractsClient
)
}

const minimalFees = await this.publicApiClient.getMinimalFees()

const data = {
max_gas:
readData.maxGas === null || readData.maxGas === undefined
Expand All @@ -207,7 +209,7 @@ export class SmartContractsClient
: undefined,
fee: readData.fee
? toMAS(readData.fee).toFixed(MASSA_SCALING_FACTOR)
: undefined,
: toMAS(minimalFees).toFixed(MASSA_SCALING_FACTOR),
}

// returns operation ids
Expand Down
3 changes: 3 additions & 0 deletions packages/massa-web3/test/web3/smartContractsClient.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ describe('SmartContractsClient', () => {
mockPublicApiClient.getNodeStatus = jest
.fn()
.mockResolvedValue(mockNodeStatusInfo)

// Mock the getMinimalFees function
mockPublicApiClient.getMinimalFees = jest.fn().mockResolvedValue(BigInt(0))
// Mock the getBaseAccount function
mockWalletClient.getBaseAccount = jest
.fn()
Expand Down

0 comments on commit 8511026

Please sign in to comment.