From 752e2fff7d0e37c68cc12d45d0201a01a718a134 Mon Sep 17 00:00:00 2001 From: Rohit Durvasula <88731568+drohit-cb@users.noreply.github.com> Date: Tue, 17 Sep 2024 14:02:57 -0700 Subject: [PATCH] pull in latest generated code (#32) --- CHANGELOG.md | 4 + .../build-staking-operation/main.go | 0 .../solana/build-staking-operation/main.go | 67 +- gen/client/.gitignore | 24 - gen/client/.openapi-generator-ignore | 23 - gen/client/.openapi-generator/FILES | 173 ---- gen/client/.openapi-generator/VERSION | 1 - gen/client/.travis.yml | 8 - gen/client/README.md | 43 +- gen/client/api_addresses.go | 442 +++++++++- gen/client/api_balance_history.go | 183 +++++ gen/client/api_contract_events.go | 16 +- gen/client/api_contract_invocations.go | 603 ++++++++++++++ gen/client/api_external_addresses.go | 69 +- gen/client/api_server_signers.go | 8 +- gen/client/api_smart_contracts.go | 583 +++++++++++++ gen/client/api_stake.go | 14 +- gen/client/api_trades.go | 4 +- gen/client/api_transfers.go | 4 +- gen/client/api_validators.go | 6 +- gen/client/api_wallets.go | 4 +- gen/client/api_webhooks.go | 4 +- gen/client/client.go | 25 +- gen/client/client_config.yaml | 5 - gen/client/git_push.sh | 57 -- gen/client/model_address_transaction_list.go | 216 +++++ ...l_broadcast_contract_invocation_request.go | 159 ++++ gen/client/model_contract_invocation.go | 427 ++++++++++ gen/client/model_contract_invocation_list.go | 245 ++++++ ...odel_create_contract_invocation_request.go | 291 +++++++ .../model_create_payload_signature_request.go | 196 +++++ .../model_create_smart_contract_request.go | 186 +++++ gen/client/model_create_transfer_request.go | 2 +- gen/client/model_create_webhook_request.go | 97 ++- .../model_deploy_smart_contract_request.go | 159 ++++ gen/client/model_erc20_transfer_event.go | 572 +++++++++++++ gen/client/model_erc721_transfer_event.go | 572 +++++++++++++ gen/client/model_ethereum_transaction.go | 742 +++++++++++++++++ .../model_ethereum_transaction_access.go | 162 ++++ .../model_ethereum_transaction_access_list.go | 126 +++ ...el_ethereum_transaction_flattened_trace.go | 774 ++++++++++++++++++ gen/client/model_feature.go | 116 --- gen/client/model_network_identifier.go | 6 + gen/client/model_nft_contract_options.go | 188 +++++ gen/client/model_payload_signature.go | 312 +++++++ gen/client/model_payload_signature_list.go | 245 ++++++ gen/client/model_smart_contract.go | 388 +++++++++ gen/client/model_smart_contract_list.go | 216 +++++ gen/client/model_smart_contract_options.go | 157 ++++ gen/client/model_smart_contract_type.go | 111 +++ gen/client/model_staking_balance.go | 15 +- gen/client/model_staking_reward.go | 15 +- gen/client/model_token_contract_options.go | 217 +++++ gen/client/model_transaction.go | 110 +++ gen/client/model_transaction_content.go | 123 +++ gen/client/model_update_webhook_request.go | 95 +-- gen/client/model_webhook.go | 73 ++ gen/client/model_webhook_event_filter.go | 6 +- gen/client/model_webhook_event_type.go | 2 + gen/client/model_webhook_event_type_filter.go | 123 +++ .../model_webhook_wallet_activity_filter.go | 164 ++++ go.mod | 3 - go.sum | 6 - pkg/auth/transport.go | 2 +- pkg/coinbase/staking_balance.go | 7 +- pkg/coinbase/staking_balance_test.go | 2 +- pkg/coinbase/staking_reward.go | 7 +- pkg/coinbase/staking_reward_test.go | 10 +- pkg/coinbase/utils.go | 2 - 69 files changed, 9376 insertions(+), 641 deletions(-) rename examples/{eth => ethereum}/build-staking-operation/main.go (100%) delete mode 100644 gen/client/.gitignore delete mode 100644 gen/client/.openapi-generator-ignore delete mode 100644 gen/client/.openapi-generator/FILES delete mode 100644 gen/client/.openapi-generator/VERSION delete mode 100644 gen/client/.travis.yml create mode 100644 gen/client/api_balance_history.go create mode 100644 gen/client/api_contract_invocations.go create mode 100644 gen/client/api_smart_contracts.go delete mode 100644 gen/client/client_config.yaml delete mode 100644 gen/client/git_push.sh create mode 100644 gen/client/model_address_transaction_list.go create mode 100644 gen/client/model_broadcast_contract_invocation_request.go create mode 100644 gen/client/model_contract_invocation.go create mode 100644 gen/client/model_contract_invocation_list.go create mode 100644 gen/client/model_create_contract_invocation_request.go create mode 100644 gen/client/model_create_payload_signature_request.go create mode 100644 gen/client/model_create_smart_contract_request.go create mode 100644 gen/client/model_deploy_smart_contract_request.go create mode 100644 gen/client/model_erc20_transfer_event.go create mode 100644 gen/client/model_erc721_transfer_event.go create mode 100644 gen/client/model_ethereum_transaction.go create mode 100644 gen/client/model_ethereum_transaction_access.go create mode 100644 gen/client/model_ethereum_transaction_access_list.go create mode 100644 gen/client/model_ethereum_transaction_flattened_trace.go delete mode 100644 gen/client/model_feature.go create mode 100644 gen/client/model_nft_contract_options.go create mode 100644 gen/client/model_payload_signature.go create mode 100644 gen/client/model_payload_signature_list.go create mode 100644 gen/client/model_smart_contract.go create mode 100644 gen/client/model_smart_contract_list.go create mode 100644 gen/client/model_smart_contract_options.go create mode 100644 gen/client/model_smart_contract_type.go create mode 100644 gen/client/model_token_contract_options.go create mode 100644 gen/client/model_transaction_content.go create mode 100644 gen/client/model_webhook_event_type_filter.go create mode 100644 gen/client/model_webhook_wallet_activity_filter.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a2e9ef..bdb3757 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +## [0.0.9] - 2024-09-17 +- Update SDK with latest generated client code. + + ## [0.0.8] - 2024-09-17 - StakingRewards's Date field is now a full timestamp diff --git a/examples/eth/build-staking-operation/main.go b/examples/ethereum/build-staking-operation/main.go similarity index 100% rename from examples/eth/build-staking-operation/main.go rename to examples/ethereum/build-staking-operation/main.go diff --git a/examples/solana/build-staking-operation/main.go b/examples/solana/build-staking-operation/main.go index 5e740eb..f2fcf90 100644 --- a/examples/solana/build-staking-operation/main.go +++ b/examples/solana/build-staking-operation/main.go @@ -6,50 +6,30 @@ import ( "log" "math/big" "os" - "path/filepath" - "strings" "time" "github.com/btcsuite/btcutil/base58" + "github.com/coinbase/coinbase-sdk-go/gen/client" "github.com/coinbase/coinbase-sdk-go/pkg/coinbase" - bin "github.com/gagliardetto/binary" "github.com/gagliardetto/solana-go" "github.com/gagliardetto/solana-go/rpc" ) var ( - networkID = "solana-devnet" - amount = big.NewFloat(0.1) - rpcURL = "https://api.devnet.solana.com" - defaultPrivKeyPath = filepath.Join(home(), ".config/solana/id.json") + networkID = client.NETWORKIDENTIFIER_SOLANA_DEVNET + amount = big.NewFloat(0.1) + rpcURL = "https://api.devnet.solana.com" ) /* * This example code stakes SOL on the devnet network. - * Run the code with 'go run examples/solana/build-staking-operation/main.go ' + * Run the code with 'go run examples/solana/build-staking-operation/main.go ' */ func main() { ctx := context.Background() - walletAddress := os.Args[2] - - privKeys := []string{defaultPrivKeyPath} - if keys := os.Getenv("SOL_PRIVATE_KEYS"); keys != "" { - privKeys = strings.Split(keys, ",") - } - - signers := make([]solana.PrivateKey, len(privKeys)) - for i, pk := range privKeys { - privKey, err := solana.PrivateKeyFromSolanaKeygenFile(pk) - if err != nil { - log.Fatalf("private key %s does not exist or is invalid", privKey) - } - - signers[i] = privKey - } - client, err := coinbase.NewClient( coinbase.WithAPIKeyFromJSON(os.Args[1]), ) @@ -57,7 +37,7 @@ func main() { log.Fatalf("error creating coinbase client: %v", err) } - address := coinbase.NewExternalAddress(networkID, walletAddress) + address := coinbase.NewExternalAddress(string(networkID), os.Args[2]) balance, err := client.GetStakeableBalance(ctx, coinbase.Sol, address) if err != nil { @@ -73,10 +53,15 @@ func main() { log.Printf("Staking operation ID: %s\n\n", stakingOperation.ID()) + stakingOperation, err = client.Wait(ctx, stakingOperation, coinbase.WithWaitTimeoutSeconds(60)) + if err != nil { + log.Fatalf("error waiting for staking operation: %v", err) + } + for _, transaction := range stakingOperation.Transactions() { log.Printf("Tx unsigned payload: %s\n\n", transaction.UnsignedPayload()) - signedTx, err := signSolTransaction(transaction.UnsignedPayload(), signers) + signedTx, err := signSolTransaction(transaction.UnsignedPayload(), []string{os.Args[3]}) if err != nil { log.Fatalf("error signing transaction: %v", err) } @@ -91,8 +76,22 @@ func main() { log.Printf("Broadcasted tx: %s\n\n", getTxLink(stakingOperation.NetworkID(), sig)) } } +func signSolTransaction(unsignedTx string, privateKeys []string) (string, error) { + if len(privateKeys) == 0 { + return "", fmt.Errorf("need to pass at least one private key") + } + + signers := make([]solana.PrivateKey, 0, len(privateKeys)) + + for _, privateKey := range privateKeys { + signer, err := solana.PrivateKeyFromBase58(privateKey) + if err != nil { + return "", fmt.Errorf("error getting private key: %w", err) + } + + signers = append(signers, signer) + } -func signSolTransaction(unsignedTx string, signers []solana.PrivateKey) (string, error) { data := base58.Decode(unsignedTx) // parse transaction @@ -133,7 +132,8 @@ func broadcastSolTransaction(ctx context.Context, signedTx string) (string, erro ) cluster := rpc.Cluster{ - RPC: rpcURL, + Name: "solana-staking-demo-rpc", + RPC: rpcURL, } rpcClient := rpc.New(cluster.RPC) @@ -185,12 +185,3 @@ func getTxLink(networkID, signature string) string { return "" } - -func home() string { - home, err := os.UserHomeDir() - if err != nil { - log.Fatal("unable to get user homedir") - } - - return home -} diff --git a/gen/client/.gitignore b/gen/client/.gitignore deleted file mode 100644 index daf913b..0000000 --- a/gen/client/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -# Compiled Object files, Static and Dynamic libs (Shared Objects) -*.o -*.a -*.so - -# Folders -_obj -_test - -# Architecture specific extensions/prefixes -*.[568vq] -[568vq].out - -*.cgo1.go -*.cgo2.c -_cgo_defun.c -_cgo_gotypes.go -_cgo_export.* - -_testmain.go - -*.exe -*.test -*.prof diff --git a/gen/client/.openapi-generator-ignore b/gen/client/.openapi-generator-ignore deleted file mode 100644 index 7484ee5..0000000 --- a/gen/client/.openapi-generator-ignore +++ /dev/null @@ -1,23 +0,0 @@ -# OpenAPI Generator Ignore -# Generated by openapi-generator https://github.com/openapitools/openapi-generator - -# Use this file to prevent files from being overwritten by the generator. -# The patterns follow closely to .gitignore or .dockerignore. - -# As an example, the C# client generator defines ApiClient.cs. -# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: -#ApiClient.cs - -# You can match any string of characters against a directory, file or extension with a single asterisk (*): -#foo/*/qux -# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux - -# You can recursively match patterns against a directory, file or extension with a double asterisk (**): -#foo/**/qux -# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux - -# You can also negate patterns with an exclamation (!). -# For example, you can ignore all files in a docs folder with the file extension .md: -#docs/*.md -# Then explicitly reverse the ignore rule for a single file: -#!docs/README.md diff --git a/gen/client/.openapi-generator/FILES b/gen/client/.openapi-generator/FILES deleted file mode 100644 index 8321885..0000000 --- a/gen/client/.openapi-generator/FILES +++ /dev/null @@ -1,173 +0,0 @@ -.gitignore -.travis.yml -README.md -api/openapi.yaml -api_addresses.go -api_assets.go -api_contract_events.go -api_external_addresses.go -api_networks.go -api_server_signers.go -api_stake.go -api_trades.go -api_transfers.go -api_users.go -api_validators.go -api_wallet_stake.go -api_wallets.go -api_webhooks.go -client.go -configuration.go -docs/Address.md -docs/AddressBalanceList.md -docs/AddressHistoricalBalanceList.md -docs/AddressList.md -docs/AddressesAPI.md -docs/Asset.md -docs/AssetsAPI.md -docs/Balance.md -docs/BroadcastStakingOperationRequest.md -docs/BroadcastTradeRequest.md -docs/BroadcastTransferRequest.md -docs/BuildStakingOperationRequest.md -docs/ContractEvent.md -docs/ContractEventList.md -docs/ContractEventsAPI.md -docs/CreateAddressRequest.md -docs/CreateServerSignerRequest.md -docs/CreateStakingOperationRequest.md -docs/CreateTradeRequest.md -docs/CreateTransferRequest.md -docs/CreateWalletRequest.md -docs/CreateWalletRequestWallet.md -docs/CreateWebhookRequest.md -docs/Error.md -docs/EthereumValidatorMetadata.md -docs/ExternalAddressesAPI.md -docs/FaucetTransaction.md -docs/FeatureSet.md -docs/FetchHistoricalStakingBalances200Response.md -docs/FetchStakingRewards200Response.md -docs/FetchStakingRewardsRequest.md -docs/GetStakingContextRequest.md -docs/HistoricalBalance.md -docs/Network.md -docs/NetworkIdentifier.md -docs/NetworksAPI.md -docs/SeedCreationEvent.md -docs/SeedCreationEventResult.md -docs/ServerSigner.md -docs/ServerSignerEvent.md -docs/ServerSignerEventEvent.md -docs/ServerSignerEventList.md -docs/ServerSignerList.md -docs/ServerSignersAPI.md -docs/SignatureCreationEvent.md -docs/SignatureCreationEventResult.md -docs/SignedVoluntaryExitMessageMetadata.md -docs/SponsoredSend.md -docs/StakeAPI.md -docs/StakingBalance.md -docs/StakingContext.md -docs/StakingContextContext.md -docs/StakingOperation.md -docs/StakingOperationMetadata.md -docs/StakingReward.md -docs/StakingRewardFormat.md -docs/StakingRewardUSDValue.md -docs/Trade.md -docs/TradeList.md -docs/TradesAPI.md -docs/Transaction.md -docs/TransactionType.md -docs/Transfer.md -docs/TransferList.md -docs/TransfersAPI.md -docs/UpdateWebhookRequest.md -docs/User.md -docs/UsersAPI.md -docs/Validator.md -docs/ValidatorDetails.md -docs/ValidatorList.md -docs/ValidatorStatus.md -docs/ValidatorsAPI.md -docs/Wallet.md -docs/WalletList.md -docs/WalletStakeAPI.md -docs/WalletsAPI.md -docs/Webhook.md -docs/WebhookEventFilter.md -docs/WebhookEventType.md -docs/WebhookList.md -docs/WebhooksAPI.md -git_push.sh -model_address.go -model_address_balance_list.go -model_address_historical_balance_list.go -model_address_list.go -model_asset.go -model_balance.go -model_broadcast_staking_operation_request.go -model_broadcast_trade_request.go -model_broadcast_transfer_request.go -model_build_staking_operation_request.go -model_contract_event.go -model_contract_event_list.go -model_create_address_request.go -model_create_server_signer_request.go -model_create_staking_operation_request.go -model_create_trade_request.go -model_create_transfer_request.go -model_create_wallet_request.go -model_create_wallet_request_wallet.go -model_create_webhook_request.go -model_error.go -model_ethereum_validator_metadata.go -model_faucet_transaction.go -model_feature_set.go -model_fetch_historical_staking_balances_200_response.go -model_fetch_staking_rewards_200_response.go -model_fetch_staking_rewards_request.go -model_get_staking_context_request.go -model_historical_balance.go -model_network.go -model_network_identifier.go -model_seed_creation_event.go -model_seed_creation_event_result.go -model_server_signer.go -model_server_signer_event.go -model_server_signer_event_event.go -model_server_signer_event_list.go -model_server_signer_list.go -model_signature_creation_event.go -model_signature_creation_event_result.go -model_signed_voluntary_exit_message_metadata.go -model_sponsored_send.go -model_staking_balance.go -model_staking_context.go -model_staking_context_context.go -model_staking_operation.go -model_staking_operation_metadata.go -model_staking_reward.go -model_staking_reward_format.go -model_staking_reward_usd_value.go -model_trade.go -model_trade_list.go -model_transaction.go -model_transaction_type.go -model_transfer.go -model_transfer_list.go -model_update_webhook_request.go -model_user.go -model_validator.go -model_validator_details.go -model_validator_list.go -model_validator_status.go -model_wallet.go -model_wallet_list.go -model_webhook.go -model_webhook_event_filter.go -model_webhook_event_type.go -model_webhook_list.go -response.go -utils.go diff --git a/gen/client/.openapi-generator/VERSION b/gen/client/.openapi-generator/VERSION deleted file mode 100644 index 1985849..0000000 --- a/gen/client/.openapi-generator/VERSION +++ /dev/null @@ -1 +0,0 @@ -7.7.0 diff --git a/gen/client/.travis.yml b/gen/client/.travis.yml deleted file mode 100644 index f5cb2ce..0000000 --- a/gen/client/.travis.yml +++ /dev/null @@ -1,8 +0,0 @@ -language: go - -install: - - go get -d -v . - -script: - - go build -v ./ - diff --git a/gen/client/README.md b/gen/client/README.md index 0fdc0bf..ad4088b 100644 --- a/gen/client/README.md +++ b/gen/client/README.md @@ -7,7 +7,7 @@ This API client was generated by the [OpenAPI Generator](https://openapi-generat - API version: 0.0.1-alpha - Package version: 1.0.0 -- Generator version: 7.7.0 +- Generator version: 7.8.0 - Build package: org.openapitools.codegen.languages.GoClientCodegen ## Installation @@ -79,15 +79,23 @@ All URIs are relative to *https://api.cdp.coinbase.com/platform* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *AddressesAPI* | [**CreateAddress**](docs/AddressesAPI.md#createaddress) | **Post** /v1/wallets/{wallet_id}/addresses | Create a new address +*AddressesAPI* | [**CreatePayloadSignature**](docs/AddressesAPI.md#createpayloadsignature) | **Post** /v1/wallets/{wallet_id}/addresses/{address_id}/payload_signatures | Create a new payload signature. *AddressesAPI* | [**GetAddress**](docs/AddressesAPI.md#getaddress) | **Get** /v1/wallets/{wallet_id}/addresses/{address_id} | Get address by onchain address *AddressesAPI* | [**GetAddressBalance**](docs/AddressesAPI.md#getaddressbalance) | **Get** /v1/wallets/{wallet_id}/addresses/{address_id}/balances/{asset_id} | Get address balance for asset +*AddressesAPI* | [**GetPayloadSignature**](docs/AddressesAPI.md#getpayloadsignature) | **Get** /v1/wallets/{wallet_id}/addresses/{address_id}/payload_signatures/{payload_signature_id} | Get payload signature. *AddressesAPI* | [**ListAddressBalances**](docs/AddressesAPI.md#listaddressbalances) | **Get** /v1/wallets/{wallet_id}/addresses/{address_id}/balances | Get all balances for address *AddressesAPI* | [**ListAddresses**](docs/AddressesAPI.md#listaddresses) | **Get** /v1/wallets/{wallet_id}/addresses | List addresses in a wallet. +*AddressesAPI* | [**ListPayloadSignatures**](docs/AddressesAPI.md#listpayloadsignatures) | **Get** /v1/wallets/{wallet_id}/addresses/{address_id}/payload_signatures | List payload signatures for an address. *AddressesAPI* | [**RequestFaucetFunds**](docs/AddressesAPI.md#requestfaucetfunds) | **Post** /v1/wallets/{wallet_id}/addresses/{address_id}/faucet | Request faucet funds for onchain address. *AssetsAPI* | [**GetAsset**](docs/AssetsAPI.md#getasset) | **Get** /v1/networks/{network_id}/assets/{asset_id} | Get the asset for the specified asset ID. -*ContractEventsAPI* | [**ListContractEvents**](docs/ContractEventsAPI.md#listcontractevents) | **Get** /v1/networks/{network_id}/smart_contracts/{contract_address}/events | Get contract events +*BalanceHistoryAPI* | [**ListAddressHistoricalBalance**](docs/BalanceHistoryAPI.md#listaddresshistoricalbalance) | **Get** /v1/networks/{network_id}/addresses/{address_id}/balance_history/{asset_id} | Get address balance history for asset +*ContractEventsAPI* | [**ListContractEvents**](docs/ContractEventsAPI.md#listcontractevents) | **Get** /v1/networks/{network_id}/smart_contracts/{contract_address}/events | List contract events +*ContractInvocationsAPI* | [**BroadcastContractInvocation**](docs/ContractInvocationsAPI.md#broadcastcontractinvocation) | **Post** /v1/wallets/{wallet_id}/addresses/{address_id}/contract_invocations/{contract_invocation_id}/broadcast | Broadcast a contract invocation. +*ContractInvocationsAPI* | [**CreateContractInvocation**](docs/ContractInvocationsAPI.md#createcontractinvocation) | **Post** /v1/wallets/{wallet_id}/addresses/{address_id}/contract_invocations | Create a new contract invocation for an address. +*ContractInvocationsAPI* | [**GetContractInvocation**](docs/ContractInvocationsAPI.md#getcontractinvocation) | **Get** /v1/wallets/{wallet_id}/addresses/{address_id}/contract_invocations/{contract_invocation_id} | Get a contract invocation by ID. +*ContractInvocationsAPI* | [**ListContractInvocations**](docs/ContractInvocationsAPI.md#listcontractinvocations) | **Get** /v1/wallets/{wallet_id}/addresses/{address_id}/contract_invocations | List contract invocations for an address. *ExternalAddressesAPI* | [**GetExternalAddressBalance**](docs/ExternalAddressesAPI.md#getexternaladdressbalance) | **Get** /v1/networks/{network_id}/addresses/{address_id}/balances/{asset_id} | Get the balance of an asset in an external address -*ExternalAddressesAPI* | [**ListAddressHistoricalBalance**](docs/ExternalAddressesAPI.md#listaddresshistoricalbalance) | **Get** /v1/networks/{network_id}/addresses/{address_id}/balance_history/{asset_id} | Get address balance history for asset +*ExternalAddressesAPI* | [**ListAddressTransactions**](docs/ExternalAddressesAPI.md#listaddresstransactions) | **Get** /v1/networks/{network_id}/addresses/{address_id}/transactions | List transactions for an address. *ExternalAddressesAPI* | [**ListExternalAddressBalances**](docs/ExternalAddressesAPI.md#listexternaladdressbalances) | **Get** /v1/networks/{network_id}/addresses/{address_id}/balances | Get the balances of an external address *ExternalAddressesAPI* | [**RequestExternalFaucetFunds**](docs/ExternalAddressesAPI.md#requestexternalfaucetfunds) | **Post** /v1/networks/{network_id}/addresses/{address_id}/faucet | Request faucet funds for external address. *NetworksAPI* | [**GetNetwork**](docs/NetworksAPI.md#getnetwork) | **Get** /v1/networks/{network_id} | Get network by ID @@ -97,6 +105,10 @@ Class | Method | HTTP request | Description *ServerSignersAPI* | [**ListServerSigners**](docs/ServerSignersAPI.md#listserversigners) | **Get** /v1/server_signers | List server signers for the current project *ServerSignersAPI* | [**SubmitServerSignerSeedEventResult**](docs/ServerSignersAPI.md#submitserversignerseedeventresult) | **Post** /v1/server_signers/{server_signer_id}/seed_event_result | Submit the result of a server signer event *ServerSignersAPI* | [**SubmitServerSignerSignatureEventResult**](docs/ServerSignersAPI.md#submitserversignersignatureeventresult) | **Post** /v1/server_signers/{server_signer_id}/signature_event_result | Submit the result of a server signer event +*SmartContractsAPI* | [**CreateSmartContract**](docs/SmartContractsAPI.md#createsmartcontract) | **Post** /v1/wallets/{wallet_id}/addresses/{address_id}/smart_contracts | Create a new smart contract +*SmartContractsAPI* | [**DeploySmartContract**](docs/SmartContractsAPI.md#deploysmartcontract) | **Post** /v1/wallets/{wallet_id}/addresses/{address_id}/smart_contracts/{smart_contract_id}/deploy | Deploy a smart contract +*SmartContractsAPI* | [**GetSmartContract**](docs/SmartContractsAPI.md#getsmartcontract) | **Get** /v1/wallets/{wallet_id}/addresses/{address_id}/smart_contracts/{smart_contract_id} | Get a specific smart contract deployed by address +*SmartContractsAPI* | [**ListSmartContracts**](docs/SmartContractsAPI.md#listsmartcontracts) | **Get** /v1/wallets/{wallet_id}/addresses/{address_id}/smart_contracts | List smart contracts deployed by address *StakeAPI* | [**BuildStakingOperation**](docs/StakeAPI.md#buildstakingoperation) | **Post** /v1/stake/build | Build a new staking operation *StakeAPI* | [**FetchHistoricalStakingBalances**](docs/StakeAPI.md#fetchhistoricalstakingbalances) | **Get** /v1/networks/{network_id}/addresses/{address_id}/stake/balances | Fetch historical staking balances *StakeAPI* | [**FetchStakingRewards**](docs/StakeAPI.md#fetchstakingrewards) | **Post** /v1/stake/rewards/search | Fetch staking rewards @@ -133,23 +145,37 @@ Class | Method | HTTP request | Description - [AddressBalanceList](docs/AddressBalanceList.md) - [AddressHistoricalBalanceList](docs/AddressHistoricalBalanceList.md) - [AddressList](docs/AddressList.md) + - [AddressTransactionList](docs/AddressTransactionList.md) - [Asset](docs/Asset.md) - [Balance](docs/Balance.md) + - [BroadcastContractInvocationRequest](docs/BroadcastContractInvocationRequest.md) - [BroadcastStakingOperationRequest](docs/BroadcastStakingOperationRequest.md) - [BroadcastTradeRequest](docs/BroadcastTradeRequest.md) - [BroadcastTransferRequest](docs/BroadcastTransferRequest.md) - [BuildStakingOperationRequest](docs/BuildStakingOperationRequest.md) - [ContractEvent](docs/ContractEvent.md) - [ContractEventList](docs/ContractEventList.md) + - [ContractInvocation](docs/ContractInvocation.md) + - [ContractInvocationList](docs/ContractInvocationList.md) - [CreateAddressRequest](docs/CreateAddressRequest.md) + - [CreateContractInvocationRequest](docs/CreateContractInvocationRequest.md) + - [CreatePayloadSignatureRequest](docs/CreatePayloadSignatureRequest.md) - [CreateServerSignerRequest](docs/CreateServerSignerRequest.md) + - [CreateSmartContractRequest](docs/CreateSmartContractRequest.md) - [CreateStakingOperationRequest](docs/CreateStakingOperationRequest.md) - [CreateTradeRequest](docs/CreateTradeRequest.md) - [CreateTransferRequest](docs/CreateTransferRequest.md) - [CreateWalletRequest](docs/CreateWalletRequest.md) - [CreateWalletRequestWallet](docs/CreateWalletRequestWallet.md) - [CreateWebhookRequest](docs/CreateWebhookRequest.md) + - [DeploySmartContractRequest](docs/DeploySmartContractRequest.md) + - [ERC20TransferEvent](docs/ERC20TransferEvent.md) + - [ERC721TransferEvent](docs/ERC721TransferEvent.md) - [Error](docs/Error.md) + - [EthereumTransaction](docs/EthereumTransaction.md) + - [EthereumTransactionAccess](docs/EthereumTransactionAccess.md) + - [EthereumTransactionAccessList](docs/EthereumTransactionAccessList.md) + - [EthereumTransactionFlattenedTrace](docs/EthereumTransactionFlattenedTrace.md) - [EthereumValidatorMetadata](docs/EthereumValidatorMetadata.md) - [FaucetTransaction](docs/FaucetTransaction.md) - [FeatureSet](docs/FeatureSet.md) @@ -158,8 +184,11 @@ Class | Method | HTTP request | Description - [FetchStakingRewardsRequest](docs/FetchStakingRewardsRequest.md) - [GetStakingContextRequest](docs/GetStakingContextRequest.md) - [HistoricalBalance](docs/HistoricalBalance.md) + - [NFTContractOptions](docs/NFTContractOptions.md) - [Network](docs/Network.md) - [NetworkIdentifier](docs/NetworkIdentifier.md) + - [PayloadSignature](docs/PayloadSignature.md) + - [PayloadSignatureList](docs/PayloadSignatureList.md) - [SeedCreationEvent](docs/SeedCreationEvent.md) - [SeedCreationEventResult](docs/SeedCreationEventResult.md) - [ServerSigner](docs/ServerSigner.md) @@ -170,6 +199,10 @@ Class | Method | HTTP request | Description - [SignatureCreationEvent](docs/SignatureCreationEvent.md) - [SignatureCreationEventResult](docs/SignatureCreationEventResult.md) - [SignedVoluntaryExitMessageMetadata](docs/SignedVoluntaryExitMessageMetadata.md) + - [SmartContract](docs/SmartContract.md) + - [SmartContractList](docs/SmartContractList.md) + - [SmartContractOptions](docs/SmartContractOptions.md) + - [SmartContractType](docs/SmartContractType.md) - [SponsoredSend](docs/SponsoredSend.md) - [StakingBalance](docs/StakingBalance.md) - [StakingContext](docs/StakingContext.md) @@ -179,9 +212,11 @@ Class | Method | HTTP request | Description - [StakingReward](docs/StakingReward.md) - [StakingRewardFormat](docs/StakingRewardFormat.md) - [StakingRewardUSDValue](docs/StakingRewardUSDValue.md) + - [TokenContractOptions](docs/TokenContractOptions.md) - [Trade](docs/Trade.md) - [TradeList](docs/TradeList.md) - [Transaction](docs/Transaction.md) + - [TransactionContent](docs/TransactionContent.md) - [TransactionType](docs/TransactionType.md) - [Transfer](docs/Transfer.md) - [TransferList](docs/TransferList.md) @@ -196,7 +231,9 @@ Class | Method | HTTP request | Description - [Webhook](docs/Webhook.md) - [WebhookEventFilter](docs/WebhookEventFilter.md) - [WebhookEventType](docs/WebhookEventType.md) + - [WebhookEventTypeFilter](docs/WebhookEventTypeFilter.md) - [WebhookList](docs/WebhookList.md) + - [WebhookWalletActivityFilter](docs/WebhookWalletActivityFilter.md) ## Documentation For Authorization diff --git a/gen/client/api_addresses.go b/gen/client/api_addresses.go index bb86901..f3e3056 100644 --- a/gen/client/api_addresses.go +++ b/gen/client/api_addresses.go @@ -37,6 +37,22 @@ type AddressesAPI interface { // @return Address CreateAddressExecute(r ApiCreateAddressRequest) (*Address, *http.Response, error) + /* + CreatePayloadSignature Create a new payload signature. + + Create a new payload signature with an address. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param walletId The ID of the wallet the address belongs to. + @param addressId The onchain address of the address to sign the payload with. + @return ApiCreatePayloadSignatureRequest + */ + CreatePayloadSignature(ctx context.Context, walletId string, addressId string) ApiCreatePayloadSignatureRequest + + // CreatePayloadSignatureExecute executes the request + // @return PayloadSignature + CreatePayloadSignatureExecute(r ApiCreatePayloadSignatureRequest) (*PayloadSignature, *http.Response, error) + /* GetAddress Get address by onchain address @@ -70,6 +86,23 @@ type AddressesAPI interface { // @return Balance GetAddressBalanceExecute(r ApiGetAddressBalanceRequest) (*Balance, *http.Response, error) + /* + GetPayloadSignature Get payload signature. + + Get payload signature. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param walletId The ID of the wallet the address belongs to. + @param addressId The onchain address of the address that signed the payload. + @param payloadSignatureId The ID of the payload signature to fetch. + @return ApiGetPayloadSignatureRequest + */ + GetPayloadSignature(ctx context.Context, walletId string, addressId string, payloadSignatureId string) ApiGetPayloadSignatureRequest + + // GetPayloadSignatureExecute executes the request + // @return PayloadSignature + GetPayloadSignatureExecute(r ApiGetPayloadSignatureRequest) (*PayloadSignature, *http.Response, error) + /* ListAddressBalances Get all balances for address @@ -101,6 +134,22 @@ type AddressesAPI interface { // @return AddressList ListAddressesExecute(r ApiListAddressesRequest) (*AddressList, *http.Response, error) + /* + ListPayloadSignatures List payload signatures for an address. + + List payload signatures for an address. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param walletId The ID of the wallet the address belongs to. + @param addressId The onchain address of the address whose payload signatures to fetch. + @return ApiListPayloadSignaturesRequest + */ + ListPayloadSignatures(ctx context.Context, walletId string, addressId string) ApiListPayloadSignaturesRequest + + // ListPayloadSignaturesExecute executes the request + // @return PayloadSignatureList + ListPayloadSignaturesExecute(r ApiListPayloadSignaturesRequest) (*PayloadSignatureList, *http.Response, error) + /* RequestFaucetFunds Request faucet funds for onchain address. @@ -240,6 +289,129 @@ func (a *AddressesAPIService) CreateAddressExecute(r ApiCreateAddressRequest) (* return localVarReturnValue, localVarHTTPResponse, nil } +type ApiCreatePayloadSignatureRequest struct { + ctx context.Context + ApiService AddressesAPI + walletId string + addressId string + createPayloadSignatureRequest *CreatePayloadSignatureRequest +} + +func (r ApiCreatePayloadSignatureRequest) CreatePayloadSignatureRequest(createPayloadSignatureRequest CreatePayloadSignatureRequest) ApiCreatePayloadSignatureRequest { + r.createPayloadSignatureRequest = &createPayloadSignatureRequest + return r +} + +func (r ApiCreatePayloadSignatureRequest) Execute() (*PayloadSignature, *http.Response, error) { + return r.ApiService.CreatePayloadSignatureExecute(r) +} + +/* +CreatePayloadSignature Create a new payload signature. + +Create a new payload signature with an address. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param walletId The ID of the wallet the address belongs to. + @param addressId The onchain address of the address to sign the payload with. + @return ApiCreatePayloadSignatureRequest +*/ +func (a *AddressesAPIService) CreatePayloadSignature(ctx context.Context, walletId string, addressId string) ApiCreatePayloadSignatureRequest { + return ApiCreatePayloadSignatureRequest{ + ApiService: a, + ctx: ctx, + walletId: walletId, + addressId: addressId, + } +} + +// Execute executes the request +// @return PayloadSignature +func (a *AddressesAPIService) CreatePayloadSignatureExecute(r ApiCreatePayloadSignatureRequest) (*PayloadSignature, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *PayloadSignature + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AddressesAPIService.CreatePayloadSignature") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/wallets/{wallet_id}/addresses/{address_id}/payload_signatures" + localVarPath = strings.Replace(localVarPath, "{"+"wallet_id"+"}", url.PathEscape(parameterValueToString(r.walletId, "walletId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"address_id"+"}", url.PathEscape(parameterValueToString(r.addressId, "addressId")), -1) + + 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"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createPayloadSignatureRequest + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + type ApiGetAddressRequest struct { ctx context.Context ApiService AddressesAPI @@ -474,6 +646,125 @@ func (a *AddressesAPIService) GetAddressBalanceExecute(r ApiGetAddressBalanceReq return localVarReturnValue, localVarHTTPResponse, nil } +type ApiGetPayloadSignatureRequest struct { + ctx context.Context + ApiService AddressesAPI + walletId string + addressId string + payloadSignatureId string +} + +func (r ApiGetPayloadSignatureRequest) Execute() (*PayloadSignature, *http.Response, error) { + return r.ApiService.GetPayloadSignatureExecute(r) +} + +/* +GetPayloadSignature Get payload signature. + +Get payload signature. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param walletId The ID of the wallet the address belongs to. + @param addressId The onchain address of the address that signed the payload. + @param payloadSignatureId The ID of the payload signature to fetch. + @return ApiGetPayloadSignatureRequest +*/ +func (a *AddressesAPIService) GetPayloadSignature(ctx context.Context, walletId string, addressId string, payloadSignatureId string) ApiGetPayloadSignatureRequest { + return ApiGetPayloadSignatureRequest{ + ApiService: a, + ctx: ctx, + walletId: walletId, + addressId: addressId, + payloadSignatureId: payloadSignatureId, + } +} + +// Execute executes the request +// @return PayloadSignature +func (a *AddressesAPIService) GetPayloadSignatureExecute(r ApiGetPayloadSignatureRequest) (*PayloadSignature, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *PayloadSignature + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AddressesAPIService.GetPayloadSignature") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/wallets/{wallet_id}/addresses/{address_id}/payload_signatures/{payload_signature_id}" + localVarPath = strings.Replace(localVarPath, "{"+"wallet_id"+"}", url.PathEscape(parameterValueToString(r.walletId, "walletId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"address_id"+"}", url.PathEscape(parameterValueToString(r.addressId, "addressId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"payload_signature_id"+"}", url.PathEscape(parameterValueToString(r.payloadSignatureId, "payloadSignatureId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // 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"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + type ApiListAddressBalancesRequest struct { ctx context.Context ApiService AddressesAPI @@ -535,7 +826,7 @@ func (a *AddressesAPIService) ListAddressBalancesExecute(r ApiListAddressBalance localVarFormParams := url.Values{} if r.page != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "form", "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -663,10 +954,145 @@ func (a *AddressesAPIService) ListAddressesExecute(r ApiListAddressesRequest) (* localVarFormParams := url.Values{} if r.limit != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "form", "") } if r.page != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "form", "") + } + // 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"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiListPayloadSignaturesRequest struct { + ctx context.Context + ApiService AddressesAPI + walletId string + addressId string + limit *int32 + page *string +} + +// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10. +func (r ApiListPayloadSignaturesRequest) Limit(limit int32) ApiListPayloadSignaturesRequest { + r.limit = &limit + return r +} + +// A cursor for pagination across multiple pages of results. Don't include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results. +func (r ApiListPayloadSignaturesRequest) Page(page string) ApiListPayloadSignaturesRequest { + r.page = &page + return r +} + +func (r ApiListPayloadSignaturesRequest) Execute() (*PayloadSignatureList, *http.Response, error) { + return r.ApiService.ListPayloadSignaturesExecute(r) +} + +/* +ListPayloadSignatures List payload signatures for an address. + +List payload signatures for an address. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param walletId The ID of the wallet the address belongs to. + @param addressId The onchain address of the address whose payload signatures to fetch. + @return ApiListPayloadSignaturesRequest +*/ +func (a *AddressesAPIService) ListPayloadSignatures(ctx context.Context, walletId string, addressId string) ApiListPayloadSignaturesRequest { + return ApiListPayloadSignaturesRequest{ + ApiService: a, + ctx: ctx, + walletId: walletId, + addressId: addressId, + } +} + +// Execute executes the request +// @return PayloadSignatureList +func (a *AddressesAPIService) ListPayloadSignaturesExecute(r ApiListPayloadSignaturesRequest) (*PayloadSignatureList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *PayloadSignatureList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AddressesAPIService.ListPayloadSignatures") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/wallets/{wallet_id}/addresses/{address_id}/payload_signatures" + localVarPath = strings.Replace(localVarPath, "{"+"wallet_id"+"}", url.PathEscape(parameterValueToString(r.walletId, "walletId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"address_id"+"}", url.PathEscape(parameterValueToString(r.addressId, "addressId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.limit != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "form", "") + } + if r.page != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "form", "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -735,6 +1161,13 @@ type ApiRequestFaucetFundsRequest struct { ApiService AddressesAPI walletId string addressId string + assetId *string +} + +// The ID of the asset to transfer from the faucet. +func (r ApiRequestFaucetFundsRequest) AssetId(assetId string) ApiRequestFaucetFundsRequest { + r.assetId = &assetId + return r } func (r ApiRequestFaucetFundsRequest) Execute() (*FaucetTransaction, *http.Response, error) { @@ -783,6 +1216,9 @@ func (a *AddressesAPIService) RequestFaucetFundsExecute(r ApiRequestFaucetFundsR localVarQueryParams := url.Values{} localVarFormParams := url.Values{} + if r.assetId != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "asset_id", r.assetId, "form", "") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{} diff --git a/gen/client/api_balance_history.go b/gen/client/api_balance_history.go new file mode 100644 index 0000000..fa40d2f --- /dev/null +++ b/gen/client/api_balance_history.go @@ -0,0 +1,183 @@ +/* +Coinbase Platform API + +This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +API version: 0.0.1-alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + + +type BalanceHistoryAPI interface { + + /* + ListAddressHistoricalBalance Get address balance history for asset + + List the historical balance of an asset in a specific address. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param networkId The ID of the blockchain network + @param addressId The ID of the address to fetch the historical balance for. + @param assetId The symbol of the asset to fetch the historical balance for. + @return ApiListAddressHistoricalBalanceRequest + */ + ListAddressHistoricalBalance(ctx context.Context, networkId string, addressId string, assetId string) ApiListAddressHistoricalBalanceRequest + + // ListAddressHistoricalBalanceExecute executes the request + // @return AddressHistoricalBalanceList + ListAddressHistoricalBalanceExecute(r ApiListAddressHistoricalBalanceRequest) (*AddressHistoricalBalanceList, *http.Response, error) +} + +// BalanceHistoryAPIService BalanceHistoryAPI service +type BalanceHistoryAPIService service + +type ApiListAddressHistoricalBalanceRequest struct { + ctx context.Context + ApiService BalanceHistoryAPI + networkId string + addressId string + assetId string + limit *int32 + page *string +} + +// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10. +func (r ApiListAddressHistoricalBalanceRequest) Limit(limit int32) ApiListAddressHistoricalBalanceRequest { + r.limit = &limit + return r +} + +// A cursor for pagination across multiple pages of results. Don't include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results. +func (r ApiListAddressHistoricalBalanceRequest) Page(page string) ApiListAddressHistoricalBalanceRequest { + r.page = &page + return r +} + +func (r ApiListAddressHistoricalBalanceRequest) Execute() (*AddressHistoricalBalanceList, *http.Response, error) { + return r.ApiService.ListAddressHistoricalBalanceExecute(r) +} + +/* +ListAddressHistoricalBalance Get address balance history for asset + +List the historical balance of an asset in a specific address. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param networkId The ID of the blockchain network + @param addressId The ID of the address to fetch the historical balance for. + @param assetId The symbol of the asset to fetch the historical balance for. + @return ApiListAddressHistoricalBalanceRequest +*/ +func (a *BalanceHistoryAPIService) ListAddressHistoricalBalance(ctx context.Context, networkId string, addressId string, assetId string) ApiListAddressHistoricalBalanceRequest { + return ApiListAddressHistoricalBalanceRequest{ + ApiService: a, + ctx: ctx, + networkId: networkId, + addressId: addressId, + assetId: assetId, + } +} + +// Execute executes the request +// @return AddressHistoricalBalanceList +func (a *BalanceHistoryAPIService) ListAddressHistoricalBalanceExecute(r ApiListAddressHistoricalBalanceRequest) (*AddressHistoricalBalanceList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AddressHistoricalBalanceList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BalanceHistoryAPIService.ListAddressHistoricalBalance") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/networks/{network_id}/addresses/{address_id}/balance_history/{asset_id}" + localVarPath = strings.Replace(localVarPath, "{"+"network_id"+"}", url.PathEscape(parameterValueToString(r.networkId, "networkId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"address_id"+"}", url.PathEscape(parameterValueToString(r.addressId, "addressId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"asset_id"+"}", url.PathEscape(parameterValueToString(r.assetId, "assetId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.limit != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "form", "") + } + if r.page != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "form", "") + } + // 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"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/gen/client/api_contract_events.go b/gen/client/api_contract_events.go index 9971412..2eb0184 100644 --- a/gen/client/api_contract_events.go +++ b/gen/client/api_contract_events.go @@ -23,7 +23,7 @@ import ( type ContractEventsAPI interface { /* - ListContractEvents Get contract events + ListContractEvents List contract events Retrieve events for a specific contract @@ -96,7 +96,7 @@ func (r ApiListContractEventsRequest) Execute() (*ContractEventList, *http.Respo } /* -ListContractEvents Get contract events +ListContractEvents List contract events Retrieve events for a specific contract @@ -152,13 +152,13 @@ func (a *ContractEventsAPIService) ListContractEventsExecute(r ApiListContractEv return localVarReturnValue, nil, reportError("toBlockHeight is required and must be specified") } - parameterAddToHeaderOrQuery(localVarQueryParams, "protocol_name", r.protocolName, "") - parameterAddToHeaderOrQuery(localVarQueryParams, "contract_name", r.contractName, "") - parameterAddToHeaderOrQuery(localVarQueryParams, "event_name", r.eventName, "") - parameterAddToHeaderOrQuery(localVarQueryParams, "from_block_height", r.fromBlockHeight, "") - parameterAddToHeaderOrQuery(localVarQueryParams, "to_block_height", r.toBlockHeight, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "protocol_name", r.protocolName, "form", "") + parameterAddToHeaderOrQuery(localVarQueryParams, "contract_name", r.contractName, "form", "") + parameterAddToHeaderOrQuery(localVarQueryParams, "event_name", r.eventName, "form", "") + parameterAddToHeaderOrQuery(localVarQueryParams, "from_block_height", r.fromBlockHeight, "form", "") + parameterAddToHeaderOrQuery(localVarQueryParams, "to_block_height", r.toBlockHeight, "form", "") if r.nextPage != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "next_page", r.nextPage, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "next_page", r.nextPage, "form", "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{} diff --git a/gen/client/api_contract_invocations.go b/gen/client/api_contract_invocations.go new file mode 100644 index 0000000..3a79b17 --- /dev/null +++ b/gen/client/api_contract_invocations.go @@ -0,0 +1,603 @@ +/* +Coinbase Platform API + +This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +API version: 0.0.1-alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + + +type ContractInvocationsAPI interface { + + /* + BroadcastContractInvocation Broadcast a contract invocation. + + Broadcast a contract invocation. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param walletId The ID of the wallet the address belongs to. + @param addressId The ID of the address the contract invocation belongs to. + @param contractInvocationId The ID of the contract invocation to broadcast. + @return ApiBroadcastContractInvocationRequest + */ + BroadcastContractInvocation(ctx context.Context, walletId string, addressId string, contractInvocationId string) ApiBroadcastContractInvocationRequest + + // BroadcastContractInvocationExecute executes the request + // @return ContractInvocation + BroadcastContractInvocationExecute(r ApiBroadcastContractInvocationRequest) (*ContractInvocation, *http.Response, error) + + /* + CreateContractInvocation Create a new contract invocation for an address. + + Create a new contract invocation. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param walletId The ID of the wallet the source address belongs to. + @param addressId The ID of the address to invoke the contract from. + @return ApiCreateContractInvocationRequest + */ + CreateContractInvocation(ctx context.Context, walletId string, addressId string) ApiCreateContractInvocationRequest + + // CreateContractInvocationExecute executes the request + // @return ContractInvocation + CreateContractInvocationExecute(r ApiCreateContractInvocationRequest) (*ContractInvocation, *http.Response, error) + + /* + GetContractInvocation Get a contract invocation by ID. + + Get a contract invocation by ID. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param walletId The ID of the wallet the address belongs to. + @param addressId The ID of the address the contract invocation belongs to. + @param contractInvocationId The ID of the contract invocation to fetch. + @return ApiGetContractInvocationRequest + */ + GetContractInvocation(ctx context.Context, walletId string, addressId string, contractInvocationId string) ApiGetContractInvocationRequest + + // GetContractInvocationExecute executes the request + // @return ContractInvocation + GetContractInvocationExecute(r ApiGetContractInvocationRequest) (*ContractInvocation, *http.Response, error) + + /* + ListContractInvocations List contract invocations for an address. + + List contract invocations for an address. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param walletId The ID of the wallet the address belongs to. + @param addressId The ID of the address to list contract invocations for. + @return ApiListContractInvocationsRequest + */ + ListContractInvocations(ctx context.Context, walletId string, addressId string) ApiListContractInvocationsRequest + + // ListContractInvocationsExecute executes the request + // @return ContractInvocationList + ListContractInvocationsExecute(r ApiListContractInvocationsRequest) (*ContractInvocationList, *http.Response, error) +} + +// ContractInvocationsAPIService ContractInvocationsAPI service +type ContractInvocationsAPIService service + +type ApiBroadcastContractInvocationRequest struct { + ctx context.Context + ApiService ContractInvocationsAPI + walletId string + addressId string + contractInvocationId string + broadcastContractInvocationRequest *BroadcastContractInvocationRequest +} + +func (r ApiBroadcastContractInvocationRequest) BroadcastContractInvocationRequest(broadcastContractInvocationRequest BroadcastContractInvocationRequest) ApiBroadcastContractInvocationRequest { + r.broadcastContractInvocationRequest = &broadcastContractInvocationRequest + return r +} + +func (r ApiBroadcastContractInvocationRequest) Execute() (*ContractInvocation, *http.Response, error) { + return r.ApiService.BroadcastContractInvocationExecute(r) +} + +/* +BroadcastContractInvocation Broadcast a contract invocation. + +Broadcast a contract invocation. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param walletId The ID of the wallet the address belongs to. + @param addressId The ID of the address the contract invocation belongs to. + @param contractInvocationId The ID of the contract invocation to broadcast. + @return ApiBroadcastContractInvocationRequest +*/ +func (a *ContractInvocationsAPIService) BroadcastContractInvocation(ctx context.Context, walletId string, addressId string, contractInvocationId string) ApiBroadcastContractInvocationRequest { + return ApiBroadcastContractInvocationRequest{ + ApiService: a, + ctx: ctx, + walletId: walletId, + addressId: addressId, + contractInvocationId: contractInvocationId, + } +} + +// Execute executes the request +// @return ContractInvocation +func (a *ContractInvocationsAPIService) BroadcastContractInvocationExecute(r ApiBroadcastContractInvocationRequest) (*ContractInvocation, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ContractInvocation + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ContractInvocationsAPIService.BroadcastContractInvocation") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/wallets/{wallet_id}/addresses/{address_id}/contract_invocations/{contract_invocation_id}/broadcast" + localVarPath = strings.Replace(localVarPath, "{"+"wallet_id"+"}", url.PathEscape(parameterValueToString(r.walletId, "walletId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"address_id"+"}", url.PathEscape(parameterValueToString(r.addressId, "addressId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"contract_invocation_id"+"}", url.PathEscape(parameterValueToString(r.contractInvocationId, "contractInvocationId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.broadcastContractInvocationRequest == nil { + return localVarReturnValue, nil, reportError("broadcastContractInvocationRequest is required and must be specified") + } + + // 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"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.broadcastContractInvocationRequest + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiCreateContractInvocationRequest struct { + ctx context.Context + ApiService ContractInvocationsAPI + walletId string + addressId string + createContractInvocationRequest *CreateContractInvocationRequest +} + +func (r ApiCreateContractInvocationRequest) CreateContractInvocationRequest(createContractInvocationRequest CreateContractInvocationRequest) ApiCreateContractInvocationRequest { + r.createContractInvocationRequest = &createContractInvocationRequest + return r +} + +func (r ApiCreateContractInvocationRequest) Execute() (*ContractInvocation, *http.Response, error) { + return r.ApiService.CreateContractInvocationExecute(r) +} + +/* +CreateContractInvocation Create a new contract invocation for an address. + +Create a new contract invocation. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param walletId The ID of the wallet the source address belongs to. + @param addressId The ID of the address to invoke the contract from. + @return ApiCreateContractInvocationRequest +*/ +func (a *ContractInvocationsAPIService) CreateContractInvocation(ctx context.Context, walletId string, addressId string) ApiCreateContractInvocationRequest { + return ApiCreateContractInvocationRequest{ + ApiService: a, + ctx: ctx, + walletId: walletId, + addressId: addressId, + } +} + +// Execute executes the request +// @return ContractInvocation +func (a *ContractInvocationsAPIService) CreateContractInvocationExecute(r ApiCreateContractInvocationRequest) (*ContractInvocation, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ContractInvocation + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ContractInvocationsAPIService.CreateContractInvocation") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/wallets/{wallet_id}/addresses/{address_id}/contract_invocations" + localVarPath = strings.Replace(localVarPath, "{"+"wallet_id"+"}", url.PathEscape(parameterValueToString(r.walletId, "walletId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"address_id"+"}", url.PathEscape(parameterValueToString(r.addressId, "addressId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createContractInvocationRequest == nil { + return localVarReturnValue, nil, reportError("createContractInvocationRequest is required and must be specified") + } + + // 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"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createContractInvocationRequest + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetContractInvocationRequest struct { + ctx context.Context + ApiService ContractInvocationsAPI + walletId string + addressId string + contractInvocationId string +} + +func (r ApiGetContractInvocationRequest) Execute() (*ContractInvocation, *http.Response, error) { + return r.ApiService.GetContractInvocationExecute(r) +} + +/* +GetContractInvocation Get a contract invocation by ID. + +Get a contract invocation by ID. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param walletId The ID of the wallet the address belongs to. + @param addressId The ID of the address the contract invocation belongs to. + @param contractInvocationId The ID of the contract invocation to fetch. + @return ApiGetContractInvocationRequest +*/ +func (a *ContractInvocationsAPIService) GetContractInvocation(ctx context.Context, walletId string, addressId string, contractInvocationId string) ApiGetContractInvocationRequest { + return ApiGetContractInvocationRequest{ + ApiService: a, + ctx: ctx, + walletId: walletId, + addressId: addressId, + contractInvocationId: contractInvocationId, + } +} + +// Execute executes the request +// @return ContractInvocation +func (a *ContractInvocationsAPIService) GetContractInvocationExecute(r ApiGetContractInvocationRequest) (*ContractInvocation, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ContractInvocation + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ContractInvocationsAPIService.GetContractInvocation") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/wallets/{wallet_id}/addresses/{address_id}/contract_invocations/{contract_invocation_id}" + localVarPath = strings.Replace(localVarPath, "{"+"wallet_id"+"}", url.PathEscape(parameterValueToString(r.walletId, "walletId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"address_id"+"}", url.PathEscape(parameterValueToString(r.addressId, "addressId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"contract_invocation_id"+"}", url.PathEscape(parameterValueToString(r.contractInvocationId, "contractInvocationId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // 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"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiListContractInvocationsRequest struct { + ctx context.Context + ApiService ContractInvocationsAPI + walletId string + addressId string + limit *int32 + page *string +} + +// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10. +func (r ApiListContractInvocationsRequest) Limit(limit int32) ApiListContractInvocationsRequest { + r.limit = &limit + return r +} + +// A cursor for pagination across multiple pages of results. Don't include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results. +func (r ApiListContractInvocationsRequest) Page(page string) ApiListContractInvocationsRequest { + r.page = &page + return r +} + +func (r ApiListContractInvocationsRequest) Execute() (*ContractInvocationList, *http.Response, error) { + return r.ApiService.ListContractInvocationsExecute(r) +} + +/* +ListContractInvocations List contract invocations for an address. + +List contract invocations for an address. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param walletId The ID of the wallet the address belongs to. + @param addressId The ID of the address to list contract invocations for. + @return ApiListContractInvocationsRequest +*/ +func (a *ContractInvocationsAPIService) ListContractInvocations(ctx context.Context, walletId string, addressId string) ApiListContractInvocationsRequest { + return ApiListContractInvocationsRequest{ + ApiService: a, + ctx: ctx, + walletId: walletId, + addressId: addressId, + } +} + +// Execute executes the request +// @return ContractInvocationList +func (a *ContractInvocationsAPIService) ListContractInvocationsExecute(r ApiListContractInvocationsRequest) (*ContractInvocationList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ContractInvocationList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ContractInvocationsAPIService.ListContractInvocations") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/wallets/{wallet_id}/addresses/{address_id}/contract_invocations" + localVarPath = strings.Replace(localVarPath, "{"+"wallet_id"+"}", url.PathEscape(parameterValueToString(r.walletId, "walletId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"address_id"+"}", url.PathEscape(parameterValueToString(r.addressId, "addressId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.limit != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "form", "") + } + if r.page != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "form", "") + } + // 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"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/gen/client/api_external_addresses.go b/gen/client/api_external_addresses.go index d6a1565..f692255 100644 --- a/gen/client/api_external_addresses.go +++ b/gen/client/api_external_addresses.go @@ -40,21 +40,20 @@ type ExternalAddressesAPI interface { GetExternalAddressBalanceExecute(r ApiGetExternalAddressBalanceRequest) (*Balance, *http.Response, error) /* - ListAddressHistoricalBalance Get address balance history for asset + ListAddressTransactions List transactions for an address. - List the historical balance of an asset in a specific address. + List all transactions that interact with the address. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param networkId The ID of the blockchain network - @param addressId The ID of the address to fetch the historical balance for. - @param assetId The symbol of the asset to fetch the historical balance for. - @return ApiListAddressHistoricalBalanceRequest + @param addressId The ID of the address to fetch the transactions for. + @return ApiListAddressTransactionsRequest */ - ListAddressHistoricalBalance(ctx context.Context, networkId string, addressId string, assetId string) ApiListAddressHistoricalBalanceRequest + ListAddressTransactions(ctx context.Context, networkId string, addressId string) ApiListAddressTransactionsRequest - // ListAddressHistoricalBalanceExecute executes the request - // @return AddressHistoricalBalanceList - ListAddressHistoricalBalanceExecute(r ApiListAddressHistoricalBalanceRequest) (*AddressHistoricalBalanceList, *http.Response, error) + // ListAddressTransactionsExecute executes the request + // @return AddressTransactionList + ListAddressTransactionsExecute(r ApiListAddressTransactionsRequest) (*AddressTransactionList, *http.Response, error) /* ListExternalAddressBalances Get the balances of an external address @@ -211,82 +210,78 @@ func (a *ExternalAddressesAPIService) GetExternalAddressBalanceExecute(r ApiGetE return localVarReturnValue, localVarHTTPResponse, nil } -type ApiListAddressHistoricalBalanceRequest struct { +type ApiListAddressTransactionsRequest struct { ctx context.Context ApiService ExternalAddressesAPI networkId string addressId string - assetId string limit *int32 page *string } // A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10. -func (r ApiListAddressHistoricalBalanceRequest) Limit(limit int32) ApiListAddressHistoricalBalanceRequest { +func (r ApiListAddressTransactionsRequest) Limit(limit int32) ApiListAddressTransactionsRequest { r.limit = &limit return r } // A cursor for pagination across multiple pages of results. Don't include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results. -func (r ApiListAddressHistoricalBalanceRequest) Page(page string) ApiListAddressHistoricalBalanceRequest { +func (r ApiListAddressTransactionsRequest) Page(page string) ApiListAddressTransactionsRequest { r.page = &page return r } -func (r ApiListAddressHistoricalBalanceRequest) Execute() (*AddressHistoricalBalanceList, *http.Response, error) { - return r.ApiService.ListAddressHistoricalBalanceExecute(r) +func (r ApiListAddressTransactionsRequest) Execute() (*AddressTransactionList, *http.Response, error) { + return r.ApiService.ListAddressTransactionsExecute(r) } /* -ListAddressHistoricalBalance Get address balance history for asset +ListAddressTransactions List transactions for an address. -List the historical balance of an asset in a specific address. +List all transactions that interact with the address. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param networkId The ID of the blockchain network - @param addressId The ID of the address to fetch the historical balance for. - @param assetId The symbol of the asset to fetch the historical balance for. - @return ApiListAddressHistoricalBalanceRequest + @param addressId The ID of the address to fetch the transactions for. + @return ApiListAddressTransactionsRequest */ -func (a *ExternalAddressesAPIService) ListAddressHistoricalBalance(ctx context.Context, networkId string, addressId string, assetId string) ApiListAddressHistoricalBalanceRequest { - return ApiListAddressHistoricalBalanceRequest{ +func (a *ExternalAddressesAPIService) ListAddressTransactions(ctx context.Context, networkId string, addressId string) ApiListAddressTransactionsRequest { + return ApiListAddressTransactionsRequest{ ApiService: a, ctx: ctx, networkId: networkId, addressId: addressId, - assetId: assetId, } } // Execute executes the request -// @return AddressHistoricalBalanceList -func (a *ExternalAddressesAPIService) ListAddressHistoricalBalanceExecute(r ApiListAddressHistoricalBalanceRequest) (*AddressHistoricalBalanceList, *http.Response, error) { +// @return AddressTransactionList +func (a *ExternalAddressesAPIService) ListAddressTransactionsExecute(r ApiListAddressTransactionsRequest) (*AddressTransactionList, *http.Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *AddressHistoricalBalanceList + localVarReturnValue *AddressTransactionList ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ExternalAddressesAPIService.ListAddressHistoricalBalance") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ExternalAddressesAPIService.ListAddressTransactions") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/v1/networks/{network_id}/addresses/{address_id}/balance_history/{asset_id}" + localVarPath := localBasePath + "/v1/networks/{network_id}/addresses/{address_id}/transactions" localVarPath = strings.Replace(localVarPath, "{"+"network_id"+"}", url.PathEscape(parameterValueToString(r.networkId, "networkId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"address_id"+"}", url.PathEscape(parameterValueToString(r.addressId, "addressId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"asset_id"+"}", url.PathEscape(parameterValueToString(r.assetId, "assetId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if r.limit != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "form", "") } if r.page != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "form", "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -411,7 +406,7 @@ func (a *ExternalAddressesAPIService) ListExternalAddressBalancesExecute(r ApiLi localVarFormParams := url.Values{} if r.page != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "form", "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -480,6 +475,13 @@ type ApiRequestExternalFaucetFundsRequest struct { ApiService ExternalAddressesAPI networkId string addressId string + assetId *string +} + +// The ID of the asset to transfer from the faucet. +func (r ApiRequestExternalFaucetFundsRequest) AssetId(assetId string) ApiRequestExternalFaucetFundsRequest { + r.assetId = &assetId + return r } func (r ApiRequestExternalFaucetFundsRequest) Execute() (*FaucetTransaction, *http.Response, error) { @@ -528,6 +530,9 @@ func (a *ExternalAddressesAPIService) RequestExternalFaucetFundsExecute(r ApiReq localVarQueryParams := url.Values{} localVarFormParams := url.Values{} + if r.assetId != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "asset_id", r.assetId, "form", "") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{} diff --git a/gen/client/api_server_signers.go b/gen/client/api_server_signers.go index 7c9cfe0..c38d2bf 100644 --- a/gen/client/api_server_signers.go +++ b/gen/client/api_server_signers.go @@ -404,10 +404,10 @@ func (a *ServerSignersAPIService) ListServerSignerEventsExecute(r ApiListServerS localVarFormParams := url.Values{} if r.limit != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "form", "") } if r.page != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "form", "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -531,10 +531,10 @@ func (a *ServerSignersAPIService) ListServerSignersExecute(r ApiListServerSigner localVarFormParams := url.Values{} if r.limit != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "form", "") } if r.page != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "form", "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{} diff --git a/gen/client/api_smart_contracts.go b/gen/client/api_smart_contracts.go new file mode 100644 index 0000000..03eadbd --- /dev/null +++ b/gen/client/api_smart_contracts.go @@ -0,0 +1,583 @@ +/* +Coinbase Platform API + +This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +API version: 0.0.1-alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + + +type SmartContractsAPI interface { + + /* + CreateSmartContract Create a new smart contract + + Create a new smart contract + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param walletId The ID of the wallet the address belongs to. + @param addressId The ID of the address to deploy the smart contract from. + @return ApiCreateSmartContractRequest + */ + CreateSmartContract(ctx context.Context, walletId string, addressId string) ApiCreateSmartContractRequest + + // CreateSmartContractExecute executes the request + // @return SmartContract + CreateSmartContractExecute(r ApiCreateSmartContractRequest) (*SmartContract, *http.Response, error) + + /* + DeploySmartContract Deploy a smart contract + + Deploys a smart contract, by broadcasting the transaction to the network. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param walletId The ID of the wallet the address belongs to. + @param addressId The ID of the address to broadcast the transaction from. + @param smartContractId The UUID of the smart contract to broadcast the transaction to. + @return ApiDeploySmartContractRequest + */ + DeploySmartContract(ctx context.Context, walletId string, addressId string, smartContractId string) ApiDeploySmartContractRequest + + // DeploySmartContractExecute executes the request + // @return SmartContract + DeploySmartContractExecute(r ApiDeploySmartContractRequest) (*SmartContract, *http.Response, error) + + /* + GetSmartContract Get a specific smart contract deployed by address + + Get a specific smart contract deployed by address. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param walletId The ID of the wallet the address belongs to. + @param addressId The ID of the address to fetch the smart contract for. + @param smartContractId The UUID of the smart contract to fetch. + @return ApiGetSmartContractRequest + */ + GetSmartContract(ctx context.Context, walletId string, addressId string, smartContractId string) ApiGetSmartContractRequest + + // GetSmartContractExecute executes the request + // @return SmartContract + GetSmartContractExecute(r ApiGetSmartContractRequest) (*SmartContract, *http.Response, error) + + /* + ListSmartContracts List smart contracts deployed by address + + List all smart contracts deployed by address. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param walletId The ID of the wallet the address belongs to. + @param addressId The ID of the address to fetch the smart contracts for. + @return ApiListSmartContractsRequest + */ + ListSmartContracts(ctx context.Context, walletId string, addressId string) ApiListSmartContractsRequest + + // ListSmartContractsExecute executes the request + // @return SmartContractList + ListSmartContractsExecute(r ApiListSmartContractsRequest) (*SmartContractList, *http.Response, error) +} + +// SmartContractsAPIService SmartContractsAPI service +type SmartContractsAPIService service + +type ApiCreateSmartContractRequest struct { + ctx context.Context + ApiService SmartContractsAPI + walletId string + addressId string + createSmartContractRequest *CreateSmartContractRequest +} + +func (r ApiCreateSmartContractRequest) CreateSmartContractRequest(createSmartContractRequest CreateSmartContractRequest) ApiCreateSmartContractRequest { + r.createSmartContractRequest = &createSmartContractRequest + return r +} + +func (r ApiCreateSmartContractRequest) Execute() (*SmartContract, *http.Response, error) { + return r.ApiService.CreateSmartContractExecute(r) +} + +/* +CreateSmartContract Create a new smart contract + +Create a new smart contract + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param walletId The ID of the wallet the address belongs to. + @param addressId The ID of the address to deploy the smart contract from. + @return ApiCreateSmartContractRequest +*/ +func (a *SmartContractsAPIService) CreateSmartContract(ctx context.Context, walletId string, addressId string) ApiCreateSmartContractRequest { + return ApiCreateSmartContractRequest{ + ApiService: a, + ctx: ctx, + walletId: walletId, + addressId: addressId, + } +} + +// Execute executes the request +// @return SmartContract +func (a *SmartContractsAPIService) CreateSmartContractExecute(r ApiCreateSmartContractRequest) (*SmartContract, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SmartContract + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SmartContractsAPIService.CreateSmartContract") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/wallets/{wallet_id}/addresses/{address_id}/smart_contracts" + localVarPath = strings.Replace(localVarPath, "{"+"wallet_id"+"}", url.PathEscape(parameterValueToString(r.walletId, "walletId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"address_id"+"}", url.PathEscape(parameterValueToString(r.addressId, "addressId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createSmartContractRequest == nil { + return localVarReturnValue, nil, reportError("createSmartContractRequest is required and must be specified") + } + + // 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"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createSmartContractRequest + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiDeploySmartContractRequest struct { + ctx context.Context + ApiService SmartContractsAPI + walletId string + addressId string + smartContractId string + deploySmartContractRequest *DeploySmartContractRequest +} + +func (r ApiDeploySmartContractRequest) DeploySmartContractRequest(deploySmartContractRequest DeploySmartContractRequest) ApiDeploySmartContractRequest { + r.deploySmartContractRequest = &deploySmartContractRequest + return r +} + +func (r ApiDeploySmartContractRequest) Execute() (*SmartContract, *http.Response, error) { + return r.ApiService.DeploySmartContractExecute(r) +} + +/* +DeploySmartContract Deploy a smart contract + +Deploys a smart contract, by broadcasting the transaction to the network. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param walletId The ID of the wallet the address belongs to. + @param addressId The ID of the address to broadcast the transaction from. + @param smartContractId The UUID of the smart contract to broadcast the transaction to. + @return ApiDeploySmartContractRequest +*/ +func (a *SmartContractsAPIService) DeploySmartContract(ctx context.Context, walletId string, addressId string, smartContractId string) ApiDeploySmartContractRequest { + return ApiDeploySmartContractRequest{ + ApiService: a, + ctx: ctx, + walletId: walletId, + addressId: addressId, + smartContractId: smartContractId, + } +} + +// Execute executes the request +// @return SmartContract +func (a *SmartContractsAPIService) DeploySmartContractExecute(r ApiDeploySmartContractRequest) (*SmartContract, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SmartContract + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SmartContractsAPIService.DeploySmartContract") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/wallets/{wallet_id}/addresses/{address_id}/smart_contracts/{smart_contract_id}/deploy" + localVarPath = strings.Replace(localVarPath, "{"+"wallet_id"+"}", url.PathEscape(parameterValueToString(r.walletId, "walletId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"address_id"+"}", url.PathEscape(parameterValueToString(r.addressId, "addressId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"smart_contract_id"+"}", url.PathEscape(parameterValueToString(r.smartContractId, "smartContractId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.deploySmartContractRequest == nil { + return localVarReturnValue, nil, reportError("deploySmartContractRequest is required and must be specified") + } + + // 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"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.deploySmartContractRequest + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetSmartContractRequest struct { + ctx context.Context + ApiService SmartContractsAPI + walletId string + addressId string + smartContractId string +} + +func (r ApiGetSmartContractRequest) Execute() (*SmartContract, *http.Response, error) { + return r.ApiService.GetSmartContractExecute(r) +} + +/* +GetSmartContract Get a specific smart contract deployed by address + +Get a specific smart contract deployed by address. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param walletId The ID of the wallet the address belongs to. + @param addressId The ID of the address to fetch the smart contract for. + @param smartContractId The UUID of the smart contract to fetch. + @return ApiGetSmartContractRequest +*/ +func (a *SmartContractsAPIService) GetSmartContract(ctx context.Context, walletId string, addressId string, smartContractId string) ApiGetSmartContractRequest { + return ApiGetSmartContractRequest{ + ApiService: a, + ctx: ctx, + walletId: walletId, + addressId: addressId, + smartContractId: smartContractId, + } +} + +// Execute executes the request +// @return SmartContract +func (a *SmartContractsAPIService) GetSmartContractExecute(r ApiGetSmartContractRequest) (*SmartContract, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SmartContract + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SmartContractsAPIService.GetSmartContract") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/wallets/{wallet_id}/addresses/{address_id}/smart_contracts/{smart_contract_id}" + localVarPath = strings.Replace(localVarPath, "{"+"wallet_id"+"}", url.PathEscape(parameterValueToString(r.walletId, "walletId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"address_id"+"}", url.PathEscape(parameterValueToString(r.addressId, "addressId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"smart_contract_id"+"}", url.PathEscape(parameterValueToString(r.smartContractId, "smartContractId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // 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"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiListSmartContractsRequest struct { + ctx context.Context + ApiService SmartContractsAPI + walletId string + addressId string +} + +func (r ApiListSmartContractsRequest) Execute() (*SmartContractList, *http.Response, error) { + return r.ApiService.ListSmartContractsExecute(r) +} + +/* +ListSmartContracts List smart contracts deployed by address + +List all smart contracts deployed by address. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param walletId The ID of the wallet the address belongs to. + @param addressId The ID of the address to fetch the smart contracts for. + @return ApiListSmartContractsRequest +*/ +func (a *SmartContractsAPIService) ListSmartContracts(ctx context.Context, walletId string, addressId string) ApiListSmartContractsRequest { + return ApiListSmartContractsRequest{ + ApiService: a, + ctx: ctx, + walletId: walletId, + addressId: addressId, + } +} + +// Execute executes the request +// @return SmartContractList +func (a *SmartContractsAPIService) ListSmartContractsExecute(r ApiListSmartContractsRequest) (*SmartContractList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SmartContractList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SmartContractsAPIService.ListSmartContracts") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/wallets/{wallet_id}/addresses/{address_id}/smart_contracts" + localVarPath = strings.Replace(localVarPath, "{"+"wallet_id"+"}", url.PathEscape(parameterValueToString(r.walletId, "walletId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"address_id"+"}", url.PathEscape(parameterValueToString(r.addressId, "addressId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // 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"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/gen/client/api_stake.go b/gen/client/api_stake.go index ea5f69f..3c64df3 100644 --- a/gen/client/api_stake.go +++ b/gen/client/api_stake.go @@ -327,14 +327,14 @@ func (a *StakeAPIService) FetchHistoricalStakingBalancesExecute(r ApiFetchHistor } if r.limit != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "form", "") } if r.page != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "form", "") } - parameterAddToHeaderOrQuery(localVarQueryParams, "asset_id", r.assetId, "") - parameterAddToHeaderOrQuery(localVarQueryParams, "start_time", r.startTime, "") - parameterAddToHeaderOrQuery(localVarQueryParams, "end_time", r.endTime, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "asset_id", r.assetId, "form", "") + parameterAddToHeaderOrQuery(localVarQueryParams, "start_time", r.startTime, "form", "") + parameterAddToHeaderOrQuery(localVarQueryParams, "end_time", r.endTime, "form", "") // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -466,10 +466,10 @@ func (a *StakeAPIService) FetchStakingRewardsExecute(r ApiFetchStakingRewardsReq } if r.limit != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "form", "") } if r.page != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "form", "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/json"} diff --git a/gen/client/api_trades.go b/gen/client/api_trades.go index 7bf5b2e..02ce0b5 100644 --- a/gen/client/api_trades.go +++ b/gen/client/api_trades.go @@ -535,10 +535,10 @@ func (a *TradesAPIService) ListTradesExecute(r ApiListTradesRequest) (*TradeList localVarFormParams := url.Values{} if r.limit != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "form", "") } if r.page != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "form", "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{} diff --git a/gen/client/api_transfers.go b/gen/client/api_transfers.go index edbcbdc..85733ea 100644 --- a/gen/client/api_transfers.go +++ b/gen/client/api_transfers.go @@ -535,10 +535,10 @@ func (a *TransfersAPIService) ListTransfersExecute(r ApiListTransfersRequest) (* localVarFormParams := url.Values{} if r.limit != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "form", "") } if r.page != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "form", "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{} diff --git a/gen/client/api_validators.go b/gen/client/api_validators.go index 904c577..301bf4f 100644 --- a/gen/client/api_validators.go +++ b/gen/client/api_validators.go @@ -253,13 +253,13 @@ func (a *ValidatorsAPIService) ListValidatorsExecute(r ApiListValidatorsRequest) localVarFormParams := url.Values{} if r.status != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "status", r.status, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "status", r.status, "form", "") } if r.limit != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "form", "") } if r.page != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "form", "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{} diff --git a/gen/client/api_wallets.go b/gen/client/api_wallets.go index 21b1cad..7b7d95c 100644 --- a/gen/client/api_wallets.go +++ b/gen/client/api_wallets.go @@ -612,10 +612,10 @@ func (a *WalletsAPIService) ListWalletsExecute(r ApiListWalletsRequest) (*Wallet localVarFormParams := url.Values{} if r.limit != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "form", "") } if r.page != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "form", "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{} diff --git a/gen/client/api_webhooks.go b/gen/client/api_webhooks.go index 1bfd09e..258e4b6 100644 --- a/gen/client/api_webhooks.go +++ b/gen/client/api_webhooks.go @@ -358,10 +358,10 @@ func (a *WebhooksAPIService) ListWebhooksExecute(r ApiListWebhooksRequest) (*Web localVarFormParams := url.Values{} if r.limit != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "form", "") } if r.page != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "form", "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{} diff --git a/gen/client/client.go b/gen/client/client.go index c15e03e..33fd923 100644 --- a/gen/client/client.go +++ b/gen/client/client.go @@ -53,14 +53,20 @@ type APIClient struct { AssetsAPI AssetsAPI + BalanceHistoryAPI BalanceHistoryAPI + ContractEventsAPI ContractEventsAPI + ContractInvocationsAPI ContractInvocationsAPI + ExternalAddressesAPI ExternalAddressesAPI NetworksAPI NetworksAPI ServerSignersAPI ServerSignersAPI + SmartContractsAPI SmartContractsAPI + StakeAPI StakeAPI TradesAPI TradesAPI @@ -96,10 +102,13 @@ func NewAPIClient(cfg *Configuration) *APIClient { // API Services c.AddressesAPI = (*AddressesAPIService)(&c.common) c.AssetsAPI = (*AssetsAPIService)(&c.common) + c.BalanceHistoryAPI = (*BalanceHistoryAPIService)(&c.common) c.ContractEventsAPI = (*ContractEventsAPIService)(&c.common) + c.ContractInvocationsAPI = (*ContractInvocationsAPIService)(&c.common) c.ExternalAddressesAPI = (*ExternalAddressesAPIService)(&c.common) c.NetworksAPI = (*NetworksAPIService)(&c.common) c.ServerSignersAPI = (*ServerSignersAPIService)(&c.common) + c.SmartContractsAPI = (*SmartContractsAPIService)(&c.common) c.StakeAPI = (*StakeAPIService)(&c.common) c.TradesAPI = (*TradesAPIService)(&c.common) c.TransfersAPI = (*TransfersAPIService)(&c.common) @@ -181,7 +190,7 @@ func parameterValueToString( obj interface{}, key string ) string { // parameterAddToHeaderOrQuery adds the provided object to the request header or url query // supporting deep object syntax -func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, collectionType string) { +func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, style string, collectionType string) { var v = reflect.ValueOf(obj) var value = "" if v == reflect.ValueOf(nil) { @@ -197,11 +206,11 @@ func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix stri if err != nil { return } - parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, collectionType) + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, style, collectionType) return } if t, ok := obj.(time.Time); ok { - parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339Nano), collectionType) + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339Nano), style, collectionType) return } value = v.Type().String() + " value" @@ -213,7 +222,11 @@ func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix stri var lenIndValue = indValue.Len() for i:=0;i&1 | grep -v 'To https' diff --git a/gen/client/model_address_transaction_list.go b/gen/client/model_address_transaction_list.go new file mode 100644 index 0000000..24effe9 --- /dev/null +++ b/gen/client/model_address_transaction_list.go @@ -0,0 +1,216 @@ +/* +Coinbase Platform API + +This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +API version: 0.0.1-alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "bytes" + "fmt" +) + +// checks if the AddressTransactionList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AddressTransactionList{} + +// AddressTransactionList +type AddressTransactionList struct { + Data []Transaction `json:"data"` + // True if this list has another page of items after this one that can be fetched. + HasMore bool `json:"has_more"` + // The page token to be used to fetch the next page. + NextPage string `json:"next_page"` +} + +type _AddressTransactionList AddressTransactionList + +// NewAddressTransactionList instantiates a new AddressTransactionList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewAddressTransactionList(data []Transaction, hasMore bool, nextPage string) *AddressTransactionList { + this := AddressTransactionList{} + this.Data = data + this.HasMore = hasMore + this.NextPage = nextPage + return &this +} + +// NewAddressTransactionListWithDefaults instantiates a new AddressTransactionList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewAddressTransactionListWithDefaults() *AddressTransactionList { + this := AddressTransactionList{} + return &this +} + +// GetData returns the Data field value +func (o *AddressTransactionList) GetData() []Transaction { + if o == nil { + var ret []Transaction + return ret + } + + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *AddressTransactionList) GetDataOk() ([]Transaction, bool) { + if o == nil { + return nil, false + } + return o.Data, true +} + +// SetData sets field value +func (o *AddressTransactionList) SetData(v []Transaction) { + o.Data = v +} + +// GetHasMore returns the HasMore field value +func (o *AddressTransactionList) GetHasMore() bool { + if o == nil { + var ret bool + return ret + } + + return o.HasMore +} + +// GetHasMoreOk returns a tuple with the HasMore field value +// and a boolean to check if the value has been set. +func (o *AddressTransactionList) GetHasMoreOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.HasMore, true +} + +// SetHasMore sets field value +func (o *AddressTransactionList) SetHasMore(v bool) { + o.HasMore = v +} + +// GetNextPage returns the NextPage field value +func (o *AddressTransactionList) GetNextPage() string { + if o == nil { + var ret string + return ret + } + + return o.NextPage +} + +// GetNextPageOk returns a tuple with the NextPage field value +// and a boolean to check if the value has been set. +func (o *AddressTransactionList) GetNextPageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.NextPage, true +} + +// SetNextPage sets field value +func (o *AddressTransactionList) SetNextPage(v string) { + o.NextPage = v +} + +func (o AddressTransactionList) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o AddressTransactionList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["data"] = o.Data + toSerialize["has_more"] = o.HasMore + toSerialize["next_page"] = o.NextPage + return toSerialize, nil +} + +func (o *AddressTransactionList) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "data", + "has_more", + "next_page", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varAddressTransactionList := _AddressTransactionList{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varAddressTransactionList) + + if err != nil { + return err + } + + *o = AddressTransactionList(varAddressTransactionList) + + return err +} + +type NullableAddressTransactionList struct { + value *AddressTransactionList + isSet bool +} + +func (v NullableAddressTransactionList) Get() *AddressTransactionList { + return v.value +} + +func (v *NullableAddressTransactionList) Set(val *AddressTransactionList) { + v.value = val + v.isSet = true +} + +func (v NullableAddressTransactionList) IsSet() bool { + return v.isSet +} + +func (v *NullableAddressTransactionList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAddressTransactionList(val *AddressTransactionList) *NullableAddressTransactionList { + return &NullableAddressTransactionList{value: val, isSet: true} +} + +func (v NullableAddressTransactionList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAddressTransactionList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/gen/client/model_broadcast_contract_invocation_request.go b/gen/client/model_broadcast_contract_invocation_request.go new file mode 100644 index 0000000..4d556b2 --- /dev/null +++ b/gen/client/model_broadcast_contract_invocation_request.go @@ -0,0 +1,159 @@ +/* +Coinbase Platform API + +This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +API version: 0.0.1-alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "bytes" + "fmt" +) + +// checks if the BroadcastContractInvocationRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BroadcastContractInvocationRequest{} + +// BroadcastContractInvocationRequest struct for BroadcastContractInvocationRequest +type BroadcastContractInvocationRequest struct { + // The hex-encoded signed payload of the contract invocation + SignedPayload string `json:"signed_payload"` +} + +type _BroadcastContractInvocationRequest BroadcastContractInvocationRequest + +// NewBroadcastContractInvocationRequest instantiates a new BroadcastContractInvocationRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBroadcastContractInvocationRequest(signedPayload string) *BroadcastContractInvocationRequest { + this := BroadcastContractInvocationRequest{} + this.SignedPayload = signedPayload + return &this +} + +// NewBroadcastContractInvocationRequestWithDefaults instantiates a new BroadcastContractInvocationRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBroadcastContractInvocationRequestWithDefaults() *BroadcastContractInvocationRequest { + this := BroadcastContractInvocationRequest{} + return &this +} + +// GetSignedPayload returns the SignedPayload field value +func (o *BroadcastContractInvocationRequest) GetSignedPayload() string { + if o == nil { + var ret string + return ret + } + + return o.SignedPayload +} + +// GetSignedPayloadOk returns a tuple with the SignedPayload field value +// and a boolean to check if the value has been set. +func (o *BroadcastContractInvocationRequest) GetSignedPayloadOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.SignedPayload, true +} + +// SetSignedPayload sets field value +func (o *BroadcastContractInvocationRequest) SetSignedPayload(v string) { + o.SignedPayload = v +} + +func (o BroadcastContractInvocationRequest) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BroadcastContractInvocationRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["signed_payload"] = o.SignedPayload + return toSerialize, nil +} + +func (o *BroadcastContractInvocationRequest) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "signed_payload", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varBroadcastContractInvocationRequest := _BroadcastContractInvocationRequest{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varBroadcastContractInvocationRequest) + + if err != nil { + return err + } + + *o = BroadcastContractInvocationRequest(varBroadcastContractInvocationRequest) + + return err +} + +type NullableBroadcastContractInvocationRequest struct { + value *BroadcastContractInvocationRequest + isSet bool +} + +func (v NullableBroadcastContractInvocationRequest) Get() *BroadcastContractInvocationRequest { + return v.value +} + +func (v *NullableBroadcastContractInvocationRequest) Set(val *BroadcastContractInvocationRequest) { + v.value = val + v.isSet = true +} + +func (v NullableBroadcastContractInvocationRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableBroadcastContractInvocationRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBroadcastContractInvocationRequest(val *BroadcastContractInvocationRequest) *NullableBroadcastContractInvocationRequest { + return &NullableBroadcastContractInvocationRequest{value: val, isSet: true} +} + +func (v NullableBroadcastContractInvocationRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBroadcastContractInvocationRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/gen/client/model_contract_invocation.go b/gen/client/model_contract_invocation.go new file mode 100644 index 0000000..e6aa47f --- /dev/null +++ b/gen/client/model_contract_invocation.go @@ -0,0 +1,427 @@ +/* +Coinbase Platform API + +This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +API version: 0.0.1-alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "bytes" + "fmt" +) + +// checks if the ContractInvocation type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ContractInvocation{} + +// ContractInvocation A contract invocation onchain. +type ContractInvocation struct { + // The ID of the blockchain network. + NetworkId string `json:"network_id"` + // The ID of the wallet that owns the address. + WalletId string `json:"wallet_id"` + // The onchain address of the address invoking the contract. + AddressId string `json:"address_id"` + // The ID of the contract invocation. + ContractInvocationId string `json:"contract_invocation_id"` + // The onchain address of the contract. + ContractAddress string `json:"contract_address"` + // The method to be invoked on the contract. + Method string `json:"method"` + // The JSON-encoded arguments to pass to the contract method. The keys should be the argument names and the values should be the argument values. + Args string `json:"args"` + // The JSON-encoded ABI of the contract. + Abi *string `json:"abi,omitempty"` + // The amount to send to the contract for a payable method + Amount string `json:"amount"` + Transaction Transaction `json:"transaction"` +} + +type _ContractInvocation ContractInvocation + +// NewContractInvocation instantiates a new ContractInvocation object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewContractInvocation(networkId string, walletId string, addressId string, contractInvocationId string, contractAddress string, method string, args string, amount string, transaction Transaction) *ContractInvocation { + this := ContractInvocation{} + this.NetworkId = networkId + this.WalletId = walletId + this.AddressId = addressId + this.ContractInvocationId = contractInvocationId + this.ContractAddress = contractAddress + this.Method = method + this.Args = args + this.Amount = amount + this.Transaction = transaction + return &this +} + +// NewContractInvocationWithDefaults instantiates a new ContractInvocation object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewContractInvocationWithDefaults() *ContractInvocation { + this := ContractInvocation{} + return &this +} + +// GetNetworkId returns the NetworkId field value +func (o *ContractInvocation) GetNetworkId() string { + if o == nil { + var ret string + return ret + } + + return o.NetworkId +} + +// GetNetworkIdOk returns a tuple with the NetworkId field value +// and a boolean to check if the value has been set. +func (o *ContractInvocation) GetNetworkIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.NetworkId, true +} + +// SetNetworkId sets field value +func (o *ContractInvocation) SetNetworkId(v string) { + o.NetworkId = v +} + +// GetWalletId returns the WalletId field value +func (o *ContractInvocation) GetWalletId() string { + if o == nil { + var ret string + return ret + } + + return o.WalletId +} + +// GetWalletIdOk returns a tuple with the WalletId field value +// and a boolean to check if the value has been set. +func (o *ContractInvocation) GetWalletIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.WalletId, true +} + +// SetWalletId sets field value +func (o *ContractInvocation) SetWalletId(v string) { + o.WalletId = v +} + +// GetAddressId returns the AddressId field value +func (o *ContractInvocation) GetAddressId() string { + if o == nil { + var ret string + return ret + } + + return o.AddressId +} + +// GetAddressIdOk returns a tuple with the AddressId field value +// and a boolean to check if the value has been set. +func (o *ContractInvocation) GetAddressIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.AddressId, true +} + +// SetAddressId sets field value +func (o *ContractInvocation) SetAddressId(v string) { + o.AddressId = v +} + +// GetContractInvocationId returns the ContractInvocationId field value +func (o *ContractInvocation) GetContractInvocationId() string { + if o == nil { + var ret string + return ret + } + + return o.ContractInvocationId +} + +// GetContractInvocationIdOk returns a tuple with the ContractInvocationId field value +// and a boolean to check if the value has been set. +func (o *ContractInvocation) GetContractInvocationIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ContractInvocationId, true +} + +// SetContractInvocationId sets field value +func (o *ContractInvocation) SetContractInvocationId(v string) { + o.ContractInvocationId = v +} + +// GetContractAddress returns the ContractAddress field value +func (o *ContractInvocation) GetContractAddress() string { + if o == nil { + var ret string + return ret + } + + return o.ContractAddress +} + +// GetContractAddressOk returns a tuple with the ContractAddress field value +// and a boolean to check if the value has been set. +func (o *ContractInvocation) GetContractAddressOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ContractAddress, true +} + +// SetContractAddress sets field value +func (o *ContractInvocation) SetContractAddress(v string) { + o.ContractAddress = v +} + +// GetMethod returns the Method field value +func (o *ContractInvocation) GetMethod() string { + if o == nil { + var ret string + return ret + } + + return o.Method +} + +// GetMethodOk returns a tuple with the Method field value +// and a boolean to check if the value has been set. +func (o *ContractInvocation) GetMethodOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Method, true +} + +// SetMethod sets field value +func (o *ContractInvocation) SetMethod(v string) { + o.Method = v +} + +// GetArgs returns the Args field value +func (o *ContractInvocation) GetArgs() string { + if o == nil { + var ret string + return ret + } + + return o.Args +} + +// GetArgsOk returns a tuple with the Args field value +// and a boolean to check if the value has been set. +func (o *ContractInvocation) GetArgsOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Args, true +} + +// SetArgs sets field value +func (o *ContractInvocation) SetArgs(v string) { + o.Args = v +} + +// GetAbi returns the Abi field value if set, zero value otherwise. +func (o *ContractInvocation) GetAbi() string { + if o == nil || IsNil(o.Abi) { + var ret string + return ret + } + return *o.Abi +} + +// GetAbiOk returns a tuple with the Abi field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ContractInvocation) GetAbiOk() (*string, bool) { + if o == nil || IsNil(o.Abi) { + return nil, false + } + return o.Abi, true +} + +// HasAbi returns a boolean if a field has been set. +func (o *ContractInvocation) HasAbi() bool { + if o != nil && !IsNil(o.Abi) { + return true + } + + return false +} + +// SetAbi gets a reference to the given string and assigns it to the Abi field. +func (o *ContractInvocation) SetAbi(v string) { + o.Abi = &v +} + +// GetAmount returns the Amount field value +func (o *ContractInvocation) GetAmount() string { + if o == nil { + var ret string + return ret + } + + return o.Amount +} + +// GetAmountOk returns a tuple with the Amount field value +// and a boolean to check if the value has been set. +func (o *ContractInvocation) GetAmountOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Amount, true +} + +// SetAmount sets field value +func (o *ContractInvocation) SetAmount(v string) { + o.Amount = v +} + +// GetTransaction returns the Transaction field value +func (o *ContractInvocation) GetTransaction() Transaction { + if o == nil { + var ret Transaction + return ret + } + + return o.Transaction +} + +// GetTransactionOk returns a tuple with the Transaction field value +// and a boolean to check if the value has been set. +func (o *ContractInvocation) GetTransactionOk() (*Transaction, bool) { + if o == nil { + return nil, false + } + return &o.Transaction, true +} + +// SetTransaction sets field value +func (o *ContractInvocation) SetTransaction(v Transaction) { + o.Transaction = v +} + +func (o ContractInvocation) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ContractInvocation) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["network_id"] = o.NetworkId + toSerialize["wallet_id"] = o.WalletId + toSerialize["address_id"] = o.AddressId + toSerialize["contract_invocation_id"] = o.ContractInvocationId + toSerialize["contract_address"] = o.ContractAddress + toSerialize["method"] = o.Method + toSerialize["args"] = o.Args + if !IsNil(o.Abi) { + toSerialize["abi"] = o.Abi + } + toSerialize["amount"] = o.Amount + toSerialize["transaction"] = o.Transaction + return toSerialize, nil +} + +func (o *ContractInvocation) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "network_id", + "wallet_id", + "address_id", + "contract_invocation_id", + "contract_address", + "method", + "args", + "amount", + "transaction", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varContractInvocation := _ContractInvocation{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varContractInvocation) + + if err != nil { + return err + } + + *o = ContractInvocation(varContractInvocation) + + return err +} + +type NullableContractInvocation struct { + value *ContractInvocation + isSet bool +} + +func (v NullableContractInvocation) Get() *ContractInvocation { + return v.value +} + +func (v *NullableContractInvocation) Set(val *ContractInvocation) { + v.value = val + v.isSet = true +} + +func (v NullableContractInvocation) IsSet() bool { + return v.isSet +} + +func (v *NullableContractInvocation) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableContractInvocation(val *ContractInvocation) *NullableContractInvocation { + return &NullableContractInvocation{value: val, isSet: true} +} + +func (v NullableContractInvocation) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableContractInvocation) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/gen/client/model_contract_invocation_list.go b/gen/client/model_contract_invocation_list.go new file mode 100644 index 0000000..ac39209 --- /dev/null +++ b/gen/client/model_contract_invocation_list.go @@ -0,0 +1,245 @@ +/* +Coinbase Platform API + +This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +API version: 0.0.1-alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "bytes" + "fmt" +) + +// checks if the ContractInvocationList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ContractInvocationList{} + +// ContractInvocationList struct for ContractInvocationList +type ContractInvocationList struct { + Data []ContractInvocation `json:"data"` + // True if this list has another page of items after this one that can be fetched. + HasMore bool `json:"has_more"` + // The page token to be used to fetch the next page. + NextPage string `json:"next_page"` + // The total number of contract invocations for the address in the wallet. + TotalCount int32 `json:"total_count"` +} + +type _ContractInvocationList ContractInvocationList + +// NewContractInvocationList instantiates a new ContractInvocationList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewContractInvocationList(data []ContractInvocation, hasMore bool, nextPage string, totalCount int32) *ContractInvocationList { + this := ContractInvocationList{} + this.Data = data + this.HasMore = hasMore + this.NextPage = nextPage + this.TotalCount = totalCount + return &this +} + +// NewContractInvocationListWithDefaults instantiates a new ContractInvocationList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewContractInvocationListWithDefaults() *ContractInvocationList { + this := ContractInvocationList{} + return &this +} + +// GetData returns the Data field value +func (o *ContractInvocationList) GetData() []ContractInvocation { + if o == nil { + var ret []ContractInvocation + return ret + } + + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *ContractInvocationList) GetDataOk() ([]ContractInvocation, bool) { + if o == nil { + return nil, false + } + return o.Data, true +} + +// SetData sets field value +func (o *ContractInvocationList) SetData(v []ContractInvocation) { + o.Data = v +} + +// GetHasMore returns the HasMore field value +func (o *ContractInvocationList) GetHasMore() bool { + if o == nil { + var ret bool + return ret + } + + return o.HasMore +} + +// GetHasMoreOk returns a tuple with the HasMore field value +// and a boolean to check if the value has been set. +func (o *ContractInvocationList) GetHasMoreOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.HasMore, true +} + +// SetHasMore sets field value +func (o *ContractInvocationList) SetHasMore(v bool) { + o.HasMore = v +} + +// GetNextPage returns the NextPage field value +func (o *ContractInvocationList) GetNextPage() string { + if o == nil { + var ret string + return ret + } + + return o.NextPage +} + +// GetNextPageOk returns a tuple with the NextPage field value +// and a boolean to check if the value has been set. +func (o *ContractInvocationList) GetNextPageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.NextPage, true +} + +// SetNextPage sets field value +func (o *ContractInvocationList) SetNextPage(v string) { + o.NextPage = v +} + +// GetTotalCount returns the TotalCount field value +func (o *ContractInvocationList) GetTotalCount() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.TotalCount +} + +// GetTotalCountOk returns a tuple with the TotalCount field value +// and a boolean to check if the value has been set. +func (o *ContractInvocationList) GetTotalCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.TotalCount, true +} + +// SetTotalCount sets field value +func (o *ContractInvocationList) SetTotalCount(v int32) { + o.TotalCount = v +} + +func (o ContractInvocationList) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ContractInvocationList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["data"] = o.Data + toSerialize["has_more"] = o.HasMore + toSerialize["next_page"] = o.NextPage + toSerialize["total_count"] = o.TotalCount + return toSerialize, nil +} + +func (o *ContractInvocationList) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "data", + "has_more", + "next_page", + "total_count", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varContractInvocationList := _ContractInvocationList{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varContractInvocationList) + + if err != nil { + return err + } + + *o = ContractInvocationList(varContractInvocationList) + + return err +} + +type NullableContractInvocationList struct { + value *ContractInvocationList + isSet bool +} + +func (v NullableContractInvocationList) Get() *ContractInvocationList { + return v.value +} + +func (v *NullableContractInvocationList) Set(val *ContractInvocationList) { + v.value = val + v.isSet = true +} + +func (v NullableContractInvocationList) IsSet() bool { + return v.isSet +} + +func (v *NullableContractInvocationList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableContractInvocationList(val *ContractInvocationList) *NullableContractInvocationList { + return &NullableContractInvocationList{value: val, isSet: true} +} + +func (v NullableContractInvocationList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableContractInvocationList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/gen/client/model_create_contract_invocation_request.go b/gen/client/model_create_contract_invocation_request.go new file mode 100644 index 0000000..e55e84b --- /dev/null +++ b/gen/client/model_create_contract_invocation_request.go @@ -0,0 +1,291 @@ +/* +Coinbase Platform API + +This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +API version: 0.0.1-alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "bytes" + "fmt" +) + +// checks if the CreateContractInvocationRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateContractInvocationRequest{} + +// CreateContractInvocationRequest struct for CreateContractInvocationRequest +type CreateContractInvocationRequest struct { + // The address of the contract to invoke. + ContractAddress string `json:"contract_address"` + // The method to invoke on the contract. + Method string `json:"method"` + // The JSON-encoded arguments to pass to the contract method. The keys should be the argument names and the values should be the argument values. + Args string `json:"args"` + // The JSON-encoded ABI of the contract. + Abi *string `json:"abi,omitempty"` + // The amount in atomic units of the native asset to send to the contract for a payable method + Amount *string `json:"amount,omitempty"` +} + +type _CreateContractInvocationRequest CreateContractInvocationRequest + +// NewCreateContractInvocationRequest instantiates a new CreateContractInvocationRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCreateContractInvocationRequest(contractAddress string, method string, args string) *CreateContractInvocationRequest { + this := CreateContractInvocationRequest{} + this.ContractAddress = contractAddress + this.Method = method + this.Args = args + return &this +} + +// NewCreateContractInvocationRequestWithDefaults instantiates a new CreateContractInvocationRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCreateContractInvocationRequestWithDefaults() *CreateContractInvocationRequest { + this := CreateContractInvocationRequest{} + return &this +} + +// GetContractAddress returns the ContractAddress field value +func (o *CreateContractInvocationRequest) GetContractAddress() string { + if o == nil { + var ret string + return ret + } + + return o.ContractAddress +} + +// GetContractAddressOk returns a tuple with the ContractAddress field value +// and a boolean to check if the value has been set. +func (o *CreateContractInvocationRequest) GetContractAddressOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ContractAddress, true +} + +// SetContractAddress sets field value +func (o *CreateContractInvocationRequest) SetContractAddress(v string) { + o.ContractAddress = v +} + +// GetMethod returns the Method field value +func (o *CreateContractInvocationRequest) GetMethod() string { + if o == nil { + var ret string + return ret + } + + return o.Method +} + +// GetMethodOk returns a tuple with the Method field value +// and a boolean to check if the value has been set. +func (o *CreateContractInvocationRequest) GetMethodOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Method, true +} + +// SetMethod sets field value +func (o *CreateContractInvocationRequest) SetMethod(v string) { + o.Method = v +} + +// GetArgs returns the Args field value +func (o *CreateContractInvocationRequest) GetArgs() string { + if o == nil { + var ret string + return ret + } + + return o.Args +} + +// GetArgsOk returns a tuple with the Args field value +// and a boolean to check if the value has been set. +func (o *CreateContractInvocationRequest) GetArgsOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Args, true +} + +// SetArgs sets field value +func (o *CreateContractInvocationRequest) SetArgs(v string) { + o.Args = v +} + +// GetAbi returns the Abi field value if set, zero value otherwise. +func (o *CreateContractInvocationRequest) GetAbi() string { + if o == nil || IsNil(o.Abi) { + var ret string + return ret + } + return *o.Abi +} + +// GetAbiOk returns a tuple with the Abi field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateContractInvocationRequest) GetAbiOk() (*string, bool) { + if o == nil || IsNil(o.Abi) { + return nil, false + } + return o.Abi, true +} + +// HasAbi returns a boolean if a field has been set. +func (o *CreateContractInvocationRequest) HasAbi() bool { + if o != nil && !IsNil(o.Abi) { + return true + } + + return false +} + +// SetAbi gets a reference to the given string and assigns it to the Abi field. +func (o *CreateContractInvocationRequest) SetAbi(v string) { + o.Abi = &v +} + +// GetAmount returns the Amount field value if set, zero value otherwise. +func (o *CreateContractInvocationRequest) GetAmount() string { + if o == nil || IsNil(o.Amount) { + var ret string + return ret + } + return *o.Amount +} + +// GetAmountOk returns a tuple with the Amount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateContractInvocationRequest) GetAmountOk() (*string, bool) { + if o == nil || IsNil(o.Amount) { + return nil, false + } + return o.Amount, true +} + +// HasAmount returns a boolean if a field has been set. +func (o *CreateContractInvocationRequest) HasAmount() bool { + if o != nil && !IsNil(o.Amount) { + return true + } + + return false +} + +// SetAmount gets a reference to the given string and assigns it to the Amount field. +func (o *CreateContractInvocationRequest) SetAmount(v string) { + o.Amount = &v +} + +func (o CreateContractInvocationRequest) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateContractInvocationRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["contract_address"] = o.ContractAddress + toSerialize["method"] = o.Method + toSerialize["args"] = o.Args + if !IsNil(o.Abi) { + toSerialize["abi"] = o.Abi + } + if !IsNil(o.Amount) { + toSerialize["amount"] = o.Amount + } + return toSerialize, nil +} + +func (o *CreateContractInvocationRequest) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "contract_address", + "method", + "args", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varCreateContractInvocationRequest := _CreateContractInvocationRequest{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varCreateContractInvocationRequest) + + if err != nil { + return err + } + + *o = CreateContractInvocationRequest(varCreateContractInvocationRequest) + + return err +} + +type NullableCreateContractInvocationRequest struct { + value *CreateContractInvocationRequest + isSet bool +} + +func (v NullableCreateContractInvocationRequest) Get() *CreateContractInvocationRequest { + return v.value +} + +func (v *NullableCreateContractInvocationRequest) Set(val *CreateContractInvocationRequest) { + v.value = val + v.isSet = true +} + +func (v NullableCreateContractInvocationRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateContractInvocationRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateContractInvocationRequest(val *CreateContractInvocationRequest) *NullableCreateContractInvocationRequest { + return &NullableCreateContractInvocationRequest{value: val, isSet: true} +} + +func (v NullableCreateContractInvocationRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateContractInvocationRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/gen/client/model_create_payload_signature_request.go b/gen/client/model_create_payload_signature_request.go new file mode 100644 index 0000000..c09a959 --- /dev/null +++ b/gen/client/model_create_payload_signature_request.go @@ -0,0 +1,196 @@ +/* +Coinbase Platform API + +This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +API version: 0.0.1-alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "bytes" + "fmt" +) + +// checks if the CreatePayloadSignatureRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreatePayloadSignatureRequest{} + +// CreatePayloadSignatureRequest struct for CreatePayloadSignatureRequest +type CreatePayloadSignatureRequest struct { + // The unsigned payload. + UnsignedPayload string `json:"unsigned_payload"` + // The signature of the payload. + Signature *string `json:"signature,omitempty"` +} + +type _CreatePayloadSignatureRequest CreatePayloadSignatureRequest + +// NewCreatePayloadSignatureRequest instantiates a new CreatePayloadSignatureRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCreatePayloadSignatureRequest(unsignedPayload string) *CreatePayloadSignatureRequest { + this := CreatePayloadSignatureRequest{} + this.UnsignedPayload = unsignedPayload + return &this +} + +// NewCreatePayloadSignatureRequestWithDefaults instantiates a new CreatePayloadSignatureRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCreatePayloadSignatureRequestWithDefaults() *CreatePayloadSignatureRequest { + this := CreatePayloadSignatureRequest{} + return &this +} + +// GetUnsignedPayload returns the UnsignedPayload field value +func (o *CreatePayloadSignatureRequest) GetUnsignedPayload() string { + if o == nil { + var ret string + return ret + } + + return o.UnsignedPayload +} + +// GetUnsignedPayloadOk returns a tuple with the UnsignedPayload field value +// and a boolean to check if the value has been set. +func (o *CreatePayloadSignatureRequest) GetUnsignedPayloadOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.UnsignedPayload, true +} + +// SetUnsignedPayload sets field value +func (o *CreatePayloadSignatureRequest) SetUnsignedPayload(v string) { + o.UnsignedPayload = v +} + +// GetSignature returns the Signature field value if set, zero value otherwise. +func (o *CreatePayloadSignatureRequest) GetSignature() string { + if o == nil || IsNil(o.Signature) { + var ret string + return ret + } + return *o.Signature +} + +// GetSignatureOk returns a tuple with the Signature field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreatePayloadSignatureRequest) GetSignatureOk() (*string, bool) { + if o == nil || IsNil(o.Signature) { + return nil, false + } + return o.Signature, true +} + +// HasSignature returns a boolean if a field has been set. +func (o *CreatePayloadSignatureRequest) HasSignature() bool { + if o != nil && !IsNil(o.Signature) { + return true + } + + return false +} + +// SetSignature gets a reference to the given string and assigns it to the Signature field. +func (o *CreatePayloadSignatureRequest) SetSignature(v string) { + o.Signature = &v +} + +func (o CreatePayloadSignatureRequest) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreatePayloadSignatureRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["unsigned_payload"] = o.UnsignedPayload + if !IsNil(o.Signature) { + toSerialize["signature"] = o.Signature + } + return toSerialize, nil +} + +func (o *CreatePayloadSignatureRequest) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "unsigned_payload", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varCreatePayloadSignatureRequest := _CreatePayloadSignatureRequest{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varCreatePayloadSignatureRequest) + + if err != nil { + return err + } + + *o = CreatePayloadSignatureRequest(varCreatePayloadSignatureRequest) + + return err +} + +type NullableCreatePayloadSignatureRequest struct { + value *CreatePayloadSignatureRequest + isSet bool +} + +func (v NullableCreatePayloadSignatureRequest) Get() *CreatePayloadSignatureRequest { + return v.value +} + +func (v *NullableCreatePayloadSignatureRequest) Set(val *CreatePayloadSignatureRequest) { + v.value = val + v.isSet = true +} + +func (v NullableCreatePayloadSignatureRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableCreatePayloadSignatureRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreatePayloadSignatureRequest(val *CreatePayloadSignatureRequest) *NullableCreatePayloadSignatureRequest { + return &NullableCreatePayloadSignatureRequest{value: val, isSet: true} +} + +func (v NullableCreatePayloadSignatureRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreatePayloadSignatureRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/gen/client/model_create_smart_contract_request.go b/gen/client/model_create_smart_contract_request.go new file mode 100644 index 0000000..a52b50d --- /dev/null +++ b/gen/client/model_create_smart_contract_request.go @@ -0,0 +1,186 @@ +/* +Coinbase Platform API + +This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +API version: 0.0.1-alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "bytes" + "fmt" +) + +// checks if the CreateSmartContractRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateSmartContractRequest{} + +// CreateSmartContractRequest struct for CreateSmartContractRequest +type CreateSmartContractRequest struct { + Type SmartContractType `json:"type"` + Options SmartContractOptions `json:"options"` +} + +type _CreateSmartContractRequest CreateSmartContractRequest + +// NewCreateSmartContractRequest instantiates a new CreateSmartContractRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCreateSmartContractRequest(type_ SmartContractType, options SmartContractOptions) *CreateSmartContractRequest { + this := CreateSmartContractRequest{} + this.Type = type_ + this.Options = options + return &this +} + +// NewCreateSmartContractRequestWithDefaults instantiates a new CreateSmartContractRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCreateSmartContractRequestWithDefaults() *CreateSmartContractRequest { + this := CreateSmartContractRequest{} + return &this +} + +// GetType returns the Type field value +func (o *CreateSmartContractRequest) GetType() SmartContractType { + if o == nil { + var ret SmartContractType + return ret + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *CreateSmartContractRequest) GetTypeOk() (*SmartContractType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value +func (o *CreateSmartContractRequest) SetType(v SmartContractType) { + o.Type = v +} + +// GetOptions returns the Options field value +func (o *CreateSmartContractRequest) GetOptions() SmartContractOptions { + if o == nil { + var ret SmartContractOptions + return ret + } + + return o.Options +} + +// GetOptionsOk returns a tuple with the Options field value +// and a boolean to check if the value has been set. +func (o *CreateSmartContractRequest) GetOptionsOk() (*SmartContractOptions, bool) { + if o == nil { + return nil, false + } + return &o.Options, true +} + +// SetOptions sets field value +func (o *CreateSmartContractRequest) SetOptions(v SmartContractOptions) { + o.Options = v +} + +func (o CreateSmartContractRequest) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateSmartContractRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["type"] = o.Type + toSerialize["options"] = o.Options + return toSerialize, nil +} + +func (o *CreateSmartContractRequest) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "type", + "options", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varCreateSmartContractRequest := _CreateSmartContractRequest{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varCreateSmartContractRequest) + + if err != nil { + return err + } + + *o = CreateSmartContractRequest(varCreateSmartContractRequest) + + return err +} + +type NullableCreateSmartContractRequest struct { + value *CreateSmartContractRequest + isSet bool +} + +func (v NullableCreateSmartContractRequest) Get() *CreateSmartContractRequest { + return v.value +} + +func (v *NullableCreateSmartContractRequest) Set(val *CreateSmartContractRequest) { + v.value = val + v.isSet = true +} + +func (v NullableCreateSmartContractRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateSmartContractRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateSmartContractRequest(val *CreateSmartContractRequest) *NullableCreateSmartContractRequest { + return &NullableCreateSmartContractRequest{value: val, isSet: true} +} + +func (v NullableCreateSmartContractRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateSmartContractRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/gen/client/model_create_transfer_request.go b/gen/client/model_create_transfer_request.go index 9278fb8..b06329f 100644 --- a/gen/client/model_create_transfer_request.go +++ b/gen/client/model_create_transfer_request.go @@ -27,7 +27,7 @@ type CreateTransferRequest struct { NetworkId string `json:"network_id"` // The ID of the asset to transfer AssetId string `json:"asset_id"` - // The destination address + // The destination address, which can be a 0x address, Basename, or ENS name Destination string `json:"destination"` // Whether the transfer uses sponsored gas Gasless *bool `json:"gasless,omitempty"` diff --git a/gen/client/model_create_webhook_request.go b/gen/client/model_create_webhook_request.go index 1d38f29..8e1bb90 100644 --- a/gen/client/model_create_webhook_request.go +++ b/gen/client/model_create_webhook_request.go @@ -23,11 +23,14 @@ var _ MappedNullable = &CreateWebhookRequest{} type CreateWebhookRequest struct { // The ID of the blockchain network NetworkId string `json:"network_id"` - EventType *WebhookEventType `json:"event_type,omitempty"` + EventType WebhookEventType `json:"event_type"` + EventTypeFilter *WebhookEventTypeFilter `json:"event_type_filter,omitempty"` // Webhook will monitor all events that matches any one of the event filters. EventFilters []WebhookEventFilter `json:"event_filters,omitempty"` // The URL to which the notifications will be sent NotificationUri string `json:"notification_uri"` + // The custom header to be used for x-webhook-signature header on callbacks, so developers can verify the requests are coming from Coinbase. + SignatureHeader *string `json:"signature_header,omitempty"` } type _CreateWebhookRequest CreateWebhookRequest @@ -36,9 +39,10 @@ type _CreateWebhookRequest CreateWebhookRequest // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewCreateWebhookRequest(networkId string, notificationUri string) *CreateWebhookRequest { +func NewCreateWebhookRequest(networkId string, eventType WebhookEventType, notificationUri string) *CreateWebhookRequest { this := CreateWebhookRequest{} this.NetworkId = networkId + this.EventType = eventType this.NotificationUri = notificationUri return &this } @@ -75,36 +79,60 @@ func (o *CreateWebhookRequest) SetNetworkId(v string) { o.NetworkId = v } -// GetEventType returns the EventType field value if set, zero value otherwise. +// GetEventType returns the EventType field value func (o *CreateWebhookRequest) GetEventType() WebhookEventType { - if o == nil || IsNil(o.EventType) { + if o == nil { var ret WebhookEventType return ret } - return *o.EventType + + return o.EventType } -// GetEventTypeOk returns a tuple with the EventType field value if set, nil otherwise +// GetEventTypeOk returns a tuple with the EventType field value // and a boolean to check if the value has been set. func (o *CreateWebhookRequest) GetEventTypeOk() (*WebhookEventType, bool) { - if o == nil || IsNil(o.EventType) { + if o == nil { + return nil, false + } + return &o.EventType, true +} + +// SetEventType sets field value +func (o *CreateWebhookRequest) SetEventType(v WebhookEventType) { + o.EventType = v +} + +// GetEventTypeFilter returns the EventTypeFilter field value if set, zero value otherwise. +func (o *CreateWebhookRequest) GetEventTypeFilter() WebhookEventTypeFilter { + if o == nil || IsNil(o.EventTypeFilter) { + var ret WebhookEventTypeFilter + return ret + } + return *o.EventTypeFilter +} + +// GetEventTypeFilterOk returns a tuple with the EventTypeFilter field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateWebhookRequest) GetEventTypeFilterOk() (*WebhookEventTypeFilter, bool) { + if o == nil || IsNil(o.EventTypeFilter) { return nil, false } - return o.EventType, true + return o.EventTypeFilter, true } -// HasEventType returns a boolean if a field has been set. -func (o *CreateWebhookRequest) HasEventType() bool { - if o != nil && !IsNil(o.EventType) { +// HasEventTypeFilter returns a boolean if a field has been set. +func (o *CreateWebhookRequest) HasEventTypeFilter() bool { + if o != nil && !IsNil(o.EventTypeFilter) { return true } return false } -// SetEventType gets a reference to the given WebhookEventType and assigns it to the EventType field. -func (o *CreateWebhookRequest) SetEventType(v WebhookEventType) { - o.EventType = &v +// SetEventTypeFilter gets a reference to the given WebhookEventTypeFilter and assigns it to the EventTypeFilter field. +func (o *CreateWebhookRequest) SetEventTypeFilter(v WebhookEventTypeFilter) { + o.EventTypeFilter = &v } // GetEventFilters returns the EventFilters field value if set, zero value otherwise. @@ -163,6 +191,38 @@ func (o *CreateWebhookRequest) SetNotificationUri(v string) { o.NotificationUri = v } +// GetSignatureHeader returns the SignatureHeader field value if set, zero value otherwise. +func (o *CreateWebhookRequest) GetSignatureHeader() string { + if o == nil || IsNil(o.SignatureHeader) { + var ret string + return ret + } + return *o.SignatureHeader +} + +// GetSignatureHeaderOk returns a tuple with the SignatureHeader field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateWebhookRequest) GetSignatureHeaderOk() (*string, bool) { + if o == nil || IsNil(o.SignatureHeader) { + return nil, false + } + return o.SignatureHeader, true +} + +// HasSignatureHeader returns a boolean if a field has been set. +func (o *CreateWebhookRequest) HasSignatureHeader() bool { + if o != nil && !IsNil(o.SignatureHeader) { + return true + } + + return false +} + +// SetSignatureHeader gets a reference to the given string and assigns it to the SignatureHeader field. +func (o *CreateWebhookRequest) SetSignatureHeader(v string) { + o.SignatureHeader = &v +} + func (o CreateWebhookRequest) MarshalJSON() ([]byte, error) { toSerialize,err := o.ToMap() if err != nil { @@ -174,13 +234,17 @@ func (o CreateWebhookRequest) MarshalJSON() ([]byte, error) { func (o CreateWebhookRequest) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} toSerialize["network_id"] = o.NetworkId - if !IsNil(o.EventType) { - toSerialize["event_type"] = o.EventType + toSerialize["event_type"] = o.EventType + if !IsNil(o.EventTypeFilter) { + toSerialize["event_type_filter"] = o.EventTypeFilter } if !IsNil(o.EventFilters) { toSerialize["event_filters"] = o.EventFilters } toSerialize["notification_uri"] = o.NotificationUri + if !IsNil(o.SignatureHeader) { + toSerialize["signature_header"] = o.SignatureHeader + } return toSerialize, nil } @@ -190,6 +254,7 @@ func (o *CreateWebhookRequest) UnmarshalJSON(data []byte) (err error) { // that every required field exists as a key in the generic map. requiredProperties := []string{ "network_id", + "event_type", "notification_uri", } diff --git a/gen/client/model_deploy_smart_contract_request.go b/gen/client/model_deploy_smart_contract_request.go new file mode 100644 index 0000000..b8113a6 --- /dev/null +++ b/gen/client/model_deploy_smart_contract_request.go @@ -0,0 +1,159 @@ +/* +Coinbase Platform API + +This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +API version: 0.0.1-alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "bytes" + "fmt" +) + +// checks if the DeploySmartContractRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DeploySmartContractRequest{} + +// DeploySmartContractRequest struct for DeploySmartContractRequest +type DeploySmartContractRequest struct { + // The hex-encoded signed payload of the contract deployment transaction. + SignedPayload string `json:"signed_payload"` +} + +type _DeploySmartContractRequest DeploySmartContractRequest + +// NewDeploySmartContractRequest instantiates a new DeploySmartContractRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewDeploySmartContractRequest(signedPayload string) *DeploySmartContractRequest { + this := DeploySmartContractRequest{} + this.SignedPayload = signedPayload + return &this +} + +// NewDeploySmartContractRequestWithDefaults instantiates a new DeploySmartContractRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewDeploySmartContractRequestWithDefaults() *DeploySmartContractRequest { + this := DeploySmartContractRequest{} + return &this +} + +// GetSignedPayload returns the SignedPayload field value +func (o *DeploySmartContractRequest) GetSignedPayload() string { + if o == nil { + var ret string + return ret + } + + return o.SignedPayload +} + +// GetSignedPayloadOk returns a tuple with the SignedPayload field value +// and a boolean to check if the value has been set. +func (o *DeploySmartContractRequest) GetSignedPayloadOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.SignedPayload, true +} + +// SetSignedPayload sets field value +func (o *DeploySmartContractRequest) SetSignedPayload(v string) { + o.SignedPayload = v +} + +func (o DeploySmartContractRequest) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DeploySmartContractRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["signed_payload"] = o.SignedPayload + return toSerialize, nil +} + +func (o *DeploySmartContractRequest) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "signed_payload", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varDeploySmartContractRequest := _DeploySmartContractRequest{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varDeploySmartContractRequest) + + if err != nil { + return err + } + + *o = DeploySmartContractRequest(varDeploySmartContractRequest) + + return err +} + +type NullableDeploySmartContractRequest struct { + value *DeploySmartContractRequest + isSet bool +} + +func (v NullableDeploySmartContractRequest) Get() *DeploySmartContractRequest { + return v.value +} + +func (v *NullableDeploySmartContractRequest) Set(val *DeploySmartContractRequest) { + v.value = val + v.isSet = true +} + +func (v NullableDeploySmartContractRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableDeploySmartContractRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDeploySmartContractRequest(val *DeploySmartContractRequest) *NullableDeploySmartContractRequest { + return &NullableDeploySmartContractRequest{value: val, isSet: true} +} + +func (v NullableDeploySmartContractRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDeploySmartContractRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/gen/client/model_erc20_transfer_event.go b/gen/client/model_erc20_transfer_event.go new file mode 100644 index 0000000..096e23a --- /dev/null +++ b/gen/client/model_erc20_transfer_event.go @@ -0,0 +1,572 @@ +/* +Coinbase Platform API + +This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +API version: 0.0.1-alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "time" +) + +// checks if the ERC20TransferEvent type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ERC20TransferEvent{} + +// ERC20TransferEvent Represents an event triggered by an ERC-20 token transfer on the blockchain. Contains information about the transaction, block, and involved addresses. +type ERC20TransferEvent struct { + // Unique identifier for the webhook that triggered this event. + WebhookId *string `json:"webhookId,omitempty"` + // Type of event, in this case, an ERC-20 token transfer. + EventType *string `json:"eventType,omitempty"` + // Blockchain network where the event occurred. + Network *string `json:"network,omitempty"` + // Hash of the block containing the transaction. + BlockHash *string `json:"blockHash,omitempty"` + // Number of the block containing the transaction. + BlockNumber *int32 `json:"blockNumber,omitempty"` + // Timestamp when the block was mined. + BlockTime *time.Time `json:"blockTime,omitempty"` + // Hash of the transaction that triggered the event. + TransactionHash *string `json:"transactionHash,omitempty"` + // Position of the transaction within the block. + TransactionIndex *int32 `json:"transactionIndex,omitempty"` + // Position of the event log within the transaction. + LogIndex *int32 `json:"logIndex,omitempty"` + // Address of the ERC-20 token contract. + ContractAddress *string `json:"contractAddress,omitempty"` + // Address of the sender in the token transfer. + From *string `json:"from,omitempty"` + // Address of the recipient in the token transfer. + To *string `json:"to,omitempty"` + // Amount of tokens transferred, typically in the smallest unit (e.g., wei for Ethereum). + Value *string `json:"value,omitempty"` +} + +// NewERC20TransferEvent instantiates a new ERC20TransferEvent object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewERC20TransferEvent() *ERC20TransferEvent { + this := ERC20TransferEvent{} + return &this +} + +// NewERC20TransferEventWithDefaults instantiates a new ERC20TransferEvent object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewERC20TransferEventWithDefaults() *ERC20TransferEvent { + this := ERC20TransferEvent{} + return &this +} + +// GetWebhookId returns the WebhookId field value if set, zero value otherwise. +func (o *ERC20TransferEvent) GetWebhookId() string { + if o == nil || IsNil(o.WebhookId) { + var ret string + return ret + } + return *o.WebhookId +} + +// GetWebhookIdOk returns a tuple with the WebhookId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ERC20TransferEvent) GetWebhookIdOk() (*string, bool) { + if o == nil || IsNil(o.WebhookId) { + return nil, false + } + return o.WebhookId, true +} + +// HasWebhookId returns a boolean if a field has been set. +func (o *ERC20TransferEvent) HasWebhookId() bool { + if o != nil && !IsNil(o.WebhookId) { + return true + } + + return false +} + +// SetWebhookId gets a reference to the given string and assigns it to the WebhookId field. +func (o *ERC20TransferEvent) SetWebhookId(v string) { + o.WebhookId = &v +} + +// GetEventType returns the EventType field value if set, zero value otherwise. +func (o *ERC20TransferEvent) GetEventType() string { + if o == nil || IsNil(o.EventType) { + var ret string + return ret + } + return *o.EventType +} + +// GetEventTypeOk returns a tuple with the EventType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ERC20TransferEvent) GetEventTypeOk() (*string, bool) { + if o == nil || IsNil(o.EventType) { + return nil, false + } + return o.EventType, true +} + +// HasEventType returns a boolean if a field has been set. +func (o *ERC20TransferEvent) HasEventType() bool { + if o != nil && !IsNil(o.EventType) { + return true + } + + return false +} + +// SetEventType gets a reference to the given string and assigns it to the EventType field. +func (o *ERC20TransferEvent) SetEventType(v string) { + o.EventType = &v +} + +// GetNetwork returns the Network field value if set, zero value otherwise. +func (o *ERC20TransferEvent) GetNetwork() string { + if o == nil || IsNil(o.Network) { + var ret string + return ret + } + return *o.Network +} + +// GetNetworkOk returns a tuple with the Network field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ERC20TransferEvent) GetNetworkOk() (*string, bool) { + if o == nil || IsNil(o.Network) { + return nil, false + } + return o.Network, true +} + +// HasNetwork returns a boolean if a field has been set. +func (o *ERC20TransferEvent) HasNetwork() bool { + if o != nil && !IsNil(o.Network) { + return true + } + + return false +} + +// SetNetwork gets a reference to the given string and assigns it to the Network field. +func (o *ERC20TransferEvent) SetNetwork(v string) { + o.Network = &v +} + +// GetBlockHash returns the BlockHash field value if set, zero value otherwise. +func (o *ERC20TransferEvent) GetBlockHash() string { + if o == nil || IsNil(o.BlockHash) { + var ret string + return ret + } + return *o.BlockHash +} + +// GetBlockHashOk returns a tuple with the BlockHash field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ERC20TransferEvent) GetBlockHashOk() (*string, bool) { + if o == nil || IsNil(o.BlockHash) { + return nil, false + } + return o.BlockHash, true +} + +// HasBlockHash returns a boolean if a field has been set. +func (o *ERC20TransferEvent) HasBlockHash() bool { + if o != nil && !IsNil(o.BlockHash) { + return true + } + + return false +} + +// SetBlockHash gets a reference to the given string and assigns it to the BlockHash field. +func (o *ERC20TransferEvent) SetBlockHash(v string) { + o.BlockHash = &v +} + +// GetBlockNumber returns the BlockNumber field value if set, zero value otherwise. +func (o *ERC20TransferEvent) GetBlockNumber() int32 { + if o == nil || IsNil(o.BlockNumber) { + var ret int32 + return ret + } + return *o.BlockNumber +} + +// GetBlockNumberOk returns a tuple with the BlockNumber field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ERC20TransferEvent) GetBlockNumberOk() (*int32, bool) { + if o == nil || IsNil(o.BlockNumber) { + return nil, false + } + return o.BlockNumber, true +} + +// HasBlockNumber returns a boolean if a field has been set. +func (o *ERC20TransferEvent) HasBlockNumber() bool { + if o != nil && !IsNil(o.BlockNumber) { + return true + } + + return false +} + +// SetBlockNumber gets a reference to the given int32 and assigns it to the BlockNumber field. +func (o *ERC20TransferEvent) SetBlockNumber(v int32) { + o.BlockNumber = &v +} + +// GetBlockTime returns the BlockTime field value if set, zero value otherwise. +func (o *ERC20TransferEvent) GetBlockTime() time.Time { + if o == nil || IsNil(o.BlockTime) { + var ret time.Time + return ret + } + return *o.BlockTime +} + +// GetBlockTimeOk returns a tuple with the BlockTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ERC20TransferEvent) GetBlockTimeOk() (*time.Time, bool) { + if o == nil || IsNil(o.BlockTime) { + return nil, false + } + return o.BlockTime, true +} + +// HasBlockTime returns a boolean if a field has been set. +func (o *ERC20TransferEvent) HasBlockTime() bool { + if o != nil && !IsNil(o.BlockTime) { + return true + } + + return false +} + +// SetBlockTime gets a reference to the given time.Time and assigns it to the BlockTime field. +func (o *ERC20TransferEvent) SetBlockTime(v time.Time) { + o.BlockTime = &v +} + +// GetTransactionHash returns the TransactionHash field value if set, zero value otherwise. +func (o *ERC20TransferEvent) GetTransactionHash() string { + if o == nil || IsNil(o.TransactionHash) { + var ret string + return ret + } + return *o.TransactionHash +} + +// GetTransactionHashOk returns a tuple with the TransactionHash field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ERC20TransferEvent) GetTransactionHashOk() (*string, bool) { + if o == nil || IsNil(o.TransactionHash) { + return nil, false + } + return o.TransactionHash, true +} + +// HasTransactionHash returns a boolean if a field has been set. +func (o *ERC20TransferEvent) HasTransactionHash() bool { + if o != nil && !IsNil(o.TransactionHash) { + return true + } + + return false +} + +// SetTransactionHash gets a reference to the given string and assigns it to the TransactionHash field. +func (o *ERC20TransferEvent) SetTransactionHash(v string) { + o.TransactionHash = &v +} + +// GetTransactionIndex returns the TransactionIndex field value if set, zero value otherwise. +func (o *ERC20TransferEvent) GetTransactionIndex() int32 { + if o == nil || IsNil(o.TransactionIndex) { + var ret int32 + return ret + } + return *o.TransactionIndex +} + +// GetTransactionIndexOk returns a tuple with the TransactionIndex field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ERC20TransferEvent) GetTransactionIndexOk() (*int32, bool) { + if o == nil || IsNil(o.TransactionIndex) { + return nil, false + } + return o.TransactionIndex, true +} + +// HasTransactionIndex returns a boolean if a field has been set. +func (o *ERC20TransferEvent) HasTransactionIndex() bool { + if o != nil && !IsNil(o.TransactionIndex) { + return true + } + + return false +} + +// SetTransactionIndex gets a reference to the given int32 and assigns it to the TransactionIndex field. +func (o *ERC20TransferEvent) SetTransactionIndex(v int32) { + o.TransactionIndex = &v +} + +// GetLogIndex returns the LogIndex field value if set, zero value otherwise. +func (o *ERC20TransferEvent) GetLogIndex() int32 { + if o == nil || IsNil(o.LogIndex) { + var ret int32 + return ret + } + return *o.LogIndex +} + +// GetLogIndexOk returns a tuple with the LogIndex field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ERC20TransferEvent) GetLogIndexOk() (*int32, bool) { + if o == nil || IsNil(o.LogIndex) { + return nil, false + } + return o.LogIndex, true +} + +// HasLogIndex returns a boolean if a field has been set. +func (o *ERC20TransferEvent) HasLogIndex() bool { + if o != nil && !IsNil(o.LogIndex) { + return true + } + + return false +} + +// SetLogIndex gets a reference to the given int32 and assigns it to the LogIndex field. +func (o *ERC20TransferEvent) SetLogIndex(v int32) { + o.LogIndex = &v +} + +// GetContractAddress returns the ContractAddress field value if set, zero value otherwise. +func (o *ERC20TransferEvent) GetContractAddress() string { + if o == nil || IsNil(o.ContractAddress) { + var ret string + return ret + } + return *o.ContractAddress +} + +// GetContractAddressOk returns a tuple with the ContractAddress field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ERC20TransferEvent) GetContractAddressOk() (*string, bool) { + if o == nil || IsNil(o.ContractAddress) { + return nil, false + } + return o.ContractAddress, true +} + +// HasContractAddress returns a boolean if a field has been set. +func (o *ERC20TransferEvent) HasContractAddress() bool { + if o != nil && !IsNil(o.ContractAddress) { + return true + } + + return false +} + +// SetContractAddress gets a reference to the given string and assigns it to the ContractAddress field. +func (o *ERC20TransferEvent) SetContractAddress(v string) { + o.ContractAddress = &v +} + +// GetFrom returns the From field value if set, zero value otherwise. +func (o *ERC20TransferEvent) GetFrom() string { + if o == nil || IsNil(o.From) { + var ret string + return ret + } + return *o.From +} + +// GetFromOk returns a tuple with the From field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ERC20TransferEvent) GetFromOk() (*string, bool) { + if o == nil || IsNil(o.From) { + return nil, false + } + return o.From, true +} + +// HasFrom returns a boolean if a field has been set. +func (o *ERC20TransferEvent) HasFrom() bool { + if o != nil && !IsNil(o.From) { + return true + } + + return false +} + +// SetFrom gets a reference to the given string and assigns it to the From field. +func (o *ERC20TransferEvent) SetFrom(v string) { + o.From = &v +} + +// GetTo returns the To field value if set, zero value otherwise. +func (o *ERC20TransferEvent) GetTo() string { + if o == nil || IsNil(o.To) { + var ret string + return ret + } + return *o.To +} + +// GetToOk returns a tuple with the To field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ERC20TransferEvent) GetToOk() (*string, bool) { + if o == nil || IsNil(o.To) { + return nil, false + } + return o.To, true +} + +// HasTo returns a boolean if a field has been set. +func (o *ERC20TransferEvent) HasTo() bool { + if o != nil && !IsNil(o.To) { + return true + } + + return false +} + +// SetTo gets a reference to the given string and assigns it to the To field. +func (o *ERC20TransferEvent) SetTo(v string) { + o.To = &v +} + +// GetValue returns the Value field value if set, zero value otherwise. +func (o *ERC20TransferEvent) GetValue() string { + if o == nil || IsNil(o.Value) { + var ret string + return ret + } + return *o.Value +} + +// GetValueOk returns a tuple with the Value field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ERC20TransferEvent) GetValueOk() (*string, bool) { + if o == nil || IsNil(o.Value) { + return nil, false + } + return o.Value, true +} + +// HasValue returns a boolean if a field has been set. +func (o *ERC20TransferEvent) HasValue() bool { + if o != nil && !IsNil(o.Value) { + return true + } + + return false +} + +// SetValue gets a reference to the given string and assigns it to the Value field. +func (o *ERC20TransferEvent) SetValue(v string) { + o.Value = &v +} + +func (o ERC20TransferEvent) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ERC20TransferEvent) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.WebhookId) { + toSerialize["webhookId"] = o.WebhookId + } + if !IsNil(o.EventType) { + toSerialize["eventType"] = o.EventType + } + if !IsNil(o.Network) { + toSerialize["network"] = o.Network + } + if !IsNil(o.BlockHash) { + toSerialize["blockHash"] = o.BlockHash + } + if !IsNil(o.BlockNumber) { + toSerialize["blockNumber"] = o.BlockNumber + } + if !IsNil(o.BlockTime) { + toSerialize["blockTime"] = o.BlockTime + } + if !IsNil(o.TransactionHash) { + toSerialize["transactionHash"] = o.TransactionHash + } + if !IsNil(o.TransactionIndex) { + toSerialize["transactionIndex"] = o.TransactionIndex + } + if !IsNil(o.LogIndex) { + toSerialize["logIndex"] = o.LogIndex + } + if !IsNil(o.ContractAddress) { + toSerialize["contractAddress"] = o.ContractAddress + } + if !IsNil(o.From) { + toSerialize["from"] = o.From + } + if !IsNil(o.To) { + toSerialize["to"] = o.To + } + if !IsNil(o.Value) { + toSerialize["value"] = o.Value + } + return toSerialize, nil +} + +type NullableERC20TransferEvent struct { + value *ERC20TransferEvent + isSet bool +} + +func (v NullableERC20TransferEvent) Get() *ERC20TransferEvent { + return v.value +} + +func (v *NullableERC20TransferEvent) Set(val *ERC20TransferEvent) { + v.value = val + v.isSet = true +} + +func (v NullableERC20TransferEvent) IsSet() bool { + return v.isSet +} + +func (v *NullableERC20TransferEvent) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableERC20TransferEvent(val *ERC20TransferEvent) *NullableERC20TransferEvent { + return &NullableERC20TransferEvent{value: val, isSet: true} +} + +func (v NullableERC20TransferEvent) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableERC20TransferEvent) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/gen/client/model_erc721_transfer_event.go b/gen/client/model_erc721_transfer_event.go new file mode 100644 index 0000000..8337fb5 --- /dev/null +++ b/gen/client/model_erc721_transfer_event.go @@ -0,0 +1,572 @@ +/* +Coinbase Platform API + +This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +API version: 0.0.1-alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "time" +) + +// checks if the ERC721TransferEvent type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ERC721TransferEvent{} + +// ERC721TransferEvent Represents an event triggered by an ERC-721 token transfer on the blockchain. Contains information about the transaction, block, and involved addresses. +type ERC721TransferEvent struct { + // Unique identifier for the webhook that triggered this event. + WebhookId *string `json:"webhookId,omitempty"` + // Type of event, in this case, an ERC-721 token transfer. + EventType *string `json:"eventType,omitempty"` + // Blockchain network where the event occurred. + Network *string `json:"network,omitempty"` + // Hash of the block containing the transaction. + BlockHash *string `json:"blockHash,omitempty"` + // Number of the block containing the transaction. + BlockNumber *int32 `json:"blockNumber,omitempty"` + // Timestamp when the block was mined. + BlockTime *time.Time `json:"blockTime,omitempty"` + // Hash of the transaction that triggered the event. + TransactionHash *string `json:"transactionHash,omitempty"` + // Position of the transaction within the block. + TransactionIndex *int32 `json:"transactionIndex,omitempty"` + // Position of the event log within the transaction. + LogIndex *int32 `json:"logIndex,omitempty"` + // Address of the ERC-721 token contract. + ContractAddress *string `json:"contractAddress,omitempty"` + // Address of the sender in the token transfer. + From *string `json:"from,omitempty"` + // Address of the recipient in the token transfer. + To *string `json:"to,omitempty"` + // Unique identifier of the NFT being transferred. + TokenId *string `json:"tokenId,omitempty"` +} + +// NewERC721TransferEvent instantiates a new ERC721TransferEvent object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewERC721TransferEvent() *ERC721TransferEvent { + this := ERC721TransferEvent{} + return &this +} + +// NewERC721TransferEventWithDefaults instantiates a new ERC721TransferEvent object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewERC721TransferEventWithDefaults() *ERC721TransferEvent { + this := ERC721TransferEvent{} + return &this +} + +// GetWebhookId returns the WebhookId field value if set, zero value otherwise. +func (o *ERC721TransferEvent) GetWebhookId() string { + if o == nil || IsNil(o.WebhookId) { + var ret string + return ret + } + return *o.WebhookId +} + +// GetWebhookIdOk returns a tuple with the WebhookId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ERC721TransferEvent) GetWebhookIdOk() (*string, bool) { + if o == nil || IsNil(o.WebhookId) { + return nil, false + } + return o.WebhookId, true +} + +// HasWebhookId returns a boolean if a field has been set. +func (o *ERC721TransferEvent) HasWebhookId() bool { + if o != nil && !IsNil(o.WebhookId) { + return true + } + + return false +} + +// SetWebhookId gets a reference to the given string and assigns it to the WebhookId field. +func (o *ERC721TransferEvent) SetWebhookId(v string) { + o.WebhookId = &v +} + +// GetEventType returns the EventType field value if set, zero value otherwise. +func (o *ERC721TransferEvent) GetEventType() string { + if o == nil || IsNil(o.EventType) { + var ret string + return ret + } + return *o.EventType +} + +// GetEventTypeOk returns a tuple with the EventType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ERC721TransferEvent) GetEventTypeOk() (*string, bool) { + if o == nil || IsNil(o.EventType) { + return nil, false + } + return o.EventType, true +} + +// HasEventType returns a boolean if a field has been set. +func (o *ERC721TransferEvent) HasEventType() bool { + if o != nil && !IsNil(o.EventType) { + return true + } + + return false +} + +// SetEventType gets a reference to the given string and assigns it to the EventType field. +func (o *ERC721TransferEvent) SetEventType(v string) { + o.EventType = &v +} + +// GetNetwork returns the Network field value if set, zero value otherwise. +func (o *ERC721TransferEvent) GetNetwork() string { + if o == nil || IsNil(o.Network) { + var ret string + return ret + } + return *o.Network +} + +// GetNetworkOk returns a tuple with the Network field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ERC721TransferEvent) GetNetworkOk() (*string, bool) { + if o == nil || IsNil(o.Network) { + return nil, false + } + return o.Network, true +} + +// HasNetwork returns a boolean if a field has been set. +func (o *ERC721TransferEvent) HasNetwork() bool { + if o != nil && !IsNil(o.Network) { + return true + } + + return false +} + +// SetNetwork gets a reference to the given string and assigns it to the Network field. +func (o *ERC721TransferEvent) SetNetwork(v string) { + o.Network = &v +} + +// GetBlockHash returns the BlockHash field value if set, zero value otherwise. +func (o *ERC721TransferEvent) GetBlockHash() string { + if o == nil || IsNil(o.BlockHash) { + var ret string + return ret + } + return *o.BlockHash +} + +// GetBlockHashOk returns a tuple with the BlockHash field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ERC721TransferEvent) GetBlockHashOk() (*string, bool) { + if o == nil || IsNil(o.BlockHash) { + return nil, false + } + return o.BlockHash, true +} + +// HasBlockHash returns a boolean if a field has been set. +func (o *ERC721TransferEvent) HasBlockHash() bool { + if o != nil && !IsNil(o.BlockHash) { + return true + } + + return false +} + +// SetBlockHash gets a reference to the given string and assigns it to the BlockHash field. +func (o *ERC721TransferEvent) SetBlockHash(v string) { + o.BlockHash = &v +} + +// GetBlockNumber returns the BlockNumber field value if set, zero value otherwise. +func (o *ERC721TransferEvent) GetBlockNumber() int32 { + if o == nil || IsNil(o.BlockNumber) { + var ret int32 + return ret + } + return *o.BlockNumber +} + +// GetBlockNumberOk returns a tuple with the BlockNumber field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ERC721TransferEvent) GetBlockNumberOk() (*int32, bool) { + if o == nil || IsNil(o.BlockNumber) { + return nil, false + } + return o.BlockNumber, true +} + +// HasBlockNumber returns a boolean if a field has been set. +func (o *ERC721TransferEvent) HasBlockNumber() bool { + if o != nil && !IsNil(o.BlockNumber) { + return true + } + + return false +} + +// SetBlockNumber gets a reference to the given int32 and assigns it to the BlockNumber field. +func (o *ERC721TransferEvent) SetBlockNumber(v int32) { + o.BlockNumber = &v +} + +// GetBlockTime returns the BlockTime field value if set, zero value otherwise. +func (o *ERC721TransferEvent) GetBlockTime() time.Time { + if o == nil || IsNil(o.BlockTime) { + var ret time.Time + return ret + } + return *o.BlockTime +} + +// GetBlockTimeOk returns a tuple with the BlockTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ERC721TransferEvent) GetBlockTimeOk() (*time.Time, bool) { + if o == nil || IsNil(o.BlockTime) { + return nil, false + } + return o.BlockTime, true +} + +// HasBlockTime returns a boolean if a field has been set. +func (o *ERC721TransferEvent) HasBlockTime() bool { + if o != nil && !IsNil(o.BlockTime) { + return true + } + + return false +} + +// SetBlockTime gets a reference to the given time.Time and assigns it to the BlockTime field. +func (o *ERC721TransferEvent) SetBlockTime(v time.Time) { + o.BlockTime = &v +} + +// GetTransactionHash returns the TransactionHash field value if set, zero value otherwise. +func (o *ERC721TransferEvent) GetTransactionHash() string { + if o == nil || IsNil(o.TransactionHash) { + var ret string + return ret + } + return *o.TransactionHash +} + +// GetTransactionHashOk returns a tuple with the TransactionHash field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ERC721TransferEvent) GetTransactionHashOk() (*string, bool) { + if o == nil || IsNil(o.TransactionHash) { + return nil, false + } + return o.TransactionHash, true +} + +// HasTransactionHash returns a boolean if a field has been set. +func (o *ERC721TransferEvent) HasTransactionHash() bool { + if o != nil && !IsNil(o.TransactionHash) { + return true + } + + return false +} + +// SetTransactionHash gets a reference to the given string and assigns it to the TransactionHash field. +func (o *ERC721TransferEvent) SetTransactionHash(v string) { + o.TransactionHash = &v +} + +// GetTransactionIndex returns the TransactionIndex field value if set, zero value otherwise. +func (o *ERC721TransferEvent) GetTransactionIndex() int32 { + if o == nil || IsNil(o.TransactionIndex) { + var ret int32 + return ret + } + return *o.TransactionIndex +} + +// GetTransactionIndexOk returns a tuple with the TransactionIndex field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ERC721TransferEvent) GetTransactionIndexOk() (*int32, bool) { + if o == nil || IsNil(o.TransactionIndex) { + return nil, false + } + return o.TransactionIndex, true +} + +// HasTransactionIndex returns a boolean if a field has been set. +func (o *ERC721TransferEvent) HasTransactionIndex() bool { + if o != nil && !IsNil(o.TransactionIndex) { + return true + } + + return false +} + +// SetTransactionIndex gets a reference to the given int32 and assigns it to the TransactionIndex field. +func (o *ERC721TransferEvent) SetTransactionIndex(v int32) { + o.TransactionIndex = &v +} + +// GetLogIndex returns the LogIndex field value if set, zero value otherwise. +func (o *ERC721TransferEvent) GetLogIndex() int32 { + if o == nil || IsNil(o.LogIndex) { + var ret int32 + return ret + } + return *o.LogIndex +} + +// GetLogIndexOk returns a tuple with the LogIndex field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ERC721TransferEvent) GetLogIndexOk() (*int32, bool) { + if o == nil || IsNil(o.LogIndex) { + return nil, false + } + return o.LogIndex, true +} + +// HasLogIndex returns a boolean if a field has been set. +func (o *ERC721TransferEvent) HasLogIndex() bool { + if o != nil && !IsNil(o.LogIndex) { + return true + } + + return false +} + +// SetLogIndex gets a reference to the given int32 and assigns it to the LogIndex field. +func (o *ERC721TransferEvent) SetLogIndex(v int32) { + o.LogIndex = &v +} + +// GetContractAddress returns the ContractAddress field value if set, zero value otherwise. +func (o *ERC721TransferEvent) GetContractAddress() string { + if o == nil || IsNil(o.ContractAddress) { + var ret string + return ret + } + return *o.ContractAddress +} + +// GetContractAddressOk returns a tuple with the ContractAddress field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ERC721TransferEvent) GetContractAddressOk() (*string, bool) { + if o == nil || IsNil(o.ContractAddress) { + return nil, false + } + return o.ContractAddress, true +} + +// HasContractAddress returns a boolean if a field has been set. +func (o *ERC721TransferEvent) HasContractAddress() bool { + if o != nil && !IsNil(o.ContractAddress) { + return true + } + + return false +} + +// SetContractAddress gets a reference to the given string and assigns it to the ContractAddress field. +func (o *ERC721TransferEvent) SetContractAddress(v string) { + o.ContractAddress = &v +} + +// GetFrom returns the From field value if set, zero value otherwise. +func (o *ERC721TransferEvent) GetFrom() string { + if o == nil || IsNil(o.From) { + var ret string + return ret + } + return *o.From +} + +// GetFromOk returns a tuple with the From field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ERC721TransferEvent) GetFromOk() (*string, bool) { + if o == nil || IsNil(o.From) { + return nil, false + } + return o.From, true +} + +// HasFrom returns a boolean if a field has been set. +func (o *ERC721TransferEvent) HasFrom() bool { + if o != nil && !IsNil(o.From) { + return true + } + + return false +} + +// SetFrom gets a reference to the given string and assigns it to the From field. +func (o *ERC721TransferEvent) SetFrom(v string) { + o.From = &v +} + +// GetTo returns the To field value if set, zero value otherwise. +func (o *ERC721TransferEvent) GetTo() string { + if o == nil || IsNil(o.To) { + var ret string + return ret + } + return *o.To +} + +// GetToOk returns a tuple with the To field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ERC721TransferEvent) GetToOk() (*string, bool) { + if o == nil || IsNil(o.To) { + return nil, false + } + return o.To, true +} + +// HasTo returns a boolean if a field has been set. +func (o *ERC721TransferEvent) HasTo() bool { + if o != nil && !IsNil(o.To) { + return true + } + + return false +} + +// SetTo gets a reference to the given string and assigns it to the To field. +func (o *ERC721TransferEvent) SetTo(v string) { + o.To = &v +} + +// GetTokenId returns the TokenId field value if set, zero value otherwise. +func (o *ERC721TransferEvent) GetTokenId() string { + if o == nil || IsNil(o.TokenId) { + var ret string + return ret + } + return *o.TokenId +} + +// GetTokenIdOk returns a tuple with the TokenId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ERC721TransferEvent) GetTokenIdOk() (*string, bool) { + if o == nil || IsNil(o.TokenId) { + return nil, false + } + return o.TokenId, true +} + +// HasTokenId returns a boolean if a field has been set. +func (o *ERC721TransferEvent) HasTokenId() bool { + if o != nil && !IsNil(o.TokenId) { + return true + } + + return false +} + +// SetTokenId gets a reference to the given string and assigns it to the TokenId field. +func (o *ERC721TransferEvent) SetTokenId(v string) { + o.TokenId = &v +} + +func (o ERC721TransferEvent) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ERC721TransferEvent) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.WebhookId) { + toSerialize["webhookId"] = o.WebhookId + } + if !IsNil(o.EventType) { + toSerialize["eventType"] = o.EventType + } + if !IsNil(o.Network) { + toSerialize["network"] = o.Network + } + if !IsNil(o.BlockHash) { + toSerialize["blockHash"] = o.BlockHash + } + if !IsNil(o.BlockNumber) { + toSerialize["blockNumber"] = o.BlockNumber + } + if !IsNil(o.BlockTime) { + toSerialize["blockTime"] = o.BlockTime + } + if !IsNil(o.TransactionHash) { + toSerialize["transactionHash"] = o.TransactionHash + } + if !IsNil(o.TransactionIndex) { + toSerialize["transactionIndex"] = o.TransactionIndex + } + if !IsNil(o.LogIndex) { + toSerialize["logIndex"] = o.LogIndex + } + if !IsNil(o.ContractAddress) { + toSerialize["contractAddress"] = o.ContractAddress + } + if !IsNil(o.From) { + toSerialize["from"] = o.From + } + if !IsNil(o.To) { + toSerialize["to"] = o.To + } + if !IsNil(o.TokenId) { + toSerialize["tokenId"] = o.TokenId + } + return toSerialize, nil +} + +type NullableERC721TransferEvent struct { + value *ERC721TransferEvent + isSet bool +} + +func (v NullableERC721TransferEvent) Get() *ERC721TransferEvent { + return v.value +} + +func (v *NullableERC721TransferEvent) Set(val *ERC721TransferEvent) { + v.value = val + v.isSet = true +} + +func (v NullableERC721TransferEvent) IsSet() bool { + return v.isSet +} + +func (v *NullableERC721TransferEvent) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableERC721TransferEvent(val *ERC721TransferEvent) *NullableERC721TransferEvent { + return &NullableERC721TransferEvent{value: val, isSet: true} +} + +func (v NullableERC721TransferEvent) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableERC721TransferEvent) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/gen/client/model_ethereum_transaction.go b/gen/client/model_ethereum_transaction.go new file mode 100644 index 0000000..0d97585 --- /dev/null +++ b/gen/client/model_ethereum_transaction.go @@ -0,0 +1,742 @@ +/* +Coinbase Platform API + +This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +API version: 0.0.1-alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "time" + "bytes" + "fmt" +) + +// checks if the EthereumTransaction type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &EthereumTransaction{} + +// EthereumTransaction struct for EthereumTransaction +type EthereumTransaction struct { + // The onchain address of the sender. + From string `json:"from"` + // The amount of gas spent in the transaction. + Gas *int32 `json:"gas,omitempty"` + // The price per gas spent in the transaction in atomic units of the native asset. + GasPrice *int32 `json:"gas_price,omitempty"` + // The hash of the transaction as a hexadecimal string, prefixed with 0x. + Hash *string `json:"hash,omitempty"` + // The input data of the transaction. + Input *string `json:"input,omitempty"` + // The nonce of the transaction in the source address. + Nonce *int32 `json:"nonce,omitempty"` + // The onchain address of the receiver. + To string `json:"to"` + // The index of the transaction in the block. + Index *int32 `json:"index,omitempty"` + // The value of the transaction in atomic units of the native asset. + Value *string `json:"value,omitempty"` + // The EIP-2718 transaction type. See https://eips.ethereum.org/EIPS/eip-2718 for more details. + Type *int32 `json:"type,omitempty"` + // The max fee per gas as defined in EIP-1559. https://eips.ethereum.org/EIPS/eip-1559 for more details. + MaxFeePerGas *int32 `json:"max_fee_per_gas,omitempty"` + // The max priority fee per gas as defined in EIP-1559. https://eips.ethereum.org/EIPS/eip-1559 for more details. + MaxPriorityFeePerGas *int32 `json:"max_priority_fee_per_gas,omitempty"` + // The confirmed priority fee per gas as defined in EIP-1559. https://eips.ethereum.org/EIPS/eip-1559 for more details. + PriorityFeePerGas *int32 `json:"priority_fee_per_gas,omitempty"` + TransactionAccessList *EthereumTransactionAccessList `json:"transaction_access_list,omitempty"` + FlattenedTraces []EthereumTransactionFlattenedTrace `json:"flattened_traces,omitempty"` + // The timestamp of the block in which the event was emitted + BlockTimestamp *time.Time `json:"block_timestamp,omitempty"` + // This is for handling optimism rollup specific EIP-2718 transaction type field. + Mint *string `json:"mint,omitempty"` +} + +type _EthereumTransaction EthereumTransaction + +// NewEthereumTransaction instantiates a new EthereumTransaction object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewEthereumTransaction(from string, to string) *EthereumTransaction { + this := EthereumTransaction{} + this.From = from + this.To = to + return &this +} + +// NewEthereumTransactionWithDefaults instantiates a new EthereumTransaction object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewEthereumTransactionWithDefaults() *EthereumTransaction { + this := EthereumTransaction{} + return &this +} + +// GetFrom returns the From field value +func (o *EthereumTransaction) GetFrom() string { + if o == nil { + var ret string + return ret + } + + return o.From +} + +// GetFromOk returns a tuple with the From field value +// and a boolean to check if the value has been set. +func (o *EthereumTransaction) GetFromOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.From, true +} + +// SetFrom sets field value +func (o *EthereumTransaction) SetFrom(v string) { + o.From = v +} + +// GetGas returns the Gas field value if set, zero value otherwise. +func (o *EthereumTransaction) GetGas() int32 { + if o == nil || IsNil(o.Gas) { + var ret int32 + return ret + } + return *o.Gas +} + +// GetGasOk returns a tuple with the Gas field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EthereumTransaction) GetGasOk() (*int32, bool) { + if o == nil || IsNil(o.Gas) { + return nil, false + } + return o.Gas, true +} + +// HasGas returns a boolean if a field has been set. +func (o *EthereumTransaction) HasGas() bool { + if o != nil && !IsNil(o.Gas) { + return true + } + + return false +} + +// SetGas gets a reference to the given int32 and assigns it to the Gas field. +func (o *EthereumTransaction) SetGas(v int32) { + o.Gas = &v +} + +// GetGasPrice returns the GasPrice field value if set, zero value otherwise. +func (o *EthereumTransaction) GetGasPrice() int32 { + if o == nil || IsNil(o.GasPrice) { + var ret int32 + return ret + } + return *o.GasPrice +} + +// GetGasPriceOk returns a tuple with the GasPrice field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EthereumTransaction) GetGasPriceOk() (*int32, bool) { + if o == nil || IsNil(o.GasPrice) { + return nil, false + } + return o.GasPrice, true +} + +// HasGasPrice returns a boolean if a field has been set. +func (o *EthereumTransaction) HasGasPrice() bool { + if o != nil && !IsNil(o.GasPrice) { + return true + } + + return false +} + +// SetGasPrice gets a reference to the given int32 and assigns it to the GasPrice field. +func (o *EthereumTransaction) SetGasPrice(v int32) { + o.GasPrice = &v +} + +// GetHash returns the Hash field value if set, zero value otherwise. +func (o *EthereumTransaction) GetHash() string { + if o == nil || IsNil(o.Hash) { + var ret string + return ret + } + return *o.Hash +} + +// GetHashOk returns a tuple with the Hash field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EthereumTransaction) GetHashOk() (*string, bool) { + if o == nil || IsNil(o.Hash) { + return nil, false + } + return o.Hash, true +} + +// HasHash returns a boolean if a field has been set. +func (o *EthereumTransaction) HasHash() bool { + if o != nil && !IsNil(o.Hash) { + return true + } + + return false +} + +// SetHash gets a reference to the given string and assigns it to the Hash field. +func (o *EthereumTransaction) SetHash(v string) { + o.Hash = &v +} + +// GetInput returns the Input field value if set, zero value otherwise. +func (o *EthereumTransaction) GetInput() string { + if o == nil || IsNil(o.Input) { + var ret string + return ret + } + return *o.Input +} + +// GetInputOk returns a tuple with the Input field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EthereumTransaction) GetInputOk() (*string, bool) { + if o == nil || IsNil(o.Input) { + return nil, false + } + return o.Input, true +} + +// HasInput returns a boolean if a field has been set. +func (o *EthereumTransaction) HasInput() bool { + if o != nil && !IsNil(o.Input) { + return true + } + + return false +} + +// SetInput gets a reference to the given string and assigns it to the Input field. +func (o *EthereumTransaction) SetInput(v string) { + o.Input = &v +} + +// GetNonce returns the Nonce field value if set, zero value otherwise. +func (o *EthereumTransaction) GetNonce() int32 { + if o == nil || IsNil(o.Nonce) { + var ret int32 + return ret + } + return *o.Nonce +} + +// GetNonceOk returns a tuple with the Nonce field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EthereumTransaction) GetNonceOk() (*int32, bool) { + if o == nil || IsNil(o.Nonce) { + return nil, false + } + return o.Nonce, true +} + +// HasNonce returns a boolean if a field has been set. +func (o *EthereumTransaction) HasNonce() bool { + if o != nil && !IsNil(o.Nonce) { + return true + } + + return false +} + +// SetNonce gets a reference to the given int32 and assigns it to the Nonce field. +func (o *EthereumTransaction) SetNonce(v int32) { + o.Nonce = &v +} + +// GetTo returns the To field value +func (o *EthereumTransaction) GetTo() string { + if o == nil { + var ret string + return ret + } + + return o.To +} + +// GetToOk returns a tuple with the To field value +// and a boolean to check if the value has been set. +func (o *EthereumTransaction) GetToOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.To, true +} + +// SetTo sets field value +func (o *EthereumTransaction) SetTo(v string) { + o.To = v +} + +// GetIndex returns the Index field value if set, zero value otherwise. +func (o *EthereumTransaction) GetIndex() int32 { + if o == nil || IsNil(o.Index) { + var ret int32 + return ret + } + return *o.Index +} + +// GetIndexOk returns a tuple with the Index field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EthereumTransaction) GetIndexOk() (*int32, bool) { + if o == nil || IsNil(o.Index) { + return nil, false + } + return o.Index, true +} + +// HasIndex returns a boolean if a field has been set. +func (o *EthereumTransaction) HasIndex() bool { + if o != nil && !IsNil(o.Index) { + return true + } + + return false +} + +// SetIndex gets a reference to the given int32 and assigns it to the Index field. +func (o *EthereumTransaction) SetIndex(v int32) { + o.Index = &v +} + +// GetValue returns the Value field value if set, zero value otherwise. +func (o *EthereumTransaction) GetValue() string { + if o == nil || IsNil(o.Value) { + var ret string + return ret + } + return *o.Value +} + +// GetValueOk returns a tuple with the Value field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EthereumTransaction) GetValueOk() (*string, bool) { + if o == nil || IsNil(o.Value) { + return nil, false + } + return o.Value, true +} + +// HasValue returns a boolean if a field has been set. +func (o *EthereumTransaction) HasValue() bool { + if o != nil && !IsNil(o.Value) { + return true + } + + return false +} + +// SetValue gets a reference to the given string and assigns it to the Value field. +func (o *EthereumTransaction) SetValue(v string) { + o.Value = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *EthereumTransaction) GetType() int32 { + if o == nil || IsNil(o.Type) { + var ret int32 + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EthereumTransaction) GetTypeOk() (*int32, bool) { + if o == nil || IsNil(o.Type) { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *EthereumTransaction) HasType() bool { + if o != nil && !IsNil(o.Type) { + return true + } + + return false +} + +// SetType gets a reference to the given int32 and assigns it to the Type field. +func (o *EthereumTransaction) SetType(v int32) { + o.Type = &v +} + +// GetMaxFeePerGas returns the MaxFeePerGas field value if set, zero value otherwise. +func (o *EthereumTransaction) GetMaxFeePerGas() int32 { + if o == nil || IsNil(o.MaxFeePerGas) { + var ret int32 + return ret + } + return *o.MaxFeePerGas +} + +// GetMaxFeePerGasOk returns a tuple with the MaxFeePerGas field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EthereumTransaction) GetMaxFeePerGasOk() (*int32, bool) { + if o == nil || IsNil(o.MaxFeePerGas) { + return nil, false + } + return o.MaxFeePerGas, true +} + +// HasMaxFeePerGas returns a boolean if a field has been set. +func (o *EthereumTransaction) HasMaxFeePerGas() bool { + if o != nil && !IsNil(o.MaxFeePerGas) { + return true + } + + return false +} + +// SetMaxFeePerGas gets a reference to the given int32 and assigns it to the MaxFeePerGas field. +func (o *EthereumTransaction) SetMaxFeePerGas(v int32) { + o.MaxFeePerGas = &v +} + +// GetMaxPriorityFeePerGas returns the MaxPriorityFeePerGas field value if set, zero value otherwise. +func (o *EthereumTransaction) GetMaxPriorityFeePerGas() int32 { + if o == nil || IsNil(o.MaxPriorityFeePerGas) { + var ret int32 + return ret + } + return *o.MaxPriorityFeePerGas +} + +// GetMaxPriorityFeePerGasOk returns a tuple with the MaxPriorityFeePerGas field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EthereumTransaction) GetMaxPriorityFeePerGasOk() (*int32, bool) { + if o == nil || IsNil(o.MaxPriorityFeePerGas) { + return nil, false + } + return o.MaxPriorityFeePerGas, true +} + +// HasMaxPriorityFeePerGas returns a boolean if a field has been set. +func (o *EthereumTransaction) HasMaxPriorityFeePerGas() bool { + if o != nil && !IsNil(o.MaxPriorityFeePerGas) { + return true + } + + return false +} + +// SetMaxPriorityFeePerGas gets a reference to the given int32 and assigns it to the MaxPriorityFeePerGas field. +func (o *EthereumTransaction) SetMaxPriorityFeePerGas(v int32) { + o.MaxPriorityFeePerGas = &v +} + +// GetPriorityFeePerGas returns the PriorityFeePerGas field value if set, zero value otherwise. +func (o *EthereumTransaction) GetPriorityFeePerGas() int32 { + if o == nil || IsNil(o.PriorityFeePerGas) { + var ret int32 + return ret + } + return *o.PriorityFeePerGas +} + +// GetPriorityFeePerGasOk returns a tuple with the PriorityFeePerGas field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EthereumTransaction) GetPriorityFeePerGasOk() (*int32, bool) { + if o == nil || IsNil(o.PriorityFeePerGas) { + return nil, false + } + return o.PriorityFeePerGas, true +} + +// HasPriorityFeePerGas returns a boolean if a field has been set. +func (o *EthereumTransaction) HasPriorityFeePerGas() bool { + if o != nil && !IsNil(o.PriorityFeePerGas) { + return true + } + + return false +} + +// SetPriorityFeePerGas gets a reference to the given int32 and assigns it to the PriorityFeePerGas field. +func (o *EthereumTransaction) SetPriorityFeePerGas(v int32) { + o.PriorityFeePerGas = &v +} + +// GetTransactionAccessList returns the TransactionAccessList field value if set, zero value otherwise. +func (o *EthereumTransaction) GetTransactionAccessList() EthereumTransactionAccessList { + if o == nil || IsNil(o.TransactionAccessList) { + var ret EthereumTransactionAccessList + return ret + } + return *o.TransactionAccessList +} + +// GetTransactionAccessListOk returns a tuple with the TransactionAccessList field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EthereumTransaction) GetTransactionAccessListOk() (*EthereumTransactionAccessList, bool) { + if o == nil || IsNil(o.TransactionAccessList) { + return nil, false + } + return o.TransactionAccessList, true +} + +// HasTransactionAccessList returns a boolean if a field has been set. +func (o *EthereumTransaction) HasTransactionAccessList() bool { + if o != nil && !IsNil(o.TransactionAccessList) { + return true + } + + return false +} + +// SetTransactionAccessList gets a reference to the given EthereumTransactionAccessList and assigns it to the TransactionAccessList field. +func (o *EthereumTransaction) SetTransactionAccessList(v EthereumTransactionAccessList) { + o.TransactionAccessList = &v +} + +// GetFlattenedTraces returns the FlattenedTraces field value if set, zero value otherwise. +func (o *EthereumTransaction) GetFlattenedTraces() []EthereumTransactionFlattenedTrace { + if o == nil || IsNil(o.FlattenedTraces) { + var ret []EthereumTransactionFlattenedTrace + return ret + } + return o.FlattenedTraces +} + +// GetFlattenedTracesOk returns a tuple with the FlattenedTraces field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EthereumTransaction) GetFlattenedTracesOk() ([]EthereumTransactionFlattenedTrace, bool) { + if o == nil || IsNil(o.FlattenedTraces) { + return nil, false + } + return o.FlattenedTraces, true +} + +// HasFlattenedTraces returns a boolean if a field has been set. +func (o *EthereumTransaction) HasFlattenedTraces() bool { + if o != nil && !IsNil(o.FlattenedTraces) { + return true + } + + return false +} + +// SetFlattenedTraces gets a reference to the given []EthereumTransactionFlattenedTrace and assigns it to the FlattenedTraces field. +func (o *EthereumTransaction) SetFlattenedTraces(v []EthereumTransactionFlattenedTrace) { + o.FlattenedTraces = v +} + +// GetBlockTimestamp returns the BlockTimestamp field value if set, zero value otherwise. +func (o *EthereumTransaction) GetBlockTimestamp() time.Time { + if o == nil || IsNil(o.BlockTimestamp) { + var ret time.Time + return ret + } + return *o.BlockTimestamp +} + +// GetBlockTimestampOk returns a tuple with the BlockTimestamp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EthereumTransaction) GetBlockTimestampOk() (*time.Time, bool) { + if o == nil || IsNil(o.BlockTimestamp) { + return nil, false + } + return o.BlockTimestamp, true +} + +// HasBlockTimestamp returns a boolean if a field has been set. +func (o *EthereumTransaction) HasBlockTimestamp() bool { + if o != nil && !IsNil(o.BlockTimestamp) { + return true + } + + return false +} + +// SetBlockTimestamp gets a reference to the given time.Time and assigns it to the BlockTimestamp field. +func (o *EthereumTransaction) SetBlockTimestamp(v time.Time) { + o.BlockTimestamp = &v +} + +// GetMint returns the Mint field value if set, zero value otherwise. +func (o *EthereumTransaction) GetMint() string { + if o == nil || IsNil(o.Mint) { + var ret string + return ret + } + return *o.Mint +} + +// GetMintOk returns a tuple with the Mint field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EthereumTransaction) GetMintOk() (*string, bool) { + if o == nil || IsNil(o.Mint) { + return nil, false + } + return o.Mint, true +} + +// HasMint returns a boolean if a field has been set. +func (o *EthereumTransaction) HasMint() bool { + if o != nil && !IsNil(o.Mint) { + return true + } + + return false +} + +// SetMint gets a reference to the given string and assigns it to the Mint field. +func (o *EthereumTransaction) SetMint(v string) { + o.Mint = &v +} + +func (o EthereumTransaction) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o EthereumTransaction) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["from"] = o.From + if !IsNil(o.Gas) { + toSerialize["gas"] = o.Gas + } + if !IsNil(o.GasPrice) { + toSerialize["gas_price"] = o.GasPrice + } + if !IsNil(o.Hash) { + toSerialize["hash"] = o.Hash + } + if !IsNil(o.Input) { + toSerialize["input"] = o.Input + } + if !IsNil(o.Nonce) { + toSerialize["nonce"] = o.Nonce + } + toSerialize["to"] = o.To + if !IsNil(o.Index) { + toSerialize["index"] = o.Index + } + if !IsNil(o.Value) { + toSerialize["value"] = o.Value + } + if !IsNil(o.Type) { + toSerialize["type"] = o.Type + } + if !IsNil(o.MaxFeePerGas) { + toSerialize["max_fee_per_gas"] = o.MaxFeePerGas + } + if !IsNil(o.MaxPriorityFeePerGas) { + toSerialize["max_priority_fee_per_gas"] = o.MaxPriorityFeePerGas + } + if !IsNil(o.PriorityFeePerGas) { + toSerialize["priority_fee_per_gas"] = o.PriorityFeePerGas + } + if !IsNil(o.TransactionAccessList) { + toSerialize["transaction_access_list"] = o.TransactionAccessList + } + if !IsNil(o.FlattenedTraces) { + toSerialize["flattened_traces"] = o.FlattenedTraces + } + if !IsNil(o.BlockTimestamp) { + toSerialize["block_timestamp"] = o.BlockTimestamp + } + if !IsNil(o.Mint) { + toSerialize["mint"] = o.Mint + } + return toSerialize, nil +} + +func (o *EthereumTransaction) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "from", + "to", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varEthereumTransaction := _EthereumTransaction{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varEthereumTransaction) + + if err != nil { + return err + } + + *o = EthereumTransaction(varEthereumTransaction) + + return err +} + +type NullableEthereumTransaction struct { + value *EthereumTransaction + isSet bool +} + +func (v NullableEthereumTransaction) Get() *EthereumTransaction { + return v.value +} + +func (v *NullableEthereumTransaction) Set(val *EthereumTransaction) { + v.value = val + v.isSet = true +} + +func (v NullableEthereumTransaction) IsSet() bool { + return v.isSet +} + +func (v *NullableEthereumTransaction) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableEthereumTransaction(val *EthereumTransaction) *NullableEthereumTransaction { + return &NullableEthereumTransaction{value: val, isSet: true} +} + +func (v NullableEthereumTransaction) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableEthereumTransaction) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/gen/client/model_ethereum_transaction_access.go b/gen/client/model_ethereum_transaction_access.go new file mode 100644 index 0000000..1a1cae4 --- /dev/null +++ b/gen/client/model_ethereum_transaction_access.go @@ -0,0 +1,162 @@ +/* +Coinbase Platform API + +This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +API version: 0.0.1-alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the EthereumTransactionAccess type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &EthereumTransactionAccess{} + +// EthereumTransactionAccess struct for EthereumTransactionAccess +type EthereumTransactionAccess struct { + Address *string `json:"address,omitempty"` + StorageKeys []string `json:"storage_keys,omitempty"` +} + +// NewEthereumTransactionAccess instantiates a new EthereumTransactionAccess object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewEthereumTransactionAccess() *EthereumTransactionAccess { + this := EthereumTransactionAccess{} + return &this +} + +// NewEthereumTransactionAccessWithDefaults instantiates a new EthereumTransactionAccess object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewEthereumTransactionAccessWithDefaults() *EthereumTransactionAccess { + this := EthereumTransactionAccess{} + return &this +} + +// GetAddress returns the Address field value if set, zero value otherwise. +func (o *EthereumTransactionAccess) GetAddress() string { + if o == nil || IsNil(o.Address) { + var ret string + return ret + } + return *o.Address +} + +// GetAddressOk returns a tuple with the Address field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EthereumTransactionAccess) GetAddressOk() (*string, bool) { + if o == nil || IsNil(o.Address) { + return nil, false + } + return o.Address, true +} + +// HasAddress returns a boolean if a field has been set. +func (o *EthereumTransactionAccess) HasAddress() bool { + if o != nil && !IsNil(o.Address) { + return true + } + + return false +} + +// SetAddress gets a reference to the given string and assigns it to the Address field. +func (o *EthereumTransactionAccess) SetAddress(v string) { + o.Address = &v +} + +// GetStorageKeys returns the StorageKeys field value if set, zero value otherwise. +func (o *EthereumTransactionAccess) GetStorageKeys() []string { + if o == nil || IsNil(o.StorageKeys) { + var ret []string + return ret + } + return o.StorageKeys +} + +// GetStorageKeysOk returns a tuple with the StorageKeys field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EthereumTransactionAccess) GetStorageKeysOk() ([]string, bool) { + if o == nil || IsNil(o.StorageKeys) { + return nil, false + } + return o.StorageKeys, true +} + +// HasStorageKeys returns a boolean if a field has been set. +func (o *EthereumTransactionAccess) HasStorageKeys() bool { + if o != nil && !IsNil(o.StorageKeys) { + return true + } + + return false +} + +// SetStorageKeys gets a reference to the given []string and assigns it to the StorageKeys field. +func (o *EthereumTransactionAccess) SetStorageKeys(v []string) { + o.StorageKeys = v +} + +func (o EthereumTransactionAccess) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o EthereumTransactionAccess) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Address) { + toSerialize["address"] = o.Address + } + if !IsNil(o.StorageKeys) { + toSerialize["storage_keys"] = o.StorageKeys + } + return toSerialize, nil +} + +type NullableEthereumTransactionAccess struct { + value *EthereumTransactionAccess + isSet bool +} + +func (v NullableEthereumTransactionAccess) Get() *EthereumTransactionAccess { + return v.value +} + +func (v *NullableEthereumTransactionAccess) Set(val *EthereumTransactionAccess) { + v.value = val + v.isSet = true +} + +func (v NullableEthereumTransactionAccess) IsSet() bool { + return v.isSet +} + +func (v *NullableEthereumTransactionAccess) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableEthereumTransactionAccess(val *EthereumTransactionAccess) *NullableEthereumTransactionAccess { + return &NullableEthereumTransactionAccess{value: val, isSet: true} +} + +func (v NullableEthereumTransactionAccess) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableEthereumTransactionAccess) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/gen/client/model_ethereum_transaction_access_list.go b/gen/client/model_ethereum_transaction_access_list.go new file mode 100644 index 0000000..c6cd3ac --- /dev/null +++ b/gen/client/model_ethereum_transaction_access_list.go @@ -0,0 +1,126 @@ +/* +Coinbase Platform API + +This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +API version: 0.0.1-alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the EthereumTransactionAccessList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &EthereumTransactionAccessList{} + +// EthereumTransactionAccessList struct for EthereumTransactionAccessList +type EthereumTransactionAccessList struct { + AccessList []EthereumTransactionAccess `json:"access_list,omitempty"` +} + +// NewEthereumTransactionAccessList instantiates a new EthereumTransactionAccessList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewEthereumTransactionAccessList() *EthereumTransactionAccessList { + this := EthereumTransactionAccessList{} + return &this +} + +// NewEthereumTransactionAccessListWithDefaults instantiates a new EthereumTransactionAccessList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewEthereumTransactionAccessListWithDefaults() *EthereumTransactionAccessList { + this := EthereumTransactionAccessList{} + return &this +} + +// GetAccessList returns the AccessList field value if set, zero value otherwise. +func (o *EthereumTransactionAccessList) GetAccessList() []EthereumTransactionAccess { + if o == nil || IsNil(o.AccessList) { + var ret []EthereumTransactionAccess + return ret + } + return o.AccessList +} + +// GetAccessListOk returns a tuple with the AccessList field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EthereumTransactionAccessList) GetAccessListOk() ([]EthereumTransactionAccess, bool) { + if o == nil || IsNil(o.AccessList) { + return nil, false + } + return o.AccessList, true +} + +// HasAccessList returns a boolean if a field has been set. +func (o *EthereumTransactionAccessList) HasAccessList() bool { + if o != nil && !IsNil(o.AccessList) { + return true + } + + return false +} + +// SetAccessList gets a reference to the given []EthereumTransactionAccess and assigns it to the AccessList field. +func (o *EthereumTransactionAccessList) SetAccessList(v []EthereumTransactionAccess) { + o.AccessList = v +} + +func (o EthereumTransactionAccessList) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o EthereumTransactionAccessList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.AccessList) { + toSerialize["access_list"] = o.AccessList + } + return toSerialize, nil +} + +type NullableEthereumTransactionAccessList struct { + value *EthereumTransactionAccessList + isSet bool +} + +func (v NullableEthereumTransactionAccessList) Get() *EthereumTransactionAccessList { + return v.value +} + +func (v *NullableEthereumTransactionAccessList) Set(val *EthereumTransactionAccessList) { + v.value = val + v.isSet = true +} + +func (v NullableEthereumTransactionAccessList) IsSet() bool { + return v.isSet +} + +func (v *NullableEthereumTransactionAccessList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableEthereumTransactionAccessList(val *EthereumTransactionAccessList) *NullableEthereumTransactionAccessList { + return &NullableEthereumTransactionAccessList{value: val, isSet: true} +} + +func (v NullableEthereumTransactionAccessList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableEthereumTransactionAccessList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/gen/client/model_ethereum_transaction_flattened_trace.go b/gen/client/model_ethereum_transaction_flattened_trace.go new file mode 100644 index 0000000..81533b2 --- /dev/null +++ b/gen/client/model_ethereum_transaction_flattened_trace.go @@ -0,0 +1,774 @@ +/* +Coinbase Platform API + +This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +API version: 0.0.1-alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the EthereumTransactionFlattenedTrace type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &EthereumTransactionFlattenedTrace{} + +// EthereumTransactionFlattenedTrace struct for EthereumTransactionFlattenedTrace +type EthereumTransactionFlattenedTrace struct { + Error *string `json:"error,omitempty"` + Type *string `json:"type,omitempty"` + From *string `json:"from,omitempty"` + To *string `json:"to,omitempty"` + Value *string `json:"value,omitempty"` + Gas *int32 `json:"gas,omitempty"` + GasUsed *int32 `json:"gas_used,omitempty"` + Input *string `json:"input,omitempty"` + Output *string `json:"output,omitempty"` + SubTraces *int32 `json:"sub_traces,omitempty"` + TraceAddress []int32 `json:"trace_address,omitempty"` + TraceType *string `json:"trace_type,omitempty"` + CallType *string `json:"call_type,omitempty"` + TraceId *string `json:"trace_id,omitempty"` + Status *int32 `json:"status,omitempty"` + BlockHash *string `json:"block_hash,omitempty"` + BlockNumber *int32 `json:"block_number,omitempty"` + TransactionHash *string `json:"transaction_hash,omitempty"` + TransactionIndex *int32 `json:"transaction_index,omitempty"` +} + +// NewEthereumTransactionFlattenedTrace instantiates a new EthereumTransactionFlattenedTrace object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewEthereumTransactionFlattenedTrace() *EthereumTransactionFlattenedTrace { + this := EthereumTransactionFlattenedTrace{} + return &this +} + +// NewEthereumTransactionFlattenedTraceWithDefaults instantiates a new EthereumTransactionFlattenedTrace object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewEthereumTransactionFlattenedTraceWithDefaults() *EthereumTransactionFlattenedTrace { + this := EthereumTransactionFlattenedTrace{} + return &this +} + +// GetError returns the Error field value if set, zero value otherwise. +func (o *EthereumTransactionFlattenedTrace) GetError() string { + if o == nil || IsNil(o.Error) { + var ret string + return ret + } + return *o.Error +} + +// GetErrorOk returns a tuple with the Error field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EthereumTransactionFlattenedTrace) GetErrorOk() (*string, bool) { + if o == nil || IsNil(o.Error) { + return nil, false + } + return o.Error, true +} + +// HasError returns a boolean if a field has been set. +func (o *EthereumTransactionFlattenedTrace) HasError() bool { + if o != nil && !IsNil(o.Error) { + return true + } + + return false +} + +// SetError gets a reference to the given string and assigns it to the Error field. +func (o *EthereumTransactionFlattenedTrace) SetError(v string) { + o.Error = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *EthereumTransactionFlattenedTrace) GetType() string { + if o == nil || IsNil(o.Type) { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EthereumTransactionFlattenedTrace) GetTypeOk() (*string, bool) { + if o == nil || IsNil(o.Type) { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *EthereumTransactionFlattenedTrace) HasType() bool { + if o != nil && !IsNil(o.Type) { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *EthereumTransactionFlattenedTrace) SetType(v string) { + o.Type = &v +} + +// GetFrom returns the From field value if set, zero value otherwise. +func (o *EthereumTransactionFlattenedTrace) GetFrom() string { + if o == nil || IsNil(o.From) { + var ret string + return ret + } + return *o.From +} + +// GetFromOk returns a tuple with the From field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EthereumTransactionFlattenedTrace) GetFromOk() (*string, bool) { + if o == nil || IsNil(o.From) { + return nil, false + } + return o.From, true +} + +// HasFrom returns a boolean if a field has been set. +func (o *EthereumTransactionFlattenedTrace) HasFrom() bool { + if o != nil && !IsNil(o.From) { + return true + } + + return false +} + +// SetFrom gets a reference to the given string and assigns it to the From field. +func (o *EthereumTransactionFlattenedTrace) SetFrom(v string) { + o.From = &v +} + +// GetTo returns the To field value if set, zero value otherwise. +func (o *EthereumTransactionFlattenedTrace) GetTo() string { + if o == nil || IsNil(o.To) { + var ret string + return ret + } + return *o.To +} + +// GetToOk returns a tuple with the To field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EthereumTransactionFlattenedTrace) GetToOk() (*string, bool) { + if o == nil || IsNil(o.To) { + return nil, false + } + return o.To, true +} + +// HasTo returns a boolean if a field has been set. +func (o *EthereumTransactionFlattenedTrace) HasTo() bool { + if o != nil && !IsNil(o.To) { + return true + } + + return false +} + +// SetTo gets a reference to the given string and assigns it to the To field. +func (o *EthereumTransactionFlattenedTrace) SetTo(v string) { + o.To = &v +} + +// GetValue returns the Value field value if set, zero value otherwise. +func (o *EthereumTransactionFlattenedTrace) GetValue() string { + if o == nil || IsNil(o.Value) { + var ret string + return ret + } + return *o.Value +} + +// GetValueOk returns a tuple with the Value field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EthereumTransactionFlattenedTrace) GetValueOk() (*string, bool) { + if o == nil || IsNil(o.Value) { + return nil, false + } + return o.Value, true +} + +// HasValue returns a boolean if a field has been set. +func (o *EthereumTransactionFlattenedTrace) HasValue() bool { + if o != nil && !IsNil(o.Value) { + return true + } + + return false +} + +// SetValue gets a reference to the given string and assigns it to the Value field. +func (o *EthereumTransactionFlattenedTrace) SetValue(v string) { + o.Value = &v +} + +// GetGas returns the Gas field value if set, zero value otherwise. +func (o *EthereumTransactionFlattenedTrace) GetGas() int32 { + if o == nil || IsNil(o.Gas) { + var ret int32 + return ret + } + return *o.Gas +} + +// GetGasOk returns a tuple with the Gas field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EthereumTransactionFlattenedTrace) GetGasOk() (*int32, bool) { + if o == nil || IsNil(o.Gas) { + return nil, false + } + return o.Gas, true +} + +// HasGas returns a boolean if a field has been set. +func (o *EthereumTransactionFlattenedTrace) HasGas() bool { + if o != nil && !IsNil(o.Gas) { + return true + } + + return false +} + +// SetGas gets a reference to the given int32 and assigns it to the Gas field. +func (o *EthereumTransactionFlattenedTrace) SetGas(v int32) { + o.Gas = &v +} + +// GetGasUsed returns the GasUsed field value if set, zero value otherwise. +func (o *EthereumTransactionFlattenedTrace) GetGasUsed() int32 { + if o == nil || IsNil(o.GasUsed) { + var ret int32 + return ret + } + return *o.GasUsed +} + +// GetGasUsedOk returns a tuple with the GasUsed field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EthereumTransactionFlattenedTrace) GetGasUsedOk() (*int32, bool) { + if o == nil || IsNil(o.GasUsed) { + return nil, false + } + return o.GasUsed, true +} + +// HasGasUsed returns a boolean if a field has been set. +func (o *EthereumTransactionFlattenedTrace) HasGasUsed() bool { + if o != nil && !IsNil(o.GasUsed) { + return true + } + + return false +} + +// SetGasUsed gets a reference to the given int32 and assigns it to the GasUsed field. +func (o *EthereumTransactionFlattenedTrace) SetGasUsed(v int32) { + o.GasUsed = &v +} + +// GetInput returns the Input field value if set, zero value otherwise. +func (o *EthereumTransactionFlattenedTrace) GetInput() string { + if o == nil || IsNil(o.Input) { + var ret string + return ret + } + return *o.Input +} + +// GetInputOk returns a tuple with the Input field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EthereumTransactionFlattenedTrace) GetInputOk() (*string, bool) { + if o == nil || IsNil(o.Input) { + return nil, false + } + return o.Input, true +} + +// HasInput returns a boolean if a field has been set. +func (o *EthereumTransactionFlattenedTrace) HasInput() bool { + if o != nil && !IsNil(o.Input) { + return true + } + + return false +} + +// SetInput gets a reference to the given string and assigns it to the Input field. +func (o *EthereumTransactionFlattenedTrace) SetInput(v string) { + o.Input = &v +} + +// GetOutput returns the Output field value if set, zero value otherwise. +func (o *EthereumTransactionFlattenedTrace) GetOutput() string { + if o == nil || IsNil(o.Output) { + var ret string + return ret + } + return *o.Output +} + +// GetOutputOk returns a tuple with the Output field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EthereumTransactionFlattenedTrace) GetOutputOk() (*string, bool) { + if o == nil || IsNil(o.Output) { + return nil, false + } + return o.Output, true +} + +// HasOutput returns a boolean if a field has been set. +func (o *EthereumTransactionFlattenedTrace) HasOutput() bool { + if o != nil && !IsNil(o.Output) { + return true + } + + return false +} + +// SetOutput gets a reference to the given string and assigns it to the Output field. +func (o *EthereumTransactionFlattenedTrace) SetOutput(v string) { + o.Output = &v +} + +// GetSubTraces returns the SubTraces field value if set, zero value otherwise. +func (o *EthereumTransactionFlattenedTrace) GetSubTraces() int32 { + if o == nil || IsNil(o.SubTraces) { + var ret int32 + return ret + } + return *o.SubTraces +} + +// GetSubTracesOk returns a tuple with the SubTraces field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EthereumTransactionFlattenedTrace) GetSubTracesOk() (*int32, bool) { + if o == nil || IsNil(o.SubTraces) { + return nil, false + } + return o.SubTraces, true +} + +// HasSubTraces returns a boolean if a field has been set. +func (o *EthereumTransactionFlattenedTrace) HasSubTraces() bool { + if o != nil && !IsNil(o.SubTraces) { + return true + } + + return false +} + +// SetSubTraces gets a reference to the given int32 and assigns it to the SubTraces field. +func (o *EthereumTransactionFlattenedTrace) SetSubTraces(v int32) { + o.SubTraces = &v +} + +// GetTraceAddress returns the TraceAddress field value if set, zero value otherwise. +func (o *EthereumTransactionFlattenedTrace) GetTraceAddress() []int32 { + if o == nil || IsNil(o.TraceAddress) { + var ret []int32 + return ret + } + return o.TraceAddress +} + +// GetTraceAddressOk returns a tuple with the TraceAddress field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EthereumTransactionFlattenedTrace) GetTraceAddressOk() ([]int32, bool) { + if o == nil || IsNil(o.TraceAddress) { + return nil, false + } + return o.TraceAddress, true +} + +// HasTraceAddress returns a boolean if a field has been set. +func (o *EthereumTransactionFlattenedTrace) HasTraceAddress() bool { + if o != nil && !IsNil(o.TraceAddress) { + return true + } + + return false +} + +// SetTraceAddress gets a reference to the given []int32 and assigns it to the TraceAddress field. +func (o *EthereumTransactionFlattenedTrace) SetTraceAddress(v []int32) { + o.TraceAddress = v +} + +// GetTraceType returns the TraceType field value if set, zero value otherwise. +func (o *EthereumTransactionFlattenedTrace) GetTraceType() string { + if o == nil || IsNil(o.TraceType) { + var ret string + return ret + } + return *o.TraceType +} + +// GetTraceTypeOk returns a tuple with the TraceType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EthereumTransactionFlattenedTrace) GetTraceTypeOk() (*string, bool) { + if o == nil || IsNil(o.TraceType) { + return nil, false + } + return o.TraceType, true +} + +// HasTraceType returns a boolean if a field has been set. +func (o *EthereumTransactionFlattenedTrace) HasTraceType() bool { + if o != nil && !IsNil(o.TraceType) { + return true + } + + return false +} + +// SetTraceType gets a reference to the given string and assigns it to the TraceType field. +func (o *EthereumTransactionFlattenedTrace) SetTraceType(v string) { + o.TraceType = &v +} + +// GetCallType returns the CallType field value if set, zero value otherwise. +func (o *EthereumTransactionFlattenedTrace) GetCallType() string { + if o == nil || IsNil(o.CallType) { + var ret string + return ret + } + return *o.CallType +} + +// GetCallTypeOk returns a tuple with the CallType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EthereumTransactionFlattenedTrace) GetCallTypeOk() (*string, bool) { + if o == nil || IsNil(o.CallType) { + return nil, false + } + return o.CallType, true +} + +// HasCallType returns a boolean if a field has been set. +func (o *EthereumTransactionFlattenedTrace) HasCallType() bool { + if o != nil && !IsNil(o.CallType) { + return true + } + + return false +} + +// SetCallType gets a reference to the given string and assigns it to the CallType field. +func (o *EthereumTransactionFlattenedTrace) SetCallType(v string) { + o.CallType = &v +} + +// GetTraceId returns the TraceId field value if set, zero value otherwise. +func (o *EthereumTransactionFlattenedTrace) GetTraceId() string { + if o == nil || IsNil(o.TraceId) { + var ret string + return ret + } + return *o.TraceId +} + +// GetTraceIdOk returns a tuple with the TraceId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EthereumTransactionFlattenedTrace) GetTraceIdOk() (*string, bool) { + if o == nil || IsNil(o.TraceId) { + return nil, false + } + return o.TraceId, true +} + +// HasTraceId returns a boolean if a field has been set. +func (o *EthereumTransactionFlattenedTrace) HasTraceId() bool { + if o != nil && !IsNil(o.TraceId) { + return true + } + + return false +} + +// SetTraceId gets a reference to the given string and assigns it to the TraceId field. +func (o *EthereumTransactionFlattenedTrace) SetTraceId(v string) { + o.TraceId = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *EthereumTransactionFlattenedTrace) GetStatus() int32 { + if o == nil || IsNil(o.Status) { + var ret int32 + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EthereumTransactionFlattenedTrace) GetStatusOk() (*int32, bool) { + if o == nil || IsNil(o.Status) { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *EthereumTransactionFlattenedTrace) HasStatus() bool { + if o != nil && !IsNil(o.Status) { + return true + } + + return false +} + +// SetStatus gets a reference to the given int32 and assigns it to the Status field. +func (o *EthereumTransactionFlattenedTrace) SetStatus(v int32) { + o.Status = &v +} + +// GetBlockHash returns the BlockHash field value if set, zero value otherwise. +func (o *EthereumTransactionFlattenedTrace) GetBlockHash() string { + if o == nil || IsNil(o.BlockHash) { + var ret string + return ret + } + return *o.BlockHash +} + +// GetBlockHashOk returns a tuple with the BlockHash field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EthereumTransactionFlattenedTrace) GetBlockHashOk() (*string, bool) { + if o == nil || IsNil(o.BlockHash) { + return nil, false + } + return o.BlockHash, true +} + +// HasBlockHash returns a boolean if a field has been set. +func (o *EthereumTransactionFlattenedTrace) HasBlockHash() bool { + if o != nil && !IsNil(o.BlockHash) { + return true + } + + return false +} + +// SetBlockHash gets a reference to the given string and assigns it to the BlockHash field. +func (o *EthereumTransactionFlattenedTrace) SetBlockHash(v string) { + o.BlockHash = &v +} + +// GetBlockNumber returns the BlockNumber field value if set, zero value otherwise. +func (o *EthereumTransactionFlattenedTrace) GetBlockNumber() int32 { + if o == nil || IsNil(o.BlockNumber) { + var ret int32 + return ret + } + return *o.BlockNumber +} + +// GetBlockNumberOk returns a tuple with the BlockNumber field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EthereumTransactionFlattenedTrace) GetBlockNumberOk() (*int32, bool) { + if o == nil || IsNil(o.BlockNumber) { + return nil, false + } + return o.BlockNumber, true +} + +// HasBlockNumber returns a boolean if a field has been set. +func (o *EthereumTransactionFlattenedTrace) HasBlockNumber() bool { + if o != nil && !IsNil(o.BlockNumber) { + return true + } + + return false +} + +// SetBlockNumber gets a reference to the given int32 and assigns it to the BlockNumber field. +func (o *EthereumTransactionFlattenedTrace) SetBlockNumber(v int32) { + o.BlockNumber = &v +} + +// GetTransactionHash returns the TransactionHash field value if set, zero value otherwise. +func (o *EthereumTransactionFlattenedTrace) GetTransactionHash() string { + if o == nil || IsNil(o.TransactionHash) { + var ret string + return ret + } + return *o.TransactionHash +} + +// GetTransactionHashOk returns a tuple with the TransactionHash field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EthereumTransactionFlattenedTrace) GetTransactionHashOk() (*string, bool) { + if o == nil || IsNil(o.TransactionHash) { + return nil, false + } + return o.TransactionHash, true +} + +// HasTransactionHash returns a boolean if a field has been set. +func (o *EthereumTransactionFlattenedTrace) HasTransactionHash() bool { + if o != nil && !IsNil(o.TransactionHash) { + return true + } + + return false +} + +// SetTransactionHash gets a reference to the given string and assigns it to the TransactionHash field. +func (o *EthereumTransactionFlattenedTrace) SetTransactionHash(v string) { + o.TransactionHash = &v +} + +// GetTransactionIndex returns the TransactionIndex field value if set, zero value otherwise. +func (o *EthereumTransactionFlattenedTrace) GetTransactionIndex() int32 { + if o == nil || IsNil(o.TransactionIndex) { + var ret int32 + return ret + } + return *o.TransactionIndex +} + +// GetTransactionIndexOk returns a tuple with the TransactionIndex field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EthereumTransactionFlattenedTrace) GetTransactionIndexOk() (*int32, bool) { + if o == nil || IsNil(o.TransactionIndex) { + return nil, false + } + return o.TransactionIndex, true +} + +// HasTransactionIndex returns a boolean if a field has been set. +func (o *EthereumTransactionFlattenedTrace) HasTransactionIndex() bool { + if o != nil && !IsNil(o.TransactionIndex) { + return true + } + + return false +} + +// SetTransactionIndex gets a reference to the given int32 and assigns it to the TransactionIndex field. +func (o *EthereumTransactionFlattenedTrace) SetTransactionIndex(v int32) { + o.TransactionIndex = &v +} + +func (o EthereumTransactionFlattenedTrace) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o EthereumTransactionFlattenedTrace) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Error) { + toSerialize["error"] = o.Error + } + if !IsNil(o.Type) { + toSerialize["type"] = o.Type + } + if !IsNil(o.From) { + toSerialize["from"] = o.From + } + if !IsNil(o.To) { + toSerialize["to"] = o.To + } + if !IsNil(o.Value) { + toSerialize["value"] = o.Value + } + if !IsNil(o.Gas) { + toSerialize["gas"] = o.Gas + } + if !IsNil(o.GasUsed) { + toSerialize["gas_used"] = o.GasUsed + } + if !IsNil(o.Input) { + toSerialize["input"] = o.Input + } + if !IsNil(o.Output) { + toSerialize["output"] = o.Output + } + if !IsNil(o.SubTraces) { + toSerialize["sub_traces"] = o.SubTraces + } + if !IsNil(o.TraceAddress) { + toSerialize["trace_address"] = o.TraceAddress + } + if !IsNil(o.TraceType) { + toSerialize["trace_type"] = o.TraceType + } + if !IsNil(o.CallType) { + toSerialize["call_type"] = o.CallType + } + if !IsNil(o.TraceId) { + toSerialize["trace_id"] = o.TraceId + } + if !IsNil(o.Status) { + toSerialize["status"] = o.Status + } + if !IsNil(o.BlockHash) { + toSerialize["block_hash"] = o.BlockHash + } + if !IsNil(o.BlockNumber) { + toSerialize["block_number"] = o.BlockNumber + } + if !IsNil(o.TransactionHash) { + toSerialize["transaction_hash"] = o.TransactionHash + } + if !IsNil(o.TransactionIndex) { + toSerialize["transaction_index"] = o.TransactionIndex + } + return toSerialize, nil +} + +type NullableEthereumTransactionFlattenedTrace struct { + value *EthereumTransactionFlattenedTrace + isSet bool +} + +func (v NullableEthereumTransactionFlattenedTrace) Get() *EthereumTransactionFlattenedTrace { + return v.value +} + +func (v *NullableEthereumTransactionFlattenedTrace) Set(val *EthereumTransactionFlattenedTrace) { + v.value = val + v.isSet = true +} + +func (v NullableEthereumTransactionFlattenedTrace) IsSet() bool { + return v.isSet +} + +func (v *NullableEthereumTransactionFlattenedTrace) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableEthereumTransactionFlattenedTrace(val *EthereumTransactionFlattenedTrace) *NullableEthereumTransactionFlattenedTrace { + return &NullableEthereumTransactionFlattenedTrace{value: val, isSet: true} +} + +func (v NullableEthereumTransactionFlattenedTrace) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableEthereumTransactionFlattenedTrace) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/gen/client/model_feature.go b/gen/client/model_feature.go deleted file mode 100644 index a1ae101..0000000 --- a/gen/client/model_feature.go +++ /dev/null @@ -1,116 +0,0 @@ -/* -Coinbase Platform API - -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. - -API version: 0.0.1-alpha -Contact: yuga.cohler@coinbase.com -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package client - -import ( - "encoding/json" - "fmt" -) - -// Feature Features that can be enabled for a wallet -type Feature string - -// List of Feature -const ( - FEATURE_TRANSFER Feature = "transfer" - FEATURE_TRADE Feature = "trade" - FEATURE_FAUCET Feature = "faucet" - FEATURE_SERVER_SIGNER Feature = "server_signer" -) - -// All allowed values of Feature enum -var AllowedFeatureEnumValues = []Feature{ - "transfer", - "trade", - "faucet", - "server_signer", -} - -func (v *Feature) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - enumTypeValue := Feature(value) - for _, existing := range AllowedFeatureEnumValues { - if existing == enumTypeValue { - *v = enumTypeValue - return nil - } - } - - return fmt.Errorf("%+v is not a valid Feature", value) -} - -// NewFeatureFromValue returns a pointer to a valid Feature -// for the value passed as argument, or an error if the value passed is not allowed by the enum -func NewFeatureFromValue(v string) (*Feature, error) { - ev := Feature(v) - if ev.IsValid() { - return &ev, nil - } else { - return nil, fmt.Errorf("invalid value '%v' for Feature: valid values are %v", v, AllowedFeatureEnumValues) - } -} - -// IsValid return true if the value is valid for the enum, false otherwise -func (v Feature) IsValid() bool { - for _, existing := range AllowedFeatureEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to Feature value -func (v Feature) Ptr() *Feature { - return &v -} - -type NullableFeature struct { - value *Feature - isSet bool -} - -func (v NullableFeature) Get() *Feature { - return v.value -} - -func (v *NullableFeature) Set(val *Feature) { - v.value = val - v.isSet = true -} - -func (v NullableFeature) IsSet() bool { - return v.isSet -} - -func (v *NullableFeature) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableFeature(val *Feature) *NullableFeature { - return &NullableFeature{value: val, isSet: true} -} - -func (v NullableFeature) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableFeature) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} - diff --git a/gen/client/model_network_identifier.go b/gen/client/model_network_identifier.go index 4f92e85..469a674 100644 --- a/gen/client/model_network_identifier.go +++ b/gen/client/model_network_identifier.go @@ -25,6 +25,9 @@ const ( NETWORKIDENTIFIER_ETHEREUM_HOLESKY NetworkIdentifier = "ethereum-holesky" NETWORKIDENTIFIER_ETHEREUM_MAINNET NetworkIdentifier = "ethereum-mainnet" NETWORKIDENTIFIER_POLYGON_MAINNET NetworkIdentifier = "polygon-mainnet" + NETWORKIDENTIFIER_SOLANA_DEVNET NetworkIdentifier = "solana-devnet" + NETWORKIDENTIFIER_SOLANA_MAINNET NetworkIdentifier = "solana-mainnet" + NETWORKIDENTIFIER_ARBITRUM_MAINNET NetworkIdentifier = "arbitrum-mainnet" ) // All allowed values of NetworkIdentifier enum @@ -34,6 +37,9 @@ var AllowedNetworkIdentifierEnumValues = []NetworkIdentifier{ "ethereum-holesky", "ethereum-mainnet", "polygon-mainnet", + "solana-devnet", + "solana-mainnet", + "arbitrum-mainnet", } func (v *NetworkIdentifier) UnmarshalJSON(src []byte) error { diff --git a/gen/client/model_nft_contract_options.go b/gen/client/model_nft_contract_options.go new file mode 100644 index 0000000..0a605c8 --- /dev/null +++ b/gen/client/model_nft_contract_options.go @@ -0,0 +1,188 @@ +/* +Coinbase Platform API + +This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +API version: 0.0.1-alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "bytes" + "fmt" +) + +// checks if the NFTContractOptions type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NFTContractOptions{} + +// NFTContractOptions Options for NFT contract creation +type NFTContractOptions struct { + // The name of the NFT + Name string `json:"name"` + // The symbol of the NFT + Symbol string `json:"symbol"` +} + +type _NFTContractOptions NFTContractOptions + +// NewNFTContractOptions instantiates a new NFTContractOptions object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewNFTContractOptions(name string, symbol string) *NFTContractOptions { + this := NFTContractOptions{} + this.Name = name + this.Symbol = symbol + return &this +} + +// NewNFTContractOptionsWithDefaults instantiates a new NFTContractOptions object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewNFTContractOptionsWithDefaults() *NFTContractOptions { + this := NFTContractOptions{} + return &this +} + +// GetName returns the Name field value +func (o *NFTContractOptions) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *NFTContractOptions) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *NFTContractOptions) SetName(v string) { + o.Name = v +} + +// GetSymbol returns the Symbol field value +func (o *NFTContractOptions) GetSymbol() string { + if o == nil { + var ret string + return ret + } + + return o.Symbol +} + +// GetSymbolOk returns a tuple with the Symbol field value +// and a boolean to check if the value has been set. +func (o *NFTContractOptions) GetSymbolOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Symbol, true +} + +// SetSymbol sets field value +func (o *NFTContractOptions) SetSymbol(v string) { + o.Symbol = v +} + +func (o NFTContractOptions) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o NFTContractOptions) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + toSerialize["symbol"] = o.Symbol + return toSerialize, nil +} + +func (o *NFTContractOptions) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "name", + "symbol", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varNFTContractOptions := _NFTContractOptions{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varNFTContractOptions) + + if err != nil { + return err + } + + *o = NFTContractOptions(varNFTContractOptions) + + return err +} + +type NullableNFTContractOptions struct { + value *NFTContractOptions + isSet bool +} + +func (v NullableNFTContractOptions) Get() *NFTContractOptions { + return v.value +} + +func (v *NullableNFTContractOptions) Set(val *NFTContractOptions) { + v.value = val + v.isSet = true +} + +func (v NullableNFTContractOptions) IsSet() bool { + return v.isSet +} + +func (v *NullableNFTContractOptions) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNFTContractOptions(val *NFTContractOptions) *NullableNFTContractOptions { + return &NullableNFTContractOptions{value: val, isSet: true} +} + +func (v NullableNFTContractOptions) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNFTContractOptions) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/gen/client/model_payload_signature.go b/gen/client/model_payload_signature.go new file mode 100644 index 0000000..d27f875 --- /dev/null +++ b/gen/client/model_payload_signature.go @@ -0,0 +1,312 @@ +/* +Coinbase Platform API + +This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +API version: 0.0.1-alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "bytes" + "fmt" +) + +// checks if the PayloadSignature type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PayloadSignature{} + +// PayloadSignature A payload signed by an address. +type PayloadSignature struct { + // The ID of the payload signature. + PayloadSignatureId string `json:"payload_signature_id"` + // The ID of the wallet that owns the address. + WalletId string `json:"wallet_id"` + // The onchain address of the signer. + AddressId string `json:"address_id"` + // The unsigned payload. This is the payload that needs to be signed by the signer address. + UnsignedPayload string `json:"unsigned_payload"` + // The signature of the payload. + Signature *string `json:"signature,omitempty"` + // The status of the payload signature. + Status string `json:"status"` +} + +type _PayloadSignature PayloadSignature + +// NewPayloadSignature instantiates a new PayloadSignature object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPayloadSignature(payloadSignatureId string, walletId string, addressId string, unsignedPayload string, status string) *PayloadSignature { + this := PayloadSignature{} + this.PayloadSignatureId = payloadSignatureId + this.WalletId = walletId + this.AddressId = addressId + this.UnsignedPayload = unsignedPayload + this.Status = status + return &this +} + +// NewPayloadSignatureWithDefaults instantiates a new PayloadSignature object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPayloadSignatureWithDefaults() *PayloadSignature { + this := PayloadSignature{} + return &this +} + +// GetPayloadSignatureId returns the PayloadSignatureId field value +func (o *PayloadSignature) GetPayloadSignatureId() string { + if o == nil { + var ret string + return ret + } + + return o.PayloadSignatureId +} + +// GetPayloadSignatureIdOk returns a tuple with the PayloadSignatureId field value +// and a boolean to check if the value has been set. +func (o *PayloadSignature) GetPayloadSignatureIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.PayloadSignatureId, true +} + +// SetPayloadSignatureId sets field value +func (o *PayloadSignature) SetPayloadSignatureId(v string) { + o.PayloadSignatureId = v +} + +// GetWalletId returns the WalletId field value +func (o *PayloadSignature) GetWalletId() string { + if o == nil { + var ret string + return ret + } + + return o.WalletId +} + +// GetWalletIdOk returns a tuple with the WalletId field value +// and a boolean to check if the value has been set. +func (o *PayloadSignature) GetWalletIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.WalletId, true +} + +// SetWalletId sets field value +func (o *PayloadSignature) SetWalletId(v string) { + o.WalletId = v +} + +// GetAddressId returns the AddressId field value +func (o *PayloadSignature) GetAddressId() string { + if o == nil { + var ret string + return ret + } + + return o.AddressId +} + +// GetAddressIdOk returns a tuple with the AddressId field value +// and a boolean to check if the value has been set. +func (o *PayloadSignature) GetAddressIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.AddressId, true +} + +// SetAddressId sets field value +func (o *PayloadSignature) SetAddressId(v string) { + o.AddressId = v +} + +// GetUnsignedPayload returns the UnsignedPayload field value +func (o *PayloadSignature) GetUnsignedPayload() string { + if o == nil { + var ret string + return ret + } + + return o.UnsignedPayload +} + +// GetUnsignedPayloadOk returns a tuple with the UnsignedPayload field value +// and a boolean to check if the value has been set. +func (o *PayloadSignature) GetUnsignedPayloadOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.UnsignedPayload, true +} + +// SetUnsignedPayload sets field value +func (o *PayloadSignature) SetUnsignedPayload(v string) { + o.UnsignedPayload = v +} + +// GetSignature returns the Signature field value if set, zero value otherwise. +func (o *PayloadSignature) GetSignature() string { + if o == nil || IsNil(o.Signature) { + var ret string + return ret + } + return *o.Signature +} + +// GetSignatureOk returns a tuple with the Signature field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PayloadSignature) GetSignatureOk() (*string, bool) { + if o == nil || IsNil(o.Signature) { + return nil, false + } + return o.Signature, true +} + +// HasSignature returns a boolean if a field has been set. +func (o *PayloadSignature) HasSignature() bool { + if o != nil && !IsNil(o.Signature) { + return true + } + + return false +} + +// SetSignature gets a reference to the given string and assigns it to the Signature field. +func (o *PayloadSignature) SetSignature(v string) { + o.Signature = &v +} + +// GetStatus returns the Status field value +func (o *PayloadSignature) GetStatus() string { + if o == nil { + var ret string + return ret + } + + return o.Status +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *PayloadSignature) GetStatusOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Status, true +} + +// SetStatus sets field value +func (o *PayloadSignature) SetStatus(v string) { + o.Status = v +} + +func (o PayloadSignature) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o PayloadSignature) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["payload_signature_id"] = o.PayloadSignatureId + toSerialize["wallet_id"] = o.WalletId + toSerialize["address_id"] = o.AddressId + toSerialize["unsigned_payload"] = o.UnsignedPayload + if !IsNil(o.Signature) { + toSerialize["signature"] = o.Signature + } + toSerialize["status"] = o.Status + return toSerialize, nil +} + +func (o *PayloadSignature) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "payload_signature_id", + "wallet_id", + "address_id", + "unsigned_payload", + "status", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varPayloadSignature := _PayloadSignature{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varPayloadSignature) + + if err != nil { + return err + } + + *o = PayloadSignature(varPayloadSignature) + + return err +} + +type NullablePayloadSignature struct { + value *PayloadSignature + isSet bool +} + +func (v NullablePayloadSignature) Get() *PayloadSignature { + return v.value +} + +func (v *NullablePayloadSignature) Set(val *PayloadSignature) { + v.value = val + v.isSet = true +} + +func (v NullablePayloadSignature) IsSet() bool { + return v.isSet +} + +func (v *NullablePayloadSignature) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePayloadSignature(val *PayloadSignature) *NullablePayloadSignature { + return &NullablePayloadSignature{value: val, isSet: true} +} + +func (v NullablePayloadSignature) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePayloadSignature) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/gen/client/model_payload_signature_list.go b/gen/client/model_payload_signature_list.go new file mode 100644 index 0000000..bde6181 --- /dev/null +++ b/gen/client/model_payload_signature_list.go @@ -0,0 +1,245 @@ +/* +Coinbase Platform API + +This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +API version: 0.0.1-alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "bytes" + "fmt" +) + +// checks if the PayloadSignatureList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PayloadSignatureList{} + +// PayloadSignatureList +type PayloadSignatureList struct { + Data []PayloadSignature `json:"data"` + // True if this list has another page of items after this one that can be fetched. + HasMore bool `json:"has_more"` + // The page token to be used to fetch the next page. + NextPage string `json:"next_page"` + // The total number of payload signatures for the address. + TotalCount int32 `json:"total_count"` +} + +type _PayloadSignatureList PayloadSignatureList + +// NewPayloadSignatureList instantiates a new PayloadSignatureList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPayloadSignatureList(data []PayloadSignature, hasMore bool, nextPage string, totalCount int32) *PayloadSignatureList { + this := PayloadSignatureList{} + this.Data = data + this.HasMore = hasMore + this.NextPage = nextPage + this.TotalCount = totalCount + return &this +} + +// NewPayloadSignatureListWithDefaults instantiates a new PayloadSignatureList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPayloadSignatureListWithDefaults() *PayloadSignatureList { + this := PayloadSignatureList{} + return &this +} + +// GetData returns the Data field value +func (o *PayloadSignatureList) GetData() []PayloadSignature { + if o == nil { + var ret []PayloadSignature + return ret + } + + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *PayloadSignatureList) GetDataOk() ([]PayloadSignature, bool) { + if o == nil { + return nil, false + } + return o.Data, true +} + +// SetData sets field value +func (o *PayloadSignatureList) SetData(v []PayloadSignature) { + o.Data = v +} + +// GetHasMore returns the HasMore field value +func (o *PayloadSignatureList) GetHasMore() bool { + if o == nil { + var ret bool + return ret + } + + return o.HasMore +} + +// GetHasMoreOk returns a tuple with the HasMore field value +// and a boolean to check if the value has been set. +func (o *PayloadSignatureList) GetHasMoreOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.HasMore, true +} + +// SetHasMore sets field value +func (o *PayloadSignatureList) SetHasMore(v bool) { + o.HasMore = v +} + +// GetNextPage returns the NextPage field value +func (o *PayloadSignatureList) GetNextPage() string { + if o == nil { + var ret string + return ret + } + + return o.NextPage +} + +// GetNextPageOk returns a tuple with the NextPage field value +// and a boolean to check if the value has been set. +func (o *PayloadSignatureList) GetNextPageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.NextPage, true +} + +// SetNextPage sets field value +func (o *PayloadSignatureList) SetNextPage(v string) { + o.NextPage = v +} + +// GetTotalCount returns the TotalCount field value +func (o *PayloadSignatureList) GetTotalCount() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.TotalCount +} + +// GetTotalCountOk returns a tuple with the TotalCount field value +// and a boolean to check if the value has been set. +func (o *PayloadSignatureList) GetTotalCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.TotalCount, true +} + +// SetTotalCount sets field value +func (o *PayloadSignatureList) SetTotalCount(v int32) { + o.TotalCount = v +} + +func (o PayloadSignatureList) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o PayloadSignatureList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["data"] = o.Data + toSerialize["has_more"] = o.HasMore + toSerialize["next_page"] = o.NextPage + toSerialize["total_count"] = o.TotalCount + return toSerialize, nil +} + +func (o *PayloadSignatureList) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "data", + "has_more", + "next_page", + "total_count", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varPayloadSignatureList := _PayloadSignatureList{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varPayloadSignatureList) + + if err != nil { + return err + } + + *o = PayloadSignatureList(varPayloadSignatureList) + + return err +} + +type NullablePayloadSignatureList struct { + value *PayloadSignatureList + isSet bool +} + +func (v NullablePayloadSignatureList) Get() *PayloadSignatureList { + return v.value +} + +func (v *NullablePayloadSignatureList) Set(val *PayloadSignatureList) { + v.value = val + v.isSet = true +} + +func (v NullablePayloadSignatureList) IsSet() bool { + return v.isSet +} + +func (v *NullablePayloadSignatureList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePayloadSignatureList(val *PayloadSignatureList) *NullablePayloadSignatureList { + return &NullablePayloadSignatureList{value: val, isSet: true} +} + +func (v NullablePayloadSignatureList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePayloadSignatureList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/gen/client/model_smart_contract.go b/gen/client/model_smart_contract.go new file mode 100644 index 0000000..da8059f --- /dev/null +++ b/gen/client/model_smart_contract.go @@ -0,0 +1,388 @@ +/* +Coinbase Platform API + +This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +API version: 0.0.1-alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "bytes" + "fmt" +) + +// checks if the SmartContract type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SmartContract{} + +// SmartContract Represents a smart contract on the blockchain +type SmartContract struct { + // The unique identifier of the smart contract + SmartContractId string `json:"smart_contract_id"` + // The name of the blockchain network + NetworkId string `json:"network_id"` + // The ID of the wallet that deployed the smart contract + WalletId string `json:"wallet_id"` + // The EVM address of the smart contract + ContractAddress string `json:"contract_address"` + // The EVM address of the account that deployed the smart contract + DeployerAddress string `json:"deployer_address"` + Type SmartContractType `json:"type"` + Options SmartContractOptions `json:"options"` + // The JSON-encoded ABI of the contract + Abi string `json:"abi"` + Transaction Transaction `json:"transaction"` +} + +type _SmartContract SmartContract + +// NewSmartContract instantiates a new SmartContract object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSmartContract(smartContractId string, networkId string, walletId string, contractAddress string, deployerAddress string, type_ SmartContractType, options SmartContractOptions, abi string, transaction Transaction) *SmartContract { + this := SmartContract{} + this.SmartContractId = smartContractId + this.NetworkId = networkId + this.WalletId = walletId + this.ContractAddress = contractAddress + this.DeployerAddress = deployerAddress + this.Type = type_ + this.Options = options + this.Abi = abi + this.Transaction = transaction + return &this +} + +// NewSmartContractWithDefaults instantiates a new SmartContract object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSmartContractWithDefaults() *SmartContract { + this := SmartContract{} + return &this +} + +// GetSmartContractId returns the SmartContractId field value +func (o *SmartContract) GetSmartContractId() string { + if o == nil { + var ret string + return ret + } + + return o.SmartContractId +} + +// GetSmartContractIdOk returns a tuple with the SmartContractId field value +// and a boolean to check if the value has been set. +func (o *SmartContract) GetSmartContractIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.SmartContractId, true +} + +// SetSmartContractId sets field value +func (o *SmartContract) SetSmartContractId(v string) { + o.SmartContractId = v +} + +// GetNetworkId returns the NetworkId field value +func (o *SmartContract) GetNetworkId() string { + if o == nil { + var ret string + return ret + } + + return o.NetworkId +} + +// GetNetworkIdOk returns a tuple with the NetworkId field value +// and a boolean to check if the value has been set. +func (o *SmartContract) GetNetworkIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.NetworkId, true +} + +// SetNetworkId sets field value +func (o *SmartContract) SetNetworkId(v string) { + o.NetworkId = v +} + +// GetWalletId returns the WalletId field value +func (o *SmartContract) GetWalletId() string { + if o == nil { + var ret string + return ret + } + + return o.WalletId +} + +// GetWalletIdOk returns a tuple with the WalletId field value +// and a boolean to check if the value has been set. +func (o *SmartContract) GetWalletIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.WalletId, true +} + +// SetWalletId sets field value +func (o *SmartContract) SetWalletId(v string) { + o.WalletId = v +} + +// GetContractAddress returns the ContractAddress field value +func (o *SmartContract) GetContractAddress() string { + if o == nil { + var ret string + return ret + } + + return o.ContractAddress +} + +// GetContractAddressOk returns a tuple with the ContractAddress field value +// and a boolean to check if the value has been set. +func (o *SmartContract) GetContractAddressOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ContractAddress, true +} + +// SetContractAddress sets field value +func (o *SmartContract) SetContractAddress(v string) { + o.ContractAddress = v +} + +// GetDeployerAddress returns the DeployerAddress field value +func (o *SmartContract) GetDeployerAddress() string { + if o == nil { + var ret string + return ret + } + + return o.DeployerAddress +} + +// GetDeployerAddressOk returns a tuple with the DeployerAddress field value +// and a boolean to check if the value has been set. +func (o *SmartContract) GetDeployerAddressOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DeployerAddress, true +} + +// SetDeployerAddress sets field value +func (o *SmartContract) SetDeployerAddress(v string) { + o.DeployerAddress = v +} + +// GetType returns the Type field value +func (o *SmartContract) GetType() SmartContractType { + if o == nil { + var ret SmartContractType + return ret + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *SmartContract) GetTypeOk() (*SmartContractType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value +func (o *SmartContract) SetType(v SmartContractType) { + o.Type = v +} + +// GetOptions returns the Options field value +func (o *SmartContract) GetOptions() SmartContractOptions { + if o == nil { + var ret SmartContractOptions + return ret + } + + return o.Options +} + +// GetOptionsOk returns a tuple with the Options field value +// and a boolean to check if the value has been set. +func (o *SmartContract) GetOptionsOk() (*SmartContractOptions, bool) { + if o == nil { + return nil, false + } + return &o.Options, true +} + +// SetOptions sets field value +func (o *SmartContract) SetOptions(v SmartContractOptions) { + o.Options = v +} + +// GetAbi returns the Abi field value +func (o *SmartContract) GetAbi() string { + if o == nil { + var ret string + return ret + } + + return o.Abi +} + +// GetAbiOk returns a tuple with the Abi field value +// and a boolean to check if the value has been set. +func (o *SmartContract) GetAbiOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Abi, true +} + +// SetAbi sets field value +func (o *SmartContract) SetAbi(v string) { + o.Abi = v +} + +// GetTransaction returns the Transaction field value +func (o *SmartContract) GetTransaction() Transaction { + if o == nil { + var ret Transaction + return ret + } + + return o.Transaction +} + +// GetTransactionOk returns a tuple with the Transaction field value +// and a boolean to check if the value has been set. +func (o *SmartContract) GetTransactionOk() (*Transaction, bool) { + if o == nil { + return nil, false + } + return &o.Transaction, true +} + +// SetTransaction sets field value +func (o *SmartContract) SetTransaction(v Transaction) { + o.Transaction = v +} + +func (o SmartContract) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SmartContract) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["smart_contract_id"] = o.SmartContractId + toSerialize["network_id"] = o.NetworkId + toSerialize["wallet_id"] = o.WalletId + toSerialize["contract_address"] = o.ContractAddress + toSerialize["deployer_address"] = o.DeployerAddress + toSerialize["type"] = o.Type + toSerialize["options"] = o.Options + toSerialize["abi"] = o.Abi + toSerialize["transaction"] = o.Transaction + return toSerialize, nil +} + +func (o *SmartContract) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "smart_contract_id", + "network_id", + "wallet_id", + "contract_address", + "deployer_address", + "type", + "options", + "abi", + "transaction", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varSmartContract := _SmartContract{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varSmartContract) + + if err != nil { + return err + } + + *o = SmartContract(varSmartContract) + + return err +} + +type NullableSmartContract struct { + value *SmartContract + isSet bool +} + +func (v NullableSmartContract) Get() *SmartContract { + return v.value +} + +func (v *NullableSmartContract) Set(val *SmartContract) { + v.value = val + v.isSet = true +} + +func (v NullableSmartContract) IsSet() bool { + return v.isSet +} + +func (v *NullableSmartContract) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSmartContract(val *SmartContract) *NullableSmartContract { + return &NullableSmartContract{value: val, isSet: true} +} + +func (v NullableSmartContract) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSmartContract) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/gen/client/model_smart_contract_list.go b/gen/client/model_smart_contract_list.go new file mode 100644 index 0000000..27788de --- /dev/null +++ b/gen/client/model_smart_contract_list.go @@ -0,0 +1,216 @@ +/* +Coinbase Platform API + +This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +API version: 0.0.1-alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "bytes" + "fmt" +) + +// checks if the SmartContractList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SmartContractList{} + +// SmartContractList struct for SmartContractList +type SmartContractList struct { + Data []SmartContract `json:"data"` + // True if this list has another page of items after this one that can be fetched. + HasMore bool `json:"has_more"` + // The page token to be used to fetch the next page. + NextPage string `json:"next_page"` +} + +type _SmartContractList SmartContractList + +// NewSmartContractList instantiates a new SmartContractList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSmartContractList(data []SmartContract, hasMore bool, nextPage string) *SmartContractList { + this := SmartContractList{} + this.Data = data + this.HasMore = hasMore + this.NextPage = nextPage + return &this +} + +// NewSmartContractListWithDefaults instantiates a new SmartContractList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSmartContractListWithDefaults() *SmartContractList { + this := SmartContractList{} + return &this +} + +// GetData returns the Data field value +func (o *SmartContractList) GetData() []SmartContract { + if o == nil { + var ret []SmartContract + return ret + } + + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *SmartContractList) GetDataOk() ([]SmartContract, bool) { + if o == nil { + return nil, false + } + return o.Data, true +} + +// SetData sets field value +func (o *SmartContractList) SetData(v []SmartContract) { + o.Data = v +} + +// GetHasMore returns the HasMore field value +func (o *SmartContractList) GetHasMore() bool { + if o == nil { + var ret bool + return ret + } + + return o.HasMore +} + +// GetHasMoreOk returns a tuple with the HasMore field value +// and a boolean to check if the value has been set. +func (o *SmartContractList) GetHasMoreOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.HasMore, true +} + +// SetHasMore sets field value +func (o *SmartContractList) SetHasMore(v bool) { + o.HasMore = v +} + +// GetNextPage returns the NextPage field value +func (o *SmartContractList) GetNextPage() string { + if o == nil { + var ret string + return ret + } + + return o.NextPage +} + +// GetNextPageOk returns a tuple with the NextPage field value +// and a boolean to check if the value has been set. +func (o *SmartContractList) GetNextPageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.NextPage, true +} + +// SetNextPage sets field value +func (o *SmartContractList) SetNextPage(v string) { + o.NextPage = v +} + +func (o SmartContractList) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SmartContractList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["data"] = o.Data + toSerialize["has_more"] = o.HasMore + toSerialize["next_page"] = o.NextPage + return toSerialize, nil +} + +func (o *SmartContractList) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "data", + "has_more", + "next_page", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varSmartContractList := _SmartContractList{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varSmartContractList) + + if err != nil { + return err + } + + *o = SmartContractList(varSmartContractList) + + return err +} + +type NullableSmartContractList struct { + value *SmartContractList + isSet bool +} + +func (v NullableSmartContractList) Get() *SmartContractList { + return v.value +} + +func (v *NullableSmartContractList) Set(val *SmartContractList) { + v.value = val + v.isSet = true +} + +func (v NullableSmartContractList) IsSet() bool { + return v.isSet +} + +func (v *NullableSmartContractList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSmartContractList(val *SmartContractList) *NullableSmartContractList { + return &NullableSmartContractList{value: val, isSet: true} +} + +func (v NullableSmartContractList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSmartContractList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/gen/client/model_smart_contract_options.go b/gen/client/model_smart_contract_options.go new file mode 100644 index 0000000..83bd860 --- /dev/null +++ b/gen/client/model_smart_contract_options.go @@ -0,0 +1,157 @@ +/* +Coinbase Platform API + +This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +API version: 0.0.1-alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "gopkg.in/validator.v2" + "fmt" +) + +// SmartContractOptions - Options for smart contract creation +type SmartContractOptions struct { + NFTContractOptions *NFTContractOptions + TokenContractOptions *TokenContractOptions +} + +// NFTContractOptionsAsSmartContractOptions is a convenience function that returns NFTContractOptions wrapped in SmartContractOptions +func NFTContractOptionsAsSmartContractOptions(v *NFTContractOptions) SmartContractOptions { + return SmartContractOptions{ + NFTContractOptions: v, + } +} + +// TokenContractOptionsAsSmartContractOptions is a convenience function that returns TokenContractOptions wrapped in SmartContractOptions +func TokenContractOptionsAsSmartContractOptions(v *TokenContractOptions) SmartContractOptions { + return SmartContractOptions{ + TokenContractOptions: v, + } +} + + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *SmartContractOptions) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into NFTContractOptions + err = newStrictDecoder(data).Decode(&dst.NFTContractOptions) + if err == nil { + jsonNFTContractOptions, _ := json.Marshal(dst.NFTContractOptions) + if string(jsonNFTContractOptions) == "{}" { // empty struct + dst.NFTContractOptions = nil + } else { + if err = validator.Validate(dst.NFTContractOptions); err != nil { + dst.NFTContractOptions = nil + } else { + match++ + } + } + } else { + dst.NFTContractOptions = nil + } + + // try to unmarshal data into TokenContractOptions + err = newStrictDecoder(data).Decode(&dst.TokenContractOptions) + if err == nil { + jsonTokenContractOptions, _ := json.Marshal(dst.TokenContractOptions) + if string(jsonTokenContractOptions) == "{}" { // empty struct + dst.TokenContractOptions = nil + } else { + if err = validator.Validate(dst.TokenContractOptions); err != nil { + dst.TokenContractOptions = nil + } else { + match++ + } + } + } else { + dst.TokenContractOptions = nil + } + + if match > 1 { // more than 1 match + // reset to nil + dst.NFTContractOptions = nil + dst.TokenContractOptions = nil + + return fmt.Errorf("data matches more than one schema in oneOf(SmartContractOptions)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return fmt.Errorf("data failed to match schemas in oneOf(SmartContractOptions)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src SmartContractOptions) MarshalJSON() ([]byte, error) { + if src.NFTContractOptions != nil { + return json.Marshal(&src.NFTContractOptions) + } + + if src.TokenContractOptions != nil { + return json.Marshal(&src.TokenContractOptions) + } + + return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *SmartContractOptions) GetActualInstance() (interface{}) { + if obj == nil { + return nil + } + if obj.NFTContractOptions != nil { + return obj.NFTContractOptions + } + + if obj.TokenContractOptions != nil { + return obj.TokenContractOptions + } + + // all schemas are nil + return nil +} + +type NullableSmartContractOptions struct { + value *SmartContractOptions + isSet bool +} + +func (v NullableSmartContractOptions) Get() *SmartContractOptions { + return v.value +} + +func (v *NullableSmartContractOptions) Set(val *SmartContractOptions) { + v.value = val + v.isSet = true +} + +func (v NullableSmartContractOptions) IsSet() bool { + return v.isSet +} + +func (v *NullableSmartContractOptions) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSmartContractOptions(val *SmartContractOptions) *NullableSmartContractOptions { + return &NullableSmartContractOptions{value: val, isSet: true} +} + +func (v NullableSmartContractOptions) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSmartContractOptions) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/gen/client/model_smart_contract_type.go b/gen/client/model_smart_contract_type.go new file mode 100644 index 0000000..c4c8bed --- /dev/null +++ b/gen/client/model_smart_contract_type.go @@ -0,0 +1,111 @@ +/* +Coinbase Platform API + +This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +API version: 0.0.1-alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "fmt" +) + +// SmartContractType The type of the smart contract +type SmartContractType string + +// List of SmartContractType +const ( + SMARTCONTRACTTYPE_ERC20 SmartContractType = "erc20" + SMARTCONTRACTTYPE_ERC721 SmartContractType = "erc721" +) + +// All allowed values of SmartContractType enum +var AllowedSmartContractTypeEnumValues = []SmartContractType{ + "erc20", + "erc721", +} + +func (v *SmartContractType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := SmartContractType(value) + for _, existing := range AllowedSmartContractTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid SmartContractType", value) +} + +// NewSmartContractTypeFromValue returns a pointer to a valid SmartContractType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewSmartContractTypeFromValue(v string) (*SmartContractType, error) { + ev := SmartContractType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for SmartContractType: valid values are %v", v, AllowedSmartContractTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v SmartContractType) IsValid() bool { + for _, existing := range AllowedSmartContractTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SmartContractType value +func (v SmartContractType) Ptr() *SmartContractType { + return &v +} + +type NullableSmartContractType struct { + value *SmartContractType + isSet bool +} + +func (v NullableSmartContractType) Get() *SmartContractType { + return v.value +} + +func (v *NullableSmartContractType) Set(val *SmartContractType) { + v.value = val + v.isSet = true +} + +func (v NullableSmartContractType) IsSet() bool { + return v.isSet +} + +func (v *NullableSmartContractType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSmartContractType(val *SmartContractType) *NullableSmartContractType { + return &NullableSmartContractType{value: val, isSet: true} +} + +func (v NullableSmartContractType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSmartContractType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + diff --git a/gen/client/model_staking_balance.go b/gen/client/model_staking_balance.go index 693ca7c..0f07dd0 100644 --- a/gen/client/model_staking_balance.go +++ b/gen/client/model_staking_balance.go @@ -12,6 +12,7 @@ package client import ( "encoding/json" + "time" "bytes" "fmt" ) @@ -23,8 +24,8 @@ var _ MappedNullable = &StakingBalance{} type StakingBalance struct { // The onchain address for which the staking balances are being fetched. Address string `json:"address"` - // The date of the staking balance in format 'YYYY-MM-DD' in UTC. - Date string `json:"date"` + // The timestamp of the staking balance in UTC. + Date time.Time `json:"date"` BondedStake Balance `json:"bonded_stake"` UnbondedBalance Balance `json:"unbonded_balance"` // The type of staking participation. @@ -37,7 +38,7 @@ type _StakingBalance StakingBalance // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewStakingBalance(address string, date string, bondedStake Balance, unbondedBalance Balance, participantType string) *StakingBalance { +func NewStakingBalance(address string, date time.Time, bondedStake Balance, unbondedBalance Balance, participantType string) *StakingBalance { this := StakingBalance{} this.Address = address this.Date = date @@ -80,9 +81,9 @@ func (o *StakingBalance) SetAddress(v string) { } // GetDate returns the Date field value -func (o *StakingBalance) GetDate() string { +func (o *StakingBalance) GetDate() time.Time { if o == nil { - var ret string + var ret time.Time return ret } @@ -91,7 +92,7 @@ func (o *StakingBalance) GetDate() string { // GetDateOk returns a tuple with the Date field value // and a boolean to check if the value has been set. -func (o *StakingBalance) GetDateOk() (*string, bool) { +func (o *StakingBalance) GetDateOk() (*time.Time, bool) { if o == nil { return nil, false } @@ -99,7 +100,7 @@ func (o *StakingBalance) GetDateOk() (*string, bool) { } // SetDate sets field value -func (o *StakingBalance) SetDate(v string) { +func (o *StakingBalance) SetDate(v time.Time) { o.Date = v } diff --git a/gen/client/model_staking_reward.go b/gen/client/model_staking_reward.go index fd603f1..32a70bf 100644 --- a/gen/client/model_staking_reward.go +++ b/gen/client/model_staking_reward.go @@ -12,6 +12,7 @@ package client import ( "encoding/json" + "time" "bytes" "fmt" ) @@ -23,8 +24,8 @@ var _ MappedNullable = &StakingReward{} type StakingReward struct { // The onchain address for which the staking rewards are being fetched. AddressId string `json:"address_id"` - // The date of the reward in format 'YYYY-MM-DD' in UTC. - Date string `json:"date"` + // The timestamp of the reward in UTC. + Date time.Time `json:"date"` // The reward amount in requested \"format\". Default is USD. Amount string `json:"amount"` // The state of the reward. @@ -39,7 +40,7 @@ type _StakingReward StakingReward // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewStakingReward(addressId string, date string, amount string, state string, format StakingRewardFormat, usdValue StakingRewardUSDValue) *StakingReward { +func NewStakingReward(addressId string, date time.Time, amount string, state string, format StakingRewardFormat, usdValue StakingRewardUSDValue) *StakingReward { this := StakingReward{} this.AddressId = addressId this.Date = date @@ -85,9 +86,9 @@ func (o *StakingReward) SetAddressId(v string) { } // GetDate returns the Date field value -func (o *StakingReward) GetDate() string { +func (o *StakingReward) GetDate() time.Time { if o == nil { - var ret string + var ret time.Time return ret } @@ -96,7 +97,7 @@ func (o *StakingReward) GetDate() string { // GetDateOk returns a tuple with the Date field value // and a boolean to check if the value has been set. -func (o *StakingReward) GetDateOk() (*string, bool) { +func (o *StakingReward) GetDateOk() (*time.Time, bool) { if o == nil { return nil, false } @@ -104,7 +105,7 @@ func (o *StakingReward) GetDateOk() (*string, bool) { } // SetDate sets field value -func (o *StakingReward) SetDate(v string) { +func (o *StakingReward) SetDate(v time.Time) { o.Date = v } diff --git a/gen/client/model_token_contract_options.go b/gen/client/model_token_contract_options.go new file mode 100644 index 0000000..5e52a15 --- /dev/null +++ b/gen/client/model_token_contract_options.go @@ -0,0 +1,217 @@ +/* +Coinbase Platform API + +This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +API version: 0.0.1-alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "bytes" + "fmt" +) + +// checks if the TokenContractOptions type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TokenContractOptions{} + +// TokenContractOptions Options for token contract creation +type TokenContractOptions struct { + // The name of the token + Name string `json:"name"` + // The symbol of the token + Symbol string `json:"symbol"` + // The total supply of the token denominated in the whole amount of the token. + TotalSupply string `json:"total_supply"` +} + +type _TokenContractOptions TokenContractOptions + +// NewTokenContractOptions instantiates a new TokenContractOptions object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewTokenContractOptions(name string, symbol string, totalSupply string) *TokenContractOptions { + this := TokenContractOptions{} + this.Name = name + this.Symbol = symbol + this.TotalSupply = totalSupply + return &this +} + +// NewTokenContractOptionsWithDefaults instantiates a new TokenContractOptions object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTokenContractOptionsWithDefaults() *TokenContractOptions { + this := TokenContractOptions{} + return &this +} + +// GetName returns the Name field value +func (o *TokenContractOptions) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *TokenContractOptions) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *TokenContractOptions) SetName(v string) { + o.Name = v +} + +// GetSymbol returns the Symbol field value +func (o *TokenContractOptions) GetSymbol() string { + if o == nil { + var ret string + return ret + } + + return o.Symbol +} + +// GetSymbolOk returns a tuple with the Symbol field value +// and a boolean to check if the value has been set. +func (o *TokenContractOptions) GetSymbolOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Symbol, true +} + +// SetSymbol sets field value +func (o *TokenContractOptions) SetSymbol(v string) { + o.Symbol = v +} + +// GetTotalSupply returns the TotalSupply field value +func (o *TokenContractOptions) GetTotalSupply() string { + if o == nil { + var ret string + return ret + } + + return o.TotalSupply +} + +// GetTotalSupplyOk returns a tuple with the TotalSupply field value +// and a boolean to check if the value has been set. +func (o *TokenContractOptions) GetTotalSupplyOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.TotalSupply, true +} + +// SetTotalSupply sets field value +func (o *TokenContractOptions) SetTotalSupply(v string) { + o.TotalSupply = v +} + +func (o TokenContractOptions) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TokenContractOptions) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + toSerialize["symbol"] = o.Symbol + toSerialize["total_supply"] = o.TotalSupply + return toSerialize, nil +} + +func (o *TokenContractOptions) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "name", + "symbol", + "total_supply", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varTokenContractOptions := _TokenContractOptions{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varTokenContractOptions) + + if err != nil { + return err + } + + *o = TokenContractOptions(varTokenContractOptions) + + return err +} + +type NullableTokenContractOptions struct { + value *TokenContractOptions + isSet bool +} + +func (v NullableTokenContractOptions) Get() *TokenContractOptions { + return v.value +} + +func (v *NullableTokenContractOptions) Set(val *TokenContractOptions) { + v.value = val + v.isSet = true +} + +func (v NullableTokenContractOptions) IsSet() bool { + return v.isSet +} + +func (v *NullableTokenContractOptions) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTokenContractOptions(val *TokenContractOptions) *NullableTokenContractOptions { + return &NullableTokenContractOptions{value: val, isSet: true} +} + +func (v NullableTokenContractOptions) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTokenContractOptions) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/gen/client/model_transaction.go b/gen/client/model_transaction.go index 7a0d23c..eba3bc6 100644 --- a/gen/client/model_transaction.go +++ b/gen/client/model_transaction.go @@ -23,6 +23,10 @@ var _ MappedNullable = &Transaction{} type Transaction struct { // The ID of the blockchain network. NetworkId string `json:"network_id"` + // The hash of the block at which the transaction was recorded. + BlockHash *string `json:"block_hash,omitempty"` + // The block height at which the transaction was recorded. + BlockHeight *string `json:"block_height,omitempty"` // The onchain address of the sender. FromAddressId string `json:"from_address_id"` // The onchain address of the recipient. @@ -37,6 +41,7 @@ type Transaction struct { TransactionLink *string `json:"transaction_link,omitempty"` // The status of the transaction. Status string `json:"status"` + Content *TransactionContent `json:"content,omitempty"` } type _Transaction Transaction @@ -86,6 +91,70 @@ func (o *Transaction) SetNetworkId(v string) { o.NetworkId = v } +// GetBlockHash returns the BlockHash field value if set, zero value otherwise. +func (o *Transaction) GetBlockHash() string { + if o == nil || IsNil(o.BlockHash) { + var ret string + return ret + } + return *o.BlockHash +} + +// GetBlockHashOk returns a tuple with the BlockHash field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Transaction) GetBlockHashOk() (*string, bool) { + if o == nil || IsNil(o.BlockHash) { + return nil, false + } + return o.BlockHash, true +} + +// HasBlockHash returns a boolean if a field has been set. +func (o *Transaction) HasBlockHash() bool { + if o != nil && !IsNil(o.BlockHash) { + return true + } + + return false +} + +// SetBlockHash gets a reference to the given string and assigns it to the BlockHash field. +func (o *Transaction) SetBlockHash(v string) { + o.BlockHash = &v +} + +// GetBlockHeight returns the BlockHeight field value if set, zero value otherwise. +func (o *Transaction) GetBlockHeight() string { + if o == nil || IsNil(o.BlockHeight) { + var ret string + return ret + } + return *o.BlockHeight +} + +// GetBlockHeightOk returns a tuple with the BlockHeight field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Transaction) GetBlockHeightOk() (*string, bool) { + if o == nil || IsNil(o.BlockHeight) { + return nil, false + } + return o.BlockHeight, true +} + +// HasBlockHeight returns a boolean if a field has been set. +func (o *Transaction) HasBlockHeight() bool { + if o != nil && !IsNil(o.BlockHeight) { + return true + } + + return false +} + +// SetBlockHeight gets a reference to the given string and assigns it to the BlockHeight field. +func (o *Transaction) SetBlockHeight(v string) { + o.BlockHeight = &v +} + // GetFromAddressId returns the FromAddressId field value func (o *Transaction) GetFromAddressId() string { if o == nil { @@ -286,6 +355,38 @@ func (o *Transaction) SetStatus(v string) { o.Status = v } +// GetContent returns the Content field value if set, zero value otherwise. +func (o *Transaction) GetContent() TransactionContent { + if o == nil || IsNil(o.Content) { + var ret TransactionContent + return ret + } + return *o.Content +} + +// GetContentOk returns a tuple with the Content field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Transaction) GetContentOk() (*TransactionContent, bool) { + if o == nil || IsNil(o.Content) { + return nil, false + } + return o.Content, true +} + +// HasContent returns a boolean if a field has been set. +func (o *Transaction) HasContent() bool { + if o != nil && !IsNil(o.Content) { + return true + } + + return false +} + +// SetContent gets a reference to the given TransactionContent and assigns it to the Content field. +func (o *Transaction) SetContent(v TransactionContent) { + o.Content = &v +} + func (o Transaction) MarshalJSON() ([]byte, error) { toSerialize,err := o.ToMap() if err != nil { @@ -297,6 +398,12 @@ func (o Transaction) MarshalJSON() ([]byte, error) { func (o Transaction) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} toSerialize["network_id"] = o.NetworkId + if !IsNil(o.BlockHash) { + toSerialize["block_hash"] = o.BlockHash + } + if !IsNil(o.BlockHeight) { + toSerialize["block_height"] = o.BlockHeight + } toSerialize["from_address_id"] = o.FromAddressId if !IsNil(o.ToAddressId) { toSerialize["to_address_id"] = o.ToAddressId @@ -312,6 +419,9 @@ func (o Transaction) ToMap() (map[string]interface{}, error) { toSerialize["transaction_link"] = o.TransactionLink } toSerialize["status"] = o.Status + if !IsNil(o.Content) { + toSerialize["content"] = o.Content + } return toSerialize, nil } diff --git a/gen/client/model_transaction_content.go b/gen/client/model_transaction_content.go new file mode 100644 index 0000000..bbe8d2b --- /dev/null +++ b/gen/client/model_transaction_content.go @@ -0,0 +1,123 @@ +/* +Coinbase Platform API + +This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +API version: 0.0.1-alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "gopkg.in/validator.v2" + "fmt" +) + +// TransactionContent - struct for TransactionContent +type TransactionContent struct { + EthereumTransaction *EthereumTransaction +} + +// EthereumTransactionAsTransactionContent is a convenience function that returns EthereumTransaction wrapped in TransactionContent +func EthereumTransactionAsTransactionContent(v *EthereumTransaction) TransactionContent { + return TransactionContent{ + EthereumTransaction: v, + } +} + + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *TransactionContent) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into EthereumTransaction + err = newStrictDecoder(data).Decode(&dst.EthereumTransaction) + if err == nil { + jsonEthereumTransaction, _ := json.Marshal(dst.EthereumTransaction) + if string(jsonEthereumTransaction) == "{}" { // empty struct + dst.EthereumTransaction = nil + } else { + if err = validator.Validate(dst.EthereumTransaction); err != nil { + dst.EthereumTransaction = nil + } else { + match++ + } + } + } else { + dst.EthereumTransaction = nil + } + + if match > 1 { // more than 1 match + // reset to nil + dst.EthereumTransaction = nil + + return fmt.Errorf("data matches more than one schema in oneOf(TransactionContent)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return fmt.Errorf("data failed to match schemas in oneOf(TransactionContent)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src TransactionContent) MarshalJSON() ([]byte, error) { + if src.EthereumTransaction != nil { + return json.Marshal(&src.EthereumTransaction) + } + + return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *TransactionContent) GetActualInstance() (interface{}) { + if obj == nil { + return nil + } + if obj.EthereumTransaction != nil { + return obj.EthereumTransaction + } + + // all schemas are nil + return nil +} + +type NullableTransactionContent struct { + value *TransactionContent + isSet bool +} + +func (v NullableTransactionContent) Get() *TransactionContent { + return v.value +} + +func (v *NullableTransactionContent) Set(val *TransactionContent) { + v.value = val + v.isSet = true +} + +func (v NullableTransactionContent) IsSet() bool { + return v.isSet +} + +func (v *NullableTransactionContent) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTransactionContent(val *TransactionContent) *NullableTransactionContent { + return &NullableTransactionContent{value: val, isSet: true} +} + +func (v NullableTransactionContent) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTransactionContent) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/gen/client/model_update_webhook_request.go b/gen/client/model_update_webhook_request.go index c79f3d4..85c98de 100644 --- a/gen/client/model_update_webhook_request.go +++ b/gen/client/model_update_webhook_request.go @@ -21,11 +21,9 @@ var _ MappedNullable = &UpdateWebhookRequest{} // UpdateWebhookRequest struct for UpdateWebhookRequest type UpdateWebhookRequest struct { - // The ID of the blockchain network - NetworkId *string `json:"network_id,omitempty"` - EventType WebhookEventType `json:"event_type"` + EventTypeFilter *WebhookEventTypeFilter `json:"event_type_filter,omitempty"` // Webhook will monitor all events that matches any one of the event filters. - EventFilters []WebhookEventFilter `json:"event_filters"` + EventFilters []WebhookEventFilter `json:"event_filters,omitempty"` // The Webhook uri that updates to NotificationUri string `json:"notification_uri"` } @@ -36,10 +34,8 @@ type _UpdateWebhookRequest UpdateWebhookRequest // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewUpdateWebhookRequest(eventType WebhookEventType, eventFilters []WebhookEventFilter, notificationUri string) *UpdateWebhookRequest { +func NewUpdateWebhookRequest(notificationUri string) *UpdateWebhookRequest { this := UpdateWebhookRequest{} - this.EventType = eventType - this.EventFilters = eventFilters this.NotificationUri = notificationUri return &this } @@ -52,82 +48,66 @@ func NewUpdateWebhookRequestWithDefaults() *UpdateWebhookRequest { return &this } -// GetNetworkId returns the NetworkId field value if set, zero value otherwise. -func (o *UpdateWebhookRequest) GetNetworkId() string { - if o == nil || IsNil(o.NetworkId) { - var ret string +// GetEventTypeFilter returns the EventTypeFilter field value if set, zero value otherwise. +func (o *UpdateWebhookRequest) GetEventTypeFilter() WebhookEventTypeFilter { + if o == nil || IsNil(o.EventTypeFilter) { + var ret WebhookEventTypeFilter return ret } - return *o.NetworkId + return *o.EventTypeFilter } -// GetNetworkIdOk returns a tuple with the NetworkId field value if set, nil otherwise +// GetEventTypeFilterOk returns a tuple with the EventTypeFilter field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *UpdateWebhookRequest) GetNetworkIdOk() (*string, bool) { - if o == nil || IsNil(o.NetworkId) { +func (o *UpdateWebhookRequest) GetEventTypeFilterOk() (*WebhookEventTypeFilter, bool) { + if o == nil || IsNil(o.EventTypeFilter) { return nil, false } - return o.NetworkId, true + return o.EventTypeFilter, true } -// HasNetworkId returns a boolean if a field has been set. -func (o *UpdateWebhookRequest) HasNetworkId() bool { - if o != nil && !IsNil(o.NetworkId) { +// HasEventTypeFilter returns a boolean if a field has been set. +func (o *UpdateWebhookRequest) HasEventTypeFilter() bool { + if o != nil && !IsNil(o.EventTypeFilter) { return true } return false } -// SetNetworkId gets a reference to the given string and assigns it to the NetworkId field. -func (o *UpdateWebhookRequest) SetNetworkId(v string) { - o.NetworkId = &v -} - -// GetEventType returns the EventType field value -func (o *UpdateWebhookRequest) GetEventType() WebhookEventType { - if o == nil { - var ret WebhookEventType - return ret - } - - return o.EventType -} - -// GetEventTypeOk returns a tuple with the EventType field value -// and a boolean to check if the value has been set. -func (o *UpdateWebhookRequest) GetEventTypeOk() (*WebhookEventType, bool) { - if o == nil { - return nil, false - } - return &o.EventType, true +// SetEventTypeFilter gets a reference to the given WebhookEventTypeFilter and assigns it to the EventTypeFilter field. +func (o *UpdateWebhookRequest) SetEventTypeFilter(v WebhookEventTypeFilter) { + o.EventTypeFilter = &v } -// SetEventType sets field value -func (o *UpdateWebhookRequest) SetEventType(v WebhookEventType) { - o.EventType = v -} - -// GetEventFilters returns the EventFilters field value +// GetEventFilters returns the EventFilters field value if set, zero value otherwise. func (o *UpdateWebhookRequest) GetEventFilters() []WebhookEventFilter { - if o == nil { + if o == nil || IsNil(o.EventFilters) { var ret []WebhookEventFilter return ret } - return o.EventFilters } -// GetEventFiltersOk returns a tuple with the EventFilters field value +// GetEventFiltersOk returns a tuple with the EventFilters field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateWebhookRequest) GetEventFiltersOk() ([]WebhookEventFilter, bool) { - if o == nil { + if o == nil || IsNil(o.EventFilters) { return nil, false } return o.EventFilters, true } -// SetEventFilters sets field value +// HasEventFilters returns a boolean if a field has been set. +func (o *UpdateWebhookRequest) HasEventFilters() bool { + if o != nil && !IsNil(o.EventFilters) { + return true + } + + return false +} + +// SetEventFilters gets a reference to the given []WebhookEventFilter and assigns it to the EventFilters field. func (o *UpdateWebhookRequest) SetEventFilters(v []WebhookEventFilter) { o.EventFilters = v } @@ -166,11 +146,12 @@ func (o UpdateWebhookRequest) MarshalJSON() ([]byte, error) { func (o UpdateWebhookRequest) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if !IsNil(o.NetworkId) { - toSerialize["network_id"] = o.NetworkId + if !IsNil(o.EventTypeFilter) { + toSerialize["event_type_filter"] = o.EventTypeFilter + } + if !IsNil(o.EventFilters) { + toSerialize["event_filters"] = o.EventFilters } - toSerialize["event_type"] = o.EventType - toSerialize["event_filters"] = o.EventFilters toSerialize["notification_uri"] = o.NotificationUri return toSerialize, nil } @@ -180,8 +161,6 @@ func (o *UpdateWebhookRequest) UnmarshalJSON(data []byte) (err error) { // by unmarshalling the object into a generic map with string keys and checking // that every required field exists as a key in the generic map. requiredProperties := []string{ - "event_type", - "event_filters", "notification_uri", } diff --git a/gen/client/model_webhook.go b/gen/client/model_webhook.go index 4e83b16..e8a56d2 100644 --- a/gen/client/model_webhook.go +++ b/gen/client/model_webhook.go @@ -25,6 +25,7 @@ type Webhook struct { // The ID of the blockchain network NetworkId *string `json:"network_id,omitempty"` EventType *WebhookEventType `json:"event_type,omitempty"` + EventTypeFilter *WebhookEventTypeFilter `json:"event_type_filter,omitempty"` // Webhook will monitor all events that matches any one of the event filters. EventFilters []WebhookEventFilter `json:"event_filters,omitempty"` // The URL to which the notifications will be sent. @@ -33,6 +34,8 @@ type Webhook struct { CreatedAt *time.Time `json:"created_at,omitempty"` // The date and time the webhook was last updated. UpdatedAt *time.Time `json:"updated_at,omitempty"` + // The header that will contain the signature of the webhook payload. + SignatureHeader *string `json:"signature_header,omitempty"` } // NewWebhook instantiates a new Webhook object @@ -148,6 +151,38 @@ func (o *Webhook) SetEventType(v WebhookEventType) { o.EventType = &v } +// GetEventTypeFilter returns the EventTypeFilter field value if set, zero value otherwise. +func (o *Webhook) GetEventTypeFilter() WebhookEventTypeFilter { + if o == nil || IsNil(o.EventTypeFilter) { + var ret WebhookEventTypeFilter + return ret + } + return *o.EventTypeFilter +} + +// GetEventTypeFilterOk returns a tuple with the EventTypeFilter field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Webhook) GetEventTypeFilterOk() (*WebhookEventTypeFilter, bool) { + if o == nil || IsNil(o.EventTypeFilter) { + return nil, false + } + return o.EventTypeFilter, true +} + +// HasEventTypeFilter returns a boolean if a field has been set. +func (o *Webhook) HasEventTypeFilter() bool { + if o != nil && !IsNil(o.EventTypeFilter) { + return true + } + + return false +} + +// SetEventTypeFilter gets a reference to the given WebhookEventTypeFilter and assigns it to the EventTypeFilter field. +func (o *Webhook) SetEventTypeFilter(v WebhookEventTypeFilter) { + o.EventTypeFilter = &v +} + // GetEventFilters returns the EventFilters field value if set, zero value otherwise. func (o *Webhook) GetEventFilters() []WebhookEventFilter { if o == nil || IsNil(o.EventFilters) { @@ -276,6 +311,38 @@ func (o *Webhook) SetUpdatedAt(v time.Time) { o.UpdatedAt = &v } +// GetSignatureHeader returns the SignatureHeader field value if set, zero value otherwise. +func (o *Webhook) GetSignatureHeader() string { + if o == nil || IsNil(o.SignatureHeader) { + var ret string + return ret + } + return *o.SignatureHeader +} + +// GetSignatureHeaderOk returns a tuple with the SignatureHeader field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Webhook) GetSignatureHeaderOk() (*string, bool) { + if o == nil || IsNil(o.SignatureHeader) { + return nil, false + } + return o.SignatureHeader, true +} + +// HasSignatureHeader returns a boolean if a field has been set. +func (o *Webhook) HasSignatureHeader() bool { + if o != nil && !IsNil(o.SignatureHeader) { + return true + } + + return false +} + +// SetSignatureHeader gets a reference to the given string and assigns it to the SignatureHeader field. +func (o *Webhook) SetSignatureHeader(v string) { + o.SignatureHeader = &v +} + func (o Webhook) MarshalJSON() ([]byte, error) { toSerialize,err := o.ToMap() if err != nil { @@ -295,6 +362,9 @@ func (o Webhook) ToMap() (map[string]interface{}, error) { if !IsNil(o.EventType) { toSerialize["event_type"] = o.EventType } + if !IsNil(o.EventTypeFilter) { + toSerialize["event_type_filter"] = o.EventTypeFilter + } if !IsNil(o.EventFilters) { toSerialize["event_filters"] = o.EventFilters } @@ -307,6 +377,9 @@ func (o Webhook) ToMap() (map[string]interface{}, error) { if !IsNil(o.UpdatedAt) { toSerialize["updated_at"] = o.UpdatedAt } + if !IsNil(o.SignatureHeader) { + toSerialize["signature_header"] = o.SignatureHeader + } return toSerialize, nil } diff --git a/gen/client/model_webhook_event_filter.go b/gen/client/model_webhook_event_filter.go index 895bf70..adbe571 100644 --- a/gen/client/model_webhook_event_filter.go +++ b/gen/client/model_webhook_event_filter.go @@ -19,11 +19,11 @@ var _ MappedNullable = &WebhookEventFilter{} // WebhookEventFilter The event_filter parameter specifies the criteria to filter events from the blockchain. It allows filtering events by contract address, sender address and receiver address. For a single event filter, not all of the properties need to be presented. type WebhookEventFilter struct { - // The onchain contract address of the token being transferred. + // The onchain contract address of the token for which the events should be tracked. ContractAddress *string `json:"contract_address,omitempty"` - // The onchain address of the sender. + // The onchain address of the sender. Set this filter to track all transfer events originating from your address. FromAddress *string `json:"from_address,omitempty"` - // The onchain address of the receiver. + // The onchain address of the receiver. Set this filter to track all transfer events sent to your address. ToAddress *string `json:"to_address,omitempty"` } diff --git a/gen/client/model_webhook_event_type.go b/gen/client/model_webhook_event_type.go index 52b9ade..6da3829 100644 --- a/gen/client/model_webhook_event_type.go +++ b/gen/client/model_webhook_event_type.go @@ -23,6 +23,7 @@ const ( WEBHOOKEVENTTYPE_UNSPECIFIED WebhookEventType = "unspecified" WEBHOOKEVENTTYPE_ERC20_TRANSFER WebhookEventType = "erc20_transfer" WEBHOOKEVENTTYPE_ERC721_TRANSFER WebhookEventType = "erc721_transfer" + WEBHOOKEVENTTYPE_WALLET_ACTIVITY WebhookEventType = "wallet_activity" ) // All allowed values of WebhookEventType enum @@ -30,6 +31,7 @@ var AllowedWebhookEventTypeEnumValues = []WebhookEventType{ "unspecified", "erc20_transfer", "erc721_transfer", + "wallet_activity", } func (v *WebhookEventType) UnmarshalJSON(src []byte) error { diff --git a/gen/client/model_webhook_event_type_filter.go b/gen/client/model_webhook_event_type_filter.go new file mode 100644 index 0000000..f3b903f --- /dev/null +++ b/gen/client/model_webhook_event_type_filter.go @@ -0,0 +1,123 @@ +/* +Coinbase Platform API + +This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +API version: 0.0.1-alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "gopkg.in/validator.v2" + "fmt" +) + +// WebhookEventTypeFilter - The event_type_filter parameter specifies the criteria to filter events based on event type. +type WebhookEventTypeFilter struct { + WebhookWalletActivityFilter *WebhookWalletActivityFilter +} + +// WebhookWalletActivityFilterAsWebhookEventTypeFilter is a convenience function that returns WebhookWalletActivityFilter wrapped in WebhookEventTypeFilter +func WebhookWalletActivityFilterAsWebhookEventTypeFilter(v *WebhookWalletActivityFilter) WebhookEventTypeFilter { + return WebhookEventTypeFilter{ + WebhookWalletActivityFilter: v, + } +} + + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *WebhookEventTypeFilter) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into WebhookWalletActivityFilter + err = newStrictDecoder(data).Decode(&dst.WebhookWalletActivityFilter) + if err == nil { + jsonWebhookWalletActivityFilter, _ := json.Marshal(dst.WebhookWalletActivityFilter) + if string(jsonWebhookWalletActivityFilter) == "{}" { // empty struct + dst.WebhookWalletActivityFilter = nil + } else { + if err = validator.Validate(dst.WebhookWalletActivityFilter); err != nil { + dst.WebhookWalletActivityFilter = nil + } else { + match++ + } + } + } else { + dst.WebhookWalletActivityFilter = nil + } + + if match > 1 { // more than 1 match + // reset to nil + dst.WebhookWalletActivityFilter = nil + + return fmt.Errorf("data matches more than one schema in oneOf(WebhookEventTypeFilter)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return fmt.Errorf("data failed to match schemas in oneOf(WebhookEventTypeFilter)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src WebhookEventTypeFilter) MarshalJSON() ([]byte, error) { + if src.WebhookWalletActivityFilter != nil { + return json.Marshal(&src.WebhookWalletActivityFilter) + } + + return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *WebhookEventTypeFilter) GetActualInstance() (interface{}) { + if obj == nil { + return nil + } + if obj.WebhookWalletActivityFilter != nil { + return obj.WebhookWalletActivityFilter + } + + // all schemas are nil + return nil +} + +type NullableWebhookEventTypeFilter struct { + value *WebhookEventTypeFilter + isSet bool +} + +func (v NullableWebhookEventTypeFilter) Get() *WebhookEventTypeFilter { + return v.value +} + +func (v *NullableWebhookEventTypeFilter) Set(val *WebhookEventTypeFilter) { + v.value = val + v.isSet = true +} + +func (v NullableWebhookEventTypeFilter) IsSet() bool { + return v.isSet +} + +func (v *NullableWebhookEventTypeFilter) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableWebhookEventTypeFilter(val *WebhookEventTypeFilter) *NullableWebhookEventTypeFilter { + return &NullableWebhookEventTypeFilter{value: val, isSet: true} +} + +func (v NullableWebhookEventTypeFilter) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableWebhookEventTypeFilter) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/gen/client/model_webhook_wallet_activity_filter.go b/gen/client/model_webhook_wallet_activity_filter.go new file mode 100644 index 0000000..c70f921 --- /dev/null +++ b/gen/client/model_webhook_wallet_activity_filter.go @@ -0,0 +1,164 @@ +/* +Coinbase Platform API + +This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +API version: 0.0.1-alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the WebhookWalletActivityFilter type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &WebhookWalletActivityFilter{} + +// WebhookWalletActivityFilter Filter for wallet activity events. This filter allows the client to specify one or more wallet addresses to monitor for activities such as transactions, transfers, or other types of events that are associated with the specified addresses. +type WebhookWalletActivityFilter struct { + // A list of wallet addresses to filter on. + Addresses []string `json:"addresses,omitempty"` + // The ID of the wallet that owns the webhook. + WalletId *string `json:"wallet_id,omitempty"` +} + +// NewWebhookWalletActivityFilter instantiates a new WebhookWalletActivityFilter object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewWebhookWalletActivityFilter() *WebhookWalletActivityFilter { + this := WebhookWalletActivityFilter{} + return &this +} + +// NewWebhookWalletActivityFilterWithDefaults instantiates a new WebhookWalletActivityFilter object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewWebhookWalletActivityFilterWithDefaults() *WebhookWalletActivityFilter { + this := WebhookWalletActivityFilter{} + return &this +} + +// GetAddresses returns the Addresses field value if set, zero value otherwise. +func (o *WebhookWalletActivityFilter) GetAddresses() []string { + if o == nil || IsNil(o.Addresses) { + var ret []string + return ret + } + return o.Addresses +} + +// GetAddressesOk returns a tuple with the Addresses field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WebhookWalletActivityFilter) GetAddressesOk() ([]string, bool) { + if o == nil || IsNil(o.Addresses) { + return nil, false + } + return o.Addresses, true +} + +// HasAddresses returns a boolean if a field has been set. +func (o *WebhookWalletActivityFilter) HasAddresses() bool { + if o != nil && !IsNil(o.Addresses) { + return true + } + + return false +} + +// SetAddresses gets a reference to the given []string and assigns it to the Addresses field. +func (o *WebhookWalletActivityFilter) SetAddresses(v []string) { + o.Addresses = v +} + +// GetWalletId returns the WalletId field value if set, zero value otherwise. +func (o *WebhookWalletActivityFilter) GetWalletId() string { + if o == nil || IsNil(o.WalletId) { + var ret string + return ret + } + return *o.WalletId +} + +// GetWalletIdOk returns a tuple with the WalletId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WebhookWalletActivityFilter) GetWalletIdOk() (*string, bool) { + if o == nil || IsNil(o.WalletId) { + return nil, false + } + return o.WalletId, true +} + +// HasWalletId returns a boolean if a field has been set. +func (o *WebhookWalletActivityFilter) HasWalletId() bool { + if o != nil && !IsNil(o.WalletId) { + return true + } + + return false +} + +// SetWalletId gets a reference to the given string and assigns it to the WalletId field. +func (o *WebhookWalletActivityFilter) SetWalletId(v string) { + o.WalletId = &v +} + +func (o WebhookWalletActivityFilter) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o WebhookWalletActivityFilter) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Addresses) { + toSerialize["addresses"] = o.Addresses + } + if !IsNil(o.WalletId) { + toSerialize["wallet_id"] = o.WalletId + } + return toSerialize, nil +} + +type NullableWebhookWalletActivityFilter struct { + value *WebhookWalletActivityFilter + isSet bool +} + +func (v NullableWebhookWalletActivityFilter) Get() *WebhookWalletActivityFilter { + return v.value +} + +func (v *NullableWebhookWalletActivityFilter) Set(val *WebhookWalletActivityFilter) { + v.value = val + v.isSet = true +} + +func (v NullableWebhookWalletActivityFilter) IsSet() bool { + return v.isSet +} + +func (v *NullableWebhookWalletActivityFilter) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableWebhookWalletActivityFilter(val *WebhookWalletActivityFilter) *NullableWebhookWalletActivityFilter { + return &NullableWebhookWalletActivityFilter{value: val, isSet: true} +} + +func (v NullableWebhookWalletActivityFilter) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableWebhookWalletActivityFilter) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/go.mod b/go.mod index fac0eae..027686d 100644 --- a/go.mod +++ b/go.mod @@ -19,7 +19,6 @@ require ( github.com/blendle/zapdriver v1.3.1 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 // indirect - github.com/buger/jsonparser v1.1.1 // indirect github.com/consensys/bavard v0.1.13 // indirect github.com/consensys/gnark-crypto v0.12.1 // indirect github.com/crate-crypto/go-kzg-4844 v1.0.0 // indirect @@ -30,8 +29,6 @@ require ( github.com/gagliardetto/treeout v0.1.4 // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/google/uuid v1.6.0 // indirect - github.com/gorilla/rpc v1.2.0 // indirect - github.com/gorilla/websocket v1.4.2 // indirect github.com/holiman/uint256 v1.3.1 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/klauspost/compress v1.16.0 // indirect diff --git a/go.sum b/go.sum index dd12a27..e7b016b 100644 --- a/go.sum +++ b/go.sum @@ -33,8 +33,6 @@ github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVa github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs= -github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cockroachdb/errors v1.11.3 h1:5bA+k2Y6r+oz/6Z/RFlNeVCesGARKuC6YymtcDrbC/I= @@ -101,10 +99,6 @@ github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/ github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gorilla/rpc v1.2.0 h1:WvvdC2lNeT1SP32zrIce5l0ECBfbAlmrmSBsuc57wfk= -github.com/gorilla/rpc v1.2.0/go.mod h1:V4h9r+4sF5HnzqbwIez0fKSpANP0zlYd3qR7p36jkTQ= -github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= -github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/holiman/uint256 v1.3.1 h1:JfTzmih28bittyHM8z360dCjIA9dbPIBlcTI6lmctQs= github.com/holiman/uint256 v1.3.1/go.mod h1:EOMSn4q6Nyt9P6efbI3bueV4e1b3dGlUCXeiRV4ng7E= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= diff --git a/pkg/auth/transport.go b/pkg/auth/transport.go index db1a5ab..05fd388 100644 --- a/pkg/auth/transport.go +++ b/pkg/auth/transport.go @@ -36,7 +36,7 @@ func (t *transport) RoundTrip(req *http.Request) (*http.Response, error) { "Correlation-Context", fmt.Sprintf( "%s,%s", - fmt.Sprintf("%s=%s", "sdk_version", "0.0.8"), + fmt.Sprintf("%s=%s", "sdk_version", "0.0.9"), fmt.Sprintf("%s=%s", "sdk_language", "go"), ), ) diff --git a/pkg/coinbase/staking_balance.go b/pkg/coinbase/staking_balance.go index c28f5af..ba1de3e 100644 --- a/pkg/coinbase/staking_balance.go +++ b/pkg/coinbase/staking_balance.go @@ -78,11 +78,6 @@ func (c *Client) ListHistoricalStakingBalances( } func newStakingBalanceFromModel(m *client.StakingBalance) (*StakingBalance, error) { - date, err := time.Parse(timestampFormat, m.Date) - if err != nil { - return nil, err - } - bondedStake, err := newBalanceFromModel(&m.BondedStake) if err != nil { return nil, err @@ -95,7 +90,7 @@ func newStakingBalanceFromModel(m *client.StakingBalance) (*StakingBalance, erro return &StakingBalance{ model: m, - parsedDate: date, + parsedDate: m.GetDate(), bondedStake: bondedStake, unbondedBalance: unbondedBalance, }, nil diff --git a/pkg/coinbase/staking_balance_test.go b/pkg/coinbase/staking_balance_test.go index 9f72b92..38fd80c 100644 --- a/pkg/coinbase/staking_balance_test.go +++ b/pkg/coinbase/staking_balance_test.go @@ -60,7 +60,7 @@ func TestListHistoricalStakingBalances(t *testing.T) { Data: []client.StakingBalance{ { ParticipantType: "participantType", - Date: parsedTime.Format(timestampFormat), + Date: parsedTime, BondedStake: client.Balance{ Amount: "123", Asset: client.Asset{ diff --git a/pkg/coinbase/staking_reward.go b/pkg/coinbase/staking_reward.go index 3277f88..5624e7e 100644 --- a/pkg/coinbase/staking_reward.go +++ b/pkg/coinbase/staking_reward.go @@ -116,12 +116,7 @@ func (s StakingReward) Amount() (*big.Float, error) { // Date returns the date of the staking reward. func (s StakingReward) Date() (time.Time, error) { - parsedDate, err := time.Parse(timestampFormat, s.model.GetDate()) - if err != nil { - return time.Time{}, fmt.Errorf("invalid date found: %s", s.model.GetDate()) - } - - return parsedDate, nil + return s.model.GetDate(), nil } // USDValue returns the USD value of the staking reward. diff --git a/pkg/coinbase/staking_reward_test.go b/pkg/coinbase/staking_reward_test.go index ab69011..15449ce 100644 --- a/pkg/coinbase/staking_reward_test.go +++ b/pkg/coinbase/staking_reward_test.go @@ -261,13 +261,13 @@ func TestAmount(t *testing.T) { func TestDate(t *testing.T) { stakingReward := StakingReward{ model: api.StakingReward{ - Date: "2024-08-10T00:00:11Z", + Date: time.Date(2024, 8, 10, 0, 0, 00, 0, time.UTC), }, } resp, err := stakingReward.Date() assert.NoError(t, err, "error should be nil") - assert.Equal(t, "2024-08-10T00:00:11Z", resp.Format(timestampFormat)) + assert.Equal(t, "2024-08-10 00:00:00 +0000 UTC", resp.String()) } func mockFetchAsset(t *testing.T, assetsAPI *mocks.AssetsAPI, statusCode int) { @@ -301,7 +301,7 @@ func mockFetchStakingRewards(t *testing.T, stakeAPI *mocks.StakeAPI, statusCode Data: []api.StakingReward{ { AddressId: "test-address-id", - Date: "2024-08-10", + Date: time.Date(2024, 8, 10, 0, 0, 00, 0, time.UTC), Amount: "1", State: "pending", Format: "usd", @@ -333,7 +333,7 @@ func mockFetchStakingRewardsWithPage(t *testing.T, stakeAPI *mocks.StakeAPI) { Data: []api.StakingReward{ { AddressId: "test-address-id", - Date: "2024-08-10", + Date: time.Date(2024, 8, 10, 0, 0, 00, 0, time.UTC), Amount: "1", State: "pending", Format: "usd", @@ -361,7 +361,7 @@ func mockFetchStakingRewardsWithPage(t *testing.T, stakeAPI *mocks.StakeAPI) { Data: []api.StakingReward{ { AddressId: "test-address-id", - Date: "2024-08-11", + Date: time.Date(2024, 8, 10, 0, 0, 00, 0, time.UTC), Amount: "1", State: "pending", Format: "usd", diff --git a/pkg/coinbase/utils.go b/pkg/coinbase/utils.go index 06fee24..0f83b95 100644 --- a/pkg/coinbase/utils.go +++ b/pkg/coinbase/utils.go @@ -13,8 +13,6 @@ const ( StakingOperationModePartial = "partial" StakingOperationModeDefault = "default" StakingOperationModeNative = "native" - - timestampFormat = "2006-01-02T15:04:05Z" ) func normalizeNetwork(network string) string {