Skip to content

Commit 5288289

Browse files
authored
Merge pull request #1168 from onflow/brian-doyle/tune-hybrid-tutorial
Update contract import instructions
2 parents 7f3605c + 44a411a commit 5288289

File tree

1 file changed

+8
-25
lines changed

1 file changed

+8
-25
lines changed

docs/tutorials/cross-vm-apps/introduction.md

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ Click `Send Batch Transaction Example` and approve the transaction. You'll see t
9898

9999
:::tip
100100

101-
Currently, the Flow wallet sponsors all gas for all transactions on both testnet **and mainnet!**
101+
Currently, the Flow wallet sponsors all gas for all transactions signed with the wallet on both testnet **and mainnet!**
102102

103103
:::
104104

@@ -234,7 +234,7 @@ Returns the current Cadence VM block number.
234234

235235
Next, we'll update the starter to connect to and call functions in our own contract. For this, we'll use a simple [Button Clicker Contract]. You can deploy your own copy, or use the one deployed at [`0xA7Cf2260e501952c71189D04FAd17c704DFB36e6`].
236236

237-
## Set Up a `useContracts` Hook
237+
## Set Up Contract Imports
238238

239239
:::info
240240

@@ -244,35 +244,18 @@ The following steps assume deployment with Hardhat Ignition. If you are using a
244244

245245
In your fork of the app, add a folder called `contracts` to the `src` folder. In it, copy over ['deployed_addresses.json`] from `ignition/deployments/chain-545` in the Button Clicker repo, and `ignition/deployments/chain-545/ClickTokenModule#ClickToken.json`.
246246

247-
Next, add a file called `useContracts.ts` in the `src/hooks` folder.
247+
Next, create a folder called `constants` and add a file called `contracts.ts` to it.
248248

249-
In it, import the contract artifact and addresses file, and create a hook to conveniently export them where needed.
249+
In it, import the contract artifact and addresses file, and create export a constant with this information.
250250

251251
```tsx
252252
import ClickToken from '../contracts/ClickTokenModule#ClickToken.json';
253253
import deployedAddresses from '../contracts/deployed_addresses.json';
254254

255-
export interface Contract {
256-
abi: any;
257-
address: string;
258-
}
259-
260-
export type ContractMap = {
261-
[contractName: string]: Contract;
262-
};
263-
264-
export const useContracts = (): ContractMap => {
265-
return {
266-
ClickToken: {
267-
abi: ClickToken.abi,
268-
address: deployedAddresses[
269-
'ClickTokenModule#ClickToken'
270-
] as `0x${string}`,
271-
},
272-
};
273-
};
274-
275-
export default useContracts;
255+
export const clickToken = {
256+
abi: ClickToken.abi,
257+
address: deployedAddresses['ClickTokenModule#ClickToken'] as `0x${string}`
258+
};
276259
```
277260

278261
## Build Traditional Functionality

0 commit comments

Comments
 (0)