1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782# ๐ Tensor Go SDK
<div align="center">
[](https://golang.org)
[](LICENSE)
**A powerful, type-safe Go SDK for the [Tensor Protocol](https://docs.tensor.trade/) - The leading NFT marketplace on Solana**
[Installation](#-installation) โข
[Quick Start](#-quick-start) โข
[Examples](#-examples) โข
[Contributing](#-contributing)
</div>
---
## โจ Features
- ๐ฅ **Complete API Coverage** - Support for all major Tensor endpoints
- ๐ก๏ธ **Type Safety** - Fully typed requests and responses
- โก **High Performance** - Optimized for speed and efficiency
- ๐ **Context Support** - Built-in timeout and cancellation support
- ๐ **Rich Error Handling** - Detailed error types and messages
- ๐งช **Well Tested** - Comprehensive test coverage
- ๐ **Great Documentation** - Clear examples and API docs
- ๐ง **Easy Integration** - Simple, intuitive API design
## ๐ฆ Installation
```bash
go get github.com/srpvpn/tensor-go-sdk
```
## ๐ Quick Start
```go
package main
import (
"context"
"fmt"
"log"
"time"
"github.com/srpvpn/tensor-go-sdk/api/collections"
"github.com/srpvpn/tensor-go-sdk/api/escrow"
"github.com/srpvpn/tensor-go-sdk/api/marketplace"
"github.com/srpvpn/tensor-go-sdk/api/nfts"
"github.com/srpvpn/tensor-go-sdk/api/rpc"
"github.com/srpvpn/tensor-go-sdk/api/tswap"
"github.com/srpvpn/tensor-go-sdk/api/user"
"github.com/srpvpn/tensor-go-sdk/client"
)
func main() {
// Initialize client
cfg := &client.Config{
APIKey: "your-api-key",
Timeout: 30 * time.Second,
}
tensorClient := client.New(cfg)
ctx := context.Background()
// Get user portfolio
portfolio, _, err := tensorClient.User.GetPortfolio(ctx, &user.PortfolioRequest{
Wallet: "DRpbCBMxVnDK7maPM5tGv6MvB3v1sRMC86PZ8okm21hy",
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("Found %d collections in portfolio\n", len(portfolio.Collections))
// Buy an NFT
buyTx, _, err := tensorClient.Marketplace.BuyNFT(ctx, &marketplace.BuyNFTRequest{
Buyer: "buyer-wallet-address",
Mint: "nft-mint-address",
Owner: "current-owner-address",
MaxPrice: 1.5,
Blockhash: "recent-blockhash",
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("Generated %d transactions for NFT purchase\n", len(buyTx.Txs))
// Close a TSwap pool
closeResp, statusCode, err := tensorClient.TSwap.CloseTSwapPool(ctx, &tswap.CloseTSwapPoolRequest{
PoolAddress: "pool-address",
Blockhash: "recent-blockhash",
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("Pool close transaction status: %d, transactions: %d\n", statusCode, len(closeResp.Txs))
// Get priority fees for optimized transactions
priorityFees, _, err := tensorClient.RPC.GetPriorityFees(ctx, &rpc.PriorityFeesRequest{})
if err != nil {
log.Fatal(err)
}
fmt.Printf("Current priority fees - Medium: %d micro-lamports\n", priorityFees.Medium)
// Deposit to escrow account
escrowDeposit, statusCode, err := tensorClient.Escrow.DepositWithdrawEscrow(ctx, &escrow.DepositWithdrawEscrowRequest{
Action: "DEPOSIT",
Owner: "owner-wallet-address",
Lamports: 1000000000.0, // 1 SOL
Blockhash: "recent-blockhash",
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("Escrow deposit status: %d, response: %s\n", statusCode, escrowDeposit.Status)
// Get NFT information
nftInfo, statusCode, err := tensorClient.NFTs.GetNFTsInfo(ctx, &nfts.NFTsInfoRequest{
Mints: []string{"nft-mint-address-1", "nft-mint-address-2"},
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("NFT info status: %d, data length: %d bytes\n", statusCode, len(nftInfo))
// Get verified collections
collections, statusCode, err := tensorClient.Collections.GetVerifiedCollections(ctx, &collections.GetVerifiedCollectionsRequest{
SortBy: "statsV2.volume1h:desc",
Limit: 10,
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("Found %d verified collections\n", len(collections))
}
```
## ๐ API Reference
### ๐ค User API
<details>
<summary><b>Portfolio Management</b></summary>
```go
// Get user's NFT portfolio
portfolio, _, err := client.User.GetPortfolio(ctx, &user.PortfolioRequest{
Wallet: "wallet-address",
IncludeBidCount: &[]bool{true}[0],
IncludeFavouriteCount: &[]bool{true}[0],
IncludeUnverified: &[]bool{false}[0],
Currencies: []string{"SOL", "USDC"},
})
```
</details>
<details>
<summary><b>Active Listings</b></summary>
```go
// Get user's active NFT listings
listings, _, err := client.User.GetListings(ctx, &user.ListingsRequest{
Wallets: []string{"wallet1", "wallet2"},
SortBy: "PriceDesc",
Limit: 50,
CollId: &[]string{"collection-id"}[0],
Currencies: []string{"SOL"},
})
```
</details>
<details>
<summary><b>Bid Management</b></summary>
```go
// Get NFT bids
nftBids, _, err := client.User.GetNFTBids(ctx, &user.NFTBidsRequest{
Owner: "wallet-address",
Limit: 100,
CollId: &[]string{"collection-id"}[0],
})
// Get collection bids
collBids, _, err := client.User.GetCollectionBids(ctx, &user.CollectionBidsRequest{
Owner: "wallet-address",
Limit: 100,
CollId: &[]string{"collection-id"}[0],
})
// Get trait bids
traitBids, _, err := client.User.GetTraitBids(ctx, &user.TraitBidsRequest{
Owner: "wallet-address",
Limit: 100,
CollId: &[]string{"collection-id"}[0],
})
```
</details>
<details>
<summary><b>Transaction History</b></summary>
```go
// Get user's transaction history
transactions, _, err := client.User.GetTransactions(ctx, &user.TransactionsRequest{
Wallets: []string{"wallet-address"},
Limit: 100,
TxTypes: []string{"SALE_BUY_NOW", "SALE_ACCEPT_BID", "LIST"},
Collid: "collection-id",
})
```
</details>
<details>
<summary><b>Pool Management</b></summary>
```go
// Get TSwap pools
tswapPools, _, err := client.User.GetTSwapPools(ctx, &user.TSwapsPoolsRequest{
Owner: "wallet-address",
PoolAddresses: []string{"pool1", "pool2"},
Limit: 50,
})
// Get TAmm pools
tammPools, _, err := client.User.GetTAmmPools(ctx, &user.TAmmPoolsRequest{
Owner: "wallet-address",
PoolAddresses: []string{"pool1", "pool2"},
Limit: 50,
})
```
</details>
<details>
<summary><b>Escrow & Inventory</b></summary>
```go
// Get escrow accounts
escrow, _, err := client.User.GetEscrowAccounts(ctx, &user.EscrowAccountsRequest{
Owner: "wallet-address",
})
// Get inventory for collection
inventory, _, err := client.User.GetInventoryForCollection(ctx, &user.InventoryForCollectionRequest{
Wallets: []string{"wallet-address"},
CollId: &[]string{"collection-id"}[0],
Limit: &[]int32{100}[0],
})
```
</details>
### ๐ TSwap API
<details>
<summary><b>Pool Management</b></summary>
```go
// Close TSwap pool
closeResp, statusCode, err := client.TSwap.CloseTSwapPool(ctx, &tswap.CloseTSwapPoolRequest{
PoolAddress: "pool-address",
Blockhash: "recent-blockhash",
Compute: &[]int32{200000}[0],
PriorityMicroLamports: &[]int32{1000}[0],
})
// Edit TSwap pool
editResp, statusCode, err := client.TSwap.EditTSwapPool(ctx, &tswap.EditTSwapPoolRequest{
PoolAddress: "pool-address",
PoolType: "TOKEN", // TOKEN, NFT, or TRADE
CurveType: "linear", // linear or exponential
StartingPrice: 1.5,
Delta: 0.1,
Blockhash: "recent-blockhash",
MmKeepFeesSeparate: &[]bool{true}[0],
MmFeeBps: &[]float64{250.0}[0], // 2.5%
MaxTakerSellCount: &[]int32{10}[0],
UseSharedEscrow: &[]bool{false}[0],
Compute: &[]int32{200000}[0],
PriorityMicroLamports: &[]int32{1000}[0],
})
```
</details>
<details>
<summary><b>NFT Deposit/Withdraw</b></summary>
```go
// Deposit NFT to TSwap pool
depositNFTResp, statusCode, err := client.TSwap.DepositWithdrawNFT(ctx, &tswap.DepositWithdrawNFTRequest{
Action: "DEPOSIT", // DEPOSIT or WITHDRAW
PoolAddress: "pool-address",
Mint: "nft-mint-address",
Blockhash: "recent-blockhash",
NftSource: &[]string{"source-address"}[0],
Compute: &[]int32{200000}[0],
PriorityMicroLamports: &[]int32{1000}[0],
})
// Withdraw NFT from TSwap pool
withdrawNFTResp, statusCode, err := client.TSwap.DepositWithdrawNFT(ctx, &tswap.DepositWithdrawNFTRequest{
Action: "WITHDRAW",
PoolAddress: "pool-address",
Mint: "nft-mint-address",
Blockhash: "recent-blockhash",
})
```
</details>
<details>
<summary><b>SOL Deposit/Withdraw</b></summary>
```go
// Deposit SOL to TSwap pool
depositSOLResp, statusCode, err := client.TSwap.DepositWithdrawSOL(ctx, &tswap.DepositWithdrawSOLRequest{
Action: "DEPOSIT", // DEPOSIT or WITHDRAW (case insensitive, normalized to uppercase)
PoolAddress: "pool-address",
Lamports: 1000000000.0, // 1 SOL in lamports
Blockhash: "recent-blockhash",
Compute: &[]int32{200000}[0],
PriorityMicroLamports: &[]int32{1000}[0],
})
// Withdraw SOL from TSwap pool
withdrawSOLResp, statusCode, err := client.TSwap.DepositWithdrawSOL(ctx, &tswap.DepositWithdrawSOLRequest{
Action: "WITHDRAW",
PoolAddress: "pool-address",
Lamports: 500000000.0, // 0.5 SOL in lamports
Blockhash: "recent-blockhash",
})
```
</details>
### ๐ Marketplace API
<details>
<summary><b>NFT Trading</b></summary>
```go
// Buy NFT
buyTx, _, err := client.Marketplace.BuyNFT(ctx, &marketplace.BuyNFTRequest{
Buyer: "buyer-wallet",
Mint: "nft-mint",
Owner: "current-owner",
MaxPrice: 1.5,
Blockhash: "recent-blockhash",
OptionalRoyaltyPct: &[]int32{5}[0],
})
// Sell NFT (accept bid)
sellTx, _, err := client.Marketplace.SellNFT(ctx, &marketplace.SellNFTRequest{
Seller: "seller-wallet",
Mint: "nft-mint",
BidAddress: "bid-address",
MinPrice: 1.0,
Blockhash: "recent-blockhash",
})
```
</details>
<details>
<summary><b>Listing Management</b></summary>
```go
// List NFT
listTx, _, err := client.Marketplace.ListNFT(ctx, &marketplace.ListNFTRequest{
Mint: "nft-mint",
Owner: "owner-wallet",
Price: 2.5,
Blockhash: "recent-blockhash",
ExpireIn: &[]int32{3600}[0], // 1 hour
})
// Edit listing
editTx, _, err := client.Marketplace.EditListing(ctx, &marketplace.EditListingRequest{
Mint: "nft-mint",
Owner: "owner-wallet",
Price: 3.0, // New price
Blockhash: "recent-blockhash",
})
// Delist NFT
delistTx, _, err := client.Marketplace.DelistNFT(ctx, &marketplace.DelistNFTRequest{
Mint: "nft-mint",
Owner: "owner-wallet",
Blockhash: "recent-blockhash",
})
```
</details>
<details>
<summary><b>Bidding</b></summary>
```go
// Place NFT bid
nftBidTx, _, err := client.Marketplace.PlaceNFTBid(ctx, &marketplace.PlaceNFTBidRequest{
Owner: "bidder-wallet",
Price: 1.5,
Mint: "nft-mint",
Blockhash: "recent-blockhash",
UseSharedEscrow: &[]bool{true}[0],
})
// Place collection bid
collBidTx, _, err := client.Marketplace.PlaceCollectionBid(ctx, &marketplace.PlaceCollectionBidRequest{
Owner: "bidder-wallet",
Price: 1.0,
Quantity: 5,
CollId: "collection-id",
Blockhash: "recent-blockhash",
})
// Place trait bid
traitBidTx, _, err := client.Marketplace.PlaceTraitBid(ctx, &marketplace.PlaceTraitBidRequest{
Owner: "bidder-wallet",
Price: 0.8,
Quantity: 3,
CollId: "collection-id",
Traits: []string{"trait1", "trait2"},
Blockhash: "recent-blockhash",
})
```
</details>
<details>
<summary><b>Bid Management</b></summary>
```go
// Edit bid
editBidTx, _, err := client.Marketplace.EditBid(ctx, &marketplace.EditBidRequest{
BidStateAddress: "bid-state-address",
Blockhash: "recent-blockhash",
Price: &[]float64{2.0}[0], // New price
Quantity: &[]int32{10}[0], // New quantity
})
// Cancel bid
cancelTx, _, err := client.Marketplace.CancelBid(ctx, &marketplace.CancelBidRequest{
BidStateAddress: "bid-state-address",
Blockhash: "recent-blockhash",
})
```
</details>
### ๐ง RPC API
<details>
<summary><b>Priority Fees</b></summary>
```go
// Get market-based priority fees for transaction creation
priorityFees, statusCode, err := client.RPC.GetPriorityFees(ctx, &rpc.PriorityFeesRequest{})
if err != nil {
log.Fatal(err)
}
fmt.Printf("Priority Fees - Min: %d, Low: %d, Medium: %d, High: %d, Very High: %d\n",
priorityFees.Min, priorityFees.Low, priorityFees.Medium, priorityFees.High, priorityFees.VeryHigh)
// Use the fees in your transaction
compute := int32(200000)
priorityMicroLamports := int32(priorityFees.Medium) // Use medium priority
buyTx, _, err := client.Marketplace.BuyNFT(ctx, &marketplace.BuyNFTRequest{
Buyer: "buyer-wallet",
Mint: "nft-mint",
Owner: "current-owner",
MaxPrice: 1.5,
Blockhash: "recent-blockhash",
Compute: &compute,
PriorityMicroLamports: &priorityMicroLamports,
})
```
</details>
### ๐ฐ Shared Escrow API
<details>
<summary><b>Escrow Management</b></summary>
```go
// Deposit SOL to escrow account
depositResp, statusCode, err := client.Escrow.DepositWithdrawEscrow(ctx, &escrow.DepositWithdrawEscrowRequest{
Action: "DEPOSIT", // DEPOSIT or WITHDRAW (case insensitive, normalized to uppercase)
Owner: "owner-wallet-address",
Lamports: 1000000000.0, // 1 SOL in lamports
Blockhash: "recent-blockhash",
Compute: &[]int32{200000}[0],
PriorityMicroLamports: &[]int32{1000}[0],
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("Escrow deposit status: %d, response: %s\n", statusCode, depositResp.Status)
// Withdraw SOL from escrow account
withdrawResp, statusCode, err := client.Escrow.DepositWithdrawEscrow(ctx, &escrow.DepositWithdrawEscrowRequest{
Action: "WITHDRAW",
Owner: "owner-wallet-address",
Lamports: 500000000.0, // 0.5 SOL in lamports
Blockhash: "recent-blockhash",
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("Escrow withdraw status: %d, response: %s\n", statusCode, withdrawResp.Status)
// Use with priority fees for optimized transactions
priorityFees, _, err := client.RPC.GetPriorityFees(ctx, &rpc.PriorityFeesRequest{})
if err != nil {
log.Fatal(err)
}
compute := int32(200000)
priorityMicroLamports := int32(priorityFees.Medium)
optimizedDeposit, _, err := client.Escrow.DepositWithdrawEscrow(ctx, &escrow.DepositWithdrawEscrowRequest{
Action: "DEPOSIT",
Owner: "owner-wallet-address",
Lamports: 2000000000.0, // 2 SOL
Blockhash: "recent-blockhash",
Compute: &compute,
PriorityMicroLamports: &priorityMicroLamports,
})
```
</details>
### ๐ผ๏ธ NFTs API
<details>
<summary><b>NFT Information</b></summary>
```go
// Get NFT info by mint addresses
nftInfoBytes, statusCode, err := client.NFTs.GetNFTsInfo(ctx, &nfts.NFTsInfoRequest{
Mints: []string{
"nft-mint-address-1",
"nft-mint-address-2",
"nft-mint-address-3",
},
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("NFT info response (status: %d): %s\n", statusCode, string(nftInfoBytes))
// Single NFT info
singleNFTBytes, statusCode, err := client.NFTs.GetNFTsInfo(ctx, &nfts.NFTsInfoRequest{
Mints: []string{"single-nft-mint-address"},
})
```
</details>
<details>
<summary><b>NFTs by Collection</b></summary>
```go
// Get NFTs by collection with basic filters
collectionNFTsBytes, statusCode, err := client.NFTs.GetNFTsByCollection(ctx, &nfts.NFTsByCollectionRequest{
CollId: "collection-id",
SortBy: "PriceAsc", // PriceAsc, PriceDesc, RarityAsc, RarityDesc, etc.
Limit: 50,
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("Collection NFTs response (status: %d): %s\n", statusCode, string(collectionNFTsBytes))
// Advanced filtering with all options
advancedFilterBytes, statusCode, err := client.NFTs.GetNFTsByCollection(ctx, &nfts.NFTsByCollectionRequest{
CollId: "collection-id",
SortBy: "PriceDesc",
Limit: 100,
OnlyListings: &[]bool{true}[0], // Only show listed NFTs
MinPrice: &[]float64{0.5}[0], // Minimum price filter
MaxPrice: &[]float64{10.0}[0], // Maximum price filter
TraitCountMin: &[]int32{3}[0], // Minimum trait count
TraitCountMax: &[]int32{8}[0], // Maximum trait count
Name: &[]string{"Cool NFT"}[0], // Name filter
ExcludeOwners: []string{"owner-to-exclude"}, // Exclude specific owners
IncludeOwners: []string{"owner-to-include"}, // Include only specific owners
IncludeCurrencies: []string{"SOL", "USDC"}, // Currency filters
Traits: []string{`{"Background": ["Blue", "Red"]}`}, // Trait filters
RaritySystem: &[]string{"tensor"}[0], // Rarity system
RarityMin: &[]float64{1.0}[0], // Minimum rarity
RarityMax: &[]float64{100.0}[0], // Maximum rarity
OnlyInscriptions: &[]bool{false}[0], // Solana Inscriptions filter
ImmutableStatus: &[]string{"mutable"}[0], // Immutability filter
})
// Pagination with cursor
paginatedBytes, statusCode, err := client.NFTs.GetNFTsByCollection(ctx, &nfts.NFTsByCollectionRequest{
CollId: "collection-id",
SortBy: "PriceAsc",
Limit: 50,
Cursor: &[]string{"cursor-from-previous-response"}[0],
})
// Filter by specific mints within collection
specificMintsBytes, statusCode, err := client.NFTs.GetNFTsByCollection(ctx, &nfts.NFTsByCollectionRequest{
CollId: "collection-id",
SortBy: "PriceAsc",
Limit: 50,
Mints: []string{"mint1", "mint2", "mint3"}, // Filter for specific mints
})
```
</details>
### ๐๏ธ Collections API
<details>
<summary><b>Get Verified Collections</b></summary>
```go
// Get top collections by volume
collectionsBytes, statusCode, err := client.Collections.GetVerifiedCollections(ctx, &collections.GetVerifiedCollectionsRequest{
SortBy: "statsV2.volume1h:desc", // Sort by 1h volume descending
Limit: 10, // Get top 10 collections
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("Collections response (status: %d): %s\n", statusCode, string(collectionsBytes))
// Get specific collections by slug
specificCollections, statusCode, err := client.Collections.GetVerifiedCollections(ctx, &collections.GetVerifiedCollectionsRequest{
SortBy: "statsV2.volume24h:desc",
Limit: 5,
SlugDisplays: []string{"portalsuniverse", "degods", "madlads"},
})
// Get collections by collection IDs
collByIds, statusCode, err := client.Collections.GetVerifiedCollections(ctx, &collections.GetVerifiedCollectionsRequest{
SortBy: "statsV2.floor1h:asc",
Limit: 20,
CollIds: []string{"ec2fc59c-8240-4166-ad76-478f57958188"},
})
// Get collections with pagination
page1, statusCode, err := client.Collections.GetVerifiedCollections(ctx, &collections.GetVerifiedCollectionsRequest{
SortBy: "statsV2.marketCap:desc",
Limit: 50,
Page: func() *int32 { v := int32(1); return &v }(),
})
page2, statusCode, err := client.Collections.GetVerifiedCollections(ctx, &collections.GetVerifiedCollectionsRequest{
SortBy: "statsV2.marketCap:desc",
Limit: 50,
Page: func() *int32 { v := int32(2); return &v }(),
})
// Filter by verified on-chain collection (max 10 vocs/fvcs)
onChainFiltered, statusCode, err := client.Collections.GetVerifiedCollections(ctx, &collections.GetVerifiedCollectionsRequest{
SortBy: "statsV2.volume7d:desc",
Limit: 25,
Vocs: []string{"voc-address-1", "voc-address-2"},
})
// Filter by first verified creators (max 10 vocs/fvcs)
creatorFiltered, statusCode, err := client.Collections.GetVerifiedCollections(ctx, &collections.GetVerifiedCollectionsRequest{
SortBy: "statsV2.sales24h:desc",
Limit: 25,
Fvcs: []string{"creator-address-1", "creator-address-2"},
})
```
</details>
## ๐ฏ Implementation Status
### โ
Implemented APIs
| API Category | Status | Endpoints |
|-------------|--------|-----------|
| **User API** | โ
Complete | Portfolio, Listings, Bids, Transactions, Pools, Escrow, Inventory |
| **Marketplace API** | โ
Complete | Buy, Sell, List, Delist, Edit, Bid, Cancel |
| **TSwap API** | โ
Complete | Close Pool, Edit Pool, Deposit/Withdraw NFT, Deposit/Withdraw SOL |
| **RPC API** | โ
Complete | Priority Fees |
| **Shared Escrow API** | โ
Complete | Deposit/Withdraw Escrow |
| **NFTs API** | โ
Complete | NFT Info, NFTs by Collection |
### ๐ง Roadmap
| API Category | Status | Priority | Description |
|-------------|--------|----------|-------------|
| **TAmm API** | ๐ Planned | Medium | Advanced AMM features |
| **Data API - Orders** | ๐ Planned | Medium | Order book and market data |
| **Data API - Collections** | ๐ Planned | Medium | Collection statistics |
| **Refresh API** | ๐ Planned | Low | Data refresh endpoints |
| **SDK API - Mint Proof** | ๐ Planned | Medium | Mint proof generation |
| **SDK API - Trait Bids** | ๐ Planned | Medium | Advanced trait bidding |
| **SDK API - Whitelist** | ๐ Planned | Low | Whitelist management |
## ๐งช Testing
```bash
# Run all tests
go test ./...
# Run tests with coverage
go test -cover ./...
# Run tests with race detection
go test -race ./...
# Run specific package tests
go test ./api/user
go test ./api/marketplace
```
## ๐ Examples
Check out the [examples](./examples) directory for complete working examples:
- [Basic Usage](./examples/basic_usage/main.go) - Simple portfolio and trading operations
- [Advanced Trading](./examples/offline_demo/main.go) - Complex trading scenarios
## ๐ค Contributing
We welcome contributions! This project is growing fast and we'd love your help to make it even better.
### Ways to Contribute
- ๐ **Report Bugs** - Found an issue? Let us know!
- ๐ก **Feature Requests** - Have an idea? We'd love to hear it!
- ๐ **Documentation** - Help improve our docs
- ๐ง **Code Contributions** - Submit PRs for new features or fixes
- ๐งช **Testing** - Help us improve test coverage
- ๐ **Spread the Word** - Star the repo and tell others!
### Getting Started
1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Make your changes
4. Add tests for your changes
5. Ensure all tests pass (`go test ./...`)
6. Commit your changes (`git commit -m 'Add amazing feature'`)
7. Push to the branch (`git push origin feature/amazing-feature`)
8. Open a Pull Request
### Development Setup
```bash
# Clone the repo
git clone https://github.com/srpvpn/tensor-go-sdk.git
cd tensor-go-sdk
# Install dependencies
go mod download
# Run tests
go test ./...
# Run linter (if you have golangci-lint installed)
golangci-lint run
```
## ๐ License
This project is licensed under the GNU General Public License v3.0 - see the [LICENSE](LICENSE) file for details.
<div align="center">
**Built with โค๏ธ for the Solana NFT ecosystem**
[โญ Star us on GitHub](https://github.com/srpvpn/tensor-go-sdk)
</div>