Skip to content

Commit 9678b47

Browse files
feat: update sol methods (#248)
Update SOL methods: - Replaces base64 signatures with base58, which is the standard encoding for signatures on Solana - Improves examples with real data - Improves descriptions
1 parent 690f724 commit 9678b47

File tree

1 file changed

+26
-16
lines changed

1 file changed

+26
-16
lines changed

packages/keyring-api/docs/sol-methods.md

+26-16
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Signs and sends a transaction to the Solana blockchain.
4040
- Type: `object`
4141
- Properties:
4242
- `signature`
43-
- Description: The transaction signature.
43+
- Description: The base58 encoded transaction signature.
4444
- Type: `string`
4545

4646
### Examples
@@ -121,9 +121,9 @@ Signs a transaction to the Solana blockchain.
121121
"method": "signTransaction",
122122
"params": {
123123
"account": {
124-
"address": "GM4iccdbdSF1qN3Bqmdksfk7iuxYhWzC8T3XbizStAdE"
124+
"address": "FDUGdV6bjhvw5gbirXCvqbTSWK9999kcrZcrHoCQzXJK"
125125
},
126-
"transaction": "MTIzNDU2Nzg5MDIzMzQzNDM1NDM=",
126+
"transaction": "AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAQACBJmwAo+dnq8yhuKR7QpXgj+5yPFMzVwViEudWE9Z+N903bOu6UdCGJS9VyhRo8wvswWSAO709XY+51AU1MALO6wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMGRm/lIRcy/+ytunLDm+e8jOW7xfcSayxDmzpAAAAAdazMubIOjxUiTY/+xWYNSffhgTb7vd9LWQ0sI2iMMSoCAwAFAiwBAAACAgABDAIAAABAQg8AAAAAAAA=",
127127
"scope": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
128128
"options": {
129129
"preflightCommitment": "confirmed",
@@ -137,13 +137,15 @@ Signs a transaction to the Solana blockchain.
137137

138138
```json
139139
{
140-
"signedTransaction": "MTIzNDU2Nzg5MDIzMzQzNDM1NDM2NDU2NTM0"
140+
"signedTransaction": "AchmhyZwTxtSzYoT9A89g0ttVuYx9yDzk8Ykw35yM2XuGwzv/8qwg8My2yAWI1Ai3PGMN1VioGZFl4LDIEtDKw6AAQACBJmwAo+dnq8yhuKR7QpXgj+5yPFMzVwViEudWE9Z+N903bOu6UdCGJS9VyhRo8wvswWSAO709XY+51AU1MALO6wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMGRm/lIRcy/+ytunLDm+e8jOW7xfcSayxDmzpAAAAAdazMubIOjxUiTY/+xWYNSffhgTb7vd9LWQ0sI2iMMSoCAwAFAiwBAAACAgABDAIAAABAQg8AAAAAAAA="
141141
}
142142
```
143143

144144
## [signMessage](https://github.com/anza-xyz/wallet-standard/blob/master/packages/core/features/src/signMessage.ts#L4)
145145

146-
Signs a message to the Solana blockchain.
146+
Signs the provided base64 encoded message using the provided account's private key.
147+
148+
It signs the base64 encoded message, **NOT** the original message, meaning that the signature must be verified using the base64 encoded message as well.
147149

148150
### [Parameters](https://github.com/anza-xyz/wallet-standard/blob/master/packages/core/features/src/signMessage.ts#L27)
149151

@@ -167,7 +169,7 @@ Signs a message to the Solana blockchain.
167169
- Type: `object`
168170
- Properties:
169171
- `signature` (required)
170-
- Description: The base64 encoded message signature.
172+
- Description: The base58 encoded message signature.
171173
- Type: `string`
172174
- `signedMessage` (required)
173175
- Description: The base64 encoded signed message.
@@ -187,7 +189,7 @@ Signs a message to the Solana blockchain.
187189
"account": {
188190
"address": "GM4iccdbdSF1qN3Bqmdksfk7iuxYhWzC8T3XbizStAdE"
189191
},
190-
"message": "1234567890"
192+
"message": "SGVsbG8sIHdvcmxkIQ==" // "Hello, world!" in base64
191193
}
192194
}
193195
```
@@ -196,15 +198,17 @@ Signs a message to the Solana blockchain.
196198

197199
```json
198200
{
199-
"signature": "1234567890",
200-
"signedMessage": "MTIzNDU2Nzg5MA==",
201+
"signature": "2n1rfebBmxvRd6MMdDdV5V9Hyy34FRBgVc6EFGjH78fNUW2Fz6RgkMwpHwLGFVQS2BBDkHV38FuKdavSF2GTo5gq",
202+
"signedMessage": "SGVsbG8sIHdvcmxkIQ==", // "Hello, world!" in base64
201203
"signatureType": "ed25519"
202204
}
203205
```
204206

205207
## [signIn](https://github.com/anza-xyz/wallet-standard/blob/master/packages/core/features/src/signIn.ts#L4)
206208

207-
Signs in to the Solana blockchain.
209+
Receives a sign in intent object that contains data like domain, or URI, then converts it into a message using `JSON.stringify()`, then signs the message.
210+
211+
Signature verification must be done against the JSON.
208212

209213
### [Parameters](https://github.com/anza-xyz/wallet-standard/blob/master/packages/core/features/src/signIn.ts#L27)
210214

@@ -262,10 +266,10 @@ Signs in to the Solana blockchain.
262266
- Description: The address of the account.
263267
- Type: `string`
264268
- `signedMessage` (required)
265-
- Description: Message bytes that were signed. The wallet may prefix or otherwise modify the message before signing it.
269+
- Description: The provided intent object that was JSON.stringified and base64 encoded. Perform signature verifications against this string.
266270
- Type: `string`
267271
- `signature` (required)
268-
- Description: The base64 encoded message signature. If the signature type is provided, the signature must be Ed25519.
272+
- Description: The base58 encoded message signature. If the signature type is provided, the signature must be Ed25519.
269273
- Type: `string`
270274
- `signatureType` (optional)
271275
- Description: The type of signature. If not provided, the signature must be Ed25519.
@@ -279,7 +283,13 @@ Signs in to the Solana blockchain.
279283
{
280284
"method": "signIn",
281285
"params": {
282-
"domain": "example.com"
286+
"address": "27h6cm6S9ag5y4ASi1a1vbTSKEsQMjEdfvZ6atPjmbuD",
287+
"domain": "example.com",
288+
"statement": "I accept the terms of service",
289+
"uri": "https://example.com",
290+
"version": "1",
291+
"chainId": "solana:101",
292+
"nonce": "123"
283293
}
284294
}
285295
```
@@ -289,10 +299,10 @@ Signs in to the Solana blockchain.
289299
```json
290300
{
291301
"account": {
292-
"address": "GM4iccdbdSF1qN3Bqmdksfk7iuxYhWzC8T3XbizStAdE"
302+
"address": "27h6cm6S9ag5y4ASi1a1vbTSKEsQMjEdfvZ6atPjmbuD"
293303
},
294-
"signedMessage": "MTIzNDU2Nzg5MA==",
295-
"signature": "1234567890",
304+
"signedMessage": "eyJhZGRyZXNzIjoiMjdoNmNtNlM5YWc1eTRBU2kxYTF2YlRTS0VzUU1qRWRmdlo2YXRQam1idUQiLCJkb21haW4iOiJleGFtcGxlLmNvbSIsInN0YXRlbWVudCI6IkkgYWNjZXB0IHRoZSB0ZXJtcyBvZiBzZXJ2aWNlIiwidXJpIjoiaHR0cHM6Ly9leGFtcGxlLmNvbSIsInZlcnNpb24iOiIxIiwiY2hhaW5JZCI6InNvbGFuYToxMDEiLCJub25jZSI6IjEyMyJ9",
305+
"signature": "3WiRaNnVAbrYWd4MT7rkq8oBC52HrbLZDst1K2ErAUiXswJu9aBZUMgKZpm581VV8Df6BDmgYGLRP7GcWE8mxMD9",
296306
"signatureType": "ed25519"
297307
}
298308
```

0 commit comments

Comments
 (0)