Skip to content

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

License

Notifications You must be signed in to change notification settings

BEDLAM520/testnet-contract

 
 

Repository files navigation

AR.IO Network Test SmartWeave Contract

Project setup

Clone this repository and install the dependencies.

  • nvm use
  • yarn install
  • yarn build

Testing

Runs integration tests using arlocal. Note - these test write temporary files to your local disc.

  • yarn tests - runs full test suite
  • yarn test -t 'auctions' - runs tests that match this spec name (e.g. auctions.test.ts)

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
  • finalize-operator-stake-decrease - after stake withdraw period, this completes the operator stake decrease and returns the specific amount back to the operator.

    yarn ts-node tools/finalize-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
  • finalize-leave-network - finalize network withdraw period completes, this will finish removing the gateway from the Gateway Address Registry and returns all stakes back to the operator.

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

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 96.6%
  • JavaScript 3.4%