From 49276caaeacfc8f464bb4773cd8ebd58c8a70bfe Mon Sep 17 00:00:00 2001 From: spacehaz Date: Wed, 18 Dec 2024 16:47:44 +0300 Subject: [PATCH] update for readme --- README.md | 3 ++- package.json | 2 +- src/modules/claim-link/index.ts | 4 ++++ src/texts/errors.ts | 1 + 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 641b941..7e28c63 100644 --- a/README.md +++ b/README.md @@ -287,6 +287,7 @@ const { #### Add message (method is available only for link creator) +You can add message before the deposit. The method will be locked after the deposit ```js const claimLink = await sdk.createClaimLink({ @@ -301,7 +302,7 @@ await claimLink.addMessage({ signTypedData, // optional params. By default is set to 12. Can be modified to any number between 6 and 43 - encryptionKey: 12 + encryptionKeyLength: 12 }) ``` diff --git a/package.json b/package.json index d1de9e6..0289a9b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "linkdrop-sdk", - "version": "3.14.0-alpha-rc.6", + "version": "3.14.0-alpha-rc.7", "main": "dist/index.js", "types": "dist/index.d.ts", "files": [ diff --git a/src/modules/claim-link/index.ts b/src/modules/claim-link/index.ts index 0ee818b..65d4d32 100644 --- a/src/modules/claim-link/index.ts +++ b/src/modules/claim-link/index.ts @@ -271,6 +271,10 @@ class ClaimLink implements IClaimLinkSDK { signTypedData, encryptionKeyLength = 12 }) => { + + if (this.deposited) { + throw new Error(errors.cannot_add_message_after_deposit()) + } if (message.length > configs.MAX_MESSAGE_TEXT_LENGTH) { throw new Error(errors.message_text_length_failed()) diff --git a/src/texts/errors.ts b/src/texts/errors.ts index 9669c7f..f7e55de 100644 --- a/src/texts/errors.ts +++ b/src/texts/errors.ts @@ -29,6 +29,7 @@ export default { 'at_least_one_argument_not_provided': (args: string[]) => `At least one of the following arguments should be provided: ${args.join(', ')}`, 'encryption_key_length_failed': () => `Length of the encryption key should be greater than or equal to ${MIN_MESSAGE_ENCRYPTION_KEY_LENGTH} and lower than or equal to ${MAX_MESSAGE_ENCRYPTION_KEY_LENGTH}`, 'message_text_length_failed': () => `Length of the message text should be lower than or equal to ${MAX_MESSAGE_TEXT_LENGTH}`, + 'cannot_add_message_after_deposit': () => 'Cannot add message after the deposit', 'variable_is_not_valid': ( variableName: string, expectedValueType: string,