diff --git a/CHANGELOG.md b/CHANGELOG.md index 9658d3c..0785552 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ ## Unreleased +## [0.0.14] - 2024-11-26 + +### Added + +- Add a `Content` and `ToAddressID` method to `Transaction`. + ## [0.0.13] - 2024-11-21 ### Added diff --git a/gen/client/README.md b/gen/client/README.md index a6617ca..fe679de 100644 --- a/gen/client/README.md +++ b/gen/client/README.md @@ -118,8 +118,9 @@ Class | Method | HTTP request | Description *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 +*SmartContractsAPI* | [**ListSmartContracts**](docs/SmartContractsAPI.md#listsmartcontracts) | **Get** /v1/smart_contracts | List smart contracts *SmartContractsAPI* | [**ReadContract**](docs/SmartContractsAPI.md#readcontract) | **Post** /v1/networks/{network_id}/smart_contracts/{contract_address}/read | Read data from a smart contract +*SmartContractsAPI* | [**RegisterSmartContract**](docs/SmartContractsAPI.md#registersmartcontract) | **Post** /v1/networks/{network_id}/smart_contracts/{contract_address}/register | Register a smart contract *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 @@ -151,6 +152,7 @@ Class | Method | HTTP request | Description ## Documentation For Models + - [ABI](docs/ABI.md) - [Address](docs/Address.md) - [AddressBalanceList](docs/AddressBalanceList.md) - [AddressHistoricalBalanceList](docs/AddressHistoricalBalanceList.md) @@ -227,6 +229,7 @@ Class | Method | HTTP request | Description - [SignatureCreationEventResult](docs/SignatureCreationEventResult.md) - [SignedVoluntaryExitMessageMetadata](docs/SignedVoluntaryExitMessageMetadata.md) - [SmartContract](docs/SmartContract.md) + - [SmartContractActivityEvent](docs/SmartContractActivityEvent.md) - [SmartContractList](docs/SmartContractList.md) - [SmartContractOptions](docs/SmartContractOptions.md) - [SmartContractType](docs/SmartContractType.md) @@ -262,6 +265,7 @@ Class | Method | HTTP request | Description - [WebhookEventType](docs/WebhookEventType.md) - [WebhookEventTypeFilter](docs/WebhookEventTypeFilter.md) - [WebhookList](docs/WebhookList.md) + - [WebhookSmartContractEventFilter](docs/WebhookSmartContractEventFilter.md) - [WebhookWalletActivityFilter](docs/WebhookWalletActivityFilter.md) diff --git a/gen/client/api_smart_contracts.go b/gen/client/api_smart_contracts.go index 5744e4d..7765d15 100644 --- a/gen/client/api_smart_contracts.go +++ b/gen/client/api_smart_contracts.go @@ -73,16 +73,14 @@ type SmartContractsAPI interface { GetSmartContractExecute(r ApiGetSmartContractRequest) (*SmartContract, *http.Response, error) /* - ListSmartContracts List smart contracts deployed by address + ListSmartContracts List smart contracts - List all smart contracts deployed by address. + List smart contracts @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 + ListSmartContracts(ctx context.Context) ApiListSmartContractsRequest // ListSmartContractsExecute executes the request // @return SmartContractList @@ -103,6 +101,21 @@ type SmartContractsAPI interface { // ReadContractExecute executes the request // @return SolidityValue ReadContractExecute(r ApiReadContractRequest) (*SolidityValue, *http.Response, error) + + /* + RegisterSmartContract Register a smart contract + + Register a smart contract + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param contractAddress EVM address of the smart contract (42 characters, including '0x', in lowercase) + @param networkId The ID of the network to fetch. + @return ApiRegisterSmartContractRequest + */ + RegisterSmartContract(ctx context.Context, contractAddress string, networkId string) ApiRegisterSmartContractRequest + + // RegisterSmartContractExecute executes the request + RegisterSmartContractExecute(r ApiRegisterSmartContractRequest) (*http.Response, error) } // SmartContractsAPIService SmartContractsAPI service @@ -486,8 +499,13 @@ func (a *SmartContractsAPIService) GetSmartContractExecute(r ApiGetSmartContract type ApiListSmartContractsRequest struct { ctx context.Context ApiService SmartContractsAPI - walletId string - addressId string + page *string +} + +// Pagination token for retrieving the next set of results +func (r ApiListSmartContractsRequest) Page(page string) ApiListSmartContractsRequest { + r.page = &page + return r } func (r ApiListSmartContractsRequest) Execute() (*SmartContractList, *http.Response, error) { @@ -495,21 +513,17 @@ func (r ApiListSmartContractsRequest) Execute() (*SmartContractList, *http.Respo } /* -ListSmartContracts List smart contracts deployed by address +ListSmartContracts List smart contracts -List all smart contracts deployed by address. +List smart contracts @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 { +func (a *SmartContractsAPIService) ListSmartContracts(ctx context.Context) ApiListSmartContractsRequest { return ApiListSmartContractsRequest{ ApiService: a, ctx: ctx, - walletId: walletId, - addressId: addressId, } } @@ -528,14 +542,15 @@ func (a *SmartContractsAPIService) ListSmartContractsExecute(r ApiListSmartContr 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) + localVarPath := localBasePath + "/v1/smart_contracts" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} + if r.page != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "form", "") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -723,3 +738,118 @@ func (a *SmartContractsAPIService) ReadContractExecute(r ApiReadContractRequest) return localVarReturnValue, localVarHTTPResponse, nil } + +type ApiRegisterSmartContractRequest struct { + ctx context.Context + ApiService SmartContractsAPI + contractAddress string + networkId string + aBI *ABI +} + +func (r ApiRegisterSmartContractRequest) ABI(aBI ABI) ApiRegisterSmartContractRequest { + r.aBI = &aBI + return r +} + +func (r ApiRegisterSmartContractRequest) Execute() (*http.Response, error) { + return r.ApiService.RegisterSmartContractExecute(r) +} + +/* +RegisterSmartContract Register a smart contract + +Register a smart contract + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param contractAddress EVM address of the smart contract (42 characters, including '0x', in lowercase) + @param networkId The ID of the network to fetch. + @return ApiRegisterSmartContractRequest +*/ +func (a *SmartContractsAPIService) RegisterSmartContract(ctx context.Context, contractAddress string, networkId string) ApiRegisterSmartContractRequest { + return ApiRegisterSmartContractRequest{ + ApiService: a, + ctx: ctx, + contractAddress: contractAddress, + networkId: networkId, + } +} + +// Execute executes the request +func (a *SmartContractsAPIService) RegisterSmartContractExecute(r ApiRegisterSmartContractRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SmartContractsAPIService.RegisterSmartContract") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/networks/{network_id}/smart_contracts/{contract_address}/register" + localVarPath = strings.Replace(localVarPath, "{"+"contract_address"+"}", url.PathEscape(parameterValueToString(r.contractAddress, "contractAddress")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"network_id"+"}", url.PathEscape(parameterValueToString(r.networkId, "networkId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.aBI == nil { + return nil, reportError("aBI 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.aBI + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return 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 localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} diff --git a/gen/client/model_abi.go b/gen/client/model_abi.go new file mode 100644 index 0000000..1fb6b53 --- /dev/null +++ b/gen/client/model_abi.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 ABI type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ABI{} + +// ABI Smart Contract to be registered +type ABI struct { + // ABI of the smart contract + Abi string `json:"abi"` + // Name of the smart contract + ContractName string `json:"contract_name"` +} + +type _ABI ABI + +// NewABI instantiates a new ABI 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 NewABI(abi string, contractName string) *ABI { + this := ABI{} + this.Abi = abi + this.ContractName = contractName + return &this +} + +// NewABIWithDefaults instantiates a new ABI 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 NewABIWithDefaults() *ABI { + this := ABI{} + return &this +} + +// GetAbi returns the Abi field value +func (o *ABI) 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 *ABI) GetAbiOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Abi, true +} + +// SetAbi sets field value +func (o *ABI) SetAbi(v string) { + o.Abi = v +} + +// GetContractName returns the ContractName field value +func (o *ABI) GetContractName() string { + if o == nil { + var ret string + return ret + } + + return o.ContractName +} + +// GetContractNameOk returns a tuple with the ContractName field value +// and a boolean to check if the value has been set. +func (o *ABI) GetContractNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ContractName, true +} + +// SetContractName sets field value +func (o *ABI) SetContractName(v string) { + o.ContractName = v +} + +func (o ABI) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ABI) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["abi"] = o.Abi + toSerialize["contract_name"] = o.ContractName + return toSerialize, nil +} + +func (o *ABI) 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{ + "abi", + "contract_name", + } + + 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) + } + } + + varABI := _ABI{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varABI) + + if err != nil { + return err + } + + *o = ABI(varABI) + + return err +} + +type NullableABI struct { + value *ABI + isSet bool +} + +func (v NullableABI) Get() *ABI { + return v.value +} + +func (v *NullableABI) Set(val *ABI) { + v.value = val + v.isSet = true +} + +func (v NullableABI) IsSet() bool { + return v.isSet +} + +func (v *NullableABI) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableABI(val *ABI) *NullableABI { + return &NullableABI{value: val, isSet: true} +} + +func (v NullableABI) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableABI) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/gen/client/model_address_reputation.go b/gen/client/model_address_reputation.go index 3b1c429..3026a85 100644 --- a/gen/client/model_address_reputation.go +++ b/gen/client/model_address_reputation.go @@ -22,7 +22,7 @@ var _ MappedNullable = &AddressReputation{} // AddressReputation The reputation score with metadata of a blockchain address. type AddressReputation struct { // The reputation score of a wallet address which lie between 0 to 100. - ReputationScore *int32 `json:"reputation_score,omitempty"` + ReputationScore int32 `json:"reputation_score"` Metadata AddressReputationMetadata `json:"metadata"` } @@ -32,8 +32,9 @@ type _AddressReputation AddressReputation // 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 NewAddressReputation(metadata AddressReputationMetadata) *AddressReputation { +func NewAddressReputation(reputationScore int32, metadata AddressReputationMetadata) *AddressReputation { this := AddressReputation{} + this.ReputationScore = reputationScore this.Metadata = metadata return &this } @@ -46,36 +47,28 @@ func NewAddressReputationWithDefaults() *AddressReputation { return &this } -// GetReputationScore returns the ReputationScore field value if set, zero value otherwise. +// GetReputationScore returns the ReputationScore field value func (o *AddressReputation) GetReputationScore() int32 { - if o == nil || IsNil(o.ReputationScore) { + if o == nil { var ret int32 return ret } - return *o.ReputationScore + + return o.ReputationScore } -// GetReputationScoreOk returns a tuple with the ReputationScore field value if set, nil otherwise +// GetReputationScoreOk returns a tuple with the ReputationScore field value // and a boolean to check if the value has been set. func (o *AddressReputation) GetReputationScoreOk() (*int32, bool) { - if o == nil || IsNil(o.ReputationScore) { + if o == nil { return nil, false } - return o.ReputationScore, true -} - -// HasReputationScore returns a boolean if a field has been set. -func (o *AddressReputation) HasReputationScore() bool { - if o != nil && !IsNil(o.ReputationScore) { - return true - } - - return false + return &o.ReputationScore, true } -// SetReputationScore gets a reference to the given int32 and assigns it to the ReputationScore field. +// SetReputationScore sets field value func (o *AddressReputation) SetReputationScore(v int32) { - o.ReputationScore = &v + o.ReputationScore = v } // GetMetadata returns the Metadata field value @@ -112,9 +105,7 @@ func (o AddressReputation) MarshalJSON() ([]byte, error) { func (o AddressReputation) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if !IsNil(o.ReputationScore) { - toSerialize["reputation_score"] = o.ReputationScore - } + toSerialize["reputation_score"] = o.ReputationScore toSerialize["metadata"] = o.Metadata return toSerialize, nil } @@ -124,6 +115,7 @@ func (o *AddressReputation) 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{ + "reputation_score", "metadata", } diff --git a/gen/client/model_ethereum_token_transfer.go b/gen/client/model_ethereum_token_transfer.go index ff1fb4d..fd899c4 100644 --- a/gen/client/model_ethereum_token_transfer.go +++ b/gen/client/model_ethereum_token_transfer.go @@ -28,7 +28,7 @@ type EthereumTokenTransfer struct { Value *string `json:"value,omitempty"` // The ID of ERC721 or ERC1155 token being transferred. TokenId *string `json:"token_id,omitempty"` - LogIndex int32 `json:"log_index"` + LogIndex int64 `json:"log_index"` TokenTransferType TokenTransferType `json:"token_transfer_type"` } @@ -38,7 +38,7 @@ type _EthereumTokenTransfer EthereumTokenTransfer // 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 NewEthereumTokenTransfer(contractAddress string, fromAddress string, toAddress string, logIndex int32, tokenTransferType TokenTransferType) *EthereumTokenTransfer { +func NewEthereumTokenTransfer(contractAddress string, fromAddress string, toAddress string, logIndex int64, tokenTransferType TokenTransferType) *EthereumTokenTransfer { this := EthereumTokenTransfer{} this.ContractAddress = contractAddress this.FromAddress = fromAddress @@ -193,9 +193,9 @@ func (o *EthereumTokenTransfer) SetTokenId(v string) { } // GetLogIndex returns the LogIndex field value -func (o *EthereumTokenTransfer) GetLogIndex() int32 { +func (o *EthereumTokenTransfer) GetLogIndex() int64 { if o == nil { - var ret int32 + var ret int64 return ret } @@ -204,7 +204,7 @@ func (o *EthereumTokenTransfer) GetLogIndex() int32 { // GetLogIndexOk returns a tuple with the LogIndex field value // and a boolean to check if the value has been set. -func (o *EthereumTokenTransfer) GetLogIndexOk() (*int32, bool) { +func (o *EthereumTokenTransfer) GetLogIndexOk() (*int64, bool) { if o == nil { return nil, false } @@ -212,7 +212,7 @@ func (o *EthereumTokenTransfer) GetLogIndexOk() (*int32, bool) { } // SetLogIndex sets field value -func (o *EthereumTokenTransfer) SetLogIndex(v int32) { +func (o *EthereumTokenTransfer) SetLogIndex(v int64) { o.LogIndex = v } diff --git a/gen/client/model_ethereum_transaction.go b/gen/client/model_ethereum_transaction.go index 6deb2d0..62eb67b 100644 --- a/gen/client/model_ethereum_transaction.go +++ b/gen/client/model_ethereum_transaction.go @@ -25,29 +25,29 @@ 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"` + Gas *int64 `json:"gas,omitempty"` // The price per gas spent in the transaction in atomic units of the native asset. - GasPrice *int32 `json:"gas_price,omitempty"` + GasPrice *int64 `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"` + Nonce *int64 `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"` + Index *int64 `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"` + Type *int64 `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"` + MaxFeePerGas *int64 `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"` + MaxPriorityFeePerGas *int64 `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"` + PriorityFeePerGas *int64 `json:"priority_fee_per_gas,omitempty"` TransactionAccessList *EthereumTransactionAccessList `json:"transaction_access_list,omitempty"` TokenTransfers []EthereumTokenTransfer `json:"token_transfers,omitempty"` FlattenedTraces []EthereumTransactionFlattenedTrace `json:"flattened_traces,omitempty"` @@ -55,6 +55,8 @@ type EthereumTransaction struct { BlockTimestamp *time.Time `json:"block_timestamp,omitempty"` // This is for handling optimism rollup specific EIP-2718 transaction type field. Mint *string `json:"mint,omitempty"` + // RLP encoded transaction as a hex string (prefixed with 0x) for native compatibility with popular eth clients such as etherjs, viem etc. + RlpEncodedTx *string `json:"rlp_encoded_tx,omitempty"` } type _EthereumTransaction EthereumTransaction @@ -103,9 +105,9 @@ func (o *EthereumTransaction) SetFrom(v string) { } // GetGas returns the Gas field value if set, zero value otherwise. -func (o *EthereumTransaction) GetGas() int32 { +func (o *EthereumTransaction) GetGas() int64 { if o == nil || IsNil(o.Gas) { - var ret int32 + var ret int64 return ret } return *o.Gas @@ -113,7 +115,7 @@ func (o *EthereumTransaction) GetGas() int32 { // 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) { +func (o *EthereumTransaction) GetGasOk() (*int64, bool) { if o == nil || IsNil(o.Gas) { return nil, false } @@ -129,15 +131,15 @@ func (o *EthereumTransaction) HasGas() bool { return false } -// SetGas gets a reference to the given int32 and assigns it to the Gas field. -func (o *EthereumTransaction) SetGas(v int32) { +// SetGas gets a reference to the given int64 and assigns it to the Gas field. +func (o *EthereumTransaction) SetGas(v int64) { o.Gas = &v } // GetGasPrice returns the GasPrice field value if set, zero value otherwise. -func (o *EthereumTransaction) GetGasPrice() int32 { +func (o *EthereumTransaction) GetGasPrice() int64 { if o == nil || IsNil(o.GasPrice) { - var ret int32 + var ret int64 return ret } return *o.GasPrice @@ -145,7 +147,7 @@ func (o *EthereumTransaction) GetGasPrice() int32 { // 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) { +func (o *EthereumTransaction) GetGasPriceOk() (*int64, bool) { if o == nil || IsNil(o.GasPrice) { return nil, false } @@ -161,8 +163,8 @@ func (o *EthereumTransaction) HasGasPrice() bool { return false } -// SetGasPrice gets a reference to the given int32 and assigns it to the GasPrice field. -func (o *EthereumTransaction) SetGasPrice(v int32) { +// SetGasPrice gets a reference to the given int64 and assigns it to the GasPrice field. +func (o *EthereumTransaction) SetGasPrice(v int64) { o.GasPrice = &v } @@ -231,9 +233,9 @@ func (o *EthereumTransaction) SetInput(v string) { } // GetNonce returns the Nonce field value if set, zero value otherwise. -func (o *EthereumTransaction) GetNonce() int32 { +func (o *EthereumTransaction) GetNonce() int64 { if o == nil || IsNil(o.Nonce) { - var ret int32 + var ret int64 return ret } return *o.Nonce @@ -241,7 +243,7 @@ func (o *EthereumTransaction) GetNonce() int32 { // 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) { +func (o *EthereumTransaction) GetNonceOk() (*int64, bool) { if o == nil || IsNil(o.Nonce) { return nil, false } @@ -257,8 +259,8 @@ func (o *EthereumTransaction) HasNonce() bool { return false } -// SetNonce gets a reference to the given int32 and assigns it to the Nonce field. -func (o *EthereumTransaction) SetNonce(v int32) { +// SetNonce gets a reference to the given int64 and assigns it to the Nonce field. +func (o *EthereumTransaction) SetNonce(v int64) { o.Nonce = &v } @@ -287,9 +289,9 @@ func (o *EthereumTransaction) SetTo(v string) { } // GetIndex returns the Index field value if set, zero value otherwise. -func (o *EthereumTransaction) GetIndex() int32 { +func (o *EthereumTransaction) GetIndex() int64 { if o == nil || IsNil(o.Index) { - var ret int32 + var ret int64 return ret } return *o.Index @@ -297,7 +299,7 @@ func (o *EthereumTransaction) GetIndex() int32 { // 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) { +func (o *EthereumTransaction) GetIndexOk() (*int64, bool) { if o == nil || IsNil(o.Index) { return nil, false } @@ -313,8 +315,8 @@ func (o *EthereumTransaction) HasIndex() bool { return false } -// SetIndex gets a reference to the given int32 and assigns it to the Index field. -func (o *EthereumTransaction) SetIndex(v int32) { +// SetIndex gets a reference to the given int64 and assigns it to the Index field. +func (o *EthereumTransaction) SetIndex(v int64) { o.Index = &v } @@ -351,9 +353,9 @@ func (o *EthereumTransaction) SetValue(v string) { } // GetType returns the Type field value if set, zero value otherwise. -func (o *EthereumTransaction) GetType() int32 { +func (o *EthereumTransaction) GetType() int64 { if o == nil || IsNil(o.Type) { - var ret int32 + var ret int64 return ret } return *o.Type @@ -361,7 +363,7 @@ func (o *EthereumTransaction) GetType() int32 { // 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) { +func (o *EthereumTransaction) GetTypeOk() (*int64, bool) { if o == nil || IsNil(o.Type) { return nil, false } @@ -377,15 +379,15 @@ func (o *EthereumTransaction) HasType() bool { return false } -// SetType gets a reference to the given int32 and assigns it to the Type field. -func (o *EthereumTransaction) SetType(v int32) { +// SetType gets a reference to the given int64 and assigns it to the Type field. +func (o *EthereumTransaction) SetType(v int64) { o.Type = &v } // GetMaxFeePerGas returns the MaxFeePerGas field value if set, zero value otherwise. -func (o *EthereumTransaction) GetMaxFeePerGas() int32 { +func (o *EthereumTransaction) GetMaxFeePerGas() int64 { if o == nil || IsNil(o.MaxFeePerGas) { - var ret int32 + var ret int64 return ret } return *o.MaxFeePerGas @@ -393,7 +395,7 @@ func (o *EthereumTransaction) GetMaxFeePerGas() int32 { // 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) { +func (o *EthereumTransaction) GetMaxFeePerGasOk() (*int64, bool) { if o == nil || IsNil(o.MaxFeePerGas) { return nil, false } @@ -409,15 +411,15 @@ func (o *EthereumTransaction) HasMaxFeePerGas() bool { return false } -// SetMaxFeePerGas gets a reference to the given int32 and assigns it to the MaxFeePerGas field. -func (o *EthereumTransaction) SetMaxFeePerGas(v int32) { +// SetMaxFeePerGas gets a reference to the given int64 and assigns it to the MaxFeePerGas field. +func (o *EthereumTransaction) SetMaxFeePerGas(v int64) { o.MaxFeePerGas = &v } // GetMaxPriorityFeePerGas returns the MaxPriorityFeePerGas field value if set, zero value otherwise. -func (o *EthereumTransaction) GetMaxPriorityFeePerGas() int32 { +func (o *EthereumTransaction) GetMaxPriorityFeePerGas() int64 { if o == nil || IsNil(o.MaxPriorityFeePerGas) { - var ret int32 + var ret int64 return ret } return *o.MaxPriorityFeePerGas @@ -425,7 +427,7 @@ func (o *EthereumTransaction) GetMaxPriorityFeePerGas() int32 { // 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) { +func (o *EthereumTransaction) GetMaxPriorityFeePerGasOk() (*int64, bool) { if o == nil || IsNil(o.MaxPriorityFeePerGas) { return nil, false } @@ -441,15 +443,15 @@ func (o *EthereumTransaction) HasMaxPriorityFeePerGas() bool { return false } -// SetMaxPriorityFeePerGas gets a reference to the given int32 and assigns it to the MaxPriorityFeePerGas field. -func (o *EthereumTransaction) SetMaxPriorityFeePerGas(v int32) { +// SetMaxPriorityFeePerGas gets a reference to the given int64 and assigns it to the MaxPriorityFeePerGas field. +func (o *EthereumTransaction) SetMaxPriorityFeePerGas(v int64) { o.MaxPriorityFeePerGas = &v } // GetPriorityFeePerGas returns the PriorityFeePerGas field value if set, zero value otherwise. -func (o *EthereumTransaction) GetPriorityFeePerGas() int32 { +func (o *EthereumTransaction) GetPriorityFeePerGas() int64 { if o == nil || IsNil(o.PriorityFeePerGas) { - var ret int32 + var ret int64 return ret } return *o.PriorityFeePerGas @@ -457,7 +459,7 @@ func (o *EthereumTransaction) GetPriorityFeePerGas() int32 { // 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) { +func (o *EthereumTransaction) GetPriorityFeePerGasOk() (*int64, bool) { if o == nil || IsNil(o.PriorityFeePerGas) { return nil, false } @@ -473,8 +475,8 @@ func (o *EthereumTransaction) HasPriorityFeePerGas() bool { return false } -// SetPriorityFeePerGas gets a reference to the given int32 and assigns it to the PriorityFeePerGas field. -func (o *EthereumTransaction) SetPriorityFeePerGas(v int32) { +// SetPriorityFeePerGas gets a reference to the given int64 and assigns it to the PriorityFeePerGas field. +func (o *EthereumTransaction) SetPriorityFeePerGas(v int64) { o.PriorityFeePerGas = &v } @@ -638,6 +640,38 @@ func (o *EthereumTransaction) SetMint(v string) { o.Mint = &v } +// GetRlpEncodedTx returns the RlpEncodedTx field value if set, zero value otherwise. +func (o *EthereumTransaction) GetRlpEncodedTx() string { + if o == nil || IsNil(o.RlpEncodedTx) { + var ret string + return ret + } + return *o.RlpEncodedTx +} + +// GetRlpEncodedTxOk returns a tuple with the RlpEncodedTx field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EthereumTransaction) GetRlpEncodedTxOk() (*string, bool) { + if o == nil || IsNil(o.RlpEncodedTx) { + return nil, false + } + return o.RlpEncodedTx, true +} + +// HasRlpEncodedTx returns a boolean if a field has been set. +func (o *EthereumTransaction) HasRlpEncodedTx() bool { + if o != nil && !IsNil(o.RlpEncodedTx) { + return true + } + + return false +} + +// SetRlpEncodedTx gets a reference to the given string and assigns it to the RlpEncodedTx field. +func (o *EthereumTransaction) SetRlpEncodedTx(v string) { + o.RlpEncodedTx = &v +} + func (o EthereumTransaction) MarshalJSON() ([]byte, error) { toSerialize,err := o.ToMap() if err != nil { @@ -698,6 +732,9 @@ func (o EthereumTransaction) ToMap() (map[string]interface{}, error) { if !IsNil(o.Mint) { toSerialize["mint"] = o.Mint } + if !IsNil(o.RlpEncodedTx) { + toSerialize["rlp_encoded_tx"] = o.RlpEncodedTx + } return toSerialize, nil } diff --git a/gen/client/model_ethereum_transaction_flattened_trace.go b/gen/client/model_ethereum_transaction_flattened_trace.go index 81533b2..9535bcb 100644 --- a/gen/client/model_ethereum_transaction_flattened_trace.go +++ b/gen/client/model_ethereum_transaction_flattened_trace.go @@ -24,20 +24,20 @@ type EthereumTransactionFlattenedTrace struct { 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"` + Gas *int64 `json:"gas,omitempty"` + GasUsed *int64 `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"` + SubTraces *int64 `json:"sub_traces,omitempty"` + TraceAddress []int64 `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"` + Status *int64 `json:"status,omitempty"` BlockHash *string `json:"block_hash,omitempty"` - BlockNumber *int32 `json:"block_number,omitempty"` + BlockNumber *int64 `json:"block_number,omitempty"` TransactionHash *string `json:"transaction_hash,omitempty"` - TransactionIndex *int32 `json:"transaction_index,omitempty"` + TransactionIndex *int64 `json:"transaction_index,omitempty"` } // NewEthereumTransactionFlattenedTrace instantiates a new EthereumTransactionFlattenedTrace object @@ -218,9 +218,9 @@ func (o *EthereumTransactionFlattenedTrace) SetValue(v string) { } // GetGas returns the Gas field value if set, zero value otherwise. -func (o *EthereumTransactionFlattenedTrace) GetGas() int32 { +func (o *EthereumTransactionFlattenedTrace) GetGas() int64 { if o == nil || IsNil(o.Gas) { - var ret int32 + var ret int64 return ret } return *o.Gas @@ -228,7 +228,7 @@ func (o *EthereumTransactionFlattenedTrace) GetGas() int32 { // 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) { +func (o *EthereumTransactionFlattenedTrace) GetGasOk() (*int64, bool) { if o == nil || IsNil(o.Gas) { return nil, false } @@ -244,15 +244,15 @@ func (o *EthereumTransactionFlattenedTrace) HasGas() bool { return false } -// SetGas gets a reference to the given int32 and assigns it to the Gas field. -func (o *EthereumTransactionFlattenedTrace) SetGas(v int32) { +// SetGas gets a reference to the given int64 and assigns it to the Gas field. +func (o *EthereumTransactionFlattenedTrace) SetGas(v int64) { o.Gas = &v } // GetGasUsed returns the GasUsed field value if set, zero value otherwise. -func (o *EthereumTransactionFlattenedTrace) GetGasUsed() int32 { +func (o *EthereumTransactionFlattenedTrace) GetGasUsed() int64 { if o == nil || IsNil(o.GasUsed) { - var ret int32 + var ret int64 return ret } return *o.GasUsed @@ -260,7 +260,7 @@ func (o *EthereumTransactionFlattenedTrace) GetGasUsed() int32 { // 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) { +func (o *EthereumTransactionFlattenedTrace) GetGasUsedOk() (*int64, bool) { if o == nil || IsNil(o.GasUsed) { return nil, false } @@ -276,8 +276,8 @@ func (o *EthereumTransactionFlattenedTrace) HasGasUsed() bool { return false } -// SetGasUsed gets a reference to the given int32 and assigns it to the GasUsed field. -func (o *EthereumTransactionFlattenedTrace) SetGasUsed(v int32) { +// SetGasUsed gets a reference to the given int64 and assigns it to the GasUsed field. +func (o *EthereumTransactionFlattenedTrace) SetGasUsed(v int64) { o.GasUsed = &v } @@ -346,9 +346,9 @@ func (o *EthereumTransactionFlattenedTrace) SetOutput(v string) { } // GetSubTraces returns the SubTraces field value if set, zero value otherwise. -func (o *EthereumTransactionFlattenedTrace) GetSubTraces() int32 { +func (o *EthereumTransactionFlattenedTrace) GetSubTraces() int64 { if o == nil || IsNil(o.SubTraces) { - var ret int32 + var ret int64 return ret } return *o.SubTraces @@ -356,7 +356,7 @@ func (o *EthereumTransactionFlattenedTrace) GetSubTraces() int32 { // 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) { +func (o *EthereumTransactionFlattenedTrace) GetSubTracesOk() (*int64, bool) { if o == nil || IsNil(o.SubTraces) { return nil, false } @@ -372,15 +372,15 @@ func (o *EthereumTransactionFlattenedTrace) HasSubTraces() bool { return false } -// SetSubTraces gets a reference to the given int32 and assigns it to the SubTraces field. -func (o *EthereumTransactionFlattenedTrace) SetSubTraces(v int32) { +// SetSubTraces gets a reference to the given int64 and assigns it to the SubTraces field. +func (o *EthereumTransactionFlattenedTrace) SetSubTraces(v int64) { o.SubTraces = &v } // GetTraceAddress returns the TraceAddress field value if set, zero value otherwise. -func (o *EthereumTransactionFlattenedTrace) GetTraceAddress() []int32 { +func (o *EthereumTransactionFlattenedTrace) GetTraceAddress() []int64 { if o == nil || IsNil(o.TraceAddress) { - var ret []int32 + var ret []int64 return ret } return o.TraceAddress @@ -388,7 +388,7 @@ func (o *EthereumTransactionFlattenedTrace) GetTraceAddress() []int32 { // 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) { +func (o *EthereumTransactionFlattenedTrace) GetTraceAddressOk() ([]int64, bool) { if o == nil || IsNil(o.TraceAddress) { return nil, false } @@ -404,8 +404,8 @@ func (o *EthereumTransactionFlattenedTrace) HasTraceAddress() bool { return false } -// SetTraceAddress gets a reference to the given []int32 and assigns it to the TraceAddress field. -func (o *EthereumTransactionFlattenedTrace) SetTraceAddress(v []int32) { +// SetTraceAddress gets a reference to the given []int64 and assigns it to the TraceAddress field. +func (o *EthereumTransactionFlattenedTrace) SetTraceAddress(v []int64) { o.TraceAddress = v } @@ -506,9 +506,9 @@ func (o *EthereumTransactionFlattenedTrace) SetTraceId(v string) { } // GetStatus returns the Status field value if set, zero value otherwise. -func (o *EthereumTransactionFlattenedTrace) GetStatus() int32 { +func (o *EthereumTransactionFlattenedTrace) GetStatus() int64 { if o == nil || IsNil(o.Status) { - var ret int32 + var ret int64 return ret } return *o.Status @@ -516,7 +516,7 @@ func (o *EthereumTransactionFlattenedTrace) GetStatus() int32 { // 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) { +func (o *EthereumTransactionFlattenedTrace) GetStatusOk() (*int64, bool) { if o == nil || IsNil(o.Status) { return nil, false } @@ -532,8 +532,8 @@ func (o *EthereumTransactionFlattenedTrace) HasStatus() bool { return false } -// SetStatus gets a reference to the given int32 and assigns it to the Status field. -func (o *EthereumTransactionFlattenedTrace) SetStatus(v int32) { +// SetStatus gets a reference to the given int64 and assigns it to the Status field. +func (o *EthereumTransactionFlattenedTrace) SetStatus(v int64) { o.Status = &v } @@ -570,9 +570,9 @@ func (o *EthereumTransactionFlattenedTrace) SetBlockHash(v string) { } // GetBlockNumber returns the BlockNumber field value if set, zero value otherwise. -func (o *EthereumTransactionFlattenedTrace) GetBlockNumber() int32 { +func (o *EthereumTransactionFlattenedTrace) GetBlockNumber() int64 { if o == nil || IsNil(o.BlockNumber) { - var ret int32 + var ret int64 return ret } return *o.BlockNumber @@ -580,7 +580,7 @@ func (o *EthereumTransactionFlattenedTrace) GetBlockNumber() int32 { // 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) { +func (o *EthereumTransactionFlattenedTrace) GetBlockNumberOk() (*int64, bool) { if o == nil || IsNil(o.BlockNumber) { return nil, false } @@ -596,8 +596,8 @@ func (o *EthereumTransactionFlattenedTrace) HasBlockNumber() bool { return false } -// SetBlockNumber gets a reference to the given int32 and assigns it to the BlockNumber field. -func (o *EthereumTransactionFlattenedTrace) SetBlockNumber(v int32) { +// SetBlockNumber gets a reference to the given int64 and assigns it to the BlockNumber field. +func (o *EthereumTransactionFlattenedTrace) SetBlockNumber(v int64) { o.BlockNumber = &v } @@ -634,9 +634,9 @@ func (o *EthereumTransactionFlattenedTrace) SetTransactionHash(v string) { } // GetTransactionIndex returns the TransactionIndex field value if set, zero value otherwise. -func (o *EthereumTransactionFlattenedTrace) GetTransactionIndex() int32 { +func (o *EthereumTransactionFlattenedTrace) GetTransactionIndex() int64 { if o == nil || IsNil(o.TransactionIndex) { - var ret int32 + var ret int64 return ret } return *o.TransactionIndex @@ -644,7 +644,7 @@ func (o *EthereumTransactionFlattenedTrace) GetTransactionIndex() int32 { // 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) { +func (o *EthereumTransactionFlattenedTrace) GetTransactionIndexOk() (*int64, bool) { if o == nil || IsNil(o.TransactionIndex) { return nil, false } @@ -660,8 +660,8 @@ func (o *EthereumTransactionFlattenedTrace) HasTransactionIndex() bool { return false } -// SetTransactionIndex gets a reference to the given int32 and assigns it to the TransactionIndex field. -func (o *EthereumTransactionFlattenedTrace) SetTransactionIndex(v int32) { +// SetTransactionIndex gets a reference to the given int64 and assigns it to the TransactionIndex field. +func (o *EthereumTransactionFlattenedTrace) SetTransactionIndex(v int64) { o.TransactionIndex = &v } diff --git a/gen/client/model_smart_contract.go b/gen/client/model_smart_contract.go index da8059f..6b35fae 100644 --- a/gen/client/model_smart_contract.go +++ b/gen/client/model_smart_contract.go @@ -29,6 +29,8 @@ type SmartContract struct { WalletId string `json:"wallet_id"` // The EVM address of the smart contract ContractAddress string `json:"contract_address"` + // The name of the smart contract + ContractName string `json:"contract_name"` // The EVM address of the account that deployed the smart contract DeployerAddress string `json:"deployer_address"` Type SmartContractType `json:"type"` @@ -44,12 +46,13 @@ type _SmartContract SmartContract // 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 { +func NewSmartContract(smartContractId string, networkId string, walletId string, contractAddress string, contractName 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.ContractName = contractName this.DeployerAddress = deployerAddress this.Type = type_ this.Options = options @@ -162,6 +165,30 @@ func (o *SmartContract) SetContractAddress(v string) { o.ContractAddress = v } +// GetContractName returns the ContractName field value +func (o *SmartContract) GetContractName() string { + if o == nil { + var ret string + return ret + } + + return o.ContractName +} + +// GetContractNameOk returns a tuple with the ContractName field value +// and a boolean to check if the value has been set. +func (o *SmartContract) GetContractNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ContractName, true +} + +// SetContractName sets field value +func (o *SmartContract) SetContractName(v string) { + o.ContractName = v +} + // GetDeployerAddress returns the DeployerAddress field value func (o *SmartContract) GetDeployerAddress() string { if o == nil { @@ -296,6 +323,7 @@ func (o SmartContract) ToMap() (map[string]interface{}, error) { toSerialize["network_id"] = o.NetworkId toSerialize["wallet_id"] = o.WalletId toSerialize["contract_address"] = o.ContractAddress + toSerialize["contract_name"] = o.ContractName toSerialize["deployer_address"] = o.DeployerAddress toSerialize["type"] = o.Type toSerialize["options"] = o.Options @@ -313,6 +341,7 @@ func (o *SmartContract) UnmarshalJSON(data []byte) (err error) { "network_id", "wallet_id", "contract_address", + "contract_name", "deployer_address", "type", "options", diff --git a/gen/client/model_smart_contract_activity_event.go b/gen/client/model_smart_contract_activity_event.go new file mode 100644 index 0000000..5a8272a --- /dev/null +++ b/gen/client/model_smart_contract_activity_event.go @@ -0,0 +1,757 @@ +/* +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 SmartContractActivityEvent type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SmartContractActivityEvent{} + +// SmartContractActivityEvent Represents an event triggered by a smart contract activity on the blockchain. Contains information about the function, transaction, block, and involved addresses. +type SmartContractActivityEvent 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"` + // Name of the project this smart contract belongs to. + ProjectName *string `json:"projectName,omitempty"` + // Name of the contract. + ContractName *string `json:"contractName,omitempty"` + // Name of the function. + Func *string `json:"func,omitempty"` + // Signature of the function. + Sig *string `json:"sig,omitempty"` + // First 4 bytes of the Transaction, a unique ID. + FourBytes *string `json:"fourBytes,omitempty"` + // Address of the smart contract. + ContractAddress *string `json:"contractAddress,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 initiator in the transfer. + From *string `json:"from,omitempty"` + // Address of the recipient in the transfer. + To *string `json:"to,omitempty"` + // Amount of tokens transferred, typically in the smallest unit (e.g., wei for Ethereum). + Value *int32 `json:"value,omitempty"` +} + +// NewSmartContractActivityEvent instantiates a new SmartContractActivityEvent 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 NewSmartContractActivityEvent() *SmartContractActivityEvent { + this := SmartContractActivityEvent{} + return &this +} + +// NewSmartContractActivityEventWithDefaults instantiates a new SmartContractActivityEvent 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 NewSmartContractActivityEventWithDefaults() *SmartContractActivityEvent { + this := SmartContractActivityEvent{} + return &this +} + +// GetWebhookId returns the WebhookId field value if set, zero value otherwise. +func (o *SmartContractActivityEvent) 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 *SmartContractActivityEvent) 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 *SmartContractActivityEvent) 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 *SmartContractActivityEvent) SetWebhookId(v string) { + o.WebhookId = &v +} + +// GetEventType returns the EventType field value if set, zero value otherwise. +func (o *SmartContractActivityEvent) 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 *SmartContractActivityEvent) 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 *SmartContractActivityEvent) 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 *SmartContractActivityEvent) SetEventType(v string) { + o.EventType = &v +} + +// GetNetwork returns the Network field value if set, zero value otherwise. +func (o *SmartContractActivityEvent) 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 *SmartContractActivityEvent) 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 *SmartContractActivityEvent) 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 *SmartContractActivityEvent) SetNetwork(v string) { + o.Network = &v +} + +// GetProjectName returns the ProjectName field value if set, zero value otherwise. +func (o *SmartContractActivityEvent) GetProjectName() string { + if o == nil || IsNil(o.ProjectName) { + var ret string + return ret + } + return *o.ProjectName +} + +// GetProjectNameOk returns a tuple with the ProjectName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SmartContractActivityEvent) GetProjectNameOk() (*string, bool) { + if o == nil || IsNil(o.ProjectName) { + return nil, false + } + return o.ProjectName, true +} + +// HasProjectName returns a boolean if a field has been set. +func (o *SmartContractActivityEvent) HasProjectName() bool { + if o != nil && !IsNil(o.ProjectName) { + return true + } + + return false +} + +// SetProjectName gets a reference to the given string and assigns it to the ProjectName field. +func (o *SmartContractActivityEvent) SetProjectName(v string) { + o.ProjectName = &v +} + +// GetContractName returns the ContractName field value if set, zero value otherwise. +func (o *SmartContractActivityEvent) GetContractName() string { + if o == nil || IsNil(o.ContractName) { + var ret string + return ret + } + return *o.ContractName +} + +// GetContractNameOk returns a tuple with the ContractName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SmartContractActivityEvent) GetContractNameOk() (*string, bool) { + if o == nil || IsNil(o.ContractName) { + return nil, false + } + return o.ContractName, true +} + +// HasContractName returns a boolean if a field has been set. +func (o *SmartContractActivityEvent) HasContractName() bool { + if o != nil && !IsNil(o.ContractName) { + return true + } + + return false +} + +// SetContractName gets a reference to the given string and assigns it to the ContractName field. +func (o *SmartContractActivityEvent) SetContractName(v string) { + o.ContractName = &v +} + +// GetFunc returns the Func field value if set, zero value otherwise. +func (o *SmartContractActivityEvent) GetFunc() string { + if o == nil || IsNil(o.Func) { + var ret string + return ret + } + return *o.Func +} + +// GetFuncOk returns a tuple with the Func field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SmartContractActivityEvent) GetFuncOk() (*string, bool) { + if o == nil || IsNil(o.Func) { + return nil, false + } + return o.Func, true +} + +// HasFunc returns a boolean if a field has been set. +func (o *SmartContractActivityEvent) HasFunc() bool { + if o != nil && !IsNil(o.Func) { + return true + } + + return false +} + +// SetFunc gets a reference to the given string and assigns it to the Func field. +func (o *SmartContractActivityEvent) SetFunc(v string) { + o.Func = &v +} + +// GetSig returns the Sig field value if set, zero value otherwise. +func (o *SmartContractActivityEvent) GetSig() string { + if o == nil || IsNil(o.Sig) { + var ret string + return ret + } + return *o.Sig +} + +// GetSigOk returns a tuple with the Sig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SmartContractActivityEvent) GetSigOk() (*string, bool) { + if o == nil || IsNil(o.Sig) { + return nil, false + } + return o.Sig, true +} + +// HasSig returns a boolean if a field has been set. +func (o *SmartContractActivityEvent) HasSig() bool { + if o != nil && !IsNil(o.Sig) { + return true + } + + return false +} + +// SetSig gets a reference to the given string and assigns it to the Sig field. +func (o *SmartContractActivityEvent) SetSig(v string) { + o.Sig = &v +} + +// GetFourBytes returns the FourBytes field value if set, zero value otherwise. +func (o *SmartContractActivityEvent) GetFourBytes() string { + if o == nil || IsNil(o.FourBytes) { + var ret string + return ret + } + return *o.FourBytes +} + +// GetFourBytesOk returns a tuple with the FourBytes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SmartContractActivityEvent) GetFourBytesOk() (*string, bool) { + if o == nil || IsNil(o.FourBytes) { + return nil, false + } + return o.FourBytes, true +} + +// HasFourBytes returns a boolean if a field has been set. +func (o *SmartContractActivityEvent) HasFourBytes() bool { + if o != nil && !IsNil(o.FourBytes) { + return true + } + + return false +} + +// SetFourBytes gets a reference to the given string and assigns it to the FourBytes field. +func (o *SmartContractActivityEvent) SetFourBytes(v string) { + o.FourBytes = &v +} + +// GetContractAddress returns the ContractAddress field value if set, zero value otherwise. +func (o *SmartContractActivityEvent) 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 *SmartContractActivityEvent) 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 *SmartContractActivityEvent) 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 *SmartContractActivityEvent) SetContractAddress(v string) { + o.ContractAddress = &v +} + +// GetBlockHash returns the BlockHash field value if set, zero value otherwise. +func (o *SmartContractActivityEvent) 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 *SmartContractActivityEvent) 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 *SmartContractActivityEvent) 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 *SmartContractActivityEvent) SetBlockHash(v string) { + o.BlockHash = &v +} + +// GetBlockNumber returns the BlockNumber field value if set, zero value otherwise. +func (o *SmartContractActivityEvent) 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 *SmartContractActivityEvent) 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 *SmartContractActivityEvent) 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 *SmartContractActivityEvent) SetBlockNumber(v int32) { + o.BlockNumber = &v +} + +// GetBlockTime returns the BlockTime field value if set, zero value otherwise. +func (o *SmartContractActivityEvent) 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 *SmartContractActivityEvent) 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 *SmartContractActivityEvent) 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 *SmartContractActivityEvent) SetBlockTime(v time.Time) { + o.BlockTime = &v +} + +// GetTransactionHash returns the TransactionHash field value if set, zero value otherwise. +func (o *SmartContractActivityEvent) 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 *SmartContractActivityEvent) 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 *SmartContractActivityEvent) 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 *SmartContractActivityEvent) SetTransactionHash(v string) { + o.TransactionHash = &v +} + +// GetTransactionIndex returns the TransactionIndex field value if set, zero value otherwise. +func (o *SmartContractActivityEvent) 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 *SmartContractActivityEvent) 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 *SmartContractActivityEvent) 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 *SmartContractActivityEvent) SetTransactionIndex(v int32) { + o.TransactionIndex = &v +} + +// GetLogIndex returns the LogIndex field value if set, zero value otherwise. +func (o *SmartContractActivityEvent) 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 *SmartContractActivityEvent) 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 *SmartContractActivityEvent) 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 *SmartContractActivityEvent) SetLogIndex(v int32) { + o.LogIndex = &v +} + +// GetFrom returns the From field value if set, zero value otherwise. +func (o *SmartContractActivityEvent) 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 *SmartContractActivityEvent) 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 *SmartContractActivityEvent) 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 *SmartContractActivityEvent) SetFrom(v string) { + o.From = &v +} + +// GetTo returns the To field value if set, zero value otherwise. +func (o *SmartContractActivityEvent) 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 *SmartContractActivityEvent) 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 *SmartContractActivityEvent) 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 *SmartContractActivityEvent) SetTo(v string) { + o.To = &v +} + +// GetValue returns the Value field value if set, zero value otherwise. +func (o *SmartContractActivityEvent) GetValue() int32 { + if o == nil || IsNil(o.Value) { + var ret int32 + 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 *SmartContractActivityEvent) GetValueOk() (*int32, 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 *SmartContractActivityEvent) HasValue() bool { + if o != nil && !IsNil(o.Value) { + return true + } + + return false +} + +// SetValue gets a reference to the given int32 and assigns it to the Value field. +func (o *SmartContractActivityEvent) SetValue(v int32) { + o.Value = &v +} + +func (o SmartContractActivityEvent) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SmartContractActivityEvent) 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.ProjectName) { + toSerialize["projectName"] = o.ProjectName + } + if !IsNil(o.ContractName) { + toSerialize["contractName"] = o.ContractName + } + if !IsNil(o.Func) { + toSerialize["func"] = o.Func + } + if !IsNil(o.Sig) { + toSerialize["sig"] = o.Sig + } + if !IsNil(o.FourBytes) { + toSerialize["fourBytes"] = o.FourBytes + } + if !IsNil(o.ContractAddress) { + toSerialize["contractAddress"] = o.ContractAddress + } + 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.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 NullableSmartContractActivityEvent struct { + value *SmartContractActivityEvent + isSet bool +} + +func (v NullableSmartContractActivityEvent) Get() *SmartContractActivityEvent { + return v.value +} + +func (v *NullableSmartContractActivityEvent) Set(val *SmartContractActivityEvent) { + v.value = val + v.isSet = true +} + +func (v NullableSmartContractActivityEvent) IsSet() bool { + return v.isSet +} + +func (v *NullableSmartContractActivityEvent) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSmartContractActivityEvent(val *SmartContractActivityEvent) *NullableSmartContractActivityEvent { + return &NullableSmartContractActivityEvent{value: val, isSet: true} +} + +func (v NullableSmartContractActivityEvent) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSmartContractActivityEvent) 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 index d2211ac..18ef6d9 100644 --- a/gen/client/model_smart_contract_type.go +++ b/gen/client/model_smart_contract_type.go @@ -23,6 +23,7 @@ const ( SMARTCONTRACTTYPE_ERC20 SmartContractType = "erc20" SMARTCONTRACTTYPE_ERC721 SmartContractType = "erc721" SMARTCONTRACTTYPE_ERC1155 SmartContractType = "erc1155" + SMARTCONTRACTTYPE_CUSTOM SmartContractType = "custom" ) // All allowed values of SmartContractType enum @@ -30,6 +31,7 @@ var AllowedSmartContractTypeEnumValues = []SmartContractType{ "erc20", "erc721", "erc1155", + "custom", } func (v *SmartContractType) UnmarshalJSON(src []byte) error { diff --git a/gen/client/model_webhook_event_type.go b/gen/client/model_webhook_event_type.go index 6da3829..0a0295a 100644 --- a/gen/client/model_webhook_event_type.go +++ b/gen/client/model_webhook_event_type.go @@ -24,6 +24,7 @@ const ( WEBHOOKEVENTTYPE_ERC20_TRANSFER WebhookEventType = "erc20_transfer" WEBHOOKEVENTTYPE_ERC721_TRANSFER WebhookEventType = "erc721_transfer" WEBHOOKEVENTTYPE_WALLET_ACTIVITY WebhookEventType = "wallet_activity" + WEBHOOKEVENTTYPE_SMART_CONTRACT_EVENT_ACTIVITY WebhookEventType = "smart_contract_event_activity" ) // All allowed values of WebhookEventType enum @@ -32,6 +33,7 @@ var AllowedWebhookEventTypeEnumValues = []WebhookEventType{ "erc20_transfer", "erc721_transfer", "wallet_activity", + "smart_contract_event_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 index f3b903f..b1179be 100644 --- a/gen/client/model_webhook_event_type_filter.go +++ b/gen/client/model_webhook_event_type_filter.go @@ -18,9 +18,17 @@ import ( // WebhookEventTypeFilter - The event_type_filter parameter specifies the criteria to filter events based on event type. type WebhookEventTypeFilter struct { + WebhookSmartContractEventFilter *WebhookSmartContractEventFilter WebhookWalletActivityFilter *WebhookWalletActivityFilter } +// WebhookSmartContractEventFilterAsWebhookEventTypeFilter is a convenience function that returns WebhookSmartContractEventFilter wrapped in WebhookEventTypeFilter +func WebhookSmartContractEventFilterAsWebhookEventTypeFilter(v *WebhookSmartContractEventFilter) WebhookEventTypeFilter { + return WebhookEventTypeFilter{ + WebhookSmartContractEventFilter: v, + } +} + // WebhookWalletActivityFilterAsWebhookEventTypeFilter is a convenience function that returns WebhookWalletActivityFilter wrapped in WebhookEventTypeFilter func WebhookWalletActivityFilterAsWebhookEventTypeFilter(v *WebhookWalletActivityFilter) WebhookEventTypeFilter { return WebhookEventTypeFilter{ @@ -33,6 +41,23 @@ func WebhookWalletActivityFilterAsWebhookEventTypeFilter(v *WebhookWalletActivit func (dst *WebhookEventTypeFilter) UnmarshalJSON(data []byte) error { var err error match := 0 + // try to unmarshal data into WebhookSmartContractEventFilter + err = newStrictDecoder(data).Decode(&dst.WebhookSmartContractEventFilter) + if err == nil { + jsonWebhookSmartContractEventFilter, _ := json.Marshal(dst.WebhookSmartContractEventFilter) + if string(jsonWebhookSmartContractEventFilter) == "{}" { // empty struct + dst.WebhookSmartContractEventFilter = nil + } else { + if err = validator.Validate(dst.WebhookSmartContractEventFilter); err != nil { + dst.WebhookSmartContractEventFilter = nil + } else { + match++ + } + } + } else { + dst.WebhookSmartContractEventFilter = nil + } + // try to unmarshal data into WebhookWalletActivityFilter err = newStrictDecoder(data).Decode(&dst.WebhookWalletActivityFilter) if err == nil { @@ -52,6 +77,7 @@ func (dst *WebhookEventTypeFilter) UnmarshalJSON(data []byte) error { if match > 1 { // more than 1 match // reset to nil + dst.WebhookSmartContractEventFilter = nil dst.WebhookWalletActivityFilter = nil return fmt.Errorf("data matches more than one schema in oneOf(WebhookEventTypeFilter)") @@ -64,6 +90,10 @@ func (dst *WebhookEventTypeFilter) UnmarshalJSON(data []byte) error { // Marshal data from the first non-nil pointers in the struct to JSON func (src WebhookEventTypeFilter) MarshalJSON() ([]byte, error) { + if src.WebhookSmartContractEventFilter != nil { + return json.Marshal(&src.WebhookSmartContractEventFilter) + } + if src.WebhookWalletActivityFilter != nil { return json.Marshal(&src.WebhookWalletActivityFilter) } @@ -76,6 +106,10 @@ func (obj *WebhookEventTypeFilter) GetActualInstance() (interface{}) { if obj == nil { return nil } + if obj.WebhookSmartContractEventFilter != nil { + return obj.WebhookSmartContractEventFilter + } + if obj.WebhookWalletActivityFilter != nil { return obj.WebhookWalletActivityFilter } diff --git a/gen/client/model_webhook_smart_contract_event_filter.go b/gen/client/model_webhook_smart_contract_event_filter.go new file mode 100644 index 0000000..22fe01c --- /dev/null +++ b/gen/client/model_webhook_smart_contract_event_filter.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 WebhookSmartContractEventFilter type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &WebhookSmartContractEventFilter{} + +// WebhookSmartContractEventFilter Filter for smart contract events. This filter allows the client to specify smart contract addresses to monitor for activities such as contract function calls. +type WebhookSmartContractEventFilter struct { + // A list of smart contract addresses to filter on. + ContractAddresses []string `json:"contract_addresses"` +} + +type _WebhookSmartContractEventFilter WebhookSmartContractEventFilter + +// NewWebhookSmartContractEventFilter instantiates a new WebhookSmartContractEventFilter 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 NewWebhookSmartContractEventFilter(contractAddresses []string) *WebhookSmartContractEventFilter { + this := WebhookSmartContractEventFilter{} + this.ContractAddresses = contractAddresses + return &this +} + +// NewWebhookSmartContractEventFilterWithDefaults instantiates a new WebhookSmartContractEventFilter 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 NewWebhookSmartContractEventFilterWithDefaults() *WebhookSmartContractEventFilter { + this := WebhookSmartContractEventFilter{} + return &this +} + +// GetContractAddresses returns the ContractAddresses field value +func (o *WebhookSmartContractEventFilter) GetContractAddresses() []string { + if o == nil { + var ret []string + return ret + } + + return o.ContractAddresses +} + +// GetContractAddressesOk returns a tuple with the ContractAddresses field value +// and a boolean to check if the value has been set. +func (o *WebhookSmartContractEventFilter) GetContractAddressesOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.ContractAddresses, true +} + +// SetContractAddresses sets field value +func (o *WebhookSmartContractEventFilter) SetContractAddresses(v []string) { + o.ContractAddresses = v +} + +func (o WebhookSmartContractEventFilter) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o WebhookSmartContractEventFilter) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["contract_addresses"] = o.ContractAddresses + return toSerialize, nil +} + +func (o *WebhookSmartContractEventFilter) 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_addresses", + } + + 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) + } + } + + varWebhookSmartContractEventFilter := _WebhookSmartContractEventFilter{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varWebhookSmartContractEventFilter) + + if err != nil { + return err + } + + *o = WebhookSmartContractEventFilter(varWebhookSmartContractEventFilter) + + return err +} + +type NullableWebhookSmartContractEventFilter struct { + value *WebhookSmartContractEventFilter + isSet bool +} + +func (v NullableWebhookSmartContractEventFilter) Get() *WebhookSmartContractEventFilter { + return v.value +} + +func (v *NullableWebhookSmartContractEventFilter) Set(val *WebhookSmartContractEventFilter) { + v.value = val + v.isSet = true +} + +func (v NullableWebhookSmartContractEventFilter) IsSet() bool { + return v.isSet +} + +func (v *NullableWebhookSmartContractEventFilter) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableWebhookSmartContractEventFilter(val *WebhookSmartContractEventFilter) *NullableWebhookSmartContractEventFilter { + return &NullableWebhookSmartContractEventFilter{value: val, isSet: true} +} + +func (v NullableWebhookSmartContractEventFilter) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableWebhookSmartContractEventFilter) 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 index c70f921..465eae7 100644 --- a/gen/client/model_webhook_wallet_activity_filter.go +++ b/gen/client/model_webhook_wallet_activity_filter.go @@ -12,6 +12,8 @@ package client import ( "encoding/json" + "bytes" + "fmt" ) // checks if the WebhookWalletActivityFilter type satisfies the MappedNullable interface at compile time @@ -22,15 +24,18 @@ 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"` + WalletId string `json:"wallet_id"` } +type _WebhookWalletActivityFilter WebhookWalletActivityFilter + // 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 { +func NewWebhookWalletActivityFilter(walletId string) *WebhookWalletActivityFilter { this := WebhookWalletActivityFilter{} + this.WalletId = walletId return &this } @@ -74,36 +79,28 @@ func (o *WebhookWalletActivityFilter) SetAddresses(v []string) { o.Addresses = v } -// GetWalletId returns the WalletId field value if set, zero value otherwise. +// GetWalletId returns the WalletId field value func (o *WebhookWalletActivityFilter) GetWalletId() string { - if o == nil || IsNil(o.WalletId) { + if o == nil { var ret string return ret } - return *o.WalletId + + return o.WalletId } -// GetWalletIdOk returns a tuple with the WalletId field value if set, nil otherwise +// GetWalletIdOk returns a tuple with the WalletId field value // and a boolean to check if the value has been set. func (o *WebhookWalletActivityFilter) GetWalletIdOk() (*string, bool) { - if o == nil || IsNil(o.WalletId) { + if o == nil { return nil, false } - return o.WalletId, true + 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. +// SetWalletId sets field value func (o *WebhookWalletActivityFilter) SetWalletId(v string) { - o.WalletId = &v + o.WalletId = v } func (o WebhookWalletActivityFilter) MarshalJSON() ([]byte, error) { @@ -119,12 +116,47 @@ func (o WebhookWalletActivityFilter) ToMap() (map[string]interface{}, error) { if !IsNil(o.Addresses) { toSerialize["addresses"] = o.Addresses } - if !IsNil(o.WalletId) { - toSerialize["wallet_id"] = o.WalletId - } + toSerialize["wallet_id"] = o.WalletId return toSerialize, nil } +func (o *WebhookWalletActivityFilter) 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{ + "wallet_id", + } + + 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) + } + } + + varWebhookWalletActivityFilter := _WebhookWalletActivityFilter{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varWebhookWalletActivityFilter) + + if err != nil { + return err + } + + *o = WebhookWalletActivityFilter(varWebhookWalletActivityFilter) + + return err +} + type NullableWebhookWalletActivityFilter struct { value *WebhookWalletActivityFilter isSet bool diff --git a/pkg/auth/transport.go b/pkg/auth/transport.go index f2513fe..0ea79ca 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.13"), + fmt.Sprintf("%s=%s", "sdk_version", "0.0.14"), fmt.Sprintf("%s=%s", "sdk_language", "go"), ), ) diff --git a/pkg/coinbase/transaction.go b/pkg/coinbase/transaction.go index 9fbb346..492c5e2 100644 --- a/pkg/coinbase/transaction.go +++ b/pkg/coinbase/transaction.go @@ -67,6 +67,15 @@ func (t *Transaction) FromAddressID() string { return t.model.FromAddressId } +// ToAddressID returns the to address for the transaction if it exists +func (t *Transaction) ToAddressID() string { + if t.model.ToAddressId == nil { + return "" + } + + return *t.model.ToAddressId +} + // Raw returns the raw transaction in the underlying blockchain's format func (t *Transaction) Raw() interface{} { return t.signable.Raw() @@ -77,6 +86,10 @@ func (t *Transaction) IsSigned() bool { return t.signable.IsSigned() } +func (t *Transaction) Content() *client.TransactionContent { + return t.model.Content +} + // String returns a string representation of the transaction func (t *Transaction) String() string { return fmt.Sprintf("Transaction{ TransactionHash: %s TransactionLink: %s}", t.TransactionHash(), t.TransactionLink())