npm install @did-space/client
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'),
},
})
);
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/',
})
);
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/',
})
);