Skip to content

Commit

Permalink
Merge branch 'ckb-mint' of https://github.com/fpChan/force-bridge int…
Browse files Browse the repository at this point in the history
…o ckb-mint
  • Loading branch information
fpChan committed May 12, 2021
2 parents 2f565ab + f92c763 commit 6596dee
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
19 changes: 15 additions & 4 deletions offchain-modules/src/packages/handlers/ckb.ts
Expand Up @@ -181,7 +181,7 @@ export class CkbHandler {
const firstInputLock = txPrevious.transaction.outputs[Number(tx.inputs[0].previousOutput.index)].lock;
const firstInputLockHash = this.ckb.utils.scriptToHash(<CKBComponents.Script>firstInputLock);

logger.debug(
logger.info(
`CkbHandler isMintTx tx ${tx.hash} sender lock hash is ${firstInputLockHash}. first output type code hash is ${firstOutputTypeCodeHash}.`,
);
return firstInputLockHash === committeeLockHash;
Expand Down Expand Up @@ -281,12 +281,23 @@ export class CkbHandler {
const rawTx = await generator.mint(await account.getLockscript(), records);
const signedTx = this.ckb.signTransaction(this.PRI_KEY)(rawTx);
const mintTxHash = await this.ckb.rpc.sendTransaction(signedTx);
mintRecords.map((r) => {
r.mintHash = mintTxHash;
});
logger.info(
`CkbHandler handleMintRecords Mint Transaction has been sent, ckbTxHash ${mintTxHash}, mintIds:${mintIds}`,
);
const txStatus = await this.waitUntilCommitted(mintTxHash, 200);
if (txStatus.txStatus.status === 'committed') {
mintRecords.map((r) => {
r.status = 'success';
r.mintHash = mintTxHash;
});
} else {
mintRecords.map((r) => {
r.mintHash = mintTxHash;
});
logger.error(
`CkbHandler handleMintRecords mint execute failed txStatus:${txStatus.txStatus.status}, mintIds:${mintIds}`,
);
}
await this.db.updateCkbMint(mintRecords);
logger.info('CkbHandler handleMintRecords mint execute completed, mintIds:', mintIds);
} catch (e) {
Expand Down
2 changes: 1 addition & 1 deletion offchain-modules/src/scripts/integration-test/tron.ts
Expand Up @@ -239,7 +239,7 @@ async function main() {

//await checkEffect(trc20TxHash, 'TVWvkCasxAJUyzPKMQ2Rus1NtmBwrkVyBR', 'trc20');
} catch (e) {
logger.warn(`The tron component integration not pass yet. i:${i} error:${e.toString()}`);
logger.warn(`The tron component integration not pass yet. i:${i} error:`, e);
continue;
}
logger.info('The tron component integration test pass!');
Expand Down

0 comments on commit 6596dee

Please sign in to comment.