-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor: remove models/script and repalce with lumos #2762
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ import { AppendScript, BlockTips, Connector } from './connector' | |
import LightConnector from './light-connector' | ||
import { generateRPC } from '../../utils/ckb-rpc' | ||
import { BUNDLED_LIGHT_CKB_URL } from '../../utils/const' | ||
import { utils } from '@ckb-lumos/base' | ||
|
||
export default class Queue { | ||
#lockHashes: string[] | ||
|
@@ -50,13 +51,13 @@ export default class Queue { | |
.map(blake160 => [ | ||
blake160, | ||
Multisig.hash([blake160]), | ||
SystemScriptInfo.generateSecpScript(blake160).computeHash().slice(0, 42), | ||
utils.computeScriptHash(SystemScriptInfo.generateSecpScript(blake160)).slice(0, 42), | ||
]) | ||
.flat() | ||
) | ||
this.#multiSignBlake160s = blake160s.map(blake160 => Multisig.hash([blake160])) | ||
this.#anyoneCanPayLockHashes = blake160s.map(b => | ||
this.#assetAccountInfo.generateAnyoneCanPayScript(b).computeHash() | ||
utils.computeScriptHash(this.#assetAccountInfo.generateAnyoneCanPayScript(b)) | ||
) | ||
} | ||
|
||
|
@@ -217,7 +218,8 @@ export default class Queue { | |
input.setInputIndex(inputIndex.toString()) | ||
|
||
if ( | ||
previousOutput.type?.computeHash() === SystemScriptInfo.DAO_SCRIPT_HASH && | ||
previousOutput.type && | ||
utils.computeScriptHash(previousOutput.type) === SystemScriptInfo.getInstance().getDaoScriptHash() && | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why we should refactor the |
||
previousTx.outputsData![+input.previousOutput!.index] === '0x0000000000000000' | ||
) { | ||
const output = tx.outputs![inputIndex] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import { In, MigrationInterface, QueryRunner } from "typeorm"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe I should not edit this migration file, but it does not build if I don't change it, how should it be? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe changing the type will not have a side effect. |
||
import { scriptToHash } from '@nervosnetwork/ckb-sdk-utils' | ||
import { ScriptHashType } from "../../../models/chain/script"; | ||
import Output from "../entities/output"; | ||
import { HashType } from "@ckb-lumos/base"; | ||
|
||
export class UpdateOutputChequeLockHash1652945662504 implements MigrationInterface { | ||
name = 'UpdateOutputChequeLockHash1652945662504' | ||
|
@@ -11,12 +11,12 @@ export class UpdateOutputChequeLockHash1652945662504 implements MigrationInterfa | |
scriptToHash({ | ||
args: '0x' + '0'.repeat(80), | ||
codeHash: process.env.TESTNET_CHEQUE_SCRIPT_CODEHASH!, | ||
hashType: process.env.TESTNET_CHEQUE_SCRIPT_HASHTYPE! as ScriptHashType | ||
hashType: process.env.TESTNET_CHEQUE_SCRIPT_HASHTYPE! as HashType | ||
}), | ||
scriptToHash({ | ||
args: '0x' + '0'.repeat(80), | ||
codeHash: process.env.MAINNET_CHEQUE_SCRIPT_CODEHASH!, | ||
hashType: process.env.MAINNET_CHEQUE_SCRIPT_HASHTYPE! as ScriptHashType | ||
hashType: process.env.MAINNET_CHEQUE_SCRIPT_HASHTYPE! as HashType | ||
}) | ||
] | ||
const chequeOutput = await queryRunner.connection | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can keep using the class model in Neuron to keep the code pattern