Skip to content

Commit

Permalink
feat: extended URNs for dcl wearables / emotes (#168)
Browse files Browse the repository at this point in the history
* feat: resolves V1 and V2 collection items

* refactor

---------

Co-authored-by: Alejo Thomas Ortega <alejo.ortega@decentraland.org>
  • Loading branch information
Julieta11 and aleortega authored Aug 11, 2023
1 parent 14bf432 commit 2a38e9d
Show file tree
Hide file tree
Showing 15 changed files with 809 additions and 568 deletions.
21 changes: 13 additions & 8 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
{
"extends": "@dcl/eslint-config",
"parser": "@typescript-eslint/parser",
"extends": "@dcl/eslint-config/sdk",
"parserOptions": {
"ecmaVersion": 2020, // Allows for the parsing of modern ECMAScript features
"sourceType": "module", // Allows for the use of imports
"project": [
// Specify it only for TypeScript files
"./tsconfig.json",
"./test/tsconfig.json"
"tsconfig.json",
"test/tsconfig.json"
]
},
"rules": {
"prettier/prettier": ["error", {
"printWidth": 120,
"semi": false,
"singleQuote": true,
"trailingComma": "none",
"tabWidth": 2
}]
}
}
}
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,11 @@ const parsed = await parseUrn("urn:decentraland:sepolia:LAND:-10,-13?atBlock=151

- `decentraland:off-chain:{registry}:{name}`: Resolve static offchain assets (i.e. base wearables, not in any blockchain)
- `decentraland:{network}:collections-v1:{contract(0x[a-fA-F0-9]+)}:{name}`: Resolve an ethereum wearables collection asset by contract address (v1)
- `decentraland:{network}:collections-v1:{contract(0x[a-fA-F0-9]+)}:{name}:{tokenId}`: Resolve an ethereum wearable item from collections v1 by contract address and token id
- `decentraland:{network}:collections-v1:{collection-name}:{name}`: Resolve an ethereum wearables collection asset by collection name (wearables API) (v1)
- `decentraland:{network}:collections-v1:{collection-name}:{name}:{tokenId}`: Resolve an ethereum wearable item from collections v1 by collection name and token id
- `decentraland:{network}:collections-v2:{contract(0x[a-fA-F0-9]+)}:{id}`: Resolve an ethereum wearables collection asset by contract address (v2)
- `decentraland:{network}:collections-v2:{contract(0x[a-fA-F0-9]+)}:{id}:{tokenId}`: Resolve an ethereum wearable item from collections v2 by contract address and token id
- `decentraland:{network}:LAND:{x},{y}`: Resolves the ethereum asset of a LAND position.
- `decentraland:{network}:LAND:{tokenId}`: Resolves the ethereum asset of a LAND by tokenId.
- `decentraland:{network}:collections-thirdparty:{thirdPartyName}:{collectionId}:{itemId}`: Resolves the ethereum asset of an item of a third party collection, currently only supported on polygon
Expand Down
14 changes: 13 additions & 1 deletion etc/urn-resolver.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ export type BlockchainCollectionV1Asset = {
collectionName: string | null;
};

// @public (undocumented)
export type BlockchainCollectionV1Item = Omit<BlockchainCollectionV1Asset, 'type'> & {
type: 'blockchain-collection-v1-item';
tokenId: string;
};

// @public (undocumented)
export type BlockchainCollectionV2 = BaseBlockchainAsset & {
namespace: 'decentraland';
Expand All @@ -80,14 +86,20 @@ export type BlockchainCollectionV2Asset = BaseBlockchainAsset & {
id: string;
};

// @public (undocumented)
export type BlockchainCollectionV2Item = Omit<BlockchainCollectionV2Asset, 'type'> & {
type: 'blockchain-collection-v2-item';
tokenId: string;
};

// @public (undocumented)
export type BlockchainLandAsset = BlockchainAsset & {
x: number;
y: number;
};

// @public (undocumented)
export type DecentralandAssetIdentifier = BlockchainAsset | OffChainAsset | EntityV3Asset | BlockchainCollectionV1Asset | BlockchainCollectionV2Asset | BlockchainLandAsset | BlockchainCollectionV1 | BlockchainCollectionV2 | BlockchainCollectionThirdPartyName | BlockchainCollectionThirdPartyCollection | BlockchainCollectionThirdParty;
export type DecentralandAssetIdentifier = BlockchainAsset | OffChainAsset | EntityV3Asset | BlockchainCollectionV1Asset | BlockchainCollectionV1Item | BlockchainCollectionV2Asset | BlockchainCollectionV2Item | BlockchainLandAsset | BlockchainCollectionV1 | BlockchainCollectionV2 | BlockchainCollectionThirdPartyName | BlockchainCollectionThirdPartyCollection | BlockchainCollectionThirdParty;

// @public (undocumented)
export type EntityV3Asset = {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"devDependencies": {
"@dcl/eslint-config": "^1.1.8",
"@microsoft/api-extractor": "^7.18.4",
"@types/mocha": "^9.1.1",
"@types/mocha": "^10.0.1",
"expect": "^29.0.1",
"mocha": "^10.0.0",
"ts-node": "^10.9.1",
Expand Down
Loading

0 comments on commit 2a38e9d

Please sign in to comment.