@actioncodes/protocol 1.2.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. package/LICENSE +2 -2
  2. package/README.md +32 -45
  3. package/dist/ActionCodesProtocol.d.ts +35 -0
  4. package/dist/ActionCodesProtocol.d.ts.map +1 -0
  5. package/dist/adapters/BaseChainAdapter.d.ts +22 -0
  6. package/dist/adapters/BaseChainAdapter.d.ts.map +1 -0
  7. package/dist/adapters/SolanaAdapter.d.ts +44 -0
  8. package/dist/adapters/SolanaAdapter.d.ts.map +1 -0
  9. package/dist/constants.d.ts +6 -8
  10. package/dist/constants.d.ts.map +1 -1
  11. package/dist/errors.d.ts +63 -0
  12. package/dist/errors.d.ts.map +1 -0
  13. package/dist/index.cjs +3 -0
  14. package/dist/index.cjs.map +25 -0
  15. package/dist/index.d.ts +10 -8
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +3 -23
  18. package/dist/index.js.map +25 -0
  19. package/dist/strategy/DelegationStrategy.d.ts +43 -0
  20. package/dist/strategy/DelegationStrategy.d.ts.map +1 -0
  21. package/dist/strategy/WalletStrategy.d.ts +8 -0
  22. package/dist/strategy/WalletStrategy.d.ts.map +1 -0
  23. package/dist/types.d.ts +40 -0
  24. package/dist/types.d.ts.map +1 -0
  25. package/dist/utils/canonical.d.ts +5 -0
  26. package/dist/utils/canonical.d.ts.map +1 -0
  27. package/dist/utils/crypto.d.ts +13 -0
  28. package/dist/utils/crypto.d.ts.map +1 -0
  29. package/dist/utils/protocolMeta.d.ts +16 -0
  30. package/dist/utils/protocolMeta.d.ts.map +1 -0
  31. package/docs/ActionCodesProtocol/README.md +11 -0
  32. package/docs/ActionCodesProtocol/classes/ActionCodesProtocol.md +147 -0
  33. package/docs/README.md +10 -50
  34. package/docs/adapters/BaseChainAdapter/README.md +20 -0
  35. package/docs/adapters/BaseChainAdapter/classes/BaseChainAdapter.md +56 -0
  36. package/docs/adapters/BaseChainAdapter/interfaces/BaseContext.md +17 -0
  37. package/docs/adapters/BaseChainAdapter/interfaces/ChainAdapter.md +33 -0
  38. package/docs/adapters/BaseChainAdapter/type-aliases/ChainContext.md +23 -0
  39. package/docs/adapters/NodeCryptoAdapter/README.md +15 -0
  40. package/docs/adapters/NodeCryptoAdapter/classes/NodeCryptoAdapter.md +254 -0
  41. package/docs/adapters/NodeCryptoAdapter/type-aliases/NodeCryptoContext.md +27 -0
  42. package/docs/adapters/SolanaAdapter/README.md +16 -0
  43. package/docs/adapters/SolanaAdapter/classes/SolanaAdapter.md +190 -0
  44. package/docs/adapters/SolanaAdapter/type-aliases/SolanaContext.md +27 -0
  45. package/docs/adapters/SolanaAdapter/type-aliases/SolanaTransaction.md +13 -0
  46. package/docs/constants/README.md +8 -13
  47. package/docs/constants/variables/CODE_CHARSET_DIGITS.md +11 -0
  48. package/docs/constants/variables/CODE_DEFAULT_LENGTH.md +11 -0
  49. package/docs/constants/variables/CODE_MAX_LENGTH.md +11 -0
  50. package/docs/constants/variables/CODE_MIN_LENGTH.md +11 -0
  51. package/docs/constants/variables/PROTOCOL_META_MAX_BYTES.md +11 -0
  52. package/docs/constants/variables/PROTOCOL_NORMALIZATION.md +11 -0
  53. package/docs/constants/variables/SUPPORTED_CHAINS.md +3 -3
  54. package/docs/errors/README.md +22 -0
  55. package/docs/errors/classes/ExpiredCodeError.md +695 -0
  56. package/docs/errors/classes/InvalidCodeFormatError.md +691 -0
  57. package/docs/errors/classes/InvalidPubkeyFormatError.md +691 -0
  58. package/docs/errors/classes/InvalidSignatureError.md +687 -0
  59. package/docs/errors/classes/MetaMismatchError.md +695 -0
  60. package/docs/errors/classes/MissingMetaError.md +681 -0
  61. package/docs/errors/classes/ProtocolError.md +637 -0
  62. package/docs/errors/classes/TransactionNotSignedByIntendedOwnerError.md +691 -0
  63. package/docs/errors/enumerations/ProtocolErrorCode.md +121 -0
  64. package/docs/index/README.md +83 -41
  65. package/docs/modules.md +12 -9
  66. package/docs/strategy/WalletStrategy/README.md +11 -0
  67. package/docs/strategy/WalletStrategy/classes/WalletStrategy.md +67 -0
  68. package/docs/types/README.md +14 -0
  69. package/docs/types/interfaces/ActionCode.md +65 -0
  70. package/docs/types/interfaces/CanonicalMessageParts.md +33 -0
  71. package/docs/types/interfaces/CodeGenerationConfig.md +33 -0
  72. package/docs/types/interfaces/CodeGenerationResult.md +25 -0
  73. package/docs/utils/canonical/README.md +16 -0
  74. package/docs/utils/canonical/functions/serializeCanonical.md +21 -0
  75. package/docs/utils/canonical/variables/CANONICAL_MESSAGE_PREFIX.md +11 -0
  76. package/docs/utils/canonical/variables/CANONICAL_MESSAGE_VERSION.md +11 -0
  77. package/docs/utils/crypto/README.md +18 -0
  78. package/docs/utils/crypto/functions/base32EncodeCrockford.md +21 -0
  79. package/docs/utils/crypto/functions/codeHash.md +21 -0
  80. package/docs/utils/crypto/functions/digestToDigits.md +25 -0
  81. package/docs/utils/crypto/functions/generateRandomSecret.md +15 -0
  82. package/docs/utils/crypto/functions/hkdfSha256.md +35 -0
  83. package/docs/utils/crypto/functions/hmacSha256.md +25 -0
  84. package/docs/utils/crypto/functions/sha256.md +21 -0
  85. package/docs/utils/crypto/functions/truncateBits.md +25 -0
  86. package/docs/utils/protocolMeta/README.md +21 -0
  87. package/docs/utils/protocolMeta/functions/buildProtocolMeta.md +21 -0
  88. package/docs/utils/protocolMeta/functions/parseProtocolMeta.md +21 -0
  89. package/docs/utils/protocolMeta/functions/validateProtocolMetaFormat.md +21 -0
  90. package/docs/utils/protocolMeta/interfaces/ProtocolMetaFields.md +41 -0
  91. package/docs/utils/protocolMeta/variables/SCHEME.md +11 -0
  92. package/package.json +42 -47
  93. package/dist/actioncode.d.ts +0 -120
  94. package/dist/actioncode.d.ts.map +0 -1
  95. package/dist/actioncode.js +0 -173
  96. package/dist/adapters/base.d.ts +0 -93
  97. package/dist/adapters/base.d.ts.map +0 -1
  98. package/dist/adapters/base.js +0 -52
  99. package/dist/adapters/solana/index.d.ts +0 -2
  100. package/dist/adapters/solana/index.d.ts.map +0 -1
  101. package/dist/adapters/solana/index.js +0 -17
  102. package/dist/adapters/solana/solana.d.ts +0 -113
  103. package/dist/adapters/solana/solana.d.ts.map +0 -1
  104. package/dist/adapters/solana/solana.js +0 -524
  105. package/dist/codegen.d.ts +0 -76
  106. package/dist/codegen.d.ts.map +0 -1
  107. package/dist/codegen.js +0 -198
  108. package/dist/constants.js +0 -11
  109. package/dist/meta.d.ts +0 -54
  110. package/dist/meta.d.ts.map +0 -1
  111. package/dist/meta.js +0 -91
  112. package/dist/protocol.d.ts +0 -179
  113. package/dist/protocol.d.ts.map +0 -1
  114. package/dist/protocol.js +0 -377
  115. package/docs/_media/LICENSE +0 -201
  116. package/docs/_media/README.md +0 -28
  117. package/docs/actioncode/README.md +0 -21
  118. package/docs/actioncode/classes/ActionCode.md +0 -430
  119. package/docs/actioncode/interfaces/ActionCodeFields.md +0 -89
  120. package/docs/actioncode/interfaces/ActionCodeMetadata.md +0 -25
  121. package/docs/actioncode/interfaces/ActionCodeTransaction.md +0 -57
  122. package/docs/actioncode/type-aliases/ActionCodeStatus.md +0 -11
  123. package/docs/adapters/base/README.md +0 -11
  124. package/docs/adapters/base/classes/BaseChainAdapter.md +0 -396
  125. package/docs/adapters/solana/README.md +0 -19
  126. package/docs/adapters/solana/solana/README.md +0 -15
  127. package/docs/adapters/solana/solana/classes/SolanaAdapter.md +0 -506
  128. package/docs/adapters/solana/solana/type-aliases/SolanaTransaction.md +0 -13
  129. package/docs/codegen/README.md +0 -11
  130. package/docs/codegen/classes/CodeGenerator.md +0 -341
  131. package/docs/constants/type-aliases/SupportedChain.md +0 -11
  132. package/docs/constants/variables/CODE_LENGTH.md +0 -11
  133. package/docs/constants/variables/CODE_TTL.md +0 -11
  134. package/docs/constants/variables/MAX_PREFIX_LENGTH.md +0 -11
  135. package/docs/constants/variables/MIN_PREFIX_LENGTH.md +0 -11
  136. package/docs/constants/variables/PROTOCOL_CODE_PREFIX.md +0 -11
  137. package/docs/constants/variables/PROTOCOL_PREFIX.md +0 -11
  138. package/docs/constants/variables/PROTOCOL_VERSION.md +0 -11
  139. package/docs/meta/README.md +0 -15
  140. package/docs/meta/classes/ProtocolMetaParser.md +0 -177
  141. package/docs/meta/interfaces/ProtocolMetaV1.md +0 -59
  142. package/docs/protocol/README.md +0 -51
  143. package/docs/protocol/classes/ActionCodesProtocol.md +0 -676
  144. package/docs/protocol/interfaces/ProtocolConfig.md +0 -71
