@usebutr/sui 2.0.0 → 2.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/CHANGELOG.md ADDED
@@ -0,0 +1,208 @@
1
+ # @usebutr/sui
2
+
3
+ ## 2.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`bc5b58c`](https://github.com/pedroapfilho/usebutr/commit/bc5b58cd87601be38dbb77a14e16eaaa36e8f012), [`bc5b58c`](https://github.com/pedroapfilho/usebutr/commit/bc5b58cd87601be38dbb77a14e16eaaa36e8f012)]:
8
+ - @usebutr/wallet-standard-shared@1.0.0
9
+ - @usebutr/core@2.0.1
10
+
11
+ ## 2.0.1
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [302ae4a]
16
+ - @usebutr/wallet-standard-shared@0.5.1
17
+
18
+ ## 2.0.0
19
+
20
+ ### Major Changes
21
+
22
+ - 9b1caa2: Correctness pass across the storage, hydration and connector layers. Several of
23
+ these change observable behaviour; the ones worth knowing about before upgrading:
24
+
25
+ **Breaking**
26
+
27
+ - `SuiWallet.signTransaction` now returns `{ bytes, signature }` instead of
28
+ `Uint8Array`. Sui's `executeTransactionBlock` needs both, and each connector
29
+ previously returned a different half, so the old value could not be broadcast
30
+ and a consumer could not tell which half they held. SVM and Bitcoin keep their
31
+ single-`Uint8Array` shape.
32
+ - `@usebutr/svm`'s `sendTx` returns the signature base58-encoded, matching the
33
+ WalletConnect namespace, the Ledger app, Solana explorers and
34
+ `getSignatureStatuses`. It previously returned base64.
35
+ - `@usebutr/sui`'s feature input types drop the `string` arm from
36
+ `transaction`; wallets only ever accepted the `toJSON()` form. Strings and BCS
37
+ bytes are now wrapped for you, so `sendTx` accepts strictly more than before.
38
+
39
+ **Behaviour fixes**
40
+
41
+ - `WalletStorage.setPool` and `removePoolEntry` could self-deadlock on a corrupt
42
+ pool payload, leaving `connectWallet` unresolved and every later pool write
43
+ jammed for the page's life. Both are fixed, and `readWalletSnapshot` now shares
44
+ one codec with `WalletStorage` so the server and client decodes cannot drift.
45
+ - A seeded (SSR) entry whose silent reconnect failed used to stay in the pool
46
+ backed by a placeholder connector forever, so `useSigner`/`useBalance`
47
+ reported an error and `useConnectionStatus` reported `"reconnecting"`
48
+ permanently. Those entries are now dropped.
49
+ - `useSigner` and `useBalance` stay `idle` for a wallet that is still
50
+ reconnecting instead of surfacing a placeholder rejection as `status: "error"`.
51
+ - `useConnectionStatus` lets a live `"connecting"`/`"error"` take precedence over
52
+ the derived `"reconnecting"`, so an in-flight attempt and a connection error
53
+ are no longer hidden. New `useIsReconnecting(connectorId?)` answers the
54
+ per-wallet question directly.
55
+ - A background restore no longer writes the connect-attempt status or steals
56
+ `activeConnectorId`, and a superseded `CONNECT_FAILED` no longer overwrites the
57
+ current attempt.
58
+ - An externally-disconnected connector is now torn down, not just dropped from
59
+ the pool, so a cached adapter is not reused while still holding a session.
60
+ - EVM: a malformed provider response is treated as absent rather than `""`, which
61
+ previously produced chain `eip155:0`, zero-length signatures, empty transaction
62
+ hashes and a confident `0 ETH`. `switchChain` gained the same-chain
63
+ short-circuit `sendTxToChain` already had.
64
+ - WalletConnect: accounts carry their own chain instead of all being stamped with
65
+ the active one, so a multi-chain session no longer returns a wrong-chain
66
+ address. One pairing now covers every configured namespace, the pairing URI
67
+ survives a reconnect, and concurrent connects share one pairing.
68
+ - Bitcoin: the sats-connect (Xverse) adapter honours `silent`, so a reload no
69
+ longer triggers an unsolicited approval prompt, and exposes the payment address
70
+ as its single account instead of also presenting the ordinals address as
71
+ spendable.
72
+ - Polkadot: the injected adapter actually delivers events to subscribers,
73
+ `switchChain` notifies like its Wallet Standard sibling, and chain resolution
74
+ prefers the mainnets rather than whatever the wallet listed first.
75
+ - Ledger: the device session is committed atomically, so a locked device no
76
+ longer leaves an open transport that reports itself connected, and concurrent
77
+ connects open one transport.
78
+ - SVM: `sendTxToChain` submits to the chain you asked for instead of the
79
+ adapter's current one, and rejects a chain the wallet does not advertise.
80
+ - `@usebutr/svm`'s `switchChain` capability now counts only `solana:` chains, so
81
+ a multi-namespace wallet no longer advertises a method that always throws.
82
+
83
+ **Testing**
84
+
85
+ - `createFakePersistence` is now the real `WalletStorage` over memory drivers
86
+ rather than a parallel implementation, so it inherits upsert semantics,
87
+ validation and JSON round-tripping. Two divergences are fixed as a result:
88
+ `setPool` upserts rather than replaces, and `clearAll` leaves the
89
+ user-disconnected flag alone.
90
+ - `createFakeConnectedWallet` rejects being given both an `adapter` and explicit
91
+ `addresses`/`accounts`, a combination whose halves could disagree.
92
+
93
+ ### Patch Changes
94
+
95
+ - Updated dependencies [9b1caa2]
96
+ - @usebutr/wallet-standard-shared@0.5.0
97
+ - @usebutr/core@2.0.0
98
+
99
+ ## 1.0.1
100
+
101
+ ### Patch Changes
102
+
103
+ - Updated dependencies [8ecaf89]
104
+ - @usebutr/core@1.1.0
105
+ - @usebutr/wallet-standard-shared@0.4.1
106
+
107
+ ## 1.0.0
108
+
109
+ ### Major Changes
110
+
111
+ - f0a5116: **Breaking:** the `platform` field is gone from the `PlatformDiscoverer` type in `@usebutr/core`, and from the `evmDiscoverer`, `svmDiscoverer`, `suiDiscoverer`, `bitcoinDiscoverer` and `polkadotDiscoverer` objects that implement it. Nothing read it: the aggregator keys discoverers by `ChainPlatform` in its own registry, so the field only restated the key.
112
+
113
+ Migration: read the platform from the `KNOWN_DISCOVERERS` key in `@usebutr/wallets` (`Object.entries(KNOWN_DISCOVERERS)`), or from `adapter.chainPlatform` on a discovered adapter. Custom `PlatformDiscoverer` implementations must drop the `platform` property; keeping it is now an excess-property error.
114
+
115
+ - f0a5116: **Breaking:** `slugify` is no longer exported from `@usebutr/svm`, `@usebutr/sui` or `@usebutr/bitcoin`. Each package exported a one-argument wrapper that only bound a platform prefix onto the canonical two-argument helper, so three names shadowed one implementation.
116
+
117
+ Migration: import `slugify` from `@usebutr/wallet-standard-shared` and pass the platform prefix as the first argument. `slugify(name)` from `@usebutr/svm` becomes `slugify("svm", name)`; the `@usebutr/sui` prefix is `"sui"` and the `@usebutr/bitcoin` prefix is `"btc"`. Adapter ids are byte-for-byte the same.
118
+
119
+ ### Patch Changes
120
+
121
+ - 7887cf0: Resolve capabilities through `buildWalletCapabilities` from `@usebutr/wallet-standard-shared` instead of a per-package copy of the same object literal. Resolver names, input types and returned flags are unchanged. The injected Polkadot profile now derives its chain count from `POLKADOT_CHAINS_LIST` rather than asserting `switchChain: true` directly; the result is the same.
122
+ - 7887cf0: Move each package's `discover*Adapters` function next to the adapter builder it wraps and drop the single-function `wallet-standard.ts` module. The functions are still exported from the package root under the same names; only an internal file boundary went away.
123
+ - Updated dependencies [7887cf0]
124
+ - Updated dependencies [7887cf0]
125
+ - Updated dependencies [f0a5116]
126
+ - Updated dependencies [f0a5116]
127
+ - Updated dependencies [7887cf0]
128
+ - @usebutr/core@1.0.0
129
+ - @usebutr/wallet-standard-shared@0.4.0
130
+
131
+ ## 0.2.7
132
+
133
+ ### Patch Changes
134
+
135
+ - efe4550: Share the session plumbing behind the Wallet Standard and WalletConnect CAIP adapters. `@usebutr/wallet-standard-shared` now exports `createWalletStandardCore`, which the Bitcoin, Polkadot, Sui and SVM adapters build on; the WalletConnect Bitcoin, Sui and SVM namespaces share an equivalent CAIP core. Every package's public API is unchanged. The one visible difference is a dev-console warning: a failed SVM disconnect now logs `[butr] SVM Wallet Standard disconnect threw:` instead of `[butr] Wallet Standard disconnect threw:`.
136
+ - Updated dependencies [efe4550]
137
+ - Updated dependencies [4467a5e]
138
+ - @usebutr/wallet-standard-shared@0.3.0
139
+ - @usebutr/core@0.5.0
140
+
141
+ ## 0.2.6
142
+
143
+ ### Patch Changes
144
+
145
+ - Updated dependencies [c1309ee]
146
+ - @usebutr/core@0.4.2
147
+ - @usebutr/wallet-standard-shared@0.2.6
148
+
149
+ ## 0.2.5
150
+
151
+ ### Patch Changes
152
+
153
+ - 937dfae: Bump runtime dependency floors (`@wallet-standard/app` 1.1.1, `@ledgerhq/*` latest minors, `@walletconnect/universal-provider` 2.23.10) and modernize public type declarations from method signatures to property function types (oxlint `method-signature-style`). Type-level only — no runtime behavior change.
154
+ - Updated dependencies [937dfae]
155
+ - @usebutr/core@0.4.1
156
+ - @usebutr/wallet-standard-shared@0.2.5
157
+
158
+ ## 0.2.4
159
+
160
+ ### Patch Changes
161
+
162
+ - a46eecd: Ship unminified ESM so downstream bundlers (Vite/esbuild dep pre-bundling) process the package correctly; fixes a ReferenceError in consumer dev servers. The consuming app minifies once at its own build.
163
+ - Updated dependencies [b5322ae]
164
+ - Updated dependencies [d5f32c7]
165
+ - Updated dependencies [a46eecd]
166
+ - Updated dependencies [3f26776]
167
+ - @usebutr/core@0.4.0
168
+ - @usebutr/wallet-standard-shared@0.2.4
169
+
170
+ ## 0.2.3
171
+
172
+ ### Patch Changes
173
+
174
+ - Updated dependencies [886ee1d]
175
+ - @usebutr/core@0.3.0
176
+ - @usebutr/wallet-standard-shared@0.2.3
177
+
178
+ ## 0.2.2
179
+
180
+ ### Patch Changes
181
+
182
+ - Updated dependencies [db5d7e9]
183
+ - @usebutr/core@0.2.2
184
+ - @usebutr/wallet-standard-shared@0.2.2
185
+
186
+ ## 0.2.1
187
+
188
+ ### Patch Changes
189
+
190
+ - f846e77: Wallet-announced icons are trimmed of surrounding whitespace on ingestion. Some wallets ship data-URI icons with a leading newline, which strict consumers reject — Next.js's `<Image>` throws because `src` must not start with a control character. `@usebutr/core` exports a `sanitizeIcon` helper; the EIP-6963 and Wallet Standard adapters apply it, and an all-whitespace icon now resolves to `undefined` rather than a blank string.
191
+ - Updated dependencies [f846e77]
192
+ - @usebutr/core@0.2.1
193
+ - @usebutr/wallet-standard-shared@0.2.1
194
+
195
+ ## 0.2.0
196
+
197
+ ### Minor Changes
198
+
199
+ - b77a477: Shared Wallet Standard protocol types (`WalletStandardWallet`, `WalletStandardWalletAccount`, `WalletStandardAppModule`, `WalletsApp`, `StandardConnectFeature`, `StandardDisconnectFeature`, `StandardEventsFeature`, `StandardEventsListener`) are imported from `@usebutr/wallet-standard-shared` directly — they are no longer re-exported from `@usebutr/svm`, `@usebutr/sui`, or `@usebutr/bitcoin`. Platform-specific feature shapes still ship from their own packages.
200
+
201
+ `@usebutr/svm` adapter ids are now platform-prefixed (`wallet-standard:svm-<slug>`), consistent with the `sui-` and `btc-` prefixes. `slugify` in `@usebutr/wallet-standard-shared` requires a non-empty platform prefix.
202
+
203
+ ### Patch Changes
204
+
205
+ - Updated dependencies [b77a477]
206
+ - Updated dependencies [b77a477]
207
+ - @usebutr/core@0.2.0
208
+ - @usebutr/wallet-standard-shared@0.2.0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Pedro Filho
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,39 @@
1
+ # @usebutr/sui
2
+
3
+ Wallet Standard adapter for butr (Sui).
4
+
5
+ Part of [butr](https://www.usebutr.com), a multi-chain wallet discovery and
6
+ connection-state library. Your application owns the picker UI and chain client.
7
+
8
+ ## Install
9
+
10
+ ```bash
11
+ npm install @usebutr/react @usebutr/core @usebutr/sui zustand @wallet-standard/app
12
+ ```
13
+
14
+ React 18+ is a peer dependency of the provider. Discovery does not render a connect modal; add your picker as the provider child. `@wallet-standard/app` is required for Wallet Standard discovery.
15
+
16
+ ## Usage
17
+
18
+ ```tsx
19
+ import type { ReactNode } from "react";
20
+ import { createWalletSource } from "@usebutr/core";
21
+ import { discoverSuiAdapters } from "@usebutr/sui";
22
+ import { WalletManagerProvider } from "@usebutr/react";
23
+
24
+ const discovery = createWalletSource(discoverSuiAdapters);
25
+ export const WalletProvider = ({ children }: { children: ReactNode }) => (
26
+ <WalletManagerProvider discovery={discovery}>{children}</WalletManagerProvider>
27
+ );
28
+ ```
29
+
30
+ ## Documentation
31
+
32
+ - [Package reference](https://docs.usebutr.com/api/sui)
33
+ - [Getting started](https://docs.usebutr.com/getting-started/quickstart)
34
+ - [Examples and source](https://github.com/pedroapfilho/usebutr)
35
+ - [Report an issue](https://github.com/pedroapfilho/usebutr/issues)
36
+
37
+ ## License
38
+
39
+ [MIT](./LICENSE), copyright 2026 Pedro Filho.
package/dist/index.d.ts CHANGED
@@ -11,6 +11,7 @@ type SuiSignPersonalMessageOutput = {
11
11
  };
12
12
  type SuiSignPersonalMessageFeature = {
13
13
  signPersonalMessage: (input: SuiSignPersonalMessageInput) => Promise<SuiSignPersonalMessageOutput>;
14
+ version?: string;
14
15
  };
15
16
  type SuiSignTransactionInput = {
16
17
  account: WalletStandardWalletAccount;
@@ -25,6 +26,7 @@ type SuiSignTransactionOutput = {
25
26
  };
26
27
  type SuiSignTransactionFeature = {
27
28
  signTransaction: (input: SuiSignTransactionInput) => Promise<SuiSignTransactionOutput>;
29
+ version?: string;
28
30
  };
29
31
  type SuiSignAndExecuteTransactionInput = {
30
32
  account: WalletStandardWalletAccount;
@@ -41,6 +43,7 @@ type SuiSignAndExecuteTransactionOutput = {
41
43
  };
42
44
  type SuiSignAndExecuteTransactionFeature = {
43
45
  signAndExecuteTransaction: (input: SuiSignAndExecuteTransactionInput) => Promise<SuiSignAndExecuteTransactionOutput>;
46
+ version?: string;
44
47
  };
45
48
  //#endregion
46
49
  //#region src/wallet-standard-adapter.d.ts
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/wallet-standard-types.ts","../src/wallet-standard-adapter.ts","../src/chains.ts","../src/capabilities.ts","../src/discoverer.ts","../src/signer-augmentation.ts"],"mappings":";;;KAOK;EACH,SAAS;EACT,SAAS;;KAGN;EACH;EACA;;KAGG;EACH,sBACE,OAAO,gCACJ,QAAQ;;KAGV;EACH,SAAS;EACT;EACA;IAAe,cAAc;;;KAG1B;EACH;EACA;;KAGG;EACH,kBAAkB,OAAO,4BAA4B,QAAQ;;KAG1D;EACH,SAAS;EACT;EACA;IAAe,cAAc;;;KAG1B;EACH;EACA;EACA;EACA;;KAGG;EACH,4BACE,OAAO,sCACJ,QAAQ;;;;;;;;;cCPT,kBACJ,QAAQ,sBAIR;;;;AAAA,wBAAwB,8BACvB;;;;;cAqIG,sBAAuB,YAAY,SAAS;;;cCxL5C;;;;;;;;;;;;;;;;;;;;;;;;;;cAiBA,iBAAiB,cAAc;;;KChBhC;EACH;EACA;IACE;IACA;IACA;IACA;;;;;;;;cASE,yBAA0B,OAAO,kCAAgC;;;;;;;cCVjE,eAAe;;;;;;;;YCAT;IACR,KAAK"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/wallet-standard-types.ts","../src/wallet-standard-adapter.ts","../src/chains.ts","../src/capabilities.ts","../src/discoverer.ts","../src/signer-augmentation.ts"],"mappings":";;;KAOK;EACH,SAAS;EACT,SAAS;;KAGN;EACH;EACA;;KAGG;EACH,sBACE,OAAO,gCACJ,QAAQ;EACb;;KAGG;EACH,SAAS;EACT;EACA;IAAe,cAAc;;;KAG1B;EACH;EACA;;KAGG;EACH,kBAAkB,OAAO,4BAA4B,QAAQ;EAC7D;;KAGG;EACH,SAAS;EACT;EACA;IAAe,cAAc;;;KAG1B;EACH;EACA;EACA;EACA;;KAGG;EACH,4BACE,OAAO,sCACJ,QAAQ;EACb;;;;;;;;;cCII,kBAAe,QACX,sBAIe;;;;AAAA,wBAAC,8BACvB;;;;;cAwIG,sBAAmB,YAAgB,SAAS;;;cCzM5C;;aACM;aAAkB;aAAoB;aAAkB;;;aAEhE;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;;;aAES;aAAmB;aAAqB;aAAkB;;;cAGjE,iBAAiB,cAAc;;;KChBhC;EACH;EACA;IACE;IACA;IACA;IACA;;;;;;;;cASE,yBAAsB,OAAW,kCAAgC;;;;;;;cCVjE,eAAe;;;;;;;;YCAT;IACR,KAAK"}
package/dist/index.js CHANGED
@@ -21,6 +21,9 @@ const resolveSuiCapabilities = (input) => buildWalletCapabilities({
21
21
  const SUI_PREFIX = "sui:";
22
22
  const SUI_DECIMALS = 9;
23
23
  const SUI_MAINNET = "sui:mainnet";
24
+ const isSuiSignPersonalMessageFeature = (feature) => "signPersonalMessage" in feature && typeof feature.signPersonalMessage === "function";
25
+ const isSuiSignAndExecuteTransactionFeature = (feature) => "signAndExecuteTransaction" in feature && typeof feature.signAndExecuteTransaction === "function";
26
+ const isSuiSignTransactionFeature = (feature) => "signTransaction" in feature && typeof feature.signTransaction === "function";
24
27
  /** Coerce butr's `unknown` tx into the shape the Sui Wallet Standard features
25
28
  * expect: an object with `toJSON()` returning a Promise<string>. A raw string
26
29
  * or BCS byte array is wrapped, because wallets accept only the `toJSON()`
@@ -31,7 +34,7 @@ const coerceSuiTransaction = (tx) => {
31
34
  const encoded = bytesToBase64(tx);
32
35
  return { toJSON: () => Promise.resolve(encoded) };
33
36
  }
34
- if (typeof tx === "object" && tx !== null && "toJSON" in tx && typeof tx.toJSON === "function") return tx;
37
+ if (typeof tx === "object" && tx !== null && "toJSON" in tx && typeof tx.toJSON === "function") return { toJSON: tx.toJSON };
35
38
  throw new TypeError("Sui sendTx/signTransaction expects a @mysten/sui Transaction (with toJSON()), a base64-encoded string, or BCS bytes");
36
39
  };
37
40
  /**
@@ -52,9 +55,9 @@ const buildSuiAdapter = (wallet, registerDisconnector) => {
52
55
  wallet
53
56
  });
54
57
  if (core === null) return null;
55
- const signMessage = getFeature(wallet, "sui:signPersonalMessage");
56
- const signAndExecute = getFeature(wallet, "sui:signAndExecuteTransaction");
57
- const signTx = getFeature(wallet, "sui:signTransaction");
58
+ const signMessage = getFeature(wallet, "sui:signPersonalMessage", isSuiSignPersonalMessageFeature);
59
+ const signAndExecute = getFeature(wallet, "sui:signAndExecuteTransaction", isSuiSignAndExecuteTransactionFeature);
60
+ const signTx = getFeature(wallet, "sui:signTransaction", isSuiSignTransactionFeature);
58
61
  /** Resolve a caller-supplied target into a chain the wallet advertises,
59
62
  * accepting either a full CAIP-2 id (`sui:testnet`) or a bare reference. */
60
63
  const resolveTargetChain = (targetChainId) => {
@@ -72,7 +75,7 @@ const buildSuiAdapter = (wallet, registerDisconnector) => {
72
75
  transaction
73
76
  })).digest;
74
77
  };
75
- return {
78
+ const adapter = {
76
79
  ...core,
77
80
  capabilities: resolveSuiCapabilities({
78
81
  chainCount: core.chainCount,
@@ -110,21 +113,22 @@ const buildSuiAdapter = (wallet, registerDisconnector) => {
110
113
  signature: base64ToBytes(output.signature),
111
114
  signedMessage: base64ToBytes(output.bytes)
112
115
  };
113
- },
114
- ...signTx === void 0 ? {} : { async signTransaction(tx, account) {
115
- const wsAccount = core.resolveAccount(account);
116
- const transaction = coerceSuiTransaction(tx);
117
- const output = await signTx.signTransaction({
118
- account: wsAccount,
119
- chain: core.currentChainId(),
120
- transaction
121
- });
122
- return {
123
- bytes: base64ToBytes(output.bytes),
124
- signature: base64ToBytes(output.signature)
125
- };
126
- } }
116
+ }
117
+ };
118
+ if (signTx !== void 0) adapter.signTransaction = async (tx, account) => {
119
+ const wsAccount = core.resolveAccount(account);
120
+ const transaction = coerceSuiTransaction(tx);
121
+ const output = await signTx.signTransaction({
122
+ account: wsAccount,
123
+ chain: core.currentChainId(),
124
+ transaction
125
+ });
126
+ return {
127
+ bytes: base64ToBytes(output.bytes),
128
+ signature: base64ToBytes(output.signature)
129
+ };
127
130
  };
131
+ return adapter;
128
132
  };
129
133
  /**
130
134
  * Requires the optional `@wallet-standard/app` peer dep.
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/capabilities.ts","../src/wallet-standard-adapter.ts","../src/chains.ts","../src/discoverer.ts"],"sourcesContent":["import type { WalletCapabilities } from \"@usebutr/core\";\nimport { buildWalletCapabilities } from \"@usebutr/wallet-standard-shared\";\n\ntype WalletStandardCapabilityInput = {\n chainCount: number;\n features: {\n events: boolean;\n signAndExecuteTransaction: boolean;\n signMessage: boolean;\n signTransaction: boolean;\n };\n};\n\n/**\n * `signIn` is false: Sui Wallet Standard has no Sign-In-With-Sui feature.\n * `signAndExecuteTransaction` means the wallet broadcasts, while\n * `signTransaction` is sign-only and leaves the broadcast to the consumer.\n */\nconst resolveSuiCapabilities = (input: WalletStandardCapabilityInput): WalletCapabilities =>\n buildWalletCapabilities({\n chainCount: input.chainCount,\n events: input.features.events,\n sendTransaction: input.features.signAndExecuteTransaction,\n signIn: false,\n signMessage: input.features.signMessage,\n signTransaction: input.features.signTransaction,\n });\n\nexport type { WalletStandardCapabilityInput };\nexport { resolveSuiCapabilities };\n","import type { WalletAdapter } from \"@usebutr/core\";\nimport { base64ToBytes, bytesToBase64 } from \"@usebutr/core\";\nimport {\n createWalletStandardCore,\n discoverWalletStandard,\n getFeature,\n slugify,\n} from \"@usebutr/wallet-standard-shared\";\nimport type { WalletStandardWallet } from \"@usebutr/wallet-standard-shared\";\n\nimport { resolveSuiCapabilities } from \"./capabilities\";\nimport type {\n SuiSignAndExecuteTransactionFeature,\n SuiSignPersonalMessageFeature,\n SuiSignTransactionFeature,\n} from \"./wallet-standard-types\";\n\nconst SUI_PREFIX = \"sui:\";\nconst SUI_DECIMALS = 9;\nconst SUI_MAINNET = \"sui:mainnet\";\n\n/** Coerce butr's `unknown` tx into the shape the Sui Wallet Standard features\n * expect: an object with `toJSON()` returning a Promise<string>. A raw string\n * or BCS byte array is wrapped, because wallets accept only the `toJSON()`\n * form and a bare string reaches them as a shape they cannot consume. */\nconst coerceSuiTransaction = (tx: unknown): { toJSON: () => Promise<string> } => {\n if (typeof tx === \"string\") {\n return { toJSON: () => Promise.resolve(tx) };\n }\n if (tx instanceof Uint8Array) {\n const encoded = bytesToBase64(tx);\n return { toJSON: () => Promise.resolve(encoded) };\n }\n if (typeof tx === \"object\" && tx !== null && \"toJSON\" in tx && typeof tx.toJSON === \"function\") {\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion -- validated toJSON() above; @mysten/sui Transaction is otherwise untyped here\n return tx as { toJSON: () => Promise<string> };\n }\n throw new TypeError(\n \"Sui sendTx/signTransaction expects a @mysten/sui Transaction (with toJSON()), a base64-encoded string, or BCS bytes\",\n );\n};\n\n/**\n * Sui Wallet Standard has no \"switch network\" RPC, so `switchChain` moves\n * butr's view only and the wallet's own UI owns its cluster. Balance and\n * receipt reads need `@mysten/sui`'s `SuiClient`, which butr doesn't ship.\n */\nconst buildSuiAdapter = (\n wallet: WalletStandardWallet,\n /** Optional. Called with a function that pushes a synthetic\n * `disconnected` event to all current subscribers. The discovery\n * layer invokes it on Wallet Standard `unregister`. */\n registerDisconnector?: (emit: () => void) => void,\n): WalletAdapter | null => {\n const core = createWalletStandardCore({\n chainPrefix: SUI_PREFIX,\n id: slugify(\"sui\", wallet.name),\n label: \"Sui\",\n namespace: \"sui\",\n platform: \"Sui\",\n preferredChainIds: [SUI_MAINNET],\n registerDisconnector,\n trackChainChanges: true,\n wallet,\n });\n if (core === null) {\n return null;\n }\n\n const signMessage = getFeature<SuiSignPersonalMessageFeature>(wallet, \"sui:signPersonalMessage\");\n const signAndExecute = getFeature<SuiSignAndExecuteTransactionFeature>(\n wallet,\n \"sui:signAndExecuteTransaction\",\n );\n const signTx = getFeature<SuiSignTransactionFeature>(wallet, \"sui:signTransaction\");\n\n /** Resolve a caller-supplied target into a chain the wallet advertises,\n * accepting either a full CAIP-2 id (`sui:testnet`) or a bare reference. */\n const resolveTargetChain = (targetChainId: string): string => {\n const candidate = targetChainId.startsWith(SUI_PREFIX)\n ? targetChainId\n : `${SUI_PREFIX}${targetChainId}`;\n if (!wallet.chains.includes(candidate)) {\n throw new Error(\n `Wallet ${wallet.name} does not advertise chain \"${candidate}\". Available: ${wallet.chains.join(\", \")}`,\n );\n }\n return candidate;\n };\n\n const executeTx = async (\n tx: unknown,\n account?: { walletAddress: string },\n chain?: string,\n ): Promise<string> => {\n if (signAndExecute === undefined) {\n throw new Error(`Wallet ${wallet.name} does not advertise sui:signAndExecuteTransaction`);\n }\n const wsAccount = core.resolveAccount(account);\n const transaction = coerceSuiTransaction(tx);\n const output = await signAndExecute.signAndExecuteTransaction({\n account: wsAccount,\n chain: chain ?? core.currentChainId(),\n transaction,\n });\n return output.digest;\n };\n\n return {\n ...core,\n capabilities: resolveSuiCapabilities({\n chainCount: core.chainCount,\n features: {\n events: core.hasEvents,\n signAndExecuteTransaction: Boolean(signAndExecute),\n signMessage: Boolean(signMessage),\n signTransaction: Boolean(signTx),\n },\n }),\n chainPlatform: \"sui\",\n\n getBalance: () =>\n Promise.resolve({\n decimals: SUI_DECIMALS,\n formatted: \"0\",\n symbol: \"SUI\",\n value: 0n,\n }),\n\n getTransactionReceipt: () => Promise.resolve({ status: \"Pending\" as const }),\n\n async requestAccounts() {\n await core.connect();\n },\n\n sendTx: (tx, account) => executeTx(tx, account),\n\n // Async so an unadvertised chain surfaces as a rejection rather than a\n // synchronous throw; the declared return type is a promise either way.\n async sendTxToChain(tx, targetChainId, account, cb) {\n const target = resolveTargetChain(targetChainId);\n if (target !== core.currentChainId()) {\n cb?.();\n }\n const digest = await executeTx(tx, account, target);\n return digest;\n },\n\n async signMessage(msg, account) {\n if (signMessage === undefined) {\n throw new Error(`Wallet ${wallet.name} does not advertise sui:signPersonalMessage`);\n }\n const output = await signMessage.signPersonalMessage({\n account: core.resolveAccount(account),\n message: msg,\n });\n return {\n signature: base64ToBytes(output.signature),\n signedMessage: base64ToBytes(output.bytes),\n };\n },\n\n ...(signTx === undefined\n ? {}\n : {\n async signTransaction(tx, account) {\n const wsAccount = core.resolveAccount(account);\n const transaction = coerceSuiTransaction(tx);\n const output = await signTx.signTransaction({\n account: wsAccount,\n chain: core.currentChainId(),\n transaction,\n });\n return {\n bytes: base64ToBytes(output.bytes),\n signature: base64ToBytes(output.signature),\n };\n },\n }),\n };\n};\n\n/**\n * Requires the optional `@wallet-standard/app` peer dep.\n * Spec: https://docs.sui.io/standards/wallet-standard\n */\nconst discoverSuiAdapters = (onAdapter: (adapter: WalletAdapter) => void): (() => void) =>\n discoverWalletStandard(onAdapter, (wallet, registerDisconnector) =>\n buildSuiAdapter(wallet, registerDisconnector),\n );\n\nexport { buildSuiAdapter, discoverSuiAdapters };\n","import type { ChainBase } from \"@usebutr/core\";\n\nconst SUI_CHAINS = {\n devnet: { id: \"sui:devnet\", name: \"Sui Devnet\", namespace: \"sui\", reference: \"devnet\" },\n localnet: {\n id: \"sui:localnet\",\n name: \"Sui Localnet\",\n namespace: \"sui\",\n reference: \"localnet\",\n },\n mainnet: {\n id: \"sui:mainnet\",\n name: \"Sui Mainnet\",\n namespace: \"sui\",\n reference: \"mainnet\",\n },\n testnet: { id: \"sui:testnet\", name: \"Sui Testnet\", namespace: \"sui\", reference: \"testnet\" },\n} as const satisfies Record<string, ChainBase>;\n\nconst SUI_CHAINS_LIST: ReadonlyArray<ChainBase> = Object.values(SUI_CHAINS);\n\nexport { SUI_CHAINS, SUI_CHAINS_LIST };\n","import type { PlatformDiscoverer } from \"@usebutr/core\";\n\nimport { discoverSuiAdapters } from \"./wallet-standard-adapter\";\n\n/**\n * Sui's `PlatformDiscoverer`: Sui Wallet Standard announcements. No\n * legacy fallback; Sui standardised on Wallet Stand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,WAAW,SACX,CAAC,IACD,EACE,MAAM,gBAAgB,IAAI,SAAS;GACjC,MAAM,YAAY,KAAK,eAAe,OAAO;GAC7C,MAAM,cAAc,qBAAqB,EAAE;GAC3C,MAAM,SAAS,MAAM,OAAO,gBAAgB;IAC1C,SAAS;IACT,OAAO,KAAK,eAAe;IAC3B;GACF,CAAC;GACD,OAAO;IACL,OAAO,cAAc,OAAO,KAAK;IACjC,WAAW,cAAc,OAAO,SAAS;GAC3C;EACF,EACF;CACN;AACF;;;;;AAMA,MAAM,uBAAuB,cAC3B,uBAAuB,YAAY,QAAQ,yBACzC,gBAAgB,QAAQ,oBAAoB,CAC9C;;;;AC3LF,MAAM,aAAa;CACjB,QAAQ;EAAE,IAAI;EAAc,MAAM;EAAc,WAAW;EAAO,WAAW;CAAS;CACtF,UAAU;EACR,IAAI;EACJ,MAAM;EACN,WAAW;EACX,WAAW;CACb;CACA,SAAS;EACP,IAAI;EACJ,MAAM;EACN,WAAW;EACX,WAAW;CACb;CACA,SAAS;EAAE,IAAI;EAAe,MAAM;EAAe,WAAW;EAAO,WAAW;CAAU;AAC5F;AAEA,MAAM,kBAA4C,OAAO,OAAO,UAAU;;;;;;;;ACX1E,MAAM,gBAAoC,EACxC,WAAW,oBACb"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/capabilities.ts","../src/wallet-standard-adapter.ts","../src/chains.ts","../src/discoverer.ts"],"sourcesContent":["import type { WalletCapabilities } from \"@usebutr/core\";\nimport { buildWalletCapabilities } from \"@usebutr/wallet-standard-shared\";\n\ntype WalletStandardCapabilityInput = {\n chainCount: number;\n features: {\n events: boolean;\n signAndExecuteTransaction: boolean;\n signMessage: boolean;\n signTransaction: boolean;\n };\n};\n\n/**\n * `signIn` is false: Sui Wallet Standard has no Sign-In-With-Sui feature.\n * `signAndExecuteTransaction` means the wallet broadcasts, while\n * `signTransaction` is sign-only and leaves the broadcast to the consumer.\n */\nconst resolveSuiCapabilities = (input: WalletStandardCapabilityInput): WalletCapabilities =>\n buildWalletCapabilities({\n chainCount: input.chainCount,\n events: input.features.events,\n sendTransaction: input.features.signAndExecuteTransaction,\n signIn: false,\n signMessage: input.features.signMessage,\n signTransaction: input.features.signTransaction,\n });\n\nexport type { WalletStandardCapabilityInput };\nexport { resolveSuiCapabilities };\n","import type { TransactionInput, WalletAdapter } from \"@usebutr/core\";\nimport { base64ToBytes, bytesToBase64 } from \"@usebutr/core\";\nimport {\n createWalletStandardCore,\n discoverWalletStandard,\n getFeature,\n slugify,\n} from \"@usebutr/wallet-standard-shared\";\nimport type { WalletStandardFeature, WalletStandardWallet } from \"@usebutr/wallet-standard-shared\";\n\nimport { resolveSuiCapabilities } from \"./capabilities\";\nimport type {\n SuiSignAndExecuteTransactionFeature,\n SuiSignPersonalMessageFeature,\n SuiSignTransactionFeature,\n} from \"./wallet-standard-types\";\n\nconst SUI_PREFIX = \"sui:\";\nconst SUI_DECIMALS = 9;\nconst SUI_MAINNET = \"sui:mainnet\";\n\nconst isSuiSignPersonalMessageFeature = (\n feature: WalletStandardFeature,\n): feature is WalletStandardFeature & SuiSignPersonalMessageFeature =>\n \"signPersonalMessage\" in feature && typeof feature.signPersonalMessage === \"function\";\n\nconst isSuiSignAndExecuteTransactionFeature = (\n feature: WalletStandardFeature,\n): feature is WalletStandardFeature & SuiSignAndExecuteTransactionFeature =>\n \"signAndExecuteTransaction\" in feature && typeof feature.signAndExecuteTransaction === \"function\";\n\nconst isSuiSignTransactionFeature = (\n feature: WalletStandardFeature,\n): feature is WalletStandardFeature & SuiSignTransactionFeature =>\n \"signTransaction\" in feature && typeof feature.signTransaction === \"function\";\n\n/** Coerce butr's `unknown` tx into the shape the Sui Wallet Standard features\n * expect: an object with `toJSON()` returning a Promise<string>. A raw string\n * or BCS byte array is wrapped, because wallets accept only the `toJSON()`\n * form and a bare string reaches them as a shape they cannot consume. */\nconst coerceSuiTransaction = (tx: TransactionInput) => {\n if (typeof tx === \"string\") {\n return { toJSON: () => Promise.resolve(tx) };\n }\n if (tx instanceof Uint8Array) {\n const encoded = bytesToBase64(tx);\n return { toJSON: () => Promise.resolve(encoded) };\n }\n if (typeof tx === \"object\" && tx !== null && \"toJSON\" in tx && typeof tx.toJSON === \"function\") {\n return { toJSON: tx.toJSON };\n }\n throw new TypeError(\n \"Sui sendTx/signTransaction expects a @mysten/sui Transaction (with toJSON()), a base64-encoded string, or BCS bytes\",\n );\n};\n\n/**\n * Sui Wallet Standard has no \"switch network\" RPC, so `switchChain` moves\n * butr's view only and the wallet's own UI owns its cluster. Balance and\n * receipt reads need `@mysten/sui`'s `SuiClient`, which butr doesn't ship.\n */\nconst buildSuiAdapter = (\n wallet: WalletStandardWallet,\n /** Optional. Called with a function that pushes a synthetic\n * `disconnected` event to all current subscribers. The discovery\n * layer invokes it on Wallet Standard `unregister`. */\n registerDisconnector?: (emit: () => void) => void,\n): WalletAdapter | null => {\n const core = createWalletStandardCore({\n chainPrefix: SUI_PREFIX,\n id: slugify(\"sui\", wallet.name),\n label: \"Sui\",\n namespace: \"sui\",\n platform: \"Sui\",\n preferredChainIds: [SUI_MAINNET],\n registerDisconnector,\n trackChainChanges: true,\n wallet,\n });\n if (core === null) {\n return null;\n }\n\n const signMessage = getFeature(\n wallet,\n \"sui:signPersonalMessage\",\n isSuiSignPersonalMessageFeature,\n );\n const signAndExecute = getFeature(\n wallet,\n \"sui:signAndExecuteTransaction\",\n isSuiSignAndExecuteTransactionFeature,\n );\n const signTx = getFeature(wallet, \"sui:signTransaction\", isSuiSignTransactionFeature);\n\n /** Resolve a caller-supplied target into a chain the wallet advertises,\n * accepting either a full CAIP-2 id (`sui:testnet`) or a bare reference. */\n const resolveTargetChain = (targetChainId: string): string => {\n const candidate = targetChainId.startsWith(SUI_PREFIX)\n ? targetChainId\n : `${SUI_PREFIX}${targetChainId}`;\n if (!wallet.chains.includes(candidate)) {\n throw new Error(\n `Wallet ${wallet.name} does not advertise chain \"${candidate}\". Available: ${wallet.chains.join(\", \")}`,\n );\n }\n return candidate;\n };\n\n const executeTx = async (\n tx: TransactionInput,\n account?: { walletAddress: string },\n chain?: string,\n ): Promise<string> => {\n if (signAndExecute === undefined) {\n throw new Error(`Wallet ${wallet.name} does not advertise sui:signAndExecuteTransaction`);\n }\n const wsAccount = core.resolveAccount(account);\n const transaction = coerceSuiTransaction(tx);\n const output = await signAndExecute.signAndExecuteTransaction({\n account: wsAccount,\n chain: chain ?? core.currentChainId(),\n transaction,\n });\n return output.digest;\n };\n\n const adapter: WalletAdapter = {\n ...core,\n capabilities: resolveSuiCapabilities({\n chainCount: core.chainCount,\n features: {\n events: core.hasEvents,\n signAndExecuteTransaction: Boolean(signAndExecute),\n signMessage: Boolean(signMessage),\n signTransaction: Boolean(signTx),\n },\n }),\n chainPlatform: \"sui\",\n\n getBalance: () =>\n Promise.resolve({\n decimals: SUI_DECIMALS,\n formatted: \"0\",\n symbol: \"SUI\",\n value: 0n,\n }),\n\n getTransactionReceipt: () => Promise.resolve({ status: \"Pending\" as const }),\n\n async requestAccounts() {\n await core.connect();\n },\n\n sendTx: (tx, account) => executeTx(tx, account),\n\n async sendTxToChain(tx, targetChainId, account, cb) {\n const target = resolveTargetChain(targetChainId);\n if (target !== core.currentChainId()) {\n cb?.();\n }\n const digest = await executeTx(tx, account, target);\n return digest;\n },\n\n async signMessage(msg, account) {\n if (signMessage === undefined) {\n throw new Error(`Wallet ${wallet.name} does not advertise sui:signPersonalMessage`);\n }\n const output = await signMessage.signPersonalMessage({\n account: core.resolveAccount(account),\n message: msg,\n });\n return {\n signature: base64ToBytes(output.signature),\n signedMessage: base64ToBytes(output.bytes),\n };\n },\n };\n\n if (signTx !== undefined) {\n adapter.signTransaction = async (tx, account) => {\n const wsAccount = core.resolveAccount(account);\n const transaction = coerceSuiTransaction(tx);\n const output = await signTx.signTransaction({\n account: wsAccount,\n chain: core.currentChainId(),\n transaction,\n });\n return {\n bytes: base64ToBytes(output.bytes),\n signature: base64ToBytes(output.signature),\n };\n };\n }\n\n return adapter;\n};\n\n/**\n * Requires the optional `@wallet-standard/app` peer dep.\n * Spec: https://docs.sui.io/standards/wallet-standard\n */\nconst discoverSuiAdapters = (onAdapter: (adapter: WalletAdapter) => void): (() => void) =>\n discoverWalletStandard(onAdapter, (wallet, registerDisconnector) =>\n buildSuiAdapter(wallet, registerDisconnector),\n );\n\nexport { buildSuiAdapter, discoverSuiAdapters };\n","import type { ChainBase } from \"@usebutr/core\";\n\nconst SUI_CHAINS = {\n devnet: { id: \"sui:devnet\", name: \"Sui Devnet\", namespace: \"sui\", reference: \"devnet\" },\n localnet: {\n id: \"sui:localnet\",\n name: \"Sui Localnet\",\n namespace: \"sui\",\n reference: \"localnet\",\n },\n mainnet: {\n id: \"sui:mainnet\",\n name: \"Sui Mainnet\",\n namespace: \"sui\",\n reference: \"mainnet\",\n },\n testnet: { id: \"sui:testnet\", name: \"Sui Testnet\", namespace: \"sui\", reference: \"testnet\" },\n} as const satisfies Record<string, ChainBase>;\n\nconst SUI_CHAINS_LIST: ReadonlyArray<ChainBase> = Object.values(SUI_CHAINS);\n\nexport { SUI_CHAINS, SUI_CHAINS_LIST };\n","import type { PlatformDiscoverer } from \"@usebutr/core\";\n\nimport { discoverSuiAdapters } from \"./wallet-standard-adapter\";\n\n/**\n * Sui's `PlatformDiscoverer`: Sui Wallet Standard announcements. No\n * legacy fallback; Sui standardised on Wallet Standard from launch.\n */\nconst suiDiscoverer: PlatformDiscoverer = {\n subscribe: discoverSuiAdapters,\n};\n\nexport { suiDiscoverer };\n"],"mappings":";;;;;;;;;AAkBA,MAAM,0BAA0B,UAC9B,wBAAwB;CACtB,YAAY,MAAM;CAClB,QAAQ,MAAM,SAAS;CACvB,iBAAiB,MAAM,SAAS;CAChC,QAAQ;CACR,aAAa,MAAM,SAAS;CAC5B,iBAAiB,MAAM,SAAS;AAClC,CAAC;;;;ACTH,MAAM,aAAa;AACnB,MAAM,eAAe;AACrB,MAAM,cAAc;AAEpB,MAAM,mCACJ,YAEA,yBAAyB,WAAW,OAAO,QAAQ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C1C,SAAS;GACT,OAAO,KAAK,eAAe;GAC3B;EACF,CAAC;EACD,OAAO;GACL,OAAO,cAAc,OAAO,KAAK;GACjC,WAAW,cAAc,OAAO,SAAS;EAC3C;CACF;CAGF,OAAO;AACT;;;;;AAMA,MAAM,uBAAuB,cAC3B,uBAAuB,YAAY,QAAQ,yBACzC,gBAAgB,QAAQ,oBAAoB,CAC9C;;;;AC5MF,MAAM,aAAa;CACjB,QAAQ;EAAE,IAAI;EAAc,MAAM;EAAc,WAAW;EAAO,WAAW;CAAS;CACtF,UAAU;EACR,IAAI;EACJ,MAAM;EACN,WAAW;EACX,WAAW;CACb;CACA,SAAS;EACP,IAAI;EACJ,MAAM;EACN,WAAW;EACX,WAAW;CACb;CACA,SAAS;EAAE,IAAI;EAAe,MAAM;EAAe,WAAW;EAAO,WAAW;CAAU;AAC5F;AAEA,MAAM,kBAA4C,OAAO,OAAO,UAAU;;;;;;;;ACX1E,MAAM,gBAAoC,EACxC,WAAW,oBACb"}
package/package.json CHANGED
@@ -1,7 +1,21 @@
1
1
  {
2
2
  "name": "@usebutr/sui",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "Wallet Standard adapter for butr (Sui).",
5
+ "keywords": [
6
+ "butr",
7
+ "dapp",
8
+ "react",
9
+ "sui",
10
+ "typescript",
11
+ "wallet",
12
+ "wallet-standard",
13
+ "web3"
14
+ ],
15
+ "homepage": "https://docs.usebutr.com/api/sui",
16
+ "bugs": {
17
+ "url": "https://github.com/pedroapfilho/usebutr/issues"
18
+ },
5
19
  "license": "MIT",
6
20
  "author": "Pedro Filho <pedro@filho.me>",
7
21
  "repository": {
@@ -10,7 +24,8 @@
10
24
  "directory": "packages/sui"
11
25
  },
12
26
  "files": [
13
- "dist"
27
+ "dist",
28
+ "CHANGELOG.md"
14
29
  ],
15
30
  "type": "module",
16
31
  "sideEffects": false,
@@ -25,12 +40,12 @@
25
40
  "access": "public"
26
41
  },
27
42
  "dependencies": {
28
- "@usebutr/core": "2.0.0",
29
- "@usebutr/wallet-standard-shared": "0.5.0"
43
+ "@usebutr/core": "2.0.1",
44
+ "@usebutr/wallet-standard-shared": "1.0.0"
30
45
  },
31
46
  "devDependencies": {
32
47
  "@wallet-standard/app": "^1.1.1",
33
- "typescript": "^6.0.3",
48
+ "typescript": "^7.0.2",
34
49
  "vitest": "^4.1.10",
35
50
  "@repo/config-vitest": "0.0.0",
36
51
  "@repo/typescript-config": "0.0.0"