From c0996b47d745234df948fd3108c58d79ed1e77f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Sedl=C3=A1=C4=8Dek?= Date: Wed, 9 Oct 2024 18:27:51 +0200 Subject: [PATCH] stack api 0d76158 (#159) --- api/api.gen.go | 323 ++++++++++++++++++++++++------------------------- 1 file changed, 158 insertions(+), 165 deletions(-) diff --git a/api/api.gen.go b/api/api.gen.go index 2392fbb..a523eaa 100644 --- a/api/api.gen.go +++ b/api/api.gen.go @@ -1,4 +1,4 @@ -// sequence-api v0.4.0 7578ce7543fbe82fa6e423652b4fa3d384362329 +// sequence-api v0.4.0 470a0f88ea399c2a57ff8c22da54358c033ed5f0 // -- // Code generated by webrpc-gen@v0.18.7 with golang generator. DO NOT EDIT. // @@ -31,7 +31,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "7578ce7543fbe82fa6e423652b4fa3d384362329" + return "470a0f88ea399c2a57ff8c22da54358c033ed5f0" } // @@ -385,6 +385,7 @@ type ExchangeRate struct { type LinkedWallet struct { ID uint64 `json:"id" db:"id,omitempty"` + WalletType *string `json:"walletType" db:"wallet_type"` WalletAddress prototyp.Hash `json:"walletAddress" db:"wallet_address"` LinkedWalletAddress prototyp.Hash `json:"linkedWalletAddress" db:"linked_wallet_address"` CreatedAt *time.Time `json:"createdAt,omitempty" db:"created_at,omitempty"` @@ -578,6 +579,14 @@ type SardinePaymentOption struct { ProcessingTime string `json:"processingTime"` } +type SwapPrice struct { + CurrencyAddress string `json:"currencyAddress"` + CurrencyBalance prototyp.BigInt `json:"currencyBalance"` + Price prototyp.BigInt `json:"price"` + To string `json:"to"` + TransactionValue prototyp.BigInt `json:"transactionValue"` +} + type SwapQuote struct { CurrencyAddress string `json:"currencyAddress"` CurrencyBalance prototyp.BigInt `json:"currencyBalance"` @@ -594,19 +603,16 @@ type SwapQuote struct { // Cross chain matching tokens type CurrencyGroup struct { - ID uint64 `json:"id" db:"id,omitempty"` Name string `json:"name" db:"name"` Tokens []*CurrencyGroupToken `json:"tokens"` } type CurrencyGroupToken struct { - ID uint64 `json:"id" db:"id,omitempty"` - CurrencyGroupID uint64 `json:"currencyGroupId" db:"currency_group_id"` - ChainID uint64 `json:"chainId" db:"chain_id"` - TokenAddress prototyp.Hash `json:"tokenAddress" db:"token_address"` + ChainID uint64 `json:"chainId" db:"chain_id"` + TokenAddress prototyp.Hash `json:"tokenAddress" db:"token_address"` } -type InventoryPaymentConfig struct { +type OffchainInventory struct { ID uint64 `json:"id" db:"id,omitempty"` ProjectID uint64 `json:"projectId" db:"project_id"` ChainID uint64 `json:"chainId" db:"chain_id"` @@ -625,31 +631,31 @@ type InventoryPaymentConfig struct { DeletedAt *time.Time `json:"-" db:"deleted_at,omitempty"` } -type InventoryPayment struct { - ID uint64 `json:"id" db:"id,omitempty"` - InventoryPaymentConfigID uint64 `json:"inventoryPaymentConfigId" db:"inventory_payment_config_id"` - ProductRecipient prototyp.Hash `json:"productRecipient" db:"product_recipient"` - PaymentChainID uint64 `json:"paymentChainId" db:"payment_chain_id"` - PaymentTokenAddress prototyp.Hash `json:"paymentTokenAddress" db:"payment_token_address"` - Expiration *time.Time `json:"expiration" db:"expiration"` - CreatedAt *time.Time `json:"createdAt" db:"created_at"` - CompletedAt *time.Time `json:"completedAt" db:"completed_at"` - ProcessedAt *time.Time `json:"processedAt" db:"processed_at"` -} - -type InventoryPaymentResponse struct { - PaymentID uint64 `json:"paymentId"` - InventoryPaymentConfigID uint64 `json:"inventoryPaymentConfigId"` - ChainID uint64 `json:"chainId"` - ExternalProductID string `json:"externalProductId"` - PaymentTokenAddress prototyp.Hash `json:"paymentTokenAddress"` - PaymentTokenType TokenType `json:"paymentTokenType"` - PaymentTokenID uint64 `json:"paymentTokenId"` - PaymentTotal uint64 `json:"paymentTotal"` - Expiration *time.Time `json:"expiration"` - Signature string `json:"signature"` - TxTo prototyp.Hash `json:"txTo"` - TxData string `json:"txData"` +type OffchainPayment struct { + ID uint64 `json:"id" db:"id,omitempty"` + OffchainInventoryID uint64 `json:"offchainInventoryId" db:"offchain_inventory_id"` + ProductRecipient prototyp.Hash `json:"productRecipient" db:"product_recipient"` + PaymentChainID uint64 `json:"paymentChainId" db:"payment_chain_id"` + PaymentTokenAddress prototyp.Hash `json:"paymentTokenAddress" db:"payment_token_address"` + Expiration *time.Time `json:"expiration" db:"expiration"` + CreatedAt *time.Time `json:"createdAt" db:"created_at"` + CompletedAt *time.Time `json:"completedAt" db:"completed_at"` + ProcessedAt *time.Time `json:"processedAt" db:"processed_at"` +} + +type PaymentResponse struct { + PaymentID uint64 `json:"paymentId"` + OffchainInventoryID uint64 `json:"offchainInventoryId"` + ChainID uint64 `json:"chainId"` + ExternalProductID string `json:"externalProductId"` + PaymentTokenAddress prototyp.Hash `json:"paymentTokenAddress"` + PaymentTokenType TokenType `json:"paymentTokenType"` + PaymentTokenID uint64 `json:"paymentTokenId"` + PaymentTotal uint64 `json:"paymentTotal"` + Expiration *time.Time `json:"expiration"` + Signature string `json:"signature"` + TxTo prototyp.Hash `json:"txTo"` + TxData string `json:"txData"` } var WebRPCServices = map[string][]string{ @@ -708,17 +714,16 @@ var WebRPCServices = map[string][]string{ "RemoveLinkedWallet", "GenerateWaaSVerificationURL", "ValidateWaaSVerificationNonce", - "GetSwapQuotes", - "AddCurrencyGroup", - "UpdateCurrencyGroup", + "GetSwapPrices", + "GetSwapQuote", "ListCurrencyGroups", - "DeleteCurrencyGroup", - "AddInventoryPaymentConfig", - "GetInventoryPaymentConfig", - "ListInventoryPaymentConfigs", - "UpdateInventoryPaymentConfig", - "DeleteInventoryPaymentConfig", - "RequestInventoryPayment", + "AddOffchainInventory", + "GetOffchainInventory", + "ListOffchainInventories", + "UpdateOffchainInventory", + "DeleteOffchainInventory", + "RequestOffchainPayment", + "ListOffchainPayments", }, } @@ -784,11 +789,11 @@ type API interface { SardineGetSupportedTokens(ctx context.Context) ([]*SardineSupportedToken, error) SardineGetEnabledTokens(ctx context.Context) ([]*SardineEnabledToken, error) SardineGetQuote(ctx context.Context, params *SardineGetQuoteParams) (*SardineQuote, error) - // Deprecated use SardineGetClientToken() + // Deprecated. Use SardineGetClientToken() instead. GetSardineClientToken(ctx context.Context) (string, error) - // Deprecated use SardineGetNFTCheckoutToken() + // Deprecated. Use SardineGetNFTCheckoutToken() instead. GetSardineNFTCheckoutToken(ctx context.Context, params *SardineNFTCheckoutParams) (*SardineNFTCheckout, error) - // Deprecated use SardineGetNFTCheckoutOrderStatus() + // Deprecated. Use SardineGetNFTCheckoutOrderStatus() instead. GetSardineNFTCheckoutOrderStatus(ctx context.Context, orderId string) (*SardineOrder, error) // // Price Feed @@ -822,8 +827,8 @@ type API interface { // // Linked wallets (v0 -- simple support) // - LinkWallet(ctx context.Context, parentWalletAddress string, parentWalletMessage string, parentWalletSignature string, linkedWalletAddress string, linkedWalletMessage string, linkedWalletSignature string, signatureChainId string) (bool, error) - GetLinkedWallets(ctx context.Context, parentWalletAddress string, parentWalletMessage string, parentWalletSignature string, signatureChainId string) ([]string, error) + LinkWallet(ctx context.Context, parentWalletAddress string, parentWalletMessage string, parentWalletSignature string, linkedWalletAddress string, linkedWalletMessage string, linkedWalletSignature string, signatureChainId string, linkedWalletType *string) (bool, error) + GetLinkedWallets(ctx context.Context, parentWalletAddress string, parentWalletMessage string, parentWalletSignature string, signatureChainId string) ([]*LinkedWallet, error) RemoveLinkedWallet(ctx context.Context, parentWalletAddress string, parentWalletMessage string, parentWalletSignature string, linkedWalletAddress string, linkedWalletMessage string, linkedWalletSignature string, signatureChainId string) (bool, error) // NOTE: these methods are deprecated, please do not use them. We may resurface them in the future, but just wanted // to be clear, they are not necessary for our linked wallets. @@ -832,20 +837,19 @@ type API interface { // // Currency abstraction // - GetSwapQuotes(ctx context.Context, userAddress string, currencyAddress string, currencyAmount string, chainId uint64, includeApprove bool) ([]*SwapQuote, error) + GetSwapPrices(ctx context.Context, userAddress string, buyCurrencyAddress string, buyAmount string, chainId uint64) ([]*SwapPrice, error) + GetSwapQuote(ctx context.Context, userAddress string, buyCurrencyAddress string, sellCurrencyAddress string, buyAmount string, chainId uint64, includeApprove bool) (*SwapQuote, error) // // Inventory, payments and management // - AddCurrencyGroup(ctx context.Context, currencyGroup *CurrencyGroup) (uint64, error) - UpdateCurrencyGroup(ctx context.Context, currencyGroup *CurrencyGroup) error ListCurrencyGroups(ctx context.Context) ([]*CurrencyGroup, error) - DeleteCurrencyGroup(ctx context.Context, groupId uint64) (bool, error) - AddInventoryPaymentConfig(ctx context.Context, config *InventoryPaymentConfig) (uint64, error) - GetInventoryPaymentConfig(ctx context.Context, configId uint64) (*InventoryPaymentConfig, error) - ListInventoryPaymentConfigs(ctx context.Context, projectId uint64) ([]*InventoryPaymentConfig, error) - UpdateInventoryPaymentConfig(ctx context.Context, config *InventoryPaymentConfig) error - DeleteInventoryPaymentConfig(ctx context.Context, configId uint64) (bool, error) - RequestInventoryPayment(ctx context.Context, configId uint64, recipient string, chainId *uint64, tokenAddress *string) (*InventoryPaymentResponse, error) + AddOffchainInventory(ctx context.Context, inventory *OffchainInventory) (uint64, error) + GetOffchainInventory(ctx context.Context, inventoryId uint64) (*OffchainInventory, error) + ListOffchainInventories(ctx context.Context, projectId uint64) ([]*OffchainInventory, error) + UpdateOffchainInventory(ctx context.Context, inventory *OffchainInventory) error + DeleteOffchainInventory(ctx context.Context, inventoryId uint64) (bool, error) + RequestOffchainPayment(ctx context.Context, inventoryId uint64, recipient string, chainId *uint64, tokenAddress *string) (*PaymentResponse, error) + ListOffchainPayments(ctx context.Context, inventoryId uint64, page *Page) (*Page, []*OffchainPayment, error) } // @@ -910,11 +914,11 @@ type APIClient interface { SardineGetSupportedTokens(ctx context.Context) ([]*SardineSupportedToken, error) SardineGetEnabledTokens(ctx context.Context) ([]*SardineEnabledToken, error) SardineGetQuote(ctx context.Context, params *SardineGetQuoteParams) (*SardineQuote, error) - // Deprecated use SardineGetClientToken() + // Deprecated. Use SardineGetClientToken() instead. GetSardineClientToken(ctx context.Context) (string, error) - // Deprecated use SardineGetNFTCheckoutToken() + // Deprecated. Use SardineGetNFTCheckoutToken() instead. GetSardineNFTCheckoutToken(ctx context.Context, params *SardineNFTCheckoutParams) (*SardineNFTCheckout, error) - // Deprecated use SardineGetNFTCheckoutOrderStatus() + // Deprecated. Use SardineGetNFTCheckoutOrderStatus() instead. GetSardineNFTCheckoutOrderStatus(ctx context.Context, orderId string) (*SardineOrder, error) // // Price Feed @@ -948,8 +952,8 @@ type APIClient interface { // // Linked wallets (v0 -- simple support) // - LinkWallet(ctx context.Context, parentWalletAddress string, parentWalletMessage string, parentWalletSignature string, linkedWalletAddress string, linkedWalletMessage string, linkedWalletSignature string, signatureChainId string) (bool, error) - GetLinkedWallets(ctx context.Context, parentWalletAddress string, parentWalletMessage string, parentWalletSignature string, signatureChainId string) ([]string, error) + LinkWallet(ctx context.Context, parentWalletAddress string, parentWalletMessage string, parentWalletSignature string, linkedWalletAddress string, linkedWalletMessage string, linkedWalletSignature string, signatureChainId string, linkedWalletType *string) (bool, error) + GetLinkedWallets(ctx context.Context, parentWalletAddress string, parentWalletMessage string, parentWalletSignature string, signatureChainId string) ([]*LinkedWallet, error) RemoveLinkedWallet(ctx context.Context, parentWalletAddress string, parentWalletMessage string, parentWalletSignature string, linkedWalletAddress string, linkedWalletMessage string, linkedWalletSignature string, signatureChainId string) (bool, error) // NOTE: these methods are deprecated, please do not use them. We may resurface them in the future, but just wanted // to be clear, they are not necessary for our linked wallets. @@ -958,20 +962,19 @@ type APIClient interface { // // Currency abstraction // - GetSwapQuotes(ctx context.Context, userAddress string, currencyAddress string, currencyAmount string, chainId uint64, includeApprove bool) ([]*SwapQuote, error) + GetSwapPrices(ctx context.Context, userAddress string, buyCurrencyAddress string, buyAmount string, chainId uint64) ([]*SwapPrice, error) + GetSwapQuote(ctx context.Context, userAddress string, buyCurrencyAddress string, sellCurrencyAddress string, buyAmount string, chainId uint64, includeApprove bool) (*SwapQuote, error) // // Inventory, payments and management // - AddCurrencyGroup(ctx context.Context, currencyGroup *CurrencyGroup) (uint64, error) - UpdateCurrencyGroup(ctx context.Context, currencyGroup *CurrencyGroup) error ListCurrencyGroups(ctx context.Context) ([]*CurrencyGroup, error) - DeleteCurrencyGroup(ctx context.Context, groupId uint64) (bool, error) - AddInventoryPaymentConfig(ctx context.Context, config *InventoryPaymentConfig) (uint64, error) - GetInventoryPaymentConfig(ctx context.Context, configId uint64) (*InventoryPaymentConfig, error) - ListInventoryPaymentConfigs(ctx context.Context, projectId uint64) ([]*InventoryPaymentConfig, error) - UpdateInventoryPaymentConfig(ctx context.Context, config *InventoryPaymentConfig) error - DeleteInventoryPaymentConfig(ctx context.Context, configId uint64) (bool, error) - RequestInventoryPayment(ctx context.Context, configId uint64, recipient string, chainId *uint64, tokenAddress *string) (*InventoryPaymentResponse, error) + AddOffchainInventory(ctx context.Context, inventory *OffchainInventory) (uint64, error) + GetOffchainInventory(ctx context.Context, inventoryId uint64) (*OffchainInventory, error) + ListOffchainInventories(ctx context.Context, projectId uint64) ([]*OffchainInventory, error) + UpdateOffchainInventory(ctx context.Context, inventory *OffchainInventory) error + DeleteOffchainInventory(ctx context.Context, inventoryId uint64) (bool, error) + RequestOffchainPayment(ctx context.Context, inventoryId uint64, recipient string, chainId *uint64, tokenAddress *string) (*PaymentResponse, error) + ListOffchainPayments(ctx context.Context, inventoryId uint64, page *Page) (*Page, []*OffchainPayment, error) } // @@ -982,12 +985,12 @@ const APIPathPrefix = "/rpc/API/" type aPIClient struct { client HTTPClient - urls [65]string + urls [64]string } func NewAPIClient(addr string, client HTTPClient) APIClient { prefix := urlBase(addr) + APIPathPrefix - urls := [65]string{ + urls := [64]string{ prefix + "Ping", prefix + "Version", prefix + "RuntimeStatus", @@ -1042,17 +1045,16 @@ func NewAPIClient(addr string, client HTTPClient) APIClient { prefix + "RemoveLinkedWallet", prefix + "GenerateWaaSVerificationURL", prefix + "ValidateWaaSVerificationNonce", - prefix + "GetSwapQuotes", - prefix + "AddCurrencyGroup", - prefix + "UpdateCurrencyGroup", + prefix + "GetSwapPrices", + prefix + "GetSwapQuote", prefix + "ListCurrencyGroups", - prefix + "DeleteCurrencyGroup", - prefix + "AddInventoryPaymentConfig", - prefix + "GetInventoryPaymentConfig", - prefix + "ListInventoryPaymentConfigs", - prefix + "UpdateInventoryPaymentConfig", - prefix + "DeleteInventoryPaymentConfig", - prefix + "RequestInventoryPayment", + prefix + "AddOffchainInventory", + prefix + "GetOffchainInventory", + prefix + "ListOffchainInventories", + prefix + "UpdateOffchainInventory", + prefix + "DeleteOffchainInventory", + prefix + "RequestOffchainPayment", + prefix + "ListOffchainPayments", } return &aPIClient{ client: client, @@ -1999,16 +2001,17 @@ func (c *aPIClient) PaperSessionSecret2(ctx context.Context, chainName string, c return out.Ret0, err } -func (c *aPIClient) LinkWallet(ctx context.Context, parentWalletAddress string, parentWalletMessage string, parentWalletSignature string, linkedWalletAddress string, linkedWalletMessage string, linkedWalletSignature string, signatureChainId string) (bool, error) { +func (c *aPIClient) LinkWallet(ctx context.Context, parentWalletAddress string, parentWalletMessage string, parentWalletSignature string, linkedWalletAddress string, linkedWalletMessage string, linkedWalletSignature string, signatureChainId string, linkedWalletType *string) (bool, error) { in := struct { - Arg0 string `json:"parentWalletAddress"` - Arg1 string `json:"parentWalletMessage"` - Arg2 string `json:"parentWalletSignature"` - Arg3 string `json:"linkedWalletAddress"` - Arg4 string `json:"linkedWalletMessage"` - Arg5 string `json:"linkedWalletSignature"` - Arg6 string `json:"signatureChainId"` - }{parentWalletAddress, parentWalletMessage, parentWalletSignature, linkedWalletAddress, linkedWalletMessage, linkedWalletSignature, signatureChainId} + Arg0 string `json:"parentWalletAddress"` + Arg1 string `json:"parentWalletMessage"` + Arg2 string `json:"parentWalletSignature"` + Arg3 string `json:"linkedWalletAddress"` + Arg4 string `json:"linkedWalletMessage"` + Arg5 string `json:"linkedWalletSignature"` + Arg6 string `json:"signatureChainId"` + Arg7 *string `json:"linkedWalletType"` + }{parentWalletAddress, parentWalletMessage, parentWalletSignature, linkedWalletAddress, linkedWalletMessage, linkedWalletSignature, signatureChainId, linkedWalletType} out := struct { Ret0 bool `json:"status"` }{} @@ -2024,7 +2027,7 @@ func (c *aPIClient) LinkWallet(ctx context.Context, parentWalletAddress string, return out.Ret0, err } -func (c *aPIClient) GetLinkedWallets(ctx context.Context, parentWalletAddress string, parentWalletMessage string, parentWalletSignature string, signatureChainId string) ([]string, error) { +func (c *aPIClient) GetLinkedWallets(ctx context.Context, parentWalletAddress string, parentWalletMessage string, parentWalletSignature string, signatureChainId string) ([]*LinkedWallet, error) { in := struct { Arg0 string `json:"parentWalletAddress"` Arg1 string `json:"parentWalletMessage"` @@ -2032,7 +2035,7 @@ func (c *aPIClient) GetLinkedWallets(ctx context.Context, parentWalletAddress st Arg3 string `json:"signatureChainId"` }{parentWalletAddress, parentWalletMessage, parentWalletSignature, signatureChainId} out := struct { - Ret0 []string `json:"linkedWallets"` + Ret0 []*LinkedWallet `json:"linkedWallets"` }{} resp, err := doHTTPRequest(ctx, c.client, c.urls[50], in, &out) @@ -2113,16 +2116,15 @@ func (c *aPIClient) ValidateWaaSVerificationNonce(ctx context.Context, nonce str return out.Ret0, err } -func (c *aPIClient) GetSwapQuotes(ctx context.Context, userAddress string, currencyAddress string, currencyAmount string, chainId uint64, includeApprove bool) ([]*SwapQuote, error) { +func (c *aPIClient) GetSwapPrices(ctx context.Context, userAddress string, buyCurrencyAddress string, buyAmount string, chainId uint64) ([]*SwapPrice, error) { in := struct { Arg0 string `json:"userAddress"` - Arg1 string `json:"currencyAddress"` - Arg2 string `json:"currencyAmount"` + Arg1 string `json:"buyCurrencyAddress"` + Arg2 string `json:"buyAmount"` Arg3 uint64 `json:"chainId"` - Arg4 bool `json:"includeApprove"` - }{userAddress, currencyAddress, currencyAmount, chainId, includeApprove} + }{userAddress, buyCurrencyAddress, buyAmount, chainId} out := struct { - Ret0 []*SwapQuote `json:"swapQuotes"` + Ret0 []*SwapPrice `json:"swapPrices"` }{} resp, err := doHTTPRequest(ctx, c.client, c.urls[54], in, &out) @@ -2136,12 +2138,17 @@ func (c *aPIClient) GetSwapQuotes(ctx context.Context, userAddress string, curre return out.Ret0, err } -func (c *aPIClient) AddCurrencyGroup(ctx context.Context, currencyGroup *CurrencyGroup) (uint64, error) { +func (c *aPIClient) GetSwapQuote(ctx context.Context, userAddress string, buyCurrencyAddress string, sellCurrencyAddress string, buyAmount string, chainId uint64, includeApprove bool) (*SwapQuote, error) { in := struct { - Arg0 *CurrencyGroup `json:"currencyGroup"` - }{currencyGroup} + Arg0 string `json:"userAddress"` + Arg1 string `json:"buyCurrencyAddress"` + Arg2 string `json:"sellCurrencyAddress"` + Arg3 string `json:"buyAmount"` + Arg4 uint64 `json:"chainId"` + Arg5 bool `json:"includeApprove"` + }{userAddress, buyCurrencyAddress, sellCurrencyAddress, buyAmount, chainId, includeApprove} out := struct { - Ret0 uint64 `json:"groupId"` + Ret0 *SwapQuote `json:"swapQuote"` }{} resp, err := doHTTPRequest(ctx, c.client, c.urls[55], in, &out) @@ -2155,28 +2162,12 @@ func (c *aPIClient) AddCurrencyGroup(ctx context.Context, currencyGroup *Currenc return out.Ret0, err } -func (c *aPIClient) UpdateCurrencyGroup(ctx context.Context, currencyGroup *CurrencyGroup) error { - in := struct { - Arg0 *CurrencyGroup `json:"currencyGroup"` - }{currencyGroup} - - resp, err := doHTTPRequest(ctx, c.client, c.urls[56], in, nil) - if resp != nil { - cerr := resp.Body.Close() - if err == nil && cerr != nil { - err = ErrWebrpcRequestFailed.WithCause(fmt.Errorf("failed to close response body: %w", cerr)) - } - } - - return err -} - func (c *aPIClient) ListCurrencyGroups(ctx context.Context) ([]*CurrencyGroup, error) { out := struct { Ret0 []*CurrencyGroup `json:"currencyGroups"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[57], nil, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[56], nil, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -2187,15 +2178,15 @@ func (c *aPIClient) ListCurrencyGroups(ctx context.Context) ([]*CurrencyGroup, e return out.Ret0, err } -func (c *aPIClient) DeleteCurrencyGroup(ctx context.Context, groupId uint64) (bool, error) { +func (c *aPIClient) AddOffchainInventory(ctx context.Context, inventory *OffchainInventory) (uint64, error) { in := struct { - Arg0 uint64 `json:"groupId"` - }{groupId} + Arg0 *OffchainInventory `json:"inventory"` + }{inventory} out := struct { - Ret0 bool `json:"ok"` + Ret0 uint64 `json:"inventoryId"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[58], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[57], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -2206,15 +2197,15 @@ func (c *aPIClient) DeleteCurrencyGroup(ctx context.Context, groupId uint64) (bo return out.Ret0, err } -func (c *aPIClient) AddInventoryPaymentConfig(ctx context.Context, config *InventoryPaymentConfig) (uint64, error) { +func (c *aPIClient) GetOffchainInventory(ctx context.Context, inventoryId uint64) (*OffchainInventory, error) { in := struct { - Arg0 *InventoryPaymentConfig `json:"config"` - }{config} + Arg0 uint64 `json:"inventoryId"` + }{inventoryId} out := struct { - Ret0 uint64 `json:"configId"` + Ret0 *OffchainInventory `json:"inventory"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[59], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[58], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -2225,15 +2216,15 @@ func (c *aPIClient) AddInventoryPaymentConfig(ctx context.Context, config *Inven return out.Ret0, err } -func (c *aPIClient) GetInventoryPaymentConfig(ctx context.Context, configId uint64) (*InventoryPaymentConfig, error) { +func (c *aPIClient) ListOffchainInventories(ctx context.Context, projectId uint64) ([]*OffchainInventory, error) { in := struct { - Arg0 uint64 `json:"configId"` - }{configId} + Arg0 uint64 `json:"projectId"` + }{projectId} out := struct { - Ret0 *InventoryPaymentConfig `json:"config"` + Ret0 []*OffchainInventory `json:"inventory"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[60], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[59], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -2244,15 +2235,12 @@ func (c *aPIClient) GetInventoryPaymentConfig(ctx context.Context, configId uint return out.Ret0, err } -func (c *aPIClient) ListInventoryPaymentConfigs(ctx context.Context, projectId uint64) ([]*InventoryPaymentConfig, error) { +func (c *aPIClient) UpdateOffchainInventory(ctx context.Context, inventory *OffchainInventory) error { in := struct { - Arg0 uint64 `json:"projectId"` - }{projectId} - out := struct { - Ret0 []*InventoryPaymentConfig `json:"configs"` - }{} + Arg0 *OffchainInventory `json:"inventory"` + }{inventory} - resp, err := doHTTPRequest(ctx, c.client, c.urls[61], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[60], in, nil) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -2260,15 +2248,18 @@ func (c *aPIClient) ListInventoryPaymentConfigs(ctx context.Context, projectId u } } - return out.Ret0, err + return err } -func (c *aPIClient) UpdateInventoryPaymentConfig(ctx context.Context, config *InventoryPaymentConfig) error { +func (c *aPIClient) DeleteOffchainInventory(ctx context.Context, inventoryId uint64) (bool, error) { in := struct { - Arg0 *InventoryPaymentConfig `json:"config"` - }{config} + Arg0 uint64 `json:"inventoryId"` + }{inventoryId} + out := struct { + Ret0 bool `json:"ok"` + }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[62], in, nil) + resp, err := doHTTPRequest(ctx, c.client, c.urls[61], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -2276,18 +2267,21 @@ func (c *aPIClient) UpdateInventoryPaymentConfig(ctx context.Context, config *In } } - return err + return out.Ret0, err } -func (c *aPIClient) DeleteInventoryPaymentConfig(ctx context.Context, configId uint64) (bool, error) { +func (c *aPIClient) RequestOffchainPayment(ctx context.Context, inventoryId uint64, recipient string, chainId *uint64, tokenAddress *string) (*PaymentResponse, error) { in := struct { - Arg0 uint64 `json:"configId"` - }{configId} + Arg0 uint64 `json:"inventoryId"` + Arg1 string `json:"recipient"` + Arg2 *uint64 `json:"chainId"` + Arg3 *string `json:"tokenAddress"` + }{inventoryId, recipient, chainId, tokenAddress} out := struct { - Ret0 bool `json:"ok"` + Ret0 *PaymentResponse `json:"payment"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[63], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[62], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -2298,18 +2292,17 @@ func (c *aPIClient) DeleteInventoryPaymentConfig(ctx context.Context, configId u return out.Ret0, err } -func (c *aPIClient) RequestInventoryPayment(ctx context.Context, configId uint64, recipient string, chainId *uint64, tokenAddress *string) (*InventoryPaymentResponse, error) { +func (c *aPIClient) ListOffchainPayments(ctx context.Context, inventoryId uint64, page *Page) (*Page, []*OffchainPayment, error) { in := struct { - Arg0 uint64 `json:"configId"` - Arg1 string `json:"recipient"` - Arg2 *uint64 `json:"chainId"` - Arg3 *string `json:"tokenAddress"` - }{configId, recipient, chainId, tokenAddress} + Arg0 uint64 `json:"inventoryId"` + Arg1 *Page `json:"page"` + }{inventoryId, page} out := struct { - Ret0 *InventoryPaymentResponse `json:"payment"` + Ret0 *Page `json:"page"` + Ret1 []*OffchainPayment `json:"payments"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[64], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[63], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -2317,7 +2310,7 @@ func (c *aPIClient) RequestInventoryPayment(ctx context.Context, configId uint64 } } - return out.Ret0, err + return out.Ret0, out.Ret1, err } // HTTPClient is the interface used by generated clients to send HTTP requests.