@actioncodes/protocol 1.0.3 → 1.1.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.
- package/dist/adapters/base.d.ts +10 -0
- package/dist/adapters/base.d.ts.map +1 -1
- package/dist/adapters/solana/solana.d.ts +7 -1
- package/dist/adapters/solana/solana.d.ts.map +1 -1
- package/dist/adapters/solana/solana.js +39 -0
- 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 +38 -10
- package/docs/adapters/solana/solana/classes/SolanaAdapter.md +42 -12
- 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 +21 -21
- 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:
|
9
|
+
Defined in: [adapters/solana/solana.ts:25](https://github.com/otaprotocol/actioncodes/blob/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/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:
|
38
|
+
Defined in: [adapters/solana/solana.ts:28](https://github.com/otaprotocol/actioncodes/blob/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/src/adapters/solana/solana.ts#L28)
|
39
39
|
|
40
40
|
#### Overrides
|
41
41
|
|
@@ -47,7 +47,7 @@ Defined in: [adapters/solana/solana.ts:27](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:
|
50
|
+
Defined in: [adapters/solana/solana.ts:45](https://github.com/otaprotocol/actioncodes/blob/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/src/adapters/solana/solana.ts#L45)
|
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:
|
78
|
+
Defined in: [adapters/solana/solana.ts:214](https://github.com/otaprotocol/actioncodes/blob/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/src/adapters/solana/solana.ts#L214)
|
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:50](https://github.com/otaprotocol/actioncodes/blob/
|
102
|
+
Defined in: [adapters/base.ts:50](https://github.com/otaprotocol/actioncodes/blob/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/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:
|
142
|
+
Defined in: [adapters/solana/solana.ts:35](https://github.com/otaprotocol/actioncodes/blob/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/src/adapters/solana/solana.ts#L35)
|
143
143
|
|
144
144
|
Encode protocol meta as a Solana memo instruction
|
145
145
|
|
@@ -167,7 +167,7 @@ TransactionInstruction for the memo
|
|
167
167
|
|
168
168
|
> **getCodeSignatureMessage**(`code`, `timestamp`, `prefix`): `string`
|
169
169
|
|
170
|
-
Defined in: [adapters/base.ts:96](https://github.com/otaprotocol/actioncodes/blob/
|
170
|
+
Defined in: [adapters/base.ts:96](https://github.com/otaprotocol/actioncodes/blob/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/src/adapters/base.ts#L96)
|
171
171
|
|
172
172
|
Get the code signature message
|
173
173
|
|
@@ -207,7 +207,7 @@ The code signature message
|
|
207
207
|
|
208
208
|
> **hasIssuerSignature**(`tx`, `issuer`): `boolean`
|
209
209
|
|
210
|
-
Defined in: [adapters/solana/solana.ts:
|
210
|
+
Defined in: [adapters/solana/solana.ts:73](https://github.com/otaprotocol/actioncodes/blob/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/src/adapters/solana/solana.ts#L73)
|
211
211
|
|
212
212
|
Check if the issuer has signed the transaction
|
213
213
|
|
@@ -237,11 +237,41 @@ True if issuer has signed
|
|
237
237
|
|
238
238
|
***
|
239
239
|
|
240
|
+
### signWithProtocolKey()
|
241
|
+
|
242
|
+
> **signWithProtocolKey**(`actionCode`, `key`): `Promise`\<[`ActionCode`](../../../../actioncode/classes/ActionCode.md)\>
|
243
|
+
|
244
|
+
Defined in: [adapters/solana/solana.ts:272](https://github.com/otaprotocol/actioncodes/blob/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/src/adapters/solana/solana.ts#L272)
|
245
|
+
|
246
|
+
Sign the transaction with the protocol key using a callback approach
|
247
|
+
|
248
|
+
#### Parameters
|
249
|
+
|
250
|
+
##### actionCode
|
251
|
+
|
252
|
+
[`ActionCode`](../../../../actioncode/classes/ActionCode.md)
|
253
|
+
|
254
|
+
##### key
|
255
|
+
|
256
|
+
`Keypair`
|
257
|
+
|
258
|
+
#### Returns
|
259
|
+
|
260
|
+
`Promise`\<[`ActionCode`](../../../../actioncode/classes/ActionCode.md)\>
|
261
|
+
|
262
|
+
Promise that resolves to the signed transaction
|
263
|
+
|
264
|
+
#### Overrides
|
265
|
+
|
266
|
+
[`BaseChainAdapter`](../../../base/classes/BaseChainAdapter.md).[`signWithProtocolKey`](../../../base/classes/BaseChainAdapter.md#signwithprotocolkey)
|
267
|
+
|
268
|
+
***
|
269
|
+
|
240
270
|
### validate()
|
241
271
|
|
242
272
|
> **validate**(`tx`, `authorities`, `expectedPrefix`): `boolean`
|
243
273
|
|
244
|
-
Defined in: [adapters/solana/solana.ts:
|
274
|
+
Defined in: [adapters/solana/solana.ts:63](https://github.com/otaprotocol/actioncodes/blob/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/src/adapters/solana/solana.ts#L63)
|
245
275
|
|
246
276
|
Validate transaction with protocol meta and authority list
|
247
277
|
|
@@ -281,7 +311,7 @@ True if transaction is valid
|
|
281
311
|
|
282
312
|
> **validateFromBase64**(`base64String`, `authorities`, `expectedPrefix`): `boolean`
|
283
313
|
|
284
|
-
Defined in: [adapters/solana/solana.ts:
|
314
|
+
Defined in: [adapters/solana/solana.ts:237](https://github.com/otaprotocol/actioncodes/blob/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/src/adapters/solana/solana.ts#L237)
|
285
315
|
|
286
316
|
Validate base64 transaction (for backward compatibility)
|
287
317
|
|
@@ -317,7 +347,7 @@ True if transaction is valid
|
|
317
347
|
|
318
348
|
> `protected` **validateTransactionIntegrity**(`tx`, `meta`): `boolean`
|
319
349
|
|
320
|
-
Defined in: [adapters/solana/solana.ts:
|
350
|
+
Defined in: [adapters/solana/solana.ts:180](https://github.com/otaprotocol/actioncodes/blob/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/src/adapters/solana/solana.ts#L180)
|
321
351
|
|
322
352
|
Validate Solana transaction integrity with additional checks
|
323
353
|
|
@@ -351,7 +381,7 @@ True if transaction integrity is valid
|
|
351
381
|
|
352
382
|
> **verifyCodeSignature**(`actionCode`): `boolean`
|
353
383
|
|
354
|
-
Defined in: [adapters/solana/solana.ts:
|
384
|
+
Defined in: [adapters/solana/solana.ts:254](https://github.com/otaprotocol/actioncodes/blob/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/src/adapters/solana/solana.ts#L254)
|
355
385
|
|
356
386
|
Verify the code signature
|
357
387
|
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:
|
11
|
+
Defined in: [adapters/solana/solana.ts:19](https://github.com/otaprotocol/actioncodes/blob/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/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/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/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/007a9
|
|
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/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/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/007a9
|
|
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/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/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/007a9
|
|
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/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/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/007a9
|
|
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/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/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/007a9
|
|
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/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/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/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/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/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/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/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/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/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/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/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/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/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/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/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/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/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/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/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/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/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/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/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/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/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/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/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/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/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/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/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/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/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/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/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/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/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/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/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/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/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/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/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/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/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/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/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/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/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/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/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/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/007a9e0
|
|
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/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/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/007a9e0
|
|
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/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/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/007a9e0
|
|
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/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/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/007a9e0
|
|
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/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/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/007a9e0d
|
|
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/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/src/meta.ts#L8)
|
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
# Class: ActionCodesProtocol
|
8
8
|
|
9
|
-
Defined in: [protocol.ts:31](https://github.com/otaprotocol/actioncodes/blob/
|
9
|
+
Defined in: [protocol.ts:31](https://github.com/otaprotocol/actioncodes/blob/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/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/
|
22
|
+
Defined in: [protocol.ts:35](https://github.com/otaprotocol/actioncodes/blob/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/src/protocol.ts#L35)
|
23
23
|
|
24
24
|
#### Parameters
|
25
25
|
|
@@ -37,7 +37,7 @@ Defined in: [protocol.ts:35](https://github.com/otaprotocol/actioncodes/blob/007
|
|
37
37
|
|
38
38
|
> **attachTransaction**(`actionCode`, `transaction`, `txType?`): [`ActionCode`](../../actioncode/classes/ActionCode.md)
|
39
39
|
|
40
|
-
Defined in: [protocol.ts:161](https://github.com/otaprotocol/actioncodes/blob/
|
40
|
+
Defined in: [protocol.ts:161](https://github.com/otaprotocol/actioncodes/blob/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/src/protocol.ts#L161)
|
41
41
|
|
42
42
|
Attach a transaction to an action code
|
43
43
|
|
@@ -73,7 +73,7 @@ Updated ActionCode
|
|
73
73
|
|
74
74
|
> **createActionCode**(`pubkey`, `signFn`, `chain`, `prefix`, `timestamp?`): `Promise`\<[`ActionCode`](../../actioncode/classes/ActionCode.md)\>
|
75
75
|
|
76
|
-
Defined in: [protocol.ts:111](https://github.com/otaprotocol/actioncodes/blob/
|
76
|
+
Defined in: [protocol.ts:111](https://github.com/otaprotocol/actioncodes/blob/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/src/protocol.ts#L111)
|
77
77
|
|
78
78
|
Create an action code
|
79
79
|
|
@@ -121,7 +121,7 @@ Promise resolving to a complete ActionCode object
|
|
121
121
|
|
122
122
|
> **createProtocolMeta**(`actionCode`, `issuer?`, `params?`): [`ProtocolMetaV1`](../../meta/interfaces/ProtocolMetaV1.md)
|
123
123
|
|
124
|
-
Defined in: [protocol.ts:226](https://github.com/otaprotocol/actioncodes/blob/
|
124
|
+
Defined in: [protocol.ts:226](https://github.com/otaprotocol/actioncodes/blob/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/src/protocol.ts#L226)
|
125
125
|
|
126
126
|
Create protocol meta for a transaction
|
127
127
|
|
@@ -157,7 +157,7 @@ ProtocolMetaV1 object
|
|
157
157
|
|
158
158
|
> **decodeProtocolMeta**(`transaction`, `chain`): `null` \| [`ProtocolMetaV1`](../../meta/interfaces/ProtocolMetaV1.md)
|
159
159
|
|
160
|
-
Defined in: [protocol.ts:260](https://github.com/otaprotocol/actioncodes/blob/
|
160
|
+
Defined in: [protocol.ts:260](https://github.com/otaprotocol/actioncodes/blob/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/src/protocol.ts#L260)
|
161
161
|
|
162
162
|
Decode protocol meta from a transaction
|
163
163
|
|
@@ -187,7 +187,7 @@ Decoded ProtocolMetaV1 or null
|
|
187
187
|
|
188
188
|
> **decodeProtocolMetaTyped**\<`T`\>(`transaction`, `chain`): `null` \| [`ProtocolMetaV1`](../../meta/interfaces/ProtocolMetaV1.md)
|
189
189
|
|
190
|
-
Defined in: [protocol.ts:341](https://github.com/otaprotocol/actioncodes/blob/
|
190
|
+
Defined in: [protocol.ts:341](https://github.com/otaprotocol/actioncodes/blob/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/src/protocol.ts#L341)
|
191
191
|
|
192
192
|
Decode protocol meta with type safety
|
193
193
|
|
@@ -223,7 +223,7 @@ Decoded ProtocolMetaV1 or null
|
|
223
223
|
|
224
224
|
> **detectTampering**\<`T`\>(`transaction`, `chain`, `authorities`, `expectedPrefix?`): `boolean`
|
225
225
|
|
226
|
-
Defined in: [protocol.ts:321](https://github.com/otaprotocol/actioncodes/blob/
|
226
|
+
Defined in: [protocol.ts:321](https://github.com/otaprotocol/actioncodes/blob/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/src/protocol.ts#L321)
|
227
227
|
|
228
228
|
Detect tampered transactions with type safety
|
229
229
|
|
@@ -271,7 +271,7 @@ True if transaction is valid and not tampered
|
|
271
271
|
|
272
272
|
> **encodeProtocolMeta**(`meta`, `chain`): `any`
|
273
273
|
|
274
|
-
Defined in: [protocol.ts:245](https://github.com/otaprotocol/actioncodes/blob/
|
274
|
+
Defined in: [protocol.ts:245](https://github.com/otaprotocol/actioncodes/blob/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/src/protocol.ts#L245)
|
275
275
|
|
276
276
|
Encode protocol meta for a specific chain
|
277
277
|
|
@@ -301,7 +301,7 @@ Chain-specific encoded meta
|
|
301
301
|
|
302
302
|
> **finalizeActionCode**(`actionCode`, `txSignature`): [`ActionCode`](../../actioncode/classes/ActionCode.md)
|
303
303
|
|
304
|
-
Defined in: [protocol.ts:194](https://github.com/otaprotocol/actioncodes/blob/
|
304
|
+
Defined in: [protocol.ts:194](https://github.com/otaprotocol/actioncodes/blob/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/src/protocol.ts#L194)
|
305
305
|
|
306
306
|
Finalize an action code with transaction signature
|
307
307
|
|
@@ -331,7 +331,7 @@ Updated ActionCode
|
|
331
331
|
|
332
332
|
> **getChainAdapter**\<`T`\>(`chain`): `undefined` \| [`BaseChainAdapter`](../../adapters/base/classes/BaseChainAdapter.md)\<`T`\>
|
333
333
|
|
334
|
-
Defined in: [protocol.ts:77](https://github.com/otaprotocol/actioncodes/blob/
|
334
|
+
Defined in: [protocol.ts:77](https://github.com/otaprotocol/actioncodes/blob/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/src/protocol.ts#L77)
|
335
335
|
|
336
336
|
Get chain adapter with proper typing
|
337
337
|
|
@@ -361,7 +361,7 @@ Chain adapter or undefined
|
|
361
361
|
|
362
362
|
> **getConfig**(): [`ProtocolConfig`](../interfaces/ProtocolConfig.md)
|
363
363
|
|
364
|
-
Defined in: [protocol.ts:354](https://github.com/otaprotocol/actioncodes/blob/
|
364
|
+
Defined in: [protocol.ts:354](https://github.com/otaprotocol/actioncodes/blob/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/src/protocol.ts#L354)
|
365
365
|
|
366
366
|
Get protocol configuration
|
367
367
|
|
@@ -377,7 +377,7 @@ Current protocol configuration
|
|
377
377
|
|
378
378
|
> **getRegisteredChains**(): `string`[]
|
379
379
|
|
380
|
-
Defined in: [protocol.ts:59](https://github.com/otaprotocol/actioncodes/blob/
|
380
|
+
Defined in: [protocol.ts:59](https://github.com/otaprotocol/actioncodes/blob/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/src/protocol.ts#L59)
|
381
381
|
|
382
382
|
Get registered chain adapters
|
383
383
|
|
@@ -393,7 +393,7 @@ Array of registered chain identifiers
|
|
393
393
|
|
394
394
|
> **isChainSupported**(`chain`): `boolean`
|
395
395
|
|
396
|
-
Defined in: [protocol.ts:68](https://github.com/otaprotocol/actioncodes/blob/
|
396
|
+
Defined in: [protocol.ts:68](https://github.com/otaprotocol/actioncodes/blob/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/src/protocol.ts#L68)
|
397
397
|
|
398
398
|
Check if a chain is supported
|
399
399
|
|
@@ -417,7 +417,7 @@ True if chain is supported
|
|
417
417
|
|
418
418
|
> **registerAdapter**\<`T`\>(`adapter`): `void`
|
419
419
|
|
420
|
-
Defined in: [protocol.ts:51](https://github.com/otaprotocol/actioncodes/blob/
|
420
|
+
Defined in: [protocol.ts:51](https://github.com/otaprotocol/actioncodes/blob/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/src/protocol.ts#L51)
|
421
421
|
|
422
422
|
Register a chain adapter
|
423
423
|
|
@@ -445,7 +445,7 @@ Chain adapter implementation
|
|
445
445
|
|
446
446
|
> **updateConfig**(`updates`): `void`
|
447
447
|
|
448
|
-
Defined in: [protocol.ts:362](https://github.com/otaprotocol/actioncodes/blob/
|
448
|
+
Defined in: [protocol.ts:362](https://github.com/otaprotocol/actioncodes/blob/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/src/protocol.ts#L362)
|
449
449
|
|
450
450
|
Update protocol configuration
|
451
451
|
|
@@ -467,7 +467,7 @@ Configuration updates
|
|
467
467
|
|
468
468
|
> **validateActionCode**(`actionCode`): `boolean`
|
469
469
|
|
470
|
-
Defined in: [protocol.ts:86](https://github.com/otaprotocol/actioncodes/blob/
|
470
|
+
Defined in: [protocol.ts:86](https://github.com/otaprotocol/actioncodes/blob/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/src/protocol.ts#L86)
|
471
471
|
|
472
472
|
Validate an action code
|
473
473
|
|
@@ -491,7 +491,7 @@ True if valid
|
|
491
491
|
|
492
492
|
> **validateTransaction**(`transaction`, `chain`, `authorities`, `expectedPrefix?`): `boolean`
|
493
493
|
|
494
|
-
Defined in: [protocol.ts:277](https://github.com/otaprotocol/actioncodes/blob/
|
494
|
+
Defined in: [protocol.ts:277](https://github.com/otaprotocol/actioncodes/blob/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/src/protocol.ts#L277)
|
495
495
|
|
496
496
|
Validate a transaction with protocol meta
|
497
497
|
|
@@ -533,7 +533,7 @@ True if transaction is valid
|
|
533
533
|
|
534
534
|
> **validateTransactionTyped**\<`T`\>(`transaction`, `chain`, `authorities`, `expectedPrefix?`): `boolean`
|
535
535
|
|
536
|
-
Defined in: [protocol.ts:299](https://github.com/otaprotocol/actioncodes/blob/
|
536
|
+
Defined in: [protocol.ts:299](https://github.com/otaprotocol/actioncodes/blob/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/src/protocol.ts#L299)
|
537
537
|
|
538
538
|
Type-safe transaction validation for specific chains
|
539
539
|
|
@@ -581,7 +581,7 @@ True if transaction is valid
|
|
581
581
|
|
582
582
|
> `static` **create**(): `ActionCodesProtocol`
|
583
583
|
|
584
|
-
Defined in: [protocol.ts:370](https://github.com/otaprotocol/actioncodes/blob/
|
584
|
+
Defined in: [protocol.ts:370](https://github.com/otaprotocol/actioncodes/blob/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/src/protocol.ts#L370)
|
585
585
|
|
586
586
|
Create a new protocol instance with default configuration
|
587
587
|
|
@@ -597,7 +597,7 @@ New protocol instance
|
|
597
597
|
|
598
598
|
> `static` **createWithConfig**(`config`): `ActionCodesProtocol`
|
599
599
|
|
600
|
-
Defined in: [protocol.ts:379](https://github.com/otaprotocol/actioncodes/blob/
|
600
|
+
Defined in: [protocol.ts:379](https://github.com/otaprotocol/actioncodes/blob/c724b443a380f5f43ae1dd1ddefb6b90efaa0aa5/src/protocol.ts#L379)
|
601
601
|
|
602
602
|
Create a new protocol instance with custom configuration
|
603
603
|
|