Skip to main content

payOrder

Function

Payments are made for uploaded data orders. This feature provides the ability to pay on behalf of a service provider for the storage of data that has been uploaded by a specified user.

Example

import {
newEverpayByEcc,
newEverpayByRSA,
payOrder
} from 'arseeding-js/cjs/payOrder'
import { readFileSync } from 'fs'
import path from 'path'
import { fileURLToPath } from 'url'

const run = async () => {
// use ecc wallet
const eccPrivate = '<your ecc private key>'
const pay = newEverpayByEcc(eccPrivate)

// or

// use rsa wallet
const __dirname = path.dirname(fileURLToPath(import.meta.url))
const arJWK = JSON.parse(
readFileSync(path.join(__dirname, '<your arweave keyfile>.json')).toString()
)
const arAddress = '<your arweave wallet address>'
const pay = newEverpayByRSA(arJWK, arAddress)

// pay
const everHash = await payOrder(pay, order)
console.log(everHash)
}

Parameters

FieldDescription
eccPrivateecc private key.
arJWKarweave wallet key file.
arAddressarweave wallet address.
payeverpay Example.
orderThe data structure when paying for an order. You can use the data structure returned by the createAndSubmitItem function to pay for the order, or use getOrders to get the order data structure if it is missing.
everhashWhen an order is successfully paid, a unique transaction identifier is returned and the transaction can be viewed via the everscan browser.

Return example

'0xb2800fc8451b6588eb9b12b03e1d1e640fa95722b020c366c4b6dffb4dad20eb'