Solidity
將 Typescript 依賴項與 Solidity 合約連接起來
如何將我的契約與 typscript 依賴項(https://www.npmjs.com/package/@dydxprotocol/exchange-wrappers)聯繫起來。
如果這些資訊不足以提供解決方案,請寫下您需要的內容。
我使用0xWeb生成 typescript 類來直接訪問區塊鏈
$ npm i 0xweb -g $ 0xweb init $ 0xweb install 0xab33e884ec8fed4f5867246e4300228f3d666561 --name dydx/oasis-matching-exchange --chain eth
然後使用生成的類發送Tx
import { DydxOasisMatchingExchange } from '@0xweb/eth/dydx/oasis-matching-exchange/oasis-matching-exchange'; async function submit () { let contract = new DydxOasisMatchingExchange(); let account = { key: '' } let tradeOriginator = '0x...'; let receiver = '0x..'; let makerToken = '0x...'; let takerToken = '0x...'; let requestedFillAmount = 1n; let orderData = '0x....'; // send the tx let tx = await contract.exchange( account, tradeOriginator, receiver, makerToken, takerToken, requestedFillAmount, orderData ); let receipt = await tx.receipt; } submit();