diff --git a/lib/common/erc20/approve.spec.ts b/lib/common/erc20/approve.spec.ts index 44dc8cdf3..8587e16f0 100644 --- a/lib/common/erc20/approve.spec.ts +++ b/lib/common/erc20/approve.spec.ts @@ -1,10 +1,10 @@ import { createApproveCaller } from './approve' -import { stubbedSendTx } from '../utils/for-test' +import { stubTransactionResposeFactory } from '../utils/for-test' describe('approve.spec.ts', () => { describe('createApproveCaller', () => { it('call success', async () => { - const success = true + const success = stubTransactionResposeFactory({}) const to = '0x0472ec0185ebb8202f3d4ddb0226998889663cf2' const value = '12345' @@ -12,9 +12,7 @@ describe('approve.spec.ts', () => { approve: jest .fn() // eslint-disable-next-line @typescript-eslint/no-unused-vars - .mockImplementation(async (to: string, value: number) => - stubbedSendTx() - ), + .mockImplementation(async (to: string, value: number) => success), } const expected = success diff --git a/lib/common/erc20/approve.ts b/lib/common/erc20/approve.ts index f8e9953a8..3d716168c 100644 --- a/lib/common/erc20/approve.ts +++ b/lib/common/erc20/approve.ts @@ -4,7 +4,7 @@ import { FallbackableOverrides, MutationOption, } from '../utils/execute' -import { T } from 'ramda' +import { TransactionResponse } from '@ethersproject/abstract-provider' export type CreateApproveCaller = ( contract: ethers.Contract @@ -12,7 +12,7 @@ export type CreateApproveCaller = ( to: string, value: string, overrides?: FallbackableOverrides -) => Promise +) => Promise export const createApproveCaller: CreateApproveCaller = (contract: ethers.Contract) => @@ -23,4 +23,4 @@ export const createApproveCaller: CreateApproveCaller = mutation: true, args: [to, value], overrides, - }).then(T) + }) diff --git a/lib/common/erc20/index.ts b/lib/common/erc20/index.ts index 030254a90..b1391ab11 100644 --- a/lib/common/erc20/index.ts +++ b/lib/common/erc20/index.ts @@ -12,6 +12,7 @@ import { createSymbolCaller } from './symbol' import { createDecimalsCaller } from './decimals' import { createAllowanceCaller } from './allowance' import { FallbackableOverrides } from '../utils/execute' +import { TransactionResponse } from '@ethersproject/abstract-provider' export type Erc20Contract = { readonly totalSupply: () => Promise @@ -20,19 +21,19 @@ export type Erc20Contract = { to: string, value: string, overrides?: FallbackableOverrides - ) => Promise + ) => Promise readonly allowance: (from: string, to: string) => Promise readonly approve: ( to: string, value: string, overrides?: FallbackableOverrides - ) => Promise + ) => Promise readonly transferFrom: ( from: string, to: string, value: string, overrides?: FallbackableOverrides - ) => Promise + ) => Promise readonly name: () => Promise readonly symbol: () => Promise readonly decimals: () => Promise diff --git a/lib/common/erc20/transfer.spec.ts b/lib/common/erc20/transfer.spec.ts index c25af2456..649fd33f1 100644 --- a/lib/common/erc20/transfer.spec.ts +++ b/lib/common/erc20/transfer.spec.ts @@ -1,10 +1,10 @@ import { createTransferCaller } from './transfer' -import { stubbedSendTx } from '../../common/utils/for-test' +import { stubTransactionResposeFactory } from '../../common/utils/for-test' describe('transfer.spec.ts', () => { describe('createTransferCaller', () => { it('call success', async () => { - const success = true + const success = stubTransactionResposeFactory({}) const to = '0x0472ec0185ebb8202f3d4ddb0226998889663cf2' const value = '12345' @@ -12,9 +12,7 @@ describe('transfer.spec.ts', () => { transfer: jest .fn() // eslint-disable-next-line @typescript-eslint/no-unused-vars - .mockImplementation(async (to: string, value: number) => - stubbedSendTx() - ), + .mockImplementation(async (to: string, value: number) => success), } const expected = success diff --git a/lib/common/erc20/transfer.ts b/lib/common/erc20/transfer.ts index 82b113bc1..cec3e01dd 100644 --- a/lib/common/erc20/transfer.ts +++ b/lib/common/erc20/transfer.ts @@ -4,7 +4,7 @@ import { FallbackableOverrides, MutationOption, } from '../utils/execute' -import { T } from 'ramda' +import { TransactionResponse } from '@ethersproject/abstract-provider' export type CreateTransferCaller = ( contract: ethers.Contract @@ -12,7 +12,7 @@ export type CreateTransferCaller = ( to: string, value: string, overrides?: FallbackableOverrides -) => Promise +) => Promise export const createTransferCaller: CreateTransferCaller = (contract: ethers.Contract) => @@ -23,4 +23,4 @@ export const createTransferCaller: CreateTransferCaller = args: [to, value], mutation: true, overrides, - }).then(T) + }) diff --git a/lib/common/erc20/transferFrom.spec.ts b/lib/common/erc20/transferFrom.spec.ts index 1d7a651b4..d5c45210a 100644 --- a/lib/common/erc20/transferFrom.spec.ts +++ b/lib/common/erc20/transferFrom.spec.ts @@ -1,10 +1,10 @@ import { createTransferFromCaller } from './transferFrom' -import { stubbedSendTx } from '../../common/utils/for-test' +import { stubTransactionResposeFactory } from '../../common/utils/for-test' describe('transferFrom.spec.ts', () => { describe('createTransferFromCaller', () => { it('call success', async () => { - const success = true + const success = stubTransactionResposeFactory({}) const from = '0x1E9342827907CD370CB8Ba2F768d7D50b2f457F9' const to = '0x0472ec0185ebb8202f3d4ddb0226998889663cf2' const value = '12345' @@ -13,8 +13,8 @@ describe('transferFrom.spec.ts', () => { transferFrom: jest .fn() // eslint-disable-next-line @typescript-eslint/no-unused-vars - .mockImplementation(async (from: string, to: string, value: number) => - stubbedSendTx() + .mockImplementation( + async (from: string, to: string, value: number) => success ), } diff --git a/lib/common/erc20/transferFrom.ts b/lib/common/erc20/transferFrom.ts index c4ae1c594..ddb1bf269 100644 --- a/lib/common/erc20/transferFrom.ts +++ b/lib/common/erc20/transferFrom.ts @@ -4,7 +4,7 @@ import { FallbackableOverrides, MutationOption, } from '../utils/execute' -import { T } from 'ramda' +import { TransactionResponse } from '@ethersproject/abstract-provider' export type CreateTransferFromCaller = ( contract: ethers.Contract @@ -13,7 +13,7 @@ export type CreateTransferFromCaller = ( to: string, value: string, overrides?: FallbackableOverrides -) => Promise +) => Promise export const createTransferFromCaller: CreateTransferFromCaller = (contract: ethers.Contract) => @@ -29,4 +29,4 @@ export const createTransferFromCaller: CreateTransferFromCaller = mutation: true, args: [from, to, value], overrides, - }).then(T) + }) diff --git a/lib/ethereum/dev/deposit.spec.ts b/lib/ethereum/dev/deposit.spec.ts index bef55913e..77a1897fa 100644 --- a/lib/ethereum/dev/deposit.spec.ts +++ b/lib/ethereum/dev/deposit.spec.ts @@ -1,10 +1,10 @@ import { createDepositCaller } from './deposit' -import { stubbedSendTx } from '../../common/utils/for-test' +import { stubTransactionResposeFactory } from '../../common/utils/for-test' describe('deposit.spec.ts', () => { describe('createDepositCaller', () => { it('call success', async () => { - const success = true + const success = stubTransactionResposeFactory({}) const to = '0x0472ec0185ebb8202f3d4ddb0226998889663cf2' const value = '12345' @@ -12,9 +12,7 @@ describe('deposit.spec.ts', () => { deposit: jest .fn() // eslint-disable-next-line @typescript-eslint/no-unused-vars - .mockImplementation(async (to: string, value: number) => - stubbedSendTx() - ), + .mockImplementation(async (to: string, value: number) => success), } const expected = success diff --git a/lib/ethereum/dev/deposit.ts b/lib/ethereum/dev/deposit.ts index 9a0095412..249363a47 100644 --- a/lib/ethereum/dev/deposit.ts +++ b/lib/ethereum/dev/deposit.ts @@ -4,7 +4,7 @@ import { MutationOption, FallbackableOverrides, } from '../../common/utils/execute' -import { T } from 'ramda' +import { TransactionResponse } from '@ethersproject/abstract-provider' export type CreateDepositCaller = ( contract: ethers.Contract @@ -12,7 +12,7 @@ export type CreateDepositCaller = ( to: string, value: string, overrides?: FallbackableOverrides -) => Promise +) => Promise export const createDepositCaller: CreateDepositCaller = (contract: ethers.Contract) => @@ -23,4 +23,4 @@ export const createDepositCaller: CreateDepositCaller = args: [to, value], mutation: true, overrides, - }).then(T) + }) diff --git a/lib/ethereum/dev/index.ts b/lib/ethereum/dev/index.ts index 1ba2b1238..d3da3d831 100644 --- a/lib/ethereum/dev/index.ts +++ b/lib/ethereum/dev/index.ts @@ -13,18 +13,19 @@ import { createDecimalsCaller } from '../../common/erc20/decimals' import { createAllowanceCaller } from '../../common/erc20/allowance' import { createDepositCaller } from './deposit' import { FallbackableOverrides } from '../../common/utils/execute' +import { TransactionResponse } from '@ethersproject/abstract-provider' export type DevContract = { readonly totalSupply: () => Promise readonly balanceOf: (address: string) => Promise - readonly transfer: (to: string, value: string) => Promise + readonly transfer: (to: string, value: string) => Promise readonly allowance: (from: string, to: string) => Promise - readonly approve: (to: string, value: string) => Promise + readonly approve: (to: string, value: string) => Promise readonly transferFrom: ( from: string, to: string, value: string - ) => Promise + ) => Promise readonly name: () => Promise readonly symbol: () => Promise readonly decimals: () => Promise @@ -32,7 +33,7 @@ export type DevContract = { to: string, value: string, overrides?: FallbackableOverrides - ) => Promise + ) => Promise } export const createDevContract = diff --git a/lib/ethereum/lockup/depositToPosition.spec.ts b/lib/ethereum/lockup/depositToPosition.spec.ts index b63c1b966..e464a710b 100644 --- a/lib/ethereum/lockup/depositToPosition.spec.ts +++ b/lib/ethereum/lockup/depositToPosition.spec.ts @@ -1,12 +1,14 @@ import { createDepositToPositionCaller } from './depositToPosition' -import { stubbedSendTx } from '../../common/utils/for-test' +import { stubTransactionResposeFactory } from '../../common/utils/for-test' describe('depositToPosition.spec.ts', () => { describe('createDepositToPositionCaller', () => { it('call success', async () => { - const expected = true + const expected = stubTransactionResposeFactory({}) const lockupContract = { - depositToPosition: jest.fn().mockImplementation(stubbedSendTx), + depositToPosition: jest + .fn() + .mockImplementation(() => Promise.resolve(expected)), } // eslint-disable-next-line @typescript-eslint/no-explicit-any diff --git a/lib/ethereum/lockup/depositToPosition.ts b/lib/ethereum/lockup/depositToPosition.ts index 15eccdffb..03ca49a38 100644 --- a/lib/ethereum/lockup/depositToPosition.ts +++ b/lib/ethereum/lockup/depositToPosition.ts @@ -5,7 +5,7 @@ import { FallbackableOverrides, MutationOption, } from '../../common/utils/execute' -import { T } from 'ramda' +import { TransactionResponse } from '@ethersproject/abstract-provider' export type CreateDepositToPositionCaller = ( contract: ethers.Contract @@ -13,7 +13,7 @@ export type CreateDepositToPositionCaller = ( positionTokenId: string, amount: string, overrides?: FallbackableOverrides -) => Promise +) => Promise export const createDepositToPositionCaller: CreateDepositToPositionCaller = (contract: ethers.Contract) => @@ -28,4 +28,4 @@ export const createDepositToPositionCaller: CreateDepositToPositionCaller = mutation: true, args: [positionTokenId, amount], overrides, - }).then(T) + }) diff --git a/lib/ethereum/lockup/index.ts b/lib/ethereum/lockup/index.ts index fcc357a13..edf591af8 100644 --- a/lib/ethereum/lockup/index.ts +++ b/lib/ethereum/lockup/index.ts @@ -31,12 +31,12 @@ export type LockupContract = { positionTokenId: string, amount: string, overrides?: FallbackableOverrides - ) => Promise + ) => Promise readonly withdraw: ( propertyAddress: string, amount: string, overrides?: FallbackableOverrides - ) => Promise + ) => Promise readonly calculateWithdrawableInterestAmountByPosition: ( positionTokenId: string ) => Promise @@ -67,11 +67,11 @@ export type LockupContract = { positionTokenId: string, amount: string, overrides?: FallbackableOverrides - ) => Promise + ) => Promise readonly migrateToSTokens: ( positionTokenId: string, overrides?: FallbackableOverrides - ) => Promise + ) => Promise } export const createLockupContract = diff --git a/lib/ethereum/lockup/migrateToSTokens.spec.ts b/lib/ethereum/lockup/migrateToSTokens.spec.ts index 522a06806..8dff32da9 100644 --- a/lib/ethereum/lockup/migrateToSTokens.spec.ts +++ b/lib/ethereum/lockup/migrateToSTokens.spec.ts @@ -1,12 +1,12 @@ import { createMigrateToSTokensCaller } from './migrateToSTokens' -import { stubbedSendTx } from '../../common/utils/for-test' +import { stubTransactionResposeFactory } from '../../common/utils/for-test' describe('migrateToSTokens.spec.ts', () => { describe('createMigrateToSTokensCaller', () => { it('call success', async () => { - const expected = true + const expected = stubTransactionResposeFactory({}) const lockupContract = { - migrateToSTokens: jest.fn().mockImplementation(stubbedSendTx), + migrateToSTokens: jest.fn().mockImplementation(()=>Promise.resolve(expected)), } // eslint-disable-next-line @typescript-eslint/no-explicit-any diff --git a/lib/ethereum/lockup/migrateToSTokens.ts b/lib/ethereum/lockup/migrateToSTokens.ts index a174c9dcf..6034d268c 100644 --- a/lib/ethereum/lockup/migrateToSTokens.ts +++ b/lib/ethereum/lockup/migrateToSTokens.ts @@ -5,14 +5,14 @@ import { FallbackableOverrides, MutationOption, } from '../../common/utils/execute' -import { T } from 'ramda' +import { TransactionResponse } from '@ethersproject/abstract-provider' export type CreateMigrateToSTokensCaller = ( contract: ethers.Contract ) => ( propertyAddress: string, overrides?: FallbackableOverrides -) => Promise +) => Promise export const createMigrateToSTokensCaller: CreateMigrateToSTokensCaller = (contract: ethers.Contract) => @@ -23,4 +23,4 @@ export const createMigrateToSTokensCaller: CreateMigrateToSTokensCaller = mutation: true, args: [propertyAddress], overrides, - }).then(T) + }) diff --git a/lib/ethereum/lockup/withdraw.spec.ts b/lib/ethereum/lockup/withdraw.spec.ts index 4a8979a16..7bef6b688 100644 --- a/lib/ethereum/lockup/withdraw.spec.ts +++ b/lib/ethereum/lockup/withdraw.spec.ts @@ -1,15 +1,15 @@ import { createWithdrawCaller } from './withdraw' -import { stubbedSendTx } from '../../common/utils/for-test' +import { stubTransactionResposeFactory } from '../../common/utils/for-test' describe('withdraw.spec.ts', () => { describe('createWithdrawCaller', () => { it('call success', async () => { - const expected = true + const expected = stubTransactionResposeFactory({}) const lockupContract = { withdraw: jest .fn() // eslint-disable-next-line @typescript-eslint/no-unused-vars - .mockImplementation(async (property: string) => stubbedSendTx()), + .mockImplementation(async (property: string) => expected), } // eslint-disable-next-line @typescript-eslint/no-explicit-any diff --git a/lib/ethereum/lockup/withdraw.ts b/lib/ethereum/lockup/withdraw.ts index f617f31ab..5a4e38943 100644 --- a/lib/ethereum/lockup/withdraw.ts +++ b/lib/ethereum/lockup/withdraw.ts @@ -4,7 +4,7 @@ import { FallbackableOverrides, MutationOption, } from '../../common/utils/execute' -import { T } from 'ramda' +import { TransactionResponse } from '@ethersproject/abstract-provider' export type CreateWithdrawCaller = ( contract: ethers.Contract @@ -12,7 +12,7 @@ export type CreateWithdrawCaller = ( propertyAddress: string, amount: string, overrides?: FallbackableOverrides -) => Promise +) => Promise export const createWithdrawCaller: CreateWithdrawCaller = (contract: ethers.Contract) => @@ -27,4 +27,4 @@ export const createWithdrawCaller: CreateWithdrawCaller = mutation: true, args: [propertyAddress, amount], overrides, - }).then(T) + }) diff --git a/lib/ethereum/lockup/withdrawByPosition.spec.ts b/lib/ethereum/lockup/withdrawByPosition.spec.ts index 4bfcc047b..8ba387878 100644 --- a/lib/ethereum/lockup/withdrawByPosition.spec.ts +++ b/lib/ethereum/lockup/withdrawByPosition.spec.ts @@ -1,12 +1,14 @@ import { createWithdrawByPositionCaller } from './withdrawByPosition' -import { stubbedSendTx } from '../../common/utils/for-test' +import { stubTransactionResposeFactory } from '../../common/utils/for-test' describe('withdrawByPosition.spec.ts', () => { describe('createWithdrawByPositionCaller', () => { it('call success', async () => { - const expected = true + const expected = stubTransactionResposeFactory({}) const lockupContract = { - withdrawByPosition: jest.fn().mockImplementation(stubbedSendTx), + withdrawByPosition: jest + .fn() + .mockImplementation(() => Promise.resolve(expected)), } // eslint-disable-next-line @typescript-eslint/no-explicit-any diff --git a/lib/ethereum/lockup/withdrawByPosition.ts b/lib/ethereum/lockup/withdrawByPosition.ts index b2dec9a2d..357494265 100644 --- a/lib/ethereum/lockup/withdrawByPosition.ts +++ b/lib/ethereum/lockup/withdrawByPosition.ts @@ -5,7 +5,7 @@ import { FallbackableOverrides, MutationOption, } from '../../common/utils/execute' -import { T } from 'ramda' +import { TransactionResponse } from '@ethersproject/abstract-provider' export type CreateWithdrawByPositionCaller = ( contract: ethers.Contract @@ -13,7 +13,7 @@ export type CreateWithdrawByPositionCaller = ( positionTokenId: string, amount: string, overrides?: FallbackableOverrides -) => Promise +) => Promise export const createWithdrawByPositionCaller: CreateWithdrawByPositionCaller = (contract: ethers.Contract) => @@ -28,4 +28,4 @@ export const createWithdrawByPositionCaller: CreateWithdrawByPositionCaller = mutation: true, args: [positionTokenId, amount], overrides, - }).then(T) + }) diff --git a/lib/ethereum/market-factory/create.spec.ts b/lib/ethereum/market-factory/create.spec.ts index 69fbed82b..1bcc494b5 100644 --- a/lib/ethereum/market-factory/create.spec.ts +++ b/lib/ethereum/market-factory/create.spec.ts @@ -1,16 +1,16 @@ import { createCreateCaller } from './create' -import { stubbedSendTx } from '../../common/utils/for-test' +import { stubTransactionResposeFactory } from '../../common/utils/for-test' describe('create.spec.ts', () => { describe('createCreateCaller', () => { it('call success', async () => { - const expected = true + const expected = stubTransactionResposeFactory({}) const marketFactoryContract = { create: jest .fn() // eslint-disable-next-line @typescript-eslint/no-unused-vars - .mockImplementation(async (marketBehaviorAddress: string) => - stubbedSendTx() + .mockImplementation( + async (marketBehaviorAddress: string) => expected ), } diff --git a/lib/ethereum/market-factory/create.ts b/lib/ethereum/market-factory/create.ts index 164b0a26d..7c6829cb0 100644 --- a/lib/ethereum/market-factory/create.ts +++ b/lib/ethereum/market-factory/create.ts @@ -4,14 +4,14 @@ import { FallbackableOverrides, MutationOption, } from '../../common/utils/execute' -import { T } from 'ramda' +import { TransactionResponse } from '@ethersproject/abstract-provider' export type CreateCreateCaller = ( contract: ethers.Contract ) => ( marketBehaviorAddress: string, overrides?: FallbackableOverrides -) => Promise +) => Promise export const createCreateCaller: CreateCreateCaller = (contract: ethers.Contract) => @@ -22,4 +22,4 @@ export const createCreateCaller: CreateCreateCaller = mutation: true, args: [marketBehaviorAddress], overrides, - }).then(T) + }) diff --git a/lib/ethereum/market-factory/index.ts b/lib/ethereum/market-factory/index.ts index 329ff9eb1..7378a61e1 100644 --- a/lib/ethereum/market-factory/index.ts +++ b/lib/ethereum/market-factory/index.ts @@ -4,12 +4,13 @@ import { Signer } from '@ethersproject/abstract-signer' import { marketFactoryAbi } from './abi' import { createCreateCaller } from './create' import { FallbackableOverrides } from '../../common/utils/execute' +import { TransactionResponse } from '@ethersproject/abstract-provider' export type MarketFactoryContract = { readonly create: ( marketBehaviorAddress: string, overrides?: FallbackableOverrides - ) => Promise + ) => Promise } export const createMarketFactoryContract = diff --git a/lib/ethereum/policy-factory/create.spec.ts b/lib/ethereum/policy-factory/create.spec.ts index 7aa9d2702..23bc6d251 100644 --- a/lib/ethereum/policy-factory/create.spec.ts +++ b/lib/ethereum/policy-factory/create.spec.ts @@ -1,19 +1,17 @@ import { createCreateCaller } from './create' -import { stubbedSendTx } from '../../common/utils/for-test' +import { stubTransactionResposeFactory } from '../../common/utils/for-test' describe('deposit.spec.ts', () => { describe('createDepositCaller', () => { it('call success', async () => { - const success = true + const success = stubTransactionResposeFactory({}) const policy = '0x0472ec0185ebb8202f3d4ddb0226998889663cf2' const devContract = { create: jest .fn() // eslint-disable-next-line @typescript-eslint/no-unused-vars - .mockImplementation(async (newPolicyAddress: string) => - stubbedSendTx() - ), + .mockImplementation(async (newPolicyAddress: string) => success), } const expected = success diff --git a/lib/ethereum/policy-factory/create.ts b/lib/ethereum/policy-factory/create.ts index 087be7863..e16ed1b85 100644 --- a/lib/ethereum/policy-factory/create.ts +++ b/lib/ethereum/policy-factory/create.ts @@ -4,14 +4,14 @@ import { FallbackableOverrides, MutationOption, } from '../../common/utils/execute' -import { T } from 'ramda' +import { TransactionResponse } from '@ethersproject/abstract-provider' export type CreateCreateCaller = ( contract: ethers.Contract ) => ( newPolicyAddress: string, overrides?: FallbackableOverrides -) => Promise +) => Promise export const createCreateCaller: CreateCreateCaller = (contract: ethers.Contract) => @@ -22,4 +22,4 @@ export const createCreateCaller: CreateCreateCaller = mutation: true, args: [newPolicyAddress], overrides, - }).then(T) + }) diff --git a/lib/ethereum/policy-factory/forceAttach.spec.ts b/lib/ethereum/policy-factory/forceAttach.spec.ts index b795f7023..0850ce9f7 100644 --- a/lib/ethereum/policy-factory/forceAttach.spec.ts +++ b/lib/ethereum/policy-factory/forceAttach.spec.ts @@ -1,17 +1,17 @@ import { createForceAttachCaller } from './forceAttach' -import { stubbedSendTx } from '../../common/utils/for-test' +import { stubTransactionResposeFactory } from '../../common/utils/for-test' describe('forceAttach.spec.ts', () => { describe('createForceAttachCaller', () => { it('call success', async () => { - const success = true + const success = stubTransactionResposeFactory({}) const policy = '0x0472ec0185ebb8202f3d4ddb0226998889663cf2' const devContract = { forceAttach: jest .fn() // eslint-disable-next-line @typescript-eslint/no-unused-vars - .mockImplementation(async (policy: string) => stubbedSendTx()), + .mockImplementation(async (policy: string) => success), } const expected = success diff --git a/lib/ethereum/policy-factory/forceAttach.ts b/lib/ethereum/policy-factory/forceAttach.ts index 47ce4a97c..9ab9d6e11 100644 --- a/lib/ethereum/policy-factory/forceAttach.ts +++ b/lib/ethereum/policy-factory/forceAttach.ts @@ -4,11 +4,14 @@ import { FallbackableOverrides, MutationOption, } from '../../common/utils/execute' -import { T } from 'ramda' +import { TransactionResponse } from '@ethersproject/abstract-provider' export type CreateForceAttachCaller = ( contract: ethers.Contract -) => (policy: string, overrides?: FallbackableOverrides) => Promise +) => ( + policy: string, + overrides?: FallbackableOverrides +) => Promise export const createForceAttachCaller: CreateForceAttachCaller = (contract: ethers.Contract) => @@ -19,4 +22,4 @@ export const createForceAttachCaller: CreateForceAttachCaller = mutation: true, args: [policy], overrides, - }).then(T) + }) diff --git a/lib/ethereum/policy-factory/index.ts b/lib/ethereum/policy-factory/index.ts index 96d9c1829..feac091d1 100644 --- a/lib/ethereum/policy-factory/index.ts +++ b/lib/ethereum/policy-factory/index.ts @@ -5,16 +5,17 @@ import { policyFactoryAbi } from './abi' import { createCreateCaller } from './create' import { createForceAttachCaller } from './forceAttach' import { FallbackableOverrides } from '../../common/utils/execute' +import { TransactionResponse } from '@ethersproject/abstract-provider' export type PolicyFactoryContract = { readonly create: ( newPolicyAddress: string, overrides?: FallbackableOverrides - ) => Promise + ) => Promise readonly forceAttach: ( policy: string, overrides?: FallbackableOverrides - ) => Promise + ) => Promise } export type CreatePolicyFactoryContract = ( diff --git a/lib/ethereum/property/changeAuthor.spec.ts b/lib/ethereum/property/changeAuthor.spec.ts index c1caea6c5..43f435ec9 100644 --- a/lib/ethereum/property/changeAuthor.spec.ts +++ b/lib/ethereum/property/changeAuthor.spec.ts @@ -1,17 +1,17 @@ import { createChangeAuthorCaller } from './changeAuthor' -import { stubbedSendTx } from '../../common/utils/for-test' +import { stubTransactionResposeFactory } from '../../common/utils/for-test' describe('changeAuthor.spec.ts', () => { describe('createChangeAuthorCaller', () => { it('call success', async () => { - const expected = true + const expected = stubTransactionResposeFactory({}) const nextAuther = '0x0472ec0185ebb8202f3d4ddb0226998889663cf2' const contract = { changeAuthor: jest .fn() // eslint-disable-next-line @typescript-eslint/no-unused-vars - .mockImplementation(async (nextAuther: string) => stubbedSendTx()), + .mockImplementation(async (nextAuther: string) => expected), } // eslint-disable-next-line @typescript-eslint/no-explicit-any diff --git a/lib/ethereum/property/changeAuthor.ts b/lib/ethereum/property/changeAuthor.ts index 36068bd54..287059e17 100644 --- a/lib/ethereum/property/changeAuthor.ts +++ b/lib/ethereum/property/changeAuthor.ts @@ -4,11 +4,14 @@ import { FallbackableOverrides, MutationOption, } from '../../common/utils/execute' -import { T } from 'ramda' +import { TransactionResponse } from '@ethersproject/abstract-provider' export type CreateChangeAuthorCaller = ( contract: ethers.Contract -) => (nextAuther: string, overrides?: FallbackableOverrides) => Promise +) => ( + nextAuther: string, + overrides?: FallbackableOverrides +) => Promise export const createChangeAuthorCaller: CreateChangeAuthorCaller = (contract: ethers.Contract) => @@ -19,4 +22,4 @@ export const createChangeAuthorCaller: CreateChangeAuthorCaller = mutation: true, args: [nextAuther], overrides, - }).then(T) + }) diff --git a/lib/ethereum/property/changeName.spec.ts b/lib/ethereum/property/changeName.spec.ts index 6f03a9787..40d01ff61 100644 --- a/lib/ethereum/property/changeName.spec.ts +++ b/lib/ethereum/property/changeName.spec.ts @@ -1,17 +1,17 @@ import { createChangeNameCaller } from './changeName' -import { stubbedSendTx } from '../../common/utils/for-test' +import { stubTransactionResposeFactory } from '../../common/utils/for-test' describe('changeName.spec.ts', () => { describe('createChangeNameCaller', () => { it('call success', async () => { - const expected = true + const expected = stubTransactionResposeFactory({}) const nextName = 'next' const contract = { changeName: jest .fn() // eslint-disable-next-line @typescript-eslint/no-unused-vars - .mockImplementation(async (nextName: string) => stubbedSendTx()), + .mockImplementation(async (nextName: string) => expected), } // eslint-disable-next-line @typescript-eslint/no-explicit-any diff --git a/lib/ethereum/property/changeName.ts b/lib/ethereum/property/changeName.ts index 180a947c7..b5aef9f83 100644 --- a/lib/ethereum/property/changeName.ts +++ b/lib/ethereum/property/changeName.ts @@ -4,11 +4,14 @@ import { FallbackableOverrides, MutationOption, } from '../../common/utils/execute' -import { T } from 'ramda' +import { TransactionResponse } from '@ethersproject/abstract-provider' export type CreateChangeNameCaller = ( contract: ethers.Contract -) => (nextAuther: string, overrides?: FallbackableOverrides) => Promise +) => ( + nextAuther: string, + overrides?: FallbackableOverrides +) => Promise export const createChangeNameCaller: CreateChangeNameCaller = (contract: ethers.Contract) => @@ -19,4 +22,4 @@ export const createChangeNameCaller: CreateChangeNameCaller = mutation: true, args: [nextName], overrides, - }).then(T) + }) diff --git a/lib/ethereum/property/changeSymbol.spec.ts b/lib/ethereum/property/changeSymbol.spec.ts index 16c9727c2..a459a92c4 100644 --- a/lib/ethereum/property/changeSymbol.spec.ts +++ b/lib/ethereum/property/changeSymbol.spec.ts @@ -1,17 +1,17 @@ import { createChangeSymbolCaller } from './changeSymbol' -import { stubbedSendTx } from '../../common/utils/for-test' +import { stubTransactionResposeFactory } from '../../common/utils/for-test' describe('changeSymbol.spec.ts', () => { describe('createChangeSymbolCaller', () => { it('call success', async () => { - const expected = true + const expected = stubTransactionResposeFactory({}) const nextSymbol = 'next' const contract = { changeSymbol: jest .fn() // eslint-disable-next-line @typescript-eslint/no-unused-vars - .mockImplementation(async (nextSymbol: string) => stubbedSendTx()), + .mockImplementation(async (nextSymbol: string) => expected), } // eslint-disable-next-line @typescript-eslint/no-explicit-any diff --git a/lib/ethereum/property/changeSymbol.ts b/lib/ethereum/property/changeSymbol.ts index 235c82069..54db1a217 100644 --- a/lib/ethereum/property/changeSymbol.ts +++ b/lib/ethereum/property/changeSymbol.ts @@ -4,11 +4,14 @@ import { FallbackableOverrides, MutationOption, } from '../../common/utils/execute' -import { T } from 'ramda' +import { TransactionResponse } from '@ethersproject/abstract-provider' export type CreateChangeSymbolCaller = ( contract: ethers.Contract -) => (nextAuther: string, overrides?: FallbackableOverrides) => Promise +) => ( + nextAuther: string, + overrides?: FallbackableOverrides +) => Promise export const createChangeSymbolCaller: CreateChangeSymbolCaller = (contract: ethers.Contract) => @@ -19,4 +22,4 @@ export const createChangeSymbolCaller: CreateChangeSymbolCaller = mutation: true, args: [nextSymbol], overrides, - }).then(T) + }) diff --git a/lib/ethereum/property/index.ts b/lib/ethereum/property/index.ts index 6b64e5d1e..da06b4e9d 100644 --- a/lib/ethereum/property/index.ts +++ b/lib/ethereum/property/index.ts @@ -16,6 +16,7 @@ import { createBalanceOfCaller } from '../../common/erc20/balanceOf' import { createApproveCaller } from '../../common/erc20/approve' import { createAllowanceCaller } from '../../common/erc20/allowance' import { FallbackableOverrides } from '../../common/utils/execute' +import { TransactionResponse } from '@ethersproject/abstract-provider' export type PropertyContract = { readonly totalSupply: () => Promise @@ -24,19 +25,19 @@ export type PropertyContract = { to: string, value: string, overrides?: FallbackableOverrides - ) => Promise + ) => Promise readonly allowance: (from: string, to: string) => Promise readonly approve: ( to: string, value: string, overrides?: FallbackableOverrides - ) => Promise + ) => Promise readonly transferFrom: ( from: string, to: string, value: string, overrides?: FallbackableOverrides - ) => Promise + ) => Promise readonly name: () => Promise readonly symbol: () => Promise readonly decimals: () => Promise @@ -44,15 +45,15 @@ export type PropertyContract = { readonly changeAuthor: ( nextAuthor: string, overrides?: FallbackableOverrides - ) => Promise + ) => Promise readonly changeName: ( nextName: string, overrides?: FallbackableOverrides - ) => Promise + ) => Promise readonly changeSymbol: ( nextSymbol: string, overrides?: FallbackableOverrides - ) => Promise + ) => Promise } export type CreatePropertyContract = ( diff --git a/lib/ethereum/s-tokens/freezeTokenURI.spec.ts b/lib/ethereum/s-tokens/freezeTokenURI.spec.ts index 8a9820090..4b31b557b 100644 --- a/lib/ethereum/s-tokens/freezeTokenURI.spec.ts +++ b/lib/ethereum/s-tokens/freezeTokenURI.spec.ts @@ -1,17 +1,17 @@ import { createFreezeTokenURICaller } from './freezeTokenURI' -import { stubbedSendTx } from '../../common/utils/for-test' +import { stubTransactionResposeFactory } from '../../common/utils/for-test' describe('freezeTokenURI.spec.ts', () => { describe('createFreezeTokenURICaller', () => { it('call success', async () => { - const success = true + const success = stubTransactionResposeFactory({}) const tokenId = 1 const devContract = { freezeTokenURI: jest .fn() // eslint-disable-next-line @typescript-eslint/no-unused-vars - .mockImplementation(async (tokenId: string) => stubbedSendTx()), + .mockImplementation(async (tokenId: string) => success), } const expected = success diff --git a/lib/ethereum/s-tokens/freezeTokenURI.ts b/lib/ethereum/s-tokens/freezeTokenURI.ts index 041fea286..a2259ed27 100644 --- a/lib/ethereum/s-tokens/freezeTokenURI.ts +++ b/lib/ethereum/s-tokens/freezeTokenURI.ts @@ -4,11 +4,14 @@ import { FallbackableOverrides, MutationOption, } from '../../common/utils/execute' -import { T } from 'ramda' +import { TransactionResponse } from '@ethersproject/abstract-provider' export type CreateFreezeTokenURICaller = ( contract: ethers.Contract -) => (tokenId: number, overrides?: FallbackableOverrides) => Promise +) => ( + tokenId: number, + overrides?: FallbackableOverrides +) => Promise export const createFreezeTokenURICaller: CreateFreezeTokenURICaller = (contract: ethers.Contract) => @@ -19,4 +22,4 @@ export const createFreezeTokenURICaller: CreateFreezeTokenURICaller = mutation: true, args: [String(tokenId)], overrides, - }).then(T) + }) diff --git a/lib/ethereum/s-tokens/index.ts b/lib/ethereum/s-tokens/index.ts index 77337aa28..88d70cacb 100644 --- a/lib/ethereum/s-tokens/index.ts +++ b/lib/ethereum/s-tokens/index.ts @@ -11,12 +11,16 @@ import { createRewardsCaller, Rewards } from './rewards' import { createTokenURICaller, TokenURI } from './tokenURI' import { createPositionsOfPropertyCaller } from './positionsOfProperty' import { createPositionsOfOwnerCaller } from './positionsOfOwner' +import { TransactionResponse } from '@ethersproject/abstract-provider' export type STokensContract = { readonly positions: (tokenId: number) => Promise readonly isFreezed: (tokenId: number) => Promise - readonly freezeTokenURI: (tokenId: number) => Promise - readonly setTokenURIImage: (tokenId: number, data: string) => Promise + readonly freezeTokenURI: (tokenId: number) => Promise + readonly setTokenURIImage: ( + tokenId: number, + data: string + ) => Promise readonly ownerOf: (tokenId: number) => Promise readonly rewards: (tokenId: number) => Promise readonly tokenURI: (tokenId: number) => Promise diff --git a/lib/ethereum/s-tokens/setTokenURIImage.spec.ts b/lib/ethereum/s-tokens/setTokenURIImage.spec.ts index 82ed638f0..e54b92b95 100644 --- a/lib/ethereum/s-tokens/setTokenURIImage.spec.ts +++ b/lib/ethereum/s-tokens/setTokenURIImage.spec.ts @@ -1,10 +1,10 @@ import { createSetTokenURIImageCaller } from './setTokenURIImage' -import { stubbedSendTx } from '../../common/utils/for-test' +import { stubTransactionResposeFactory } from '../../common/utils/for-test' describe('setTokenURIImage.spec.ts', () => { describe('createSetTokenURIImageCaller', () => { it('call success', async () => { - const success = true + const success = stubTransactionResposeFactory({}) const tokenId = 1 const data = 'https://hogehoge' @@ -12,9 +12,7 @@ describe('setTokenURIImage.spec.ts', () => { setTokenURIImage: jest .fn() // eslint-disable-next-line @typescript-eslint/no-unused-vars - .mockImplementation(async (tokenId: string, data: string) => - stubbedSendTx() - ), + .mockImplementation(async (tokenId: string, data: string) => success), } const expected = success diff --git a/lib/ethereum/s-tokens/setTokenURIImage.ts b/lib/ethereum/s-tokens/setTokenURIImage.ts index 0a7097edd..e71242474 100644 --- a/lib/ethereum/s-tokens/setTokenURIImage.ts +++ b/lib/ethereum/s-tokens/setTokenURIImage.ts @@ -4,7 +4,7 @@ import { FallbackableOverrides, MutationOption, } from '../../common/utils/execute' -import { T } from 'ramda' +import { TransactionResponse } from '@ethersproject/abstract-provider' export type CreateSetTokenURIImageCaller = ( contract: ethers.Contract @@ -12,7 +12,7 @@ export type CreateSetTokenURIImageCaller = ( tokenId: number, data: string, overrides?: FallbackableOverrides -) => Promise +) => Promise export const createSetTokenURIImageCaller: CreateSetTokenURIImageCaller = (contract: ethers.Contract) => @@ -23,4 +23,4 @@ export const createSetTokenURIImageCaller: CreateSetTokenURIImageCaller = mutation: true, args: [String(tokenId), data], overrides, - }).then(T) + }) diff --git a/lib/ethereum/withdraw/index.ts b/lib/ethereum/withdraw/index.ts index 108106c10..f0fa5739d 100644 --- a/lib/ethereum/withdraw/index.ts +++ b/lib/ethereum/withdraw/index.ts @@ -14,7 +14,7 @@ export type WithdrawContract = { readonly withdraw: ( propertyAddress: string, overrides?: FallbackableOverrides - ) => Promise + ) => Promise readonly bulkWithdraw: ( propertyAddresses: readonly string[] ) => Promise diff --git a/lib/ethereum/withdraw/withdraw.spec.ts b/lib/ethereum/withdraw/withdraw.spec.ts index 9c33a86fe..95aa3f3d5 100644 --- a/lib/ethereum/withdraw/withdraw.spec.ts +++ b/lib/ethereum/withdraw/withdraw.spec.ts @@ -1,16 +1,16 @@ import { createWithdrawCaller } from './withdraw' -import { stubbedSendTx } from '../../common/utils/for-test' +import { stubTransactionResposeFactory } from '../../common/utils/for-test' describe('withdraw.spec.ts', () => { describe('createwithdrawCaller', () => { it('call success', async () => { - const value = true + const value = stubTransactionResposeFactory({}) const withdrawContract = { withdraw: jest .fn() // eslint-disable-next-line @typescript-eslint/no-unused-vars - .mockImplementation(async (property: string) => stubbedSendTx()), + .mockImplementation(async (property: string) => value), } const expected = value diff --git a/lib/ethereum/withdraw/withdraw.ts b/lib/ethereum/withdraw/withdraw.ts index e793ac20d..ee7a4bd05 100644 --- a/lib/ethereum/withdraw/withdraw.ts +++ b/lib/ethereum/withdraw/withdraw.ts @@ -4,14 +4,14 @@ import { FallbackableOverrides, MutationOption, } from '../../common/utils/execute' -import { T } from 'ramda' +import { TransactionResponse } from '@ethersproject/abstract-provider' export type CreateWithdrawCaller = ( contract: ethers.Contract ) => ( propertyAddress: string, overrides?: FallbackableOverrides -) => Promise +) => Promise export const createWithdrawCaller: CreateWithdrawCaller = (contract: ethers.Contract) => @@ -22,4 +22,4 @@ export const createWithdrawCaller: CreateWithdrawCaller = mutation: true, args: [propertyAddress], overrides, - }).then(T) + }) diff --git a/lib/l2/lockup/index.ts b/lib/l2/lockup/index.ts index d69f4d764..3de78a760 100644 --- a/lib/l2/lockup/index.ts +++ b/lib/l2/lockup/index.ts @@ -22,7 +22,7 @@ export type LockupContract = { readonly withdrawByPosition: ( positionTokenId: string, amount: string - ) => Promise + ) => Promise readonly calculateWithdrawableInterestAmountByPosition: ( positionTokenId: string ) => Promise @@ -43,7 +43,7 @@ export type LockupContract = { readonly depositToPosition: ( positionTokenId: string, amount: string - ) => Promise + ) => Promise readonly totalLocked: () => Promise readonly totalLockedForProperty: (address: string) => Promise readonly getLockedupProperties: () => Promise diff --git a/lib/l2/market-factory/index.ts b/lib/l2/market-factory/index.ts index 9773bcdfd..570759d51 100644 --- a/lib/l2/market-factory/index.ts +++ b/lib/l2/market-factory/index.ts @@ -4,9 +4,12 @@ import { Signer } from '@ethersproject/abstract-signer' import { marketFactoryAbi } from './abi' import { createCreateCaller } from '../../ethereum/market-factory/create' import { createGetEnabledMarketsCaller } from './getEnabledMarkets' +import { TransactionResponse } from '@ethersproject/abstract-provider' export type MarketFactoryContract = { - readonly create: (marketBehaviorAddress: string) => Promise + readonly create: ( + marketBehaviorAddress: string + ) => Promise readonly getEnabledMarkets: () => Promise } diff --git a/lib/l2/property/index.ts b/lib/l2/property/index.ts index 64695549d..29453ad8b 100644 --- a/lib/l2/property/index.ts +++ b/lib/l2/property/index.ts @@ -15,6 +15,7 @@ import { createBalanceOfCaller } from './../../common/erc20/balanceOf' import { createApproveCaller } from './../../common/erc20/approve' import { createAllowanceCaller } from './../../common/erc20/allowance' import { FallbackableOverrides } from '../../common/utils/execute' +import { TransactionResponse } from '@ethersproject/abstract-provider' export type PropertyContract = { readonly totalSupply: () => Promise @@ -23,19 +24,19 @@ export type PropertyContract = { to: string, value: string, overrides?: FallbackableOverrides - ) => Promise + ) => Promise readonly allowance: (from: string, to: string) => Promise readonly approve: ( to: string, value: string, overrides?: FallbackableOverrides - ) => Promise + ) => Promise readonly transferFrom: ( from: string, to: string, value: string, overrides?: FallbackableOverrides - ) => Promise + ) => Promise readonly name: () => Promise readonly symbol: () => Promise readonly decimals: () => Promise @@ -43,11 +44,11 @@ export type PropertyContract = { readonly changeName: ( nextName: string, overrides?: FallbackableOverrides - ) => Promise + ) => Promise readonly changeSymbol: ( nextSymbol: string, overrides?: FallbackableOverrides - ) => Promise + ) => Promise } export type CreatePropertyContract = (