@actioncodes/protocol 1.2.1 → 2.0.0

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 (144) hide show
  1. package/LICENSE +2 -2
  2. package/README.md +32 -45
  3. package/dist/ActionCodesProtocol.d.ts +35 -0
  4. package/dist/ActionCodesProtocol.d.ts.map +1 -0
  5. package/dist/adapters/BaseChainAdapter.d.ts +22 -0
  6. package/dist/adapters/BaseChainAdapter.d.ts.map +1 -0
  7. package/dist/adapters/SolanaAdapter.d.ts +44 -0
  8. package/dist/adapters/SolanaAdapter.d.ts.map +1 -0
  9. package/dist/constants.d.ts +6 -8
  10. package/dist/constants.d.ts.map +1 -1
  11. package/dist/errors.d.ts +63 -0
  12. package/dist/errors.d.ts.map +1 -0
  13. package/dist/index.cjs +3 -0
  14. package/dist/index.cjs.map +25 -0
  15. package/dist/index.d.ts +10 -8
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +3 -23
  18. package/dist/index.js.map +25 -0
  19. package/dist/strategy/DelegationStrategy.d.ts +43 -0
  20. package/dist/strategy/DelegationStrategy.d.ts.map +1 -0
  21. package/dist/strategy/WalletStrategy.d.ts +8 -0
  22. package/dist/strategy/WalletStrategy.d.ts.map +1 -0
  23. package/dist/types.d.ts +40 -0
  24. package/dist/types.d.ts.map +1 -0
  25. package/dist/utils/canonical.d.ts +5 -0
  26. package/dist/utils/canonical.d.ts.map +1 -0
  27. package/dist/utils/crypto.d.ts +13 -0
  28. package/dist/utils/crypto.d.ts.map +1 -0
  29. package/dist/utils/protocolMeta.d.ts +16 -0
  30. package/dist/utils/protocolMeta.d.ts.map +1 -0
  31. package/docs/ActionCodesProtocol/README.md +11 -0
  32. package/docs/ActionCodesProtocol/classes/ActionCodesProtocol.md +147 -0
  33. package/docs/README.md +10 -50
  34. package/docs/adapters/BaseChainAdapter/README.md +20 -0
  35. package/docs/adapters/BaseChainAdapter/classes/BaseChainAdapter.md +56 -0
  36. package/docs/adapters/BaseChainAdapter/interfaces/BaseContext.md +17 -0
  37. package/docs/adapters/BaseChainAdapter/interfaces/ChainAdapter.md +33 -0
  38. package/docs/adapters/BaseChainAdapter/type-aliases/ChainContext.md +23 -0
  39. package/docs/adapters/NodeCryptoAdapter/README.md +15 -0
  40. package/docs/adapters/NodeCryptoAdapter/classes/NodeCryptoAdapter.md +254 -0
  41. package/docs/adapters/NodeCryptoAdapter/type-aliases/NodeCryptoContext.md +27 -0
  42. package/docs/adapters/SolanaAdapter/README.md +16 -0
  43. package/docs/adapters/SolanaAdapter/classes/SolanaAdapter.md +190 -0
  44. package/docs/adapters/SolanaAdapter/type-aliases/SolanaContext.md +27 -0
  45. package/docs/adapters/SolanaAdapter/type-aliases/SolanaTransaction.md +13 -0
  46. package/docs/constants/README.md +8 -13
  47. package/docs/constants/variables/CODE_CHARSET_DIGITS.md +11 -0
  48. package/docs/constants/variables/CODE_DEFAULT_LENGTH.md +11 -0
  49. package/docs/constants/variables/CODE_MAX_LENGTH.md +11 -0
  50. package/docs/constants/variables/CODE_MIN_LENGTH.md +11 -0
  51. package/docs/constants/variables/PROTOCOL_META_MAX_BYTES.md +11 -0
  52. package/docs/constants/variables/PROTOCOL_NORMALIZATION.md +11 -0
  53. package/docs/constants/variables/SUPPORTED_CHAINS.md +3 -3
  54. package/docs/errors/README.md +22 -0
  55. package/docs/errors/classes/ExpiredCodeError.md +695 -0
  56. package/docs/errors/classes/InvalidCodeFormatError.md +691 -0
  57. package/docs/errors/classes/InvalidPubkeyFormatError.md +691 -0
  58. package/docs/errors/classes/InvalidSignatureError.md +687 -0
  59. package/docs/errors/classes/MetaMismatchError.md +695 -0
  60. package/docs/errors/classes/MissingMetaError.md +681 -0
  61. package/docs/errors/classes/ProtocolError.md +637 -0
  62. package/docs/errors/classes/TransactionNotSignedByIntendedOwnerError.md +691 -0
  63. package/docs/errors/enumerations/ProtocolErrorCode.md +121 -0
  64. package/docs/index/README.md +83 -41
  65. package/docs/modules.md +12 -9
  66. package/docs/strategy/WalletStrategy/README.md +11 -0
  67. package/docs/strategy/WalletStrategy/classes/WalletStrategy.md +67 -0
  68. package/docs/types/README.md +14 -0
  69. package/docs/types/interfaces/ActionCode.md +65 -0
  70. package/docs/types/interfaces/CanonicalMessageParts.md +33 -0
  71. package/docs/types/interfaces/CodeGenerationConfig.md +33 -0
  72. package/docs/types/interfaces/CodeGenerationResult.md +25 -0
  73. package/docs/utils/canonical/README.md +16 -0
  74. package/docs/utils/canonical/functions/serializeCanonical.md +21 -0
  75. package/docs/utils/canonical/variables/CANONICAL_MESSAGE_PREFIX.md +11 -0
  76. package/docs/utils/canonical/variables/CANONICAL_MESSAGE_VERSION.md +11 -0
  77. package/docs/utils/crypto/README.md +18 -0
  78. package/docs/utils/crypto/functions/base32EncodeCrockford.md +21 -0
  79. package/docs/utils/crypto/functions/codeHash.md +21 -0
  80. package/docs/utils/crypto/functions/digestToDigits.md +25 -0
  81. package/docs/utils/crypto/functions/generateRandomSecret.md +15 -0
  82. package/docs/utils/crypto/functions/hkdfSha256.md +35 -0
  83. package/docs/utils/crypto/functions/hmacSha256.md +25 -0
  84. package/docs/utils/crypto/functions/sha256.md +21 -0
  85. package/docs/utils/crypto/functions/truncateBits.md +25 -0
  86. package/docs/utils/protocolMeta/README.md +21 -0
  87. package/docs/utils/protocolMeta/functions/buildProtocolMeta.md +21 -0
  88. package/docs/utils/protocolMeta/functions/parseProtocolMeta.md +21 -0
  89. package/docs/utils/protocolMeta/functions/validateProtocolMetaFormat.md +21 -0
  90. package/docs/utils/protocolMeta/interfaces/ProtocolMetaFields.md +41 -0
  91. package/docs/utils/protocolMeta/variables/SCHEME.md +11 -0
  92. package/package.json +42 -47
  93. package/dist/actioncode.d.ts +0 -120
  94. package/dist/actioncode.d.ts.map +0 -1
  95. package/dist/actioncode.js +0 -173
  96. package/dist/adapters/base.d.ts +0 -93
  97. package/dist/adapters/base.d.ts.map +0 -1
  98. package/dist/adapters/base.js +0 -52
  99. package/dist/adapters/solana/index.d.ts +0 -2
  100. package/dist/adapters/solana/index.d.ts.map +0 -1
  101. package/dist/adapters/solana/index.js +0 -17
  102. package/dist/adapters/solana/solana.d.ts +0 -113
  103. package/dist/adapters/solana/solana.d.ts.map +0 -1
  104. package/dist/adapters/solana/solana.js +0 -524
  105. package/dist/codegen.d.ts +0 -76
  106. package/dist/codegen.d.ts.map +0 -1
  107. package/dist/codegen.js +0 -198
  108. package/dist/constants.js +0 -11
  109. package/dist/meta.d.ts +0 -54
  110. package/dist/meta.d.ts.map +0 -1
  111. package/dist/meta.js +0 -91
  112. package/dist/protocol.d.ts +0 -179
  113. package/dist/protocol.d.ts.map +0 -1
  114. package/dist/protocol.js +0 -377
  115. package/docs/_media/LICENSE +0 -201
  116. package/docs/_media/README.md +0 -28
  117. package/docs/actioncode/README.md +0 -21
  118. package/docs/actioncode/classes/ActionCode.md +0 -430
  119. package/docs/actioncode/interfaces/ActionCodeFields.md +0 -89
  120. package/docs/actioncode/interfaces/ActionCodeMetadata.md +0 -25
  121. package/docs/actioncode/interfaces/ActionCodeTransaction.md +0 -57
  122. package/docs/actioncode/type-aliases/ActionCodeStatus.md +0 -11
  123. package/docs/adapters/base/README.md +0 -11
  124. package/docs/adapters/base/classes/BaseChainAdapter.md +0 -396
  125. package/docs/adapters/solana/README.md +0 -19
  126. package/docs/adapters/solana/solana/README.md +0 -15
  127. package/docs/adapters/solana/solana/classes/SolanaAdapter.md +0 -506
  128. package/docs/adapters/solana/solana/type-aliases/SolanaTransaction.md +0 -13
  129. package/docs/codegen/README.md +0 -11
  130. package/docs/codegen/classes/CodeGenerator.md +0 -341
  131. package/docs/constants/type-aliases/SupportedChain.md +0 -11
  132. package/docs/constants/variables/CODE_LENGTH.md +0 -11
  133. package/docs/constants/variables/CODE_TTL.md +0 -11
  134. package/docs/constants/variables/MAX_PREFIX_LENGTH.md +0 -11
  135. package/docs/constants/variables/MIN_PREFIX_LENGTH.md +0 -11
  136. package/docs/constants/variables/PROTOCOL_CODE_PREFIX.md +0 -11
  137. package/docs/constants/variables/PROTOCOL_PREFIX.md +0 -11
  138. package/docs/constants/variables/PROTOCOL_VERSION.md +0 -11
  139. package/docs/meta/README.md +0 -15
  140. package/docs/meta/classes/ProtocolMetaParser.md +0 -177
  141. package/docs/meta/interfaces/ProtocolMetaV1.md +0 -59
  142. package/docs/protocol/README.md +0 -51
  143. package/docs/protocol/classes/ActionCodesProtocol.md +0 -676
  144. package/docs/protocol/interfaces/ProtocolConfig.md +0 -71
