Skip to content

Commit c2db4c7

Browse files
committed
add APIs for STokensManager.descriptorOf/STokensManager.descriptorOfPropertyByPayload
1 parent 90533f6 commit c2db4c7

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

lib/ethereum/s-tokens/index.spec.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ import { createSetSTokenRoyaltyForPropertyCaller } from './setSTokenRoyaltyForPr
1515
import { createRoyaltyOfCaller } from './royaltyOf'
1616
import { createSetTokenURIDescriptorCaller } from './setTokenURIDescriptor'
1717
import { createPayloadOfCaller } from './payloadOf'
18+
import { createDescriptorOfCaller } from './descriptorOf'
19+
import { createDescriptorOfPropertyByPayloadCaller } from './descriptorOfPropertyByPayload'
1820

1921
jest.mock('./positions')
2022
jest.mock('./isFreezed')
@@ -29,6 +31,8 @@ jest.mock('./positionsOfOwner')
2931
jest.mock('./setSTokenRoyaltyForProperty')
3032
jest.mock('./royaltyOf')
3133
jest.mock('./setTokenURIDescriptor')
34+
jest.mock('./descriptorOf')
35+
jest.mock('./descriptorOfPropertyByPayload')
3236
jest.mock('ethers')
3337

3438
describe('s-tokens/index.ts', () => {
@@ -49,7 +53,12 @@ describe('s-tokens/index.ts', () => {
4953
() => 123,
5054
)
5155
;(createTokenURISimCaller as jest.Mock).mockImplementation(() => 123)
56+
;(createDescriptorOfCaller as jest.Mock).mockImplementation(() => 123)
57+
;(createDescriptorOfPropertyByPayloadCaller as jest.Mock).mockImplementation(
58+
() => 123,
59+
)
5260
;(ethers.Contract as jest.Mock).mockImplementation(() => 123)
61+
5362
describe('createSTokensContract', () => {
5463
it('check return object', () => {
5564
const host = 'localhost'
@@ -76,6 +85,9 @@ describe('s-tokens/index.ts', () => {
7685
positionsOfProperty: createPositionsOfPropertyCaller(contract),
7786
positionsOfOwner: createPositionsOfOwnerCaller(contract),
7887
payloadOf: createPayloadOfCaller(contract),
88+
descriptorOf: createDescriptorOfCaller(contract),
89+
descriptorOfPropertyByPayload:
90+
createDescriptorOfPropertyByPayloadCaller(contract),
7991
contract: () => contract,
8092
}
8193
}

lib/ethereum/s-tokens/index.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import { createSetTokenURIDescriptorCaller } from './setTokenURIDescriptor'
1616
import type { TransactionResponse } from 'ethers'
1717
import { createTokenURISimCaller, TokenURISimProps } from './tokenURISim'
1818
import { FallbackableOverrides } from '../../common/utils/execute'
19+
import { createDescriptorOfCaller } from './descriptorOf'
20+
import { createDescriptorOfPropertyByPayloadCaller } from './descriptorOfPropertyByPayload'
1921

2022
export type STokensContract = {
2123
readonly positions: (tokenId: number) => Promise<Positions>
@@ -53,6 +55,11 @@ export type STokensContract = {
5355
) => Promise<readonly number[]>
5456
readonly contract: () => ethers.Contract
5557
readonly payloadOf: (tokenId: number) => Promise<string>
58+
readonly descriptorOf: (propertyAddress: string) => Promise<string>
59+
readonly descriptorOfPropertyByPayload: (
60+
propertyAddress: string,
61+
payload: string | Uint8Array,
62+
) => Promise<string>
5663
}
5764

5865
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
@@ -81,6 +88,9 @@ export const createSTokensContract =
8188
payloadOf: createPayloadOfCaller(contractClient),
8289
positionsOfProperty: createPositionsOfPropertyCaller(contractClient),
8390
positionsOfOwner: createPositionsOfOwnerCaller(contractClient),
91+
descriptorOf: createDescriptorOfCaller(contractClient),
92+
descriptorOfPropertyByPayload:
93+
createDescriptorOfPropertyByPayloadCaller(contractClient),
8494
contract: () => contractClient,
8595
}
8696
}

0 commit comments

Comments
 (0)