Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: dev-protocol/dev-kit-js
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v5.10.2
Choose a base ref
...
head repository: dev-protocol/dev-kit-js
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v5.11.0
Choose a head ref
  • 13 commits
  • 38 files changed
  • 2 contributors

Commits on Jan 20, 2022

  1. Verified

    This commit was signed with the committer’s verified signature.
    Muhammad-Altabba Muhammad Altabba
    Copy the full SHA
    85e5af3 View commit details
  2. Verified

    This commit was signed with the committer’s verified signature.
    Muhammad-Altabba Muhammad Altabba
    Copy the full SHA
    b01be8b View commit details
  3. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    40e0765 View commit details

Commits on Jan 21, 2022

  1. Copy the full SHA
    4dbd88e View commit details

Commits on Jan 22, 2022

  1. Copy the full SHA
    40245d0 View commit details

Commits on Jan 23, 2022

  1. Copy the full SHA
    e6ac0f3 View commit details

Commits on Jan 24, 2022

  1. Copy the full SHA
    60378f6 View commit details
  2. Copy the full SHA
    967b8d5 View commit details

Commits on Jan 25, 2022

  1. add new function

    Akira-Taniguchi committed Jan 25, 2022
    Copy the full SHA
    b0b5cf2 View commit details
  2. set new property

    Akira-Taniguchi committed Jan 25, 2022
    Copy the full SHA
    5714bff View commit details
  3. Copy the full SHA
    512cbf1 View commit details

Commits on Jan 26, 2022

  1. Copy the full SHA
    1c14ac3 View commit details
  2. 5.11.0

    Akira-Taniguchi committed Jan 26, 2022
    Copy the full SHA
    cbee0e3 View commit details
Showing with 903 additions and 146 deletions.
  1. 0 lib/{ethereum → common}/erc20/abi.ts
  2. 0 lib/{ethereum → common}/erc20/allowance.spec.ts
  3. +1 −1 lib/{ethereum → common}/erc20/allowance.ts
  4. +1 −1 lib/{ethereum → common}/erc20/approve.spec.ts
  5. +1 −1 lib/{ethereum → common}/erc20/approve.ts
  6. 0 lib/{ethereum → common}/erc20/balanceOf.spec.ts
  7. +1 −1 lib/{ethereum → common}/erc20/balanceOf.ts
  8. 0 lib/{ethereum → common}/erc20/decimals.spec.ts
  9. +1 −1 lib/{ethereum → common}/erc20/decimals.ts
  10. 0 lib/{ethereum → common}/erc20/index.spec.ts
  11. +1 −1 lib/{ethereum → common}/erc20/index.ts
  12. 0 lib/{ethereum → common}/erc20/name.spec.ts
  13. +1 −1 lib/{ethereum → common}/erc20/name.ts
  14. 0 lib/{ethereum → common}/erc20/symbol.spec.ts
  15. +1 −1 lib/{ethereum → common}/erc20/symbol.ts
  16. 0 lib/{ethereum → common}/erc20/totalSupply.spec.ts
  17. +1 −1 lib/{ethereum → common}/erc20/totalSupply.ts
  18. 0 lib/{ethereum → common}/erc20/transfer.spec.ts
  19. +1 −1 lib/{ethereum → common}/erc20/transfer.ts
  20. 0 lib/{ethereum → common}/erc20/transferFrom.spec.ts
  21. +1 −1 lib/{ethereum → common}/erc20/transferFrom.ts
  22. +17 −17 lib/ethereum/dev/index.spec.ts
  23. +9 −9 lib/ethereum/dev/index.ts
  24. +18 −18 lib/ethereum/property/index.spec.ts
  25. +9 −9 lib/ethereum/property/index.ts
  26. +1 −1 lib/l2/dev/index.ts
  27. +1 −1 lib/l2/erc20/index.ts
  28. +32 −0 lib/l2/property-factory/abi.ts
  29. +1 −4 lib/l2/property-factory/createAndAuthenticate.ts
  30. +39 −0 lib/l2/property-factory/getPropertiesOfAuthor.spec.ts
  31. +18 −0 lib/l2/property-factory/getPropertiesOfAuthor.ts
  32. +6 −0 lib/l2/property-factory/index.spec.ts
  33. +5 −0 lib/l2/property-factory/index.ts
  34. +431 −0 lib/l2/property/abi.ts
  35. +98 −0 lib/l2/property/index.spec.ts
  36. +76 −4 lib/l2/property/index.ts
  37. +8 −8 package.json
  38. +123 −64 yarn.lock
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ethers } from 'ethers'
import { execute, QueryOption } from '../../common/utils/execute'
import { execute, QueryOption } from '../utils/execute'

