@actioncodes/protocol 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/README.md +1 -1
  2. package/dist/actioncode.d.ts +13 -12
  3. package/dist/actioncode.d.ts.map +1 -1
  4. package/dist/actioncode.js +13 -5
  5. package/dist/adapters/base.d.ts +17 -0
  6. package/dist/adapters/base.d.ts.map +1 -1
  7. package/dist/adapters/base.js +11 -0
  8. package/dist/adapters/solana/solana.d.ts +2 -0
  9. package/dist/adapters/solana/solana.d.ts.map +1 -1
  10. package/dist/adapters/solana/solana.js +49 -2
  11. package/dist/codegen.d.ts +16 -13
  12. package/dist/codegen.d.ts.map +1 -1
  13. package/dist/codegen.js +47 -19
  14. package/dist/protocol.d.ts +14 -14
  15. package/dist/protocol.d.ts.map +1 -1
  16. package/dist/protocol.js +39 -30
  17. package/docs/README.md +1 -1
  18. package/docs/actioncode/classes/ActionCode.md +51 -65
  19. package/docs/actioncode/interfaces/ActionCodeFields.md +13 -19
  20. package/docs/actioncode/interfaces/ActionCodeMetadata.md +3 -3
  21. package/docs/actioncode/interfaces/ActionCodeTransaction.md +6 -12
  22. package/docs/actioncode/type-aliases/ActionCodeStatus.md +1 -1
  23. package/docs/adapters/base/classes/BaseChainAdapter.md +70 -8
  24. package/docs/adapters/solana/solana/classes/SolanaAdapter.md +80 -10
  25. package/docs/adapters/solana/solana/type-aliases/SolanaTransaction.md +1 -1
  26. package/docs/codegen/classes/CodeGenerator.md +65 -61
  27. package/docs/constants/type-aliases/SupportedChain.md +1 -1
  28. package/docs/constants/variables/CODE_LENGTH.md +1 -1
  29. package/docs/constants/variables/CODE_TTL.md +1 -1
  30. package/docs/constants/variables/MAX_PREFIX_LENGTH.md +1 -1
  31. package/docs/constants/variables/MIN_PREFIX_LENGTH.md +1 -1
  32. package/docs/constants/variables/PROTOCOL_CODE_PREFIX.md +1 -1
  33. package/docs/constants/variables/PROTOCOL_PREFIX.md +1 -1
  34. package/docs/constants/variables/PROTOCOL_VERSION.md +1 -1
  35. package/docs/constants/variables/SUPPORTED_CHAINS.md +1 -1
  36. package/docs/meta/classes/ProtocolMetaParser.md +6 -6
  37. package/docs/meta/interfaces/ProtocolMetaV1.md +7 -7
  38. package/docs/protocol/classes/ActionCodesProtocol.md +76 -76
  39. package/docs/protocol/interfaces/ProtocolConfig.md +7 -7
  40. package/package.json +2 -1
@@ -6,7 +6,7 @@
6
6
 
7
7
  # Class: SolanaAdapter
8
8
 
