Skip to content

Commit

Permalink
feat: implement GetPolicyAssetMints
Browse files Browse the repository at this point in the history
Signed-off-by: Marko Kungla <marko@mkungla.dev>
  • Loading branch information
mkungla committed Mar 30, 2024
1 parent 353ba4b commit fa9118d
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,23 @@ type (
Response
Data []UTxO `json:"data"`
}

PolicyAssetMintsResponse struct {
Response
Data []PolicyAssetMint `json:"data"`
}

PolicyAssetMint struct {
AssetName AssetName `json:"asset_name"`
AssetNameASCII string `json:"asset_name_ascii"`
Fingerprint AssetFingerprint `json:"fingerprint"`
MintingTxHash TxHash `json:"minting_tx_hash"`
TotalSupply decimal.Decimal `json:"total_supply"`
MintCNT uint `json:"mint_cnt"`
BurnCNT uint `json:"burn_cnt"`
CreationTime Timestamp `json:"creation_time"`
Decimals uint8 `json:"decimals"`
}
)

// String returns AssetName as string.
Expand Down Expand Up @@ -536,3 +553,24 @@ func (c *Client) GetPolicyAssetAddresses(

return
}

func (c *Client) GetPolicyAssetMints(
ctx context.Context,
policy PolicyID,
opts *RequestOptions,
) (res *PolicyAssetMintsResponse, err error) {
res = &PolicyAssetMintsResponse{}

if opts == nil {
opts = c.NewRequestOptions()
}
opts.QuerySet("_asset_policy", policy.String())

rsp, err := c.request(ctx, &res.Response, "GET", "/policy_asset_mints", nil, opts)
if err != nil {
return
}

err = ReadAndUnmarshalResponse(rsp, &res.Response, &res.Data)
return
}

0 comments on commit fa9118d

Please sign in to comment.