@usebutr/sui 1.0.1 → 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 +208 -0
- package/LICENSE +21 -0
- package/README.md +39 -0
- package/dist/index.d.ts +14 -44
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +54 -67
- package/dist/index.js.map +1 -1
- package/package.json +20 -6
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,13 +11,14 @@ 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;
|
|
17
18
|
chain: string;
|
|
18
19
|
transaction: {
|
|
19
20
|
toJSON: () => Promise<string>;
|
|
20
|
-
}
|
|
21
|
+
};
|
|
21
22
|
};
|
|
22
23
|
type SuiSignTransactionOutput = {
|
|
23
24
|
bytes: string;
|
|
@@ -25,13 +26,14 @@ 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;
|
|
31
33
|
chain: string;
|
|
32
34
|
transaction: {
|
|
33
35
|
toJSON: () => Promise<string>;
|
|
34
|
-
}
|
|
36
|
+
};
|
|
35
37
|
};
|
|
36
38
|
type SuiSignAndExecuteTransactionOutput = {
|
|
37
39
|
bytes: string;
|
|
@@ -41,26 +43,14 @@ 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
|
|
47
50
|
/**
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
* expose `standard:connect`. Same posture as `buildSvmAdapter`: gate
|
|
52
|
-
* features on what each wallet advertises, return placeholders for
|
|
53
|
-
* RPC-backed reads (`getBalance`, `getTransactionReceipt`), forward
|
|
54
|
-
* `subscribe` through `standard:events`.
|
|
55
|
-
*
|
|
56
|
-
* **Known limitations**
|
|
57
|
-
*
|
|
58
|
-
* - `getBalance` returns a `{ value: 0n, symbol: "SUI" }` placeholder.
|
|
59
|
-
* Consumers wrap `@mysten/sui`'s `SuiClient` for real reads.
|
|
60
|
-
* - `getTransactionReceipt` returns `"Pending"` for the same reason.
|
|
61
|
-
* - `switchChain` is local-state-only (mirrors SVM). Sui Wallet Standard
|
|
62
|
-
* has no "tell the wallet to switch network" RPC; the wallet's UI
|
|
63
|
-
* controls its global cluster setting.
|
|
51
|
+
* Sui Wallet Standard has no "switch network" RPC, so `switchChain` moves
|
|
52
|
+
* butr's view only and the wallet's own UI owns its cluster. Balance and
|
|
53
|
+
* receipt reads need `@mysten/sui`'s `SuiClient`, which butr doesn't ship.
|
|
64
54
|
*/
|
|
65
55
|
declare const buildSuiAdapter: (wallet: WalletStandardWallet,
|
|
66
56
|
/** Optional. Called with a function that pushes a synthetic
|
|
@@ -68,20 +58,8 @@ declare const buildSuiAdapter: (wallet: WalletStandardWallet,
|
|
|
68
58
|
* layer invokes it on Wallet Standard `unregister`. */
|
|
69
59
|
registerDisconnector?: (emit: () => void) => void) => WalletAdapter | null;
|
|
70
60
|
/**
|
|
71
|
-
*
|
|
61
|
+
* Requires the optional `@wallet-standard/app` peer dep.
|
|
72
62
|
* Spec: https://docs.sui.io/standards/wallet-standard
|
|
73
|
-
*
|
|
74
|
-
* Runtime requires the `@wallet-standard/app` package, which is an
|
|
75
|
-
* **optional peer dependency** of butr.
|
|
76
|
-
*
|
|
77
|
-
* Sui wallets share the same `getWallets()` bus as SVM wallets; Phantom
|
|
78
|
-
* advertises features for SVM, Sui, and Bitcoin from a single Wallet
|
|
79
|
-
* Standard wallet object. `buildSuiAdapter` returns `null` for wallets
|
|
80
|
-
* that don't advertise any `sui:*` features, so we cleanly end up with
|
|
81
|
-
* one adapter per platform on multi-chain wallets.
|
|
82
|
-
*
|
|
83
|
-
* The discovery loop (dynamic import, dedupe, register / unregister
|
|
84
|
-
* bridge) lives in `@usebutr/wallet-standard-shared`.
|
|
85
63
|
*/
|
|
86
64
|
declare const discoverSuiAdapters: (onAdapter: (adapter: WalletAdapter) => void) => (() => void);
|
|
87
65
|
//#endregion
|
|
@@ -125,15 +103,9 @@ type WalletStandardCapabilityInput = {
|
|
|
125
103
|
};
|
|
126
104
|
};
|
|
127
105
|
/**
|
|
128
|
-
* Sui Wallet Standard
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
* - `sendTransaction = sui:signAndExecuteTransaction present`. The wallet
|
|
132
|
-
* broadcasts; consumers receive the digest.
|
|
133
|
-
* - `signTransaction = sui:signTransaction present`. Sign-only; consumers
|
|
134
|
-
* broadcast with their own RPC client (`@mysten/sui`'s SuiClient).
|
|
135
|
-
* - `signMessage = sui:signPersonalMessage present`.
|
|
136
|
-
* - `signIn = false`. Sui has no SIWS-equivalent feature in Wallet Standard.
|
|
106
|
+
* `signIn` is false: Sui Wallet Standard has no Sign-In-With-Sui feature.
|
|
107
|
+
* `signAndExecuteTransaction` means the wallet broadcasts, while
|
|
108
|
+
* `signTransaction` is sign-only and leaves the broadcast to the consumer.
|
|
137
109
|
*/
|
|
138
110
|
declare const resolveSuiCapabilities: (input: WalletStandardCapabilityInput) => WalletCapabilities;
|
|
139
111
|
//#endregion
|
|
@@ -146,10 +118,8 @@ declare const suiDiscoverer: PlatformDiscoverer;
|
|
|
146
118
|
//#endregion
|
|
147
119
|
//#region src/signer-augmentation.d.ts
|
|
148
120
|
/**
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
* object, which consumers narrow further via its `features` map (e.g.
|
|
152
|
-
* `wallet.features["sui:signAndExecuteTransaction"]`).
|
|
121
|
+
* Sui's `getSigner()` hands back the Wallet Standard wallet, which consumers
|
|
122
|
+
* narrow through its `features` map.
|
|
153
123
|
*/
|
|
154
124
|
declare module "@usebutr/core" {
|
|
155
125
|
interface SignerForPlatform {
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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":";;;
|
|
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
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
import { base64ToBytes } from "@usebutr/core";
|
|
1
|
+
import { base64ToBytes, bytesToBase64 } from "@usebutr/core";
|
|
2
2
|
import { buildWalletCapabilities, createWalletStandardCore, discoverWalletStandard, getFeature, slugify } from "@usebutr/wallet-standard-shared";
|
|
3
3
|
|
|
4
4
|
//#region src/capabilities.ts
|
|
5
5
|
/**
|
|
6
|
-
* Sui Wallet Standard
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* - `sendTransaction = sui:signAndExecuteTransaction present`. The wallet
|
|
10
|
-
* broadcasts; consumers receive the digest.
|
|
11
|
-
* - `signTransaction = sui:signTransaction present`. Sign-only; consumers
|
|
12
|
-
* broadcast with their own RPC client (`@mysten/sui`'s SuiClient).
|
|
13
|
-
* - `signMessage = sui:signPersonalMessage present`.
|
|
14
|
-
* - `signIn = false`. Sui has no SIWS-equivalent feature in Wallet Standard.
|
|
6
|
+
* `signIn` is false: Sui Wallet Standard has no Sign-In-With-Sui feature.
|
|
7
|
+
* `signAndExecuteTransaction` means the wallet broadcasts, while
|
|
8
|
+
* `signTransaction` is sign-only and leaves the broadcast to the consumer.
|
|
15
9
|
*/
|
|
16
10
|
const resolveSuiCapabilities = (input) => buildWalletCapabilities({
|
|
17
11
|
chainCount: input.chainCount,
|
|
@@ -27,33 +21,26 @@ const resolveSuiCapabilities = (input) => buildWalletCapabilities({
|
|
|
27
21
|
const SUI_PREFIX = "sui:";
|
|
28
22
|
const SUI_DECIMALS = 9;
|
|
29
23
|
const SUI_MAINNET = "sui:mainnet";
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
*
|
|
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";
|
|
27
|
+
/** Coerce butr's `unknown` tx into the shape the Sui Wallet Standard features
|
|
28
|
+
* expect: an object with `toJSON()` returning a Promise<string>. A raw string
|
|
29
|
+
* or BCS byte array is wrapped, because wallets accept only the `toJSON()`
|
|
30
|
+
* form and a bare string reaches them as a shape they cannot consume. */
|
|
35
31
|
const coerceSuiTransaction = (tx) => {
|
|
36
|
-
if (typeof tx === "string") return tx;
|
|
37
|
-
if (
|
|
38
|
-
|
|
32
|
+
if (typeof tx === "string") return { toJSON: () => Promise.resolve(tx) };
|
|
33
|
+
if (tx instanceof Uint8Array) {
|
|
34
|
+
const encoded = bytesToBase64(tx);
|
|
35
|
+
return { toJSON: () => Promise.resolve(encoded) };
|
|
36
|
+
}
|
|
37
|
+
if (typeof tx === "object" && tx !== null && "toJSON" in tx && typeof tx.toJSON === "function") return { toJSON: tx.toJSON };
|
|
38
|
+
throw new TypeError("Sui sendTx/signTransaction expects a @mysten/sui Transaction (with toJSON()), a base64-encoded string, or BCS bytes");
|
|
39
39
|
};
|
|
40
40
|
/**
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* expose `standard:connect`. Same posture as `buildSvmAdapter`: gate
|
|
45
|
-
* features on what each wallet advertises, return placeholders for
|
|
46
|
-
* RPC-backed reads (`getBalance`, `getTransactionReceipt`), forward
|
|
47
|
-
* `subscribe` through `standard:events`.
|
|
48
|
-
*
|
|
49
|
-
* **Known limitations**
|
|
50
|
-
*
|
|
51
|
-
* - `getBalance` returns a `{ value: 0n, symbol: "SUI" }` placeholder.
|
|
52
|
-
* Consumers wrap `@mysten/sui`'s `SuiClient` for real reads.
|
|
53
|
-
* - `getTransactionReceipt` returns `"Pending"` for the same reason.
|
|
54
|
-
* - `switchChain` is local-state-only (mirrors SVM). Sui Wallet Standard
|
|
55
|
-
* has no "tell the wallet to switch network" RPC; the wallet's UI
|
|
56
|
-
* controls its global cluster setting.
|
|
41
|
+
* Sui Wallet Standard has no "switch network" RPC, so `switchChain` moves
|
|
42
|
+
* butr's view only and the wallet's own UI owns its cluster. Balance and
|
|
43
|
+
* receipt reads need `@mysten/sui`'s `SuiClient`, which butr doesn't ship.
|
|
57
44
|
*/
|
|
58
45
|
const buildSuiAdapter = (wallet, registerDisconnector) => {
|
|
59
46
|
const core = createWalletStandardCore({
|
|
@@ -68,20 +55,27 @@ const buildSuiAdapter = (wallet, registerDisconnector) => {
|
|
|
68
55
|
wallet
|
|
69
56
|
});
|
|
70
57
|
if (core === null) return null;
|
|
71
|
-
const signMessage = getFeature(wallet, "sui:signPersonalMessage");
|
|
72
|
-
const signAndExecute = getFeature(wallet, "sui:signAndExecuteTransaction");
|
|
73
|
-
const signTx = getFeature(wallet, "sui:signTransaction");
|
|
74
|
-
|
|
58
|
+
const signMessage = getFeature(wallet, "sui:signPersonalMessage", isSuiSignPersonalMessageFeature);
|
|
59
|
+
const signAndExecute = getFeature(wallet, "sui:signAndExecuteTransaction", isSuiSignAndExecuteTransactionFeature);
|
|
60
|
+
const signTx = getFeature(wallet, "sui:signTransaction", isSuiSignTransactionFeature);
|
|
61
|
+
/** Resolve a caller-supplied target into a chain the wallet advertises,
|
|
62
|
+
* accepting either a full CAIP-2 id (`sui:testnet`) or a bare reference. */
|
|
63
|
+
const resolveTargetChain = (targetChainId) => {
|
|
64
|
+
const candidate = targetChainId.startsWith(SUI_PREFIX) ? targetChainId : `${SUI_PREFIX}${targetChainId}`;
|
|
65
|
+
if (!wallet.chains.includes(candidate)) throw new Error(`Wallet ${wallet.name} does not advertise chain "${candidate}". Available: ${wallet.chains.join(", ")}`);
|
|
66
|
+
return candidate;
|
|
67
|
+
};
|
|
68
|
+
const executeTx = async (tx, account, chain) => {
|
|
75
69
|
if (signAndExecute === void 0) throw new Error(`Wallet ${wallet.name} does not advertise sui:signAndExecuteTransaction`);
|
|
76
70
|
const wsAccount = core.resolveAccount(account);
|
|
77
71
|
const transaction = coerceSuiTransaction(tx);
|
|
78
72
|
return (await signAndExecute.signAndExecuteTransaction({
|
|
79
73
|
account: wsAccount,
|
|
80
|
-
chain: core.currentChainId(),
|
|
74
|
+
chain: chain ?? core.currentChainId(),
|
|
81
75
|
transaction
|
|
82
76
|
})).digest;
|
|
83
77
|
};
|
|
84
|
-
|
|
78
|
+
const adapter = {
|
|
85
79
|
...core,
|
|
86
80
|
capabilities: resolveSuiCapabilities({
|
|
87
81
|
chainCount: core.chainCount,
|
|
@@ -104,9 +98,10 @@ const buildSuiAdapter = (wallet, registerDisconnector) => {
|
|
|
104
98
|
await core.connect();
|
|
105
99
|
},
|
|
106
100
|
sendTx: (tx, account) => executeTx(tx, account),
|
|
107
|
-
sendTxToChain
|
|
108
|
-
|
|
109
|
-
|
|
101
|
+
async sendTxToChain(tx, targetChainId, account, cb) {
|
|
102
|
+
const target = resolveTargetChain(targetChainId);
|
|
103
|
+
if (target !== core.currentChainId()) cb?.();
|
|
104
|
+
return await executeTx(tx, account, target);
|
|
110
105
|
},
|
|
111
106
|
async signMessage(msg, account) {
|
|
112
107
|
if (signMessage === void 0) throw new Error(`Wallet ${wallet.name} does not advertise sui:signPersonalMessage`);
|
|
@@ -118,34 +113,26 @@ const buildSuiAdapter = (wallet, registerDisconnector) => {
|
|
|
118
113
|
signature: base64ToBytes(output.signature),
|
|
119
114
|
signedMessage: base64ToBytes(output.bytes)
|
|
120
115
|
};
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
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
|
+
};
|
|
132
130
|
};
|
|
131
|
+
return adapter;
|
|
133
132
|
};
|
|
134
133
|
/**
|
|
135
|
-
*
|
|
134
|
+
* Requires the optional `@wallet-standard/app` peer dep.
|
|
136
135
|
* Spec: https://docs.sui.io/standards/wallet-standard
|
|
137
|
-
*
|
|
138
|
-
* Runtime requires the `@wallet-standard/app` package, which is an
|
|
139
|
-
* **optional peer dependency** of butr.
|
|
140
|
-
*
|
|
141
|
-
* Sui wallets share the same `getWallets()` bus as SVM wallets; Phantom
|
|
142
|
-
* advertises features for SVM, Sui, and Bitcoin from a single Wallet
|
|
143
|
-
* Standard wallet object. `buildSuiAdapter` returns `null` for wallets
|
|
144
|
-
* that don't advertise any `sui:*` features, so we cleanly end up with
|
|
145
|
-
* one adapter per platform on multi-chain wallets.
|
|
146
|
-
*
|
|
147
|
-
* The discovery loop (dynamic import, dedupe, register / unregister
|
|
148
|
-
* bridge) lives in `@usebutr/wallet-standard-shared`.
|
|
149
136
|
*/
|
|
150
137
|
const discoverSuiAdapters = (onAdapter) => discoverWalletStandard(onAdapter, (wallet, registerDisconnector) => buildSuiAdapter(wallet, registerDisconnector));
|
|
151
138
|
|
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 * Sui Wallet Standard feature → butr capability mapping. The flags that hold\n * for every namespace are documented on `buildWalletCapabilities`.\n *\n * - `sendTransaction = sui:signAndExecuteTransaction present`. The wallet\n * broadcasts; consumers receive the digest.\n * - `signTransaction = sui:signTransaction present`. Sign-only; consumers\n * broadcast with their own RPC client (`@mysten/sui`'s SuiClient).\n * - `signMessage = sui:signPersonalMessage present`.\n * - `signIn = false`. Sui has no SIWS-equivalent feature in Wallet Standard.\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 } 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 `sui:signAndExecuteTransaction`\n * expects (an object with `toJSON()` returning a Promise<string>). When\n * consumers pass a base64 string directly, we wrap it in a stub object so\n * the feature contract stays satisfied without us depending on\n * `@mysten/sui`. */\nconst coerceSuiTransaction = (tx: unknown): { toJSON: () => Promise<string> } | string => {\n if (typeof tx === \"string\") {\n return tx;\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()) or a base64-encoded string\",\n );\n};\n\n/**\n * Adapt a Sui Wallet Standard `Wallet` into a butr `WalletAdapter`.\n *\n * Returns `null` if the wallet doesn't advertise any Sui chain or doesn't\n * expose `standard:connect`. Same posture as `buildSvmAdapter`: gate\n * features on what each wallet advertises, return placeholders for\n * RPC-backed reads (`getBalance`, `getTransactionReceipt`), forward\n * `subscribe` through `standard:events`.\n *\n * **Known limitations**\n *\n * - `getBalance` returns a `{ value: 0n, symbol: \"SUI\" }` placeholder.\n * Consumers wrap `@mysten/sui`'s `SuiClient` for real reads.\n * - `getTransactionReceipt` returns `\"Pending\"` for the same reason.\n * - `switchChain` is local-state-only (mirrors SVM). Sui Wallet Standard\n * has no \"tell the wallet to switch network\" RPC; the wallet's UI\n * controls its global cluster setting.\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 const executeTx = async (tx: unknown, account?: { walletAddress: string }): 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: 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 sendTxToChain: (tx, _targetChainId, account, cb) => {\n cb?.();\n return executeTx(tx, account);\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 base64ToBytes(output.bytes);\n },\n }),\n };\n};\n\n/**\n * Subscribe to Sui Wallet Standard announcements.\n * Spec: https://docs.sui.io/standards/wallet-standard\n *\n * Runtime requires the `@wallet-standard/app` package, which is an\n * **optional peer dependency** of butr.\n *\n * Sui wallets share the same `getWallets()` bus as SVM wallets; Phantom\n * advertises features for SVM, Sui, and Bitcoin from a single Wallet\n * Standard wallet object. `buildSuiAdapter` returns `null` for wallets\n * that don't advertise any `sui:*` features, so we cleanly end up with\n * one adapter per platform on multi-chain wallets.\n *\n * The discovery loop (dynamic import, dedupe, register / unregister\n * bridge) lives in `@usebutr/wallet-standard-shared`.\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\n// Sui wallets follow the Wallet Standard convention of advertising\n// chains as `sui:mainnet` / `sui:testnet` / `sui:devnet` / `sui:localnet`\n// rather than the strict CAIP-2 form (the genesis-checkpoint hash).\n// Sui Wallet, Suiet, Phantom (Sui), and Surf all exchange these short\n// names; the adapter's `switchChain` rejects anything else.\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":"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"}
|
|
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":"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"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@usebutr/sui",
|
|
3
|
-
"version": "
|
|
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": "
|
|
29
|
-
"@usebutr/wallet-standard-shared": "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": "^
|
|
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"
|
|
@@ -47,7 +62,6 @@
|
|
|
47
62
|
"build": "tsdown",
|
|
48
63
|
"clean": "rm -rf dist",
|
|
49
64
|
"dev": "tsdown --watch",
|
|
50
|
-
"lint": "oxlint src",
|
|
51
65
|
"test": "vitest run --passWithNoTests",
|
|
52
66
|
"test:coverage": "vitest run --coverage --passWithNoTests",
|
|
53
67
|
"typecheck": "tsc -p tsconfig.json --noEmit"
|