v1

package
v0.0.0-...-9f791b1 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2022 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const BlockTimeFormat = "01-02|15:04:05.999"

BlockTimeFormat is time format of last block

Variables

API is the interface of Photon network should be set before start restful server

View Source
var Config *params.Config

Config is the configuration of Photon network should be set before start restful server

View Source
var HTTPPassword = ""

HTTPPassword is password needed when call http api

View Source
var HTTPUsername = ""

HTTPUsername is username needed when call http api

View Source
var QuitChain chan struct{}

QuitChain stop http server

Functions

func Address

func Address(w rest.ResponseWriter, r *rest.Request)

Address is api of /api/1/address

func AllowRevealSecret

func AllowRevealSecret(w rest.ResponseWriter, r *rest.Request)

AllowRevealSecret : 当用户发出了一笔指定密码的交易时使用,这种交易在调用本接口解锁之前,是不会接收方发来的SecretRequest的 AllowRevealSecret : used when clients send a transfer with specific secrets. that secret will not receive SecretRequest before invoking this function to unlock.

func Balance

func Balance(w rest.ResponseWriter, r *rest.Request)

Balance for test only query `addr`'s balance on `token`

func BalanceUpdateForPFS

func BalanceUpdateForPFS(w rest.ResponseWriter, r *rest.Request)

BalanceUpdateForPFS for path finding service, test only

func CancelTransfer

func CancelTransfer(w rest.ResponseWriter, r *rest.Request)

CancelTransfer : cancel a transfer when haven't send secret

func ChannelFor3rdParty

func ChannelFor3rdParty(w rest.ResponseWriter, r *rest.Request)

ChannelFor3rdParty generate info for 3rd party use, for update transfer and withdraw. /api/1/thirdparty/:channel/:3rd channel: channel identifier 3rd: the account that MS used to send transaction on blockchain

func CloseSettleChannel

func CloseSettleChannel(w rest.ResponseWriter, r *rest.Request)

CloseSettleChannel can do the following jobs: close channel settle channel deposit to channel

func ContractCallTXQuery

func ContractCallTXQuery(w rest.ResponseWriter, r *rest.Request)

ContractCallTXQuery query tx info of contract call

func Deposit

func Deposit(w rest.ResponseWriter, r *rest.Request)

Deposit open a channel with partner if channel not exists and deposit `balance` token to this channel. token must exist partner maybe an invalid address Balance must be positive

func EthBalance

func EthBalance(w rest.ResponseWriter, r *rest.Request)

EthBalance how many eth `addr` have.

func EthereumStatus

func EthereumStatus(w rest.ResponseWriter, r *rest.Request)

EthereumStatus query the status between Photon and ethereum

func EventChannels

func EventChannels(w rest.ResponseWriter, r *rest.Request)

EventChannels returns all events about the channel specified

func EventNetwork

func EventNetwork(w rest.ResponseWriter, r *rest.Request)

EventNetwork returns all events related to Photon network

func EventTokens

func EventTokens(w rest.ResponseWriter, r *rest.Request)

EventTokens returns all events about the token specified

func FindPath

func FindPath(w rest.ResponseWriter, r *rest.Request)

FindPath :

func ForceUnlock

func ForceUnlock(w rest.ResponseWriter, r *rest.Request)

ForceUnlock force unlock by locksecrethash

func GetAllFeeChargeRecord

func GetAllFeeChargeRecord(w rest.ResponseWriter, r *rest.Request)

GetAllFeeChargeRecord :

func GetBalanceByTokenAddress

func GetBalanceByTokenAddress(w rest.ResponseWriter, r *rest.Request)

GetBalanceByTokenAddress : get account's balance and locked account on token

func GetBuildInfo

func GetBuildInfo(w rest.ResponseWriter, r *rest.Request)

GetBuildInfo :

func GetChannelList

func GetChannelList(w rest.ResponseWriter, r *rest.Request)

GetChannelList list all my channels

func GetDaysIncome

func GetDaysIncome(w rest.ResponseWriter, r *rest.Request)

GetDaysIncome :

func GetFeePolicy

func GetFeePolicy(w rest.ResponseWriter, r *rest.Request)

GetFeePolicy :

func GetIncomeDetails

func GetIncomeDetails(w rest.ResponseWriter, r *rest.Request)

GetIncomeDetails :

func GetNodeStatus

func GetNodeStatus(w rest.ResponseWriter, r *rest.Request)

GetNodeStatus just for xmpp right now

func GetRandomSecret

func GetRandomSecret(w rest.ResponseWriter, r *rest.Request)

GetRandomSecret : create a secret and lockSecretHash with sha3

func GetReceivedTransfers

func GetReceivedTransfers(w rest.ResponseWriter, r *rest.Request)

GetReceivedTransfers retuns list of received transfer between `from_block` and `to_block` it contains token swap

func GetSentTransferDetail

func GetSentTransferDetail(w rest.ResponseWriter, r *rest.Request)

GetSentTransferDetail : query transfer status by lockSecretHash

func GetSentTransferDetails

func GetSentTransferDetails(w rest.ResponseWriter, r *rest.Request)

GetSentTransferDetails returns list of sent transfer between `from_block` and `to_block`

func GetSystemStatus

func GetSystemStatus(w rest.ResponseWriter, r *rest.Request)

GetSystemStatus :

func GetUnfinishedReceivedTransfer

func GetUnfinishedReceivedTransfer(w rest.ResponseWriter, r *rest.Request)

GetUnfinishedReceivedTransfer :根据lockSecretHash查询未完成的交易 GetUnfinishedReceivedTransfer : check incomplete transfers according to lockSecretHash

func NotifyNetworkDown

func NotifyNetworkDown(w rest.ResponseWriter, r *rest.Request)

NotifyNetworkDown :

func PrepareUpdate

func PrepareUpdate(w rest.ResponseWriter, r *rest.Request)

PrepareUpdate : 停止创建新的交易,返回当前是否可以升级 PrepareUpdate : stop sending new transfers, return boolean that if we can update now?

func RegisterSecret

func RegisterSecret(w rest.ResponseWriter, r *rest.Request)

RegisterSecret : 当从其他渠道知道一笔交易的密码时,可以注册密码到state manger中 RegisterSecret : when knowing the secret of a transfer from other sources, we can register secret in statemanager

func RegisterSecretOnChain

func RegisterSecretOnChain(w rest.ResponseWriter, r *rest.Request)

RegisterSecretOnChain register secret to contract

func SetFeePolicy

func SetFeePolicy(w rest.ResponseWriter, r *rest.Request)

SetFeePolicy :

func SpecifiedChannel

func SpecifiedChannel(w rest.ResponseWriter, r *rest.Request)

SpecifiedChannel get a channel state

func Start

func Start()

Start the restful server

func Stop

func Stop(w rest.ResponseWriter, r *rest.Request)

Stop for app user, call this api before quit.

func SwitchNetwork

func SwitchNetwork(w rest.ResponseWriter, r *rest.Request)

SwitchNetwork switch between mesh and internet

func TokenPartners

func TokenPartners(w rest.ResponseWriter, r *rest.Request)

TokenPartners is api of /api/1/:token/:partner

func TokenSwap

func TokenSwap(w rest.ResponseWriter, r *rest.Request)

TokenSwap is the api of /api/1/tokenswap/:id :id must be a unique identifier.

func Tokens

func Tokens(w rest.ResponseWriter, r *rest.Request)

Tokens is api of /api/1/tokens

func TransferToken

func TransferToken(w rest.ResponseWriter, r *rest.Request)

TransferToken for test only Transfer from this node to `addr` `value` tokens on token `token`

func Transfers

func Transfers(w rest.ResponseWriter, r *rest.Request)

Transfers is the api of /transfer/:token/:partner

func UpdateMeshNetworkNodes

func UpdateMeshNetworkNodes(w rest.ResponseWriter, r *rest.Request)

UpdateMeshNetworkNodes update nodes of this intranet

Types

type ChannelData

type ChannelData struct {
	ChannelIdentifier   string            `json:"channel_identifier"`
	OpenBlockNumber     int64             `json:"open_block_number"`
	PartnerAddrses      string            `json:"partner_address"`
	Balance             *big.Int          `json:"balance"`
	PartnerBalance      *big.Int          `json:"partner_balance"`
	LockedAmount        *big.Int          `json:"locked_amount"`
	PartnerLockedAmount *big.Int          `json:"partner_locked_amount"`
	TokenAddress        string            `json:"token_address"`
	State               channeltype.State `json:"state"`
	StateString         string            `json:"state_string"`
	SettleTimeout       int               `json:"settle_timeout"`
	RevealTimeout       int               `json:"reveal_timeout"`
}

ChannelData export json data format

type ConnectionStatus

type ConnectionStatus struct {
	XMPPStatus    netshare.Status `json:"xmpp_status"`
	EthStatus     netshare.Status `json:"eth_status"`
	LastBlockTime string          `json:"last_block_time"`
}

ConnectionStatus status of network connection

type GetIncomeDetailsRequest

type GetIncomeDetailsRequest struct {
	TokenAddress string `json:"token_address"`
	FromTime     int64  `json:"from_time"`
	ToTime       int64  `json:"to_time"`
	Limit        int    `json:"limit"`
}

GetIncomeDetailsRequest :

type GetOneWeekIncomeRequest

type GetOneWeekIncomeRequest struct {
	TokenAddress string `json:"token_address"`
	Days         int    `json:"days"`
}

GetOneWeekIncomeRequest :

type TransferData

type TransferData struct {
	Initiator      string                      `json:"initiator_address"`
	Target         string                      `json:"target_address"`
	Token          string                      `json:"token_address"`
	Amount         *big.Int                    `json:"amount"`
	Secret         string                      `json:"secret,omitempty"` // 当用户想使用自己指定的密码,而非随机密码时使用	// client can assign specific secret
	LockSecretHash string                      `json:"lockSecretHash"`
	IsDirect       bool                        `json:"is_direct,omitempty"`
	Sync           bool                        `json:"sync,omitempty"` //是否同步
	Data           string                      `json:"data"`           // 交易附加信息,长度不超过256
	RouteInfo      []pfsproxy.FindPathResponse `json:"route_info"`     // 指定的路由信息
}

TransferData post for transfers

Jump to

Keyboard shortcuts

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