How to use dcl-catalyst-commons - 2 common examples

To help you get started, we’ve selected a few dcl-catalyst-commons examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github decentraland / explorer / kernel / packages / shared / profiles / sagas.ts View on Github external
async function deploy(url: string, identity: ExplorerIdentity, metadata: any, contentFiles: Map) {
  // Build entity and group all files
  const preparationData = await DeploymentBuilder.buildEntity(
    EntityType.PROFILE,
    [identity.address],
    contentFiles,
    metadata
  )
  // sign the entity id fetchMetaContentServer
  const authChain = Authenticator.signPayload(identity, preparationData.entityId)
  // Build the client
  const catalyst = new ContentClient(url, 'explorer-kernel-profile')
  // Build the deploy data
  const deployData: DeploymentData = { ...preparationData, authChain }
  // Deploy the actual entity
  return catalyst.deployEntity(deployData)
}
github decentraland / explorer / kernel / packages / decentraland-loader / lifecycle / controllers / download.ts View on Github external
for (const tile of tiles) {
      let promise: IFuture

      if (this.positionToSceneId.has(tile)) {
        promise = this.positionToSceneId.get(tile)!
      } else {
        promise = future()
        this.positionToSceneId.set(tile, promise)
        missingTiles.push(tile)
      }

      futures.push(promise.then((id) => [tile, id]))
    }

    if (missingTiles.length > 0) {
      const scenes = await this.catalyst.fetchEntitiesByPointers(EntityType.SCENE, missingTiles)

      // resolve promises
      for (const scene of scenes) {
        for (const tile of scene.pointers) {
          if (this.positionToSceneId.has(tile)) {
            const promise = this.positionToSceneId.get(tile)
            promise!.resolve(scene.id)
          } else {
            // if we get back a pointer/tile that was not pending => create the future and resolve
            const promise = future()
            promise.resolve(scene.id)
            this.positionToSceneId.set(tile, promise)
          }
        }

        const sceneId = scene.id

dcl-catalyst-commons

Common tools and types to share between catalyst servers and clients

Apache-2.0
Latest version published 12 months ago

Package Health Score

45 / 100
Full package analysis