@solana/spl-token
Advanced tools
Comparing version 0.1.4 to 0.1.5
@@ -103,4 +103,4 @@ 'use strict'; | ||
static fromBuffer(buffer) { | ||
assert__default['default'](buffer.length === 8, "Invalid buffer length: ".concat(buffer.length)); | ||
return new u64([...buffer].reverse().map(i => "00".concat(i.toString(16)).slice(-2)).join(''), 16); | ||
assert__default['default'](buffer.length === 8, `Invalid buffer length: ${buffer.length}`); | ||
return new u64([...buffer].reverse().map(i => `00${i.toString(16)}`.slice(-2)).join(''), 16); | ||
} | ||
@@ -242,3 +242,3 @@ | ||
static async createMint(connection, payer, mintAuthority, freezeAuthority, decimals, programId) { | ||
const mintAccount = new web3_js.Account(); | ||
const mintAccount = web3_js.Keypair.generate(); | ||
const token = new Token(connection, mintAccount.publicKey, programId, payer); // Allocate memory for the account | ||
@@ -273,3 +273,3 @@ | ||
const balanceNeeded = await Token.getMinBalanceRentForExemptAccount(this.connection); | ||
const newAccount = new web3_js.Account(); | ||
const newAccount = web3_js.Keypair.generate(); | ||
const transaction = new web3_js.Transaction(); | ||
@@ -368,3 +368,3 @@ transaction.add(web3_js.SystemProgram.createAccount({ | ||
const newAccount = new web3_js.Account(); | ||
const newAccount = web3_js.Keypair.generate(); | ||
const transaction = new web3_js.Transaction(); | ||
@@ -404,3 +404,3 @@ transaction.add(web3_js.SystemProgram.createAccount({ | ||
async createMultisig(m, signers) { | ||
const multisigAccount = new web3_js.Account(); // Allocate memory for the account | ||
const multisigAccount = web3_js.Keypair.generate(); // Allocate memory for the account | ||
@@ -460,7 +460,7 @@ const balanceNeeded = await Token.getMinBalanceRentForExemptMultisig(this.connection); | ||
if (!info.owner.equals(this.programId)) { | ||
throw new Error("Invalid mint owner: ".concat(JSON.stringify(info.owner))); | ||
throw new Error(`Invalid mint owner: ${JSON.stringify(info.owner)}`); | ||
} | ||
if (info.data.length != MintLayout.span) { | ||
throw new Error("Invalid mint size"); | ||
throw new Error(`Invalid mint size`); | ||
} | ||
@@ -507,3 +507,3 @@ | ||
if (info.data.length != AccountLayout.span) { | ||
throw new Error("Invalid account size"); | ||
throw new Error(`Invalid account size`); | ||
} | ||
@@ -544,3 +544,3 @@ | ||
if (!accountInfo.mint.equals(this.publicKey)) { | ||
throw new Error("Invalid account mint: ".concat(JSON.stringify(accountInfo.mint), " !== ").concat(JSON.stringify(this.publicKey))); | ||
throw new Error(`Invalid account mint: ${JSON.stringify(accountInfo.mint)} !== ${JSON.stringify(this.publicKey)}`); | ||
} | ||
@@ -565,7 +565,7 @@ | ||
if (!info.owner.equals(this.programId)) { | ||
throw new Error("Invalid multisig owner"); | ||
throw new Error(`Invalid multisig owner`); | ||
} | ||
if (info.data.length != MultisigLayout.span) { | ||
throw new Error("Invalid multisig size"); | ||
throw new Error(`Invalid multisig size`); | ||
} | ||
@@ -1720,3 +1720,3 @@ | ||
if (!web3_js.PublicKey.isOnCurve(owner.toBuffer())) { | ||
throw new Error("Owner cannot sign: ".concat(owner.toString())); | ||
throw new Error(`Owner cannot sign: ${owner.toString()}`); | ||
} | ||
@@ -1723,0 +1723,0 @@ |
@@ -6,6 +6,6 @@ declare module '@solana/spl-token' { | ||
PublicKey, | ||
Signer, | ||
TransactionInstruction, | ||
TransactionSignature, | ||
Connection, | ||
Account, | ||
} from '@solana/web3.js'; | ||
@@ -72,3 +72,3 @@ import BN from 'bn.js'; | ||
associatedProgramId: PublicKey; | ||
payer: Account; | ||
payer: Signer; | ||
constructor( | ||
@@ -78,3 +78,3 @@ connection: Connection, | ||
programId: PublicKey, | ||
payer: Account, | ||
payer: Signer, | ||
); | ||
@@ -98,3 +98,3 @@ static getMinBalanceRentForExemptMint( | ||
connection: Connection, | ||
payer: Account, | ||
payer: Signer, | ||
mintAuthority: PublicKey, | ||
@@ -111,3 +111,3 @@ freezeAuthority: PublicKey | null, | ||
owner: PublicKey, | ||
payer: Account, | ||
payer: Signer, | ||
amount: number, | ||
@@ -123,4 +123,4 @@ ): Promise<PublicKey>; | ||
destination: PublicKey, | ||
owner: Account | PublicKey, | ||
multiSigners: Array<Account>, | ||
owner: Signer | PublicKey, | ||
multiSigners: Array<Signer>, | ||
amount: number | u64, | ||
@@ -131,4 +131,4 @@ ): Promise<TransactionSignature>; | ||
delegate: PublicKey, | ||
owner: Account | PublicKey, | ||
multiSigners: Array<Account>, | ||
owner: Signer | PublicKey, | ||
multiSigners: Array<Signer>, | ||
amount: number | u64, | ||
@@ -138,4 +138,4 @@ ): Promise<void>; | ||
account: PublicKey, | ||
owner: Account | PublicKey, | ||
multiSigners: Array<Account>, | ||
owner: Signer | PublicKey, | ||
multiSigners: Array<Signer>, | ||
): Promise<void>; | ||
@@ -146,9 +146,9 @@ setAuthority( | ||
authorityType: AuthorityType, | ||
currentAuthority: Account | PublicKey, | ||
multiSigners: Array<Account>, | ||
currentAuthority: Signer | PublicKey, | ||
multiSigners: Array<Signer>, | ||
): Promise<void>; | ||
mintTo( | ||
dest: PublicKey, | ||
authority: Account | PublicKey, | ||
multiSigners: Array<Account>, | ||
authority: Signer | PublicKey, | ||
multiSigners: Array<Signer>, | ||
amount: number | u64, | ||
@@ -158,4 +158,4 @@ ): Promise<void>; | ||
account: PublicKey, | ||
owner: Account | PublicKey, | ||
multiSigners: Array<Account>, | ||
owner: Signer | PublicKey, | ||
multiSigners: Array<Signer>, | ||
amount: number | u64, | ||
@@ -166,3 +166,3 @@ ): Promise<void>; | ||
authority: any, | ||
multiSigners: Array<Account>, | ||
multiSigners: Array<Signer>, | ||
): Promise<void>; | ||
@@ -172,3 +172,3 @@ thawAccount( | ||
authority: any, | ||
multiSigners: Array<Account>, | ||
multiSigners: Array<Signer>, | ||
): Promise<void>; | ||
@@ -178,4 +178,4 @@ closeAccount( | ||
dest: PublicKey, | ||
authority: Account | PublicKey, | ||
multiSigners: Array<Account>, | ||
authority: Signer | PublicKey, | ||
multiSigners: Array<Signer>, | ||
): Promise<void>; | ||
@@ -200,3 +200,3 @@ static createInitMintInstruction( | ||
owner: PublicKey, | ||
multiSigners: Array<Account>, | ||
multiSigners: Array<Signer>, | ||
amount: number | u64, | ||
@@ -209,3 +209,3 @@ ): TransactionInstruction; | ||
owner: PublicKey, | ||
multiSigners: Array<Account>, | ||
multiSigners: Array<Signer>, | ||
amount: number | u64, | ||
@@ -217,3 +217,3 @@ ): TransactionInstruction; | ||
owner: PublicKey, | ||
multiSigners: Array<Account>, | ||
multiSigners: Array<Signer>, | ||
): TransactionInstruction; | ||
@@ -226,3 +226,3 @@ static createSetAuthorityInstruction( | ||
authority: PublicKey, | ||
multiSigners: Array<Account>, | ||
multiSigners: Array<Signer>, | ||
): TransactionInstruction; | ||
@@ -234,3 +234,3 @@ static createMintToInstruction( | ||
authority: PublicKey, | ||
multiSigners: Array<Account>, | ||
multiSigners: Array<Signer>, | ||
amount: number | u64, | ||
@@ -243,3 +243,3 @@ ): TransactionInstruction; | ||
owner: PublicKey, | ||
multiSigners: Array<Account>, | ||
multiSigners: Array<Signer>, | ||
amount: number | u64, | ||
@@ -252,3 +252,3 @@ ): TransactionInstruction; | ||
authority: PublicKey, | ||
multiSigners: Array<Account>, | ||
multiSigners: Array<Signer>, | ||
): TransactionInstruction; | ||
@@ -260,3 +260,3 @@ static createFreezeAccountInstruction( | ||
authority: PublicKey, | ||
multiSigners: Array<Account>, | ||
multiSigners: Array<Signer>, | ||
): TransactionInstruction; | ||
@@ -268,3 +268,3 @@ static createThawAccountInstruction( | ||
authority: PublicKey, | ||
multiSigners: Array<Account>, | ||
multiSigners: Array<Signer>, | ||
): TransactionInstruction; | ||
@@ -271,0 +271,0 @@ static createAssociatedTokenAccountInstruction( |
@@ -6,3 +6,3 @@ import _defineProperty from '@babel/runtime/helpers/defineProperty'; | ||
import * as BufferLayout from 'buffer-layout'; | ||
import { sendAndConfirmTransaction as sendAndConfirmTransaction$1, PublicKey, Account, Transaction, SystemProgram, TransactionInstruction, SYSVAR_RENT_PUBKEY } from '@solana/web3.js'; | ||
import { sendAndConfirmTransaction as sendAndConfirmTransaction$1, PublicKey, Keypair, Transaction, SystemProgram, SYSVAR_RENT_PUBKEY, TransactionInstruction } from '@solana/web3.js'; | ||
@@ -73,4 +73,4 @@ // | ||
static fromBuffer(buffer) { | ||
assert(buffer.length === 8, "Invalid buffer length: ".concat(buffer.length)); | ||
return new u64([...buffer].reverse().map(i => "00".concat(i.toString(16)).slice(-2)).join(''), 16); | ||
assert(buffer.length === 8, `Invalid buffer length: ${buffer.length}`); | ||
return new u64([...buffer].reverse().map(i => `00${i.toString(16)}`.slice(-2)).join(''), 16); | ||
} | ||
@@ -212,3 +212,3 @@ | ||
static async createMint(connection, payer, mintAuthority, freezeAuthority, decimals, programId) { | ||
const mintAccount = new Account(); | ||
const mintAccount = Keypair.generate(); | ||
const token = new Token(connection, mintAccount.publicKey, programId, payer); // Allocate memory for the account | ||
@@ -243,3 +243,3 @@ | ||
const balanceNeeded = await Token.getMinBalanceRentForExemptAccount(this.connection); | ||
const newAccount = new Account(); | ||
const newAccount = Keypair.generate(); | ||
const transaction = new Transaction(); | ||
@@ -338,3 +338,3 @@ transaction.add(SystemProgram.createAccount({ | ||
const newAccount = new Account(); | ||
const newAccount = Keypair.generate(); | ||
const transaction = new Transaction(); | ||
@@ -374,3 +374,3 @@ transaction.add(SystemProgram.createAccount({ | ||
async createMultisig(m, signers) { | ||
const multisigAccount = new Account(); // Allocate memory for the account | ||
const multisigAccount = Keypair.generate(); // Allocate memory for the account | ||
@@ -430,7 +430,7 @@ const balanceNeeded = await Token.getMinBalanceRentForExemptMultisig(this.connection); | ||
if (!info.owner.equals(this.programId)) { | ||
throw new Error("Invalid mint owner: ".concat(JSON.stringify(info.owner))); | ||
throw new Error(`Invalid mint owner: ${JSON.stringify(info.owner)}`); | ||
} | ||
if (info.data.length != MintLayout.span) { | ||
throw new Error("Invalid mint size"); | ||
throw new Error(`Invalid mint size`); | ||
} | ||
@@ -477,3 +477,3 @@ | ||
if (info.data.length != AccountLayout.span) { | ||
throw new Error("Invalid account size"); | ||
throw new Error(`Invalid account size`); | ||
} | ||
@@ -514,3 +514,3 @@ | ||
if (!accountInfo.mint.equals(this.publicKey)) { | ||
throw new Error("Invalid account mint: ".concat(JSON.stringify(accountInfo.mint), " !== ").concat(JSON.stringify(this.publicKey))); | ||
throw new Error(`Invalid account mint: ${JSON.stringify(accountInfo.mint)} !== ${JSON.stringify(this.publicKey)}`); | ||
} | ||
@@ -535,7 +535,7 @@ | ||
if (!info.owner.equals(this.programId)) { | ||
throw new Error("Invalid multisig owner"); | ||
throw new Error(`Invalid multisig owner`); | ||
} | ||
if (info.data.length != MultisigLayout.span) { | ||
throw new Error("Invalid multisig size"); | ||
throw new Error(`Invalid multisig size`); | ||
} | ||
@@ -1690,3 +1690,3 @@ | ||
if (!PublicKey.isOnCurve(owner.toBuffer())) { | ||
throw new Error("Owner cannot sign: ".concat(owner.toString())); | ||
throw new Error(`Owner cannot sign: ${owner.toString()}`); | ||
} | ||
@@ -1693,0 +1693,0 @@ |
@@ -10,9 +10,4 @@ /** | ||
import {Layout} from 'buffer-layout'; | ||
import { | ||
Account, | ||
Connection, | ||
PublicKey, | ||
TransactionInstruction, | ||
} from '@solana/web3.js'; | ||
import type {TransactionSignature} from '@solana/web3.js'; | ||
import {Connection, PublicKey, TransactionInstruction} from '@solana/web3.js'; | ||
import type {Signer, TransactionSignature} from '@solana/web3.js'; | ||
@@ -74,3 +69,3 @@ declare module '@solana/spl-token' { | ||
associatedProgramId: PublicKey; | ||
payer: Account; | ||
payer: Signer; | ||
constructor( | ||
@@ -80,3 +75,3 @@ connection: Connection, | ||
programId: PublicKey, | ||
payer: Account, | ||
payer: Signer, | ||
): Token; | ||
@@ -100,3 +95,3 @@ static getMinBalanceRentForExemptMint( | ||
connection: Connection, | ||
payer: Account, | ||
payer: Signer, | ||
mintAuthority: PublicKey, | ||
@@ -113,3 +108,3 @@ freezeAuthority: PublicKey | null, | ||
owner: PublicKey, | ||
payer: Account, | ||
payer: Signer, | ||
amount: number, | ||
@@ -125,4 +120,4 @@ ): Promise<PublicKey>; | ||
destination: PublicKey, | ||
owner: Account | PublicKey, | ||
multiSigners: Array<Account>, | ||
owner: Signer | PublicKey, | ||
multiSigners: Array<Signer>, | ||
amount: number | u64, | ||
@@ -133,4 +128,4 @@ ): Promise<TransactionSignature>; | ||
delegate: PublicKey, | ||
owner: Account | PublicKey, | ||
multiSigners: Array<Account>, | ||
owner: Signer | PublicKey, | ||
multiSigners: Array<Signer>, | ||
amount: number | u64, | ||
@@ -140,4 +135,4 @@ ): Promise<void>; | ||
account: PublicKey, | ||
owner: Account | PublicKey, | ||
multiSigners: Array<Account>, | ||
owner: Signer | PublicKey, | ||
multiSigners: Array<Signer>, | ||
): Promise<void>; | ||
@@ -148,9 +143,9 @@ setAuthority( | ||
authorityType: AuthorityType, | ||
currentAuthority: Account | PublicKey, | ||
multiSigners: Array<Account>, | ||
currentAuthority: Signer | PublicKey, | ||
multiSigners: Array<Signer>, | ||
): Promise<void>; | ||
mintTo( | ||
dest: PublicKey, | ||
authority: Account | PublicKey, | ||
multiSigners: Array<Account>, | ||
authority: Signer | PublicKey, | ||
multiSigners: Array<Signer>, | ||
amount: number | u64, | ||
@@ -160,4 +155,4 @@ ): Promise<void>; | ||
account: PublicKey, | ||
owner: Account | PublicKey, | ||
multiSigners: Array<Account>, | ||
owner: Signer | PublicKey, | ||
multiSigners: Array<Signer>, | ||
amount: number | u64, | ||
@@ -168,3 +163,3 @@ ): Promise<void>; | ||
authority: any, | ||
multiSigners: Array<Account>, | ||
multiSigners: Array<Signer>, | ||
): Promise<void>; | ||
@@ -174,3 +169,3 @@ thawAccount( | ||
authority: any, | ||
multiSigners: Array<Account>, | ||
multiSigners: Array<Signer>, | ||
): Promise<void>; | ||
@@ -180,4 +175,4 @@ closeAccount( | ||
dest: PublicKey, | ||
authority: Account | PublicKey, | ||
multiSigners: Array<Account>, | ||
authority: Signer | PublicKey, | ||
multiSigners: Array<Signer>, | ||
): Promise<void>; | ||
@@ -202,3 +197,3 @@ static createInitMintInstruction( | ||
owner: PublicKey, | ||
multiSigners: Array<Account>, | ||
multiSigners: Array<Signer>, | ||
amount: number | u64, | ||
@@ -211,3 +206,3 @@ ): TransactionInstruction; | ||
owner: PublicKey, | ||
multiSigners: Array<Account>, | ||
multiSigners: Array<Signer>, | ||
amount: number | u64, | ||
@@ -219,3 +214,3 @@ ): TransactionInstruction; | ||
owner: PublicKey, | ||
multiSigners: Array<Account>, | ||
multiSigners: Array<Signer>, | ||
): TransactionInstruction; | ||
@@ -228,3 +223,3 @@ static createSetAuthorityInstruction( | ||
authority: PublicKey, | ||
multiSigners: Array<Account>, | ||
multiSigners: Array<Signer>, | ||
): TransactionInstruction; | ||
@@ -236,3 +231,3 @@ static createMintToInstruction( | ||
authority: PublicKey, | ||
multiSigners: Array<Account>, | ||
multiSigners: Array<Signer>, | ||
amount: number | u64, | ||
@@ -245,3 +240,3 @@ ): TransactionInstruction; | ||
owner: PublicKey, | ||
multiSigners: Array<Account>, | ||
multiSigners: Array<Signer>, | ||
amount: number | u64, | ||
@@ -254,3 +249,3 @@ ): TransactionInstruction; | ||
authority: PublicKey, | ||
multiSigners: Array<Account>, | ||
multiSigners: Array<Signer>, | ||
): TransactionInstruction; | ||
@@ -262,3 +257,3 @@ static createFreezeAccountInstruction( | ||
authority: PublicKey, | ||
multiSigners: Array<Account>, | ||
multiSigners: Array<Signer>, | ||
): TransactionInstruction; | ||
@@ -270,3 +265,3 @@ static createThawAccountInstruction( | ||
authority: PublicKey, | ||
multiSigners: Array<Account>, | ||
multiSigners: Array<Signer>, | ||
): TransactionInstruction; | ||
@@ -273,0 +268,0 @@ static createAssociatedTokenAccountInstruction( |
{ | ||
"name": "@solana/spl-token", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"description": "SPL Token JavaScript API", | ||
@@ -59,7 +59,7 @@ "license": "MIT", | ||
"@babel/runtime": "^7.10.5", | ||
"@solana/web3.js": "^1.9.1", | ||
"@solana/web3.js": "^1.12.0", | ||
"bn.js": "^5.1.0", | ||
"buffer": "6.0.3", | ||
"buffer-layout": "^1.2.0", | ||
"dotenv": "8.2.0" | ||
"dotenv": "10.0.0" | ||
}, | ||
@@ -77,3 +77,3 @@ "devDependencies": { | ||
"@rollup/plugin-babel": "^5.1.0", | ||
"@rollup/plugin-commonjs": "^17.0.0", | ||
"@rollup/plugin-commonjs": "^19.0.0", | ||
"@rollup/plugin-json": "^4.1.0", | ||
@@ -80,0 +80,0 @@ "@rollup/plugin-multi-entry": "^4.0.0", |
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 too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
5243275
31856
0
+ Addeddotenv@10.0.0(transitive)
- Removeddotenv@8.2.0(transitive)
Updated@solana/web3.js@^1.12.0
Updateddotenv@10.0.0