Socket
Socket
Sign inDemoInstall

@project-serum/anchor

Package Overview
Dependencies
65
Maintainers
6
Versions
73
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.25.0-beta.1 to 0.25.0

dist/browser/types/src/coder/borsh/types.d.ts

7

dist/browser/types/src/coder/borsh/index.d.ts

@@ -6,2 +6,3 @@ import { Idl } from "../../idl.js";

import { BorshStateCoder } from "./state.js";
import { BorshTypesCoder } from "./types.js";
import { Coder } from "../index.js";

@@ -16,3 +17,3 @@ export { BorshInstructionCoder } from "./instruction.js";

*/
export declare class BorshCoder<A extends string = string> implements Coder {
export declare class BorshCoder<A extends string = string, T extends string = string> implements Coder {
/**

@@ -34,4 +35,8 @@ * Instruction coder.

readonly events: BorshEventCoder;
/**
* Coder for user-defined types.
*/
readonly types: BorshTypesCoder<T>;
constructor(idl: Idl);
}
//# sourceMappingURL=index.d.ts.map

@@ -10,3 +10,3 @@ /// <reference types="node" />

*/
export interface Coder {
export interface Coder<A extends string = string, T extends string = string> {
/**

@@ -19,3 +19,3 @@ * Instruction coder.

*/
readonly accounts: AccountsCoder;
readonly accounts: AccountsCoder<A>;
/**

@@ -29,2 +29,6 @@ * Coder for state structs.

readonly events: EventCoder;
/**
* Coder for user-defined types.
*/
readonly types: TypesCoder<T>;
}

@@ -49,2 +53,6 @@ export interface StateCoder {

}
export interface TypesCoder<N extends string = string> {
encode<T = any>(typeName: N, type: T): Buffer;
decode<T = any>(typeName: N, typeData: Buffer): T;
}
//# sourceMappingURL=index.d.ts.map

@@ -7,2 +7,3 @@ import { Idl } from "../../idl.js";

import { SplTokenEventsCoder } from "./events.js";
import { SplTokenTypesCoder } from "./types.js";
/**

@@ -16,4 +17,5 @@ * Coder for the SPL token program.

readonly events: SplTokenEventsCoder;
readonly types: SplTokenTypesCoder;
constructor(idl: Idl);
}
//# sourceMappingURL=index.d.ts.map

@@ -7,2 +7,3 @@ import { Idl } from "../../idl.js";

import { SystemEventsCoder } from "./events.js";
import { SystemTypesCoder } from "./types.js";
/**

@@ -16,4 +17,5 @@ * Coder for the System program.

readonly events: SystemEventsCoder;
readonly types: SystemTypesCoder;
constructor(idl: Idl);
}
//# sourceMappingURL=index.d.ts.map

@@ -100,2 +100,4 @@ import { PublicKey } from "@solana/web3.js";

AccountSysvarMismatch: number;
AccountReallocExceedsLimit: number;
AccountDuplicateReallocs: number;
StateInvalidAddress: number;

@@ -102,0 +104,0 @@ DeclaredProgramIdMismatch: number;

2

dist/browser/types/src/nodewallet.d.ts

@@ -9,3 +9,3 @@ import { Keypair, PublicKey, Transaction } from "@solana/web3.js";

constructor(payer: Keypair);
static local(): NodeWallet;
static local(): NodeWallet | never;
signTransaction(tx: Transaction): Promise<Transaction>;

@@ -12,0 +12,0 @@ signAllTransactions(txs: Transaction[]): Promise<Transaction[]>;

@@ -13,6 +13,6 @@ import { PublicKey } from "@solana/web3.js";

static readonly CONST_ACCOUNTS: {
associatedTokenProgram: PublicKey;
rent: PublicKey;
systemProgram: PublicKey;
tokenProgram: PublicKey;
associatedTokenProgram: PublicKey;
rent: PublicKey;
};

@@ -19,0 +19,0 @@ private _accountStore;

@@ -52,3 +52,3 @@ import { PublicKey } from "@solana/web3.js";

constructor(programId: PublicKey, coder: Coder);
parseLogs(logs: string[], callback: (log: Event) => void): void;
parseLogs(logs: string[]): Generator<Event<IdlEvent, Record<string, never>>, void, unknown>;
private handleLog;

@@ -55,0 +55,0 @@ private handleProgramLog;

@@ -35,3 +35,3 @@ import { PublicKey } from "@solana/web3.js";

* below will refer to the two counter examples found
* [here](https://github.com/project-serum/anchor#examples).
* [here](https://github.com/coral-xyz/anchor#examples).
*/

@@ -69,2 +69,3 @@ export declare class Program<IDL extends Idl = Idl> {

* @deprecated
* Use program.methods.<method>(...args).rpc() instead
*/

@@ -71,0 +72,0 @@ readonly rpc: RpcNamespace<IDL>;

@@ -30,5 +30,7 @@ import { ConfirmOptions, AccountMeta, Signer, Transaction, TransactionInstruction, TransactionSignature, PublicKey } from "@solana/web3.js";

private _accountsResolver;
private _autoResolveAccounts;
constructor(_args: Array<any>, _ixFn: InstructionFn<IDL>, _txFn: TransactionFn<IDL>, _rpcFn: RpcFn<IDL>, _simulateFn: SimulateFn<IDL>, _viewFn: ViewFn<IDL> | undefined, _provider: Provider, _programId: PublicKey, _idlIx: AllInstructions<IDL>, _accountNamespace: AccountNamespace<IDL>);
pubkeys(): Promise<Partial<InstructionAccountAddresses<IDL, I>>>;
accounts(accounts: Partial<Accounts<I["accounts"][number]>>): MethodsBuilder<IDL, I>;
accountsStrict(accounts: Accounts<I["accounts"][number]>): MethodsBuilder<IDL, I>;
signers(signers: Array<Signer>): MethodsBuilder<IDL, I>;

@@ -35,0 +37,0 @@ remainingAccounts(accounts: Array<AccountMeta>): MethodsBuilder<IDL, I>;

import { Program, Provider } from "../index.js";
import { SplAssociatedToken } from "./associated-token.js";
import { SplToken } from "./token.js";

@@ -6,3 +7,4 @@ export { SplToken } from "./token.js";

static token(provider?: Provider): Program<SplToken>;
static associatedToken(provider?: Provider): Program<SplAssociatedToken>;
}
//# sourceMappingURL=index.d.ts.map

@@ -6,2 +6,3 @@ import { Idl } from "../../idl.js";

import { BorshStateCoder } from "./state.js";
import { BorshTypesCoder } from "./types.js";
import { Coder } from "../index.js";

@@ -16,3 +17,3 @@ export { BorshInstructionCoder } from "./instruction.js";

*/
export declare class BorshCoder<A extends string = string> implements Coder {
export declare class BorshCoder<A extends string = string, T extends string = string> implements Coder {
/**

@@ -34,4 +35,8 @@ * Instruction coder.

readonly events: BorshEventCoder;
/**
* Coder for user-defined types.
*/
readonly types: BorshTypesCoder<T>;
constructor(idl: Idl);
}
//# sourceMappingURL=index.d.ts.map

@@ -8,2 +8,3 @@ "use strict";

const state_js_1 = require("./state.js");
const types_js_1 = require("./types.js");
var instruction_js_2 = require("./instruction.js");

@@ -32,2 +33,3 @@ Object.defineProperty(exports, "BorshInstructionCoder", { enumerable: true, get: function () { return instruction_js_2.BorshInstructionCoder; } });

}
this.types = new types_js_1.BorshTypesCoder(idl);
}

@@ -34,0 +36,0 @@ }

