ProjectOpenSea / opensea-creatures

Example non-fungible collectible, to demonstrate OpenSea integration
https://docs.opensea.io
MIT License
1.17k stars 790 forks source link

createFactorySellOrders get API Error 404: Not found. Full message was '{"success":false} #170

Open larry-lmw opened 2 years ago

larry-lmw commented 2 years ago

I tried to build the project and deployed in rinkeby network for creature accessories sale. Everything seemed fine except that trying to run /scripts/creature-accessories/init-sales.js caused error "API Error 404: Not found. Full message was '{"success":false}"

I put here the log file for contracts deployment


759.bundled.js:2660Warning: Please rename truffle.js to truffle-config.js to ensure Windows compatibility.
759.bundled.js:3070
Compiling your contracts...
759.bundled.js:3071===========================
759.bundled.js:3106> Compiling .\contracts\Creature.sol
759.bundled.js:3106> Compiling .\contracts\CreatureAccessory.sol
759.bundled.js:3106> Compiling .\contracts\CreatureAccessoryFactory.sol
759.bundled.js:31062> Compiling .\contracts\CreatureAccessoryLootBox.sol
759.bundled.js:3106> Compiling .\contracts\CreatureFactory.sol
759.bundled.js:3106> Compiling .\contracts\CreatureLootBox.sol
759.bundled.js:3106> Compiling .\contracts\ERC1155Tradable.sol
759.bundled.js:3106> Compiling .\contracts\ERC721Tradable.sol
759.bundled.js:3106> Compiling .\contracts\IFactoryERC1155.sol
759.bundled.js:3106> Compiling .\contracts\IFactoryERC721.sol
759.bundled.js:3106> Compiling .\contracts\LootBoxRandomness.sol
759.bundled.js:3106> Compiling .\contracts\Migrations.sol
759.bundled.js:3106> Compiling .\contracts\common\meta-transactions\ContentMixin.sol
759.bundled.js:3106> Compiling .\contracts\common\meta-transactions\EIP712Base.sol
759.bundled.js:3106> Compiling .\contracts\common\meta-transactions\Initializable.sol
759.bundled.js:3106> Compiling .\contracts\common\meta-transactions\NativeMetaTransaction.sol
759.bundled.js:3106> Compiling .\contracts\test\ApprovedSpenderContract.sol
759.bundled.js:3106> Compiling .\contracts\test\MockProxyRegistry.sol
759.bundled.js:3106> Compiling .\contracts\test\TestForReentrancyAttack.sol
759.bundled.js:3078> Artifacts written to V:\projects\opensea-creatures-master\build\contracts
759.bundled.js:3079> Compiled successfully using:
759.bundled.js:3093   - solc: 0.8.10+commit.fc410830.Emscripten.clang
4493 > Duplicate contract names found for OwnableDelegateProxy. > This can cause errors and unknown behavior. Please rename one of your contracts.
4493 > Duplicate contract names found for ProxyRegistry. > This can cause errors and unknown behavior. Please rename one of your contracts.
759.bundled.js:26602Warning: Please rename truffle.js to truffle-config.js to ensure Windows compatibility.
26706
26728

Starting migrations...

Network name: 'rinkeby' Network id: 4 Block gas limit: 29970676 (0x1c950f4)

2_deploy_contracts.js

2_deploy_contracts.js:29==> Network rinkeby 2_deploy_contracts.js:30

Deploying 'CreatureAccessory'

transaction hash: 0xb811cf27931951e4d0cdeea8051322ce4a2759e45dd435db60ebed5b081a8a40 Blocks: 2 Seconds: 25 contract address: 0x3A7FB4D6Ac94C7dD2399803be4c62c90A321fa18 block number: 9831352 block timestamp: 1639765000 account: 0x0D68FB39952D2e94BA657CE56A84bccc0D488Dd2 balance: 0.484155203663517612 gas used: 2752235 (0x29feeb) gas price: 1.000000009 gwei value sent: 0 ETH total cost: 0.002752235024770115 ETH 2_deploy_contracts.js:59===> DEPLOY_ACCESSORIES deployed CreatureAccessory at 0x3A7FB4D6Ac94C7dD2399803be4c62c90A321fa18

Deploying 'LootBoxRandomness'

transaction hash: 0x9fdfeee268e33151c32117ec541050803904a7996c3dfb0f0ac52807c46b7643 Blocks: 1 Seconds: 9 contract address: 0x5F2F72a72113609C1994b6E9cF056C3E9ECFbbd9 block number: 9831360 block timestamp: 1639765120 account: 0x0D68FB39952D2e94BA657CE56A84bccc0D488Dd2 balance: 0.483089012651206463 gas used: 486417 (0x76c11) gas price: 1.000000012 gwei value sent: 0 ETH total cost: 0.000486417005837004 ETH 26888 Linking

  • Contract: CreatureAccessoryLootBox <--> Library: LootBoxRandomness (at address: 0x5F2F72a72113609C1994b6E9cF056C3E9ECFbbd9)

