Skip to content

Commit

Permalink
chore: change ropsten to goerli
Browse files Browse the repository at this point in the history
  • Loading branch information
marianogoldman committed Jul 25, 2022
1 parent b2c419f commit e8b6a45
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 24 deletions.
17 changes: 8 additions & 9 deletions src/content-url-resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,27 +94,26 @@ resolvers.push(function wearablesV1UrlResolver(asset, options) {
})

resolvers.push(async function landResolver(asset, options) {
if (
asset.type == "blockchain-asset" &&
asset.contractAddress.toLowerCase() == (await getContract(asset.network, "LANDProxy"))
) {
const host = defaultContentServerForNetwork(asset.network, options)
const { x, y } = LandUtils.decodeTokenId(asset.id)
return `https://${host}/content/entities/scene?pointer=${x},${y}`
if (asset.type == "blockchain-asset") {
if (asset.contractAddress.toLowerCase() == (await getContract(asset.network, "LANDProxy"))?.toLowerCase()) {
const host = defaultContentServerForNetwork(asset.network, options)
const {x, y} = LandUtils.decodeTokenId(asset.id)
return `https://${host}/content/entities/scene?pointer=${x},${y}`
}
}
})

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

function defaultWearablesServerForNetwork(network: string, options: ResolversOptions) {
if (options.wearablesServerHost) return options.wearablesServerHost
if (network == "ropsten") {
if (network == "goerli") {
return `wearable-api.decentraland.zone`
}
return `wearable-api.decentraland.org`
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 | ropsten | matic and others.
* mainnet | goerli | matic and others.
*/
network: string
/**
Expand Down Expand Up @@ -49,7 +49,7 @@ export type BlockchainCollectionV1Asset = {
*/
blockchain: "ethereum"
/**
* mainnet | ropsten | matic and others.
* mainnet | goerli | matic and others.
*/
network: string
/**
Expand All @@ -76,7 +76,7 @@ export type BlockchainCollectionV1 = {
*/
blockchain: "ethereum"
/**
* mainnet | ropsten | matic and others.
* mainnet | goerli | 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 @@ -46,15 +46,15 @@ describe("Content url generation", function () {
"https://peer.decentraland.org/content/entities/scene?pointer=13,-137"
)
test(
"urn:decentraland:ropsten:LAND:4763953136893138488487244504044754960247",
"urn:decentraland:goerli:LAND:4763953136893138488487244504044754960247",
"https://peer.decentraland.zone/content/entities/scene?pointer=13,-137"
)
test(
"urn:decentraland:ropsten:LAND:4763953136893138488487244504044754960247",
"urn:decentraland:goerli:LAND:4763953136893138488487244504044754960247",
"https://localhost:7666/content/entities/scene?pointer=13,-137",
{ contentServerHost: "localhost:7666" }
)
test("urn:decentraland:ropsten:LAND:-10,-13", "https://peer.decentraland.zone/content/entities/scene?pointer=-10,-13")
test("urn:decentraland:goerli: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
2 changes: 1 addition & 1 deletion test/land-utils.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import expect from "expect"
import { LandUtils } from "../src/land-utils"
import { LandUtils } from "../src"

function testValidPositionParsingAndGeneration(tokenId: string, x: number, y: number) {
it(tokenId + " (" + x + ", " + y + ") decode", async () => {
Expand Down
16 changes: 8 additions & 8 deletions test/urn.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import expect from "expect"
import { DecentralandAssetIdentifier, parseUrn } from "../src/index"
import { DecentralandAssetIdentifier, parseUrn } from "../src"
import { resolveEthereumAsset } from "../src/resolvers"

let counter = 0
Expand All @@ -16,7 +16,7 @@ describe("Basic use cases", function () {
})

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

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

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

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

it("test land (ropsten)", async () => {
expect(await parseUrn("urn:decentraland:ropsten:LAND:0x1")).toMatchObject({
contractAddress: "0x7a73483784ab79257bb11b96fd62a2c3ae4fb75b",
it("test land (goerli)", async () => {
expect(await parseUrn("urn:decentraland:goerli:LAND:0x1")).toMatchObject({
contractAddress: "0x25b6B4bac4aDB582a0ABd475439dA6730777Fbf7",
blockchain: "ethereum",
network: "ropsten",
network: "goerli",
id: "0x1",
})
})
Expand Down

0 comments on commit e8b6a45

Please sign in to comment.