|
1 | | -import { ethers } from 'ethers' |
2 | | -// import { createLockupContract, LockupContract } from '../../ethereum/lockup' |
3 | | -// import { createGetValueCaller } from '../../ethereum/lockup/getValue' |
4 | | -// import { lockupAbi } from '../../ethereum/lockup/abi' |
5 | | -// import { createGetPropertyValueCaller } from '../../ethereum/lockup/getPropertyValue' |
6 | | -// import { createWithdrawCaller } from '../../ethereum/lockup/withdraw' |
7 | | -// import { createCalculateWithdrawableInterestAmountCaller } from '../../ethereum/lockup/calculateWithdrawableInterestAmount' |
8 | | -// import { createGetAllValueCaller } from '../../ethereum/lockup/getAllValue' |
9 | | -// import { createGetStorageWithdrawalStatusCaller } from '../../ethereum/lockup/getStorageWithdrawalStatus' |
10 | | -// import { createCalculateCumulativeHoldersRewardAmountCaller } from '../../ethereum/lockup/calculateCumulativeHoldersRewardAmount' |
11 | | -// import { createCalculateCumulativeRewardPricesCaller } from '../../ethereum/lockup/calculateCumulativeRewardPrices' |
12 | | -// import { createCalculateRewardAmountCaller } from '../../ethereum/lockup/calculateRewardAmount' |
13 | | -// import { createCapCaller } from '../../ethereum/lockup/cap' |
14 | | -// import { createDepositToPropertyCaller } from '../../ethereum/lockup/depositToProperty' |
15 | | -// import { createDepositToPositionCaller } from '../../ethereum/lockup/depositToPosition' |
16 | | -// import { createWithdrawByPositionCaller } from '../../ethereum/lockup/withdrawByPosition' |
17 | | -// import { createMigrateToSTokensCaller } from '../../ethereum/lockup/migrateToSTokens' |
18 | | -// import { createcalculateWithdrawableInterestAmountByPositionCaller } from '../../ethereum/lockup/calculateWithdrawableInterestAmountByPosition' |
19 | | -import { stubTransactionResposeFactory } from '../../common/utils/for-test' |
| 1 | +import { ethers, Wallet } from 'ethers' |
20 | 2 | import { Options, positionsCreate } from './positionsCreate' |
21 | 3 | import { testProviders } from '../common/const' |
| 4 | +import { env } from '../common/env' |
22 | 5 |
|
23 | 6 | describe('positionsCreate.ts', () => { |
24 | | - const host = 'localhost' |
25 | | - const address = '0x0000000000000000000000000000000000000000' |
26 | | - const provider = new ethers.providers.JsonRpcProvider(host) |
27 | | - |
28 | | - const propertyAddress = '0x80a25ACDD0797dfCe02dA25e4a55A4a334EE51c5' |
| 7 | + const propertyAddress = '0x38c4bF6cD20d157EE45553b0fAD13B0c6750b439' |
29 | 8 | const amount = '100' |
30 | 9 | const overrides = { |
31 | 10 | overrides: undefined, |
32 | 11 | fallback: undefined, |
33 | 12 | } |
34 | 13 |
|
35 | | - const stubTx = stubTransactionResposeFactory({}) |
36 | | - it('return Error if network is not valid', async () => { |
37 | | - const options: Options = { |
38 | | - provider: testProviders.polyMumbai, |
| 14 | + it("", async () => { |
| 15 | + // await window.ethereum.enable() |
| 16 | + const wallet = new ethers.Wallet(env.mnemonic, testProviders.ropsten) |
| 17 | + console.log(wallet) |
| 18 | + const options: Options = { |
| 19 | + wallet, |
39 | 20 | propertyAddress, |
40 | 21 | amount, |
41 | 22 | overrides, |
42 | 23 | } |
43 | | - const result = async () => { |
44 | | - await positionsCreate(options) |
| 24 | + const tx = await positionsCreate(options).then(result => result) |
| 25 | + console.log(tx) |
| 26 | + }) |
| 27 | + it('return undefined if network is not valid', async () => { |
| 28 | + const wallet = new ethers.Wallet(env.mnemonic, testProviders.polyMumbai) |
| 29 | + const options: Options = { |
| 30 | + wallet, |
| 31 | + propertyAddress, |
| 32 | + amount, |
| 33 | + overrides, |
45 | 34 | } |
46 | | - expect(result).rejects.toThrow('network is not valid') |
| 35 | + const tx = await positionsCreate(options).then(result => result) |
| 36 | + expect(tx).toEqual(undefined) |
47 | 37 | }) |
48 | 38 | }) |
| 39 | + |
| 40 | +// declare global { |
| 41 | +// interface Window { |
| 42 | +// ethereum: any; |
| 43 | +// } |
| 44 | +// } |
0 commit comments