@@ -10,3 +10,3 @@ /// <reference types="node" />

*/
export interface Coder {
export interface Coder<A extends string = string, T extends string = string> {
/**

@@ -19,3 +19,3 @@ * Instruction coder.

*/
readonly accounts: AccountsCoder;
readonly accounts: AccountsCoder<A>;
/**

@@ -29,2 +29,6 @@ * Coder for state structs.

readonly events: EventCoder;
/**
* Coder for user-defined types.
*/
readonly types: TypesCoder<T>;
}

@@ -49,2 +53,6 @@ export interface StateCoder {

}
export interface TypesCoder<N extends string = string> {
encode<T = any>(typeName: N, type: T): Buffer;
decode<T = any>(typeName: N, typeData: Buffer): T;
}
//# sourceMappingURL=index.d.ts.map

@@ -7,2 +7,3 @@ import { Idl } from "../../idl.js";

import { SplTokenEventsCoder } from "./events.js";
import { SplTokenTypesCoder } from "./types.js";
/**

@@ -16,4 +17,5 @@ * Coder for the SPL token program.

readonly events: SplTokenEventsCoder;
readonly types: SplTokenTypesCoder;
constructor(idl: Idl);
}
//# sourceMappingURL=index.d.ts.map

@@ -8,2 +8,3 @@ "use strict";

const events_js_1 = require("./events.js");
const types_js_1 = require("./types.js");
/**

@@ -18,2 +19,3 @@ * Coder for the SPL token program.

this.state = new state_js_1.SplTokenStateCoder(idl);
this.types = new types_js_1.SplTokenTypesCoder(idl);
}

@@ -20,0 +22,0 @@ }

@@ -7,2 +7,3 @@ import { Idl } from "../../idl.js";

import { SystemEventsCoder } from "./events.js";
import { SystemTypesCoder } from "./types.js";
/**

@@ -16,4 +17,5 @@ * Coder for the System program.

readonly events: SystemEventsCoder;
readonly types: SystemTypesCoder;
constructor(idl: Idl);
}
//# sourceMappingURL=index.d.ts.map

@@ -8,2 +8,3 @@ "use strict";

const events_js_1 = require("./events.js");
const types_js_1 = require("./types.js");
/**

@@ -18,2 +19,3 @@ * Coder for the System program.

this.state = new state_js_1.SystemStateCoder(idl);
this.types = new types_js_1.SystemTypesCoder(idl);
}

@@ -20,0 +22,0 @@ }

@@ -100,2 +100,4 @@ import { PublicKey } from "@solana/web3.js";

AccountSysvarMismatch: number;
AccountReallocExceedsLimit: number;
AccountDuplicateReallocs: number;
StateInvalidAddress: number;

@@ -102,0 +104,0 @@ DeclaredProgramIdMismatch: number;

@@ -310,2 +310,4 @@ "use strict";

AccountSysvarMismatch: 3015,
AccountReallocExceedsLimit: 3016,
AccountDuplicateReallocs: 3017,
// State.

@@ -442,2 +444,10 @@ StateInvalidAddress: 4000,

],
[
exports.LangErrorCode.AccountReallocExceedsLimit,
"The account reallocation exceeds the MAX_PERMITTED_DATA_INCREASE limit",
],
[
exports.LangErrorCode.AccountDuplicateReallocs,
"The account was duplicated for more than one reallocation",
],
// State.

@@ -444,0 +454,0 @@ [

@@ -9,3 +9,3 @@ import { Keypair, PublicKey, Transaction } from "@solana/web3.js";

constructor(payer: Keypair);
static local(): NodeWallet;
static local(): NodeWallet | never;
signTransaction(tx: Transaction): Promise<Transaction>;

@@ -12,0 +12,0 @@ signAllTransactions(txs: Transaction[]): Promise<Transaction[]>;

@@ -14,2 +14,5 @@ "use strict";

const process = require("process");
if (!process.env.ANCHOR_WALLET || process.env.ANCHOR_WALLET === "") {
throw new Error("expected environment variable `ANCHOR_WALLET` is not set.");
}
const payer = web3_js_1.Keypair.fromSecretKey(buffer_1.Buffer.from(JSON.parse(require("fs").readFileSync(process.env.ANCHOR_WALLET, {

@@ -16,0 +19,0 @@ encoding: "utf-8",

@@ -13,6 +13,6 @@ import { PublicKey } from "@solana/web3.js";

static readonly CONST_ACCOUNTS: {
associatedTokenProgram: PublicKey;
rent: PublicKey;
systemProgram: PublicKey;
tokenProgram: PublicKey;
associatedTokenProgram: PublicKey;
rent: PublicKey;
};

@@ -19,0 +19,0 @@ private _accountStore;

@@ -205,6 +205,6 @@ "use strict";

AccountsResolver.CONST_ACCOUNTS = {
associatedTokenProgram: token_js_1.ASSOCIATED_PROGRAM_ID,
rent: web3_js_1.SYSVAR_RENT_PUBKEY,
systemProgram: web3_js_1.SystemProgram.programId,
tokenProgram: token_js_1.TOKEN_PROGRAM_ID,
associatedTokenProgram: token_js_1.ASSOCIATED_PROGRAM_ID,
rent: web3_js_1.SYSVAR_RENT_PUBKEY,
};

@@ -211,0 +211,0 @@ // TODO: this should be configureable to avoid unnecessary requests.

@@ -52,3 +52,3 @@ import { PublicKey } from "@solana/web3.js";

constructor(programId: PublicKey, coder: Coder);
parseLogs(logs: string[], callback: (log: Event) => void): void;
parseLogs(logs: string[]): Generator<Event<IdlEvent, Record<string, never>>, void, unknown>;
private handleLog;

@@ -55,0 +55,0 @@ private handleProgramLog;

@@ -60,3 +60,3 @@ "use strict";

}
this._eventParser.parseLogs(logs.logs, (event) => {
for (const event of this._eventParser.parseLogs(logs.logs)) {
const allListeners = this._eventListeners.get(event.name);

@@ -72,3 +72,3 @@ if (allListeners) {

}
});
}
});

@@ -122,3 +122,3 @@ return listener;

// emit the event if the string matches the event being subscribed to.
parseLogs(logs, callback) {
*parseLogs(logs) {
const logScanner = new LogScanner(logs);

@@ -130,3 +130,3 @@ const execution = new ExecutionContext();

if (event) {
callback(event);
yield event;
}

@@ -133,0 +133,0 @@ if (newProgram) {

@@ -35,3 +35,3 @@ import { PublicKey } from "@solana/web3.js";

* below will refer to the two counter examples found
* [here](https://github.com/project-serum/anchor#examples).
* [here](https://github.com/coral-xyz/anchor#examples).
*/

@@ -69,2 +69,3 @@ export declare class Program<IDL extends Idl = Idl> {

* @deprecated
* Use program.methods.<method>(...args).rpc() instead
*/

@@ -71,0 +72,0 @@ readonly rpc: RpcNamespace<IDL>;

@@ -57,3 +57,3 @@ "use strict";

* below will refer to the two counter examples found
* [here](https://github.com/project-serum/anchor#examples).
* [here](https://github.com/coral-xyz/anchor#examples).
*/

@@ -60,0 +60,0 @@ class Program {

@@ -30,5 +30,7 @@ import { ConfirmOptions, AccountMeta, Signer, Transaction, TransactionInstruction, TransactionSignature, PublicKey } from "@solana/web3.js";

private _accountsResolver;
private _autoResolveAccounts;
constructor(_args: Array<any>, _ixFn: InstructionFn<IDL>, _txFn: TransactionFn<IDL>, _rpcFn: RpcFn<IDL>, _simulateFn: SimulateFn<IDL>, _viewFn: ViewFn<IDL> | undefined, _provider: Provider, _programId: PublicKey, _idlIx: AllInstructions<IDL>, _accountNamespace: AccountNamespace<IDL>);
pubkeys(): Promise<Partial<InstructionAccountAddresses<IDL, I>>>;
accounts(accounts: Partial<Accounts<I["accounts"][number]>>): MethodsBuilder<IDL, I>;
accountsStrict(accounts: Accounts<I["accounts"][number]>): MethodsBuilder<IDL, I>;
signers(signers: Array<Signer>): MethodsBuilder<IDL, I>;

@@ -35,0 +37,0 @@ remainingAccounts(accounts: Array<AccountMeta>): MethodsBuilder<IDL, I>;

@@ -24,12 +24,21 @@ "use strict";

this._postInstructions = [];
this._autoResolveAccounts = true;
this._accountsResolver = new accounts_resolver_js_1.AccountsResolver(_args, this._accounts, _provider, _programId, _idlIx, _accountNamespace);
}
async pubkeys() {
await this._accountsResolver.resolve();
if (this._autoResolveAccounts) {
await this._accountsResolver.resolve();
}
return this._accounts;
}
accounts(accounts) {
this._autoResolveAccounts = true;
Object.assign(this._accounts, accounts);
return this;
}
accountsStrict(accounts) {
this._autoResolveAccounts = false;
Object.assign(this._accounts, accounts);
return this;
}
signers(signers) {

@@ -52,3 +61,5 @@ this._signers = this._signers.concat(signers);

async rpc(options) {
await this._accountsResolver.resolve();
if (this._autoResolveAccounts) {
await this._accountsResolver.resolve();
}
// @ts-ignore

@@ -65,3 +76,5 @@ return this._rpcFn(...this._args, {

async view(options) {
await this._accountsResolver.resolve();
if (this._autoResolveAccounts) {
await this._accountsResolver.resolve();
}
if (!this._viewFn) {

@@ -81,3 +94,5 @@ throw new Error("Method does not support views");

async simulate(options) {
await this._accountsResolver.resolve();
if (this._autoResolveAccounts) {
await this._accountsResolver.resolve();
}
// @ts-ignore

@@ -94,3 +109,5 @@ return this._simulateFn(...this._args, {

async instruction() {
await this._accountsResolver.resolve();
if (this._autoResolveAccounts) {
await this._accountsResolver.resolve();
}
// @ts-ignore

@@ -106,3 +123,5 @@ return this._ixFn(...this._args, {

async transaction() {
await this._accountsResolver.resolve();
if (this._autoResolveAccounts) {
await this._accountsResolver.resolve();
}
// @ts-ignore

@@ -109,0 +128,0 @@ return this._txFn(...this._args, {

@@ -32,5 +32,5 @@ "use strict";

let parser = new event_js_1.EventParser(programId, coder);
parser.parseLogs(logs, (event) => {
for (const event of parser.parseLogs(logs)) {
events.push(event);
});
}
}

@@ -37,0 +37,0 @@ return { events, raw: logs };

import { Program, Provider } from "../index.js";
import { SplAssociatedToken } from "./associated-token.js";
import { SplToken } from "./token.js";

@@ -6,3 +7,4 @@ export { SplToken } from "./token.js";

static token(provider?: Provider): Program<SplToken>;
static associatedToken(provider?: Provider): Program<SplAssociatedToken>;
}
//# sourceMappingURL=index.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Spl = void 0;
const associated_token_js_1 = require("./associated-token.js");
const token_js_1 = require("./token.js");

@@ -9,4 +10,7 @@ class Spl {

}
static associatedToken(provider) {
return (0, associated_token_js_1.program)(provider);
}
}
exports.Spl = Spl;
//# sourceMappingURL=index.js.map

@@ -38,3 +38,3 @@ "use strict";

async function verifiedBuild(connection, programId, limit = 5) {
const url = `https://anchor.projectserum.com/api/v0/program/${programId.toString()}/latest?limit=${limit}`;
const url = `https://api.apr.dev/api/v0/program/${programId.toString()}/latest?limit=${limit}`;
const [programData, latestBuildsResp] = await Promise.all([

@@ -41,0 +41,0 @@ fetchData(connection, programId),

@@ -6,2 +6,3 @@ import { Idl } from "../../idl.js";

import { BorshStateCoder } from "./state.js";
import { BorshTypesCoder } from "./types.js";
import { Coder } from "../index.js";

@@ -16,3 +17,3 @@ export { BorshInstructionCoder } from "./instruction.js";

*/
export declare class BorshCoder<A extends string = string> implements Coder {
export declare class BorshCoder<A extends string = string, T extends string = string> implements Coder {
/**

@@ -34,4 +35,8 @@ * Instruction coder.

readonly events: BorshEventCoder;
/**
* Coder for user-defined types.
*/
readonly types: BorshTypesCoder<T>;
constructor(idl: Idl);
}
//# sourceMappingURL=index.d.ts.map

@@ -5,2 +5,3 @@ import { BorshInstructionCoder } from "./instruction.js";

import { BorshStateCoder } from "./state.js";
import { BorshTypesCoder } from "./types.js";
export { BorshInstructionCoder } from "./instruction.js";

@@ -22,4 +23,5 @@ export { BorshAccountsCoder, ACCOUNT_DISCRIMINATOR_SIZE } from "./accounts.js";

}
this.types = new BorshTypesCoder(idl);
}
}
//# sourceMappingURL=index.js.map

@@ -10,3 +10,3 @@ /// <reference types="node" />

*/
export interface Coder {
export interface Coder<A extends string = string, T extends string = string> {
/**

@@ -19,3 +19,3 @@ * Instruction coder.

*/
readonly accounts: AccountsCoder;
readonly accounts: AccountsCoder<A>;
/**

@@ -29,2 +29,6 @@ * Coder for state structs.

readonly events: EventCoder;
/**
* Coder for user-defined types.
*/
readonly types: TypesCoder<T>;
}

@@ -49,2 +53,6 @@ export interface StateCoder {

}
export interface TypesCoder<N extends string = string> {
encode<T = any>(typeName: N, type: T): Buffer;
decode<T = any>(typeName: N, typeData: Buffer): T;
}
//# sourceMappingURL=index.d.ts.map

@@ -7,2 +7,3 @@ import { Idl } from "../../idl.js";

import { SplTokenEventsCoder } from "./events.js";
import { SplTokenTypesCoder } from "./types.js";
/**

@@ -16,4 +17,5 @@ * Coder for the SPL token program.

readonly events: SplTokenEventsCoder;
readonly types: SplTokenTypesCoder;
constructor(idl: Idl);
}
//# sourceMappingURL=index.d.ts.map

@@ -5,2 +5,3 @@ import { SplTokenInstructionCoder } from "./instruction.js";

import { SplTokenEventsCoder } from "./events.js";
import { SplTokenTypesCoder } from "./types.js";
/**

@@ -15,4 +16,5 @@ * Coder for the SPL token program.

this.state = new SplTokenStateCoder(idl);
this.types = new SplTokenTypesCoder(idl);
}
}
//# sourceMappingURL=index.js.map

@@ -7,2 +7,3 @@ import { Idl } from "../../idl.js";

import { SystemEventsCoder } from "./events.js";
import { SystemTypesCoder } from "./types.js";
/**

@@ -16,4 +17,5 @@ * Coder for the System program.

readonly events: SystemEventsCoder;
readonly types: SystemTypesCoder;
constructor(idl: Idl);
}
//# sourceMappingURL=index.d.ts.map

@@ -5,2 +5,3 @@ import { SystemInstructionCoder } from "./instruction.js";

import { SystemEventsCoder } from "./events.js";
import { SystemTypesCoder } from "./types.js";
/**

@@ -15,4 +16,5 @@ * Coder for the System program.

this.state = new SystemStateCoder(idl);
this.types = new SystemTypesCoder(idl);
}
}
//# sourceMappingURL=index.js.map

@@ -100,2 +100,4 @@ import { PublicKey } from "@solana/web3.js";

AccountSysvarMismatch: number;
AccountReallocExceedsLimit: number;
AccountDuplicateReallocs: number;
StateInvalidAddress: number;

@@ -102,0 +104,0 @@ DeclaredProgramIdMismatch: number;

@@ -279,2 +279,4 @@ import { PublicKey } from "@solana/web3.js";

AccountSysvarMismatch: 3015,
AccountReallocExceedsLimit: 3016,
AccountDuplicateReallocs: 3017,
// State.

@@ -411,2 +413,10 @@ StateInvalidAddress: 4000,

],
[
LangErrorCode.AccountReallocExceedsLimit,
"The account reallocation exceeds the MAX_PERMITTED_DATA_INCREASE limit",
],
[
LangErrorCode.AccountDuplicateReallocs,
"The account was duplicated for more than one reallocation",
],
// State.

@@ -413,0 +423,0 @@ [

@@ -9,3 +9,3 @@ import { Keypair, PublicKey, Transaction } from "@solana/web3.js";

constructor(payer: Keypair);
static local(): NodeWallet;
static local(): NodeWallet | never;
signTransaction(tx: Transaction): Promise<Transaction>;

@@ -12,0 +12,0 @@ signAllTransactions(txs: Transaction[]): Promise<Transaction[]>;

@@ -12,2 +12,5 @@ import { Buffer } from "buffer";

const process = require("process");
if (!process.env.ANCHOR_WALLET || process.env.ANCHOR_WALLET === "") {
throw new Error("expected environment variable `ANCHOR_WALLET` is not set.");
}
const payer = Keypair.fromSecretKey(Buffer.from(JSON.parse(require("fs").readFileSync(process.env.ANCHOR_WALLET, {

@@ -14,0 +17,0 @@ encoding: "utf-8",

@@ -13,6 +13,6 @@ import { PublicKey } from "@solana/web3.js";

static readonly CONST_ACCOUNTS: {
associatedTokenProgram: PublicKey;
rent: PublicKey;
systemProgram: PublicKey;
tokenProgram: PublicKey;
associatedTokenProgram: PublicKey;
rent: PublicKey;
};

@@ -19,0 +19,0 @@ private _accountStore;

@@ -175,6 +175,6 @@ import camelCase from "camelcase";

AccountsResolver.CONST_ACCOUNTS = {
associatedTokenProgram: ASSOCIATED_PROGRAM_ID,
rent: SYSVAR_RENT_PUBKEY,
systemProgram: SystemProgram.programId,
tokenProgram: TOKEN_PROGRAM_ID,
associatedTokenProgram: ASSOCIATED_PROGRAM_ID,
rent: SYSVAR_RENT_PUBKEY,
};

@@ -181,0 +181,0 @@ // TODO: this should be configureable to avoid unnecessary requests.

@@ -52,3 +52,3 @@ import { PublicKey } from "@solana/web3.js";

constructor(programId: PublicKey, coder: Coder);
parseLogs(logs: string[], callback: (log: Event) => void): void;
parseLogs(logs: string[]): Generator<Event<IdlEvent, Record<string, never>>, void, unknown>;
private handleLog;

@@ -55,0 +55,0 @@ private handleProgramLog;

@@ -34,3 +34,3 @@ import * as assert from "assert";

}
this._eventParser.parseLogs(logs.logs, (event) => {
for (const event of this._eventParser.parseLogs(logs.logs)) {
const allListeners = this._eventListeners.get(event.name);

@@ -46,3 +46,3 @@ if (allListeners) {

}
});
}
});

@@ -95,3 +95,3 @@ return listener;

// emit the event if the string matches the event being subscribed to.
parseLogs(logs, callback) {
*parseLogs(logs) {
const logScanner = new LogScanner(logs);

@@ -103,3 +103,3 @@ const execution = new ExecutionContext();

if (event) {
callback(event);
yield event;
}

@@ -106,0 +106,0 @@ if (newProgram) {

@@ -35,3 +35,3 @@ import { PublicKey } from "@solana/web3.js";

* below will refer to the two counter examples found
* [here](https://github.com/project-serum/anchor#examples).
* [here](https://github.com/coral-xyz/anchor#examples).
*/

@@ -69,2 +69,3 @@ export declare class Program<IDL extends Idl = Idl> {

* @deprecated
* Use program.methods.<method>(...args).rpc() instead
*/

@@ -71,0 +72,0 @@ readonly rpc: RpcNamespace<IDL>;

@@ -37,3 +37,3 @@ import { inflate } from "pako";

* below will refer to the two counter examples found
* [here](https://github.com/project-serum/anchor#examples).
* [here](https://github.com/coral-xyz/anchor#examples).
*/

@@ -40,0 +40,0 @@ export class Program {

@@ -30,5 +30,7 @@ import { ConfirmOptions, AccountMeta, Signer, Transaction, TransactionInstruction, TransactionSignature, PublicKey } from "@solana/web3.js";

private _accountsResolver;
private _autoResolveAccounts;
constructor(_args: Array<any>, _ixFn: InstructionFn<IDL>, _txFn: TransactionFn<IDL>, _rpcFn: RpcFn<IDL>, _simulateFn: SimulateFn<IDL>, _viewFn: ViewFn<IDL> | undefined, _provider: Provider, _programId: PublicKey, _idlIx: AllInstructions<IDL>, _accountNamespace: AccountNamespace<IDL>);
pubkeys(): Promise<Partial<InstructionAccountAddresses<IDL, I>>>;
accounts(accounts: Partial<Accounts<I["accounts"][number]>>): MethodsBuilder<IDL, I>;
accountsStrict(accounts: Accounts<I["accounts"][number]>): MethodsBuilder<IDL, I>;
signers(signers: Array<Signer>): MethodsBuilder<IDL, I>;

@@ -35,0 +37,0 @@ remainingAccounts(accounts: Array<AccountMeta>): MethodsBuilder<IDL, I>;

@@ -20,12 +20,21 @@ import { AccountsResolver } from "../accounts-resolver.js";

this._postInstructions = [];
this._autoResolveAccounts = true;
this._accountsResolver = new AccountsResolver(_args, this._accounts, _provider, _programId, _idlIx, _accountNamespace);
}
async pubkeys() {
await this._accountsResolver.resolve();
if (this._autoResolveAccounts) {
await this._accountsResolver.resolve();
}
return this._accounts;
}
accounts(accounts) {
this._autoResolveAccounts = true;
Object.assign(this._accounts, accounts);
return this;
}
accountsStrict(accounts) {
this._autoResolveAccounts = false;
Object.assign(this._accounts, accounts);
return this;
}
signers(signers) {

@@ -48,3 +57,5 @@ this._signers = this._signers.concat(signers);

async rpc(options) {
await this._accountsResolver.resolve();
if (this._autoResolveAccounts) {
await this._accountsResolver.resolve();
}
// @ts-ignore

@@ -61,3 +72,5 @@ return this._rpcFn(...this._args, {

async view(options) {
await this._accountsResolver.resolve();
if (this._autoResolveAccounts) {
await this._accountsResolver.resolve();
}
if (!this._viewFn) {

@@ -77,3 +90,5 @@ throw new Error("Method does not support views");

async simulate(options) {
await this._accountsResolver.resolve();
if (this._autoResolveAccounts) {
await this._accountsResolver.resolve();
}
// @ts-ignore

@@ -90,3 +105,5 @@ return this._simulateFn(...this._args, {

async instruction() {
await this._accountsResolver.resolve();
if (this._autoResolveAccounts) {
await this._accountsResolver.resolve();
}
// @ts-ignore

@@ -102,3 +119,5 @@ return this._ixFn(...this._args, {

async transaction() {
await this._accountsResolver.resolve();
if (this._autoResolveAccounts) {
await this._accountsResolver.resolve();
}
// @ts-ignore

@@ -105,0 +124,0 @@ return this._txFn(...this._args, {

@@ -30,5 +30,5 @@ import { splitArgsAndCtx } from "../context.js";

let parser = new EventParser(programId, coder);
parser.parseLogs(logs, (event) => {
for (const event of parser.parseLogs(logs)) {
events.push(event);
});
}
}

@@ -35,0 +35,0 @@ return { events, raw: logs };

import { Program, Provider } from "../index.js";
import { SplAssociatedToken } from "./associated-token.js";
import { SplToken } from "./token.js";

@@ -6,3 +7,4 @@ export { SplToken } from "./token.js";

static token(provider?: Provider): Program<SplToken>;
static associatedToken(provider?: Provider): Program<SplAssociatedToken>;
}
//# sourceMappingURL=index.d.ts.map

@@ -0,1 +1,2 @@

import { program as associatedTokenProgram, } from "./associated-token.js";
import { program as tokenProgram } from "./token.js";

@@ -6,3 +7,6 @@ export class Spl {

}
static associatedToken(provider) {
return associatedTokenProgram(provider);
}
}
//# sourceMappingURL=index.js.map

@@ -9,3 +9,3 @@ import fetch from "cross-fetch";

export async function verifiedBuild(connection, programId, limit = 5) {
const url = `https://anchor.projectserum.com/api/v0/program/${programId.toString()}/latest?limit=${limit}`;
const url = `https://api.apr.dev/api/v0/program/${programId.toString()}/latest?limit=${limit}`;
const [programData, latestBuildsResp] = await Promise.all([

@@ -12,0 +12,0 @@ fetchData(connection, programId),

{
"name": "@project-serum/anchor",
"version": "0.25.0-beta.1",
"version": "0.25.0",
"description": "Anchor client",

@@ -10,9 +10,9 @@ "module": "./dist/esm/index.js",

"types": "dist/cjs/index.d.ts",
"homepage": "https://github.com/project-serum/anchor#readme",
"homepage": "https://github.com/coral-xyz/anchor#readme",
"bugs": {
"url": "https://github.com/project-serum/anchor/issues"
"url": "https://github.com/coral-xyz/anchor/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/project-serum/anchor.git"
"url": "https://github.com/coral-xyz/anchor.git"
},

@@ -19,0 +19,0 @@ "publishConfig": {

# @project-serum/anchor
[![npm](https://img.shields.io/npm/v/@project-serum/anchor.svg?color=blue)](https://www.npmjs.com/package/@project-serum/anchor)
[![Docs](https://img.shields.io/badge/docs-typedoc-blue)](https://project-serum.github.io/anchor/ts/index.html)
[![Docs](https://img.shields.io/badge/docs-typedoc-blue)](https://coral-xyz.github.io/anchor/ts/index.html)

@@ -6,0 +6,0 @@ TypeScript client for Anchor programs.

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc