@mysten/docs 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -0
- package/dist/bcs/index.md +358 -0
- package/dist/bcs/llms-index.md +4 -0
- package/dist/codegen/index.md +441 -0
- package/dist/codegen/llms-index.md +4 -0
- package/dist/dapp-kit/actions/connect-wallet.md +69 -0
- package/dist/dapp-kit/actions/disconnect-wallet.md +38 -0
- package/dist/dapp-kit/actions/sign-and-execute-transaction.md +96 -0
- package/dist/dapp-kit/actions/sign-personal-message.md +58 -0
- package/dist/dapp-kit/actions/sign-transaction.md +65 -0
- package/dist/dapp-kit/actions/switch-account.md +37 -0
- package/dist/dapp-kit/actions/switch-network.md +37 -0
- package/dist/dapp-kit/dapp-kit-instance.md +162 -0
- package/dist/dapp-kit/getting-started/create-dapp.md +151 -0
- package/dist/dapp-kit/getting-started/next-js.md +162 -0
- package/dist/dapp-kit/getting-started/react.md +172 -0
- package/dist/dapp-kit/getting-started/vue.md +193 -0
- package/dist/dapp-kit/index.md +70 -0
- package/dist/dapp-kit/llms-index.md +26 -0
- package/dist/dapp-kit/react/components/connect-button.md +42 -0
- package/dist/dapp-kit/react/components/connect-modal.md +51 -0
- package/dist/dapp-kit/react/components/index.md +13 -0
- package/dist/dapp-kit/react/dapp-kit-provider.md +86 -0
- package/dist/dapp-kit/react/hooks/index.md +25 -0
- package/dist/dapp-kit/react/hooks/use-current-account.md +33 -0
- package/dist/dapp-kit/react/hooks/use-current-client.md +36 -0
- package/dist/dapp-kit/react/hooks/use-current-network.md +28 -0
- package/dist/dapp-kit/react/hooks/use-current-wallet.md +36 -0
- package/dist/dapp-kit/react/hooks/use-dapp-kit.md +100 -0
- package/dist/dapp-kit/react/hooks/use-wallet-connection.md +48 -0
- package/dist/dapp-kit/react/hooks/use-wallets.md +33 -0
- package/dist/dapp-kit/state.md +169 -0
- package/dist/dapp-kit/theming.md +196 -0
- package/dist/dapp-kit/web-components/connect-button.md +89 -0
- package/dist/dapp-kit/web-components/connect-modal.md +177 -0
- package/dist/kiosk/advanced-examples.md +101 -0
- package/dist/kiosk/from-v1.md +320 -0
- package/dist/kiosk/index.md +22 -0
- package/dist/kiosk/kiosk-client/introduction.md +52 -0
- package/dist/kiosk/kiosk-client/kiosk-transaction/examples.md +119 -0
- package/dist/kiosk/kiosk-client/kiosk-transaction/kiosk-transaction.md +103 -0
- package/dist/kiosk/kiosk-client/kiosk-transaction/managing.md +235 -0
- package/dist/kiosk/kiosk-client/kiosk-transaction/purchasing.md +110 -0
- package/dist/kiosk/kiosk-client/querying.md +237 -0
- package/dist/kiosk/kiosk-client/transfer-policy-transaction/introduction.md +79 -0
- package/dist/kiosk/kiosk-client/transfer-policy-transaction/using-the-manager.md +115 -0
- package/dist/kiosk/llms-index.md +8 -0
- package/dist/llms-index.md +125 -0
- package/dist/payment-kit/getting-started.md +256 -0
- package/dist/payment-kit/index.md +132 -0
- package/dist/payment-kit/llms-index.md +8 -0
- package/dist/payment-kit/payment-kit-sdk.md +747 -0
- package/dist/payment-kit/payment-processing.md +372 -0
- package/dist/payment-kit/registry-management.md +529 -0
- package/dist/seal/index.md +85 -0
- package/dist/seal/llms-index.md +4 -0
- package/dist/slush-wallet/dapp.md +95 -0
- package/dist/slush-wallet/deep-linking.md +465 -0
- package/dist/slush-wallet/index.md +7 -0
- package/dist/slush-wallet/llms-index.md +6 -0
- package/dist/sui/bcs.md +134 -0
- package/dist/sui/clients/core.md +606 -0
- package/dist/sui/clients/graphql.md +101 -0
- package/dist/sui/clients/grpc.md +155 -0
- package/dist/sui/clients/index.md +95 -0
- package/dist/sui/clients/json-rpc.md +239 -0
- package/dist/sui/cryptography/keypairs.md +267 -0
- package/dist/sui/cryptography/multisig.md +194 -0
- package/dist/sui/cryptography/passkey.md +111 -0
- package/dist/sui/cryptography/webcrypto-signer.md +81 -0
- package/dist/sui/executors.md +148 -0
- package/dist/sui/faucet.md +26 -0
- package/dist/sui/hello-sui.md +115 -0
- package/dist/sui/index.md +53 -0
- package/dist/sui/install.md +61 -0
- package/dist/sui/llm-docs.md +32 -0
- package/dist/sui/llms-index.md +44 -0
- package/dist/sui/migrations/0.38.md +58 -0
- package/dist/sui/migrations/sui-1.0.md +455 -0
- package/dist/sui/migrations/sui-2.0/agent-prompt.md +42 -0
- package/dist/sui/migrations/sui-2.0/dapp-kit.md +350 -0
- package/dist/sui/migrations/sui-2.0/deepbook-v3.md +33 -0
- package/dist/sui/migrations/sui-2.0/index.md +158 -0
- package/dist/sui/migrations/sui-2.0/json-rpc-migration.md +386 -0
- package/dist/sui/migrations/sui-2.0/kiosk.md +120 -0
- package/dist/sui/migrations/sui-2.0/sdk-maintainers.md +90 -0
- package/dist/sui/migrations/sui-2.0/seal.md +14 -0
- package/dist/sui/migrations/sui-2.0/sui.md +341 -0
- package/dist/sui/migrations/sui-2.0/suins.md +43 -0
- package/dist/sui/migrations/sui-2.0/wallet-builders.md +66 -0
- package/dist/sui/migrations/sui-2.0/walrus.md +41 -0
- package/dist/sui/migrations/sui-2.0/zksend.md +95 -0
- package/dist/sui/plugins.md +258 -0
- package/dist/sui/sdk-building.md +344 -0
- package/dist/sui/transaction-building/basics.md +299 -0
- package/dist/sui/transaction-building/gas.md +62 -0
- package/dist/sui/transaction-building/intents.md +62 -0
- package/dist/sui/transaction-building/offline.md +73 -0
- package/dist/sui/transaction-building/sponsored-transactions.md +22 -0
- package/dist/sui/utils/derived_objects.md +59 -0
- package/dist/sui/utils/index.md +52 -0
- package/dist/sui/zklogin.md +83 -0
- package/dist/walrus/index.md +527 -0
- package/dist/walrus/llms-index.md +4 -0
- package/dist/zksend/index.md +27 -0
- package/dist/zksend/link-builder.md +192 -0
- package/dist/zksend/llms-index.md +5 -0
- package/package.json +66 -0
|
@@ -0,0 +1,465 @@
|
|
|
1
|
+
# Deep Linking
|
|
2
|
+
|
|
3
|
+
> Deep linking configuration for Slush Wallet
|
|
4
|
+
|
|
5
|
+
Deep linking allows external applications, websites, and services to open Slush directly to specific
|
|
6
|
+
screens or trigger specific actions. This enables seamless integrations where users can be directed
|
|
7
|
+
into the wallet to perform actions like swapping tokens, claiming assets, or browsing dApps.
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
Slush supports two types of deep linking:
|
|
12
|
+
|
|
13
|
+
1. **Custom URL Schemes** - Direct links using `slush://` (mobile app only)
|
|
14
|
+
2. **Universal Links & App Links** - HTTPS links that work across mobile and desktop
|
|
15
|
+
|
|
16
|
+
> **Note:** For most integrations, use `my.slush.app` HTTPS links. They work on iOS, Android, and desktop
|
|
17
|
+
> browsers, opening the native app when installed or falling back to the web app.
|
|
18
|
+
|
|
19
|
+
> **Warning:** Deep linking is not currently supported for the Slush browser extension.
|
|
20
|
+
|
|
21
|
+
> **Warning:** Always URL-encode parameter values, especially token type addresses which contain special
|
|
22
|
+
> characters like colons (`:`). See [URL Encode Parameters](#url-encode-parameters) for examples.
|
|
23
|
+
|
|
24
|
+
## URL Schemes
|
|
25
|
+
|
|
26
|
+
Slush registers a custom URL scheme:
|
|
27
|
+
|
|
28
|
+
| Scheme | Description |
|
|
29
|
+
| ---------- | ----------------------------------- |
|
|
30
|
+
| `slush://` | Primary scheme for the Slush wallet |
|
|
31
|
+
|
|
32
|
+
### Basic Format
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
slush://<path>?<parameters>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Examples
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
slush://swap?fromCoinType=0x2::sui::SUI
|
|
42
|
+
slush://browse/https://app.example.com
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Universal Links & App Links
|
|
46
|
+
|
|
47
|
+
Slush responds to HTTPS links (Universal Links on iOS, App Links on Android) from the following
|
|
48
|
+
domains:
|
|
49
|
+
|
|
50
|
+
| Domain | Supported Paths |
|
|
51
|
+
| -------------- | -------------------------------------------- |
|
|
52
|
+
| `my.slush.app` | `/browse/*`, `/claim/*`, `/swap/*`, `/pay/*` |
|
|
53
|
+
|
|
54
|
+
### Cross-Platform Behavior
|
|
55
|
+
|
|
56
|
+
The `my.slush.app` domain is recommended because it works across all platforms:
|
|
57
|
+
|
|
58
|
+
| Environment | Behavior |
|
|
59
|
+
| -------------------------- | -------------------------------------------------- |
|
|
60
|
+
| Mobile (app installed) | Opens directly in the Slush native app |
|
|
61
|
+
| Mobile (app not installed) | Opens in the mobile browser with the Slush web app |
|
|
62
|
+
| Desktop browser | Opens the Slush web app |
|
|
63
|
+
|
|
64
|
+
> **Note:** Unlike custom URL schemes (`slush://`), `my.slush.app` links never fail - they always open either
|
|
65
|
+
> the native app or the web app, ensuring users can complete their intended action.
|
|
66
|
+
|
|
67
|
+
### Examples
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
# Opens dApp browser - works on mobile and desktop
|
|
71
|
+
https://my.slush.app/browse/https://app.turbos.finance
|
|
72
|
+
|
|
73
|
+
# Opens claim flow - works on mobile and desktop
|
|
74
|
+
https://my.slush.app/claim?claimUrl=abc123xyz
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Supported Routes
|
|
78
|
+
|
|
79
|
+
### dApp Browser
|
|
80
|
+
|
|
81
|
+
Open the in-app browser to load a specific URL:
|
|
82
|
+
|
|
83
|
+
| Route | Description |
|
|
84
|
+
| ------------- | ------------------------------- |
|
|
85
|
+
| `browse/:url` | Opens a URL in the dApp browser |
|
|
86
|
+
|
|
87
|
+
**Parameters:**
|
|
88
|
+
|
|
89
|
+
| Parameter | Type | Required | Description |
|
|
90
|
+
| --------- | ------ | -------- | ------------------------------- |
|
|
91
|
+
| `url` | string | Yes | Full URL to load in the browser |
|
|
92
|
+
|
|
93
|
+
**Examples:**
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
slush://browse/https://app.turbos.finance
|
|
97
|
+
https://my.slush.app/browse/https://app.cetus.zone
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
> The URL must be a complete, valid URL including the protocol (e.g., `https://`).
|
|
101
|
+
|
|
102
|
+
### Token Swap
|
|
103
|
+
|
|
104
|
+
Open the token swap screen with optional pre-filled values:
|
|
105
|
+
|
|
106
|
+
| Route | Description |
|
|
107
|
+
| ------ | ------------------------ |
|
|
108
|
+
| `swap` | Opens the swap interface |
|
|
109
|
+
|
|
110
|
+
**Parameters:**
|
|
111
|
+
|
|
112
|
+
| Parameter | Type | Required | Description |
|
|
113
|
+
| -------------- | ------ | -------- | ------------------------------------------- |
|
|
114
|
+
| `fromCoinType` | string | No | Source token type address (defaults to SUI) |
|
|
115
|
+
| `toCoinType` | string | No | Destination token type address |
|
|
116
|
+
| `presetAmount` | string | No | Pre-filled amount to swap |
|
|
117
|
+
|
|
118
|
+
**Examples:**
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
# Open swap with SUI as source
|
|
122
|
+
slush://swap
|
|
123
|
+
|
|
124
|
+
# Pre-fill swap from SUI to USDC
|
|
125
|
+
slush://swap?fromCoinType=0x2::sui::SUI&toCoinType=0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC
|
|
126
|
+
|
|
127
|
+
# Pre-fill swap amount
|
|
128
|
+
slush://swap?fromCoinType=0x2::sui::SUI&presetAmount=100
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Claim Assets
|
|
132
|
+
|
|
133
|
+
Open the claim screen to receive stashed or gifted tokens:
|
|
134
|
+
|
|
135
|
+
| Route | Description |
|
|
136
|
+
| ------- | ------------------------- |
|
|
137
|
+
| `claim` | Opens the claim interface |
|
|
138
|
+
|
|
139
|
+
**Parameters:**
|
|
140
|
+
|
|
141
|
+
| Parameter | Type | Required | Description |
|
|
142
|
+
| ---------- | ------ | -------- | ---------------------------------------- |
|
|
143
|
+
| `claimUrl` | string | Yes | Full claim URL from zkSend or Getstashed |
|
|
144
|
+
|
|
145
|
+
**Examples:**
|
|
146
|
+
|
|
147
|
+
```
|
|
148
|
+
slush://claim?claimUrl=https://zksend.com/claim/abc123xyz
|
|
149
|
+
slush://claim?claimUrl=https://getstashed.com/claim/def456
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Token Details
|
|
153
|
+
|
|
154
|
+
View details for a specific token:
|
|
155
|
+
|
|
156
|
+
| Route | Description |
|
|
157
|
+
| -------- | ----------------------- |
|
|
158
|
+
| `tokens` | Opens token detail view |
|
|
159
|
+
|
|
160
|
+
**Parameters:**
|
|
161
|
+
|
|
162
|
+
| Parameter | Type | Required | Description |
|
|
163
|
+
| ---------- | ------ | -------- | ---------------------------------- |
|
|
164
|
+
| `coinType` | string | Yes | Full token type address to display |
|
|
165
|
+
|
|
166
|
+
**Examples:**
|
|
167
|
+
|
|
168
|
+
```
|
|
169
|
+
# View SUI token details
|
|
170
|
+
slush://tokens?coinType=0x2::sui::SUI
|
|
171
|
+
|
|
172
|
+
# View USDC token details
|
|
173
|
+
slush://tokens?coinType=0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Receive / QR Code
|
|
177
|
+
|
|
178
|
+
Open the receive screen to display the wallet address or scan a QR code:
|
|
179
|
+
|
|
180
|
+
| Route | Description |
|
|
181
|
+
| ------- | ---------------------------------- |
|
|
182
|
+
| `suime` | Opens receive or QR scanner screen |
|
|
183
|
+
|
|
184
|
+
**Parameters:**
|
|
185
|
+
|
|
186
|
+
| Parameter | Type | Required | Description |
|
|
187
|
+
| --------- | ------ | -------- | ---------------------------------- |
|
|
188
|
+
| `action` | string | Yes | Either `RECEIVE` or `SCAN_QR_CODE` |
|
|
189
|
+
|
|
190
|
+
**Examples:**
|
|
191
|
+
|
|
192
|
+
```
|
|
193
|
+
# Show receive QR code
|
|
194
|
+
slush://suime?action=RECEIVE
|
|
195
|
+
|
|
196
|
+
# Open QR code scanner
|
|
197
|
+
slush://suime?action=SCAN_QR_CODE
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### DeFi Strategies
|
|
201
|
+
|
|
202
|
+
Access yield strategies and DeFi opportunities:
|
|
203
|
+
|
|
204
|
+
| Route | Description |
|
|
205
|
+
| ------------------------- | ----------------------------------- |
|
|
206
|
+
| `strategies` | View all available strategies |
|
|
207
|
+
| `strategies/strategy/:id` | View details of a specific strategy |
|
|
208
|
+
| `strategies/deposit/:id` | Open deposit flow for a strategy |
|
|
209
|
+
| `strategies/withdraw/:id` | Open withdraw flow for a strategy |
|
|
210
|
+
|
|
211
|
+
**Path Parameters:**
|
|
212
|
+
|
|
213
|
+
| Parameter | Type | Required | Description |
|
|
214
|
+
| --------- | ------ | -------- | ------------------- |
|
|
215
|
+
| `id` | string | Yes | Strategy identifier |
|
|
216
|
+
|
|
217
|
+
**Examples:**
|
|
218
|
+
|
|
219
|
+
```
|
|
220
|
+
# View all strategies
|
|
221
|
+
slush://strategies
|
|
222
|
+
|
|
223
|
+
# View specific strategy details
|
|
224
|
+
slush://strategies/strategy/lending-usdc
|
|
225
|
+
|
|
226
|
+
# Deposit into a strategy
|
|
227
|
+
slush://strategies/deposit/lending-usdc
|
|
228
|
+
|
|
229
|
+
# Withdraw from a strategy
|
|
230
|
+
slush://strategies/withdraw/lending-usdc
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### Staking
|
|
234
|
+
|
|
235
|
+
Access native and liquid staking features:
|
|
236
|
+
|
|
237
|
+
| Route | Description |
|
|
238
|
+
| ------------------------ | ---------------------- |
|
|
239
|
+
| `staking` | Staking overview |
|
|
240
|
+
| `staking/native-stake` | Native SUI staking |
|
|
241
|
+
| `staking/native-unstake` | Unstake native SUI |
|
|
242
|
+
| `staking/liquid-stake` | Liquid staking |
|
|
243
|
+
| `staking/liquid-unstake` | Unstake liquid staking |
|
|
244
|
+
|
|
245
|
+
**Examples:**
|
|
246
|
+
|
|
247
|
+
```
|
|
248
|
+
slush://staking
|
|
249
|
+
slush://staking/native-stake
|
|
250
|
+
slush://staking/liquid-stake
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
### Send Tokens
|
|
254
|
+
|
|
255
|
+
Access the send flow:
|
|
256
|
+
|
|
257
|
+
| Route | Description |
|
|
258
|
+
| ------------------- | ------------------------ |
|
|
259
|
+
| `send-coins` | Open send flow |
|
|
260
|
+
| `send-coins/send` | Send input screen |
|
|
261
|
+
| `send-coins/camera` | QR scanner for recipient |
|
|
262
|
+
| `send-coins/review` | Review transaction |
|
|
263
|
+
|
|
264
|
+
**Examples:**
|
|
265
|
+
|
|
266
|
+
```
|
|
267
|
+
slush://send-coins
|
|
268
|
+
slush://send-coins/camera
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
### Payment Kit
|
|
272
|
+
|
|
273
|
+
Open the payment flow using Payment Kit URIs. Slush supports the `sui:pay` protocol for processing
|
|
274
|
+
on-chain payments with optional registry support.
|
|
275
|
+
|
|
276
|
+
| Route | Description |
|
|
277
|
+
| ----- | --------------------------- |
|
|
278
|
+
| `pay` | Opens the payment interface |
|
|
279
|
+
|
|
280
|
+
**URI Format:**
|
|
281
|
+
|
|
282
|
+
Payment Kit uses a special `sui:pay` (`slush:pay` is also supported) protocol that can be opened via
|
|
283
|
+
Slush deep links:
|
|
284
|
+
|
|
285
|
+
```
|
|
286
|
+
https://my.slush.app/pay?receiver=<address>&amount=<amount>&coinType=<coinType>&nonce=<nonce>
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
**Parameters:**
|
|
290
|
+
|
|
291
|
+
| Parameter | Type | Required | Description |
|
|
292
|
+
| ---------- | ------ | -------- | ------------------------------------------------------ |
|
|
293
|
+
| `receiver` | string | Yes | Recipient Sui address |
|
|
294
|
+
| `amount` | string | Yes | Payment amount in smallest unit (e.g., MIST for SUI) |
|
|
295
|
+
| `coinType` | string | Yes | Coin type (e.g., `0x2::sui::SUI`) |
|
|
296
|
+
| `nonce` | string | Yes | Unique payment identifier (max 36 characters) |
|
|
297
|
+
| `registry` | string | No | Registry name or object ID for registry-based payments |
|
|
298
|
+
| `label` | string | No | Human-readable label for the payment |
|
|
299
|
+
| `message` | string | No | Message or memo for the payment |
|
|
300
|
+
| `iconUrl` | string | No | URL to an icon image for display purposes |
|
|
301
|
+
|
|
302
|
+
**Examples:**
|
|
303
|
+
|
|
304
|
+
```
|
|
305
|
+
# Basic payment with SUI (using custom scheme)
|
|
306
|
+
sui:pay?receiver=0x1234...abcd&amount=1000000000&coinType=0x2::sui::SUI&nonce=abc-123-xyz
|
|
307
|
+
|
|
308
|
+
# Basic payment with SUI (using universal link)
|
|
309
|
+
https://my.slush.app/pay?receiver=0x1234...abcd&amount=1000000000&coinType=0x2::sui::SUI&nonce=abc-123-xyz
|
|
310
|
+
|
|
311
|
+
# Payment with registry and label
|
|
312
|
+
https://my.slush.app/pay?receiver=0x1234...abcd&amount=1000000000&coinType=0x2::sui::SUI&nonce=abc-123-xyz®istry=my-registry&label=Coffee%20Payment
|
|
313
|
+
|
|
314
|
+
# Payment with custom coin type
|
|
315
|
+
https://my.slush.app/pay?receiver=0x1234...abcd&amount=5000000&coinType=0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC&nonce=def-456-uvw
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
> Use the `@mysten/payment-kit` SDK to generate properly formatted payment URIs. See the [Payment
|
|
319
|
+
> Kit documentation](/payment-kit/getting-started) for more details.
|
|
320
|
+
|
|
321
|
+
## Implementation Examples
|
|
322
|
+
|
|
323
|
+
### Web Integration
|
|
324
|
+
|
|
325
|
+
Link to Slush from any web page (mobile or desktop):
|
|
326
|
+
|
|
327
|
+
```html
|
|
328
|
+
<!-- Recommended: Works on all platforms -->
|
|
329
|
+
<a href="https://my.slush.app/browse/https://your-dapp.com">Open in Slush</a>
|
|
330
|
+
|
|
331
|
+
<!-- Mobile-only: Opens app if installed, fails otherwise -->
|
|
332
|
+
<a href="slush://swap">Open Slush to Swap</a>
|
|
333
|
+
<a href="slush://browse/https://your-dapp.com">Open in Slush</a>
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
### JavaScript / React Native
|
|
337
|
+
|
|
338
|
+
Open Slush programmatically:
|
|
339
|
+
|
|
340
|
+
```javascript
|
|
341
|
+
|
|
342
|
+
// Recommended: Use my.slush.app links (works everywhere)
|
|
343
|
+
Linking.openURL('https://my.slush.app/browse/https://your-dapp.com');
|
|
344
|
+
|
|
345
|
+
// Alternative: Use custom schemes when you need app-specific behavior
|
|
346
|
+
Linking.openURL('slush://swap?fromCoinType=0x2::sui::SUI');
|
|
347
|
+
|
|
348
|
+
// Detect if native app is installed (only needed for custom schemes)
|
|
349
|
+
const canOpen = await Linking.canOpenURL('slush://');
|
|
350
|
+
if (canOpen) {
|
|
351
|
+
// Native app is installed
|
|
352
|
+
Linking.openURL('slush://swap');
|
|
353
|
+
} else {
|
|
354
|
+
// Fall back to web app
|
|
355
|
+
Linking.openURL('https://my.slush.app/browse/https://your-dapp.com');
|
|
356
|
+
}
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
### iOS (Swift)
|
|
360
|
+
|
|
361
|
+
```swift
|
|
362
|
+
|
|
363
|
+
// Recommended: Use my.slush.app links (works everywhere)
|
|
364
|
+
if let url = URL(string: "https://my.slush.app/browse/https://your-dapp.com") {
|
|
365
|
+
UIApplication.shared.open(url)
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
// Alternative: Check for native app, fall back to web
|
|
369
|
+
if let customUrl = URL(string: "slush://swap"),
|
|
370
|
+
UIApplication.shared.canOpenURL(customUrl) {
|
|
371
|
+
UIApplication.shared.open(customUrl)
|
|
372
|
+
} else if let webUrl = URL(string: "https://my.slush.app/browse/https://your-dapp.com") {
|
|
373
|
+
UIApplication.shared.open(webUrl)
|
|
374
|
+
}
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
### Android (Kotlin)
|
|
378
|
+
|
|
379
|
+
```kotlin
|
|
380
|
+
|
|
381
|
+
// Recommended: Use my.slush.app links (works everywhere)
|
|
382
|
+
val intent = Intent(Intent.ACTION_VIEW, Uri.parse("https://my.slush.app/browse/https://your-dapp.com"))
|
|
383
|
+
startActivity(intent)
|
|
384
|
+
|
|
385
|
+
// Alternative: Use custom scheme for native app only
|
|
386
|
+
val customIntent = Intent(Intent.ACTION_VIEW, Uri.parse("slush://swap"))
|
|
387
|
+
startActivity(customIntent)
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
## Best Practices
|
|
391
|
+
|
|
392
|
+
### Use my.slush.app Links for Maximum Compatibility
|
|
393
|
+
|
|
394
|
+
When linking from any platform, prefer `my.slush.app` links over custom URL schemes. These links
|
|
395
|
+
work everywhere - mobile apps, mobile browsers, and desktop browsers - providing a seamless
|
|
396
|
+
experience for all users.
|
|
397
|
+
|
|
398
|
+
```html
|
|
399
|
+
<!-- Recommended: Works on mobile (app or browser) and desktop -->
|
|
400
|
+
<a href="https://my.slush.app/browse/https://your-dapp.com">Open in Slush</a>
|
|
401
|
+
|
|
402
|
+
<!-- Alternative: Only works if mobile app is installed -->
|
|
403
|
+
<a href="slush://browse/https://your-dapp.com">Open in Slush</a>
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
> Use `my.slush.app` links as your default choice. Only use custom URL schemes (`slush://`) when you
|
|
407
|
+
> specifically need to detect whether the mobile app is installed.
|
|
408
|
+
|
|
409
|
+
### URL Encode Parameters
|
|
410
|
+
|
|
411
|
+
Always URL-encode parameter values, especially token type addresses which contain special
|
|
412
|
+
characters:
|
|
413
|
+
|
|
414
|
+
```javascript
|
|
415
|
+
const coinType = '0x2::sui::SUI';
|
|
416
|
+
const encodedCoinType = encodeURIComponent(coinType);
|
|
417
|
+
const url = `slush://swap?fromCoinType=${encodedCoinType}`;
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
### Check App Installation (Custom Schemes Only)
|
|
421
|
+
|
|
422
|
+
If you're using custom URL schemes (`slush://`), check if the app is installed to provide
|
|
423
|
+
appropriate fallbacks. This is not needed when using `my.slush.app` links, which automatically fall
|
|
424
|
+
back to the web app.
|
|
425
|
+
|
|
426
|
+
```javascript
|
|
427
|
+
const canOpenSlush = await Linking.canOpenURL('slush://');
|
|
428
|
+
if (canOpenSlush) {
|
|
429
|
+
Linking.openURL('slush://swap');
|
|
430
|
+
} else {
|
|
431
|
+
// Fall back to my.slush.app which always works
|
|
432
|
+
Linking.openURL('https://my.slush.app/browse/https://your-dapp.com');
|
|
433
|
+
}
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
### Handle Missing Parameters Gracefully
|
|
437
|
+
|
|
438
|
+
Slush will attempt to open the requested screen even if optional parameters are missing. Required
|
|
439
|
+
parameters that are missing will result in the app opening to a default or error state.
|
|
440
|
+
|
|
441
|
+
## Troubleshooting
|
|
442
|
+
|
|
443
|
+
### Link Not Opening the App
|
|
444
|
+
|
|
445
|
+
1. **Verify the app is installed** - Custom URL schemes only work if Slush is installed
|
|
446
|
+
2. **Check URL format** - Ensure the URL is properly formatted and encoded
|
|
447
|
+
3. **iOS Universal Links** - Must be clicked from Safari or apps that support Universal Links;
|
|
448
|
+
copied/pasted URLs may not trigger the app
|
|
449
|
+
4. **Android App Links** - Ensure the device has verified the app link association
|
|
450
|
+
|
|
451
|
+
### Wrong Screen Opens
|
|
452
|
+
|
|
453
|
+
1. **Check the path** - Verify the route matches one of the supported routes above
|
|
454
|
+
2. **Check parameters** - Ensure all required parameters are provided
|
|
455
|
+
3. **Check parameter encoding** - Special characters in coin types must be URL-encoded
|
|
456
|
+
|
|
457
|
+
### Universal Links Open in Browser Instead of App
|
|
458
|
+
|
|
459
|
+
This can happen if:
|
|
460
|
+
|
|
461
|
+
- The link is typed directly into the address bar
|
|
462
|
+
- The link domain is the same as the current page
|
|
463
|
+
- The user has previously chosen to open links in Safari
|
|
464
|
+
|
|
465
|
+
To ensure Universal Links work reliably, link from a different domain than the target domain.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Slush Wallet Integration
|
|
2
|
+
|
|
3
|
+
> Integrate Slush Wallet into your Sui dApp
|
|
4
|
+
|
|
5
|
+
This section covers integration with [Slush Wallet](https://slush.app), a mobile wallet for the Sui
|
|
6
|
+
blockchain. You'll find guides for wallet-specific functionality to enhance your dApp's user
|
|
7
|
+
experience.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Slush Wallet
|
|
2
|
+
> Slush Wallet Integration
|
|
3
|
+
|
|
4
|
+
- [Slush Wallet Integration](./index.md): Integrate Slush Wallet into your Sui dApp
|
|
5
|
+
- [dApp Integration](./dapp.md): Connect your dApp to Slush Wallet
|
|
6
|
+
- [Deep Linking](./deep-linking.md): Deep linking configuration for Slush Wallet
|
package/dist/sui/bcs.md
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# BCS
|
|
2
|
+
|
|
3
|
+
> Binary Canonical Serialization for encoding Sui Move types
|
|
4
|
+
|
|
5
|
+
The `@mysten/sui/bcs` package extends `@mysten/bcs` with Sui specific scheme definitions.
|
|
6
|
+
|
|
7
|
+
To learn more about using BCS see the [BCS documentation](/bcs).
|
|
8
|
+
|
|
9
|
+
the `bcs` export of `@mysten/sui/bcs` contains all the same exports as `bcs` from `@mysten/bcs` plus
|
|
10
|
+
the following pre-defined schemes:
|
|
11
|
+
|
|
12
|
+
- `U8`
|
|
13
|
+
- `U16`
|
|
14
|
+
- `U32`
|
|
15
|
+
- `U64`
|
|
16
|
+
- `U128`
|
|
17
|
+
- `U256`
|
|
18
|
+
- `ULEB128`
|
|
19
|
+
- `Bool`
|
|
20
|
+
- `String`
|
|
21
|
+
- `Address`
|
|
22
|
+
- `Argument`
|
|
23
|
+
- `CallArg`
|
|
24
|
+
- `CompressedSignature`
|
|
25
|
+
- `GasData`
|
|
26
|
+
- `MultiSig`
|
|
27
|
+
- `MultiSigPkMap`
|
|
28
|
+
- `MultiSigPublicKey`
|
|
29
|
+
- `ObjectArg`
|
|
30
|
+
- `ObjectDigest`
|
|
31
|
+
- `ProgrammableMoveCall`
|
|
32
|
+
- `ProgrammableTransaction`
|
|
33
|
+
- `PublicKey`
|
|
34
|
+
- `SenderSignedData`
|
|
35
|
+
- `SharedObjectRef`
|
|
36
|
+
- `StructTag`
|
|
37
|
+
- `SuiObjectRef`
|
|
38
|
+
- `Transaction`
|
|
39
|
+
- `TransactionData`
|
|
40
|
+
- `TransactionDataV1`
|
|
41
|
+
- `TransactionExpiration`
|
|
42
|
+
- `TransactionKind`
|
|
43
|
+
- `TypeTag`
|
|
44
|
+
- `Object` - Complete object with data, owner, previousTransaction, and storageRebate
|
|
45
|
+
- `TransactionEffects` - Transaction execution effects (supports both V1 and V2)
|
|
46
|
+
- `TransactionEffectsV1` - Legacy transaction effects format
|
|
47
|
+
- `TransactionEffectsV2` - Current transaction effects format with detailed object changes
|
|
48
|
+
|
|
49
|
+
All the upper-cased values are `BcsType` instances, and can be used directly to parse and serialize
|
|
50
|
+
data.
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
|
|
54
|
+
bcs.U8.serialize(1);
|
|
55
|
+
bcs.Address.serialize('0x1');
|
|
56
|
+
bcs.TypeTag.serialize({
|
|
57
|
+
vector: {
|
|
58
|
+
u8: true,
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Working with Objects
|
|
64
|
+
|
|
65
|
+
To parse on-chain objects, fetch them with `include: { content: true }` and pass `object.content` to
|
|
66
|
+
a generated BCS type or a manual struct definition. The `content` field contains only the inner Move
|
|
67
|
+
struct bytes:
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
|
|
71
|
+
const { object } = await client.core.getObject({
|
|
72
|
+
objectId: '0x123...',
|
|
73
|
+
include: { content: true },
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
const parsed = MyStruct.parse(object.content);
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### `bcs.Object` — Full object envelope
|
|
80
|
+
|
|
81
|
+
The `bcs.Object` schema represents the complete on-chain object, including metadata (type, owner,
|
|
82
|
+
version, previous transaction, storage rebate) wrapping the inner struct bytes. This is what the
|
|
83
|
+
`objectBcs` include option returns. Most of this metadata is already available as fields on the
|
|
84
|
+
object response, so you typically only need `content`.
|
|
85
|
+
|
|
86
|
+
```typescript
|
|
87
|
+
|
|
88
|
+
// Parse a full object envelope (from objectBcs include option)
|
|
89
|
+
const envelope = bcs.Object.parse(object.objectBcs);
|
|
90
|
+
console.log('Owner:', envelope.owner);
|
|
91
|
+
console.log('Inner struct bytes:', envelope.data.Move.contents);
|
|
92
|
+
|
|
93
|
+
// Serialize a full object envelope
|
|
94
|
+
const serialized = bcs.Object.serialize({
|
|
95
|
+
data: {
|
|
96
|
+
Move: {
|
|
97
|
+
type: { GasCoin: null },
|
|
98
|
+
hasPublicTransfer: true,
|
|
99
|
+
version: '1',
|
|
100
|
+
contents: new Uint8Array([...]),
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
owner: { AddressOwner: '0x...' },
|
|
104
|
+
previousTransaction: '...',
|
|
105
|
+
storageRebate: '1000',
|
|
106
|
+
});
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
> **Warning:** Do not pass `objectBcs` bytes to a Move struct parser — it contains wrapping metadata that will
|
|
110
|
+
> cause parsing to fail. Use `content` for parsing Move struct fields. See the [Core API
|
|
111
|
+
> docs](/sui/clients/core#objectbcs) for details.
|
|
112
|
+
|
|
113
|
+
## Working with Transaction Effects
|
|
114
|
+
|
|
115
|
+
The `bcs.TransactionEffects` schema can be used to parse transaction effects:
|
|
116
|
+
|
|
117
|
+
```typescript
|
|
118
|
+
|
|
119
|
+
// Parse transaction effects
|
|
120
|
+
const effects = bcs.TransactionEffects.parse(effectsBytes);
|
|
121
|
+
|
|
122
|
+
// Check execution status
|
|
123
|
+
if (effects.V2.status.$kind === 'Success') {
|
|
124
|
+
console.log('Transaction succeeded');
|
|
125
|
+
} else {
|
|
126
|
+
console.log('Transaction failed:', effects.V2.status.Failure.error);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// Access changed objects
|
|
130
|
+
for (const [objectId, change] of effects.V2.changedObjects) {
|
|
131
|
+
console.log('Object:', objectId);
|
|
132
|
+
console.log('Output state:', change.outputState.$kind);
|
|
133
|
+
}
|
|
134
|
+
```
|