Skip to content

Commit facaaed

Browse files
committed
refactor(go-sdk): split optional tags into ethereum and solana
1 parent 3a7a963 commit facaaed

4 files changed

Lines changed: 46 additions & 21 deletions

File tree

sdk/go/README.md

Lines changed: 40 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -199,29 +199,47 @@ var events []interface{}
199199
json.Unmarshal([]byte(quote.EventLog), &events)
200200
```
201201

202-
## Optional Web3 Helpers (build tag)
202+
## Optional blockchain helpers (build tags)
203203

204204
By default, the Go SDK builds a **core profile** (attestation, key derivation, info, signing, env encryption).
205205

206-
Web3 helper utilities are behind build tag `web3`:
206+
Optional helpers are split by tags:
207207

208-
- `ToEthereumAccount()`
209-
- `ToEthereumAccountSecure()`
210-
- `ToSolanaKeypair()`
211-
- `ToSolanaKeypairSecure()`
208+
- `ethereum` tag:
209+
- `ToEthereumAccount()`
210+
- `ToEthereumAccountSecure()`
211+
- `solana` tag:
212+
- `ToSolanaKeypair()`
213+
- `ToSolanaKeypairSecure()`
212214

213-
### Enable Web3 helpers
215+
### Enable Ethereum helpers
214216

215217
```bash
216218
# add optional dependency
217219
go get github.com/ethereum/go-ethereum@v1.16.8
218220

219-
# build/run with web3 helpers enabled
220-
go build -tags web3 ./...
221-
go test -tags web3 ./...
221+
# build/test with ethereum helpers enabled
222+
go build -tags ethereum ./...
223+
go test -tags ethereum ./...
222224
```
223225

224-
If you don't need Web3 helper APIs, do not use `-tags web3` and you won't pull those optional imports.
226+
### Enable Solana helpers
227+
228+
```bash
229+
# no extra dependency is required for solana helper APIs
230+
go build -tags solana ./...
231+
go test -tags solana ./...
232+
```
233+
234+
### Enable both
235+
236+
```bash
237+
go get github.com/ethereum/go-ethereum@v1.16.8
238+
go build -tags "ethereum solana" ./...
239+
go test -tags "ethereum solana" ./...
240+
```
241+
242+
If you don't need blockchain helper APIs, do not use these tags and you won't pull optional helper imports.
225243

226244
### Testing against a local starter app
227245

@@ -239,18 +257,25 @@ go mod tidy
239257
go run .
240258
```
241259

242-
If your starter enables Web3 routes, add and build with tag:
260+
If your starter enables optional blockchain routes, run with matching tags:
243261

244262
```bash
263+
# ethereum only
245264
go get github.com/ethereum/go-ethereum@v1.16.8
246-
go run -tags web3 .
265+
go run -tags ethereum .
266+
267+
# solana only
268+
go run -tags solana .
269+
270+
# both
271+
go run -tags "ethereum solana" .
247272
```
248273

249274
## Blockchain Integration
250275

251276
### Ethereum
252277

253-
> requires build tag: `web3`
278+
> requires build tag: `ethereum`
254279
255280
```go
256281
import (
@@ -289,7 +314,7 @@ if err != nil {
289314

290315
### Solana
291316

292-
> requires build tag: `web3`
317+
> requires build tag: `solana`
293318
294319
```go
295320
import (

sdk/go/dstack/client_web3_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
//go:build web3
2-
// +build web3
1+
//go:build ethereum
2+
// +build ethereum
33

44
// SPDX-FileCopyrightText: © 2025 Phala Network <dstack@phala.network>
55
//

sdk/go/dstack/ethereum.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
//go:build web3
2-
// +build web3
1+
//go:build ethereum
2+
// +build ethereum
33

44
// SPDX-FileCopyrightText: © 2025 Phala Network <dstack@phala.network>
55
//

sdk/go/dstack/solana.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
//go:build web3
2-
// +build web3
1+
//go:build solana
2+
// +build solana
33

44
// SPDX-FileCopyrightText: © 2025 Phala Network <dstack@phala.network>
55
//

0 commit comments

Comments
 (0)