rosetta-solana-go

command module
v0.0.0-...-60eaa49 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 8, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

README

Rosetta

Rosetta Solana

ROSETTA-SOLANA IS CONSIDERED ALPHA SOFTWARE. USE AT YOUR OWN RISK!

Overview

rosetta-solana-go provides a reference implementation of the Rosetta API for Solana in Go. If you haven't heard of the Rosetta API, you can find more information here.

Features

  • Rosetta API implementation (both Data API and Construction API)
  • Stateless, offline, curve-based transaction construction

Usage

As specified in the Rosetta API Principles, all Rosetta implementations must be deployable via Docker and support running via either an online or offline mode.

Direct Install

After cloning this repository, run:

go build -o rosettasolanago

docker

docker build -t rosetta-sol-go .
RPC_URL=https://api.mainnet-beta.solana.com PORT=8080 NETWORK=MAINNET MODE=ONLINE docker-compose up

Testing with rosetta-cli

To validate rosetta-solana, install rosetta-cli and run one of the following commands:

  • rosetta-cli check:data --configuration-file rosetta-cli-conf/testnet/devnet.json
  • rosetta-cli check:construction --configuration-file rosetta-cli-conf/testnet/devnet.json

Development

  • RPC_URL=https://devnet.solana.com PORT=8080 NETWORK=TESTNET MODE=ONLINE go run *.go run to run server

Details

Endpoints Implemented

    /network/list (network_list)
    /network/options (network_options)
    /network/status (network_status)
    /account/balance (account_balance)
    /block (get_block)
    /block/transaction (block_transaction)
    /construction/combine (construction_combine)
    /construction/derive (construction_derive)
    /construction/hash (construction_hash)
    /construction/metadata (construction_metadata)
    /construction/payloads (construction_payloads)
    /construction/preprocess (construction_preprocess)
    /construction/submit (construction_submit)
    /construction/parse (construction_parse)
    /call (call)
        
Environment variables
RPC_URL = "https://api.mainnet-beta.solana.com" (optional)
NETWORK = "MAINNET" //MAINNET/TESTNET/DEVNET (required)
PORT = "8080" (optional)
MODE = "ONLINE" //ONLINE/OFFLINE (required)
Operations supported

See types::OperationType to see full list of current operations supported . This list might not be up to date.

 
		System__Transfer,
		System__CreateAccount,
		System__Assign,
		System__CreateNonceAccount,
		System__AdvanceNonce,
		System__WithdrawFromNonce,
		System__AuthorizeNonce,
		System__Allocate,
		SplToken__Transfer,
		SplToken__InitializeMint,
		SplToken__InitializeAccount,
		SplToken__CreateToken,
		SplToken__CreateAccount,
		SplToken__Approve,
		SplToken__Revoke,
		SplToken_MintTo,
		SplToken_Burn,
		SplToken_CloseAccount,
		SplToken_FreezeAccount,
		SplToken__TransferChecked,
		Unknown,

See https://github.com/imerkle/rosetta-solana-go/blob/master/USAGE.md for examples of request body for every operations

TODO

  • Add more ops
  • Write tests

NOTE

This is a go port of https://github.com/imerkle/rosetta-solana originally written in rust.

License

This project is available open source under the terms of the Apache 2.0 License.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL