accounts 0.3.0 → 0.4.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 (168) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/LICENSE +21 -0
  3. package/README.md +97 -0
  4. package/dist/core/AccessKey.d.ts +55 -0
  5. package/dist/core/AccessKey.d.ts.map +1 -0
  6. package/dist/core/AccessKey.js +69 -0
  7. package/dist/core/AccessKey.js.map +1 -0
  8. package/dist/core/Account.d.ts +91 -0
  9. package/dist/core/Account.d.ts.map +1 -0
  10. package/dist/core/Account.js +64 -0
  11. package/dist/core/Account.js.map +1 -0
  12. package/dist/core/Adapter.d.ts +187 -0
  13. package/dist/core/Adapter.d.ts.map +1 -0
  14. package/dist/core/Adapter.js +7 -0
  15. package/dist/core/Adapter.js.map +1 -0
  16. package/dist/core/Ceremony.d.ts +109 -0
  17. package/dist/core/Ceremony.d.ts.map +1 -0
  18. package/dist/core/Ceremony.js +104 -0
  19. package/dist/core/Ceremony.js.map +1 -0
  20. package/dist/core/Client.d.ts +16 -0
  21. package/dist/core/Client.d.ts.map +1 -0
  22. package/dist/core/Client.js +18 -0
  23. package/dist/core/Client.js.map +1 -0
  24. package/dist/core/Dialog.d.ts +52 -0
  25. package/dist/core/Dialog.d.ts.map +1 -0
  26. package/dist/core/Dialog.js +342 -0
  27. package/dist/core/Dialog.js.map +1 -0
  28. package/dist/core/Expiry.d.ts +15 -0
  29. package/dist/core/Expiry.d.ts.map +1 -0
  30. package/dist/core/Expiry.js +29 -0
  31. package/dist/core/Expiry.js.map +1 -0
  32. package/dist/core/Messenger.d.ts +86 -0
  33. package/dist/core/Messenger.d.ts.map +1 -0
  34. package/dist/core/Messenger.js +127 -0
  35. package/dist/core/Messenger.js.map +1 -0
  36. package/dist/core/Provider.d.ts +69 -0
  37. package/dist/core/Provider.d.ts.map +1 -0
  38. package/dist/core/Provider.js +401 -0
  39. package/dist/core/Provider.js.map +1 -0
  40. package/dist/core/Remote.d.ts +114 -0
  41. package/dist/core/Remote.d.ts.map +1 -0
  42. package/dist/core/Remote.js +116 -0
  43. package/dist/core/Remote.js.map +1 -0
  44. package/dist/core/Schema.d.ts +805 -0
  45. package/dist/core/Schema.d.ts.map +1 -0
  46. package/dist/core/Schema.js +43 -0
  47. package/dist/core/Schema.js.map +1 -0
  48. package/dist/core/Storage.d.ts +42 -0
  49. package/dist/core/Storage.d.ts.map +1 -0
  50. package/dist/core/Storage.js +173 -0
  51. package/dist/core/Storage.js.map +1 -0
  52. package/dist/core/Store.d.ts +58 -0
  53. package/dist/core/Store.d.ts.map +1 -0
  54. package/dist/core/Store.js +58 -0
  55. package/dist/core/Store.js.map +1 -0
  56. package/dist/core/adapters/dangerous_secp256k1.d.ts +30 -0
  57. package/dist/core/adapters/dangerous_secp256k1.d.ts.map +1 -0
  58. package/dist/core/adapters/dangerous_secp256k1.js +39 -0
  59. package/dist/core/adapters/dangerous_secp256k1.js.map +1 -0
  60. package/dist/core/adapters/dialog.d.ts +31 -0
  61. package/dist/core/adapters/dialog.d.ts.map +1 -0
  62. package/dist/core/adapters/dialog.js +306 -0
  63. package/dist/core/adapters/dialog.js.map +1 -0
  64. package/dist/core/adapters/local.d.ts +33 -0
  65. package/dist/core/adapters/local.d.ts.map +1 -0
  66. package/dist/core/adapters/local.js +227 -0
  67. package/dist/core/adapters/local.js.map +1 -0
  68. package/dist/core/adapters/webAuthn.d.ts +36 -0
  69. package/dist/core/adapters/webAuthn.d.ts.map +1 -0
  70. package/dist/core/adapters/webAuthn.js +93 -0
  71. package/dist/core/adapters/webAuthn.js.map +1 -0
  72. package/dist/core/internal/withDedupe.d.ts +12 -0
  73. package/dist/core/internal/withDedupe.d.ts.map +1 -0
  74. package/dist/core/internal/withDedupe.js +12 -0
  75. package/dist/core/internal/withDedupe.js.map +1 -0
  76. package/dist/core/zod/request.d.ts +31 -0
  77. package/dist/core/zod/request.d.ts.map +1 -0
  78. package/dist/core/zod/request.js +41 -0
  79. package/dist/core/zod/request.js.map +1 -0
  80. package/dist/core/zod/rpc.d.ts +603 -0
  81. package/dist/core/zod/rpc.d.ts.map +1 -0
  82. package/dist/core/zod/rpc.js +293 -0
  83. package/dist/core/zod/rpc.js.map +1 -0
  84. package/dist/core/zod/utils.d.ts +18 -0
  85. package/dist/core/zod/utils.d.ts.map +1 -0
  86. package/dist/core/zod/utils.js +21 -0
  87. package/dist/core/zod/utils.js.map +1 -0
  88. package/dist/index.d.ts +15 -0
  89. package/dist/index.d.ts.map +1 -0
  90. package/dist/index.js +15 -0
  91. package/dist/index.js.map +1 -0
  92. package/dist/internal/types.d.ts +284 -0
  93. package/dist/internal/types.d.ts.map +1 -0
  94. package/dist/internal/types.js +2 -0
  95. package/dist/internal/types.js.map +1 -0
  96. package/dist/server/Handler.d.ts +257 -0
  97. package/dist/server/Handler.d.ts.map +1 -0
  98. package/dist/server/Handler.js +433 -0
  99. package/dist/server/Handler.js.map +1 -0
  100. package/dist/server/Kv.d.ts +16 -0
  101. package/dist/server/Kv.d.ts.map +1 -0
  102. package/dist/server/Kv.js +30 -0
  103. package/dist/server/Kv.js.map +1 -0
  104. package/dist/server/index.d.ts +3 -0
  105. package/dist/server/index.d.ts.map +1 -0
  106. package/dist/server/index.js +3 -0
  107. package/dist/server/index.js.map +1 -0
  108. package/dist/server/internal/requestListener.d.ts +124 -0
  109. package/dist/server/internal/requestListener.d.ts.map +1 -0
  110. package/dist/server/internal/requestListener.js +173 -0
  111. package/dist/server/internal/requestListener.js.map +1 -0
  112. package/dist/wagmi/Connector.d.ts +93 -0
  113. package/dist/wagmi/Connector.d.ts.map +1 -0
  114. package/dist/wagmi/Connector.js +238 -0
  115. package/dist/wagmi/Connector.js.map +1 -0
  116. package/dist/wagmi/index.d.ts +3 -0
  117. package/dist/wagmi/index.d.ts.map +1 -0
  118. package/dist/wagmi/index.js +3 -0
  119. package/dist/wagmi/index.js.map +1 -0
  120. package/package.json +109 -2
  121. package/src/core/AccessKey.test.ts +257 -0
  122. package/src/core/AccessKey.ts +123 -0
  123. package/src/core/Account.test.ts +309 -0
  124. package/src/core/Account.ts +152 -0
  125. package/src/core/Adapter.ts +238 -0
  126. package/src/core/Ceremony.browser.test.ts +239 -0
  127. package/src/core/Ceremony.test.ts +151 -0
  128. package/src/core/Ceremony.ts +203 -0
  129. package/src/core/Client.ts +36 -0
  130. package/src/core/Dialog.browser.test.ts +309 -0
  131. package/src/core/Dialog.test-d.ts +19 -0
  132. package/src/core/Dialog.ts +442 -0
  133. package/src/core/Expiry.ts +34 -0
  134. package/src/core/Messenger.ts +206 -0
  135. package/src/core/Provider.browser.test.ts +774 -0
  136. package/src/core/Provider.connect.browser.test.ts +415 -0
  137. package/src/core/Provider.test-d.ts +53 -0
  138. package/src/core/Provider.test.ts +1566 -0
  139. package/src/core/Provider.ts +559 -0
  140. package/src/core/Remote.ts +262 -0
  141. package/src/core/Schema.test-d.ts +211 -0
  142. package/src/core/Schema.ts +143 -0
  143. package/src/core/Storage.ts +213 -0
  144. package/src/core/Store.test.ts +287 -0
  145. package/src/core/Store.ts +129 -0
  146. package/src/core/adapters/dangerous_secp256k1.ts +53 -0
  147. package/src/core/adapters/dialog.ts +379 -0
  148. package/src/core/adapters/local.test.ts +97 -0
  149. package/src/core/adapters/local.ts +277 -0
  150. package/src/core/adapters/webAuthn.ts +129 -0
  151. package/src/core/internal/withDedupe.test.ts +116 -0
  152. package/src/core/internal/withDedupe.ts +20 -0
  153. package/src/core/mppx.test.ts +83 -0
  154. package/src/core/zod/request.test.ts +121 -0
  155. package/src/core/zod/request.ts +70 -0
  156. package/src/core/zod/rpc.ts +374 -0
  157. package/src/core/zod/utils.test.ts +69 -0
  158. package/src/core/zod/utils.ts +40 -0
  159. package/src/index.ts +14 -0
  160. package/src/internal/types.ts +378 -0
  161. package/src/server/Handler.test.ts +1014 -0
  162. package/src/server/Handler.ts +605 -0
  163. package/src/server/Kv.ts +46 -0
  164. package/src/server/index.ts +2 -0
  165. package/src/server/internal/requestListener.ts +273 -0
  166. package/src/tsconfig.json +9 -0
  167. package/src/wagmi/Connector.ts +287 -0
  168. package/src/wagmi/index.ts +2 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # accounts
2
+
3
+ ## 0.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - f257ccc: Initial release.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026-present weth, LLC
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,97 @@
1
+ # Tempo Accounts SDK
2
+
3
+ Accounts SDK for Tempo Wallets & Apps.
4
+
5
+ ## Install
6
+
7
+ ```sh
8
+ pnpm i accounts
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ### Vanilla JS
14
+
15
+ You can get set up with the Accounts SDK with pure JavaScript by using the
16
+ `Provider` instance.
17
+
18
+ Internally, the `Provider` utilizes [EIP-6963](https://eips.ethereum.org/EIPS/eip-6963) to inject it's provider instance into
19
+ the page so it can be picked up by wallet connection dialogs on external web applications.
20
+
21
+ ```tsx
22
+ import { Provider } from 'accounts'
23
+
24
+ const provider = Provider.create()
25
+
26
+ const { accounts } = await provider.request({
27
+ method: 'wallet_connect',
28
+ })
29
+ ```
30
+
31
+ ### Viem
32
+
33
+ The Provider provides a Viem Client instance via the `getClient` accessor.
34
+
35
+ ```tsx
36
+ import { Provider } from 'accounts'
37
+
38
+ const provider = Provider.create()
39
+
40
+ const client = provider.getClient()
41
+ ```
42
+
43
+ ### Wagmi
44
+
45
+ Use the `tempoWallet` Wagmi connector to allow your Wagmi application to enable the Tempo Wallet dialog.
46
+
47
+ ```tsx
48
+ import { createConfig, http } from 'wagmi'
49
+ import { tempo } from 'wagmi/chains'
50
+ import { tempoWallet } from 'accounts/wagmi'
51
+
52
+ export const wagmiConfig = createConfig({
53
+ chains: [tempo],
54
+ connectors: [tempoWallet()],
55
+ transports: {
56
+ [tempo.id]: http(),
57
+ },
58
+ })
59
+ ```
60
+
61
+ ## Adapters
62
+
63
+ | Adapter | Description |
64
+ | ------------------------ | ---------------------------------------------------------------------------------- |
65
+ | `dialog` / `tempoWallet` | Adapter for the Tempo Wallet dialog (an embedded iframe/popup dialog). |
66
+ | `webAuthn` | App-bound passkey accounts using WebAuthn registration and authentication flows. |
67
+ | `local` | Key agnostic adapter to define arbitrary account/key types and signing mechanisms. |
68
+
69
+ ## Development
70
+
71
+ ```sh
72
+ pnpm dev # start embed + embed-ref + playground dev servers
73
+ pnpm dev:embed # start Tempo Wallet embed only
74
+ pnpm dev:embed-ref # start reference embed implementation only (port 5174)
75
+ pnpm dev:playground # start playground app only
76
+ pnpm dev:hosts # start embed + playground instances on different TLDs
77
+ pnpm build # build library
78
+ pnpm check # lint + format
79
+ pnpm check:types # type checks
80
+ pnpm test # run tests
81
+ ```
82
+
83
+ > `pnpm dev:hosts` starts three dev servers on different domains for cross-origin testing:
84
+ >
85
+ > - `https://app.moderato.tempo.local:3001`
86
+ > - `https://playground.a:5173`
87
+ > - `https://playground.b:5175`
88
+
89
+ ### Embed Reference Implementation
90
+
91
+ The `embed-ref/` directory contains a minimal, unstyled reference implementation of the embed dialog app. It demonstrates how to build a custom embed using the Account SDK's `Remote` API.
92
+
93
+ Select `dialogRefImpl` in the playground's adapter dropdown to test against it.
94
+
95
+ ## License
96
+
97
+ MIT
@@ -0,0 +1,55 @@
1
+ import { Address, WebCryptoP256 } from 'ox';
2
+ import { KeyAuthorization } from 'ox/tempo';
3
+ import { Account as TempoAccount } from 'viem/tempo';
4
+ import type * as Store from './Store.js';
5
+ /** Returns the pending key authorization for an access key account without removing it. */
6
+ export declare function getPending(account: TempoAccount.Account, options: {
7
+ store: Store.Store;
8
+ }): KeyAuthorization.Signed | undefined;
9
+ /** Generates a P256 key pair and access key account. */
10
+ export declare function generate(options?: generate.Options): Promise<generate.ReturnType>;
11
+ export declare namespace generate {
12
+ type Options = {
13
+ /** Root account to attach to the access key. */
14
+ account?: TempoAccount.Account | undefined;
15
+ };
16
+ type ReturnType = {
17
+ /** The generated access key account. */
18
+ accessKey: TempoAccount.AccessKeyAccount;
19
+ /** Generated key pair to pass to `authorizeAccessKey`. */
20
+ keyPair: Awaited<globalThis.ReturnType<typeof WebCryptoP256.createKeyPair>>;
21
+ };
22
+ }
23
+ /** Removes an access key entry for the given account from the store. */
24
+ export declare function remove(account: TempoAccount.Account, options: {
25
+ store: Store.Store;
26
+ }): void;
27
+ /** Permanently removes the pending key authorization for an access key account. */
28
+ export declare function removePending(account: TempoAccount.Account, options: {
29
+ store: Store.Store;
30
+ }): void;
31
+ /** Removes an access key from the store. */
32
+ export declare function revoke(options: revoke.Options): void;
33
+ export declare namespace revoke {
34
+ type Options = {
35
+ /** Root account address. */
36
+ address: Address.Address;
37
+ /** Reactive state store. */
38
+ store: Store.Store;
39
+ };
40
+ }
41
+ /** Saves an access key to the store with its one-time key authorization. */
42
+ export declare function save(options: save.Options): void;
43
+ export declare namespace save {
44
+ type Options = {
45
+ /** Root account address that owns this access key. */
46
+ address: Address.Address;
47
+ /** Signed key authorization to attach to the first transaction. */
48
+ keyAuthorization: KeyAuthorization.Signed;
49
+ /** The WebCrypto key pair backing the access key. Only present for locally-generated keys. */
50
+ keyPair?: Awaited<ReturnType<typeof WebCryptoP256.createKeyPair>> | undefined;
51
+ /** Reactive state store. */
52
+ store: Store.Store;
53
+ };
54
+ }
55
+ //# sourceMappingURL=AccessKey.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AccessKey.d.ts","sourceRoot":"","sources":["../../src/core/AccessKey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,IAAI,CAAA;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,YAAY,CAAA;AAEpD,OAAO,KAAK,KAAK,KAAK,MAAM,YAAY,CAAA;AAExC,2FAA2F;AAC3F,wBAAgB,UAAU,CACxB,OAAO,EAAE,YAAY,CAAC,OAAO,EAC7B,OAAO,EAAE;IAAE,KAAK,EAAE,KAAK,CAAC,KAAK,CAAA;CAAE,GAC9B,gBAAgB,CAAC,MAAM,GAAG,SAAS,CAOrC;AAED,wDAAwD;AACxD,wBAAsB,QAAQ,CAAC,OAAO,GAAE,QAAQ,CAAC,OAAY,GAAG,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAQ3F;AAED,MAAM,CAAC,OAAO,WAAW,QAAQ,CAAC;IAChC,KAAK,OAAO,GAAG;QACb,gDAAgD;QAChD,OAAO,CAAC,EAAE,YAAY,CAAC,OAAO,GAAG,SAAS,CAAA;KAC3C,CAAA;IAED,KAAK,UAAU,GAAG;QAChB,wCAAwC;QACxC,SAAS,EAAE,YAAY,CAAC,gBAAgB,CAAA;QACxC,0DAA0D;QAC1D,OAAO,EAAE,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,O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 'viem/tempo';
4
+ /** Returns the pending key authorization for an access key account without removing it. */
5
+ export function getPending(account, options) {
6
+ if (account.source !== 'accessKey')
7
+ return undefined;
8
+ const { store } = options;
9
+ const accessKeyAddress = account.accessKeyAddress;
10
+ const { accessKeys } = store.getState();
11
+ const entry = accessKeys.find((a) => a.address?.toLowerCase() === accessKeyAddress.toLowerCase());
12
+ return entry?.keyAuthorization;
13
+ }
14
+ /** Generates a P256 key pair and access key account. */
15
+ export async function generate(options = {}) {
16
+ const { account } = options;
17
+ const keyPair = await WebCryptoP256.createKeyPair();
18
+ const accessKey = TempoAccount.fromWebCryptoP256(keyPair, account ? { access: account } : undefined);
19
+ return { accessKey, keyPair };
20
+ }
21
+ /** Removes an access key entry for the given account from the store. */
22
+ export function remove(account, options) {
23
+ if (account.source !== 'accessKey')
24
+ return;
25
+ const { store } = options;
26
+ const accessKeyAddress = account.accessKeyAddress;
27
+ store.setState((state) => ({
28
+ accessKeys: state.accessKeys.filter((a) => a.address?.toLowerCase() !== accessKeyAddress?.toLowerCase()),
29
+ }));
30
+ }
31
+ /** Permanently removes the pending key authorization for an access key account. */
32
+ export function removePending(account, options) {
33
+ if (account.source !== 'accessKey')
34
+ return;
35
+ const { store } = options;
36
+ const accessKeyAddress = account.accessKeyAddress;
37
+ store.setState((state) => ({
38
+ accessKeys: state.accessKeys.map((a) => a.address.toLowerCase() === accessKeyAddress.toLowerCase()
39
+ ? { ...a, keyAuthorization: undefined }
40
+ : a),
41
+ }));
42
+ }
43
+ /** Removes an access key from the store. */
44
+ export function revoke(options) {
45
+ const { address, store } = options;
46
+ const { accessKeys } = store.getState();
47
+ store.setState({
48
+ accessKeys: accessKeys.filter((a) => a.access.toLowerCase() !== address.toLowerCase()),
49
+ });
50
+ }
51
+ /** Saves an access key to the store with its one-time key authorization. */
52
+ export function save(options) {
53
+ const { address, keyAuthorization, keyPair, store } = options;
54
+ store.setState((state) => ({
55
+ accessKeys: [
56
+ {
57
+ address: keyAuthorization.address,
58
+ access: address,
59
+ expiry: keyAuthorization.expiry ?? undefined,
60
+ keyAuthorization,
61
+ keyType: keyAuthorization.type,
62
+ limits: keyAuthorization.limits,
63
+ ...(keyPair ? { keyPair } : {}),
64
+ },
65
+ ...state.accessKeys,
66
+ ],
67
+ }));
68
+ }
69
+ //# sourceMappingURL=AccessKey.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AccessKey.js","sourceRoot":"","sources":["../../src/core/AccessKey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,IAAI,CAAA;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,YAAY,CAAA;AAIpD,2FAA2F;AAC3F,MAAM,UAAU,UAAU,CACxB,OAA6B,EAC7B,OAA+B;IAE/B,IAAI,OAAO,CAAC,MAAM,KAAK,WAAW;QAAE,OAAO,SAAS,CAAA;IACpD,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAA;IACzB,MAAM,gBAAgB,GAAI,OAAyC,CAAC,gBAAgB,CAAA;IACpF,MAAM,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAA;IACvC,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,CAAC,WAAW,EAAE,CAAC,CAAA;IACjG,OAAO,KAAK,EAAE,gBAAgB,CAAA;AAChC,CAAC;AAED,wDAAwD;AACxD,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,UAA4B,EAAE;IAC3D,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAA;IAC3B,MAAM,OAAO,GAAG,MAAM,aAAa,CAAC,aAAa,EAAE,CAAA;IACnD,MAAM,SAAS,GAAG,YAAY,CAAC,iBAAiB,CAC9C,OAAO,EACP,OA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M,UAAU,MAAM,CAAC,OAAuB;IAC5C,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,OAAO,CAAA;IAClC,MAAM,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAA;IACvC,KAAK,CAAC,QAAQ,CAAC;QACb,UAAU,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,OAAO,CAAC,WAAW,EAAE,CAAC;KACvF,CAAC,CAAA;AACJ,CAAC;AAWD,4EAA4E;AAC5E,MAAM,UAAU,IAAI,CAAC,OAAqB;IACxC,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,OAAO,CAAA;IAE7D,KAAK,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACzB,UAAU,EAAE;YACV;gBACE,OAAO,EAAE,gBAAgB,CAAC,OAAO;gBACjC,MAAM,EAAE,OAAO;gBACf,MAAM,EAAE,gBAAgB,CAAC,MAAM,IAAI,SAAS;gBAC5C,gBAAgB;gBAChB,OAAO,EAAE,gBAAgB,CAAC,IAAI;gBAC9B,MAAM,EAAE,gBAAgB,CAAC,MAAiE;gBAC1F,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAChC;YACD,GAAG,KAAK,CAAC,UAAU;SACpB;KACF,CAAC,CAAC,CAAA;AACL,CAAC"}
@@ -0,0 +1,91 @@
1
+ import { type WebCryptoP256 } from 'ox';
2
+ import { type KeyAuthorization } from 'ox/tempo';
3
+ import type { Hex } from 'viem';
4
+ import type { Address, JsonRpcAccount } from 'viem/accounts';
5
+ import { Account as TempoAccount } from 'viem/tempo';
6
+ import type { OneOf } from '../internal/types.js';
7
+ import type * as core_Store from './Store.js';
8
+ /** Account stored in the provider state. */
9
+ export type Store = {
10
+ /** Account address. */
11
+ address: Address;
12
+ } & OneOf<{} | Pick<TempoAccount.Account, 'keyType' | 'sign'> | {
13
+ keyType: 'secp256k1';
14
+ privateKey: Hex;
15
+ } | {
16
+ keyType: 'p256';
17
+ privateKey: Hex;
18
+ } | {
19
+ keyType: 'webAuthn';
20
+ credential: {
21
+ id: string;
22
+ publicKey: Hex;
23
+ rpId: string;
24
+ };
25
+ } | {
26
+ keyType: 'webCrypto';
27
+ keyPair: Awaited<ReturnType<typeof WebCryptoP256.createKeyPair>>;
28
+ } | {
29
+ keyType: 'webAuthn_headless';
30
+ privateKey: Hex;
31
+ rpId: string;
32
+ origin: string;
33
+ }>;
34
+ /** Access key entry stored alongside accounts. */
35
+ export type AccessKey = {
36
+ /** Access key address. */
37
+ address: Address;
38
+ /** Owner of the access key. */
39
+ access: Address;
40
+ /** Unix timestamp when the access key expires. */
41
+ expiry?: number | undefined;
42
+ /** Signed key authorization to attach to the first transaction. Consumed on use. */
43
+ keyAuthorization?: KeyAuthorization.Signed | undefined;
44
+ /** The WebCrypto key pair backing the access key. Only present for locally-generated keys. */
45
+ keyPair?: Awaited<ReturnType<typeof WebCryptoP256.createKeyPair>> | undefined;
46
+ /** Key type. */
47
+ keyType: 'secp256k1' | 'p256' | 'webAuthn' | 'webCrypto';
48
+ /** TIP-20 spending limits for the access key. */
49
+ limits?: {
50
+ token: Address;
51
+ limit: bigint;
52
+ }[] | undefined;
53
+ };
54
+ /** Resolves a viem Account from the store by address (or active account). */
55
+ export declare function find(options: find.Options & {
56
+ signable: true;
57
+ }): TempoAccount.Account;
58
+ export declare function find(options: find.Options): TempoAccount.Account | JsonRpcAccount;
59
+ export declare namespace find {
60
+ type Options = {
61
+ /** Whether to resolve an access key for this account. @default true */
62
+ accessKey?: boolean | undefined;
63
+ /** Address to resolve. Defaults to the active account. */
64
+ address?: Address | undefined;
65
+ /** Whether to hydrate signing capability. @default false */
66
+ signable?: boolean | undefined;
67
+ /** Reactive state store. */
68
+ store: core_Store.Store;
69
+ };
70
+ }
71
+ /** Overloaded signature for `find` without `store` (pre-bound by the provider). */
72
+ export type Find = {
73
+ (options: Omit<find.Options, 'store'> & {
74
+ signable: true;
75
+ }): TempoAccount.Account;
76
+ (options?: Omit<find.Options, 'store'>): TempoAccount.Account | JsonRpcAccount;
77
+ };
78
+ /** Hydrates an access key entry to a viem Account. Only works for locally-generated keys with a `keyPair`. */
79
+ export declare function hydrateAccessKey(accessKey: AccessKey): TempoAccount.Account;
80
+ /** Hydrates a store account to a viem Account. */
81
+ export declare function hydrate(account: Store, options: {
82
+ signable: true;
83
+ }): TempoAccount.Account;
84
+ export declare function hydrate(account: Store, options?: hydrate.Options): TempoAccount.Account | JsonRpcAccount;
85
+ export declare namespace hydrate {
86
+ type Options = {
87
+ /** Whether to hydrate signing capability. @default false */
88
+ signable?: boolean | undefined;
89
+ };
90
+ }
91
+ //# sourceMappingURL=Account.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Account.d.ts","sourceRoot":"","sources":["../../src/core/Account.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,aAAa,EAAE,MAAM,IAAI,CAAA;AACjD,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAChD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AAC/B,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC5D,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,YAAY,CAAA;AAEpD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,KAAK,KAAK,UAAU,MAAM,YAAY,CAAA;AAE7C,4CAA4C;AAC5C,MAAM,MAAM,KAAK,GAAG;IAClB,uBAAuB;IACvB,OAAO,EAAE,OAAO,CAAA;CACjB,GAAG,KAAK,CACL,EAAE,GACF,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,SAAS,GAAG,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Ac,CAAA;AAgCxC,MAAM,CAAC,OAAO,WAAW,OAAO,CAAC;IAC/B,KAAK,OAAO,GAAG;QACb,4DAA4D;QAC5D,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;KAC/B,CAAA;CACF"}
@@ -0,0 +1,64 @@
1
+ import { Provider } from 'ox';
2
+ import {} from 'ox/tempo';
3
+ import { Account as TempoAccount } from 'viem/tempo';
4
+ export function find(options) {
5
+ const { accessKey = true, address, signable = false, store } = options;
6
+ const { accessKeys, accounts, activeAccount } = store.getState();
7
+ const activeAddr = accounts[activeAccount]?.address;
8
+ const root = address
9
+ ? accounts.find((a) => a.address === address)
10
+ : accounts.find((a) => a.address === activeAddr);
11
+ if (!root)
12
+ throw address
13
+ ? new Provider.UnauthorizedError({ message: `Account "${address}" not found.` })
14
+ : new Provider.DisconnectedError({ message: 'No active account.' });
15
+ // When accessKey is requested, prefer a locally-signable access key for this address.
16
+ if (accessKey) {
17
+ const key = accessKeys.find((a) => a.access.toLowerCase() === root.address.toLowerCase() && a.keyPair);
18
+ if (key) {
19
+ // Remove expired access keys.
20
+ if (key.expiry && key.expiry < Date.now() / 1000)
21
+ store.setState({ accessKeys: accessKeys.filter((a) => a !== key) });
22
+ else
23
+ return hydrateAccessKey(key);
24
+ }
25
+ }
26
+ return hydrate(root, { signable });
27
+ }
28
+ /** Hydrates an access key entry to a viem Account. Only works for locally-generated keys with a `keyPair`. */
29
+ export function hydrateAccessKey(accessKey) {
30
+ if (!accessKey.keyPair)
31
+ throw new Provider.UnauthorizedError({
32
+ message: 'External access key cannot be hydrated for signing.',
33
+ });
34
+ return TempoAccount.fromWebCryptoP256(accessKey.keyPair, { access: accessKey.access });
35
+ }
36
+ export function hydrate(account, options = {}) {
37
+ const { signable = false } = options;
38
+ if (!signable)
39
+ return { address: account.address, type: 'json-rpc' };
40
+ if ('sign' in account && typeof account.sign === 'function')
41
+ return account;
42
+ if (!account.keyType)
43
+ throw new Provider.UnauthorizedError({ message: `Account "${account.address}" cannot sign.` });
44
+ switch (account.keyType) {
45
+ case 'secp256k1':
46
+ return TempoAccount.fromSecp256k1(account.privateKey);
47
+ case 'p256':
48
+ return TempoAccount.fromP256(account.privateKey);
49
+ case 'webCrypto':
50
+ return TempoAccount.fromWebCryptoP256(account.keyPair);
51
+ case 'webAuthn':
52
+ return TempoAccount.fromWebAuthnP256(account.credential, {
53
+ rpId: account.credential.rpId,
54
+ });
55
+ case 'webAuthn_headless':
56
+ return TempoAccount.fromHeadlessWebAuthn(account.privateKey, {
57
+ rpId: account.rpId,
58
+ origin: account.origin,
59
+ });
60
+ default:
61
+ throw new Provider.UnauthorizedError({ message: 'Unknown key type.' });
62
+ }
63
+ }
64
+ //# sourceMappingURL=Account.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Account.js","sourceRoot":"","sources":["../../src/core/Account.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAsB,MAAM,IAAI,CAAA;AACjD,OAAO,EAAyB,MAAM,UAAU,CAAA;AAGhD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,YAAY,CAAA;AAgDpD,MAAM,UAAU,IAAI,CAAC,OAAqB;IACxC,MAAM,EAAE,SAAS,GAAG,IAAI,EAAE,OAAO,EAAE,QAAQ,GAAG,KAAK,EAAE,KAAK,EAAE,GAAG,OAAO,CAAA;IACtE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,aAAa,EAAE,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAA;IAEhE,MAAM,UAAU,GAAG,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAA;IACnD,MAAM,IAAI,GAAG,OAAO;QAClB,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,OAAO,CAAC;QAC7C,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OA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C"}
@@ -0,0 +1,187 @@
1
+ import type { KeyAuthorization } from 'ox/tempo';
2
+ import type { Client, Hex, Transport } from 'viem';
3
+ import type { Address } from 'viem/accounts';
4
+ import type { tempo } from 'viem/chains';
5
+ import type * as Account from './Account.js';
6
+ import type * as Schema from './Schema.js';
7
+ import type * as Storage from './Storage.js';
8
+ import type * as Store from './Store.js';
9
+ import type * as Rpc from './zod/rpc.js';
10
+ /** Wire-format request (method + params) for a given RPC schema item. */
11
+ type EncodedRequest<encoded extends {
12
+ method: unknown;
13
+ params: unknown;
14
+ }> = Pick<encoded, 'method' | 'params'>;
15
+ /** Adapter interface for the provider. */
16
+ export type Adapter = SetupFn & Meta;
17
+ /** The setup function an adapter must implement. */
18
+ export type SetupFn = (params: SetupFn.Parameters) => Instance;
19
+ /** Static metadata attached to an adapter function. */
20
+ export type Meta = {
21
+ /** Data URI of the provider icon. @default Black 1×1 SVG. */
22
+ icon?: `data:image/${string}` | undefined;
23
+ /** Display name of the provider (e.g. `"My Wallet"`). @default "Injected Wallet" */
24
+ name?: string | undefined;
25
+ /** Reverse DNS identifier (e.g. `"com.example.mywallet"`). @default `com.{lowercase name}` */
26
+ rdns?: string | undefined;
27
+ };
28
+ export type Instance = {
29
+ /** Adapter actions dispatched by the provider's `request()` method. */
30
+ actions: {
31
+ /** Grant an access key for the active account. */
32
+ authorizeAccessKey?: ((params: authorizeAccessKey.Parameters, request: EncodedRequest<Rpc.wallet_authorizeAccessKey.Encoded>) => Promise<authorizeAccessKey.ReturnType>) | undefined;
33
+ /** Create a new account (e.g. WebAuthn registration). */
34
+ createAccount: (params: createAccount.Parameters, request: EncodedRequest<Rpc.wallet_connect.Encoded>) => Promise<createAccount.ReturnType>;
35
+ /** Disconnect hook for adapter-specific cleanup. */
36
+ disconnect?: (() => Promise<void>) | undefined;
37
+ /** Discover existing accounts (e.g. WebAuthn assertion). */
38
+ loadAccounts: (params: loadAccounts.Parameters | undefined, request: EncodedRequest<Rpc.wallet_connect.Encoded>) => Promise<loadAccounts.ReturnType>;
39
+ /** Revoke an access key. */
40
+ revokeAccessKey?: ((params: revokeAccessKey.Parameters, request: EncodedRequest<Rpc.wallet_revokeAccessKey.Encoded>) => Promise<void>) | undefined;
41
+ /** Send a transaction. */
42
+ sendTransaction: (params: sendTransaction.Parameters, request: EncodedRequest<Rpc.eth_sendTransaction.Encoded>) => Promise<sendTransaction.ReturnType>;
43
+ /** Send a transaction and wait for the receipt. */
44
+ sendTransactionSync: (params: sendTransactionSync.Parameters, request: EncodedRequest<Rpc.eth_sendTransactionSync.Encoded>) => Promise<sendTransactionSync.ReturnType>;
45
+ /** Sign a personal message (EIP-191). */
46
+ signPersonalMessage: (params: signPersonalMessage.Parameters, request: EncodedRequest<Rpc.personal_sign.Encoded>) => Promise<Hex>;
47
+ /** Sign a transaction without broadcasting it. */
48
+ signTransaction: (params: signTransaction.Parameters, request: EncodedRequest<Rpc.eth_signTransaction.Encoded>) => Promise<signTransaction.ReturnType>;
49
+ /** Sign EIP-712 typed data. */
50
+ signTypedData: (params: signTypedData.Parameters, request: EncodedRequest<Rpc.eth_signTypedData_v4.Encoded>) => Promise<Hex>;
51
+ /** Switch chain hook for adapter-specific handling. */
52
+ switchChain?: ((params: switchChain.Parameters) => Promise<void>) | undefined;
53
+ };
54
+ /** Cleanup function called when the provider is destroyed. */
55
+ cleanup?: (() => void) | undefined;
56
+ /** When `true`, the provider merges new accounts onto existing ones instead of replacing. */
57
+ persistAccounts?: boolean | undefined;
58
+ };
59
+ export declare namespace SetupFn {
60
+ /** Parameters passed to an adapter's setup function. */
61
+ type Parameters = {
62
+ /** Returns the rehydrated local account for the given address, or the active account if omitted. */
63
+ getAccount: Account.Find;
64
+ /** Get the viem client for a given chain ID. Defaults to the active chain. */
65
+ getClient: (options?: getClient.Options | undefined) => Client<Transport, typeof tempo>;
66
+ /** Storage adapter used by the provider. */
67
+ storage: Storage.Storage;
68
+ /** Reactive state store. */
69
+ store: Store.Store;
70
+ };
71
+ /** Value returned from an adapter's setup function. */
72
+ type ReturnType = Instance;
73
+ }
74
+ /** Creates an adapter from metadata and a setup function. */
75
+ export declare function define(meta: Meta, fn: SetupFn): Adapter;
76
+ /** Spreads decoded params. */
77
+ export type ActionRequest<item extends Schema.Item> = Schema.Decoded<item>['params'] extends readonly [infer first] ? first : never;
78
+ export declare namespace getClient {
79
+ type Options = {
80
+ /** Chain ID. Defaults to the active chain. */
81
+ chainId?: number | undefined;
82
+ /** Fee payer service URL. */
83
+ feePayer?: string | undefined;
84
+ };
85
+ }
86
+ export declare namespace createAccount {
87
+ type Parameters = {
88
+ /** Grant an access key during the ceremony. */
89
+ authorizeAccessKey?: authorizeAccessKey.Parameters | undefined;
90
+ /** Digest to sign. */
91
+ digest?: Hex | undefined;
92
+ /** Display name for the new account (e.g. credential name for WebAuthn). */
93
+ name: string;
94
+ /** Opaque user identifier (e.g. for WebAuthn `user.id`). */
95
+ userId?: string | undefined;
96
+ };
97
+ type ReturnType = {
98
+ accounts: readonly Store.Account[];
99
+ /** Signed key authorization, if an access key was granted. */
100
+ keyAuthorization?: authorizeAccessKey.ReturnType | undefined;
101
+ /** Signature over the digest, if one was provided. */
102
+ signature?: Hex | undefined;
103
+ };
104
+ }
105
+ export declare namespace loadAccounts {
106
+ type Parameters = {
107
+ /** Grant an access key during the ceremony. */
108
+ authorizeAccessKey?: authorizeAccessKey.Parameters | undefined;
109
+ /** Credential ID to restrict authentication to a specific credential. */
110
+ credentialId?: string | undefined;
111
+ /** Digest to sign. */
112
+ digest?: Hex | undefined;
113
+ /** When `true`, prompts the user to pick from all available credentials instead of using the last-used one. */
114
+ selectAccount?: boolean | undefined;
115
+ };
116
+ type ReturnType = {
117
+ /** Loaded accounts. */
118
+ accounts: readonly Store.Account[];
119
+ /** Signed key authorization, if an access key was granted. */
120
+ keyAuthorization?: authorizeAccessKey.ReturnType | undefined;
121
+ /** Signature over the digest, if one was provided. */
122
+ signature?: Hex | undefined;
123
+ };
124
+ }
125
+ export declare namespace signPersonalMessage {
126
+ type Parameters = {
127
+ /** Address of the account to sign with. */
128
+ address: Address;
129
+ /** Hex-encoded message data. */
130
+ data: Hex;
131
+ };
132
+ }
133
+ export declare namespace signTypedData {
134
+ type Parameters = {
135
+ /** Address of the account to sign with. */
136
+ address: Address;
137
+ /** JSON-encoded EIP-712 typed data. */
138
+ data: string;
139
+ };
140
+ }
141
+ export declare namespace authorizeAccessKey {
142
+ type Parameters = {
143
+ /** Access key address. Alternative to `publicKey` when the caller already knows the derived address. */
144
+ address?: Address | undefined;
145
+ /** Unix timestamp (seconds) when the key expires. */
146
+ expiry: number;
147
+ /** Key type of the external public key. Required when `publicKey` or `address` is provided. */
148
+ keyType?: 'secp256k1' | 'p256' | 'webAuthn' | undefined;
149
+ /** TIP-20 spending limits for this key. */
150
+ limits?: readonly {
151
+ token: Address;
152
+ limit: bigint;
153
+ }[] | undefined;
154
+ /** External public key to authorize. When provided, no key pair is generated — the caller holds the signing material. */
155
+ publicKey?: Hex | undefined;
156
+ /** Pre-computed signature over the key authorization digest (skips a second signing ceremony). */
157
+ signature?: Hex | undefined;
158
+ };
159
+ type ReturnType = KeyAuthorization.Rpc;
160
+ }
161
+ export declare namespace revokeAccessKey {
162
+ type Parameters = {
163
+ /** Root account address. */
164
+ address: Address;
165
+ /** Address of the access key to revoke. */
166
+ accessKeyAddress: Address;
167
+ };
168
+ }
169
+ export declare namespace sendTransaction {
170
+ type Parameters = ActionRequest<typeof Rpc.eth_sendTransaction.schema>;
171
+ type ReturnType = Rpc.eth_sendTransaction.Encoded['returns'];
172
+ }
173
+ export declare namespace sendTransactionSync {
174
+ type Parameters = ActionRequest<typeof Rpc.eth_sendTransactionSync.schema>;
175
+ type ReturnType = Rpc.eth_sendTransactionSync.Encoded['returns'];
176
+ }
177
+ export declare namespace signTransaction {
178
+ type Parameters = ActionRequest<typeof Rpc.eth_signTransaction.schema>;
179
+ type ReturnType = Hex;
180
+ }
181
+ export declare namespace switchChain {
182
+ type Parameters = {
183
+ chainId: number;
184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M,CAAA;KAAE,CAAA;CACtC"}
@@ -0,0 +1,7 @@
1
+ /** Creates an adapter from metadata and a setup function. */
2
+ export function define(meta, fn) {
3
+ const { name, ...rest } = meta;
4
+ Object.defineProperty(fn, 'name', { value: name, configurable: true });
5
+ return Object.assign(fn, rest);
6
+ }
7
+ //# sourceMappingURL=Adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Adapter.js","sourceRoot":"","sources":["../../src/core/Adapter.ts"],"names":[],"mappings":"AAiHA,6DAA6D;AAC7D,MAAM,UAAU,MAAM,CAAC,IAAU,EAAE,EAAW;IAC5C,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAA;IAC9B,MAAM,CAAC,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAA;IACtE,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,CAAY,CAAA;AAC3C,CAAC"}