Skip to main content

Payment

getStreamRecord Query

Retrieve stream record information for a given stream address.

paramsdescription
accountThe address of the stream record to be queried.
example
await client.payment.getStreamRecord('0x...');

deposit Tx

Deposit BNB to a payment account.

| params | description | | ------- | ----------------------------------------------------------- | ------------------ | | to | payment address of the stream record to receive the deposit | | creator | | operator's account | | amount | the amount to deposit |

example
const tx = await client.payment.deposit({
amount: '1000000000',
creator: '0x...',
to: '0x...',
});
tip

This is only construct tx, next need simulate and broadcast

withdraw Tx

Withdraws BNB from a payment account.

Withdrawal will trigger settlement, i.e., updating static balance and buffer balance. If the withdrawal amount is greater than the static balance after settlement it will fail. If the withdrawal amount is equal to or greater than 100BNB, it will be timelock-ed for 1 day duration. And after the duration, a message without from field should be sent to get the funds.

paramsdescription
creatoroperator's account
amountthe amount to withdraw
frompayment address
example
const tx = await client.payment.withdraw({
amount: '100000000',
creator: '0x...',
from: '0x..',
});
tip

This is only construct tx, next need simulate and broadcast

disableRefund Tx

Disable refund/withdrawal for a payment account. After disabling withdrawal of a payment account, no more withdrawal can be executed. The action cannot be reverted.

paramsdescription
owneroperator address
addrpayment address
example
const tx = await client.payment.disableRefund({
owner: address,
addr: paymentAccount,
});
tip

This is only construct tx, next need simulate and broadcast

listUserPaymentAccounts Storage Provider

list user payment info.

paramsdescription
accountthe address of user
authTypeAuthType
example
const res = await client.payment.listUserPaymentAccounts(
{
account: address,
},
{
type: 'EDDSA',
domain: window.location.origin,
seed: offChainData.seedString,
address,
},
);

List payment info by a user address.