本文整理匯總了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,
),
);
});