Skip to content

Commit

Permalink
estimated v2
Browse files Browse the repository at this point in the history
  • Loading branch information
niklabh authored and github-actions[bot] committed Mar 27, 2023
1 parent aeb17bf commit 97bed3f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
4 changes: 4 additions & 0 deletions packages/apps/public/locales/en/app-contracts.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@
"deployment constructor": "deployment constructor",
"exec": "exec",
"json for either ABI or .contract bundle": "json for either ABI or .contract bundle",
"max ProofSize allowed": "max ProofSize allowed",
"max ProofSize allowed ({{estimatedProofSize}} estimated)": "max ProofSize allowed ({{estimatedProofSize}} estimated)",
"max RefTime allowed (M)": "max RefTime allowed (M)",
"max RefTime allowed (M, {{estimatedRefTime}} estimated)": "max RefTime allowed (M, {{estimatedRefTime}} estimated)",
"max gas allowed (M)": "max gas allowed (M)",
"max gas allowed (M, {{estimatedMg}} estimated)": "max gas allowed (M, {{estimatedMg}} estimated)",
"max read gas": "max read gas",
Expand Down
10 changes: 9 additions & 1 deletion packages/page-contracts/src/Contracts/Call.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ function Call ({ className = '', contract, messageIndex, onCallResult, onChangeM
} else {
setEstimatedWeight(
result.isOk
? gasRequired
? gasRequired.refTime.toBn()
: null
);
}
Expand Down Expand Up @@ -191,6 +191,14 @@ function Call ({ className = '', contract, messageIndex, onCallResult, onChangeM
)}
<InputMegaGas
estimatedWeight={message.isMutating ? estimatedWeight : MAX_CALL_WEIGHT}
estimatedWeightV2={message.isMutating
? estimatedWeightV2
: api.registry.createType('WeightV2', {
proofSize: new BN(1_000_000),
refTIme: MAX_CALL_WEIGHT
})
}
help={t<string>('The maximum amount of gas to use for this contract call. If the call requires more, it will fail.')}
isCall={!message.isMutating}
weight={weight}
/>
Expand Down
4 changes: 2 additions & 2 deletions packages/page-contracts/src/shared/InputMegaGas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import { useTranslation } from '../translate.js';

interface Props {
className?: string;
estimatedWeight?: BN
estimatedWeightV2?: WeightV2;
estimatedWeight?: BN | null;
estimatedWeightV2?: WeightV2 | null;
help: React.ReactNode;
isCall?: boolean;
weight: UseWeight;
Expand Down

0 comments on commit 97bed3f

Please sign in to comment.