Fix Token program ESM exports (#3508)

* Fix Memo program ESM exports

* fix repository link

* Fix Token program ESM exports

* web3.js is a peer dependency

* memo/ts -> memo/js (same as token)

* add gh-pages dev dep

* add explicit js extensions

* use explicit js imports

* lint fixes for type imports

* fix version

* check in package-lock.json

* check in package-lock.json

* update spl-memo dep

* reorg imports

* move spl-memo to dev deps

* remove editorconfig

* update spl-memo

* update node version in CI

* memo and token use npm now

* use npm ci commands

* reorder imports
This commit is contained in:
Jordan Sexton 2022-08-22 19:07:03 -05:00 committed by GitHub
parent a179eba71e
commit 29d316e811
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
116 changed files with 18380 additions and 3524 deletions

View File

@ -69,6 +69,8 @@ jobs:
node-version: ${{ env.NODE_VERSION }}
- uses: actions/cache@v2
with:
path: ~/.cache/yarn
key: yarn-${{ hashFiles('memo/js/yarn.lock') }}
path: ~/.npm
key: node-${{ hashFiles('memo/js/package-lock.json') }}
restore-keys: |
node-
- run: ./ci/js-test-memo.sh

View File

@ -120,7 +120,7 @@ jobs:
js-test:
runs-on: ubuntu-latest
env:
NODE_VERSION: 14.x
NODE_VERSION: 16.x
needs: cargo-test-sbf
steps:
- uses: actions/checkout@v2
@ -130,8 +130,8 @@ jobs:
node-version: ${{ env.NODE_VERSION }}
- uses: actions/cache@v2
with:
path: ~/.cache/yarn
key: node-${{ hashFiles('token/js/yarn.lock') }}
path: ~/.npm
key: node-${{ hashFiles('token/js/package-lock.json') }}
restore-keys: |
node-
- name: Download programs

View File

@ -7,7 +7,7 @@ source ./ci/solana-version.sh install
set -x
cd memo/js
yarn install --pure-lockfile
yarn lint
yarn build
yarn test
npm install
npm run lint
npm run build
npm test

View File

@ -7,7 +7,7 @@ source ./ci/solana-version.sh install
set -x
cd token/js
yarn install --pure-lockfile
yarn lint
yarn build
yarn test
npm install
npm run lint
npm run build
npm test

View File

@ -1,4 +1,5 @@
node_modules
docs
lib
test-ledger
package-lock.json

20
token/js/.eslintrc Normal file
View File

@ -0,0 +1,20 @@
{
"root": true,
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended"
],
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint",
"prettier"
],
"rules": {
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/consistent-type-imports": "error"
}
}

View File

@ -1,14 +0,0 @@
{
"root": true,
"env": {
"browser": true,
"node": true,
"es6": true
},
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint", "prettier"],
"rules": {
"@typescript-eslint/ban-ts-comment": "off"
}
}

13
token/js/.gitignore vendored
View File

@ -1,2 +1,13 @@
lib
.idea
.vscode
.DS_Store
node_modules
pnpm-lock.yaml
yarn.lock
docs
lib
test-ledger
*.tsbuildinfo

View File

@ -1,3 +1,5 @@
docs
lib
test-ledger
package-lock.json

View File

