Skip to content

Commit

Permalink
feat: add unsubscription type
Browse files Browse the repository at this point in the history
  • Loading branch information
wa0x6e committed Nov 12, 2024
1 parent 977a8c5 commit 071172e
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 6 deletions.
9 changes: 4 additions & 5 deletions scripts/generateHashWithTypes.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
const { createHash } = require('crypto');

const types = {
Statement: [
Unsubscription: [
{ name: 'from', type: 'address' },
{ name: 'timestamp', type: 'uint64' },
{ name: 'space', type: 'string' },
{ name: 'about', type: 'string' },
{ name: 'statement', type: 'string' }
{ name: 'type', type: 'string' },
{ name: 'value', type: 'string' },
{ name: 'timestamp', type: 'uint64' }
]
};
function sha256(str) {
Expand Down
23 changes: 23 additions & 0 deletions src/schemas/unsubscription.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$ref": "#/definitions/Unsubscription",
"definitions": {
"Unsubscription": {
"title": "Unsubscription",
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": ["email"]
},
"value": {
"type": "string",
"title": "value",
"maxLength": 256
}
},
"required": ["type", "value"],
"additionalProperties": false
}
}
}
3 changes: 2 additions & 1 deletion src/sign/hashedTypes.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,6 @@
"4288d50b713081aae77d60d596d75864bff7acf7791a00183401e58658ee9da5": "statement",
"d56782e3b50ac86c25ae292923da8c367e3c9e8e7ea9d8baa435051fe2f430fa": "proposal",
"df10a7eeabe19301d6018be8b6c5d13231320d7ece64d021043fa172b64f3796": "update-proposal",
"499ff7269df478dede66b3c0b96a0b90286c479b4013b423ac7cf8628a94e6db": "subscription"
"499ff7269df478dede66b3c0b96a0b90286c479b4013b423ac7cf8628a94e6db": "subscription",
"07332dd26824595cc95dcb5c2f13173c57c23944b328220ce46de163f0e94191": "unsubscription"
}
9 changes: 9 additions & 0 deletions src/sign/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -355,3 +355,12 @@ export const subscriptionTypes = {
{ name: 'timestamp', type: 'uint64' }
]
};

export const unsubscriptionTypes = {
Unsubscription: [
{ name: 'from', type: 'address' },
{ name: 'type', type: 'string' },
{ name: 'value', type: 'string' },
{ name: 'timestamp', type: 'uint64' }
]
};

0 comments on commit 071172e

Please sign in to comment.