Skip to content

Commit

Permalink
style: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Daryl-L committed Jan 31, 2024
1 parent 1fac84d commit 49446d9
Show file tree
Hide file tree
Showing 14 changed files with 2,004 additions and 2,111 deletions.
2 changes: 1 addition & 1 deletion offchain-modules/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module.exports = {
'import/order': ['warn', { alphabetize: { order: 'asc' } }],
'no-console': 'warn',
'no-constant-condition': 'warn',
'deprecation/deprecation': 'warn'
'deprecation/deprecation': 'warn',
},
ignorePatterns: ['**/generated', '**/*.js'],
};
2 changes: 1 addition & 1 deletion offchain-modules/.eslintrc.next.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ module.exports = {
'@typescript-eslint/explicit-module-boundary-types': 'error',
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
'@typescript-eslint/no-floating-promises': ['error'],
'import/order': ['error', { alphabetize: { order: 'asc' } }]
'import/order': ['error', { alphabetize: { order: 'asc' } }],
},
};
4 changes: 1 addition & 3 deletions offchain-modules/lerna.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
"version": "0.0.38",
"workspaces": [
"packages/*"
],
"workspaces": ["packages/*"],
"npmClient": "yarn",
"useWorkspaces": true,
"command": {
Expand Down
4 changes: 1 addition & 3 deletions offchain-modules/packages/app-monitor/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,5 @@
"sourceMap": true,
"downlevelIteration": true
},
"exclude": [
"node_modules"
]
"exclude": ["node_modules"]
}
2 changes: 1 addition & 1 deletion offchain-modules/packages/app-rpc-server/src/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ export class ForceBridgeAPIV1Handler implements API.ForceBridgeAPIV1 {
const assetFut = this.getAccountBalance(value);
balanceFutures.push(assetFut);
}
return (await Promise.all(balanceFutures)) as unknown as Promise<GetBalanceResponse>;
return ((await Promise.all(balanceFutures)) as unknown) as Promise<GetBalanceResponse>;
}

