Skip to content

Commit afde8f3

Browse files
committed
use dynamic import
typo
1 parent 948444a commit afde8f3

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

examples/oft-solana/tasks/solana/renounceFreeze.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,8 @@ import { TOKEN_PROGRAM_ID } from '@solana/spl-token'
44
import { PublicKey } from '@solana/web3.js'
55
import { task } from 'hardhat/config'
66

7-
import { types } from '@layerzerolabs/devtools-evm-hardhat'
87
import { EndpointId } from '@layerzerolabs/lz-definitions'
98

10-
import IDL from '../../target/idl/oft.json'
11-
import { Oft } from '../../target/types/oft'
12-
139
import { deriveConnection, getExplorerTxLink } from './index'
1410

1511
interface Args {
@@ -50,8 +46,11 @@ task('lz:oft:solana:renounce-freeze', 'Renounce freeze authority for an OFT toke
5046
commitment: 'processed',
5147
})
5248

53-
// @ts-ignore Anchor IDL error can be ignored (will only show up after IDL file is created)
54-
const program = new Program<Oft>(IDL, programIdStr, provider)
49+
const IDL = await import('../../target/idl/oft.json').then((module) => module.default)
50+
const anchorTypes = await import('../../target/types/oft').then((module) => module)
51+
52+
// @ts-ignore we can ignore the IDL type error, which is a quirk of Anchor
53+
const program = new Program<typeof anchorTypes.IDL>(IDL, programIdStr, provider)
5554

5655
const [oftStorePda, oftStoreBump] = PublicKey.findProgramAddressSync(
5756
[Buffer.from('OFT'), new PublicKey(tokenEscrowStr).toBuffer()],

0 commit comments

Comments
 (0)