export type CreateAllowanceCaller = (
contract: ethers.Contract
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createApproveCaller } from './approve'
import { stubbedSendTx } from '../../common/utils/for-test'
import { stubbedSendTx } from '../utils/for-test'

describe('approve.spec.ts', () => {
describe('createApproveCaller', () => {
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ import {
execute,
FallbackableOverrides,
MutationOption,
} from '../../common/utils/execute'
} from '../utils/execute'
import { T } from 'ramda'

export type CreateApproveCaller = (
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ethers } from 'ethers'
import { execute, QueryOption } from '../../common/utils/execute'
import { execute, QueryOption } from '../utils/execute'

export type CreateBalanceOfCaller = (
contract: ethers.Contract
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ethers } from 'ethers'
import { execute, QueryOption } from '../../common/utils/execute'
import { execute, QueryOption } from '../utils/execute'
import { always } from 'ramda'

export type CreateDecimalsCaller = (
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/ethereum/erc20/index.ts → lib/common/erc20/index.ts
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ import { createNameCaller } from './name'
import { createSymbolCaller } from './symbol'
import { createDecimalsCaller } from './decimals'
import { createAllowanceCaller } from './allowance'
import { FallbackableOverrides } from '../../common/utils/execute'
import { FallbackableOverrides } from '../utils/execute'

export type Erc20Contract = {
readonly totalSupply: () => Promise<string>
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/ethereum/erc20/name.ts → lib/common/erc20/name.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ethers } from 'ethers'
import { execute, QueryOption } from '../../common/utils/execute'
import { execute, QueryOption } from '../utils/execute'
import { always } from 'ramda'

export type CreateNameCaller = (
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ethers } from 'ethers'
import { execute, QueryOption } from '../../common/utils/execute'
import { execute, QueryOption } from '../utils/execute'
import { always } from 'ramda'

export type CreateSymbolCaller = (
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ethers } from 'ethers'
import { execute, QueryOption } from '../../common/utils/execute'
import { execute, QueryOption } from '../utils/execute'
import { always } from 'ramda'

export type CreateTotalSupplyCaller = (
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ import {
execute,
FallbackableOverrides,
MutationOption,
} from '../../common/utils/execute'
} from '../utils/execute'
import { T } from 'ramda'

export type CreateTransferCaller = (
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ import {
execute,
FallbackableOverrides,
MutationOption,
} from '../../common/utils/execute'
} from '../utils/execute'
import { T } from 'ramda'

export type CreateTransferFromCaller = (
34 changes: 17 additions & 17 deletions lib/ethereum/dev/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
import { ethers } from 'ethers'
import { createDevContract, DevContract } from '.'
import { createTransferCaller } from './../erc20/transfer'
import { createTransferCaller } from './../../common/erc20/transfer'
import { devAbi } from './abi'
import { createDepositCaller } from './deposit'
import { createBalanceOfCaller } from './../erc20/balanceOf'
import { createTotalSupplyCaller } from './../erc20/totalSupply'
import { createApproveCaller } from './../erc20/approve'
import { createTransferFromCaller } from '../erc20/transferFrom'
import { createNameCaller } from './../erc20/name'
import { createSymbolCaller } from './../erc20/symbol'
import { createDecimalsCaller } from './../erc20/decimals'
import { createAllowanceCaller } from './../erc20/allowance'
import { createBalanceOfCaller } from './../../common/erc20/balanceOf'
import { createTotalSupplyCaller } from './../../common/erc20/totalSupply'
import { createApproveCaller } from './../../common/erc20/approve'
import { createTransferFromCaller } from '../../common/erc20/transferFrom'
import { createNameCaller } from './../../common/erc20/name'
import { createSymbolCaller } from './../../common/erc20/symbol'
import { createDecimalsCaller } from './../../common/erc20/decimals'
import { createAllowanceCaller } from './../../common/erc20/allowance'

jest.mock('./deposit')
jest.mock('./../erc20/balanceOf')
jest.mock('./../erc20/totalSupply')
jest.mock('./../erc20/approve')
jest.mock('../erc20/transferFrom')
jest.mock('./../erc20/name')
jest.mock('./../erc20/symbol')
jest.mock('./../erc20/decimals')
jest.mock('./../erc20/allowance')
jest.mock('./../../common/erc20/balanceOf')
jest.mock('./../../common/erc20/totalSupply')
jest.mock('./../../common/erc20/approve')
jest.mock('../../common/erc20/transferFrom')
jest.mock('./../../common/erc20/name')
jest.mock('./../../common/erc20/symbol')
jest.mock('./../../common/erc20/decimals')
jest.mock('./../../common/erc20/allowance')

describe('dev/index.ts', () => {
;(createDepositCaller as jest.Mock).mockImplementation((contract) => contract)
18 changes: 9 additions & 9 deletions lib/ethereum/dev/index.ts
Original file line number Diff line number Diff line change
@@ -2,15 +2,15 @@ import { ethers } from 'ethers'
import { Provider } from '@ethersproject/abstract-provider'
import { Signer } from '@ethersproject/abstract-signer'
import { devAbi } from './abi'
import { createTransferCaller } from './../erc20/transfer'
import { createBalanceOfCaller } from './../erc20/balanceOf'
import { createTotalSupplyCaller } from './../erc20/totalSupply'
import { createApproveCaller } from './../erc20/approve'
import { createTransferFromCaller } from '../erc20/transferFrom'
import { createNameCaller } from './../erc20/name'
import { createSymbolCaller } from './../erc20/symbol'
import { createDecimalsCaller } from './../erc20/decimals'
import { createAllowanceCaller } from './../erc20/allowance'
import { createTransferCaller } from '../../common/erc20/transfer'
import { createBalanceOfCaller } from '../../common/erc20/balanceOf'
import { createTotalSupplyCaller } from '../../common/erc20/totalSupply'
import { createApproveCaller } from '../../common/erc20/approve'
import { createTransferFromCaller } from '../../common/erc20/transferFrom'
import { createNameCaller } from '../../common/erc20/name'
import { createSymbolCaller } from '../../common/erc20/symbol'
import { createDecimalsCaller } from '../../common/erc20/decimals'
import { createAllowanceCaller } from '../../common/erc20/allowance'
import { createDepositCaller } from './deposit'
import { FallbackableOverrides } from '../../common/utils/execute'

36 changes: 18 additions & 18 deletions lib/ethereum/property/index.spec.ts
Original file line number Diff line number Diff line change
@@ -5,29 +5,29 @@ import { createAuthorCaller } from './author'
import { createChangeNameCaller } from './changeName'
import { createChangeSymbolCaller } from './changeSymbol'
import { createChangeAuthorCaller } from './changeAuthor'
import { createTransferCaller } from './../erc20/transfer'
import { createNameCaller } from './../erc20/name'
import { createSymbolCaller } from './../erc20/symbol'
import { createTotalSupplyCaller } from './../erc20/totalSupply'
import { createDecimalsCaller } from './../erc20/decimals'
import { createTransferFromCaller } from '../erc20/transferFrom'
import { createBalanceOfCaller } from './../erc20/balanceOf'
import { createApproveCaller } from './../erc20/approve'
import { createAllowanceCaller } from './../erc20/allowance'
import { createTransferCaller } from './../../common/erc20/transfer'
import { createNameCaller } from './../../common/erc20/name'
import { createSymbolCaller } from './../../common/erc20/symbol'
import { createTotalSupplyCaller } from './../../common/erc20/totalSupply'
import { createDecimalsCaller } from './../../common/erc20/decimals'
import { createTransferFromCaller } from '../../common/erc20/transferFrom'
import { createBalanceOfCaller } from './../../common/erc20/balanceOf'
import { createApproveCaller } from './../../common/erc20/approve'
import { createAllowanceCaller } from './../../common/erc20/allowance'

jest.mock('./author')
jest.mock('./changeName')
jest.mock('./changeSymbol')
jest.mock('./changeAuthor')
jest.mock('./../erc20/transfer')
jest.mock('./../erc20/name')
jest.mock('./../erc20/symbol')
jest.mock('./../erc20/totalSupply')
jest.mock('./../erc20/decimals')
jest.mock('../erc20/transferFrom')
jest.mock('./../erc20/balanceOf')
jest.mock('./../erc20/approve')
jest.mock('./../erc20/allowance')
jest.mock('./../../common/erc20/transfer')
jest.mock('./../../common/erc20/name')
jest.mock('./../../common/erc20/symbol')
jest.mock('./../../common/erc20/totalSupply')
jest.mock('./../../common/erc20/decimals')
jest.mock('./../../common/erc20/transferFrom')
jest.mock('./../../common/erc20/balanceOf')
jest.mock('./../../common/erc20/approve')
jest.mock('./../../common/erc20/allowance')

describe('property/index.ts', () => {
;(createAuthorCaller as jest.Mock).mockImplementation((contract) => contract)
18 changes: 9 additions & 9 deletions lib/ethereum/property/index.ts
Original file line number Diff line number Diff line change
@@ -6,15 +6,15 @@ import { createAuthorCaller } from './author'
import { createChangeAuthorCaller } from './changeAuthor'
import { createChangeNameCaller } from './changeName'
import { createChangeSymbolCaller } from './changeSymbol'
import { createTransferCaller } from './../erc20/transfer'
import { createNameCaller } from './../erc20/name'
import { createSymbolCaller } from './../erc20/symbol'
import { createTotalSupplyCaller } from './../erc20/totalSupply'
import { createDecimalsCaller } from './../erc20/decimals'
import { createTransferFromCaller } from '../erc20/transferFrom'
import { createBalanceOfCaller } from './../erc20/balanceOf'
import { createApproveCaller } from './../erc20/approve'
import { createAllowanceCaller } from './../erc20/allowance'
import { createTransferCaller } from '../../common/erc20/transfer'
import { createNameCaller } from '../../common/erc20/name'
import { createSymbolCaller } from '../../common/erc20/symbol'
import { createTotalSupplyCaller } from '../../common/erc20/totalSupply'
import { createDecimalsCaller } from '../../common/erc20/decimals'
import { createTransferFromCaller } from '../../common/erc20/transferFrom'
import { createBalanceOfCaller } from '../../common/erc20/balanceOf'
import { createApproveCaller } from '../../common/erc20/approve'
import { createAllowanceCaller } from '../../common/erc20/allowance'
import { FallbackableOverrides } from '../../common/utils/execute'

export type PropertyContract = {
2 changes: 1 addition & 1 deletion lib/l2/dev/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createErc20Contract, Erc20Contract } from '../../ethereum/erc20'
import { createErc20Contract, Erc20Contract } from '../../common/erc20'

export const createDevContract = createErc20Contract
export type DevContract = Erc20Contract
2 changes: 1 addition & 1 deletion lib/l2/erc20/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { createErc20Contract, Erc20Contract } from '../../ethereum/erc20'
export { createErc20Contract, Erc20Contract } from '../../common/erc20'
32 changes: 32 additions & 0 deletions lib/l2/property-factory/abi.ts
Original file line number Diff line number Diff line change
@@ -126,4 +126,36 @@ export const propertyFactoryAbi = [
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [
{
internalType: 'address',
name: '_author',
type: 'address',
},
],
name: 'getPropertiesOfAuthor',
outputs: [
{
internalType: 'address[]',
name: '',
type: 'address[]',
},
],
stateMutability: 'view',
type: 'function',
},
{
inputs: [
{
internalType: 'address',
name: '_property',
type: 'address',
},
],
name: 'setPropertyAddress',
outputs: [],
stateMutability: 'nonpayable',
type: 'function',
},
]
5 changes: 1 addition & 4 deletions lib/l2/property-factory/createAndAuthenticate.ts
Original file line number Diff line number Diff line change
@@ -6,10 +6,7 @@ import { Provider } from '@ethersproject/abstract-provider'
import { TransactionResponse } from '@ethersproject/abstract-provider'
import { execute, FallbackableOverrides } from '../../common/utils/execute'
import { ethers } from 'ethers'
import {
getMetricsProperty,
WaitForEventOptions,
} from '../../ethereum/market/authenticate'
import { WaitForEventOptions } from '../../ethereum/market/authenticate'
import { metricsFactoryAbi } from '../metrics-factory/abi'

export type CreateCreateAndAuthenticateCaller = (
39 changes: 39 additions & 0 deletions lib/l2/property-factory/getPropertiesOfAuthor.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { createGetPropertiesOfAuthorCaller } from './getPropertiesOfAuthor'

describe('getPropertiesOfAuthor.spec.ts', () => {
describe('createGetPropertiesOfAuthorrCaller', () => {
it('call success', async () => {
const value = ['0x1', '0x2', '0x3', '0x4', '0x5', '0x6']

const contract = {
getPropertiesOfAuthor: jest
.fn()
.mockImplementation(async () => Promise.resolve(value)),
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const caller = createGetPropertiesOfAuthorCaller(contract as any)

const result = await caller('0xAddress')

expect(result).toEqual(value)
})

it('call failure', async () => {
const error = 'error'

const contract = {
getPropertiesOfAuthor: jest
.fn()
.mockImplementation(async () => Promise.reject(error)),
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const caller = createGetPropertiesOfAuthorCaller(contract as any)

const result = await caller('0xAddress').catch((err) => err)

expect(result).toEqual(error)
})
})
})
18 changes: 18 additions & 0 deletions lib/l2/property-factory/getPropertiesOfAuthor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
import { ethers } from 'ethers'
import { execute, QueryOption } from '../../common/utils/execute'

export type CreateGetPropertiesOfAuthorCaller = (
contract: ethers.Contract
) => (authorAddress: string) => Promise<readonly string[]>

export const createGetPropertiesOfAuthorCaller: CreateGetPropertiesOfAuthorCaller =
(contract: ethers.Contract) => async (authorAddress: string) => {
const res = await execute<QueryOption, readonly string[]>({
contract,
method: 'getPropertiesOfAuthor',
args: [authorAddress],
mutation: false,
})
return res
}
6 changes: 6 additions & 0 deletions lib/l2/property-factory/index.spec.ts
Original file line number Diff line number Diff line change
@@ -3,9 +3,11 @@ import { createPropertyFactoryContract, PropertyFactoryContract } from '.'
import { propertyFactoryAbi } from './abi'
import { createCreatePropertyCaller } from '../../ethereum/property-factory/create'
import { createCreateAndAuthenticateCaller } from './createAndAuthenticate'
import { createGetPropertiesOfAuthorCaller } from './getPropertiesOfAuthor'

jest.mock('../../ethereum/property-factory/create')
jest.mock('./createAndAuthenticate')
jest.mock('./getPropertiesOfAuthor')

describe('property-factory/index.ts', () => {
;(createCreatePropertyCaller as jest.Mock).mockImplementation(
@@ -14,6 +16,9 @@ describe('property-factory/index.ts', () => {
;(createCreateAndAuthenticateCaller as jest.Mock).mockImplementation(
(contract) => contract
)
;(createGetPropertiesOfAuthorCaller as jest.Mock).mockImplementation(
(contract) => contract
)
describe('createPropertyFactoryContract', () => {
it('check return object', () => {
const host = 'localhost'
@@ -34,6 +39,7 @@ describe('property-factory/index.ts', () => {
contract,
provider
),
getPropertiesOfAuthor: createGetPropertiesOfAuthorCaller(contract)
}
}

5 changes: 5 additions & 0 deletions lib/l2/property-factory/index.ts
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ import { propertyFactoryAbi } from './abi'
import { createCreatePropertyCaller } from '../../ethereum/property-factory/create'
import { WaitForEventOptions } from '../../ethereum/market/authenticate'
import { createCreateAndAuthenticateCaller } from './createAndAuthenticate'
import { createGetPropertiesOfAuthorCaller } from './getPropertiesOfAuthor'
import { FallbackableOverrides } from '../../common/utils/execute'

export type PropertyFactoryContract = {
@@ -26,6 +27,9 @@ export type PropertyFactoryContract = {
readonly transaction: TransactionResponse
readonly waitForAuthentication: () => Promise<string>
}>
readonly getPropertiesOfAuthor: (
author: string
) => Promise<readonly string[]>
}

export const createPropertyFactoryContract =
@@ -43,5 +47,6 @@ export const createPropertyFactoryContract =
contract,
provider as Provider
),
getPropertiesOfAuthor: createGetPropertiesOfAuthorCaller(contract)
}
}
Loading