Skip to content

Commit

Permalink
feat: Support Sepolia (#167)
Browse files Browse the repository at this point in the history
  • Loading branch information
fzavalia authored Jul 13, 2023
1 parent 64b7018 commit 1f955de
Show file tree
Hide file tree
Showing 7 changed files with 125 additions and 48 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ npm i @dcl/urn-resolver
```typescript
import { parseUrn } from '@dcl/urn-resolver'

const parsed = await parseUrn("urn:decentraland:goerli:LAND:-10,-13?atBlock=151231111")
const parsed = await parseUrn("urn:decentraland:sepolia:LAND:-10,-13?atBlock=151231111")
=> {
uri: URL {
href: 'urn:decentraland:goerli:LAND:-10,-13?atBlock=151231111',
href: 'urn:decentraland:sepolia:LAND:-10,-13?atBlock=151231111',
protocol: 'urn:',
pathname: 'decentraland:goerli:LAND:-10,-13',
pathname: 'decentraland:sepolia:LAND:-10,-13',
search: '?atBlock=151231111',
searchParams: URLSearchParams { 'atBlock' => '151231111' },
},
blockchain: 'ethereum',
type: 'blockchain-asset',
network: 'goerli',
network: 'sepolia',
contractAddress: '0x7a73483784ab79257bb11b96fd62a2c3ae4fb75b',
id: '0xfffffffffffffffffffffffffffffff6fffffffffffffffffffffffffffffff3',
x: -10,
Expand Down
4 changes: 2 additions & 2 deletions src/content-url-resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,15 @@ resolvers.push(async function landResolver(asset, options) {

function defaultContentServerForNetwork(network: string, options: ResolversOptions) {
if (options.contentServerHost) return options.contentServerHost
if (network == "goerli") {
if (network == "goerli" || network == "sepolia") {
return `peer.decentraland.zone`
}
return `peer.decentraland.org`
}

function defaultWearablesServerForNetwork(network: string, options: ResolversOptions) {
if (options.wearablesServerHost) return options.wearablesServerHost
if (network == "goerli") {
if (network == "goerli" || network == "sepolia") {
return `wearable-api.decentraland.zone`
}
return `wearable-api.decentraland.org`
Expand Down
127 changes: 102 additions & 25 deletions src/contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export = (
"Xmas2019Collection": "0xc3af02c0fd486c8e9da5788b915d6fff3f049866",
"DCLRegistrar": "0x2a187453064356c898cae034eaed119e1663acb8",
"DCLController": "0x6843291bd86857d97f0d269e698939fb10d60772",
"DCLControllerV2": "0xbe92b49aee993adea3a002adcda189a2b7dec56c",
"Catalyst": "0xcc054fab08127c19f621ab83ade5962cd10584ec",
"CatalystProxy": "0x4a2f10076101650f40342885b99b6b101d83c486",
"MCHCollection": "0xf64dc33a192e056bb5f0e5049356a0498b502d50",
Expand Down Expand Up @@ -94,27 +95,40 @@ export = (
"DAOVotingPower": "0xcf9b305b4cd210079f5648f17ede69e666c0c8d4",
"TheGraphMultisig": "0x89FDdaB2F93417182CdCdb0B8B3322B93AB3A192",
"VestingImpl": "0x42f32e19365d8045661a006408cc6d1064039fbf",
"PeriodicTokenVestingImpl": "0xb76b389cd04595321d51f575f5d950df1cef3dd7",
"VestingFactory": "0xe357273545c152f07afe2c38257b7b653fd3f6d0",
"BatchVesting": "0xc57185366bcda81cde363380e2099758712038d0"
"BatchVesting": "0xc57185366bcda81cde363380e2099758712038d0",
"OwnableBatchVestingImpl": "0x24b18ac1c0cc1cfa14b03fe5c4580ab85191608a",
"MinimalProxyFactory": "0x38971125599c5e5b618072601c4eb803d7b24796",
"SABGnosisSafe": "0x335cb926dBcaf479cC927c4A8803880eEc7123Ac",
"RentalsProxyAdmin": "0xb49882c17281d3451972ae7e476cb3e0698af712",
"RentalsProxy": "0x3a1469499d0be105d4f77045ca403a5f6dc2f3f5",
"RentalsImplementation": "0xe90636e24d8faf02aa0e01c26d72dab9629865cb"
},
"kovan": {
"MANAToken": "0x230fc362413d9e862326c2c7084610a5a2fdf78a",
"LANDRegistry": "0x2059291430b9aa2F79547f657816eFb816b36614",
"LANDProxy": "0x537263c440943f6a6808bCb8CcB3fe03EE838aD1",
"Marketplace": "0x6f44f195999f06aeb5872db96cdc517f1e839f13"
},
"rinkeby": {
"MANAToken": "0x28bce5263f5d7f4eb7e8c6d5d78275ca455bac63",
"LANDProxy": "0x28bef22df3e2040a4be64a9ca0e8b5ae2b91462d",
"LANDRegistry": "0xbeea8bfb0e582be1c3fb464824e61c218ba0c1b1",
"EstateRegistry": "0x3f0b58ad7a8b27d0e5573cd1ca7d456e2f6d4884",
"Multisig": "0x0de35b8b47b129877e0efca24e294b61d7e7eee3",
"MANAMiniMeToken": "0xfb2712a1246f712b889692c7ce55fec25c06bc33",
"LANDMiniMeToken": "0x576c4577aAd561EA79acbd49215a0cC1473BfCCA",
"EstateMiniMeToken": "0x2b98C125733035cDE09d311F988845808EE270E6",
"DAOVotingPower": "0xe65835cd7c9311866ae5d260a1eb7b963899ca14",
"VestingImpl": "0x8493bb6ae17e12c062b0eb1fe780cc0b2df16bb2",
"VestingFactory": "0x64c9f713a743458ab22ec49d88dd00621f528786"
"sepolia": {
"MANAToken": "0xfa04d2e2ba9aec166c93dfeeba7427b2303befa9",
"LANDRegistry": "0xe8737b4d17df2f54fff5193a225561a9ff99b11f",
"LANDProxy": "0x42f4ba48791e2de32f5fbf553441c2672864bb33",
"Marketplace": "0x5e1870e444e4a25333494c3cfda0609f13fd806a",
"MarketplaceProxy": "0xccf0c17da6cd68041b1bf0f7e015767242077d8c",
"EstateRegistry": "0xd27b7075917579a3d243e4b6a058cef5c0aac5d5",
"EstateProxy": "0x369a7fbe718c870c79f99fb423882e8dd8b20486",
"ERC721Bid": "0x2c2835b95852fd975e087b3b25297322728792e2",
"DCLRegistrar": "0x7518456ae93eb98f3e64571b689c626616bb7f30",
"DCLControllerV2": "0xd2046364317c21fa8d121d84185c39e6e910cf89",
"RentalsImplementation": "0xa77aef8c75a6ad9b84c6dd8b9d148f2a9accfaf5",
"RentalsProxyAdmin": "0x9d6e8912b8192d5e2f2c9ab1ba62fdfd0488fc5a",
"RentalsProxy": "0xe70db6319e9cee3f604909bdade58d1f5c1cf702",
"VestingImpl": "0x6ad9fb3f07a6013e6db2327e27ad0a38e858d88d",
"PeriodicTokenVestingImpl": "0xfbbda3074423aad9c0078086564651bb6b0ab2bd",
"VestingFactory": "0x71c84760df0537f7db286274817462dc2e6c1366",
"BatchVesting": "0x380e46851c47b73b6aa9bea50cf3b50e2cf637cf",
"OwnableBatchVestingImpl": "0xb8c7a7afd42675ab61f0a3732f8d0491825a933b",
"MinimalProxyFactory": "0xa4ea879211c35260d3c470f773b49241ecb561a7",
"ExclusiveMasksCollection": "0x11a970e744ff69db8f461c2d0fc91d4293914301",
"NAMEDenylist": "0x6082b0b10b0fe9040652e35acbf3a22fe6764f27",
"Catalyst": "0x9b5091588a4bae0a5ea54a35af3c31f57a68ed37",
"POIAllowlist": "0xff7fcdbeaf0a5f2c408564036a9afaef9f38182d"
},
"goerli": {
"MANAToken": "0xe7fDae84ACaba2A5Ba817B6E6D8A2d415DBFEdbe",
Expand All @@ -125,19 +139,24 @@ export = (
"LANDProxy": "0x25b6B4bac4aDB582a0ABd475439dA6730777Fbf7",
"EstateRegistry": "0x5309aE874FC4eB21adCd63f8b6C3f766Cc3B1849",
"EstateProxy": "0xC9A46712E6913c24d15b46fF12221a79c4e251DC",
"RentalsProxyAdmin": "0x6ad9fb3f07a6013e6db2327e27ad0a38e858d88d",
"RentalsProxy": "0xbb2a03bf5f525734cb0536be4be61ba788d7ee01",
"RentalsImplementation": "0xe70db6319e9cee3f604909bdade58d1f5c1cf702",
"RentalsProxyAdmin": "0xa924cbea79a031baa05d76908644d5c5bedeaaed",
"RentalsProxy": "0x92159c78f0f4523b9c60382bb888f30f10a46b3b",
"RentalsImplementation": "0x619cf59b03a4e0c42850429e154ff7fd1d966b3c",
"MarketplaceProxy": "0x5d01fbD3E22892be40F69bdAE7Ad921C8cdA2085",
"MarketplaceImplementation": "0x09B389B3523870798f46555fef26B4476A973E6E",
"MarketplaceLegacyNFT": "0x0fFc7E6D72eE2F287B877533454210621b1B7822",
"DCLRegistrar": "0x6b8da2752827cf926215b43bb8E46Fd7b9dDac35",
"DCLController": "0x6fF05B6271BBEd8F16a46e6073d27aD94224E0Ac",
"DCLControllerV2": "0xe23b047c8ee33d0c423676544bca6d2c9d3faa49",
"ERC721Bid": "0xd7dC1C183B8fFaED6b7f30fFC616Ff81B66812e5",
"ExclusiveMasksCollection": "0x1f0880E0b4514DC58e68B9BE91693bFA8C067ac1",
"NAMEDenylist": "0x71c84760df0537f7db286274817462dc2e6c1366",
"Catalyst": "0x380e46851c47b73b6aa9bea50cf3b50e2cf637cf",
"POIAllowlist": "0xb8c7a7afd42675ab61f0a3732f8d0491825a933b"
"POIAllowlist": "0xb8c7a7afd42675ab61f0a3732f8d0491825a933b",
"VestingImpl": "0xa1c496c3beca1832a8434ac77ee3a1a53881c12e",
"PeriodicTokenVestingImpl": "0x3b2149a7573e2b0dd157307d427b9380f8f1b2a1",
"VestingFactory": "0x11a970e744ff69db8f461c2d0fc91d4293914301",
"BatchVestings": "0x651440486194aeca2cfff6e344bd604dda8a2d7f"
},
"matic": {
"MetaTxForwarder": "0x0baBda04f62C549A09EF3313Fe187f29c099FF3C",
Expand All @@ -164,7 +183,8 @@ export = (
"MarketplaceV2": "0x480a0f4e360E8964e68858Dd231c2922f1df45Ef",
"ERC721Bid": "0xb96697FA4A3361Ba35B774a42c58dACcaAd1B8E1",
"FoundationEOACreator1": "0x6ADf75e49bAC21abab9AdB9266d2cC6d90AbD31a",
"UpgradeableBeacon": "0xDDb3781Fff645325C8896AA1F067bAa381607ecc"
"UpgradeableBeacon": "0xDDb3781Fff645325C8896AA1F067bAa381607ecc",
"POI": "0xFEC09d5C192aaf7Ec7E2C89Cc8D3224138391B2E"
},
"mumbai": {
"dAppsAdmin": "0xb919da06d5f81777B13Fc5CBd48635E19500Fbf5",
Expand All @@ -191,7 +211,64 @@ export = (
"RoyaltiesManager": "0x68838E6068a3a925a78546E475dE73C75e4F2651",
"MarketplaceV2": "0x5A467398dfa9d5C663a656423A2D055f538198A4",
"ERC721Bid": "0x78Dd92c8941dBC7BE54E2a9390D58aD28AD97afD",
"UpgradeableBeacon": "0x0c8ad1f6aadf89d2eb19f01a100a6143108fe2b0"
"UpgradeableBeacon": "0x0c8ad1f6aadf89d2eb19f01a100a6143108fe2b0",
"POI": "0x08E5a5288D6bBa9383724C57175C03A37fe83A2A"
},
"kovan": {
"MANAToken": "0x230fc362413d9e862326c2c7084610a5a2fdf78a",
"LANDRegistry": "0x2059291430b9aa2F79547f657816eFb816b36614",
"LANDProxy": "0x537263c440943f6a6808bCb8CcB3fe03EE838aD1",
"Marketplace": "0x6f44f195999f06aeb5872db96cdc517f1e839f13"
},
"rinkeby": {
"MANAToken": "0x28bce5263f5d7f4eb7e8c6d5d78275ca455bac63",
"LANDProxy": "0x28bef22df3e2040a4be64a9ca0e8b5ae2b91462d",
"LANDRegistry": "0xbeea8bfb0e582be1c3fb464824e61c218ba0c1b1",
"EstateRegistry": "0x3f0b58ad7a8b27d0e5573cd1ca7d456e2f6d4884",
"Multisig": "0x0de35b8b47b129877e0efca24e294b61d7e7eee3",
"MANAMiniMeToken": "0xfb2712a1246f712b889692c7ce55fec25c06bc33",
"LANDMiniMeToken": "0x576c4577aAd561EA79acbd49215a0cC1473BfCCA",
"EstateMiniMeToken": "0x2b98C125733035cDE09d311F988845808EE270E6",
"DAOVotingPower": "0xe65835cd7c9311866ae5d260a1eb7b963899ca14",
"VestingImpl": "0x8493bb6ae17e12c062b0eb1fe780cc0b2df16bb2",
"VestingFactory": "0x64c9f713a743458ab22ec49d88dd00621f528786"
},
"ropsten": {
"PrivateNodeWallet": "0x62ba62ff92917edf8ac0386fa10e3b27950bce8d",
"MANAToken": "0x2a8fd99c19271f4f04b1b7b9c4f7cf264b626edb",
"LANDRegistry": "0x255baf4096cb1723c00c4b4390a4b3028ecaa8ba",
"LANDProxy": "0x7a73483784ab79257bb11b96fd62a2c3ae4fb75b",
"TerraformReserve": "0x4bc79175f1f6fded07f04aa1b4b0465ecff6f1b3",
"ReturnVesting": "0x58c7e6e382c1c19c132b0361c12cbc33e2b13076",
"LegacyMarketplace": "0x80faa2b517b84a5aec1078d3600eab4c0b3aff56",
"Marketplace": "0x3d2f10c76b115db93a418ed286ca0c5abfdbf5d0",
"MarketplaceProxy": "0x5424912699dabaa5f2998750c1c66e73d67ad219",
"ServiceLocator": "0xb240b30c12d2a9ea6ba3abbf663d9ae265fbebeb",
"MortgageHelper": "0x0e4c24f71c8679b8af8e5a22aac3816e2b23f1cc",
"MortgageManager": "0x31ebb4ffd5e34acfc87ea21a0c56157188f3f0e1",
"RCNEngine": "0xbeE217bfe06C6FAaa2d5f2e06eBB84C5fb70d9bF",
"RCNToken": "0x2f45b6fb2f28a73f110400386da31044b2e953d4",
"KyberOracle": "0x4931d0621360187199de494a1469165079b31bfc",
"DecentralandInvite": "0x7557dfa02f3bd7d274851e3f627de2ed2ff390e8",
"EstateRegistry": "0x60e315992d5e62457215dd1e6a49d1ceb7983dfc",
"EstateProxy": "0x124bf28a423b2ca80b3846c3aa0eb944fe7ebb95",
"ERC721Bid": "0x250fa138c0a994799c7a49df3097dc71e37b3d6f",
"BidMANABurner": "0x01f43c3133b83086d4776027fbd152fa8a685fb4",
"AvatarNameRegistry": "0xd127F8d9C736d91Acdee34645e0b4C9db7178160",
"AvatarNameRegistryProxy": "0x2d794a7c956624fb93Eb3ff6E48D5b5d6dBA127b",
"ExclusiveMasksCollection": "0x30ae57840b0e9b8ea55334083d53d80b2cfe80e0",
"DCLRegistrar": "0xeb6f5d94d79f0750781cc962908b161b95192f53",
"DCLController": "0xd4e92f6ea18412dbae8b2d2b69e498a2d1064fa2",
"Catalyst": "0xadd085f2318e9678bbb18b3e0711328f902b374b",
"BuyAdapter": "0xd1e4e2880ff56cd0d5c68da9bed58bfbf0150948",
"AdapterFeeCollector": "0x5DC888024cB599CfDdb9E6483ED6bAe1fA9e9D18",
"AdapterConverter": "0x2782eb28Dcb1eF4E7632273cd4e347e130Ce4646",
"POIAllowlist": "0x5DC4a5C214f2161F0D5595a6dDd9352409aE3Ab4",
"NAMEDenylist": "0x20c6f1e86eba703a14414a0cbc1b55c89dba7a0f",
"CollectionsV2Factory": "0x16d8bac5b67a6b782a9081377bec413bc5bb56a6",
"VestingImpl": "0xc243b243a2033348730420ea55239767802a19d0",
"VestingFactory": "0xcbfa36f59246ae43cb827a77f6ca955b93dd6042",
"BatchVesting": "0xedbea1174b892f88a836f61de395f5f155d4d2a9"
}
}
) as Record<string, Record<string, string>>
2 changes: 1 addition & 1 deletion src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const collections: Collection[] = []

const lowerCasedContracts: Record<string, Record<string, string>> = {}

const validNetworks = new Set(["ethereum", "kovan", "rinkeby", "goerli", "matic", "mumbai"])
const validNetworks = new Set(["ethereum", "kovan", "rinkeby", "goerli", "sepolia", "matic", "mumbai"])

for (let network in contracts) {
lowerCasedContracts[network] = Object.create(null)
Expand Down
6 changes: 3 additions & 3 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export type BaseBlockchainAsset = {
*/
blockchain: "ethereum"
/**
* mainnet | goerli | matic and others.
* mainnet | sepolia | matic and others.
*/
network: string
/**
Expand Down Expand Up @@ -49,7 +49,7 @@ export type BlockchainCollectionV1Asset = {
*/
blockchain: "ethereum"
/**
* mainnet | goerli | matic and others.
* mainnet | sepolia | matic and others.
*/
network: string
/**
Expand All @@ -76,7 +76,7 @@ export type BlockchainCollectionV1 = {
*/
blockchain: "ethereum"
/**
* mainnet | goerli | matic and others.
* mainnet | sepolia | matic and others.
*/
network: string

Expand Down
6 changes: 3 additions & 3 deletions test/content-url.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@ describe("Content url generation", function () {
"https://peer.decentraland.org/content/entities/scene?pointer=13,-137"
)
test(
"urn:decentraland:goerli:LAND:4763953136893138488487244504044754960247",
"urn:decentraland:sepolia:LAND:4763953136893138488487244504044754960247",
"https://peer.decentraland.zone/content/entities/scene?pointer=13,-137"
)
test(
"urn:decentraland:goerli:LAND:4763953136893138488487244504044754960247",
"urn:decentraland:sepolia:LAND:4763953136893138488487244504044754960247",
"https://localhost:7666/content/entities/scene?pointer=13,-137",
{ contentServerHost: "localhost:7666" }
)
test("urn:decentraland:goerli:LAND:-10,-13", "https://peer.decentraland.zone/content/entities/scene?pointer=-10,-13")
test("urn:decentraland:sepolia:LAND:-10,-13", "https://peer.decentraland.zone/content/entities/scene?pointer=-10,-13")

test(
"urn:decentraland:ethereum:collections-v1:community_contest:cw_bell_attendant_hat",
Expand Down
20 changes: 10 additions & 10 deletions test/urn.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe("Basic use cases", function () {
})

it("Print LAND resolution for readme", async () => {
console.log(await parseUrn("urn:decentraland:goerli:LAND:-10,-13?atBlock=151231111"))
console.log(await parseUrn("urn:decentraland:sepolia:LAND:-10,-13?atBlock=151231111"))
})

it("test land", async () => {
Expand All @@ -38,9 +38,9 @@ describe("Basic use cases", function () {
})

it("test land (query string)", async () => {
const t = await parseUrn("urn:decentraland:goerli:LAND:0x1?atBlock=151231111#4")
const t = await parseUrn("urn:decentraland:sepolia:LAND:0x1?atBlock=151231111#4")
expect(t).toHaveProperty("uri")
expect(t.uri.toString()).toEqual("urn:decentraland:goerli:LAND:0x1?atBlock=151231111#4")
expect(t.uri.toString()).toEqual("urn:decentraland:sepolia:LAND:0x1?atBlock=151231111#4")
})

// it("test land (address)", async () => {
Expand All @@ -52,11 +52,11 @@ describe("Basic use cases", function () {
// })
// })

it("test land (goerli)", async () => {
expect(await parseUrn("urn:decentraland:goerli:LAND:0x1")).toMatchObject({
contractAddress: "0x25b6B4bac4aDB582a0ABd475439dA6730777Fbf7",
it("test land (sepolia)", async () => {
expect(await parseUrn("urn:decentraland:sepolia:LAND:0x1")).toMatchObject({
contractAddress: "0x42f4ba48791e2de32f5fbf553441c2672864bb33",
blockchain: "ethereum",
network: "goerli",
network: "sepolia",
id: "0x1",
})
})
Expand Down Expand Up @@ -328,15 +328,15 @@ describe("Basic use cases", function () {
"uri": new URL("urn:decentraland:ethereum:erc721:0xf87e31492faf9a91b02ee0deaad50d51d56d5d4d:111111111111111111"),
}
)
expect(await parseUrn("urn:decentraland:goerli:erc721:0xf87e31492faf9a91b02ee0deaad50d51d56d5d4d:111111111111111111")).toEqual(
expect(await parseUrn("urn:decentraland:sepolia:erc721:0xf87e31492faf9a91b02ee0deaad50d51d56d5d4d:111111111111111111")).toEqual(
{
"blockchain": "ethereum",
"contractAddress": "0xf87e31492faf9a91b02ee0deaad50d51d56d5d4d",
"id": "111111111111111111",
"namespace": "decentraland",
"network": "goerli",
"network": "sepolia",
"type": "blockchain-asset",
"uri": new URL("urn:decentraland:goerli:erc721:0xf87e31492faf9a91b02ee0deaad50d51d56d5d4d:111111111111111111"),
"uri": new URL("urn:decentraland:sepolia:erc721:0xf87e31492faf9a91b02ee0deaad50d51d56d5d4d:111111111111111111"),
}
)
expect(await parseUrn("urn:decentraland:matic:erc721:0xf87e31492faf9a91b02ee0deaad50d51d56d5d4d:111111111111111111")).toEqual(
Expand Down

0 comments on commit 1f955de

Please sign in to comment.