@actioncodes/protocol 1.1.0 → 1.1.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.
- package/dist/adapters/base.d.ts +9 -2
- package/dist/adapters/base.d.ts.map +1 -1
- package/dist/adapters/base.js +1 -1
- package/dist/adapters/solana/solana.d.ts +23 -17
- package/dist/adapters/solana/solana.d.ts.map +1 -1
- package/dist/adapters/solana/solana.js +153 -69
- package/dist/protocol.d.ts +9 -6
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +32 -11
- package/docs/actioncode/classes/ActionCode.md +23 -23
- package/docs/actioncode/interfaces/ActionCodeFields.md +11 -11
- package/docs/actioncode/interfaces/ActionCodeMetadata.md +3 -3
- package/docs/actioncode/interfaces/ActionCodeTransaction.md +4 -4
- package/docs/actioncode/type-aliases/ActionCodeStatus.md +1 -1
- package/docs/adapters/base/classes/BaseChainAdapter.md +45 -15
- package/docs/adapters/solana/solana/classes/SolanaAdapter.md +88 -62
- package/docs/adapters/solana/solana/type-aliases/SolanaTransaction.md +1 -1
- package/docs/codegen/classes/CodeGenerator.md +14 -14
- package/docs/constants/type-aliases/SupportedChain.md +1 -1
- package/docs/constants/variables/CODE_LENGTH.md +1 -1
- package/docs/constants/variables/CODE_TTL.md +1 -1
- package/docs/constants/variables/MAX_PREFIX_LENGTH.md +1 -1
- package/docs/constants/variables/MIN_PREFIX_LENGTH.md +1 -1
- package/docs/constants/variables/PROTOCOL_CODE_PREFIX.md +1 -1
- package/docs/constants/variables/PROTOCOL_PREFIX.md +1 -1
- package/docs/constants/variables/PROTOCOL_VERSION.md +1 -1
- package/docs/constants/variables/SUPPORTED_CHAINS.md +1 -1
- package/docs/meta/classes/ProtocolMetaParser.md +6 -6
- package/docs/meta/interfaces/ProtocolMetaV1.md +7 -7
- package/docs/protocol/classes/ActionCodesProtocol.md +45 -27
- package/docs/protocol/interfaces/ProtocolConfig.md +7 -7
- package/package.json +1 -1
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
# Class: SolanaAdapter
|
8
8
|
|
9
|
-
Defined in: [adapters/solana/solana.ts:25](https://github.com/otaprotocol/actioncodes/blob/
|
9
|
+
Defined in: [adapters/solana/solana.ts:25](https://github.com/otaprotocol/actioncodes/blob/8a4aa3018c6ed7e0af5268c1fef98a56ef85fed1/src/adapters/solana/solana.ts#L25)
|
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:28](https://github.com/otaprotocol/actioncodes/blob/
|
38
|
+
Defined in: [adapters/solana/solana.ts:28](https://github.com/otaprotocol/actioncodes/blob/8a4aa3018c6ed7e0af5268c1fef98a56ef85fed1/src/adapters/solana/solana.ts#L28)
|
39
39
|
|
40
40
|
#### Overrides
|
41
41
|
|
@@ -43,11 +43,35 @@ Defined in: [adapters/solana/solana.ts:28](https://github.com/otaprotocol/action
|
|
43
43
|
|
44
44
|
## Methods
|
45
45
|
|
46
|
-
###
|
46
|
+
### decodeFromBase64()
|
47
|
+
|
48
|
+
> **decodeFromBase64**(`base64String`): `null` \| [`ProtocolMetaV1`](../../../../meta/interfaces/ProtocolMetaV1.md)
|
49
|
+
|
50
|
+
Defined in: [adapters/solana/solana.ts:356](https://github.com/otaprotocol/actioncodes/blob/8a4aa3018c6ed7e0af5268c1fef98a56ef85fed1/src/adapters/solana/solana.ts#L356)
|
51
|
+
|
52
|
+
Decode protocol meta from base64 string (for backward compatibility)
|
53
|
+
|
54
|
+
#### Parameters
|
55
|
+
|
56
|
+
##### base64String
|
57
|
+
|
58
|
+
`string`
|
59
|
+
|
60
|
+
Base64 encoded transaction
|
61
|
+
|
62
|
+
#### Returns
|
63
|
+
|
64
|
+
`null` \| [`ProtocolMetaV1`](../../../../meta/interfaces/ProtocolMetaV1.md)
|
65
|
+
|
66
|
+
Decoded ProtocolMetaV1 or null
|
67
|
+
|
68
|
+
***
|
47
69
|
|
48
|
-
|
70
|
+
### decodeMeta()
|
49
71
|
|
50
|
-
|
72
|
+
> **decodeMeta**(`tx`): `null` \| [`ProtocolMetaV1`](../../../../meta/interfaces/ProtocolMetaV1.md)
|
73
|
+
|
74
|
+
Defined in: [adapters/solana/solana.ts:56](https://github.com/otaprotocol/actioncodes/blob/8a4aa3018c6ed7e0af5268c1fef98a56ef85fed1/src/adapters/solana/solana.ts#L56)
|
51
75
|
|
52
76
|
Decode protocol meta from Solana transaction (legacy or versioned)
|
53
77
|
|
@@ -55,9 +79,9 @@ Decode protocol meta from Solana transaction (legacy or versioned)
|
|
55
79
|
|
56
80
|
##### tx
|
57
81
|
|
58
|
-
|
82
|
+
The Solana transaction (can be deserialized object or base64 string)
|
59
83
|
|
60
|
-
|
84
|
+
`string` | [`SolanaTransaction`](../type-aliases/SolanaTransaction.md)
|
61
85
|
|
62
86
|
#### Returns
|
63
87
|
|
@@ -67,17 +91,17 @@ Decoded ProtocolMetaV1 or null if not found
|
|
67
91
|
|
68
92
|
#### Overrides
|
69
93
|
|
70
|
-
[`BaseChainAdapter`](../../../base/classes/BaseChainAdapter.md).[`
|
94
|
+
[`BaseChainAdapter`](../../../base/classes/BaseChainAdapter.md).[`decodeMeta`](../../../base/classes/BaseChainAdapter.md#decodemeta)
|
71
95
|
|
72
96
|
***
|
73
97
|
|
74
|
-
###
|
98
|
+
### deserializeTransaction()
|
75
99
|
|
76
|
-
> **
|
100
|
+
> **deserializeTransaction**(`base64String`): [`SolanaTransaction`](../type-aliases/SolanaTransaction.md)
|
77
101
|
|
78
|
-
Defined in: [adapters/solana/solana.ts:
|
102
|
+
Defined in: [adapters/solana/solana.ts:81](https://github.com/otaprotocol/actioncodes/blob/8a4aa3018c6ed7e0af5268c1fef98a56ef85fed1/src/adapters/solana/solana.ts#L81)
|
79
103
|
|
80
|
-
|
104
|
+
Deserialize a Solana transaction from base64 string
|
81
105
|
|
82
106
|
#### Parameters
|
83
107
|
|
@@ -89,9 +113,9 @@ Base64 encoded transaction
|
|
89
113
|
|
90
114
|
#### Returns
|
91
115
|
|
92
|
-
|
116
|
+
[`SolanaTransaction`](../type-aliases/SolanaTransaction.md)
|
93
117
|
|
94
|
-
|
118
|
+
SolanaTransaction object
|
95
119
|
|
96
120
|
***
|
97
121
|
|
@@ -99,7 +123,7 @@ Decoded ProtocolMetaV1 or null
|
|
99
123
|
|
100
124
|
> **detectTampering**(`tx`, `authorities`, `expectedPrefix`): `boolean`
|
101
125
|
|
102
|
-
Defined in: [adapters/base.ts:
|
126
|
+
Defined in: [adapters/base.ts:58](https://github.com/otaprotocol/actioncodes/blob/8a4aa3018c6ed7e0af5268c1fef98a56ef85fed1/src/adapters/base.ts#L58)
|
103
127
|
|
104
128
|
Detect tampered transactions by cross-checking metadata
|
105
129
|
|
@@ -135,11 +159,11 @@ True if transaction is valid and not tampered
|
|
135
159
|
|
136
160
|
***
|
137
161
|
|
138
|
-
###
|
162
|
+
### encodeMeta()
|
139
163
|
|
140
|
-
> **
|
164
|
+
> **encodeMeta**(`meta`): `TransactionInstruction`
|
141
165
|
|
142
|
-
Defined in: [adapters/solana/solana.ts:35](https://github.com/otaprotocol/actioncodes/blob/
|
166
|
+
Defined in: [adapters/solana/solana.ts:35](https://github.com/otaprotocol/actioncodes/blob/8a4aa3018c6ed7e0af5268c1fef98a56ef85fed1/src/adapters/solana/solana.ts#L35)
|
143
167
|
|
144
168
|
Encode protocol meta as a Solana memo instruction
|
145
169
|
|
@@ -159,7 +183,7 @@ TransactionInstruction for the memo
|
|
159
183
|
|
160
184
|
#### Overrides
|
161
185
|
|
162
|
-
[`BaseChainAdapter`](../../../base/classes/BaseChainAdapter.md).[`
|
186
|
+
[`BaseChainAdapter`](../../../base/classes/BaseChainAdapter.md).[`encodeMeta`](../../../base/classes/BaseChainAdapter.md#encodemeta)
|
163
187
|
|
164
188
|
***
|
165
189
|
|
@@ -167,7 +191,7 @@ TransactionInstruction for the memo
|
|
167
191
|
|
168
192
|
> **getCodeSignatureMessage**(`code`, `timestamp`, `prefix`): `string`
|
169
193
|
|
170
|
-
Defined in: [adapters/base.ts:
|
194
|
+
Defined in: [adapters/base.ts:104](https://github.com/otaprotocol/actioncodes/blob/8a4aa3018c6ed7e0af5268c1fef98a56ef85fed1/src/adapters/base.ts#L104)
|
171
195
|
|
172
196
|
Get the code signature message
|
173
197
|
|
@@ -207,7 +231,7 @@ The code signature message
|
|
207
231
|
|
208
232
|
> **hasIssuerSignature**(`tx`, `issuer`): `boolean`
|
209
233
|
|
210
|
-
Defined in: [adapters/solana/solana.ts:
|
234
|
+
Defined in: [adapters/solana/solana.ts:193](https://github.com/otaprotocol/actioncodes/blob/8a4aa3018c6ed7e0af5268c1fef98a56ef85fed1/src/adapters/solana/solana.ts#L193)
|
211
235
|
|
212
236
|
Check if the issuer has signed the transaction
|
213
237
|
|
@@ -215,9 +239,9 @@ Check if the issuer has signed the transaction
|
|
215
239
|
|
216
240
|
##### tx
|
217
241
|
|
218
|
-
|
242
|
+
The Solana transaction (can be deserialized object or base64 string)
|
219
243
|
|
220
|
-
|
244
|
+
`string` | [`SolanaTransaction`](../type-aliases/SolanaTransaction.md)
|
221
245
|
|
222
246
|
##### issuer
|
223
247
|
|
@@ -237,91 +261,89 @@ True if issuer has signed
|
|
237
261
|
|
238
262
|
***
|
239
263
|
|
240
|
-
###
|
264
|
+
### injectMeta()
|
241
265
|
|
242
|
-
> **
|
266
|
+
> **injectMeta**(`serializedTx`, `meta`): `string`
|
243
267
|
|
244
|
-
Defined in: [adapters/solana/solana.ts:
|
268
|
+
Defined in: [adapters/solana/solana.ts:101](https://github.com/otaprotocol/actioncodes/blob/8a4aa3018c6ed7e0af5268c1fef98a56ef85fed1/src/adapters/solana/solana.ts#L101)
|
245
269
|
|
246
|
-
|
270
|
+
Inject protocol meta into Solana transaction
|
247
271
|
|
248
272
|
#### Parameters
|
249
273
|
|
250
|
-
#####
|
274
|
+
##### serializedTx
|
251
275
|
|
252
|
-
|
276
|
+
`string`
|
253
277
|
|
254
|
-
|
278
|
+
Serialized transaction string (base64)
|
255
279
|
|
256
|
-
|
280
|
+
##### meta
|
281
|
+
|
282
|
+
[`ProtocolMetaV1`](../../../../meta/interfaces/ProtocolMetaV1.md)
|
283
|
+
|
284
|
+
ProtocolMetaV1 object
|
257
285
|
|
258
286
|
#### Returns
|
259
287
|
|
260
|
-
`
|
288
|
+
`string`
|
261
289
|
|
262
|
-
|
290
|
+
Serialized transaction with injected meta
|
263
291
|
|
264
292
|
#### Overrides
|
265
293
|
|
266
|
-
[`BaseChainAdapter`](../../../base/classes/BaseChainAdapter.md).[`
|
294
|
+
[`BaseChainAdapter`](../../../base/classes/BaseChainAdapter.md).[`injectMeta`](../../../base/classes/BaseChainAdapter.md#injectmeta)
|
267
295
|
|
268
296
|
***
|
269
297
|
|
270
|
-
###
|
298
|
+
### signWithProtocolKey()
|
271
299
|
|
272
|
-
> **
|
300
|
+
> **signWithProtocolKey**(`actionCode`, `key`): `Promise`\<[`ActionCode`](../../../../actioncode/classes/ActionCode.md)\>
|
273
301
|
|
274
|
-
Defined in: [adapters/solana/solana.ts:
|
302
|
+
Defined in: [adapters/solana/solana.ts:366](https://github.com/otaprotocol/actioncodes/blob/8a4aa3018c6ed7e0af5268c1fef98a56ef85fed1/src/adapters/solana/solana.ts#L366)
|
275
303
|
|
276
|
-
|
304
|
+
Sign the transaction with the protocol key
|
277
305
|
|
278
306
|
#### Parameters
|
279
307
|
|
280
|
-
#####
|
281
|
-
|
282
|
-
[`SolanaTransaction`](../type-aliases/SolanaTransaction.md)
|
283
|
-
|
284
|
-
The Solana transaction
|
285
|
-
|
286
|
-
##### authorities
|
308
|
+
##### actionCode
|
287
309
|
|
288
|
-
`
|
310
|
+
[`ActionCode`](../../../../actioncode/classes/ActionCode.md)
|
289
311
|
|
290
|
-
|
312
|
+
The action code containing the transaction
|
291
313
|
|
292
|
-
#####
|
314
|
+
##### key
|
293
315
|
|
294
|
-
`
|
316
|
+
`Keypair`
|
295
317
|
|
296
|
-
|
318
|
+
The keypair to sign with
|
297
319
|
|
298
320
|
#### Returns
|
299
321
|
|
300
|
-
`
|
322
|
+
`Promise`\<[`ActionCode`](../../../../actioncode/classes/ActionCode.md)\>
|
301
323
|
|
302
|
-
|
324
|
+
Promise that resolves to the signed action code
|
303
325
|
|
304
326
|
#### Overrides
|
305
327
|
|
306
|
-
[`BaseChainAdapter`](../../../base/classes/BaseChainAdapter.md).[`
|
328
|
+
[`BaseChainAdapter`](../../../base/classes/BaseChainAdapter.md).[`signWithProtocolKey`](../../../base/classes/BaseChainAdapter.md#signwithprotocolkey)
|
307
329
|
|
308
330
|
***
|
309
331
|
|
310
|
-
###
|
332
|
+
### validate()
|
311
333
|
|
312
|
-
> **
|
334
|
+
> **validate**(`tx`, `authorities`, `expectedPrefix`): `boolean`
|
313
335
|
|
314
|
-
Defined in: [adapters/solana/solana.ts:
|
336
|
+
Defined in: [adapters/solana/solana.ts:183](https://github.com/otaprotocol/actioncodes/blob/8a4aa3018c6ed7e0af5268c1fef98a56ef85fed1/src/adapters/solana/solana.ts#L183)
|
315
337
|
|
316
|
-
Validate
|
338
|
+
Validate transaction with protocol meta and authority list
|
317
339
|
|
318
340
|
#### Parameters
|
319
341
|
|
320
|
-
#####
|
342
|
+
##### tx
|
321
343
|
|
322
|
-
`
|
344
|
+
[`SolanaTransaction`](../type-aliases/SolanaTransaction.md)
|
323
345
|
|
324
|
-
|
346
|
+
The Solana transaction
|
325
347
|
|
326
348
|
##### authorities
|
327
349
|
|
@@ -341,13 +363,17 @@ Expected protocol prefix (default: 'DEFAULT')
|
|
341
363
|
|
342
364
|
True if transaction is valid
|
343
365
|
|
366
|
+
#### Overrides
|
367
|
+
|
368
|
+
[`BaseChainAdapter`](../../../base/classes/BaseChainAdapter.md).[`validate`](../../../base/classes/BaseChainAdapter.md#validate)
|
369
|
+
|
344
370
|
***
|
345
371
|
|
346
372
|
### validateTransactionIntegrity()
|
347
373
|
|
348
374
|
> `protected` **validateTransactionIntegrity**(`tx`, `meta`): `boolean`
|
349
375
|
|
350
|
-
Defined in: [adapters/solana/solana.ts:
|
376
|
+
Defined in: [adapters/solana/solana.ts:309](https://github.com/otaprotocol/actioncodes/blob/8a4aa3018c6ed7e0af5268c1fef98a56ef85fed1/src/adapters/solana/solana.ts#L309)
|
351
377
|
|
352
378
|
Validate Solana transaction integrity with additional checks
|
353
379
|
|
@@ -381,7 +407,7 @@ True if transaction integrity is valid
|
|
381
407
|
|
382
408
|
> **verifyCodeSignature**(`actionCode`): `boolean`
|
383
409
|
|
384
|
-
Defined in: [adapters/solana/solana.ts:
|
410
|
+
Defined in: [adapters/solana/solana.ts:338](https://github.com/otaprotocol/actioncodes/blob/8a4aa3018c6ed7e0af5268c1fef98a56ef85fed1/src/adapters/solana/solana.ts#L338)
|
385
411
|
|
386
412
|
Verify the code signature
|
387
413
|
This is specific to the chain and should be implemented by the concrete adapter
|
@@ -8,6 +8,6 @@
|
|
8
8
|
|
9
9
|
> **SolanaTransaction** = `Transaction` \| `VersionedTransaction`
|
10
10
|
|
11
|
-
Defined in: [adapters/solana/solana.ts:19](https://github.com/otaprotocol/actioncodes/blob/
|
11
|
+
Defined in: [adapters/solana/solana.ts:19](https://github.com/otaprotocol/actioncodes/blob/8a4aa3018c6ed7e0af5268c1fef98a56ef85fed1/src/adapters/solana/solana.ts#L19)
|
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/
|
9
|
+
Defined in: [codegen.ts:4](https://github.com/otaprotocol/actioncodes/blob/8a4aa3018c6ed7e0af5268c1fef98a56ef85fed1/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/c724b
|
|
24
24
|
|
25
25
|
> `static` **CODE\_DIGITS**: `number` = `CODE_LENGTH`
|
26
26
|
|
27
|
-
Defined in: [codegen.ts:6](https://github.com/otaprotocol/actioncodes/blob/
|
27
|
+
Defined in: [codegen.ts:6](https://github.com/otaprotocol/actioncodes/blob/8a4aa3018c6ed7e0af5268c1fef98a56ef85fed1/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/c724b
|
|
32
32
|
|
33
33
|
> `static` **MAX\_PREFIX\_LENGTH**: `number`
|
34
34
|
|
35
|
-
Defined in: [codegen.ts:8](https://github.com/otaprotocol/actioncodes/blob/
|
35
|
+
Defined in: [codegen.ts:8](https://github.com/otaprotocol/actioncodes/blob/8a4aa3018c6ed7e0af5268c1fef98a56ef85fed1/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/c724b
|
|
40
40
|
|
41
41
|
> `static` **MIN\_PREFIX\_LENGTH**: `number`
|
42
42
|
|
43
|
-
Defined in: [codegen.ts:7](https://github.com/otaprotocol/actioncodes/blob/
|
43
|
+
Defined in: [codegen.ts:7](https://github.com/otaprotocol/actioncodes/blob/8a4aa3018c6ed7e0af5268c1fef98a56ef85fed1/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/c724b
|
|
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/
|
51
|
+
Defined in: [codegen.ts:5](https://github.com/otaprotocol/actioncodes/blob/8a4aa3018c6ed7e0af5268c1fef98a56ef85fed1/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/c724b
|
|
56
56
|
|
57
57
|
> `static` **deriveCodeHash**(`pubkey`, `prefix`, `timestamp?`): `string`
|
58
58
|
|
59
|
-
Defined in: [codegen.ts:167](https://github.com/otaprotocol/actioncodes/blob/
|
59
|
+
Defined in: [codegen.ts:167](https://github.com/otaprotocol/actioncodes/blob/8a4aa3018c6ed7e0af5268c1fef98a56ef85fed1/src/codegen.ts#L167)
|
60
60
|
|
61
61
|
Derive the full SHA-256 hash for storage or encryption key generation
|
62
62
|
|
@@ -92,7 +92,7 @@ Full SHA-256 hash string
|
|
92
92
|
|
93
93
|
> `static` **generateCode**(`pubkey`, `prefix`, `timestamp`): `object`
|
94
94
|
|
95
|
-
Defined in: [codegen.ts:123](https://github.com/otaprotocol/actioncodes/blob/
|
95
|
+
Defined in: [codegen.ts:123](https://github.com/otaprotocol/actioncodes/blob/8a4aa3018c6ed7e0af5268c1fef98a56ef85fed1/src/codegen.ts#L123)
|
96
96
|
|
97
97
|
Generate a deterministic 8-digit code based on public key, prefix, and timestamp
|
98
98
|
|
@@ -144,7 +144,7 @@ Error if generated code is invalid
|
|
144
144
|
|
145
145
|
> `static` **getExpectedCode**(`pubkey`, `timestamp`, `prefix`): `string`
|
146
146
|
|
147
|
-
Defined in: [codegen.ts:186](https://github.com/otaprotocol/actioncodes/blob/
|
147
|
+
Defined in: [codegen.ts:186](https://github.com/otaprotocol/actioncodes/blob/8a4aa3018c6ed7e0af5268c1fef98a56ef85fed1/src/codegen.ts#L186)
|
148
148
|
|
149
149
|
Get the expected code for a given public key and timestamp
|
150
150
|
|
@@ -180,7 +180,7 @@ Full code string with prefix + 8 digits
|
|
180
180
|
|
181
181
|
> `static` **isValidTimestamp**(`timestamp`): `boolean`
|
182
182
|
|
183
|
-
Defined in: [codegen.ts:228](https://github.com/otaprotocol/actioncodes/blob/
|
183
|
+
Defined in: [codegen.ts:228](https://github.com/otaprotocol/actioncodes/blob/8a4aa3018c6ed7e0af5268c1fef98a56ef85fed1/src/codegen.ts#L228)
|
184
184
|
|
185
185
|
Check if a timestamp falls within a valid time window
|
186
186
|
|
@@ -204,7 +204,7 @@ True if timestamp is valid
|
|
204
204
|
|
205
205
|
> `static` **normalizePrefix**(`prefix`): `string`
|
206
206
|
|
207
|
-
Defined in: [codegen.ts:107](https://github.com/otaprotocol/actioncodes/blob/
|
207
|
+
Defined in: [codegen.ts:107](https://github.com/otaprotocol/actioncodes/blob/8a4aa3018c6ed7e0af5268c1fef98a56ef85fed1/src/codegen.ts#L107)
|
208
208
|
|
209
209
|
Normalize prefix - convert PROTOCOL_CODE_PREFIX to empty string, validate others
|
210
210
|
|
@@ -232,7 +232,7 @@ Error if prefix is invalid
|
|
232
232
|
|
233
233
|
> `static` **validateCode**(`code`, `pubkey`, `timestamp`, `prefix`): `boolean`
|
234
234
|
|
235
|
-
Defined in: [codegen.ts:202](https://github.com/otaprotocol/actioncodes/blob/
|
235
|
+
Defined in: [codegen.ts:202](https://github.com/otaprotocol/actioncodes/blob/8a4aa3018c6ed7e0af5268c1fef98a56ef85fed1/src/codegen.ts#L202)
|
236
236
|
|
237
237
|
Validate if a code matches the expected code for a given public key and timestamp
|
238
238
|
|
@@ -274,7 +274,7 @@ True if code matches expected code and timestamp is valid
|
|
274
274
|
|
275
275
|
> `static` **validateCodeDigits**(`code`): `boolean`
|
276
276
|
|
277
|
-
Defined in: [codegen.ts:67](https://github.com/otaprotocol/actioncodes/blob/
|
277
|
+
Defined in: [codegen.ts:67](https://github.com/otaprotocol/actioncodes/blob/8a4aa3018c6ed7e0af5268c1fef98a56ef85fed1/src/codegen.ts#L67)
|
278
278
|
|
279
279
|
Validate that the numeric part of a code is exactly 8 digits
|
280
280
|
|
@@ -298,7 +298,7 @@ True if numeric part is valid, false otherwise
|
|
298
298
|
|
299
299
|
> `static` **validateCodeFormat**(`code`): `boolean`
|
300
300
|
|
301
|
-
Defined in: [codegen.ts:26](https://github.com/otaprotocol/actioncodes/blob/
|
301
|
+
Defined in: [codegen.ts:26](https://github.com/otaprotocol/actioncodes/blob/8a4aa3018c6ed7e0af5268c1fef98a56ef85fed1/src/codegen.ts#L26)
|
302
302
|
|
303
303
|
Validate generated code format (prefix + exactly 8 digits)
|
304
304
|
|
@@ -322,7 +322,7 @@ True if code is valid, false otherwise
|
|
322
322
|
|
323
323
|
> `static` **validatePrefix**(`prefix`): `boolean`
|
324
324
|
|
325
|
-
Defined in: [codegen.ts:15](https://github.com/otaprotocol/actioncodes/blob/
|
325
|
+
Defined in: [codegen.ts:15](https://github.com/otaprotocol/actioncodes/blob/8a4aa3018c6ed7e0af5268c1fef98a56ef85fed1/src/codegen.ts#L15)
|
326
326
|
|
327
327
|
Validate prefix format
|
328
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/
|
11
|
+
Defined in: [constants.ts:9](https://github.com/otaprotocol/actioncodes/blob/8a4aa3018c6ed7e0af5268c1fef98a56ef85fed1/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/
|
11
|
+
Defined in: [constants.ts:3](https://github.com/otaprotocol/actioncodes/blob/8a4aa3018c6ed7e0af5268c1fef98a56ef85fed1/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/
|
11
|
+
Defined in: [constants.ts:4](https://github.com/otaprotocol/actioncodes/blob/8a4aa3018c6ed7e0af5268c1fef98a56ef85fed1/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/
|
11
|
+
Defined in: [constants.ts:7](https://github.com/otaprotocol/actioncodes/blob/8a4aa3018c6ed7e0af5268c1fef98a56ef85fed1/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/
|
11
|
+
Defined in: [constants.ts:6](https://github.com/otaprotocol/actioncodes/blob/8a4aa3018c6ed7e0af5268c1fef98a56ef85fed1/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/
|
11
|
+
Defined in: [constants.ts:5](https://github.com/otaprotocol/actioncodes/blob/8a4aa3018c6ed7e0af5268c1fef98a56ef85fed1/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/
|
11
|
+
Defined in: [constants.ts:2](https://github.com/otaprotocol/actioncodes/blob/8a4aa3018c6ed7e0af5268c1fef98a56ef85fed1/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/
|
11
|
+
Defined in: [constants.ts:1](https://github.com/otaprotocol/actioncodes/blob/8a4aa3018c6ed7e0af5268c1fef98a56ef85fed1/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/
|
11
|
+
Defined in: [constants.ts:8](https://github.com/otaprotocol/actioncodes/blob/8a4aa3018c6ed7e0af5268c1fef98a56ef85fed1/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/
|
9
|
+
Defined in: [meta.ts:19](https://github.com/otaprotocol/actioncodes/blob/8a4aa3018c6ed7e0af5268c1fef98a56ef85fed1/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/
|
29
|
+
Defined in: [meta.ts:74](https://github.com/otaprotocol/actioncodes/blob/8a4aa3018c6ed7e0af5268c1fef98a56ef85fed1/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/
|
77
|
+
Defined in: [meta.ts:27](https://github.com/otaprotocol/actioncodes/blob/8a4aa3018c6ed7e0af5268c1fef98a56ef85fed1/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/
|
101
|
+
Defined in: [meta.ts:55](https://github.com/otaprotocol/actioncodes/blob/8a4aa3018c6ed7e0af5268c1fef98a56ef85fed1/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/
|
125
|
+
Defined in: [meta.ts:99](https://github.com/otaprotocol/actioncodes/blob/8a4aa3018c6ed7e0af5268c1fef98a56ef85fed1/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/
|
155
|
+
Defined in: [meta.ts:110](https://github.com/otaprotocol/actioncodes/blob/8a4aa3018c6ed7e0af5268c1fef98a56ef85fed1/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/
|
9
|
+
Defined in: [meta.ts:7](https://github.com/otaprotocol/actioncodes/blob/8a4aa3018c6ed7e0af5268c1fef98a56ef85fed1/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/
|
19
|
+
Defined in: [meta.ts:11](https://github.com/otaprotocol/actioncodes/blob/8a4aa3018c6ed7e0af5268c1fef98a56ef85fed1/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/c724b44
|
|
24
24
|
|
25
25
|
> **initiator**: `string`
|
26
26
|
|
27
|
-
Defined in: [meta.ts:10](https://github.com/otaprotocol/actioncodes/blob/
|
27
|
+
Defined in: [meta.ts:10](https://github.com/otaprotocol/actioncodes/blob/8a4aa3018c6ed7e0af5268c1fef98a56ef85fed1/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/c724b44
|
|
32
32
|
|
33
33
|
> `optional` **iss**: `string`
|
34
34
|
|
35
|
-
Defined in: [meta.ts:12](https://github.com/otaprotocol/actioncodes/blob/
|
35
|
+
Defined in: [meta.ts:12](https://github.com/otaprotocol/actioncodes/blob/8a4aa3018c6ed7e0af5268c1fef98a56ef85fed1/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/c724b44
|
|
40
40
|
|
41
41
|
> `optional` **params**: `string`
|
42
42
|
|
43
|
-
Defined in: [meta.ts:13](https://github.com/otaprotocol/actioncodes/blob/
|
43
|
+
Defined in: [meta.ts:13](https://github.com/otaprotocol/actioncodes/blob/8a4aa3018c6ed7e0af5268c1fef98a56ef85fed1/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/c724b44
|
|
48
48
|
|
49
49
|
> **prefix**: `string`
|
50
50
|
|
51
|
-
Defined in: [meta.ts:9](https://github.com/otaprotocol/actioncodes/blob/
|
51
|
+
Defined in: [meta.ts:9](https://github.com/otaprotocol/actioncodes/blob/8a4aa3018c6ed7e0af5268c1fef98a56ef85fed1/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/c724b443
|
|
56
56
|
|
57
57
|
> **version**: `string`
|
58
58
|
|
59
|
-
Defined in: [meta.ts:8](https://github.com/otaprotocol/actioncodes/blob/
|
59
|
+
Defined in: [meta.ts:8](https://github.com/otaprotocol/actioncodes/blob/8a4aa3018c6ed7e0af5268c1fef98a56ef85fed1/src/meta.ts#L8)
|