API Reference

Note: The API is still in beta and subject to change

User Endpoints

Get User

GET https://api.swaye.me/user

Returns the logged in users details

Headers

NameTypeDescription

Authorization*

String

Bearer token received via OAuth

{
    handle: "username"
    wallet: {
        address: "0xaw234"
    }
}

Get user Balance

GET https://api.swaye.me/user/balance

Returns the native token balance of the logged in user

Headers

NameTypeDescription

Authorization*

String

Bearer token received via OAuth

{
    balance: "0.1"
}

Get user accounts

GET https://api.swaye.me/user/accounts

Get accounts (wallets) for a user

Headers

NameTypeDescription

Authorization*

String

Bearer token received via OAuth

[
    ...addresses
]

Block Endpoints

Get Block Information

GET https://api.swaye.me/block/:number

Path Parameters

NameTypeDescription

number*

String

Block Number

Headers

NameTypeDescription

Authorization*

String

Bearer token received via OAuth

{
  hash: string
  parentHash: string
  number: number
  transactions:[]
  timestamp: number
  nonce: string
  difficulty: number
  gasLimit: number
  gasUsed: number
  miner: string
  extraData: string
}

Get Latest Block Number

GET https://api.swaye.me/block/lastestBlockNumber

Headers

NameTypeDescription

Authorization*

String

Bearer token received via OAuth

{
    latestBlock: 1299312
}

Chain Endpoints

Get Chain Id

GET https://api.swaye.me/chain/chainId

Returns the chain Id associated with the client

Headers

NameTypeDescription

Authorization*

String

Bearer token received via OAuth

{
    chainId: 80001
}

Contract Endpoints

Call a function on a contract

POST https://api.swaye.me/contract/call

Headers

NameTypeDescription

Authorization*

String

Bearer token received via OAuth

Request Body

NameTypeDescription

functionSignature*

String

Signature of function

params*

String

Params in matching order of function signature

contractAddress*

String

Address of contract to call

{
    result: "0.1212"
}

Transaction Endpoint

Submit Transaction

POST https://api.swaye.me/transaction/submit

Headers

NameTypeDescription

Authorization*

Bearer ....

Bearer token received via OAuth

Request Body

NameTypeDescription

functionSignature*

String

params*

String

contractAddress*

String

value

String

{
    hash: "0x0200012"
}

Get Transaction

GET https://api.swaye.me/transaction/:hash

Path Parameters

NameTypeDescription

hash*

String

TransactionHash

Headers

NameTypeDescription

Authorization*

String

Bearer token received via OAuth

{
  hash: string
  type: number
  accessList: any[]
  blockHash: string
  blockNumber: number
  transactionIndex: number
  confirmations: number
  from: string
  gasPrice: string
  maxPriorityFeePerGas: string
  maxFeePerGas: string
  gasLimit: number
  to: string
  value: string
  nonce: number
  data: string
  r: string
  s: string
  v: number
  creates: string
  chainId: number
}

Get Transaction Receipt

GET https://api.swaye.me/transaction/:hash/receipt

Path Parameters

NameTypeDescription

hash*

String

Transaction hash

Headers

NameTypeDescription

Authorization*

String

Bearer token received via OAuth

{
  to: string
  from: string
  contractAddress: string
  transactionIndex: number
  gasUsed: number
  logsBloom: string
  blockHash: string
  transactionHash: string
  logs: any[]
  blockNumber: number
  confirmations: number
  cumulativeGasUsed: number
  effectiveGasPrice: string
  status: number
  type: number
  byzantium: boolean
}

ERC20 Endpoints

Get Balance

GET https://api.swaye.me/erc20/balance/:address

Path Parameters

NameTypeDescription

address*

String

Contract Address

Headers

NameTypeDescription

Authorization*

String

Bearer token received via OAuth

{
    balance: "1000.000"
}

Get Allowance

GET https://api.swaye.me/erc20/allowance/:address

Path Parameters

NameTypeDescription

address*

String

Contract Address

Query Parameters

NameTypeDescription

owner*

String

Owner Address

spender*

String

Spender Address

Headers

NameTypeDescription

Authorization*

String

Bearer token received via OAuth

{
    
}

Get Total Supply

GET https://api.swaye.me/erc20/totalSupply/:address

Path Parameters

NameTypeDescription

address*

String

Contract address

Headers

NameTypeDescription

Authorization*

String

Bearer token received via OAuth

{
    totalSupply: "100"
}

Transfer

POST https://api.swaye.me/erc20/transfer

Headers

NameTypeDescription

Authorization*

Bearer token received via OAuth

Request Body

