Skip to content

Commit

Permalink
feat: upgrade to Gem Farm 0.24.2
Browse files Browse the repository at this point in the history
Bump `@gemworks/gem-farm-ts` from 0.22.11 to 0.24.1.

Import the IDLs instead of maintaining a local copy to ensure the IDLs
stay in sync when the Gem Farm client SDK is updated.
  • Loading branch information
solberenson committed May 3, 2022
1 parent f1d7603 commit bdc550c
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 2,385 deletions.
4 changes: 2 additions & 2 deletions lib/gem-farm/common/gem-bank/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
import { Connection, Keypair, PublicKey } from "@solana/web3.js"
import { SignerWalletAdapter } from "@solana/wallet-adapter-base"
import { NodeWallet, programs } from "@metaplex/js"
import { IDL } from "@gemworks/gem-farm-ts/dist/types/gem_bank"

//when we only want to view vaults, no need to connect a real wallet.
export function createFakeWallet() {
Expand All @@ -28,8 +29,7 @@ export async function initGemBank(
wallet?: SignerWalletAdapter
) {
const walletToUse = wallet ?? createFakeWallet()
const idl = await (await fetch("gem_bank.json")).json()
return new GemBank(conn, walletToUse as any, idl)
return new GemBank(conn, walletToUse as any, IDL)
}

export class GemBank extends GemBankClient {
Expand Down
6 changes: 3 additions & 3 deletions lib/gem-farm/common/gem-farm/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ import {
GEM_BANK_PROG_ID
} from "@gemworks/gem-farm-ts"
import { programs } from "@metaplex/js"
import { IDL as GemBankIDL } from "@gemworks/gem-farm-ts/dist/types/gem_bank"
import { IDL as GemFarmIDL} from "@gemworks/gem-farm-ts/dist/types/gem_farm"

export async function initGemFarm(
conn: Connection,
wallet?: SignerWalletAdapter
) {
const walletToUse = wallet ?? createFakeWallet()
const farmIdl = await (await fetch("gem_farm.json")).json()
const bankIdl = await (await fetch("gem_bank.json")).json()
return new GemFarm(conn, walletToUse as any, farmIdl, bankIdl)
return new GemFarm(conn, walletToUse as any, GemFarmIDL, GemBankIDL)
}

export class GemFarm extends GemFarmClient {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"dependencies": {
"@emotion/react": "^11.8.2",
"@gemworks/gem-farm-ts": "^0.22.11",
"@gemworks/gem-farm-ts": "^0.24.1",
"@mdx-js/react": "1.6.22",
"@metaplex/js": "^4.12.0",
"@solana/wallet-adapter-react": "^0.15.4",
Expand Down
Loading

0 comments on commit bdc550c

Please sign in to comment.