Namespace
Namespace
is the first-level unit in Glacier
. There are usually only two operations: creation and enumeration. The code for creation is as follows:
src/createNamespace.ts
async function createNamespace() {
const result = await client.createNamespace('myproject');
console.log(result);
}
Output result:
{
insertedId: 'myproject';
}
The code to enumerate Namespace
is as follows:
src/namespaces.ts
async function namespaces() {
const result = await client.namespaces(
'0xb4c42d4b15aa65f782b81ac01eaba2472f83b4e9'
);
console.log(result);
}
Output result:
[
{
owner: '0xb4c42d4b15aa65f782b81ac01eaba2472f83b4e9',
network: 'ethereum',
namespace: 'myproject',
seqId: 0,
dataset: [],
createdAt: 1672026246,
updatedAt: 1672036876,
},
];