我正在开发一个借贷协议的前端,用户列出 NFT 以在 Solana 上借贷。我收到一个错误createListing
:
await program.instruction.createListing(
listingBump,
params, {
accounts: {
owner: wallet.publicKey,
listing: listingPubkey,
nftAccount: shipAccount,
nftMint: shipMint.publicKey,
collateralMint: collateralMint.publicKey,
feeDestination: feeDestination,
feeMint: atlasMint.publicKey,
tokenProgram: TOKEN_PROGRAM_ID,
systemProgram: SystemProgram.programId,
},
signers: [wallet]
});
这是错误:Error while creating the listing TypeError: s.TransactionInstruction is not a constructor at Object.r [as createListing] (main-packed.js:1175) at Object.createListing (solana.js:915)
这是引发它的行(在包装上):
var Y = Object.freeze({
__proto__: null,
invoke: async function (t, e, n, i) {
t = Q(t), i || (i = w());
const s = new s.Transaction();
return s.add(new s.TransactionInstruction({
programId: t,
keys: null != e ? e : [],
data: n
})), await i.send(s);
},
getMultipleAccounts: H
});
我不确定是什么引发了错误。另外,必须注意我使用的是纯 JS,因为我正在使用 Dart-JS 互操作在 Flutter 中进行开发。所以我不得不使用 Browserify/Esmify 包来捆绑所有需要的包并将它们暴露给互操作。也许这与问题有关。