diff --git a/javascript/solana.js/package-lock.json b/javascript/solana.js/package-lock.json index 9072edf..17bb1f6 100644 --- a/javascript/solana.js/package-lock.json +++ b/javascript/solana.js/package-lock.json @@ -1,12 +1,12 @@ { "name": "@switchboard-xyz/solana.js", - "version": "2.0.67", + "version": "2.0.68", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@switchboard-xyz/solana.js", - "version": "2.0.67", + "version": "2.0.68", "license": "MIT", "dependencies": { "@project-serum/anchor": "^0.26.0", diff --git a/javascript/solana.js/package.json b/javascript/solana.js/package.json index dec49b3..59ded65 100644 --- a/javascript/solana.js/package.json +++ b/javascript/solana.js/package.json @@ -1,6 +1,6 @@ { "name": "@switchboard-xyz/solana.js", - "version": "2.0.67", + "version": "2.0.68", "author": "", "license": "MIT", "description": "API wrapper for integrating with the Switchboard V2 program on Solana", diff --git a/javascript/solana.js/src/json/vrf.ts b/javascript/solana.js/src/json/vrf.ts index a3871d6..104a0c9 100644 --- a/javascript/solana.js/src/json/vrf.ts +++ b/javascript/solana.js/src/json/vrf.ts @@ -1,6 +1,6 @@ import { AccountMeta, Keypair, PublicKey } from '@solana/web3.js'; -import { CreateQueueVrfParams } from '../accounts'; -import { Callback } from '../generated'; +import { CreateQueueVrfParams, Callback } from '../accounts'; +import { Callback as CallbackJson } from '../generated'; import { keypairToString, loadKeypair, @@ -28,7 +28,18 @@ export class VrfJson implements IVrfJson { if (!('callback' in object)) { throw new Error(`VRF has no callback defined`); } - this.callback = Callback.fromJSON(object.callback); + const callbackJson = CallbackJson.fromJSON(object.callback); + this.callback = { + programId: callbackJson.programId, + accounts: callbackJson.accounts.map((a): AccountMeta => { + return { + pubkey: a.pubkey, + isSigner: a.isSigner, + isWritable: a.isWritable, + }; + }), + ixData: Buffer.from(callbackJson.ixData), + }; // permissions this.enable = parseBoolean(object, 'enable', false); @@ -69,15 +80,15 @@ export class VrfJson implements IVrfJson { toJSON() { return { callback: { - programId: this.callback.programId, - accounts: this.callback.accounts.map((a): AccountMeta => { + programId: this.callback.programId.toBase58(), + accounts: this.callback.accounts.map(a => { return { - pubkey: a.pubkey, + pubkey: a.pubkey.toBase58(), isSigner: a.isSigner, isWritable: a.isWritable, }; }), - isData: Buffer.from(this.callback.ixData), + isData: `[${new Uint8Array(this.callback.ixData)}]`, }, keypair: keypairToString(this.vrfKeypair), authority: this.authority?.toBase58() ?? undefined,