parent
909b488454
commit
82c3efbe45
|
@ -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",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue