Skip to main content

Bundle

If you don't know how to generate Arseeding golang please see the previous section: golang SDK Overview.

Using Arseeding-go can help developers to quickly send files to Arseeding nodes.

Sending data

data := []byte("some data")
tags := []types.Tag{
{"Content-Type", "application/text"},
{"aa", "aaa"},
}
currency := "USDC" // everpay supported all tokens, like 'AR','ETH','USDT' and so on
apiKey := ""
needSeq := false
order, err := sdk.SendData(data, currency, apiKey, &schema.OptionItem{Tags: tags}, needSeq)

Return value: order

data is the data to be uploaded, usually binary data. You can read the file via io and complete the upload.

tags is a key-value index supported by Arweave, you can set the file type, set the file name and even the version number in tags. About Arweave Tag: TODO.

Content-Type in tags needs to be configured based on the content you upload. For example, if you upload an image in png format, configure it as image/png. For details, refer to Content-Type.

currency selects the currency you need to pay for the file storage, the value can be an empty string if you use the No_Fee mode node for personal deployments.

apiKey Arseeding provide API Key so that Users upload data directly without payment.

needSeq Arseeding supports sequential on-chain users' orders, if you need to on-chain in sequence, set it to true

Note: This step sends the data to Arseeding for staging and returns a pending order to the user, which will be uploaded by Arseeding once the order is paid (you can then query the data via the Arseeding or Arweave gateways). If the order is not paid within 1 hour, the order expires and the data is deleted.

Paying order

By paying the required fees for uploading data through arseeding-go, Arseeding can 100% guarantee the data will be uploaded to Arweave for permanent storage.

everTx, err := sdk.PayOrder(order)

Return value: everTx

Note: If the user does not have assets on everpay yet, you can refer to here in order to cross-chain assets. The payment must be completed within 60 minutes, otherwise the data will not be uploaded to Arweave and Arseeding will clear the data.

Sending data + Paying order

arseeding-go also offers a convenient way to integrate sending data + payments to satisfy users who already have assets in everpay.

everTx, itemId, err := sdk.SendDataAndPay(data, currency, &schema.OptionItem{Tags: tags}, needSeq) // your account must have enough balance in everpay

Send raw data with API Key

Arseeding can provide API Keys for users to upload data directly without having to make payments.

arseedUrl := "<https://arseed.web3infra.dev>"
cli := sdk.New(arseedUrl)

apiKey := "aabbccddeee..."
data := "<such as a picture>"
contentType := "image/jpeg"
tags := map[string]string{
"key1": "arseeding test",
"key2": "a test bundle native data",
}

res, err := cli.SubmitNativeData(apiKey, data, contentType, tags)
fmt.Println("itemId: %s",res.ItemId)

Get bundle costs

Returns the cost value based on the amount of data you need to upload.

arseedUrl := "<https://arseed.web3infra.dev>"
cli := sdk.New(arseedUrl)

resFee, err := cli.BundleFee(dataSize, currency)

Return: resFee

Get user orders

Look up all Bundle data upload orders for a user by their address for that address.

arseedUrl := "<https://arseed.web3infra.dev>"
cli := sdk.New(arseedUrl)

resOrders, err := cli.GetOrders(addr)

Return: resOrders