-
Notifications
You must be signed in to change notification settings - Fork 6
/
contract.go
50 lines (45 loc) · 2.62 KB
/
contract.go
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
package opensea
import (
"context"
"encoding/json"
"fmt"
)
type Contract struct {
Collection Collection `json:"collection" bson:"collection"`
Address Address `json:"address" bson:"address"`
AssetContractType string `json:"asset_contract_type" bson:"asset_contract_type"`
CreatedDate string `json:"created_date" bson:"created_date"`
Name string `json:"name" bson:"name"`
NFTVersion string `json:"nft_version" bson:"nft_version"`
OpenseaVersion interface{} `json:"opensea_version" bson:"opensea_version"`
Owner int64 `json:"owner" bson:"owner"`
SchemaName string `json:"schema_name" bson:"schema_name"`
Symbol string `json:"symbol" bson:"symbol"`
TotalSupply interface{} `json:"total_supply" bson:"total_supply"`
Description string `json:"description" bson:"description"`
ExternalLink string `json:"external_link" bson:"external_link"`
ImageURL string `json:"image_url" bson:"image_url"`
DefaultToFiat bool `json:"default_to_fiat" bson:"default_to_fiat"`
DevBuyerFeeBasisPoints int64 `json:"dev_buyer_fee_basis_points" bson:"dev_buyer_fee_basis_points"`
DevSellerFeeBasisPoints int64 `json:"dev_seller_fee_basis_points" bson:"dev_seller_fee_basis_points"`
OnlyProxiedTransfers bool `json:"only_proxied_transfers" bson:"only_proxied_transfers"`
OpenseaBuyerFeeBasisPoints int64 `json:"opensea_buyer_fee_basis_points" bson:"opensea_buyer_fee_basis_points"`
OpenseaSellerFeeBasisPoints int64 `json:"opensea_seller_fee_basis_points" bson:"opensea_seller_fee_basis_points"`
BuyerFeeBasisPoints int64 `json:"buyer_fee_basis_points" bson:"buyer_fee_basis_points"`
SellerFeeBasisPoints int64 `json:"seller_fee_basis_points" bson:"seller_fee_basis_points"`
PayoutAddress Address `json:"payout_address" bson:"payout_address"`
}
func (o Opensea) GetSingleContract(assetContractAddress string) (*Contract, error) {
ctx := context.TODO()
return o.GetSingleContractWithContext(ctx, assetContractAddress)
}
func (o Opensea) GetSingleContractWithContext(ctx context.Context, assetContractAddress string) (contract *Contract, err error) {
path := fmt.Sprintf("%s/%s", singleContractEndpoint, assetContractAddress)
b, err := o.GetPath(ctx, path)
if err != nil {
return nil, err
}
contract = &Contract{}
err = json.Unmarshal(b, contract)
return
}