Skip to content
This repository has been archived by the owner on Sep 14, 2023. It is now read-only.

Commit

Permalink
chore: add derived contract address from dry run
Browse files Browse the repository at this point in the history
  • Loading branch information
kratico committed Dec 14, 2022
1 parent 730e773 commit 451c90c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion examples/smart_contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ function instantiateContractTx() {
const constructor = findContractConstructorByLabel("default")!
const salt = Uint8Array.from(Array.from([0, 0, 0, 0]), () => Math.floor(Math.random() * 16))
const value = preSubmitContractInstantiateDryRunGasEstimate(constructor, contract.wasm, salt)
.next(({ gasRequired }) => {
.next(({ gasRequired, result: { accountId } }) => {
// the contract address derived from the code hash and the salt
console.log("Derived contract address", U.ss58.encode(42, accountId))
return {
type: "instantiateWithCode",
value: 0n,
Expand Down

0 comments on commit 451c90c

Please sign in to comment.