@clockwork-xyz/sdk
Advanced tools
Comparing version 0.2.3 to 0.2.4
import * as anchor from "@coral-xyz/anchor"; | ||
import { Connection, PublicKey, TransactionInstruction } from "@solana/web3.js"; | ||
import { ConfirmOptions, Connection, PublicKey, Transaction, TransactionInstruction } from "@solana/web3.js"; | ||
import { ThreadProgram } from "./programs/thread/types"; | ||
@@ -7,7 +7,21 @@ import { NetworkProgram } from "./programs/network/types"; | ||
import { ThreadSettingsInput, TriggerInput } from "./models"; | ||
/** | ||
* Wallet interface for objects that can be used to sign provider transactions. | ||
*/ | ||
export interface ClockworkProviderWallet { | ||
signTransaction(tx: Transaction): Promise<Transaction>; | ||
signAllTransactions(txs: Transaction[]): Promise<Transaction[]>; | ||
publicKey: PublicKey; | ||
} | ||
declare class ClockworkProvider { | ||
threadProgram: anchor.Program<ThreadProgram>; | ||
networkProgram: anchor.Program<NetworkProgram>; | ||
constructor(wallet: anchor.Wallet, connection: Connection); | ||
constructor(wallet: ClockworkProviderWallet, connection: Connection, opts?: ConfirmOptions); | ||
/** | ||
* Build a ClockworkProvider from an AnchorProvider | ||
* | ||
* @param authority thread authority | ||
*/ | ||
static fromAnchorProvider(provider: anchor.AnchorProvider): ClockworkProvider; | ||
/** | ||
* Get Thread PDA. Returns the public key and bump. | ||
@@ -14,0 +28,0 @@ * |
@@ -44,6 +44,4 @@ "use strict"; | ||
class ClockworkProvider { | ||
constructor(wallet, connection) { | ||
const provider = new anchor.AnchorProvider(connection, wallet, { | ||
commitment: "confirmed", | ||
}); | ||
constructor(wallet, connection, opts = anchor.AnchorProvider.defaultOptions()) { | ||
const provider = new anchor.AnchorProvider(connection, wallet, opts); | ||
this.threadProgram = new anchor.Program(idl_json_1.default, idl_json_1.default.metadata.address, provider); | ||
@@ -53,2 +51,11 @@ this.networkProgram = new anchor.Program(idl_json_2.default, idl_json_2.default.metadata.address, provider); | ||
/** | ||
* Build a ClockworkProvider from an AnchorProvider | ||
* | ||
* @param authority thread authority | ||
*/ | ||
static fromAnchorProvider(provider) { | ||
const clockworkProvider = new ClockworkProvider(provider.wallet, provider.connection, provider.opts); | ||
return clockworkProvider; | ||
} | ||
/** | ||
* Get Thread PDA. Returns the public key and bump. | ||
@@ -55,0 +62,0 @@ * |
{ | ||
"name": "@clockwork-xyz/sdk", | ||
"author": "Clockwork", | ||
"version": "0.2.3", | ||
"version": "0.2.4", | ||
"description": "Clockwork Typescript SDK", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
253959
8051
0