@actioncodes/protocol 1.0.0 → 1.0.2
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/README.md +1 -1
- package/dist/actioncode.d.ts +13 -12
- package/dist/actioncode.d.ts.map +1 -1
- package/dist/actioncode.js +13 -5
- package/dist/adapters/base.d.ts +17 -0
- package/dist/adapters/base.d.ts.map +1 -1
- package/dist/adapters/base.js +11 -0
- package/dist/adapters/solana/solana.d.ts +2 -0
- package/dist/adapters/solana/solana.d.ts.map +1 -1
- package/dist/adapters/solana/solana.js +49 -2
- package/dist/codegen.d.ts +16 -13
- package/dist/codegen.d.ts.map +1 -1
- package/dist/codegen.js +47 -19
- package/dist/protocol.d.ts +14 -14
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +39 -30
- package/docs/README.md +1 -1
- package/docs/actioncode/classes/ActionCode.md +51 -65
- package/docs/actioncode/interfaces/ActionCodeFields.md +13 -19
- package/docs/actioncode/interfaces/ActionCodeMetadata.md +3 -3
- package/docs/actioncode/interfaces/ActionCodeTransaction.md +6 -12
- package/docs/actioncode/type-aliases/ActionCodeStatus.md +1 -1
- package/docs/adapters/base/classes/BaseChainAdapter.md +70 -8
- package/docs/adapters/solana/solana/classes/SolanaAdapter.md +80 -10
- package/docs/adapters/solana/solana/type-aliases/SolanaTransaction.md +1 -1
- package/docs/codegen/classes/CodeGenerator.md +65 -61
- 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 +76 -76
- package/docs/protocol/interfaces/ProtocolConfig.md +7 -7
- package/package.json +2 -1
@@ -4,33 +4,27 @@
|
|
4
4
|
|
5
5
|
[@actioncodes/protocol](../../modules.md) / [actioncode](../README.md) / ActionCode
|
6
6
|
|
7
|
-
# Class: ActionCode
|
7
|
+
# Class: ActionCode
|
8
8
|
|
9
|
-
Defined in: [actioncode.ts:
|
10
|
-
|
11
|
-
## Type Parameters
|
12
|
-
|
13
|
-
### T
|
14
|
-
|
15
|
-
`T`
|
9
|
+
Defined in: [actioncode.ts:32](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/actioncode.ts#L32)
|
16
10
|
|
17
11
|
## Constructors
|
18
12
|
|
19
13
|
### Constructor
|
20
14
|
|
21
|
-
> **new ActionCode
|
15
|
+
> **new ActionCode**(`fields`): `ActionCode`
|
22
16
|
|
23
|
-
Defined in: [actioncode.ts:
|
17
|
+
Defined in: [actioncode.ts:33](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/actioncode.ts#L33)
|
24
18
|
|
25
19
|
#### Parameters
|
26
20
|
|
27
21
|
##### fields
|
28
22
|
|
29
|
-
[`ActionCodeFields`](../interfaces/ActionCodeFields.md)
|
23
|
+
[`ActionCodeFields`](../interfaces/ActionCodeFields.md)
|
30
24
|
|
31
25
|
#### Returns
|
32
26
|
|
33
|
-
`ActionCode
|
27
|
+
`ActionCode`
|
34
28
|
|
35
29
|
## Accessors
|
36
30
|
|
@@ -40,7 +34,7 @@ Defined in: [actioncode.ts:31](https://github.com/otaprotocol/actioncodes/blob/b
|
|
40
34
|
|
41
35
|
> **get** **chain**(): `string`
|
42
36
|
|
43
|
-
Defined in: [actioncode.ts:
|
37
|
+
Defined in: [actioncode.ts:95](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/actioncode.ts#L95)
|
44
38
|
|
45
39
|
Get the target chain for this action code
|
46
40
|
|
@@ -58,7 +52,7 @@ Chain identifier (e.g., "solana", "evm")
|
|
58
52
|
|
59
53
|
> **get** **code**(): `string`
|
60
54
|
|
61
|
-
Defined in: [actioncode.ts:
|
55
|
+
Defined in: [actioncode.ts:111](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/actioncode.ts#L111)
|
62
56
|
|
63
57
|
Get the action code string
|
64
58
|
|
@@ -76,7 +70,7 @@ The 8-character action code
|
|
76
70
|
|
77
71
|
> **get** **codeHash**(): `string`
|
78
72
|
|
79
|
-
Defined in: [actioncode.ts:
|
73
|
+
Defined in: [actioncode.ts:217](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/actioncode.ts#L217)
|
80
74
|
|
81
75
|
Get the code hash for this action code
|
82
76
|
it is also used in the protocol meta as the code id
|
@@ -95,7 +89,7 @@ Code hash string
|
|
95
89
|
|
96
90
|
> **get** **description**(): `undefined` \| `string`
|
97
91
|
|
98
|
-
Defined in: [actioncode.ts:
|
92
|
+
Defined in: [actioncode.ts:151](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/actioncode.ts#L151)
|
99
93
|
|
100
94
|
Get a human-readable description of the action
|
101
95
|
|
@@ -113,7 +107,7 @@ Description string or undefined
|
|
113
107
|
|
114
108
|
> **get** **displayString**(): `string`
|
115
109
|
|
116
|
-
Defined in: [actioncode.ts:
|
110
|
+
Defined in: [actioncode.ts:183](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/actioncode.ts#L183)
|
117
111
|
|
118
112
|
Get a human-readable display string for the action code
|
119
113
|
|
@@ -131,7 +125,7 @@ Formatted display string
|
|
131
125
|
|
132
126
|
> **get** **encoded**(): `string`
|
133
127
|
|
134
|
-
Defined in: [actioncode.ts:
|
128
|
+
Defined in: [actioncode.ts:47](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/actioncode.ts#L47)
|
135
129
|
|
136
130
|
##### Returns
|
137
131
|
|
@@ -145,7 +139,7 @@ Defined in: [actioncode.ts:45](https://github.com/otaprotocol/actioncodes/blob/b
|
|
145
139
|
|
146
140
|
> **get** **expired**(): `boolean`
|
147
141
|
|
148
|
-
Defined in: [actioncode.ts:
|
142
|
+
Defined in: [actioncode.ts:87](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/actioncode.ts#L87)
|
149
143
|
|
150
144
|
Check if the action code has expired
|
151
145
|
|
@@ -157,31 +151,17 @@ True if the code has expired
|
|
157
151
|
|
158
152
|
***
|
159
153
|
|
160
|
-
### isValid
|
161
|
-
|
162
|
-
#### Get Signature
|
163
|
-
|
164
|
-
> **get** **isValid**(): `boolean`
|
165
|
-
|
166
|
-
Defined in: [actioncode.ts:49](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/actioncode.ts#L49)
|
167
|
-
|
168
|
-
##### Returns
|
169
|
-
|
170
|
-
`boolean`
|
171
|
-
|
172
|
-
***
|
173
|
-
|
174
154
|
### json
|
175
155
|
|
176
156
|
#### Get Signature
|
177
157
|
|
178
|
-
> **get** **json**(): [`ActionCodeFields`](../interfaces/ActionCodeFields.md)
|
158
|
+
> **get** **json**(): [`ActionCodeFields`](../interfaces/ActionCodeFields.md)
|
179
159
|
|
180
|
-
Defined in: [actioncode.ts:
|
160
|
+
Defined in: [actioncode.ts:68](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/actioncode.ts#L68)
|
181
161
|
|
182
162
|
##### Returns
|
183
163
|
|
184
|
-
[`ActionCodeFields`](../interfaces/ActionCodeFields.md)
|
164
|
+
[`ActionCodeFields`](../interfaces/ActionCodeFields.md)
|
185
165
|
|
186
166
|
***
|
187
167
|
|
@@ -191,7 +171,7 @@ Defined in: [actioncode.ts:59](https://github.com/otaprotocol/actioncodes/blob/b
|
|
191
171
|
|
192
172
|
> **get** **metadata**(): `undefined` \| [`ActionCodeMetadata`](../interfaces/ActionCodeMetadata.md)
|
193
173
|
|
194
|
-
Defined in: [actioncode.ts:
|
174
|
+
Defined in: [actioncode.ts:143](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/actioncode.ts#L143)
|
195
175
|
|
196
176
|
Get metadata associated with this action code
|
197
177
|
|
@@ -209,7 +189,7 @@ Metadata object or undefined
|
|
209
189
|
|
210
190
|
> **get** **params**(): `undefined` \| `Record`\<`string`, `any`\>
|
211
191
|
|
212
|
-
Defined in: [actioncode.ts:
|
192
|
+
Defined in: [actioncode.ts:159](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/actioncode.ts#L159)
|
213
193
|
|
214
194
|
Get parameters associated with this action
|
215
195
|
|
@@ -227,7 +207,7 @@ Parameters object or undefined
|
|
227
207
|
|
228
208
|
> **get** **prefix**(): `string`
|
229
209
|
|
230
|
-
Defined in: [actioncode.ts:
|
210
|
+
Defined in: [actioncode.ts:119](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/actioncode.ts#L119)
|
231
211
|
|
232
212
|
Get the prefix used for this action code
|
233
213
|
|
@@ -245,7 +225,7 @@ Normalized prefix
|
|
245
225
|
|
246
226
|
> **get** **pubkey**(): `string`
|
247
227
|
|
248
|
-
Defined in: [actioncode.ts:
|
228
|
+
Defined in: [actioncode.ts:127](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/actioncode.ts#L127)
|
249
229
|
|
250
230
|
Get the user's public key
|
251
231
|
|
@@ -263,7 +243,7 @@ User's public key
|
|
263
243
|
|
264
244
|
> **get** **remainingTime**(): `number`
|
265
245
|
|
266
|
-
Defined in: [actioncode.ts:
|
246
|
+
Defined in: [actioncode.ts:78](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/actioncode.ts#L78)
|
267
247
|
|
268
248
|
Get remaining time in milliseconds until expiration
|
269
249
|
|
@@ -281,7 +261,7 @@ Remaining time in milliseconds, or 0 if expired
|
|
281
261
|
|
282
262
|
> **get** **remainingTimeString**(): `string`
|
283
263
|
|
284
|
-
Defined in: [actioncode.ts:
|
264
|
+
Defined in: [actioncode.ts:196](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/actioncode.ts#L196)
|
285
265
|
|
286
266
|
Get a formatted time string showing remaining time
|
287
267
|
|
@@ -299,7 +279,7 @@ Human-readable time string (e.g., "1m 30s remaining")
|
|
299
279
|
|
300
280
|
> **get** **signature**(): `string`
|
301
281
|
|
302
|
-
Defined in: [actioncode.ts:
|
282
|
+
Defined in: [actioncode.ts:175](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/actioncode.ts#L175)
|
303
283
|
|
304
284
|
Get the user's signature
|
305
285
|
|
@@ -317,7 +297,7 @@ User's signature string
|
|
317
297
|
|
318
298
|
> **get** **status**(): [`ActionCodeStatus`](../type-aliases/ActionCodeStatus.md)
|
319
299
|
|
320
|
-
Defined in: [actioncode.ts:
|
300
|
+
Defined in: [actioncode.ts:103](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/actioncode.ts#L103)
|
321
301
|
|
322
302
|
Get the current status of the action code
|
323
303
|
|
@@ -335,7 +315,7 @@ Current status
|
|
335
315
|
|
336
316
|
> **get** **timestamp**(): `number`
|
337
317
|
|
338
|
-
Defined in: [actioncode.ts:
|
318
|
+
Defined in: [actioncode.ts:167](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/actioncode.ts#L167)
|
339
319
|
|
340
320
|
Get the timestamp when the code was generated
|
341
321
|
|
@@ -351,31 +331,43 @@ Timestamp in milliseconds
|
|
351
331
|
|
352
332
|
#### Get Signature
|
353
333
|
|
354
|
-
> **get** **transaction**(): `undefined` \| [`ActionCodeTransaction`](../interfaces/ActionCodeTransaction.md)
|
334
|
+
> **get** **transaction**(): `undefined` \| [`ActionCodeTransaction`](../interfaces/ActionCodeTransaction.md)
|
355
335
|
|
356
|
-
Defined in: [actioncode.ts:
|
336
|
+
Defined in: [actioncode.ts:135](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/actioncode.ts#L135)
|
357
337
|
|
358
338
|
Get the transaction data (chain-specific)
|
359
339
|
|
360
340
|
##### Returns
|
361
341
|
|
362
|
-
`undefined` \| [`ActionCodeTransaction`](../interfaces/ActionCodeTransaction.md)
|
342
|
+
`undefined` \| [`ActionCodeTransaction`](../interfaces/ActionCodeTransaction.md)
|
363
343
|
|
364
344
|
Transaction data or undefined
|
365
345
|
|
366
346
|
## Methods
|
367
347
|
|
368
|
-
###
|
348
|
+
### isValid()
|
369
349
|
|
370
|
-
>
|
350
|
+
> **isValid**(`protocol`): `boolean`
|
371
351
|
|
372
|
-
Defined in: [actioncode.ts:
|
352
|
+
Defined in: [actioncode.ts:51](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/actioncode.ts#L51)
|
373
353
|
|
374
|
-
####
|
354
|
+
#### Parameters
|
355
|
+
|
356
|
+
##### protocol
|
357
|
+
|
358
|
+
[`ActionCodesProtocol`](../../protocol/classes/ActionCodesProtocol.md)
|
359
|
+
|
360
|
+
#### Returns
|
361
|
+
|
362
|
+
`boolean`
|
375
363
|
|
376
|
-
|
364
|
+
***
|
365
|
+
|
366
|
+
### fromEncoded()
|
367
|
+
|
368
|
+
> `static` **fromEncoded**(`encoded`): `ActionCode`
|
377
369
|
|
378
|
-
|
370
|
+
Defined in: [actioncode.ts:42](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/actioncode.ts#L42)
|
379
371
|
|
380
372
|
#### Parameters
|
381
373
|
|
@@ -385,28 +377,22 @@ Defined in: [actioncode.ts:40](https://github.com/otaprotocol/actioncodes/blob/b
|
|
385
377
|
|
386
378
|
#### Returns
|
387
379
|
|
388
|
-
`ActionCode
|
380
|
+
`ActionCode`
|
389
381
|
|
390
382
|
***
|
391
383
|
|
392
384
|
### fromPayload()
|
393
385
|
|
394
|
-
> `static` **fromPayload
|
395
|
-
|
396
|
-
Defined in: [actioncode.ts:33](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/actioncode.ts#L33)
|
397
|
-
|
398
|
-
#### Type Parameters
|
399
|
-
|
400
|
-
##### T
|
386
|
+
> `static` **fromPayload**(`input`): `ActionCode`
|
401
387
|
|
402
|
-
|
388
|
+
Defined in: [actioncode.ts:35](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/actioncode.ts#L35)
|
403
389
|
|
404
390
|
#### Parameters
|
405
391
|
|
406
392
|
##### input
|
407
393
|
|
408
|
-
[`ActionCodeFields`](../interfaces/ActionCodeFields.md)
|
394
|
+
[`ActionCodeFields`](../interfaces/ActionCodeFields.md)
|
409
395
|
|
410
396
|
#### Returns
|
411
397
|
|
412
|
-
`ActionCode
|
398
|
+
`ActionCode`
|
@@ -4,15 +4,9 @@
|
|
4
4
|
|
5
5
|
[@actioncodes/protocol](../../modules.md) / [actioncode](../README.md) / ActionCodeFields
|
6
6
|
|
7
|
-
# Interface: ActionCodeFields
|
7
|
+
# Interface: ActionCodeFields
|
8
8
|
|
9
|
-
Defined in: [actioncode.ts:
|
10
|
-
|
11
|
-
## Type Parameters
|
12
|
-
|
13
|
-
### T
|
14
|
-
|
15
|
-
`T`
|
9
|
+
Defined in: [actioncode.ts:19](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/actioncode.ts#L19)
|
16
10
|
|
17
11
|
## Properties
|
18
12
|
|
@@ -20,7 +14,7 @@ Defined in: [actioncode.ts:17](https://github.com/otaprotocol/actioncodes/blob/b
|
|
20
14
|
|
21
15
|
> **chain**: `"solana"`
|
22
16
|
|
23
|
-
Defined in: [actioncode.ts:
|
17
|
+
Defined in: [actioncode.ts:25](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/actioncode.ts#L25)
|
24
18
|
|
25
19
|
***
|
26
20
|
|
@@ -28,7 +22,7 @@ Defined in: [actioncode.ts:23](https://github.com/otaprotocol/actioncodes/blob/b
|
|
28
22
|
|
29
23
|
> **code**: `string`
|
30
24
|
|
31
|
-
Defined in: [actioncode.ts:
|
25
|
+
Defined in: [actioncode.ts:20](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/actioncode.ts#L20)
|
32
26
|
|
33
27
|
***
|
34
28
|
|
@@ -36,7 +30,7 @@ Defined in: [actioncode.ts:18](https://github.com/otaprotocol/actioncodes/blob/b
|
|
36
30
|
|
37
31
|
> **expiresAt**: `number`
|
38
32
|
|
39
|
-
Defined in: [actioncode.ts:
|
33
|
+
Defined in: [actioncode.ts:28](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/actioncode.ts#L28)
|
40
34
|
|
41
35
|
***
|
42
36
|
|
@@ -44,7 +38,7 @@ Defined in: [actioncode.ts:26](https://github.com/otaprotocol/actioncodes/blob/b
|
|
44
38
|
|
45
39
|
> `optional` **metadata**: [`ActionCodeMetadata`](ActionCodeMetadata.md)
|
46
40
|
|
47
|
-
Defined in: [actioncode.ts:
|
41
|
+
Defined in: [actioncode.ts:27](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/actioncode.ts#L27)
|
48
42
|
|
49
43
|
***
|
50
44
|
|
@@ -52,7 +46,7 @@ Defined in: [actioncode.ts:25](https://github.com/otaprotocol/actioncodes/blob/b
|
|
52
46
|
|
53
47
|
> **prefix**: `string`
|
54
48
|
|
55
|
-
Defined in: [actioncode.ts:
|
49
|
+
Defined in: [actioncode.ts:21](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/actioncode.ts#L21)
|
56
50
|
|
57
51
|
***
|
58
52
|
|
@@ -60,7 +54,7 @@ Defined in: [actioncode.ts:19](https://github.com/otaprotocol/actioncodes/blob/b
|
|
60
54
|
|
61
55
|
> **pubkey**: `string`
|
62
56
|
|
63
|
-
Defined in: [actioncode.ts:
|
57
|
+
Defined in: [actioncode.ts:22](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/actioncode.ts#L22)
|
64
58
|
|
65
59
|
***
|
66
60
|
|
@@ -68,7 +62,7 @@ Defined in: [actioncode.ts:20](https://github.com/otaprotocol/actioncodes/blob/b
|
|
68
62
|
|
69
63
|
> **signature**: `string`
|
70
64
|
|
71
|
-
Defined in: [actioncode.ts:
|
65
|
+
Defined in: [actioncode.ts:24](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/actioncode.ts#L24)
|
72
66
|
|
73
67
|
***
|
74
68
|
|
@@ -76,7 +70,7 @@ Defined in: [actioncode.ts:22](https://github.com/otaprotocol/actioncodes/blob/b
|
|
76
70
|
|
77
71
|
> **status**: [`ActionCodeStatus`](../type-aliases/ActionCodeStatus.md)
|
78
72
|
|
79
|
-
Defined in: [actioncode.ts:
|
73
|
+
Defined in: [actioncode.ts:29](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/actioncode.ts#L29)
|
80
74
|
|
81
75
|
***
|
82
76
|
|
@@ -84,12 +78,12 @@ Defined in: [actioncode.ts:27](https://github.com/otaprotocol/actioncodes/blob/b
|
|
84
78
|
|
85
79
|
> **timestamp**: `number`
|
86
80
|
|
87
|
-
Defined in: [actioncode.ts:
|
81
|
+
Defined in: [actioncode.ts:23](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/actioncode.ts#L23)
|
88
82
|
|
89
83
|
***
|
90
84
|
|
91
85
|
### transaction?
|
92
86
|
|
93
|
-
> `optional` **transaction**: [`ActionCodeTransaction`](ActionCodeTransaction.md)
|
87
|
+
> `optional` **transaction**: [`ActionCodeTransaction`](ActionCodeTransaction.md)
|
94
88
|
|
95
|
-
Defined in: [actioncode.ts:
|
89
|
+
Defined in: [actioncode.ts:26](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/actioncode.ts#L26)
|
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
# Interface: ActionCodeMetadata
|
8
8
|
|
9
|
-
Defined in: [actioncode.ts:
|
9
|
+
Defined in: [actioncode.ts:8](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/actioncode.ts#L8)
|
10
10
|
|
11
11
|
## Properties
|
12
12
|
|
@@ -14,7 +14,7 @@ Defined in: [actioncode.ts:6](https://github.com/otaprotocol/actioncodes/blob/b4
|
|
14
14
|
|
15
15
|
> `optional` **description**: `string`
|
16
16
|
|
17
|
-
Defined in: [actioncode.ts:
|
17
|
+
Defined in: [actioncode.ts:9](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/actioncode.ts#L9)
|
18
18
|
|
19
19
|
***
|
20
20
|
|
@@ -22,4 +22,4 @@ Defined in: [actioncode.ts:7](https://github.com/otaprotocol/actioncodes/blob/b4
|
|
22
22
|
|
23
23
|
> `optional` **params**: `Record`\<`string`, `any`\>
|
24
24
|
|
25
|
-
Defined in: [actioncode.ts:
|
25
|
+
Defined in: [actioncode.ts:10](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/actioncode.ts#L10)
|
@@ -4,23 +4,17 @@
|
|
4
4
|
|
5
5
|
[@actioncodes/protocol](../../modules.md) / [actioncode](../README.md) / ActionCodeTransaction
|
6
6
|
|
7
|
-
# Interface: ActionCodeTransaction
|
7
|
+
# Interface: ActionCodeTransaction
|
8
8
|
|
9
|
-
Defined in: [actioncode.ts:
|
10
|
-
|
11
|
-
## Type Parameters
|
12
|
-
|
13
|
-
### T
|
14
|
-
|
15
|
-
`T`
|
9
|
+
Defined in: [actioncode.ts:13](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/actioncode.ts#L13)
|
16
10
|
|
17
11
|
## Properties
|
18
12
|
|
19
13
|
### transaction?
|
20
14
|
|
21
|
-
> `optional` **transaction**: `
|
15
|
+
> `optional` **transaction**: `string`
|
22
16
|
|
23
|
-
Defined in: [actioncode.ts:
|
17
|
+
Defined in: [actioncode.ts:14](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/actioncode.ts#L14)
|
24
18
|
|
25
19
|
***
|
26
20
|
|
@@ -28,7 +22,7 @@ Defined in: [actioncode.ts:12](https://github.com/otaprotocol/actioncodes/blob/b
|
|
28
22
|
|
29
23
|
> `optional` **txSignature**: `string`
|
30
24
|
|
31
|
-
Defined in: [actioncode.ts:
|
25
|
+
Defined in: [actioncode.ts:15](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/actioncode.ts#L15)
|
32
26
|
|
33
27
|
***
|
34
28
|
|
@@ -36,4 +30,4 @@ Defined in: [actioncode.ts:13](https://github.com/otaprotocol/actioncodes/blob/b
|
|
36
30
|
|
37
31
|
> `optional` **txType**: `string`
|
38
32
|
|
39
|
-
Defined in: [actioncode.ts:
|
33
|
+
Defined in: [actioncode.ts:16](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/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:
|
11
|
+
Defined in: [actioncode.ts:6](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/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
|
+
Defined in: [adapters/base.ts:9](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/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:
|
41
|
+
Defined in: [adapters/base.ts:10](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/adapters/base.ts#L10)
|
42
42
|
|
43
43
|
## Methods
|
44
44
|
|
@@ -46,7 +46,7 @@ Defined in: [adapters/base.ts:8](https://github.com/otaprotocol/actioncodes/blob
|
|
46
46
|
|
47
47
|
> `abstract` **decode**(`tx`): `null` \| [`ProtocolMetaV1`](../../../meta/interfaces/ProtocolMetaV1.md)
|
48
48
|
|
49
|
-
Defined in: [adapters/base.ts:
|
49
|
+
Defined in: [adapters/base.ts:24](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/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:
|
73
|
+
Defined in: [adapters/base.ts:50](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/adapters/base.ts#L50)
|
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` **encode**(`meta`): `any`
|
108
108
|
|
109
|
-
Defined in: [adapters/base.ts:
|
109
|
+
Defined in: [adapters/base.ts:17](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/adapters/base.ts#L17)
|
110
110
|
|
111
111
|
Encode protocol meta for this chain
|
112
112
|
|
@@ -126,11 +126,47 @@ Chain-specific encoded data
|
|
126
126
|
|
127
127
|
***
|
128
128
|
|
129
|
+
### getCodeSignatureMessage()
|
130
|
+
|
131
|
+
> **getCodeSignatureMessage**(`code`, `timestamp`, `prefix`): `string`
|
132
|
+
|
133
|
+
Defined in: [adapters/base.ts:96](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/adapters/base.ts#L96)
|
134
|
+
|
135
|
+
Get the code signature message
|
136
|
+
|
137
|
+
#### Parameters
|
138
|
+
|
139
|
+
##### code
|
140
|
+
|
141
|
+
`string`
|
142
|
+
|
143
|
+
The code to sign
|
144
|
+
|
145
|
+
##### timestamp
|
146
|
+
|
147
|
+
`number`
|
148
|
+
|
149
|
+
The timestamp of the code
|
150
|
+
|
151
|
+
##### prefix
|
152
|
+
|
153
|
+
`string` = `PROTOCOL_CODE_PREFIX`
|
154
|
+
|
155
|
+
The prefix of the code
|
156
|
+
|
157
|
+
#### Returns
|
158
|
+
|
159
|
+
`string`
|
160
|
+
|
161
|
+
The code signature message
|
162
|
+
|
163
|
+
***
|
164
|
+
|
129
165
|
### hasIssuerSignature()
|
130
166
|
|
131
167
|
> `abstract` **hasIssuerSignature**(`tx`, `issuer`): `boolean`
|
132
168
|
|
133
|
-
Defined in: [adapters/base.ts:
|
169
|
+
Defined in: [adapters/base.ts:41](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/adapters/base.ts#L41)
|
134
170
|
|
135
171
|
Check if the issuer has signed the transaction
|
136
172
|
|
@@ -160,7 +196,7 @@ True if issuer has signed
|
|
160
196
|
|
161
197
|
> `abstract` **validate**(`tx`, `authorities`, `expectedPrefix?`): `boolean`
|
162
198
|
|
163
|
-
Defined in: [adapters/base.ts:
|
199
|
+
Defined in: [adapters/base.ts:33](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/adapters/base.ts#L33)
|
164
200
|
|
165
201
|
Validate transaction with protocol meta and authority list
|
166
202
|
|
@@ -196,7 +232,7 @@ True if transaction is valid
|
|
196
232
|
|
197
233
|
> `abstract` `protected` **validateTransactionIntegrity**(`tx`, `meta`): `boolean`
|
198
234
|
|
199
|
-
Defined in: [adapters/base.ts:
|
235
|
+
Defined in: [adapters/base.ts:87](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/adapters/base.ts#L87)
|
200
236
|
|
201
237
|
Chain-specific transaction integrity validation
|
202
238
|
Override this method for additional validation logic
|
@@ -220,3 +256,29 @@ Decoded protocol meta
|
|
220
256
|
`boolean`
|
221
257
|
|
222
258
|
True if transaction integrity is valid
|
259
|
+
|
260
|
+
***
|
261
|
+
|
262
|
+
### verifyCodeSignature()
|
263
|
+
|
264
|
+
> `abstract` **verifyCodeSignature**(`actionCode`): `boolean`
|
265
|
+
|
266
|
+
Defined in: [adapters/base.ts:107](https://github.com/otaprotocol/actioncodes/blob/6e0359c879f763df764595dbea0cb596eff80113/src/adapters/base.ts#L107)
|
267
|
+
|
268
|
+
Verify the code signature
|
269
|
+
This is specific to the chain and should be implemented by the concrete adapter
|
270
|
+
It will be used to verify the code signature for the action code if the right wallet is used to sign the code
|
271
|
+
|
272
|
+
#### Parameters
|
273
|
+
|
274
|
+
##### actionCode
|
275
|
+
|
276
|
+
[`ActionCode`](../../../actioncode/classes/ActionCode.md)
|
277
|
+
|
278
|
+
The action code to verify
|
279
|
+
|
280
|
+
#### Returns
|
281
|
+
|
282
|
+
`boolean`
|
283
|
+
|
284
|
+
True if the code signature is valid
|