NameTypeDescription

contractAddress*

String

Contract Address

amount*

String

Amount in wei

address*

String

Receiver address

{
    hash: "0x0000"
}

Approve

POST https://api.swaye.me/erc20/approve

Headers

NameTypeDescription

Authorization*

String

Bearer token received via OAuth

Request Body

NameTypeDescription

contractAddress*

String

Contract Address

amount*

String

Amount in wei

address*

String

Spender Address

{
    hash: "0x000000"
}

Transfer From

POST https://api.swaye.me/erc20/transferFrom

Headers

NameTypeDescription

Authorization*

Bearer

Bearer token received via OAuth

Request Body

NameTypeDescription

contractAddress*

String

Contract Address

from*

String

From address

to*

String

Recipient Address

amount*

String

Amount in Wei

{
    hash: "0x000000000"
}

ERC721 Endpoints

Get Balance

GET https://api.swaye.me/erc721/balance/:address

Returns the total tokens owned by the user

Path Parameters

NameTypeDescription

address*

String

Contract Address

Query Parameters

NameTypeDescription

address*

String

Owner Address

Headers

NameTypeDescription

Authorization*

String

Bearer token received via OAuth

{
    balance: "2"
}

Get Approved

GET https://api.swaye.me/erc721/approved/:address/:tokenId

Returns the approved addresses for a token

Path Parameters

NameTypeDescription

address*

String

Contract Address

tokenId*

String

Token ID

Headers

NameTypeDescription

Authorization*

String

Bearer token received via OAuth

{
    approvedAddress:[]
}

Get token of owner by index

GET https://api.swaye.me/erc721/tokenOfOwnerByIndex/:address

Returns the token id for an owner at an index of their holdings

E.G:

Get Balance returns "2", meaning two tokens are owned. Index 0 would be used to retrieve the first token, and 1 for the second

Path Parameters

NameTypeDescription

address*

String

Contract Address

Query Parameters

NameTypeDescription

owner*

String

Owner address

index*

String

token Index

Headers

NameTypeDescription

Authorization*

String

Bearer token received via OAuth

{
    tokenId: "1"
}

Get All Tokens of owner

GET https://api.swaye.me/erc721/getAllTokensOfOwner/:addresss

Returns an array of tokenIds

Path Parameters

NameTypeDescription

address*

String

Contract address

Query Parameters

NameTypeDescription

owner*

String

Owner address

Headers

NameTypeDescription

Authorization*

String

Bearer token received via OAuth

{
    tokenIds: ["1", "2"]
}

Get Token URI

GET https://api.swaye.me/erc721/tokenURI/:address/:tokenId

Path Parameters

NameTypeDescription

address*

String

Contract Address

tokenId*

String

Token Id

Headers

NameTypeDescription

Authorization*

String

Bearer token received via OAuth

{
    tokenURI: "..."
}

Transfer From

POST https://api.swaye.me/erc721/transferFrom

Headers

NameTypeDescription

Authorization*

String

Bearer token received via OAuth

Request Body

NameTypeDescription

from*

String

From address

to*

String

To address

tokenId*

String

Token Id

contractAddress*

String

Contract address

{
    hash: "0x0000"
}

Approve

POST https://api.swaye.me/erc721/approve

Headers

NameTypeDescription

Authorization*

String

Bearer token received via OAuth

Request Body

NameTypeDescription

contractAddress*

String

Contract Address

tokenId*

String

approvedAddresss*

String

Address to be approved

{
    hash: "0x000000"
}

Safe Transfer From

POST https://api.swaye.me/erc721/safeTrasferFrom

Headers

NameTypeDescription

Authorization*

String

Bearer token received via OAuth

Request Body

NameTypeDescription

from*

String

Sender address

to*

String

Receiver Address

contractAddress*

String

Contract Address

tokenId*

String

Token Id

{
    hash: "0x000000"
}

Set Approval for All

POST https://api.swaye.me/erc721/setApprovalForAll

Sets or unsets the approval of a given operator An operator is allowed to transfer all tokens of the sender on their behalf.

Headers

NameTypeDescription

Authorization*

String

Bearer token received via OAuth

Request Body

NameTypeDescription

operator*

String

Operator address

approved*

boolean

contractAddress*

String

Contract address

{
    hash: "0x000"
}

Is Approved for all

POST https://api.swaye.me

Headers

NameTypeDescription

Authorization*

String

Bearer token received via OAuth

Request Body

NameTypeDescription

owner*

String

Owner Address

operator*

String

Operator Address

contractAddress*

String

Contract Address

{
    isApproved: true
}

Last updated