@actioncodes/protocol 1.1.1 → 1.1.3

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 (31) hide show
  1. package/dist/adapters/base.d.ts +9 -3
  2. package/dist/adapters/base.d.ts.map +1 -1
  3. package/dist/adapters/solana/solana.d.ts +25 -19
  4. package/dist/adapters/solana/solana.d.ts.map +1 -1
  5. package/dist/adapters/solana/solana.js +203 -69
  6. package/dist/protocol.d.ts +9 -6
  7. package/dist/protocol.d.ts.map +1 -1
  8. package/dist/protocol.js +29 -8
  9. package/docs/actioncode/classes/ActionCode.md +23 -23
  10. package/docs/actioncode/interfaces/ActionCodeFields.md +11 -11
  11. package/docs/actioncode/interfaces/ActionCodeMetadata.md +3 -3
  12. package/docs/actioncode/interfaces/ActionCodeTransaction.md +4 -4
  13. package/docs/actioncode/type-aliases/ActionCodeStatus.md +1 -1
  14. package/docs/adapters/base/classes/BaseChainAdapter.md +46 -18
  15. package/docs/adapters/solana/solana/classes/SolanaAdapter.md +87 -61
  16. package/docs/adapters/solana/solana/type-aliases/SolanaTransaction.md +1 -1
  17. package/docs/codegen/classes/CodeGenerator.md +14 -14
  18. package/docs/constants/type-aliases/SupportedChain.md +1 -1
  19. package/docs/constants/variables/CODE_LENGTH.md +1 -1
  20. package/docs/constants/variables/CODE_TTL.md +1 -1
  21. package/docs/constants/variables/MAX_PREFIX_LENGTH.md +1 -1
  22. package/docs/constants/variables/MIN_PREFIX_LENGTH.md +1 -1
  23. package/docs/constants/variables/PROTOCOL_CODE_PREFIX.md +1 -1
  24. package/docs/constants/variables/PROTOCOL_PREFIX.md +1 -1
  25. package/docs/constants/variables/PROTOCOL_VERSION.md +1 -1
  26. package/docs/constants/variables/SUPPORTED_CHAINS.md +1 -1
  27. package/docs/meta/classes/ProtocolMetaParser.md +6 -6
  28. package/docs/meta/interfaces/ProtocolMetaV1.md +7 -7
  29. package/docs/protocol/classes/ActionCodesProtocol.md +45 -27
  30. package/docs/protocol/interfaces/ProtocolConfig.md +7 -7
  31. package/package.json +1 -1
@@ -6,7 +6,7 @@
6
6
 
7
7
  # Class: ActionCodesProtocol
8
8
 
