From 343e123482f4ef9f6f04b1f53f568d6af15ad730 Mon Sep 17 00:00:00 2001 From: Ryan Gilbert Date: Thu, 19 Dec 2024 17:24:52 -0500 Subject: [PATCH] Release v0.13.0 (#352) Release v0.13.0 --- CHANGELOG.md | 19 +- README.md | 6 +- package-lock.json | 4 +- package.json | 2 +- quickstart-template/bridge-usdc.js | 2 +- .../discord_tutorial/webhook-transfer.js | 2 +- quickstart-template/package.json | 2 +- quickstart-template/register-basename.js | 2 +- src/client/api.ts | 1438 +++++++++++------ src/coinbase/address.ts | 23 + src/coinbase/address_reputation.ts | 60 + src/coinbase/coinbase.ts | 2 + src/coinbase/smart_contract.ts | 169 +- src/coinbase/types.ts | 184 ++- src/coinbase/validator.ts | 114 +- src/coinbase/wallet.ts | 146 +- src/tests/address_reputation_test.ts | 96 ++ src/tests/address_test.ts | 48 +- src/tests/e2e.ts | 28 +- src/tests/smart_contract_test.ts | 265 ++- src/tests/utils.ts | 35 +- src/tests/validator_test.ts | 95 ++ src/tests/wallet_address_test.ts | 6 +- src/tests/wallet_test.ts | 120 +- src/tests/webhook_test.ts | 7 +- 25 files changed, 2284 insertions(+), 591 deletions(-) create mode 100644 src/coinbase/address_reputation.ts create mode 100644 src/tests/address_reputation_test.ts create mode 100644 src/tests/validator_test.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index da5c3bf3..dd1710f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,23 @@ # Coinbase Node.js SDK Changelog -## Unreleased +## [0.13.0] - 2024-12-19 + +### Added +- Add support for registering, updating, and listing smart contracts that are + deployed external to CDP. +- Add support for fetching address reputation + - Add `reputation` method to `Address` to fetch the reputation of the address +- Add `networkId` to `WalletData` so that it is saved with the seed data and surfaced via the export function +- Add ability to import external wallets into CDP via a BIP-39 mnemonic phrase, as a 1-of-1 wallet +- Add ability to import WalletData files exported by the Python CDP SDK +- Add getters for `Validator` object to expose more data to users. +- Add test file for `Validator` object. + +### Deprecated +- Deprecate `Wallet.loadSeed()` method in favor of `Wallet.loadSeedFromFile()` +- Deprecate `Wallet.saveSeed()` method in favor of `Wallet.saveSeedToFile()` + +## [0.12.0] - Skipped ### [0.11.3] - 2024-12-10 diff --git a/README.md b/README.md index 11d2eecd..c18bd5bf 100644 --- a/README.md +++ b/README.md @@ -201,13 +201,13 @@ For convenience during testing, we provide a `saveSeed` method that stores the w ```typescript const seedFilePath = ""; -wallet.saveSeed(seedFilePath); +wallet.saveSeedToFile(seedFilePath); ``` To encrypt the saved data, set encrypt to true. Note that your CDP API key also serves as the encryption key for the data persisted locally. To re-instantiate wallets with encrypted data, ensure that your SDK is configured with the same API key when invoking `saveSeed` and `loadSeed`. ```typescript -wallet.saveSeed(seedFilePath, true); +wallet.saveSeedToFile(seedFilePath, true); ``` The below code demonstrates how to re-instantiate a Wallet from the data export. @@ -221,7 +221,7 @@ To import Wallets that were persisted to your local file system using `saveSeed` ```typescript const userWallet = await Wallet.fetch(wallet.getId()); -await userWallet.loadSeed(seedFilePath); +await userWallet.loadSeedFromFile(seedFilePath); ``` diff --git a/package-lock.json b/package-lock.json index 819c5334..b1805b6c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@coinbase/coinbase-sdk", - "version": "0.11.3", + "version": "0.13.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@coinbase/coinbase-sdk", - "version": "0.11.3", + "version": "0.13.0", "license": "ISC", "dependencies": { "@scure/bip32": "^1.4.0", diff --git a/package.json b/package.json index 9b1630c2..18826248 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "license": "ISC", "description": "Coinbase Platform SDK", "repository": "https://github.com/coinbase/coinbase-sdk-nodejs", - "version": "0.11.3", + "version": "0.13.0", "main": "dist/index.js", "types": "dist/index.d.ts", "scripts": { diff --git a/quickstart-template/bridge-usdc.js b/quickstart-template/bridge-usdc.js index 4a0cbbbd..03b92eff 100644 --- a/quickstart-template/bridge-usdc.js +++ b/quickstart-template/bridge-usdc.js @@ -141,7 +141,7 @@ async function getTransactionReceipt(txHash) { async function fetchWalletAndLoadSeed(walletId, seedFilePath) { try { const wallet = await Wallet.fetch(walletId); - await wallet.loadSeed(seedFilePath); + await wallet.loadSeedFromFile(seedFilePath); console.log(`Successfully loaded funded wallet: `, wallet.getId()); return wallet; diff --git a/quickstart-template/discord_tutorial/webhook-transfer.js b/quickstart-template/discord_tutorial/webhook-transfer.js index 1aad72e8..74028d7d 100644 --- a/quickstart-template/discord_tutorial/webhook-transfer.js +++ b/quickstart-template/discord_tutorial/webhook-transfer.js @@ -26,7 +26,7 @@ const webhookNotificationUri = process.env.WEBHOOK_NOTIFICATION_URL; // Create Wallet else { myWallet = await Wallet.create(); - const saveSeed = myWallet.saveSeed(seedPath); + const saveSeed = myWallet.saveSeedToFile(seedPath); console.log("✅ Seed saved: ", saveSeed); } diff --git a/quickstart-template/package.json b/quickstart-template/package.json index 3b3bca6c..b29d4e2d 100644 --- a/quickstart-template/package.json +++ b/quickstart-template/package.json @@ -22,7 +22,7 @@ "dependencies": { "@solana/web3.js": "^2.0.0-rc.1", "bs58": "^6.0.0", - "@coinbase/coinbase-sdk": "^0.11.2", + "@coinbase/coinbase-sdk": "^0.13.0", "csv-parse": "^5.5.6", "csv-writer": "^1.6.0", "viem": "^2.21.6" diff --git a/quickstart-template/register-basename.js b/quickstart-template/register-basename.js index 4025bcac..d2a30fc9 100644 --- a/quickstart-template/register-basename.js +++ b/quickstart-template/register-basename.js @@ -133,7 +133,7 @@ async function registerBaseName(wallet, registerArgs) { async function fetchWalletAndLoadSeed(walletId, seedFilePath) { try { const wallet = await Wallet.fetch(walletId); - await wallet.loadSeed(seedFilePath); + await wallet.loadSeedFromFile(seedFilePath); console.log(`Successfully loaded funded wallet: `, wallet); return wallet; diff --git a/src/client/api.ts b/src/client/api.ts index 9735beff..a3748041 100644 --- a/src/client/api.ts +++ b/src/client/api.ts @@ -5,7 +5,7 @@ * This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. * * The version of the OpenAPI document: 0.0.1-alpha - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -24,7 +24,7 @@ import type { RequestArgs } from './base'; import { BASE_PATH, COLLECTION_FORMATS, BaseAPI, RequiredError, operationServerMap } from './base'; /** - * + * * @export * @interface Address */ @@ -61,13 +61,13 @@ export interface Address { 'index': number; } /** - * + * * @export * @interface AddressBalanceList */ export interface AddressBalanceList { /** - * + * * @type {Array} * @memberof AddressBalanceList */ @@ -92,13 +92,13 @@ export interface AddressBalanceList { 'total_count': number; } /** - * + * * @export * @interface AddressHistoricalBalanceList */ export interface AddressHistoricalBalanceList { /** - * + * * @type {Array} * @memberof AddressHistoricalBalanceList */ @@ -117,13 +117,13 @@ export interface AddressHistoricalBalanceList { 'next_page': string; } /** - * + * * @export * @interface AddressList */ export interface AddressList { /** - * + * * @type {Array
} * @memberof AddressList */ @@ -154,13 +154,13 @@ export interface AddressList { */ export interface AddressReputation { /** - * The reputation score of a wallet address which lie between 0 to 100. + * The score of a wallet address, ranging from -100 to 100. A negative score indicates a bad reputation, while a positive score indicates a good reputation. * @type {number} * @memberof AddressReputation */ - 'reputation_score': number; + 'score': number; /** - * + * * @type {AddressReputationMetadata} * @memberof AddressReputation */ @@ -234,26 +234,13 @@ export interface AddressReputationMetadata { 'smart_contract_deployments': number; } /** - * The risk score of a blockchain address. - * @export - * @interface AddressRisk - */ -export interface AddressRisk { - /** - * The lower the score is, the higher the risk is. The score lies between -100 to 0. - * @type {number} - * @memberof AddressRisk - */ - 'risk_score': number; -} -/** - * + * * @export * @interface AddressTransactionList */ export interface AddressTransactionList { /** - * + * * @type {Array} * @memberof AddressTransactionList */ @@ -315,14 +302,14 @@ export interface Balance { */ 'amount': string; /** - * + * * @type {Asset} * @memberof Balance */ 'asset': Asset; } /** - * + * * @export * @interface BroadcastContractInvocationRequest */ @@ -335,7 +322,7 @@ export interface BroadcastContractInvocationRequest { 'signed_payload': string; } /** - * + * * @export * @interface BroadcastStakingOperationRequest */ @@ -354,7 +341,7 @@ export interface BroadcastStakingOperationRequest { 'transaction_index': number; } /** - * + * * @export * @interface BroadcastTradeRequest */ @@ -373,7 +360,7 @@ export interface BroadcastTradeRequest { 'approve_transaction_signed_payload'?: string; } /** - * + * * @export * @interface BroadcastTransferRequest */ @@ -386,7 +373,7 @@ export interface BroadcastTransferRequest { 'signed_payload': string; } /** - * + * * @export * @interface BuildStakingOperationRequest */ @@ -593,20 +580,20 @@ export interface ContractInvocation { */ 'amount': string; /** - * + * * @type {Transaction} * @memberof ContractInvocation */ 'transaction': Transaction; } /** - * + * * @export * @interface ContractInvocationList */ export interface ContractInvocationList { /** - * + * * @type {Array} * @memberof ContractInvocationList */ @@ -631,7 +618,7 @@ export interface ContractInvocationList { 'total_count': number; } /** - * + * * @export * @interface CreateAddressRequest */ @@ -656,7 +643,7 @@ export interface CreateAddressRequest { 'address_index'?: number; } /** - * + * * @export * @interface CreateContractInvocationRequest */ @@ -693,7 +680,7 @@ export interface CreateContractInvocationRequest { 'amount'?: string; } /** - * + * * @export * @interface CreateFundOperationRequest */ @@ -718,7 +705,7 @@ export interface CreateFundOperationRequest { 'fund_quote_id'?: string; } /** - * + * * @export * @interface CreateFundQuoteRequest */ @@ -737,7 +724,7 @@ export interface CreateFundQuoteRequest { 'asset_id': string; } /** - * + * * @export * @interface CreatePayloadSignatureRequest */ @@ -756,7 +743,7 @@ export interface CreatePayloadSignatureRequest { 'signature'?: string; } /** - * + * * @export * @interface CreateServerSignerRequest */ @@ -781,19 +768,19 @@ export interface CreateServerSignerRequest { 'is_mpc': boolean; } /** - * + * * @export * @interface CreateSmartContractRequest */ export interface CreateSmartContractRequest { /** - * + * * @type {SmartContractType} * @memberof CreateSmartContractRequest */ 'type': SmartContractType; /** - * + * * @type {SmartContractOptions} * @memberof CreateSmartContractRequest */ @@ -802,7 +789,7 @@ export interface CreateSmartContractRequest { /** - * + * * @export * @interface CreateStakingOperationRequest */ @@ -833,7 +820,7 @@ export interface CreateStakingOperationRequest { 'options': { [key: string]: string; }; } /** - * + * * @export * @interface CreateTradeRequest */ @@ -858,7 +845,7 @@ export interface CreateTradeRequest { 'to_asset_id': string; } /** - * + * * @export * @interface CreateTransferRequest */ @@ -895,13 +882,13 @@ export interface CreateTransferRequest { 'gasless'?: boolean; } /** - * + * * @export * @interface CreateWalletRequest */ export interface CreateWalletRequest { /** - * + * * @type {CreateWalletRequestWallet} * @memberof CreateWalletRequest */ @@ -927,7 +914,7 @@ export interface CreateWalletRequestWallet { 'use_server_signer'?: boolean; } /** - * + * * @export * @interface CreateWalletWebhookRequest */ @@ -946,7 +933,7 @@ export interface CreateWalletWebhookRequest { 'signature_header'?: string; } /** - * + * * @export * @interface CreateWebhookRequest */ @@ -958,13 +945,13 @@ export interface CreateWebhookRequest { */ 'network_id': string; /** - * + * * @type {WebhookEventType} * @memberof CreateWebhookRequest */ 'event_type': WebhookEventType; /** - * + * * @type {WebhookEventTypeFilter} * @memberof CreateWebhookRequest */ @@ -1003,14 +990,14 @@ export interface CryptoAmount { */ 'amount': string; /** - * + * * @type {Asset} * @memberof CryptoAmount */ 'asset': Asset; } /** - * + * * @export * @interface DeploySmartContractRequest */ @@ -1193,25 +1180,25 @@ export interface ERC721TransferEvent { 'tokenId'?: string; } /** - * + * * @export * @interface EthereumTokenTransfer */ export interface EthereumTokenTransfer { /** - * + * * @type {string} * @memberof EthereumTokenTransfer */ 'contract_address': string; /** - * + * * @type {string} * @memberof EthereumTokenTransfer */ 'from_address': string; /** - * + * * @type {string} * @memberof EthereumTokenTransfer */ @@ -1229,13 +1216,13 @@ export interface EthereumTokenTransfer { */ 'token_id'?: string; /** - * + * * @type {number} * @memberof EthereumTokenTransfer */ 'log_index': number; /** - * + * * @type {TokenTransferType} * @memberof EthereumTokenTransfer */ @@ -1244,7 +1231,7 @@ export interface EthereumTokenTransfer { /** - * + * * @export * @interface EthereumTransaction */ @@ -1328,19 +1315,19 @@ export interface EthereumTransaction { */ 'priority_fee_per_gas'?: number; /** - * + * * @type {EthereumTransactionAccessList} * @memberof EthereumTransaction */ 'transaction_access_list'?: EthereumTransactionAccessList; /** - * + * * @type {Array} * @memberof EthereumTransaction */ 'token_transfers'?: Array; /** - * + * * @type {Array} * @memberof EthereumTransaction */ @@ -1357,155 +1344,161 @@ export interface EthereumTransaction { * @memberof EthereumTransaction */ 'mint'?: string; + /** + * RLP encoded transaction as a hex string (prefixed with 0x) for native compatibility with popular eth clients such as etherjs, viem etc. + * @type {string} + * @memberof EthereumTransaction + */ + 'rlp_encoded_tx'?: string; } /** - * + * * @export * @interface EthereumTransactionAccess */ export interface EthereumTransactionAccess { /** - * + * * @type {string} * @memberof EthereumTransactionAccess */ 'address'?: string; /** - * + * * @type {Array} * @memberof EthereumTransactionAccess */ 'storage_keys'?: Array; } /** - * + * * @export * @interface EthereumTransactionAccessList */ export interface EthereumTransactionAccessList { /** - * + * * @type {Array} * @memberof EthereumTransactionAccessList */ 'access_list'?: Array; } /** - * + * * @export * @interface EthereumTransactionFlattenedTrace */ export interface EthereumTransactionFlattenedTrace { /** - * + * * @type {string} * @memberof EthereumTransactionFlattenedTrace */ 'error'?: string; /** - * + * * @type {string} * @memberof EthereumTransactionFlattenedTrace */ 'type'?: string; /** - * + * * @type {string} * @memberof EthereumTransactionFlattenedTrace */ 'from'?: string; /** - * + * * @type {string} * @memberof EthereumTransactionFlattenedTrace */ 'to'?: string; /** - * + * * @type {string} * @memberof EthereumTransactionFlattenedTrace */ 'value'?: string; /** - * + * * @type {number} * @memberof EthereumTransactionFlattenedTrace */ 'gas'?: number; /** - * + * * @type {number} * @memberof EthereumTransactionFlattenedTrace */ 'gas_used'?: number; /** - * + * * @type {string} * @memberof EthereumTransactionFlattenedTrace */ 'input'?: string; /** - * + * * @type {string} * @memberof EthereumTransactionFlattenedTrace */ 'output'?: string; /** - * + * * @type {number} * @memberof EthereumTransactionFlattenedTrace */ 'sub_traces'?: number; /** - * + * * @type {Array} * @memberof EthereumTransactionFlattenedTrace */ 'trace_address'?: Array; /** - * + * * @type {string} * @memberof EthereumTransactionFlattenedTrace */ 'trace_type'?: string; /** - * + * * @type {string} * @memberof EthereumTransactionFlattenedTrace */ 'call_type'?: string; /** - * + * * @type {string} * @memberof EthereumTransactionFlattenedTrace */ 'trace_id'?: string; /** - * + * * @type {number} * @memberof EthereumTransactionFlattenedTrace */ 'status'?: number; /** - * + * * @type {string} * @memberof EthereumTransactionFlattenedTrace */ 'block_hash'?: string; /** - * + * * @type {number} * @memberof EthereumTransactionFlattenedTrace */ 'block_number'?: number; /** - * + * * @type {string} * @memberof EthereumTransactionFlattenedTrace */ 'transaction_hash'?: string; /** - * + * * @type {number} * @memberof EthereumTransactionFlattenedTrace */ @@ -1560,13 +1553,13 @@ export interface EthereumValidatorMetadata { */ 'withdrawableEpoch': string; /** - * + * * @type {Balance} * @memberof EthereumValidatorMetadata */ 'balance': Balance; /** - * + * * @type {Balance} * @memberof EthereumValidatorMetadata */ @@ -1591,14 +1584,14 @@ export interface FaucetTransaction { */ 'transaction_link': string; /** - * + * * @type {Transaction} * @memberof FaucetTransaction */ 'transaction': Transaction; } /** - * + * * @export * @interface FeatureSet */ @@ -1641,13 +1634,13 @@ export interface FeatureSet { 'gasless_send': boolean; } /** - * + * * @export * @interface FetchHistoricalStakingBalances200Response */ export interface FetchHistoricalStakingBalances200Response { /** - * + * * @type {Array} * @memberof FetchHistoricalStakingBalances200Response */ @@ -1666,13 +1659,13 @@ export interface FetchHistoricalStakingBalances200Response { 'next_page': string; } /** - * + * * @export * @interface FetchStakingRewards200Response */ export interface FetchStakingRewards200Response { /** - * + * * @type {Array} * @memberof FetchStakingRewards200Response */ @@ -1691,7 +1684,7 @@ export interface FetchStakingRewards200Response { 'next_page': string; } /** - * + * * @export * @interface FetchStakingRewardsRequest */ @@ -1727,7 +1720,7 @@ export interface FetchStakingRewardsRequest { */ 'end_time': string; /** - * + * * @type {StakingRewardFormat} * @memberof FetchStakingRewardsRequest */ @@ -1785,19 +1778,19 @@ export interface FundOperation { */ 'address_id': string; /** - * + * * @type {CryptoAmount} * @memberof FundOperation */ 'crypto_amount': CryptoAmount; /** - * + * * @type {FiatAmount} * @memberof FundOperation */ 'fiat_amount': FiatAmount; /** - * + * * @type {FundOperationFees} * @memberof FundOperation */ @@ -1825,13 +1818,13 @@ export type FundOperationStatusEnum = typeof FundOperationStatusEnum[keyof typeo */ export interface FundOperationFees { /** - * + * * @type {FiatAmount} * @memberof FundOperationFees */ 'buy_fee': FiatAmount; /** - * + * * @type {CryptoAmount} * @memberof FundOperationFees */ @@ -1844,7 +1837,7 @@ export interface FundOperationFees { */ export interface FundOperationList { /** - * + * * @type {Array} * @memberof FundOperationList */ @@ -1899,13 +1892,13 @@ export interface FundQuote { */ 'address_id': string; /** - * + * * @type {CryptoAmount} * @memberof FundQuote */ 'crypto_amount': CryptoAmount; /** - * + * * @type {FiatAmount} * @memberof FundQuote */ @@ -1917,14 +1910,14 @@ export interface FundQuote { */ 'expires_at': string; /** - * + * * @type {FundOperationFees} * @memberof FundQuote */ 'fees': FundOperationFees; } /** - * + * * @export * @interface GetStakingContextRequest */ @@ -1979,7 +1972,7 @@ export interface HistoricalBalance { */ 'block_height': string; /** - * + * * @type {Asset} * @memberof HistoricalBalance */ @@ -2049,13 +2042,13 @@ export interface NFTContractOptions { 'base_uri': string; } /** - * + * * @export * @interface Network */ export interface Network { /** - * + * * @type {NetworkIdentifier} * @memberof Network */ @@ -2085,13 +2078,13 @@ export interface Network { */ 'is_testnet': boolean; /** - * + * * @type {Asset} * @memberof Network */ 'native_asset': Asset; /** - * + * * @type {FeatureSet} * @memberof Network */ @@ -2282,13 +2275,13 @@ export const PayloadSignatureStatusEnum = { export type PayloadSignatureStatusEnum = typeof PayloadSignatureStatusEnum[keyof typeof PayloadSignatureStatusEnum]; /** - * + * * @export * @interface PayloadSignatureList */ export interface PayloadSignatureList { /** - * + * * @type {Array} * @memberof PayloadSignatureList */ @@ -2313,7 +2306,7 @@ export interface PayloadSignatureList { 'total_count': number; } /** - * + * * @export * @interface ReadContractRequest */ @@ -2337,6 +2330,25 @@ export interface ReadContractRequest { */ 'abi'?: string; } +/** + * Smart Contract data to be registered + * @export + * @interface RegisterSmartContractRequest + */ +export interface RegisterSmartContractRequest { + /** + * ABI of the smart contract + * @type {string} + * @memberof RegisterSmartContractRequest + */ + 'abi': string; + /** + * Name of the smart contract + * @type {string} + * @memberof RegisterSmartContractRequest + */ + 'contract_name'?: string; +} /** * An event representing a seed creation. * @export @@ -2425,7 +2437,7 @@ export interface ServerSignerEvent { */ 'server_signer_id': string; /** - * + * * @type {ServerSignerEventEvent} * @memberof ServerSignerEvent */ @@ -2438,13 +2450,13 @@ export interface ServerSignerEvent { export type ServerSignerEventEvent = SeedCreationEvent | SignatureCreationEvent; /** - * + * * @export * @interface ServerSignerEventList */ export interface ServerSignerEventList { /** - * + * * @type {Array} * @memberof ServerSignerEventList */ @@ -2469,13 +2481,13 @@ export interface ServerSignerEventList { 'total_count': number; } /** - * + * * @export * @interface ServerSignerList */ export interface ServerSignerList { /** - * + * * @type {Array} * @memberof ServerSignerList */ @@ -2542,7 +2554,7 @@ export interface SignatureCreationEvent { */ 'signing_payload': string; /** - * + * * @type {TransactionType} * @memberof SignatureCreationEvent */ @@ -2581,7 +2593,7 @@ export interface SignatureCreationEventResult { */ 'address_id': string; /** - * + * * @type {TransactionType} * @memberof SignatureCreationEventResult */ @@ -2633,7 +2645,7 @@ export interface SignedVoluntaryExitMessageMetadata { */ export interface SmartContract { /** - * The unique identifier of the smart contract + * The unique identifier of the smart contract. * @type {string} * @memberof SmartContract */ @@ -2645,11 +2657,11 @@ export interface SmartContract { */ 'network_id': string; /** - * The ID of the wallet that deployed the smart contract + * The ID of the wallet that deployed the smart contract. If this smart contract was deployed externally, this will be omitted. * @type {string} * @memberof SmartContract */ - 'wallet_id': string; + 'wallet_id'?: string; /** * The EVM address of the smart contract * @type {string} @@ -2657,23 +2669,29 @@ export interface SmartContract { */ 'contract_address': string; /** - * The EVM address of the account that deployed the smart contract + * The name of the smart contract * @type {string} * @memberof SmartContract */ - 'deployer_address': string; + 'contract_name': string; /** - * + * The EVM address of the account that deployed the smart contract. If this smart contract was deployed externally, this will be omitted. + * @type {string} + * @memberof SmartContract + */ + 'deployer_address'?: string; + /** + * * @type {SmartContractType} * @memberof SmartContract */ 'type': SmartContractType; /** - * + * * @type {SmartContractOptions} * @memberof SmartContract */ - 'options': SmartContractOptions; + 'options'?: SmartContractOptions; /** * The JSON-encoded ABI of the contract * @type {string} @@ -2681,11 +2699,17 @@ export interface SmartContract { */ 'abi': string; /** - * + * * @type {Transaction} * @memberof SmartContract */ - 'transaction': Transaction; + 'transaction'?: Transaction; + /** + * Whether the smart contract was deployed externally. If true, the deployer_address and transaction will be omitted. + * @type {boolean} + * @memberof SmartContract + */ + 'is_external': boolean; } @@ -2805,13 +2829,13 @@ export interface SmartContractActivityEvent { 'value'?: number; } /** - * + * * @export * @interface SmartContractList */ export interface SmartContractList { /** - * + * * @type {Array} * @memberof SmartContractList */ @@ -2845,20 +2869,21 @@ export type SmartContractOptions = MultiTokenContractOptions | NFTContractOption export const SmartContractType = { Erc20: 'erc20', Erc721: 'erc721', - Erc1155: 'erc1155' + Erc1155: 'erc1155', + Custom: 'custom' } as const; export type SmartContractType = typeof SmartContractType[keyof typeof SmartContractType]; /** - * + * * @export * @interface SolidityValue */ export interface SolidityValue { /** - * + * * @type {string} * @memberof SolidityValue */ @@ -3020,13 +3045,13 @@ export interface StakingBalance { */ 'date': string; /** - * + * * @type {Balance} * @memberof StakingBalance */ 'bonded_stake': Balance; /** - * + * * @type {Balance} * @memberof StakingBalance */ @@ -3045,32 +3070,32 @@ export interface StakingBalance { */ export interface StakingContext { /** - * + * * @type {StakingContextContext} * @memberof StakingContext */ 'context': StakingContextContext; } /** - * + * * @export * @interface StakingContextContext */ export interface StakingContextContext { /** - * + * * @type {Balance} * @memberof StakingContextContext */ 'stakeable_balance': Balance; /** - * + * * @type {Balance} * @memberof StakingContextContext */ 'unstakeable_balance': Balance; /** - * + * * @type {Balance} * @memberof StakingContextContext */ @@ -3119,7 +3144,7 @@ export interface StakingOperation { */ 'transactions': Array; /** - * + * * @type {StakingOperationMetadata} * @memberof StakingOperation */ @@ -3172,13 +3197,13 @@ export interface StakingReward { */ 'state': StakingRewardStateEnum; /** - * + * * @type {StakingRewardFormat} * @memberof StakingReward */ 'format': StakingRewardFormat; /** - * + * * @type {StakingRewardUSDValue} * @memberof StakingReward */ @@ -3309,7 +3334,7 @@ export interface Trade { */ 'from_amount': string; /** - * + * * @type {Asset} * @memberof Trade */ @@ -3321,32 +3346,32 @@ export interface Trade { */ 'to_amount': string; /** - * + * * @type {Asset} * @memberof Trade */ 'to_asset': Asset; /** - * + * * @type {Transaction} * @memberof Trade */ 'transaction': Transaction; /** - * + * * @type {Transaction} * @memberof Trade */ 'approve_transaction'?: Transaction; } /** - * + * * @export * @interface TradeList */ export interface TradeList { /** - * + * * @type {Array} * @memberof TradeList */ @@ -3437,7 +3462,7 @@ export interface Transaction { */ 'status': TransactionStatusEnum; /** - * + * * @type {TransactionContent} * @memberof Transaction */ @@ -3462,7 +3487,7 @@ export type TransactionStatusEnum = typeof TransactionStatusEnum[keyof typeof Tr export type TransactionContent = EthereumTransaction; /** - * + * * @export * @enum {string} */ @@ -3511,13 +3536,14 @@ export interface Transfer { */ 'amount': string; /** - * The ID of the asset being transferred + * The ID of the asset being transferred. Use `asset.asset_id` instead. * @type {string} * @memberof Transfer + * @deprecated */ 'asset_id': string; /** - * + * * @type {Asset} * @memberof Transfer */ @@ -3529,13 +3555,13 @@ export interface Transfer { */ 'transfer_id': string; /** - * + * * @type {Transaction} * @memberof Transfer */ 'transaction'?: Transaction; /** - * + * * @type {SponsoredSend} * @memberof Transfer */ @@ -3544,26 +3570,30 @@ export interface Transfer { * The unsigned payload of the transfer. This is the payload that needs to be signed by the sender. * @type {string} * @memberof Transfer + * @deprecated */ 'unsigned_payload'?: string; /** * The signed payload of the transfer. This is the payload that has been signed by the sender. * @type {string} * @memberof Transfer + * @deprecated */ 'signed_payload'?: string; /** * The hash of the transfer transaction * @type {string} * @memberof Transfer + * @deprecated */ 'transaction_hash'?: string; /** - * The status of the transfer + * * @type {string} * @memberof Transfer + * @deprecated */ - 'status'?: TransferStatusEnum; + 'status'?: string; /** * Whether the transfer uses sponsored gas * @type {boolean} @@ -3571,24 +3601,14 @@ export interface Transfer { */ 'gasless': boolean; } - -export const TransferStatusEnum = { - Pending: 'pending', - Broadcast: 'broadcast', - Complete: 'complete', - Failed: 'failed' -} as const; - -export type TransferStatusEnum = typeof TransferStatusEnum[keyof typeof TransferStatusEnum]; - /** - * + * * @export * @interface TransferList */ export interface TransferList { /** - * + * * @type {Array} * @memberof TransferList */ @@ -3613,13 +3633,32 @@ export interface TransferList { 'total_count': number; } /** - * + * Smart Contract data to be updated + * @export + * @interface UpdateSmartContractRequest + */ +export interface UpdateSmartContractRequest { + /** + * ABI of the smart contract + * @type {string} + * @memberof UpdateSmartContractRequest + */ + 'abi'?: string; + /** + * Name of the smart contract + * @type {string} + * @memberof UpdateSmartContractRequest + */ + 'contract_name'?: string; +} +/** + * * @export * @interface UpdateWebhookRequest */ export interface UpdateWebhookRequest { /** - * + * * @type {WebhookEventTypeFilter} * @memberof UpdateWebhookRequest */ @@ -3638,7 +3677,7 @@ export interface UpdateWebhookRequest { 'notification_uri'?: string; } /** - * + * * @export * @interface User */ @@ -3650,7 +3689,7 @@ export interface User { */ 'id': string; /** - * + * * @type {string} * @memberof User */ @@ -3681,13 +3720,13 @@ export interface Validator { */ 'asset_id': string; /** - * + * * @type {ValidatorStatus} * @memberof Validator */ 'status': ValidatorStatus; /** - * + * * @type {ValidatorDetails} * @memberof Validator */ @@ -3702,13 +3741,13 @@ export interface Validator { export type ValidatorDetails = EthereumValidatorMetadata; /** - * + * * @export * @interface ValidatorList */ export interface ValidatorList { /** - * + * * @type {Array} * @memberof ValidatorList */ @@ -3752,7 +3791,7 @@ export type ValidatorStatus = typeof ValidatorStatus[keyof typeof ValidatorStatu /** - * + * * @export * @interface Wallet */ @@ -3770,13 +3809,13 @@ export interface Wallet { */ 'network_id': string; /** - * + * * @type {Address} * @memberof Wallet */ 'default_address'?: Address; /** - * + * * @type {FeatureSet} * @memberof Wallet */ @@ -3803,7 +3842,7 @@ export type WalletServerSignerStatusEnum = typeof WalletServerSignerStatusEnum[k */ export interface WalletList { /** - * + * * @type {Array} * @memberof WalletList */ @@ -3846,13 +3885,13 @@ export interface Webhook { */ 'network_id'?: string; /** - * + * * @type {WebhookEventType} * @memberof Webhook */ 'event_type'?: WebhookEventType; /** - * + * * @type {WebhookEventTypeFilter} * @memberof Webhook */ @@ -3916,7 +3955,7 @@ export interface WebhookEventFilter { 'to_address'?: string; } /** - * + * * @export * @enum {string} */ @@ -3940,13 +3979,13 @@ export type WebhookEventType = typeof WebhookEventType[keyof typeof WebhookEvent export type WebhookEventTypeFilter = WebhookSmartContractEventFilter | WebhookWalletActivityFilter; /** - * + * * @export * @interface WebhookList */ export interface WebhookList { /** - * + * * @type {Array} * @memberof WebhookList */ @@ -3965,7 +4004,7 @@ export interface WebhookList { 'next_page'?: string; } /** - * Filter for smart contract events. This filter allows the client to specify smart contract addresses to monitor for activities such as contract function calls. + * Filter for smart contract events. This filter allows the client to specify smart contract addresses to monitor for activities such as contract function calls. * @export * @interface WebhookSmartContractEventFilter */ @@ -3978,7 +4017,7 @@ export interface WebhookSmartContractEventFilter { 'contract_addresses': Array; } /** - * 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. + * 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. * @export * @interface WebhookWalletActivityFilter */ @@ -3994,7 +4033,7 @@ export interface WebhookWalletActivityFilter { * @type {string} * @memberof WebhookWalletActivityFilter */ - 'wallet_id'?: string; + 'wallet_id': string; } /** @@ -4007,7 +4046,7 @@ export const AddressesApiAxiosParamCreator = function (configuration?: Configura * Create a new address scoped to the wallet. * @summary Create a new address * @param {string} walletId The ID of the wallet to create the address in. - * @param {CreateAddressRequest} [createAddressRequest] + * @param {CreateAddressRequest} [createAddressRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -4027,8 +4066,11 @@ export const AddressesApiAxiosParamCreator = function (configuration?: Configura const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + localVarHeaderParameter['Content-Type'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); @@ -4046,7 +4088,7 @@ export const AddressesApiAxiosParamCreator = function (configuration?: Configura * @summary Create a new payload signature. * @param {string} walletId The ID of the wallet the address belongs to. * @param {string} addressId The onchain address of the address to sign the payload with. - * @param {CreatePayloadSignatureRequest} [createPayloadSignatureRequest] + * @param {CreatePayloadSignatureRequest} [createPayloadSignatureRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -4069,8 +4111,11 @@ export const AddressesApiAxiosParamCreator = function (configuration?: Configura const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + localVarHeaderParameter['Content-Type'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); @@ -4110,8 +4155,14 @@ export const AddressesApiAxiosParamCreator = function (configuration?: Configura const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + + // authentication session required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -4152,8 +4203,14 @@ export const AddressesApiAxiosParamCreator = function (configuration?: Configura const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + // authentication session required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -4194,8 +4251,14 @@ export const AddressesApiAxiosParamCreator = function (configuration?: Configura const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + + // authentication session required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -4233,12 +4296,18 @@ export const AddressesApiAxiosParamCreator = function (configuration?: Configura const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + + // authentication session required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + if (page !== undefined) { localVarQueryParameter['page'] = page; } - + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -4273,6 +4342,12 @@ export const AddressesApiAxiosParamCreator = function (configuration?: Configura const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + + // authentication session required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + if (limit !== undefined) { localVarQueryParameter['limit'] = limit; } @@ -4282,7 +4357,7 @@ export const AddressesApiAxiosParamCreator = function (configuration?: Configura } - + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -4321,6 +4396,12 @@ export const AddressesApiAxiosParamCreator = function (configuration?: Configura const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + + // authentication session required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + if (limit !== undefined) { localVarQueryParameter['limit'] = limit; } @@ -4330,7 +4411,7 @@ export const AddressesApiAxiosParamCreator = function (configuration?: Configura } - + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -4369,12 +4450,15 @@ export const AddressesApiAxiosParamCreator = function (configuration?: Configura const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + if (assetId !== undefined) { localVarQueryParameter['asset_id'] = assetId; } - + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -4398,7 +4482,7 @@ export const AddressesApiFp = function(configuration?: Configuration) { * Create a new address scoped to the wallet. * @summary Create a new address * @param {string} walletId The ID of the wallet to create the address in. - * @param {CreateAddressRequest} [createAddressRequest] + * @param {CreateAddressRequest} [createAddressRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -4413,7 +4497,7 @@ export const AddressesApiFp = function(configuration?: Configuration) { * @summary Create a new payload signature. * @param {string} walletId The ID of the wallet the address belongs to. * @param {string} addressId The onchain address of the address to sign the payload with. - * @param {CreatePayloadSignatureRequest} [createPayloadSignatureRequest] + * @param {CreatePayloadSignatureRequest} [createPayloadSignatureRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -4543,7 +4627,7 @@ export const AddressesApiFactory = function (configuration?: Configuration, base * Create a new address scoped to the wallet. * @summary Create a new address * @param {string} walletId The ID of the wallet to create the address in. - * @param {CreateAddressRequest} [createAddressRequest] + * @param {CreateAddressRequest} [createAddressRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -4555,7 +4639,7 @@ export const AddressesApiFactory = function (configuration?: Configuration, base * @summary Create a new payload signature. * @param {string} walletId The ID of the wallet the address belongs to. * @param {string} addressId The onchain address of the address to sign the payload with. - * @param {CreatePayloadSignatureRequest} [createPayloadSignatureRequest] + * @param {CreatePayloadSignatureRequest} [createPayloadSignatureRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -4660,7 +4744,7 @@ export interface AddressesApiInterface { * Create a new address scoped to the wallet. * @summary Create a new address * @param {string} walletId The ID of the wallet to create the address in. - * @param {CreateAddressRequest} [createAddressRequest] + * @param {CreateAddressRequest} [createAddressRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AddressesApiInterface @@ -4672,7 +4756,7 @@ export interface AddressesApiInterface { * @summary Create a new payload signature. * @param {string} walletId The ID of the wallet the address belongs to. * @param {string} addressId The onchain address of the address to sign the payload with. - * @param {CreatePayloadSignatureRequest} [createPayloadSignatureRequest] + * @param {CreatePayloadSignatureRequest} [createPayloadSignatureRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AddressesApiInterface @@ -4777,7 +4861,7 @@ export class AddressesApi extends BaseAPI implements AddressesApiInterface { * Create a new address scoped to the wallet. * @summary Create a new address * @param {string} walletId The ID of the wallet to create the address in. - * @param {CreateAddressRequest} [createAddressRequest] + * @param {CreateAddressRequest} [createAddressRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AddressesApi @@ -4791,7 +4875,7 @@ export class AddressesApi extends BaseAPI implements AddressesApiInterface { * @summary Create a new payload signature. * @param {string} walletId The ID of the wallet the address belongs to. * @param {string} addressId The onchain address of the address to sign the payload with. - * @param {CreatePayloadSignatureRequest} [createPayloadSignatureRequest] + * @param {CreatePayloadSignatureRequest} [createPayloadSignatureRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AddressesApi @@ -4935,8 +5019,14 @@ export const AssetsApiAxiosParamCreator = function (configuration?: Configuratio const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + // authentication session required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -5075,6 +5165,12 @@ export const BalanceHistoryApiAxiosParamCreator = function (configuration?: Conf const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + + // authentication session required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + if (limit !== undefined) { localVarQueryParameter['limit'] = limit; } @@ -5084,7 +5180,7 @@ export const BalanceHistoryApiAxiosParamCreator = function (configuration?: Conf } - + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -5245,6 +5341,12 @@ export const ContractEventsApiAxiosParamCreator = function (configuration?: Conf const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + + // authentication session required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + if (protocolName !== undefined) { localVarQueryParameter['protocol_name'] = protocolName; } @@ -5270,7 +5372,7 @@ export const ContractEventsApiAxiosParamCreator = function (configuration?: Conf } - + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -5406,7 +5508,7 @@ export const ContractInvocationsApiAxiosParamCreator = function (configuration?: * @param {string} walletId The ID of the wallet the address belongs to. * @param {string} addressId The ID of the address the contract invocation belongs to. * @param {string} contractInvocationId The ID of the contract invocation to broadcast. - * @param {BroadcastContractInvocationRequest} broadcastContractInvocationRequest + * @param {BroadcastContractInvocationRequest} broadcastContractInvocationRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -5434,8 +5536,11 @@ export const ContractInvocationsApiAxiosParamCreator = function (configuration?: const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + localVarHeaderParameter['Content-Type'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); @@ -5453,7 +5558,7 @@ export const ContractInvocationsApiAxiosParamCreator = function (configuration?: * @summary Create a new contract invocation for an address. * @param {string} walletId The ID of the wallet the source address belongs to. * @param {string} addressId The ID of the address to invoke the contract from. - * @param {CreateContractInvocationRequest} createContractInvocationRequest + * @param {CreateContractInvocationRequest} createContractInvocationRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -5478,8 +5583,11 @@ export const ContractInvocationsApiAxiosParamCreator = function (configuration?: const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + localVarHeaderParameter['Content-Type'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); @@ -5523,8 +5631,14 @@ export const ContractInvocationsApiAxiosParamCreator = function (configuration?: const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + // authentication session required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -5563,6 +5677,12 @@ export const ContractInvocationsApiAxiosParamCreator = function (configuration?: const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + + // authentication session required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + if (limit !== undefined) { localVarQueryParameter['limit'] = limit; } @@ -5572,7 +5692,7 @@ export const ContractInvocationsApiAxiosParamCreator = function (configuration?: } - + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -5598,7 +5718,7 @@ export const ContractInvocationsApiFp = function(configuration?: Configuration) * @param {string} walletId The ID of the wallet the address belongs to. * @param {string} addressId The ID of the address the contract invocation belongs to. * @param {string} contractInvocationId The ID of the contract invocation to broadcast. - * @param {BroadcastContractInvocationRequest} broadcastContractInvocationRequest + * @param {BroadcastContractInvocationRequest} broadcastContractInvocationRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -5613,7 +5733,7 @@ export const ContractInvocationsApiFp = function(configuration?: Configuration) * @summary Create a new contract invocation for an address. * @param {string} walletId The ID of the wallet the source address belongs to. * @param {string} addressId The ID of the address to invoke the contract from. - * @param {CreateContractInvocationRequest} createContractInvocationRequest + * @param {CreateContractInvocationRequest} createContractInvocationRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -5670,7 +5790,7 @@ export const ContractInvocationsApiFactory = function (configuration?: Configura * @param {string} walletId The ID of the wallet the address belongs to. * @param {string} addressId The ID of the address the contract invocation belongs to. * @param {string} contractInvocationId The ID of the contract invocation to broadcast. - * @param {BroadcastContractInvocationRequest} broadcastContractInvocationRequest + * @param {BroadcastContractInvocationRequest} broadcastContractInvocationRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -5682,7 +5802,7 @@ export const ContractInvocationsApiFactory = function (configuration?: Configura * @summary Create a new contract invocation for an address. * @param {string} walletId The ID of the wallet the source address belongs to. * @param {string} addressId The ID of the address to invoke the contract from. - * @param {CreateContractInvocationRequest} createContractInvocationRequest + * @param {CreateContractInvocationRequest} createContractInvocationRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -5729,7 +5849,7 @@ export interface ContractInvocationsApiInterface { * @param {string} walletId The ID of the wallet the address belongs to. * @param {string} addressId The ID of the address the contract invocation belongs to. * @param {string} contractInvocationId The ID of the contract invocation to broadcast. - * @param {BroadcastContractInvocationRequest} broadcastContractInvocationRequest + * @param {BroadcastContractInvocationRequest} broadcastContractInvocationRequest * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ContractInvocationsApiInterface @@ -5741,7 +5861,7 @@ export interface ContractInvocationsApiInterface { * @summary Create a new contract invocation for an address. * @param {string} walletId The ID of the wallet the source address belongs to. * @param {string} addressId The ID of the address to invoke the contract from. - * @param {CreateContractInvocationRequest} createContractInvocationRequest + * @param {CreateContractInvocationRequest} createContractInvocationRequest * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ContractInvocationsApiInterface @@ -5788,7 +5908,7 @@ export class ContractInvocationsApi extends BaseAPI implements ContractInvocatio * @param {string} walletId The ID of the wallet the address belongs to. * @param {string} addressId The ID of the address the contract invocation belongs to. * @param {string} contractInvocationId The ID of the contract invocation to broadcast. - * @param {BroadcastContractInvocationRequest} broadcastContractInvocationRequest + * @param {BroadcastContractInvocationRequest} broadcastContractInvocationRequest * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ContractInvocationsApi @@ -5802,7 +5922,7 @@ export class ContractInvocationsApi extends BaseAPI implements ContractInvocatio * @summary Create a new contract invocation for an address. * @param {string} walletId The ID of the wallet the source address belongs to. * @param {string} addressId The ID of the address to invoke the contract from. - * @param {CreateContractInvocationRequest} createContractInvocationRequest + * @param {CreateContractInvocationRequest} createContractInvocationRequest * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ContractInvocationsApi @@ -5880,8 +6000,14 @@ export const ExternalAddressesApiAxiosParamCreator = function (configuration?: C const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + + // authentication session required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -5922,8 +6048,14 @@ export const ExternalAddressesApiAxiosParamCreator = function (configuration?: C const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + + // authentication session required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -5961,12 +6093,18 @@ export const ExternalAddressesApiAxiosParamCreator = function (configuration?: C const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + + // authentication session required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + if (page !== undefined) { localVarQueryParameter['page'] = page; } - + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -6005,6 +6143,12 @@ export const ExternalAddressesApiAxiosParamCreator = function (configuration?: C const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + + // authentication session required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + if (assetId !== undefined) { localVarQueryParameter['asset_id'] = assetId; } @@ -6014,7 +6158,7 @@ export const ExternalAddressesApiAxiosParamCreator = function (configuration?: C } - + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -6292,7 +6436,7 @@ export const FundApiAxiosParamCreator = function (configuration?: Configuration) * @summary Create a new fund operation. * @param {string} walletId The ID of the wallet the address belongs to. * @param {string} addressId The onchain address to be funded. - * @param {CreateFundOperationRequest} createFundOperationRequest + * @param {CreateFundOperationRequest} createFundOperationRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -6317,8 +6461,11 @@ export const FundApiAxiosParamCreator = function (configuration?: Configuration) const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + localVarHeaderParameter['Content-Type'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); @@ -6336,7 +6483,7 @@ export const FundApiAxiosParamCreator = function (configuration?: Configuration) * @summary Create a Fund Operation quote. * @param {string} walletId The ID of the wallet the address belongs to. * @param {string} addressId The onchain address to be funded. - * @param {CreateFundQuoteRequest} createFundQuoteRequest + * @param {CreateFundQuoteRequest} createFundQuoteRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -6361,8 +6508,11 @@ export const FundApiAxiosParamCreator = function (configuration?: Configuration) const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + localVarHeaderParameter['Content-Type'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); @@ -6406,8 +6556,14 @@ export const FundApiAxiosParamCreator = function (configuration?: Configuration) const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + + // authentication session required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -6446,6 +6602,12 @@ export const FundApiAxiosParamCreator = function (configuration?: Configuration) const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + + // authentication session required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + if (limit !== undefined) { localVarQueryParameter['limit'] = limit; } @@ -6455,7 +6617,7 @@ export const FundApiAxiosParamCreator = function (configuration?: Configuration) } - + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -6480,7 +6642,7 @@ export const FundApiFp = function(configuration?: Configuration) { * @summary Create a new fund operation. * @param {string} walletId The ID of the wallet the address belongs to. * @param {string} addressId The onchain address to be funded. - * @param {CreateFundOperationRequest} createFundOperationRequest + * @param {CreateFundOperationRequest} createFundOperationRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -6495,7 +6657,7 @@ export const FundApiFp = function(configuration?: Configuration) { * @summary Create a Fund Operation quote. * @param {string} walletId The ID of the wallet the address belongs to. * @param {string} addressId The onchain address to be funded. - * @param {CreateFundQuoteRequest} createFundQuoteRequest + * @param {CreateFundQuoteRequest} createFundQuoteRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -6551,7 +6713,7 @@ export const FundApiFactory = function (configuration?: Configuration, basePath? * @summary Create a new fund operation. * @param {string} walletId The ID of the wallet the address belongs to. * @param {string} addressId The onchain address to be funded. - * @param {CreateFundOperationRequest} createFundOperationRequest + * @param {CreateFundOperationRequest} createFundOperationRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -6563,7 +6725,7 @@ export const FundApiFactory = function (configuration?: Configuration, basePath? * @summary Create a Fund Operation quote. * @param {string} walletId The ID of the wallet the address belongs to. * @param {string} addressId The onchain address to be funded. - * @param {CreateFundQuoteRequest} createFundQuoteRequest + * @param {CreateFundQuoteRequest} createFundQuoteRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -6609,7 +6771,7 @@ export interface FundApiInterface { * @summary Create a new fund operation. * @param {string} walletId The ID of the wallet the address belongs to. * @param {string} addressId The onchain address to be funded. - * @param {CreateFundOperationRequest} createFundOperationRequest + * @param {CreateFundOperationRequest} createFundOperationRequest * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof FundApiInterface @@ -6621,7 +6783,7 @@ export interface FundApiInterface { * @summary Create a Fund Operation quote. * @param {string} walletId The ID of the wallet the address belongs to. * @param {string} addressId The onchain address to be funded. - * @param {CreateFundQuoteRequest} createFundQuoteRequest + * @param {CreateFundQuoteRequest} createFundQuoteRequest * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof FundApiInterface @@ -6667,7 +6829,7 @@ export class FundApi extends BaseAPI implements FundApiInterface { * @summary Create a new fund operation. * @param {string} walletId The ID of the wallet the address belongs to. * @param {string} addressId The onchain address to be funded. - * @param {CreateFundOperationRequest} createFundOperationRequest + * @param {CreateFundOperationRequest} createFundOperationRequest * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof FundApi @@ -6681,7 +6843,7 @@ export class FundApi extends BaseAPI implements FundApiInterface { * @summary Create a Fund Operation quote. * @param {string} walletId The ID of the wallet the address belongs to. * @param {string} addressId The onchain address to be funded. - * @param {CreateFundQuoteRequest} createFundQuoteRequest + * @param {CreateFundQuoteRequest} createFundQuoteRequest * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof FundApi @@ -6734,7 +6896,7 @@ export const MPCWalletStakeApiAxiosParamCreator = function (configuration?: Conf * @param {string} walletId The ID of the wallet the address belongs to. * @param {string} addressId The ID of the address the staking operation belongs to. * @param {string} stakingOperationId The ID of the staking operation to broadcast. - * @param {BroadcastStakingOperationRequest} broadcastStakingOperationRequest + * @param {BroadcastStakingOperationRequest} broadcastStakingOperationRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -6762,8 +6924,11 @@ export const MPCWalletStakeApiAxiosParamCreator = function (configuration?: Conf const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + localVarHeaderParameter['Content-Type'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); @@ -6781,7 +6946,7 @@ export const MPCWalletStakeApiAxiosParamCreator = function (configuration?: Conf * @summary Create a new staking operation for an address * @param {string} walletId The ID of the wallet the address belongs to. * @param {string} addressId The ID of the address to create the staking operation for. - * @param {CreateStakingOperationRequest} createStakingOperationRequest + * @param {CreateStakingOperationRequest} createStakingOperationRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -6806,8 +6971,11 @@ export const MPCWalletStakeApiAxiosParamCreator = function (configuration?: Conf const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + localVarHeaderParameter['Content-Type'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); @@ -6851,8 +7019,14 @@ export const MPCWalletStakeApiAxiosParamCreator = function (configuration?: Conf const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + // authentication session required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -6878,7 +7052,7 @@ export const MPCWalletStakeApiFp = function(configuration?: Configuration) { * @param {string} walletId The ID of the wallet the address belongs to. * @param {string} addressId The ID of the address the staking operation belongs to. * @param {string} stakingOperationId The ID of the staking operation to broadcast. - * @param {BroadcastStakingOperationRequest} broadcastStakingOperationRequest + * @param {BroadcastStakingOperationRequest} broadcastStakingOperationRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -6893,7 +7067,7 @@ export const MPCWalletStakeApiFp = function(configuration?: Configuration) { * @summary Create a new staking operation for an address * @param {string} walletId The ID of the wallet the address belongs to. * @param {string} addressId The ID of the address to create the staking operation for. - * @param {CreateStakingOperationRequest} createStakingOperationRequest + * @param {CreateStakingOperationRequest} createStakingOperationRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -6934,7 +7108,7 @@ export const MPCWalletStakeApiFactory = function (configuration?: Configuration, * @param {string} walletId The ID of the wallet the address belongs to. * @param {string} addressId The ID of the address the staking operation belongs to. * @param {string} stakingOperationId The ID of the staking operation to broadcast. - * @param {BroadcastStakingOperationRequest} broadcastStakingOperationRequest + * @param {BroadcastStakingOperationRequest} broadcastStakingOperationRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -6946,7 +7120,7 @@ export const MPCWalletStakeApiFactory = function (configuration?: Configuration, * @summary Create a new staking operation for an address * @param {string} walletId The ID of the wallet the address belongs to. * @param {string} addressId The ID of the address to create the staking operation for. - * @param {CreateStakingOperationRequest} createStakingOperationRequest + * @param {CreateStakingOperationRequest} createStakingOperationRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -6980,7 +7154,7 @@ export interface MPCWalletStakeApiInterface { * @param {string} walletId The ID of the wallet the address belongs to. * @param {string} addressId The ID of the address the staking operation belongs to. * @param {string} stakingOperationId The ID of the staking operation to broadcast. - * @param {BroadcastStakingOperationRequest} broadcastStakingOperationRequest + * @param {BroadcastStakingOperationRequest} broadcastStakingOperationRequest * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof MPCWalletStakeApiInterface @@ -6992,7 +7166,7 @@ export interface MPCWalletStakeApiInterface { * @summary Create a new staking operation for an address * @param {string} walletId The ID of the wallet the address belongs to. * @param {string} addressId The ID of the address to create the staking operation for. - * @param {CreateStakingOperationRequest} createStakingOperationRequest + * @param {CreateStakingOperationRequest} createStakingOperationRequest * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof MPCWalletStakeApiInterface @@ -7026,7 +7200,7 @@ export class MPCWalletStakeApi extends BaseAPI implements MPCWalletStakeApiInter * @param {string} walletId The ID of the wallet the address belongs to. * @param {string} addressId The ID of the address the staking operation belongs to. * @param {string} stakingOperationId The ID of the staking operation to broadcast. - * @param {BroadcastStakingOperationRequest} broadcastStakingOperationRequest + * @param {BroadcastStakingOperationRequest} broadcastStakingOperationRequest * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof MPCWalletStakeApi @@ -7040,7 +7214,7 @@ export class MPCWalletStakeApi extends BaseAPI implements MPCWalletStakeApiInter * @summary Create a new staking operation for an address * @param {string} walletId The ID of the wallet the address belongs to. * @param {string} addressId The ID of the address to create the staking operation for. - * @param {CreateStakingOperationRequest} createStakingOperationRequest + * @param {CreateStakingOperationRequest} createStakingOperationRequest * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof MPCWalletStakeApi @@ -7095,8 +7269,14 @@ export const NetworksApiAxiosParamCreator = function (configuration?: Configurat const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + + // authentication session required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -7228,6 +7408,12 @@ export const OnchainIdentityApiAxiosParamCreator = function (configuration?: Con const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + + // authentication session required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + if (roles) { localVarQueryParameter['roles'] = roles.join(COLLECTION_FORMATS.csv); } @@ -7241,7 +7427,7 @@ export const OnchainIdentityApiAxiosParamCreator = function (configuration?: Con } - + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -7394,46 +7580,14 @@ export const ReputationApiAxiosParamCreator = function (configuration?: Configur const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Get the risk of an address - * @summary Get the risk of an address - * @param {string} networkId The ID of the blockchain network. - * @param {string} addressId The ID of the address to fetch the risk for. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getAddressRisk: async (networkId: string, addressId: string, options: RawAxiosRequestConfig = {}): Promise => { - // verify required parameter 'networkId' is not null or undefined - assertParamExists('getAddressRisk', 'networkId', networkId) - // verify required parameter 'addressId' is not null or undefined - assertParamExists('getAddressRisk', 'addressId', addressId) - const localVarPath = `/v1/networks/{network_id}/addresses/{address_id}/risk` - .replace(`{${"network_id"}}`, encodeURIComponent(String(networkId))) - .replace(`{${"address_id"}}`, encodeURIComponent(String(addressId))); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - let baseOptions; - if (configuration) { - baseOptions = configuration.baseOptions; - } - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - + // authentication session required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -7467,20 +7621,6 @@ export const ReputationApiFp = function(configuration?: Configuration) { const localVarOperationServerBasePath = operationServerMap['ReputationApi.getAddressReputation']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, - /** - * Get the risk of an address - * @summary Get the risk of an address - * @param {string} networkId The ID of the blockchain network. - * @param {string} addressId The ID of the address to fetch the risk for. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async getAddressRisk(networkId: string, addressId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.getAddressRisk(networkId, addressId, options); - const localVarOperationServerIndex = configuration?.serverIndex ?? 0; - const localVarOperationServerBasePath = operationServerMap['ReputationApi.getAddressRisk']?.[localVarOperationServerIndex]?.url; - return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); - }, } }; @@ -7502,17 +7642,6 @@ export const ReputationApiFactory = function (configuration?: Configuration, bas getAddressReputation(networkId: string, addressId: string, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.getAddressReputation(networkId, addressId, options).then((request) => request(axios, basePath)); }, - /** - * Get the risk of an address - * @summary Get the risk of an address - * @param {string} networkId The ID of the blockchain network. - * @param {string} addressId The ID of the address to fetch the risk for. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getAddressRisk(networkId: string, addressId: string, options?: RawAxiosRequestConfig): AxiosPromise { - return localVarFp.getAddressRisk(networkId, addressId, options).then((request) => request(axios, basePath)); - }, }; }; @@ -7533,17 +7662,6 @@ export interface ReputationApiInterface { */ getAddressReputation(networkId: string, addressId: string, options?: RawAxiosRequestConfig): AxiosPromise; - /** - * Get the risk of an address - * @summary Get the risk of an address - * @param {string} networkId The ID of the blockchain network. - * @param {string} addressId The ID of the address to fetch the risk for. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ReputationApiInterface - */ - getAddressRisk(networkId: string, addressId: string, options?: RawAxiosRequestConfig): AxiosPromise; - } /** @@ -7565,19 +7683,6 @@ export class ReputationApi extends BaseAPI implements ReputationApiInterface { public getAddressReputation(networkId: string, addressId: string, options?: RawAxiosRequestConfig) { return ReputationApiFp(this.configuration).getAddressReputation(networkId, addressId, options).then((request) => request(this.axios, this.basePath)); } - - /** - * Get the risk of an address - * @summary Get the risk of an address - * @param {string} networkId The ID of the blockchain network. - * @param {string} addressId The ID of the address to fetch the risk for. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ReputationApi - */ - public getAddressRisk(networkId: string, addressId: string, options?: RawAxiosRequestConfig) { - return ReputationApiFp(this.configuration).getAddressRisk(networkId, addressId, options).then((request) => request(this.axios, this.basePath)); - } } @@ -7591,7 +7696,7 @@ export const ServerSignersApiAxiosParamCreator = function (configuration?: Confi /** * Create a new Server-Signer * @summary Create a new Server-Signer - * @param {CreateServerSignerRequest} [createServerSignerRequest] + * @param {CreateServerSignerRequest} [createServerSignerRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -7608,8 +7713,11 @@ export const ServerSignersApiAxiosParamCreator = function (configuration?: Confi const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + localVarHeaderParameter['Content-Type'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); @@ -7645,8 +7753,14 @@ export const ServerSignersApiAxiosParamCreator = function (configuration?: Confi const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + + // authentication session required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -7682,6 +7796,9 @@ export const ServerSignersApiAxiosParamCreator = function (configuration?: Confi const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + if (limit !== undefined) { localVarQueryParameter['limit'] = limit; } @@ -7691,7 +7808,7 @@ export const ServerSignersApiAxiosParamCreator = function (configuration?: Confi } - + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -7722,6 +7839,12 @@ export const ServerSignersApiAxiosParamCreator = function (configuration?: Confi const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + + // authentication session required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + if (limit !== undefined) { localVarQueryParameter['limit'] = limit; } @@ -7731,7 +7854,7 @@ export const ServerSignersApiAxiosParamCreator = function (configuration?: Confi } - + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -7745,7 +7868,7 @@ export const ServerSignersApiAxiosParamCreator = function (configuration?: Confi * Submit the result of a server signer event * @summary Submit the result of a server signer event * @param {string} serverSignerId The ID of the server signer to submit the event result for - * @param {SeedCreationEventResult} [seedCreationEventResult] + * @param {SeedCreationEventResult} [seedCreationEventResult] * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -7765,8 +7888,11 @@ export const ServerSignersApiAxiosParamCreator = function (configuration?: Confi const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + localVarHeaderParameter['Content-Type'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); @@ -7783,7 +7909,7 @@ export const ServerSignersApiAxiosParamCreator = function (configuration?: Confi * Submit the result of a server signer event * @summary Submit the result of a server signer event * @param {string} serverSignerId The ID of the server signer to submit the event result for - * @param {SignatureCreationEventResult} [signatureCreationEventResult] + * @param {SignatureCreationEventResult} [signatureCreationEventResult] * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -7803,8 +7929,11 @@ export const ServerSignersApiAxiosParamCreator = function (configuration?: Confi const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + localVarHeaderParameter['Content-Type'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); @@ -7830,7 +7959,7 @@ export const ServerSignersApiFp = function(configuration?: Configuration) { /** * Create a new Server-Signer * @summary Create a new Server-Signer - * @param {CreateServerSignerRequest} [createServerSignerRequest] + * @param {CreateServerSignerRequest} [createServerSignerRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -7887,7 +8016,7 @@ export const ServerSignersApiFp = function(configuration?: Configuration) { * Submit the result of a server signer event * @summary Submit the result of a server signer event * @param {string} serverSignerId The ID of the server signer to submit the event result for - * @param {SeedCreationEventResult} [seedCreationEventResult] + * @param {SeedCreationEventResult} [seedCreationEventResult] * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -7901,7 +8030,7 @@ export const ServerSignersApiFp = function(configuration?: Configuration) { * Submit the result of a server signer event * @summary Submit the result of a server signer event * @param {string} serverSignerId The ID of the server signer to submit the event result for - * @param {SignatureCreationEventResult} [signatureCreationEventResult] + * @param {SignatureCreationEventResult} [signatureCreationEventResult] * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -7924,7 +8053,7 @@ export const ServerSignersApiFactory = function (configuration?: Configuration, /** * Create a new Server-Signer * @summary Create a new Server-Signer - * @param {CreateServerSignerRequest} [createServerSignerRequest] + * @param {CreateServerSignerRequest} [createServerSignerRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -7969,7 +8098,7 @@ export const ServerSignersApiFactory = function (configuration?: Configuration, * Submit the result of a server signer event * @summary Submit the result of a server signer event * @param {string} serverSignerId The ID of the server signer to submit the event result for - * @param {SeedCreationEventResult} [seedCreationEventResult] + * @param {SeedCreationEventResult} [seedCreationEventResult] * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -7980,7 +8109,7 @@ export const ServerSignersApiFactory = function (configuration?: Configuration, * Submit the result of a server signer event * @summary Submit the result of a server signer event * @param {string} serverSignerId The ID of the server signer to submit the event result for - * @param {SignatureCreationEventResult} [signatureCreationEventResult] + * @param {SignatureCreationEventResult} [signatureCreationEventResult] * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -7999,7 +8128,7 @@ export interface ServerSignersApiInterface { /** * Create a new Server-Signer * @summary Create a new Server-Signer - * @param {CreateServerSignerRequest} [createServerSignerRequest] + * @param {CreateServerSignerRequest} [createServerSignerRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ServerSignersApiInterface @@ -8044,7 +8173,7 @@ export interface ServerSignersApiInterface { * Submit the result of a server signer event * @summary Submit the result of a server signer event * @param {string} serverSignerId The ID of the server signer to submit the event result for - * @param {SeedCreationEventResult} [seedCreationEventResult] + * @param {SeedCreationEventResult} [seedCreationEventResult] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ServerSignersApiInterface @@ -8055,7 +8184,7 @@ export interface ServerSignersApiInterface { * Submit the result of a server signer event * @summary Submit the result of a server signer event * @param {string} serverSignerId The ID of the server signer to submit the event result for - * @param {SignatureCreationEventResult} [signatureCreationEventResult] + * @param {SignatureCreationEventResult} [signatureCreationEventResult] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ServerSignersApiInterface @@ -8074,7 +8203,7 @@ export class ServerSignersApi extends BaseAPI implements ServerSignersApiInterfa /** * Create a new Server-Signer * @summary Create a new Server-Signer - * @param {CreateServerSignerRequest} [createServerSignerRequest] + * @param {CreateServerSignerRequest} [createServerSignerRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ServerSignersApi @@ -8127,7 +8256,7 @@ export class ServerSignersApi extends BaseAPI implements ServerSignersApiInterfa * Submit the result of a server signer event * @summary Submit the result of a server signer event * @param {string} serverSignerId The ID of the server signer to submit the event result for - * @param {SeedCreationEventResult} [seedCreationEventResult] + * @param {SeedCreationEventResult} [seedCreationEventResult] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ServerSignersApi @@ -8140,7 +8269,7 @@ export class ServerSignersApi extends BaseAPI implements ServerSignersApiInterfa * Submit the result of a server signer event * @summary Submit the result of a server signer event * @param {string} serverSignerId The ID of the server signer to submit the event result for - * @param {SignatureCreationEventResult} [signatureCreationEventResult] + * @param {SignatureCreationEventResult} [signatureCreationEventResult] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ServerSignersApi @@ -8163,7 +8292,7 @@ export const SmartContractsApiAxiosParamCreator = function (configuration?: Conf * @summary Create a new smart contract * @param {string} walletId The ID of the wallet the address belongs to. * @param {string} addressId The ID of the address to deploy the smart contract from. - * @param {CreateSmartContractRequest} createSmartContractRequest + * @param {CreateSmartContractRequest} createSmartContractRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -8188,8 +8317,11 @@ export const SmartContractsApiAxiosParamCreator = function (configuration?: Conf const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + localVarHeaderParameter['Content-Type'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); @@ -8208,7 +8340,7 @@ export const SmartContractsApiAxiosParamCreator = function (configuration?: Conf * @param {string} walletId The ID of the wallet the address belongs to. * @param {string} addressId The ID of the address to broadcast the transaction from. * @param {string} smartContractId The UUID of the smart contract to broadcast the transaction to. - * @param {DeploySmartContractRequest} deploySmartContractRequest + * @param {DeploySmartContractRequest} deploySmartContractRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -8236,8 +8368,11 @@ export const SmartContractsApiAxiosParamCreator = function (configuration?: Conf const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + localVarHeaderParameter['Content-Type'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); @@ -8281,8 +8416,14 @@ export const SmartContractsApiAxiosParamCreator = function (configuration?: Conf const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + // authentication session required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -8293,21 +8434,14 @@ export const SmartContractsApiAxiosParamCreator = function (configuration?: Conf }; }, /** - * List all smart contracts deployed by address. - * @summary List smart contracts deployed by address - * @param {string} walletId The ID of the wallet the address belongs to. - * @param {string} addressId The ID of the address to fetch the smart contracts for. + * List smart contracts + * @summary List smart contracts + * @param {string} [page] Pagination token for retrieving the next set of results * @param {*} [options] Override http request option. * @throws {RequiredError} */ - listSmartContracts: async (walletId: string, addressId: string, options: RawAxiosRequestConfig = {}): Promise => { - // verify required parameter 'walletId' is not null or undefined - assertParamExists('listSmartContracts', 'walletId', walletId) - // verify required parameter 'addressId' is not null or undefined - assertParamExists('listSmartContracts', 'addressId', addressId) - const localVarPath = `/v1/wallets/{wallet_id}/addresses/{address_id}/smart_contracts` - .replace(`{${"wallet_id"}}`, encodeURIComponent(String(walletId))) - .replace(`{${"address_id"}}`, encodeURIComponent(String(addressId))); + listSmartContracts: async (page?: string, options: RawAxiosRequestConfig = {}): Promise => { + const localVarPath = `/v1/smart_contracts`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; @@ -8319,8 +8453,18 @@ export const SmartContractsApiAxiosParamCreator = function (configuration?: Conf const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + + // authentication session required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + + if (page !== undefined) { + localVarQueryParameter['page'] = page; + } + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -8333,9 +8477,9 @@ export const SmartContractsApiAxiosParamCreator = function (configuration?: Conf /** * Perform a read operation on a smart contract without creating a transaction * @summary Read data from a smart contract - * @param {string} networkId - * @param {string} contractAddress - * @param {ReadContractRequest} readContractRequest + * @param {string} networkId + * @param {string} contractAddress + * @param {ReadContractRequest} readContractRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -8360,8 +8504,14 @@ export const SmartContractsApiAxiosParamCreator = function (configuration?: Conf const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + + // authentication session required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + localVarHeaderParameter['Content-Type'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); @@ -8369,6 +8519,102 @@ export const SmartContractsApiAxiosParamCreator = function (configuration?: Conf localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(readContractRequest, localVarRequestOptions, configuration) + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Register a smart contract + * @summary Register a smart contract + * @param {string} networkId The ID of the network to fetch. + * @param {string} contractAddress EVM address of the smart contract (42 characters, including \'0x\', in lowercase) + * @param {RegisterSmartContractRequest} [registerSmartContractRequest] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + registerSmartContract: async (networkId: string, contractAddress: string, registerSmartContractRequest?: RegisterSmartContractRequest, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'networkId' is not null or undefined + assertParamExists('registerSmartContract', 'networkId', networkId) + // verify required parameter 'contractAddress' is not null or undefined + assertParamExists('registerSmartContract', 'contractAddress', contractAddress) + const localVarPath = `/v1/networks/{network_id}/smart_contracts/{contract_address}/register` + .replace(`{${"network_id"}}`, encodeURIComponent(String(networkId))) + .replace(`{${"contract_address"}}`, encodeURIComponent(String(contractAddress))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + + // authentication session required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(registerSmartContractRequest, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Update a smart contract + * @summary Update a smart contract + * @param {string} networkId The ID of the network to fetch. + * @param {string} contractAddress EVM address of the smart contract (42 characters, including \'0x\', in lowercase) + * @param {UpdateSmartContractRequest} [updateSmartContractRequest] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateSmartContract: async (networkId: string, contractAddress: string, updateSmartContractRequest?: UpdateSmartContractRequest, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'networkId' is not null or undefined + assertParamExists('updateSmartContract', 'networkId', networkId) + // verify required parameter 'contractAddress' is not null or undefined + assertParamExists('updateSmartContract', 'contractAddress', contractAddress) + const localVarPath = `/v1/networks/{network_id}/smart_contracts/{contract_address}` + .replace(`{${"network_id"}}`, encodeURIComponent(String(networkId))) + .replace(`{${"contract_address"}}`, encodeURIComponent(String(contractAddress))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'PUT', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + + // authentication session required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(updateSmartContractRequest, localVarRequestOptions, configuration) + return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, @@ -8389,7 +8635,7 @@ export const SmartContractsApiFp = function(configuration?: Configuration) { * @summary Create a new smart contract * @param {string} walletId The ID of the wallet the address belongs to. * @param {string} addressId The ID of the address to deploy the smart contract from. - * @param {CreateSmartContractRequest} createSmartContractRequest + * @param {CreateSmartContractRequest} createSmartContractRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -8405,7 +8651,7 @@ export const SmartContractsApiFp = function(configuration?: Configuration) { * @param {string} walletId The ID of the wallet the address belongs to. * @param {string} addressId The ID of the address to broadcast the transaction from. * @param {string} smartContractId The UUID of the smart contract to broadcast the transaction to. - * @param {DeploySmartContractRequest} deploySmartContractRequest + * @param {DeploySmartContractRequest} deploySmartContractRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -8431,15 +8677,14 @@ export const SmartContractsApiFp = function(configuration?: Configuration) { return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** - * List all smart contracts deployed by address. - * @summary List smart contracts deployed by address - * @param {string} walletId The ID of the wallet the address belongs to. - * @param {string} addressId The ID of the address to fetch the smart contracts for. + * List smart contracts + * @summary List smart contracts + * @param {string} [page] Pagination token for retrieving the next set of results * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async listSmartContracts(walletId: string, addressId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.listSmartContracts(walletId, addressId, options); + async listSmartContracts(page?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.listSmartContracts(page, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['SmartContractsApi.listSmartContracts']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); @@ -8447,9 +8692,9 @@ export const SmartContractsApiFp = function(configuration?: Configuration) { /** * Perform a read operation on a smart contract without creating a transaction * @summary Read data from a smart contract - * @param {string} networkId - * @param {string} contractAddress - * @param {ReadContractRequest} readContractRequest + * @param {string} networkId + * @param {string} contractAddress + * @param {ReadContractRequest} readContractRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -8459,6 +8704,36 @@ export const SmartContractsApiFp = function(configuration?: Configuration) { const localVarOperationServerBasePath = operationServerMap['SmartContractsApi.readContract']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, + /** + * Register a smart contract + * @summary Register a smart contract + * @param {string} networkId The ID of the network to fetch. + * @param {string} contractAddress EVM address of the smart contract (42 characters, including \'0x\', in lowercase) + * @param {RegisterSmartContractRequest} [registerSmartContractRequest] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async registerSmartContract(networkId: string, contractAddress: string, registerSmartContractRequest?: RegisterSmartContractRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.registerSmartContract(networkId, contractAddress, registerSmartContractRequest, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['SmartContractsApi.registerSmartContract']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * Update a smart contract + * @summary Update a smart contract + * @param {string} networkId The ID of the network to fetch. + * @param {string} contractAddress EVM address of the smart contract (42 characters, including \'0x\', in lowercase) + * @param {UpdateSmartContractRequest} [updateSmartContractRequest] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async updateSmartContract(networkId: string, contractAddress: string, updateSmartContractRequest?: UpdateSmartContractRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.updateSmartContract(networkId, contractAddress, updateSmartContractRequest, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['SmartContractsApi.updateSmartContract']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, } }; @@ -8474,7 +8749,7 @@ export const SmartContractsApiFactory = function (configuration?: Configuration, * @summary Create a new smart contract * @param {string} walletId The ID of the wallet the address belongs to. * @param {string} addressId The ID of the address to deploy the smart contract from. - * @param {CreateSmartContractRequest} createSmartContractRequest + * @param {CreateSmartContractRequest} createSmartContractRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -8487,7 +8762,7 @@ export const SmartContractsApiFactory = function (configuration?: Configuration, * @param {string} walletId The ID of the wallet the address belongs to. * @param {string} addressId The ID of the address to broadcast the transaction from. * @param {string} smartContractId The UUID of the smart contract to broadcast the transaction to. - * @param {DeploySmartContractRequest} deploySmartContractRequest + * @param {DeploySmartContractRequest} deploySmartContractRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -8507,28 +8782,51 @@ export const SmartContractsApiFactory = function (configuration?: Configuration, return localVarFp.getSmartContract(walletId, addressId, smartContractId, options).then((request) => request(axios, basePath)); }, /** - * List all smart contracts deployed by address. - * @summary List smart contracts deployed by address - * @param {string} walletId The ID of the wallet the address belongs to. - * @param {string} addressId The ID of the address to fetch the smart contracts for. + * List smart contracts + * @summary List smart contracts + * @param {string} [page] Pagination token for retrieving the next set of results * @param {*} [options] Override http request option. * @throws {RequiredError} */ - listSmartContracts(walletId: string, addressId: string, options?: RawAxiosRequestConfig): AxiosPromise { - return localVarFp.listSmartContracts(walletId, addressId, options).then((request) => request(axios, basePath)); + listSmartContracts(page?: string, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.listSmartContracts(page, options).then((request) => request(axios, basePath)); }, /** * Perform a read operation on a smart contract without creating a transaction * @summary Read data from a smart contract - * @param {string} networkId - * @param {string} contractAddress - * @param {ReadContractRequest} readContractRequest + * @param {string} networkId + * @param {string} contractAddress + * @param {ReadContractRequest} readContractRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ readContract(networkId: string, contractAddress: string, readContractRequest: ReadContractRequest, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.readContract(networkId, contractAddress, readContractRequest, options).then((request) => request(axios, basePath)); }, + /** + * Register a smart contract + * @summary Register a smart contract + * @param {string} networkId The ID of the network to fetch. + * @param {string} contractAddress EVM address of the smart contract (42 characters, including \'0x\', in lowercase) + * @param {RegisterSmartContractRequest} [registerSmartContractRequest] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + registerSmartContract(networkId: string, contractAddress: string, registerSmartContractRequest?: RegisterSmartContractRequest, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.registerSmartContract(networkId, contractAddress, registerSmartContractRequest, options).then((request) => request(axios, basePath)); + }, + /** + * Update a smart contract + * @summary Update a smart contract + * @param {string} networkId The ID of the network to fetch. + * @param {string} contractAddress EVM address of the smart contract (42 characters, including \'0x\', in lowercase) + * @param {UpdateSmartContractRequest} [updateSmartContractRequest] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateSmartContract(networkId: string, contractAddress: string, updateSmartContractRequest?: UpdateSmartContractRequest, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.updateSmartContract(networkId, contractAddress, updateSmartContractRequest, options).then((request) => request(axios, basePath)); + }, }; }; @@ -8543,7 +8841,7 @@ export interface SmartContractsApiInterface { * @summary Create a new smart contract * @param {string} walletId The ID of the wallet the address belongs to. * @param {string} addressId The ID of the address to deploy the smart contract from. - * @param {CreateSmartContractRequest} createSmartContractRequest + * @param {CreateSmartContractRequest} createSmartContractRequest * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof SmartContractsApiInterface @@ -8556,7 +8854,7 @@ export interface SmartContractsApiInterface { * @param {string} walletId The ID of the wallet the address belongs to. * @param {string} addressId The ID of the address to broadcast the transaction from. * @param {string} smartContractId The UUID of the smart contract to broadcast the transaction to. - * @param {DeploySmartContractRequest} deploySmartContractRequest + * @param {DeploySmartContractRequest} deploySmartContractRequest * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof SmartContractsApiInterface @@ -8576,28 +8874,51 @@ export interface SmartContractsApiInterface { getSmartContract(walletId: string, addressId: string, smartContractId: string, options?: RawAxiosRequestConfig): AxiosPromise; /** - * List all smart contracts deployed by address. - * @summary List smart contracts deployed by address - * @param {string} walletId The ID of the wallet the address belongs to. - * @param {string} addressId The ID of the address to fetch the smart contracts for. + * List smart contracts + * @summary List smart contracts + * @param {string} [page] Pagination token for retrieving the next set of results * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof SmartContractsApiInterface */ - listSmartContracts(walletId: string, addressId: string, options?: RawAxiosRequestConfig): AxiosPromise; + listSmartContracts(page?: string, options?: RawAxiosRequestConfig): AxiosPromise; /** * Perform a read operation on a smart contract without creating a transaction * @summary Read data from a smart contract - * @param {string} networkId - * @param {string} contractAddress - * @param {ReadContractRequest} readContractRequest + * @param {string} networkId + * @param {string} contractAddress + * @param {ReadContractRequest} readContractRequest * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof SmartContractsApiInterface */ readContract(networkId: string, contractAddress: string, readContractRequest: ReadContractRequest, options?: RawAxiosRequestConfig): AxiosPromise; + /** + * Register a smart contract + * @summary Register a smart contract + * @param {string} networkId The ID of the network to fetch. + * @param {string} contractAddress EVM address of the smart contract (42 characters, including \'0x\', in lowercase) + * @param {RegisterSmartContractRequest} [registerSmartContractRequest] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof SmartContractsApiInterface + */ + registerSmartContract(networkId: string, contractAddress: string, registerSmartContractRequest?: RegisterSmartContractRequest, options?: RawAxiosRequestConfig): AxiosPromise; + + /** + * Update a smart contract + * @summary Update a smart contract + * @param {string} networkId The ID of the network to fetch. + * @param {string} contractAddress EVM address of the smart contract (42 characters, including \'0x\', in lowercase) + * @param {UpdateSmartContractRequest} [updateSmartContractRequest] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof SmartContractsApiInterface + */ + updateSmartContract(networkId: string, contractAddress: string, updateSmartContractRequest?: UpdateSmartContractRequest, options?: RawAxiosRequestConfig): AxiosPromise; + } /** @@ -8612,7 +8933,7 @@ export class SmartContractsApi extends BaseAPI implements SmartContractsApiInter * @summary Create a new smart contract * @param {string} walletId The ID of the wallet the address belongs to. * @param {string} addressId The ID of the address to deploy the smart contract from. - * @param {CreateSmartContractRequest} createSmartContractRequest + * @param {CreateSmartContractRequest} createSmartContractRequest * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof SmartContractsApi @@ -8627,7 +8948,7 @@ export class SmartContractsApi extends BaseAPI implements SmartContractsApiInter * @param {string} walletId The ID of the wallet the address belongs to. * @param {string} addressId The ID of the address to broadcast the transaction from. * @param {string} smartContractId The UUID of the smart contract to broadcast the transaction to. - * @param {DeploySmartContractRequest} deploySmartContractRequest + * @param {DeploySmartContractRequest} deploySmartContractRequest * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof SmartContractsApi @@ -8651,24 +8972,23 @@ export class SmartContractsApi extends BaseAPI implements SmartContractsApiInter } /** - * List all smart contracts deployed by address. - * @summary List smart contracts deployed by address - * @param {string} walletId The ID of the wallet the address belongs to. - * @param {string} addressId The ID of the address to fetch the smart contracts for. + * List smart contracts + * @summary List smart contracts + * @param {string} [page] Pagination token for retrieving the next set of results * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof SmartContractsApi */ - public listSmartContracts(walletId: string, addressId: string, options?: RawAxiosRequestConfig) { - return SmartContractsApiFp(this.configuration).listSmartContracts(walletId, addressId, options).then((request) => request(this.axios, this.basePath)); + public listSmartContracts(page?: string, options?: RawAxiosRequestConfig) { + return SmartContractsApiFp(this.configuration).listSmartContracts(page, options).then((request) => request(this.axios, this.basePath)); } /** * Perform a read operation on a smart contract without creating a transaction * @summary Read data from a smart contract - * @param {string} networkId - * @param {string} contractAddress - * @param {ReadContractRequest} readContractRequest + * @param {string} networkId + * @param {string} contractAddress + * @param {ReadContractRequest} readContractRequest * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof SmartContractsApi @@ -8676,6 +8996,34 @@ export class SmartContractsApi extends BaseAPI implements SmartContractsApiInter public readContract(networkId: string, contractAddress: string, readContractRequest: ReadContractRequest, options?: RawAxiosRequestConfig) { return SmartContractsApiFp(this.configuration).readContract(networkId, contractAddress, readContractRequest, options).then((request) => request(this.axios, this.basePath)); } + + /** + * Register a smart contract + * @summary Register a smart contract + * @param {string} networkId The ID of the network to fetch. + * @param {string} contractAddress EVM address of the smart contract (42 characters, including \'0x\', in lowercase) + * @param {RegisterSmartContractRequest} [registerSmartContractRequest] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof SmartContractsApi + */ + public registerSmartContract(networkId: string, contractAddress: string, registerSmartContractRequest?: RegisterSmartContractRequest, options?: RawAxiosRequestConfig) { + return SmartContractsApiFp(this.configuration).registerSmartContract(networkId, contractAddress, registerSmartContractRequest, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Update a smart contract + * @summary Update a smart contract + * @param {string} networkId The ID of the network to fetch. + * @param {string} contractAddress EVM address of the smart contract (42 characters, including \'0x\', in lowercase) + * @param {UpdateSmartContractRequest} [updateSmartContractRequest] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof SmartContractsApi + */ + public updateSmartContract(networkId: string, contractAddress: string, updateSmartContractRequest?: UpdateSmartContractRequest, options?: RawAxiosRequestConfig) { + return SmartContractsApiFp(this.configuration).updateSmartContract(networkId, contractAddress, updateSmartContractRequest, options).then((request) => request(this.axios, this.basePath)); + } } @@ -8689,7 +9037,7 @@ export const StakeApiAxiosParamCreator = function (configuration?: Configuration /** * Build a new staking operation * @summary Build a new staking operation - * @param {BuildStakingOperationRequest} buildStakingOperationRequest + * @param {BuildStakingOperationRequest} buildStakingOperationRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -8708,8 +9056,14 @@ export const StakeApiAxiosParamCreator = function (configuration?: Configuration const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + + // authentication session required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + localVarHeaderParameter['Content-Type'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); @@ -8760,6 +9114,12 @@ export const StakeApiAxiosParamCreator = function (configuration?: Configuration const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + + // authentication session required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + if (limit !== undefined) { localVarQueryParameter['limit'] = limit; } @@ -8785,7 +9145,7 @@ export const StakeApiAxiosParamCreator = function (configuration?: Configuration } - + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -8798,7 +9158,7 @@ export const StakeApiAxiosParamCreator = function (configuration?: Configuration /** * Fetch staking rewards for a list of addresses * @summary Fetch staking rewards - * @param {FetchStakingRewardsRequest} fetchStakingRewardsRequest + * @param {FetchStakingRewardsRequest} fetchStakingRewardsRequest * @param {number} [limit] A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 50. * @param {string} [page] 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. * @param {*} [options] Override http request option. @@ -8819,6 +9179,12 @@ export const StakeApiAxiosParamCreator = function (configuration?: Configuration const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + + // authentication session required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + if (limit !== undefined) { localVarQueryParameter['limit'] = limit; } @@ -8828,7 +9194,7 @@ export const StakeApiAxiosParamCreator = function (configuration?: Configuration } - + localVarHeaderParameter['Content-Type'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); @@ -8872,8 +9238,14 @@ export const StakeApiAxiosParamCreator = function (configuration?: Configuration const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + + // authentication session required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -8886,7 +9258,7 @@ export const StakeApiAxiosParamCreator = function (configuration?: Configuration /** * Get staking context for an address * @summary Get staking context - * @param {GetStakingContextRequest} getStakingContextRequest + * @param {GetStakingContextRequest} getStakingContextRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -8905,8 +9277,14 @@ export const StakeApiAxiosParamCreator = function (configuration?: Configuration const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + // authentication session required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + + localVarHeaderParameter['Content-Type'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); @@ -8950,8 +9328,14 @@ export const StakeApiAxiosParamCreator = function (configuration?: Configuration const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + + // authentication session required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -8991,6 +9375,12 @@ export const StakeApiAxiosParamCreator = function (configuration?: Configuration const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + + // authentication session required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + if (status !== undefined) { localVarQueryParameter['status'] = status; } @@ -9004,7 +9394,7 @@ export const StakeApiAxiosParamCreator = function (configuration?: Configuration } - + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -9027,7 +9417,7 @@ export const StakeApiFp = function(configuration?: Configuration) { /** * Build a new staking operation * @summary Build a new staking operation - * @param {BuildStakingOperationRequest} buildStakingOperationRequest + * @param {BuildStakingOperationRequest} buildStakingOperationRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -9059,7 +9449,7 @@ export const StakeApiFp = function(configuration?: Configuration) { /** * Fetch staking rewards for a list of addresses * @summary Fetch staking rewards - * @param {FetchStakingRewardsRequest} fetchStakingRewardsRequest + * @param {FetchStakingRewardsRequest} fetchStakingRewardsRequest * @param {number} [limit] A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 50. * @param {string} [page] 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. * @param {*} [options] Override http request option. @@ -9089,7 +9479,7 @@ export const StakeApiFp = function(configuration?: Configuration) { /** * Get staking context for an address * @summary Get staking context - * @param {GetStakingContextRequest} getStakingContextRequest + * @param {GetStakingContextRequest} getStakingContextRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -9144,7 +9534,7 @@ export const StakeApiFactory = function (configuration?: Configuration, basePath /** * Build a new staking operation * @summary Build a new staking operation - * @param {BuildStakingOperationRequest} buildStakingOperationRequest + * @param {BuildStakingOperationRequest} buildStakingOperationRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -9170,7 +9560,7 @@ export const StakeApiFactory = function (configuration?: Configuration, basePath /** * Fetch staking rewards for a list of addresses * @summary Fetch staking rewards - * @param {FetchStakingRewardsRequest} fetchStakingRewardsRequest + * @param {FetchStakingRewardsRequest} fetchStakingRewardsRequest * @param {number} [limit] A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 50. * @param {string} [page] 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. * @param {*} [options] Override http request option. @@ -9194,7 +9584,7 @@ export const StakeApiFactory = function (configuration?: Configuration, basePath /** * Get staking context for an address * @summary Get staking context - * @param {GetStakingContextRequest} getStakingContextRequest + * @param {GetStakingContextRequest} getStakingContextRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -9239,7 +9629,7 @@ export interface StakeApiInterface { /** * Build a new staking operation * @summary Build a new staking operation - * @param {BuildStakingOperationRequest} buildStakingOperationRequest + * @param {BuildStakingOperationRequest} buildStakingOperationRequest * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof StakeApiInterface @@ -9265,7 +9655,7 @@ export interface StakeApiInterface { /** * Fetch staking rewards for a list of addresses * @summary Fetch staking rewards - * @param {FetchStakingRewardsRequest} fetchStakingRewardsRequest + * @param {FetchStakingRewardsRequest} fetchStakingRewardsRequest * @param {number} [limit] A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 50. * @param {string} [page] 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. * @param {*} [options] Override http request option. @@ -9289,7 +9679,7 @@ export interface StakeApiInterface { /** * Get staking context for an address * @summary Get staking context - * @param {GetStakingContextRequest} getStakingContextRequest + * @param {GetStakingContextRequest} getStakingContextRequest * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof StakeApiInterface @@ -9334,7 +9724,7 @@ export class StakeApi extends BaseAPI implements StakeApiInterface { /** * Build a new staking operation * @summary Build a new staking operation - * @param {BuildStakingOperationRequest} buildStakingOperationRequest + * @param {BuildStakingOperationRequest} buildStakingOperationRequest * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof StakeApi @@ -9364,7 +9754,7 @@ export class StakeApi extends BaseAPI implements StakeApiInterface { /** * Fetch staking rewards for a list of addresses * @summary Fetch staking rewards - * @param {FetchStakingRewardsRequest} fetchStakingRewardsRequest + * @param {FetchStakingRewardsRequest} fetchStakingRewardsRequest * @param {number} [limit] A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 50. * @param {string} [page] 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. * @param {*} [options] Override http request option. @@ -9392,7 +9782,7 @@ export class StakeApi extends BaseAPI implements StakeApiInterface { /** * Get staking context for an address * @summary Get staking context - * @param {GetStakingContextRequest} getStakingContextRequest + * @param {GetStakingContextRequest} getStakingContextRequest * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof StakeApi @@ -9446,7 +9836,7 @@ export const TradesApiAxiosParamCreator = function (configuration?: Configuratio * @param {string} walletId The ID of the wallet the address belongs to * @param {string} addressId The ID of the address the trade belongs to * @param {string} tradeId The ID of the trade to broadcast - * @param {BroadcastTradeRequest} broadcastTradeRequest + * @param {BroadcastTradeRequest} broadcastTradeRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -9474,8 +9864,11 @@ export const TradesApiAxiosParamCreator = function (configuration?: Configuratio const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + localVarHeaderParameter['Content-Type'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); @@ -9493,7 +9886,7 @@ export const TradesApiAxiosParamCreator = function (configuration?: Configuratio * @summary Create a new trade for an address * @param {string} walletId The ID of the wallet the source address belongs to * @param {string} addressId The ID of the address to conduct the trade from - * @param {CreateTradeRequest} createTradeRequest + * @param {CreateTradeRequest} createTradeRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -9518,8 +9911,11 @@ export const TradesApiAxiosParamCreator = function (configuration?: Configuratio const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + localVarHeaderParameter['Content-Type'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); @@ -9563,8 +9959,14 @@ export const TradesApiAxiosParamCreator = function (configuration?: Configuratio const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + + // authentication session required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -9603,6 +10005,12 @@ export const TradesApiAxiosParamCreator = function (configuration?: Configuratio const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + + // authentication session required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + if (limit !== undefined) { localVarQueryParameter['limit'] = limit; } @@ -9612,7 +10020,7 @@ export const TradesApiAxiosParamCreator = function (configuration?: Configuratio } - + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -9638,7 +10046,7 @@ export const TradesApiFp = function(configuration?: Configuration) { * @param {string} walletId The ID of the wallet the address belongs to * @param {string} addressId The ID of the address the trade belongs to * @param {string} tradeId The ID of the trade to broadcast - * @param {BroadcastTradeRequest} broadcastTradeRequest + * @param {BroadcastTradeRequest} broadcastTradeRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -9653,7 +10061,7 @@ export const TradesApiFp = function(configuration?: Configuration) { * @summary Create a new trade for an address * @param {string} walletId The ID of the wallet the source address belongs to * @param {string} addressId The ID of the address to conduct the trade from - * @param {CreateTradeRequest} createTradeRequest + * @param {CreateTradeRequest} createTradeRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -9710,7 +10118,7 @@ export const TradesApiFactory = function (configuration?: Configuration, basePat * @param {string} walletId The ID of the wallet the address belongs to * @param {string} addressId The ID of the address the trade belongs to * @param {string} tradeId The ID of the trade to broadcast - * @param {BroadcastTradeRequest} broadcastTradeRequest + * @param {BroadcastTradeRequest} broadcastTradeRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -9722,7 +10130,7 @@ export const TradesApiFactory = function (configuration?: Configuration, basePat * @summary Create a new trade for an address * @param {string} walletId The ID of the wallet the source address belongs to * @param {string} addressId The ID of the address to conduct the trade from - * @param {CreateTradeRequest} createTradeRequest + * @param {CreateTradeRequest} createTradeRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -9769,7 +10177,7 @@ export interface TradesApiInterface { * @param {string} walletId The ID of the wallet the address belongs to * @param {string} addressId The ID of the address the trade belongs to * @param {string} tradeId The ID of the trade to broadcast - * @param {BroadcastTradeRequest} broadcastTradeRequest + * @param {BroadcastTradeRequest} broadcastTradeRequest * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof TradesApiInterface @@ -9781,7 +10189,7 @@ export interface TradesApiInterface { * @summary Create a new trade for an address * @param {string} walletId The ID of the wallet the source address belongs to * @param {string} addressId The ID of the address to conduct the trade from - * @param {CreateTradeRequest} createTradeRequest + * @param {CreateTradeRequest} createTradeRequest * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof TradesApiInterface @@ -9828,7 +10236,7 @@ export class TradesApi extends BaseAPI implements TradesApiInterface { * @param {string} walletId The ID of the wallet the address belongs to * @param {string} addressId The ID of the address the trade belongs to * @param {string} tradeId The ID of the trade to broadcast - * @param {BroadcastTradeRequest} broadcastTradeRequest + * @param {BroadcastTradeRequest} broadcastTradeRequest * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof TradesApi @@ -9842,7 +10250,7 @@ export class TradesApi extends BaseAPI implements TradesApiInterface { * @summary Create a new trade for an address * @param {string} walletId The ID of the wallet the source address belongs to * @param {string} addressId The ID of the address to conduct the trade from - * @param {CreateTradeRequest} createTradeRequest + * @param {CreateTradeRequest} createTradeRequest * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof TradesApi @@ -9918,6 +10326,12 @@ export const TransactionHistoryApiAxiosParamCreator = function (configuration?: const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + + // authentication session required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + if (limit !== undefined) { localVarQueryParameter['limit'] = limit; } @@ -9927,7 +10341,7 @@ export const TransactionHistoryApiAxiosParamCreator = function (configuration?: } - + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -10047,7 +10461,7 @@ export const TransfersApiAxiosParamCreator = function (configuration?: Configura * @param {string} walletId The ID of the wallet the address belongs to * @param {string} addressId The ID of the address the transfer belongs to * @param {string} transferId The ID of the transfer to broadcast - * @param {BroadcastTransferRequest} broadcastTransferRequest + * @param {BroadcastTransferRequest} broadcastTransferRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -10075,8 +10489,11 @@ export const TransfersApiAxiosParamCreator = function (configuration?: Configura const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + localVarHeaderParameter['Content-Type'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); @@ -10094,7 +10511,7 @@ export const TransfersApiAxiosParamCreator = function (configuration?: Configura * @summary Create a new transfer for an address * @param {string} walletId The ID of the wallet the source address belongs to * @param {string} addressId The ID of the address to transfer from - * @param {CreateTransferRequest} createTransferRequest + * @param {CreateTransferRequest} createTransferRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -10119,8 +10536,11 @@ export const TransfersApiAxiosParamCreator = function (configuration?: Configura const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + localVarHeaderParameter['Content-Type'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); @@ -10164,8 +10584,14 @@ export const TransfersApiAxiosParamCreator = function (configuration?: Configura const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + + // authentication session required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -10204,6 +10630,12 @@ export const TransfersApiAxiosParamCreator = function (configuration?: Configura const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + + // authentication session required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + if (limit !== undefined) { localVarQueryParameter['limit'] = limit; } @@ -10213,7 +10645,7 @@ export const TransfersApiAxiosParamCreator = function (configuration?: Configura } - + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -10239,7 +10671,7 @@ export const TransfersApiFp = function(configuration?: Configuration) { * @param {string} walletId The ID of the wallet the address belongs to * @param {string} addressId The ID of the address the transfer belongs to * @param {string} transferId The ID of the transfer to broadcast - * @param {BroadcastTransferRequest} broadcastTransferRequest + * @param {BroadcastTransferRequest} broadcastTransferRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -10254,7 +10686,7 @@ export const TransfersApiFp = function(configuration?: Configuration) { * @summary Create a new transfer for an address * @param {string} walletId The ID of the wallet the source address belongs to * @param {string} addressId The ID of the address to transfer from - * @param {CreateTransferRequest} createTransferRequest + * @param {CreateTransferRequest} createTransferRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -10311,7 +10743,7 @@ export const TransfersApiFactory = function (configuration?: Configuration, base * @param {string} walletId The ID of the wallet the address belongs to * @param {string} addressId The ID of the address the transfer belongs to * @param {string} transferId The ID of the transfer to broadcast - * @param {BroadcastTransferRequest} broadcastTransferRequest + * @param {BroadcastTransferRequest} broadcastTransferRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -10323,7 +10755,7 @@ export const TransfersApiFactory = function (configuration?: Configuration, base * @summary Create a new transfer for an address * @param {string} walletId The ID of the wallet the source address belongs to * @param {string} addressId The ID of the address to transfer from - * @param {CreateTransferRequest} createTransferRequest + * @param {CreateTransferRequest} createTransferRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -10370,7 +10802,7 @@ export interface TransfersApiInterface { * @param {string} walletId The ID of the wallet the address belongs to * @param {string} addressId The ID of the address the transfer belongs to * @param {string} transferId The ID of the transfer to broadcast - * @param {BroadcastTransferRequest} broadcastTransferRequest + * @param {BroadcastTransferRequest} broadcastTransferRequest * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof TransfersApiInterface @@ -10382,7 +10814,7 @@ export interface TransfersApiInterface { * @summary Create a new transfer for an address * @param {string} walletId The ID of the wallet the source address belongs to * @param {string} addressId The ID of the address to transfer from - * @param {CreateTransferRequest} createTransferRequest + * @param {CreateTransferRequest} createTransferRequest * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof TransfersApiInterface @@ -10429,7 +10861,7 @@ export class TransfersApi extends BaseAPI implements TransfersApiInterface { * @param {string} walletId The ID of the wallet the address belongs to * @param {string} addressId The ID of the address the transfer belongs to * @param {string} transferId The ID of the transfer to broadcast - * @param {BroadcastTransferRequest} broadcastTransferRequest + * @param {BroadcastTransferRequest} broadcastTransferRequest * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof TransfersApi @@ -10443,7 +10875,7 @@ export class TransfersApi extends BaseAPI implements TransfersApiInterface { * @summary Create a new transfer for an address * @param {string} walletId The ID of the wallet the source address belongs to * @param {string} addressId The ID of the address to transfer from - * @param {CreateTransferRequest} createTransferRequest + * @param {CreateTransferRequest} createTransferRequest * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof TransfersApi @@ -10510,7 +10942,7 @@ export const UsersApiAxiosParamCreator = function (configuration?: Configuration const localVarQueryParameter = {} as any; - + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -10611,7 +11043,7 @@ export const WalletsApiAxiosParamCreator = function (configuration?: Configurati /** * Create a new wallet scoped to the user. * @summary Create a new wallet - * @param {CreateWalletRequest} [createWalletRequest] + * @param {CreateWalletRequest} [createWalletRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -10628,8 +11060,11 @@ export const WalletsApiAxiosParamCreator = function (configuration?: Configurati const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + localVarHeaderParameter['Content-Type'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); @@ -10665,8 +11100,14 @@ export const WalletsApiAxiosParamCreator = function (configuration?: Configurati const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + + // authentication session required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -10703,8 +11144,14 @@ export const WalletsApiAxiosParamCreator = function (configuration?: Configurati const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + + // authentication session required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -10737,8 +11184,14 @@ export const WalletsApiAxiosParamCreator = function (configuration?: Configurati const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + // authentication session required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -10769,6 +11222,12 @@ export const WalletsApiAxiosParamCreator = function (configuration?: Configurati const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + + // authentication session required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + if (limit !== undefined) { localVarQueryParameter['limit'] = limit; } @@ -10778,7 +11237,7 @@ export const WalletsApiAxiosParamCreator = function (configuration?: Configurati } - + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -10801,7 +11260,7 @@ export const WalletsApiFp = function(configuration?: Configuration) { /** * Create a new wallet scoped to the user. * @summary Create a new wallet - * @param {CreateWalletRequest} [createWalletRequest] + * @param {CreateWalletRequest} [createWalletRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -10878,7 +11337,7 @@ export const WalletsApiFactory = function (configuration?: Configuration, basePa /** * Create a new wallet scoped to the user. * @summary Create a new wallet - * @param {CreateWalletRequest} [createWalletRequest] + * @param {CreateWalletRequest} [createWalletRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -10939,7 +11398,7 @@ export interface WalletsApiInterface { /** * Create a new wallet scoped to the user. * @summary Create a new wallet - * @param {CreateWalletRequest} [createWalletRequest] + * @param {CreateWalletRequest} [createWalletRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof WalletsApiInterface @@ -11000,7 +11459,7 @@ export class WalletsApi extends BaseAPI implements WalletsApiInterface { /** * Create a new wallet scoped to the user. * @summary Create a new wallet - * @param {CreateWalletRequest} [createWalletRequest] + * @param {CreateWalletRequest} [createWalletRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof WalletsApi @@ -11072,7 +11531,7 @@ export const WebhooksApiAxiosParamCreator = function (configuration?: Configurat * Create a new webhook scoped to a wallet * @summary Create a new webhook scoped to a wallet * @param {string} walletId The ID of the wallet to create the webhook for. - * @param {CreateWalletWebhookRequest} [createWalletWebhookRequest] + * @param {CreateWalletWebhookRequest} [createWalletWebhookRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -11092,8 +11551,14 @@ export const WebhooksApiAxiosParamCreator = function (configuration?: Configurat const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + + // authentication session required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + localVarHeaderParameter['Content-Type'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); @@ -11109,7 +11574,7 @@ export const WebhooksApiAxiosParamCreator = function (configuration?: Configurat /** * Create a new webhook * @summary Create a new webhook - * @param {CreateWebhookRequest} [createWebhookRequest] + * @param {CreateWebhookRequest} [createWebhookRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -11126,8 +11591,14 @@ export const WebhooksApiAxiosParamCreator = function (configuration?: Configurat const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + + // authentication session required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + localVarHeaderParameter['Content-Type'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); @@ -11163,8 +11634,14 @@ export const WebhooksApiAxiosParamCreator = function (configuration?: Configurat const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + // authentication session required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -11195,6 +11672,12 @@ export const WebhooksApiAxiosParamCreator = function (configuration?: Configurat const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + + // authentication session required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + if (limit !== undefined) { localVarQueryParameter['limit'] = limit; } @@ -11204,7 +11687,7 @@ export const WebhooksApiAxiosParamCreator = function (configuration?: Configurat } - + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -11218,7 +11701,7 @@ export const WebhooksApiAxiosParamCreator = function (configuration?: Configurat * Update a webhook * @summary Update a webhook * @param {string} webhookId The Webhook id that needs to be updated - * @param {UpdateWebhookRequest} [updateWebhookRequest] + * @param {UpdateWebhookRequest} [updateWebhookRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -11238,8 +11721,14 @@ export const WebhooksApiAxiosParamCreator = function (configuration?: Configurat const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + // authentication apiKey required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + + // authentication session required + await setApiKeyToObject(localVarHeaderParameter, "Jwt", configuration) + localVarHeaderParameter['Content-Type'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); @@ -11266,7 +11755,7 @@ export const WebhooksApiFp = function(configuration?: Configuration) { * Create a new webhook scoped to a wallet * @summary Create a new webhook scoped to a wallet * @param {string} walletId The ID of the wallet to create the webhook for. - * @param {CreateWalletWebhookRequest} [createWalletWebhookRequest] + * @param {CreateWalletWebhookRequest} [createWalletWebhookRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -11279,7 +11768,7 @@ export const WebhooksApiFp = function(configuration?: Configuration) { /** * Create a new webhook * @summary Create a new webhook - * @param {CreateWebhookRequest} [createWebhookRequest] + * @param {CreateWebhookRequest} [createWebhookRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -11320,7 +11809,7 @@ export const WebhooksApiFp = function(configuration?: Configuration) { * Update a webhook * @summary Update a webhook * @param {string} webhookId The Webhook id that needs to be updated - * @param {UpdateWebhookRequest} [updateWebhookRequest] + * @param {UpdateWebhookRequest} [updateWebhookRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -11344,7 +11833,7 @@ export const WebhooksApiFactory = function (configuration?: Configuration, baseP * Create a new webhook scoped to a wallet * @summary Create a new webhook scoped to a wallet * @param {string} walletId The ID of the wallet to create the webhook for. - * @param {CreateWalletWebhookRequest} [createWalletWebhookRequest] + * @param {CreateWalletWebhookRequest} [createWalletWebhookRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -11354,7 +11843,7 @@ export const WebhooksApiFactory = function (configuration?: Configuration, baseP /** * Create a new webhook * @summary Create a new webhook - * @param {CreateWebhookRequest} [createWebhookRequest] + * @param {CreateWebhookRequest} [createWebhookRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -11386,7 +11875,7 @@ export const WebhooksApiFactory = function (configuration?: Configuration, baseP * Update a webhook * @summary Update a webhook * @param {string} webhookId The Webhook id that needs to be updated - * @param {UpdateWebhookRequest} [updateWebhookRequest] + * @param {UpdateWebhookRequest} [updateWebhookRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -11406,7 +11895,7 @@ export interface WebhooksApiInterface { * Create a new webhook scoped to a wallet * @summary Create a new webhook scoped to a wallet * @param {string} walletId The ID of the wallet to create the webhook for. - * @param {CreateWalletWebhookRequest} [createWalletWebhookRequest] + * @param {CreateWalletWebhookRequest} [createWalletWebhookRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof WebhooksApiInterface @@ -11416,7 +11905,7 @@ export interface WebhooksApiInterface { /** * Create a new webhook * @summary Create a new webhook - * @param {CreateWebhookRequest} [createWebhookRequest] + * @param {CreateWebhookRequest} [createWebhookRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof WebhooksApiInterface @@ -11448,7 +11937,7 @@ export interface WebhooksApiInterface { * Update a webhook * @summary Update a webhook * @param {string} webhookId The Webhook id that needs to be updated - * @param {UpdateWebhookRequest} [updateWebhookRequest] + * @param {UpdateWebhookRequest} [updateWebhookRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof WebhooksApiInterface @@ -11468,7 +11957,7 @@ export class WebhooksApi extends BaseAPI implements WebhooksApiInterface { * Create a new webhook scoped to a wallet * @summary Create a new webhook scoped to a wallet * @param {string} walletId The ID of the wallet to create the webhook for. - * @param {CreateWalletWebhookRequest} [createWalletWebhookRequest] + * @param {CreateWalletWebhookRequest} [createWalletWebhookRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof WebhooksApi @@ -11480,7 +11969,7 @@ export class WebhooksApi extends BaseAPI implements WebhooksApiInterface { /** * Create a new webhook * @summary Create a new webhook - * @param {CreateWebhookRequest} [createWebhookRequest] + * @param {CreateWebhookRequest} [createWebhookRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof WebhooksApi @@ -11518,7 +12007,7 @@ export class WebhooksApi extends BaseAPI implements WebhooksApiInterface { * Update a webhook * @summary Update a webhook * @param {string} webhookId The Webhook id that needs to be updated - * @param {UpdateWebhookRequest} [updateWebhookRequest] + * @param {UpdateWebhookRequest} [updateWebhookRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof WebhooksApi @@ -11529,3 +12018,4 @@ export class WebhooksApi extends BaseAPI implements WebhooksApiInterface { } + diff --git a/src/coinbase/address.ts b/src/coinbase/address.ts index 1f40844a..a03fa8fb 100644 --- a/src/coinbase/address.ts +++ b/src/coinbase/address.ts @@ -16,6 +16,7 @@ import { formatDate, getWeekBackDate } from "./utils"; import { StakingReward } from "./staking_reward"; import { StakingBalance } from "./staking_balance"; import { Transaction } from "./transaction"; +import { AddressReputation } from "./address_reputation"; /** * A representation of a blockchain address, which is a user-controlled account on a network. @@ -25,6 +26,7 @@ export class Address { protected networkId: string; protected id: string; + protected _reputation?: AddressReputation; /** * Initializes a new Address instance. @@ -296,6 +298,27 @@ export class Address { return new FaucetTransaction(response.data); } + /** + * Returns the reputation of the Address. + * + * @returns The reputation of the Address. + * @throws {Error} if the API request to get the Address reputation fails. + * @throws {Error} if the Address reputation is not available. + */ + public async reputation(): Promise { + if (this._reputation) { + return this._reputation; + } + + const response = await Coinbase.apiClients.addressReputation!.getAddressReputation( + this.getNetworkId(), + this.getId(), + ); + + this._reputation = new AddressReputation(response.data); + return this._reputation; + } + /** * Returns a string representation of the address. * diff --git a/src/coinbase/address_reputation.ts b/src/coinbase/address_reputation.ts new file mode 100644 index 00000000..d18e9d2c --- /dev/null +++ b/src/coinbase/address_reputation.ts @@ -0,0 +1,60 @@ +import { AddressReputation as AddressReputationModel, AddressReputationMetadata } from "../client"; + +/** + * A representation of the reputation of a blockchain address. + */ +export class AddressReputation { + private model: AddressReputationModel; + /** + * A representation of the reputation of a blockchain address. + * + * @param {AddressReputationModel} model - The reputation model instance. + */ + constructor(model: AddressReputationModel) { + if (!model) { + throw new Error("Address reputation model cannot be empty"); + } + this.model = model; + } + + /** + * Returns the address ID. + * + * @returns {string} The address ID. + */ + public get risky(): boolean { + return this.model.score < 0; + } + + /** + * Returns the score of the address. + * The score is a number between -100 and 100. + * + * @returns {number} The score of the address. + */ + public get score(): number { + return this.model.score; + } + + /** + * Returns the metadata of the address reputation. + * The metadata contains additional information about the address reputation. + * + * @returns {AddressReputationMetadata} The metadata of the address reputation. + */ + public get metadata(): AddressReputationMetadata { + return this.model.metadata; + } + + /** + * Returns the address ID. + * + * @returns {string} The address ID. + */ + toString(): string { + const metadata = Object.entries(this.model.metadata).map(([key, value]) => { + return `${key}: ${value}`; + }); + return `AddressReputation(score: ${this.score}, metadata: {${metadata.join(", ")}})`; + } +} diff --git a/src/coinbase/coinbase.ts b/src/coinbase/coinbase.ts index 56063596..6b9fd818 100644 --- a/src/coinbase/coinbase.ts +++ b/src/coinbase/coinbase.ts @@ -19,6 +19,7 @@ import { TransactionHistoryApiFactory, MPCWalletStakeApiFactory, FundApiFactory, + ReputationApiFactory, } from "../client"; import { BASE_PATH } from "./../client/base"; import { Configuration } from "./../client/configuration"; @@ -172,6 +173,7 @@ export class Coinbase { ); Coinbase.apiKeyPrivateKey = privateKey; Coinbase.useServerSigner = useServerSigner; + Coinbase.apiClients.addressReputation = ReputationApiFactory(config, basePath, axiosInstance); } /** diff --git a/src/coinbase/smart_contract.ts b/src/coinbase/smart_contract.ts index fe124d9d..0f439a15 100644 --- a/src/coinbase/smart_contract.ts +++ b/src/coinbase/smart_contract.ts @@ -14,7 +14,11 @@ import { NFTContractOptions, TokenContractOptions, MultiTokenContractOptions, + RegisterContractOptions, TransactionStatus, + PaginationOptions, + PaginationResponse, + UpdateContractOptions, } from "./types"; import { Coinbase } from "./coinbase"; import { delay } from "./utils"; @@ -39,6 +43,15 @@ export class SmartContract { this.model = contractModel; } + /** + * Returns whether the SmartContract is external. + * + * @returns True if the SmartContract is external, false otherwise. + */ + public get isExternal(): boolean { + return this.model.is_external; + } + /** * Returns a list of ContractEvents for the provided network, contract, and event details. * @@ -91,6 +104,68 @@ export class SmartContract { return contractEvents; } + /** + * Register a smart contract. + * + * @param options - The options to register a smart contract. + * @param options.networkId - The network ID. + * @param options.contractAddress - The contract address. + * @param options.abi - The ABI of the contract. + * @param options.contractName - The contract name. + * @returns The smart contract. + */ + public static async register({ + networkId, + contractAddress, + abi, + contractName, + }: RegisterContractOptions): Promise { + const response = await Coinbase.apiClients.smartContract!.registerSmartContract( + networkId, + contractAddress, + { + abi: JSON.stringify(abi), + contract_name: contractName, + }, + ); + return SmartContract.fromModel(response.data); + } + + /** + * Lists Smart Contracts. + * + * @param options - The pagination options. + * @param options.page - The cursor for pagination across multiple pages of Smart Contract. Don\'t include this parameter on the first call. Use the next page value returned in a previous response to request subsequent results. + * + * @returns The paginated list response of Smart Contracts. + */ + public static async list({ page = undefined }: PaginationOptions = {}): Promise< + PaginationResponse + > { + const data: SmartContract[] = []; + let nextPage: string | undefined; + + const response = await Coinbase.apiClients.smartContract!.listSmartContracts(page); + const smartContracts = response.data.data; + for (const sc of smartContracts) { + data.push(new SmartContract(sc)); + } + + const hasMore: boolean = response.data.has_more ? response.data.has_more : false; + + if (hasMore) { + if (response.data.next_page) { + nextPage = response.data.next_page; + } + } + + return { + data, + hasMore, + nextPage, + }; + } + /** * Converts a SmartContractModel into a SmartContract object. * @@ -124,8 +199,19 @@ export class SmartContract { * * @returns The Wallet ID. */ - public getWalletId(): string { - return this.model.wallet_id; + public getWalletId(): string | undefined { + if (!this.model.wallet_id) return undefined; + + return this.model.wallet_id!; + } + + /** + * Returns the name of the smart contract. + * + * @returns The contract name. + */ + public getContractName(): string { + return this.model.contract_name; } /** @@ -142,8 +228,10 @@ export class SmartContract { * * @returns The Deployer Address. */ - public getDeployerAddress(): string { - return this.model.deployer_address; + public getDeployerAddress(): string | undefined { + if (!this.model.deployer_address) return undefined; + + return this.model.deployer_address!; } /** @@ -159,6 +247,8 @@ export class SmartContract { return SmartContractType.ERC721; case SmartContractTypeModel.Erc1155: return SmartContractType.ERC1155; + case SmartContractTypeModel.Custom: + return SmartContractType.CUSTOM; default: throw new Error(`Unknown smart contract type: ${this.model.type}`); } @@ -170,21 +260,26 @@ export class SmartContract { * @returns The Smart Contract Options. */ public getOptions(): SmartContractOptions { - if (this.isERC20(this.getType(), this.model.options)) { + if (this.isExternal) + throw new Error("SmartContract options cannot be returned for external SmartContract"); + + const options = this.model.options!; + + if (this.isERC20(this.getType(), options)) { return { - name: this.model.options.name, - symbol: this.model.options.symbol, - totalSupply: this.model.options.total_supply, + name: options.name, + symbol: options.symbol, + totalSupply: options.total_supply, } as TokenContractOptions; - } else if (this.isERC721(this.getType(), this.model.options)) { + } else if (this.isERC721(this.getType(), options)) { return { - name: this.model.options.name, - symbol: this.model.options.symbol, - baseURI: this.model.options.base_uri, + name: options.name, + symbol: options.symbol, + baseURI: options.base_uri, } as NFTContractOptions; } else { return { - uri: this.model.options.uri, + uri: options.uri, } as MultiTokenContractOptions; } } @@ -203,8 +298,10 @@ export class SmartContract { * * @returns The Transaction. */ - public getTransaction(): Transaction { - return new Transaction(this.model.transaction); + public getTransaction(): Transaction | undefined { + if (this.isExternal) return undefined; + + return new Transaction(this.model.transaction!); } /** @@ -215,7 +312,29 @@ export class SmartContract { * @returns The hex-encoded signed payload */ async sign(key: ethers.Wallet): Promise { - return this.getTransaction().sign(key); + if (this.isExternal) throw new Error("Cannot sign an external SmartContract"); + + return this.getTransaction()!.sign(key); + } + + /** + * Update a smart contract. + * + * @param options - The options to update a smart contract. + * @param options.abi - The new ABI of the contract. + * @param options.contractName - The new contract name. + * @returns The smart contract. + */ + public async update({ abi, contractName }: UpdateContractOptions): Promise { + const response = await Coinbase.apiClients.smartContract!.updateSmartContract( + this.getNetworkId(), + this.getContractAddress(), + { + abi: JSON.stringify(abi), + contract_name: contractName, + }, + ); + return SmartContract.fromModel(response.data); } /** @@ -225,7 +344,9 @@ export class SmartContract { * @throws {APIError} if the API request to broadcast a SmartContract deployment fails. */ public async broadcast(): Promise { - if (!this.getTransaction().isSigned()) + if (this.isExternal) throw new Error("Cannot broadcast an external SmartContract"); + + if (!this.getTransaction()!.isSigned()) throw new Error("Cannot broadcast unsigned SmartContract deployment"); const deploySmartContractRequest: DeploySmartContractRequest = { @@ -233,8 +354,8 @@ export class SmartContract { }; const response = await Coinbase.apiClients.smartContract!.deploySmartContract( - this.getWalletId(), - this.getDeployerAddress(), + this.getWalletId()!, + this.getDeployerAddress()!, this.getId(), deploySmartContractRequest, ); @@ -255,13 +376,15 @@ export class SmartContract { * @throws {Error} if the SmartContract deployment times out. */ public async wait({ intervalSeconds = 0.2, timeoutSeconds = 10 } = {}): Promise { + if (this.isExternal) throw new Error("Cannot wait for an external SmartContract"); + const startTime = Date.now(); while (Date.now() - startTime < timeoutSeconds * 1000) { await this.reload(); // If the SmartContract deployment is in a terminal state, return the SmartContract. - const status = this.getTransaction().getStatus(); + const status = this.getTransaction()!.getStatus(); if (status === TransactionStatus.COMPLETE || status === TransactionStatus.FAILED) { return this; } @@ -278,9 +401,11 @@ export class SmartContract { * @throws {APIError} if the API request to get a SmartContract fails. */ public async reload(): Promise { + if (this.isExternal) throw new Error("Cannot reload an external SmartContract"); + const result = await Coinbase.apiClients.smartContract!.getSmartContract( - this.getWalletId(), - this.getDeployerAddress(), + this.getWalletId()!, + this.getDeployerAddress()!, this.getId(), ); this.model = result?.data; diff --git a/src/coinbase/types.ts b/src/coinbase/types.ts index 90dc36fe..8eb3c757 100644 --- a/src/coinbase/types.ts +++ b/src/coinbase/types.ts @@ -61,6 +61,9 @@ import { FundOperationList, CreateFundOperationRequest, CreateFundQuoteRequest, + AddressReputation, + RegisterSmartContractRequest, + UpdateSmartContractRequest, } from "./../client/api"; import { Address } from "./address"; import { Wallet } from "./wallet"; @@ -225,7 +228,7 @@ export type WalletAPIClient = { * List wallets belonging to the user. * * @param limit - A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10. - * @param page - 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. + * @param page - 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. * @param options - Override http request option. * @throws {APIError} If the request fails. * @throws {RequiredError} If the required parameter is not provided. @@ -357,7 +360,7 @@ export type AddressAPIClient = { * @param walletId - The ID of the wallet the address belongs to. * @param addressId - The onchain address of the address to sign the payload with. * @param limit - A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10. - * @param page - 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. + * @param page - 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. * @param options - Axios request options. * @throws {APIError} If the request fails. */ @@ -379,7 +382,7 @@ export type ExternalAddressAPIClient = { * * @param networkId - The ID of the blockchain network * @param addressId - The ID of the address to fetch the balance for - * @param page - 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. + * @param page - 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. * @param options - Override http request option. * @throws {APIError} If the request fails. */ @@ -727,6 +730,7 @@ export type ApiClients = { transactionHistory?: TransactionHistoryApiClient; smartContract?: SmartContractAPIClient; fund?: FundOperationApiClient; + addressReputation?: AddressReputationApiClient; }; /** @@ -810,13 +814,87 @@ export enum FundOperationStatus { } /** - * The Wallet Data type definition. - * The data required to recreate a Wallet. + * Interface representing wallet data, with support for both camelCase and snake_case + * property names for compatibility with older versions of the Python SDK. */ -export type WalletData = { - walletId: string; +export interface WalletData { + /** + * The CDP wallet ID in either camelCase or snake_case format, but not both. + */ + walletId?: string; + wallet_id?: string; + + /** + * The wallet seed + */ seed: string; -}; + + /** + * The network ID in either camelCase or snake_case format, but not both. + */ + networkId?: string; + network_id?: string; +} + +/** + * Type guard to check if data matches the appropriate WalletData format. + * WalletData must have: + * - exactly one of (walletId or wallet_id) + * - at most one of (networkId or network_id) + * - a seed + * + * @param data - The data to check + * @returns True if data matches the appropriate WalletData format + */ +export function isWalletData(data: unknown): data is WalletData { + if (typeof data !== "object" || data === null) { + return false; + } + + const { walletId, wallet_id, networkId, network_id, seed } = data as WalletData; + + // Check that exactly one of walletId or wallet_id is present (but not both) + const hasWalletId = typeof walletId === "string"; + const hasWalletSnakeId = typeof wallet_id === "string"; + if (!(hasWalletId !== hasWalletSnakeId)) { + return false; + } + + // Check that at most one of networkId or network_id is present (but not both) + const hasNetworkId = typeof networkId === "string"; + const hasNetworkSnakeId = typeof network_id === "string"; + if (hasNetworkId && hasNetworkSnakeId) { + return false; + } + + // Check that seed is present and is a string + return typeof seed === "string"; +} + +/** + * Interface representing a BIP-39 mnemonic seed phrase. + */ +export interface MnemonicSeedPhrase { + /** + * The BIP-39 mnemonic seed phrase (12, 15, 18, 21, or 24 words) + */ + mnemonicPhrase: string; +} + +/** + * Type guard to check if data matches the MnemonicSeedPhrase format. + * + * @param data - The data to check + * @returns True if data matches the MnemonicSeedPhrase format + */ +export function isMnemonicSeedPhrase(data: unknown): data is MnemonicSeedPhrase { + if (typeof data !== "object" || data === null) { + return false; + } + + const { mnemonicPhrase } = data as MnemonicSeedPhrase; + return typeof mnemonicPhrase === "string"; +} /** * The Seed Data type definition. @@ -826,6 +904,7 @@ export type SeedData = { encrypted: boolean; authTag: string; iv: string; + networkId: string; }; /** @@ -850,6 +929,7 @@ export enum ServerSignerStatus { * Options for creating a Wallet. */ export type WalletCreateOptions = { + seed?: string; networkId?: string; timeoutSeconds?: number; intervalSeconds?: number; @@ -961,6 +1041,7 @@ export enum SmartContractType { ERC20 = "erc20", ERC721 = "erc721", ERC1155 = "erc1155", + CUSTOM = "custom", } /** @@ -1142,7 +1223,7 @@ export interface WebhookApiClient { * * @summary List webhooks * @param {number} [limit] - A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10. - * @param {string} [page] - 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. + * @param {string} [page] - 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. * @param {*} [options] - Override http request option. * @throws {RequiredError} */ @@ -1177,7 +1258,7 @@ export interface BalanceHistoryApiClient { * @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. * @param limit - A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10. - * @param page - 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. + * @param page - 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. * @param options - Override http request option. * @throws {RequiredError} */ @@ -1199,7 +1280,7 @@ export interface TransactionHistoryApiClient { * @param networkId - The ID of the blockchain network * @param addressId - The ID of the address to fetch transactions for. * @param limit - A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10. - * @param page - 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. + * @param page - 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. * @param options - Override http request option. * @throws {RequiredError} */ @@ -1277,6 +1358,24 @@ export type UpdateWebhookOptions = { eventTypeFilter?: WebhookEventTypeFilter; }; +/** + * Options for registering a smart contract. + */ +export type RegisterContractOptions = { + networkId: string; + contractAddress: string; + abi: object; + contractName?: string; +}; + +/** + * Options for updating a smart contract. + */ +export type UpdateContractOptions = { + abi?: object; + contractName?: string; +}; + /** * ContractInvocationAPI client type definition. */ @@ -1356,18 +1455,15 @@ export type ContractInvocationAPIClient = { export interface SmartContractAPIClient { /** - * List smart contracts belonging to the user for a given wallet and address. + * List smart contracts belonging to the CDP project. * * @summary List smart contracts belonging to the CDP project - * @param walletId - The ID of the wallet the address belongs to. - * @param addressId - The ID of the address to list smart contracts for. + * @param page - 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. * @param options - Axios request options. * @throws {APIError} If the request fails. */ - listSmartContracts( - walletId: string, - addressId: string, + page?: string, options?: RawAxiosRequestConfig, ): AxiosPromise; @@ -1435,6 +1531,42 @@ export interface SmartContractAPIClient { contractAddress: string, readContractRequest: ReadContractRequest, ): AxiosPromise; + + /** + * Register a smart contract. + * + * @summary Register a smart contract. + * @param {string} [networkId] - The network ID. + * @param {string} [contractAddress] - The contract address. + * @param {RegisterSmartContractRequest} [registerSmartContractRequest] - The request body containing the register smart contract details. + * @param options - Axios request options + * @returns - A promise resolving to the register smart contract result + * @throws {APIError} If the request fails + */ + registerSmartContract( + networkId: string, + contractAddress: string, + registerSmartContractRequest: RegisterSmartContractRequest, + options?: RawAxiosRequestConfig, + ): AxiosPromise; + + /** + * Update a smart contract. + * + * @summary Update a smart contract. + * @param {string} [networkId] - The network ID. + * @param {string} [contractAddress] - The contract address. + * @param {UpdateSmartContractRequest} [updateSmartContractRequest] - The request body containing the update smart contract details. + * @param options - Axios request options + * @returns - A promise resolving to the update smart contract result + * @throws {APIError} If the request fails + */ + updateSmartContract( + networkId: string, + contractAddress: string, + updateSmartContractRequest: UpdateSmartContractRequest, + options?: RawAxiosRequestConfig, + ): AxiosPromise; } export interface FundOperationApiClient { @@ -1444,7 +1576,7 @@ export interface FundOperationApiClient { * @param walletId - The ID of the wallet the address belongs to. * @param addressId - The ID of the address to list fund operations for. * @param limit - A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10. - * @param page - 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. + * @param page - 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. * @param options - Axios request options * @throws {APIError} If the request fails */ @@ -1505,6 +1637,22 @@ export interface FundOperationApiClient { ): AxiosPromise; } +export interface AddressReputationApiClient { + /** + * Get the reputation of an address + * + * @param networkId - The ID of the blockchain network + * @param addressId - The ID of the address to fetch the reputation for + * @param options - Override http request option. + * @throws {APIError} If the request fails. + */ + getAddressReputation( + networkId: string, + addressId: string, + options?: RawAxiosRequestConfig, + ): AxiosPromise; +} + /** * Options for pagination on list methods. */ diff --git a/src/coinbase/validator.ts b/src/coinbase/validator.ts index a598f20e..32b3bd60 100644 --- a/src/coinbase/validator.ts +++ b/src/coinbase/validator.ts @@ -1,5 +1,9 @@ import { Coinbase } from "./coinbase"; -import { Validator as ValidatorModel, ValidatorStatus as APIValidatorStatus } from "../client/api"; +import { + Balance, + Validator as ValidatorModel, + ValidatorStatus as APIValidatorStatus, +} from "../client/api"; import { ValidatorStatus } from "./types"; /** @@ -150,6 +154,105 @@ export class Validator { return ValidatorStatus.UNKNOWN; } } + /** + * Returns the network ID. + * + * @returns The network ID. + */ + public getNetworkId(): string { + return this.model.network_id; + } + + /** + * Returns the asset ID. + * + * @returns The asset ID. + */ + public getAssetId(): string { + return this.model.asset_id; + } + + /** + * Returns the activation epoch of the validator. + * + * @returns The activation epoch as a string. + */ + public getActivationEpoch(): string { + return this.model.details?.activationEpoch || ""; + } + + /** + * Returns the balance of the validator. + * + * @returns The balance object. + */ + public getBalance(): Balance | undefined { + return this.model.details?.balance; + } + + /** + * Returns the effective balance of the validator. + * + * @returns The effective balance object. + */ + public getEffectiveBalance(): Balance | undefined { + return this.model.details?.effective_balance; + } + + /** + * Returns the exit epoch of the validator. + * + * @returns The exit epoch as a string. + */ + public getExitEpoch(): string { + return this.model.details?.exitEpoch || ""; + } + + /** + * Returns the index of the validator. + * + * @returns The validator index as a string. + */ + public getIndex(): string { + return this.model.details?.index || ""; + } + + /** + * Returns the public key of the validator. + * + * @returns The validator's public key as a string. + */ + public getPublicKey(): string { + return this.model.details?.public_key || ""; + } + + /** + * Returns whether the validator has been slashed. + * + * @returns True if the validator has been slashed, false otherwise. + */ + public isSlashed(): boolean { + return this.model.details?.slashed || false; + } + + /** + * Returns the withdrawable epoch of the validator. + * + * @returns The withdrawable epoch as a string. + */ + public getWithdrawableEpoch(): string { + return this.model.details?.withdrawableEpoch || ""; + } + + /** + * Returns the withdrawal address of the validator. + * + * @returns The withdrawal address as a string. + */ + public getWithdrawalAddress(): string { + return this.model.details?.withdrawal_address || ""; + } + /** * Returns the string representation of the Validator. * @@ -158,4 +261,13 @@ export class Validator { public toString(): string { return `Id: ${this.getValidatorId()} Status: ${this.getStatus()}`; } + + /** + * Returns the JSON representation of the Validator. + * + * @returns The JSON representation of the Validator. + */ + public toJSON(): string { + return JSON.stringify(this.model); + } } diff --git a/src/coinbase/wallet.ts b/src/coinbase/wallet.ts index b8b16e97..3c850465 100644 --- a/src/coinbase/wallet.ts +++ b/src/coinbase/wallet.ts @@ -1,4 +1,7 @@ import { HDKey } from "@scure/bip32"; +import { mnemonicToSeedSync, validateMnemonic } from "@scure/bip39"; +import { wordlist } from "@scure/bip39/wordlists/english"; +import { hexlify } from "ethers"; import * as crypto from "crypto"; import Decimal from "decimal.js"; import { ethers } from "ethers"; @@ -26,6 +29,9 @@ import { StakeOptionsMode, WalletCreateOptions, WalletData, + isWalletData, + MnemonicSeedPhrase, + isMnemonicSeedPhrase, CreateERC20Options, CreateERC721Options, CreateERC1155Options, @@ -130,31 +136,67 @@ export class Wallet { } /** - * Imports a Wallet for the given Wallet data. + * Loads an existing CDP Wallet using a wallet data object or mnemonic seed phrase. * - * @param data - The Wallet data to import. - * @param data.walletId - The ID of the Wallet to import. - * @param data.seed - The seed to use for the Wallet. - * @returns The imported Wallet. - * @throws {ArgumentError} If the Wallet ID is not provided. + * @param data - The data used to import the wallet: + * - If WalletData: Must contain walletId (or wallet_id) and seed. + * Allows for the loading of an existing CDP wallet into CDP. + * - If MnemonicSeedPhrase: Must contain a valid BIP-39 mnemonic phrase (12, 15, 18, 21, or 24 words). + * Allows for the import of an external wallet into CDP as a 1-of-1 wallet. + * @returns A Promise that resolves to the loaded Wallet instance + * @throws {ArgumentError} If the data format is invalid. * @throws {ArgumentError} If the seed is not provided. - * @throws {APIError} If the request fails. + * @throws {ArgumentError} If the mnemonic seed phrase is invalid. */ - public static async import(data: WalletData): Promise { - if (!data.walletId) { - throw new ArgumentError("Wallet ID must be provided"); - } - if (!data.seed) { - throw new ArgumentError("Seed must be provided"); + public static async import(data: WalletData | MnemonicSeedPhrase): Promise { + // Check if data is a mnemonic seed phrase object + if (isMnemonicSeedPhrase(data)) { + // Handle mnemonic seed phrase object import + + if (!data.mnemonicPhrase) { + throw new ArgumentError("BIP-39 mnemonic seed phrase must be provided"); + } + + if (!validateMnemonic(data.mnemonicPhrase, wordlist)) { + throw new ArgumentError("Invalid BIP-39 mnemonic seed phrase"); + } + + // Convert mnemonic phrase to seed + const seedBuffer = mnemonicToSeedSync(data.mnemonicPhrase); + const seed = hexlify(seedBuffer).slice(2); // remove 0x prefix + + // Create wallet using the provided seed + const wallet = await Wallet.createWithSeed({ + seed: seed, + networkId: Coinbase.networks.BaseSepolia, + }); + + // Ensure the wallet is created + await wallet.listAddresses(); + return wallet; + } else if (isWalletData(data)) { + // Handle WalletData object import + + const walletId = data.walletId || data.wallet_id; + if (!walletId) { + throw new ArgumentError("Wallet ID must be provided"); + } + + if (!data.seed) { + throw new ArgumentError("Seed must be provided"); + } + + const walletModel = await Coinbase.apiClients.wallet!.getWallet(walletId); + const wallet = Wallet.init(walletModel.data, data.seed); + await wallet.listAddresses(); + return wallet; + } else { + throw new ArgumentError("Invalid import data format"); } - const walletModel = await Coinbase.apiClients.wallet!.getWallet(data.walletId); - const wallet = Wallet.init(walletModel.data, data.seed); - await wallet.listAddresses(); - return wallet; } /** - * Returns a newly created Wallet object. + * Creates a new Wallet with a random seed. * * @constructs Wallet * @param options - The options to create the Wallet. @@ -170,6 +212,32 @@ export class Wallet { networkId = Coinbase.networks.BaseSepolia, timeoutSeconds = 20, intervalSeconds = 0.2, + }: WalletCreateOptions = {}): Promise { + return Wallet.createWithSeed({ + networkId, + timeoutSeconds, + intervalSeconds, + }); + } + + /** + * Creates a new Wallet with the given seed. + * + * @param options - The options to create the Wallet. + * @param options.seed - The seed to use for the Wallet. If undefined, a random seed will be generated. + * @param options.networkId - the ID of the blockchain network. Defaults to 'base-sepolia'. + * @param options.intervalSeconds - The interval at which to poll the backend, in seconds. + * @param options.timeoutSeconds - The maximum amount of time to wait for the ServerSigner to create a seed, in seconds. + * @throws {ArgumentError} If the model or client is not provided. + * @throws {Error} - If address derivation or caching fails. + * @throws {APIError} - If the request fails. + * @returns A promise that resolves with the new Wallet object. + */ + public static async createWithSeed({ + seed = undefined, + networkId = Coinbase.networks.BaseSepolia, + timeoutSeconds = 20, + intervalSeconds = 0.2, }: WalletCreateOptions = {}): Promise { const result = await Coinbase.apiClients.wallet!.createWallet({ wallet: { @@ -178,7 +246,7 @@ export class Wallet { }, }); - const wallet = Wallet.init(result.data, undefined); + const wallet = Wallet.init(result.data, seed); if (Coinbase.useServerSigner) { await wallet.waitForSigner(wallet.getId()!, intervalSeconds, timeoutSeconds); } @@ -221,7 +289,11 @@ export class Wallet { if (!this.seed) { throw new Error("Cannot export Wallet without loaded seed"); } - return { walletId: this.getId()!, seed: this.seed }; + return { + walletId: this.getId()!, + seed: this.seed, + networkId: this.getNetworkId(), + }; } /** @@ -590,6 +662,20 @@ export class Wallet { return this.model.id; } + /** + * Saves the seed of the Wallet to the given file. + * + * @deprecated Use saveSeedToFile() instead + * @param filePath - The path of the file to save the seed to + * @param encrypt - Whether the seed information persisted to the local file system should be + * encrypted or not. Data is unencrypted by default. + * @returns A string indicating the success of the operation + * @throws {Error} If the Wallet does not have a seed + */ + public saveSeed(filePath: string, encrypt: boolean = false): string { + return this.saveSeedToFile(filePath, encrypt); + } + /** * Saves the seed of the Wallet to the given file. Wallets whose seeds are saved this way can be * rehydrated using load_seed. A single file can be used for multiple Wallet seeds. @@ -601,7 +687,7 @@ export class Wallet { * @returns A string indicating the success of the operation * @throws {Error} If the Wallet does not have a seed */ - public saveSeed(filePath: string, encrypt: boolean = false): string { + public saveSeedToFile(filePath: string, encrypt: boolean = false): string { if (!this.master) { throw new Error("Cannot save Wallet without loaded seed"); } @@ -626,11 +712,12 @@ export class Wallet { iv = ivBytes.toString("hex"); } - existingSeedsInStore[data.walletId] = { + existingSeedsInStore[data.walletId!] = { seed: seedToStore, encrypted: encrypt, authTag: authTag, iv: iv, + networkId: data.networkId!, }; fs.writeFileSync(filePath, JSON.stringify(existingSeedsInStore, null, 2), "utf8"); @@ -641,10 +728,21 @@ export class Wallet { /** * Loads the seed of the Wallet from the given file. * + * @deprecated Use loadSeedFromFile() instead * @param filePath - The path of the file to load the seed from * @returns A string indicating the success of the operation */ public async loadSeed(filePath: string): Promise { + return this.loadSeedFromFile(filePath); + } + + /** + * Loads the seed of the Wallet from the given file. + * + * @param filePath - The path of the file to load the seed from + * @returns A string indicating the success of the operation + */ + public async loadSeedFromFile(filePath: string): Promise { const existingSeedsInStore = this.getExistingSeeds(filePath); if (Object.keys(existingSeedsInStore).length === 0) { throw new ArgumentError(`File ${filePath} does not contain any seed data`); @@ -912,8 +1010,8 @@ export class Wallet { * @param seed - The seed to use for the Wallet */ private validateSeed(seed: string | undefined): void { - if (seed && seed.length !== 64) { - throw new ArgumentError("Seed must be 32 bytes"); + if (seed && seed.length !== 64 && seed.length !== 128) { + throw new ArgumentError("Seed must be 32 or 64 bytes"); } } diff --git a/src/tests/address_reputation_test.ts b/src/tests/address_reputation_test.ts new file mode 100644 index 00000000..71cac006 --- /dev/null +++ b/src/tests/address_reputation_test.ts @@ -0,0 +1,96 @@ +import { AddressReputation } from "../coinbase/address_reputation"; + +describe("AddressReputation", () => { + let addressReputation: AddressReputation; + + beforeEach(() => { + addressReputation = new AddressReputation({ + score: -90, + metadata: { + unique_days_active: 1, + total_transactions: 1, + token_swaps_performed: 1, + bridge_transactions_performed: 1, + smart_contract_deployments: 1, + longest_active_streak: 1, + lend_borrow_stake_transactions: 1, + ens_contract_interactions: 1, + current_active_streak: 1, + activity_period_days: 1, + }, + }); + }); + + it("returns the score", () => { + expect(addressReputation.score).toBe(-90); + }); + + it("returns the metadata", () => { + expect(addressReputation.metadata).toEqual({ + unique_days_active: 1, + total_transactions: 1, + token_swaps_performed: 1, + bridge_transactions_performed: 1, + smart_contract_deployments: 1, + longest_active_streak: 1, + lend_borrow_stake_transactions: 1, + ens_contract_interactions: 1, + current_active_streak: 1, + activity_period_days: 1, + }); + }); + + it("returns the string representation of the address reputation", () => { + expect(addressReputation.toString()).toBe( + "AddressReputation(score: -90, metadata: {unique_days_active: 1, total_transactions: 1, token_swaps_performed: 1, bridge_transactions_performed: 1, smart_contract_deployments: 1, longest_active_streak: 1, lend_borrow_stake_transactions: 1, ens_contract_interactions: 1, current_active_streak: 1, activity_period_days: 1})", + ); + }); + + it("should throw an error for an empty model", () => { + expect(() => new AddressReputation(null!)).toThrow("Address reputation model cannot be empty"); + }); + + describe("#risky", () => { + it("returns the risky as true for score < 0", () => { + expect(addressReputation.risky).toBe(true); + }); + + it("should return risky as false for a score > 0", () => { + addressReputation = new AddressReputation({ + score: 90, + metadata: { + unique_days_active: 1, + total_transactions: 1, + token_swaps_performed: 1, + bridge_transactions_performed: 1, + smart_contract_deployments: 1, + longest_active_streak: 1, + lend_borrow_stake_transactions: 1, + ens_contract_interactions: 1, + current_active_streak: 1, + activity_period_days: 1, + }, + }); + expect(addressReputation.risky).toBe(false); + }); + + it("should return risky as false for a score=0", () => { + addressReputation = new AddressReputation({ + score: 0, + metadata: { + unique_days_active: 1, + total_transactions: 1, + token_swaps_performed: 1, + bridge_transactions_performed: 1, + smart_contract_deployments: 1, + longest_active_streak: 1, + lend_borrow_stake_transactions: 1, + ens_contract_interactions: 1, + current_active_streak: 1, + activity_period_days: 1, + }, + }); + expect(addressReputation.risky).toBe(false); + }); + }); +}); diff --git a/src/tests/address_test.ts b/src/tests/address_test.ts index 8b4fc092..fb02a761 100644 --- a/src/tests/address_test.ts +++ b/src/tests/address_test.ts @@ -1,12 +1,13 @@ import { Coinbase } from "../coinbase/coinbase"; import { Address, TransactionStatus } from "../index"; -import { AddressHistoricalBalanceList, AddressTransactionList } from "../client"; +import { AddressHistoricalBalanceList, AddressTransactionList, AddressReputation } from "../client"; import { VALID_ADDRESS_MODEL, mockReturnValue, newAddressModel, balanceHistoryApiMock, transactionHistoryApiMock, + reputationApiMock, } from "./utils"; import Decimal from "decimal.js"; import { randomUUID } from "crypto"; @@ -269,4 +270,49 @@ describe("Address", () => { expect(paginationResponse.nextPage).toEqual("next page"); }); }); + + describe("#reputation", () => { + beforeEach(() => { + const mockReputationResponse: AddressReputation = { + score: 90, + metadata: { + activity_period_days: 1, + bridge_transactions_performed: 1, + current_active_streak: 1, + ens_contract_interactions: 2, + lend_borrow_stake_transactions: 3, + longest_active_streak: 4, + smart_contract_deployments: 5, + token_swaps_performed: 6, + total_transactions: 7, + unique_days_active: 8, + }, + }; + Coinbase.apiClients.addressReputation = reputationApiMock; + Coinbase.apiClients.addressReputation!.getAddressReputation = + mockReturnValue(mockReputationResponse); + }); + + it("should return address reputation", async () => { + const reputation = await address.reputation(); + expect(reputation.score).toEqual(90); + expect(reputation.metadata).toEqual({ + activity_period_days: 1, + bridge_transactions_performed: 1, + current_active_streak: 1, + ens_contract_interactions: 2, + lend_borrow_stake_transactions: 3, + longest_active_streak: 4, + smart_contract_deployments: 5, + token_swaps_performed: 6, + total_transactions: 7, + unique_days_active: 8, + }); + expect(Coinbase.apiClients.addressReputation!.getAddressReputation).toHaveBeenCalledTimes(1); + expect(Coinbase.apiClients.addressReputation!.getAddressReputation).toHaveBeenCalledWith( + address.getNetworkId(), + address.getId(), + ); + }); + }); }); diff --git a/src/tests/e2e.ts b/src/tests/e2e.ts index 6fc2fce1..978c828b 100644 --- a/src/tests/e2e.ts +++ b/src/tests/e2e.ts @@ -54,13 +54,17 @@ describe("Coinbase SDK E2E Test", () => { const walletId = Object.keys(seedFile)[0]; const seed = seedFile[walletId].seed; - const importedWallet = await Wallet.import({ seed, walletId }); + const importedWallet = await Wallet.import({ + seed, + walletId, + networkId: Coinbase.networks.BaseSepolia, + }); expect(importedWallet).toBeDefined(); expect(importedWallet.getId()).toBe(walletId); console.log( `Imported wallet with ID: ${importedWallet.getId()}, default address: ${importedWallet.getDefaultAddress()}`, ); - await importedWallet.saveSeed("test_seed.json"); + await importedWallet.saveSeedToFile("test_seed.json"); try { const transaction = await importedWallet.faucet(); @@ -84,13 +88,13 @@ describe("Coinbase SDK E2E Test", () => { expect(exportedWallet.seed).toBeDefined(); console.log("Saving seed to file..."); - await wallet.saveSeed("test_seed.json"); + await wallet.saveSeedToFile("test_seed.json"); expect(fs.existsSync("test_seed.json")).toBe(true); console.log("Saved seed to test_seed.json"); const unhydratedWallet = await Wallet.fetch(walletId); expect(unhydratedWallet.canSign()).toBe(false); - await unhydratedWallet.loadSeed("test_seed.json"); + await unhydratedWallet.loadSeedFromFile("test_seed.json"); expect(unhydratedWallet.canSign()).toBe(true); expect(unhydratedWallet.getId()).toBe(walletId); @@ -116,11 +120,16 @@ describe("Coinbase SDK E2E Test", () => { console.log(`Second address balances: ${secondBalance}`); console.log("Fetching address transactions..."); - const result = await ( - await unhydratedWallet.getDefaultAddress() - ).listTransactions({ limit: 1 }); + let result; + for (let i = 0; i < 5; i++) { + // Try up to 5 times + result = await (await unhydratedWallet.getDefaultAddress()).listTransactions({ limit: 1 }); + if (result?.data.length > 0) break; + // Wait 2 seconds between attempts + console.log(`Waiting for transaction to be processed... (${i + 1} attempts)`); + await new Promise(resolve => setTimeout(resolve, 2000)); + } expect(result?.data.length).toBeGreaterThan(0); - console.log(`Fetched transactions: ${result?.data[0].toString()}`); console.log("Fetching address historical balances..."); const balance_result = await ( @@ -133,11 +142,12 @@ describe("Coinbase SDK E2E Test", () => { fs.unlinkSync("test_seed.json"); expect(exportedWallet.seed.length).toBe(64); - expect(savedSeed[exportedWallet.walletId]).toEqual({ + expect(savedSeed[exportedWallet.walletId!]).toEqual({ seed: exportedWallet.seed, encrypted: false, authTag: "", iv: "", + networkId: exportedWallet.networkId, }); }, 60000); }); diff --git a/src/tests/smart_contract_test.ts b/src/tests/smart_contract_test.ts index 2df83a61..e396a5bb 100644 --- a/src/tests/smart_contract_test.ts +++ b/src/tests/smart_contract_test.ts @@ -16,6 +16,9 @@ import { ERC721_BASE_URI, VALID_SMART_CONTRACT_ERC1155_MODEL, ERC1155_URI, + VALID_SMART_CONTRACT_EXTERNAL_MODEL, + testAllReadTypesABI, + VALID_EXTERNAL_SMART_CONTRACT_ERC20_MODEL, } from "./utils"; import { SmartContract } from "../coinbase/smart_contract"; import { ContractEvent } from "../coinbase/contract_event"; @@ -29,11 +32,17 @@ import { TimeoutError } from "../coinbase/errors"; describe("SmartContract", () => { let erc20Model: SmartContractModel = VALID_SMART_CONTRACT_ERC20_MODEL; + let erc20ExternalModel: SmartContractModel = VALID_EXTERNAL_SMART_CONTRACT_ERC20_MODEL; let erc721Model: SmartContractModel = VALID_SMART_CONTRACT_ERC721_MODEL; let erc20SmartContract: SmartContract = SmartContract.fromModel(erc20Model); + let erc20ExternalSmartContract: SmartContract = SmartContract.fromModel(erc20ExternalModel); let erc721SmartContract: SmartContract = SmartContract.fromModel(erc721Model); let erc1155Model: SmartContractModel = VALID_SMART_CONTRACT_ERC1155_MODEL; let erc1155SmartContract: SmartContract = SmartContract.fromModel(erc1155Model); + + let externalModel: SmartContractModel = VALID_SMART_CONTRACT_EXTERNAL_MODEL; + let externalSmartContract: SmartContract = SmartContract.fromModel(externalModel); + afterEach(() => { jest.clearAllMocks(); }); @@ -50,6 +59,198 @@ describe("SmartContract", () => { }); }); + describe(".register", () => { + const networkId = erc20ExternalModel.network_id; + const contractName = erc20ExternalModel.contract_name; + const contractAddress = erc20ExternalModel.contract_address; + + it("should register a new smart contract", async () => { + Coinbase.apiClients.smartContract = smartContractApiMock; + Coinbase.apiClients.smartContract.registerSmartContract = jest + .fn() + .mockResolvedValue({ data: erc20ExternalModel }); + + const smartContract = await SmartContract.register({ + networkId: networkId, + contractAddress: contractAddress, + abi: testAllReadTypesABI, + contractName: contractName, + }); + + expect(Coinbase.apiClients.smartContract!.registerSmartContract).toHaveBeenCalledWith( + networkId, + contractAddress, + { + abi: JSON.stringify(testAllReadTypesABI), + contract_name: contractName, + }, + ); + expect(smartContract).toBeInstanceOf(SmartContract); + expect(smartContract.getContractAddress()).toBe(contractAddress); + }); + + it("should throw an error if register fails", async () => { + Coinbase.apiClients.smartContract!.registerSmartContract = jest + .fn() + .mockRejectedValue(new Error("Failed to register the smart contract")); + await expect( + SmartContract.register({ + networkId: networkId, + contractAddress: contractAddress, + abi: testAllReadTypesABI, + contractName: contractName, + }), + ).rejects.toThrow("Failed to register the smart contract"); + }); + }); + + describe(".update", () => { + const networkId = erc20ExternalModel.network_id; + const contractAddress = erc20ExternalModel.contract_address; + + it("should update an existing smart contract", async () => { + const updatedContract = JSON.parse(JSON.stringify(erc20ExternalModel)); + const updatedAbiJson = { abi: "data2" }; + updatedContract.contract_name = "UpdatedContractName"; + updatedContract.abi = JSON.stringify(updatedAbiJson); + + Coinbase.apiClients.smartContract = smartContractApiMock; + Coinbase.apiClients.smartContract.updateSmartContract = jest + .fn() + .mockResolvedValue({ data: updatedContract }); + + const smartContract = await erc20ExternalSmartContract.update({ + abi: updatedAbiJson, + contractName: updatedContract.contract_name, + }); + + expect(Coinbase.apiClients.smartContract!.updateSmartContract).toHaveBeenCalledWith( + networkId, + contractAddress, + { + abi: updatedContract.abi, + contract_name: updatedContract.contract_name, + }, + ); + expect(smartContract).toBeInstanceOf(SmartContract); + expect(smartContract.getContractAddress()).toBe(contractAddress); + expect(smartContract.getAbi()).toEqual(updatedAbiJson); + expect(smartContract.getContractName()).toEqual(updatedContract.contract_name); + }); + + it("should update an existing smart contract - update contract name only", async () => { + const updatedContract = JSON.parse(JSON.stringify(erc20ExternalModel)); + updatedContract.contract_name = "UpdatedContractName"; + + Coinbase.apiClients.smartContract = smartContractApiMock; + Coinbase.apiClients.smartContract.updateSmartContract = jest + .fn() + .mockResolvedValue({ data: updatedContract }); + + const smartContract = await erc20ExternalSmartContract.update({ + contractName: updatedContract.contract_name, + }); + + expect(Coinbase.apiClients.smartContract!.updateSmartContract).toHaveBeenCalledWith( + networkId, + contractAddress, + { + contract_name: updatedContract.contract_name, + abi: undefined, + }, + ); + expect(smartContract).toBeInstanceOf(SmartContract); + expect(smartContract.getContractAddress()).toBe(contractAddress); + expect(smartContract.getAbi()).toEqual(erc20ExternalSmartContract.getAbi()); + expect(smartContract.getContractName()).toEqual(updatedContract.contract_name); + }); + + it("should update an existing smart contract - update abi only", async () => { + const updatedContract = JSON.parse(JSON.stringify(erc20ExternalModel)); + const updatedAbiJson = { abi: "data2" }; + updatedContract.abi = JSON.stringify(updatedAbiJson); + + Coinbase.apiClients.smartContract = smartContractApiMock; + Coinbase.apiClients.smartContract.updateSmartContract = jest + .fn() + .mockResolvedValue({ data: updatedContract }); + + const smartContract = await erc20ExternalSmartContract.update({ abi: updatedAbiJson }); + + expect(Coinbase.apiClients.smartContract!.updateSmartContract).toHaveBeenCalledWith( + networkId, + contractAddress, + { + contract_name: undefined, + abi: updatedContract.abi, + }, + ); + expect(smartContract).toBeInstanceOf(SmartContract); + expect(smartContract.getContractAddress()).toBe(contractAddress); + expect(smartContract.getAbi()).toEqual(updatedAbiJson); + expect(smartContract.getContractName()).toEqual(erc20ExternalSmartContract.getContractName()); + }); + + it("should update an existing smart contract - no update", async () => { + Coinbase.apiClients.smartContract = smartContractApiMock; + Coinbase.apiClients.smartContract.updateSmartContract = jest + .fn() + .mockResolvedValue({ data: erc20ExternalModel }); + + const smartContract = await erc20ExternalSmartContract.update({}); + + expect(Coinbase.apiClients.smartContract!.updateSmartContract).toHaveBeenCalledWith( + networkId, + contractAddress, + {}, + ); + expect(smartContract).toBeInstanceOf(SmartContract); + expect(smartContract.getContractAddress()).toBe(contractAddress); + expect(smartContract.getAbi()).toEqual(erc20ExternalSmartContract.getAbi()); + expect(smartContract.getContractName()).toEqual(erc20ExternalSmartContract.getContractName()); + }); + + it("should throw an error if update fails", async () => { + Coinbase.apiClients.smartContract!.updateSmartContract = jest + .fn() + .mockRejectedValue(new Error("Failed to update the smart contract")); + await expect( + erc20ExternalSmartContract.update({ + abi: testAllReadTypesABI, + contractName: erc20ExternalSmartContract.getContractName(), + }), + ).rejects.toThrow("Failed to update the smart contract"); + }); + }); + + describe(".list", () => { + it("should list smart contracts", async () => { + Coinbase.apiClients.smartContract = smartContractApiMock; + Coinbase.apiClients.smartContract.listSmartContracts = jest.fn().mockResolvedValue({ + data: { + data: [erc20ExternalModel], + has_more: true, + next_page: null, + }, + }); + const paginationResponse = await SmartContract.list(); + const smartContracts = paginationResponse.data; + + expect(Coinbase.apiClients.smartContract!.listSmartContracts).toHaveBeenCalledWith(undefined); + expect(smartContracts.length).toBe(1); + expect(smartContracts[0].getContractAddress()).toBe(erc20ExternalModel.contract_address); + expect(paginationResponse.hasMore).toBe(true); + expect(paginationResponse.nextPage).toBe(undefined); + }); + + it("should throw an error if list fails", async () => { + Coinbase.apiClients.smartContract!.listSmartContracts = mockReturnRejectedValue( + new APIError(""), + ); + await expect(SmartContract.list()).rejects.toThrow(APIError); + }); + }); + describe("#getId", () => { it("returns the smart contract ID", () => { expect(erc20SmartContract.getId()).toEqual( @@ -74,12 +275,26 @@ describe("SmartContract", () => { }); }); + describe("#getWalletId", () => { + it("returns the smart contract wallet ID", () => { + expect(erc20SmartContract.getWalletId()).toEqual(VALID_SMART_CONTRACT_ERC20_MODEL.wallet_id); + }); + + it("returns undefined for external contracts", () => { + expect(externalSmartContract.getWalletId()).toBeUndefined(); + }); + }); + describe("#getDeployerAddress", () => { it("returns the smart contract deployer address", () => { expect(erc20SmartContract.getDeployerAddress()).toEqual( VALID_SMART_CONTRACT_ERC20_MODEL.deployer_address, ); }); + + it("returns undefined for external contracts", () => { + expect(externalSmartContract.getDeployerAddress()).toBeUndefined(); + }); }); describe("#getType", () => { @@ -129,15 +344,19 @@ describe("SmartContract", () => { describe("#getTransaction", () => { it("returns the smart contract transaction", () => { expect(erc20SmartContract.getTransaction()).toEqual( - new Transaction(VALID_SMART_CONTRACT_ERC20_MODEL.transaction), + new Transaction(VALID_SMART_CONTRACT_ERC20_MODEL.transaction!), ); }); + + it("returns undefined for external contracts", () => { + expect(externalSmartContract.getTransaction()).toBeUndefined(); + }); }); describe("#sign", () => { let signingKey: any = ethers.Wallet.createRandom(); - it("return the signature", async () => { + it("returns the signature", async () => { const smartContract = SmartContract.fromModel({ ...VALID_SMART_CONTRACT_ERC20_MODEL, transaction: { @@ -150,6 +369,12 @@ describe("SmartContract", () => { expect(signature).toEqual(smartContract.getTransaction()!.getSignature()!); }); + + it("throws an error for external contracts", async () => { + expect(externalSmartContract.sign(signingKey)).rejects.toThrow( + "Cannot sign an external SmartContract", + ); + }); }); describe("#broadcast", () => { @@ -168,7 +393,7 @@ describe("SmartContract", () => { }); }); - describe("when it was successful", () => { + describe("when it is successful", () => { let broadcastedSmartContract: SmartContract; beforeEach(async () => { @@ -186,7 +411,7 @@ describe("SmartContract", () => { it("returns the broadcasted smart contract", async () => { expect(broadcastedSmartContract).toBeInstanceOf(SmartContract); - expect(broadcastedSmartContract.getTransaction().getStatus()).toEqual( + expect(broadcastedSmartContract.getTransaction()!.getStatus()).toEqual( TransactionStatus.BROADCAST, ); }); @@ -236,6 +461,14 @@ describe("SmartContract", () => { expect(erc20SmartContract.broadcast()).rejects.toThrow(APIError); }); }); + + describe("when the contract is external", () => { + it("throws an error", async () => { + expect(externalSmartContract.broadcast()).rejects.toThrow( + "Cannot broadcast an external SmartContract", + ); + }); + }); }); describe("#wait", () => { @@ -253,7 +486,7 @@ describe("SmartContract", () => { it("successfully waits and returns", async () => { const completedSmartContract = await erc20SmartContract.wait(); expect(completedSmartContract).toBeInstanceOf(SmartContract); - expect(completedSmartContract.getTransaction().getStatus()).toEqual( + expect(completedSmartContract.getTransaction()!.getStatus()).toEqual( TransactionStatus.COMPLETE, ); }); @@ -273,7 +506,7 @@ describe("SmartContract", () => { it("successfully waits and returns a failed invocation", async () => { const completedSmartContract = await erc20SmartContract.wait(); expect(completedSmartContract).toBeInstanceOf(SmartContract); - expect(completedSmartContract.getTransaction().getStatus()).toEqual( + expect(completedSmartContract.getTransaction()!.getStatus()).toEqual( TransactionStatus.FAILED, ); }); @@ -296,6 +529,14 @@ describe("SmartContract", () => { ).rejects.toThrow(new TimeoutError("SmartContract deployment timed out")); }); }); + + describe("when the contract is external", () => { + it("throws an error", async () => { + expect(externalSmartContract.wait()).rejects.toThrow( + "Cannot wait for an external SmartContract", + ); + }); + }); }); describe("#reload", () => { @@ -308,17 +549,23 @@ describe("SmartContract", () => { }, }); await erc20SmartContract.reload(); - expect(erc20SmartContract.getTransaction().getStatus()).toEqual(TransactionStatus.COMPLETE); + expect(erc20SmartContract.getTransaction()!.getStatus()).toEqual(TransactionStatus.COMPLETE); expect(Coinbase.apiClients.smartContract!.getSmartContract).toHaveBeenCalledTimes(1); }); + + it("throws an error when the smart contract is external", async () => { + expect(externalSmartContract.reload()).rejects.toThrow( + "Cannot reload an external SmartContract", + ); + }); }); describe("#toString", () => { it("returns the same value as toString", () => { expect(erc20SmartContract.toString()).toEqual( `SmartContract{id: '${erc20SmartContract.getId()}', networkId: '${erc20SmartContract.getNetworkId()}', ` + - `contractAddress: '${erc20SmartContract.getContractAddress()}', deployerAddress: '${erc20SmartContract.getDeployerAddress()}', ` + - `type: '${erc20SmartContract.getType()}'}`, + `contractAddress: '${erc20SmartContract.getContractAddress()}', deployerAddress: '${erc20SmartContract.getDeployerAddress()}', ` + + `type: '${erc20SmartContract.getType()}'}`, ); }); }); diff --git a/src/tests/utils.ts b/src/tests/utils.ts index 08893a75..cd0c9c9d 100644 --- a/src/tests/utils.ts +++ b/src/tests/utils.ts @@ -302,7 +302,7 @@ export const VALID_SIGNED_CONTRACT_INVOCATION_MODEL: ContractInvocationModel = { }, }; -export const ERC20_NAME = "Test NFT"; +export const ERC20_NAME = "Test ERC20 Token"; export const ERC20_SYMBOL = "TEST"; export const ERC20_TOTAL_SUPPLY = 100; @@ -310,6 +310,8 @@ export const VALID_SMART_CONTRACT_ERC20_MODEL: SmartContractModel = { smart_contract_id: "test-smart-contract-1", network_id: Coinbase.networks.BaseSepolia, wallet_id: walletId, + contract_name: ERC20_NAME, + is_external: false, contract_address: "0xcontract-address", deployer_address: "0xdeployer-address", type: SmartContractType.Erc20, @@ -328,6 +330,16 @@ export const VALID_SMART_CONTRACT_ERC20_MODEL: SmartContractModel = { }, }; +export const VALID_EXTERNAL_SMART_CONTRACT_ERC20_MODEL: SmartContractModel = { + smart_contract_id: "test-smart-contract-1", + network_id: Coinbase.networks.BaseSepolia, + contract_name: ERC20_NAME, + is_external: true, + contract_address: "0xcontract-address", + type: SmartContractType.Custom, + abi: JSON.stringify("some-abi"), +}; + export const ERC721_NAME = "Test NFT"; export const ERC721_SYMBOL = "TEST"; export const ERC721_BASE_URI = "https://example.com/metadata/"; @@ -335,6 +347,8 @@ export const VALID_SMART_CONTRACT_ERC721_MODEL: SmartContractModel = { smart_contract_id: "test-smart-contract-1", network_id: Coinbase.networks.BaseSepolia, wallet_id: walletId, + contract_name: ERC721_NAME, + is_external: false, contract_address: "0xcontract-address", deployer_address: "0xdeployer-address", type: SmartContractType.Erc721, @@ -358,6 +372,8 @@ export const VALID_SMART_CONTRACT_ERC1155_MODEL: SmartContractModel = { smart_contract_id: "test-smart-contract-1", network_id: Coinbase.networks.BaseSepolia, wallet_id: walletId, + contract_name: "", + is_external: false, contract_address: "0xcontract-address", deployer_address: "0xdeployer-address", type: SmartContractType.Erc1155, @@ -374,6 +390,17 @@ export const VALID_SMART_CONTRACT_ERC1155_MODEL: SmartContractModel = { }, }; +export const VALID_SMART_CONTRACT_EXTERNAL_MODEL: SmartContractModel = { + smart_contract_id: "test-smart-contract-external", + network_id: Coinbase.networks.BaseSepolia, + contract_name: ERC20_NAME, + is_external: true, + contract_address: "0xcontract-address", + type: SmartContractType.Custom, + abi: JSON.stringify("some-abi"), +}; + + const asset = Asset.fromModel({ asset_id: Coinbase.assets.Eth, network_id: "base-sepolia", @@ -764,6 +791,8 @@ export const smartContractApiMock = { getSmartContract: jest.fn(), listSmartContracts: jest.fn(), readContract: jest.fn(), + registerSmartContract: jest.fn(), + updateSmartContract: jest.fn(), }; export const contractInvocationApiMock = { @@ -784,6 +813,10 @@ export const fundOperationsApiMock = { createFundQuote: jest.fn(), }; +export const reputationApiMock = { + getAddressReputation: jest.fn(), +}; + export const testAllReadTypesABI = [ { type: "function", diff --git a/src/tests/validator_test.ts b/src/tests/validator_test.ts new file mode 100644 index 00000000..fcb3c3d6 --- /dev/null +++ b/src/tests/validator_test.ts @@ -0,0 +1,95 @@ +import { Validator } from "../coinbase/validator"; +import { ValidatorStatus } from "../coinbase/types"; +import { Validator as ValidatorModel } from "../client"; +import { Coinbase } from "../coinbase/coinbase"; +import { ValidatorStatus as APIValidatorStatus } from "../client/api"; + +describe("Validator", () => { + let validator: Validator; + + beforeEach(() => { + const mockModel: ValidatorModel = { + validator_id: "123", + status: APIValidatorStatus.Active, + network_id: Coinbase.networks.EthereumHolesky, + asset_id: Coinbase.assets.Eth, + details: { + effective_balance: { + amount: "100", + asset: { network_id: Coinbase.networks.EthereumHolesky, asset_id: Coinbase.assets.Eth }, + }, + balance: { + amount: "200", + asset: { network_id: Coinbase.networks.EthereumHolesky, asset_id: Coinbase.assets.Eth }, + }, + exitEpoch: "epoch-1", + activationEpoch: "epoch-0", + index: "0", + public_key: "public-key-123", + slashed: false, + withdrawableEpoch: "epoch-2", + withdrawal_address: "withdrawal-address-123", + }, + }; + + validator = new Validator(mockModel); + }); + + test("getValidatorId should return the correct validator ID", () => { + expect(validator.getValidatorId()).toBe("123"); + }); + + test("getStatus should return the correct status", () => { + expect(validator.getStatus()).toBe(ValidatorStatus.ACTIVE); + }); + + test("getNetworkId should return the correct network ID", () => { + expect(validator.getNetworkId()).toBe(Coinbase.networks.EthereumHolesky); + }); + + test("getAssetId should return the correct asset ID", () => { + expect(validator.getAssetId()).toBe(Coinbase.assets.Eth); + }); + + test("getActivationEpoch should return the correct activation epoch", () => { + expect(validator.getActivationEpoch()).toBe("epoch-0"); + }); + + test("getExitEpoch should return the correct exit epoch", () => { + expect(validator.getExitEpoch()).toBe("epoch-1"); + }); + + test("getIndex should return the correct index", () => { + expect(validator.getIndex()).toBe("0"); + }); + + test("getPublicKey should return the correct public key", () => { + expect(validator.getPublicKey()).toBe("public-key-123"); + }); + + test("isSlashed should return the correct slashed status", () => { + expect(validator.isSlashed()).toBe(false); + }); + + test("getWithdrawableEpoch should return the correct withdrawable epoch", () => { + expect(validator.getWithdrawableEpoch()).toBe("epoch-2"); + }); + + test("getWithdrawalAddress should return the correct withdrawal address", () => { + expect(validator.getWithdrawalAddress()).toBe("withdrawal-address-123"); + }); + + test("getEffectiveBalance should return the correct effective balance", () => { + expect(validator.getEffectiveBalance()).toEqual({ + amount: "100", + asset: { network_id: Coinbase.networks.EthereumHolesky, asset_id: Coinbase.assets.Eth }, + }); + }); + + test("getBalance should return the correct balance", () => { + expect(validator.getBalance()).toEqual({ + amount: "200", + asset: { network_id: Coinbase.networks.EthereumHolesky, asset_id: Coinbase.assets.Eth }, + }); + }); +}); diff --git a/src/tests/wallet_address_test.ts b/src/tests/wallet_address_test.ts index 031ffdf8..35c7982f 100644 --- a/src/tests/wallet_address_test.ts +++ b/src/tests/wallet_address_test.ts @@ -1556,7 +1556,7 @@ describe("WalletAddress", () => { walletAddress = new WalletAddress(addressModel, key as unknown as ethers.Wallet); - const tx = new Transaction(VALID_SMART_CONTRACT_ERC20_MODEL.transaction); + const tx = new Transaction(VALID_SMART_CONTRACT_ERC20_MODEL.transaction!); expectedSignedPayload = await tx.sign(key as unknown as ethers.Wallet); }); @@ -1852,7 +1852,7 @@ describe("WalletAddress", () => { walletAddress = new WalletAddress(addressModel, key as unknown as ethers.Wallet); - const tx = new Transaction(VALID_SMART_CONTRACT_ERC721_MODEL.transaction); + const tx = new Transaction(VALID_SMART_CONTRACT_ERC721_MODEL.transaction!); expectedSignedPayload = await tx.sign(key as unknown as ethers.Wallet); }); @@ -2148,7 +2148,7 @@ describe("WalletAddress", () => { walletAddress = new WalletAddress(addressModel, key as unknown as ethers.Wallet); - const tx = new Transaction(VALID_SMART_CONTRACT_ERC1155_MODEL.transaction); + const tx = new Transaction(VALID_SMART_CONTRACT_ERC1155_MODEL.transaction!); expectedSignedPayload = await tx.sign(key as unknown as ethers.Wallet); }); diff --git a/src/tests/wallet_test.ts b/src/tests/wallet_test.ts index ba37aef3..e09a8fad 100644 --- a/src/tests/wallet_test.ts +++ b/src/tests/wallet_test.ts @@ -71,6 +71,7 @@ import { PayloadSignature } from "../coinbase/payload_signature"; import { ContractInvocation } from "../coinbase/contract_invocation"; import { SmartContract } from "../coinbase/smart_contract"; import { Webhook } from "../coinbase/webhook"; +import { WalletData } from "../coinbase/types"; describe("Wallet Class", () => { let wallet: Wallet; @@ -1025,6 +1026,94 @@ describe("Wallet Class", () => { "Wallet ID must be provided", ); }); + it("should throw an error when seed is not provided", async () => { + const walletData = seedWallet.export(); + walletData.seed = ""; + await expect(async () => await Wallet.import(walletData)).rejects.toThrow( + "Seed must be provided", + ); + }); + it("should throw an error when both walletId and wallet_id are provided", async () => { + const walletData = seedWallet.export(); + walletData.wallet_id = walletData.walletId; + await expect(async () => await Wallet.import(walletData)).rejects.toThrow( + "Invalid import data format", + ); + }); + it("should throw an error when wallet data format is invalid", async () => { + const invalidWalletData = { + foo: "bar", + bar: 123, + } as unknown as WalletData; + await expect(async () => await Wallet.import(invalidWalletData)).rejects.toThrow( + "Invalid import data format", + ); + }); + }); + + describe("#importFromMnemonicSeedPhrase", () => { + const validMnemonic = + "crouch cereal notice one canyon kiss tape employ ghost column vanish despair eight razor laptop keen rally gaze riot regret assault jacket risk curve"; + const address0 = "0x43A0477E658C6e05136e81C576CF02daCEa067bB"; + const publicKey = "0x037e6cbdd1d949f60f41d5db7ffa9b3ddce0b77eab35ef7affd3f64cbfd9e33a91"; + const addressModel = { + ...VALID_ADDRESS_MODEL, + address_id: address0, + public_key: publicKey, + }; + + beforeEach(() => { + jest.clearAllMocks(); + Coinbase.apiClients.wallet = walletsApiMock; + Coinbase.apiClients.address = addressesApiMock; + Coinbase.apiClients.wallet!.createWallet = mockFn(request => { + const { network_id } = request.wallet; + apiResponses[walletId] = { + id: walletId, + network_id, + default_address: addressModel, + }; + return { data: apiResponses[walletId] }; + }); + Coinbase.apiClients.wallet!.getWallet = mockFn(walletId => { + walletModel = apiResponses[walletId]; + walletModel.default_address!.address_id = address0; + return { data: apiResponses[walletId] }; + }); + Coinbase.apiClients.address!.createAddress = mockReturnValue(addressModel); + Coinbase.apiClients.address!.listAddresses = mockFn(() => { + return { + data: { + data: [addressModel], + has_more: false, + next_page: "", + total_count: 1, + }, + }; + }); + }); + + it("successfully imports a wallet from a valid 24-word mnemonic", async () => { + const wallet = await Wallet.import({ mnemonicPhrase: validMnemonic }); + expect(wallet).toBeInstanceOf(Wallet); + expect(Coinbase.apiClients.wallet!.createWallet).toHaveBeenCalledTimes(1); + expect(Coinbase.apiClients.address!.createAddress).toHaveBeenCalledTimes(1); + expect(Coinbase.apiClients.address!.listAddresses).toHaveBeenCalledTimes(1); + }); + + it("throws an error when mnemonic is empty", async () => { + await expect(Wallet.import({ mnemonicPhrase: "" })).rejects.toThrow( + "BIP-39 mnemonic seed phrase must be provided", + ); + expect(Coinbase.apiClients.wallet!.createWallet).not.toHaveBeenCalled(); + }); + + it("throws an error when mnemonic is invalid", async () => { + await expect(Wallet.import({ mnemonicPhrase: "invalid mnemonic phrase" })).rejects.toThrow( + "Invalid BIP-39 mnemonic seed phrase", + ); + expect(Coinbase.apiClients.wallet!.createWallet).not.toHaveBeenCalled(); + }); }); describe("#listBalances", () => { @@ -1190,17 +1279,18 @@ describe("Wallet Class", () => { }); it("should save the seed when encryption is false", async () => { - seedWallet.saveSeed(filePath, false); + seedWallet.saveSeedToFile(filePath, false); const storedSeedData = fs.readFileSync(filePath); const walletSeedData = JSON.parse(storedSeedData.toString()); expect(walletSeedData[walletId].encrypted).toBe(false); expect(walletSeedData[walletId].iv).toBe(""); expect(walletSeedData[walletId].authTag).toBe(""); expect(walletSeedData[walletId].seed).toBe(seed); + expect(walletSeedData[walletId].networkId).toBe(seedWallet.getNetworkId()); }); it("should save the seed when encryption is true", async () => { - seedWallet.saveSeed(filePath, true); + seedWallet.saveSeedToFile(filePath, true); const storedSeedData = fs.readFileSync(filePath); const walletSeedData = JSON.parse(storedSeedData.toString()); expect(walletSeedData[walletId].encrypted).toBe(true); @@ -1211,7 +1301,7 @@ describe("Wallet Class", () => { it("should throw an error when the wallet is seedless", async () => { const seedlessWallet = Wallet.init(walletModel, ""); - expect(() => seedlessWallet.saveSeed(filePath, false)).toThrow(Error); + expect(() => seedlessWallet.saveSeedToFile(filePath, false)).toThrow(Error); }); }); @@ -1249,18 +1339,18 @@ describe("Wallet Class", () => { }); it("loads the seed from the file", async () => { - await seedlessWallet.loadSeed(filePath); + await seedlessWallet.loadSeedFromFile(filePath); expect(seedlessWallet.canSign()).toBe(true); }); it("loads the encrypted seed from the file", async () => { - seedWallet.saveSeed(filePath, true); - await seedlessWallet.loadSeed(filePath); + seedWallet.saveSeedToFile(filePath, true); + await seedlessWallet.loadSeedFromFile(filePath); expect(seedlessWallet.canSign()).toBe(true); }); it("loads the encrypted seed from the file with multiple seeds", async () => { - seedWallet.saveSeed(filePath, true); + seedWallet.saveSeedToFile(filePath, true); const otherModel = { id: crypto.randomUUID(), @@ -1269,14 +1359,14 @@ describe("Wallet Class", () => { }; const randomSeed = ethers.Wallet.createRandom().privateKey.slice(2); const otherWallet = Wallet.init(otherModel, randomSeed); - otherWallet.saveSeed(filePath, true); + otherWallet.saveSeedToFile(filePath, true); - await seedlessWallet.loadSeed(filePath); + await seedlessWallet.loadSeedFromFile(filePath); expect(seedlessWallet.canSign()).toBe(true); }); it("raises an error if the wallet is already hydrated", async () => { - await expect(seedWallet.loadSeed(filePath)).rejects.toThrow(Error); + await expect(seedWallet.loadSeedFromFile(filePath)).rejects.toThrow(Error); }); it("raises an error when file contains different wallet data", async () => { @@ -1290,28 +1380,28 @@ describe("Wallet Class", () => { }; fs.writeFileSync(filePath, JSON.stringify(otherSeedData), "utf8"); - await expect(seedlessWallet.loadSeed(filePath)).rejects.toThrow(ArgumentError); + await expect(seedlessWallet.loadSeedFromFile(filePath)).rejects.toThrow(ArgumentError); }); it("raises an error when the file is absent", async () => { - await expect(seedlessWallet.loadSeed("non-file.json")).rejects.toThrow(ArgumentError); + await expect(seedlessWallet.loadSeedFromFile("non-file.json")).rejects.toThrow(ArgumentError); }); it("raises an error when the file is corrupted", async () => { fs.writeFileSync(filePath, "corrupted data", "utf8"); - await expect(seedlessWallet.loadSeed(filePath)).rejects.toThrow(ArgumentError); + await expect(seedlessWallet.loadSeedFromFile(filePath)).rejects.toThrow(ArgumentError); }); it("throws an error when the file is empty", async () => { fs.writeFileSync("invalid-file.json", "", "utf8"); - await expect(wallet.loadSeed("invalid-file.json")).rejects.toThrow(ArgumentError); + await expect(wallet.loadSeedFromFile("invalid-file.json")).rejects.toThrow(ArgumentError); fs.unlinkSync("invalid-file.json"); }); it("throws an error when the file is not a valid JSON", async () => { fs.writeFileSync("invalid-file.json", `{"test":{"authTag":false}}`, "utf8"); - await expect(wallet.loadSeed("invalid-file.json")).rejects.toThrow(ArgumentError); + await expect(wallet.loadSeedFromFile("invalid-file.json")).rejects.toThrow(ArgumentError); fs.unlinkSync("invalid-file.json"); }); }); diff --git a/src/tests/webhook_test.ts b/src/tests/webhook_test.ts index 3e326c8d..448124ce 100644 --- a/src/tests/webhook_test.ts +++ b/src/tests/webhook_test.ts @@ -227,12 +227,13 @@ describe("Webhook", () => { }); it("should update the webhook address list only", async () => { const webhook = Webhook.init(mockModel); - await webhook.update({ eventTypeFilter: { addresses: ["0x1..", "0x2.."] } }); + + await webhook.update({ eventTypeFilter: { wallet_id: "test-wallet-id", addresses: ["0x1..", "0x2.."] } }); expect(Coinbase.apiClients.webhook!.updateWebhook).toHaveBeenCalledWith("test-id", { notification_uri: "https://example.com/callback", event_filters: [{ contract_address: "0x...", from_address: "0x...", to_address: "0x..." }], - event_type_filter: { addresses: ["0x1..", "0x2.."] }, + event_type_filter: { wallet_id: "test-wallet-id", addresses: ["0x1..", "0x2.."] }, }); expect(webhook.getNotificationURI()).toBe("https://example.com/callback"); @@ -245,7 +246,7 @@ describe("Webhook", () => { const webhook = Webhook.init(mockWalletActivityWebhookModel); await webhook.update({ notificationUri: "https://new-url.com/callback", - eventTypeFilter: { addresses: ["0x1..", "0x2.."] }, + eventTypeFilter: { wallet_id: "test-wallet-id", addresses: ["0x1..", "0x2.."] }, }); expect(Coinbase.apiClients.webhook!.updateWebhook).toHaveBeenCalledWith("test-id", {