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

Name
Type
Description

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

Name
Type
Description

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

Name
Type
Description

Authorization*

String

Bearer token received via OAuth

[
    ...addresses
]

Block Endpoints

Get Block Information

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

Path Parameters

Name
Type
Description

number*

String

Block Number

Headers

Name
Type
Description

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

Name
Type
Description

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

Name
Type
Description

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

Name
Type
Description

Authorization*

String

Bearer token received via OAuth

Request Body

Name
Type
Description

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

Name
Type
Description

Authorization*

Bearer ....

Bearer token received via OAuth

Request Body

Name
Type
Description

functionSignature*

String

params*

String

contractAddress*

String

value

String

{
    hash: "0x0200012"
}

Get Transaction

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

Path Parameters

Name
Type
Description

hash*

String

TransactionHash

Headers

Name
Type
Description

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

Name
Type
Description

hash*

String

Transaction hash

Headers

Name
Type
Description

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

Name
Type
Description

address*

String

Contract Address

Headers

Name
Type
Description

Authorization*

String

Bearer token received via OAuth

{
    balance: "1000.000"
}

Get Allowance

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

Path Parameters

Name
Type
Description

address*

String

Contract Address

Query Parameters

Name
Type
Description

owner*

String

Owner Address

spender*

String

Spender Address

Headers

Name
Type
Description

Authorization*

String

Bearer token received via OAuth

{
    
}

Get Total Supply

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

Path Parameters

Name
Type
Description

address*

String

Contract address

Headers

Name
Type
Description

Authorization*

String

Bearer token received via OAuth

{
    totalSupply: "100"
}

Transfer

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

Headers

Name
Type
Description

Authorization*

Bearer token received via OAuth

Request Body

Name
Type
Description

contractAddress*

String

Contract Address

amount*

String

Amount in wei

address*

String

Receiver address

{
    hash: "0x0000"
}

Approve

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

Headers

Name
Type
Description

Authorization*

String

Bearer token received via OAuth

Request Body

Name
Type
Description

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

Name
Type
Description

Authorization*

Bearer

Bearer token received via OAuth

Request Body

Name
Type
Description

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

Name
Type
Description

address*

String

Contract Address

Query Parameters

Name
Type
Description

address*

String

Owner Address

Headers

Name
Type
Description

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

Name
Type
Description

address*

String

Contract Address

tokenId*

String

Token ID

Headers

Name
Type
Description

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

Name
Type
Description

address*

String

Contract Address

Query Parameters

Name
Type
Description

owner*

String

Owner address

index*

String

token Index

Headers

Name
Type
Description

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

Name
Type
Description

address*

String

Contract address

Query Parameters

Name
Type
Description

owner*

String

Owner address

Headers

Name
Type
Description

Authorization*

String

Bearer token received via OAuth

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

Get Token URI

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

Path Parameters

Name
Type
Description

address*

String

Contract Address

tokenId*

String

Token Id

Headers

Name
Type
Description

Authorization*

String

Bearer token received via OAuth

{
    tokenURI: "..."
}

Transfer From

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

Headers

Name
Type
Description

Authorization*

String

Bearer token received via OAuth

Request Body

Name
Type
Description

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

Name
Type
Description

Authorization*

String

Bearer token received via OAuth

Request Body

Name
Type
Description

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

Name
Type
Description

Authorization*

String

Bearer token received via OAuth

Request Body

Name
Type
Description

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

Name
Type
Description

Authorization*

String

Bearer token received via OAuth

Request Body

Name
Type
Description

operator*

String

Operator address

approved*

boolean

contractAddress*

String

Contract address

{
    hash: "0x000"
}

Is Approved for all

POST https://api.swaye.me

Headers

Name
Type
Description

Authorization*

String

Bearer token received via OAuth

Request Body

Name
Type
Description

owner*

String

Owner Address

operator*

String

Operator Address

contractAddress*

String

Contract Address

{
    isApproved: true
}

Last updated