Skip to content

Commit

Permalink
update for readme
Browse files Browse the repository at this point in the history
  • Loading branch information
spacehaz committed Dec 18, 2024
1 parent e3c30c9 commit 49276ca
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -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
})
```

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": [
Expand Down
4 changes: 4 additions & 0 deletions src/modules/claim-link/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
1 change: 1 addition & 0 deletions src/texts/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 49276ca

Please sign in to comment.