Seascape Network
EN
EN
  • Welcome to Seascape
  • Guides
    • How to use the Scape Store Swapping Feature
    • How to Play Profit Circus
    • Guide to NFT Brawl
    • Guide to Staking Saloon
    • Guide to Scape Forum
    • Guide to Zombie Farm
    • Bridge Your MSCP between MOVR and BSC
    • Guide to join the pCWS Pools and NFT Trading
  • SMARTCONTRACTS
    • Addresses
      • Lighthouse
      • Changelog
    • Installation
    • Seascape NFT (SCAPES)
    • Crowns (CWS) token
  • Game for Developers
    • API Urls
    • Seascape Nft
    • Game 2: NFT BRAWL
      • Leaderboard
    • Game 5: Zombie Farm
      • Glossary
      • Reward categories
      • Option categories
      • API call order
  • Scape Store (Marketplace)
    • Config
    • Nft Swap
    • RPC backend
    • Smartcontract Changelog
  • API changelog
  • Seadex
    • Intro
    • Local deployment
    • Addresses
    • Managing Token
      • Add supported token to Factory
  • Lighthouse (IDO)
    • API
    • Smartcontrontracts
      • Tiers
    • Installation
  • Seascape SDK
    • Intro
    • Installation
    • Features
      • Shared Smartcontract Parameters
        • Configuration Format
        • Seascape CDN Config
        • CdnWrite
          • Truffle Framework
          • Hardhat Framework
          • Non-framework update
        • CDN Read
      • Server Proof
        • Smartcontract Data
        • Proof of Server
Powered by GitBook
On this page

Was this helpful?

  1. Seascape SDK
  2. Features
  3. Shared Smartcontract Parameters
  4. CdnWrite

Non-framework update

Explains how to upload the smartcontract configuration onto Seascape CDN

PreviousHardhat FrameworkNextCDN Read

Last updated 2 years ago

Was this helpful?

We assume that you installed the `seascape` module in your project. If not then please follow the instructions.

We assume that you already defined how to configure the smartcontracts path. So that you can give it to the website/backend developers. For more reminding please check the page.

We also assume that you got the credentials and setted up the .env with the CDN credentials. For more information check the page.

Scripts

Why would you update without the framework?

First, you would need the Configuration file itself. If the configuration doesn't exist, then CdnRead will create an empty configuration for you.

import { 
    CdnRead, 
    CdnWrite, 
    ConfigPath,             // project path
    SmartcontractConfig,     // smartcontract config object with address etc.
    SmartcontractPath         // smartcontract address path inside the config.json
} from "seascape";

let main = async() => {
    let path = {project: 'lighthouse', env: 'beta'} as ConfigPath;
    
    let initialized = await CdnRead.initConfig(path);
    if (!initialized) {
        console.log(`Global initializiation failed`);
        process.exit(1);
    } 
}

Once you called the CdnRead.initConfig(), it will make the configuration available at global.seascapeConfig variable.

Then we need to prepare the smartcontract that we want to update. Here is the rest of the main function().

    // CDN client
    let client = await CdnWrite.connectCdn(
        process.env.ALIBABA_REGION, 
        process.env.ALIBABA_ACCESSID, 
        process.env.ALIBABA_SECRET,
        process.env.ALIBABA_BUCKET
    );
    if (client === undefined) {
        console.log(`Could not connect to the CDN`);
        process.exit(2);
    }

    // Smartcontract Config
    let smartcontract = {
        name: "MSCP ALLO",
        address: "0x93Efe41A6a5377bC1d7DD43412fD14B4bA0134Fb",
        abi: "https://...",
    } as SmartcontractConfig;

    // Path of the smartcontract inside the config.json
    let smartcontractPath = {
        networkId: 1287,
        type: 'nfts'
    } as SmartcontractPath;

    // update the Smartcontract
    let updated = await CdnWrite.setSmartcontract(path, client, smartcontractPath, smartcontract);
    console.log(`Was CDN updated successfully? ${updated}`);

Check the <project name> and <project env>. Those are indicating the path of the configuration file.

Then, we set the configuration onto CDN using the setHardhatSmartcontract() function of CdnWrite module.

The uploaded smartcontract config will be available for checking at:

Once the smartcontract configuration is uploaded onto the CDN, as the Smartcontract writer should share the project name, project environment, Smartcontract name, the methods to call, the logs to listen to the appropriate developers.

Seascape SDK/Installation
Configuration format
CDN Write module
https://cdn.seascape.network/lighthouse/beta/config.jsoncdn.seascape.network
Check the result of the custom configuration update.