@@ -1,51 +0,0 @@
1
- [**@actioncodes/protocol**](../README.md)
2
-
3
- ***
4
-
5
- [@actioncodes/protocol](../modules.md) / protocol
6
-
7
- # protocol
8
-
9
- ## Classes
10
-
11
- - [ActionCodesProtocol](classes/ActionCodesProtocol.md)
12
-
13
- ## Interfaces
14
-
15
- - [ProtocolConfig](interfaces/ProtocolConfig.md)
16
-
17
- ## References
18
-
19
- ### ActionCode
20
-
21
- Re-exports [ActionCode](../actioncode/classes/ActionCode.md)
22
-
23
- ***
24
-
25
- ### ActionCodeStatus
26
-
27
- Re-exports [ActionCodeStatus](../actioncode/type-aliases/ActionCodeStatus.md)
28
-
29
- ***
30
-
31
- ### ActionCodeTransaction
32
-
33
- Re-exports [ActionCodeTransaction](../actioncode/interfaces/ActionCodeTransaction.md)
34
-
35
- ***
36
-
37
- ### ProtocolMetaV1
38
-
39
- Re-exports [ProtocolMetaV1](../meta/interfaces/ProtocolMetaV1.md)
40
-
41
- ***
42
-
43
- ### SUPPORTED\_CHAINS
44
-
45
- Re-exports [SUPPORTED_CHAINS](../constants/variables/SUPPORTED_CHAINS.md)
46
-
47
- ***
48
-
49
- ### SupportedChain
50
-
51
- Re-exports [SupportedChain](../constants/type-aliases/SupportedChain.md)
@@ -1,676 +0,0 @@
1
- [**@actioncodes/protocol**](../../README.md)
2
-
3
- ***
4
-
5
- [@actioncodes/protocol](../../modules.md) / [protocol](../README.md) / ActionCodesProtocol
6
-
7
- # Class: ActionCodesProtocol
8
-
9
- Defined in: [protocol.ts:31](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/protocol.ts#L31)
10
-
11
- OTA Protocol - Main entry point for the One-Time Action Code Protocol
12
-
13
- Provides a unified interface for generating, validating, and managing
14
- action codes across multiple blockchain networks.
15
-
16
- ## Constructors
17
-
18
- ### Constructor
19
-
20
- > **new ActionCodesProtocol**(`config?`): `ActionCodesProtocol`
21
-
22
- Defined in: [protocol.ts:35](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/protocol.ts#L35)
23
-
24
- #### Parameters
25
-
26
- ##### config?
27
-
28
- `Partial`\<[`ProtocolConfig`](../interfaces/ProtocolConfig.md)\>
29
-
30
- #### Returns
31
-
32
- `ActionCodesProtocol`
33
-
34
- ## Methods
35
-
36
- ### attachMessage()
37
-
38
- > **attachMessage**(`actionCode`, `message`, `params?`, `messageType?`): [`ActionCode`](../../actioncode/classes/ActionCode.md)
39
-
40
- Defined in: [protocol.ts:226](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/protocol.ts#L226)
41
-
42
- Attach a message to an action code (sign-only mode, resolved state)
43
-
44
- #### Parameters
45
-
46
- ##### actionCode
47
-
48
- [`ActionCode`](../../actioncode/classes/ActionCode.md)
49
-
50
- ActionCode to attach message to
51
-
52
- ##### message
53
-
54
- `string`
55
-
56
- The message that will be signed
57
-
58
- ##### params?
59
-
60
- `string`
61
-
62
- Optional parameters for protocol meta
63
-
64
- ##### messageType?
65
-
66
- `string`
67
-
68
- Optional message type
69
-
70
- #### Returns
71
-
72
- [`ActionCode`](../../actioncode/classes/ActionCode.md)
73
-
74
- Updated ActionCode with transaction containing message
75
-
76
- ***
77
-
78
- ### attachTransaction()
79
-
80
- > **attachTransaction**(`actionCode`, `transaction`, `issuer`, `params?`, `txType?`): [`ActionCode`](../../actioncode/classes/ActionCode.md)
81
-
82
- Defined in: [protocol.ts:168](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/protocol.ts#L168)
83
-
84
- Attach a transaction to an action code with automatic protocol meta injection
85
-
86
- #### Parameters
87
-
88
- ##### actionCode
89
-
90
- [`ActionCode`](../../actioncode/classes/ActionCode.md)
91
-
92
- ActionCode to attach transaction to
93
-
94
- ##### transaction
95
-
96
- `string`
97
-
98
- Chain-specific transaction data (serialized)
99
-
100
- ##### issuer
101
-
102
- `string`
103
-
104
- Issuer public key for protocol meta, this is the proof of who is attaching the transaction to the action code
105
-
106
- ##### params?
107
-
108
- `string`
109
-
110
- Optional parameters for protocol meta
111
-
112
- ##### txType?
113
-
114
- `string`
115
-
116
- Optional transaction type
117
-
118
- #### Returns
119
-
120
- [`ActionCode`](../../actioncode/classes/ActionCode.md)
121
-
122
- Updated ActionCode with injected protocol meta
123
-
124
- ***
125
-
126
- ### createActionCode()
127
-
128
- > **createActionCode**(`pubkey`, `signFn`, `chain`, `prefix`, `timestamp?`): `Promise`\<[`ActionCode`](../../actioncode/classes/ActionCode.md)\>
129
-
130
- Defined in: [protocol.ts:116](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/protocol.ts#L116)
131
-
132
- Create an action code
133
-
134
- #### Parameters
135
-
136
- ##### pubkey
137
-
138
- `string`
139
-
140
- Wallet public key
141
-
142
- ##### signFn
143
-
144
- (`message`) => `Promise`\<`string`\>
145
-
146
- Chain-specific signing function (e.g.wallet.signMessage)
147
-
148
- ##### chain
149
-
150
- `"solana"`
151
-
152
- Target blockchain
153
-
154
- ##### prefix
155
-
156
- `string` = `...`
157
-
158
- Optional code prefix
159
-
160
- ##### timestamp?
161
-
162
- `number`
163
-
164
- Optional timestamp
165
-
166
- #### Returns
167
-
168
- `Promise`\<[`ActionCode`](../../actioncode/classes/ActionCode.md)\>
169
-
170
- Promise resolving to a complete ActionCode object
171
-
172
- ***
173
-
174
- ### createProtocolMeta()
175
-
176
- > **createProtocolMeta**(`actionCode`, `issuer?`, `params?`, `timestamp?`): [`ProtocolMetaV1`](../../meta/interfaces/ProtocolMetaV1.md)
177
-
178
- Defined in: [protocol.ts:314](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/protocol.ts#L314)
179
-
180
- Create protocol meta for a transaction
181
-
182
- #### Parameters
183
-
184
- ##### actionCode
185
-
186
- [`ActionCode`](../../actioncode/classes/ActionCode.md)
187
-
188
- ActionCode to create meta for
189
-
190
- ##### issuer?
191
-
192
- `string`
193
-
194
- Optional issuer public key
195
-
196
- ##### params?
197
-
198
- `string`
199
-
200
- Optional parameters
201
-
202
- ##### timestamp?
203
-
204
- `number`
205
-
206
- Optional timestamp (defaults to action code timestamp)
207
-
208
- #### Returns
209
-
210
- [`ProtocolMetaV1`](../../meta/interfaces/ProtocolMetaV1.md)
211
-
212
- ProtocolMetaV1 object
213
-
214
- ***
215
-
216
- ### decodeProtocolMeta()
217
-
218
- > **decodeProtocolMeta**(`transaction`, `chain`): `null` \| [`ProtocolMetaV1`](../../meta/interfaces/ProtocolMetaV1.md)
219
-
220
- Defined in: [protocol.ts:350](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/protocol.ts#L350)
221
-
222
- Decode protocol meta from a transaction
223
-
224
- #### Parameters
225
-
226
- ##### transaction
227
-
228
- `any`
229
-
230
- Chain-specific transaction
231
-
232
- ##### chain
233
-
234
- `string`
235
-
236
- Source chain
237
-
238
- #### Returns
239
-
240
- `null` \| [`ProtocolMetaV1`](../../meta/interfaces/ProtocolMetaV1.md)
241
-
242
- Decoded ProtocolMetaV1 or null
243
-
244
- ***
245
-
246
- ### decodeProtocolMetaTyped()
247
-
248
- > **decodeProtocolMetaTyped**\<`T`\>(`transaction`, `chain`): `null` \| [`ProtocolMetaV1`](../../meta/interfaces/ProtocolMetaV1.md)
249
-
250
- Defined in: [protocol.ts:432](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/protocol.ts#L432)
251
-
252
- Decode protocol meta with type safety
253
-
254
- #### Type Parameters
255
-
256
- ##### T
257
-
258
- `T`
259
-
260
- #### Parameters
261
-
262
- ##### transaction
263
-
264
- `T`
265
-
266
- Chain-specific transaction
267
-
268
- ##### chain
269
-
270
- `string`
271
-
272
- Source chain
273
-
274
- #### Returns
275
-
276
- `null` \| [`ProtocolMetaV1`](../../meta/interfaces/ProtocolMetaV1.md)
277
-
278
- Decoded ProtocolMetaV1 or null
279
-
280
- ***
281
-
282
- ### detectTampering()
283
-
284
- > **detectTampering**\<`T`\>(`transaction`, `chain`, `authorities`, `expectedPrefix?`): `boolean`
285
-
286
- Defined in: [protocol.ts:412](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/protocol.ts#L412)
287
-
288
- Detect tampered transactions with type safety
289
-
290
- #### Type Parameters
291
-
292
- ##### T
293
-
294
- `T`
295
-
296
- #### Parameters
297
-
298
- ##### transaction
299
-
300
- `T`
301
-
302
- Chain-specific transaction
303
-
304
- ##### chain
305
-
306
- `string`
307
-
308
- Source chain
309
-
310
- ##### authorities
311
-
312
- `string`[]
313
-
314
- Array of valid protocol authority identifiers
315
-
316
- ##### expectedPrefix?
317
-
318
- `string`
319
-
320
- Expected protocol prefix
321
-
322
- #### Returns
323
-
324
- `boolean`
325
-
326
- True if transaction is valid and not tampered
327
-
328
- ***
329
-
330
- ### encodeProtocolMeta()
331
-
332
- > **encodeProtocolMeta**(`meta`, `chain`): `any`
333
-
334
- Defined in: [protocol.ts:335](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/protocol.ts#L335)
335
-
336
- Encode protocol meta for a specific chain
337
-
338
- #### Parameters
339
-
340
- ##### meta
341
-
342
- [`ProtocolMetaV1`](../../meta/interfaces/ProtocolMetaV1.md)
343
-
344
- ProtocolMetaV1 object
345
-
346
- ##### chain
347
-
348
- `string`
349
-
350
- Target chain
351
-
352
- #### Returns
353
-
354
- `any`
355
-
356
- Chain-specific encoded meta
357
-
358
- ***
359
-
360
- ### finalizeActionCode()
361
-
362
- > **finalizeActionCode**(`actionCode`, `signature`): [`ActionCode`](../../actioncode/classes/ActionCode.md)
363
-
364
- Defined in: [protocol.ts:264](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/protocol.ts#L264)
365
-
366
- Finalize an action code based on its intent type
367
-
368
- #### Parameters
369
-
370
- ##### actionCode
371
-
372
- [`ActionCode`](../../actioncode/classes/ActionCode.md)
373
-
374
- ActionCode to finalize
375
-
376
- ##### signature
377
-
378
- `string`
379
-
380
- Transaction signature (for transaction intent) or signed message (for sign-only intent)
381
-
382
- #### Returns
383
-
384
- [`ActionCode`](../../actioncode/classes/ActionCode.md)
385
-
386
- Updated ActionCode
387
-
388
- ***
389
-
390
- ### getChainAdapter()
391
-
392
- > **getChainAdapter**\<`T`\>(`chain`): `undefined` \| [`BaseChainAdapter`](../../adapters/base/classes/BaseChainAdapter.md)\<`T`\>
393
-
394
- Defined in: [protocol.ts:77](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/protocol.ts#L77)
395
-
396
- Get chain adapter with proper typing
397
-
398
- #### Type Parameters
399
-
400
- ##### T
401
-
402
- `T` = `any`
403
-
404
- #### Parameters
405
-
406
- ##### chain
407
-
408
- `string`
409
-
410
- Chain identifier
411
-
412
- #### Returns
413
-
414
- `undefined` \| [`BaseChainAdapter`](../../adapters/base/classes/BaseChainAdapter.md)\<`T`\>
415
-
416
- Chain adapter or undefined
417
-
418
- ***
419
-
420
- ### getConfig()
421
-
422
- > **getConfig**(): [`ProtocolConfig`](../interfaces/ProtocolConfig.md)
423
-
424
- Defined in: [protocol.ts:445](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/protocol.ts#L445)
425
-
426
- Get protocol configuration
427
-
428
- #### Returns
429
-
430
- [`ProtocolConfig`](../interfaces/ProtocolConfig.md)
431
-
432
- Current protocol configuration
433
-
434
- ***
435
-
436
- ### getRegisteredChains()
437
-
438
- > **getRegisteredChains**(): `string`[]
439
-
440
- Defined in: [protocol.ts:59](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/protocol.ts#L59)
441
-
442
- Get registered chain adapters
443
-
444
- #### Returns
445
-
446
- `string`[]
447
-
448
- Array of registered chain identifiers
449
-
450
- ***
451
-
452
- ### isChainSupported()
453
-
454
- > **isChainSupported**(`chain`): `boolean`
455
-
456
- Defined in: [protocol.ts:68](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/protocol.ts#L68)
457
-
458
- Check if a chain is supported
459
-
460
- #### Parameters
461
-
462
- ##### chain
463
-
464
- `string`
465
-
466
- Chain identifier
467
-
468
- #### Returns
469
-
470
- `boolean`
471
-
472
- True if chain is supported
473
-
474
- ***
475
-
476
- ### registerAdapter()
477
-
478
- > **registerAdapter**\<`T`\>(`adapter`): `void`
479
-
480
- Defined in: [protocol.ts:51](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/protocol.ts#L51)
481
-
482
- Register a chain adapter
483
-
484
- #### Type Parameters
485
-
486
- ##### T
487
-
488
- `T`
489
-
490
- #### Parameters
491
-
492
- ##### adapter
493
-
494
- [`BaseChainAdapter`](../../adapters/base/classes/BaseChainAdapter.md)\<`T`\>
495
-
496
- Chain adapter implementation
497
-
498
- #### Returns
499
-
500
- `void`
501
-
502
- ***
503
-
504
- ### updateConfig()
505
-
506
- > **updateConfig**(`updates`): `void`
507
-
508
- Defined in: [protocol.ts:453](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/protocol.ts#L453)
509
-
510
- Update protocol configuration
511
-
512
- #### Parameters
513
-
514
- ##### updates
515
-
516
- `Partial`\<[`ProtocolConfig`](../interfaces/ProtocolConfig.md)\>
517
-
518
- Configuration updates
519
-
520
- #### Returns
521
-
522
- `void`
523
-
524
- ***
525
-
526
- ### validateActionCode()
527
-
528
- > **validateActionCode**(`actionCode`): `boolean`
529
-
530
- Defined in: [protocol.ts:86](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/protocol.ts#L86)
531
-
532
- Validate an action code, checking intent type and required fields
533
-
534
- #### Parameters
535
-
536
- ##### actionCode
537
-
538
- [`ActionCode`](../../actioncode/classes/ActionCode.md)
539
-
540
- ActionCode to validate
541
-
542
- #### Returns
543
-
544
- `boolean`
545
-
546
- True if valid
547
-
548
- ***
549
-
550
- ### validateTransaction()
551
-
552
- > **validateTransaction**(`transaction`, `chain`, `authorities`, `expectedPrefix?`): `boolean`
553
-
554
- Defined in: [protocol.ts:367](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/protocol.ts#L367)
555
-
556
- Validate a transaction with protocol meta
557
-
558
- #### Parameters
559
-
560
- ##### transaction
561
-
562
- `any`
563
-
564
- Chain-specific transaction (can be serialized string or deserialized object)
565
-
566
- ##### chain
567
-
568
- `string`
569
-
570
- Source chain
571
-
572
- ##### authorities
573
-
574
- `string`[]
575
-
576
- Array of valid protocol authority identifiers
577
-
578
- ##### expectedPrefix?
579
-
580
- `string`
581
-
582
- Expected protocol prefix
583
-
584
- #### Returns
585
-
586
- `boolean`
587
-
588
- True if transaction is valid
589
-
590
- ***
591
-
592
- ### validateTransactionTyped()
593
-
594
- > **validateTransactionTyped**\<`T`\>(`transaction`, `chain`, `authorities`, `expectedPrefix?`): `boolean`
595
-
596
- Defined in: [protocol.ts:390](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/protocol.ts#L390)
597
-
598
- Type-safe transaction validation for specific chains
599
-
600
- #### Type Parameters
601
-
602
- ##### T
603
-
604
- `T`
605
-
606
- #### Parameters
607
-
608
- ##### transaction
609
-
610
- `T`
611
-
612
- Chain-specific transaction
613
-
614
- ##### chain
615
-
616
- `string`
617
-
618
- Source chain
619
-
620
- ##### authorities
621
-
622
- `string`[]
623
-
624
- Array of valid protocol authority identifiers
625
-
626
- ##### expectedPrefix?
627
-
628
- `string`
629
-
630
- Expected protocol prefix
631
-
632
- #### Returns
633
-
634
- `boolean`
635
-
636
- True if transaction is valid
637
-
638
- ***
639
-
640
- ### create()
641
-
642
- > `static` **create**(): `ActionCodesProtocol`
643
-
644
- Defined in: [protocol.ts:461](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/protocol.ts#L461)
645
-
646
- Create a new protocol instance with default configuration
647
-
648
- #### Returns
649
-
650
- `ActionCodesProtocol`
651
-
652
- New protocol instance
653
-
654
- ***
655
-
656
- ### createWithConfig()
657
-
658
- > `static` **createWithConfig**(`config`): `ActionCodesProtocol`
659
-
660
- Defined in: [protocol.ts:470](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/protocol.ts#L470)
661
-
662
- Create a new protocol instance with custom configuration
663
-
664
- #### Parameters
665
-
666
- ##### config
667
-
668
- `Partial`\<[`ProtocolConfig`](../interfaces/ProtocolConfig.md)\>
669
-
670
- Custom configuration
671
-
672
- #### Returns
673
-
674
- `ActionCodesProtocol`
675
-
676
- New protocol instance