Skip to main content

Types

The following types can be imported from everpay-js via typescript

ChainType

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

ArJWK

export type ArJWK = JWKInterface | 'use_wallet'

JWKInterface is sourced from arweave-js JWKInterface

EthereumTransaction

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

TransactionResponse is sourced from ethers.js TransactionResponse

ArweaveTransaction

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

TransactionInterface is sourced from arweave-js TransactionInterface

Config

Everpay constructor configuration items

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

Signer is sourced from 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
symbol: string
tag: 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
}