Skip to content

Commit 3ba050b

Browse files
committed
change the return values rounded to boolean type
1 parent 48d3db5 commit 3ba050b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+167
-145
lines changed

lib/common/erc20/approve.spec.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
import { createApproveCaller } from './approve'
2-
import { stubbedSendTx } from '../utils/for-test'
2+
import { stubTransactionResposeFactory } from '../utils/for-test'
33

44
describe('approve.spec.ts', () => {
55
describe('createApproveCaller', () => {
66
it('call success', async () => {
7-
const success = true
7+
const success = stubTransactionResposeFactory({})
88
const to = '0x0472ec0185ebb8202f3d4ddb0226998889663cf2'
99
const value = '12345'
1010

1111
const contract = {
1212
approve: jest
1313
.fn()
1414
// eslint-disable-next-line @typescript-eslint/no-unused-vars
15-
.mockImplementation(async (to: string, value: number) =>
16-
stubbedSendTx()
17-
),
15+
.mockImplementation(async (to: string, value: number) => success),
1816
}
1917

2018
const expected = success

lib/common/erc20/approve.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ import {
44
FallbackableOverrides,
55
MutationOption,
66
} from '../utils/execute'
7-
import { T } from 'ramda'
7+
import { TransactionResponse } from '@ethersproject/abstract-provider'
88

99
export type CreateApproveCaller = (
1010
contract: ethers.Contract
1111
) => (
1212
to: string,
1313
value: string,
1414
overrides?: FallbackableOverrides
15-
) => Promise<boolean>
15+
) => Promise<TransactionResponse>
1616

1717
export const createApproveCaller: CreateApproveCaller =
1818
(contract: ethers.Contract) =>
@@ -23,4 +23,4 @@ export const createApproveCaller: CreateApproveCaller =
2323
mutation: true,
2424
args: [to, value],
2525
overrides,
26-
}).then(T)
26+
})

lib/common/erc20/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { createSymbolCaller } from './symbol'
1212
import { createDecimalsCaller } from './decimals'
1313
import { createAllowanceCaller } from './allowance'
1414
import { FallbackableOverrides } from '../utils/execute'
15+
import { TransactionResponse } from '@ethersproject/abstract-provider'
1516

1617
export type Erc20Contract = {
1718
readonly totalSupply: () => Promise<string>
@@ -20,19 +21,19 @@ export type Erc20Contract = {
2021
to: string,
2122
value: string,
2223
overrides?: FallbackableOverrides
23-
) => Promise<boolean>
24+
) => Promise<TransactionResponse>
2425
readonly allowance: (from: string, to: string) => Promise<string>
2526
readonly approve: (
2627
to: string,
2728
value: string,
2829
overrides?: FallbackableOverrides
29-
) => Promise<boolean>
30+
) => Promise<TransactionResponse>
3031
readonly transferFrom: (
3132
from: string,
3233
to: string,
3334
value: string,
3435
overrides?: FallbackableOverrides
35-
) => Promise<boolean>
36+
) => Promise<TransactionResponse>
3637
readonly name: () => Promise<string>
3738
readonly symbol: () => Promise<string>
3839
readonly decimals: () => Promise<string>

lib/common/erc20/transfer.spec.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
import { createTransferCaller } from './transfer'
2-
import { stubbedSendTx } from '../../common/utils/for-test'
2+
import { stubTransactionResposeFactory } from '../../common/utils/for-test'
33

