Skip to content

Commit

Permalink
Merge pull request AstarNetwork#2 from AstarNetwork/gas-fix
Browse files Browse the repository at this point in the history
Gas Fix
  • Loading branch information
niklabh authored Jan 4, 2023
2 parents 80c1aae + 68f6e97 commit ffd4918
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions ui/components/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,25 @@ const Home: NextPage = () => {

const contract = new ContractPromise(api, abi, address)

const { gasRequired, result, output } = await contract.query.flip(
address,
{
gasLimit: api.registry.createType('WeightV2', {
refTime,
proofSize,
}) as WeightV2,
storageDepositLimit,
}
)

const gasLimit = api.registry.createType('WeightV2', gasRequired) as WeightV2

// Send the transaction, like elsewhere this is a normal extrinsic
// with the same rules as applied in the API (As with the read example,
// additional params, if required can follow)
await contract.tx
.flip({
gasLimit: api.registry.createType('WeightV2', {
refTime,
proofSize,
}) as WeightV2,
gasLimit: gasLimit,
storageDepositLimit
})
.signAndSend(account, async (res) => {
Expand Down

0 comments on commit ffd4918

Please sign in to comment.