(connection, wallet)
| 3 | import { STABLE_POOL_IDL, STABLE_POOL_PROGRAM_ID } from './const' |
| 4 | |
| 5 | export function getProgramInstance(connection, wallet) { |
| 6 | if (!wallet.publicKey) throw new WalletNotConnectedError() |
| 7 | |
| 8 | const provider = new anchor.Provider( |
| 9 | connection, |
| 10 | wallet, |
| 11 | anchor.Provider.defaultOptions(), |
| 12 | ) |
| 13 | |
| 14 | const idl = STABLE_POOL_IDL |
| 15 | |
| 16 | const programId = STABLE_POOL_PROGRAM_ID |
| 17 | |
| 18 | const program = new anchor.Program(idl, programId, provider) |
| 19 | |
| 20 | return program |
| 21 | } |