Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
181 changes: 133 additions & 48 deletions cdm.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,39 @@
},
"contracts": {
"@w3s/playground-registry": {
"version": 7,
"address": "0xeB814656e2466b5A8e613F8121D57c75F684A35D",
"version": 11,
"address": "0xBa606EC33a32B51DeDe246372975a956f1A3f9D7",
"abi": [
{
"type": "constructor",
"inputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "spikeVerify",
"inputs": [
{
"name": "signature",
"type": "uint8[]"
},
{
"name": "message",
"type": "uint8[]"
},
{
"name": "public_key",
"type": "bytes32"
}
],
"outputs": [
{
"name": "",
"type": "bool"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "publish",
Expand Down Expand Up @@ -59,6 +84,48 @@
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "publishDev",
"inputs": [
{
"name": "domain",
"type": "string"
},
{
"name": "metadata_uri",
"type": "string"
},
{
"name": "visibility",
"type": "uint8"
},
{
"name": "owner",
"type": "tuple",
"components": [
{
"name": "isSome",
"type": "bool"
},
{
"name": "value",
"type": "address"
}
]
},
{
"name": "modded_from",
"type": "string"
},
{
"name": "is_moddable",
"type": "bool"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "unpublish",
Expand Down Expand Up @@ -119,18 +186,6 @@
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "unstar",
"inputs": [
{
"name": "domain",
"type": "string"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "getContextId",
Expand Down Expand Up @@ -283,6 +338,42 @@
],
"stateMutability": "view"
},
{
"type": "function",
"name": "adminSetDeployAwardCount",
"inputs": [
{
"name": "account",
"type": "address"
},
{
"name": "count",
"type": "uint32"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "adminSetAppSocialCounts",
"inputs": [
{
"name": "domain",
"type": "string"
},
{
"name": "star_count",
"type": "uint32"
},
{
"name": "mod_count",
"type": "uint32"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "setBlacklisted",
Expand Down Expand Up @@ -1021,7 +1112,7 @@
},
{
"type": "function",
"name": "importUsernames",
"name": "importIdentities",
"inputs": [
{
"name": "entries",
Expand All @@ -1032,8 +1123,8 @@
"type": "address"
},
{
"name": "name",
"type": "string"
"name": "root_pubkey",
"type": "bytes32"
}
]
}
Expand All @@ -1043,26 +1134,30 @@
},
{
"type": "function",
"name": "setUsername",
"name": "setIdentity",
"inputs": [
{
"name": "name",
"type": "string"
"name": "root_pubkey",
"type": "bytes32"
},
{
"name": "signature",
"type": "uint8[]"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "clearUsername",
"name": "clearIdentity",
"inputs": [],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "getUsername",
"name": "getRootAccount",
"inputs": [
{
"name": "account",
Expand All @@ -1072,14 +1167,14 @@
"outputs": [
{
"name": "",
"type": "string"
"type": "bytes32"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "getUsernames",
"name": "getRootAccounts",
"inputs": [
{
"name": "accounts",
Expand All @@ -1089,51 +1184,41 @@
"outputs": [
{
"name": "",
"type": "string[]"
"type": "bytes32[]"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "getUsernameOwner",
"name": "adminSetIdentity",
"inputs": [
{
"name": "name",
"type": "string"
}
],
"outputs": [
{
"name": "",
"name": "account",
"type": "address"
},
{
"name": "root_pubkey",
"type": "bytes32"
}
],
"stateMutability": "view"
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "isUsernameAvailable",
"name": "adminClearIdentity",
"inputs": [
{
"name": "name",
"type": "string"
},
{
"name": "prospective_caller",
"name": "account",
"type": "address"
}
],
"outputs": [
{
"name": "",
"type": "bool"
}
],
"stateMutability": "view"
"outputs": [],
"stateMutability": "nonpayable"
}
],
"metadataCid": "bafk2bzaceavewu2aczp237db4dtzgej4tkjavhwfczp3jgaottwzzgpzuadry"
"metadataCid": "bafk2bzaceaanuqhbybkuhzk3de7pzv37g7mnvgj7inrpsisi3kxsg36xdh7f6"
}
}
}
20 changes: 13 additions & 7 deletions src/utils/deploy/playground.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const { captureWarningMock, withSpanMock, bulletinStorageSigner, getBulletinAllo
}));

// Mock the metadata upload path so we never actually touch the network.
// The mock returns a fake CID that publish() treats as the metadata CID.
// The mock returns a fake CID that registry publishing treats as the metadata CID.
vi.mock("@parity/product-sdk-cloud-storage", () => ({
calculateCid: vi.fn(async () => ({ toString: (): string => "bafymeta" })),
}));
Expand Down Expand Up @@ -62,12 +62,14 @@ vi.mock("polkadot-api/ws", () => ({
// Likewise stub the connection + registry helpers. We capture the publish
// arguments so we can assert on them.
const publishTx = vi.fn(async () => ({ ok: true, txHash: "0xdead" }));
const publishDevTx = vi.fn(async () => ({ ok: true, txHash: "0xfeed" }));
vi.mock("../connection.js", () => ({
getConnection: vi.fn(async () => ({ raw: { assetHub: {} } })),
}));
vi.mock("../registry.js", () => ({
getRegistryContract: vi.fn(async () => ({
publish: { tx: publishTx },
publishDev: { tx: publishDevTx },
})),
}));
vi.mock("../../telemetry.js", () => ({
Expand Down Expand Up @@ -103,6 +105,8 @@ const fakeSigner: ResolvedSigner = {
beforeEach(() => {
publishTx.mockClear();
publishTx.mockImplementation(async () => ({ ok: true, txHash: "0xdead" }));
publishDevTx.mockClear();
publishDevTx.mockImplementation(async () => ({ ok: true, txHash: "0xfeed" }));
captureWarningMock.mockClear();
withSpanMock.mockClear();
getBulletinAllowanceSignerMock.mockClear();
Expand Down Expand Up @@ -518,6 +522,7 @@ describe("publishToPlayground", () => {
false,
false,
);
expect(publishDevTx).not.toHaveBeenCalled();
} finally {
rmSync(dir, { recursive: true, force: true });
}
Expand Down Expand Up @@ -579,15 +584,17 @@ describe("publishToPlayground", () => {
}
});

it("passes claimedOwnerH160 through as the registry.publish owner argument", async () => {
it("passes claimedOwnerH160 through as the registry.publishDev owner argument", async () => {
await publishToPlayground({
domain: "claimed-app",
publishSigner: fakeSigner,
repositoryUrl: null,
cwd: "/definitely/not/a/repo",
claimedOwnerH160: "0x1234567890abcdef1234567890abcdef12345678",
isDevSigner: true,
});
expect(publishTx).toHaveBeenCalledWith(
expect(publishTx).not.toHaveBeenCalled();
expect(publishDevTx).toHaveBeenCalledWith(
"claimed-app.dot",
"bafymeta",
1,
Expand All @@ -597,7 +604,6 @@ describe("publishToPlayground", () => {
},
"",
false,
false,
);
});

Expand All @@ -623,7 +629,7 @@ describe("publishToPlayground", () => {
);
});

it("forwards isModdable and isDevSigner to registry.publish", async () => {
it("routes dev signer publishes through registry.publishDev", async () => {
await publishToPlayground({
domain: "modded-by-dev",
publishSigner: fakeSigner,
Expand All @@ -632,7 +638,8 @@ describe("publishToPlayground", () => {
isModdable: true,
isDevSigner: true,
});
expect(publishTx).toHaveBeenCalledWith(
expect(publishTx).not.toHaveBeenCalled();
expect(publishDevTx).toHaveBeenCalledWith(
"modded-by-dev.dot",
"bafymeta",
1,
Expand All @@ -642,7 +649,6 @@ describe("publishToPlayground", () => {
},
"",
true,
true,
);
});

Expand Down
Loading
Loading