Skip to main content

transfer

Function

Based on the account, ethConnectedSigner, arJWK parameters passed when the Everpay instance is created, when do transfering,

  • Internal build EverpayTxWithoutSig
  • Call the corresponding (plugin) wallet/webauthn signature function, generate sig, assemble EverpayTx
  • Send the everpay tx to everPay backend server for signature verification
  • The backend server verifies it and updates the user's asset balance. And store the everPay transaction record on the arweave blockchain

Developers can visit the DOCS - System overview - Transaction section for more information.

info

Any everPay account can transfer any of its assets on everPay to other everPay accounts, regardless of whether the everPay account to be transferred is an ethereum or arweave account model. For example.

  • 5NPqYBdIsIpJzPeYixuz7BEH_W7BEk_mb8HxBD3OHXo everPay account of arweave account model can transfer AR, ETH, USDT to 0x26361130d5d6E798E9319114643AF8c868412859 everPay account of ethereum account model
  • and vice versa

Parameter

everpay.transfer(transferParams: TransferParams)
parametersrequireddescription
tagYESA unique identifier for the token, which can be viewed via the info interface.
amountYESThe amount of assets transferred.
toYESThe recipient ID of everPay.
dataNOFor additional information, developers can customize the JSON data and pass it through JSON.stringify() processing. The data can be customized to achieve some complex functions, such as bulk transfer.

Return

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

Example

From ethereum account

const provider = new ethers.providers.Web3Provider(window.ethereum)
const signer = provider.getSigner()
const everpay = new Everpay({
account: window.ethereum.selectedAddress,
chainType: 'ethereum',
ethConnectedSigner: signer
})

everpay.transfer({
tag: 'ethereum-usdt-0x923fcb255da521037385457fb549a51f78ef0af4',
amount: '5.26'
to: '5NPqYBdIsIpJzPeYixuz7BEH_W7BEk_mb8HxBD3OHXo',
data: { hello: 'world', this: 'is everpay' }
}).then(console.log)

/* Returned result
{
status: 'ok',
everpayTx: {
tokenSymbol: 'usdt',
action: 'transfer',
from: '0x26361130d5d6E798E9319114643AF8c868412859',
to: '5NPqYBdIsIpJzPeYixuz7BEH_W7BEk_mb8HxBD3OHXo',
amount: '5260000',
fee: '0',
feeRecipient: '0x6451eB7f668de69Fb4C943Db72bCF2A73DeeC6B1',
nonce: '1625987254171',
tokenID: '0xd85476c906b5301e8e9eb58d174a6f96b9dfc5ee',
chainType: 'ethereum',
chainID: '42',
data: '{"hello":"world","this":"is everpay"}',
version: 'v1',
sig: '0x3ee66c303fe59b8e1f84e638cb7cca8bbb0e5b0ca63f784021e877be13c176d35d831e120a20eb8c72741fcc40c6a35a566d3ed34f6274d4c26160f38c14eec11b'
},
everHash: '0x0b7be08f6b96c2f1c7a810c72af2cc46632e4a7f0f9e36ccb10840864fedd470'
}
*/

From arweave account

const arAddress = await window.arweaveWallet.getActiveAddress()
const everpay = new Everpay({
account: arAddress,
chainType: 'arweave',
arJWK: 'use_wallet',
})

everpay.transfer({
tag: 'arweave,ethereum-ar-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,0x83ea4a2fe3ead9a7b204ab2d56cb0b81d71489c8',
amount: '0.0000000001',
to: '0x26361130d5d6E798E9319114643AF8c868412859'
}).then(console.log)

/* Returned result
{
status: 'ok',
everpayTx: {
tokenSymbol: 'ar',
action: 'transfer',
from: '5NPqYBdIsIpJzPeYixuz7BEH_W7BEk_mb8HxBD3OHXo',
to: '0x26361130d5d6E798E9319114643AF8c868412859',
amount: '100',
fee: '0',
feeRecipient: '0x6451eB7f668de69Fb4C943Db72bCF2A73DeeC6B1',
nonce: '1629277056512',
tokenID: 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,0xcc9141efa8c20c7df0778748255b1487957811be',
chainType: 'arweave,ethereum',
chainID: '0,42',
data: '',
version: 'v1',
sig: 'aiXZo1IINdFWNKnq_4SJDq93qWuIzXfaUlIoo8RnXCGVvaM39a7royP7A0bmiVbcDhGAnsyN44UnEiQx1ilUcXkMXyUNoz3w7MEy2XVLmR4nXPljMwXNhRi3WqsyCfk_bMCGnoibYj0CHFCnJU00Ik2L6dor8NlbcwoP5h6E24yrgOGVbMKxCQwL2EC2PSVNkHle0rfHePYuPYCw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