From a07935371f5a6c62a27d0184a597eb999c3ef3a1 Mon Sep 17 00:00:00 2001 From: Jack May Date: Thu, 30 Jul 2020 02:07:55 -0700 Subject: [PATCH] Prep token/js for publishing (#165) --- .travis/install-program-deps.sh | 1 + ci/token.sh | 1 + token-swap/js/cli/token-swap-test.js | 8 +- token/js/cli/token-test.js | 6 +- token/js/client/token.js | 92 ++++++++------- token/js/module.d.ts | 162 +++++++++++++++++++++++++++ token/js/module.flow.js | 156 +++++++++++++++++++++++--- token/js/package-lock.json | 56 ++++++++- token/js/package.json | 24 +++- 9 files changed, 432 insertions(+), 74 deletions(-) create mode 100644 token/js/module.d.ts diff --git a/.travis/install-program-deps.sh b/.travis/install-program-deps.sh index 3138d5f6..8a8dc1b9 100755 --- a/.travis/install-program-deps.sh +++ b/.travis/install-program-deps.sh @@ -14,4 +14,5 @@ sudo apt-get install -y libssl-dev --allow-unauthenticated sudo apt-get install -y libssl1.1 --allow-unauthenticated clang-7 --version nvm install node +npm install -g typescript node --version diff --git a/ci/token.sh b/ci/token.sh index f9d95c32..1fc5629f 100755 --- a/ci/token.sh +++ b/ci/token.sh @@ -18,6 +18,7 @@ cd "$(dirname "$0")/../token/js" npm install npm run lint npm run flow +tsc module.d.ts npm run cluster:localnet npm run localnet:update npm run localnet:up diff --git a/token-swap/js/cli/token-swap-test.js b/token-swap/js/cli/token-swap-test.js index c7235142..dcf3a4a8 100644 --- a/token-swap/js/cli/token-swap-test.js +++ b/token-swap/js/cli/token-swap-test.js @@ -4,7 +4,7 @@ import fs from 'mz/fs'; import semver from 'semver'; import { Account, Connection, BpfLoader, PublicKey } from '@solana/web3.js'; -import { Token, TokenAmount } from '../../../token/js/client/token'; +import { Token, u64 } from '../../../token/js/client/token'; import { TokenSwap } from '../client/token-swap'; import { Store } from '../client/util/store'; import { newAccountWithLamports } from '../client/util/new-account-with-lamports'; @@ -121,7 +121,7 @@ export async function createTokenSwap(): Promise { payer, authority, owner.publicKey, - new TokenAmount(0), + new u64(0), 2, tokenProgramId, true, @@ -133,7 +133,7 @@ export async function createTokenSwap(): Promise { payer, owner.publicKey, authority, - new TokenAmount(BASE_AMOUNT), + new u64(BASE_AMOUNT), 2, tokenProgramId, true, @@ -145,7 +145,7 @@ export async function createTokenSwap(): Promise { payer, owner.publicKey, authority, - new TokenAmount(BASE_AMOUNT), + new u64(BASE_AMOUNT), 2, tokenProgramId, true, diff --git a/token/js/cli/token-test.js b/token/js/cli/token-test.js index 67e9f3ec..dc9afa24 100644 --- a/token/js/cli/token-test.js +++ b/token/js/cli/token-test.js @@ -4,7 +4,7 @@ import fs from 'mz/fs'; import {Account, Connection, BpfLoader, PublicKey} from '@solana/web3.js'; import semver from 'semver'; -import {Token, TokenAmount} from '../client/token'; +import {Token, u64} from '../client/token'; import {url} from '../url'; import {newAccountWithLamports} from '../client/util/new-account-with-lamports'; import {sleep} from '../client/util/sleep'; @@ -113,7 +113,7 @@ export async function createMint(): Promise { payer, mintOwner.publicKey, testAccountOwner.publicKey, - new TokenAmount(10000), + new u64(10000), 2, programId, false, @@ -255,7 +255,7 @@ export async function mintTo(): Promise { payer, mintableOwner.publicKey, testMintableAccountOwner.publicKey, - new TokenAmount(10000), + new u64(10000), 2, programId, true, diff --git a/token/js/client/token.js b/token/js/client/token.js index b7896f5d..08ba3151 100644 --- a/token/js/client/token.js +++ b/token/js/client/token.js @@ -19,9 +19,9 @@ import * as Layout from './layout'; import {sendAndConfirmTransaction} from './util/send-and-confirm-transaction'; /** - * Some amount of tokens + * 64-bit value */ -export class TokenAmount extends BN { +export class u64 extends BN { /** * Convert to Buffer representation */ @@ -31,7 +31,7 @@ export class TokenAmount extends BN { if (b.length === 8) { return b; } - assert(b.length < 8, 'TokenAmount too large'); + assert(b.length < 8, 'u64 too large'); const zeroPad = Buffer.alloc(8); b.copy(zeroPad); @@ -39,9 +39,9 @@ export class TokenAmount extends BN { } /** - * Construct a TokenAmount from Buffer representation + * Construct a u64 from Buffer representation */ - static fromBuffer(buffer: Buffer): TokenAmount { + static fromBuffer(buffer: Buffer): u64 { assert(buffer.length === 8, `Invalid buffer length: ${buffer.length}`); return new BN( [...buffer] @@ -98,7 +98,7 @@ type AccountInfo = {| /** * Amount of tokens this account holds */ - amount: TokenAmount, + amount: u64, /** * The delegate for this account @@ -108,7 +108,7 @@ type AccountInfo = {| /** * The amount of tokens the delegate authorized to the delegate */ - delegatedAmount: TokenAmount, + delegatedAmount: u64, /** * Is this account initialized @@ -163,7 +163,6 @@ type MultisigInfo = {| signer2: PublicKey, signer3: PublicKey, signer4: PublicKey, - signer4: PublicKey, signer5: PublicKey, signer6: PublicKey, signer7: PublicKey, @@ -286,7 +285,7 @@ export class Token { payer: Account, mintOwner: PublicKey, accountOwner: PublicKey, - supply: TokenAmount, + supply: u64, decimals: number, programId: PublicKey, is_owned: boolean = false, @@ -528,15 +527,15 @@ export class Token { const accountInfo = AccountLayout.decode(data); accountInfo.mint = new PublicKey(accountInfo.mint); accountInfo.owner = new PublicKey(accountInfo.owner); - accountInfo.amount = TokenAmount.fromBuffer(accountInfo.amount); + accountInfo.amount = u64.fromBuffer(accountInfo.amount); accountInfo.isInitialized = accountInfo.isInitialized != 0; accountInfo.isNative = accountInfo.isNative != 0; if (accountInfo.option === 0) { accountInfo.delegate = null; - accountInfo.delegatedAmount = new TokenAmount(); + accountInfo.delegatedAmount = new u64(); } else { accountInfo.delegate = new PublicKey(accountInfo.delegate); - accountInfo.delegatedAmount = TokenAmount.fromBuffer( + accountInfo.delegatedAmount = u64.fromBuffer( accountInfo.delegatedAmount, ); } @@ -599,7 +598,7 @@ export class Token { destination: PublicKey, authority: Account | PublicKey, multiSigners: Array, - amount: number | TokenAmount, + amount: number | u64, ): Promise { let ownerPublicKey; let signers; @@ -614,7 +613,8 @@ export class Token { 'Transfer', this.connection, new Transaction().add( - this.transferInstruction( + Token.createTransferInstruction( + this.programId, source, destination, ownerPublicKey, @@ -641,7 +641,7 @@ export class Token { delegate: PublicKey, owner: Account | PublicKey, multiSigners: Array, - amount: number | TokenAmount, + amount: number | u64, ): Promise { let ownerPublicKey; let signers; @@ -656,7 +656,7 @@ export class Token { 'Approve', this.connection, new Transaction().add( - this.approveInstruction(account, delegate, ownerPublicKey, multiSigners, amount), + Token.createApproveInstruction(this.programId, account, delegate, ownerPublicKey, multiSigners, amount), ), this.payer, ...signers @@ -688,7 +688,7 @@ export class Token { 'Revoke', this.connection, new Transaction().add( - this.revokeInstruction(account, ownerPublicKey, multiSigners), + Token.createRevokeInstruction(this.programId, account, ownerPublicKey, multiSigners), ), this.payer, ...signers @@ -722,7 +722,7 @@ export class Token { 'SetOwner', this.connection, new Transaction().add( - this.setOwnerInstruction(owned, newOwner, ownerPublicKey, multiSigners), + Token.createSetOwnerInstruction(this.programId, owned, newOwner, ownerPublicKey, multiSigners), ), this.payer, ...signers, @@ -756,7 +756,7 @@ export class Token { await sendAndConfirmTransaction( 'MintTo', this.connection, - new Transaction().add(this.mintToInstruction(dest, ownerPublicKey, multiSigners, amount)), + new Transaction().add(Token.createMintToInstruction(this.programId, this.publicKey, dest, ownerPublicKey, multiSigners, amount)), this.payer, ...signers, ); @@ -788,7 +788,7 @@ export class Token { await sendAndConfirmTransaction( 'Burn', this.connection, - new Transaction().add(this.burnInstruction(account, ownerPublicKey, multiSigners, amount)), + new Transaction().add(Token.createBurnInstruction(this.programId, account, ownerPublicKey, multiSigners, amount)), this.payer, ...signers, ); @@ -819,7 +819,7 @@ export class Token { await sendAndConfirmTransaction( 'CloseAccount', this.connection, - new Transaction().add(this.closeAccountInstruction(account, dest, ownerPublicKey, multiSigners)), + new Transaction().add(Token.createCloseAccountInstruction(this.programId, account, dest, ownerPublicKey, multiSigners)), this.payer, ...signers, ); @@ -834,12 +834,13 @@ export class Token { * @param multiSigners Signing accounts if `authority` is a multiSig * @param amount Number of tokens to transfer */ - transferInstruction( + static createTransferInstruction( + programId: PublicKey, source: PublicKey, destination: PublicKey, authority: Account | PublicKey, multiSigners: Array, - amount: number | TokenAmount, + amount: number | u64, ): TransactionInstruction { const dataLayout = BufferLayout.struct([ BufferLayout.u8('instruction'), @@ -850,7 +851,7 @@ export class Token { dataLayout.encode( { instruction: 3, // Transfer instruction - amount: new TokenAmount(amount).toBuffer(), + amount: new u64(amount).toBuffer(), }, data, ); @@ -867,7 +868,7 @@ export class Token { } return new TransactionInstruction({ keys, - programId: this.programId, + programId: programId, data, }); } @@ -881,12 +882,13 @@ export class Token { * @param multiSigners Signing accounts if `owner` is a multiSig * @param amount Maximum number of tokens the delegate may transfer */ - approveInstruction( + static createApproveInstruction( + programId: PublicKey, account: PublicKey, delegate: PublicKey, owner: Account | PublicKey, multiSigners: Array, - amount: number | TokenAmount, + amount: number | u64, ): TransactionInstruction { const dataLayout = BufferLayout.struct([ BufferLayout.u8('instruction'), @@ -897,7 +899,7 @@ export class Token { dataLayout.encode( { instruction: 4, // Approve instruction - amount: new TokenAmount(amount).toBuffer(), + amount: new u64(amount).toBuffer(), }, data, ); @@ -915,7 +917,7 @@ export class Token { return new TransactionInstruction({ keys, - programId: this.programId, + programId: programId, data, }); } @@ -929,7 +931,8 @@ export class Token { * @param multiSigners Signing accounts if `owner` is a multiSig * @param amount Maximum number of tokens the delegate may transfer */ - revokeInstruction( + static createRevokeInstruction( + programId: PublicKey, account: PublicKey, owner: Account | PublicKey, multiSigners: Array, @@ -956,7 +959,7 @@ export class Token { return new TransactionInstruction({ keys, - programId: this.programId, + programId: programId, data, }); } @@ -969,7 +972,8 @@ export class Token { * @param owner Owner of the account * @param multiSigners Signing accounts if `owner` is a multiSig */ - setOwnerInstruction( + static createSetOwnerInstruction( + programId: PublicKey, owned: PublicKey, newOwner: PublicKey, owner: Account | PublicKey, @@ -998,7 +1002,7 @@ export class Token { return new TransactionInstruction({ keys, - programId: this.programId, + programId: programId, data, }); } @@ -1012,7 +1016,9 @@ export class Token { * @param amount amount to mint */ - mintToInstruction( + static createMintToInstruction( + programId: PublicKey, + mint: PublicKey, dest: PublicKey, authority: Account | PublicKey, multiSigners: Array, @@ -1027,13 +1033,13 @@ export class Token { dataLayout.encode( { instruction: 7, // MintTo instruction - amount: new TokenAmount(amount).toBuffer(), + amount: new u64(amount).toBuffer(), }, data, ); let keys = [ - {pubkey: this.publicKey, isSigner: false, isWritable: true}, + {pubkey: mint, isSigner: false, isWritable: true}, {pubkey: dest, isSigner: false, isWritable: true}, ]; if (authority instanceof Account) { @@ -1045,7 +1051,7 @@ export class Token { return new TransactionInstruction({ keys, - programId: this.programId, + programId: programId, data, }); } @@ -1058,7 +1064,8 @@ export class Token { * @param multiSigners Signing accounts if `authority` is a multiSig * @param amount ammount to burn */ - burnInstruction( + static createBurnInstruction( + programId: PublicKey, account: PublicKey, authority: Account | PublicKey, multiSigners: Array, @@ -1073,7 +1080,7 @@ export class Token { dataLayout.encode( { instruction: 8, // Burn instruction - amount: new TokenAmount(amount).toBuffer(), + amount: new u64(amount).toBuffer(), }, data, ); @@ -1090,7 +1097,7 @@ export class Token { return new TransactionInstruction({ keys, - programId: this.programId, + programId: programId, data, }); } @@ -1102,7 +1109,8 @@ export class Token { * @param owner account owner * @param multiSigners Signing accounts if `owner` is a multiSig */ - closeAccountInstruction( + static createCloseAccountInstruction( + programId: PublicKey, account: PublicKey, dest: PublicKey, owner: Account | PublicKey, @@ -1130,7 +1138,7 @@ export class Token { return new TransactionInstruction({ keys, - programId: this.programId, + programId: programId, data, }); } diff --git a/token/js/module.d.ts b/token/js/module.d.ts new file mode 100644 index 00000000..c00b4e67 --- /dev/null +++ b/token/js/module.d.ts @@ -0,0 +1,162 @@ +declare module '@solana/spl-token' { + import {Buffer} from 'buffer'; + import * as BufferLayout from 'buffer-layout'; + import { PublicKey, TransactionInstruction, TransactionSignature, Connection } from "@solana/web3.js"; + import BN from 'bn.js'; + + + // === src/publickey.js === + export class u64 extends BN { + toBuffer(): Buffer; + static fromBuffer(buffer: Buffer): u64; + } + export type MintInfo = { + owner: null | PublicKey, + decimals: number, + initialized: boolean, + }; + export type AccountInfo = { + mint: PublicKey, + owner: PublicKey, + amount: u64, + delegate: null | PublicKey, + delegatedAmount: u64, + isInitialized: boolean, + isNative: boolean, + }; + export type MultisigInfo = { + m: number, + n: number, + initialized: boolean, + signer1: PublicKey, + signer2: PublicKey, + signer3: PublicKey, + signer4: PublicKey, + signer5: PublicKey, + signer6: PublicKey, + signer7: PublicKey, + signer8: PublicKey, + signer9: PublicKey, + signer10: PublicKey, + signer11: PublicKey, + }; + export type TokenAndPublicKey = [Token, PublicKey]; + export class Token { + constructor( + connection: Connection, + publicKey: PublicKey, + programId: PublicKey, + payer: Account, + ); + static createMint( + connection: Connection, + payer: Account, + mintOwner: PublicKey, + accountOwner: PublicKey, + supply: u64, + decimals: number, + programId: PublicKey, + is_owned: boolean, + ): Promise; + static getAccount(connection: Connection): Promise; + createAccount(owner: PublicKey): Promise; + createMultisig(m: number, signers: Array): Promise; + getMintInfo(): Promise; + getAccountInfo(account: PublicKey): Promise; + getMultisigInfo(multisig: PublicKey): Promise; + transfer( + source: PublicKey, + destination: PublicKey, + authority: Account | PublicKey, + multiSigners: Array, + amount: number | u64, + ): Promise; + approve( + account: PublicKey, + delegate: PublicKey, + owner: Account | PublicKey, + multiSigners: Array, + amount: number | u64, + ): Promise; + revoke( + account: PublicKey, + owner: Account | PublicKey, + multiSigners: Array, + ): Promise; + setOwner( + owned: PublicKey, + newOwner: PublicKey, + owner: Account | PublicKey, + multiSigners: Array, + ): Promise; + mintTo( + dest: PublicKey, + authority: Account | PublicKey, + multiSigners: Array, + amount: number, + ): Promise; + burn( + account: PublicKey, + authority: Account | PublicKey, + multiSigners: Array, + amount: number, + ): Promise; + closeAccount( + account: PublicKey, + dest: PublicKey, + owner: Account | PublicKey, + multiSigners: Array, + ): Promise; + static createTransferInstruction( + programId: PublicKey, + source: PublicKey, + destination: PublicKey, + authority: Account | PublicKey, + multiSigners: Array, + amount: number | u64, + ): TransactionInstruction; + static createApproveInstruction( + programId: PublicKey, + account: PublicKey, + delegate: PublicKey, + owner: Account | PublicKey, + multiSigners: Array, + amount: number | u64, + ): TransactionInstruction; + static createRevokeInstruction( + programId: PublicKey, + account: PublicKey, + owner: Account | PublicKey, + multiSigners: Array, + ): TransactionInstruction; + static createSetOwnerInstruction( + programId: PublicKey, + owned: PublicKey, + newOwner: PublicKey, + owner: Account | PublicKey, + multiSigners: Array, + ): TransactionInstruction; + static createMintToInstruction( + programId: PublicKey, + mint: PublicKey, + dest: PublicKey, + authority: Account | PublicKey, + multiSigners: Array, + amount: number, + ): TransactionInstruction; + static createBurnInstruction( + programId: PublicKey, + account: PublicKey, + authority: Account | PublicKey, + multiSigners: Array, + amount: number, + ): TransactionInstruction; + static createCloseAccountInstruction( + programId: PublicKey, + account: PublicKey, + dest: PublicKey, + owner: Account | PublicKey, + multiSigners: Array, + ): TransactionInstruction; + } +} diff --git a/token/js/module.flow.js b/token/js/module.flow.js index 4ae7d83b..cf4688e4 100644 --- a/token/js/module.flow.js +++ b/token/js/module.flow.js @@ -1,24 +1,47 @@ /** - * Flow Library definition for token + * Flow Library definition for spl-token * * This file is manually maintained * - * Usage: add the following line under the [libs] section of your project's - * .flowconfig: - * [libs] - * token/module.flow.js - * */ -declare module 'spl-token' { +declare module '@solana/spl-token' { // === client/token.js === - declare export class TokenAmount extends BN { - /** - * Convert to Buffer representation - */ + declare export class u64 extends BN { toBuffer(): Buffer; - static fromBuffer(buffer: Buffer): TokenAmount; + static fromBuffer(buffer: Buffer): u64; } + declare export type MintInfo = {| + owner: null | PublicKey, + decimals: number, + initialized: boolean, + |}; + declare export type AccountInfo = {| + mint: PublicKey, + owner: PublicKey, + amount: u64, + delegate: null | PublicKey, + delegatedAmount: u64, + isInitialized: boolean, + isNative: boolean, + |}; + declare export type MultisigInfo = {| + m: number, + n: number, + initialized: boolean, + signer1: PublicKey, + signer2: PublicKey, + signer3: PublicKey, + signer4: PublicKey, + signer5: PublicKey, + signer6: PublicKey, + signer7: PublicKey, + signer8: PublicKey, + signer9: PublicKey, + signer10: PublicKey, + signer11: PublicKey, + |}; + declare export type TokenAndPublicKey = [Token, PublicKey]; declare export class Token { constructor( connection: Connection, @@ -26,18 +49,115 @@ declare module 'spl-token' { programId: PublicKey, payer: Account, ): Token; - static createNewToken( + static createMint( connection: Connection, payer: Account, - owner: Account, - supply: TokenAmount, + mintOwner: PublicKey, + accountOwner: PublicKey, + supply: u64, decimals: number, programId: PublicKey, is_owned: boolean, ): Promise; static getAccount(connection: Connection): Promise; - newAccount(owner: Account, source: null | PublicKey): Promise; - getTokenInfo(): Promise; - getTokenAccountInfo(account: PublicKey): Promise; + createAccount(owner: PublicKey): Promise; + createMultisig(m: number, signers: Array): Promise; + getMintInfo(): Promise; + getAccountInfo(account: PublicKey): Promise; + getMultisigInfo(multisig: PublicKey): Promise; + transfer( + source: PublicKey, + destination: PublicKey, + authority: Account | PublicKey, + multiSigners: Array, + amount: number | u64, + ): Promise; + approve( + account: PublicKey, + delegate: PublicKey, + owner: Account | PublicKey, + multiSigners: Array, + amount: number | u64, + ): Promise; + revoke( + account: PublicKey, + owner: Account | PublicKey, + multiSigners: Array, + ): Promise; + setOwner( + owned: PublicKey, + newOwner: PublicKey, + owner: Account | PublicKey, + multiSigners: Array, + ): Promise; + mintTo( + dest: PublicKey, + authority: Account | PublicKey, + multiSigners: Array, + amount: number, + ): Promise; + burn( + account: PublicKey, + authority: Account | PublicKey, + multiSigners: Array, + amount: number, + ): Promise; + closeAccount( + account: PublicKey, + dest: PublicKey, + owner: Account | PublicKey, + multiSigners: Array, + ): Promise; + static createTransferInstruction( + programId: PublicKey, + source: PublicKey, + destination: PublicKey, + authority: Account | PublicKey, + multiSigners: Array, + amount: number | u64, + ): TransactionInstruction; + static createApproveInstruction( + programId: PublicKey, + account: PublicKey, + delegate: PublicKey, + owner: Account | PublicKey, + multiSigners: Array, + amount: number | u64, + ): TransactionInstruction; + static createRevokeInstruction( + programId: PublicKey, + account: PublicKey, + owner: Account | PublicKey, + multiSigners: Array, + ): TransactionInstruction; + static createSetOwnerInstruction( + programId: PublicKey, + owned: PublicKey, + newOwner: PublicKey, + owner: Account | PublicKey, + multiSigners: Array, + ): TransactionInstruction; + static createMintToInstruction( + programId: PublicKey, + mint: PublicKey, + dest: PublicKey, + authority: Account | PublicKey, + multiSigners: Array, + amount: number, + ): TransactionInstruction; + static createBurnInstruction( + programId: PublicKey, + account: PublicKey, + authority: Account | PublicKey, + multiSigners: Array, + amount: number, + ): TransactionInstruction; + static createCloseAccountInstruction( + programId: PublicKey, + account: PublicKey, + dest: PublicKey, + owner: Account | PublicKey, + multiSigners: Array, + ): TransactionInstructio; } } diff --git a/token/js/package-lock.json b/token/js/package-lock.json index 91d82723..0009bcad 100644 --- a/token/js/package-lock.json +++ b/token/js/package-lock.json @@ -1,5 +1,5 @@ { - "name": "spl-token", + "name": "@solana/spl-token", "version": "0.0.1", "lockfileVersion": 1, "requires": true, @@ -2121,6 +2121,58 @@ "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" }, + "cross-env": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.2.tgz", + "integrity": "sha512-KZP/bMEOJEDCkDQAyRhu3RL2ZO/SUVrxQVI0G3YEQ+OLbRA3c6zgixe8Mq8a/z7+HKlNEjo8oiLUs8iRijY2Rw==", + "dev": true, + "requires": { + "cross-spawn": "^7.0.1" + }, + "dependencies": { + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + } + } + }, "cross-spawn": { "version": "6.0.5", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", @@ -6656,7 +6708,7 @@ }, "table": { "version": "5.4.6", - "resolved": "http://registry.npmjs.org/table/-/table-5.4.6.tgz", + "resolved": "https://registry.npmjs.org/table/-/table-5.4.6.tgz", "integrity": "sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug==", "requires": { "ajv": "^6.10.2", diff --git a/token/js/package.json b/token/js/package.json index 66463fad..91f45b83 100644 --- a/token/js/package.json +++ b/token/js/package.json @@ -1,13 +1,30 @@ { - "name": "spl-token", + "name": "@solana/spl-token", "version": "0.0.1", - "description": "", + "description": "SPL Token Javascript API", + "license": "MIT", + "author": "Solana Maintainers ", + "homepage": "https://solana.com/", "repository": { "type": "git", "url": "https://github.com/solana-labs/solana-program-library" }, + "bugs": { + "url": "https://github.com/solana-labs/solana-program-library/issues" + }, + "publishConfig": { + "access": "public" + }, + "main": "client/token.js", + "types": "module.d.ts", + "files": [ + "/cli", + "/client", + "/module.flow.js" + ], "testnetDefaultChannel": "v1.2.12", "scripts": { + "build": "cross-env NODE_ENV=production rollup -c", "start": "babel-node cli/main.js", "lint": "npm run pretty && eslint .", "lint:fix": "npm run lint -- --fix", @@ -25,9 +42,6 @@ "localnet:logs": "solana-localnet logs -f", "pretty": "prettier --write '{,src/**/}*.js'" }, - "keywords": [], - "author": "", - "license": "MIT", "devDependencies": { "prettier": "^2.0.5" },