@@ -0,0 +1,18 @@
1
+ [**@actioncodes/protocol-v2**](../../README.md)
2
+
3
+ ***
4
+
5
+ [@actioncodes/protocol-v2](../../modules.md) / utils/crypto
6
+
7
+ # utils/crypto
8
+
9
+ ## Functions
10
+
11
+ - [base32EncodeCrockford](functions/base32EncodeCrockford.md)
12
+ - [codeHash](functions/codeHash.md)
13
+ - [digestToDigits](functions/digestToDigits.md)
14
+ - [generateRandomSecret](functions/generateRandomSecret.md)
15
+ - [hkdfSha256](functions/hkdfSha256.md)
16
+ - [hmacSha256](functions/hmacSha256.md)
17
+ - [sha256](functions/sha256.md)
18
+ - [truncateBits](functions/truncateBits.md)
@@ -0,0 +1,21 @@
1
+ [**@actioncodes/protocol-v2**](../../../README.md)
2
+
3
+ ***
4
+
5
+ [@actioncodes/protocol-v2](../../../modules.md) / [utils/crypto](../README.md) / base32EncodeCrockford
6
+
7
+ # Function: base32EncodeCrockford()
8
+
9
+ > **base32EncodeCrockford**(`data`): `string`
10
+
11
+ Defined in: src/utils/crypto.ts:40
12
+
13
+ ## Parameters
14
+
15
+ ### data
16
+
17
+ `Uint8Array`
18
+
19
+ ## Returns
20
+
21
+ `string`
@@ -0,0 +1,21 @@
1
+ [**@actioncodes/protocol-v2**](../../../README.md)
2
+
3
+ ***
4
+
5
+ [@actioncodes/protocol-v2](../../../modules.md) / [utils/crypto](../README.md) / codeHash
6
+
7
+ # Function: codeHash()
8
+
9
+ > **codeHash**(`code`): `string`
10
+
11
+ Defined in: src/utils/crypto.ts:94
12
+
13
+ ## Parameters
14
+
15
+ ### code
16
+
17
+ `string`
18
+
19
+ ## Returns
20
+
21
+ `string`
@@ -0,0 +1,25 @@
1
+ [**@actioncodes/protocol-v2**](../../../README.md)
2
+
3
+ ***
4
+
5
+ [@actioncodes/protocol-v2](../../../modules.md) / [utils/crypto](../README.md) / digestToDigits
6
+
7
+ # Function: digestToDigits()
8
+
9
+ > **digestToDigits**(`digest`, `length`): `string`
10
+
11
+ Defined in: src/utils/crypto.ts:73
12
+
13
+ ## Parameters
14
+
15
+ ### digest
16
+
17
+ `Uint8Array`
18
+
19
+ ### length
20
+
21
+ `number`
22
+
23
+ ## Returns
24
+
25
+ `string`
@@ -0,0 +1,15 @@
1
+ [**@actioncodes/protocol-v2**](../../../README.md)
2
+
3
+ ***
4
+
5
+ [@actioncodes/protocol-v2](../../../modules.md) / [utils/crypto](../README.md) / generateRandomSecret
6
+
7
+ # Function: generateRandomSecret()
8
+
9
+ > **generateRandomSecret**(): `string`
10
+
11
+ Defined in: src/utils/crypto.ts:102
12
+
13
+ ## Returns
14
+
15
+ `string`
@@ -0,0 +1,35 @@
1
+ [**@actioncodes/protocol-v2**](../../../README.md)
2
+
3
+ ***
4
+
5
+ [@actioncodes/protocol-v2](../../../modules.md) / [utils/crypto](../README.md) / hkdfSha256
6
+
7
+ # Function: hkdfSha256()
8
+
9
+ > **hkdfSha256**(`ikm`, `length`, `__namedParameters`): `Uint8Array`
10
+
11
+ Defined in: src/utils/crypto.ts:22
12
+
13
+ ## Parameters
14
+
15
+ ### ikm
16
+
17
+ `string` | `Uint8Array`\<`ArrayBufferLike`\>
18
+
19
+ ### length
20
+
21
+ `number`
22
+
23
+ ### \_\_namedParameters
24
+
25
+ #### info?
26
+
27
+ `string` \| `Uint8Array`\<`ArrayBufferLike`\>
28
+
29
+ #### salt?
30
+
31
+ `string` \| `Uint8Array`\<`ArrayBufferLike`\>
32
+
33
+ ## Returns
34
+
35
+ `Uint8Array`
@@ -0,0 +1,25 @@
1
+ [**@actioncodes/protocol-v2**](../../../README.md)
2
+
3
+ ***
4
+
5
+ [@actioncodes/protocol-v2](../../../modules.md) / [utils/crypto](../README.md) / hmacSha256
6
+
7
+ # Function: hmacSha256()
8
+
9
+ > **hmacSha256**(`key`, `data`): `Uint8Array`
10
+
11
+ Defined in: src/utils/crypto.ts:14
12
+
13
+ ## Parameters
14
+
15
+ ### key
16
+
17
+ `string` | `Uint8Array`\<`ArrayBufferLike`\>
18
+
19
+ ### data
20
+
21
+ `string` | `Uint8Array`\<`ArrayBufferLike`\>
22
+
23
+ ## Returns
24
+
25
+ `Uint8Array`
@@ -0,0 +1,21 @@
1
+ [**@actioncodes/protocol-v2**](../../../README.md)
2
+
3
+ ***
4
+
5
+ [@actioncodes/protocol-v2](../../../modules.md) / [utils/crypto](../README.md) / sha256
6
+
7
+ # Function: sha256()
8
+
9
+ > **sha256**(`data`): `Uint8Array`
10
+
11
+ Defined in: src/utils/crypto.ts:10
12
+
13
+ ## Parameters
14
+
15
+ ### data
16
+
17
+ `string` | `Uint8Array`\<`ArrayBufferLike`\>
18
+
19
+ ## Returns
20
+
21
+ `Uint8Array`
@@ -0,0 +1,25 @@
1
+ [**@actioncodes/protocol-v2**](../../../README.md)
2
+
3
+ ***
4
+
5
+ [@actioncodes/protocol-v2](../../../modules.md) / [utils/crypto](../README.md) / truncateBits
6
+
7
+ # Function: truncateBits()
8
+
9
+ > **truncateBits**(`input`, `totalBits`): `Uint8Array`
10
+
11
+ Defined in: src/utils/crypto.ts:58
12
+
13
+ ## Parameters
14
+
15
+ ### input
16
+
17
+ `Uint8Array`
18
+
19
+ ### totalBits
20
+
21
+ `number`
22
+
23
+ ## Returns
24
+
25
+ `Uint8Array`
@@ -0,0 +1,21 @@
1
+ [**@actioncodes/protocol-v2**](../../README.md)
2
+
3
+ ***
4
+
5
+ [@actioncodes/protocol-v2](../../modules.md) / utils/protocolMeta
6
+
7
+ # utils/protocolMeta
8
+
9
+ ## Interfaces
10
+
11
+ - [ProtocolMetaFields](interfaces/ProtocolMetaFields.md)
12
+
13
+ ## Variables
14
+
15
+ - [SCHEME](variables/SCHEME.md)
16
+
17
+ ## Functions
18
+
19
+ - [buildProtocolMeta](functions/buildProtocolMeta.md)
20
+ - [parseProtocolMeta](functions/parseProtocolMeta.md)
21
+ - [validateProtocolMetaFormat](functions/validateProtocolMetaFormat.md)
@@ -0,0 +1,21 @@
1
+ [**@actioncodes/protocol-v2**](../../../README.md)
2
+
3
+ ***
4
+
5
+ [@actioncodes/protocol-v2](../../../modules.md) / [utils/protocolMeta](../README.md) / buildProtocolMeta
6
+
7
+ # Function: buildProtocolMeta()
8
+
9
+ > **buildProtocolMeta**(`fields`): `string`
10
+
11
+ Defined in: src/utils/protocolMeta.ts:13
12
+
13
+ ## Parameters
14
+
15
+ ### fields
16
+
17
+ [`ProtocolMetaFields`](../interfaces/ProtocolMetaFields.md)
18
+
19
+ ## Returns
20
+
21
+ `string`
@@ -0,0 +1,21 @@
1
+ [**@actioncodes/protocol-v2**](../../../README.md)
2
+
3
+ ***
4
+
5
+ [@actioncodes/protocol-v2](../../../modules.md) / [utils/protocolMeta](../README.md) / parseProtocolMeta
6
+
7
+ # Function: parseProtocolMeta()
8
+
9
+ > **parseProtocolMeta**(`input`): [`ProtocolMetaFields`](../interfaces/ProtocolMetaFields.md)
10
+
11
+ Defined in: src/utils/protocolMeta.ts:34
12
+
13
+ ## Parameters
14
+
15
+ ### input
16
+
17
+ `string`
18
+
19
+ ## Returns
20
+
21
+ [`ProtocolMetaFields`](../interfaces/ProtocolMetaFields.md)
@@ -0,0 +1,21 @@
1
+ [**@actioncodes/protocol-v2**](../../../README.md)
2
+
3
+ ***
4
+
5
+ [@actioncodes/protocol-v2](../../../modules.md) / [utils/protocolMeta](../README.md) / validateProtocolMetaFormat
6
+
7
+ # Function: validateProtocolMetaFormat()
8
+
9
+ > **validateProtocolMetaFormat**(`input`): \{ `ok`: `true`; \} \| \{ `ok`: `false`; `reason`: `string`; \}
10
+
11
+ Defined in: src/utils/protocolMeta.ts:74
12
+
13
+ ## Parameters
14
+
15
+ ### input
16
+
17
+ `string`
18
+
19
+ ## Returns
20
+
21
+ \{ `ok`: `true`; \} \| \{ `ok`: `false`; `reason`: `string`; \}
@@ -0,0 +1,41 @@
1
+ [**@actioncodes/protocol-v2**](../../../README.md)
2
+
3
+ ***
4
+
5
+ [@actioncodes/protocol-v2](../../../modules.md) / [utils/protocolMeta](../README.md) / ProtocolMetaFields
6
+
7
+ # Interface: ProtocolMetaFields
8
+
9
+ Defined in: src/utils/protocolMeta.ts:4
10
+
11
+ ## Properties
12
+
13
+ ### id
14
+
15
+ > **id**: `string`
16
+
17
+ Defined in: src/utils/protocolMeta.ts:6
18
+
19
+ ***
20
+
21
+ ### int
22
+
23
+ > **int**: `string`
24
+
25
+ Defined in: src/utils/protocolMeta.ts:7
26
+
27
+ ***
28
+
29
+ ### p?
30
+
31
+ > `optional` **p**: `Record`\<`string`, `unknown`\>
32
+
33
+ Defined in: src/utils/protocolMeta.ts:8
34
+
35
+ ***
36
+
37
+ ### ver
38
+
39
+ > **ver**: `2`
40
+
41
+ Defined in: src/utils/protocolMeta.ts:5
@@ -0,0 +1,11 @@
1
+ [**@actioncodes/protocol-v2**](../../../README.md)
2
+
3
+ ***
4
+
5
+ [@actioncodes/protocol-v2](../../../modules.md) / [utils/protocolMeta](../README.md) / SCHEME
6
+
7
+ # Variable: SCHEME
8
+
9
+ > `const` **SCHEME**: `"actioncodes:"` = `"actioncodes:"`
10
+
11
+ Defined in: src/utils/protocolMeta.ts:11
package/package.json CHANGED
@@ -1,31 +1,18 @@
1
1
  {
2
2
  "name": "@actioncodes/protocol",
3
- "version": "1.2.1",
4
- "description": "Action Codes Protocol",
3
+ "version": "2.0.0",
4
+ "module": "index.ts",
5
+ "type": "module",
6
+ "license": "Apache-2.0",
5
7
  "main": "dist/index.js",
6
8
  "types": "dist/index.d.ts",
7
9
  "exports": {
8
10
  ".": {
9
11
  "types": "./dist/index.d.ts",
10
- "require": "./dist/index.js",
11
- "import": "./dist/index.js"
12
+ "import": "./dist/index.js",
13
+ "require": "./dist/index.cjs"
12
14
  }
13
15
  },
14
- "scripts": {
15
- "build": "pnpm run lint && pnpm run test && pnpm run build:js",
16
- "build:js": "tsc",
17
- "lint": "eslint .",
18
- "test": "jest",
19
- "test:watch": "jest --watch",
20
- "docs": "typedoc --out docs/ --entryPointStrategy expand --tsconfig ./tsconfig.json --plugin typedoc-plugin-markdown ./src",
21
- "publish:package": "pnpm run lint && pnpm build && pnpm publish --access public",
22
- "release": "pnpm run lint && pnpm version patch && pnpm build && pnpm publish --access public",
23
- "release:patch": "pnpm run lint && pnpm version patch && pnpm build && pnpm publish --access public",
24
- "release:minor": "pnpm run lint && pnpm version minor && pnpm build && pnpm publish --access public",
25
- "release:major": "pnpm run lint && pnpm version major && pnpm build && pnpm publish --access public",
26
- "publish:dry": "pnpm run lint && pnpm build && pnpm publish --access public --dry-run",
27
- "prepare": "husky"
28
- },
29
16
  "keywords": [
30
17
  "solana",
31
18
  "ota-protocol",
@@ -34,13 +21,10 @@
34
21
  "ota-protocol-types",
35
22
  "ota-protocol-constants"
36
23
  ],
37
- "author": "OTA Protocol Core Team",
38
- "license": "Apache-2.0",
39
- "copyright": "Copyright 2025 OTA Protocol",
40
- "homepage": "https://ota.codes",
24
+ "homepage": "https://actioncodes.org",
41
25
  "repository": {
42
26
  "type": "git",
43
- "url": "https://github.com/otaprotocol/actioncodes"
27
+ "url": "https://github.com/otaprotocol/protocol-v2"
44
28
  },
45
29
  "publishConfig": {
46
30
  "registry": "https://registry.npmjs.org/",
@@ -55,38 +39,49 @@
55
39
  "README.md",
56
40
  "LICENSE"
57
41
  ],
58
- "packageManager": "pnpm@10.13.1",
42
+ "scripts": {
43
+ "build": "bun lint && bun run test && bun run build:all",
44
+ "build:js": "bun run build.js",
45
+ "build:types": "tsc --project tsconfig.build.json",
46
+ "build:all": "bun run build:js && bun run build:types",
47
+ "lint": "eslint .",
48
+ "test": "bun test",
49
+ "docs": "typedoc --out docs/ --entryPointStrategy expand --tsconfig ./tsconfig.json --plugin typedoc-plugin-markdown ./src",
50
+ "publish:package": "bun lint && bun run build:all && bun publish --access public",
51
+ "release": "bun lint && bun version patch && bun run build:all && bun publish --access public",
52
+ "release:patch": "bun lint && bun version patch && bun run build:all && bun publish --access public",
53
+ "release:minor": "bun lint && bun version minor && bun run build:all && bun publish --access public",
54
+ "release:major": "bun lint && bun version major && bun run build:all && bun publish --access public",
55
+ "publish:dry": "bun lint && bun run build:all && bun publish --access public --dry-run",
56
+ "prepare": "husky"
57
+ },
59
58
  "devDependencies": {
60
- "@commitlint/cli": "^19.8.1",
61
- "@commitlint/config-conventional": "^19.8.1",
62
- "@eslint/js": "^9.31.0",
59
+ "@commitlint/cli": "^20.0.0",
60
+ "@commitlint/config-conventional": "^20.0.0",
63
61
  "@semantic-release/changelog": "^6.0.3",
64
62
  "@semantic-release/git": "^10.0.1",
65
63
  "@semantic-release/github": "^11.0.3",
66
64
  "@semantic-release/npm": "^12.0.2",
65
+ "@types/bun": "latest",
67
66
  "@types/jest": "^30.0.0",
68
- "@typescript-eslint/eslint-plugin": "^8.37.0",
69
- "@typescript-eslint/parser": "^8.37.0",
70
- "bs58": "^6.0.0",
71
- "eslint": "^9.31.0",
72
- "eslint-plugin-jest": "^29.0.1",
73
- "globals": "^16.3.0",
67
+ "eslint": "^9.36.0",
68
+ "globals": "^16.4.0",
74
69
  "husky": "^9.1.7",
75
- "jest": "^30.0.4",
76
- "semantic-release": "^24.2.7",
77
- "ts-jest": "^29.4.0",
78
- "ts-node": "^10.9.2",
79
- "typedoc-plugin-markdown": "^4.6.3",
80
- "typescript": "^5.8.3",
81
- "typescript-eslint": "^8.37.0"
82
- },
83
- "dependencies": {
84
- "buffer": "^6.0.3",
85
- "js-sha256": "^0.11.1"
70
+ "jest": "^30.2.0",
71
+ "ts-jest": "^29.4.4",
72
+ "typedoc": "^0.28.13",
73
+ "typedoc-plugin-markdown": "^4.9.0",
74
+ "typescript-eslint": "^8.45.0"
86
75
  },
87
76
  "peerDependencies": {
77
+ "@solana/web3.js": "^1.98.4",
78
+ "typescript": "^5"
79
+ },
80
+ "dependencies": {
81
+ "@noble/hashes": "^2.0.1",
88
82
  "@solana/spl-memo": "^0.2.5",
89
- "@solana/web3.js": "^1.98.2",
83
+ "bs58": "^6.0.0",
90
84
  "tweetnacl": "^1.0.3"
91
- }
85
+ },
86
+ "packageManager": "pnpm@10.13.1"
92
87
  }
