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:
parent
a179eba71e
commit
29d316e811
|
@ -69,6 +69,8 @@ jobs:
|
||||||
node-version: ${{ env.NODE_VERSION }}
|
node-version: ${{ env.NODE_VERSION }}
|
||||||
- uses: actions/cache@v2
|
- uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ~/.cache/yarn
|
path: ~/.npm
|
||||||
key: yarn-${{ hashFiles('memo/js/yarn.lock') }}
|
key: node-${{ hashFiles('memo/js/package-lock.json') }}
|
||||||
|
restore-keys: |
|
||||||
|
node-
|
||||||
- run: ./ci/js-test-memo.sh
|
- run: ./ci/js-test-memo.sh
|
||||||
|
|
|
@ -120,7 +120,7 @@ jobs:
|
||||||
js-test:
|
js-test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
NODE_VERSION: 14.x
|
NODE_VERSION: 16.x
|
||||||
needs: cargo-test-sbf
|
needs: cargo-test-sbf
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
@ -130,8 +130,8 @@ jobs:
|
||||||
node-version: ${{ env.NODE_VERSION }}
|
node-version: ${{ env.NODE_VERSION }}
|
||||||
- uses: actions/cache@v2
|
- uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ~/.cache/yarn
|
path: ~/.npm
|
||||||
key: node-${{ hashFiles('token/js/yarn.lock') }}
|
key: node-${{ hashFiles('token/js/package-lock.json') }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
node-
|
node-
|
||||||
- name: Download programs
|
- name: Download programs
|
||||||
|
|
|
@ -7,7 +7,7 @@ source ./ci/solana-version.sh install
|
||||||
set -x
|
set -x
|
||||||
cd memo/js
|
cd memo/js
|
||||||
|
|
||||||
yarn install --pure-lockfile
|
npm install
|
||||||
yarn lint
|
npm run lint
|
||||||
yarn build
|
npm run build
|
||||||
yarn test
|
npm test
|
||||||
|
|
|
@ -7,7 +7,7 @@ source ./ci/solana-version.sh install
|
||||||
set -x
|
set -x
|
||||||
cd token/js
|
cd token/js
|
||||||
|
|
||||||
yarn install --pure-lockfile
|
npm install
|
||||||
yarn lint
|
npm run lint
|
||||||
yarn build
|
npm run build
|
||||||
yarn test
|
npm test
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
node_modules
|
|
||||||
|
|
||||||
docs
|
docs
|
||||||
lib
|
lib
|
||||||
|
test-ledger
|
||||||
|
|
||||||
|
package-lock.json
|
||||||
|
|
|
@ -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"
|
||||||
|
}
|
||||||
|
}
|
|
@ -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"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,2 +1,13 @@
|
||||||
lib
|
.idea
|
||||||
|
.vscode
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
node_modules
|
||||||
|
|
||||||
|
pnpm-lock.yaml
|
||||||
|
yarn.lock
|
||||||
|
|
||||||
docs
|
docs
|
||||||
|
lib
|
||||||
|
test-ledger
|
||||||
|
*.tsbuildinfo
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
docs
|
docs
|
||||||
lib
|
lib
|
||||||
test-ledger
|
test-ledger
|
||||||
|
|
||||||
|
package-lock.json
|
||||||
|
|
|
@ -25,11 +25,20 @@ Please see [upgrading from 0.1.x](#upgrading-from-0.1.x).
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
```shell
|
```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
|
## Build from Source
|
||||||
|
|
||||||
|
0. Prerequisites
|
||||||
|
|
||||||
|
* Node 16+
|
||||||
|
* NPM 8+
|
||||||
|
|
||||||
1. Clone the project:
|
1. Clone the project:
|
||||||
```shell
|
```shell
|
||||||
git clone https://github.com/solana-labs/solana-program-library.git
|
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:
|
3. Install the dependencies:
|
||||||
```shell
|
```shell
|
||||||
yarn install
|
npm install
|
||||||
```
|
```
|
||||||
|
|
||||||
4. Build the library:
|
4. Build the library:
|
||||||
```shell
|
```shell
|
||||||
yarn build
|
npm run build
|
||||||
```
|
```
|
||||||
|
|
||||||
5. Build the on-chain programs:
|
5. Build the on-chain programs:
|
||||||
```shell
|
```shell
|
||||||
yarn test:build-programs
|
npm run test:build-programs
|
||||||
```
|
```
|
||||||
|
|
||||||
6. Run the tests:
|
6. Run the tests:
|
||||||
```shell
|
```shell
|
||||||
yarn test
|
npm run test
|
||||||
```
|
```
|
||||||
|
|
||||||
7. Run the example:
|
7. Run the example:
|
||||||
```shell
|
```shell
|
||||||
yarn example
|
npm run example
|
||||||
```
|
```
|
||||||
|
|
||||||
## Upgrading
|
## Upgrading
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,11 +1,14 @@
|
||||||
{
|
{
|
||||||
"name": "@solana/spl-token",
|
"name": "@solana/spl-token",
|
||||||
"version": "0.3.1",
|
"description": "SPL Token Program JS API",
|
||||||
|
"version": "0.3.2",
|
||||||
"author": "Solana Maintainers <maintainers@solana.foundation>",
|
"author": "Solana Maintainers <maintainers@solana.foundation>",
|
||||||
"repository": "https://github.com/solana-labs/solana-program-library",
|
"repository": "https://github.com/solana-labs/solana-program-library",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"publishConfig": {
|
"type": "module",
|
||||||
"access": "public"
|
"sideEffects": false,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=16"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"lib",
|
"lib",
|
||||||
|
@ -13,62 +16,71 @@
|
||||||
"LICENSE",
|
"LICENSE",
|
||||||
"README.md"
|
"README.md"
|
||||||
],
|
],
|
||||||
"type": "module",
|
"publishConfig": {
|
||||||
"sideEffects": false,
|
"access": "public"
|
||||||
"main": "lib/cjs/index.js",
|
},
|
||||||
"module": "lib/esm/index.mjs",
|
"main": "./lib/cjs/index.js",
|
||||||
"types": "lib/types/index.d.ts",
|
"module": "./lib/esm/index.js",
|
||||||
|
"types": "./lib/types/index.d.ts",
|
||||||
"exports": {
|
"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": {
|
"scripts": {
|
||||||
"clean": "shx rm -rf lib",
|
"nuke": "shx rm -rf node_modules package-lock.json || true",
|
||||||
"build": "yarn clean && tsc -p tsconfig.json; tsc-esm -p tsconfig.json && tsc -p tsconfig.cjs.json",
|
"reinstall": "npm run nuke && npm install",
|
||||||
"postbuild": "echo '{\"type\":\"commonjs\"}' > lib/cjs/package.json && echo '{\"type\":\"module\"}' > lib/esm/package.json",
|
"clean": "shx rm -rf lib **/*.tsbuildinfo || true",
|
||||||
"deploy": "yarn docs && gh-pages --dist docs --dest token/js --dotfiles",
|
"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",
|
"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: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-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-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: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",
|
"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/",
|
"deploy": "npm run deploy:docs",
|
||||||
"fmt": "prettier --write '{*,**/*}.{js,ts,jsx,tsx,json}'",
|
"docs": "shx rm -rf docs && typedoc && shx cp .nojekyll docs/",
|
||||||
"lint": "eslint --max-warnings 0 --ext .ts . && prettier --check '{*,**/*}.{js,ts,jsx,tsx,json}'",
|
"deploy:docs": "npm run docs && gh-pages --dist token/js --dotfiles"
|
||||||
"lint:fix": "eslint --fix --ext .ts . && yarn fmt",
|
},
|
||||||
"nuke": "shx rm -rf node_modules yarn.lock"
|
"peerDependencies": {
|
||||||
|
"@solana/web3.js": "^1.20.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@solana/buffer-layout": "^4.0.0",
|
"@solana/buffer-layout": "^4.0.0",
|
||||||
"@solana/buffer-layout-utils": "^0.2.0",
|
"@solana/buffer-layout-utils": "^0.2.0",
|
||||||
"@solana/web3.js": "^1.41.0"
|
"buffer": "^6.0.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"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/chai-as-promised": "^7.1.4",
|
||||||
"@types/eslint": "^8.4.0",
|
"@types/chai": "^4.3.3",
|
||||||
"@types/eslint-plugin-prettier": "^3.1.0",
|
|
||||||
"@types/mocha": "^9.1.0",
|
"@types/mocha": "^9.1.0",
|
||||||
"@types/node": "^16.11.21",
|
"@types/node": "^18.7.9",
|
||||||
"@types/prettier": "^2.4.3",
|
"@types/node-fetch": "^2.6.2",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.10.0",
|
"@types/prettier": "^2.7.0",
|
||||||
"@typescript-eslint/parser": "^5.10.0",
|
"@typescript-eslint/eslint-plugin": "^5.34.0",
|
||||||
"chai": "^4.3.4",
|
"@typescript-eslint/parser": "^5.34.0",
|
||||||
|
"chai": "^4.3.6",
|
||||||
"chai-as-promised": "^7.1.1",
|
"chai-as-promised": "^7.1.1",
|
||||||
"eslint": "^8.7.0",
|
"eslint": "^8.20.0",
|
||||||
"eslint-config-prettier": "^8.3.0",
|
"eslint-config-prettier": "^8.5.0",
|
||||||
"eslint-plugin-prettier": "^4.0.0",
|
"eslint-plugin-prettier": "^4.2.1",
|
||||||
"gh-pages": "^3.2.3",
|
"gh-pages": "^3.2.3",
|
||||||
"mocha": "^9.1.4",
|
"mocha": "^9.1.4",
|
||||||
"prettier": "^2.5.1",
|
"prettier": "^2.7.1",
|
||||||
|
"process": "^0.11.10",
|
||||||
"shx": "^0.3.4",
|
"shx": "^0.3.4",
|
||||||
"start-server-and-test": "^1.14.0",
|
"start-server-and-test": "^1.14.0",
|
||||||
"ts-node": "^10.4.0",
|
|
||||||
"tslib": "^2.3.1",
|
"tslib": "^2.3.1",
|
||||||
"typedoc": "^0.22.11",
|
"ts-node": "^10.9.1",
|
||||||
"typescript": "^4.5.5",
|
"typedoc": "^0.23.10",
|
||||||
"typescript-esm": "^2.0.0"
|
"typescript": "^4.7.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,8 @@
|
||||||
import {
|
import type { ConfirmOptions, Connection, PublicKey, Signer, TransactionSignature } from '@solana/web3.js';
|
||||||
ConfirmOptions,
|
import { sendAndConfirmTransaction, Transaction } from '@solana/web3.js';
|
||||||
Connection,
|
import { TOKEN_PROGRAM_ID } from '../constants.js';
|
||||||
PublicKey,
|
import { createApproveInstruction } from '../instructions/approve.js';
|
||||||
sendAndConfirmTransaction,
|
import { getSigners } from './internal.js';
|
||||||
Signer,
|
|
||||||
Transaction,
|
|
||||||
TransactionSignature,
|
|
||||||
} from '@solana/web3.js';
|
|
||||||
import { TOKEN_PROGRAM_ID } from '../constants';
|
|
||||||
import { createApproveInstruction } from '../instructions/index';
|
|
||||||
import { getSigners } from './internal';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Approve a delegate to transfer up to a maximum number of tokens from an account
|
* Approve a delegate to transfer up to a maximum number of tokens from an account
|
||||||
|
|
|
@ -1,15 +1,8 @@
|
||||||
import {
|
import type { ConfirmOptions, Connection, PublicKey, Signer, TransactionSignature } from '@solana/web3.js';
|
||||||
ConfirmOptions,
|
import { sendAndConfirmTransaction, Transaction } from '@solana/web3.js';
|
||||||
Connection,
|
import { TOKEN_PROGRAM_ID } from '../constants.js';
|
||||||
PublicKey,
|
import { createApproveCheckedInstruction } from '../instructions/approveChecked.js';
|
||||||
sendAndConfirmTransaction,
|
import { getSigners } from './internal.js';
|
||||||
Signer,
|
|
||||||
Transaction,
|
|
||||||
TransactionSignature,
|
|
||||||
} from '@solana/web3.js';
|
|
||||||
import { TOKEN_PROGRAM_ID } from '../constants';
|
|
||||||
import { createApproveCheckedInstruction } from '../instructions/index';
|
|
||||||
import { getSigners } from './internal';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Approve a delegate to transfer up to a maximum number of tokens from an account, asserting the token mint and
|
* Approve a delegate to transfer up to a maximum number of tokens from an account, asserting the token mint and
|
||||||
|
|
|
@ -1,15 +1,8 @@
|
||||||
import {
|
import type { ConfirmOptions, Connection, PublicKey, Signer, TransactionSignature } from '@solana/web3.js';
|
||||||
ConfirmOptions,
|
import { sendAndConfirmTransaction, Transaction } from '@solana/web3.js';
|
||||||
Connection,
|
import { TOKEN_PROGRAM_ID } from '../constants.js';
|
||||||
PublicKey,
|
import { createBurnInstruction } from '../instructions/burn.js';
|
||||||
sendAndConfirmTransaction,
|
import { getSigners } from './internal.js';
|
||||||
Signer,
|
|
||||||
Transaction,
|
|
||||||
TransactionSignature,
|
|
||||||
} from '@solana/web3.js';
|
|
||||||
import { TOKEN_PROGRAM_ID } from '../constants';
|
|
||||||
import { createBurnInstruction } from '../instructions/index';
|
|
||||||
import { getSigners } from './internal';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Burn tokens from an account
|
* Burn tokens from an account
|
||||||
|
|
|
@ -1,15 +1,8 @@
|
||||||
import {
|
import type { ConfirmOptions, Connection, PublicKey, Signer, TransactionSignature } from '@solana/web3.js';
|
||||||
ConfirmOptions,
|
import { sendAndConfirmTransaction, Transaction } from '@solana/web3.js';
|
||||||
Connection,
|
import { TOKEN_PROGRAM_ID } from '../constants.js';
|
||||||
PublicKey,
|
import { createBurnCheckedInstruction } from '../instructions/burnChecked.js';
|
||||||
sendAndConfirmTransaction,
|
import { getSigners } from './internal.js';
|
||||||
Signer,
|
|
||||||
Transaction,
|
|
||||||
TransactionSignature,
|
|
||||||
} from '@solana/web3.js';
|
|
||||||
import { TOKEN_PROGRAM_ID } from '../constants';
|
|
||||||
import { createBurnCheckedInstruction } from '../instructions/index';
|
|
||||||
import { getSigners } from './internal';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Burn tokens from an account, asserting the token mint and decimals
|
* Burn tokens from an account, asserting the token mint and decimals
|
||||||
|
|
|
@ -1,15 +1,8 @@
|
||||||
import {
|
import type { ConfirmOptions, Connection, PublicKey, Signer, TransactionSignature } from '@solana/web3.js';
|
||||||
ConfirmOptions,
|
import { sendAndConfirmTransaction, Transaction } from '@solana/web3.js';
|
||||||
Connection,
|
import { TOKEN_PROGRAM_ID } from '../constants.js';
|
||||||
PublicKey,
|
import { createCloseAccountInstruction } from '../instructions/closeAccount.js';
|
||||||
sendAndConfirmTransaction,
|
import { getSigners } from './internal.js';
|
||||||
Signer,
|
|
||||||
Transaction,
|
|
||||||
TransactionSignature,
|
|
||||||
} from '@solana/web3.js';
|
|
||||||
import { TOKEN_PROGRAM_ID } from '../constants';
|
|
||||||
import { createCloseAccountInstruction } from '../instructions/index';
|
|
||||||
import { getSigners } from './internal';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Close a token account
|
* Close a token account
|
||||||
|
|
|
@ -1,18 +1,10 @@
|
||||||
import {
|
import type { ConfirmOptions, Connection, Keypair, PublicKey, Signer } from '@solana/web3.js';
|
||||||
ConfirmOptions,
|
import { sendAndConfirmTransaction, SystemProgram, Transaction } from '@solana/web3.js';
|
||||||
Connection,
|
import { TOKEN_PROGRAM_ID } from '../constants.js';
|
||||||
Keypair,
|
import { getAccountLenForMint } from '../extensions/extensionType.js';
|
||||||
PublicKey,
|
import { createInitializeAccountInstruction } from '../instructions/initializeAccount.js';
|
||||||
sendAndConfirmTransaction,
|
import { getMint } from '../state/mint.js';
|
||||||
Signer,
|
import { createAssociatedTokenAccount } from './createAssociatedTokenAccount.js';
|
||||||
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';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create and initialize a new token account
|
* Create and initialize a new token account
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
import { ConfirmOptions, Connection, PublicKey, sendAndConfirmTransaction, Signer, Transaction } from '@solana/web3.js';
|
import type { ConfirmOptions, Connection, PublicKey, Signer } from '@solana/web3.js';
|
||||||
import { ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_PROGRAM_ID } from '../constants';
|
import { sendAndConfirmTransaction, Transaction } from '@solana/web3.js';
|
||||||
import { createAssociatedTokenAccountInstruction } from '../instructions/index';
|
import { ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_PROGRAM_ID } from '../constants.js';
|
||||||
import { getAssociatedTokenAddress } from '../state/index';
|
import { createAssociatedTokenAccountInstruction } from '../instructions/associatedTokenAccount.js';
|
||||||
|
import { getAssociatedTokenAddress } from '../state/mint.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create and initialize a new associated token account
|
* Create and initialize a new associated token account
|
||||||
|
|
|
@ -1,16 +1,8 @@
|
||||||
import {
|
import type { ConfirmOptions, Connection, PublicKey, Signer } from '@solana/web3.js';
|
||||||
ConfirmOptions,
|
import { Keypair, sendAndConfirmTransaction, SystemProgram, Transaction } from '@solana/web3.js';
|
||||||
Connection,
|
import { TOKEN_PROGRAM_ID } from '../constants.js';
|
||||||
Keypair,
|
import { createInitializeMintInstruction } from '../instructions/initializeMint.js';
|
||||||
PublicKey,
|
import { getMinimumBalanceForRentExemptMint, MINT_SIZE } from '../state/mint.js';
|
||||||
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';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create and initialize a new mint
|
* Create and initialize a new mint
|
||||||
|
|
|
@ -1,16 +1,8 @@
|
||||||
import {
|
import type { ConfirmOptions, Connection, PublicKey, Signer } from '@solana/web3.js';
|
||||||
ConfirmOptions,
|
import { Keypair, sendAndConfirmTransaction, SystemProgram, Transaction } from '@solana/web3.js';
|
||||||
Connection,
|
import { TOKEN_PROGRAM_ID } from '../constants.js';
|
||||||
Keypair,
|
import { createInitializeMultisigInstruction } from '../instructions/initializeMultisig.js';
|
||||||
PublicKey,
|
import { getMinimumBalanceForRentExemptMultisig, MULTISIG_SIZE } from '../state/multisig.js';
|
||||||
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';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create and initialize a new multisig
|
* Create and initialize a new multisig
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { ConfirmOptions, Connection, sendAndConfirmTransaction, Signer, Transaction } from '@solana/web3.js';
|
import type { ConfirmOptions, Connection, Signer } from '@solana/web3.js';
|
||||||
import { TOKEN_2022_PROGRAM_ID, NATIVE_MINT_2022 } from '../constants';
|
import { sendAndConfirmTransaction, Transaction } from '@solana/web3.js';
|
||||||
import { createCreateNativeMintInstruction } from '../instructions/index';
|
import { NATIVE_MINT_2022, TOKEN_2022_PROGRAM_ID } from '../constants.js';
|
||||||
|
import { createCreateNativeMintInstruction } from '../instructions/createNativeMint.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create native mint
|
* Create native mint
|
||||||
|
|
|
@ -1,21 +1,12 @@
|
||||||
import {
|
import type { ConfirmOptions, Connection, Keypair, PublicKey, Signer } from '@solana/web3.js';
|
||||||
ConfirmOptions,
|
import { sendAndConfirmTransaction, SystemProgram, Transaction } from '@solana/web3.js';
|
||||||
Connection,
|
import { ASSOCIATED_TOKEN_PROGRAM_ID, NATIVE_MINT, TOKEN_PROGRAM_ID } from '../constants.js';
|
||||||
Keypair,
|
import { createAssociatedTokenAccountInstruction } from '../instructions/associatedTokenAccount.js';
|
||||||
PublicKey,
|
import { createInitializeAccountInstruction } from '../instructions/initializeAccount.js';
|
||||||
sendAndConfirmTransaction,
|
import { createSyncNativeInstruction } from '../instructions/syncNative.js';
|
||||||
Signer,
|
import { ACCOUNT_SIZE, getMinimumBalanceForRentExemptAccount } from '../state/account.js';
|
||||||
SystemProgram,
|
import { getAssociatedTokenAddress } from '../state/mint.js';
|
||||||
Transaction,
|
import { createAccount } from './createAccount.js';
|
||||||
} 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';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create, initialize, and fund a new wrapped native SOL account
|
* Create, initialize, and fund a new wrapped native SOL account
|
||||||
|
|
|
@ -1,15 +1,8 @@
|
||||||
import {
|
import type { ConfirmOptions, Connection, PublicKey, Signer, TransactionSignature } from '@solana/web3.js';
|
||||||
ConfirmOptions,
|
import { sendAndConfirmTransaction, Transaction } from '@solana/web3.js';
|
||||||
Connection,
|
import { TOKEN_PROGRAM_ID } from '../constants.js';
|
||||||
PublicKey,
|
import { createFreezeAccountInstruction } from '../instructions/freezeAccount.js';
|
||||||
sendAndConfirmTransaction,
|
import { getSigners } from './internal.js';
|
||||||
Signer,
|
|
||||||
Transaction,
|
|
||||||
TransactionSignature,
|
|
||||||
} from '@solana/web3.js';
|
|
||||||
import { TOKEN_PROGRAM_ID } from '../constants';
|
|
||||||
import { createFreezeAccountInstruction } from '../instructions/index';
|
|
||||||
import { getSigners } from './internal';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Freeze a token account
|
* Freeze a token account
|
||||||
|
|
|
@ -1,21 +1,16 @@
|
||||||
import {
|
import type { Commitment, ConfirmOptions, Connection, PublicKey, Signer } from '@solana/web3.js';
|
||||||
Commitment,
|
import { sendAndConfirmTransaction, Transaction } from '@solana/web3.js';
|
||||||
ConfirmOptions,
|
import { ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_PROGRAM_ID } from '../constants.js';
|
||||||
Connection,
|
|
||||||
PublicKey,
|
|
||||||
sendAndConfirmTransaction,
|
|
||||||
Signer,
|
|
||||||
Transaction,
|
|
||||||
} from '@solana/web3.js';
|
|
||||||
import { ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_PROGRAM_ID } from '../constants';
|
|
||||||
import {
|
import {
|
||||||
TokenAccountNotFoundError,
|
TokenAccountNotFoundError,
|
||||||
TokenInvalidAccountOwnerError,
|
TokenInvalidAccountOwnerError,
|
||||||
TokenInvalidMintError,
|
TokenInvalidMintError,
|
||||||
TokenInvalidOwnerError,
|
TokenInvalidOwnerError,
|
||||||
} from '../errors';
|
} from '../errors.js';
|
||||||
import { createAssociatedTokenAccountInstruction } from '../instructions/index';
|
import { createAssociatedTokenAccountInstruction } from '../instructions/associatedTokenAccount.js';
|
||||||
import { Account, getAccount, getAssociatedTokenAddress } from '../state/index';
|
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
|
* Retrieve the associated token account, or create it if it doesn't exist
|
||||||
|
|
|
@ -1,22 +1,22 @@
|
||||||
export * from './createMint';
|
export * from './createMint.js';
|
||||||
export * from './createNativeMint';
|
export * from './createNativeMint.js';
|
||||||
export * from './createAccount';
|
export * from './createAccount.js';
|
||||||
export * from './createWrappedNativeAccount';
|
export * from './createWrappedNativeAccount.js';
|
||||||
export * from './createMultisig';
|
export * from './createMultisig.js';
|
||||||
export * from './transfer';
|
export * from './transfer.js';
|
||||||
export * from './approve';
|
export * from './approve.js';
|
||||||
export * from './revoke';
|
export * from './revoke.js';
|
||||||
export * from './setAuthority';
|
export * from './setAuthority.js';
|
||||||
export * from './mintTo';
|
export * from './mintTo.js';
|
||||||
export * from './burn';
|
export * from './burn.js';
|
||||||
export * from './closeAccount';
|
export * from './closeAccount.js';
|
||||||
export * from './freezeAccount';
|
export * from './freezeAccount.js';
|
||||||
export * from './thawAccount';
|
export * from './thawAccount.js';
|
||||||
export * from './transferChecked';
|
export * from './transferChecked.js';
|
||||||
export * from './approveChecked';
|
export * from './approveChecked.js';
|
||||||
export * from './mintToChecked';
|
export * from './mintToChecked.js';
|
||||||
export * from './burnChecked';
|
export * from './burnChecked.js';
|
||||||
export * from './syncNative';
|
export * from './syncNative.js';
|
||||||
|
|
||||||
export * from './createAssociatedTokenAccount';
|
export * from './createAssociatedTokenAccount.js';
|
||||||
export * from './getOrCreateAssociatedTokenAccount';
|
export * from './getOrCreateAssociatedTokenAccount.js';
|
||||||
|
|
|
@ -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 */
|
/** @internal */
|
||||||
export function getSigners(signerOrMultisig: Signer | PublicKey, multiSigners: Signer[]): [PublicKey, Signer[]] {
|
export function getSigners(signerOrMultisig: Signer | PublicKey, multiSigners: Signer[]): [PublicKey, Signer[]] {
|
||||||
|
|
|
@ -1,15 +1,8 @@
|
||||||
import {
|
import type { ConfirmOptions, Connection, PublicKey, Signer, TransactionSignature } from '@solana/web3.js';
|
||||||
ConfirmOptions,
|
import { sendAndConfirmTransaction, Transaction } from '@solana/web3.js';
|
||||||
Connection,
|
import { TOKEN_PROGRAM_ID } from '../constants.js';
|
||||||
PublicKey,
|
import { createMintToInstruction } from '../instructions/mintTo.js';
|
||||||
sendAndConfirmTransaction,
|
import { getSigners } from './internal.js';
|
||||||
Signer,
|
|
||||||
Transaction,
|
|
||||||
TransactionSignature,
|
|
||||||
} from '@solana/web3.js';
|
|
||||||
import { TOKEN_PROGRAM_ID } from '../constants';
|
|
||||||
import { createMintToInstruction } from '../instructions/index';
|
|
||||||
import { getSigners } from './internal';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mint tokens to an account
|
* Mint tokens to an account
|
||||||
|
|
|
@ -1,15 +1,8 @@
|
||||||
import {
|
import type { ConfirmOptions, Connection, PublicKey, Signer, TransactionSignature } from '@solana/web3.js';
|
||||||
ConfirmOptions,
|
import { sendAndConfirmTransaction, Transaction } from '@solana/web3.js';
|
||||||
Connection,
|
import { TOKEN_PROGRAM_ID } from '../constants.js';
|
||||||
PublicKey,
|
import { createMintToCheckedInstruction } from '../instructions/mintToChecked.js';
|
||||||
sendAndConfirmTransaction,
|
import { getSigners } from './internal.js';
|
||||||
Signer,
|
|
||||||
Transaction,
|
|
||||||
TransactionSignature,
|
|
||||||
} from '@solana/web3.js';
|
|
||||||
import { TOKEN_PROGRAM_ID } from '../constants';
|
|
||||||
import { createMintToCheckedInstruction } from '../instructions/index';
|
|
||||||
import { getSigners } from './internal';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mint tokens to an account, asserting the token mint and decimals
|
* Mint tokens to an account, asserting the token mint and decimals
|
||||||
|
|
|
@ -1,15 +1,8 @@
|
||||||
import {
|
import type { ConfirmOptions, Connection, PublicKey, Signer, TransactionSignature } from '@solana/web3.js';
|
||||||
ConfirmOptions,
|
import { sendAndConfirmTransaction, Transaction } from '@solana/web3.js';
|
||||||
Connection,
|
import { TOKEN_PROGRAM_ID } from '../constants.js';
|
||||||
PublicKey,
|
import { createRevokeInstruction } from '../instructions/revoke.js';
|
||||||
sendAndConfirmTransaction,
|
import { getSigners } from './internal.js';
|
||||||
Signer,
|
|
||||||
Transaction,
|
|
||||||
TransactionSignature,
|
|
||||||
} from '@solana/web3.js';
|
|
||||||
import { TOKEN_PROGRAM_ID } from '../constants';
|
|
||||||
import { createRevokeInstruction } from '../instructions/index';
|
|
||||||
import { getSigners } from './internal';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Revoke approval for the transfer of tokens from an account
|
* Revoke approval for the transfer of tokens from an account
|
||||||
|
|
|
@ -1,15 +1,9 @@
|
||||||
import {
|
import type { ConfirmOptions, Connection, PublicKey, Signer, TransactionSignature } from '@solana/web3.js';
|
||||||
ConfirmOptions,
|
import { sendAndConfirmTransaction, Transaction } from '@solana/web3.js';
|
||||||
Connection,
|
import { TOKEN_PROGRAM_ID } from '../constants.js';
|
||||||
PublicKey,
|
import type { AuthorityType } from '../instructions/setAuthority.js';
|
||||||
sendAndConfirmTransaction,
|
import { createSetAuthorityInstruction } from '../instructions/setAuthority.js';
|
||||||
Signer,
|
import { getSigners } from './internal.js';
|
||||||
Transaction,
|
|
||||||
TransactionSignature,
|
|
||||||
} from '@solana/web3.js';
|
|
||||||
import { TOKEN_PROGRAM_ID } from '../constants';
|
|
||||||
import { AuthorityType, createSetAuthorityInstruction } from '../instructions/index';
|
|
||||||
import { getSigners } from './internal';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assign a new authority to the account
|
* Assign a new authority to the account
|
||||||
|
|
|
@ -1,14 +1,7 @@
|
||||||
import {
|
import type { ConfirmOptions, Connection, PublicKey, Signer, TransactionSignature } from '@solana/web3.js';
|
||||||
ConfirmOptions,
|
import { sendAndConfirmTransaction, Transaction } from '@solana/web3.js';
|
||||||
Connection,
|
import { TOKEN_PROGRAM_ID } from '../constants.js';
|
||||||
PublicKey,
|
import { createSyncNativeInstruction } from '../instructions/syncNative.js';
|
||||||
sendAndConfirmTransaction,
|
|
||||||
Signer,
|
|
||||||
Transaction,
|
|
||||||
TransactionSignature,
|
|
||||||
} from '@solana/web3.js';
|
|
||||||
import { TOKEN_PROGRAM_ID } from '../constants';
|
|
||||||
import { createSyncNativeInstruction } from '../instructions/index';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sync the balance of a native SPL token account to the underlying system account's lamports
|
* Sync the balance of a native SPL token account to the underlying system account's lamports
|
||||||
|
|
|
@ -1,15 +1,8 @@
|
||||||
import {
|
import type { ConfirmOptions, Connection, PublicKey, Signer, TransactionSignature } from '@solana/web3.js';
|
||||||
ConfirmOptions,
|
import { sendAndConfirmTransaction, Transaction } from '@solana/web3.js';
|
||||||
Connection,
|
import { TOKEN_PROGRAM_ID } from '../constants.js';
|
||||||
PublicKey,
|
import { createThawAccountInstruction } from '../instructions/thawAccount.js';
|
||||||
sendAndConfirmTransaction,
|
import { getSigners } from './internal.js';
|
||||||
Signer,
|
|
||||||
Transaction,
|
|
||||||
TransactionSignature,
|
|
||||||
} from '@solana/web3.js';
|
|
||||||
import { TOKEN_PROGRAM_ID } from '../constants';
|
|
||||||
import { createThawAccountInstruction } from '../instructions/index';
|
|
||||||
import { getSigners } from './internal';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Thaw (unfreeze) a token account
|
* Thaw (unfreeze) a token account
|
||||||
|
|
|
@ -1,15 +1,8 @@
|
||||||
import {
|
import type { ConfirmOptions, Connection, PublicKey, Signer, TransactionSignature } from '@solana/web3.js';
|
||||||
ConfirmOptions,
|
import { sendAndConfirmTransaction, Transaction } from '@solana/web3.js';
|
||||||
Connection,
|
import { TOKEN_PROGRAM_ID } from '../constants.js';
|
||||||
PublicKey,
|
import { createTransferInstruction } from '../instructions/transfer.js';
|
||||||
sendAndConfirmTransaction,
|
import { getSigners } from './internal.js';
|
||||||
Signer,
|
|
||||||
Transaction,
|
|
||||||
TransactionSignature,
|
|
||||||
} from '@solana/web3.js';
|
|
||||||
import { TOKEN_PROGRAM_ID } from '../constants';
|
|
||||||
import { createTransferInstruction } from '../instructions/index';
|
|
||||||
import { getSigners } from './internal';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transfer tokens from one account to another
|
* Transfer tokens from one account to another
|
||||||
|
|
|
@ -1,15 +1,8 @@
|
||||||
import {
|
import type { ConfirmOptions, Connection, PublicKey, Signer, TransactionSignature } from '@solana/web3.js';
|
||||||
ConfirmOptions,
|
import { sendAndConfirmTransaction, Transaction } from '@solana/web3.js';
|
||||||
Connection,
|
import { TOKEN_PROGRAM_ID } from '../constants.js';
|
||||||
PublicKey,
|
import { createTransferCheckedInstruction } from '../instructions/transferChecked.js';
|
||||||
sendAndConfirmTransaction,
|
import { getSigners } from './internal.js';
|
||||||
Signer,
|
|
||||||
Transaction,
|
|
||||||
TransactionSignature,
|
|
||||||
} from '@solana/web3.js';
|
|
||||||
import { TOKEN_PROGRAM_ID } from '../constants';
|
|
||||||
import { createTransferCheckedInstruction } from '../instructions/index';
|
|
||||||
import { getSigners } from './internal';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transfer tokens from one account to another, asserting the token mint and decimals
|
* Transfer tokens from one account to another, asserting the token mint and decimals
|
||||||
|
|
|
@ -1,19 +1,12 @@
|
||||||
import {
|
import type { ConfirmOptions, Connection, PublicKey, Signer, TransactionSignature } from '@solana/web3.js';
|
||||||
ConfirmOptions,
|
import { sendAndConfirmTransaction, Transaction } from '@solana/web3.js';
|
||||||
Connection,
|
import { getSigners } from '../../actions/internal.js';
|
||||||
PublicKey,
|
import { TOKEN_2022_PROGRAM_ID } from '../../constants.js';
|
||||||
sendAndConfirmTransaction,
|
import type { AccountState } from '../../state/account.js';
|
||||||
Signer,
|
|
||||||
Transaction,
|
|
||||||
TransactionSignature,
|
|
||||||
} from '@solana/web3.js';
|
|
||||||
import { TOKEN_2022_PROGRAM_ID } from '../../constants';
|
|
||||||
import { AccountState } from '../../state';
|
|
||||||
import {
|
import {
|
||||||
createInitializeDefaultAccountStateInstruction,
|
createInitializeDefaultAccountStateInstruction,
|
||||||
createUpdateDefaultAccountStateInstruction,
|
createUpdateDefaultAccountStateInstruction,
|
||||||
} from './instructions';
|
} from './instructions.js';
|
||||||
import { getSigners } from '../../actions/internal';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize a default account state on a mint
|
* Initialize a default account state on a mint
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
export * from './actions';
|
export * from './actions.js';
|
||||||
export * from './instructions';
|
export * from './instructions.js';
|
||||||
export * from './state';
|
export * from './state.js';
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
import { struct, u8 } from '@solana/buffer-layout';
|
import { struct, u8 } from '@solana/buffer-layout';
|
||||||
import { PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
|
import type { PublicKey, Signer } from '@solana/web3.js';
|
||||||
import { AccountState } from '../../state/account';
|
import { TransactionInstruction } from '@solana/web3.js';
|
||||||
import { TokenInstruction } from '../../instructions/types';
|
import { programSupportsExtensions, TOKEN_2022_PROGRAM_ID } from '../../constants.js';
|
||||||
import { programSupportsExtensions, TOKEN_2022_PROGRAM_ID } from '../../constants';
|
import { TokenUnsupportedInstructionError } from '../../errors.js';
|
||||||
import { TokenUnsupportedInstructionError } from '../../errors';
|
import { TokenInstruction } from '../../instructions/types.js';
|
||||||
|
import type { AccountState } from '../../state/account.js';
|
||||||
|
|
||||||
export enum DefaultAccountStateInstruction {
|
export enum DefaultAccountStateInstruction {
|
||||||
Initialize = 0,
|
Initialize = 0,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { struct, u8 } from '@solana/buffer-layout';
|
import { struct, u8 } from '@solana/buffer-layout';
|
||||||
import { AccountState } from '../../state';
|
import type { AccountState } from '../../state/account.js';
|
||||||
import { Mint } from '../../state';
|
import type { Mint } from '../../state/mint.js';
|
||||||
import { ExtensionType, getExtensionData } from '../extensionType';
|
import { ExtensionType, getExtensionData } from '../extensionType.js';
|
||||||
|
|
||||||
/** DefaultAccountState as stored by the program */
|
/** DefaultAccountState as stored by the program */
|
||||||
export interface DefaultAccountState {
|
export interface DefaultAccountState {
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
import { ACCOUNT_SIZE } from '../state/account';
|
import { ACCOUNT_SIZE } from '../state/account.js';
|
||||||
import { Mint, MINT_SIZE } from '../state/mint';
|
import type { Mint } from '../state/mint.js';
|
||||||
import { MULTISIG_SIZE } from '../state/multisig';
|
import { MINT_SIZE } from '../state/mint.js';
|
||||||
import { ACCOUNT_TYPE_SIZE } from './accountType';
|
import { MULTISIG_SIZE } from '../state/multisig.js';
|
||||||
import { MEMO_TRANSFER_SIZE } from './memoTransfer';
|
import { ACCOUNT_TYPE_SIZE } from './accountType.js';
|
||||||
import { DEFAULT_ACCOUNT_STATE_SIZE } from './defaultAccountState';
|
import { DEFAULT_ACCOUNT_STATE_SIZE } from './defaultAccountState/index.js';
|
||||||
import { MINT_CLOSE_AUTHORITY_SIZE } from './mintCloseAuthority';
|
import { IMMUTABLE_OWNER_SIZE } from './immutableOwner.js';
|
||||||
import { IMMUTABLE_OWNER_SIZE } from './immutableOwner';
|
import { INTEREST_BEARING_MINT_CONFIG_STATE_SIZE } from './interestBearingMint/state.js';
|
||||||
import { TRANSFER_FEE_CONFIG_SIZE, TRANSFER_FEE_AMOUNT_SIZE } from './transferFee';
|
import { MEMO_TRANSFER_SIZE } from './memoTransfer/index.js';
|
||||||
import { NON_TRANSFERABLE_SIZE } from './nonTransferable';
|
import { MINT_CLOSE_AUTHORITY_SIZE } from './mintCloseAuthority.js';
|
||||||
import { INTEREST_BEARING_MINT_CONFIG_STATE_SIZE } from './interestBearingMint/state';
|
import { NON_TRANSFERABLE_SIZE } from './nonTransferable.js';
|
||||||
|
import { TRANSFER_FEE_AMOUNT_SIZE, TRANSFER_FEE_CONFIG_SIZE } from './transferFee/index.js';
|
||||||
|
|
||||||
export enum ExtensionType {
|
export enum ExtensionType {
|
||||||
Uninitialized,
|
Uninitialized,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { struct } from '@solana/buffer-layout';
|
import { struct } from '@solana/buffer-layout';
|
||||||
import { Account } from '../state/account';
|
import type { Account } from '../state/account.js';
|
||||||
import { ExtensionType, getExtensionData } from './extensionType';
|
import { ExtensionType, getExtensionData } from './extensionType.js';
|
||||||
|
|
||||||
/** ImmutableOwner as stored by the program */
|
/** ImmutableOwner as stored by the program */
|
||||||
export interface ImmutableOwner {} // eslint-disable-line
|
export interface ImmutableOwner {} // eslint-disable-line
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
export * from './accountType';
|
export * from './accountType.js';
|
||||||
export * from './defaultAccountState/index';
|
export * from './defaultAccountState/index.js';
|
||||||
export * from './extensionType';
|
export * from './extensionType.js';
|
||||||
export * from './memoTransfer/index';
|
export * from './memoTransfer/index.js';
|
||||||
export * from './mintCloseAuthority';
|
export * from './mintCloseAuthority.js';
|
||||||
export * from './immutableOwner';
|
export * from './immutableOwner.js';
|
||||||
export * from './interestBearingMint';
|
export * from './interestBearingMint/index.js';
|
||||||
export * from './nonTransferable';
|
export * from './nonTransferable.js';
|
||||||
export * from './transferFee/index';
|
export * from './transferFee/index.js';
|
||||||
|
|
|
@ -1,21 +1,13 @@
|
||||||
import {
|
import type { ConfirmOptions, Connection, PublicKey, Signer } from '@solana/web3.js';
|
||||||
ConfirmOptions,
|
import { Keypair, sendAndConfirmTransaction, SystemProgram, Transaction } from '@solana/web3.js';
|
||||||
Connection,
|
import { getSigners } from '../../actions/internal.js';
|
||||||
Keypair,
|
import { TOKEN_2022_PROGRAM_ID } from '../../constants.js';
|
||||||
PublicKey,
|
import { createInitializeMintInstruction } from '../../instructions/initializeMint.js';
|
||||||
sendAndConfirmTransaction,
|
import { ExtensionType, getMintLen } from '../extensionType.js';
|
||||||
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 {
|
import {
|
||||||
createInitializeInterestBearingMintInstruction,
|
createInitializeInterestBearingMintInstruction,
|
||||||
createUpdateRateInterestBearingMintInstruction,
|
createUpdateRateInterestBearingMintInstruction,
|
||||||
} from './instructions';
|
} from './instructions.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize an interest bearing account on a mint
|
* Initialize an interest bearing account on a mint
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
export * from './actions';
|
export * from './actions.js';
|
||||||
export * from './instructions';
|
export * from './instructions.js';
|
||||||
export * from './state';
|
export * from './state.js';
|
||||||
|
|
|
@ -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 } from '@solana/buffer-layout-utils';
|
||||||
import { PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
|
import type { PublicKey, Signer } from '@solana/web3.js';
|
||||||
import { TOKEN_2022_PROGRAM_ID } from '../../constants';
|
import { TransactionInstruction } from '@solana/web3.js';
|
||||||
import { TokenInstruction } from '../../instructions';
|
import { TOKEN_2022_PROGRAM_ID } from '../../constants.js';
|
||||||
import { addSigners } from '../../instructions/internal';
|
import { addSigners } from '../../instructions/internal.js';
|
||||||
|
import { TokenInstruction } from '../../instructions/types.js';
|
||||||
|
|
||||||
export enum InterestBearingMintInstruction {
|
export enum InterestBearingMintInstruction {
|
||||||
Initialize = 0,
|
Initialize = 0,
|
||||||
|
|
|
@ -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/buffer-layout-utils';
|
||||||
import { PublicKey } from '@solana/web3.js';
|
import type { PublicKey } from '@solana/web3.js';
|
||||||
import { Mint } from '../../state';
|
import type { Mint } from '../../state/mint.js';
|
||||||
import { ExtensionType, getExtensionData } from '../extensionType';
|
import { ExtensionType, getExtensionData } from '../extensionType.js';
|
||||||
|
|
||||||
export interface InterestBearingMintConfigState {
|
export interface InterestBearingMintConfigState {
|
||||||
rateAuthority: PublicKey;
|
rateAuthority: PublicKey;
|
||||||
initializationTimestamp: BigInt;
|
initializationTimestamp: bigint;
|
||||||
preUpdateAverageRate: number;
|
preUpdateAverageRate: number;
|
||||||
lastUpdateTimestamp: BigInt;
|
lastUpdateTimestamp: bigint;
|
||||||
currentRate: number;
|
currentRate: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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 {
|
import {
|
||||||
ConfirmOptions,
|
|
||||||
Connection,
|
|
||||||
PublicKey,
|
|
||||||
sendAndConfirmTransaction,
|
|
||||||
Signer,
|
|
||||||
Transaction,
|
|
||||||
TransactionSignature,
|
|
||||||
} from '@solana/web3.js';
|
|
||||||
import { TOKEN_2022_PROGRAM_ID } from '../../constants';
|
|
||||||
import {
|
|
||||||
createEnableRequiredMemoTransfersInstruction,
|
|
||||||
createDisableRequiredMemoTransfersInstruction,
|
createDisableRequiredMemoTransfersInstruction,
|
||||||
} from './instructions';
|
createEnableRequiredMemoTransfersInstruction,
|
||||||
import { getSigners } from '../../actions/internal';
|
} from './instructions.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable memo transfers on the given account
|
* Enable memo transfers on the given account
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
export * from './actions';
|
export * from './actions.js';
|
||||||
export * from './instructions';
|
export * from './instructions.js';
|
||||||
export * from './state';
|
export * from './state.js';
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
import { struct, u8 } from '@solana/buffer-layout';
|
import { struct, u8 } from '@solana/buffer-layout';
|
||||||
import { PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
|
import type { PublicKey, Signer } from '@solana/web3.js';
|
||||||
import { TokenInstruction } from '../../instructions/types';
|
import { TransactionInstruction } from '@solana/web3.js';
|
||||||
import { programSupportsExtensions, TOKEN_2022_PROGRAM_ID } from '../../constants';
|
import { programSupportsExtensions, TOKEN_2022_PROGRAM_ID } from '../../constants.js';
|
||||||
import { TokenUnsupportedInstructionError } from '../../errors';
|
import { TokenUnsupportedInstructionError } from '../../errors.js';
|
||||||
|
import { TokenInstruction } from '../../instructions/types.js';
|
||||||
|
|
||||||
export enum MemoTransferInstruction {
|
export enum MemoTransferInstruction {
|
||||||
Enable = 0,
|
Enable = 0,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { struct } from '@solana/buffer-layout';
|
import { struct } from '@solana/buffer-layout';
|
||||||
import { bool } from '@solana/buffer-layout-utils';
|
import { bool } from '@solana/buffer-layout-utils';
|
||||||
import { Account } from '../../state';
|
import type { Account } from '../../state/account.js';
|
||||||
import { ExtensionType, getExtensionData } from '../extensionType';
|
import { ExtensionType, getExtensionData } from '../extensionType.js';
|
||||||
|
|
||||||
/** MemoTransfer as stored by the program */
|
/** MemoTransfer as stored by the program */
|
||||||
export interface MemoTransfer {
|
export interface MemoTransfer {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { struct } from '@solana/buffer-layout';
|
import { struct } from '@solana/buffer-layout';
|
||||||
import { publicKey } from '@solana/buffer-layout-utils';
|
import { publicKey } from '@solana/buffer-layout-utils';
|
||||||
import { PublicKey } from '@solana/web3.js';
|
import type { PublicKey } from '@solana/web3.js';
|
||||||
import { Mint } from '../state/mint';
|
import type { Mint } from '../state/mint.js';
|
||||||
import { ExtensionType, getExtensionData } from './extensionType';
|
import { ExtensionType, getExtensionData } from './extensionType.js';
|
||||||
|
|
||||||
/** MintCloseAuthority as stored by the program */
|
/** MintCloseAuthority as stored by the program */
|
||||||
export interface MintCloseAuthority {
|
export interface MintCloseAuthority {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { struct } from '@solana/buffer-layout';
|
import { struct } from '@solana/buffer-layout';
|
||||||
import { Mint } from '../state/mint';
|
import type { Mint } from '../state/mint.js';
|
||||||
import { ExtensionType, getExtensionData } from './extensionType';
|
import { ExtensionType, getExtensionData } from './extensionType.js';
|
||||||
|
|
||||||
/** Non-transferable state as stored by the program */
|
/** Non-transferable state as stored by the program */
|
||||||
export interface NonTransferable {} // eslint-disable-line
|
export interface NonTransferable {} // eslint-disable-line
|
||||||
|
|
|
@ -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 {
|
import {
|
||||||
ConfirmOptions,
|
|
||||||
Connection,
|
|
||||||
PublicKey,
|
|
||||||
sendAndConfirmTransaction,
|
|
||||||
Signer,
|
|
||||||
Transaction,
|
|
||||||
TransactionSignature,
|
|
||||||
} from '@solana/web3.js';
|
|
||||||
import { TOKEN_2022_PROGRAM_ID } from '../../constants';
|
|
||||||
import {
|
|
||||||
createTransferCheckedWithFeeInstruction,
|
|
||||||
createHarvestWithheldTokensToMintInstruction,
|
createHarvestWithheldTokensToMintInstruction,
|
||||||
|
createTransferCheckedWithFeeInstruction,
|
||||||
createWithdrawWithheldTokensFromAccountsInstruction,
|
createWithdrawWithheldTokensFromAccountsInstruction,
|
||||||
createWithdrawWithheldTokensFromMintInstruction,
|
createWithdrawWithheldTokensFromMintInstruction,
|
||||||
} from './instructions';
|
} from './instructions.js';
|
||||||
import { getSigners } from '../../actions/internal';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transfer tokens from one account to another, asserting the transfer fee, token mint, and decimals
|
* Transfer tokens from one account to another, asserting the transfer fee, token mint, and decimals
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
export * from './actions';
|
export * from './actions.js';
|
||||||
export * from './instructions';
|
export * from './instructions.js';
|
||||||
export * from './state';
|
export * from './state.js';
|
||||||
|
|
|
@ -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 { 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 {
|
import {
|
||||||
TokenUnsupportedInstructionError,
|
|
||||||
TokenInvalidInstructionDataError,
|
TokenInvalidInstructionDataError,
|
||||||
TokenInvalidInstructionKeysError,
|
TokenInvalidInstructionKeysError,
|
||||||
TokenInvalidInstructionProgramError,
|
TokenInvalidInstructionProgramError,
|
||||||
TokenInvalidInstructionTypeError,
|
TokenInvalidInstructionTypeError,
|
||||||
} from '../../errors';
|
TokenUnsupportedInstructionError,
|
||||||
import { TokenInstruction } from '../../instructions/types';
|
} from '../../errors.js';
|
||||||
import { programSupportsExtensions, TOKEN_2022_PROGRAM_ID } from '../../constants';
|
import { TokenInstruction } from '../../instructions/types.js';
|
||||||
|
|
||||||
export enum TransferFeeInstruction {
|
export enum TransferFeeInstruction {
|
||||||
InitializeTransferFeeConfig = 0,
|
InitializeTransferFeeConfig = 0,
|
||||||
|
@ -31,7 +32,7 @@ export interface InitializeTransferFeeConfigInstructionData {
|
||||||
withdrawWithheldAuthorityOption: 1 | 0;
|
withdrawWithheldAuthorityOption: 1 | 0;
|
||||||
withdrawWithheldAuthority: PublicKey;
|
withdrawWithheldAuthority: PublicKey;
|
||||||
transferFeeBasisPoints: number;
|
transferFeeBasisPoints: number;
|
||||||
maximumFee: BigInt;
|
maximumFee: bigint;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** TODO: docs */
|
/** TODO: docs */
|
||||||
|
@ -63,7 +64,7 @@ export function createInitializeTransferFeeConfigInstruction(
|
||||||
transferFeeConfigAuthority: PublicKey | null,
|
transferFeeConfigAuthority: PublicKey | null,
|
||||||
withdrawWithheldAuthority: PublicKey | null,
|
withdrawWithheldAuthority: PublicKey | null,
|
||||||
transferFeeBasisPoints: number,
|
transferFeeBasisPoints: number,
|
||||||
maximumFee: BigInt,
|
maximumFee: bigint,
|
||||||
programId = TOKEN_2022_PROGRAM_ID
|
programId = TOKEN_2022_PROGRAM_ID
|
||||||
): TransactionInstruction {
|
): TransactionInstruction {
|
||||||
if (!programSupportsExtensions(programId)) {
|
if (!programSupportsExtensions(programId)) {
|
||||||
|
@ -101,7 +102,7 @@ export interface DecodedInitializeTransferFeeConfigInstruction {
|
||||||
transferFeeConfigAuthority: PublicKey | null;
|
transferFeeConfigAuthority: PublicKey | null;
|
||||||
withdrawWithheldAuthority: PublicKey | null;
|
withdrawWithheldAuthority: PublicKey | null;
|
||||||
transferFeeBasisPoints: number;
|
transferFeeBasisPoints: number;
|
||||||
maximumFee: BigInt;
|
maximumFee: bigint;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,7 +154,7 @@ export interface DecodedInitializeTransferFeeConfigInstructionUnchecked {
|
||||||
transferFeeConfigAuthority: PublicKey | null;
|
transferFeeConfigAuthority: PublicKey | null;
|
||||||
withdrawWithheldAuthority: PublicKey | null;
|
withdrawWithheldAuthority: PublicKey | null;
|
||||||
transferFeeBasisPoints: number;
|
transferFeeBasisPoints: number;
|
||||||
maximumFee: BigInt;
|
maximumFee: bigint;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,9 +201,9 @@ export function decodeInitializeTransferFeeConfigInstructionUnchecked({
|
||||||
export interface TransferCheckedWithFeeInstructionData {
|
export interface TransferCheckedWithFeeInstructionData {
|
||||||
instruction: TokenInstruction.TransferFeeExtension;
|
instruction: TokenInstruction.TransferFeeExtension;
|
||||||
transferFeeInstruction: TransferFeeInstruction.TransferCheckedWithFee;
|
transferFeeInstruction: TransferFeeInstruction.TransferCheckedWithFee;
|
||||||
amount: BigInt;
|
amount: bigint;
|
||||||
decimals: number;
|
decimals: number;
|
||||||
fee: BigInt;
|
fee: bigint;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const transferCheckedWithFeeInstructionData = struct<TransferCheckedWithFeeInstructionData>([
|
export const transferCheckedWithFeeInstructionData = struct<TransferCheckedWithFeeInstructionData>([
|
||||||
|
@ -233,9 +234,9 @@ export function createTransferCheckedWithFeeInstruction(
|
||||||
mint: PublicKey,
|
mint: PublicKey,
|
||||||
destination: PublicKey,
|
destination: PublicKey,
|
||||||
authority: PublicKey,
|
authority: PublicKey,
|
||||||
amount: BigInt,
|
amount: bigint,
|
||||||
decimals: number,
|
decimals: number,
|
||||||
fee: BigInt,
|
fee: bigint,
|
||||||
multiSigners: Signer[] = [],
|
multiSigners: Signer[] = [],
|
||||||
programId = TOKEN_2022_PROGRAM_ID
|
programId = TOKEN_2022_PROGRAM_ID
|
||||||
): TransactionInstruction {
|
): TransactionInstruction {
|
||||||
|
@ -277,9 +278,9 @@ export interface DecodedTransferCheckedWithFeeInstruction {
|
||||||
data: {
|
data: {
|
||||||
instruction: TokenInstruction.TransferFeeExtension;
|
instruction: TokenInstruction.TransferFeeExtension;
|
||||||
transferFeeInstruction: TransferFeeInstruction.TransferCheckedWithFee;
|
transferFeeInstruction: TransferFeeInstruction.TransferCheckedWithFee;
|
||||||
amount: BigInt;
|
amount: bigint;
|
||||||
decimals: number;
|
decimals: number;
|
||||||
fee: BigInt;
|
fee: bigint;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -336,9 +337,9 @@ export interface DecodedTransferCheckedWithFeeInstructionUnchecked {
|
||||||
data: {
|
data: {
|
||||||
instruction: TokenInstruction.TransferFeeExtension;
|
instruction: TokenInstruction.TransferFeeExtension;
|
||||||
transferFeeInstruction: TransferFeeInstruction.TransferCheckedWithFee;
|
transferFeeInstruction: TransferFeeInstruction.TransferCheckedWithFee;
|
||||||
amount: BigInt;
|
amount: bigint;
|
||||||
decimals: number;
|
decimals: number;
|
||||||
fee: BigInt;
|
fee: bigint;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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, u64 } from '@solana/buffer-layout-utils';
|
||||||
import { PublicKey } from '@solana/web3.js';
|
import type { PublicKey } from '@solana/web3.js';
|
||||||
import { Account } from '../../state';
|
import type { Account } from '../../state/account.js';
|
||||||
import { Mint } from '../../state/mint';
|
import type { Mint } from '../../state/mint.js';
|
||||||
import { ExtensionType, getExtensionData } from '../extensionType';
|
import { ExtensionType, getExtensionData } from '../extensionType.js';
|
||||||
|
|
||||||
export const MAX_FEE_BASIS_POINTS = 10_000;
|
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 */
|
/** TransferFeeConfig as stored by the program */
|
||||||
export interface TransferFee {
|
export interface TransferFee {
|
||||||
/** First epoch where the transfer fee takes effect */
|
/** First epoch where the transfer fee takes effect */
|
||||||
epoch: BigInt;
|
epoch: bigint;
|
||||||
/** Maximum fee assessed on transfers, expressed as an amount of tokens */
|
/** 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
|
* Amount of transfer collected as fees, expressed as basis points of the
|
||||||
* transfer amount, ie. increments of 0.01%
|
* transfer amount, ie. increments of 0.01%
|
||||||
|
@ -28,7 +29,7 @@ export interface TransferFeeConfig {
|
||||||
/** Withdraw from mint instructions must be signed by this key */
|
/** Withdraw from mint instructions must be signed by this key */
|
||||||
withdrawWithheldAuthority: PublicKey;
|
withdrawWithheldAuthority: PublicKey;
|
||||||
/** Withheld transfer fee tokens that have been moved to the mint for withdrawal */
|
/** 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 */
|
/** Older transfer fee, used if the current epoch < newerTransferFee.epoch */
|
||||||
olderTransferFee: TransferFee;
|
olderTransferFee: TransferFee;
|
||||||
/** Newer transfer fee, used if the current epoch >= newerTransferFee.epoch */
|
/** 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. */
|
/** Transfer fee amount data for accounts. */
|
||||||
export interface TransferFeeAmount {
|
export interface TransferFeeAmount {
|
||||||
/** Withheld transfer fee tokens that can be claimed by the fee authority */
|
/** Withheld transfer fee tokens that can be claimed by the fee authority */
|
||||||
withheldAmount: BigInt;
|
withheldAmount: bigint;
|
||||||
}
|
}
|
||||||
/** Buffer layout for de/serializing */
|
/** Buffer layout for de/serializing */
|
||||||
export const TransferFeeAmountLayout = struct<TransferFeeAmount>([u64('withheldAmount')]);
|
export const TransferFeeAmountLayout = struct<TransferFeeAmount>([u64('withheldAmount')]);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
export * from './extensions/index';
|
export * from './extensions/index.js';
|
||||||
export * from './instructions/index';
|
export * from './instructions/index.js';
|
||||||
export * from './state/index';
|
export * from './state/index.js';
|
||||||
export * from './actions/index';
|
export * from './actions/index.js';
|
||||||
export * from './constants';
|
export * from './constants.js';
|
||||||
export * from './errors';
|
export * from './errors.js';
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
import { struct, u8 } from '@solana/buffer-layout';
|
import { struct, u8 } from '@solana/buffer-layout';
|
||||||
import { u64 } from '@solana/buffer-layout-utils';
|
import { u64 } from '@solana/buffer-layout-utils';
|
||||||
import { AccountMeta, PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
|
import type { AccountMeta, PublicKey, Signer } from '@solana/web3.js';
|
||||||
import { TOKEN_PROGRAM_ID } from '../constants';
|
import { TransactionInstruction } from '@solana/web3.js';
|
||||||
|
import { TOKEN_PROGRAM_ID } from '../constants.js';
|
||||||
import {
|
import {
|
||||||
TokenInvalidInstructionDataError,
|
TokenInvalidInstructionDataError,
|
||||||
TokenInvalidInstructionKeysError,
|
TokenInvalidInstructionKeysError,
|
||||||
TokenInvalidInstructionProgramError,
|
TokenInvalidInstructionProgramError,
|
||||||
TokenInvalidInstructionTypeError,
|
TokenInvalidInstructionTypeError,
|
||||||
} from '../errors';
|
} from '../errors.js';
|
||||||
import { addSigners } from './internal';
|
import { addSigners } from './internal.js';
|
||||||
import { TokenInstruction } from './types';
|
import { TokenInstruction } from './types.js';
|
||||||
|
|
||||||
/** TODO: docs */
|
/** TODO: docs */
|
||||||
export interface ApproveInstructionData {
|
export interface ApproveInstructionData {
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
import { struct, u8 } from '@solana/buffer-layout';
|
import { struct, u8 } from '@solana/buffer-layout';
|
||||||
import { u64 } from '@solana/buffer-layout-utils';
|
import { u64 } from '@solana/buffer-layout-utils';
|
||||||
import { AccountMeta, PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
|
import type { AccountMeta, PublicKey, Signer } from '@solana/web3.js';
|
||||||
import { TOKEN_PROGRAM_ID } from '../constants';
|
import { TransactionInstruction } from '@solana/web3.js';
|
||||||
|
import { TOKEN_PROGRAM_ID } from '../constants.js';
|
||||||
import {
|
import {
|
||||||
TokenInvalidInstructionDataError,
|
TokenInvalidInstructionDataError,
|
||||||
TokenInvalidInstructionKeysError,
|
TokenInvalidInstructionKeysError,
|
||||||
TokenInvalidInstructionProgramError,
|
TokenInvalidInstructionProgramError,
|
||||||
TokenInvalidInstructionTypeError,
|
TokenInvalidInstructionTypeError,
|
||||||
} from '../errors';
|
} from '../errors.js';
|
||||||
import { addSigners } from './internal';
|
import { addSigners } from './internal.js';
|
||||||
import { TokenInstruction } from './types';
|
import { TokenInstruction } from './types.js';
|
||||||
|
|
||||||
/** TODO: docs */
|
/** TODO: docs */
|
||||||
export interface ApproveCheckedInstructionData {
|
export interface ApproveCheckedInstructionData {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { PublicKey, SystemProgram, SYSVAR_RENT_PUBKEY, TransactionInstruction } from '@solana/web3.js';
|
import type { PublicKey } from '@solana/web3.js';
|
||||||
import { ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_PROGRAM_ID } from '../constants';
|
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
|
* Construct an AssociatedTokenAccount instruction
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
import { struct, u8 } from '@solana/buffer-layout';
|
import { struct, u8 } from '@solana/buffer-layout';
|
||||||
import { u64 } from '@solana/buffer-layout-utils';
|
import { u64 } from '@solana/buffer-layout-utils';
|
||||||
import { AccountMeta, PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
|
import type { AccountMeta, PublicKey, Signer } from '@solana/web3.js';
|
||||||
import { TOKEN_PROGRAM_ID } from '../constants';
|
import { TransactionInstruction } from '@solana/web3.js';
|
||||||
|
import { TOKEN_PROGRAM_ID } from '../constants.js';
|
||||||
import {
|
import {
|
||||||
TokenInvalidInstructionDataError,
|
TokenInvalidInstructionDataError,
|
||||||
TokenInvalidInstructionKeysError,
|
TokenInvalidInstructionKeysError,
|
||||||
TokenInvalidInstructionProgramError,
|
TokenInvalidInstructionProgramError,
|
||||||
TokenInvalidInstructionTypeError,
|
TokenInvalidInstructionTypeError,
|
||||||
} from '../errors';
|
} from '../errors.js';
|
||||||
import { addSigners } from './internal';
|
import { addSigners } from './internal.js';
|
||||||
import { TokenInstruction } from './types';
|
import { TokenInstruction } from './types.js';
|
||||||
|
|
||||||
/** TODO: docs */
|
/** TODO: docs */
|
||||||
export interface BurnInstructionData {
|
export interface BurnInstructionData {
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
import { struct, u8 } from '@solana/buffer-layout';
|
import { struct, u8 } from '@solana/buffer-layout';
|
||||||
import { u64 } from '@solana/buffer-layout-utils';
|
import { u64 } from '@solana/buffer-layout-utils';
|
||||||
import { AccountMeta, PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
|
import type { AccountMeta, PublicKey, Signer } from '@solana/web3.js';
|
||||||
import { TOKEN_PROGRAM_ID } from '../constants';
|
import { TransactionInstruction } from '@solana/web3.js';
|
||||||
|
import { TOKEN_PROGRAM_ID } from '../constants.js';
|
||||||
import {
|
import {
|
||||||
TokenInvalidInstructionDataError,
|
TokenInvalidInstructionDataError,
|
||||||
TokenInvalidInstructionKeysError,
|
TokenInvalidInstructionKeysError,
|
||||||
TokenInvalidInstructionProgramError,
|
TokenInvalidInstructionProgramError,
|
||||||
TokenInvalidInstructionTypeError,
|
TokenInvalidInstructionTypeError,
|
||||||
} from '../errors';
|
} from '../errors.js';
|
||||||
import { addSigners } from './internal';
|
import { addSigners } from './internal.js';
|
||||||
import { TokenInstruction } from './types';
|
import { TokenInstruction } from './types.js';
|
||||||
|
|
||||||
/** TODO: docs */
|
/** TODO: docs */
|
||||||
export interface BurnCheckedInstructionData {
|
export interface BurnCheckedInstructionData {
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
import { struct, u8 } from '@solana/buffer-layout';
|
import { struct, u8 } from '@solana/buffer-layout';
|
||||||
import { AccountMeta, PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
|
import type { AccountMeta, PublicKey, Signer } from '@solana/web3.js';
|
||||||
import { TOKEN_PROGRAM_ID } from '../constants';
|
import { TransactionInstruction } from '@solana/web3.js';
|
||||||
|
import { TOKEN_PROGRAM_ID } from '../constants.js';
|
||||||
import {
|
import {
|
||||||
TokenInvalidInstructionDataError,
|
TokenInvalidInstructionDataError,
|
||||||
TokenInvalidInstructionKeysError,
|
TokenInvalidInstructionKeysError,
|
||||||
TokenInvalidInstructionProgramError,
|
TokenInvalidInstructionProgramError,
|
||||||
TokenInvalidInstructionTypeError,
|
TokenInvalidInstructionTypeError,
|
||||||
} from '../errors';
|
} from '../errors.js';
|
||||||
import { addSigners } from './internal';
|
import { addSigners } from './internal.js';
|
||||||
import { TokenInstruction } from './types';
|
import { TokenInstruction } from './types.js';
|
||||||
|
|
||||||
/** TODO: docs */
|
/** TODO: docs */
|
||||||
export interface CloseAccountInstructionData {
|
export interface CloseAccountInstructionData {
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { struct, u8 } from '@solana/buffer-layout';
|
import { struct, u8 } from '@solana/buffer-layout';
|
||||||
import { PublicKey, TransactionInstruction, SystemProgram } from '@solana/web3.js';
|
import type { PublicKey } from '@solana/web3.js';
|
||||||
import { TOKEN_2022_PROGRAM_ID, NATIVE_MINT_2022 } from '../constants';
|
import { SystemProgram, TransactionInstruction } from '@solana/web3.js';
|
||||||
import { TokenInstruction } from './types';
|
import { NATIVE_MINT_2022, programSupportsExtensions, TOKEN_2022_PROGRAM_ID } from '../constants.js';
|
||||||
import { TokenUnsupportedInstructionError } from '../errors';
|
import { TokenUnsupportedInstructionError } from '../errors.js';
|
||||||
import { programSupportsExtensions } from '../constants';
|
import { TokenInstruction } from './types.js';
|
||||||
|
|
||||||
/** TODO: docs */
|
/** TODO: docs */
|
||||||
export interface CreateNativeMintInstructionData {
|
export interface CreateNativeMintInstructionData {
|
||||||
|
|
|
@ -1,27 +1,46 @@
|
||||||
import { u8 } from '@solana/buffer-layout';
|
import { u8 } from '@solana/buffer-layout';
|
||||||
import { TransactionInstruction } from '@solana/web3.js';
|
import type { TransactionInstruction } from '@solana/web3.js';
|
||||||
import { TOKEN_PROGRAM_ID } from '../constants';
|
import { TOKEN_PROGRAM_ID } from '../constants.js';
|
||||||
import { TokenInvalidInstructionDataError, TokenInvalidInstructionTypeError } from '../errors';
|
import { TokenInvalidInstructionDataError, TokenInvalidInstructionTypeError } from '../errors.js';
|
||||||
import { decodeApproveInstruction, DecodedApproveInstruction } from './approve';
|
import type { DecodedApproveInstruction } from './approve.js';
|
||||||
import { decodeApproveCheckedInstruction, DecodedApproveCheckedInstruction } from './approveChecked';
|
import { decodeApproveInstruction } from './approve.js';
|
||||||
import { decodeBurnInstruction, DecodedBurnInstruction } from './burn';
|
import type { DecodedApproveCheckedInstruction } from './approveChecked.js';
|
||||||
import { decodeBurnCheckedInstruction, DecodedBurnCheckedInstruction } from './burnChecked';
|
import { decodeApproveCheckedInstruction } from './approveChecked.js';
|
||||||
import { decodeCloseAccountInstruction, DecodedCloseAccountInstruction } from './closeAccount';
|
import type { DecodedBurnInstruction } from './burn.js';
|
||||||
import { DecodedFreezeAccountInstruction, decodeFreezeAccountInstruction } from './freezeAccount';
|
import { decodeBurnInstruction } from './burn.js';
|
||||||
import { DecodedInitializeAccountInstruction, decodeInitializeAccountInstruction } from './initializeAccount';
|
import type { DecodedBurnCheckedInstruction } from './burnChecked.js';
|
||||||
import { DecodedInitializeAccount2Instruction, decodeInitializeAccount2Instruction } from './initializeAccount2';
|
import { decodeBurnCheckedInstruction } from './burnChecked.js';
|
||||||
import { DecodedInitializeAccount3Instruction, decodeInitializeAccount3Instruction } from './initializeAccount3';
|
import type { DecodedCloseAccountInstruction } from './closeAccount.js';
|
||||||
import { DecodedInitializeMintInstruction, decodeInitializeMintInstruction } from './initializeMint';
|
import { decodeCloseAccountInstruction } from './closeAccount.js';
|
||||||
import { DecodedInitializeMultisigInstruction, decodeInitializeMultisigInstruction } from './initializeMultisig';
|
import type { DecodedFreezeAccountInstruction } from './freezeAccount.js';
|
||||||
import { DecodedMintToInstruction, decodeMintToInstruction } from './mintTo';
|
import { decodeFreezeAccountInstruction } from './freezeAccount.js';
|
||||||
import { DecodedMintToCheckedInstruction, decodeMintToCheckedInstruction } from './mintToChecked';
|
import type { DecodedInitializeAccountInstruction } from './initializeAccount.js';
|
||||||
import { DecodedRevokeInstruction, decodeRevokeInstruction } from './revoke';
|
import { decodeInitializeAccountInstruction } from './initializeAccount.js';
|
||||||
import { DecodedSetAuthorityInstruction, decodeSetAuthorityInstruction } from './setAuthority';
|
import type { DecodedInitializeAccount2Instruction } from './initializeAccount2.js';
|
||||||
import { DecodedSyncNativeInstruction, decodeSyncNativeInstruction } from './syncNative';
|
import { decodeInitializeAccount2Instruction } from './initializeAccount2.js';
|
||||||
import { DecodedThawAccountInstruction, decodeThawAccountInstruction } from './thawAccount';
|
import type { DecodedInitializeAccount3Instruction } from './initializeAccount3.js';
|
||||||
import { DecodedTransferInstruction, decodeTransferInstruction } from './transfer';
|
import { decodeInitializeAccount3Instruction } from './initializeAccount3.js';
|
||||||
import { DecodedTransferCheckedInstruction, decodeTransferCheckedInstruction } from './transferChecked';
|
import type { DecodedInitializeMintInstruction } from './initializeMint.js';
|
||||||
import { TokenInstruction } from './types';
|
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 */
|
/** TODO: docs */
|
||||||
export type DecodedInstruction =
|
export type DecodedInstruction =
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
import { struct, u8 } from '@solana/buffer-layout';
|
import { struct, u8 } from '@solana/buffer-layout';
|
||||||
import { AccountMeta, PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
|
import type { AccountMeta, PublicKey, Signer } from '@solana/web3.js';
|
||||||
import { TOKEN_PROGRAM_ID } from '../constants';
|
import { TransactionInstruction } from '@solana/web3.js';
|
||||||
|
import { TOKEN_PROGRAM_ID } from '../constants.js';
|
||||||
import {
|
import {
|
||||||
TokenInvalidInstructionDataError,
|
TokenInvalidInstructionDataError,
|
||||||
TokenInvalidInstructionKeysError,
|
TokenInvalidInstructionKeysError,
|
||||||
TokenInvalidInstructionProgramError,
|
TokenInvalidInstructionProgramError,
|
||||||
TokenInvalidInstructionTypeError,
|
TokenInvalidInstructionTypeError,
|
||||||
} from '../errors';
|
} from '../errors.js';
|
||||||
import { addSigners } from './internal';
|
import { addSigners } from './internal.js';
|
||||||
import { TokenInstruction } from './types';
|
import { TokenInstruction } from './types.js';
|
||||||
|
|
||||||
/** TODO: docs */
|
/** TODO: docs */
|
||||||
export interface FreezeAccountInstructionData {
|
export interface FreezeAccountInstructionData {
|
||||||
|
|
|
@ -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 './initializeMint.js'; // 0
|
||||||
export * from './initializeAccount'; // 1
|
export * from './initializeAccount.js'; // 1
|
||||||
export * from './initializeMultisig'; // 2
|
export * from './initializeMultisig.js'; // 2
|
||||||
export * from './transfer'; // 3
|
export * from './transfer.js'; // 3
|
||||||
export * from './approve'; // 4
|
export * from './approve.js'; // 4
|
||||||
export * from './revoke'; // 5
|
export * from './revoke.js'; // 5
|
||||||
export * from './setAuthority'; // 6
|
export * from './setAuthority.js'; // 6
|
||||||
export * from './mintTo'; // 7
|
export * from './mintTo.js'; // 7
|
||||||
export * from './burn'; // 8
|
export * from './burn.js'; // 8
|
||||||
export * from './closeAccount'; // 9
|
export * from './closeAccount.js'; // 9
|
||||||
export * from './freezeAccount'; // 10
|
export * from './freezeAccount.js'; // 10
|
||||||
export * from './thawAccount'; // 11
|
export * from './thawAccount.js'; // 11
|
||||||
export * from './transferChecked'; // 12
|
export * from './transferChecked.js'; // 12
|
||||||
export * from './approveChecked'; // 13
|
export * from './approveChecked.js'; // 13
|
||||||
export * from './mintToChecked'; // 14
|
export * from './mintToChecked.js'; // 14
|
||||||
export * from './burnChecked'; // 15
|
export * from './burnChecked.js'; // 15
|
||||||
export * from './initializeAccount2'; // 16
|
export * from './initializeAccount2.js'; // 16
|
||||||
export * from './syncNative'; // 17
|
export * from './syncNative.js'; // 17
|
||||||
export * from './initializeAccount3'; // 18
|
export * from './initializeAccount3.js'; // 18
|
||||||
export * from './initializeMultisig2'; // 19
|
export * from './initializeMultisig2.js'; // 19
|
||||||
export * from './initializeMint2'; // 20
|
export * from './initializeMint2.js'; // 20
|
||||||
export * from './initializeImmutableOwner'; // 22
|
export * from './initializeImmutableOwner.js'; // 22
|
||||||
export * from './initializeMintCloseAuthority'; // 23
|
export * from './initializeMintCloseAuthority.js'; // 23
|
||||||
export * from './reallocate'; // 29
|
export * from './reallocate.js'; // 29
|
||||||
export * from './createNativeMint'; // 31
|
export * from './createNativeMint.js'; // 31
|
||||||
export * from './initializeNonTransferableMint'; // 32
|
export * from './initializeNonTransferableMint.js'; // 32
|
||||||
|
|
||||||
export * from './decode';
|
|
||||||
|
|
||||||
export * from './associatedTokenAccount';
|
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
import { struct, u8 } from '@solana/buffer-layout';
|
import { struct, u8 } from '@solana/buffer-layout';
|
||||||
import { AccountMeta, PublicKey, SYSVAR_RENT_PUBKEY, TransactionInstruction } from '@solana/web3.js';
|
import type { AccountMeta, PublicKey } from '@solana/web3.js';
|
||||||
import { TOKEN_PROGRAM_ID } from '../constants';
|
import { SYSVAR_RENT_PUBKEY, TransactionInstruction } from '@solana/web3.js';
|
||||||
|
import { TOKEN_PROGRAM_ID } from '../constants.js';
|
||||||
import {
|
import {
|
||||||
TokenInvalidInstructionDataError,
|
TokenInvalidInstructionDataError,
|
||||||
TokenInvalidInstructionKeysError,
|
TokenInvalidInstructionKeysError,
|
||||||
TokenInvalidInstructionProgramError,
|
TokenInvalidInstructionProgramError,
|
||||||
TokenInvalidInstructionTypeError,
|
TokenInvalidInstructionTypeError,
|
||||||
} from '../errors';
|
} from '../errors.js';
|
||||||
import { TokenInstruction } from './types';
|
import { TokenInstruction } from './types.js';
|
||||||
|
|
||||||
/** TODO: docs */
|
/** TODO: docs */
|
||||||
export interface InitializeAccountInstructionData {
|
export interface InitializeAccountInstructionData {
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
import { TokenInstruction } from './types';
|
|
||||||
import { struct, u8 } from '@solana/buffer-layout';
|
import { struct, u8 } from '@solana/buffer-layout';
|
||||||
import { publicKey } from '@solana/buffer-layout-utils';
|
import { publicKey } from '@solana/buffer-layout-utils';
|
||||||
import { AccountMeta, PublicKey, SYSVAR_RENT_PUBKEY, TransactionInstruction } from '@solana/web3.js';
|
import type { AccountMeta, PublicKey } from '@solana/web3.js';
|
||||||
import { TOKEN_PROGRAM_ID } from '../constants';
|
import { SYSVAR_RENT_PUBKEY, TransactionInstruction } from '@solana/web3.js';
|
||||||
|
import { TOKEN_PROGRAM_ID } from '../constants.js';
|
||||||
import {
|
import {
|
||||||
TokenInvalidInstructionDataError,
|
TokenInvalidInstructionDataError,
|
||||||
TokenInvalidInstructionKeysError,
|
TokenInvalidInstructionKeysError,
|
||||||
TokenInvalidInstructionProgramError,
|
TokenInvalidInstructionProgramError,
|
||||||
TokenInvalidInstructionTypeError,
|
TokenInvalidInstructionTypeError,
|
||||||
} from '../errors';
|
} from '../errors.js';
|
||||||
|
import { TokenInstruction } from './types.js';
|
||||||
|
|
||||||
export interface InitializeAccount2InstructionData {
|
export interface InitializeAccount2InstructionData {
|
||||||
instruction: TokenInstruction.InitializeAccount2;
|
instruction: TokenInstruction.InitializeAccount2;
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
import { TokenInstruction } from './types';
|
|
||||||
import { struct, u8 } from '@solana/buffer-layout';
|
import { struct, u8 } from '@solana/buffer-layout';
|
||||||
import { publicKey } from '@solana/buffer-layout-utils';
|
import { publicKey } from '@solana/buffer-layout-utils';
|
||||||
import { AccountMeta, PublicKey, TransactionInstruction } from '@solana/web3.js';
|
import type { AccountMeta, PublicKey } from '@solana/web3.js';
|
||||||
import { TOKEN_PROGRAM_ID } from '../constants';
|
import { TransactionInstruction } from '@solana/web3.js';
|
||||||
|
import { TOKEN_PROGRAM_ID } from '../constants.js';
|
||||||
import {
|
import {
|
||||||
TokenInvalidInstructionDataError,
|
TokenInvalidInstructionDataError,
|
||||||
TokenInvalidInstructionKeysError,
|
TokenInvalidInstructionKeysError,
|
||||||
TokenInvalidInstructionProgramError,
|
TokenInvalidInstructionProgramError,
|
||||||
TokenInvalidInstructionTypeError,
|
TokenInvalidInstructionTypeError,
|
||||||
} from '../errors';
|
} from '../errors.js';
|
||||||
|
import { TokenInstruction } from './types.js';
|
||||||
|
|
||||||
export interface InitializeAccount3InstructionData {
|
export interface InitializeAccount3InstructionData {
|
||||||
instruction: TokenInstruction.InitializeAccount3;
|
instruction: TokenInstruction.InitializeAccount3;
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
import { struct, u8 } from '@solana/buffer-layout';
|
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 {
|
import {
|
||||||
TokenInvalidInstructionDataError,
|
TokenInvalidInstructionDataError,
|
||||||
TokenInvalidInstructionKeysError,
|
TokenInvalidInstructionKeysError,
|
||||||
TokenInvalidInstructionProgramError,
|
TokenInvalidInstructionProgramError,
|
||||||
TokenInvalidInstructionTypeError,
|
TokenInvalidInstructionTypeError,
|
||||||
} from '../errors';
|
} from '../errors.js';
|
||||||
import { TokenInstruction } from './types';
|
import { TokenInstruction } from './types.js';
|
||||||
|
|
||||||
/** Deserialized instruction for the initiation of an immutable owner account */
|
/** Deserialized instruction for the initiation of an immutable owner account */
|
||||||
export interface InitializeImmutableOwnerInstructionData {
|
export interface InitializeImmutableOwnerInstructionData {
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
import { struct, u8 } from '@solana/buffer-layout';
|
import { struct, u8 } from '@solana/buffer-layout';
|
||||||
import { publicKey } from '@solana/buffer-layout-utils';
|
import { publicKey } from '@solana/buffer-layout-utils';
|
||||||
import { AccountMeta, PublicKey, SYSVAR_RENT_PUBKEY, TransactionInstruction } from '@solana/web3.js';
|
import type { AccountMeta } from '@solana/web3.js';
|
||||||
import { TOKEN_PROGRAM_ID } from '../constants';
|
import { PublicKey, SYSVAR_RENT_PUBKEY, TransactionInstruction } from '@solana/web3.js';
|
||||||
|
import { TOKEN_PROGRAM_ID } from '../constants.js';
|
||||||
import {
|
import {
|
||||||
TokenInvalidInstructionDataError,
|
TokenInvalidInstructionDataError,
|
||||||
TokenInvalidInstructionKeysError,
|
TokenInvalidInstructionKeysError,
|
||||||
TokenInvalidInstructionProgramError,
|
TokenInvalidInstructionProgramError,
|
||||||
TokenInvalidInstructionTypeError,
|
TokenInvalidInstructionTypeError,
|
||||||
} from '../errors';
|
} from '../errors.js';
|
||||||
import { TokenInstruction } from './types';
|
import { TokenInstruction } from './types.js';
|
||||||
|
|
||||||
/** TODO: docs */
|
/** TODO: docs */
|
||||||
export interface InitializeMintInstructionData {
|
export interface InitializeMintInstructionData {
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
import { struct, u8 } from '@solana/buffer-layout';
|
import { struct, u8 } from '@solana/buffer-layout';
|
||||||
import { publicKey } from '@solana/buffer-layout-utils';
|
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 {
|
import {
|
||||||
TokenUnsupportedInstructionError,
|
|
||||||
TokenInvalidInstructionDataError,
|
TokenInvalidInstructionDataError,
|
||||||
TokenInvalidInstructionKeysError,
|
TokenInvalidInstructionKeysError,
|
||||||
TokenInvalidInstructionProgramError,
|
TokenInvalidInstructionProgramError,
|
||||||
TokenInvalidInstructionTypeError,
|
TokenInvalidInstructionTypeError,
|
||||||
} from '../errors';
|
TokenUnsupportedInstructionError,
|
||||||
import { TokenInstruction } from './types';
|
} from '../errors.js';
|
||||||
import { programSupportsExtensions } from '../constants';
|
import { TokenInstruction } from './types.js';
|
||||||
|
|
||||||
/** TODO: docs */
|
/** TODO: docs */
|
||||||
export interface InitializeMintCloseAuthorityInstructionData {
|
export interface InitializeMintCloseAuthorityInstructionData {
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
import { struct, u8 } from '@solana/buffer-layout';
|
import { struct, u8 } from '@solana/buffer-layout';
|
||||||
import { AccountMeta, PublicKey, SYSVAR_RENT_PUBKEY, TransactionInstruction } from '@solana/web3.js';
|
import type { AccountMeta, PublicKey } from '@solana/web3.js';
|
||||||
import { TOKEN_PROGRAM_ID } from '../constants';
|
import { SYSVAR_RENT_PUBKEY, TransactionInstruction } from '@solana/web3.js';
|
||||||
|
import { TOKEN_PROGRAM_ID } from '../constants.js';
|
||||||
import {
|
import {
|
||||||
TokenInvalidInstructionDataError,
|
TokenInvalidInstructionDataError,
|
||||||
TokenInvalidInstructionKeysError,
|
TokenInvalidInstructionKeysError,
|
||||||
TokenInvalidInstructionProgramError,
|
TokenInvalidInstructionProgramError,
|
||||||
TokenInvalidInstructionTypeError,
|
TokenInvalidInstructionTypeError,
|
||||||
} from '../errors';
|
} from '../errors.js';
|
||||||
import { TokenInstruction } from './types';
|
import { TokenInstruction } from './types.js';
|
||||||
|
|
||||||
/** TODO: docs */
|
/** TODO: docs */
|
||||||
export interface InitializeMultisigInstructionData {
|
export interface InitializeMultisigInstructionData {
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
import { struct, u8 } from '@solana/buffer-layout';
|
import { struct, u8 } from '@solana/buffer-layout';
|
||||||
import { PublicKey, TransactionInstruction } from '@solana/web3.js';
|
import type { PublicKey } from '@solana/web3.js';
|
||||||
import { TokenInstruction } from './types';
|
import { TransactionInstruction } from '@solana/web3.js';
|
||||||
import { TokenUnsupportedInstructionError } from '../errors';
|
import { programSupportsExtensions } from '../constants.js';
|
||||||
import { programSupportsExtensions } from '../constants';
|
import { TokenUnsupportedInstructionError } from '../errors.js';
|
||||||
|
import { TokenInstruction } from './types.js';
|
||||||
|
|
||||||
/** Deserialized instruction for the initiation of an immutable owner account */
|
/** Deserialized instruction for the initiation of an immutable owner account */
|
||||||
export interface InitializeNonTransferableMintInstructionData {
|
export interface InitializeNonTransferableMintInstructionData {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { AccountMeta, PublicKey, Signer } from '@solana/web3.js';
|
import type { AccountMeta, PublicKey, Signer } from '@solana/web3.js';
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
export function addSigners(keys: AccountMeta[], ownerOrAuthority: PublicKey, multiSigners: Signer[]): AccountMeta[] {
|
export function addSigners(keys: AccountMeta[], ownerOrAuthority: PublicKey, multiSigners: Signer[]): AccountMeta[] {
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
import { struct, u8 } from '@solana/buffer-layout';
|
import { struct, u8 } from '@solana/buffer-layout';
|
||||||
import { u64 } from '@solana/buffer-layout-utils';
|
import { u64 } from '@solana/buffer-layout-utils';
|
||||||
import { AccountMeta, PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
|
import type { AccountMeta, PublicKey, Signer } from '@solana/web3.js';
|
||||||
import { TOKEN_PROGRAM_ID } from '../constants';
|
import { TransactionInstruction } from '@solana/web3.js';
|
||||||
|
import { TOKEN_PROGRAM_ID } from '../constants.js';
|
||||||
import {
|
import {
|
||||||
TokenInvalidInstructionDataError,
|
TokenInvalidInstructionDataError,
|
||||||
TokenInvalidInstructionKeysError,
|
TokenInvalidInstructionKeysError,
|
||||||
TokenInvalidInstructionProgramError,
|
TokenInvalidInstructionProgramError,
|
||||||
TokenInvalidInstructionTypeError,
|
TokenInvalidInstructionTypeError,
|
||||||
} from '../errors';
|
} from '../errors.js';
|
||||||
import { addSigners } from './internal';
|
import { addSigners } from './internal.js';
|
||||||
import { TokenInstruction } from './types';
|
import { TokenInstruction } from './types.js';
|
||||||
|
|
||||||
/** TODO: docs */
|
/** TODO: docs */
|
||||||
export interface MintToInstructionData {
|
export interface MintToInstructionData {
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
import { struct, u8 } from '@solana/buffer-layout';
|
import { struct, u8 } from '@solana/buffer-layout';
|
||||||
import { u64 } from '@solana/buffer-layout-utils';
|
import { u64 } from '@solana/buffer-layout-utils';
|
||||||
import { AccountMeta, PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
|
import type { AccountMeta, PublicKey, Signer } from '@solana/web3.js';
|
||||||
import { TOKEN_PROGRAM_ID } from '../constants';
|
import { TransactionInstruction } from '@solana/web3.js';
|
||||||
|
import { TOKEN_PROGRAM_ID } from '../constants.js';
|
||||||
import {
|
import {
|
||||||
TokenInvalidInstructionDataError,
|
TokenInvalidInstructionDataError,
|
||||||
TokenInvalidInstructionKeysError,
|
TokenInvalidInstructionKeysError,
|
||||||
TokenInvalidInstructionProgramError,
|
TokenInvalidInstructionProgramError,
|
||||||
TokenInvalidInstructionTypeError,
|
TokenInvalidInstructionTypeError,
|
||||||
} from '../errors';
|
} from '../errors.js';
|
||||||
import { addSigners } from './internal';
|
import { addSigners } from './internal.js';
|
||||||
import { TokenInstruction } from './types';
|
import { TokenInstruction } from './types.js';
|
||||||
|
|
||||||
/** TODO: docs */
|
/** TODO: docs */
|
||||||
export interface MintToCheckedInstructionData {
|
export interface MintToCheckedInstructionData {
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
import { seq, struct, u8, u16 } from '@solana/buffer-layout';
|
import { seq, struct, u16, u8 } from '@solana/buffer-layout';
|
||||||
import { PublicKey, Signer, SystemProgram, TransactionInstruction } from '@solana/web3.js';
|
import type { PublicKey, Signer } from '@solana/web3.js';
|
||||||
import { programSupportsExtensions, TOKEN_2022_PROGRAM_ID } from '../constants';
|
import { SystemProgram, TransactionInstruction } from '@solana/web3.js';
|
||||||
import { TokenUnsupportedInstructionError } from '../errors';
|
import { programSupportsExtensions, TOKEN_2022_PROGRAM_ID } from '../constants.js';
|
||||||
import { addSigners } from './internal';
|
import { TokenUnsupportedInstructionError } from '../errors.js';
|
||||||
import { TokenInstruction } from './types';
|
import type { ExtensionType } from '../extensions/extensionType.js';
|
||||||
import { ExtensionType } from '../extensions';
|
import { addSigners } from './internal.js';
|
||||||
|
import { TokenInstruction } from './types.js';
|
||||||
|
|
||||||
/** TODO: docs */
|
/** TODO: docs */
|
||||||
export interface ReallocateInstructionData {
|
export interface ReallocateInstructionData {
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
import { struct, u8 } from '@solana/buffer-layout';
|
import { struct, u8 } from '@solana/buffer-layout';
|
||||||
import { AccountMeta, PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
|
import type { AccountMeta, PublicKey, Signer } from '@solana/web3.js';
|
||||||
import { TOKEN_PROGRAM_ID } from '../constants';
|
import { TransactionInstruction } from '@solana/web3.js';
|
||||||
|
import { TOKEN_PROGRAM_ID } from '../constants.js';
|
||||||
import {
|
import {
|
||||||
TokenInvalidInstructionDataError,
|
TokenInvalidInstructionDataError,
|
||||||
TokenInvalidInstructionKeysError,
|
TokenInvalidInstructionKeysError,
|
||||||
TokenInvalidInstructionProgramError,
|
TokenInvalidInstructionProgramError,
|
||||||
TokenInvalidInstructionTypeError,
|
TokenInvalidInstructionTypeError,
|
||||||
} from '../errors';
|
} from '../errors.js';
|
||||||
import { addSigners } from './internal';
|
import { addSigners } from './internal.js';
|
||||||
import { TokenInstruction } from './types';
|
import { TokenInstruction } from './types.js';
|
||||||
|
|
||||||
/** TODO: docs */
|
/** TODO: docs */
|
||||||
export interface RevokeInstructionData {
|
export interface RevokeInstructionData {
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
import { struct, u8 } from '@solana/buffer-layout';
|
import { struct, u8 } from '@solana/buffer-layout';
|
||||||
import { publicKey } from '@solana/buffer-layout-utils';
|
import { publicKey } from '@solana/buffer-layout-utils';
|
||||||
import { AccountMeta, PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
|
import type { AccountMeta, Signer } from '@solana/web3.js';
|
||||||
import { TOKEN_PROGRAM_ID } from '../constants';
|
import { PublicKey, TransactionInstruction } from '@solana/web3.js';
|
||||||
|
import { TOKEN_PROGRAM_ID } from '../constants.js';
|
||||||
import {
|
import {
|
||||||
TokenInvalidInstructionDataError,
|
TokenInvalidInstructionDataError,
|
||||||
TokenInvalidInstructionKeysError,
|
TokenInvalidInstructionKeysError,
|
||||||
TokenInvalidInstructionProgramError,
|
TokenInvalidInstructionProgramError,
|
||||||
TokenInvalidInstructionTypeError,
|
TokenInvalidInstructionTypeError,
|
||||||
} from '../errors';
|
} from '../errors.js';
|
||||||
import { addSigners } from './internal';
|
import { addSigners } from './internal.js';
|
||||||
import { TokenInstruction } from './types';
|
import { TokenInstruction } from './types.js';
|
||||||
|
|
||||||
/** Authority types defined by the program */
|
/** Authority types defined by the program */
|
||||||
export enum AuthorityType {
|
export enum AuthorityType {
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
import { struct, u8 } from '@solana/buffer-layout';
|
import { struct, u8 } from '@solana/buffer-layout';
|
||||||
import { AccountMeta, PublicKey, TransactionInstruction } from '@solana/web3.js';
|
import type { AccountMeta, PublicKey } from '@solana/web3.js';
|
||||||
import { TOKEN_PROGRAM_ID } from '../constants';
|
import { TransactionInstruction } from '@solana/web3.js';
|
||||||
|
import { TOKEN_PROGRAM_ID } from '../constants.js';
|
||||||
import {
|
import {
|
||||||
TokenInvalidInstructionDataError,
|
TokenInvalidInstructionDataError,
|
||||||
TokenInvalidInstructionKeysError,
|
TokenInvalidInstructionKeysError,
|
||||||
TokenInvalidInstructionProgramError,
|
TokenInvalidInstructionProgramError,
|
||||||
TokenInvalidInstructionTypeError,
|
TokenInvalidInstructionTypeError,
|
||||||
} from '../errors';
|
} from '../errors.js';
|
||||||
import { TokenInstruction } from './types';
|
import { TokenInstruction } from './types.js';
|
||||||
|
|
||||||
/** TODO: docs */
|
/** TODO: docs */
|
||||||
export interface SyncNativeInstructionData {
|
export interface SyncNativeInstructionData {
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
import { struct, u8 } from '@solana/buffer-layout';
|
import { struct, u8 } from '@solana/buffer-layout';
|
||||||
import { AccountMeta, PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
|
import type { AccountMeta, PublicKey, Signer } from '@solana/web3.js';
|
||||||
import { TOKEN_PROGRAM_ID } from '../constants';
|
import { TransactionInstruction } from '@solana/web3.js';
|
||||||
|
import { TOKEN_PROGRAM_ID } from '../constants.js';
|
||||||
import {
|
import {
|
||||||
TokenInvalidInstructionDataError,
|
TokenInvalidInstructionDataError,
|
||||||
TokenInvalidInstructionKeysError,
|
TokenInvalidInstructionKeysError,
|
||||||
TokenInvalidInstructionProgramError,
|
TokenInvalidInstructionProgramError,
|
||||||
TokenInvalidInstructionTypeError,
|
TokenInvalidInstructionTypeError,
|
||||||
} from '../errors';
|
} from '../errors.js';
|
||||||
import { addSigners } from './internal';
|
import { addSigners } from './internal.js';
|
||||||
import { TokenInstruction } from './types';
|
import { TokenInstruction } from './types.js';
|
||||||
|
|
||||||
/** TODO: docs */
|
/** TODO: docs */
|
||||||
export interface ThawAccountInstructionData {
|
export interface ThawAccountInstructionData {
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
import { struct, u8 } from '@solana/buffer-layout';
|
import { struct, u8 } from '@solana/buffer-layout';
|
||||||
import { u64 } from '@solana/buffer-layout-utils';
|
import { u64 } from '@solana/buffer-layout-utils';
|
||||||
import { AccountMeta, PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
|
import type { AccountMeta, PublicKey, Signer } from '@solana/web3.js';
|
||||||
import { TOKEN_PROGRAM_ID } from '../constants';
|
import { TransactionInstruction } from '@solana/web3.js';
|
||||||
|
import { TOKEN_PROGRAM_ID } from '../constants.js';
|
||||||
import {
|
import {
|
||||||
TokenInvalidInstructionDataError,
|
TokenInvalidInstructionDataError,
|
||||||
TokenInvalidInstructionKeysError,
|
TokenInvalidInstructionKeysError,
|
||||||
TokenInvalidInstructionProgramError,
|
TokenInvalidInstructionProgramError,
|
||||||
TokenInvalidInstructionTypeError,
|
TokenInvalidInstructionTypeError,
|
||||||
} from '../errors';
|
} from '../errors.js';
|
||||||
import { addSigners } from './internal';
|
import { addSigners } from './internal.js';
|
||||||
import { TokenInstruction } from './types';
|
import { TokenInstruction } from './types.js';
|
||||||
|
|
||||||
/** TODO: docs */
|
/** TODO: docs */
|
||||||
export interface TransferInstructionData {
|
export interface TransferInstructionData {
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
import { struct, u8 } from '@solana/buffer-layout';
|
import { struct, u8 } from '@solana/buffer-layout';
|
||||||
import { u64 } from '@solana/buffer-layout-utils';
|
import { u64 } from '@solana/buffer-layout-utils';
|
||||||
import { AccountMeta, PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
|
import type { AccountMeta, PublicKey, Signer } from '@solana/web3.js';
|
||||||
import { TOKEN_PROGRAM_ID } from '../constants';
|
import { TransactionInstruction } from '@solana/web3.js';
|
||||||
|
import { TOKEN_PROGRAM_ID } from '../constants.js';
|
||||||
import {
|
import {
|
||||||
TokenInvalidInstructionDataError,
|
TokenInvalidInstructionDataError,
|
||||||
TokenInvalidInstructionKeysError,
|
TokenInvalidInstructionKeysError,
|
||||||
TokenInvalidInstructionProgramError,
|
TokenInvalidInstructionProgramError,
|
||||||
TokenInvalidInstructionTypeError,
|
TokenInvalidInstructionTypeError,
|
||||||
} from '../errors';
|
} from '../errors.js';
|
||||||
import { addSigners } from './internal';
|
import { addSigners } from './internal.js';
|
||||||
import { TokenInstruction } from './types';
|
import { TokenInstruction } from './types.js';
|
||||||
|
|
||||||
/** TODO: docs */
|
/** TODO: docs */
|
||||||
export interface TransferCheckedInstructionData {
|
export interface TransferCheckedInstructionData {
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
import { struct, u32, u8 } from '@solana/buffer-layout';
|
import { struct, u32, u8 } from '@solana/buffer-layout';
|
||||||
import { publicKey, u64 } from '@solana/buffer-layout-utils';
|
import { publicKey, u64 } from '@solana/buffer-layout-utils';
|
||||||
import { Commitment, Connection, PublicKey, AccountInfo } from '@solana/web3.js';
|
import type { AccountInfo, Commitment, Connection, PublicKey } from '@solana/web3.js';
|
||||||
import { TOKEN_PROGRAM_ID } from '../constants';
|
import { TOKEN_PROGRAM_ID } from '../constants.js';
|
||||||
import {
|
import {
|
||||||
TokenAccountNotFoundError,
|
TokenAccountNotFoundError,
|
||||||
TokenInvalidAccountError,
|
TokenInvalidAccountError,
|
||||||
TokenInvalidAccountOwnerError,
|
TokenInvalidAccountOwnerError,
|
||||||
TokenInvalidAccountSizeError,
|
TokenInvalidAccountSizeError,
|
||||||
} from '../errors';
|
} from '../errors.js';
|
||||||
import { MULTISIG_SIZE } from './multisig';
|
import { ACCOUNT_TYPE_SIZE, AccountType } from '../extensions/accountType.js';
|
||||||
import { AccountType, ACCOUNT_TYPE_SIZE } from '../extensions/accountType';
|
import type { ExtensionType } from '../extensions/extensionType.js';
|
||||||
import { ExtensionType, getAccountLen } from '../extensions/extensionType';
|
import { getAccountLen } from '../extensions/extensionType.js';
|
||||||
|
import { MULTISIG_SIZE } from './multisig.js';
|
||||||
|
|
||||||
/** Information about a token account */
|
/** Information about a token account */
|
||||||
export interface Account {
|
export interface Account {
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
export * from './account';
|
export * from './account.js';
|
||||||
export * from './mint';
|
export * from './mint.js';
|
||||||
export * from './multisig';
|
export * from './multisig.js';
|
||||||
|
|
|
@ -1,18 +1,20 @@
|
||||||
import { struct, u32, u8 } from '@solana/buffer-layout';
|
import { struct, u32, u8 } from '@solana/buffer-layout';
|
||||||
import { bool, publicKey, u64 } from '@solana/buffer-layout-utils';
|
import { bool, publicKey, u64 } from '@solana/buffer-layout-utils';
|
||||||
import { AccountInfo, Commitment, Connection, PublicKey } from '@solana/web3.js';
|
import type { AccountInfo, Commitment, Connection } from '@solana/web3.js';
|
||||||
import { ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_PROGRAM_ID } from '../constants';
|
import { PublicKey } from '@solana/web3.js';
|
||||||
|
import { ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_PROGRAM_ID } from '../constants.js';
|
||||||
import {
|
import {
|
||||||
TokenAccountNotFoundError,
|
TokenAccountNotFoundError,
|
||||||
TokenInvalidAccountOwnerError,
|
TokenInvalidAccountOwnerError,
|
||||||
TokenInvalidAccountSizeError,
|
TokenInvalidAccountSizeError,
|
||||||
TokenInvalidMintError,
|
TokenInvalidMintError,
|
||||||
TokenOwnerOffCurveError,
|
TokenOwnerOffCurveError,
|
||||||
} from '../errors';
|
} from '../errors.js';
|
||||||
import { ACCOUNT_SIZE } from './account';
|
import { ACCOUNT_TYPE_SIZE, AccountType } from '../extensions/accountType.js';
|
||||||
import { MULTISIG_SIZE } from './multisig';
|
import type { ExtensionType } from '../extensions/extensionType.js';
|
||||||
import { AccountType, ACCOUNT_TYPE_SIZE } from '../extensions/accountType';
|
import { getMintLen } from '../extensions/extensionType.js';
|
||||||
import { ExtensionType, getMintLen } from '../extensions/extensionType';
|
import { ACCOUNT_SIZE } from './account.js';
|
||||||
|
import { MULTISIG_SIZE } from './multisig.js';
|
||||||
|
|
||||||
/** Information about a mint */
|
/** Information about a mint */
|
||||||
export interface Mint {
|
export interface Mint {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { struct, u8 } from '@solana/buffer-layout';
|
import { struct, u8 } from '@solana/buffer-layout';
|
||||||
import { bool, publicKey } from '@solana/buffer-layout-utils';
|
import { bool, publicKey } from '@solana/buffer-layout-utils';
|
||||||
import { AccountInfo, Commitment, Connection, PublicKey } from '@solana/web3.js';
|
import type { AccountInfo, Commitment, Connection, PublicKey } from '@solana/web3.js';
|
||||||
import { TOKEN_PROGRAM_ID } from '../constants';
|
import { TOKEN_PROGRAM_ID } from '../constants.js';
|
||||||
import { TokenAccountNotFoundError, TokenInvalidAccountOwnerError, TokenInvalidAccountSizeError } from '../errors';
|
import { TokenAccountNotFoundError, TokenInvalidAccountOwnerError, TokenInvalidAccountSizeError } from '../errors.js';
|
||||||
|
|
||||||
/** Information about a multisig */
|
/** Information about a multisig */
|
||||||
export interface Multisig {
|
export interface Multisig {
|
||||||
|
|
|
@ -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';
|
import { TOKEN_PROGRAM_ID } from '../src';
|
||||||
|
|
||||||
export async function newAccountWithLamports(connection: Connection, lamports = 1000000): Promise<Signer> {
|
export async function newAccountWithLamports(connection: Connection, lamports = 1000000): Promise<Signer> {
|
||||||
|
|
|
@ -2,15 +2,8 @@ import chai, { expect } from 'chai';
|
||||||
import chaiAsPromised from 'chai-as-promised';
|
import chaiAsPromised from 'chai-as-promised';
|
||||||
chai.use(chaiAsPromised);
|
chai.use(chaiAsPromised);
|
||||||
|
|
||||||
import {
|
import type { Connection, PublicKey, Signer } from '@solana/web3.js';
|
||||||
sendAndConfirmTransaction,
|
import { sendAndConfirmTransaction, Keypair, SystemProgram, Transaction } from '@solana/web3.js';
|
||||||
Connection,
|
|
||||||
Keypair,
|
|
||||||
PublicKey,
|
|
||||||
Signer,
|
|
||||||
SystemProgram,
|
|
||||||
Transaction,
|
|
||||||
} from '@solana/web3.js';
|
|
||||||
import {
|
import {
|
||||||
createAccount,
|
createAccount,
|
||||||
createInitializeMintInstruction,
|
createInitializeMintInstruction,
|
||||||
|
|
|
@ -2,15 +2,8 @@ import chai, { expect } from 'chai';
|
||||||
import chaiAsPromised from 'chai-as-promised';
|
import chaiAsPromised from 'chai-as-promised';
|
||||||
chai.use(chaiAsPromised);
|
chai.use(chaiAsPromised);
|
||||||
|
|
||||||
import {
|
import type { Connection, PublicKey, Signer } from '@solana/web3.js';
|
||||||
sendAndConfirmTransaction,
|
import { sendAndConfirmTransaction, Keypair, SystemProgram, Transaction } from '@solana/web3.js';
|
||||||
Connection,
|
|
||||||
Keypair,
|
|
||||||
PublicKey,
|
|
||||||
Signer,
|
|
||||||
SystemProgram,
|
|
||||||
Transaction,
|
|
||||||
} from '@solana/web3.js';
|
|
||||||
import {
|
import {
|
||||||
AccountState,
|
AccountState,
|
||||||
createAccount,
|
createAccount,
|
||||||
|
|
|
@ -2,15 +2,8 @@ import chai, { expect } from 'chai';
|
||||||
import chaiAsPromised from 'chai-as-promised';
|
import chaiAsPromised from 'chai-as-promised';
|
||||||
chai.use(chaiAsPromised);
|
chai.use(chaiAsPromised);
|
||||||
|
|
||||||
import {
|
import type { Connection, PublicKey, Signer } from '@solana/web3.js';
|
||||||
Connection,
|
import { Keypair, SystemProgram, Transaction, sendAndConfirmTransaction } from '@solana/web3.js';
|
||||||
Keypair,
|
|
||||||
PublicKey,
|
|
||||||
Signer,
|
|
||||||
SystemProgram,
|
|
||||||
Transaction,
|
|
||||||
sendAndConfirmTransaction,
|
|
||||||
} from '@solana/web3.js';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
AuthorityType,
|
AuthorityType,
|
||||||
|
|
|
@ -2,7 +2,8 @@ import chai, { expect } from 'chai';
|
||||||
import chaiAsPromised from 'chai-as-promised';
|
import chaiAsPromised from 'chai-as-promised';
|
||||||
chai.use(chaiAsPromised);
|
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 {
|
import {
|
||||||
createInterestBearingMint,
|
createInterestBearingMint,
|
||||||
getInterestBearingMintConfigState,
|
getInterestBearingMintConfigState,
|
||||||
|
|
|
@ -2,15 +2,8 @@ import chai, { expect } from 'chai';
|
||||||
import chaiAsPromised from 'chai-as-promised';
|
import chaiAsPromised from 'chai-as-promised';
|
||||||
chai.use(chaiAsPromised);
|
chai.use(chaiAsPromised);
|
||||||
|
|
||||||
import {
|
import type { Connection, PublicKey, Signer } from '@solana/web3.js';
|
||||||
sendAndConfirmTransaction,
|
import { sendAndConfirmTransaction, Keypair, SystemProgram, Transaction } from '@solana/web3.js';
|
||||||
Connection,
|
|
||||||
Keypair,
|
|
||||||
PublicKey,
|
|
||||||
Signer,
|
|
||||||
SystemProgram,
|
|
||||||
Transaction,
|
|
||||||
} from '@solana/web3.js';
|
|
||||||
import { createMemoInstruction } from '@solana/spl-memo';
|
import { createMemoInstruction } from '@solana/spl-memo';
|
||||||
import {
|
import {
|
||||||
createAccount,
|
createAccount,
|
||||||
|
|
|
@ -2,15 +2,8 @@ import chai, { expect } from 'chai';
|
||||||
import chaiAsPromised from 'chai-as-promised';
|
import chaiAsPromised from 'chai-as-promised';
|
||||||
chai.use(chaiAsPromised);
|
chai.use(chaiAsPromised);
|
||||||
|
|
||||||
import {
|
import type { Connection, PublicKey, Signer } from '@solana/web3.js';
|
||||||
sendAndConfirmTransaction,
|
import { sendAndConfirmTransaction, Keypair, SystemProgram, Transaction } from '@solana/web3.js';
|
||||||
Connection,
|
|
||||||
Keypair,
|
|
||||||
PublicKey,
|
|
||||||
Signer,
|
|
||||||
SystemProgram,
|
|
||||||
Transaction,
|
|
||||||
} from '@solana/web3.js';
|
|
||||||
import {
|
import {
|
||||||
createInitializeMintInstruction,
|
createInitializeMintInstruction,
|
||||||
createInitializeNonTransferableMintInstruction,
|
createInitializeNonTransferableMintInstruction,
|
||||||
|
|
|
@ -2,7 +2,8 @@ import chai, { expect } from 'chai';
|
||||||
import chaiAsPromised from 'chai-as-promised';
|
import chaiAsPromised from 'chai-as-promised';
|
||||||
chai.use(chaiAsPromised);
|
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';
|
import { ExtensionType, createAccount, createMint, createReallocateInstruction, getAccountLen } from '../../src';
|
||||||
|
|
||||||
|
|
|
@ -2,15 +2,8 @@ import chai, { expect } from 'chai';
|
||||||
import chaiAsPromised from 'chai-as-promised';
|
import chaiAsPromised from 'chai-as-promised';
|
||||||
chai.use(chaiAsPromised);
|
chai.use(chaiAsPromised);
|
||||||
|
|
||||||
import {
|
import type { Connection, PublicKey, Signer } from '@solana/web3.js';
|
||||||
Connection,
|
import { Keypair, SystemProgram, Transaction, sendAndConfirmTransaction } from '@solana/web3.js';
|
||||||
Keypair,
|
|
||||||
PublicKey,
|
|
||||||
Signer,
|
|
||||||
SystemProgram,
|
|
||||||
Transaction,
|
|
||||||
sendAndConfirmTransaction,
|
|
||||||
} from '@solana/web3.js';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
ExtensionType,
|
ExtensionType,
|
||||||
|
|
|
@ -2,7 +2,8 @@ import chai, { expect } from 'chai';
|
||||||
import chaiAsPromised from 'chai-as-promised';
|
import chaiAsPromised from 'chai-as-promised';
|
||||||
chai.use(chaiAsPromised);
|
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 { createMint, createAccount, getAccount, mintTo, burn, burnChecked } from '../../src';
|
||||||
import { TEST_PROGRAM_ID, newAccountWithLamports, getConnection } from '../common';
|
import { TEST_PROGRAM_ID, newAccountWithLamports, getConnection } from '../common';
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue