arseeding

package module
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2023 License: Apache-2.0 Imports: 59 Imported by: 0

README

Arseeding

Arseeding is a lightweight arweave data seed node. It is mainly used to synchronize, cache and broadcast transaction && data.

Important: arseeding is compatible with all http api interfaces of arweave node and also provide bundle transaction api
Related articles: arseeding server design

Introduction

  • cmd is the service starter
  • sdk is used to call the arseeding api
  • bundle is used to handle bundle items and get items info
  • cache is used to cache important arweave info and reply to request quickly
  • api register api and compatible with the implementation logic of all api's of arweave node and provide bundle service
  • jobs is the implementation of timed jobs. This includes timed jobs that update some important info and roll up bundle Tx to arweave.
  • task concurrent processing syncTasks,broadcastTasks and broadcastMetaTasks.
  • submit includes the verification of transactions and chunks, and stores them in the bolt db.
  • wdb store bundle transaction and its status
  • store bolt db wrap.

Run

PORT=':8080' KEY_PATH='yourKeyfilePath' MYSQL='mysq dsn' PAY='everpay api url' go run cmd/main.go

Development

Build & Run
make all
PORT=':8080' KEY_PATH='yourKeyfilePath' MYSQL='mysq dsn' PAY='everpay api url' ./build/arseeding
Docker build
GOOS=linux GOARCH=amd64 go build -o ./cmd/arseeding ./cmd
docker build .
Deployment

Deployment documents

API

arseeding is compatible with all http api interfaces of arweave node and also provide bundle api:

{
    v1.POST("tx", s.submitTx)
    v1.POST("chunk", s.submitChunk)
    v1.GET("tx/:arid/offset", s.getTxOffset)
    v1.GET("/tx/:arid", s.getTx)
    v1.GET("chunk/:offset", s.getChunk)
    v1.GET("tx/:arid/:field", s.getTxField)
    v1.GET("/info", s.getInfo)
    v1.GET("/tx_anchor", s.getAnchor)
    v1.GET("/price/:size", s.getTxPrice)
    v1.GET("/peers", s.getPeers)
    // proxy
    v2 := r.Group("/")
    {
        v2.Use(proxyArweaveGateway)
        v2.GET("/tx/:arid/status")
        v2.GET("/price/:size/:target")
        v2.GET("/block/hash/:hash")
        v2.GET("/block/height/:height")
        v2.GET("/current_block")
        v2.GET("/wallet/:address/balance")
        v2.GET("/wallet/:address/last_tx")
        v2.POST("/arql")
        v2.POST("/graphql")
        v2.GET("/tx/pending")
        v2.GET("/unconfirmed_tx/:arId")
    }

    // broadcast && sync tasks
    v1.POST("/task/:taskType/:arid", s.postTask)
    v1.POST("/task/kill/:taskType/:arid", s.killTask)
    v1.GET("/task/:taskType/:arid", s.getTask)
    v1.GET("/task/cache", s.getCacheTasks)

    // ANS-104 bundle Data api
    v1.GET("/bundle/bundler", s.getBundler)
    v1.POST("/bundle/tx/:currency", s.submitItem)
    v1.GET("/bundle/tx/:itemId", s.getItemMeta) // get item meta, without data
    v1.GET("/bundle/itemIds/:arId", s.getItemIdsByArId)
    v1.GET("/bundle/fees", s.bundleFees)
    v1.GET("/bundle/fee/:size/:currency", s.bundleFee)
    v1.GET("bundle/orders/:signer", s.getOrders)
    v1.GET("/:id", s.getDataByGW) // get arTx data or bundleItem data
}

note:
when use submitTx and submitChunk, arseeding cache the tx and data and also submits it to the arweave gateway.

sync and broadcast api:

v1.POST("/task/:taskType/:arid", s.postTask)
v1.POST("/task/kill/:taskType/:arid", s.killTask)
v1.GET("/task/:taskType/:arid", s.getTask)
v1.GET("/task/cache", s.getCacheTasks)

killTask This interface can be used to stop a broadcast task when enough nodes have been broadcast via getTask
taskType is 'sync' or 'broadcast' or 'broadcast_meta'

getCacheTasks return all pending tasks

bundle api describe:

v1.GET("/bundle/bundler", s.getBundler)
v1.POST("/bundle/tx/:currency", s.submitItem)
v1.GET("/bundle/tx/:itemId", s.getItemMeta)
v1.GET("/bundle/itemIds/:arId", s.getItemIdsByArId)
v1.GET("/bundle/fees", s.bundleFees)
v1.GET("/bundle/fee/:size/:currency", s.bundleFee)
v1.GET("bundle/orders/:signer", s.getOrders)
v1.GET("/:id", s.getDataByGW)
getBundler

return a bundle service provider address

GET /bundle/bundler

resp: "Fkj5J8CDLC9Jif4CzgtbiXJBnwXLSrp5AaIllleH_yY"
submitItem

submit a bundle item(goar is a useful tool to assemble a bundle item)

POST /bundle/tx/:currency
--header 'Content-Type: application/octet-stream'
--data-binary 'data....'

note:

  1. if config charge no fee ,don't need currency
  2. request body can be created use goar // see example/bundle-item/bundle_test.go
resp:
{
    ItemId:             "qe1231212441",
    Bundler:            "Fkj5J8CDLC9Jif4CzgtbiXJBnwXLSrp5AaIllleH_yY",
    Currency:           "AR",
    Decimals:           12,
    Fee:                "113123",
    PaymentExpiredTime: 122132421,
    ExpectedBlock:      3144212,
}
bundleFees

return fees you need to pay for submit your bundle item to arweave and store it forever

GET /bundle/fees

resp:
{
    "AR": {
        "currency": "AR",
        "decimals": 12,
        "base": "808920",
        "perChunk": "66060288"
    },
    "DAI": {
        "currency": "DAI",
        "decimals": 18,
        "base": "7174878265432",
        "perChunk": "585934980689532"
    },
    "ETH": {
        "currency": "ETH",
        "decimals": 18,
        "base": "6585336377",
        "perChunk": "537790161708"
    },
    "USDC": {
        "currency": "USDC",
        "decimals": 6,
        "base": "7",
        "perChunk": "586"
    },
}
getItemMeta

return item meta, without data

GET /bundle/tx/:itemId

resp:
{
    "signatureType": 3,
    "signature": "DC469T6Fz3ByFCtEjnP9AdsLSDFqINxvbIqFw1qwk0ApHtpmytRWFHZeY2gBN9nXopzY7Sbi9u5U6UcpPrwPlxs",
    "owner": "BCLR8qIeP8-kDAO6AifvSSzyCQJBwAtPYErCaX1LegK7GwXmyMvhzCmt1x6vLw4xixiOrI34ObhU2e1RGW5YNXo",
    "target": "",
    "anchor": "",
    "tags": [],
    "data": "",
    "id": "IlYC5sG61mhTOlG2Ued5LWxN4nuhyZh3ror0MBbPKy4"
}
getOrders

return signer address all order

GET /bundle/orders/:signer

resp:
[
    {
        "ID": 33,
        "CreatedAt": "2022-06-24T03:29:54.174Z",
        "UpdatedAt": "2022-06-24T04:30:09.193Z",
        "DeletedAt": null,
        "ItemId": "5rEb7c6OjMQIYjl6P7AJIb4bB9CLMBSxhZ9N7BVbRCk",
        "Signer": "Ii5wAMlLNz13n26nYY45mcZErwZLjICmYd46GZvn4ck",
        "SignType": 1,
        "Size": 1095,
        "Currency": "USDT",
        "Decimals": 6,
        "Fee": "701",
        "PaymentExpiredTime": 1656044994,
        "ExpectedBlock": 960751,
        "PaymentStatus": "expired",
        "PaymentId": "",
        "OnChainStatus": "failed"
    },
...
]
getDataByGW

get arTx data or bundleItem data

GET /:id
note: id could be itemId or arId

resp:
    data

Usage

compatible arweave sdk

arweave-js sdk

import Arweave from 'arweave';

const arweave = Arweave.init({
    host: '127.0.0.1', // arseeding service url
    port: 8080,
    protocol: 'http'
});

goar sdk

arNode := "http://127.0.0.1:8080" // arseeding service url
arClient := goar.NewClient(arNode) 
Different

Arseeding is a light node, so it does not store all the data in the arweave network, so when requesting tx data, it is likely that the data will not be available, even if the data already exists in the arweave network.
In the case we use the /task/sync/:arid api of arseeding to synchronize the tx to the service.
e.g:

  1. User want to get a tx
 arId := "yK_x7-bKBOe1GK3sEHWIQ4QZRibn504pzYOFa8iO2S8"

 // connect arseeding server by goar sdk
 arClient := goar.NewClient("http://127.0.0.1:8080") 
 
 data, err := arClient.GetTransactionData(arId)
 // err: not found

By default arseeding does not contain this data, so will return 'not found' error msg.

  1. So we need to use arseeding sync api
curl --request POST 'http://127.0.0.1:8080/task/sync/yK_x7-bKBOe1GK3sEHWIQ4QZRibn504pzYOFa8iO2S8'
  1. Use getTask api to watcher the job status
 curl 'http://127.0.0.1:8080/task/sync/yK_x7-bKBOe1GK3sEHWIQ4QZRibn504pzYOFa8iO2S8'

resp:

{
    "arId": "yK_x7-bKBOe1GK3sEHWIQ4QZRibn504pzYOFa8iO2S8",
    "tktype": "sync",
    "countSuccessed": 1,
    "countFailed": 0,
    "totalNodes": 945,
    "close": false
}

countSuccessed 1 means sync success

  1. This time re-run step 1 and it will work.

Broadcast usage

If you want your tx or data to be broadcast to all nodes, the bardcast function can help you do that.
e.g:

  1. Register for tx that require broadcasting
curl --request POST 'http://127.0.0.1:8080/task/broadcast/yK_x7-bKBOe1GK3sEHWIQ4QZRibn504pzYOFa8iO2S8'
  1. Use getTask api to watcher the job status
curl GET 'http://127.0.0.1:8080/task/broadcast/yK_x7-bKBOe1GK3sEHWIQ4QZRibn504pzYOFa8iO2S8'

resp:

{
    "arid": "yK_x7-bKBOe1GK3sEHWIQ4QZRibn504pzYOFa8iO2S8",
    "tktype": "broadcast",
    "countSuccessed": 220,
    "countFailed": 9,
    "totalNodes": 939,
    "close": false
}

countSuccessed number of nodes successfully broadcast
countFailed number of nodes failed to broadcast
totalNodes total number of nodes
close Is the broadcast task closed

  1. If the goal is to successfully broadcast to 200 nodes, then this broadcast task can be closed
curl --request POST 'http://127.0.0.1:8080/task/kill/broadcast/yK_x7-bKBOe1GK3sEHWIQ4QZRibn504pzYOFa8iO2S8'
Bundle Usage

Arseeding implement ANS-104 bundle Data API, goar is a useful tool to assemble bundle item and interact with these APIs.
e.g:

    // connect arseeding server by goar sdk
    signer, err := goar.NewSignerFromPath("test-keyfile.json")
	arseedUrl := "http://127.0.0.1:8080"
	itemSdk, err := goar.NewItemSdk(signer, arseedUrl)
	
    // now just use itemSdk to create a bundle item
    item, err := itemSdk.CreateAndSignItem(dataFiled, target, anchor, tags)
    
    // submit bundle item to arseeding
    resp, err := itemSdk.SubmitItem(item, "AR") // "AR" can be replace with any Token that the bundlr support
    // you will get info about how much you should pay, bundlr address, bundle id that can be used query your item from resp struct

resp:

{
    ItemId             string
    Bundler            string
    Currency           string
    Fee                string
    PaymentExpiredTime int64
    ExpectedBlock      int64
}

go-sdk
js-sdk

Example

everPay rollup txs sync: get all everpay rollup txIds from the arweave node, and then post to the arseeding service using the sync interface.

broadcast arweave pending pool txs: get pending pool txIds, sync to arseeding and broadcast to all nodes.

Notes

  1. The tx and data must exist in the arseeding service before using broadcast. In other words, if there is no tx and data in arseeding, use sync to synchronize the data before using broadcast.
  2. The broadcast job needs to commit tx and data to each node, so each broadcast job takes a long time to execute. So the user checks the number of successful broadcast nodes by getJob, and then actively stops the broadcast job by killJob.

Licenses

Users are requested to comply with their own license
Apache License

Documentation

Index

Constants

View Source
const (
	ItemPaymentAction   = "payment"
	ApikeyPaymentAction = "apikeyPayment"
)
View Source
const (
	MetricNameSpace = "arseeding"
)

Variables

View Source
var (
	ERR_TOO_MANY_REQUESTS = errors.New("err_limit_exceeded")
	MANIFEST_ID_NOT_FOUND = errors.New("err_manifest_id_not_found")
)

Functions

func CORSMiddleware

func CORSMiddleware() gin.HandlerFunc

func LimiterMiddleware

func LimiterMiddleware(limit int, period string, ipRateWhitelist *map[string]struct{}) gin.HandlerFunc

LimiterMiddleware period: "S"<Second>,"M"<Minute>,"H"<Hour>,"D"<Day>; limit: limit frequency

func ManifestMiddleware

func ManifestMiddleware(wdb *Wdb, store *Store) gin.HandlerFunc

Types

type Arseeding

type Arseeding struct {
	NoFee          bool // if true, means no bundle fee; default false
	EnableManifest bool
	// contains filtered or unexported fields
}

func New

func New(
	boltDirPath, mySqlDsn string, sqliteDir string, useSqlite bool,
	arWalletKeyPath string, arNode, payUrl string, noFee bool, enableManifest bool,
	useS3 bool, s3AccKey, s3SecretKey, s3BucketPrefix, s3Region, s3Endpoint string,
	use4EVER bool, useAliyun bool, aliyunEndpoint, aliyunAccKey, aliyunSecretKey, aliyunPrefix string,
	port string, customTags []types.Tag,
) *Arseeding

func (*Arseeding) CalcItemFee

func (s *Arseeding) CalcItemFee(currency string, itemSize int64) (*schema.RespFee, error)

func (*Arseeding) DelItem

func (s *Arseeding) DelItem(itemId string) error

func (*Arseeding) FetchAndStoreTx

func (s *Arseeding) FetchAndStoreTx(arId string) (err error)

func (*Arseeding) GetBundlePerFees

func (s *Arseeding) GetBundlePerFees() (map[string]schema.Fee, error)

func (*Arseeding) GetPerFee

func (s *Arseeding) GetPerFee(tokenSymbol string) *schema.Fee

func (*Arseeding) ParseAndSaveBundleItems

func (s *Arseeding) ParseAndSaveBundleItems(arId string, data []byte) error

func (*Arseeding) ProcessSubmitItem

func (s *Arseeding) ProcessSubmitItem(item types.BundleItem, currency string, isNoFeeMode bool, apiKey string, isSort bool, size int64) (schema.Order, error)

func (*Arseeding) Run

func (s *Arseeding) Run(port string, bundleInterval int)

func (*Arseeding) SaveSubmitChunk

func (s *Arseeding) SaveSubmitChunk(chunk types.GetChunk) error

func (*Arseeding) SaveSubmitTx

func (s *Arseeding) SaveSubmitTx(arTx types.Transaction) error

func (*Arseeding) SetPerFee

func (s *Arseeding) SetPerFee(feeMap map[string]schema.Fee)

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

func NewCache

func NewCache(arCli *goar.Client, peerMap map[string]int64) *Cache

func (*Cache) GetAnchor

func (c *Cache) GetAnchor() string

func (*Cache) GetConstTx

func (c *Cache) GetConstTx() *types.Transaction

func (*Cache) GetFee

func (c *Cache) GetFee() schema.ArFee

func (*Cache) GetInfo

func (c *Cache) GetInfo() types.NetworkInfo

func (*Cache) GetPeerMap

func (c *Cache) GetPeerMap() map[string]int64

func (*Cache) GetPeers

func (c *Cache) GetPeers() []string

func (*Cache) UpdateAnchor

func (c *Cache) UpdateAnchor(anchor string)

func (*Cache) UpdateFee

func (c *Cache) UpdateFee(price schema.ArFee)

func (*Cache) UpdateInfo

func (c *Cache) UpdateInfo(info types.NetworkInfo)

func (*Cache) UpdatePeers

func (c *Cache) UpdatePeers(peerMap map[string]int64)

type Store

type Store struct {
	KVDb rawdb.KeyValueDB
}

func NewAliyunStore

func NewAliyunStore(endpoint, accKey, secretKey, bucketPrefix string) (*Store, error)

func NewBoltStore

func NewBoltStore(boltDirPath string) (*Store, error)

func NewS3Store

func NewS3Store(accKey, secretKey, region, bucketPrefix, endpoint string) (*Store, error)

func (*Store) AtomicDelItem

func (s *Store) AtomicDelItem(itemId string) (err error)

func (*Store) AtomicSaveItem

func (s *Store) AtomicSaveItem(item types.BundleItem) (err error)

about bundle

func (*Store) AtomicSyncDataEndOffset

func (s *Store) AtomicSyncDataEndOffset(preEndOffset, newEndOffset uint64, dataRoot, dataSize string) error

func (*Store) Close

func (s *Store) Close() error

func (*Store) DelItemBinary

func (s *Store) DelItemBinary(itemId string) (err error)

func (*Store) DelItemMeta

func (s *Store) DelItemMeta(itemId string) (err error)

func (*Store) DelParsedBundleArId

func (s *Store) DelParsedBundleArId(arId string) error

func (*Store) DelPendingPoolTaskId

func (s *Store) DelPendingPoolTaskId(taskId string) error

func (*Store) ExistArIdToItemIds

func (s *Store) ExistArIdToItemIds(arId string) bool

func (*Store) IsExistChunk

func (s *Store) IsExistChunk(chunkStartOffset uint64) bool

func (*Store) IsExistItemBinary

func (s *Store) IsExistItemBinary(itemId string) bool

func (*Store) IsExistPeers

func (s *Store) IsExistPeers() bool

func (*Store) IsExistTxDataEndOffset

func (s *Store) IsExistTxDataEndOffset(dataRoot, dataSize string) bool

func (*Store) IsExistTxMeta

func (s *Store) IsExistTxMeta(arId string) bool

func (*Store) LoadAllDataEndOffset

func (s *Store) LoadAllDataEndOffset() (offset uint64)

func (*Store) LoadAllPendingTaskIds

func (s *Store) LoadAllPendingTaskIds() ([]string, error)

func (*Store) LoadArIdToItemIds

func (s *Store) LoadArIdToItemIds(arId string) (itemIds []string, err error)

func (*Store) LoadChunk

func (s *Store) LoadChunk(chunkStartOffset uint64) (chunk *types.GetChunk, err error)

func (*Store) LoadItemBinary

func (s *Store) LoadItemBinary(itemId string) (binaryReader *os.File, itemBinary []byte, err error)

func (*Store) LoadItemMeta

func (s *Store) LoadItemMeta(itemId string) (meta types.BundleItem, err error)

func (*Store) LoadPeers

func (s *Store) LoadPeers() (peers map[string]int64, err error)

func (*Store) LoadTask

func (s *Store) LoadTask(taskId string) (tk *schema.Task, err error)

func (*Store) LoadTxDataEndOffSet

func (s *Store) LoadTxDataEndOffSet(dataRoot, dataSize string) (txDataEndOffset uint64, err error)

func (*Store) LoadTxMeta

func (s *Store) LoadTxMeta(arId string) (arTx *types.Transaction, err error)

func (*Store) LoadWaitParseBundleArIds

func (s *Store) LoadWaitParseBundleArIds() (arIds []string, err error)

func (*Store) PutTaskPendingPool

func (s *Store) PutTaskPendingPool(taskId string) error

func (*Store) RollbackAllDataEndOffset

func (s *Store) RollbackAllDataEndOffset(preDataEndOffset uint64) (err error)

func (*Store) SaveAllDataEndOffset

func (s *Store) SaveAllDataEndOffset(allDataEndOffset uint64) (err error)

func (*Store) SaveArIdToItemIds

func (s *Store) SaveArIdToItemIds(arId string, itemIds []string) error

func (*Store) SaveChunk

func (s *Store) SaveChunk(chunkStartOffset uint64, chunk types.GetChunk) error

func (*Store) SaveItemBinary

func (s *Store) SaveItemBinary(item types.BundleItem) (err error)

func (*Store) SaveItemMeta

func (s *Store) SaveItemMeta(item types.BundleItem) (err error)

func (*Store) SavePeers

func (s *Store) SavePeers(peers map[string]int64) error

func (*Store) SaveTask

func (s *Store) SaveTask(taskId string, tk schema.Task) error

func (*Store) SaveTxDataEndOffSet

func (s *Store) SaveTxDataEndOffSet(dataRoot, dataSize string, txDataEndOffset uint64) (err error)

func (*Store) SaveTxMeta

func (s *Store) SaveTxMeta(arTx types.Transaction) error

func (*Store) SaveWaitParseBundleArId

func (s *Store) SaveWaitParseBundleArId(arId string) error

type TaskManager

type TaskManager struct {
	// contains filtered or unexported fields
}

func NewTaskMg

func NewTaskMg() *TaskManager

func (*TaskManager) AddTask

func (m *TaskManager) AddTask(arid, taskType string)

func (*TaskManager) BroadcastData

func (m *TaskManager) BroadcastData(arId, taskType string, tx *types.Transaction, peers []string, txPosted bool)

func (*TaskManager) BroadcastTxMeta

func (m *TaskManager) BroadcastTxMeta(arId, taskType string, tx *types.Transaction, peers []string)

func (*TaskManager) CloseTask

func (m *TaskManager) CloseTask(arid, taskType string) error

func (*TaskManager) DelTask

func (m *TaskManager) DelTask(arid, taskType string)

func (*TaskManager) GetTask

func (m *TaskManager) GetTask(arid, taskType string) *schema.Task

func (*TaskManager) GetTasks

func (m *TaskManager) GetTasks() (tasks map[string]schema.Task)

func (*TaskManager) GetTxDataFromPeers

func (m *TaskManager) GetTxDataFromPeers(arId, taskType string, peers []string) ([]byte, error)

func (*TaskManager) GetUnconfirmedTxFromPeers

func (m *TaskManager) GetUnconfirmedTxFromPeers(arId, taskType string, peers []string) (*types.Transaction, error)

func (*TaskManager) IncFailed

func (m *TaskManager) IncFailed(arid, taskType string)

func (*TaskManager) IncSuccessed

func (m *TaskManager) IncSuccessed(arid, taskType string)

func (*TaskManager) InitTaskMg

func (m *TaskManager) InitTaskMg(boltDb *Store) error

func (*TaskManager) IsClosed

func (m *TaskManager) IsClosed(arid, taskType string) bool

func (*TaskManager) PopTkChan

func (m *TaskManager) PopTkChan() <-chan string

func (*TaskManager) PutToTkChan

func (m *TaskManager) PutToTkChan(arId, taskType string)

func (*TaskManager) TaskBeginSet

func (m *TaskManager) TaskBeginSet(arid, taskType string, totalPeer int) error

type Wdb

type Wdb struct {
	Db *gorm.DB
}

func NewMysqlDb

func NewMysqlDb(dsn string) *Wdb

func NewSqliteDb

func NewSqliteDb(dbDir string) *Wdb

func (*Wdb) DelManifest

func (w *Wdb) DelManifest(id string) error

func (*Wdb) ExistApikey

func (w *Wdb) ExistApikey(addr string) (bool, schema.AutoApiKey)

func (*Wdb) ExistPaidOrd

func (w *Wdb) ExistPaidOrd(itemId string) bool

func (*Wdb) ExistProcessedOrderItem

func (w *Wdb) ExistProcessedOrderItem(itemId string) (res schema.Order, exist bool)

func (*Wdb) GetApiKeyDetail

func (w *Wdb) GetApiKeyDetail(key string) (schema.AutoApiKey, error)

func (*Wdb) GetApiKeyDetailByAddress

func (w *Wdb) GetApiKeyDetailByAddress(addr string) (res schema.AutoApiKey, err error)

func (*Wdb) GetArPrice

func (w *Wdb) GetArPrice() (float64, error)

func (*Wdb) GetArTxByStatus

func (w *Wdb) GetArTxByStatus(status string) ([]schema.OnChainTx, error)

func (*Wdb) GetExpiredOrders

func (w *Wdb) GetExpiredOrders() ([]schema.Order, error)

func (*Wdb) GetLastEverRawId

func (w *Wdb) GetLastEverRawId() (uint64, error)

func (*Wdb) GetManifestId

func (w *Wdb) GetManifestId(mfUrl string) (string, error)

func (*Wdb) GetNeedOnChainOrders

func (w *Wdb) GetNeedOnChainOrders() ([]schema.Order, error)

func (*Wdb) GetNeedOnChainOrdersSorted

func (w *Wdb) GetNeedOnChainOrdersSorted() ([]schema.Order, error)

func (*Wdb) GetOrdersByApiKey

func (w *Wdb) GetOrdersByApiKey(apiKey string, cursorId int64, pageSize int, sort string) ([]schema.Order, error)

func (*Wdb) GetOrdersBySigner

func (w *Wdb) GetOrdersBySigner(signer string, cursorId int64, num int) ([]schema.Order, error)

func (*Wdb) GetPrices

func (w *Wdb) GetPrices() ([]schema.TokenPrice, error)

func (*Wdb) GetReceiptsByStatus

func (w *Wdb) GetReceiptsByStatus(status string) ([]schema.ReceiptEverTx, error)

func (*Wdb) GetUnPaidOrder

func (w *Wdb) GetUnPaidOrder(itemId string) (schema.Order, error)

func (*Wdb) InsertApiKey

func (w *Wdb) InsertApiKey(ak schema.AutoApiKey) error

func (*Wdb) InsertArTx

func (w *Wdb) InsertArTx(tx schema.OnChainTx) error

func (*Wdb) InsertManifest

func (w *Wdb) InsertManifest(mf schema.Manifest) error

func (*Wdb) InsertOrder

func (w *Wdb) InsertOrder(order schema.Order) error

func (*Wdb) InsertPrices

func (w *Wdb) InsertPrices(tps []schema.TokenPrice) error

func (*Wdb) InsertReceiptTx

func (w *Wdb) InsertReceiptTx(tx schema.ReceiptEverTx) error

func (*Wdb) IsLatestUnpaidOrd

func (w *Wdb) IsLatestUnpaidOrd(itemId string, CurExpiredTime int64) bool

func (*Wdb) Migrate

func (w *Wdb) Migrate(noFee, enableManifest bool) error

func (*Wdb) UpdateApikeyTokenBal

func (w *Wdb) UpdateApikeyTokenBal(addr string, newTokBal datatypes.JSONMap) error

func (*Wdb) UpdateArTx

func (w *Wdb) UpdateArTx(id uint, arId string, curHeight int64, dataSize, reward string, status string) error

func (*Wdb) UpdateArTxStatus

func (w *Wdb) UpdateArTxStatus(arId, status string, tx *gorm.DB) error

func (*Wdb) UpdateOrdOnChainStatus

func (w *Wdb) UpdateOrdOnChainStatus(itemId, status string, tx *gorm.DB) error

func (*Wdb) UpdateOrdToExpiredStatus

func (w *Wdb) UpdateOrdToExpiredStatus(id uint) error

func (*Wdb) UpdateOrderPay

func (w *Wdb) UpdateOrderPay(id uint, everHash string, paymentStatus string, tx *gorm.DB) error

func (*Wdb) UpdatePrice

func (w *Wdb) UpdatePrice(symbol string, newPrice float64) error

func (*Wdb) UpdateReceiptStatus

func (w *Wdb) UpdateReceiptStatus(rawId uint64, status string, tx *gorm.DB) error

func (*Wdb) UpdateRefundErr

func (w *Wdb) UpdateRefundErr(rawId uint64, errMsg string) error

Directories

Path Synopsis
sdk

Jump to

Keyboard shortcuts

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