js sdk updates

This commit is contained in:
Conner Gallagher 2023-07-06 23:41:18 -06:00
parent c68b2cff71
commit 4b27dbaacc
4 changed files with 12 additions and 5 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@switchboard-xyz/solana.js", "name": "@switchboard-xyz/solana.js",
"version": "2.3.1", "version": "2.3.2",
"author": "", "author": "",
"license": "MIT", "license": "MIT",
"description": "A Typescript client to interact with Switchboard on Solana.", "description": "A Typescript client to interact with Switchboard on Solana.",

View File

@ -199,6 +199,10 @@ export class FunctionAccount extends Account<types.FunctionAccountData> {
return this._wallet; return this._wallet;
} }
public set wallet(_wallet: Promise<SwitchboardWallet>) {
this._wallet = _wallet;
}
public static fromSeed( public static fromSeed(
program: SwitchboardProgram, program: SwitchboardProgram,
creatorSeed: Uint8Array, creatorSeed: Uint8Array,
@ -401,6 +405,9 @@ export class FunctionAccount extends Account<types.FunctionAccountData> {
addressLookupProgram: addressLookupProgram, addressLookupProgram: addressLookupProgram,
} }
); );
functionAccount.wallet = Promise.resolve(escrowWallet);
return [ return [
functionAccount, functionAccount,
new TransactionObject( new TransactionObject(

View File

@ -264,8 +264,6 @@ export class SwitchboardWallet extends Account<SwitchboardWalletWithEscrow> {
params: SwitchboardWalletFundParams, params: SwitchboardWalletFundParams,
options?: TransactionObjectOptions options?: TransactionObjectOptions
): Promise<TransactionObject> { ): Promise<TransactionObject> {
const walletState = await this.loadData();
let funderPubkey = payer; let funderPubkey = payer;
if (params.funderAuthority) { if (params.funderAuthority) {
funderPubkey = params.funderAuthority.publicKey; funderPubkey = params.funderAuthority.publicKey;
@ -288,12 +286,14 @@ export class SwitchboardWallet extends Account<SwitchboardWalletWithEscrow> {
wrapAmount = this.program.mint.toTokenAmountBN(params.wrapAmount); wrapAmount = this.program.mint.toTokenAmountBN(params.wrapAmount);
} }
const walletState = await this.loadData();
const ixn = types.walletFund( const ixn = types.walletFund(
this.program, this.program,
{ params: { transferAmount, wrapAmount } }, { params: { transferAmount, wrapAmount } },
{ {
wallet: this.publicKey, wallet: this.publicKey,
mint: walletState.mint, mint: this.program.mint.address,
authority: walletState.authority, authority: walletState.authority,
attestationQueue: walletState.attestationQueue, attestationQueue: walletState.attestationQueue,
tokenWallet: this.tokenWallet, tokenWallet: this.tokenWallet,

View File

@ -77,7 +77,7 @@ describe("Vrf Pool Tests", () => {
rpcUrl: "http://0.0.0.0:8899", rpcUrl: "http://0.0.0.0:8899",
oracleKey: oracle1.publicKey.toBase58(), oracleKey: oracle1.publicKey.toBase58(),
secretPath: "~/.config/solana/id.json", secretPath: "~/.config/solana/id.json",
silent: false, silent: true,
}); });
chalkString("payer", ctx.program.walletPubkey.toBase58()); chalkString("payer", ctx.program.walletPubkey.toBase58());