@saberhq/anchor-contrib
Advanced tools
Comparing version 1.2.3 to 1.2.4
/// <reference types="node" /> | ||
import type { Address, BN, Context as AnchorContext, Program as AProgram } from "@project-serum/anchor"; | ||
import type { Idl, IdlAccountItem, IdlAccounts, IdlEvent, IdlEventField, IdlField, IdlInstruction, IdlType, IdlTypeDef, IdlTypeDefTyStruct } from "@project-serum/anchor/dist/cjs/idl"; | ||
import type { ProgramAccount } from "@project-serum/anchor/dist/cjs/program/namespace"; | ||
import type { AccountMeta, Commitment, PublicKey, Signer, Transaction, TransactionInstruction, TransactionSignature } from "@solana/web3.js"; | ||
import type EventEmitter from "eventemitter3"; | ||
import type { AccountClient, ProgramAccount, StateClient } from "@project-serum/anchor/dist/cjs/program/namespace"; | ||
import type { AccountMeta, PublicKey, Transaction, TransactionInstruction, TransactionSignature } from "@solana/web3.js"; | ||
declare type InstructionsParsed = Record<string, { | ||
@@ -35,20 +34,26 @@ accounts: IdlAccountItem[]; | ||
declare type TransactionNamespace<R extends InstructionsParsed> = MakeInstructionsNamespace<R, Transaction>; | ||
declare type StateNamespace<R extends InstructionsParsed, S> = { | ||
address: () => Promise<PublicKey>; | ||
declare type StateNamespace<R extends InstructionsParsed, S> = Omit<StateClient, "rpc" | "fetch" | "instruction"> & { | ||
rpc: RpcNamespace<R>; | ||
fetch: () => Promise<S>; | ||
instruction: InstructionNamespace<R>; | ||
subscribe: (commitment?: Commitment) => EventEmitter; | ||
unsubscribe: () => void; | ||
}; | ||
declare type AccountsNamespace<A> = { | ||
[K in keyof A]: { | ||
[K in keyof A]: AccountClient & { | ||
/** | ||
* Returns a deserialized account. | ||
* | ||
* @param address The address of the account to fetch. | ||
*/ | ||
fetch: (address: PublicKey) => Promise<A[K]>; | ||
size: number; | ||
/** | ||
* Returns all instances of this account type for the program. | ||
*/ | ||
all: (filter?: Buffer) => Promise<ProgramAccount<A[K]>[]>; | ||
subscribe: (address: Address, commitment?: Commitment) => EventEmitter; | ||
unsubscribe: (address: Address) => void; | ||
createInstruction: (signer: Signer, sizeOverride?: number) => Promise<TransactionInstruction>; | ||
/** | ||
* @deprecated since version 14.0. | ||
* | ||
* Function returning the associated account. Args are keys to associate. | ||
* Order matters. | ||
*/ | ||
associated: (...args: PublicKey[]) => Promise<A[K]>; | ||
associatedAddress: (...args: PublicKey[]) => Promise<PublicKey>; | ||
}; | ||
@@ -55,0 +60,0 @@ }; |
@@ -7,3 +7,3 @@ { | ||
}, | ||
"version": "1.2.3", | ||
"version": "1.2.4", | ||
"main": "dist/index.js", | ||
@@ -29,3 +29,3 @@ "author": "Ian Macalinao <ian@saber.so>", | ||
}, | ||
"gitHead": "7998ebd90ecaeb7697ccdc5fc216df0d1ec07df2" | ||
"gitHead": "d9a566b79c996cd3b334f45bf7d1fe44c17f0477" | ||
} |
@@ -19,8 +19,10 @@ import type { | ||
} from "@project-serum/anchor/dist/cjs/idl"; | ||
import type { ProgramAccount } from "@project-serum/anchor/dist/cjs/program/namespace"; | ||
import type { | ||
AccountClient, | ||
ProgramAccount, | ||
StateClient, | ||
} from "@project-serum/anchor/dist/cjs/program/namespace"; | ||
import type { | ||
AccountMeta, | ||
Commitment, | ||
PublicKey, | ||
Signer, | ||
Transaction, | ||
@@ -30,3 +32,2 @@ TransactionInstruction, | ||
} from "@solana/web3.js"; | ||
import type EventEmitter from "eventemitter3"; | ||
@@ -83,24 +84,30 @@ type InstructionsParsed = Record< | ||
type StateNamespace<R extends InstructionsParsed, S> = { | ||
address: () => Promise<PublicKey>; | ||
type StateNamespace<R extends InstructionsParsed, S> = Omit< | ||
StateClient, | ||
"rpc" | "fetch" | "instruction" | ||
> & { | ||
rpc: RpcNamespace<R>; | ||
fetch: () => Promise<S>; | ||
instruction: InstructionNamespace<R>; | ||
subscribe: (commitment?: Commitment) => EventEmitter; | ||
unsubscribe: () => void; | ||
}; | ||
type AccountsNamespace<A> = { | ||
[K in keyof A]: { | ||
[K in keyof A]: AccountClient & { | ||
/** | ||
* Returns a deserialized account. | ||
* | ||
* @param address The address of the account to fetch. | ||
*/ | ||
fetch: (address: PublicKey) => Promise<A[K]>; | ||
size: number; | ||
/** | ||
* Returns all instances of this account type for the program. | ||
*/ | ||
all: (filter?: Buffer) => Promise<ProgramAccount<A[K]>[]>; | ||
subscribe: (address: Address, commitment?: Commitment) => EventEmitter; | ||
unsubscribe: (address: Address) => void; | ||
createInstruction: ( | ||
signer: Signer, | ||
sizeOverride?: number | ||
) => Promise<TransactionInstruction>; | ||
/** | ||
* @deprecated since version 14.0. | ||
* | ||
* Function returning the associated account. Args are keys to associate. | ||
* Order matters. | ||
*/ | ||
associated: (...args: PublicKey[]) => Promise<A[K]>; | ||
associatedAddress: (...args: PublicKey[]) => Promise<PublicKey>; | ||
}; | ||
@@ -107,0 +114,0 @@ }; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
405
33549