@ -25,11 +25,20 @@ Please see [upgrading from 0.1.x](#upgrading-from-0.1.x).
## Install
```shell
yarn add @solana/spl-token
npm install --save @solana/spl-token @solana/web3.js
```
_OR_
```shell
yarn add @solana/spl-token @solana/web3.js
```
## Build from Source
0. Prerequisites
* Node 16+
* NPM 8+
1. Clone the project:
```shell
git clone https://github.com/solana-labs/solana-program-library.git
@ -42,27 +51,27 @@ cd solana-program-library/token/js
3. Install the dependencies:
```shell
yarn install
npm install
```
4. Build the library:
```shell
yarn build
npm run build
```
5. Build the on-chain programs:
```shell
yarn test:build-programs
npm run test:build-programs
```
6. Run the tests:
```shell
yarn test
npm run test
```
7. Run the example:
```shell
yarn example
npm run example
```
## Upgrading

17672
token/js/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +1,14 @@
{
"name": "@solana/spl-token",
"version": "0.3.1",
"description": "SPL Token Program JS API",
"version": "0.3.2",
"author": "Solana Maintainers <maintainers@solana.foundation>",
"repository": "https://github.com/solana-labs/solana-program-library",
"license": "Apache-2.0",
"publishConfig": {
"access": "public"
"type": "module",
"sideEffects": false,
"engines": {
"node": ">=16"
},
"files": [
"lib",
@ -13,62 +16,71 @@
"LICENSE",
"README.md"
],
"type": "module",
"sideEffects": false,
"main": "lib/cjs/index.js",
"module": "lib/esm/index.mjs",
"types": "lib/types/index.d.ts",
"publishConfig": {
"access": "public"
},
"main": "./lib/cjs/index.js",
"module": "./lib/esm/index.js",
"types": "./lib/types/index.d.ts",
"exports": {
"import": "./lib/esm/index.mjs",
"require": "./lib/cjs/index.js"
"require": "./lib/cjs/index.js",
"import": "./lib/esm/index.js",
"types": "./lib/types/index.d.ts"
},
"scripts": {
"clean": "shx rm -rf lib",
"build": "yarn clean && tsc -p tsconfig.json; tsc-esm -p tsconfig.json && tsc -p tsconfig.cjs.json",
"postbuild": "echo '{\"type\":\"commonjs\"}' > lib/cjs/package.json && echo '{\"type\":\"module\"}' > lib/esm/package.json",
"deploy": "yarn docs && gh-pages --dist docs --dest token/js --dotfiles",
"nuke": "shx rm -rf node_modules package-lock.json || true",
"reinstall": "npm run nuke && npm install",
"clean": "shx rm -rf lib **/*.tsbuildinfo || true",
"build": "tsc --build --verbose tsconfig.all.json",
"watch": "tsc --build --verbose --watch tsconfig.all.json",
"release": "npm run clean && npm run build",
"fmt": "prettier --write '{*,**/*}.{ts,tsx,js,jsx,json}'",
"lint": "prettier --check '{*,**/*}.{ts,tsx,js,jsx,json}' && eslint --max-warnings 0 .",
"lint:fix": "npm run fmt && eslint --fix .",
"example": "node --experimental-specifier-resolution=node --loader ts-node/esm examples/createMintAndTransferTokens.ts",
"test": "yarn test:unit && yarn test:e2e-built && yarn test:e2e-native && yarn test:e2e-2022",
"test": "npm run test:unit && npm run test:e2e-built && npm run test:e2e-native && npm run test:e2e-2022",
"test:unit": "mocha test/unit",
"test:e2e-built": "start-server-and-test 'solana-test-validator --bpf-program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA ../../target/deploy/spl_token.so --reset --quiet' http://localhost:8899/health 'mocha test/e2e'",
"test:e2e-2022": "TEST_PROGRAM_ID=TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb start-server-and-test 'solana-test-validator --bpf-program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL ../../target/deploy/spl_associated_token_account.so --bpf-program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb ../../target/deploy/spl_token_2022.so --reset --quiet' http://localhost:8899/health 'mocha test/e2e*'",
"test:e2e-native": "start-server-and-test 'solana-test-validator --reset --quiet' http://localhost:8899/health 'mocha test/e2e'",
"test:build-programs": "cargo build-sbf --manifest-path ../program/Cargo.toml && cargo build-sbf --manifest-path ../program-2022/Cargo.toml && cargo build-sbf --manifest-path ../../associated-token-account/program/Cargo.toml",
"docs": "shx rm -rf docs && NODE_OPTIONS=--max_old_space_size=4096 typedoc && shx cp .nojekyll docs/",
"fmt": "prettier --write '{*,**/*}.{js,ts,jsx,tsx,json}'",
"lint": "eslint --max-warnings 0 --ext .ts . && prettier --check '{*,**/*}.{js,ts,jsx,tsx,json}'",
"lint:fix": "eslint --fix --ext .ts . && yarn fmt",
"nuke": "shx rm -rf node_modules yarn.lock"
"deploy": "npm run deploy:docs",
"docs": "shx rm -rf docs && typedoc && shx cp .nojekyll docs/",
"deploy:docs": "npm run docs && gh-pages --dist token/js --dotfiles"
},
"peerDependencies": {
"@solana/web3.js": "^1.20.0"
},
"dependencies": {
"@solana/buffer-layout": "^4.0.0",
"@solana/buffer-layout-utils": "^0.2.0",
"@solana/web3.js": "^1.41.0"
"buffer": "^6.0.3"
},
"devDependencies": {
"@solana/spl-memo": "^0.2.0",
"@solana/spl-memo": "^0.2.1",
"@solana/web3.js": "^1.20.0",
"@types/chai-as-promised": "^7.1.4",
"@types/eslint": "^8.4.0",
"@types/eslint-plugin-prettier": "^3.1.0",
"@types/chai": "^4.3.3",
"@types/mocha": "^9.1.0",
"@types/node": "^16.11.21",
"@types/prettier": "^2.4.3",
"@typescript-eslint/eslint-plugin": "^5.10.0",
"@typescript-eslint/parser": "^5.10.0",
"chai": "^4.3.4",
"@types/node": "^18.7.9",
"@types/node-fetch": "^2.6.2",
"@types/prettier": "^2.7.0",
"@typescript-eslint/eslint-plugin": "^5.34.0",
"@typescript-eslint/parser": "^5.34.0",
"chai": "^4.3.6",
"chai-as-promised": "^7.1.1",
"eslint": "^8.7.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint": "^8.20.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.2.1",
"gh-pages": "^3.2.3",
"mocha": "^9.1.4",
"prettier": "^2.5.1",
"prettier": "^2.7.1",
"process": "^0.11.10",
"shx": "^0.3.4",
"start-server-and-test": "^1.14.0",
"ts-node": "^10.4.0",
"tslib": "^2.3.1",
"typedoc": "^0.22.11",
"typescript": "^4.5.5",
"typescript-esm": "^2.0.0"
"ts-node": "^10.9.1",
"typedoc": "^0.23.10",
"typescript": "^4.7.4"
}
}

View File

@ -1,15 +1,8 @@
import {
ConfirmOptions,
Connection,
PublicKey,
sendAndConfirmTransaction,
Signer,
Transaction,
TransactionSignature,
} from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants';
import { createApproveInstruction } from '../instructions/index';
import { getSigners } from './internal';
import type { ConfirmOptions, Connection, PublicKey, Signer, TransactionSignature } from '@solana/web3.js';
import { sendAndConfirmTransaction, Transaction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants.js';
import { createApproveInstruction } from '../instructions/approve.js';
import { getSigners } from './internal.js';
/**
* Approve a delegate to transfer up to a maximum number of tokens from an account

View File

@ -1,15 +1,8 @@
import {
ConfirmOptions,
Connection,
PublicKey,
sendAndConfirmTransaction,
Signer,
Transaction,
TransactionSignature,
} from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants';
import { createApproveCheckedInstruction } from '../instructions/index';
import { getSigners } from './internal';
import type { ConfirmOptions, Connection, PublicKey, Signer, TransactionSignature } from '@solana/web3.js';
import { sendAndConfirmTransaction, Transaction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants.js';
import { createApproveCheckedInstruction } from '../instructions/approveChecked.js';
import { getSigners } from './internal.js';
/**
* Approve a delegate to transfer up to a maximum number of tokens from an account, asserting the token mint and

View File

@ -1,15 +1,8 @@
import {
ConfirmOptions,
Connection,
PublicKey,
sendAndConfirmTransaction,
Signer,
Transaction,
TransactionSignature,
} from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants';
import { createBurnInstruction } from '../instructions/index';
import { getSigners } from './internal';
import type { ConfirmOptions, Connection, PublicKey, Signer, TransactionSignature } from '@solana/web3.js';
import { sendAndConfirmTransaction, Transaction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants.js';
import { createBurnInstruction } from '../instructions/burn.js';
import { getSigners } from './internal.js';
/**
* Burn tokens from an account

View File

@ -1,15 +1,8 @@
import {
ConfirmOptions,
Connection,
PublicKey,
sendAndConfirmTransaction,
Signer,
Transaction,
TransactionSignature,
} from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants';
import { createBurnCheckedInstruction } from '../instructions/index';
import { getSigners } from './internal';
import type { ConfirmOptions, Connection, PublicKey, Signer, TransactionSignature } from '@solana/web3.js';
import { sendAndConfirmTransaction, Transaction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants.js';
import { createBurnCheckedInstruction } from '../instructions/burnChecked.js';
import { getSigners } from './internal.js';
/**
* Burn tokens from an account, asserting the token mint and decimals

View File

@ -1,15 +1,8 @@
import {
ConfirmOptions,
Connection,
PublicKey,
sendAndConfirmTransaction,
Signer,
Transaction,
TransactionSignature,
} from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants';
import { createCloseAccountInstruction } from '../instructions/index';
import { getSigners } from './internal';
import type { ConfirmOptions, Connection, PublicKey, Signer, TransactionSignature } from '@solana/web3.js';
import { sendAndConfirmTransaction, Transaction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants.js';
import { createCloseAccountInstruction } from '../instructions/closeAccount.js';
import { getSigners } from './internal.js';
/**
* Close a token account

View File

@ -1,18 +1,10 @@
import {
ConfirmOptions,
Connection,
Keypair,
PublicKey,
sendAndConfirmTransaction,
Signer,
SystemProgram,
Transaction,
} from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants';
import { createInitializeAccountInstruction } from '../instructions/index';
import { getMint } from '../state/index';
import { createAssociatedTokenAccount } from './createAssociatedTokenAccount';
import { getAccountLenForMint } from '../extensions/extensionType';
import type { ConfirmOptions, Connection, Keypair, PublicKey, Signer } from '@solana/web3.js';
import { sendAndConfirmTransaction, SystemProgram, Transaction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants.js';
import { getAccountLenForMint } from '../extensions/extensionType.js';
import { createInitializeAccountInstruction } from '../instructions/initializeAccount.js';
import { getMint } from '../state/mint.js';
import { createAssociatedTokenAccount } from './createAssociatedTokenAccount.js';
/**
* Create and initialize a new token account

View File

@ -1,7 +1,8 @@
import { ConfirmOptions, Connection, PublicKey, sendAndConfirmTransaction, Signer, Transaction } from '@solana/web3.js';
import { ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_PROGRAM_ID } from '../constants';
import { createAssociatedTokenAccountInstruction } from '../instructions/index';
import { getAssociatedTokenAddress } from '../state/index';
import type { ConfirmOptions, Connection, PublicKey, Signer } from '@solana/web3.js';
import { sendAndConfirmTransaction, Transaction } from '@solana/web3.js';
import { ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_PROGRAM_ID } from '../constants.js';
import { createAssociatedTokenAccountInstruction } from '../instructions/associatedTokenAccount.js';
import { getAssociatedTokenAddress } from '../state/mint.js';
/**
* Create and initialize a new associated token account

View File

@ -1,16 +1,8 @@
import {
ConfirmOptions,
Connection,
Keypair,
PublicKey,
sendAndConfirmTransaction,
Signer,
SystemProgram,
Transaction,
} from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants';
import { createInitializeMintInstruction } from '../instructions/index';
import { getMinimumBalanceForRentExemptMint, MINT_SIZE } from '../state/index';
import type { ConfirmOptions, Connection, PublicKey, Signer } from '@solana/web3.js';
import { Keypair, sendAndConfirmTransaction, SystemProgram, Transaction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants.js';
import { createInitializeMintInstruction } from '../instructions/initializeMint.js';
import { getMinimumBalanceForRentExemptMint, MINT_SIZE } from '../state/mint.js';
/**
* Create and initialize a new mint

View File

@ -1,16 +1,8 @@
import {
ConfirmOptions,
Connection,
Keypair,
PublicKey,
sendAndConfirmTransaction,
Signer,
SystemProgram,
Transaction,
} from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants';
import { createInitializeMultisigInstruction } from '../instructions/index';
import { getMinimumBalanceForRentExemptMultisig, MULTISIG_SIZE } from '../state/index';
import type { ConfirmOptions, Connection, PublicKey, Signer } from '@solana/web3.js';
import { Keypair, sendAndConfirmTransaction, SystemProgram, Transaction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants.js';
import { createInitializeMultisigInstruction } from '../instructions/initializeMultisig.js';
import { getMinimumBalanceForRentExemptMultisig, MULTISIG_SIZE } from '../state/multisig.js';
/**
* Create and initialize a new multisig

View File

@ -1,6 +1,7 @@
import { ConfirmOptions, Connection, sendAndConfirmTransaction, Signer, Transaction } from '@solana/web3.js';
import { TOKEN_2022_PROGRAM_ID, NATIVE_MINT_2022 } from '../constants';
import { createCreateNativeMintInstruction } from '../instructions/index';
import type { ConfirmOptions, Connection, Signer } from '@solana/web3.js';
import { sendAndConfirmTransaction, Transaction } from '@solana/web3.js';
import { NATIVE_MINT_2022, TOKEN_2022_PROGRAM_ID } from '../constants.js';
import { createCreateNativeMintInstruction } from '../instructions/createNativeMint.js';
/**
* Create native mint

View File

@ -1,21 +1,12 @@
import {
ConfirmOptions,
Connection,
Keypair,
PublicKey,
sendAndConfirmTransaction,
Signer,
SystemProgram,
Transaction,
} from '@solana/web3.js';
import { ASSOCIATED_TOKEN_PROGRAM_ID, NATIVE_MINT, TOKEN_PROGRAM_ID } from '../constants';
import {
createAssociatedTokenAccountInstruction,
createInitializeAccountInstruction,
createSyncNativeInstruction,
} from '../instructions/index';
import { ACCOUNT_SIZE, getAssociatedTokenAddress, getMinimumBalanceForRentExemptAccount } from '../state/index';
import { createAccount } from './createAccount';
import type { ConfirmOptions, Connection, Keypair, PublicKey, Signer } from '@solana/web3.js';
import { sendAndConfirmTransaction, SystemProgram, Transaction } from '@solana/web3.js';
import { ASSOCIATED_TOKEN_PROGRAM_ID, NATIVE_MINT, TOKEN_PROGRAM_ID } from '../constants.js';
import { createAssociatedTokenAccountInstruction } from '../instructions/associatedTokenAccount.js';
import { createInitializeAccountInstruction } from '../instructions/initializeAccount.js';
import { createSyncNativeInstruction } from '../instructions/syncNative.js';
import { ACCOUNT_SIZE, getMinimumBalanceForRentExemptAccount } from '../state/account.js';
import { getAssociatedTokenAddress } from '../state/mint.js';
import { createAccount } from './createAccount.js';
/**
* Create, initialize, and fund a new wrapped native SOL account

View File

@ -1,15 +1,8 @@
import {
ConfirmOptions,
Connection,
PublicKey,
sendAndConfirmTransaction,
Signer,
Transaction,
TransactionSignature,
} from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants';
import { createFreezeAccountInstruction } from '../instructions/index';
import { getSigners } from './internal';
import type { ConfirmOptions, Connection, PublicKey, Signer, TransactionSignature } from '@solana/web3.js';
import { sendAndConfirmTransaction, Transaction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants.js';
import { createFreezeAccountInstruction } from '../instructions/freezeAccount.js';
import { getSigners } from './internal.js';
/**
* Freeze a token account

View File

@ -1,21 +1,16 @@
import {
Commitment,
ConfirmOptions,
Connection,
PublicKey,
sendAndConfirmTransaction,
Signer,
Transaction,
} from '@solana/web3.js';
import { ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_PROGRAM_ID } from '../constants';
import type { Commitment, ConfirmOptions, Connection, PublicKey, Signer } from '@solana/web3.js';
import { sendAndConfirmTransaction, Transaction } from '@solana/web3.js';
import { ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_PROGRAM_ID } from '../constants.js';
import {
TokenAccountNotFoundError,
TokenInvalidAccountOwnerError,
TokenInvalidMintError,
TokenInvalidOwnerError,
} from '../errors';
import { createAssociatedTokenAccountInstruction } from '../instructions/index';
import { Account, getAccount, getAssociatedTokenAddress } from '../state/index';
} from '../errors.js';
import { createAssociatedTokenAccountInstruction } from '../instructions/associatedTokenAccount.js';
import type { Account } from '../state/account.js';
import { getAccount } from '../state/account.js';
import { getAssociatedTokenAddress } from '../state/mint.js';
/**
* Retrieve the associated token account, or create it if it doesn't exist

View File

@ -1,22 +1,22 @@
export * from './createMint';
export * from './createNativeMint';
export * from './createAccount';
export * from './createWrappedNativeAccount';
export * from './createMultisig';
export * from './transfer';
export * from './approve';
export * from './revoke';
export * from './setAuthority';
export * from './mintTo';
export * from './burn';
export * from './closeAccount';
export * from './freezeAccount';
export * from './thawAccount';
export * from './transferChecked';
export * from './approveChecked';
export * from './mintToChecked';
export * from './burnChecked';
export * from './syncNative';
export * from './createMint.js';
export * from './createNativeMint.js';
export * from './createAccount.js';
export * from './createWrappedNativeAccount.js';
export * from './createMultisig.js';
export * from './transfer.js';
export * from './approve.js';
export * from './revoke.js';
export * from './setAuthority.js';
export * from './mintTo.js';
export * from './burn.js';
export * from './closeAccount.js';
export * from './freezeAccount.js';
export * from './thawAccount.js';
export * from './transferChecked.js';
export * from './approveChecked.js';
export * from './mintToChecked.js';
export * from './burnChecked.js';
export * from './syncNative.js';
export * from './createAssociatedTokenAccount';
export * from './getOrCreateAssociatedTokenAccount';
export * from './createAssociatedTokenAccount.js';
export * from './getOrCreateAssociatedTokenAccount.js';

View File

@ -1,4 +1,5 @@
import { PublicKey, Signer } from '@solana/web3.js';
import type { Signer } from '@solana/web3.js';
import { PublicKey } from '@solana/web3.js';
/** @internal */
export function getSigners(signerOrMultisig: Signer | PublicKey, multiSigners: Signer[]): [PublicKey, Signer[]] {

View File

@ -1,15 +1,8 @@
import {
ConfirmOptions,
Connection,
PublicKey,
sendAndConfirmTransaction,
Signer,
Transaction,
TransactionSignature,
} from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants';
import { createMintToInstruction } from '../instructions/index';
import { getSigners } from './internal';
import type { ConfirmOptions, Connection, PublicKey, Signer, TransactionSignature } from '@solana/web3.js';
import { sendAndConfirmTransaction, Transaction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants.js';
import { createMintToInstruction } from '../instructions/mintTo.js';
import { getSigners } from './internal.js';
/**
* Mint tokens to an account

View File

@ -1,15 +1,8 @@
import {
ConfirmOptions,
Connection,
PublicKey,
sendAndConfirmTransaction,
Signer,
Transaction,
TransactionSignature,
} from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants';
import { createMintToCheckedInstruction } from '../instructions/index';
import { getSigners } from './internal';
import type { ConfirmOptions, Connection, PublicKey, Signer, TransactionSignature } from '@solana/web3.js';
import { sendAndConfirmTransaction, Transaction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants.js';
import { createMintToCheckedInstruction } from '../instructions/mintToChecked.js';
import { getSigners } from './internal.js';
/**
* Mint tokens to an account, asserting the token mint and decimals

View File

@ -1,15 +1,8 @@
import {
ConfirmOptions,
Connection,
PublicKey,
sendAndConfirmTransaction,
Signer,
Transaction,
TransactionSignature,
} from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants';
import { createRevokeInstruction } from '../instructions/index';
import { getSigners } from './internal';
import type { ConfirmOptions, Connection, PublicKey, Signer, TransactionSignature } from '@solana/web3.js';
import { sendAndConfirmTransaction, Transaction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants.js';
import { createRevokeInstruction } from '../instructions/revoke.js';
import { getSigners } from './internal.js';
/**
* Revoke approval for the transfer of tokens from an account

View File

@ -1,15 +1,9 @@
import {
ConfirmOptions,
Connection,
PublicKey,
sendAndConfirmTransaction,
Signer,
Transaction,
TransactionSignature,
} from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants';
import { AuthorityType, createSetAuthorityInstruction } from '../instructions/index';
import { getSigners } from './internal';
import type { ConfirmOptions, Connection, PublicKey, Signer, TransactionSignature } from '@solana/web3.js';
import { sendAndConfirmTransaction, Transaction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants.js';
import type { AuthorityType } from '../instructions/setAuthority.js';
import { createSetAuthorityInstruction } from '../instructions/setAuthority.js';
import { getSigners } from './internal.js';
/**
* Assign a new authority to the account

View File

@ -1,14 +1,7 @@
import {
ConfirmOptions,
Connection,
PublicKey,
sendAndConfirmTransaction,
Signer,
Transaction,
TransactionSignature,
} from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants';
import { createSyncNativeInstruction } from '../instructions/index';
import type { ConfirmOptions, Connection, PublicKey, Signer, TransactionSignature } from '@solana/web3.js';
import { sendAndConfirmTransaction, Transaction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants.js';
import { createSyncNativeInstruction } from '../instructions/syncNative.js';
/**
* Sync the balance of a native SPL token account to the underlying system account's lamports

View File

@ -1,15 +1,8 @@
import {
ConfirmOptions,
Connection,
PublicKey,
sendAndConfirmTransaction,
Signer,
Transaction,
TransactionSignature,
} from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants';
import { createThawAccountInstruction } from '../instructions/index';
import { getSigners } from './internal';
import type { ConfirmOptions, Connection, PublicKey, Signer, TransactionSignature } from '@solana/web3.js';
import { sendAndConfirmTransaction, Transaction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants.js';
import { createThawAccountInstruction } from '../instructions/thawAccount.js';
import { getSigners } from './internal.js';
/**
* Thaw (unfreeze) a token account

View File

@ -1,15 +1,8 @@
import {
ConfirmOptions,
Connection,
PublicKey,
sendAndConfirmTransaction,
Signer,
Transaction,
TransactionSignature,
} from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants';
import { createTransferInstruction } from '../instructions/index';
import { getSigners } from './internal';
import type { ConfirmOptions, Connection, PublicKey, Signer, TransactionSignature } from '@solana/web3.js';
import { sendAndConfirmTransaction, Transaction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants.js';
import { createTransferInstruction } from '../instructions/transfer.js';
import { getSigners } from './internal.js';
/**
* Transfer tokens from one account to another

View File

@ -1,15 +1,8 @@
import {
ConfirmOptions,
Connection,
PublicKey,
sendAndConfirmTransaction,
Signer,
Transaction,
TransactionSignature,
} from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants';
import { createTransferCheckedInstruction } from '../instructions/index';
import { getSigners } from './internal';
import type { ConfirmOptions, Connection, PublicKey, Signer, TransactionSignature } from '@solana/web3.js';
import { sendAndConfirmTransaction, Transaction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants.js';
import { createTransferCheckedInstruction } from '../instructions/transferChecked.js';
import { getSigners } from './internal.js';
/**
* Transfer tokens from one account to another, asserting the token mint and decimals

View File

@ -1,19 +1,12 @@
import {
ConfirmOptions,
Connection,
PublicKey,
sendAndConfirmTransaction,
Signer,
Transaction,
TransactionSignature,
} from '@solana/web3.js';
import { TOKEN_2022_PROGRAM_ID } from '../../constants';
import { AccountState } from '../../state';
import type { ConfirmOptions, Connection, PublicKey, Signer, TransactionSignature } from '@solana/web3.js';
import { sendAndConfirmTransaction, Transaction } from '@solana/web3.js';
import { getSigners } from '../../actions/internal.js';
import { TOKEN_2022_PROGRAM_ID } from '../../constants.js';
import type { AccountState } from '../../state/account.js';
import {
createInitializeDefaultAccountStateInstruction,
createUpdateDefaultAccountStateInstruction,
} from './instructions';
import { getSigners } from '../../actions/internal';
} from './instructions.js';
/**
* Initialize a default account state on a mint

View File

@ -1,3 +1,3 @@
export * from './actions';
export * from './instructions';
export * from './state';
export * from './actions.js';
export * from './instructions.js';
export * from './state.js';

View File

@ -1,9 +1,10 @@
import { struct, u8 } from '@solana/buffer-layout';
import { PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
import { AccountState } from '../../state/account';
import { TokenInstruction } from '../../instructions/types';
import { programSupportsExtensions, TOKEN_2022_PROGRAM_ID } from '../../constants';
import { TokenUnsupportedInstructionError } from '../../errors';
import type { PublicKey, Signer } from '@solana/web3.js';
import { TransactionInstruction } from '@solana/web3.js';
import { programSupportsExtensions, TOKEN_2022_PROGRAM_ID } from '../../constants.js';
import { TokenUnsupportedInstructionError } from '../../errors.js';
import { TokenInstruction } from '../../instructions/types.js';
import type { AccountState } from '../../state/account.js';
export enum DefaultAccountStateInstruction {
Initialize = 0,

View File

@ -1,7 +1,7 @@
import { struct, u8 } from '@solana/buffer-layout';
import { AccountState } from '../../state';
import { Mint } from '../../state';
import { ExtensionType, getExtensionData } from '../extensionType';
import type { AccountState } from '../../state/account.js';
import type { Mint } from '../../state/mint.js';
import { ExtensionType, getExtensionData } from '../extensionType.js';
/** DefaultAccountState as stored by the program */
export interface DefaultAccountState {

View File

@ -1,14 +1,15 @@
import { ACCOUNT_SIZE } from '../state/account';
import { Mint, MINT_SIZE } from '../state/mint';
import { MULTISIG_SIZE } from '../state/multisig';
import { ACCOUNT_TYPE_SIZE } from './accountType';
import { MEMO_TRANSFER_SIZE } from './memoTransfer';
import { DEFAULT_ACCOUNT_STATE_SIZE } from './defaultAccountState';
import { MINT_CLOSE_AUTHORITY_SIZE } from './mintCloseAuthority';
import { IMMUTABLE_OWNER_SIZE } from './immutableOwner';
import { TRANSFER_FEE_CONFIG_SIZE, TRANSFER_FEE_AMOUNT_SIZE } from './transferFee';
import { NON_TRANSFERABLE_SIZE } from './nonTransferable';
import { INTEREST_BEARING_MINT_CONFIG_STATE_SIZE } from './interestBearingMint/state';
import { ACCOUNT_SIZE } from '../state/account.js';
import type { Mint } from '../state/mint.js';
import { MINT_SIZE } from '../state/mint.js';
import { MULTISIG_SIZE } from '../state/multisig.js';
import { ACCOUNT_TYPE_SIZE } from './accountType.js';
import { DEFAULT_ACCOUNT_STATE_SIZE } from './defaultAccountState/index.js';
import { IMMUTABLE_OWNER_SIZE } from './immutableOwner.js';
import { INTEREST_BEARING_MINT_CONFIG_STATE_SIZE } from './interestBearingMint/state.js';
import { MEMO_TRANSFER_SIZE } from './memoTransfer/index.js';
import { MINT_CLOSE_AUTHORITY_SIZE } from './mintCloseAuthority.js';
import { NON_TRANSFERABLE_SIZE } from './nonTransferable.js';
import { TRANSFER_FEE_AMOUNT_SIZE, TRANSFER_FEE_CONFIG_SIZE } from './transferFee/index.js';
export enum ExtensionType {
Uninitialized,

View File

@ -1,6 +1,6 @@
import { struct } from '@solana/buffer-layout';
import { Account } from '../state/account';
import { ExtensionType, getExtensionData } from './extensionType';
import type { Account } from '../state/account.js';
import { ExtensionType, getExtensionData } from './extensionType.js';
/** ImmutableOwner as stored by the program */
export interface ImmutableOwner {} // eslint-disable-line

View File

@ -1,9 +1,9 @@
export * from './accountType';
export * from './defaultAccountState/index';
export * from './extensionType';
export * from './memoTransfer/index';
export * from './mintCloseAuthority';
export * from './immutableOwner';
export * from './interestBearingMint';
export * from './nonTransferable';
export * from './transferFee/index';
export * from './accountType.js';
export * from './defaultAccountState/index.js';
export * from './extensionType.js';
export * from './memoTransfer/index.js';
export * from './mintCloseAuthority.js';
export * from './immutableOwner.js';
export * from './interestBearingMint/index.js';
export * from './nonTransferable.js';
export * from './transferFee/index.js';

View File

@ -1,21 +1,13 @@
import {
ConfirmOptions,
Connection,
Keypair,
PublicKey,
sendAndConfirmTransaction,
Signer,
SystemProgram,
Transaction,
} from '@solana/web3.js';
import { getSigners } from '../../actions/internal';
import { TOKEN_2022_PROGRAM_ID } from '../../constants';
import { createInitializeMintInstruction } from '../../instructions';
import { ExtensionType, getMintLen } from '../extensionType';
import type { ConfirmOptions, Connection, PublicKey, Signer } from '@solana/web3.js';
import { Keypair, sendAndConfirmTransaction, SystemProgram, Transaction } from '@solana/web3.js';
import { getSigners } from '../../actions/internal.js';
import { TOKEN_2022_PROGRAM_ID } from '../../constants.js';
import { createInitializeMintInstruction } from '../../instructions/initializeMint.js';
import { ExtensionType, getMintLen } from '../extensionType.js';
import {
createInitializeInterestBearingMintInstruction,
createUpdateRateInterestBearingMintInstruction,
} from './instructions';
} from './instructions.js';
/**
* Initialize an interest bearing account on a mint

View File

@ -1,3 +1,3 @@
export * from './actions';
export * from './instructions';
export * from './state';
export * from './actions.js';
export * from './instructions.js';
export * from './state.js';

View File

@ -1,9 +1,10 @@
import { struct, s16, u8 } from '@solana/buffer-layout';
import { s16, struct, u8 } from '@solana/buffer-layout';
import { publicKey } from '@solana/buffer-layout-utils';
import { PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
import { TOKEN_2022_PROGRAM_ID } from '../../constants';
import { TokenInstruction } from '../../instructions';
import { addSigners } from '../../instructions/internal';
import type { PublicKey, Signer } from '@solana/web3.js';
import { TransactionInstruction } from '@solana/web3.js';
import { TOKEN_2022_PROGRAM_ID } from '../../constants.js';
import { addSigners } from '../../instructions/internal.js';
import { TokenInstruction } from '../../instructions/types.js';
export enum InterestBearingMintInstruction {
Initialize = 0,

View File

@ -1,14 +1,14 @@
import { s16, ns64, struct } from '@solana/buffer-layout';
import { ns64, s16, struct } from '@solana/buffer-layout';
import { publicKey } from '@solana/buffer-layout-utils';
import { PublicKey } from '@solana/web3.js';
import { Mint } from '../../state';
import { ExtensionType, getExtensionData } from '../extensionType';
import type { PublicKey } from '@solana/web3.js';
import type { Mint } from '../../state/mint.js';
import { ExtensionType, getExtensionData } from '../extensionType.js';
export interface InterestBearingMintConfigState {
rateAuthority: PublicKey;
initializationTimestamp: BigInt;
initializationTimestamp: bigint;
preUpdateAverageRate: number;
lastUpdateTimestamp: BigInt;
lastUpdateTimestamp: bigint;
currentRate: number;
}

View File

@ -1,18 +1,11 @@
import type { ConfirmOptions, Connection, PublicKey, Signer, TransactionSignature } from '@solana/web3.js';
import { sendAndConfirmTransaction, Transaction } from '@solana/web3.js';
import { getSigners } from '../../actions/internal.js';
import { TOKEN_2022_PROGRAM_ID } from '../../constants.js';
import {
ConfirmOptions,
Connection,
PublicKey,
sendAndConfirmTransaction,
Signer,
Transaction,
TransactionSignature,
} from '@solana/web3.js';
import { TOKEN_2022_PROGRAM_ID } from '../../constants';
import {
createEnableRequiredMemoTransfersInstruction,
createDisableRequiredMemoTransfersInstruction,
} from './instructions';
import { getSigners } from '../../actions/internal';
createEnableRequiredMemoTransfersInstruction,
} from './instructions.js';
/**
* Enable memo transfers on the given account

View File

@ -1,3 +1,3 @@
export * from './actions';
export * from './instructions';
export * from './state';
export * from './actions.js';
export * from './instructions.js';
export * from './state.js';

View File

@ -1,8 +1,9 @@
import { struct, u8 } from '@solana/buffer-layout';
import { PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
import { TokenInstruction } from '../../instructions/types';
import { programSupportsExtensions, TOKEN_2022_PROGRAM_ID } from '../../constants';
import { TokenUnsupportedInstructionError } from '../../errors';
import type { PublicKey, Signer } from '@solana/web3.js';
import { TransactionInstruction } from '@solana/web3.js';
import { programSupportsExtensions, TOKEN_2022_PROGRAM_ID } from '../../constants.js';
import { TokenUnsupportedInstructionError } from '../../errors.js';
import { TokenInstruction } from '../../instructions/types.js';
export enum MemoTransferInstruction {
Enable = 0,

View File

@ -1,7 +1,7 @@
import { struct } from '@solana/buffer-layout';
import { bool } from '@solana/buffer-layout-utils';
import { Account } from '../../state';
import { ExtensionType, getExtensionData } from '../extensionType';
import type { Account } from '../../state/account.js';
import { ExtensionType, getExtensionData } from '../extensionType.js';
/** MemoTransfer as stored by the program */
export interface MemoTransfer {

View File

@ -1,8 +1,8 @@
import { struct } from '@solana/buffer-layout';
import { publicKey } from '@solana/buffer-layout-utils';
import { PublicKey } from '@solana/web3.js';
import { Mint } from '../state/mint';
import { ExtensionType, getExtensionData } from './extensionType';
import type { PublicKey } from '@solana/web3.js';
import type { Mint } from '../state/mint.js';
import { ExtensionType, getExtensionData } from './extensionType.js';
/** MintCloseAuthority as stored by the program */
export interface MintCloseAuthority {

View File

@ -1,6 +1,6 @@
import { struct } from '@solana/buffer-layout';
import { Mint } from '../state/mint';
import { ExtensionType, getExtensionData } from './extensionType';
import type { Mint } from '../state/mint.js';
import { ExtensionType, getExtensionData } from './extensionType.js';
/** Non-transferable state as stored by the program */
export interface NonTransferable {} // eslint-disable-line

View File

@ -1,20 +1,13 @@
import type { ConfirmOptions, Connection, PublicKey, Signer, TransactionSignature } from '@solana/web3.js';
import { sendAndConfirmTransaction, Transaction } from '@solana/web3.js';
import { getSigners } from '../../actions/internal.js';
import { TOKEN_2022_PROGRAM_ID } from '../../constants.js';
import {
ConfirmOptions,
Connection,
PublicKey,
sendAndConfirmTransaction,
Signer,
Transaction,
TransactionSignature,
} from '@solana/web3.js';
import { TOKEN_2022_PROGRAM_ID } from '../../constants';
import {
createTransferCheckedWithFeeInstruction,
createHarvestWithheldTokensToMintInstruction,
createTransferCheckedWithFeeInstruction,
createWithdrawWithheldTokensFromAccountsInstruction,
createWithdrawWithheldTokensFromMintInstruction,
} from './instructions';
import { getSigners } from '../../actions/internal';
} from './instructions.js';
/**
* Transfer tokens from one account to another, asserting the transfer fee, token mint, and decimals

View File

@ -1,3 +1,3 @@
export * from './actions';
export * from './instructions';
export * from './state';
export * from './actions.js';
export * from './instructions.js';
export * from './state.js';

View File

@ -1,15 +1,16 @@
import { struct, u8, u16 } from '@solana/buffer-layout';
import { struct, u16, u8 } from '@solana/buffer-layout';
import { publicKey, u64 } from '@solana/buffer-layout-utils';
import { AccountMeta, PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
import type { AccountMeta, Signer } from '@solana/web3.js';
import { PublicKey, TransactionInstruction } from '@solana/web3.js';
import { programSupportsExtensions, TOKEN_2022_PROGRAM_ID } from '../../constants.js';
import {
TokenUnsupportedInstructionError,
TokenInvalidInstructionDataError,
TokenInvalidInstructionKeysError,
TokenInvalidInstructionProgramError,
TokenInvalidInstructionTypeError,
} from '../../errors';
import { TokenInstruction } from '../../instructions/types';
import { programSupportsExtensions, TOKEN_2022_PROGRAM_ID } from '../../constants';
TokenUnsupportedInstructionError,
} from '../../errors.js';
import { TokenInstruction } from '../../instructions/types.js';
export enum TransferFeeInstruction {
InitializeTransferFeeConfig = 0,
@ -31,7 +32,7 @@ export interface InitializeTransferFeeConfigInstructionData {
withdrawWithheldAuthorityOption: 1 | 0;
withdrawWithheldAuthority: PublicKey;
transferFeeBasisPoints: number;
maximumFee: BigInt;
maximumFee: bigint;
}
/** TODO: docs */
@ -63,7 +64,7 @@ export function createInitializeTransferFeeConfigInstruction(
transferFeeConfigAuthority: PublicKey | null,
withdrawWithheldAuthority: PublicKey | null,
transferFeeBasisPoints: number,
maximumFee: BigInt,
maximumFee: bigint,
programId = TOKEN_2022_PROGRAM_ID
): TransactionInstruction {
if (!programSupportsExtensions(programId)) {
@ -101,7 +102,7 @@ export interface DecodedInitializeTransferFeeConfigInstruction {
transferFeeConfigAuthority: PublicKey | null;
withdrawWithheldAuthority: PublicKey | null;
transferFeeBasisPoints: number;
maximumFee: BigInt;
maximumFee: bigint;
};
}
@ -153,7 +154,7 @@ export interface DecodedInitializeTransferFeeConfigInstructionUnchecked {
transferFeeConfigAuthority: PublicKey | null;
withdrawWithheldAuthority: PublicKey | null;
transferFeeBasisPoints: number;
maximumFee: BigInt;
maximumFee: bigint;
};
}
@ -200,9 +201,9 @@ export function decodeInitializeTransferFeeConfigInstructionUnchecked({
export interface TransferCheckedWithFeeInstructionData {
instruction: TokenInstruction.TransferFeeExtension;
transferFeeInstruction: TransferFeeInstruction.TransferCheckedWithFee;
amount: BigInt;
amount: bigint;
decimals: number;
fee: BigInt;
fee: bigint;
}
export const transferCheckedWithFeeInstructionData = struct<TransferCheckedWithFeeInstructionData>([
@ -233,9 +234,9 @@ export function createTransferCheckedWithFeeInstruction(
mint: PublicKey,
destination: PublicKey,
authority: PublicKey,
amount: BigInt,
amount: bigint,
decimals: number,
fee: BigInt,
fee: bigint,
multiSigners: Signer[] = [],
programId = TOKEN_2022_PROGRAM_ID
): TransactionInstruction {
@ -277,9 +278,9 @@ export interface DecodedTransferCheckedWithFeeInstruction {
data: {
instruction: TokenInstruction.TransferFeeExtension;
transferFeeInstruction: TransferFeeInstruction.TransferCheckedWithFee;
amount: BigInt;
amount: bigint;
decimals: number;
fee: BigInt;
fee: bigint;
};
}
@ -336,9 +337,9 @@ export interface DecodedTransferCheckedWithFeeInstructionUnchecked {
data: {
instruction: TokenInstruction.TransferFeeExtension;
transferFeeInstruction: TransferFeeInstruction.TransferCheckedWithFee;
amount: BigInt;
amount: bigint;
decimals: number;
fee: BigInt;
fee: bigint;
};
}

View File

@ -1,19 +1,20 @@
import { struct, u16, Layout } from '@solana/buffer-layout';
import type { Layout } from '@solana/buffer-layout';
import { struct, u16 } from '@solana/buffer-layout';
import { publicKey, u64 } from '@solana/buffer-layout-utils';
import { PublicKey } from '@solana/web3.js';
import { Account } from '../../state';
import { Mint } from '../../state/mint';
import { ExtensionType, getExtensionData } from '../extensionType';
import type { PublicKey } from '@solana/web3.js';
import type { Account } from '../../state/account.js';
import type { Mint } from '../../state/mint.js';
import { ExtensionType, getExtensionData } from '../extensionType.js';
export const MAX_FEE_BASIS_POINTS = 10_000;
export const ONE_IN_BASIS_POINTS: BigInt = MAX_FEE_BASIS_POINTS as unknown as BigInt;
export const ONE_IN_BASIS_POINTS: bigint = MAX_FEE_BASIS_POINTS as unknown as bigint;
/** TransferFeeConfig as stored by the program */
export interface TransferFee {
/** First epoch where the transfer fee takes effect */
epoch: BigInt;
epoch: bigint;
/** Maximum fee assessed on transfers, expressed as an amount of tokens */
maximumFee: BigInt;
maximumFee: bigint;
/**
* Amount of transfer collected as fees, expressed as basis points of the
* transfer amount, ie. increments of 0.01%
@ -28,7 +29,7 @@ export interface TransferFeeConfig {
/** Withdraw from mint instructions must be signed by this key */
withdrawWithheldAuthority: PublicKey;
/** Withheld transfer fee tokens that have been moved to the mint for withdrawal */
withheldAmount: BigInt;
withheldAmount: bigint;
/** Older transfer fee, used if the current epoch < newerTransferFee.epoch */
olderTransferFee: TransferFee;
/** Newer transfer fee, used if the current epoch >= newerTransferFee.epoch */
@ -54,7 +55,7 @@ export const TRANSFER_FEE_CONFIG_SIZE = TransferFeeConfigLayout.span;
/** Transfer fee amount data for accounts. */
export interface TransferFeeAmount {
/** Withheld transfer fee tokens that can be claimed by the fee authority */
withheldAmount: BigInt;
withheldAmount: bigint;
}
/** Buffer layout for de/serializing */
export const TransferFeeAmountLayout = struct<TransferFeeAmount>([u64('withheldAmount')]);

View File

@ -1,6 +1,6 @@
export * from './extensions/index';
export * from './instructions/index';
export * from './state/index';
export * from './actions/index';
export * from './constants';
export * from './errors';
export * from './extensions/index.js';
export * from './instructions/index.js';
export * from './state/index.js';
export * from './actions/index.js';
export * from './constants.js';
export * from './errors.js';

View File

@ -1,15 +1,16 @@
import { struct, u8 } from '@solana/buffer-layout';
import { u64 } from '@solana/buffer-layout-utils';
import { AccountMeta, PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants';
import type { AccountMeta, PublicKey, Signer } from '@solana/web3.js';
import { TransactionInstruction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants.js';
import {
TokenInvalidInstructionDataError,
TokenInvalidInstructionKeysError,
TokenInvalidInstructionProgramError,
TokenInvalidInstructionTypeError,
} from '../errors';
import { addSigners } from './internal';
import { TokenInstruction } from './types';
} from '../errors.js';
import { addSigners } from './internal.js';
import { TokenInstruction } from './types.js';
/** TODO: docs */
export interface ApproveInstructionData {

View File

@ -1,15 +1,16 @@
import { struct, u8 } from '@solana/buffer-layout';
import { u64 } from '@solana/buffer-layout-utils';
import { AccountMeta, PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants';
import type { AccountMeta, PublicKey, Signer } from '@solana/web3.js';
import { TransactionInstruction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants.js';
import {
TokenInvalidInstructionDataError,
TokenInvalidInstructionKeysError,
TokenInvalidInstructionProgramError,
TokenInvalidInstructionTypeError,
} from '../errors';
import { addSigners } from './internal';
import { TokenInstruction } from './types';
} from '../errors.js';
import { addSigners } from './internal.js';
import { TokenInstruction } from './types.js';
/** TODO: docs */
export interface ApproveCheckedInstructionData {

View File

@ -1,5 +1,6 @@
import { PublicKey, SystemProgram, SYSVAR_RENT_PUBKEY, TransactionInstruction } from '@solana/web3.js';
import { ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_PROGRAM_ID } from '../constants';
import type { PublicKey } from '@solana/web3.js';
import { SystemProgram, SYSVAR_RENT_PUBKEY, TransactionInstruction } from '@solana/web3.js';
import { ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_PROGRAM_ID } from '../constants.js';
/**
* Construct an AssociatedTokenAccount instruction

View File

@ -1,15 +1,16 @@
import { struct, u8 } from '@solana/buffer-layout';
import { u64 } from '@solana/buffer-layout-utils';
import { AccountMeta, PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants';
import type { AccountMeta, PublicKey, Signer } from '@solana/web3.js';
import { TransactionInstruction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants.js';
import {
TokenInvalidInstructionDataError,
TokenInvalidInstructionKeysError,
TokenInvalidInstructionProgramError,
TokenInvalidInstructionTypeError,
} from '../errors';
import { addSigners } from './internal';
import { TokenInstruction } from './types';
} from '../errors.js';
import { addSigners } from './internal.js';
import { TokenInstruction } from './types.js';
/** TODO: docs */
export interface BurnInstructionData {

View File

@ -1,15 +1,16 @@
import { struct, u8 } from '@solana/buffer-layout';
import { u64 } from '@solana/buffer-layout-utils';
import { AccountMeta, PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants';
import type { AccountMeta, PublicKey, Signer } from '@solana/web3.js';
import { TransactionInstruction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants.js';
import {
TokenInvalidInstructionDataError,
TokenInvalidInstructionKeysError,
TokenInvalidInstructionProgramError,
TokenInvalidInstructionTypeError,
} from '../errors';
import { addSigners } from './internal';
import { TokenInstruction } from './types';
} from '../errors.js';
import { addSigners } from './internal.js';
import { TokenInstruction } from './types.js';
/** TODO: docs */
export interface BurnCheckedInstructionData {

View File

@ -1,14 +1,15 @@
import { struct, u8 } from '@solana/buffer-layout';
import { AccountMeta, PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants';
import type { AccountMeta, PublicKey, Signer } from '@solana/web3.js';
import { TransactionInstruction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants.js';
import {
TokenInvalidInstructionDataError,
TokenInvalidInstructionKeysError,
TokenInvalidInstructionProgramError,
TokenInvalidInstructionTypeError,
} from '../errors';
import { addSigners } from './internal';
import { TokenInstruction } from './types';
} from '../errors.js';
import { addSigners } from './internal.js';
import { TokenInstruction } from './types.js';
/** TODO: docs */
export interface CloseAccountInstructionData {

View File

@ -1,9 +1,9 @@
import { struct, u8 } from '@solana/buffer-layout';
import { PublicKey, TransactionInstruction, SystemProgram } from '@solana/web3.js';
import { TOKEN_2022_PROGRAM_ID, NATIVE_MINT_2022 } from '../constants';
import { TokenInstruction } from './types';
import { TokenUnsupportedInstructionError } from '../errors';
import { programSupportsExtensions } from '../constants';
import type { PublicKey } from '@solana/web3.js';
import { SystemProgram, TransactionInstruction } from '@solana/web3.js';
import { NATIVE_MINT_2022, programSupportsExtensions, TOKEN_2022_PROGRAM_ID } from '../constants.js';
import { TokenUnsupportedInstructionError } from '../errors.js';
import { TokenInstruction } from './types.js';
/** TODO: docs */
export interface CreateNativeMintInstructionData {

View File

@ -1,27 +1,46 @@
import { u8 } from '@solana/buffer-layout';
import { TransactionInstruction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants';
import { TokenInvalidInstructionDataError, TokenInvalidInstructionTypeError } from '../errors';
import { decodeApproveInstruction, DecodedApproveInstruction } from './approve';
import { decodeApproveCheckedInstruction, DecodedApproveCheckedInstruction } from './approveChecked';
import { decodeBurnInstruction, DecodedBurnInstruction } from './burn';
import { decodeBurnCheckedInstruction, DecodedBurnCheckedInstruction } from './burnChecked';
import { decodeCloseAccountInstruction, DecodedCloseAccountInstruction } from './closeAccount';
import { DecodedFreezeAccountInstruction, decodeFreezeAccountInstruction } from './freezeAccount';
import { DecodedInitializeAccountInstruction, decodeInitializeAccountInstruction } from './initializeAccount';
import { DecodedInitializeAccount2Instruction, decodeInitializeAccount2Instruction } from './initializeAccount2';
import { DecodedInitializeAccount3Instruction, decodeInitializeAccount3Instruction } from './initializeAccount3';
import { DecodedInitializeMintInstruction, decodeInitializeMintInstruction } from './initializeMint';
import { DecodedInitializeMultisigInstruction, decodeInitializeMultisigInstruction } from './initializeMultisig';
import { DecodedMintToInstruction, decodeMintToInstruction } from './mintTo';
import { DecodedMintToCheckedInstruction, decodeMintToCheckedInstruction } from './mintToChecked';
import { DecodedRevokeInstruction, decodeRevokeInstruction } from './revoke';
import { DecodedSetAuthorityInstruction, decodeSetAuthorityInstruction } from './setAuthority';
import { DecodedSyncNativeInstruction, decodeSyncNativeInstruction } from './syncNative';
import { DecodedThawAccountInstruction, decodeThawAccountInstruction } from './thawAccount';
import { DecodedTransferInstruction, decodeTransferInstruction } from './transfer';
import { DecodedTransferCheckedInstruction, decodeTransferCheckedInstruction } from './transferChecked';
import { TokenInstruction } from './types';
import type { TransactionInstruction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants.js';
import { TokenInvalidInstructionDataError, TokenInvalidInstructionTypeError } from '../errors.js';
import type { DecodedApproveInstruction } from './approve.js';
import { decodeApproveInstruction } from './approve.js';
import type { DecodedApproveCheckedInstruction } from './approveChecked.js';
import { decodeApproveCheckedInstruction } from './approveChecked.js';
import type { DecodedBurnInstruction } from './burn.js';
import { decodeBurnInstruction } from './burn.js';
import type { DecodedBurnCheckedInstruction } from './burnChecked.js';
import { decodeBurnCheckedInstruction } from './burnChecked.js';
import type { DecodedCloseAccountInstruction } from './closeAccount.js';
import { decodeCloseAccountInstruction } from './closeAccount.js';
import type { DecodedFreezeAccountInstruction } from './freezeAccount.js';
import { decodeFreezeAccountInstruction } from './freezeAccount.js';
import type { DecodedInitializeAccountInstruction } from './initializeAccount.js';
import { decodeInitializeAccountInstruction } from './initializeAccount.js';
import type { DecodedInitializeAccount2Instruction } from './initializeAccount2.js';
import { decodeInitializeAccount2Instruction } from './initializeAccount2.js';
import type { DecodedInitializeAccount3Instruction } from './initializeAccount3.js';
import { decodeInitializeAccount3Instruction } from './initializeAccount3.js';
import type { DecodedInitializeMintInstruction } from './initializeMint.js';
import { decodeInitializeMintInstruction } from './initializeMint.js';
import type { DecodedInitializeMultisigInstruction } from './initializeMultisig.js';
import { decodeInitializeMultisigInstruction } from './initializeMultisig.js';
import type { DecodedMintToInstruction } from './mintTo.js';
import { decodeMintToInstruction } from './mintTo.js';
import type { DecodedMintToCheckedInstruction } from './mintToChecked.js';
import { decodeMintToCheckedInstruction } from './mintToChecked.js';
import type { DecodedRevokeInstruction } from './revoke.js';
import { decodeRevokeInstruction } from './revoke.js';
import type { DecodedSetAuthorityInstruction } from './setAuthority.js';
import { decodeSetAuthorityInstruction } from './setAuthority.js';
import type { DecodedSyncNativeInstruction } from './syncNative.js';
import { decodeSyncNativeInstruction } from './syncNative.js';
import type { DecodedThawAccountInstruction } from './thawAccount.js';
import { decodeThawAccountInstruction } from './thawAccount.js';
import type { DecodedTransferInstruction } from './transfer.js';
import { decodeTransferInstruction } from './transfer.js';
import type { DecodedTransferCheckedInstruction } from './transferChecked.js';
import { decodeTransferCheckedInstruction } from './transferChecked.js';
import { TokenInstruction } from './types.js';
/** TODO: docs */
export type DecodedInstruction =

View File

@ -1,14 +1,15 @@
import { struct, u8 } from '@solana/buffer-layout';
import { AccountMeta, PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants';
import type { AccountMeta, PublicKey, Signer } from '@solana/web3.js';
import { TransactionInstruction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants.js';
import {
TokenInvalidInstructionDataError,
TokenInvalidInstructionKeysError,
TokenInvalidInstructionProgramError,
TokenInvalidInstructionTypeError,
} from '../errors';
import { addSigners } from './internal';
import { TokenInstruction } from './types';
} from '../errors.js';
import { addSigners } from './internal.js';
import { TokenInstruction } from './types.js';
/** TODO: docs */
export interface FreezeAccountInstructionData {

View File

@ -1,32 +1,30 @@
export * from './types';
export * from './associatedTokenAccount.js';
export * from './decode.js';
export * from './types.js';
export * from './initializeMint'; // 0
export * from './initializeAccount'; // 1
export * from './initializeMultisig'; // 2
export * from './transfer'; // 3
export * from './approve'; // 4
export * from './revoke'; // 5
export * from './setAuthority'; // 6
export * from './mintTo'; // 7
export * from './burn'; // 8
export * from './closeAccount'; // 9
export * from './freezeAccount'; // 10
export * from './thawAccount'; // 11
export * from './transferChecked'; // 12
export * from './approveChecked'; // 13
export * from './mintToChecked'; // 14
export * from './burnChecked'; // 15
export * from './initializeAccount2'; // 16
export * from './syncNative'; // 17
export * from './initializeAccount3'; // 18
export * from './initializeMultisig2'; // 19
export * from './initializeMint2'; // 20
export * from './initializeImmutableOwner'; // 22
export * from './initializeMintCloseAuthority'; // 23
export * from './reallocate'; // 29
export * from './createNativeMint'; // 31
export * from './initializeNonTransferableMint'; // 32
export * from './decode';
export * from './associatedTokenAccount';
export * from './initializeMint.js'; // 0
export * from './initializeAccount.js'; // 1
export * from './initializeMultisig.js'; // 2
export * from './transfer.js'; // 3
export * from './approve.js'; // 4
export * from './revoke.js'; // 5
export * from './setAuthority.js'; // 6
export * from './mintTo.js'; // 7
export * from './burn.js'; // 8
export * from './closeAccount.js'; // 9
export * from './freezeAccount.js'; // 10
export * from './thawAccount.js'; // 11
export * from './transferChecked.js'; // 12
export * from './approveChecked.js'; // 13
export * from './mintToChecked.js'; // 14
export * from './burnChecked.js'; // 15
export * from './initializeAccount2.js'; // 16
export * from './syncNative.js'; // 17
export * from './initializeAccount3.js'; // 18
export * from './initializeMultisig2.js'; // 19
export * from './initializeMint2.js'; // 20
export * from './initializeImmutableOwner.js'; // 22
export * from './initializeMintCloseAuthority.js'; // 23
export * from './reallocate.js'; // 29
export * from './createNativeMint.js'; // 31
export * from './initializeNonTransferableMint.js'; // 32

View File

@ -1,13 +1,14 @@
import { struct, u8 } from '@solana/buffer-layout';
import { AccountMeta, PublicKey, SYSVAR_RENT_PUBKEY, TransactionInstruction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants';
import type { AccountMeta, PublicKey } from '@solana/web3.js';
import { SYSVAR_RENT_PUBKEY, TransactionInstruction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants.js';
import {
TokenInvalidInstructionDataError,
TokenInvalidInstructionKeysError,
TokenInvalidInstructionProgramError,
TokenInvalidInstructionTypeError,
} from '../errors';
import { TokenInstruction } from './types';
} from '../errors.js';
import { TokenInstruction } from './types.js';
/** TODO: docs */
export interface InitializeAccountInstructionData {

View File

@ -1,14 +1,15 @@
import { TokenInstruction } from './types';
import { struct, u8 } from '@solana/buffer-layout';
import { publicKey } from '@solana/buffer-layout-utils';
import { AccountMeta, PublicKey, SYSVAR_RENT_PUBKEY, TransactionInstruction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants';
import type { AccountMeta, PublicKey } from '@solana/web3.js';
import { SYSVAR_RENT_PUBKEY, TransactionInstruction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants.js';
import {
TokenInvalidInstructionDataError,
TokenInvalidInstructionKeysError,
TokenInvalidInstructionProgramError,
TokenInvalidInstructionTypeError,
} from '../errors';
} from '../errors.js';
import { TokenInstruction } from './types.js';
export interface InitializeAccount2InstructionData {
instruction: TokenInstruction.InitializeAccount2;

View File

@ -1,14 +1,15 @@
import { TokenInstruction } from './types';
import { struct, u8 } from '@solana/buffer-layout';
import { publicKey } from '@solana/buffer-layout-utils';
import { AccountMeta, PublicKey, TransactionInstruction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants';
import type { AccountMeta, PublicKey } from '@solana/web3.js';
import { TransactionInstruction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants.js';
import {
TokenInvalidInstructionDataError,
TokenInvalidInstructionKeysError,
TokenInvalidInstructionProgramError,
TokenInvalidInstructionTypeError,
} from '../errors';
} from '../errors.js';
import { TokenInstruction } from './types.js';
export interface InitializeAccount3InstructionData {
instruction: TokenInstruction.InitializeAccount3;

View File

@ -1,12 +1,13 @@
import { struct, u8 } from '@solana/buffer-layout';
import { AccountMeta, PublicKey, TransactionInstruction } from '@solana/web3.js';
import type { AccountMeta, PublicKey } from '@solana/web3.js';
import { TransactionInstruction } from '@solana/web3.js';
import {
TokenInvalidInstructionDataError,
TokenInvalidInstructionKeysError,
TokenInvalidInstructionProgramError,
TokenInvalidInstructionTypeError,
} from '../errors';
import { TokenInstruction } from './types';
} from '../errors.js';
import { TokenInstruction } from './types.js';
/** Deserialized instruction for the initiation of an immutable owner account */
export interface InitializeImmutableOwnerInstructionData {

View File

@ -1,14 +1,15 @@
import { struct, u8 } from '@solana/buffer-layout';
import { publicKey } from '@solana/buffer-layout-utils';
import { AccountMeta, PublicKey, SYSVAR_RENT_PUBKEY, TransactionInstruction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants';
import type { AccountMeta } from '@solana/web3.js';
import { PublicKey, SYSVAR_RENT_PUBKEY, TransactionInstruction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants.js';
import {
TokenInvalidInstructionDataError,
TokenInvalidInstructionKeysError,
TokenInvalidInstructionProgramError,
TokenInvalidInstructionTypeError,
} from '../errors';
import { TokenInstruction } from './types';
} from '../errors.js';
import { TokenInstruction } from './types.js';
/** TODO: docs */
export interface InitializeMintInstructionData {

View File

@ -1,15 +1,16 @@
import { struct, u8 } from '@solana/buffer-layout';
import { publicKey } from '@solana/buffer-layout-utils';
import { AccountMeta, PublicKey, TransactionInstruction } from '@solana/web3.js';
import type { AccountMeta } from '@solana/web3.js';
import { PublicKey, TransactionInstruction } from '@solana/web3.js';
import { programSupportsExtensions } from '../constants.js';
import {
TokenUnsupportedInstructionError,
TokenInvalidInstructionDataError,
TokenInvalidInstructionKeysError,
TokenInvalidInstructionProgramError,
TokenInvalidInstructionTypeError,
} from '../errors';
import { TokenInstruction } from './types';
import { programSupportsExtensions } from '../constants';
TokenUnsupportedInstructionError,
} from '../errors.js';
import { TokenInstruction } from './types.js';
/** TODO: docs */
export interface InitializeMintCloseAuthorityInstructionData {

View File

@ -1,13 +1,14 @@
import { struct, u8 } from '@solana/buffer-layout';
import { AccountMeta, PublicKey, SYSVAR_RENT_PUBKEY, TransactionInstruction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants';
import type { AccountMeta, PublicKey } from '@solana/web3.js';
import { SYSVAR_RENT_PUBKEY, TransactionInstruction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants.js';
import {
TokenInvalidInstructionDataError,
TokenInvalidInstructionKeysError,
TokenInvalidInstructionProgramError,
TokenInvalidInstructionTypeError,
} from '../errors';
import { TokenInstruction } from './types';
} from '../errors.js';
import { TokenInstruction } from './types.js';
/** TODO: docs */
export interface InitializeMultisigInstructionData {

View File

@ -1,8 +1,9 @@
import { struct, u8 } from '@solana/buffer-layout';
import { PublicKey, TransactionInstruction } from '@solana/web3.js';
import { TokenInstruction } from './types';
import { TokenUnsupportedInstructionError } from '../errors';
import { programSupportsExtensions } from '../constants';
import type { PublicKey } from '@solana/web3.js';
import { TransactionInstruction } from '@solana/web3.js';
import { programSupportsExtensions } from '../constants.js';
import { TokenUnsupportedInstructionError } from '../errors.js';
import { TokenInstruction } from './types.js';
/** Deserialized instruction for the initiation of an immutable owner account */
export interface InitializeNonTransferableMintInstructionData {

View File

@ -1,4 +1,4 @@
import { AccountMeta, PublicKey, Signer } from '@solana/web3.js';
import type { AccountMeta, PublicKey, Signer } from '@solana/web3.js';
/** @internal */
export function addSigners(keys: AccountMeta[], ownerOrAuthority: PublicKey, multiSigners: Signer[]): AccountMeta[] {

View File

@ -1,15 +1,16 @@
import { struct, u8 } from '@solana/buffer-layout';
import { u64 } from '@solana/buffer-layout-utils';
import { AccountMeta, PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants';
import type { AccountMeta, PublicKey, Signer } from '@solana/web3.js';
import { TransactionInstruction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants.js';
import {
TokenInvalidInstructionDataError,
TokenInvalidInstructionKeysError,
TokenInvalidInstructionProgramError,
TokenInvalidInstructionTypeError,
} from '../errors';
import { addSigners } from './internal';
import { TokenInstruction } from './types';
} from '../errors.js';
import { addSigners } from './internal.js';
import { TokenInstruction } from './types.js';
/** TODO: docs */
export interface MintToInstructionData {

View File

@ -1,15 +1,16 @@
import { struct, u8 } from '@solana/buffer-layout';
import { u64 } from '@solana/buffer-layout-utils';
import { AccountMeta, PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants';
import type { AccountMeta, PublicKey, Signer } from '@solana/web3.js';
import { TransactionInstruction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants.js';
import {
TokenInvalidInstructionDataError,
TokenInvalidInstructionKeysError,
TokenInvalidInstructionProgramError,
TokenInvalidInstructionTypeError,
} from '../errors';
import { addSigners } from './internal';
import { TokenInstruction } from './types';
} from '../errors.js';
import { addSigners } from './internal.js';
import { TokenInstruction } from './types.js';
/** TODO: docs */
export interface MintToCheckedInstructionData {

View File

@ -1,10 +1,11 @@
import { seq, struct, u8, u16 } from '@solana/buffer-layout';
import { PublicKey, Signer, SystemProgram, TransactionInstruction } from '@solana/web3.js';
import { programSupportsExtensions, TOKEN_2022_PROGRAM_ID } from '../constants';
import { TokenUnsupportedInstructionError } from '../errors';
import { addSigners } from './internal';
import { TokenInstruction } from './types';
import { ExtensionType } from '../extensions';
import { seq, struct, u16, u8 } from '@solana/buffer-layout';
import type { PublicKey, Signer } from '@solana/web3.js';
import { SystemProgram, TransactionInstruction } from '@solana/web3.js';
import { programSupportsExtensions, TOKEN_2022_PROGRAM_ID } from '../constants.js';
import { TokenUnsupportedInstructionError } from '../errors.js';
import type { ExtensionType } from '../extensions/extensionType.js';
import { addSigners } from './internal.js';
import { TokenInstruction } from './types.js';
/** TODO: docs */
export interface ReallocateInstructionData {

View File

@ -1,14 +1,15 @@
import { struct, u8 } from '@solana/buffer-layout';
import { AccountMeta, PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants';
import type { AccountMeta, PublicKey, Signer } from '@solana/web3.js';
import { TransactionInstruction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants.js';
import {
TokenInvalidInstructionDataError,
TokenInvalidInstructionKeysError,
TokenInvalidInstructionProgramError,
TokenInvalidInstructionTypeError,
} from '../errors';
import { addSigners } from './internal';
import { TokenInstruction } from './types';
} from '../errors.js';
import { addSigners } from './internal.js';
import { TokenInstruction } from './types.js';
/** TODO: docs */
export interface RevokeInstructionData {

View File

@ -1,15 +1,16 @@
import { struct, u8 } from '@solana/buffer-layout';
import { publicKey } from '@solana/buffer-layout-utils';
import { AccountMeta, PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants';
import type { AccountMeta, Signer } from '@solana/web3.js';
import { PublicKey, TransactionInstruction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants.js';
import {
TokenInvalidInstructionDataError,
TokenInvalidInstructionKeysError,
TokenInvalidInstructionProgramError,
TokenInvalidInstructionTypeError,
} from '../errors';
import { addSigners } from './internal';
import { TokenInstruction } from './types';
} from '../errors.js';
import { addSigners } from './internal.js';
import { TokenInstruction } from './types.js';
/** Authority types defined by the program */
export enum AuthorityType {

View File

@ -1,13 +1,14 @@
import { struct, u8 } from '@solana/buffer-layout';
import { AccountMeta, PublicKey, TransactionInstruction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants';
import type { AccountMeta, PublicKey } from '@solana/web3.js';
import { TransactionInstruction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants.js';
import {
TokenInvalidInstructionDataError,
TokenInvalidInstructionKeysError,
TokenInvalidInstructionProgramError,
TokenInvalidInstructionTypeError,
} from '../errors';
import { TokenInstruction } from './types';
} from '../errors.js';
import { TokenInstruction } from './types.js';
/** TODO: docs */
export interface SyncNativeInstructionData {

View File

@ -1,14 +1,15 @@
import { struct, u8 } from '@solana/buffer-layout';
import { AccountMeta, PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants';
import type { AccountMeta, PublicKey, Signer } from '@solana/web3.js';
import { TransactionInstruction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants.js';
import {
TokenInvalidInstructionDataError,
TokenInvalidInstructionKeysError,
TokenInvalidInstructionProgramError,
TokenInvalidInstructionTypeError,
} from '../errors';
import { addSigners } from './internal';
import { TokenInstruction } from './types';
} from '../errors.js';
import { addSigners } from './internal.js';
import { TokenInstruction } from './types.js';
/** TODO: docs */
export interface ThawAccountInstructionData {

View File

@ -1,15 +1,16 @@
import { struct, u8 } from '@solana/buffer-layout';
import { u64 } from '@solana/buffer-layout-utils';
import { AccountMeta, PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants';
import type { AccountMeta, PublicKey, Signer } from '@solana/web3.js';
import { TransactionInstruction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants.js';
import {
TokenInvalidInstructionDataError,
TokenInvalidInstructionKeysError,
TokenInvalidInstructionProgramError,
TokenInvalidInstructionTypeError,
} from '../errors';
import { addSigners } from './internal';
import { TokenInstruction } from './types';
} from '../errors.js';
import { addSigners } from './internal.js';
import { TokenInstruction } from './types.js';
/** TODO: docs */
export interface TransferInstructionData {

View File

@ -1,15 +1,16 @@
import { struct, u8 } from '@solana/buffer-layout';
import { u64 } from '@solana/buffer-layout-utils';
import { AccountMeta, PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants';
import type { AccountMeta, PublicKey, Signer } from '@solana/web3.js';
import { TransactionInstruction } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants.js';
import {
TokenInvalidInstructionDataError,
TokenInvalidInstructionKeysError,
TokenInvalidInstructionProgramError,
TokenInvalidInstructionTypeError,
} from '../errors';
import { addSigners } from './internal';
import { TokenInstruction } from './types';
} from '../errors.js';
import { addSigners } from './internal.js';
import { TokenInstruction } from './types.js';
/** TODO: docs */
export interface TransferCheckedInstructionData {

View File

@ -1,16 +1,17 @@
import { struct, u32, u8 } from '@solana/buffer-layout';
import { publicKey, u64 } from '@solana/buffer-layout-utils';
import { Commitment, Connection, PublicKey, AccountInfo } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants';
import type { AccountInfo, Commitment, Connection, PublicKey } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants.js';
import {
TokenAccountNotFoundError,
TokenInvalidAccountError,
TokenInvalidAccountOwnerError,
TokenInvalidAccountSizeError,
} from '../errors';
import { MULTISIG_SIZE } from './multisig';
import { AccountType, ACCOUNT_TYPE_SIZE } from '../extensions/accountType';
import { ExtensionType, getAccountLen } from '../extensions/extensionType';
} from '../errors.js';
import { ACCOUNT_TYPE_SIZE, AccountType } from '../extensions/accountType.js';
import type { ExtensionType } from '../extensions/extensionType.js';
import { getAccountLen } from '../extensions/extensionType.js';
import { MULTISIG_SIZE } from './multisig.js';
/** Information about a token account */
export interface Account {

View File

@ -1,3 +1,3 @@
export * from './account';
export * from './mint';
export * from './multisig';
export * from './account.js';
export * from './mint.js';
export * from './multisig.js';

View File

@ -1,18 +1,20 @@
import { struct, u32, u8 } from '@solana/buffer-layout';
import { bool, publicKey, u64 } from '@solana/buffer-layout-utils';
import { AccountInfo, Commitment, Connection, PublicKey } from '@solana/web3.js';
import { ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_PROGRAM_ID } from '../constants';
import type { AccountInfo, Commitment, Connection } from '@solana/web3.js';
import { PublicKey } from '@solana/web3.js';
import { ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_PROGRAM_ID } from '../constants.js';
import {
TokenAccountNotFoundError,
TokenInvalidAccountOwnerError,
TokenInvalidAccountSizeError,
TokenInvalidMintError,
TokenOwnerOffCurveError,
} from '../errors';
import { ACCOUNT_SIZE } from './account';
import { MULTISIG_SIZE } from './multisig';
import { AccountType, ACCOUNT_TYPE_SIZE } from '../extensions/accountType';
import { ExtensionType, getMintLen } from '../extensions/extensionType';
} from '../errors.js';
import { ACCOUNT_TYPE_SIZE, AccountType } from '../extensions/accountType.js';
import type { ExtensionType } from '../extensions/extensionType.js';
import { getMintLen } from '../extensions/extensionType.js';
import { ACCOUNT_SIZE } from './account.js';
import { MULTISIG_SIZE } from './multisig.js';
/** Information about a mint */
export interface Mint {

View File

@ -1,8 +1,8 @@
import { struct, u8 } from '@solana/buffer-layout';
import { bool, publicKey } from '@solana/buffer-layout-utils';
import { AccountInfo, Commitment, Connection, PublicKey } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants';
import { TokenAccountNotFoundError, TokenInvalidAccountOwnerError, TokenInvalidAccountSizeError } from '../errors';
import type { AccountInfo, Commitment, Connection, PublicKey } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants.js';
import { TokenAccountNotFoundError, TokenInvalidAccountOwnerError, TokenInvalidAccountSizeError } from '../errors.js';
/** Information about a multisig */
export interface Multisig {

View File

@ -1,4 +1,5 @@
import { PublicKey, Keypair, Connection, Signer } from '@solana/web3.js';
import type { Signer } from '@solana/web3.js';
import { PublicKey, Keypair, Connection } from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../src';
export async function newAccountWithLamports(connection: Connection, lamports = 1000000): Promise<Signer> {

View File

@ -2,15 +2,8 @@ import chai, { expect } from 'chai';
import chaiAsPromised from 'chai-as-promised';
chai.use(chaiAsPromised);
import {
sendAndConfirmTransaction,
Connection,
Keypair,
PublicKey,
Signer,
SystemProgram,
Transaction,
} from '@solana/web3.js';
import type { Connection, PublicKey, Signer } from '@solana/web3.js';
import { sendAndConfirmTransaction, Keypair, SystemProgram, Transaction } from '@solana/web3.js';
import {
createAccount,
createInitializeMintInstruction,

View File

@ -2,15 +2,8 @@ import chai, { expect } from 'chai';
import chaiAsPromised from 'chai-as-promised';
chai.use(chaiAsPromised);
import {
sendAndConfirmTransaction,
Connection,
Keypair,
PublicKey,
Signer,
SystemProgram,
Transaction,
} from '@solana/web3.js';
import type { Connection, PublicKey, Signer } from '@solana/web3.js';
import { sendAndConfirmTransaction, Keypair, SystemProgram, Transaction } from '@solana/web3.js';
import {
AccountState,
createAccount,

View File

@ -2,15 +2,8 @@ import chai, { expect } from 'chai';
import chaiAsPromised from 'chai-as-promised';
chai.use(chaiAsPromised);
import {
Connection,
Keypair,
PublicKey,
Signer,
SystemProgram,
Transaction,
sendAndConfirmTransaction,
} from '@solana/web3.js';
import type { Connection, PublicKey, Signer } from '@solana/web3.js';
import { Keypair, SystemProgram, Transaction, sendAndConfirmTransaction } from '@solana/web3.js';
import {
AuthorityType,

View File

@ -2,7 +2,8 @@ import chai, { expect } from 'chai';
import chaiAsPromised from 'chai-as-promised';
chai.use(chaiAsPromised);
import { Connection, Keypair, PublicKey, Signer } from '@solana/web3.js';
import type { Connection, PublicKey, Signer } from '@solana/web3.js';
import { Keypair } from '@solana/web3.js';
import {
createInterestBearingMint,
getInterestBearingMintConfigState,

View File

@ -2,15 +2,8 @@ import chai, { expect } from 'chai';
import chaiAsPromised from 'chai-as-promised';
chai.use(chaiAsPromised);
import {
sendAndConfirmTransaction,
Connection,
Keypair,
PublicKey,
Signer,
SystemProgram,
Transaction,
} from '@solana/web3.js';
import type { Connection, PublicKey, Signer } from '@solana/web3.js';
import { sendAndConfirmTransaction, Keypair, SystemProgram, Transaction } from '@solana/web3.js';
import { createMemoInstruction } from '@solana/spl-memo';
import {
createAccount,

View File

@ -2,15 +2,8 @@ import chai, { expect } from 'chai';
import chaiAsPromised from 'chai-as-promised';
chai.use(chaiAsPromised);
import {
sendAndConfirmTransaction,
Connection,
Keypair,
PublicKey,
Signer,
SystemProgram,
Transaction,
} from '@solana/web3.js';
import type { Connection, PublicKey, Signer } from '@solana/web3.js';
import { sendAndConfirmTransaction, Keypair, SystemProgram, Transaction } from '@solana/web3.js';
import {
createInitializeMintInstruction,
createInitializeNonTransferableMintInstruction,

View File

@ -2,7 +2,8 @@ import chai, { expect } from 'chai';
import chaiAsPromised from 'chai-as-promised';
chai.use(chaiAsPromised);
import { Connection, Keypair, PublicKey, Signer, Transaction, sendAndConfirmTransaction } from '@solana/web3.js';
import type { Connection, PublicKey, Signer } from '@solana/web3.js';
import { Keypair, Transaction, sendAndConfirmTransaction } from '@solana/web3.js';
import { ExtensionType, createAccount, createMint, createReallocateInstruction, getAccountLen } from '../../src';

View File

@ -2,15 +2,8 @@ import chai, { expect } from 'chai';
import chaiAsPromised from 'chai-as-promised';
chai.use(chaiAsPromised);
import {
Connection,
Keypair,
PublicKey,
Signer,
SystemProgram,
Transaction,
sendAndConfirmTransaction,
} from '@solana/web3.js';
import type { Connection, PublicKey, Signer } from '@solana/web3.js';
import { Keypair, SystemProgram, Transaction, sendAndConfirmTransaction } from '@solana/web3.js';
import {
ExtensionType,

View File

@ -2,7 +2,8 @@ import chai, { expect } from 'chai';
import chaiAsPromised from 'chai-as-promised';
chai.use(chaiAsPromised);
import { Connection, Keypair, PublicKey, Signer } from '@solana/web3.js';
import type { Connection, PublicKey, Signer } from '@solana/web3.js';
import { Keypair } from '@solana/web3.js';
import { createMint, createAccount, getAccount, mintTo, burn, burnChecked } from '../../src';
import { TEST_PROGRAM_ID, newAccountWithLamports, getConnection } from '../common';

Some files were not shown because too many files have changed in this diff Show More