diff --git a/README.md b/README.md index c906fb9..b54130f 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ The default is to read from a send.json file in the current directory, but this ## JSON Configuration The application also accepts a JSON configuration file as input. Here is an example configuration file with all possible options shown. Any value left out is assumed 'false' or 0. -Some of these options are conflicting to be specified together. +Some of these options conflict with eachother if specified together. ```json { @@ -105,6 +105,7 @@ Some of these options are conflicting to be specified together. "count": 100, "onlyRoots": false }, + "verifiedRequirements": ["twitter", "caAlgo"], "sendToVaults": true } } @@ -124,6 +125,8 @@ Some of these options are conflicting to be specified together. - `count`: If specified, this is the number of NFDS to choose randomly from the total list. ie: All segments of root X, but only pick 100 random recipients by specifying a count here. - `onlyRoots`: Determines whether only root NFDs are allowed. - Only applicable if segmentsOfRoot isn't specified - if left off then ALL nfds are chosen. If specified, only select roots. +- `verifiedRequirements`: An optional array of verified field names. If specified, the destination NFD must have ALL of the specified verified fields. + - The field names are case-sensitive. All should be lowercase, but caAlgo is special and is the verified list of algorand addresses. - `sendToVaults`: Determines whether to send to vaults. - This is a key option and for most 'aidrops' should be chosen. The recipient doesn't have to be opted-in before-hand. As the sender you have to pay the .1 MBR fee per asset (only if their vault isn't already opted-in). diff --git a/lib/nfdapi/swagger/README.md b/lib/nfdapi/swagger/README.md index 8e88940..0196fe5 100644 --- a/lib/nfdapi/swagger/README.md +++ b/lib/nfdapi/swagger/README.md @@ -40,7 +40,6 @@ Class | Method | HTTP request | Description *NfdApi* | [**NfdEscrowOffer**](docs/NfdApi.md#nfdescrowoffer) | **Post** /nfd/escrowOffer/{name} | escrowOffer nfd *NfdApi* | [**NfdGetLookup**](docs/NfdApi.md#nfdgetlookup) | **Get** /nfd/lookup | Reverse Address lookup with results returned per address *NfdApi* | [**NfdGetNFD**](docs/NfdApi.md#nfdgetnfd) | **Get** /nfd/{nameOrID} | Get a specific NFD by name or by its application ID -*NfdApi* | [**NfdGetNFDsForAddresses**](docs/NfdApi.md#nfdgetnfdsforaddresses) | **Get** /nfd/address | [DEPRECATED] Reverse Address lookup *NfdApi* | [**NfdGetNFDsForAddressesV2**](docs/NfdApi.md#nfdgetnfdsforaddressesv2) | **Get** /nfd/v2/address | Reverse Address lookup with results returned per address *NfdApi* | [**NfdGetNameSig**](docs/NfdApi.md#nfdgetnamesig) | **Get** /nfd/nameSig/{name} | getNameSig nfd *NfdApi* | [**NfdGetOpenAuctions**](docs/NfdApi.md#nfdgetopenauctions) | **Get** /nfd/auction | Get all open auctions or those open for a particular name @@ -50,7 +49,6 @@ Class | Method | HTTP request | Description *NfdApi* | [**NfdKickoff**](docs/NfdApi.md#nfdkickoff) | **Post** /nfd/kickoff | kickoff nfd *NfdApi* | [**NfdLinkAddress**](docs/NfdApi.md#nfdlinkaddress) | **Post** /nfd/links/addAddress/{name} | linkAddress nfd *NfdApi* | [**NfdOffer**](docs/NfdApi.md#nfdoffer) | **Post** /nfd/offer/{name} | offer nfd -*NfdApi* | [**NfdPartnerKickoff**](docs/NfdApi.md#nfdpartnerkickoff) | **Post** /nfd/partnerKickoff | partnerKickoff nfd *NfdApi* | [**NfdPostOfferToOwner**](docs/NfdApi.md#nfdpostoffertoowner) | **Post** /nfd/postOfferToOwner/{name} | postOfferToOwner nfd *NfdApi* | [**NfdPurchase**](docs/NfdApi.md#nfdpurchase) | **Post** /nfd/purchase/{name} | purchase nfd *NfdApi* | [**NfdRescindOffer**](docs/NfdApi.md#nfdrescindoffer) | **Post** /nfd/rescindOffer/{name} | rescindOffer nfd @@ -99,7 +97,6 @@ Class | Method | HTTP request | Description - [NfdRecordinaddress](docs/NfdRecordinaddress.md) - [NfdV2SearchRecords](docs/NfdV2SearchRecords.md) - [OfferRequestBody](docs/OfferRequestBody.md) - - [PartnerKickoffRequestBody](docs/PartnerKickoffRequestBody.md) - [PostOfferToOwnerRequestBody](docs/PostOfferToOwnerRequestBody.md) - [PurchaseRequestBody](docs/PurchaseRequestBody.md) - [RateLimited](docs/RateLimited.md) diff --git a/lib/nfdapi/swagger/api_nfd.go b/lib/nfdapi/swagger/api_nfd.go index f05e84e..74de200 100644 --- a/lib/nfdapi/swagger/api_nfd.go +++ b/lib/nfdapi/swagger/api_nfd.go @@ -12,12 +12,11 @@ package swagger import ( "context" "fmt" + "github.com/antihax/optional" "io/ioutil" "net/http" "net/url" "strings" - - "github.com/antihax/optional" ) // Linger please @@ -35,7 +34,7 @@ Fetch change activity for an NFD, specifically general 'block-level' d * @param optional nil or *NfdApiNfdActivityOpts - Optional Parameters: * @param "Type_" (optional.String) - type of activity to retrieve * @param "AfterTime" (optional.Time) - Fetch events that occurred only after the specified time - * @param "Limit" (optional.Int32) - Limit the number of results returned, per NFD - max 50 + * @param "Limit" (optional.Int64) - Limit the number of results returned, per NFD - max 50 * @param "Sort" (optional.String) - What to sort on - descending timestamp is default * @param "IfNoneMatch" (optional.String) - etag @return []NfdActivity @@ -44,7 +43,7 @@ Fetch change activity for an NFD, specifically general 'block-level' d type NfdApiNfdActivityOpts struct { Type_ optional.String AfterTime optional.Time - Limit optional.Int32 + Limit optional.Int64 Sort optional.String IfNoneMatch optional.String } @@ -195,12 +194,12 @@ Fetch NFD analytics via various filters * @param "SaleType" (optional.Interface of []string) - * @param "Length" (optional.Interface of []string) - Length of NFD * @param "Traits" (optional.Interface of []string) - Traits of NFD - * @param "ParentAppID" (optional.Int32) - The parent NFD Application ID to find. Used for fetching segments of an NFD + * @param "ParentAppID" (optional.Int64) - The parent NFD Application ID to find. Used for fetching segments of an NFD * @param "MinPrice" (optional.Int64) - Minimum price of NFD * @param "MaxPrice" (optional.Int64) - Maximum price of NFD * @param "AfterTime" (optional.Time) - Fetch analytics events that occurred only after the specified time - * @param "Limit" (optional.Int32) - Limit the number of results returned - max 200 - * @param "Offset" (optional.Int32) - Starting document in large list. Fetch 1-100 [limit 100], pass offset 100 to fetch 100-200 + * @param "Limit" (optional.Int64) - Limit the number of results returned - max 200 + * @param "Offset" (optional.Int64) - Starting document in large list. Fetch 1-100 [limit 100], pass offset 100 to fetch 100-200 * @param "Sort" (optional.String) - What to sort on - descending timestamp is default * @param "IfNoneMatch" (optional.String) - etag @return NfdAnalyticRecords @@ -218,12 +217,12 @@ type NfdApiNfdAnalyticsOpts struct { SaleType optional.Interface Length optional.Interface Traits optional.Interface - ParentAppID optional.Int32 + ParentAppID optional.Int64 MinPrice optional.Int64 MaxPrice optional.Int64 AfterTime optional.Time - Limit optional.Int32 - Offset optional.Int32 + Limit optional.Int64 + Offset optional.Int64 Sort optional.String IfNoneMatch optional.String } @@ -533,7 +532,7 @@ NfdApiService Browse NFDs via various filters * @param "Category" (optional.Interface of []string) - * @param "SaleType" (optional.Interface of []string) - * @param "State" (optional.Interface of []string) - - * @param "ParentAppID" (optional.Int32) - The parent NFD Application ID to find. Used for fetching segments of an NFD + * @param "ParentAppID" (optional.Int64) - The parent NFD Application ID to find. Used for fetching segments of an NFD * @param "Length" (optional.Interface of []string) - Length of NFD * @param "Traits" (optional.Interface of []string) - Traits of NFD * @param "Owner" (optional.String) - An Algorand account address to find all NFDs owned by that address @@ -545,8 +544,8 @@ NfdApiService Browse NFDs via various filters * @param "MinPrice" (optional.Int64) - Minimum price of NFD * @param "MaxPrice" (optional.Int64) - Maximum price of NFD * @param "ChangedAfter" (optional.Time) - Fetch NFDs that changed after the specified timestamp - * @param "Limit" (optional.Int32) - Limit the number of results returned - max 200 - * @param "Offset" (optional.Int32) - Starting document in large list. Fetch 1-100 [limit 100], pass offset 100 to fetch 100-200 + * @param "Limit" (optional.Int64) - Limit the number of results returned - max 200 + * @param "Offset" (optional.Int64) - Starting document in large list. Fetch 1-100 [limit 100], pass offset 100 to fetch 100-200 * @param "Sort" (optional.String) - What to sort on * @param "View" (optional.String) - View of data to return, tiny (name, owner, caAlgo, unverifiedCaAlgo only), brief (default), or full * @param "IfNoneMatch" (optional.String) - etag @@ -558,7 +557,7 @@ type NfdApiNfdBrowseOpts struct { Category optional.Interface SaleType optional.Interface State optional.Interface - ParentAppID optional.Int32 + ParentAppID optional.Int64 Length optional.Interface Traits optional.Interface Owner optional.String @@ -570,8 +569,8 @@ type NfdApiNfdBrowseOpts struct { MinPrice optional.Int64 MaxPrice optional.Int64 ChangedAfter optional.Time - Limit optional.Int32 - Offset optional.Int32 + Limit optional.Int64 + Offset optional.Int64 Sort optional.String View optional.String IfNoneMatch optional.String @@ -2231,142 +2230,20 @@ func (a *NfdApiService) NfdGetNFD(ctx context.Context, nameOrID string, localVar return localVarReturnValue, localVarHttpResponse, nil } -/* -NfdApiService [DEPRECATED] Reverse Address lookup -[DEPRECATED] Get all NFDs which have been explicitly linked to one or more verified [or unverified] Algorand address(es). Unverified addresses will match but return as unverifiedCaAlgo array. These should be treated specially and not have the same trust level as verified addresses as they can be falsely attributed. The caAlgo array is what should be trusted for things like NFT creation addresses. For reverse lookups returning multiple NFDs, take the first one matching in caAlgo array. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param address one or more addresses to look up, maximum of 20 can be defined. Specify the same query parameter multiple times for each address, ie: address=xxx&address=yyy&address=zzz - * @param optional nil or *NfdApiNfdGetNFDsForAddressesOpts - Optional Parameters: - * @param "Limit" (optional.Int32) - Limit the total number of NFDs returned in aggregate across all specified addresses (default 40, max 300) - * @param "View" (optional.String) - View of data to return, tiny (name, owner, caAlgo, unverifiedCaAlgo only [default]), thumbnail (tiny + avatar), brief, or full - * @param "IfNoneMatch" (optional.String) - etag -@return []NfdRecord -*/ - -type NfdApiNfdGetNFDsForAddressesOpts struct { - Limit optional.Int32 - View optional.String - IfNoneMatch optional.String -} - -func (a *NfdApiService) NfdGetNFDsForAddresses(ctx context.Context, address []string, localVarOptionals *NfdApiNfdGetNFDsForAddressesOpts) ([]NfdRecord, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Get") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue []NfdRecord - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/nfd/address" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - if len(address) < 1 { - return localVarReturnValue, nil, reportError("address must have at least 1 elements") - } - if len(address) > 20 { - return localVarReturnValue, nil, reportError("address must have less than 20 elements") - } - - localVarQueryParams.Add("address", parameterToString(address, "multi")) - if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { - localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.View.IsSet() { - localVarQueryParams.Add("view", parameterToString(localVarOptionals.View.Value(), "")) - } - // to determine the Content-Type header - localVarHttpContentTypes := []string{} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/vnd.goa.error"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - if localVarOptionals != nil && localVarOptionals.IfNoneMatch.IsSet() { - localVarHeaderParams["if-none-match"] = parameterToString(localVarOptionals.IfNoneMatch.Value(), "") - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - if localVarHttpResponse.StatusCode == 200 { - var v []NfdRecord - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - if localVarHttpResponse.StatusCode == 429 { - var v RateLimited - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - /* NfdApiService Reverse Address lookup with results returned per address Get all NFDs which have been explicitly linked to one or more verified [or unverified] Algorand address(es). Unverified addresses will match but return as unverifiedCaAlgo array. These should be treated specially and not have the same trust level as verified addresses as they can be falsely attributed. The caAlgo array is what should be trusted for things like NFT creation addresses. For reverse lookups returning multiple NFDs, the first result should be used. * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param address one or more addresses (algo or otherwise) to look up, maximum of 20 can be defined. Specify the same query parameter multiple times for each address, ie: address=xxx&address=yyy&address=zzz * @param optional nil or *NfdApiNfdGetNFDsForAddressesV2Opts - Optional Parameters: - * @param "Limit" (optional.Int32) - Limit the total number of NFDs returned - automatically changed to at least be 1 per address + * @param "Limit" (optional.Int64) - Limit the total number of NFDs returned - automatically changed to at least be 1 per address * @param "View" (optional.String) - View of data to return, tiny (name, owner, caAlgo, unverifiedCaAlgo only [default]), thumbnail (tiny + avatar), brief, or full * @param "IfNoneMatch" (optional.String) - etag @return map[string][]NfdRecordinaddress */ type NfdApiNfdGetNFDsForAddressesV2Opts struct { - Limit optional.Int32 + Limit optional.Int64 View optional.String IfNoneMatch optional.String } @@ -2851,7 +2728,7 @@ Determines if specified NFD NFT ASA ID is authentic NFD @return IsValidAsaResponseBody */ -func (a *NfdApiService) NfdIsValidASA(ctx context.Context, asaID int32) (IsValidAsaResponseBody, *http.Response, error) { +func (a *NfdApiService) NfdIsValidASA(ctx context.Context, asaID int64) (IsValidAsaResponseBody, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} @@ -2968,7 +2845,7 @@ Determines if specified NFD Application ID is authentic @return IsValidNfdResponseBody */ -func (a *NfdApiService) NfdIsValidNFD(ctx context.Context, appID int32) (IsValidNfdResponseBody, *http.Response, error) { +func (a *NfdApiService) NfdIsValidNFD(ctx context.Context, appID int64) (IsValidNfdResponseBody, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} @@ -3477,134 +3354,6 @@ func (a *NfdApiService) NfdOffer(ctx context.Context, body OfferRequestBody, nam return localVarReturnValue, localVarHttpResponse, nil } -/* -NfdApiService partnerKickoff nfd -[PRIVATE] Kickoff NFD minting process, with user buying specified NFD (or kicking off auction) as appropriate. Purchase price is set by TxnLab - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @param body - -@return string -*/ -func (a *NfdApiService) NfdPartnerKickoff(ctx context.Context, body PartnerKickoffRequestBody) (string, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Post") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue string - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/nfd/partnerKickoff" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/vnd.goa.error"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - // body params - localVarPostBody = &body - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - if localVarHttpResponse.StatusCode == 201 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - if localVarHttpResponse.StatusCode == 400 { - var v ModelError - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - if localVarHttpResponse.StatusCode == 401 { - var v ModelError - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - if localVarHttpResponse.StatusCode == 404 { - var v ModelError - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - if localVarHttpResponse.StatusCode == 429 { - var v RateLimited - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - /* NfdApiService postOfferToOwner nfd Post an offer to buy to the owner of an NFD, offering up a particular amount with optional note for them to consider @@ -3985,7 +3734,7 @@ NfdApiService [DEPRECATED] Search for NFDs based on select lookup criteria * @param "Vproperty" (optional.String) - Verified property name to search on - specify value with vvalue * @param "Vvalue" (optional.String) - Value to find in the vproperty field specified with the vproperty parameter * @param "RequireAddresses" (optional.Bool) - Whether returned NFDs (only in prefix/substring search) must have linked addresses (caAlgo) defined in order to be returned. This is useful for callers wanting to lookup a name for the purposes of transferring assets to that NFD holder and they want to exclude names not linked for deposits. - * @param "Limit" (optional.Int32) - Limit the number of results returned - max 240 + * @param "Limit" (optional.Int64) - Limit the number of results returned - max 240 * @param "View" (optional.String) - View of data to return, tiny (name, owner, caAlgo, unverifiedCaAlgo only), thumbnail (tiny + avatar), (brief (default), or full * @param "Test00r" (optional.Bool) - * @param "IfNoneMatch" (optional.String) - etag @@ -4000,7 +3749,7 @@ type NfdApiNfdSearchV1Opts struct { Vproperty optional.String Vvalue optional.String RequireAddresses optional.Bool - Limit optional.Int32 + Limit optional.Int64 View optional.String Test00r optional.Bool IfNoneMatch optional.String @@ -4146,7 +3895,7 @@ Search NFDs via various filters * @param "Category" (optional.Interface of []string) - * @param "SaleType" (optional.Interface of []string) - * @param "State" (optional.Interface of []string) - - * @param "ParentAppID" (optional.Int32) - The parent NFD Application ID to find. Used for fetching segments of an NFD + * @param "ParentAppID" (optional.Int64) - The parent NFD Application ID to find. Used for fetching segments of an NFD * @param "Length" (optional.Interface of []string) - Length of NFD * @param "Traits" (optional.Interface of []string) - Traits of NFD * @param "Owner" (optional.String) - An Algorand account address to find all NFDs owned by that address @@ -4163,8 +3912,8 @@ Search NFDs via various filters * @param "MinPriceUsd" (optional.Int64) - Minimum price of NFD Segment in USD (cents) * @param "MaxPriceUsd" (optional.Int64) - Maximum price of NFD Segment in USD (cents) * @param "ChangedAfter" (optional.Time) - Fetch NFDs that changed after the specified timestamp - * @param "Limit" (optional.Int32) - Limit the number of results returned - max 200 - * @param "Offset" (optional.Int32) - Starting document in large list. Fetch 1-100 [limit 100], pass offset 100 to fetch 100-200 + * @param "Limit" (optional.Int64) - Limit the number of results returned - max 200 + * @param "Offset" (optional.Int64) - Starting document in large list. Fetch 1-100 [limit 100], pass offset 100 to fetch 100-200 * @param "Sort" (optional.String) - What to sort on * @param "View" (optional.String) - View of data to return, tiny (name, owner, caAlgo, unverifiedCaAlgo only), brief (default), or full * @param "IfNoneMatch" (optional.String) - etag @@ -4193,8 +3942,8 @@ type NfdApiNfdSearchV2Opts struct { MinPriceUsd optional.Int64 MaxPriceUsd optional.Int64 ChangedAfter optional.Time - Limit optional.Int32 - Offset optional.Int32 + Limit optional.Int64 + Offset optional.Int64 Sort optional.String View optional.String IfNoneMatch optional.String @@ -5321,14 +5070,14 @@ Suggest NFDs to purchase * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param name A name (even partial) to search for [receiving suggestions as well] * @param optional nil or *NfdApiNfdSuggestOpts - Optional Parameters: - * @param "Limit" (optional.Int32) - Limit the number of results returned - max 40 + * @param "Limit" (optional.Int64) - Limit the number of results returned - max 40 * @param "View" (optional.String) - View of data to return, brief (default), or full * @param "Buyer" (optional.String) - Expected buyer of name. Used for segment minting as additional check on availability of mint @return []NfdRecord */ type NfdApiNfdSuggestOpts struct { - Limit optional.Int32 + Limit optional.Int64 View optional.String Buyer optional.String } diff --git a/lib/nfdapi/swagger/model_consensus_record.go b/lib/nfdapi/swagger/model_consensus_record.go index 30a0b06..de4fd68 100644 --- a/lib/nfdapi/swagger/model_consensus_record.go +++ b/lib/nfdapi/swagger/model_consensus_record.go @@ -16,14 +16,14 @@ import ( // ConsensusRecord contains information about an account that participated in consensus type ConsensusRecord struct { Account string `json:"account"` - LastPropBlock int32 `json:"lastPropBlock,omitempty"` + LastPropBlock int64 `json:"lastPropBlock,omitempty"` LastPropTime time.Time `json:"lastPropTime,omitempty"` - LastVoteBlock int32 `json:"lastVoteBlock,omitempty"` + LastVoteBlock int64 `json:"lastVoteBlock,omitempty"` LastVoteTime time.Time `json:"lastVoteTime,omitempty"` LinkType string `json:"linkType,omitempty"` OwnerAccount string `json:"ownerAccount"` PctOfOnline float64 `json:"pctOfOnline"` - Proposals int32 `json:"proposals,omitempty"` + Proposals int64 `json:"proposals,omitempty"` Rank int64 `json:"rank,omitempty"` - Votes int32 `json:"votes,omitempty"` + Votes int64 `json:"votes,omitempty"` } diff --git a/lib/nfdapi/swagger/model_donation.go b/lib/nfdapi/swagger/model_donation.go index b3f0297..8eac033 100644 --- a/lib/nfdapi/swagger/model_donation.go +++ b/lib/nfdapi/swagger/model_donation.go @@ -14,5 +14,5 @@ type Donation struct { // Sender or Receiver Algorand address depending on request Address string `json:"address"` // Total donation in microAlgos - Total int32 `json:"total"` + Total int64 `json:"total"` } diff --git a/lib/nfdapi/swagger/model_escrow_offer_request_body.go b/lib/nfdapi/swagger/model_escrow_offer_request_body.go index 1dba202..9bab568 100644 --- a/lib/nfdapi/swagger/model_escrow_offer_request_body.go +++ b/lib/nfdapi/swagger/model_escrow_offer_request_body.go @@ -12,5 +12,5 @@ package swagger type EscrowOfferRequestBody struct { Buyer string `json:"buyer"` // Amount in microAlgo to escrow as new floor price - Offer int32 `json:"offer"` + Offer int64 `json:"offer"` } diff --git a/lib/nfdapi/swagger/model_is_valid_asa_response_body.go b/lib/nfdapi/swagger/model_is_valid_asa_response_body.go index 8563ede..7265810 100644 --- a/lib/nfdapi/swagger/model_is_valid_asa_response_body.go +++ b/lib/nfdapi/swagger/model_is_valid_asa_response_body.go @@ -11,7 +11,7 @@ package swagger // Whether NFD NFT ASA ID is for authentic NFD type IsValidAsaResponseBody struct { - AppID int32 `json:"appID"` + AppID int64 `json:"appID"` IsValid bool `json:"isValid"` Message string `json:"message"` Name string `json:"name"` diff --git a/lib/nfdapi/swagger/model_nfd.go b/lib/nfdapi/swagger/model_nfd.go index 8a758e1..b68737d 100644 --- a/lib/nfdapi/swagger/model_nfd.go +++ b/lib/nfdapi/swagger/model_nfd.go @@ -16,9 +16,9 @@ import ( // NFD contains all known information about an NFD record type Nfd struct { // NFD Application ID - AppID int32 `json:"appID,omitempty"` + AppID int64 `json:"appID,omitempty"` // NFD ASA ID - AsaID int32 `json:"asaID,omitempty"` + AsaID int64 `json:"asaID,omitempty"` // Whether the verified Avatar set in this NFD is newer (arc19) then is set into the NFD. This will only be present on direct NFD fetch and if true AvatarOutdated bool `json:"avatarOutdated,omitempty"` // Verified Algorand addresses for this NFD @@ -27,7 +27,7 @@ type Nfd struct { CacheControl string `json:"cache-control,omitempty"` Category string `json:"category,omitempty"` // Round this data was last fetched from - CurrentAsOfBlock int32 `json:"currentAsOfBlock,omitempty"` + CurrentAsOfBlock int64 `json:"currentAsOfBlock,omitempty"` // account wallets should send funds to - precedence is: caAlgo[0], unverifiedCaAlgo[0], owner DepositAccount string `json:"depositAccount,omitempty"` // ETag @@ -39,13 +39,13 @@ type Nfd struct { // Owner of NFD Owner string `json:"owner,omitempty"` // NFD Application ID of Parent if this is a segment - ParentAppID int32 `json:"parentAppID,omitempty"` + ParentAppID int64 `json:"parentAppID,omitempty"` Properties *NfdProperties `json:"properties,omitempty"` // Reserved owner of NFD ReservedFor string `json:"reservedFor,omitempty"` SaleType string `json:"saleType,omitempty"` // amount NFD is being sold for (microAlgos) - SellAmount int32 `json:"sellAmount,omitempty"` + SellAmount int64 `json:"sellAmount,omitempty"` // RecipientUid of NFD sales Seller string `json:"seller,omitempty"` SigNameAddress string `json:"sigNameAddress,omitempty"` diff --git a/lib/nfdapi/swagger/model_nfd_activity.go b/lib/nfdapi/swagger/model_nfd_activity.go index f3e8f88..23b0dcc 100644 --- a/lib/nfdapi/swagger/model_nfd_activity.go +++ b/lib/nfdapi/swagger/model_nfd_activity.go @@ -16,7 +16,7 @@ import ( // NFDActivity contains the property changes made in a particular NFD contract update call type NfdActivity struct { // Algorand Block number of change - Block int32 `json:"block"` + Block int64 `json:"block"` CacheControl string `json:"cache-control,omitempty"` // Changed properties Changes map[string]string `json:"changes,omitempty"` diff --git a/lib/nfdapi/swagger/model_nfd_analytic_event.go b/lib/nfdapi/swagger/model_nfd_analytic_event.go index d33a9aa..8bf8600 100644 --- a/lib/nfdapi/swagger/model_nfd_analytic_event.go +++ b/lib/nfdapi/swagger/model_nfd_analytic_event.go @@ -11,10 +11,10 @@ package swagger // NFDAnalyticEvent contains a price history record for a point in time of an NFD type NfdAnalyticEvent struct { - Block int32 `json:"block,omitempty"` + Block int64 `json:"block,omitempty"` Buyer string `json:"buyer,omitempty"` // extra amount paid to cover minimum balance requirements - add to price to determine total amount paid - CarryCost int32 `json:"carryCost,omitempty"` + CarryCost int64 `json:"carryCost,omitempty"` Category string `json:"category,omitempty"` // NFD current owner - if set via includeOwner property CurrentOwner string `json:"currentOwner,omitempty"` diff --git a/lib/nfdapi/swagger/model_nfd_analytic_record.go b/lib/nfdapi/swagger/model_nfd_analytic_record.go index adc97a1..c66d306 100644 --- a/lib/nfdapi/swagger/model_nfd_analytic_record.go +++ b/lib/nfdapi/swagger/model_nfd_analytic_record.go @@ -17,7 +17,7 @@ import ( type NfdAnalyticRecord struct { Data *NfdAnalyticEvent `json:"data,omitempty"` // price of event in microAlgos - Price int32 `json:"price,omitempty"` + Price int64 `json:"price,omitempty"` // price of event in USD PriceUsd float64 `json:"priceUsd,omitempty"` Timestamp time.Time `json:"timestamp,omitempty"` diff --git a/lib/nfdapi/swagger/model_nfd_analytic_records.go b/lib/nfdapi/swagger/model_nfd_analytic_records.go index 0064b28..754ccb3 100644 --- a/lib/nfdapi/swagger/model_nfd_analytic_records.go +++ b/lib/nfdapi/swagger/model_nfd_analytic_records.go @@ -14,5 +14,5 @@ type NfdAnalyticRecords struct { MatchCheck string `json:"match-check,omitempty"` Results []NfdAnalyticRecord `json:"results"` // total number of results, with data containing paged amount based on offset/limit - Total int32 `json:"total"` + Total int64 `json:"total"` } diff --git a/lib/nfdapi/swagger/model_nfd_auction.go b/lib/nfdapi/swagger/model_nfd_auction.go index 87e740c..57373be 100644 --- a/lib/nfdapi/swagger/model_nfd_auction.go +++ b/lib/nfdapi/swagger/model_nfd_auction.go @@ -15,15 +15,15 @@ import ( type NfdAuction struct { // Price in microAlgos - CeilingPrice int32 `json:"ceilingPrice"` + CeilingPrice int64 `json:"ceilingPrice"` // Price in microAlgos - CurrentPrice int32 `json:"currentPrice,omitempty"` + CurrentPrice int64 `json:"currentPrice,omitempty"` EndTime time.Time `json:"endTime"` // Price in microAlgos - FloorPrice int32 `json:"floorPrice"` + FloorPrice int64 `json:"floorPrice"` Name string `json:"name"` NewEndTime time.Time `json:"newEndTime,omitempty"` // Escrowed floor price in microAlgos - NewFloorPrice int32 `json:"newFloorPrice,omitempty"` + NewFloorPrice int64 `json:"newFloorPrice,omitempty"` StartTime time.Time `json:"startTime"` } diff --git a/lib/nfdapi/swagger/model_nfd_auction_and_price.go b/lib/nfdapi/swagger/model_nfd_auction_and_price.go index 51c8483..b6c0e3c 100644 --- a/lib/nfdapi/swagger/model_nfd_auction_and_price.go +++ b/lib/nfdapi/swagger/model_nfd_auction_and_price.go @@ -12,11 +12,11 @@ package swagger type NfdAuctionAndPrice struct { AuctionInfo *NfdAuction `json:"auctionInfo"` // Change in price per minute - ChangePerMinute int32 `json:"changePerMinute,omitempty"` + ChangePerMinute int64 `json:"changePerMinute,omitempty"` // Minutes elapsed so far in Auction ElapsedMinutes int64 `json:"elapsedMinutes,omitempty"` // Current price in microAlgos - Price int32 `json:"price,omitempty"` + Price int64 `json:"price,omitempty"` // Total number of minutes in Auction TotalMinutes int64 `json:"totalMinutes,omitempty"` } diff --git a/lib/nfdapi/swagger/model_nfd_record.go b/lib/nfdapi/swagger/model_nfd_record.go index a482a39..38918e9 100644 --- a/lib/nfdapi/swagger/model_nfd_record.go +++ b/lib/nfdapi/swagger/model_nfd_record.go @@ -24,7 +24,7 @@ type NfdRecord struct { CaAlgo []string `json:"caAlgo,omitempty"` Category string `json:"category,omitempty"` // Round this data was last fetched from - CurrentAsOfBlock int32 `json:"currentAsOfBlock,omitempty"` + CurrentAsOfBlock int64 `json:"currentAsOfBlock,omitempty"` // account wallets should send funds to - precedence is: caAlgo[0], unverifiedCaAlgo[0], owner DepositAccount string `json:"depositAccount,omitempty"` // Not returned, used in tagging for response to indicate if-none-match etag matched @@ -36,13 +36,13 @@ type NfdRecord struct { // Owner of NFD Owner string `json:"owner,omitempty"` // NFD Application ID of Parent if this is a segment - ParentAppID int32 `json:"parentAppID,omitempty"` + ParentAppID int64 `json:"parentAppID,omitempty"` Properties *NfdProperties `json:"properties,omitempty"` // Reserved owner of NFD ReservedFor string `json:"reservedFor,omitempty"` SaleType string `json:"saleType,omitempty"` // amount NFD is being sold for (microAlgos) - SellAmount int32 `json:"sellAmount,omitempty"` + SellAmount int64 `json:"sellAmount,omitempty"` // RecipientUid of NFD sales Seller string `json:"seller,omitempty"` SigNameAddress string `json:"sigNameAddress,omitempty"` diff --git a/lib/nfdapi/swagger/model_nfd_record_response_full.go b/lib/nfdapi/swagger/model_nfd_record_response_full.go index 38de796..d28e100 100644 --- a/lib/nfdapi/swagger/model_nfd_record_response_full.go +++ b/lib/nfdapi/swagger/model_nfd_record_response_full.go @@ -16,9 +16,9 @@ import ( // NFD contains all known information about an NFD record (full view) type NfdRecordResponseFull struct { // NFD Application ID - AppID int32 `json:"appID,omitempty"` + AppID int64 `json:"appID,omitempty"` // NFD ASA ID - AsaID int32 `json:"asaID,omitempty"` + AsaID int64 `json:"asaID,omitempty"` // Whether the verified Avatar set in this NFD is newer (arc19) then is set into the NFD. This will only be present on direct NFD fetch and if true AvatarOutdated bool `json:"avatarOutdated,omitempty"` // Verified Algorand addresses for this NFD @@ -27,7 +27,7 @@ type NfdRecordResponseFull struct { CacheControl string `json:"cache-control,omitempty"` Category string `json:"category,omitempty"` // Round this data was last fetched from - CurrentAsOfBlock int32 `json:"currentAsOfBlock,omitempty"` + CurrentAsOfBlock int64 `json:"currentAsOfBlock,omitempty"` // account wallets should send funds to - precedence is: caAlgo[0], unverifiedCaAlgo[0], owner DepositAccount string `json:"depositAccount,omitempty"` // ETag @@ -41,13 +41,13 @@ type NfdRecordResponseFull struct { // Owner of NFD Owner string `json:"owner,omitempty"` // NFD Application ID of Parent if this is a segment - ParentAppID int32 `json:"parentAppID,omitempty"` + ParentAppID int64 `json:"parentAppID,omitempty"` Properties *NfdProperties `json:"properties,omitempty"` // Reserved owner of NFD ReservedFor string `json:"reservedFor,omitempty"` SaleType string `json:"saleType,omitempty"` // amount NFD is being sold for (microAlgos) - SellAmount int32 `json:"sellAmount,omitempty"` + SellAmount int64 `json:"sellAmount,omitempty"` // RecipientUid of NFD sales Seller string `json:"seller,omitempty"` SigNameAddress string `json:"sigNameAddress,omitempty"` diff --git a/lib/nfdapi/swagger/model_nfd_recordinaddress.go b/lib/nfdapi/swagger/model_nfd_recordinaddress.go index 5c0ef4f..67e6224 100644 --- a/lib/nfdapi/swagger/model_nfd_recordinaddress.go +++ b/lib/nfdapi/swagger/model_nfd_recordinaddress.go @@ -16,9 +16,9 @@ import ( // NFD contains all known information about an NFD record type NfdRecordinaddress struct { // NFD Application ID - AppID int32 `json:"appID,omitempty"` + AppID int64 `json:"appID,omitempty"` // NFD ASA ID - AsaID int32 `json:"asaID,omitempty"` + AsaID int64 `json:"asaID,omitempty"` // Whether the verified Avatar set in this NFD is newer (arc19) then is set into the NFD. This will only be present on direct NFD fetch and if true AvatarOutdated bool `json:"avatarOutdated,omitempty"` // Verified Algorand addresses for this NFD @@ -27,7 +27,7 @@ type NfdRecordinaddress struct { CacheControl string `json:"cache-control,omitempty"` Category string `json:"category,omitempty"` // Round this data was last fetched from - CurrentAsOfBlock int32 `json:"currentAsOfBlock,omitempty"` + CurrentAsOfBlock int64 `json:"currentAsOfBlock,omitempty"` // account wallets should send funds to - precedence is: caAlgo[0], unverifiedCaAlgo[0], owner DepositAccount string `json:"depositAccount,omitempty"` // ETag @@ -41,13 +41,13 @@ type NfdRecordinaddress struct { // Owner of NFD Owner string `json:"owner,omitempty"` // NFD Application ID of Parent if this is a segment - ParentAppID int32 `json:"parentAppID,omitempty"` + ParentAppID int64 `json:"parentAppID,omitempty"` Properties *NfdProperties `json:"properties,omitempty"` // Reserved owner of NFD ReservedFor string `json:"reservedFor,omitempty"` SaleType string `json:"saleType,omitempty"` // amount NFD is being sold for (microAlgos) - SellAmount int32 `json:"sellAmount,omitempty"` + SellAmount int64 `json:"sellAmount,omitempty"` // RecipientUid of NFD sales Seller string `json:"seller,omitempty"` SigNameAddress string `json:"sigNameAddress,omitempty"` diff --git a/lib/nfdapi/swagger/model_nfd_v2_search_records.go b/lib/nfdapi/swagger/model_nfd_v2_search_records.go index 479f865..80a4b3c 100644 --- a/lib/nfdapi/swagger/model_nfd_v2_search_records.go +++ b/lib/nfdapi/swagger/model_nfd_v2_search_records.go @@ -14,5 +14,5 @@ type NfdV2SearchRecords struct { MatchCheck string `json:"match-check,omitempty"` Nfds *[]NfdRecord `json:"nfds"` // total number of results, with data containing paged amount based on offset/limit - Total int32 `json:"total"` + Total int64 `json:"total"` } diff --git a/lib/nfdapi/swagger/model_offer_request_body.go b/lib/nfdapi/swagger/model_offer_request_body.go index 70e34ec..95ffbf6 100644 --- a/lib/nfdapi/swagger/model_offer_request_body.go +++ b/lib/nfdapi/swagger/model_offer_request_body.go @@ -11,7 +11,7 @@ package swagger type OfferRequestBody struct { // Amount in microAlgo to sell the NFD for. 1 ALGO is 1,000,000 microAlgo. 1 ALGO minimum, 100 million maximum. - Offer int32 `json:"offer"` + Offer int64 `json:"offer"` // Whether to pay the offer amount + fees to the account the NFD is reserved for. Equivalent to 'gifting' the NFD PayReceiver bool `json:"payReceiver,omitempty"` ReservedFor string `json:"reservedFor,omitempty"` diff --git a/lib/nfdapi/swagger/model_partner_kickoff_request_body.go b/lib/nfdapi/swagger/model_partner_kickoff_request_body.go deleted file mode 100644 index cc2327d..0000000 --- a/lib/nfdapi/swagger/model_partner_kickoff_request_body.go +++ /dev/null @@ -1,17 +0,0 @@ -/* - * NFD Management Service - * - * Service for querying and managing NFDs - * - * API version: 1.0 - * Contact: feedback@txnlab.dev - * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) - */ -package swagger - -type PartnerKickoffRequestBody struct { - Buyer string `json:"buyer"` - // a convenience fee percentage to add 'on top' of the NFD price - 10 is 1%, 150 is 15% - ConveniencePct int64 `json:"conveniencePct,omitempty"` - Name string `json:"name"` -} diff --git a/lib/nfdapi/swagger/model_post_offer_to_owner_request_body.go b/lib/nfdapi/swagger/model_post_offer_to_owner_request_body.go index c2becd8..8ff7917 100644 --- a/lib/nfdapi/swagger/model_post_offer_to_owner_request_body.go +++ b/lib/nfdapi/swagger/model_post_offer_to_owner_request_body.go @@ -13,6 +13,6 @@ type PostOfferToOwnerRequestBody struct { // Note to pass along to the NFD owner. Must be provided but can be blank Note string `json:"note"` // Amount in microAlgo being offered to the NFD owner - Offer int32 `json:"offer"` + Offer int64 `json:"offer"` Sender string `json:"sender"` } diff --git a/lib/nfdapi/swagger/model_purchase_request_body.go b/lib/nfdapi/swagger/model_purchase_request_body.go index 0b45cfe..b64ced5 100644 --- a/lib/nfdapi/swagger/model_purchase_request_body.go +++ b/lib/nfdapi/swagger/model_purchase_request_body.go @@ -12,7 +12,7 @@ package swagger type PurchaseRequestBody struct { Buyer string `json:"buyer"` // Amount in microAlgo to purchase/claim the NFD for - Offer int32 `json:"offer"` + Offer int64 `json:"offer"` // Whether to reject receiving the NFT into the purchasers account, leaving or returning it to the NFDs vault instead RejectNFT bool `json:"rejectNFT,omitempty"` } diff --git a/lib/nfdapi/swagger/model_segment_lock_request_body.go b/lib/nfdapi/swagger/model_segment_lock_request_body.go index 7fe7082..509985e 100644 --- a/lib/nfdapi/swagger/model_segment_lock_request_body.go +++ b/lib/nfdapi/swagger/model_segment_lock_request_body.go @@ -13,7 +13,7 @@ type SegmentLockRequestBody struct { // Whether to lock (true), or unlock (false) Lock bool `json:"lock"` // amount users minting off the segment have to pay to mint in USD (in cents - ie: 300 = $3.00). Set to 0 if locking - SellAmount int32 `json:"sellAmount"` + SellAmount int64 `json:"sellAmount"` // Sender of transaction - needs to be owner of NFD Sender string `json:"sender"` } diff --git a/lib/nfdapi/swagger/model_segment_price_response_body.go b/lib/nfdapi/swagger/model_segment_price_response_body.go index fdd5acb..720d017 100644 --- a/lib/nfdapi/swagger/model_segment_price_response_body.go +++ b/lib/nfdapi/swagger/model_segment_price_response_body.go @@ -14,13 +14,13 @@ type SegmentPriceResponseBody struct { // Price of ALGO in USD AlgoUsd float64 `json:"algoUsd"` // Algorand carry cost - amount required for MBR (Minimum Balance Requirement) of contracts, escrows, etc - CarryCost int32 `json:"carryCost"` + CarryCost int64 `json:"carryCost"` // Discount rate % that is applied for this segment name - 0 if discount point not reached - starting after 2500 NFDs DiscountRate float64 `json:"discountRate"` // Number of segments minted off of parent NFD - ParentSegmentCount int32 `json:"parentSegmentCount"` + ParentSegmentCount int64 `json:"parentSegmentCount"` // Total Price in microAlgo to mint including ALGO carry cost - SellAmount int32 `json:"sellAmount"` + SellAmount int64 `json:"sellAmount"` // Price in USD for unlocked mint of this segment UnlockedSellPrice float64 `json:"unlockedSellPrice,omitempty"` // Minimum price in USD the segment has to be (not including ALGO carry cost). If locked, the fixed price, or if unlocked, the platform price diff --git a/lib/nfdapi/swagger/model_send_from_vault_request_body.go b/lib/nfdapi/swagger/model_send_from_vault_request_body.go index bd72fa3..6dd2cbd 100644 --- a/lib/nfdapi/swagger/model_send_from_vault_request_body.go +++ b/lib/nfdapi/swagger/model_send_from_vault_request_body.go @@ -11,9 +11,9 @@ package swagger type SendFromVaultRequestBody struct { // Base amount (in base units of specified asset - so decimals must be considered) of asset to send. If multiple assets are specified, amount is should be 0 as ALL of each are sent and closed out - Amount uint64 `json:"amount"` + Amount int64 `json:"amount"` // Algorand ASA IDs to transfer FROM vault - use asset 0 to send ALGO. Specifying multiple assets means ALL of each are sent and amount is ignored. If receiver is a vault and needs to opt-in, then need MBR/opt-in pairs (5 pairs - 8 opt-ins each - 40 assets), then 6 send calls of 7 assets w/ 5 at end for total of 40. If receiver is already opted-in, then 112 (7 per txn, 16 tnxs) is max. - Assets []uint64 `json:"assets"` + Assets []int64 `json:"assets"` // Optional note to include in asset send transaction Note string `json:"note,omitempty"` // Algorand account or NFD Name (if vault receiver) the asset(s) should be sent to diff --git a/lib/nfdapi/swagger/model_send_to_vault_request_body.go b/lib/nfdapi/swagger/model_send_to_vault_request_body.go index 3ff572e..3cc5180 100644 --- a/lib/nfdapi/swagger/model_send_to_vault_request_body.go +++ b/lib/nfdapi/swagger/model_send_to_vault_request_body.go @@ -11,9 +11,9 @@ package swagger type SendToVaultRequestBody struct { // Base amount (in base units of specified asset - so decimals must be considered) of asset to send. If multiple assets specified, amount is ignored and ALL of each are sent - Amount uint64 `json:"amount"` + Amount int64 `json:"amount"` // Algorand ASA IDs to transfer (and opt-in inside vault if necessary) - use asset 0 to send ALGO. Specifying multiple assets means ALL of each are sent and amount is ignored. 13 is max assets that can be specified if they're being sent (2 for MBR payments, 2 for opt-in txns (8+4 asset opt-ins), 12 asset transfers). If opt-in only then 64 is maximum (1 MBR per 8 assets, 8 assets per txn * 8 txns) - Assets []uint64 `json:"assets"` + Assets []int64 `json:"assets"` // Optional note to include in asset send transaction Note string `json:"note,omitempty"` // Whether to only opt-in to the asset, instead of including asset transfer txn diff --git a/lib/nfdapi/swagger/model_totals_ok_response_body.go b/lib/nfdapi/swagger/model_totals_ok_response_body.go index 2cf7f35..7b59e12 100644 --- a/lib/nfdapi/swagger/model_totals_ok_response_body.go +++ b/lib/nfdapi/swagger/model_totals_ok_response_body.go @@ -10,13 +10,13 @@ package swagger type TotalsOkResponseBody struct { - ForSale int32 `json:"forSale"` + ForSale int64 `json:"forSale"` // Not returned, used in tagging for response to indicate if-none-match etag matched MatchCheck string `json:"match-check,omitempty"` MintedTotals *TotalsOkResponseBodyMintedTotals `json:"mintedTotals"` SegmentTotals *TotalsOkResponseBodySegmentTotals `json:"segmentTotals"` SoldTotals *TotalsOkResponseBodySoldTotals `json:"soldTotals"` - Total int32 `json:"total"` - TotalSegments int32 `json:"totalSegments"` - UniqueOwners int32 `json:"uniqueOwners"` + Total int64 `json:"total"` + TotalSegments int64 `json:"totalSegments"` + UniqueOwners int64 `json:"uniqueOwners"` } diff --git a/lib/nfdapi/swagger/model_totals_ok_response_body_minted_totals.go b/lib/nfdapi/swagger/model_totals_ok_response_body_minted_totals.go index 58f26aa..a33ecf2 100644 --- a/lib/nfdapi/swagger/model_totals_ok_response_body_minted_totals.go +++ b/lib/nfdapi/swagger/model_totals_ok_response_body_minted_totals.go @@ -10,8 +10,8 @@ package swagger type TotalsOkResponseBodyMintedTotals struct { - Day int32 `json:"day,omitempty"` - Lifetime int32 `json:"lifetime,omitempty"` - Month int32 `json:"month,omitempty"` - Week int32 `json:"week,omitempty"` + Day int64 `json:"day,omitempty"` + Lifetime int64 `json:"lifetime,omitempty"` + Month int64 `json:"month,omitempty"` + Week int64 `json:"week,omitempty"` } diff --git a/lib/nfdapi/swagger/model_totals_ok_response_body_segment_totals.go b/lib/nfdapi/swagger/model_totals_ok_response_body_segment_totals.go index 01c2b07..02bd931 100644 --- a/lib/nfdapi/swagger/model_totals_ok_response_body_segment_totals.go +++ b/lib/nfdapi/swagger/model_totals_ok_response_body_segment_totals.go @@ -10,8 +10,8 @@ package swagger type TotalsOkResponseBodySegmentTotals struct { - Day int32 `json:"day,omitempty"` - Lifetime int32 `json:"lifetime,omitempty"` - Month int32 `json:"month,omitempty"` - Week int32 `json:"week,omitempty"` + Day int64 `json:"day,omitempty"` + Lifetime int64 `json:"lifetime,omitempty"` + Month int64 `json:"month,omitempty"` + Week int64 `json:"week,omitempty"` } diff --git a/lib/nfdapi/swagger/model_totals_ok_response_body_sold_totals.go b/lib/nfdapi/swagger/model_totals_ok_response_body_sold_totals.go index ed460ae..22d0b7d 100644 --- a/lib/nfdapi/swagger/model_totals_ok_response_body_sold_totals.go +++ b/lib/nfdapi/swagger/model_totals_ok_response_body_sold_totals.go @@ -10,8 +10,8 @@ package swagger type TotalsOkResponseBodySoldTotals struct { - Day int32 `json:"day,omitempty"` - Lifetime int32 `json:"lifetime,omitempty"` - Month int32 `json:"month,omitempty"` - Week int32 `json:"week,omitempty"` + Day int64 `json:"day,omitempty"` + Lifetime int64 `json:"lifetime,omitempty"` + Month int64 `json:"month,omitempty"` + Week int64 `json:"week,omitempty"` } diff --git a/lib/nfdapi/swagger/model_twitter_record.go b/lib/nfdapi/swagger/model_twitter_record.go index cf36e00..aa11877 100644 --- a/lib/nfdapi/swagger/model_twitter_record.go +++ b/lib/nfdapi/swagger/model_twitter_record.go @@ -15,10 +15,10 @@ import ( // TwitterRecord contains information about an NFD w/ Verified Twitter account and basic info on its twitter metrics type TwitterRecord struct { - Followers int32 `json:"followers"` - Following int32 `json:"following"` + Followers int64 `json:"followers"` + Following int64 `json:"following"` Nfd *Nfd `json:"nfd"` TimeChanged time.Time `json:"timeChanged"` - Tweets int32 `json:"tweets"` + Tweets int64 `json:"tweets"` TwitterHandle string `json:"twitterHandle"` } diff --git a/main.go b/main.go index 4ba9538..d693fbe 100644 --- a/main.go +++ b/main.go @@ -74,7 +74,7 @@ func main() { sourceAccount, _ = types.DecodeAddress(vaultNfd.NfdAccount) } - // Collect set of assets to send so we can determine distribution + // Collect set of assets to send, so we can determine distribution assetsToSend, err := fetchAssets(sendConfig) if err != nil { log.Fatalln(err) @@ -187,9 +187,9 @@ func initSigner(sender string) { flag.Usage() log.Fatalln("You must specify a sender account!") } - if !signer.HasAccount(sender) { - log.Fatalf("The sender account:%s has no mnemonics specified.", sender) - } + //if !signer.HasAccount(sender) { + // log.Fatalf("The sender account:%s has no mnemonics specified.", sender) + //} } func initClients(network string) { diff --git a/nfd-helpers.go b/nfd-helpers.go index d4e4612..f02ea3f 100644 --- a/nfd-helpers.go +++ b/nfd-helpers.go @@ -87,23 +87,27 @@ func retryNfdApiCalls(meth func() error) error { ) } -func getAllNfds(onlyRoots bool, requireVaults bool) ([]*nfdapi.NfdRecord, error) { +func getAllNfds(config *BatchSendConfig) ([]*nfdapi.NfdRecord, error) { var ( - offset, limit int32 = 0, 200 + offset, limit int64 = 0, 200 fetchedNfds nfdapi.NfdV2SearchRecords err error nfds []*nfdapi.NfdRecord ) for ; ; offset += limit { + view := "brief" + if len(config.Destination.VerifiedRequirements) > 0 { + view = "full" + } err = retryNfdApiCalls(func() error { searchOpts := &nfdapi.NfdApiNfdSearchV2Opts{ State: optional.NewInterface("owned"), - View: optional.NewString("brief"), - Limit: optional.NewInt32(limit), - Offset: optional.NewInt32(offset), + View: optional.NewString(view), + Limit: optional.NewInt64(limit), + Offset: optional.NewInt64(offset), } - if onlyRoots { + if config.Destination.RandomNFDs.OnlyRoots { searchOpts.Traits = optional.NewInterface("pristine") } fetchedNfds, _, err = api.NfdApi.NfdSearchV2(ctx, searchOpts) @@ -121,13 +125,6 @@ func getAllNfds(onlyRoots bool, requireVaults bool) ([]*nfdapi.NfdRecord, error) if nfd.DepositAccount == "" { continue } - if requireVaults { - // contract has to be at least 2.11 and not be locked for vault receipt - if !IsContractVersionAtLeast(nfd.Properties.Internal["ver"], 2, 11) || IsVaultAutoOptInLockedForSender(&nfd, types.ZeroAddress.String()) { - continue - } - } - newRecord := nfd nfds = append(nfds, &newRecord) } @@ -135,37 +132,42 @@ func getAllNfds(onlyRoots bool, requireVaults bool) ([]*nfdapi.NfdRecord, error) return nfds, nil } -func getSegmentsOfRoot(rootNfdName string, requireVaults bool) ([]*nfdapi.NfdRecord, error) { +func getSegmentsOfRoot(config *BatchSendConfig) ([]*nfdapi.NfdRecord, error) { // Fetch root NFD - all we really want is its app id - nfd, _, err := api.NfdApi.NfdGetNFD(ctx, rootNfdName, nil) + nfd, _, err := api.NfdApi.NfdGetNFD(ctx, config.Destination.SegmentsOfRoot, nil) if err != nil { log.Fatalln(err) } misc.Infof(logger, fmt.Sprintf("nfd app id for %s is:%v", nfd.Name, nfd.AppID)) - nfds, err := getAllSegments(ctx, nfd.AppID, requireVaults) + nfds, err := getAllSegments(ctx, config, nfd.AppID) if err != nil { log.Fatalln(err) } - logger.Debug(fmt.Sprintf("fetched segments of root:%s, count:%d", rootNfdName, len(nfds))) + logger.Debug(fmt.Sprintf("fetched segments of root:%s, count:%d", config.Destination.SegmentsOfRoot, len(nfds))) return nfds, nil } -func getAllSegments(ctx context.Context, parentAppID int64, requireVaults bool) ([]*nfdapi.NfdRecord, error) { +func getAllSegments(ctx context.Context, config *BatchSendConfig, parentAppID int64) ([]*nfdapi.NfdRecord, error) { var ( - offset, limit int32 = 0, 200 + offset, limit int64 = 0, 200 records nfdapi.NfdV2SearchRecords err error nfds []*nfdapi.NfdRecord ) for ; ; offset += limit { + view := "brief" + if len(config.Destination.VerifiedRequirements) > 0 { + view = "full" + } err = retryNfdApiCalls(func() error { records, _, err = api.NfdApi.NfdSearchV2(ctx, &nfdapi.NfdApiNfdSearchV2Opts{ ParentAppID: optional.NewInt64(parentAppID), State: optional.NewInterface("owned"), - Limit: optional.NewInt32(limit), - Offset: optional.NewInt32(offset), + View: optional.NewString(view), + Limit: optional.NewInt64(limit), + Offset: optional.NewInt64(offset), }) return err }) @@ -181,12 +183,6 @@ func getAllSegments(ctx context.Context, parentAppID int64, requireVaults bool) if record.DepositAccount == "" { continue } - if requireVaults { - // contract has to be at least 2.11 and not be locked for vault receipt - if !IsContractVersionAtLeast(record.Properties.Internal["ver"], 2, 11) || record.Properties.Internal["vaultOptInLocked"] == "1" { - continue - } - } newRecord := record nfds = append(nfds, &newRecord) } @@ -219,8 +215,8 @@ func getAssetSendTxns(sender string, sendFromVaultName string, recipient string, encodedTxns, _, err = api.NfdApi.NfdSendFromVault( ctx, nfdapi.SendFromVaultRequestBody{ - Amount: amount, - Assets: []uint64{assetID}, + Amount: int64(amount), + Assets: []int64{int64(assetID)}, Receiver: recipient, ReceiverType: receiverType, Sender: sender, // owner address @@ -232,8 +228,8 @@ func getAssetSendTxns(sender string, sendFromVaultName string, recipient string, encodedTxns, _, err = api.NfdApi.NfdSendToVault( ctx, nfdapi.SendToVaultRequestBody{ - Amount: amount, - Assets: []uint64{assetID}, + Amount: int64(amount), + Assets: []int64{int64(assetID)}, Sender: sender, // owner address }, recipient, diff --git a/recips.go b/recips.go index 621767a..2cc256d 100644 --- a/recips.go +++ b/recips.go @@ -1,10 +1,13 @@ package main import ( + "fmt" "log" "math/rand" "sort" + "github.com/algorand/go-algorand-sdk/v2/types" + "github.com/TxnLab/batch-asset-send/lib/misc" nfdapi "github.com/TxnLab/batch-asset-send/lib/nfdapi/swagger" ) @@ -20,7 +23,7 @@ type Recipient struct { // If the number of recipients to pick is 0 or more than the number of available NFDs, it returns recipients from all NFDs. // Otherwise, it returns recipients from randomly selected NFDs. func collectRecipients(config *BatchSendConfig, sendingFromVault *nfdapi.NfdRecord) ([]*Recipient, error) { - nfdsToChooseFrom, err := getNFdsToChooseFrom(config) + nfdsToChooseFrom, err := getNfdsToChooseFrom(config) if err != nil { return nil, err } @@ -56,22 +59,86 @@ func sortByDepositAccount(recipients []*Recipient) { }) } -// getNFdsToChooseFrom retrieves the list of NfdRecord objects to choose from +// getNfdsToChooseFrom retrieves the list of NfdRecord objects to choose from // based on the provided BatchSendConfig. If the SegmentsOfRoot field is // specified in the DestinationChoice of the config, it fetches the segments of // the specified rootNfdName and returns them. It also checks if SendToVault is set // and ensures that choice is passed through to filter out ineligible vaults (NFDs not upgraded or vault locked) -func getNFdsToChooseFrom(config *BatchSendConfig) ([]*nfdapi.NfdRecord, error) { +func getNfdsToChooseFrom(config *BatchSendConfig) ([]*nfdapi.NfdRecord, error) { + var ( + nfdRecords []*nfdapi.NfdRecord + err error + ) if config.Destination.SegmentsOfRoot != "" { if config.Destination.RandomNFDs.OnlyRoots { log.Fatalln("configured to get segments of a root but then specified wanting only roots! This is an invalid configuration") } - return getSegmentsOfRoot(config.Destination.SegmentsOfRoot, config.Destination.SendToVaults) + nfdRecords, err = getSegmentsOfRoot(config) } else { - return getAllNfds(config.Destination.RandomNFDs.OnlyRoots, config.Destination.SendToVaults) + nfdRecords, err = getAllNfds(config) + } + if err != nil { + return nil, fmt.Errorf("error in getNfdsToChooseFrom: %w", err) + } + misc.Infof(logger, "..total of %d NFDs found before next filter step", len(nfdRecords)) + return filterNfds(config, nfdRecords) +} + +func filterNfds(config *BatchSendConfig, records []*nfdapi.NfdRecord) ([]*nfdapi.NfdRecord, error) { + // do any additional filtering here, if necessary + if len(config.Destination.VerifiedRequirements) == 0 { + return records, nil } + // Return only those nfds having ALL the specified verified requirements. + var ( + filteredRecords = make([]*nfdapi.NfdRecord, 0, len(records)) + vaultExcludedByVer int + vaultExcludedBecauseLocked int + verifiedExcluded int + ) + for _, nfd := range records { + if nfd.DepositAccount == "" { + continue + } + if config.Destination.SendToVaults { + var excluded bool + // contract has to be at least 2.11 and not be locked for vault receipt + if !IsContractVersionAtLeast(nfd.Properties.Internal["ver"], 2, 11) { + vaultExcludedByVer++ + excluded = true + } + if IsVaultAutoOptInLockedForSender(nfd, types.ZeroAddress.String()) { + vaultExcludedBecauseLocked++ + excluded = true + } + if excluded { + continue + } + } - return nil, nil + verifiedProps := nfd.Properties.Verified + if len(verifiedProps) > 0 { + verified := true + for _, requirement := range config.Destination.VerifiedRequirements { + if _, ok := verifiedProps[requirement]; !ok { + verified = false + break + } + } + if !verified { + verifiedExcluded++ + continue + } + } + filteredRecords = append(filteredRecords, nfd) + } + if vaultExcludedByVer > 0 || vaultExcludedBecauseLocked > 0 { + misc.Infof(logger, "..vault requirement excluded:%d [NOT UPGRADED], and %d [LOCKED]", vaultExcludedByVer, vaultExcludedBecauseLocked) + } + if verifiedExcluded > 0 { + misc.Infof(logger, "..filtered out %d NFDs due to verified requirements", verifiedExcluded) + } + return filteredRecords, nil } func getNumToPick(config *BatchSendConfig, nfdsToChooseFrom []*nfdapi.NfdRecord) int { diff --git a/sendconfiguration.go b/sendconfiguration.go index 13c6f36..528d553 100644 --- a/sendconfiguration.go +++ b/sendconfiguration.go @@ -24,6 +24,9 @@ type DestinationChoice struct { SendToVaults bool `json:"sendToVaults"` + // Only send if v.XXXX is present in NFD (ie: verifiedRequirements: ["twitter"] would require v.twitter to be set) + VerifiedRequirements []string `json:"verifiedRequirements,omitempty"` + // If user w/ single account owns 10 eligible NFDS do they get 10 drops or just 1. Defaults to just going to // unique accounts. Set to true to send '1' per nfd regardless of final account AllowDuplicateAccounts bool `json:"allowDuplicateAccounts"` @@ -43,7 +46,10 @@ func (dc DestinationChoice) String() string { if dc.RandomNFDs.Count != 0 { sb.WriteString(fmt.Sprintf("Limited to maximum of %d recipients", dc.RandomNFDs.Count)) } - if dc.SegmentsOfRoot == "" && !dc.RandomNFDs.OnlyRoots && dc.RandomNFDs.Count == 0 { + if len(dc.VerifiedRequirements) > 0 { + sb.WriteString(fmt.Sprintf("Verified (v.*) requirements: %v, ", dc.VerifiedRequirements)) + } + if dc.SegmentsOfRoot == "" && !dc.RandomNFDs.OnlyRoots && dc.RandomNFDs.Count == 0 && len(dc.VerifiedRequirements) == 0 { sb.WriteString("Sending to ALL owned NFDs") } return sb.String() @@ -57,7 +63,7 @@ type AssetChoice struct { ASA uint64 `json:"asa"` // If IsPerRcp is NOT set then this is the TOTAL amount to send - and will be divided across destination // count - if IsPerRcp is set then amount is amount per recipient - // Specified in user friendly units - not base units - ie 1.5 ALGO would be 1.5, not 1,500,000 + // Specified in user-friendly units - not base units - ie 1.5 ALGO would be 1.5, not 1,500,000 Amount float64 `json:"amount"` // Is the amount 'per recipient' or is it total amount to send. IsPerRecip bool `json:"isPerRecip"`