0

我在 nodejs 中使用 stellar-sdk 进行销售,它显示以下错误:

Error: TypeError: Cannot read property 'toXDRObject' of undefined

我的代码:

import StellarSdk from 'stellar-sdk';

const stellarServer = new StellarSdk.Server(
    'https://horizon-testnet.stellar.org'
);

const account = await stellarServer.loadAccount(testAccount.publicKey);

const fee = await stellarServer.fetchBaseFee();

const SLTIssuerId = GCKA6K5PCQ6PNF5RQBF7PQDJWRHO6UOGFMRLK3DYHDOI244V47XKQ4GP;

const XLMAsset = new StellarSdk.Asset('XLM');
const SLTAsset = new StellarSdk.Asset('SLT', SLTIssuerId);

const transaction = new StellarSdk.TransactionBuilder(account, {
    fee,
    networkPassphrase: StellarSdk.Networks.TESTNET
})
    .addOperation(
        StellarSdk.Operation.manageSellOffer({
            selling: SLTAsset,
            buy: XLMAsset,
            price: { n: numerator, d: denominator },
            amount: '2'
        })
    )
    .setTimeout(180)
    .build();

任何人都可以帮忙吗?我是区块链新手。

4

0 回答 0