async getAccountBalance(value: BalancePayload): Promise<AssetType> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ test('test Reconciliation', (t) => {
new Reconciliation(
[
{
amount: new BigNumber('0x016345785d8a0000') as unknown as string,
amount: (new BigNumber('0x016345785d8a0000') as unknown) as string,
txId: '0xa776aebf68482d52715a0eb5e9fb8136322ef32d569af57ac9dde2c05681a8ec',
},
],
Expand Down
6 changes: 3 additions & 3 deletions offchain-modules/packages/scripts/src/demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ const mint = async () => {
witnesses: [{ lock: '', inputType: '', outputType: '' }],
outputsData: [bigintToSudtAmount(100), '0x', '0x'],
};
const signedTx = ckb.signTransaction(PRI_KEY)(rawTx as unknown as CKBComponents.RawTransaction);
const signedTx = ckb.signTransaction(PRI_KEY)((rawTx as unknown) as CKBComponents.RawTransaction);
console.dir({ signedTx }, { depth: null });
const mintTxHash = await ckb.rpc.sendTransaction(signedTx);
console.log(`Mint Transaction has been sent with tx hash ${mintTxHash}`);
Expand Down Expand Up @@ -307,7 +307,7 @@ const burn = async (sudtCell) => {
outputsData: [bigintToSudtAmount(99), bigintToSudtAmount(1)],
};
console.dir({ rawTx }, { depth: null });
const signedTx = ckb.signTransaction(PRI_KEY)(rawTx as unknown as CKBComponents.RawTransaction);
const signedTx = ckb.signTransaction(PRI_KEY)((rawTx as unknown) as CKBComponents.RawTransaction);
console.dir({ signedTx }, { depth: null });
const burnTxHash = await ckb.rpc.sendTransaction(signedTx);
console.log(`Burn Transaction has been sent with tx hash ${burnTxHash}`);
Expand Down Expand Up @@ -335,4 +335,4 @@ const bootstrap = async () => {
nconf.save();
};

bootstrap();
void bootstrap();
35 changes: 21 additions & 14 deletions offchain-modules/packages/scripts/src/devDocker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,21 +308,28 @@ async function main() {
sudtSize: 500,
},
};
const { assetWhiteList, ckbDeps, ownerConfig, bridgeEthAddress, multisigConfig, ckbStartHeight, ethStartHeight } =
await deployDev(
ETH_RPC_URL,
CKB_RPC_URL,
CKB_INDEXER_URL,
MULTISIG_NUMBER,
MULTISIG_THRESHOLD,
ETH_PRIVATE_KEY,
CKB_PRIVATE_KEY,
'DEV',
'0x01',
path.join(configPath, 'deployConfig.json'),
);
const {
assetWhiteList,
ckbDeps,
ownerConfig,
bridgeEthAddress,
multisigConfig,
ckbStartHeight,
ethStartHeight,
} = await deployDev(
ETH_RPC_URL,
CKB_RPC_URL,
CKB_INDEXER_URL,
MULTISIG_NUMBER,
MULTISIG_THRESHOLD,
ETH_PRIVATE_KEY,
CKB_PRIVATE_KEY,
'DEV',
'0x01',
path.join(configPath, 'deployConfig.json'),
);
await generateConfig(
initConfig as unknown as Config,
(initConfig as unknown) as Config,
assetWhiteList,
ckbDeps,
ownerConfig,
Expand Down
35 changes: 21 additions & 14 deletions offchain-modules/packages/scripts/src/integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,27 +334,34 @@ async function main() {
confirmNumber: 1,
},
};
const { assetWhiteList, ckbDeps, ownerConfig, bridgeEthAddress, multisigConfig, ckbStartHeight, ethStartHeight } =
await deployDev(
ETH_RPC_URL,
CKB_RPC_URL,
CKB_INDEXER_URL,
MULTISIG_NUMBER,
MULTISIG_THRESHOLD,
ETH_PRIVATE_KEY,
CKB_PRIVATE_KEY,
'DEV',
'0x01',
path.join(configPath, 'deployConfig.json'),
);
const {
assetWhiteList,
ckbDeps,
ownerConfig,
bridgeEthAddress,
multisigConfig,
ckbStartHeight,
ethStartHeight,
} = await deployDev(
ETH_RPC_URL,
CKB_RPC_URL,
CKB_INDEXER_URL,
MULTISIG_NUMBER,
MULTISIG_THRESHOLD,
ETH_PRIVATE_KEY,
CKB_PRIVATE_KEY,
'DEV',
'0x01',
path.join(configPath, 'deployConfig.json'),
);

const extraMultiSigConfig = {
threshold: EXTRA_MULTISIG_NUMBER,
verifiers: lodash.range(EXTRA_MULTISIG_NUMBER).map((_i) => genRandomVerifierConfig()),
};
logger.info(`extra multiSig config ${JSON.stringify(extraMultiSigConfig, null, 2)}`);
await generateConfig(
initConfig as unknown as Config,
(initConfig as unknown) as Config,
assetWhiteList,
ckbDeps,
ownerConfig,
Expand Down
37 changes: 22 additions & 15 deletions offchain-modules/packages/scripts/src/testnetDocker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,22 +330,29 @@ async function main() {
ckbDepsFromFile = JSON.parse(fs.readFileSync(ckbDepsPath, 'utf8'));
}

const { assetWhiteList, ckbDeps, ownerConfig, bridgeEthAddress, multisigConfig, ckbStartHeight, ethStartHeight } =
await deployDev(
ETH_RPC_URL,
CKB_RPC_URL,
CKB_INDEXER_URL,
MULTISIG_NUMBER,
MULTISIG_THRESHOLD,
ETH_PRIVATE_KEY,
CKB_PRIVATE_KEY,
'AGGRON4',
'0x01',
path.join(configPath, 'deployConfig.json'),
ckbDepsFromFile,
);
const {
assetWhiteList,
ckbDeps,
ownerConfig,
bridgeEthAddress,
multisigConfig,
ckbStartHeight,
ethStartHeight,
} = await deployDev(
ETH_RPC_URL,
CKB_RPC_URL,
CKB_INDEXER_URL,
MULTISIG_NUMBER,
MULTISIG_THRESHOLD,
ETH_PRIVATE_KEY,
CKB_PRIVATE_KEY,
'AGGRON4',
'0x01',
path.join(configPath, 'deployConfig.json'),
ckbDepsFromFile,
);
await generateConfig(
initConfig as unknown as Config,
(initConfig as unknown) as Config,
assetWhiteList,
ckbDeps,
ownerConfig,
Expand Down
Loading

0 comments on commit 49446d9

Please sign in to comment.