Deploying 'CreatureAccessoryLootBox'

transaction hash: 0xc0c2f9f17b853ed4751977f2f5aee6645848c781c604f923545f22b9c8a96ff1 Blocks: 1 Seconds: 9 contract address: 0x6544394bcB15Ab18A61b57d75f1446Ab25D806f3 block number: 9831361 block timestamp: 1639765135 account: 0x0D68FB39952D2e94BA657CE56A84bccc0D488Dd2 balance: 0.479003186606262377 gas used: 4085826 (0x3e5842) gas price: 1.000000011 gwei value sent: 0 ETH total cost: 0.004085826044944086 ETH

Deploying 'CreatureAccessoryFactory'

transaction hash: 0x590c8cf14a80a6f814fa94b1982c80b8276c04e318eddaf60016b0d91047805c Blocks: 2 Seconds: 17 contract address: 0x19Fadfea71e74DcAE335F244AfeD34F74d46c917 block number: 9831363 block timestamp: 1639765165 account: 0x0D68FB39952D2e94BA657CE56A84bccc0D488Dd2 balance: 0.477915187594294388 gas used: 1087999 (0x1099ff) gas price: 1.000000011 gwei value sent: 0 ETH total cost: 0.001087999011967989 ETH Saving migration to chain. Saving artifacts

Total cost: 0.008412477087519194 ETH

Summary

Total deployments: 4 Final cost: 0.008412477087519194 ETH

I put here the code for init_sale.js

const {WyvernSchemaName} = require('opensea-js/lib/types') const HDWalletProvider = require("@truffle/hdwallet-provider"); const opensea = require('opensea-js'); const Network = opensea.Network; const OpenSeaPort = opensea.OpenSeaPort;

/////////////////////// // Variables /////////////////////// const INFURA_API = "xxx"; const ACCOUNT_ADDRESS = "xxx"; const FACTORY_CONTRACT_ADDRESS = "0x19Fadfea71e74DcAE335F244AfeD34F74d46c917"; const MNEMONIC = "xxx"

const provider = new HDWalletProvider({ mnemonic: { phrase: MNEMONIC }, providerOrUrl: "https://rinkeby.infura.io/v3/" + INFURA_API });

const seaport = new OpenSeaPort(provider, { networkName: Network.Rinkeby });

/////////////////////// // More Variables /////////////////////// const FIXED_PRICE = 0.07;

/////////////////////// // Main /////////////////////// async function main() {

const optionId = 1;

const numOrders = await seaport.createFactorySellOrders({
    assets: [
        {
            tokenId: optionId,
            tokenAddress: FACTORY_CONTRACT_ADDRESS,
            // Comment the next line if this is an ERC-721 asset (defaults to ERC721):
            schemaName: WyvernSchemaName.ERC1155,
        },
    ],
    // Quantity of each asset to issue
    quantity: 1,
    accountAddress: ACCOUNT_ADDRESS,
    startAmount: FIXED_PRICE,
    // Number of times to repeat creating the same order for each asset. If greater than 5, creates them in batches of 5. Requires an `apiKey` to be set during seaport initialization:
    numberOfOrders: 1,
})
console.log(`Successfully made fixed-price sell orders!\n`)

}

/////////////////////// // Main Start /////////////////////// main() .then(() => process.exit(0)) .catch(error => { console.error(error); process.exit(1); });

Joseph-Cardwell commented 2 years ago

also getting this

FantasyGameFoundation commented 2 years ago

I have the same problem, please do you solve it?

Lebski commented 2 years ago

Did you provide an OpenSea API key?

Lebski commented 2 years ago

What solved the issue for me is that I replaced the FACTORY_CONTRACT_ADDRESS

    assets: [
        {
            tokenId: optionId,
            tokenAddress: FACTORY_CONTRACT_ADDRESS,
            // Comment the next line if this is an ERC-721 asset (defaults to ERC721):
            schemaName: WyvernSchemaName.ERC1155,
        },

with my actual CONTRACT_ADDRESS and NOT the address of the factory.

Deathwing commented 2 years ago

Any news here? For us the factory usage seems also not to work...same error

Lebski commented 2 years ago

Any news here? For us the factory usage seems also not to work...same error

AFAIK factory doesnt work correctly with their example since they changed their whole API

Deathwing commented 2 years ago

I tried a couple of things, but it seems a factory pattern, or basically minting your NFTs on opensea is currently not working right?

Deathwing commented 2 years ago

I found a way to deploy a working factory + get the opensea createSellOrder working for it, take look if you still need it: https://gist.github.com/Deathwing/b49c03c465c17312f8affc536b5ea64d