solana.js: doc comments
This commit is contained in:
parent
fe1a52a1eb
commit
9623cd8481
|
@ -56,15 +56,36 @@ const isBrowser =
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wrapper class for the Switchboard anchor Program.
|
* Wrapper class for the Switchboard anchor Program.
|
||||||
|
*
|
||||||
|
* Basic usage example:
|
||||||
|
*
|
||||||
|
* ```ts
|
||||||
|
* import { Connection } from "@solana/web3.js";
|
||||||
|
* import { SwitchboardProgram, TransactionObject } from '@switchboard-xyz/solana.js';
|
||||||
|
*
|
||||||
|
* const program = await SwitchboardProgram.load(
|
||||||
|
* "mainnet-beta",
|
||||||
|
* new Connection("https://api.mainnet-beta.solana.com"),
|
||||||
|
* payerKeypair
|
||||||
|
* );
|
||||||
|
*
|
||||||
|
* const txn = new TransactionObject(program.walletPubkey, [], []);
|
||||||
|
* const txnSignature = await program.signAndSend(txn);
|
||||||
|
* ```
|
||||||
*/
|
*/
|
||||||
export class SwitchboardProgram {
|
export class SwitchboardProgram {
|
||||||
private static readonly _readOnlyKeypair = READ_ONLY_KEYPAIR;
|
private static readonly _readOnlyKeypair = READ_ONLY_KEYPAIR;
|
||||||
|
|
||||||
private readonly _program: anchor.Program;
|
private readonly _program: anchor.Program;
|
||||||
|
|
||||||
|
/** The solana cluster to load the Switchboard program for. */
|
||||||
readonly cluster: Cluster | 'localnet';
|
readonly cluster: Cluster | 'localnet';
|
||||||
|
|
||||||
readonly programState: {
|
readonly programState: {
|
||||||
publicKey: PublicKey;
|
publicKey: PublicKey;
|
||||||
bump: number;
|
bump: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
readonly mint: Mint;
|
readonly mint: Mint;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -123,10 +144,17 @@ export class SwitchboardProgram {
|
||||||
* Basic usage example:
|
* Basic usage example:
|
||||||
*
|
*
|
||||||
* ```ts
|
* ```ts
|
||||||
* import {Connection} from "@solana/web3.js";
|
* import { Connection } from "@solana/web3.js";
|
||||||
* import {SwitchboardProgram} from '@switchboard-xyz/solana.js';
|
* import { SwitchboardProgram, TransactionObject } from '@switchboard-xyz/solana.js';
|
||||||
* const program = await SwitchboardProgram.load("mainnet-beta", new Connection("https://api.mainnet-beta.solana.com"), payerKeypair);
|
*
|
||||||
* console.log(program.programId);
|
* const program = await SwitchboardProgram.load(
|
||||||
|
* "mainnet-beta",
|
||||||
|
* new Connection("https://api.mainnet-beta.solana.com"),
|
||||||
|
* payerKeypair
|
||||||
|
* );
|
||||||
|
*
|
||||||
|
* const txn = new TransactionObject(program.walletPubkey, [], []);
|
||||||
|
* const txnSignature = await program.signAndSend(txn);
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
static load = async (
|
static load = async (
|
||||||
|
|
Loading…
Reference in New Issue