Skip to content

Commit

Permalink
Prettier, update tsconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmillr committed Jan 5, 2024
1 parent ff40d2f commit 3e7b22c
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 37 deletions.
2 changes: 1 addition & 1 deletion examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
31 changes: 17 additions & 14 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ export const sys = defineProgram(SYS_PROGRAM, P.U32LE, {
});

// Type tests
const assertType = <T>(value: T) => {};
const assertType = <T>(_value: T) => {};
assertType<(o: { lamports: bigint; source: string; destination: string }) => Instruction>(
sys.transfer
);
Expand Down Expand Up @@ -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: {
Expand All @@ -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}`,
},
Expand All @@ -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: {
Expand All @@ -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: {
Expand All @@ -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}`,
},
Expand All @@ -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: {
Expand All @@ -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: {
Expand All @@ -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: {
Expand All @@ -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: {
Expand Down Expand Up @@ -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,
Expand Down
19 changes: 0 additions & 19 deletions tsconfig.base.json

This file was deleted.

19 changes: 17 additions & 2 deletions tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -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"]
}
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"extends": "./tsconfig.base.json",
"extends": "./tsconfig.esm.json",
"compilerOptions": {
"module": "commonjs",
"moduleResolution": "node10",
"outDir": "lib",
"declaration": true,
"declarationMap": true
Expand Down

0 comments on commit 3e7b22c

Please sign in to comment.