solana-program-library/token/js
dependabot[bot] 50464f637a
build(deps): bump @solana/buffer-layout from 4.0.0 to 4.0.1 in /token/js (#4166)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-05 09:52:05 +00:00
..
examples docs: Add permanent delegate extension and example (#4134) 2023-04-24 16:13:04 +00:00
src [token-js] Switch to associated token address sync. (#4114) 2023-04-12 11:30:06 +00:00
test token-2022: Fix non-transferable extension for unchecked transfers (#4005) 2023-02-03 00:42:21 +01:00
.eslintignore Fix Token program ESM exports (#3508) 2022-08-22 19:07:03 -05:00
.eslintrc add eslint-plugin-require-extensions (#3543) 2022-08-28 20:38:11 -05:00
.gitignore Fix Token program ESM exports (#3508) 2022-08-22 19:07:03 -05:00
.mocharc.json increase mocha timeout 2022-02-15 16:33:36 -06:00
.nojekyll move ts to js 2022-02-15 16:33:36 -06:00
.prettierignore Fix Token program ESM exports (#3508) 2022-08-22 19:07:03 -05:00
.prettierrc move ts to js 2022-02-15 16:33:36 -06:00
LICENSE move ts to js 2022-02-15 16:33:36 -06:00
README.md Fix: Link (#4152) 2023-05-03 10:15:28 +00:00
package-lock.json build(deps): bump @solana/buffer-layout from 4.0.0 to 4.0.1 in /token/js (#4166) 2023-05-05 09:52:05 +00:00
package.json js: move `types` condition to the front (#4149) 2023-05-01 22:20:02 +00:00
tsconfig.all.json Fix Token program ESM exports (#3508) 2022-08-22 19:07:03 -05:00
tsconfig.base.json Fix Token program ESM exports (#3508) 2022-08-22 19:07:03 -05:00
tsconfig.cjs.json Fix Token program ESM exports (#3508) 2022-08-22 19:07:03 -05:00
tsconfig.esm.json Fix Token program ESM exports (#3508) 2022-08-22 19:07:03 -05:00
tsconfig.json Fix Token program ESM exports (#3508) 2022-08-22 19:07:03 -05:00
tsconfig.root.json Fix Token program ESM exports (#3508) 2022-08-22 19:07:03 -05:00
typedoc.json Fix Token program ESM exports (#3508) 2022-08-22 19:07:03 -05:00

README.md

@solana/spl-token

A TypeScript library for interacting with the SPL Token and Token-2022 programs.

FAQs

How can I get support?

Please ask questions in the Solana Stack Exchange: https://solana.stackexchange.com/

If you've found a bug or you'd like to request a feature, please open an issue.

No export named Token

Please see upgrading from 0.1.x.

Install

npm install --save @solana/spl-token @solana/web3.js

OR

yarn add @solana/spl-token @solana/web3.js

Build from Source

  1. Prerequisites
  • Node 16+
  • NPM 8+
  1. Clone the project:
git clone https://github.com/solana-labs/solana-program-library.git
  1. Navigate to the library:
cd solana-program-library/token/js
  1. Install the dependencies:
npm install
  1. Build the library:
npm run build
  1. Build the on-chain programs:
npm run test:build-programs
  1. Run the tests:
npm run test
  1. Run the example:
npm run example

Upgrading

Upgrading from 0.2.0

There are no breaking changes from 0.2.0, only new functionality for Token-2022.

Upgrading from 0.1.x

When upgrading from spl-token 0.1.x, you may see the following error in your code:

import {TOKEN_PROGRAM_ID, Token, AccountLayout} from '@solana/spl-token';
                          ^^^^^
SyntaxError: The requested module '@solana/spl-token' does not provide an export named 'Token'

The @solana/spl-token library as of version 0.2.0 does not have the Token class. Instead the actions are split up and exported separately.

To use the old version, install it with:

npm install @solana/spl-token@0.1.8

Otherwise you can find documentation on how to use new versions on the SPL docs or Solana Cookbook.