|
34 | 34 | testWS = "wss://api.devnet.solana.com" |
35 | 35 | ) |
36 | 36 |
|
| 37 | +func ExampleClient_GetProductAccount() { |
| 38 | + client := NewClient(Devnet, testRPC, testWS) |
| 39 | + productPubkey := solana.MustPublicKeyFromBase58("EWxGfxoPQSNA2744AYdAKmsQZ8F9o9M7oKkvL3VM1dko") |
| 40 | + product, _ := client.GetProductAccount(context.TODO(), productPubkey) |
| 41 | + // Print first product as JSON. |
| 42 | + jsonData, _ := json.MarshalIndent(product, "", " ") |
| 43 | + fmt.Println(string(jsonData)) |
| 44 | + // Output: |
| 45 | + // { |
| 46 | + // "first_price": "E36MyBbavhYKHVLWR79GiReNNnBDiHj6nWA7htbkNZbh", |
| 47 | + // "attrs": { |
| 48 | + // "asset_type": "FX", |
| 49 | + // "base": "EUR", |
| 50 | + // "description": "EUR/USD", |
| 51 | + // "generic_symbol": "EURUSD", |
| 52 | + // "quote_currency": "USD", |
| 53 | + // "symbol": "FX.EUR/USD", |
| 54 | + // "tenor": "Spot" |
| 55 | + // } |
| 56 | + // } |
| 57 | +} |
| 58 | + |
| 59 | +func ExampleClient_GetAllProductKeys() { |
| 60 | + client := NewClient(Devnet, testRPC, testWS) |
| 61 | + products, _ := client.GetAllProductKeys(context.TODO()) |
| 62 | + // Print first 5 product account pubkeys. |
| 63 | + for _, key := range products[:5] { |
| 64 | + fmt.Println(key) |
| 65 | + } |
| 66 | + // Output: |
| 67 | + // 89GseEmvNkzAMMEXcW9oTYzqRPXTsJ3BmNerXmgA1osV |
| 68 | + // JCnD5WiurZfoeVPEi2AXVgacg73Wd2iRDDjZDbSwdr9D |
| 69 | + // G89jkM5wFLpmnbvRbeePUumxsJyzoXaRfgBVjyx2CPzQ |
| 70 | + // GaBJpKtnyUbyKe34XuyegR7W98a9PT5cg985G974NY8R |
| 71 | + // Fwosgw2ikRvdzgKcQJwMacyczk3nXgoW3AtVtyVvXSAb |
| 72 | +} |
| 73 | + |
37 | 74 | func ExampleClient_GetAllProducts() { |
38 | 75 | client := NewClient(Devnet, testRPC, testWS) |
39 | 76 | products, _ := client.GetAllProducts(context.TODO()) |
|
0 commit comments