本文整理汇总了TypeScript中abi-decoder.decodeLogs函数的典型用法代码示例。如果您正苦于以下问题:TypeScript decodeLogs函数的具体用法?TypeScript decodeLogs怎么用?TypeScript decodeLogs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了decodeLogs函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: queryLogsForEvent
export async function queryLogsForEvent(
txHash: string,
eventName: string,
): Promise<ABIDecoder.DecodedLog | undefined> {
const receipt = await web3.eth.getTransactionReceipt(txHash);
return _.find(ABIDecoder.decodeLogs(receipt.logs), { name: eventName });
}
示例2: before
before(async () => {
await principalToken.setBalance.sendTransactionAsync(PAYER, Units.ether(1.1), {
from: CONTRACT_OWNER,
});
await principalToken.approve.sendTransactionAsync(
tokenTransferProxy.address,
Units.ether(1.1),
{ from: PAYER },
);
payerBalanceBefore = await principalToken.balanceOf.callAsync(PAYER);
beneficiaryBalanceBefore = await principalToken.balanceOf.callAsync(
BENEFICIARY_1,
);
const txHash = await router.repay.sendTransactionAsync(
agreementId,
Units.ether(1.1),
principalToken.address,
{ from: PAYER },
);
receipt = await web3.eth.getTransactionReceipt(txHash);
[repaymentLog] = _.compact(ABIDecoder.decodeLogs(receipt.logs));
});
示例3: submitMultiSigTransaction
export async function submitMultiSigTransaction(
multiSig: DharmaMultiSigWalletContract,
contract: BaseContract,
methodName: string,
args: any[],
txData: TxData,
): Promise<BigNumber> {
ABIDecoder.addABI(multiSig.abi);
const encodedTransaction = await contract.web3ContractInstance[methodName].getData.apply(
null,
args,
);
const txHash = await multiSig.submitTransaction.sendTransactionAsync(
contract.address,
// Ether value - 0.
new BigNumber(0),
encodedTransaction,
txData,
);
// Get the transaction ID from the logs.
const receipt = await web3.eth.getTransactionReceipt(txHash);
const submission = ABIDecoder.decodeLogs(receipt.logs)[0] as DecodedLog<
MultiSigSubmissionEventArgs
>;
const transactionId = submission.events[0].value;
ABIDecoder.removeABI(multiSig.abi);
return transactionId;
}
示例4: getLogs
protected async getLogs(
txHash: string,
event: string,
): Promise<ABIDecoder.DecodedLog | undefined> {
const receipt = await web3.eth.getTransactionReceipt(txHash);
return _.find(ABIDecoder.decodeLogs(receipt.logs), { name: event });
}
示例5: before
before(async () => {
const txHash = await debtToken.transfer.sendTransactionAsync(
TOKEN_OWNER_2,
DEBT_ENTRY_1.getTokenId(),
{ from: TOKEN_OWNER_2 },
);
const res = await web3.eth.getTransactionReceipt(txHash);
[transferLog] = ABIDecoder.decodeLogs(res.logs);
});
示例6: it
it("should emit a log saying the debt is edited", () => {
const [logReturned] = ABIDecoder.decodeLogs(res.logs);
const logExpected = LogModifyEntryBeneficiary(
registry.address,
entry.getIssuanceHash(),
entry.getBeneficiary(),
BENEFICIARY_2,
);
expect(logReturned).to.deep.equal(logExpected);
});
示例7: it
it("should emit approval log", () => {
const [approvalLog] = ABIDecoder.decodeLogs(res.logs);
const logExpected = LogApproval(
debtToken.address,
TOKEN_OWNER_1,
NULL_ADDRESS,
DEBT_ENTRY_2.getTokenId(),
);
expect(approvalLog).to.deep.equal(logExpected);
});
示例8: it
it("should not emit log indicating success", async () => {
const txHash = await termsContract.registerTermStart.sendTransactionAsync(
ARBITRARY_AGREEMENT_ID,
DEBTOR,
{
from: MOCK_DEBT_KERNEL_ADDRESS,
},
);
const receipt = await web3.eth.getTransactionReceipt(txHash);
expect(_.compact(ABIDecoder.decodeLogs(receipt.logs))).to.be.empty;
});
示例9: it
it("should emit log that collateral has been secured", async () => {
const receipt = await web3.eth.getTransactionReceipt(txHash);
const [collateralLockedLog] = compact(ABIDecoder.decodeLogs(receipt.logs));
expect(collateralLockedLog).to.deep.equal(
CollateralLocked(
collateralizer.address,
scenario.agreementId,
mockCollateralToken.address,
scenario.expectedCollateralAmount,
),
);
});