/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ import type { CustodialManagedAddress } from '../models/CustodialManagedAddress'; import type { TransactionHash } from '../models/TransactionHash'; import type { TransferManagedAddress } from '../models/TransferManagedAddress'; import type { CancelablePromise } from '../core/CancelablePromise'; import { request as __request } from '../core/request'; export class CustodialManagedWalletsService { /** * Create managed address *
Create new managed address for a specific chain. If the address is mainnet or testnet one depends on the API Key - testnet API Key manages testnet addresses, mainnet API Key manages mainnet addresses.
* Result of the operation is address and walletId, which is used for identifying the wallet later on and/or exporting the private key if needed.
* Free users can manage only 10 addresses per API Key.
*
Get all managed addresses for an API Key.
* * @returns CustodialManagedAddress OK * @throws ApiError */ public static custodialGetWallets(): CancelablePromiseGet managed address for an API Key. It's possible to export the private key, if query parameter export is set to true.
* * @param id WalletID of the managed address * @param _export If set to, export the private key details in the response * @returns CustodialManagedAddress OK * @throws ApiError */ public static custodialGetWallet( id: string, _export: boolean = false, ): CancelablePromiseDelete managed address. Once deleted, the address won't be charged in a daily credit usage, but it won't be possible to get the private key for it.
* * @param id WalletID of the managed address * @returns void * @throws ApiError */ public static custodialDeleteWallet( id: string, ): CancelablePromiseSign transaction and transfer assets from a custodial managed address.
* Supported chains:
*
| Mainnet address | Devnet address | |
| Address | DSpHmb7hLnetoybammcJBJiyqMVR3pDhCuW6hqVg9eBF | DSpHmb7hLnetoybammcJBJiyqMVR3pDhCuW6hqVg9eBF |
* import { LAMPORTS_PER_SOL, PublicKey, SystemProgram, Transaction, Connection } from '@solana/web3.js'
*
* const connection = new Connection('https://api-eu1.tatum.io/v3/blockchain/node/SOL')
* const from = 'HrJtQTy2RW9c6y41RvN8x3bEiD6Co74AuhER2MGCpa58'
* const to = 'FZAS4mtPvswgVxbpc117SqfNgCDLTCtk5CoeAtt58FWU'
* const amount = '0.000001'
* const devnet_fee_payer = '5zPr5331CtBjgVeLedhmJPEpFaUsorLCnb3aCQPsUc9w'
* const fromPubkey = new PublicKey(from)
* const transaction = new Transaction({ feePayer: new PublicKey(devnet_fee_payer) })
* transaction.add(
* SystemProgram.transfer({
* fromPubkey: fromPubkey,
* toPubkey: new PublicKey(to),
* lamports: new BigNumber(amount).multipliedBy(LAMPORTS_PER_SOL).toNumber(),
* }),
* )
* const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash('finalized')
* transaction.recentBlockhash = blockhash
* transaction.lastValidBlockHeight = lastValidBlockHeight
* transaction.partialSign(...signers)
* return transaction.serialize({ requireAllSignatures: false }).toString('hex')
*
* For the above example, developer have 2 options how to sign transaction - if the sender address HrJtQTy2RW9c6y41RvN8x3bEiD6Co74AuhER2MGCpa58 is managed using a Tatum managed wallet with id 0b1eae3d-2520-4903-8bbf-5dec3ad2a5d4,
* the final payload to the custodial/transaction endpoint should look like this:
*
* {
* "chain": "SOL",
* "txData": "020001044a22af97a838a504e6f7c0b18d779afcea612da50794cc1dac641861fc1ab14afa5cacaf91c298694e64bb5496916c3c68a32affb92d4bcd2736fbb00169d57bd840de2a454960308f688cd3ee308c1fa01ecfa0b03770aaaf3b52d71d46c31d000000000000000000000000000000000000000000000000000000000000000060d38e0da20dc5900b7e902c918eae6a95e2d90af154b53a422f4ab26b050f4f01030201020c02000000e803000000000000",
* "walletIds": [
* {
* "key": "0b1eae3d-2520-4903-8bbf-5dec3ad2a5d4",
* "type": "MANAGED"
* }
* ]
* }
*
* If the sender address is not managed, the transaction could be signed with the private key of that address before the serialization and the payload will look like this:
*
* {
* "chain": "SOL",
* "txData": "020001044a22af97a838a504e6f7c0b18d779afcea612da50794cc1dac641861fc1ab14afa5cacaf91c298694e64bb5496916c3c68a32affb92d4bcd2736fbb00169d57bd840de2a454960308f688cd3ee308c1fa01ecfa0b03770aaaf3b52d71d46c31d000000000000000000000000000000000000000000000000000000000000000060d38e0da20dc5900b7e902c918eae6a95e2d90af154b53a422f4ab26b050f4f01030201020c02000000e803000000000000",
* "walletIds": []
* }
*
*
*
* @param requestBody
* @returns TransactionHash OK
* @throws ApiError
*/
public static custodialTransferManagedAddress(
requestBody?: TransferManagedAddress,
): CancelablePromise