@actioncodes/protocol 1.1.7 → 1.2.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/actioncode.d.ts +4 -0
- package/dist/actioncode.d.ts.map +1 -1
- package/dist/actioncode.js +3 -0
- package/dist/adapters/base.d.ts +1 -0
- package/dist/adapters/base.d.ts.map +1 -1
- package/dist/adapters/solana/solana.d.ts +8 -0
- package/dist/adapters/solana/solana.d.ts.map +1 -1
- package/dist/adapters/solana/solana.js +20 -0
- package/dist/protocol.d.ts +13 -4
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +85 -18
- package/docs/actioncode/classes/ActionCode.md +37 -23
- package/docs/actioncode/interfaces/ActionCodeFields.md +11 -11
- package/docs/actioncode/interfaces/ActionCodeMetadata.md +3 -3
- package/docs/actioncode/interfaces/ActionCodeTransaction.md +28 -4
- package/docs/actioncode/type-aliases/ActionCodeStatus.md +1 -1
- package/docs/adapters/base/classes/BaseChainAdapter.md +39 -13
- package/docs/adapters/solana/solana/classes/SolanaAdapter.md +55 -15
- 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 +68 -26
- package/docs/protocol/interfaces/ProtocolConfig.md +7 -7
- package/package.json +1 -1
@@ -6,15 +6,39 @@
|
|
6
6
|
|
7
7
|
# Interface: ActionCodeTransaction
|
8
8
|
|
9
|
-
Defined in: [actioncode.ts:13](https://github.com/otaprotocol/actioncodes/blob/
|
9
|
+
Defined in: [actioncode.ts:13](https://github.com/otaprotocol/actioncodes/blob/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/src/actioncode.ts#L13)
|
10
10
|
|
11
11
|
## Properties
|
12
12
|
|
13
|
+
### intentType?
|
14
|
+
|
15
|
+
> `optional` **intentType**: `"transaction"` \| `"sign-only"`
|
16
|
+
|
17
|
+
Defined in: [actioncode.ts:19](https://github.com/otaprotocol/actioncodes/blob/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/src/actioncode.ts#L19)
|
18
|
+
|
19
|
+
***
|
20
|
+
|
21
|
+
### message?
|
22
|
+
|
23
|
+
> `optional` **message**: `string`
|
24
|
+
|
25
|
+
Defined in: [actioncode.ts:17](https://github.com/otaprotocol/actioncodes/blob/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/src/actioncode.ts#L17)
|
26
|
+
|
27
|
+
***
|
28
|
+
|
29
|
+
### signedMessage?
|
30
|
+
|
31
|
+
> `optional` **signedMessage**: `string`
|
32
|
+
|
33
|
+
Defined in: [actioncode.ts:18](https://github.com/otaprotocol/actioncodes/blob/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/src/actioncode.ts#L18)
|
34
|
+
|
35
|
+
***
|
36
|
+
|
13
37
|
### transaction?
|
14
38
|
|
15
39
|
> `optional` **transaction**: `string`
|
16
40
|
|
17
|
-
Defined in: [actioncode.ts:14](https://github.com/otaprotocol/actioncodes/blob/
|
41
|
+
Defined in: [actioncode.ts:14](https://github.com/otaprotocol/actioncodes/blob/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/src/actioncode.ts#L14)
|
18
42
|
|
19
43
|
***
|
20
44
|
|
@@ -22,7 +46,7 @@ Defined in: [actioncode.ts:14](https://github.com/otaprotocol/actioncodes/blob/a
|
|
22
46
|
|
23
47
|
> `optional` **txSignature**: `string`
|
24
48
|
|
25
|
-
Defined in: [actioncode.ts:15](https://github.com/otaprotocol/actioncodes/blob/
|
49
|
+
Defined in: [actioncode.ts:15](https://github.com/otaprotocol/actioncodes/blob/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/src/actioncode.ts#L15)
|
26
50
|
|
27
51
|
***
|
28
52
|
|
@@ -30,4 +54,4 @@ Defined in: [actioncode.ts:15](https://github.com/otaprotocol/actioncodes/blob/a
|
|
30
54
|
|
31
55
|
> `optional` **txType**: `string`
|
32
56
|
|
33
|
-
Defined in: [actioncode.ts:16](https://github.com/otaprotocol/actioncodes/blob/
|
57
|
+
Defined in: [actioncode.ts:16](https://github.com/otaprotocol/actioncodes/blob/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/src/actioncode.ts#L16)
|
@@ -8,4 +8,4 @@
|
|
8
8
|
|
9
9
|
> **ActionCodeStatus** = `"pending"` \| `"resolved"` \| `"finalized"` \| `"expired"` \| `"error"`
|
10
10
|
|
11
|
-
Defined in: [actioncode.ts:6](https://github.com/otaprotocol/actioncodes/blob/
|
11
|
+
Defined in: [actioncode.ts:6](https://github.com/otaprotocol/actioncodes/blob/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/src/actioncode.ts#L6)
|
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
# Class: `abstract` BaseChainAdapter\<T\>
|
8
8
|
|
9
|
-
Defined in: [adapters/base.ts:9](https://github.com/otaprotocol/actioncodes/blob/
|
9
|
+
Defined in: [adapters/base.ts:9](https://github.com/otaprotocol/actioncodes/blob/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/src/adapters/base.ts#L9)
|
10
10
|
|
11
11
|
Base adapter class for chain-specific protocol meta operations
|
12
12
|
|
@@ -38,7 +38,7 @@ Chain-specific transaction type
|
|
38
38
|
|
39
39
|
> `abstract` `readonly` **chain**: `string`
|
40
40
|
|
41
|
-
Defined in: [adapters/base.ts:10](https://github.com/otaprotocol/actioncodes/blob/
|
41
|
+
Defined in: [adapters/base.ts:10](https://github.com/otaprotocol/actioncodes/blob/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/src/adapters/base.ts#L10)
|
42
42
|
|
43
43
|
## Methods
|
44
44
|
|
@@ -46,7 +46,7 @@ Defined in: [adapters/base.ts:10](https://github.com/otaprotocol/actioncodes/blo
|
|
46
46
|
|
47
47
|
> `abstract` **decodeMeta**(`tx`): `null` \| [`ProtocolMetaV1`](../../../meta/interfaces/ProtocolMetaV1.md)
|
48
48
|
|
49
|
-
Defined in: [adapters/base.ts:24](https://github.com/otaprotocol/actioncodes/blob/
|
49
|
+
Defined in: [adapters/base.ts:24](https://github.com/otaprotocol/actioncodes/blob/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/src/adapters/base.ts#L24)
|
50
50
|
|
51
51
|
Decode protocol meta from chain-specific transaction
|
52
52
|
|
@@ -70,7 +70,7 @@ Decoded ProtocolMetaV1 or null
|
|
70
70
|
|
71
71
|
> **detectTampering**(`tx`, `authorities`, `expectedPrefix`): `boolean`
|
72
72
|
|
73
|
-
Defined in: [adapters/base.ts:58](https://github.com/otaprotocol/actioncodes/blob/
|
73
|
+
Defined in: [adapters/base.ts:58](https://github.com/otaprotocol/actioncodes/blob/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/src/adapters/base.ts#L58)
|
74
74
|
|
75
75
|
Detect tampered transactions by cross-checking metadata
|
76
76
|
|
@@ -106,7 +106,7 @@ True if transaction is valid and not tampered
|
|
106
106
|
|
107
107
|
> `abstract` **encodeMeta**(`meta`): `any`
|
108
108
|
|
109
|
-
Defined in: [adapters/base.ts:17](https://github.com/otaprotocol/actioncodes/blob/
|
109
|
+
Defined in: [adapters/base.ts:17](https://github.com/otaprotocol/actioncodes/blob/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/src/adapters/base.ts#L17)
|
110
110
|
|
111
111
|
Encode protocol meta for this chain
|
112
112
|
|
@@ -130,7 +130,7 @@ Chain-specific encoded data
|
|
130
130
|
|
131
131
|
> **getCodeSignatureMessage**(`code`, `timestamp`, `prefix`): `string`
|
132
132
|
|
133
|
-
Defined in: [adapters/base.ts:104](https://github.com/otaprotocol/actioncodes/blob/
|
133
|
+
Defined in: [adapters/base.ts:104](https://github.com/otaprotocol/actioncodes/blob/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/src/adapters/base.ts#L104)
|
134
134
|
|
135
135
|
Get the code signature message
|
136
136
|
|
@@ -166,7 +166,7 @@ The code signature message
|
|
166
166
|
|
167
167
|
> `abstract` **hasIssuerSignature**(`tx`, `issuer`): `boolean`
|
168
168
|
|
169
|
-
Defined in: [adapters/base.ts:49](https://github.com/otaprotocol/actioncodes/blob/
|
169
|
+
Defined in: [adapters/base.ts:49](https://github.com/otaprotocol/actioncodes/blob/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/src/adapters/base.ts#L49)
|
170
170
|
|
171
171
|
Check if the issuer has signed the transaction
|
172
172
|
|
@@ -196,7 +196,7 @@ True if issuer has signed
|
|
196
196
|
|
197
197
|
> `abstract` **injectMeta**(`serializedTx`, `meta`): `string`
|
198
198
|
|
199
|
-
Defined in: [adapters/base.ts:32](https://github.com/otaprotocol/actioncodes/blob/
|
199
|
+
Defined in: [adapters/base.ts:32](https://github.com/otaprotocol/actioncodes/blob/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/src/adapters/base.ts#L32)
|
200
200
|
|
201
201
|
Inject protocol meta into chain-specific transaction
|
202
202
|
|
@@ -226,7 +226,7 @@ Serialized transaction with injected meta
|
|
226
226
|
|
227
227
|
> `abstract` **signWithProtocolKey**(`actionCode`, `key`): `Promise`\<[`ActionCode`](../../../actioncode/classes/ActionCode.md)\>
|
228
228
|
|
229
|
-
Defined in: [adapters/base.ts:126](https://github.com/otaprotocol/actioncodes/blob/
|
229
|
+
Defined in: [adapters/base.ts:126](https://github.com/otaprotocol/actioncodes/blob/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/src/adapters/base.ts#L126)
|
230
230
|
|
231
231
|
Sign the transaction with the protocol key using a callback approach
|
232
232
|
This method should be implemented by each chain-specific adapter to handle
|
@@ -254,7 +254,7 @@ Promise that resolves to the signed transaction
|
|
254
254
|
|
255
255
|
> `abstract` **validate**(`tx`, `authorities`, `expectedPrefix?`): `boolean`
|
256
256
|
|
257
|
-
Defined in: [adapters/base.ts:41](https://github.com/otaprotocol/actioncodes/blob/
|
257
|
+
Defined in: [adapters/base.ts:41](https://github.com/otaprotocol/actioncodes/blob/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/src/adapters/base.ts#L41)
|
258
258
|
|
259
259
|
Validate transaction with protocol meta and authority list
|
260
260
|
|
@@ -286,11 +286,37 @@ True if transaction is valid
|
|
286
286
|
|
287
287
|
***
|
288
288
|
|
289
|
+
### validateSignedMessage()
|
290
|
+
|
291
|
+
> `abstract` **validateSignedMessage**(`message`, `signedMessage`, `pubkey`): `boolean`
|
292
|
+
|
293
|
+
Defined in: [adapters/base.ts:138](https://github.com/otaprotocol/actioncodes/blob/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/src/adapters/base.ts#L138)
|
294
|
+
|
295
|
+
#### Parameters
|
296
|
+
|
297
|
+
##### message
|
298
|
+
|
299
|
+
`string`
|
300
|
+
|
301
|
+
##### signedMessage
|
302
|
+
|
303
|
+
`string`
|
304
|
+
|
305
|
+
##### pubkey
|
306
|
+
|
307
|
+
`string`
|
308
|
+
|
309
|
+
#### Returns
|
310
|
+
|
311
|
+
`boolean`
|
312
|
+
|
313
|
+
***
|
314
|
+
|
289
315
|
### validateTransactionIntegrity()
|
290
316
|
|
291
317
|
> `abstract` `protected` **validateTransactionIntegrity**(`tx`, `meta`): `boolean`
|
292
318
|
|
293
|
-
Defined in: [adapters/base.ts:95](https://github.com/otaprotocol/actioncodes/blob/
|
319
|
+
Defined in: [adapters/base.ts:95](https://github.com/otaprotocol/actioncodes/blob/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/src/adapters/base.ts#L95)
|
294
320
|
|
295
321
|
Chain-specific transaction integrity validation
|
296
322
|
Override this method for additional validation logic
|
@@ -321,7 +347,7 @@ True if transaction integrity is valid
|
|
321
347
|
|
322
348
|
> `abstract` **verifyCodeSignature**(`actionCode`): `boolean`
|
323
349
|
|
324
|
-
Defined in: [adapters/base.ts:115](https://github.com/otaprotocol/actioncodes/blob/
|
350
|
+
Defined in: [adapters/base.ts:115](https://github.com/otaprotocol/actioncodes/blob/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/src/adapters/base.ts#L115)
|
325
351
|
|
326
352
|
Verify the code signature
|
327
353
|
This is specific to the chain and should be implemented by the concrete adapter
|
@@ -347,7 +373,7 @@ True if the code signature is valid
|
|
347
373
|
|
348
374
|
> `abstract` **verifyFinalizedTransaction**(`tx`, `actionCode`): `boolean`
|
349
375
|
|
350
|
-
Defined in: [adapters/base.ts:136](https://github.com/otaprotocol/actioncodes/blob/
|
376
|
+
Defined in: [adapters/base.ts:136](https://github.com/otaprotocol/actioncodes/blob/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/src/adapters/base.ts#L136)
|
351
377
|
|
352
378
|
Verify the finalized transaction
|
353
379
|
|
@@ -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:27](https://github.com/otaprotocol/actioncodes/blob/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/src/adapters/solana/solana.ts#L27)
|
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:30](https://github.com/otaprotocol/actioncodes/blob/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/src/adapters/solana/solana.ts#L30)
|
39
39
|
|
40
40
|
#### Overrides
|
41
41
|
|
@@ -47,7 +47,7 @@ Defined in: [adapters/solana/solana.ts:29](https://github.com/otaprotocol/action
|
|
47
47
|
|
48
48
|
> **decodeFromBase64**(`base64String`): `null` \| [`ProtocolMetaV1`](../../../../meta/interfaces/ProtocolMetaV1.md)
|
49
49
|
|
50
|
-
Defined in: [adapters/solana/solana.ts:
|
50
|
+
Defined in: [adapters/solana/solana.ts:358](https://github.com/otaprotocol/actioncodes/blob/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/src/adapters/solana/solana.ts#L358)
|
51
51
|
|
52
52
|
Decode protocol meta from base64 string (for backward compatibility)
|
53
53
|
|
@@ -71,7 +71,7 @@ Decoded ProtocolMetaV1 or null
|
|
71
71
|
|
72
72
|
> **decodeMeta**(`tx`): `null` \| [`ProtocolMetaV1`](../../../../meta/interfaces/ProtocolMetaV1.md)
|
73
73
|
|
74
|
-
Defined in: [adapters/solana/solana.ts:
|
74
|
+
Defined in: [adapters/solana/solana.ts:58](https://github.com/otaprotocol/actioncodes/blob/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/src/adapters/solana/solana.ts#L58)
|
75
75
|
|
76
76
|
Decode protocol meta from Solana transaction (legacy or versioned)
|
77
77
|
|
@@ -99,7 +99,7 @@ Decoded ProtocolMetaV1 or null if not found
|
|
99
99
|
|
100
100
|
> **deserializeTransaction**(`base64String`): [`SolanaTransaction`](../type-aliases/SolanaTransaction.md)
|
101
101
|
|
102
|
-
Defined in: [adapters/solana/solana.ts:
|
102
|
+
Defined in: [adapters/solana/solana.ts:83](https://github.com/otaprotocol/actioncodes/blob/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/src/adapters/solana/solana.ts#L83)
|
103
103
|
|
104
104
|
Deserialize a Solana transaction from base64 string
|
105
105
|
|
@@ -123,7 +123,7 @@ SolanaTransaction object
|
|
123
123
|
|
124
124
|
> **detectTampering**(`tx`, `authorities`, `expectedPrefix`): `boolean`
|
125
125
|
|
126
|
-
Defined in: [adapters/base.ts:58](https://github.com/otaprotocol/actioncodes/blob/
|
126
|
+
Defined in: [adapters/base.ts:58](https://github.com/otaprotocol/actioncodes/blob/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/src/adapters/base.ts#L58)
|
127
127
|
|
128
128
|
Detect tampered transactions by cross-checking metadata
|
129
129
|
|
@@ -163,7 +163,7 @@ True if transaction is valid and not tampered
|
|
163
163
|
|
164
164
|
> **encodeMeta**(`meta`): `TransactionInstruction`
|
165
165
|
|
166
|
-
Defined in: [adapters/solana/solana.ts:
|
166
|
+
Defined in: [adapters/solana/solana.ts:37](https://github.com/otaprotocol/actioncodes/blob/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/src/adapters/solana/solana.ts#L37)
|
167
167
|
|
168
168
|
Encode protocol meta as a Solana memo instruction
|
169
169
|
|
@@ -191,7 +191,7 @@ TransactionInstruction for the memo
|
|
191
191
|
|
192
192
|
> **getCodeSignatureMessage**(`code`, `timestamp`, `prefix`): `string`
|
193
193
|
|
194
|
-
Defined in: [adapters/base.ts:104](https://github.com/otaprotocol/actioncodes/blob/
|
194
|
+
Defined in: [adapters/base.ts:104](https://github.com/otaprotocol/actioncodes/blob/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/src/adapters/base.ts#L104)
|
195
195
|
|
196
196
|
Get the code signature message
|
197
197
|
|
@@ -231,7 +231,7 @@ The code signature message
|
|
231
231
|
|
232
232
|
> **hasIssuerSignature**(`tx`, `issuer`): `boolean`
|
233
233
|
|
234
|
-
Defined in: [adapters/solana/solana.ts:
|
234
|
+
Defined in: [adapters/solana/solana.ts:195](https://github.com/otaprotocol/actioncodes/blob/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/src/adapters/solana/solana.ts#L195)
|
235
235
|
|
236
236
|
Check if the issuer has signed the transaction
|
237
237
|
|
@@ -265,7 +265,7 @@ True if issuer has signed
|
|
265
265
|
|
266
266
|
> **injectMeta**(`serializedTx`, `meta`): `string`
|
267
267
|
|
268
|
-
Defined in: [adapters/solana/solana.ts:
|
268
|
+
Defined in: [adapters/solana/solana.ts:103](https://github.com/otaprotocol/actioncodes/blob/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/src/adapters/solana/solana.ts#L103)
|
269
269
|
|
270
270
|
Inject protocol meta into Solana transaction
|
271
271
|
|
@@ -299,7 +299,7 @@ Serialized transaction with injected meta
|
|
299
299
|
|
300
300
|
> **signWithProtocolKey**(`actionCode`, `key`): `Promise`\<[`ActionCode`](../../../../actioncode/classes/ActionCode.md)\>
|
301
301
|
|
302
|
-
Defined in: [adapters/solana/solana.ts:
|
302
|
+
Defined in: [adapters/solana/solana.ts:368](https://github.com/otaprotocol/actioncodes/blob/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/src/adapters/solana/solana.ts#L368)
|
303
303
|
|
304
304
|
Sign the transaction with the protocol key
|
305
305
|
|
@@ -333,7 +333,7 @@ Promise that resolves to the signed action code
|
|
333
333
|
|
334
334
|
> **validate**(`tx`, `authorities`, `expectedPrefix`): `boolean`
|
335
335
|
|
336
|
-
Defined in: [adapters/solana/solana.ts:
|
336
|
+
Defined in: [adapters/solana/solana.ts:185](https://github.com/otaprotocol/actioncodes/blob/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/src/adapters/solana/solana.ts#L185)
|
337
337
|
|
338
338
|
Validate transaction with protocol meta and authority list
|
339
339
|
|
@@ -369,11 +369,51 @@ True if transaction is valid
|
|
369
369
|
|
370
370
|
***
|
371
371
|
|
372
|
+
### validateSignedMessage()
|
373
|
+
|
374
|
+
> **validateSignedMessage**(`message`, `signedMessage`, `pubkey`): `boolean`
|
375
|
+
|
376
|
+
Defined in: [adapters/solana/solana.ts:548](https://github.com/otaprotocol/actioncodes/blob/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/src/adapters/solana/solana.ts#L548)
|
377
|
+
|
378
|
+
Validate a signed message for sign-only mode
|
379
|
+
|
380
|
+
#### Parameters
|
381
|
+
|
382
|
+
##### message
|
383
|
+
|
384
|
+
`string`
|
385
|
+
|
386
|
+
The message that was signed
|
387
|
+
|
388
|
+
##### signedMessage
|
389
|
+
|
390
|
+
`string`
|
391
|
+
|
392
|
+
The signed message (base64 or hex)
|
393
|
+
|
394
|
+
##### pubkey
|
395
|
+
|
396
|
+
`string`
|
397
|
+
|
398
|
+
The public key that should have signed the message
|
399
|
+
|
400
|
+
#### Returns
|
401
|
+
|
402
|
+
`boolean`
|
403
|
+
|
404
|
+
True if the signature is valid
|
405
|
+
|
406
|
+
#### Overrides
|
407
|
+
|
408
|
+
[`BaseChainAdapter`](../../../base/classes/BaseChainAdapter.md).[`validateSignedMessage`](../../../base/classes/BaseChainAdapter.md#validatesignedmessage)
|
409
|
+
|
410
|
+
***
|
411
|
+
|
372
412
|
### validateTransactionIntegrity()
|
373
413
|
|
374
414
|
> `protected` **validateTransactionIntegrity**(`tx`, `meta`): `boolean`
|
375
415
|
|
376
|
-
Defined in: [adapters/solana/solana.ts:
|
416
|
+
Defined in: [adapters/solana/solana.ts:311](https://github.com/otaprotocol/actioncodes/blob/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/src/adapters/solana/solana.ts#L311)
|
377
417
|
|
378
418
|
Validate Solana transaction integrity with additional checks
|
379
419
|
|
@@ -407,7 +447,7 @@ True if transaction integrity is valid
|
|
407
447
|
|
408
448
|
> **verifyCodeSignature**(`actionCode`): `boolean`
|
409
449
|
|
410
|
-
Defined in: [adapters/solana/solana.ts:
|
450
|
+
Defined in: [adapters/solana/solana.ts:340](https://github.com/otaprotocol/actioncodes/blob/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/src/adapters/solana/solana.ts#L340)
|
411
451
|
|
412
452
|
Verify the code signature
|
413
453
|
This is specific to the chain and should be implemented by the concrete adapter
|
@@ -437,7 +477,7 @@ True if the code signature is valid
|
|
437
477
|
|
438
478
|
> **verifyFinalizedTransaction**(`tx`, `actionCode`): `boolean`
|
439
479
|
|
440
|
-
Defined in: [adapters/solana/solana.ts:
|
480
|
+
Defined in: [adapters/solana/solana.ts:421](https://github.com/otaprotocol/actioncodes/blob/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/src/adapters/solana/solana.ts#L421)
|
441
481
|
|
442
482
|
Verify the finalized transaction from blockchain
|
443
483
|
|
@@ -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:21](https://github.com/otaprotocol/actioncodes/blob/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/src/adapters/solana/solana.ts#L21)
|
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/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/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/a8b35
|
|
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/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/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/a8b35
|
|
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/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/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/a8b35
|
|
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/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/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/a8b35
|
|
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/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/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/a8b35
|
|
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/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/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/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/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/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/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/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/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/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/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/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/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/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/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/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/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/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/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/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/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/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/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/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/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/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/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/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/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/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/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/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/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/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/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/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/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/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/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/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/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/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/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/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/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/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/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/d0ef10ae3bd279eafa4f9f7708c521c6ab240398/src/meta.ts#L110)
|
156
156
|
|
157
157
|
Validate if a code matches the protocol meta by parsing from string
|
158
158
|
|