@actioncodes/protocol 1.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 (65) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +55 -0
  3. package/dist/actioncode.d.ts +114 -0
  4. package/dist/actioncode.d.ts.map +1 -0
  5. package/dist/actioncode.js +159 -0
  6. package/dist/adapters/base.d.ts +52 -0
  7. package/dist/adapters/base.d.ts.map +1 -0
  8. package/dist/adapters/base.js +41 -0
  9. package/dist/adapters/solana/index.d.ts +2 -0
  10. package/dist/adapters/solana/index.d.ts.map +1 -0
  11. package/dist/adapters/solana/index.js +17 -0
  12. package/dist/adapters/solana/solana.d.ts +84 -0
  13. package/dist/adapters/solana/solana.d.ts.map +1 -0
  14. package/dist/adapters/solana/solana.js +223 -0
  15. package/dist/codegen.d.ts +73 -0
  16. package/dist/codegen.d.ts.map +1 -0
  17. package/dist/codegen.js +118 -0
  18. package/dist/constants.d.ts +10 -0
  19. package/dist/constants.d.ts.map +1 -0
  20. package/dist/constants.js +11 -0
  21. package/dist/index.d.ts +9 -0
  22. package/dist/index.d.ts.map +1 -0
  23. package/dist/index.js +23 -0
  24. package/dist/meta.d.ts +54 -0
  25. package/dist/meta.d.ts.map +1 -0
  26. package/dist/meta.js +91 -0
  27. package/dist/protocol.d.ts +167 -0
  28. package/dist/protocol.d.ts.map +1 -0
  29. package/dist/protocol.js +280 -0
  30. package/docs/README.md +59 -0
  31. package/docs/_media/LICENSE +201 -0
  32. package/docs/_media/README.md +28 -0
  33. package/docs/actioncode/README.md +21 -0
  34. package/docs/actioncode/classes/ActionCode.md +412 -0
  35. package/docs/actioncode/interfaces/ActionCodeFields.md +95 -0
  36. package/docs/actioncode/interfaces/ActionCodeMetadata.md +25 -0
  37. package/docs/actioncode/interfaces/ActionCodeTransaction.md +39 -0
  38. package/docs/actioncode/type-aliases/ActionCodeStatus.md +11 -0
  39. package/docs/adapters/base/README.md +11 -0
  40. package/docs/adapters/base/classes/BaseChainAdapter.md +222 -0
  41. package/docs/adapters/solana/README.md +19 -0
  42. package/docs/adapters/solana/solana/README.md +15 -0
  43. package/docs/adapters/solana/solana/classes/SolanaAdapter.md +306 -0
  44. package/docs/adapters/solana/solana/type-aliases/SolanaTransaction.md +13 -0
  45. package/docs/codegen/README.md +11 -0
  46. package/docs/codegen/classes/CodeGenerator.md +337 -0
  47. package/docs/constants/README.md +22 -0
  48. package/docs/constants/type-aliases/SupportedChain.md +11 -0
  49. package/docs/constants/variables/CODE_LENGTH.md +11 -0
  50. package/docs/constants/variables/CODE_TTL.md +11 -0
  51. package/docs/constants/variables/MAX_PREFIX_LENGTH.md +11 -0
  52. package/docs/constants/variables/MIN_PREFIX_LENGTH.md +11 -0
  53. package/docs/constants/variables/PROTOCOL_CODE_PREFIX.md +11 -0
  54. package/docs/constants/variables/PROTOCOL_PREFIX.md +11 -0
  55. package/docs/constants/variables/PROTOCOL_VERSION.md +11 -0
  56. package/docs/constants/variables/SUPPORTED_CHAINS.md +11 -0
  57. package/docs/index/README.md +139 -0
  58. package/docs/meta/README.md +15 -0
  59. package/docs/meta/classes/ProtocolMetaParser.md +177 -0
  60. package/docs/meta/interfaces/ProtocolMetaV1.md +59 -0
  61. package/docs/modules.md +17 -0
  62. package/docs/protocol/README.md +51 -0
  63. package/docs/protocol/classes/ActionCodesProtocol.md +616 -0
  64. package/docs/protocol/interfaces/ProtocolConfig.md +71 -0
  65. package/package.json +90 -0