9
- Defined in: [protocol.ts:31](https://github.com/otaprotocol/actioncodes/blob/57f8663219c9af5c455731c797e721cd72058ff4/src/protocol.ts#L31)
9
+ Defined in: [protocol.ts:31](https://github.com/otaprotocol/actioncodes/blob/a8b35c1388affc2365ea89beead5f92a97b38de7/src/protocol.ts#L31)
10
10
 
11
11
  OTA Protocol - Main entry point for the One-Time Action Code Protocol
12
12
 
@@ -19,7 +19,7 @@ action codes across multiple blockchain networks.
19
19
 
20
20
  > **new ActionCodesProtocol**(`config?`): `ActionCodesProtocol`
21
21
 
22
- Defined in: [protocol.ts:35](https://github.com/otaprotocol/actioncodes/blob/57f8663219c9af5c455731c797e721cd72058ff4/src/protocol.ts#L35)
22
+ Defined in: [protocol.ts:35](https://github.com/otaprotocol/actioncodes/blob/a8b35c1388affc2365ea89beead5f92a97b38de7/src/protocol.ts#L35)
23
23
 
24
24
  #### Parameters
25
25
 
@@ -35,11 +35,11 @@ Defined in: [protocol.ts:35](https://github.com/otaprotocol/actioncodes/blob/57f
35
35
 
36
36
  ### attachTransaction()
37
37
 
38
- > **attachTransaction**(`actionCode`, `transaction`, `txType?`): [`ActionCode`](../../actioncode/classes/ActionCode.md)
38
+ > **attachTransaction**(`actionCode`, `transaction`, `issuer`, `params?`, `txType?`): [`ActionCode`](../../actioncode/classes/ActionCode.md)
39
39
 
40
- Defined in: [protocol.ts:161](https://github.com/otaprotocol/actioncodes/blob/57f8663219c9af5c455731c797e721cd72058ff4/src/protocol.ts#L161)
40
+ Defined in: [protocol.ts:163](https://github.com/otaprotocol/actioncodes/blob/a8b35c1388affc2365ea89beead5f92a97b38de7/src/protocol.ts#L163)
41
41
 
42
- Attach a transaction to an action code
42
+ Attach a transaction to an action code with automatic protocol meta injection
43
43
 
44
44
  #### Parameters
45
45
 
@@ -53,7 +53,19 @@ ActionCode to attach transaction to
53
53
 
54
54
  `string`
55
55
 
56
- Chain-specific transaction data
56
+ Chain-specific transaction data (serialized)
57
+
58
+ ##### issuer
59
+
60
+ `string`
61
+
62
+ Issuer public key for protocol meta, this is the proof of who is attaching the transaction to the action code
63
+
64
+ ##### params?
65
+
66
+ `string`
67
+
68
+ Optional parameters for protocol meta
57
69
 
58
70
  ##### txType?
59
71
 
@@ -65,7 +77,7 @@ Optional transaction type
65
77
 
66
78
  [`ActionCode`](../../actioncode/classes/ActionCode.md)
67
79
 
68
- Updated ActionCode
80
+ Updated ActionCode with injected protocol meta
69
81
 
70
82
  ***
71
83
 
@@ -73,7 +85,7 @@ Updated ActionCode
73
85
 
74
86
  > **createActionCode**(`pubkey`, `signFn`, `chain`, `prefix`, `timestamp?`): `Promise`\<[`ActionCode`](../../actioncode/classes/ActionCode.md)\>
75
87
 
76
- Defined in: [protocol.ts:111](https://github.com/otaprotocol/actioncodes/blob/57f8663219c9af5c455731c797e721cd72058ff4/src/protocol.ts#L111)
88
+ Defined in: [protocol.ts:111](https://github.com/otaprotocol/actioncodes/blob/a8b35c1388affc2365ea89beead5f92a97b38de7/src/protocol.ts#L111)
77
89
 
78
90
  Create an action code
79
91
 
@@ -119,9 +131,9 @@ Promise resolving to a complete ActionCode object
119
131
 
120
132
  ### createProtocolMeta()
121
133
 
122
- > **createProtocolMeta**(`actionCode`, `issuer?`, `params?`): [`ProtocolMetaV1`](../../meta/interfaces/ProtocolMetaV1.md)
134
+ > **createProtocolMeta**(`actionCode`, `issuer?`, `params?`, `timestamp?`): [`ProtocolMetaV1`](../../meta/interfaces/ProtocolMetaV1.md)
123
135
 
124
- Defined in: [protocol.ts:226](https://github.com/otaprotocol/actioncodes/blob/57f8663219c9af5c455731c797e721cd72058ff4/src/protocol.ts#L226)
136
+ Defined in: [protocol.ts:252](https://github.com/otaprotocol/actioncodes/blob/a8b35c1388affc2365ea89beead5f92a97b38de7/src/protocol.ts#L252)
125
137
 
126
138
  Create protocol meta for a transaction
127
139
 
@@ -145,6 +157,12 @@ Optional issuer public key
145
157
 
146
158
  Optional parameters
147
159
 
160
+ ##### timestamp?
161
+
162
+ `number`
163
+
164
+ Optional timestamp (defaults to action code timestamp)
165
+
148
166
  #### Returns
149
167
 
150
168
  [`ProtocolMetaV1`](../../meta/interfaces/ProtocolMetaV1.md)
@@ -157,7 +175,7 @@ ProtocolMetaV1 object
157
175
 
158
176
  > **decodeProtocolMeta**(`transaction`, `chain`): `null` \| [`ProtocolMetaV1`](../../meta/interfaces/ProtocolMetaV1.md)
159
177
 
160
- Defined in: [protocol.ts:260](https://github.com/otaprotocol/actioncodes/blob/57f8663219c9af5c455731c797e721cd72058ff4/src/protocol.ts#L260)
178
+ Defined in: [protocol.ts:288](https://github.com/otaprotocol/actioncodes/blob/a8b35c1388affc2365ea89beead5f92a97b38de7/src/protocol.ts#L288)
161
179
 
162
180
  Decode protocol meta from a transaction
163
181
 
@@ -187,7 +205,7 @@ Decoded ProtocolMetaV1 or null
187
205
 
188
206
  > **decodeProtocolMetaTyped**\<`T`\>(`transaction`, `chain`): `null` \| [`ProtocolMetaV1`](../../meta/interfaces/ProtocolMetaV1.md)
189
207
 
190
- Defined in: [protocol.ts:341](https://github.com/otaprotocol/actioncodes/blob/57f8663219c9af5c455731c797e721cd72058ff4/src/protocol.ts#L341)
208
+ Defined in: [protocol.ts:370](https://github.com/otaprotocol/actioncodes/blob/a8b35c1388affc2365ea89beead5f92a97b38de7/src/protocol.ts#L370)
191
209
 
192
210
  Decode protocol meta with type safety
193
211
 
@@ -223,7 +241,7 @@ Decoded ProtocolMetaV1 or null
223
241
 
224
242
  > **detectTampering**\<`T`\>(`transaction`, `chain`, `authorities`, `expectedPrefix?`): `boolean`
225
243
 
226
- Defined in: [protocol.ts:321](https://github.com/otaprotocol/actioncodes/blob/57f8663219c9af5c455731c797e721cd72058ff4/src/protocol.ts#L321)
244
+ Defined in: [protocol.ts:350](https://github.com/otaprotocol/actioncodes/blob/a8b35c1388affc2365ea89beead5f92a97b38de7/src/protocol.ts#L350)
227
245
 
228
246
  Detect tampered transactions with type safety
229
247
 
@@ -271,7 +289,7 @@ True if transaction is valid and not tampered
271
289
 
272
290
  > **encodeProtocolMeta**(`meta`, `chain`): `any`
273
291
 
274
- Defined in: [protocol.ts:245](https://github.com/otaprotocol/actioncodes/blob/57f8663219c9af5c455731c797e721cd72058ff4/src/protocol.ts#L245)
292
+ Defined in: [protocol.ts:273](https://github.com/otaprotocol/actioncodes/blob/a8b35c1388affc2365ea89beead5f92a97b38de7/src/protocol.ts#L273)
275
293
 
276
294
  Encode protocol meta for a specific chain
277
295
 
@@ -301,7 +319,7 @@ Chain-specific encoded meta
301
319
 
302
320
  > **finalizeActionCode**(`actionCode`, `txSignature`): [`ActionCode`](../../actioncode/classes/ActionCode.md)
303
321
 
304
- Defined in: [protocol.ts:194](https://github.com/otaprotocol/actioncodes/blob/57f8663219c9af5c455731c797e721cd72058ff4/src/protocol.ts#L194)
322
+ Defined in: [protocol.ts:219](https://github.com/otaprotocol/actioncodes/blob/a8b35c1388affc2365ea89beead5f92a97b38de7/src/protocol.ts#L219)
305
323
 
306
324
  Finalize an action code with transaction signature
307
325
 
@@ -331,7 +349,7 @@ Updated ActionCode
331
349
 
332
350
  > **getChainAdapter**\<`T`\>(`chain`): `undefined` \| [`BaseChainAdapter`](../../adapters/base/classes/BaseChainAdapter.md)\<`T`\>
333
351
 
334
- Defined in: [protocol.ts:77](https://github.com/otaprotocol/actioncodes/blob/57f8663219c9af5c455731c797e721cd72058ff4/src/protocol.ts#L77)
352
+ Defined in: [protocol.ts:77](https://github.com/otaprotocol/actioncodes/blob/a8b35c1388affc2365ea89beead5f92a97b38de7/src/protocol.ts#L77)
335
353
 
336
354
  Get chain adapter with proper typing
337
355
 
@@ -361,7 +379,7 @@ Chain adapter or undefined
361
379
 
362
380
  > **getConfig**(): [`ProtocolConfig`](../interfaces/ProtocolConfig.md)
363
381
 
364
- Defined in: [protocol.ts:354](https://github.com/otaprotocol/actioncodes/blob/57f8663219c9af5c455731c797e721cd72058ff4/src/protocol.ts#L354)
382
+ Defined in: [protocol.ts:383](https://github.com/otaprotocol/actioncodes/blob/a8b35c1388affc2365ea89beead5f92a97b38de7/src/protocol.ts#L383)
365
383
 
366
384
  Get protocol configuration
367
385
 
@@ -377,7 +395,7 @@ Current protocol configuration
377
395
 
378
396
  > **getRegisteredChains**(): `string`[]
379
397
 
380
- Defined in: [protocol.ts:59](https://github.com/otaprotocol/actioncodes/blob/57f8663219c9af5c455731c797e721cd72058ff4/src/protocol.ts#L59)
398
+ Defined in: [protocol.ts:59](https://github.com/otaprotocol/actioncodes/blob/a8b35c1388affc2365ea89beead5f92a97b38de7/src/protocol.ts#L59)
381
399
 
382
400
  Get registered chain adapters
383
401
 
@@ -393,7 +411,7 @@ Array of registered chain identifiers
393
411
 
394
412
  > **isChainSupported**(`chain`): `boolean`
395
413
 
396
- Defined in: [protocol.ts:68](https://github.com/otaprotocol/actioncodes/blob/57f8663219c9af5c455731c797e721cd72058ff4/src/protocol.ts#L68)
414
+ Defined in: [protocol.ts:68](https://github.com/otaprotocol/actioncodes/blob/a8b35c1388affc2365ea89beead5f92a97b38de7/src/protocol.ts#L68)
397
415
 
398
416
  Check if a chain is supported
399
417
 
@@ -417,7 +435,7 @@ True if chain is supported
417
435
 
418
436
  > **registerAdapter**\<`T`\>(`adapter`): `void`
419
437
 
420
- Defined in: [protocol.ts:51](https://github.com/otaprotocol/actioncodes/blob/57f8663219c9af5c455731c797e721cd72058ff4/src/protocol.ts#L51)
438
+ Defined in: [protocol.ts:51](https://github.com/otaprotocol/actioncodes/blob/a8b35c1388affc2365ea89beead5f92a97b38de7/src/protocol.ts#L51)
421
439
 
422
440
  Register a chain adapter
423
441
 
@@ -445,7 +463,7 @@ Chain adapter implementation
445
463
 
446
464
  > **updateConfig**(`updates`): `void`
447
465
 
448
- Defined in: [protocol.ts:362](https://github.com/otaprotocol/actioncodes/blob/57f8663219c9af5c455731c797e721cd72058ff4/src/protocol.ts#L362)
466
+ Defined in: [protocol.ts:391](https://github.com/otaprotocol/actioncodes/blob/a8b35c1388affc2365ea89beead5f92a97b38de7/src/protocol.ts#L391)
449
467
 
450
468
  Update protocol configuration
451
469
 
@@ -467,7 +485,7 @@ Configuration updates
467
485
 
468
486
  > **validateActionCode**(`actionCode`): `boolean`
469
487
 
470
- Defined in: [protocol.ts:86](https://github.com/otaprotocol/actioncodes/blob/57f8663219c9af5c455731c797e721cd72058ff4/src/protocol.ts#L86)
488
+ Defined in: [protocol.ts:86](https://github.com/otaprotocol/actioncodes/blob/a8b35c1388affc2365ea89beead5f92a97b38de7/src/protocol.ts#L86)
471
489
 
472
490
  Validate an action code
473
491
 
@@ -491,7 +509,7 @@ True if valid
491
509
 
492
510
  > **validateTransaction**(`transaction`, `chain`, `authorities`, `expectedPrefix?`): `boolean`
493
511
 
494
- Defined in: [protocol.ts:277](https://github.com/otaprotocol/actioncodes/blob/57f8663219c9af5c455731c797e721cd72058ff4/src/protocol.ts#L277)
512
+ Defined in: [protocol.ts:305](https://github.com/otaprotocol/actioncodes/blob/a8b35c1388affc2365ea89beead5f92a97b38de7/src/protocol.ts#L305)
495
513
 
496
514
  Validate a transaction with protocol meta
497
515
 
@@ -501,7 +519,7 @@ Validate a transaction with protocol meta
501
519
 
502
520
  `any`
503
521
 
504
- Chain-specific transaction
522
+ Chain-specific transaction (can be serialized string or deserialized object)
505
523
 
506
524
  ##### chain
507
525
 
@@ -533,7 +551,7 @@ True if transaction is valid
533
551
 
534
552
  > **validateTransactionTyped**\<`T`\>(`transaction`, `chain`, `authorities`, `expectedPrefix?`): `boolean`
535
553
 
536
- Defined in: [protocol.ts:299](https://github.com/otaprotocol/actioncodes/blob/57f8663219c9af5c455731c797e721cd72058ff4/src/protocol.ts#L299)
554
+ Defined in: [protocol.ts:328](https://github.com/otaprotocol/actioncodes/blob/a8b35c1388affc2365ea89beead5f92a97b38de7/src/protocol.ts#L328)
537
555
 
538
556
  Type-safe transaction validation for specific chains
539
557
 
@@ -581,7 +599,7 @@ True if transaction is valid
581
599
 
582
600
  > `static` **create**(): `ActionCodesProtocol`
583
601
 
584
- Defined in: [protocol.ts:370](https://github.com/otaprotocol/actioncodes/blob/57f8663219c9af5c455731c797e721cd72058ff4/src/protocol.ts#L370)
602
+ Defined in: [protocol.ts:399](https://github.com/otaprotocol/actioncodes/blob/a8b35c1388affc2365ea89beead5f92a97b38de7/src/protocol.ts#L399)
585
603
 
586
604
  Create a new protocol instance with default configuration
587
605
 
@@ -597,7 +615,7 @@ New protocol instance
597
615
 
598
616
  > `static` **createWithConfig**(`config`): `ActionCodesProtocol`
599
617
 
600
- Defined in: [protocol.ts:379](https://github.com/otaprotocol/actioncodes/blob/57f8663219c9af5c455731c797e721cd72058ff4/src/protocol.ts#L379)
618
+ Defined in: [protocol.ts:408](https://github.com/otaprotocol/actioncodes/blob/a8b35c1388affc2365ea89beead5f92a97b38de7/src/protocol.ts#L408)
601
619
 
602
620
  Create a new protocol instance with custom configuration
603
621
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  # Interface: ProtocolConfig
8
8
 
9
- Defined in: [protocol.ts:10](https://github.com/otaprotocol/actioncodes/blob/57f8663219c9af5c455731c797e721cd72058ff4/src/protocol.ts#L10)
9
+ Defined in: [protocol.ts:10](https://github.com/otaprotocol/actioncodes/blob/a8b35c1388affc2365ea89beead5f92a97b38de7/src/protocol.ts#L10)
10
10
 
11
11
  OTA Protocol Configuration
12
12
 
@@ -16,7 +16,7 @@ OTA Protocol Configuration
16
16
 
17
17
  > **codeLength**: `number`
18
18
 
19
- Defined in: [protocol.ts:18](https://github.com/otaprotocol/actioncodes/blob/57f8663219c9af5c455731c797e721cd72058ff4/src/protocol.ts#L18)
19
+ Defined in: [protocol.ts:18](https://github.com/otaprotocol/actioncodes/blob/a8b35c1388affc2365ea89beead5f92a97b38de7/src/protocol.ts#L18)
20
20
 
21
21
  Code length in digits
22
22
 
@@ -26,7 +26,7 @@ Code length in digits
26
26
 
27
27
  > **codeTTL**: `number`
28
28
 
29
- Defined in: [protocol.ts:16](https://github.com/otaprotocol/actioncodes/blob/57f8663219c9af5c455731c797e721cd72058ff4/src/protocol.ts#L16)
29
+ Defined in: [protocol.ts:16](https://github.com/otaprotocol/actioncodes/blob/a8b35c1388affc2365ea89beead5f92a97b38de7/src/protocol.ts#L16)
30
30
 
31
31
  Code TTL in milliseconds
32
32
 
@@ -36,7 +36,7 @@ Code TTL in milliseconds
36
36
 
37
37
  > **defaultPrefix**: `string`
38
38
 
39
- Defined in: [protocol.ts:14](https://github.com/otaprotocol/actioncodes/blob/57f8663219c9af5c455731c797e721cd72058ff4/src/protocol.ts#L14)
39
+ Defined in: [protocol.ts:14](https://github.com/otaprotocol/actioncodes/blob/a8b35c1388affc2365ea89beead5f92a97b38de7/src/protocol.ts#L14)
40
40
 
41
41
  Default prefix for action codes
42
42
 
@@ -46,7 +46,7 @@ Default prefix for action codes
46
46
 
47
47
  > **maxPrefixLength**: `number`
48
48
 
49
- Defined in: [protocol.ts:20](https://github.com/otaprotocol/actioncodes/blob/57f8663219c9af5c455731c797e721cd72058ff4/src/protocol.ts#L20)
49
+ Defined in: [protocol.ts:20](https://github.com/otaprotocol/actioncodes/blob/a8b35c1388affc2365ea89beead5f92a97b38de7/src/protocol.ts#L20)
50
50
 
51
51
  Maximum prefix length
52
52
 
@@ -56,7 +56,7 @@ Maximum prefix length
56
56
 
57
57
  > **minPrefixLength**: `number`
58
58
 
59
- Defined in: [protocol.ts:22](https://github.com/otaprotocol/actioncodes/blob/57f8663219c9af5c455731c797e721cd72058ff4/src/protocol.ts#L22)
59
+ Defined in: [protocol.ts:22](https://github.com/otaprotocol/actioncodes/blob/a8b35c1388affc2365ea89beead5f92a97b38de7/src/protocol.ts#L22)
60
60
 
61
61
  Minimum prefix length
62
62
 
@@ -66,6 +66,6 @@ Minimum prefix length
66
66
 
67
67
  > **version**: `string`
68
68
 
69
- Defined in: [protocol.ts:12](https://github.com/otaprotocol/actioncodes/blob/57f8663219c9af5c455731c797e721cd72058ff4/src/protocol.ts#L12)
69
+ Defined in: [protocol.ts:12](https://github.com/otaprotocol/actioncodes/blob/a8b35c1388affc2365ea89beead5f92a97b38de7/src/protocol.ts#L12)
70
70
 
71
71
  Protocol version
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@actioncodes/protocol",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "description": "Action Codes Protocol",
5
5
  "main": "src/index.js",
6
6
  "types": "dist/index.d.ts",