Skip to content

Commit

Permalink
Format
Browse files Browse the repository at this point in the history
  • Loading branch information
Dr-Electron committed Dec 16, 2023
1 parent 87e7a1e commit a41f080
Show file tree
Hide file tree
Showing 10 changed files with 641 additions and 626 deletions.
2 changes: 1 addition & 1 deletion packages/sdk/examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

# Usage

You can rund single examples with `npm run run-example <example-file>`. If you want to build all examples, use `npm build`.
You can rund single examples with `npm run run-example <example-file>`. If you want to build all examples, use `npm build`.
31 changes: 18 additions & 13 deletions packages/sdk/examples/create_project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,30 @@ async function main() {
let userSign = await walletSign(address.bech32, address);
try {
responseProject = await https(origin).createProject({
address: address.bech32,
signature: userSign.signature,
publicKey: {
hex: userSign.publicKey,
network: Network.RMS,
address: address.bech32,
signature: userSign.signature,
publicKey: {
hex: userSign.publicKey,
network: Network.RMS,
},
body: {
name: 'TanKRURK',
config: {
billing: 'volume_based',
},
body: {
name: 'TanKRURK',
config: {
billing: 'volume_based',
},
},
});
},
});
} catch (e) {
console.log(e);
return;
}

console.log('Project created id: ', responseProject.project.uid, ', API Key: ', responseProject.token);
console.log(
'Project created id: ',
responseProject.project.uid,
', API Key: ',
responseProject.token,
);
}

main().then(() => process.exit());
53 changes: 27 additions & 26 deletions packages/sdk/examples/create_space.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,32 @@ import { address } from './utils/secret';
import { walletSign } from './utils/utils';

async function main() {
const origin = Build5.TEST;
let response: Space;
const userSign = await walletSign(address.bech32, address);
try {
response = await https(origin).project(API_KEY[origin])
.dataset(Dataset.SPACE)
.create({
address: address.bech32,
signature: userSign.signature,
publicKey: {
hex: userSign.publicKey,
network: Network.RMS,
},
// Use SOONAVERSE TEST - wen.soonaverse.com
projectApiKey: API_KEY[origin],
body: {
name: 'TanKRURK',
},
const origin = Build5.TEST;
let response: Space;
const userSign = await walletSign(address.bech32, address);
try {
response = await https(origin)
.project(API_KEY[origin])
.dataset(Dataset.SPACE)
.create({
address: address.bech32,
signature: userSign.signature,
publicKey: {
hex: userSign.publicKey,
network: Network.RMS,
},
// Use SOONAVERSE TEST - wen.soonaverse.com
projectApiKey: API_KEY[origin],
body: {
name: 'TanKRURK',
},
});
} catch (e) {
console.log(e);
return;
}

console.log(response);
} catch (e) {
console.log(e);
return;
}

main().then(() => process.exit());

console.log(response);
}

main().then(() => process.exit());
13 changes: 6 additions & 7 deletions packages/sdk/examples/member/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ import { address } from '../utils/secret';

async function main() {
const origin = Build5.TEST;
const response = await https(origin)
.createMember({
const response = await https(origin).createMember({
address: address.bech32,
signature: '',
body: {
address: address.bech32,
signature: '',
body: {
address: address.bech32,
},
});
},
});

console.log('Member uid: ', response.uid);
}
Expand Down
11 changes: 8 additions & 3 deletions packages/sdk/examples/member/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@ import { walletSign } from '../utils/utils';

async function main() {
const origin = Build5.TEST;
const member = await https(origin).project(API_KEY[Build5.TEST]).dataset(Dataset.MEMBER).id(address.bech32).get();

const member = await https(origin)
.project(API_KEY[Build5.TEST])
.dataset(Dataset.MEMBER)
.id(address.bech32)
.get();

const name = Math.random().toString().split('.')[1];
const signature = await walletSign(member.uid, address);
const response = await https(origin).project(API_KEY[Build5.TEST])
const response = await https(origin)
.project(API_KEY[Build5.TEST])
.dataset(Dataset.MEMBER)
.update({
address: address.bech32,
Expand Down
Loading

0 comments on commit a41f080

Please sign in to comment.