@@ -0,0 +1,11 @@
1
+ [**@actioncodes/protocol**](../../README.md)
2
+
3
+ ***
4
+
5
+ [@actioncodes/protocol](../../modules.md) / [constants](../README.md) / CODE\_TTL
6
+
7
+ # Variable: CODE\_TTL
8
+
9
+ > `const` **CODE\_TTL**: `number`
10
+
11
+ Defined in: [constants.ts:4](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/constants.ts#L4)
@@ -0,0 +1,11 @@
1
+ [**@actioncodes/protocol**](../../README.md)
2
+
3
+ ***
4
+
5
+ [@actioncodes/protocol](../../modules.md) / [constants](../README.md) / MAX\_PREFIX\_LENGTH
6
+
7
+ # Variable: MAX\_PREFIX\_LENGTH
8
+
9
+ > `const` **MAX\_PREFIX\_LENGTH**: `12` = `12`
10
+
11
+ Defined in: [constants.ts:7](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/constants.ts#L7)
@@ -0,0 +1,11 @@
1
+ [**@actioncodes/protocol**](../../README.md)
2
+
3
+ ***
4
+
5
+ [@actioncodes/protocol](../../modules.md) / [constants](../README.md) / MIN\_PREFIX\_LENGTH
6
+
7
+ # Variable: MIN\_PREFIX\_LENGTH
8
+
9
+ > `const` **MIN\_PREFIX\_LENGTH**: `3` = `3`
10
+
11
+ Defined in: [constants.ts:6](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/constants.ts#L6)
@@ -0,0 +1,11 @@
1
+ [**@actioncodes/protocol**](../../README.md)
2
+
3
+ ***
4
+
5
+ [@actioncodes/protocol](../../modules.md) / [constants](../README.md) / PROTOCOL\_CODE\_PREFIX
6
+
7
+ # Variable: PROTOCOL\_CODE\_PREFIX
8
+
9
+ > `const` **PROTOCOL\_CODE\_PREFIX**: `"DEFAULT"` = `"DEFAULT"`
10
+
11
+ Defined in: [constants.ts:5](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/constants.ts#L5)
@@ -0,0 +1,11 @@
1
+ [**@actioncodes/protocol**](../../README.md)
2
+
3
+ ***
4
+
5
+ [@actioncodes/protocol](../../modules.md) / [constants](../README.md) / PROTOCOL\_PREFIX
6
+
7
+ # Variable: PROTOCOL\_PREFIX
8
+
9
+ > `const` **PROTOCOL\_PREFIX**: `"actioncodes"` = `"actioncodes"`
10
+
11
+ Defined in: [constants.ts:2](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/constants.ts#L2)
@@ -0,0 +1,11 @@
1
+ [**@actioncodes/protocol**](../../README.md)
2
+
3
+ ***
4
+
5
+ [@actioncodes/protocol](../../modules.md) / [constants](../README.md) / PROTOCOL\_VERSION
6
+
7
+ # Variable: PROTOCOL\_VERSION
8
+
9
+ > `const` **PROTOCOL\_VERSION**: `"1"` = `"1"`
10
+
11
+ Defined in: [constants.ts:1](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/constants.ts#L1)
@@ -0,0 +1,11 @@
1
+ [**@actioncodes/protocol**](../../README.md)
2
+
3
+ ***
4
+
5
+ [@actioncodes/protocol](../../modules.md) / [constants](../README.md) / SUPPORTED\_CHAINS
6
+
7
+ # Variable: SUPPORTED\_CHAINS
8
+
9
+ > `const` **SUPPORTED\_CHAINS**: readonly \[`"solana"`\]
10
+
11
+ Defined in: [constants.ts:8](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/constants.ts#L8)
@@ -0,0 +1,139 @@
1
+ [**@actioncodes/protocol**](../README.md)
2
+
3
+ ***
4
+
5
+ [@actioncodes/protocol](../modules.md) / index
6
+
7
+ # index
8
+
9
+ ## References
10
+
11
+ ### ActionCode
12
+
13
+ Re-exports [ActionCode](../actioncode/classes/ActionCode.md)
14
+
15
+ ***
16
+
17
+ ### ActionCodeFields
18
+
19
+ Re-exports [ActionCodeFields](../actioncode/interfaces/ActionCodeFields.md)
20
+
21
+ ***
22
+
23
+ ### ActionCodeMetadata
24
+
25
+ Re-exports [ActionCodeMetadata](../actioncode/interfaces/ActionCodeMetadata.md)
26
+
27
+ ***
28
+
29
+ ### ActionCodesProtocol
30
+
31
+ Re-exports [ActionCodesProtocol](../protocol/classes/ActionCodesProtocol.md)
32
+
33
+ ***
34
+
35
+ ### ActionCodeStatus
36
+
37
+ Re-exports [ActionCodeStatus](../actioncode/type-aliases/ActionCodeStatus.md)
38
+
39
+ ***
40
+
41
+ ### ActionCodeTransaction
42
+
43
+ Re-exports [ActionCodeTransaction](../actioncode/interfaces/ActionCodeTransaction.md)
44
+
45
+ ***
46
+
47
+ ### BaseChainAdapter
48
+
49
+ Re-exports [BaseChainAdapter](../adapters/base/classes/BaseChainAdapter.md)
50
+
51
+ ***
52
+
53
+ ### CODE\_LENGTH
54
+
55
+ Re-exports [CODE_LENGTH](../constants/variables/CODE_LENGTH.md)
56
+
57
+ ***
58
+
59
+ ### CODE\_TTL
60
+
61
+ Re-exports [CODE_TTL](../constants/variables/CODE_TTL.md)
62
+
63
+ ***
64
+
65
+ ### CodeGenerator
66
+
67
+ Re-exports [CodeGenerator](../codegen/classes/CodeGenerator.md)
68
+
69
+ ***
70
+
71
+ ### MAX\_PREFIX\_LENGTH
72
+
73
+ Re-exports [MAX_PREFIX_LENGTH](../constants/variables/MAX_PREFIX_LENGTH.md)
74
+
75
+ ***
76
+
77
+ ### MIN\_PREFIX\_LENGTH
78
+
79
+ Re-exports [MIN_PREFIX_LENGTH](../constants/variables/MIN_PREFIX_LENGTH.md)
80
+
81
+ ***
82
+
83
+ ### PROTOCOL\_CODE\_PREFIX
84
+
85
+ Re-exports [PROTOCOL_CODE_PREFIX](../constants/variables/PROTOCOL_CODE_PREFIX.md)
86
+
87
+ ***
88
+
89
+ ### PROTOCOL\_PREFIX
90
+
91
+ Re-exports [PROTOCOL_PREFIX](../constants/variables/PROTOCOL_PREFIX.md)
92
+
93
+ ***
94
+
95
+ ### PROTOCOL\_VERSION
96
+
97
+ Re-exports [PROTOCOL_VERSION](../constants/variables/PROTOCOL_VERSION.md)
98
+
99
+ ***
100
+
101
+ ### ProtocolConfig
102
+
103
+ Re-exports [ProtocolConfig](../protocol/interfaces/ProtocolConfig.md)
104
+
105
+ ***
106
+
107
+ ### ProtocolMetaParser
108
+
109
+ Re-exports [ProtocolMetaParser](../meta/classes/ProtocolMetaParser.md)
110
+
111
+ ***
112
+
113
+ ### ProtocolMetaV1
114
+
115
+ Re-exports [ProtocolMetaV1](../meta/interfaces/ProtocolMetaV1.md)
116
+
117
+ ***
118
+
119
+ ### SolanaAdapter
120
+
121
+ Re-exports [SolanaAdapter](../adapters/solana/solana/classes/SolanaAdapter.md)
122
+
123
+ ***
124
+
125
+ ### SolanaTransaction
126
+
127
+ Re-exports [SolanaTransaction](../adapters/solana/solana/type-aliases/SolanaTransaction.md)
128
+
129
+ ***
130
+
131
+ ### SUPPORTED\_CHAINS
132
+
133
+ Re-exports [SUPPORTED_CHAINS](../constants/variables/SUPPORTED_CHAINS.md)
134
+
135
+ ***
136
+
137
+ ### SupportedChain
138
+
139
+ Re-exports [SupportedChain](../constants/type-aliases/SupportedChain.md)
@@ -0,0 +1,15 @@
1
+ [**@actioncodes/protocol**](../README.md)
2
+
3
+ ***
4
+
5
+ [@actioncodes/protocol](../modules.md) / meta
6
+
7
+ # meta
8
+
9
+ ## Classes
10
+
11
+ - [ProtocolMetaParser](classes/ProtocolMetaParser.md)
12
+
13
+ ## Interfaces
14
+
15
+ - [ProtocolMetaV1](interfaces/ProtocolMetaV1.md)
@@ -0,0 +1,177 @@
1
+ [**@actioncodes/protocol**](../../README.md)
2
+
3
+ ***
4
+
5
+ [@actioncodes/protocol](../../modules.md) / [meta](../README.md) / ProtocolMetaParser
6
+
7
+ # Class: ProtocolMetaParser
8
+
9
+ Defined in: [meta.ts:19](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/meta.ts#L19)
10
+
11
+ Protocol meta parser for structured memo/message parsing
12
+
13
+ ## Constructors
14
+
15
+ ### Constructor
16
+
17
+ > **new ProtocolMetaParser**(): `ProtocolMetaParser`
18
+
19
+ #### Returns
20
+
21
+ `ProtocolMetaParser`
22
+
23
+ ## Methods
24
+
25
+ ### fromInitiator()
26
+
27
+ > `static` **fromInitiator**(`initiator`, `iss`, `prefix`, `params?`, `timestamp?`): [`ProtocolMetaV1`](../interfaces/ProtocolMetaV1.md)
28
+
29
+ Defined in: [meta.ts:74](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/meta.ts#L74)
30
+
31
+ Create protocol meta from code and parameters
32
+
33
+ #### Parameters
34
+
35
+ ##### initiator
36
+
37
+ `string`
38
+
39
+ The initiator public key
40
+
41
+ ##### iss
42
+
43
+ `string`
44
+
45
+ The issuer (protocol authority)
46
+
47
+ ##### prefix
48
+
49
+ `string` = `"DEFAULT"`
50
+
51
+ The prefix (default: "DEFAULT")
52
+
53
+ ##### params?
54
+
55
+ `string`
56
+
57
+ Optional parameters
58
+
59
+ ##### timestamp?
60
+
61
+ `number`
62
+
63
+ Optional timestamp
64
+
65
+ #### Returns
66
+
67
+ [`ProtocolMetaV1`](../interfaces/ProtocolMetaV1.md)
68
+
69
+ ProtocolMeta object
70
+
71
+ ***
72
+
73
+ ### parse()
74
+
75
+ > `static` **parse**(`metaString`): `null` \| [`ProtocolMetaV1`](../interfaces/ProtocolMetaV1.md)
76
+
77
+ Defined in: [meta.ts:27](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/meta.ts#L27)
78
+
79
+ Parse protocol meta from string
80
+
81
+ #### Parameters
82
+
83
+ ##### metaString
84
+
85
+ `string`
86
+
87
+ The protocol meta string to parse
88
+
89
+ #### Returns
90
+
91
+ `null` \| [`ProtocolMetaV1`](../interfaces/ProtocolMetaV1.md)
92
+
93
+ Parsed ProtocolMeta object or null if invalid
94
+
95
+ ***
96
+
97
+ ### serialize()
98
+
99
+ > `static` **serialize**(`meta`): `string`
100
+
101
+ Defined in: [meta.ts:55](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/meta.ts#L55)
102
+
103
+ Serialize ProtocolMeta to string
104
+
105
+ #### Parameters
106
+
107
+ ##### meta
108
+
109
+ [`ProtocolMetaV1`](../interfaces/ProtocolMetaV1.md)
110
+
111
+ The protocol meta to serialize
112
+
113
+ #### Returns
114
+
115
+ `string`
116
+
117
+ Serialized protocol meta string
118
+
119
+ ***
120
+
121
+ ### validateCode()
122
+
123
+ > `static` **validateCode**(`meta`, `timestamp?`): `boolean`
124
+
125
+ Defined in: [meta.ts:99](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/meta.ts#L99)
126
+
127
+ Validate if a code matches the protocol meta
128
+
129
+ #### Parameters
130
+
131
+ ##### meta
132
+
133
+ [`ProtocolMetaV1`](../interfaces/ProtocolMetaV1.md)
134
+
135
+ The protocol meta to validate against
136
+
137
+ ##### timestamp?
138
+
139
+ `number`
140
+
141
+ Optional timestamp for validation (if not provided, uses current time)
142
+
143
+ #### Returns
144
+
145
+ `boolean`
146
+
147
+ True if the meta is valid
148
+
149
+ ***
150
+
151
+ ### validateMetaFromString()
152
+
153
+ > `static` **validateMetaFromString**(`metaString`, `timestamp?`): `boolean`
154
+
155
+ Defined in: [meta.ts:110](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/meta.ts#L110)
156
+
157
+ Validate if a code matches the protocol meta by parsing from string
158
+
159
+ #### Parameters
160
+
161
+ ##### metaString
162
+
163
+ `string`
164
+
165
+ The protocol meta string to validate against
166
+
167
+ ##### timestamp?
168
+
169
+ `number`
170
+
171
+ Optional timestamp for validation (if not provided, uses current time)
172
+
173
+ #### Returns
174
+
175
+ `boolean`
176
+
177
+ True if the code matches the meta
@@ -0,0 +1,59 @@
1
+ [**@actioncodes/protocol**](../../README.md)
2
+
3
+ ***
4
+
5
+ [@actioncodes/protocol](../../modules.md) / [meta](../README.md) / ProtocolMetaV1
6
+
7
+ # Interface: ProtocolMetaV1
8
+
9
+ Defined in: [meta.ts:7](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/meta.ts#L7)
10
+
11
+ Protocol meta structure for code verification
12
+
13
+ ## Properties
14
+
15
+ ### id
16
+
17
+ > **id**: `string`
18
+
19
+ Defined in: [meta.ts:11](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/meta.ts#L11)
20
+
21
+ ***
22
+
23
+ ### initiator
24
+
25
+ > **initiator**: `string`
26
+
27
+ Defined in: [meta.ts:10](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/meta.ts#L10)
28
+
29
+ ***
30
+
31
+ ### iss?
32
+
33
+ > `optional` **iss**: `string`
34
+
35
+ Defined in: [meta.ts:12](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/meta.ts#L12)
36
+
37
+ ***
38
+
39
+ ### params?
40
+
41
+ > `optional` **params**: `string`
42
+
43
+ Defined in: [meta.ts:13](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/meta.ts#L13)
44
+
45
+ ***
46
+
47
+ ### prefix
48
+
49
+ > **prefix**: `string`
50
+
51
+ Defined in: [meta.ts:9](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/meta.ts#L9)
52
+
53
+ ***
54
+
55
+ ### version
56
+
57
+ > **version**: `string`
58
+
59
+ Defined in: [meta.ts:8](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/meta.ts#L8)
@@ -0,0 +1,17 @@
1
+ [**@actioncodes/protocol**](README.md)
2
+
3
+ ***
4
+
5
+ # @actioncodes/protocol
6
+
7
+ ## Modules
8
+
9
+ - [actioncode](actioncode/README.md)
10
+ - [adapters/base](adapters/base/README.md)
11
+ - [adapters/solana](adapters/solana/README.md)
12
+ - [adapters/solana/solana](adapters/solana/solana/README.md)
13
+ - [codegen](codegen/README.md)
14
+ - [constants](constants/README.md)
15
+ - [index](index/README.md)
16
+ - [meta](meta/README.md)
17
+ - [protocol](protocol/README.md)
@@ -0,0 +1,51 @@
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)