Skip to content

Commit

Permalink
add default gas for bearby
Browse files Browse the repository at this point in the history
  • Loading branch information
peterjah committed Oct 4, 2024
1 parent 5cc578e commit e4410f7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/bearbyWallet/BearbyAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,9 @@ export class BearbyAccount implements Provider {
try {
const operationId = await web3.contract.call({
// TODO: add bigint support in bearby.js
maxGas: Number(params.maxGas),
coins: Number(params.coins),
// TODO add gas estimation here
maxGas: Number(params.maxGas || MAX_GAS_CALL),
coins: Number(params.coins || 0),
fee: Number(fee),
targetAddress: params.target,
functionName: params.func,
Expand All @@ -173,7 +174,7 @@ export class BearbyAccount implements Provider {
}

public async readSC(params: ReadSCParams): Promise<ReadSCData> {
if (params.maxGas > MAX_GAS_CALL) {
if (params?.maxGas > MAX_GAS_CALL) {
throw new Error(
`Gas amount ${params.maxGas} exceeds the maximum allowed ${MAX_GAS_CALL}.`,
);
Expand Down Expand Up @@ -310,7 +311,6 @@ export class BearbyAccount implements Provider {

public async getNodeStatus(): Promise<NodeStatusInfo> {
const status = await web3.massa.getNodesStatus();
console.log(status.result);
return formatNodeStatusObject(status.result as NodeStatus);
}
}

0 comments on commit e4410f7

Please sign in to comment.