44
describe('transfer.spec.ts', () => {
55
describe('createTransferCaller', () => {
66
it('call success', async () => {
7-
const success = true
7+
const success = stubTransactionResposeFactory({})
88
const to = '0x0472ec0185ebb8202f3d4ddb0226998889663cf2'
99
const value = '12345'
1010

1111
const contract = {
1212
transfer: jest
1313
.fn()
1414
// eslint-disable-next-line @typescript-eslint/no-unused-vars
15-
.mockImplementation(async (to: string, value: number) =>
16-
stubbedSendTx()
17-
),
15+
.mockImplementation(async (to: string, value: number) => success),
1816
}
1917

2018
const expected = success

lib/common/erc20/transfer.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ import {
44
FallbackableOverrides,
55
MutationOption,
66
} from '../utils/execute'
7-
import { T } from 'ramda'
7+
import { TransactionResponse } from '@ethersproject/abstract-provider'
88

99
export type CreateTransferCaller = (
1010
contract: ethers.Contract
1111
) => (
1212
to: string,
1313
value: string,
1414
overrides?: FallbackableOverrides
15-
) => Promise<boolean>
15+
) => Promise<TransactionResponse>
1616

1717
export const createTransferCaller: CreateTransferCaller =
1818
(contract: ethers.Contract) =>
@@ -23,4 +23,4 @@ export const createTransferCaller: CreateTransferCaller =
2323
args: [to, value],
2424
mutation: true,
2525
overrides,
26-
}).then(T)
26+
})

lib/common/erc20/transferFrom.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { createTransferFromCaller } from './transferFrom'
2-
import { stubbedSendTx } from '../../common/utils/for-test'
2+
import { stubTransactionResposeFactory } from '../../common/utils/for-test'
33

44
describe('transferFrom.spec.ts', () => {
55
describe('createTransferFromCaller', () => {
66
it('call success', async () => {
7-
const success = true
7+
const success = stubTransactionResposeFactory({})
88
const from = '0x1E9342827907CD370CB8Ba2F768d7D50b2f457F9'
99
const to = '0x0472ec0185ebb8202f3d4ddb0226998889663cf2'
1010
const value = '12345'
@@ -13,8 +13,8 @@ describe('transferFrom.spec.ts', () => {
1313
transferFrom: jest
1414
.fn()
1515
// eslint-disable-next-line @typescript-eslint/no-unused-vars
16-
.mockImplementation(async (from: string, to: string, value: number) =>
17-
stubbedSendTx()
16+
.mockImplementation(
17+
async (from: string, to: string, value: number) => success
1818
),
1919
}
2020

lib/common/erc20/transferFrom.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
FallbackableOverrides,
55
MutationOption,
66
} from '../utils/execute'
7-
import { T } from 'ramda'
7+
import { TransactionResponse } from '@ethersproject/abstract-provider'
88

99
export type CreateTransferFromCaller = (
1010
contract: ethers.Contract
@@ -13,7 +13,7 @@ export type CreateTransferFromCaller = (
1313
to: string,
1414
value: string,
1515
overrides?: FallbackableOverrides
16-
) => Promise<boolean>
16+
) => Promise<TransactionResponse>
1717

1818
export const createTransferFromCaller: CreateTransferFromCaller =
1919
(contract: ethers.Contract) =>
@@ -29,4 +29,4 @@ export const createTransferFromCaller: CreateTransferFromCaller =
2929
mutation: true,
3030
args: [from, to, value],
3131
overrides,
32-
}).then(T)
32+
})

lib/ethereum/dev/deposit.spec.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
import { createDepositCaller } from './deposit'
2-
import { stubbedSendTx } from '../../common/utils/for-test'
2+
import { stubTransactionResposeFactory } from '../../common/utils/for-test'
33

44
describe('deposit.spec.ts', () => {
55
describe('createDepositCaller', () => {
66
it('call success', async () => {
7-
const success = true
7+
const success = stubTransactionResposeFactory({})
88
const to = '0x0472ec0185ebb8202f3d4ddb0226998889663cf2'
99
const value = '12345'
1010

1111
const devContract = {
1212
deposit: jest
1313
.fn()
1414
// eslint-disable-next-line @typescript-eslint/no-unused-vars
15-
.mockImplementation(async (to: string, value: number) =>
16-
stubbedSendTx()
17-
),
15+
.mockImplementation(async (to: string, value: number) => success),
1816
}
1917

2018
const expected = success

lib/ethereum/dev/deposit.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ import {
44
MutationOption,
55
FallbackableOverrides,
66
} from '../../common/utils/execute'
7-
import { T } from 'ramda'
7+
import { TransactionResponse } from '@ethersproject/abstract-provider'
88

99
export type CreateDepositCaller = (
1010
contract: ethers.Contract
1111
) => (
1212
to: string,
1313
value: string,
1414
overrides?: FallbackableOverrides
15-
) => Promise<boolean>
15+
) => Promise<TransactionResponse>
1616

1717
export const createDepositCaller: CreateDepositCaller =
1818
(contract: ethers.Contract) =>
@@ -23,4 +23,4 @@ export const createDepositCaller: CreateDepositCaller =
2323
args: [to, value],
2424
mutation: true,
2525
overrides,
26-
}).then(T)
26+
})

lib/ethereum/dev/index.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,27 @@ import { createDecimalsCaller } from '../../common/erc20/decimals'
1313
import { createAllowanceCaller } from '../../common/erc20/allowance'
1414
import { createDepositCaller } from './deposit'
1515
import { FallbackableOverrides } from '../../common/utils/execute'
16+
import { TransactionResponse } from '@ethersproject/abstract-provider'
1617

1718
export type DevContract = {
1819
readonly totalSupply: () => Promise<string>
1920
readonly balanceOf: (address: string) => Promise<string>
20-
readonly transfer: (to: string, value: string) => Promise<boolean>
21+
readonly transfer: (to: string, value: string) => Promise<TransactionResponse>
2122
readonly allowance: (from: string, to: string) => Promise<string>
22-
readonly approve: (to: string, value: string) => Promise<boolean>
23+
readonly approve: (to: string, value: string) => Promise<TransactionResponse>
2324
readonly transferFrom: (
2425
from: string,
2526
to: string,
2627
value: string
27-
) => Promise<boolean>
28+
) => Promise<TransactionResponse>
2829
readonly name: () => Promise<string>
2930
readonly symbol: () => Promise<string>
3031
readonly decimals: () => Promise<string>
3132
readonly deposit: (
3233
to: string,
3334
value: string,
3435
overrides?: FallbackableOverrides
35-
) => Promise<boolean>
36+
) => Promise<TransactionResponse>
3637
}
3738

3839
export const createDevContract =

0 commit comments

Comments
 (0)