@did-space/client
TypeScript icon, indicating that this package has built-in type declarations

0.5.39 • Public • Published

@did-client

Install

npm install @did-space/client

Usage

PutNftObjectCommand

You can persist NFTs to Spaces using PutNftObjectCommand

import { SpaceClient, PutNftObjectCommand } from '@did-space/client';

const spaceClient = new SpaceClient({
  endpoint: 'https://cedcaa27-znkomkclejcfbjaxw9knzzebmzmqrxjnn9bb.did.abtnet.io/api/space/z3T6EHN7sLhH5cty1PshDeSipeG7JNxEVaRFS/app/zNKabhhwdvVmXjtRTtSHk2YQz4pdDPStV289/object/',
  wallet,
});

await spaceClient.send(
  new PutNftObjectCommand({
    did: 'zjduEsT5qiQr72tVtevGG3GwKjV6J4yHR9fy',
    controller: wallet,
    chainHost: 'https://beta.abtnetwork.io/explorer',
    display: {
      key: 'logo.jpg',
      data: fs.createReadStream('logo.jpg'),
    },
  })
);

SyncFolderPushCommand

You can use SyncFolderPushCommand to sync a local folder to a folder on Spaces

import { SpaceClient, SyncFolderPushCommand } from '@did-space/client';

const spaceClient = new SpaceClient({
  endpoint: 'https://cedcaa27-znkomkclejcfbjaxw9knzzebmzmqrxjnn9bb.did.abtnet.io/api/space/z3T6EHN7sLhH5cty1PshDeSipeG7JNxEVaRFS/app/zNKabhhwdvVmXjtRTtSHk2YQz4pdDPStV289/object/',
  wallet,
});

await spaceClient.send(
  new SyncFolderPushCommand({
    source: 'local-folder/',
    target: 'spaces-folder/',
  })
);

SyncFolderPullCommand

You can use SyncFolderPullCommand to sync folders on Spaces to local folders

import { SpaceClient, SyncFolderPullCommand } from '@did-space/client';

const spaceClient = new SpaceClient({
  endpoint: 'https://cedcaa27-znkomkclejcfbjaxw9knzzebmzmqrxjnn9bb.did.abtnet.io/api/space/z3T6EHN7sLhH5cty1PshDeSipeG7JNxEVaRFS/app/zNKabhhwdvVmXjtRTtSHk2YQz4pdDPStV289/object/',
  wallet,
});

await spaceClient.send(
  new SyncFolderPullCommand({
    source: 'spaces-folder/',
    target: 'local-folder/',
  })
);

Readme

Keywords

none

Package Sidebar

Install

npm i @did-space/client

Weekly Downloads

919

Version

0.5.39

License

ISC

Unpacked Size

172 kB

Total Files

160

Last publish

Collaborators

  • wangshijun