GithubHelp home page GithubHelp logo

webraizo30 / ar-io-network Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ar-io/testnet-contract

0.0 0.0 0.0 2.93 MB

Smartweave Contract code and tools relating to the AR.IO Network, including the Arweave Name System and Gateway Address Registry

Home Page: https://ar.io

License: GNU Affero General Public License v3.0

Shell 0.13% JavaScript 2.47% TypeScript 97.39%

ar-io-network's Introduction

AR.IO Network Test SmartWeave Contract

Project setup

Clone this repository and install the dependencies.

  • nvm use
  • yarn install
  • yarn build

Testing

Unit and integration tests are written using Jest. Setup files are located in tests directory.

Integration Tests

Integration tests are located in the tests directory and run against ArLocal. They deploy multiple Smartweave contract using Warp SDK.

  • yarn test:integration - runs full test suite
  • yarn test:integration -t 'Auctions' - runs integration tests that match this spec name (e.g. Auctions)
  • yarn test tests/records.test.ts - runs a specific test file (e.g. records.test.ts)

Unit Tests

Unit tests are located in the src directory and run against the source code directly.

  • yarn test:unit - runs full unit test suite located in tests/unit
  • yarn test:unit -t 'submitAuctionBid' - runs unit tests that match this spec name (e.g. submitAuctionBid)

Linting & Formatting

Eslint and Prettier are used for static analysis and formatting.

  • yarn format:fix - runs prettier and fixes any formatting issues
  • yarn lint:fix - runs eslint and fixes any linting issues

Tools

In order to deploy contracts and use the functions within the AR.IO Network, like Arweave Name System and the Gateway Address Registry, the following tools are available to be used.

Make sure to update the variables at the top of the respective file before running.

You can also modify the script to use dryWrite following Warps documentation here.

Environment Variables

  • JWK - the stringified JWK you want to use when writing interactions or deploying contracts
  • ARNS_CONTRACT_TX_ID - the IO Testnet contract ID (defaulted to bLAgYxAdX2Ry-nt6aH2ixgvJXbpsEYm28NgJgyqfs-U)

You can copy .env.sample to .env and fill in the values before executing any scripts.

Arweave Name System (ArNS)

The following tools can be used to perform basic ArNS operations such as name purchase, ANT creation, and ANT transfer.

  • buy-arns-name - purchases a new ArNS Name in the registry (if available) and adds the reference to an existing ANT Smartweave Contract ID

    yarn ts-node tools/buy-arns-name.ts
  • buy-arns-name-atomic-ant - "atomically" registers an ArNS name, which includes the generation of a new ANT within the same transaction as the ArNS Name registration. pointer and the ANT Smartweave Contract Source Transaction ID. Please note that only the @ sub domain will work at this time, and it is hard-coded into the script.

    yarn ts-node tools/buy-arns-name-atomic-ant.ts

AR.IO Testnet Network

The following tools can be used to perform basic AR.IO Network operations, such as joining and leaving the network, along with managing the onchain settings of a Gateway.

  • join-network - takes a Gateway into the ar.io network and adds the Gateway into the Gateway Address Registry. This detail includes the Gateway Operator’s public wallet address, fully qualified domain name, port, protocol, properties and friendly note.

    yarn ts-node tools/join-network.ts
  • update-gateway-settings - modify the settings of an existing registered Gateway record in the Gateway Address Registry, like the friendly name, fully qualified domain name, port, protocol, status, properties, and note.

    yarn ts-node tools/update-gateway-settings.ts
  • increase-operator-stake - increase the token amount staked for an existing registered Gateway.

    yarn ts-node tools/increase-operator-stake.ts
  • initiate-operator-stake-decrease - initiate a stake decrease for an existing registered Gateway

    yarn ts-node tools/initiate-operator-stake-decrease.ts
  • initiate-leave-network - initiate network withdraw period to remove a registered Gateway from the Gateway Address Registry and return all gateway operator stakes.

    yarn ts-node tools/initiate-leave-network.ts

ar-io-network's People

Contributors

vilenarios avatar dtfiedler avatar atticusofsparta avatar enzifiri avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.