Payment
getStreamRecord Query
Retrieve stream record information for a given stream address.
params | description |
---|---|
account | The address of the stream record to be queried. |
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 |
const tx = await client.payment.deposit({
amount: '1000000000',
creator: '0x...',
to: '0x...',
});
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.
params | description |
---|---|
creator | operator's account |
amount | the amount to withdraw |
from | payment address |
const tx = await client.payment.withdraw({
amount: '100000000',
creator: '0x...',
from: '0x..',
});
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.
params | description |
---|---|
owner | operator address |
addr | payment address |
const tx = await client.payment.disableRefund({
owner: address,
addr: paymentAccount,
});
listUserPaymentAccounts Storage Provider
list user payment info.
params | description |
---|---|
account | the address of user |
authType | AuthType |
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.