Skip to content

Commit f5843d1

Browse files
authored
Merge pull request #14 from numbersprotocol/feat-allow-custom-action
fix(nit.ts): allow custom commit message and custom action
2 parents d5654b2 + 24faa22 commit f5843d1

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/nit.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,11 +196,16 @@ export async function createAssetTreeInitialRegister(assetCid,
196196
return stagingAssetTree;
197197
}
198198

199-
export async function createCommitInitialRegister(signer, assetTree, authorAddress, providerCid) {
199+
export async function createCommitInitialRegister(signer,
200+
assetTree,
201+
authorAddress,
202+
providerCid,
203+
commitMessage="Action: action-initial-registration.",
204+
commitAction="action-initial-registration") {
200205
let stagingCommit = await createCommitBase(signer, assetTree, authorAddress, providerCid);
201-
stagingCommit.action = action.Actions["action-initial-registration-jade"];
206+
stagingCommit.action = action.Actions[commitAction];
202207
stagingCommit.actionResult = `https://${stagingCommit.assetTreeCid}.ipfs.dweb.link`;
203-
stagingCommit.abstract = "Action action-initial-registration.";
208+
stagingCommit.abstract = commitMessage;
204209
stagingCommit.timestampCreated = Math.floor(Date.now() / 1000);
205210
return stagingCommit;
206211
}
@@ -571,4 +576,4 @@ export async function verifyIntegrityHash(sha256sum: string, signature) {
571576

572577
export async function getIntegrityHash(assetBytes: BytesLike) {
573578
return await (ethers.utils.sha256(assetBytes)).substring(2);
574-
}
579+
}

0 commit comments

Comments
 (0)