跳到主要内容

类型

以下类型,都可通过 typescript 从 everpay-js 中 import

ChainType

export enum ChainType {
ethereum = 'ethereum',
moon = 'moon',
arweave = 'arweave',
conflux = 'conflux',
bsc = 'bsc',
platon = 'platon'
}

ArJWK

export type ArJWK = JWKInterface | 'use_wallet'

其中 JWKInterface 来源于 arweave-js JWKInterface

EthereumTransaction

import { TransactionResponse as EthereumTransaction } from '@ethersproject/abstract-provider'
export { EthereumTransaction }

TransactionResponse 来源于 ethers.js TransactionResponse

ArweaveTransaction

import { TransactionInterface as ArweaveTransaction } from 'arweave/node/lib/transaction'
export { ArweaveTransaction }

TransactionInterface 来源于 arweave-js TransactionInterface

Config

Everpay 构造函数配置项

export interface Config {
debug?: boolean
account?: string
chainType?: ChainType
ethConnectedSigner?: Signer
arJWK?: ArJWK
isSmartAccount?: boolean
}

Signer 来源于 ethers.js Signer

CrossChainInfo

export interface CrossChainInfo {
targetChainId: string
targetChainType: ChainType
targetDecimals: number
targetTokenId: string
}

Token

export interface Token {
tag: string
id: string
symbol: string
decimals: number
totalSupply: string
chainID: string
chainType: ChainType | string
crossChainInfoList: {
[propname: string]: CrossChainInfo
}
}

FeeItem

export interface FeeItem {
tokenTag: string
burnFeeMap: {
[propname: string]: string
}
transferFee: string
atomicBundleFee: string
updatedAt: string
}

EverpayInfo

export interface EverpayInfo {
ethLocker: string
arLocker: string
ethChainID: string
feeRecipient: string
owner: string
everRootHash: string
rootHash: string
tokenList: Token[]
}

ExpressInfo

interface ExpressTokenItem {
tokenTag: string
withdrawFee: string
walletBalance: string
}
export interface ExpressInfo {
address: string
withdrawTimeCost: number
tokens: ExpressTokenItem[]
}

EverpayAction

export enum EverpayAction {
transfer = 'transfer',
withdraw = 'burn',
bundle = 'bundle'
}

InternalTransferItem

export interface InternalTransferItem {
tag: string
from: string
to: string
amount: string
}

BundleItem

export interface BundleItem {
amount: string
chainID: string
from: string
to: string
tag: string
}

BundleData

export interface BundleData {
items: BundleItem[]
expiration: number
salt: string
version: string
}

BundleDataWithSigs

export interface BundleDataWithSigs extends BundleData {
sigs: {
[account: string]: string
}
}

EverpayTxWithoutSig

export interface EverpayTxWithoutSig {
tokenSymbol: string
action: EverpayAction
from: string
to: string
amount: string
fee: string
feeRecipient: string
nonce: string
tokenID: string
chainType: ChainType | string
chainID: string
data: string
version: string
}

EverpayTx

export interface EverpayTx extends EverpayTxWithoutSig {
sig: string
}

EverpayActionWithDeposit

export enum EverpayActionWithDeposit {
transfer = 'transfer',
withdraw = 'burn',
deposit = 'mint',
bundle = 'bundle'
}

EverpayTransactionStatus

enum EverpayTransactionStatus {
// deposit(mint) transaction, after the corresponding number of blocks confirm, status will be confirmed
// withdraw(burn) transaction, the backend receives the everPay Tx and status will be confirmed first
confirmed = 'confirmed',
// transaction status will be packaged only after everPay Tx storaged on arweave blockchain
packaged = 'packaged'
}

EverpayTransaction

export interface EverpayTransaction {
id: string // an arweave tx, which stored the everPay Tx information on the arweave blockchain
nonce: number
action: EverpayActionWithDeposit
from: string
to: string
amount: string
data: string
fee: string
feeRecipient: string
sig: string
everHash: string
status: EverpayTransactionStatus
timestamp: number
targetChainTxHash?: string
express: {
chainTxHash: string
withdrawFee: string
refundEverHash: string
err: string
}
}

TxsResult

export interface TxsResult {
accid?: string
currentPage: number
totalPages: number
txs: EverpayTransaction[]
}

BalanceParams

export interface BalanceParams {
tag: string
account?: string
}

BalancesParams

export interface BalancesParams {
account?: string
}

BalanceItem

export interface BalanceItem {
chainType: string
tag: string
symbol: string
balance: string
address: string
}

DepositParams

export interface DepositParams {
tag: string
amount: string
}

TransferParams

export interface TransferParams {
tag: string
amount: string
data?: Record<string, unknown>
to: string
}

WithdrawParams

export interface WithdrawParams {
chainType: ChainType
tag: string
amount: string
fee?: string
quickMode?: boolean
data?: Record<string, unknown>
to?: string
}

BundleParams

export interface BundleParams {
tag: string
amount: string
data: {
bundle: BundleDataWithSigs
}
to: string
}

TxsParams

export interface TxsParams {
page?: number
tag?: string
action?: EverpayActionWithDeposit
withoutAction?: EverpayActionWithDeposit
}

TxsByAccountParams

export interface TxsByAccountParams {
page?: number
account?: string
tag?: string
action?: EverpayActionWithDeposit
withoutAction?: EverpayActionWithDeposit
}

SendEverpayTxResult

// Note: This type does not have an export
interface PostEverpayTxResult {
status: string
}
export interface SendEverpayTxResult extends PostEverpayTxResult {
everpayTx: EverpayTx
everHash: string
}

SignMessageResult

export interface SignMessageResult {
message: string
sig: string
}

VerifyMessageParams

export interface VerifyMessageParams {
account: string
type: 'register' | 'sign'
message: string
sig: string
}

VerifyMessageResult

export interface VerifyMessageResult {
publicId: string
public: string
}

SmartAccountAuthResult

export interface SmartAccountAuthResult {
account: string
publicId: string
public: string
type: 'sign' | 'register'
message: string
sig: string
}