试图学习如何使用 opensea-js 并被困在这个错误上
得到错误没有找到钱包地址
我给了我的钱包地址和 metamask 副本的 memic 代码,所以不会错(我希望)
尝试测试获取卖单并履行卖单
错误 :
错误:在 Object.validateAndFormatWalletAddress 找不到钱包地址
import Web3 from "web3";
import { OpenSeaPort, Network } from 'opensea-js'
import { EventType } from 'opensea-js'
import { OrderSide } from 'opensea-js/lib/types.js'
import { timer } from 'rxjs';
import { take } from 'rxjs/operators';
import MnemonicWalletSubprovider from "@0x/subproviders"
import RPCSubprovider from 'web3-provider-engine/subproviders/rpc.js';
import Web3ProviderEngine from "web3-provider-engine"
const MY_ACCOUNT="XXXX"
const YOUR_API_KEY="XXX"
const tokenAddress= "0x88b48f654c30e99bc2e4a1559b4dcf1ad93fa656" // CryptoKitties
const tokenId= "64538205120729008317761756156621704067836906423535342168637960978852252483585" // Token ID
const network = Network.Rinkeby
const NODE_API_KEY="XXX"
const isInfura="XXX"
const MNEMONIC="XXXX" // wallnet code
//const BASE_DERIVATION_PATH = `44'/60'/0'/0`;
const mnemonicWalletSubprovider = new MnemonicWalletSubprovider.MnemonicWalletSubprovider
({
mnemonic: MNEMONIC,
//baseDerivationPath: BASE_DERIVATION_PATH,
});
const infuraRpcSubprovider = new RPCSubprovider({
rpcUrl: isInfura
? "https://" + network + ".infura.io/v3/" + NODE_API_KEY
: "https://eth-" + network + ".alchemyapi.io/v2/" + NODE_API_KEY,
});
const providerEngine = new Web3ProviderEngine();
providerEngine.addProvider(mnemonicWalletSubprovider);
providerEngine.addProvider(infuraRpcSubprovider);
providerEngine.start();
const seaport = new OpenSeaPort(
providerEngine,
{
networkName: Network.Rinkeby},
(arg) => console.log(arg)
);
await timer(1000).pipe(take(1)).toPromise();
// Get page 2 of all auctions, a.k.a. orders where `side == 1`
const order2 = await seaport.api.getOrders({
asset_contract_address: tokenAddress,
token_id: tokenId,
side: OrderSide.Sell
})
await timer(1000).pipe(take(1)).toPromise();
const transactionHash = await seaport.fulfillOrder({ order2, MY_ACCOUNT })