submitByApikey
功能
通过 apiKey 的方式,直接提交原始数据。
示例
import { submitByApikey } from 'arseeding-js'
const run = async () => {
const arseedingUrl = 'https://arseed.web3infra.dev'
const apikey = '<your arseeding apiKey>'
const tag = '<chaintype-symbol-id>' // everPay 支持的 token tag (chainType-symbol-id)
const data = Buffer.from('<need upload data, such as a picture>')
const contentType = 'data type'
const tags = { a: 'aa', b: 'bb' }
const res = await submitByApikey(
arseedingUrl,
apikey,
tag,
data,
contentType,
tags
)
console.log(res)
}
- 参数
- 类型
| 字段 | 描述 |
|---|---|
| arseedingUrl | arseedUrl 是需要配置的 Arseeding 后端服务地址,这里我们使用 permadao 提供的 Arseed 服务,URL 为:https://arseed.web3infra.dev 。 |
| data | 需要上传的数据。 |
| apikey | 如何申请 apiKey 请联系 permadao Team。 |
| tag | 需要支付费用的 token tag,如果你的 apiKey 持有的是 usdc,可通过 getTokenTagByEver('usdc') 获取 token tag,具体使用查看getTokenTagByEver。 |
| tags | 配置你的 Arweave Tags,什么是 Arweave Tags 参考:这里。 |
| Content-Type | Content-Type 是需要基于你上传的内容进行配置,例如 上传的 png 格式的图片,则配置为 image/png,详细说明参考 Content-Type。 |
(
arseedingUrl: string
apikey: string
tag: string
data: Buffer
contentType: string
tags:{
[key: string]: string
}
)
返回数据
{
itemId: 'tSB2-PS3Qr-POmBgjIoi4wRYhhGq3UZ9uPO8dUf2LhM',
size: 123
}