diff --git a/examples/package.json b/examples/package.json index bb19a85..1407b26 100644 --- a/examples/package.json +++ b/examples/package.json @@ -15,7 +15,7 @@ "./index.d.ts": "./lib/index.d.ts" }, "scripts": { - "build": "tsc -d && tsc -p tsconfig.esm.json", + "build": "tsc && tsc -p tsconfig.esm.json", "lint": "prettier --check index.ts", "test": "node test/index.js" }, diff --git a/index.ts b/index.ts index c325d88..4dbb53f 100644 --- a/index.ts +++ b/index.ts @@ -380,7 +380,7 @@ export const sys = defineProgram(SYS_PROGRAM, P.U32LE, { }); // Type tests -const assertType = (value: T) => {}; +const assertType = (_value: T) => {}; assertType<(o: { lamports: bigint; source: string; destination: string }) => Instruction>( sys.transfer ); @@ -428,7 +428,7 @@ export const token = defineProgram(TOKEN_PROGRAM, P.U8, { account: { sign: false, write: true }, _rent: { address: SYS_RENT, sign: false, write: false }, }, - hint: (o: { account: string; m: number }, tl: TokenList) => + hint: (o: { account: string; m: number }, _: TokenList) => `Initialize multi-sig token account=${o.account} with signatures=${o.m}`, }, transfer: { @@ -440,7 +440,7 @@ export const token = defineProgram(TOKEN_PROGRAM, P.U8, { }, hint: ( o: { amount: bigint; source: string; destination: number; owner: string }, - tl: TokenList + _: TokenList ) => `Transfer ${o.amount} from token account=${o.source} of owner=${o.owner} to ${o.destination}`, }, @@ -451,10 +451,7 @@ export const token = defineProgram(TOKEN_PROGRAM, P.U8, { delegate: { sign: false, write: false }, owner: { sign: true, write: false }, }, - hint: ( - o: { amount: bigint; account: string; delegate: number; owner: string }, - tl: TokenList - ) => + hint: (o: { amount: bigint; account: string; delegate: number; owner: string }, _: TokenList) => `Approve authority of delegate=${o.delegate} over tokens on account=${o.account} on behalf of owner=${o.owner}`, }, revoke: { @@ -463,7 +460,7 @@ export const token = defineProgram(TOKEN_PROGRAM, P.U8, { account: { sign: false, write: true }, owner: { sign: true, write: false }, }, - hint: (o: { amount: bigint; account: string; owner: string }, tl: TokenList) => + hint: (o: { amount: bigint; account: string; owner: string }, _: TokenList) => `Revoke delegate's authority over tokens on account=${o.account} on behalf of owner=${o.owner}`, }, setAuthority: { @@ -477,7 +474,7 @@ export const token = defineProgram(TOKEN_PROGRAM, P.U8, { }, hint: ( o: { newAuthority: string; account: string; currentAuthority: string; authorityType: string }, - tl: TokenList + _: TokenList ) => `Sets a new authority=${o.newAuthority} of a mint or account=${o.account}. Current authority=${o.currentAuthority}. Authority Type: ${o.authorityType}`, }, @@ -496,7 +493,7 @@ export const token = defineProgram(TOKEN_PROGRAM, P.U8, { mint: { sign: false, write: true }, owner: { sign: true, write: false }, }, - hint: (o: { amount: bigint; account: string; mint: string; owner: string }, tl: TokenList) => + hint: (o: { amount: bigint; account: string; mint: string; owner: string }, _: TokenList) => `Burn ${o.amount} tokens from account=${o.account} of owner=${o.owner} mint=${o.mint}`, }, closeAccount: { @@ -506,7 +503,7 @@ export const token = defineProgram(TOKEN_PROGRAM, P.U8, { dest: { sign: false, write: true }, owner: { sign: true, write: false }, }, - hint: (o: { account: string; dest: string; owner: string }, tl: TokenList) => + hint: (o: { account: string; dest: string; owner: string }, _: TokenList) => `Close token account=${o.account} of owner=${o.owner}, transferring all its SOL to destionation account=${o.dest}`, }, freezeAccount: { @@ -516,7 +513,7 @@ export const token = defineProgram(TOKEN_PROGRAM, P.U8, { mint: { sign: false, write: true }, authority: { sign: true, write: false }, }, - hint: (o: { account: string; authority: string; mint: string }, tl: TokenList) => + hint: (o: { account: string; authority: string; mint: string }, _: TokenList) => `Freeze token account=${o.account} of mint=${o.mint} using freeze_authority=${o.authority}`, }, thawAccount: { @@ -526,7 +523,7 @@ export const token = defineProgram(TOKEN_PROGRAM, P.U8, { mint: { sign: false, write: false }, authority: { sign: true, write: false }, }, - hint: (o: { account: string; authority: string; mint: string }, tl: TokenList) => + hint: (o: { account: string; authority: string; mint: string }, _: TokenList) => `Thaw a frozne token account=${o.account} of mint=${o.mint} using freeze_authority=${o.authority}`, }, transferChecked: { @@ -807,7 +804,13 @@ export function createTxComplex(address: string, instructions: Instruction[], bl ); } -export function createTx(from: string, to: string, amount: string, fee: bigint, blockhash: string) { +export function createTx( + from: string, + to: string, + amount: string, + _fee: bigint, + blockhash: string +) { const amountNum = Decimal.decode(amount); return createTxComplex( from, diff --git a/tsconfig.base.json b/tsconfig.base.json deleted file mode 100644 index 4e76cc9..0000000 --- a/tsconfig.base.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "target": "es2020", - "lib": ["es2020"], - "strict": true, - "sourceMap": false, - "allowSyntheticDefaultImports": false, - "allowUnreachableCode": false, - "esModuleInterop": false, - "noFallthroughCasesInSwitch": true, - "noImplicitReturns": true, - "noUncheckedIndexedAccess": false, - "noUnusedLocals": true, - "noUnusedParameters": true, - "baseUrl": ".", - }, - "include": ["index.ts"], - "exclude": ["node_modules", "lib"] -} diff --git a/tsconfig.esm.json b/tsconfig.esm.json index 2d82793..3a13c37 100644 --- a/tsconfig.esm.json +++ b/tsconfig.esm.json @@ -1,8 +1,23 @@ { - "extends": "./tsconfig.base.json", "compilerOptions": { + "target": "es2020", + "lib": ["es2020"], + "strict": true, + "sourceMap": false, + "allowSyntheticDefaultImports": false, + "allowUnreachableCode": false, + "esModuleInterop": false, + "noFallthroughCasesInSwitch": true, + "noImplicitReturns": true, + "noUncheckedIndexedAccess": false, + "noUnusedLocals": true, + "noUnusedParameters": true, + "baseUrl": ".", + "module": "es2020", "outDir": "lib/esm", "moduleResolution": "bundler" - } + }, + "include": ["index.ts"], + "exclude": ["node_modules", "lib"] } diff --git a/tsconfig.json b/tsconfig.json index 24dfcac..8243dc7 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,8 @@ { - "extends": "./tsconfig.base.json", + "extends": "./tsconfig.esm.json", "compilerOptions": { "module": "commonjs", + "moduleResolution": "node10", "outDir": "lib", "declaration": true, "declarationMap": true