當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript abi-decoder.decodeLogs函數代碼示例

本文整理匯總了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 });
}
開發者ID:TheRealest,項目名稱:charta,代碼行數:7,代碼來源:log_utils.ts

示例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));
                });
開發者ID:TheRealest,項目名稱:charta,代碼行數:25,代碼來源:repayment_router.ts

示例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;
}
開發者ID:TheRealest,項目名稱:charta,代碼行數:34,代碼來源:multisig.ts

示例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 });
    }
開發者ID:TheRealest,項目名稱:charta,代碼行數:8,代碼來源:collateralized_simple_interest_terms_contract.ts

示例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);
 });
開發者ID:TheRealest,項目名稱:charta,代碼行數:9,代碼來源:debt_token.ts

示例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);
                });
開發者ID:TheRealest,項目名稱:charta,代碼行數:11,代碼來源:debt_registry.ts

示例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);
                    });
開發者ID:TheRealest,項目名稱:charta,代碼行數:11,代碼來源:debt_token.ts

示例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;
                    });
開發者ID:TheRealest,項目名稱:charta,代碼行數:12,代碼來源:simple_interest_terms_contract.ts

示例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,
                        ),
                    );
                });
開發者ID:TheRealest,項目名稱:charta,代碼行數:13,代碼來源:collateralize.ts


注:本文中的abi-decoder.decodeLogs函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。