-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from everFinance/feat/use-amount-as-reveive-wit…
…hdraw-amount Feat/PST token decimals
- Loading branch information
Showing
7 changed files
with
157 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import Everpay from '../src/index' | ||
import { ethWalletHasUSDT, arWallet2 } from './constants/wallet' | ||
import { ArweaveTransaction } from '../src/types' | ||
import { ethers } from 'ethers' | ||
|
||
const provider = new ethers.providers.InfuraProvider('kovan') | ||
const signer = new ethers.Wallet(ethWalletHasUSDT.privateKey, provider) | ||
|
||
const everpayEthereumMode = new Everpay({ | ||
account: ethWalletHasUSDT.address, | ||
ethConnectedSigner: signer, | ||
debug: true | ||
}) | ||
|
||
test(`check ${ethWalletHasUSDT.address} deposit vrt`, async () => { | ||
return await everpayEthereumMode.deposit({ | ||
symbol: 'vrt', | ||
amount: '0.000000001' | ||
}).then(ethTx => { | ||
console.log('ethTx', ethTx) | ||
expect(ethTx).toBeTruthy() | ||
}) | ||
}) | ||
|
||
const everpayARMode = new Everpay({ | ||
account: arWallet2.address, | ||
arJWK: arWallet2.jwk, | ||
debug: true | ||
}) | ||
|
||
test(`check ${arWallet2.address} deposit VRT`, async () => { | ||
return await everpayARMode.deposit({ | ||
symbol: 'vrt', | ||
amount: '1' | ||
}).then((arTx) => { | ||
console.log('arTx', arTx as ArweaveTransaction) | ||
expect((arTx as ArweaveTransaction).id).toBeTruthy() | ||
}) | ||
}) | ||
|
||
test(`check ${arWallet2.address} deposit VRT failed`, async () => { | ||
await expect( | ||
everpayARMode.deposit({ | ||
symbol: 'vrt', | ||
amount: '0.1' | ||
}) | ||
) | ||
.rejects | ||
.toThrow('DEPOSIT_ARWEAVE_PST_MUST_BE_INTEGER') | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import Everpay from '../src/index' | ||
import { arWallet2, ethWalletHasUSDT } from './constants/wallet' | ||
|
||
test(`${arWallet2.address} withdraw ar to ${arWallet2.address}`, async () => { | ||
const everpay = new Everpay({ | ||
account: arWallet2.address, | ||
arJWK: arWallet2.jwk, | ||
debug: true | ||
}) | ||
|
||
return await everpay.transfer({ | ||
symbol: 'VRT', | ||
amount: '0.000010001', | ||
to: ethWalletHasUSDT.address | ||
}).then(withdrawResult => { | ||
console.log('withdrawResult', withdrawResult) | ||
expect(withdrawResult.status).toBe('ok') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import Everpay from '../src/index' | ||
import { arWallet2, ethWalletHasUSDT } from './constants/wallet' | ||
import { ChainType } from '../src/types' | ||
|
||
test(`${arWallet2.address} withdraw vrt to ${arWallet2.address}`, async () => { | ||
const everpay = new Everpay({ | ||
account: arWallet2.address, | ||
arJWK: arWallet2.jwk, | ||
debug: true | ||
}) | ||
|
||
return await everpay.withdraw({ | ||
chainType: ChainType.arweave, | ||
symbol: 'vrt', | ||
amount: '1', | ||
to: arWallet2.address | ||
}).then(withdrawResult => { | ||
console.log('withdrawResult', withdrawResult) | ||
expect(withdrawResult.status).toBe('ok') | ||
}) | ||
}) | ||
|
||
test(`check ${arWallet2.address} deposit VRT failed`, async () => { | ||
const everpay = new Everpay({ | ||
account: arWallet2.address, | ||
arJWK: arWallet2.jwk, | ||
debug: true | ||
}) | ||
await expect( | ||
everpay.withdraw({ | ||
chainType: ChainType.arweave, | ||
symbol: 'vrt', | ||
amount: '0.1' | ||
}) | ||
) | ||
.rejects | ||
.toThrow('PST_WITHDARW_TO_ARWEAVE_MUST_BE_INTEGER') | ||
}) | ||
|
||
test(`${arWallet2.address} withdraw ar to ethereum address ${ethWalletHasUSDT.address}`, async () => { | ||
const everpay = new Everpay({ | ||
account: arWallet2.address, | ||
arJWK: arWallet2.jwk, | ||
debug: true | ||
}) | ||
|
||
return await everpay.withdraw({ | ||
chainType: ChainType.ethereum, | ||
symbol: 'vrt', | ||
amount: '0.000010001', | ||
to: ethWalletHasUSDT.address | ||
}).then(withdrawResult => { | ||
console.log('withdrawResult', withdrawResult) | ||
expect(withdrawResult.status).toBe('ok') | ||
}) | ||
}) |