Skip to content

Commit

Permalink
fix provider for account getters
Browse files Browse the repository at this point in the history
  • Loading branch information
Giannis Chatziveroglou committed Jan 13, 2023
1 parent 860cde1 commit 13d25e0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions sdk/constants.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import type { IdlAccountData as cIdlAccountData } from "@cardinal/common";
import { emptyWallet } from "@cardinal/common";
import { AnchorProvider, Program } from "@coral-xyz/anchor";
import type { AllAccountsMap } from "@coral-xyz/anchor/dist/cjs/program/namespace/types";
import type { Wallet } from "@coral-xyz/anchor/dist/cjs/provider";
import type { ConfirmOptions, Connection } from "@solana/web3.js";
import { PublicKey } from "@solana/web3.js";
import { Keypair, PublicKey } from "@solana/web3.js";

import type { CardinalRewardsCenter } from "./idl/cardinal_rewards_center";
import { IDL } from "./idl/cardinal_rewards_center";
Expand Down Expand Up @@ -53,6 +54,10 @@ export const rewardsCenterProgram = (
return new Program<CardinalRewardsCenter>(
REWARDS_CENTER_IDL,
REWARDS_CENTER_ADDRESS,
new AnchorProvider(connection, wallet, opts ?? {})
new AnchorProvider(
connection,
wallet ?? emptyWallet(Keypair.generate().publicKey),
opts ?? {}
)
);
};

0 comments on commit 13d25e0

Please sign in to comment.