9
- Defined in: [adapters/solana/solana.ts:20](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/adapters/solana/solana.ts#L20)
9
+ Defined in: [adapters/solana/solana.ts:24](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/adapters/solana/solana.ts#L24)
10
10
 
11
11
  Simple Solana adapter for protocol meta operations
12
12
  Supports both legacy and versioned transactions
@@ -35,7 +35,7 @@ Supports both legacy and versioned transactions
35
35
 
36
36
  > `readonly` **chain**: `"solana"` = `'solana'`
37
37
 
38
- Defined in: [adapters/solana/solana.ts:23](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/adapters/solana/solana.ts#L23)
38
+ Defined in: [adapters/solana/solana.ts:27](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/adapters/solana/solana.ts#L27)
39
39
 
40
40
  #### Overrides
41
41
 
@@ -47,7 +47,7 @@ Defined in: [adapters/solana/solana.ts:23](https://github.com/otaprotocol/action
47
47
 
48
48
  > **decode**(`tx`): `null` \| [`ProtocolMetaV1`](../../../../meta/interfaces/ProtocolMetaV1.md)
49
49
 
50
- Defined in: [adapters/solana/solana.ts:40](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/adapters/solana/solana.ts#L40)
50
+ Defined in: [adapters/solana/solana.ts:44](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/adapters/solana/solana.ts#L44)
51
51
 
52
52
  Decode protocol meta from Solana transaction (legacy or versioned)
53
53
 
@@ -75,7 +75,7 @@ Decoded ProtocolMetaV1 or null if not found
75
75
 
76
76
  > **decodeFromBase64**(`base64String`): `null` \| [`ProtocolMetaV1`](../../../../meta/interfaces/ProtocolMetaV1.md)
77
77
 
78
- Defined in: [adapters/solana/solana.ts:201](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/adapters/solana/solana.ts#L201)
78
+ Defined in: [adapters/solana/solana.ts:205](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/adapters/solana/solana.ts#L205)
79
79
 
80
80
  Decode protocol meta from base64 string (for backward compatibility)
81
81
 
@@ -99,7 +99,7 @@ Decoded ProtocolMetaV1 or null
99
99
 
100
100
  > **detectTampering**(`tx`, `authorities`, `expectedPrefix`): `boolean`
101
101
 
102
- Defined in: [adapters/base.ts:48](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/adapters/base.ts#L48)
102
+ Defined in: [adapters/base.ts:50](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/adapters/base.ts#L50)
103
103
 
104
104
  Detect tampered transactions by cross-checking metadata
105
105
 
@@ -139,7 +139,7 @@ True if transaction is valid and not tampered
139
139
 
140
140
  > **encode**(`meta`): `TransactionInstruction`
141
141
 
142
- Defined in: [adapters/solana/solana.ts:30](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/adapters/solana/solana.ts#L30)
142
+ Defined in: [adapters/solana/solana.ts:34](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/adapters/solana/solana.ts#L34)
143
143
 
144
144
  Encode protocol meta as a Solana memo instruction
145
145
 
@@ -163,11 +163,51 @@ TransactionInstruction for the memo
163
163
 
164
164
  ***
165
165
 
166
+ ### getCodeSignatureMessage()
167
+
168
+ > **getCodeSignatureMessage**(`code`, `timestamp`, `prefix`): `string`
169
+
170
+ Defined in: [adapters/base.ts:96](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/adapters/base.ts#L96)
171
+
172
+ Get the code signature message
173
+
174
+ #### Parameters
175
+
176
+ ##### code
177
+
178
+ `string`
179
+
180
+ The code to sign
181
+
182
+ ##### timestamp
183
+
184
+ `number`
185
+
186
+ The timestamp of the code
187
+
188
+ ##### prefix
189
+
190
+ `string` = `PROTOCOL_CODE_PREFIX`
191
+
192
+ The prefix of the code
193
+
194
+ #### Returns
195
+
196
+ `string`
197
+
198
+ The code signature message
199
+
200
+ #### Inherited from
201
+
202
+ [`BaseChainAdapter`](../../../base/classes/BaseChainAdapter.md).[`getCodeSignatureMessage`](../../../base/classes/BaseChainAdapter.md#getcodesignaturemessage)
203
+
204
+ ***
205
+
166
206
  ### hasIssuerSignature()
167
207
 
168
208
  > **hasIssuerSignature**(`tx`, `issuer`): `boolean`
169
209
 
170
- Defined in: [adapters/solana/solana.ts:68](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/adapters/solana/solana.ts#L68)
210
+ Defined in: [adapters/solana/solana.ts:72](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/adapters/solana/solana.ts#L72)
171
211
 
172
212
  Check if the issuer has signed the transaction
173
213
 
@@ -201,7 +241,7 @@ True if issuer has signed
201
241
 
202
242
  > **validate**(`tx`, `authorities`, `expectedPrefix`): `boolean`
203
243
 
204
- Defined in: [adapters/solana/solana.ts:58](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/adapters/solana/solana.ts#L58)
244
+ Defined in: [adapters/solana/solana.ts:62](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/adapters/solana/solana.ts#L62)
205
245
 
206
246
  Validate transaction with protocol meta and authority list
207
247
 
@@ -241,7 +281,7 @@ True if transaction is valid
241
281
 
242
282
  > **validateFromBase64**(`base64String`, `authorities`, `expectedPrefix`): `boolean`
243
283
 
244
- Defined in: [adapters/solana/solana.ts:224](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/adapters/solana/solana.ts#L224)
284
+ Defined in: [adapters/solana/solana.ts:228](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/adapters/solana/solana.ts#L228)
245
285
 
246
286
  Validate base64 transaction (for backward compatibility)
247
287
 
@@ -277,7 +317,7 @@ True if transaction is valid
277
317
 
278
318
  > `protected` **validateTransactionIntegrity**(`tx`, `meta`): `boolean`
279
319
 
280
- Defined in: [adapters/solana/solana.ts:175](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/adapters/solana/solana.ts#L175)
320
+ Defined in: [adapters/solana/solana.ts:179](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/adapters/solana/solana.ts#L179)
281
321
 
282
322
  Validate Solana transaction integrity with additional checks
283
323
 
@@ -304,3 +344,33 @@ True if transaction integrity is valid
304
344
  #### Overrides
305
345
 
306
346
  [`BaseChainAdapter`](../../../base/classes/BaseChainAdapter.md).[`validateTransactionIntegrity`](../../../base/classes/BaseChainAdapter.md#validatetransactionintegrity)
347
+
348
+ ***
349
+
350
+ ### verifyCodeSignature()
351
+
352
+ > **verifyCodeSignature**(`actionCode`): `boolean`
353
+
354
+ Defined in: [adapters/solana/solana.ts:245](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/adapters/solana/solana.ts#L245)
355
+
356
+ Verify the code signature
357
+ This is specific to the chain and should be implemented by the concrete adapter
358
+ It will be used to verify the code signature for the action code if the right wallet is used to sign the code
359
+
360
+ #### Parameters
361
+
362
+ ##### actionCode
363
+
364
+ [`ActionCode`](../../../../actioncode/classes/ActionCode.md)
365
+
366
+ The action code to verify
367
+
368
+ #### Returns
369
+
370
+ `boolean`
371
+
372
+ True if the code signature is valid
373
+
374
+ #### Overrides
375
+
376
+ [`BaseChainAdapter`](../../../base/classes/BaseChainAdapter.md).[`verifyCodeSignature`](../../../base/classes/BaseChainAdapter.md#verifycodesignature)
@@ -8,6 +8,6 @@
8
8
 
9
9
  > **SolanaTransaction** = `Transaction` \| `VersionedTransaction`
10
10
 
11
- Defined in: [adapters/solana/solana.ts:14](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/adapters/solana/solana.ts#L14)
11
+ Defined in: [adapters/solana/solana.ts:18](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/adapters/solana/solana.ts#L18)
12
12
 
13
13
  Solana transaction type union
@@ -6,7 +6,7 @@
6
6
 
7
7
  # Class: CodeGenerator
8
8
 
9
- Defined in: [codegen.ts:4](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/codegen.ts#L4)
9
+ Defined in: [codegen.ts:4](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/codegen.ts#L4)
10
10
 
11
11
  ## Constructors
12
12
 
@@ -24,7 +24,7 @@ Defined in: [codegen.ts:4](https://github.com/otaprotocol/actioncodes/blob/b4bc0
24
24
 
25
25
  > `static` **CODE\_DIGITS**: `number` = `CODE_LENGTH`
26
26
 
27
- Defined in: [codegen.ts:6](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/codegen.ts#L6)
27
+ Defined in: [codegen.ts:6](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/codegen.ts#L6)
28
28
 
29
29
  ***
30
30
 
@@ -32,7 +32,7 @@ Defined in: [codegen.ts:6](https://github.com/otaprotocol/actioncodes/blob/b4bc0
32
32
 
33
33
  > `static` **MAX\_PREFIX\_LENGTH**: `number`
34
34
 
35
- Defined in: [codegen.ts:8](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/codegen.ts#L8)
35
+ Defined in: [codegen.ts:8](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/codegen.ts#L8)
36
36
 
37
37
  ***
38
38
 
@@ -40,7 +40,7 @@ Defined in: [codegen.ts:8](https://github.com/otaprotocol/actioncodes/blob/b4bc0
40
40
 
41
41
  > `static` **MIN\_PREFIX\_LENGTH**: `number`
42
42
 
43
- Defined in: [codegen.ts:7](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/codegen.ts#L7)
43
+ Defined in: [codegen.ts:7](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/codegen.ts#L7)
44
44
 
45
45
  ***
46
46
 
@@ -48,7 +48,7 @@ Defined in: [codegen.ts:7](https://github.com/otaprotocol/actioncodes/blob/b4bc0
48
48
 
49
49
  > `static` **TIME\_WINDOW\_MS**: `number` = `CODE_TTL`
50
50
 
51
- Defined in: [codegen.ts:5](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/codegen.ts#L5)
51
+ Defined in: [codegen.ts:5](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/codegen.ts#L5)
52
52
 
53
53
  ## Methods
54
54
 
@@ -56,7 +56,7 @@ Defined in: [codegen.ts:5](https://github.com/otaprotocol/actioncodes/blob/b4bc0
56
56
 
57
57
  > `static` **deriveCodeHash**(`pubkey`, `prefix`, `timestamp?`): `string`
58
58
 
59
- Defined in: [codegen.ts:74](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/codegen.ts#L74)
59
+ Defined in: [codegen.ts:106](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/codegen.ts#L106)
60
60
 
61
61
  Derive the full SHA-256 hash for storage or encryption key generation
62
62
 
@@ -90,9 +90,9 @@ Full SHA-256 hash string
90
90
 
91
91
  ### generateCode()
92
92
 
93
- > `static` **generateCode**(`pubkey`, `signature`, `prefix`, `timestamp`): `object`
93
+ > `static` **generateCode**(`pubkey`, `prefix`, `timestamp`): `object`
94
94
 
95
- Defined in: [codegen.ts:43](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/codegen.ts#L43)
95
+ Defined in: [codegen.ts:65](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/codegen.ts#L65)
96
96
 
97
97
  Generate a deterministic 8-digit code based on public key, prefix, and timestamp
98
98
 
@@ -104,12 +104,6 @@ Generate a deterministic 8-digit code based on public key, prefix, and timestamp
104
104
 
105
105
  Solana wallet public key (base58)
106
106
 
107
- ##### signature
108
-
109
- `string`
110
-
111
- User's signature string
112
-
113
107
  ##### prefix
114
108
 
115
109
  `string` = `"DEFAULT"`
@@ -140,43 +134,17 @@ Object containing code, issuedAt, and expiresAt timestamps
140
134
 
141
135
  > **issuedAt**: `number`
142
136
 
143
- ***
144
-
145
- ### generateCodeSignatureMessage()
146
-
147
- > `static` **generateCodeSignatureMessage**(`code`, `timestamp`): `string`
148
-
149
- Defined in: [codegen.ts:92](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/codegen.ts#L92)
150
-
151
- Generate the message that should be signed for code verification
152
-
153
- #### Parameters
154
-
155
- ##### code
156
-
157
- `string`
158
-
159
- The generated 8-digit code
160
-
161
- ##### timestamp
162
-
163
- `number`
164
-
165
- UNIX timestamp in milliseconds
166
-
167
- #### Returns
168
-
169
- `string`
137
+ #### Throws
170
138
 
171
- Message string in format "actioncodes:<code>:<timestamp>"
139
+ Error if generated code is invalid
172
140
 
173
141
  ***
174
142
 
175
143
  ### getExpectedCode()
176
144
 
177
- > `static` **getExpectedCode**(`pubkey`, `timestamp`, `signature`, `prefix`): `string`
145
+ > `static` **getExpectedCode**(`pubkey`, `timestamp`, `prefix`): `string`
178
146
 
179
- Defined in: [codegen.ts:104](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/codegen.ts#L104)
147
+ Defined in: [codegen.ts:125](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/codegen.ts#L125)
180
148
 
181
149
  Get the expected code for a given public key and timestamp
182
150
 
@@ -194,12 +162,6 @@ Solana wallet public key (base58)
194
162
 
195
163
  UNIX timestamp in milliseconds
196
164
 
197
- ##### signature
198
-
199
- `string`
200
-
201
- User's signature string
202
-
203
165
  ##### prefix
204
166
 
205
167
  `string` = `"DEFAULT"`
@@ -218,7 +180,7 @@ Optional namespace prefix (default: "DEFAULT")
218
180
 
219
181
  > `static` **isValidTimestamp**(`timestamp`): `boolean`
220
182
 
221
- Defined in: [codegen.ts:140](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/codegen.ts#L140)
183
+ Defined in: [codegen.ts:167](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/codegen.ts#L167)
222
184
 
223
185
  Check if a timestamp falls within a valid time window
224
186
 
@@ -242,7 +204,7 @@ True if timestamp is valid
242
204
 
243
205
  > `static` **normalizePrefix**(`prefix`): `string`
244
206
 
245
- Defined in: [codegen.ts:27](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/codegen.ts#L27)
207
+ Defined in: [codegen.ts:49](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/codegen.ts#L49)
246
208
 
247
209
  Normalize prefix - convert "DEFAULT" to empty string, validate others
248
210
 
@@ -268,9 +230,9 @@ Error if prefix is invalid
268
230
 
269
231
  ### validateCode()
270
232
 
271
- > `static` **validateCode**(`code`, `pubkey`, `timestamp`, `signature`, `prefix`): `boolean`
233
+ > `static` **validateCode**(`code`, `pubkey`, `timestamp`, `prefix`): `boolean`
272
234
 
273
- Defined in: [codegen.ts:122](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/codegen.ts#L122)
235
+ Defined in: [codegen.ts:141](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/codegen.ts#L141)
274
236
 
275
237
  Validate if a code matches the expected code for a given public key and timestamp
276
238
 
@@ -294,12 +256,6 @@ Solana wallet public key (base58)
294
256
 
295
257
  UNIX timestamp in milliseconds
296
258
 
297
- ##### signature
298
-
299
- `string`
300
-
301
- User's signature string
302
-
303
259
  ##### prefix
304
260
 
305
261
  `string` = `"DEFAULT"`
@@ -314,11 +270,59 @@ True if code matches expected code and timestamp is valid
314
270
 
315
271
  ***
316
272
 
273
+ ### validateCodeDigits()
274
+
275
+ > `static` **validateCodeDigits**(`code`): `boolean`
276
+
277
+ Defined in: [codegen.ts:37](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/codegen.ts#L37)
278
+
279
+ Validate that a code without prefix is exactly 8 digits and only numbers
280
+
281
+ #### Parameters
282
+
283
+ ##### code
284
+
285
+ `string`
286
+
287
+ The code to validate
288
+
289
+ #### Returns
290
+
291
+ `boolean`
292
+
293
+ True if code is valid, false otherwise
294
+
295
+ ***
296
+
297
+ ### validateCodeFormat()
298
+
299
+ > `static` **validateCodeFormat**(`code`): `boolean`
300
+
301
+ Defined in: [codegen.ts:26](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/codegen.ts#L26)
302
+
303
+ Validate generated code format
304
+
305
+ #### Parameters
306
+
307
+ ##### code
308
+
309
+ `string`
310
+
311
+ The code to validate
312
+
313
+ #### Returns
314
+
315
+ `boolean`
316
+
317
+ True if code is valid, false otherwise
318
+
319
+ ***
320
+
317
321
  ### validatePrefix()
318
322
 
319
323
  > `static` **validatePrefix**(`prefix`): `boolean`
320
324
 
321
- Defined in: [codegen.ts:15](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/codegen.ts#L15)
325
+ Defined in: [codegen.ts:15](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/codegen.ts#L15)
322
326
 
323
327
  Validate prefix format
324
328
 
@@ -8,4 +8,4 @@
8
8
 
9
9
  > **SupportedChain** = *typeof* [`SUPPORTED_CHAINS`](../variables/SUPPORTED_CHAINS.md)\[`number`\]
10
10
 
11
- Defined in: [constants.ts:9](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/constants.ts#L9)
11
+ Defined in: [constants.ts:9](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/constants.ts#L9)
@@ -8,4 +8,4 @@
8
8
 
9
9
  > `const` **CODE\_LENGTH**: `8` = `8`
10
10
 
11
- Defined in: [constants.ts:3](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/constants.ts#L3)
11
+ Defined in: [constants.ts:3](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/constants.ts#L3)
@@ -8,4 +8,4 @@
8
8
 
9
9
  > `const` **CODE\_TTL**: `number`
10
10
 
11
- Defined in: [constants.ts:4](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/constants.ts#L4)
11
+ Defined in: [constants.ts:4](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/constants.ts#L4)
@@ -8,4 +8,4 @@
8
8
 
9
9
  > `const` **MAX\_PREFIX\_LENGTH**: `12` = `12`
10
10
 
11
- Defined in: [constants.ts:7](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/constants.ts#L7)
11
+ Defined in: [constants.ts:7](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/constants.ts#L7)
@@ -8,4 +8,4 @@
8
8
 
9
9
  > `const` **MIN\_PREFIX\_LENGTH**: `3` = `3`
10
10
 
11
- Defined in: [constants.ts:6](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/constants.ts#L6)
11
+ Defined in: [constants.ts:6](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/constants.ts#L6)
@@ -8,4 +8,4 @@
8
8
 
9
9
  > `const` **PROTOCOL\_CODE\_PREFIX**: `"DEFAULT"` = `"DEFAULT"`
10
10
 
11
- Defined in: [constants.ts:5](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/constants.ts#L5)
11
+ Defined in: [constants.ts:5](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/constants.ts#L5)
@@ -8,4 +8,4 @@
8
8
 
9
9
  > `const` **PROTOCOL\_PREFIX**: `"actioncodes"` = `"actioncodes"`
10
10
 
11
- Defined in: [constants.ts:2](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/constants.ts#L2)
11
+ Defined in: [constants.ts:2](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/constants.ts#L2)
@@ -8,4 +8,4 @@
8
8
 
9
9
  > `const` **PROTOCOL\_VERSION**: `"1"` = `"1"`
10
10
 
11
- Defined in: [constants.ts:1](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/constants.ts#L1)
11
+ Defined in: [constants.ts:1](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/constants.ts#L1)
@@ -8,4 +8,4 @@
8
8
 
9
9
  > `const` **SUPPORTED\_CHAINS**: readonly \[`"solana"`\]
10
10
 
11
- Defined in: [constants.ts:8](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/constants.ts#L8)
11
+ Defined in: [constants.ts:8](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/constants.ts#L8)
@@ -6,7 +6,7 @@
6
6
 
7
7
  # Class: ProtocolMetaParser
8
8
 
9
- Defined in: [meta.ts:19](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/meta.ts#L19)
9
+ Defined in: [meta.ts:19](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/meta.ts#L19)
10
10
 
11
11
  Protocol meta parser for structured memo/message parsing
12
12
 
@@ -26,7 +26,7 @@ Protocol meta parser for structured memo/message parsing
26
26
 
27
27
  > `static` **fromInitiator**(`initiator`, `iss`, `prefix`, `params?`, `timestamp?`): [`ProtocolMetaV1`](../interfaces/ProtocolMetaV1.md)
28
28
 
29
- Defined in: [meta.ts:74](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/meta.ts#L74)
29
+ Defined in: [meta.ts:74](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/meta.ts#L74)
30
30
 
31
31
  Create protocol meta from code and parameters
32
32
 
@@ -74,7 +74,7 @@ ProtocolMeta object
74
74
 
75
75
  > `static` **parse**(`metaString`): `null` \| [`ProtocolMetaV1`](../interfaces/ProtocolMetaV1.md)
76
76
 
77
- Defined in: [meta.ts:27](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/meta.ts#L27)
77
+ Defined in: [meta.ts:27](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/meta.ts#L27)
78
78
 
79
79
  Parse protocol meta from string
80
80
 
@@ -98,7 +98,7 @@ Parsed ProtocolMeta object or null if invalid
98
98
 
99
99
  > `static` **serialize**(`meta`): `string`
100
100
 
101
- Defined in: [meta.ts:55](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/meta.ts#L55)
101
+ Defined in: [meta.ts:55](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/meta.ts#L55)
102
102
 
103
103
  Serialize ProtocolMeta to string
104
104
 
@@ -122,7 +122,7 @@ Serialized protocol meta string
122
122
 
123
123
  > `static` **validateCode**(`meta`, `timestamp?`): `boolean`
124
124
 
125
- Defined in: [meta.ts:99](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/meta.ts#L99)
125
+ Defined in: [meta.ts:99](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/meta.ts#L99)
126
126
 
127
127
  Validate if a code matches the protocol meta
128
128
 
@@ -152,7 +152,7 @@ True if the meta is valid
152
152
 
153
153
  > `static` **validateMetaFromString**(`metaString`, `timestamp?`): `boolean`
154
154
 
155
- Defined in: [meta.ts:110](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/meta.ts#L110)
155
+ Defined in: [meta.ts:110](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/meta.ts#L110)
156
156
 
157
157
  Validate if a code matches the protocol meta by parsing from string
158
158
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  # Interface: ProtocolMetaV1
8
8
 
9
- Defined in: [meta.ts:7](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/meta.ts#L7)
9
+ Defined in: [meta.ts:7](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/meta.ts#L7)
10
10
 
11
11
  Protocol meta structure for code verification
12
12
 
@@ -16,7 +16,7 @@ Protocol meta structure for code verification
16
16
 
17
17
  > **id**: `string`
18
18
 
19
- Defined in: [meta.ts:11](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/meta.ts#L11)
19
+ Defined in: [meta.ts:11](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/meta.ts#L11)
20
20
 
21
21
  ***
22
22
 
@@ -24,7 +24,7 @@ Defined in: [meta.ts:11](https://github.com/otaprotocol/actioncodes/blob/b4bc06f
24
24
 
25
25
  > **initiator**: `string`
26
26
 
27
- Defined in: [meta.ts:10](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/meta.ts#L10)
27
+ Defined in: [meta.ts:10](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/meta.ts#L10)
28
28
 
29
29
  ***
30
30
 
@@ -32,7 +32,7 @@ Defined in: [meta.ts:10](https://github.com/otaprotocol/actioncodes/blob/b4bc06f
32
32
 
33
33
  > `optional` **iss**: `string`
34
34
 
35
- Defined in: [meta.ts:12](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/meta.ts#L12)
35
+ Defined in: [meta.ts:12](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/meta.ts#L12)
36
36
 
37
37
  ***
38
38
 
@@ -40,7 +40,7 @@ Defined in: [meta.ts:12](https://github.com/otaprotocol/actioncodes/blob/b4bc06f
40
40
 
41
41
  > `optional` **params**: `string`
42
42
 
43
- Defined in: [meta.ts:13](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/meta.ts#L13)
43
+ Defined in: [meta.ts:13](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/meta.ts#L13)
44
44
 
45
45
  ***
46
46
 
@@ -48,7 +48,7 @@ Defined in: [meta.ts:13](https://github.com/otaprotocol/actioncodes/blob/b4bc06f
48
48
 
49
49
  > **prefix**: `string`
50
50
 
51
- Defined in: [meta.ts:9](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/meta.ts#L9)
51
+ Defined in: [meta.ts:9](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/meta.ts#L9)
52
52
 
53
53
  ***
54
54
 
@@ -56,4 +56,4 @@ Defined in: [meta.ts:9](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6
56
56
 
57
57
  > **version**: `string`
58
58
 
59
- Defined in: [meta.ts:8](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/meta.ts#L8)
59
+ Defined in: [meta.ts:8](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/meta.ts#L8)