Skip to content

Commit

Permalink
🐛 Move pin ability from registry to social
Browse files Browse the repository at this point in the history
  • Loading branch information
bal7hazar committed Jan 14, 2025
1 parent 0c75341 commit 31a924e
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 58 deletions.
44 changes: 12 additions & 32 deletions packages/sdk/src/provider/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,11 @@ import { AllowArray, Call } from "starknet";

export class Registry {
private manifest: any;
private name: string;

constructor(manifest: any) {
this.manifest = manifest;
}

public pin(props: SystemProps.RegistryPinProps): AllowArray<Call> {
const { achievementId } = props;
const entrypoint = "pin";

return {
contractAddress: getContractByName(this.manifest, `${NAMESPACE}-Registry`),
entrypoint,
calldata: [achievementId],
};
}

public unpin(props: SystemProps.RegistryUnpinProps): AllowArray<Call> {
const { achievementId } = props;
const entrypoint = "unpin";

return {
contractAddress: getContractByName(this.manifest, `${NAMESPACE}-Registry`),
entrypoint,
calldata: [achievementId],
};
this.name = `${NAMESPACE}-Registry`;
}

public register_game(props: SystemProps.RegistryRegisterGameProps): AllowArray<Call> {
Expand All @@ -57,7 +37,7 @@ export class Registry {
const entrypoint = "register_game";

return {
contractAddress: getContractByName(this.manifest, `${NAMESPACE}-Registry`),
contractAddress: getContractByName(this.manifest, this.name),
entrypoint,
calldata: [
worldAddress,
Expand Down Expand Up @@ -95,7 +75,7 @@ export class Registry {
const entrypoint = "update_game";

return {
contractAddress: getContractByName(this.manifest, `${NAMESPACE}-Registry`),
contractAddress: getContractByName(this.manifest, this.name),
entrypoint,
calldata: [
worldAddress,
Expand All @@ -119,7 +99,7 @@ export class Registry {
const entrypoint = "publish_game";

return {
contractAddress: getContractByName(this.manifest, `${NAMESPACE}-Registry`),
contractAddress: getContractByName(this.manifest, this.name),
entrypoint,
calldata: [worldAddress, namespace],
};
Expand All @@ -130,7 +110,7 @@ export class Registry {
const entrypoint = "hide_game";

return {
contractAddress: getContractByName(this.manifest, `${NAMESPACE}-Registry`),
contractAddress: getContractByName(this.manifest, this.name),
entrypoint,
calldata: [worldAddress, namespace],
};
Expand All @@ -141,7 +121,7 @@ export class Registry {
const entrypoint = "whitelist_game";

return {
contractAddress: getContractByName(this.manifest, `${NAMESPACE}-Registry`),
contractAddress: getContractByName(this.manifest, this.name),
entrypoint,
calldata: [worldAddress, namespace],
};
Expand All @@ -152,7 +132,7 @@ export class Registry {
const entrypoint = "blacklist_game";

return {
contractAddress: getContractByName(this.manifest, `${NAMESPACE}-Registry`),
contractAddress: getContractByName(this.manifest, this.name),
entrypoint,
calldata: [worldAddress, namespace],
};
Expand All @@ -163,7 +143,7 @@ export class Registry {
const entrypoint = "remove_game";

return {
contractAddress: getContractByName(this.manifest, `${NAMESPACE}-Registry`),
contractAddress: getContractByName(this.manifest, this.name),
entrypoint,
calldata: [worldAddress, namespace],
};
Expand All @@ -174,7 +154,7 @@ export class Registry {
const entrypoint = "register_achievement";

return {
contractAddress: getContractByName(this.manifest, `${NAMESPACE}-Registry`),
contractAddress: getContractByName(this.manifest, this.name),
entrypoint,
calldata: [worldAddress, namespace, identifier, karma],
};
Expand All @@ -185,7 +165,7 @@ export class Registry {
const entrypoint = "update_achievement";

return {
contractAddress: getContractByName(this.manifest, `${NAMESPACE}-Registry`),
contractAddress: getContractByName(this.manifest, this.name),
entrypoint,
calldata: [worldAddress, namespace, identifier, karma],
};
Expand All @@ -196,7 +176,7 @@ export class Registry {
const entrypoint = "remove_achievement";

return {
contractAddress: getContractByName(this.manifest, `${NAMESPACE}-Registry`),
contractAddress: getContractByName(this.manifest, this.name),
entrypoint,
calldata: [worldAddress, namespace, identifier],
};
Expand Down
10 changes: 6 additions & 4 deletions packages/sdk/src/provider/slot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,19 @@ import { AllowArray, Call } from "starknet";

export class Slot {
private manifest: any;
private name: string;

constructor(manifest: any) {
this.manifest = manifest;
this.name = `${NAMESPACE}-Slot`;
}

public deploy(props: SystemProps.SlotDeployProps): AllowArray<Call> {
const { service, project, tier } = props;
const entrypoint = "deploy";

return {
contractAddress: getContractByName(this.manifest, `${NAMESPACE}-Slot`),
contractAddress: getContractByName(this.manifest, this.name),
entrypoint,
calldata: [service, project, tier],
};
Expand All @@ -31,7 +33,7 @@ export class Slot {
const entrypoint = "remove";

return {
contractAddress: getContractByName(this.manifest, `${NAMESPACE}-Slot`),
contractAddress: getContractByName(this.manifest, this.name),
entrypoint,
calldata: [service, project],
};
Expand All @@ -42,7 +44,7 @@ export class Slot {
const entrypoint = "hire";

return {
contractAddress: getContractByName(this.manifest, `${NAMESPACE}-Slot`),
contractAddress: getContractByName(this.manifest, this.name),
entrypoint,
calldata: [project, accountId, role],
};
Expand All @@ -53,7 +55,7 @@ export class Slot {
const entrypoint = "fire";

return {
contractAddress: getContractByName(this.manifest, `${NAMESPACE}-Slot`),
contractAddress: getContractByName(this.manifest, this.name),
entrypoint,
calldata: [project, accountId],
};
Expand Down
Loading

0 comments on commit 31a924e

Please sign in to comment.