@@ -1,120 +0,0 @@
1
- import { SUPPORTED_CHAINS } from "./constants";
2
- import { ActionCodesProtocol } from "./protocol";
3
- export type ActionCodeStatus = 'pending' | 'resolved' | 'finalized' | 'expired' | 'error';
4
- export interface ActionCodeMetadata {
5
- description?: string;
6
- params?: Record<string, any>;
7
- }
8
- export interface ActionCodeTransaction {
9
- transaction?: string;
10
- txSignature?: string;
11
- txType?: string;
12
- message?: string;
13
- signedMessage?: string;
14
- intentType?: 'transaction' | 'sign-only';
15
- }
16
- export interface ActionCodeFields {
17
- code: string;
18
- prefix: string;
19
- pubkey: string;
20
- timestamp: number;
21
- signature: string;
22
- chain: (typeof SUPPORTED_CHAINS)[number];
23
- transaction?: ActionCodeTransaction;
24
- metadata?: ActionCodeMetadata;
25
- expiresAt: number;
26
- status: ActionCodeStatus;
27
- }
28
- export declare class ActionCode {
29
- private fields;
30
- constructor(fields: ActionCodeFields);
31
- static fromPayload(input: ActionCodeFields): ActionCode;
32
- static fromEncoded(encoded: string): ActionCode;
33
- get encoded(): string;
34
- isValid(protocol: ActionCodesProtocol): boolean;
35
- updateStatus(status: ActionCodeStatus): void;
36
- get json(): ActionCodeFields;
37
- /**
38
- * Get remaining time in milliseconds until expiration
39
- * @returns Remaining time in milliseconds, or 0 if expired
40
- */
41
- get remainingTime(): number;
42
- /**
43
- * Check if the action code has expired
44
- * @returns True if the code has expired
45
- */
46
- get expired(): boolean;
47
- /**
48
- * Get the target chain for this action code
49
- * @returns Chain identifier (e.g., "solana", "evm")
50
- */
51
- get chain(): string;
52
- /**
53
- * Get the current status of the action code
54
- * @returns Current status
55
- */
56
- get status(): ActionCodeStatus;
57
- /**
58
- * Get the action code string
59
- * @returns The 8-character action code
60
- */
61
- get code(): string;
62
- /**
63
- * Get the prefix used for this action code
64
- * @returns Normalized prefix
65
- */
66
- get prefix(): string;
67
- /**
68
- * Get the user's public key
69
- * @returns User's public key
70
- */
71
- get pubkey(): string;
72
- /**
73
- * Get the transaction data (chain-specific)
74
- * @returns Transaction data or undefined
75
- */
76
- get transaction(): ActionCodeTransaction | undefined;
77
- /**
78
- * Get metadata associated with this action code
79
- * @returns Metadata object or undefined
80
- */
81
- get metadata(): ActionCodeFields['metadata'] | undefined;
82
- /**
83
- * Get a human-readable description of the action
84
- * @returns Description string or undefined
85
- */
86
- get description(): string | undefined;
87
- /**
88
- * Get parameters associated with this action
89
- * @returns Parameters object or undefined
90
- */
91
- get params(): Record<string, any> | undefined;
92
- /**
93
- * Get the timestamp when the code was generated
94
- * @returns Timestamp in milliseconds
95
- */
96
- get timestamp(): number;
97
- /**
98
- * Get the user's signature
99
- * @returns User's signature string
100
- */
101
- get signature(): string;
102
- /**
103
- * Get a human-readable display string for the action code
104
- * @returns Formatted display string
105
- */
106
- get displayString(): string;
107
- /**
108
- * Get a formatted time string showing remaining time
109
- * @returns Human-readable time string (e.g., "1m 30s remaining")
110
- */
111
- get remainingTimeString(): string;
112
- /**
113
- * Get the code hash for this action code
114
- * it is also used in the protocol meta as the code id
115
- * @returns Code hash string
116
- */
117
- get codeHash(): string;
118
- get intentType(): 'transaction' | 'sign-only';
119
- }
120
- //# sourceMappingURL=actioncode.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"actioncode.d.ts","sourceRoot":"","sources":["../src/actioncode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAGjD,MAAM,MA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