From 43beea190cca0e5b6e1208a27aadbbec8432e0a8 Mon Sep 17 00:00:00 2001 From: polstianka Date: Tue, 17 Jun 2025 07:49:54 -0400 Subject: [PATCH 01/36] release actions --- .github/workflows/publish.yml | 29 +++++++++ .github/workflows/release.yml | 82 +++++++++++++++++++++++++ .kotlin/errors/errors-1728538677747.log | 4 -- 3 files changed, 111 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/publish.yml create mode 100644 .github/workflows/release.yml delete mode 100644 .kotlin/errors/errors-1728538677747.log diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 000000000..1747e9ae6 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,29 @@ +name: Publish tagged commit to public repo + +on: + push: + tags: + - '*' + +jobs: + mirror: + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - name: Checkout private repo at tag + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Push tag to public repo + env: + TOKEN: ${{ secrets.PUBLIC_REPO_TOKEN }} + TAG: ${{ github.ref_name }} + run: | + git config --global user.name "mirror-bot" + git config --global user.email "mirror-bot@example.com" + + git remote add public https://$TOKEN@github.com/ORG/PUBLIC_REPO.git + + git push --force --tags public $TAG \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..193e23736 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,82 @@ +name: Android APK release CD + +on: + push: + tags: + - 'v*' + +jobs: + build: + name: apk-release + runs-on: macos-latest + + steps: + - uses: actions/checkout@v4 + with: { fetch-depth: 0 } + + - name: Set up ruby env + uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.2 + bundler-cache: true + + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: 20.0.2+9 + + - name: Decode signing certificate into a file + env: + CERTIFICATE_BASE64: ${{ secrets.ANDROID_DIST_SIGNING_KEY }} + run: | + echo $CERTIFICATE_BASE64 | base64 --decode > google-release.keystore + + - name: Build android beta + run: bundle exec fastlane android beta + env: + KEYSTORE_FILE: ${{ github.workspace }}/google-release.keystore + KEYSTORE_PASSWORD: ${{ secrets.TONKEEPER_UPLOAD_STORE_PASSWORD }} + KEY_ALIAS: ${{ secrets.TONKEEPER_UPLOAD_KEY_ALIAS}} + KEY_PASSWORD: ${{ secrets.TONKEEPER_UPLOAD_KEY_PASSWORD }} + ANDROID_PUBLISHER_CREDENTIALS: ${{ secrets.ANDROID_PUBLISHER_CREDENTIALS }} + + - name: Upload android aab to artifacts + uses: actions/upload-artifact@v4 + with: + name: Tonkeeper aab ${{ env.VERSION_CODE }} + path: | + ${{ env.AAB_OUTPUT_PATH }} + + - name: Upload android apk to artifacts + uses: actions/upload-artifact@v4 + with: + name: Tonkeeper apk ${{ env.VERSION_CODE }} + path: | + ${{ env.APK_OUTPUT_PATH }} + + - name: Fix filename + run: | + mkdir -p release + cp "$APK_OUTPUT_PATH" release/Tonkeeper.apk + + - uses: actions/upload-artifact@v4 + with: + name: apk + path: release/Tonkeeper.apk + + publish: + needs: build + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - uses: actions/download-artifact@v4 + with: { name: apk } + + - uses: softprops/action-gh-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + files: Tonkeeper.apk \ No newline at end of file diff --git a/.kotlin/errors/errors-1728538677747.log b/.kotlin/errors/errors-1728538677747.log deleted file mode 100644 index 7cd151b6c..000000000 --- a/.kotlin/errors/errors-1728538677747.log +++ /dev/null @@ -1,4 +0,0 @@ -kotlin version: 2.0.20 -error message: The daemon has terminated unexpectedly on startup attempt #1 with error code: 0. The daemon process output: - 1. Kotlin compile daemon is ready - From 10acf78cae443b452317fad3075b54ab42790921 Mon Sep 17 00:00:00 2001 From: Andrey Sorokin Date: Wed, 16 Jul 2025 15:15:22 +0500 Subject: [PATCH 02/36] hide notification for non-gms (#159) --- .../tonkeeper/ui/screen/init/InitViewModel.kt | 269 +++++++++++------- .../screen/settings/main/SettingsViewModel.kt | 21 +- .../ui/screen/wallet/main/WalletViewModel.kt | 4 +- .../src/main/res/values-bg/strings.xml | 2 +- .../src/main/res/values-es/strings.xml | 2 +- .../src/main/res/values-in/strings.xml | 2 +- .../src/main/res/values-tr/strings.xml | 2 +- .../src/main/res/values-uk/strings.xml | 2 +- .../src/main/res/values-uz/strings.xml | 2 +- .../src/main/res/values-zh/strings.xml | 2 +- 10 files changed, 192 insertions(+), 116 deletions(-) diff --git a/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/init/InitViewModel.kt b/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/init/InitViewModel.kt index b4e0ee3a8..c7e484756 100644 --- a/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/init/InitViewModel.kt +++ b/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/init/InitViewModel.kt @@ -23,6 +23,7 @@ import com.tonapps.extensions.MutableEffectFlow import com.tonapps.extensions.logError import com.tonapps.icu.Coins import com.tonapps.icu.CurrencyFormatter +import com.tonapps.tonkeeper.Environment import com.tonapps.tonkeeper.RemoteConfig import com.tonapps.tonkeeper.core.AnalyticsHelper import com.tonapps.tonkeeper.extensions.fixW5Title @@ -85,8 +86,9 @@ class InitViewModel( private val rnLegacy: RNLegacy, private val settingsRepository: SettingsRepository, private val remoteConfig: RemoteConfig, + private val environment: Environment, savedStateHandle: SavedStateHandle -): BaseWalletVM(app) { +) : BaseWalletVM(app) { private val entropyHelper: EntropyHelper by lazy { EntropyHelper(context) @@ -129,7 +131,8 @@ class InitViewModel( private val _accountsFlow = MutableEffectFlow?>() val accountsFlow = _accountsFlow.asSharedFlow().filterNotNull() - val labelFlow = savedState.labelFlow.stateIn(viewModelScope, SharingStarted.Lazily, null).filterNotNull() + val labelFlow = + savedState.labelFlow.stateIn(viewModelScope, SharingStarted.Lazily, null).filterNotNull() private val isPinSet = AtomicBoolean(false) @@ -174,7 +177,15 @@ class InitViewModel( InitArgs.Type.Signer, InitArgs.Type.SignerQR -> resolveWallets(savedState.publicKey!!) InitArgs.Type.Ledger -> routeTo(InitRoute.SelectAccount) InitArgs.Type.Keystone -> routeTo(InitRoute.LabelAccount) - InitArgs.Type.New -> { routeTo(if (requestSetPinCode) InitRoute.CreatePasscode else InitRoute.Push) } + InitArgs.Type.New -> { + if (requestSetPinCode) { + routeTo(InitRoute.CreatePasscode) + } else if (environment.isGooglePlayServicesAvailable) { + routeTo(InitRoute.Push) + } else { + routeTo(InitRoute.LabelAccount) + } + } } } @@ -231,7 +242,7 @@ class InitViewModel( if (!valid) { routePopBackStack() } else { - routeTo(InitRoute.Push) + routeTo(if (environment.isGooglePlayServicesAvailable) InitRoute.Push else InitRoute.LabelAccount) } } @@ -243,66 +254,78 @@ class InitViewModel( return false } - private suspend fun resolveWallets(mnemonic: List): Boolean = withContext(Dispatchers.IO) { - try { - val privateKey = MnemonicHelper.privateKey(mnemonic) - val publicKey = privateKey.publicKey() - resolveWallets(InitModelState.PublicKey(publicKey = publicKey)) - true - } catch (e: Throwable) { - false - } - } - - private suspend fun resolveWallets(publicKey: InitModelState.PublicKey) = withContext(Dispatchers.IO) { - val accounts = if (publicKey.new) { - mutableListOf() - } else { - api.resolvePublicKey(publicKey.publicKey, testnet).filter { - it.walletVersion != WalletVersion.UNKNOWN - }.sortedByDescending { it.walletVersion.index }.toMutableList() + private suspend fun resolveWallets(mnemonic: List): Boolean = + withContext(Dispatchers.IO) { + try { + val privateKey = MnemonicHelper.privateKey(mnemonic) + val publicKey = privateKey.publicKey() + resolveWallets(InitModelState.PublicKey(publicKey = publicKey)) + true + } catch (e: Throwable) { + false + } } - if (accounts.count { it.walletVersion == WalletVersion.V5R1 } == 0) { - val contract = WalletV5R1Contract(publicKey.publicKey, tonNetwork) - val query = contract.address.toAccountId() - if (publicKey.new) { - accounts.add(0, AccountDetailsEntity(contract, testnet, new = true, initialized = false)) + private suspend fun resolveWallets(publicKey: InitModelState.PublicKey) = + withContext(Dispatchers.IO) { + val accounts = if (publicKey.new) { + mutableListOf() } else { - val apiAccount = api.resolveAccount(query, testnet) - val account = if (apiAccount == null) { - AccountDetailsEntity(contract, testnet = testnet, new = true, initialized = false) + api.resolvePublicKey(publicKey.publicKey, testnet).filter { + it.walletVersion != WalletVersion.UNKNOWN + }.sortedByDescending { it.walletVersion.index }.toMutableList() + } + + if (accounts.count { it.walletVersion == WalletVersion.V5R1 } == 0) { + val contract = WalletV5R1Contract(publicKey.publicKey, tonNetwork) + val query = contract.address.toAccountId() + if (publicKey.new) { + accounts.add( + 0, + AccountDetailsEntity(contract, testnet, new = true, initialized = false) + ) } else { - AccountDetailsEntity(query, apiAccount.copy( - interfaces = listOf("wallet_v5r1") - ), testnet, false) + val apiAccount = api.resolveAccount(query, testnet) + val account = if (apiAccount == null) { + AccountDetailsEntity( + contract, + testnet = testnet, + new = true, + initialized = false + ) + } else { + AccountDetailsEntity( + query, apiAccount.copy( + interfaces = listOf("wallet_v5r1") + ), testnet, false + ) + } + accounts.add(0, account) } - accounts.add(0, account) } - } - - val list = accounts.mapIndexed { index, account -> - getAccountItem(account, ListCell.getPosition(accounts.size, index)) - } - val items = mutableListOf() - for (account in list) { - items.add(account) - } - setAccounts(items.toList()) + val list = accounts.mapIndexed { index, account -> + getAccountItem(account, ListCell.getPosition(accounts.size, index)) + } - if (items.size > 1) { - routeTo(InitRoute.SelectAccount) - } else if (requestSetPinCode) { - val accountName = items.first().name - if (!accountName.isNullOrBlank()) { - setLabelName(accountName) + val items = mutableListOf() + for (account in list) { + items.add(account) + } + setAccounts(items.toList()) + + if (items.size > 1) { + routeTo(InitRoute.SelectAccount) + } else if (requestSetPinCode) { + val accountName = items.first().name + if (!accountName.isNullOrBlank()) { + setLabelName(accountName) + } + routeTo(InitRoute.CreatePasscode) + } else { + routeTo(if (environment.isGooglePlayServicesAvailable) InitRoute.Push else InitRoute.LabelAccount) } - routeTo(InitRoute.CreatePasscode) - } else { - routeTo(InitRoute.Push) } - } private fun applyAccountName() { viewModelScope.launch { @@ -372,7 +395,7 @@ class InitViewModel( val count = getWalletsCount() return if (count == 0 && type == InitArgs.Type.New) { getString(Localization.app_name) - } else { + } else { getString(Localization.wallet) } } @@ -435,10 +458,12 @@ class InitViewModel( val oldLabel = getLabel() val emoji = Emoji.getEmojiFromPrefix(name) ?: oldLabel.emoji - setLabel(oldLabel.copy( - accountName = name.replace(emoji.toString(), "").trim(), - emoji = emoji - )) + setLabel( + oldLabel.copy( + accountName = name.replace(emoji.toString(), "").trim(), + emoji = emoji + ) + ) } fun nextStep(context: Context, from: InitRoute) { @@ -447,10 +472,10 @@ class InitViewModel( } else if (from == InitRoute.LabelAccount) { execute(context) } else if (from == InitRoute.WatchAccount) { - routeTo(InitRoute.Push) + routeTo(if (environment.isGooglePlayServicesAvailable) InitRoute.Push else InitRoute.LabelAccount) } else if (from == InitRoute.SelectAccount && !requestSetPinCode) { applyAccountName() - routeTo(InitRoute.Push) + routeTo(if (environment.isGooglePlayServicesAvailable) InitRoute.Push else InitRoute.LabelAccount) } else if (requestSetPinCode) { applyAccountName() routeTo(InitRoute.CreatePasscode) @@ -480,7 +505,12 @@ class InitViewModel( when (type) { InitArgs.Type.Watch -> wallets.add(saveWatchWallet()) InitArgs.Type.New -> wallets.add(newWallet(context)) - InitArgs.Type.Import, InitArgs.Type.Testnet -> wallets.addAll(importWallet(context)) + InitArgs.Type.Import, InitArgs.Type.Testnet -> wallets.addAll( + importWallet( + context + ) + ) + InitArgs.Type.Signer -> wallets.addAll(signerWallets(false)) InitArgs.Type.SignerQR -> wallets.addAll(signerWallets(true)) InitArgs.Type.Ledger -> wallets.addAll(ledgerWallets()) @@ -561,44 +591,59 @@ class InitViewModel( val wallet = accountRepository.addNewWallet(walletId, label, mnemonic) - AnalyticsHelper.simpleTrackEvent("wallet_generate", installId, hashMapOf("wallet_type" to wallet.version.title)) + AnalyticsHelper.simpleTrackEvent( + "wallet_generate", + installId, + hashMapOf("wallet_type" to wallet.version.title) + ) return wallet } - private suspend fun importWallet(context: Context): List = withContext(Dispatchers.IO) { - val accounts = getSelectedAccounts() - if (accounts.isEmpty()) { - throw IllegalStateException("Wallet versions are not set") - } - - val mnemonic = savedState.mnemonic ?: throw IllegalStateException("Mnemonic is not set") - if (!TonMnemonic.isValid(mnemonic)) { - throw IllegalStateException("Invalid mnemonic") - } + private suspend fun importWallet(context: Context): List = + withContext(Dispatchers.IO) { + val accounts = getSelectedAccounts() + if (accounts.isEmpty()) { + throw IllegalStateException("Wallet versions are not set") + } - val ids = accounts.map { AccountRepository.newWalletId() } - saveMnemonic(context, ids, mnemonic) + val mnemonic = savedState.mnemonic ?: throw IllegalStateException("Mnemonic is not set") + if (!TonMnemonic.isValid(mnemonic)) { + throw IllegalStateException("Invalid mnemonic") + } - val label = buildNewLabel(accounts.map { - SimpleAccount( - name = it.name, - version = it.walletVersion - ) - }) + val ids = accounts.map { AccountRepository.newWalletId() } + saveMnemonic(context, ids, mnemonic) + + val label = buildNewLabel(accounts.map { + SimpleAccount( + name = it.name, + version = it.walletVersion + ) + }) + + accounts.map { + AnalyticsHelper.simpleTrackEvent( + "wallet_import", + installId, + hashMapOf("wallet_type" to it.walletVersion.title) + ) + } - accounts.map { - AnalyticsHelper.simpleTrackEvent("wallet_import", installId, hashMapOf("wallet_type" to it.walletVersion.title)) - } + val wallets = accountRepository.importWallet( + ids, + label, + mnemonic, + accounts.map { it.walletVersion }, + testnet, + accounts.map { it.initialized }) - val wallets = accountRepository.importWallet(ids, label, mnemonic, accounts.map { it.walletVersion }, testnet, accounts.map { it.initialized }) + if (!testnet && !remoteConfig.isTronDisabled) { + checkTronBalance(wallets) + } - if (!testnet && !remoteConfig.isTronDisabled) { - checkTronBalance(wallets) + wallets } - wallets - } - private suspend fun checkTronBalance(wallets: List) { val wallet = wallets.first() val tronAddress = accountRepository.getTronAddress(wallet.id) ?: return @@ -608,19 +653,23 @@ class InitViewModel( wallets.forEach { settingsRepository.setTokenHidden(it.id, TokenEntity.TRON_USDT.address, false) settingsRepository.setTokenPinned(it.id, TokenEntity.TRON_USDT.address, true) - settingsRepository.setTokensSort(wallet.id, listOf(TokenEntity.USDT.address, TokenEntity.TRON_USDT.address)) + settingsRepository.setTokensSort( + wallet.id, + listOf(TokenEntity.USDT.address, TokenEntity.TRON_USDT.address) + ) } } } private suspend fun ledgerWallets(): List { - val ledgerConnectData = savedState.ledgerConnectData ?: throw IllegalStateException("Ledger connect data is not set") + val ledgerConnectData = savedState.ledgerConnectData + ?: throw IllegalStateException("Ledger connect data is not set") val accounts = getSelectedAccounts() val ledgerAccounts = accounts.map { selectedAccount -> - ledgerConnectData.accounts.find { - account -> account.path.index == selectedAccount.ledgerIndex + ledgerConnectData.accounts.find { account -> + account.path.index == selectedAccount.ledgerIndex } ?: throw IllegalStateException("Ledger account is not found") } @@ -649,20 +698,33 @@ class InitViewModel( ) }) - return accountRepository.pairSigner(label, publicKey.publicKey, accounts.map { it.walletVersion }, qr, accounts.map { it.initialized }) + return accountRepository.pairSigner( + label, + publicKey.publicKey, + accounts.map { it.walletVersion }, + qr, + accounts.map { it.initialized }) } private suspend fun keystoneWallet(): List { val publicKey = savedState.publicKey ?: throw IllegalStateException("Public key is not set") val keystone = savedState.keystone ?: throw IllegalStateException("Keystone is not set") - val label = buildNewLabel(SimpleAccount( - version = WalletVersion.V4R2 - )) + val label = buildNewLabel( + SimpleAccount( + version = WalletVersion.V4R2 + ) + ) - val contact = BaseWalletContract.create(publicKey.publicKey, WalletVersion.V4R2.title, tonNetwork.value) - val account = api.resolveAccount(contact.address.toWalletAddress(testnet = testnet), testnet) - val initialized = account != null && (account.status == AccountStatus.active || account.status == AccountStatus.frozen) + val contact = BaseWalletContract.create( + publicKey.publicKey, + WalletVersion.V4R2.title, + tonNetwork.value + ) + val account = + api.resolveAccount(contact.address.toWalletAddress(testnet = testnet), testnet) + val initialized = + account != null && (account.status == AccountStatus.active || account.status == AccountStatus.frozen) return accountRepository.pairKeystone(label, publicKey.publicKey, keystone, initialized) } @@ -676,7 +738,8 @@ class InitViewModel( return@withContext } if (passcodeManager.hasPinCode()) { - val isValid = passcodeManager.confirmation(context, context.getString(Localization.app_name)) + val isValid = + passcodeManager.confirmation(context, context.getString(Localization.app_name)) if (!isValid) { throw IllegalStateException("wrong passcode") } @@ -704,7 +767,7 @@ class InitViewModel( val version: WalletVersion ) { - constructor(account: AccountDetailsEntity): this( + constructor(account: AccountDetailsEntity) : this( name = account.name, version = account.walletVersion ) diff --git a/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/settings/main/SettingsViewModel.kt b/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/settings/main/SettingsViewModel.kt index 227dc169b..03cd91840 100644 --- a/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/settings/main/SettingsViewModel.kt +++ b/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/settings/main/SettingsViewModel.kt @@ -235,22 +235,33 @@ class SettingsViewModel( uiItems.add(Item.Space) } - uiItems.add(Item.Notifications(ListCell.Position.FIRST)) + if (environment.isGooglePlayServicesAvailable) { + uiItems.add(Item.Notifications(ListCell.Position.FIRST)) + } + + var secondCellPosition = if (environment.isGooglePlayServicesAvailable) { + ListCell.Position.MIDDLE + } else { + ListCell.Position.FIRST + } if (wallet.hasPrivateKey) { if (!hasW5) { - uiItems.add(Item.W5(ListCell.Position.MIDDLE)) + uiItems.add(Item.W5(secondCellPosition)) + secondCellPosition = ListCell.Position.MIDDLE } if (!hasV4R2) { - uiItems.add(Item.V4R2(ListCell.Position.MIDDLE)) + uiItems.add(Item.V4R2(secondCellPosition)) + secondCellPosition = ListCell.Position.MIDDLE } } if (!wallet.testnet) { - uiItems.add(Item.Currency(currency.code, ListCell.Position.MIDDLE)) + uiItems.add(Item.Currency(currency.code, secondCellPosition)) + secondCellPosition = ListCell.Position.MIDDLE } if (wallet.isTonConnectSupported) { - uiItems.add(Item.SearchEngine(searchEngine, ListCell.Position.MIDDLE)) + uiItems.add(Item.SearchEngine(searchEngine, secondCellPosition)) uiItems.add(Item.ConnectedApps(ListCell.Position.MIDDLE)) } diff --git a/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/wallet/main/WalletViewModel.kt b/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/wallet/main/WalletViewModel.kt index 6260bbbab..793a60b84 100644 --- a/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/wallet/main/WalletViewModel.kt +++ b/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/wallet/main/WalletViewModel.kt @@ -4,6 +4,7 @@ import android.app.Application import androidx.lifecycle.viewModelScope import com.tonapps.icu.Coins import com.tonapps.network.NetworkMonitor +import com.tonapps.tonkeeper.Environment import com.tonapps.tonkeeper.RemoteConfig import com.tonapps.tonkeeper.core.entities.AssetsEntity.Companion.sort import com.tonapps.tonkeeper.extensions.hasPushPermission @@ -56,6 +57,7 @@ class WalletViewModel( private val assetsManager: AssetsManager, private val apkManager: APKManager, private val remoteConfig: RemoteConfig, + private val environment: Environment, ) : BaseWalletVM(app) { val installId: String @@ -235,7 +237,7 @@ class WalletViewModel( val walletPushEnabled = settingsRepository.getPushWallet(state.wallet.id) val hasInitializedWallet = accountRepository.getInitializedWallets().isNotEmpty() State.Setup( - pushEnabled = context.hasPushPermission() && walletPushEnabled, + pushEnabled = !environment.isGooglePlayServicesAvailable || (context.hasPushPermission() && walletPushEnabled), biometryEnabled = if (wallet.hasPrivateKey) settingsRepository.biometric else true, hasBackup = if (wallet.hasPrivateKey) state.hasBackup else true, showTelegramChannel = false, diff --git a/apps/wallet/localization/src/main/res/values-bg/strings.xml b/apps/wallet/localization/src/main/res/values-bg/strings.xml index 62a6d6ee7..eab9719e5 100644 --- a/apps/wallet/localization/src/main/res/values-bg/strings.xml +++ b/apps/wallet/localization/src/main/res/values-bg/strings.xml @@ -418,7 +418,7 @@ Система Мрежова такса Потвърдете - Трябва да включите бележка от обмена за трансфер. Без нея средствата ви ще бъдат загубени. + При изпращане не забравяйте да включите бележката или тагa от борсата. Без него средствата няма да бъдат депозирани и може да бъдат загубени. В момента използвате експериментална версия на Tonkeeper. Инсталирайте стабилната версия Отворете Signer » Изберете необходимия ключ » Сканирайте QR код diff --git a/apps/wallet/localization/src/main/res/values-es/strings.xml b/apps/wallet/localization/src/main/res/values-es/strings.xml index 1aa584fc8..d2cb11b10 100644 --- a/apps/wallet/localization/src/main/res/values-es/strings.xml +++ b/apps/wallet/localization/src/main/res/values-es/strings.xml @@ -353,7 +353,7 @@ Sistema Tarifa de red Confirmar - Debe incluir la nota del intercambio para la transferencia. Sin ella, sus fondos se perderán. + Al enviar, asegúrate de incluir el memo o etiqueta del intercambio. Sin él, los fondos no se depositarán y podrían perderse. Actualmente estás usando una versión experimental de Tonkeeper. Instalar versión estable Abra Signer » Seleccione la clave requerida » Escanee el código QR diff --git a/apps/wallet/localization/src/main/res/values-in/strings.xml b/apps/wallet/localization/src/main/res/values-in/strings.xml index 919d79ad7..865bbda09 100644 --- a/apps/wallet/localization/src/main/res/values-in/strings.xml +++ b/apps/wallet/localization/src/main/res/values-in/strings.xml @@ -353,7 +353,7 @@ Sistem Biaya jaringan Konfirmasi - Anda harus menyertakan catatan dari bursa untuk transfer. Tanpanya, dana Anda akan hilang. + Saat mengirim, pastikan untuk menyertakan memo atau tag dari bursa. Tanpanya, dana tidak akan disetorkan dan bisa hilang. Anda saat ini menggunakan versi eksperimental dari Tonkeeper. Instal versi stabil Buka Penanda » Pilih kunci yang diperlukan » Pindai kode QR diff --git a/apps/wallet/localization/src/main/res/values-tr/strings.xml b/apps/wallet/localization/src/main/res/values-tr/strings.xml index 9cdc7a86c..9508cfadc 100644 --- a/apps/wallet/localization/src/main/res/values-tr/strings.xml +++ b/apps/wallet/localization/src/main/res/values-tr/strings.xml @@ -354,7 +354,7 @@ Sistem Ağ ücreti Onayla - Transfer için borsadan aldığınız notu eklemelisiniz. Onsuz, paranız kaybolacaktır. + Gönderirken borsadan alınan notu veya etiketi eklediğinizden emin olun. Olmazsa, fonlar yatırılmaz ve kaybolabilir. Şu anda Tonkeeper\'ın deneysel bir sürümünü kullanıyorsunuz. Kararlı sürümü yükle Açık İmzalayıcı » Gerekli anahtarı seç » QR kodunu tara diff --git a/apps/wallet/localization/src/main/res/values-uk/strings.xml b/apps/wallet/localization/src/main/res/values-uk/strings.xml index c910db8fc..0188ad800 100644 --- a/apps/wallet/localization/src/main/res/values-uk/strings.xml +++ b/apps/wallet/localization/src/main/res/values-uk/strings.xml @@ -353,7 +353,7 @@ Система Мережевий збір Підтвердити - Ви повинні додати примітку від обміну для переказу. Без неї ваші кошти будуть втрачені. + Під час надсилання обов’язково додайте примітку або тег від біржі. Без цього кошти не будуть зараховані й можуть бути втрачені. Ви використовуєте експериментальну версію Tonkeeper. Встановити стабільну версію Відкрийте Signer » Виберіть потрібний ключ » Скануйте QR-код diff --git a/apps/wallet/localization/src/main/res/values-uz/strings.xml b/apps/wallet/localization/src/main/res/values-uz/strings.xml index 4d6f14b2d..0a9827050 100644 --- a/apps/wallet/localization/src/main/res/values-uz/strings.xml +++ b/apps/wallet/localization/src/main/res/values-uz/strings.xml @@ -355,7 +355,7 @@ Tizim Tarmoq to\'lovi Tasdiqlash - Pul oʻtkazmasi uchun almashinuvdan eslatmani kiritishingiz kerak. Aks holda, mablagʻlaringiz yoʻqoladi. + Yuborishda birjadan olingan eslatma yoki tegni qo‘shganingizga ishonch hosil qiling. U bo‘lmasa, mablag‘lar tushmaydi va yo‘qolishi mumkin. Siz hozirda Tonkeeper-ning tajribaviy versiyasidan foydalanmoqdasiz. Barqaror versiyani o\'rnating Signer-ni oching » Kerakli kalitni tanlang » QR kodni skaner qiling diff --git a/apps/wallet/localization/src/main/res/values-zh/strings.xml b/apps/wallet/localization/src/main/res/values-zh/strings.xml index d70cad93c..6580b81cf 100644 --- a/apps/wallet/localization/src/main/res/values-zh/strings.xml +++ b/apps/wallet/localization/src/main/res/values-zh/strings.xml @@ -354,7 +354,7 @@ 系统 网络费用 确认 - 您必须包含来自交易所的备注进行转账。否则,您的资金将丢失。 + 发送时,请务必包含交易所提供的备注或标签。否则资金将无法入账,且可能丢失。 您当前正在使用 Tonkeeper 的实验版本。 安装稳定版 打开签名器 » 选择所需的密钥 » 扫描二维码 From 38e0e953ba6277da10b871f35d4b934466e21ee9 Mon Sep 17 00:00:00 2001 From: Andrey Sorokin Date: Wed, 16 Jul 2025 15:16:08 +0500 Subject: [PATCH 03/36] sign raw fee selector (#158) --- .../data/settings/SettingsRepository.kt | 9 - .../tonkeeper/core/history/HistoryHelper.kt | 95 ++----- .../core/history/list/HistoryAdapter.kt | 14 +- .../list/holder/HistoryActionHolder.kt | 43 +++- .../core/history/list/item/HistoryItem.kt | 2 + .../collectibles/main/CollectiblesScreen.kt | 7 +- .../main/CollectiblesViewModel.kt | 4 + .../ui/screen/send/main/SendScreen.kt | 11 +- .../ui/screen/send/main/SendViewModel.kt | 3 +- .../send/transaction/SendTransactionScreen.kt | 87 ++++++- .../send/transaction/SendTransactionState.kt | 4 +- .../transaction/SendTransactionViewModel.kt | 242 ++++++++++++++---- .../usecase/emulation/EmulationUseCase.kt | 63 +++-- .../src/main/res/values-bg/strings.xml | 2 - .../src/main/res/values-es/strings.xml | 2 - .../src/main/res/values-in/strings.xml | 2 - .../src/main/res/values-ru/strings.xml | 2 - .../src/main/res/values-tr/strings.xml | 2 - .../src/main/res/values-uk/strings.xml | 2 - .../src/main/res/values-uz/strings.xml | 2 - .../src/main/res/values-zh/strings.xml | 2 - .../src/main/res/values/strings.xml | 2 - 22 files changed, 401 insertions(+), 201 deletions(-) diff --git a/apps/wallet/data/settings/src/main/java/com/tonapps/wallet/data/settings/SettingsRepository.kt b/apps/wallet/data/settings/src/main/java/com/tonapps/wallet/data/settings/SettingsRepository.kt index dd523f7d5..bd38d7422 100644 --- a/apps/wallet/data/settings/src/main/java/com/tonapps/wallet/data/settings/SettingsRepository.kt +++ b/apps/wallet/data/settings/src/main/java/com/tonapps/wallet/data/settings/SettingsRepository.kt @@ -57,7 +57,6 @@ class SettingsRepository( private const val SEARCH_ENGINE_KEY = "search_engine" private const val ENCRYPTED_COMMENT_MODAL_KEY = "encrypted_comment_modal" private const val BATTERY_VIEWED_KEY = "battery_viewed" - private const val PAYMENT_METHOD_VIEWED_KEY = "payment_method_viewed" private const val CHART_PERIOD_KEY = "chart_period" private const val SAFE_MODE_DISABLED_UNIX_KEY = "safe_mode_disabled_unix" private const val SHOW_SAFE_MODE_SETUP_KEY = "show_safe_mode_setup" @@ -256,14 +255,6 @@ class SettingsRepository( } } - var paymentMethodViewed: Boolean = prefs.getBoolean(PAYMENT_METHOD_VIEWED_KEY, false) - set(value) { - if (value != field) { - prefs.putBoolean(PAYMENT_METHOD_VIEWED_KEY, value) - field = value - } - } - var showSafeModeSetup: Boolean = prefs.getBoolean(SHOW_SAFE_MODE_SETUP_KEY, false) set(value) { if (value != field) { diff --git a/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/core/history/HistoryHelper.kt b/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/core/history/HistoryHelper.kt index ad26c902d..1a9f41f78 100644 --- a/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/core/history/HistoryHelper.kt +++ b/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/core/history/HistoryHelper.kt @@ -1,9 +1,7 @@ package com.tonapps.tonkeeper.core.history import android.content.Context -import android.util.Log import androidx.collection.arrayMapOf -import com.squareup.moshi.Json import com.tonapps.blockchain.ton.extensions.equalsAddress import com.tonapps.icu.Coins import com.tonapps.extensions.max24 @@ -30,6 +28,7 @@ import kotlinx.coroutines.withContext import com.tonapps.tonkeeper.extensions.with import com.tonapps.tonkeeper.helper.DateHelper import com.tonapps.tonkeeper.ui.screen.dialog.encrypted.EncryptedCommentScreen +import com.tonapps.tonkeeper.ui.screen.send.main.state.SendFee import com.tonapps.tonkeeper.usecase.emulation.Emulated import com.tonapps.uikit.list.ListCell import com.tonapps.wallet.api.API @@ -46,12 +45,10 @@ import com.tonapps.wallet.data.events.EventsRepository import com.tonapps.wallet.data.events.TxActionType import com.tonapps.wallet.data.passcode.PasscodeManager import com.tonapps.wallet.data.rates.RatesRepository -import com.tonapps.wallet.data.rates.entity.RatesEntity import com.tonapps.wallet.data.settings.SettingsRepository import com.tonapps.wallet.localization.Localization import com.tonapps.wallet.localization.Plurals import io.tonapi.models.JettonVerificationType -import io.tonapi.models.MessageConsequences import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.flowOn import kotlinx.coroutines.flow.map @@ -59,7 +56,6 @@ import kotlinx.coroutines.flow.take import java.text.SimpleDateFormat import java.util.Calendar import java.util.Locale -import kotlin.math.abs // TODO request refactoring class HistoryHelper( @@ -203,69 +199,8 @@ class HistoryHelper( suspend fun create( wallet: WalletEntity, - response: MessageConsequences, - rates: RatesEntity, - isBattery: Boolean = false, - options: ActionOptions - ): Details { - val items = mapping( - wallet = wallet, - event = response.event, - options = options.copy( - removeDate = true, - positionExtra = 1 - ) - ).toMutableList() - val extra = response.event.extra - - val fee = if (0 > extra) Coins.of(abs(extra)) else Coins.ZERO - val feeFormat = "≈ " + CurrencyFormatter.format("TON", fee) - val feeFiat = rates.convert("TON", fee) - val feeFiatFormat = CurrencyFormatter.formatFiat(rates.currency.code, feeFiat) - - val refund = if (extra > 0) Coins.of(extra) else Coins.ZERO - val refundFormat = "≈ " + CurrencyFormatter.format("TON", refund) - val refundFiat = rates.convert("TON", refund) - val refundFiatFormat = CurrencyFormatter.formatFiat(rates.currency.code, refundFiat) - - val isRefund = extra > 0 - - - items.add( - HistoryItem.Event( - index = items.lastIndex + 1, - position = ListCell.Position.LAST, - txId = "fee", - iconURL = "", - action = if (isRefund) ActionType.Refund else ActionType.Fee, - title = "", - subtitle = if (isBattery) context.getString(Localization.will_be_paid_with_battery) else "", - value = if (isRefund) refundFormat else feeFormat, - date = if (isRefund) refundFiatFormat.toString() else feeFiatFormat.toString(), - isOut = true, - sender = null, - recipient = null, - failed = false, - isScam = false, - wallet = wallet, - isMaybeSpam = false, - actionOutStatus = ActionOutStatus.Send - ) - ) - - return Details( - accountId = wallet.accountId, - items = items.toList(), - fee = fee, - feeFormat = feeFormat, - feeFiat = feeFiat, - feeFiatFormat = feeFiatFormat - ) - } - - suspend fun create( - wallet: WalletEntity, - emulated: Emulated + emulated: Emulated, + fee: SendFee, ): Details { val items = mapping( wallet = wallet, @@ -310,9 +245,26 @@ class HistoryHelper( iconURL = "", action = if (emulated.extra.isRefund) ActionType.Refund else ActionType.Fee, title = "", - subtitle = if (emulated.withBattery) context.getString(Localization.will_be_paid_with_battery) else "", - value = feeFormat, - date = feeFiatFormat.toString(), + subtitle = "", + value = if (fee is SendFee.Battery) { + "≈ " + context.resources.getQuantityString( + Plurals.battery_charges, + fee.charges, + CurrencyFormatter.format(value = fee.charges.toBigDecimal()) + ) + } else { + feeFormat + }, + date = if (fee is SendFee.Battery) { + context.getString( + Localization.out_of_available_charges, + CurrencyFormatter.format( + value = fee.chargesBalance.toBigDecimal() + ) + ) + } else { + feeFiatFormat.toString() + }, isOut = true, sender = null, recipient = null, @@ -320,6 +272,7 @@ class HistoryHelper( isScam = false, wallet = wallet, actionOutStatus = ActionOutStatus.Any, + sendFee = fee, ) ) diff --git a/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/core/history/list/HistoryAdapter.kt b/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/core/history/list/HistoryAdapter.kt index 8bd03af57..07b2ab464 100644 --- a/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/core/history/list/HistoryAdapter.kt +++ b/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/core/history/list/HistoryAdapter.kt @@ -1,5 +1,6 @@ package com.tonapps.tonkeeper.core.history.list +import android.view.View import android.view.ViewGroup import androidx.recyclerview.widget.RecyclerView import com.tonapps.tonkeeper.core.history.list.holder.HistoryActionHolder @@ -9,12 +10,15 @@ import com.tonapps.tonkeeper.core.history.list.holder.HistoryFailedHolder import com.tonapps.tonkeeper.core.history.list.holder.HistoryHeaderHolder import com.tonapps.tonkeeper.core.history.list.holder.HistoryLoaderHolder import com.tonapps.tonkeeper.core.history.list.item.HistoryItem +import com.tonapps.tonkeeper.ui.screen.send.main.state.SendFee import com.tonapps.uikit.list.BaseListAdapter import com.tonapps.uikit.list.BaseListHolder import com.tonapps.uikit.list.BaseListItem open class HistoryAdapter( - private val disableOpenAction: Boolean = false + private val disableOpenAction: Boolean = false, + private val shouldShowFeeToggle: () -> Boolean = { true }, + private val showFeeMethods: (currentFee: SendFee, targetView: View) -> Unit = { _, _ -> } ) : BaseListAdapter() { init { @@ -35,7 +39,13 @@ open class HistoryAdapter( viewType: Int ): BaseListHolder { return when (viewType) { - HistoryItem.TYPE_ACTION -> HistoryActionHolder(parent, disableOpenAction) + HistoryItem.TYPE_ACTION -> HistoryActionHolder( + parent, + disableOpenAction, + shouldShowFeeToggle, + showFeeMethods + ) + HistoryItem.TYPE_HEADER -> HistoryHeaderHolder(parent) HistoryItem.TYPE_LOADER -> HistoryLoaderHolder(parent) HistoryItem.TYPE_APP -> HistoryAppHolder(parent) diff --git a/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/core/history/list/holder/HistoryActionHolder.kt b/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/core/history/list/holder/HistoryActionHolder.kt index 016c3a27a..c3a3b45c9 100644 --- a/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/core/history/list/holder/HistoryActionHolder.kt +++ b/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/core/history/list/holder/HistoryActionHolder.kt @@ -2,17 +2,21 @@ package com.tonapps.tonkeeper.core.history.list.holder import android.graphics.drawable.Drawable import android.net.Uri -import android.util.Log +import android.os.Build +import android.text.Spannable +import android.text.SpannableStringBuilder +import android.text.style.ImageSpan import android.view.View import android.view.ViewGroup import androidx.annotation.ColorInt +import androidx.annotation.RequiresApi import androidx.appcompat.widget.AppCompatTextView +import androidx.core.net.toUri import com.facebook.imagepipeline.common.ResizeOptions import com.facebook.imagepipeline.postprocessors.BlurPostProcessor import com.facebook.imagepipeline.request.ImageRequestBuilder import com.tonapps.extensions.logError import com.tonapps.extensions.max24 -import com.tonapps.extensions.short12 import com.tonapps.icu.CurrencyFormatter.withCustomSymbol import com.tonapps.tonkeeper.core.history.ActionType import com.tonapps.tonkeeper.core.history.HistoryHelper @@ -20,13 +24,15 @@ import com.tonapps.tonkeeper.core.history.iconRes import com.tonapps.tonkeeper.core.history.list.item.HistoryItem import com.tonapps.tonkeeper.core.history.nameRes import com.tonapps.tonkeeper.koin.historyHelper -import com.tonapps.tonkeeper.ui.screen.transaction.TransactionScreen import com.tonapps.tonkeeper.ui.screen.nft.NftScreen +import com.tonapps.tonkeeper.ui.screen.send.main.state.SendFee +import com.tonapps.tonkeeper.ui.screen.transaction.TransactionScreen import com.tonapps.tonkeeperx.R import com.tonapps.uikit.color.accentGreenColor import com.tonapps.uikit.color.accentOrangeColor import com.tonapps.uikit.color.iconSecondaryColor import com.tonapps.uikit.color.stateList +import com.tonapps.uikit.color.textAccentColor import com.tonapps.uikit.color.textPrimaryColor import com.tonapps.uikit.color.textSecondaryColor import com.tonapps.uikit.color.textTertiaryColor @@ -44,11 +50,12 @@ import uikit.navigation.Navigation import uikit.navigation.Navigation.Companion.navigation import uikit.widget.FrescoView import uikit.widget.LoaderView -import androidx.core.net.toUri class HistoryActionHolder( parent: ViewGroup, private val disableOpenAction: Boolean, + private val shouldShowFeeToggle: () -> Boolean, + private val showFeeMethods: (currentFee: SendFee, targetView: View) -> Unit ) : HistoryHolder(parent, R.layout.view_history_action) { private val amountColorReceived = context.accentGreenColor @@ -76,6 +83,7 @@ class HistoryActionHolder( drawable } + @RequiresApi(Build.VERSION_CODES.Q) override fun onBind(item: HistoryItem.Event) { commentView.clearDrawables() @@ -103,6 +111,21 @@ class HistoryActionHolder( subtitleView.text = item.subtitle + if (item.txId == "fee" && item.sendFee != null && shouldShowFeeToggle()) { + subtitleView.setTextColor(context.textAccentColor) + val text = getString(Localization.edit_full) + val drawable = context.drawable(UIKitIcon.ic_chevron_right_12, subtitleView.currentTextColor) + drawable.setBounds(0, 0, drawable.intrinsicWidth, drawable.intrinsicHeight) + val span = ImageSpan(drawable, ImageSpan.ALIGN_CENTER) + val spannable = SpannableStringBuilder("$text ") + spannable.setSpan(span, spannable.length - 1, spannable.length, Spannable.SPAN_INCLUSIVE_EXCLUSIVE) + + subtitleView.text = spannable + itemView.setOnClickListener { + showFeeMethods(item.sendFee, itemView) + } + } + dateView.text = item.date if (item.failed && !item.pending) { @@ -184,7 +207,13 @@ class HistoryActionHolder( } else { commentView.text = comment.body.max24 commentView.setLeftDrawable(null) - commentView.setOnClickListener { context.navigation?.add(TransactionScreen.newInstance(item!!)) } + commentView.setOnClickListener { + context.navigation?.add( + TransactionScreen.newInstance( + item!! + ) + ) + } } } @@ -194,7 +223,9 @@ class HistoryActionHolder( senderAddress: String ) { val scope = lifecycleScope ?: return - val flow = context.historyHelper?.requestDecryptComment(context, comment, txId, senderAddress) ?: return + val flow = + context.historyHelper?.requestDecryptComment(context, comment, txId, senderAddress) + ?: return flow.catch { context.logError(it) commentView.reject() diff --git a/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/core/history/list/item/HistoryItem.kt b/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/core/history/list/item/HistoryItem.kt index b78914f01..9a9097ee9 100644 --- a/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/core/history/list/item/HistoryItem.kt +++ b/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/core/history/list/item/HistoryItem.kt @@ -17,6 +17,7 @@ import com.tonapps.extensions.writeEnum import com.tonapps.tonkeeper.core.history.ActionOutStatus import com.tonapps.tonkeeper.core.history.ActionType import com.tonapps.tonkeeper.helper.DateHelper +import com.tonapps.tonkeeper.ui.screen.send.main.state.SendFee import com.tonapps.uikit.list.BaseListItem import com.tonapps.uikit.list.ListCell import com.tonapps.wallet.api.entity.Blockchain @@ -318,6 +319,7 @@ sealed class HistoryItem( val spamState: SpamTransactionState = SpamTransactionState.UNKNOWN, val actionOutStatus: ActionOutStatus, val showNetwork: Boolean = false, + val sendFee: SendFee? = null ): HistoryItem(TYPE_ACTION) { val account: Account? diff --git a/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/collectibles/main/CollectiblesScreen.kt b/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/collectibles/main/CollectiblesScreen.kt index dfa6b926f..78b5d75a2 100644 --- a/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/collectibles/main/CollectiblesScreen.kt +++ b/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/collectibles/main/CollectiblesScreen.kt @@ -73,11 +73,14 @@ class CollectiblesScreen(wallet: WalletEntity): MainScreen.Child(R.layout.fragme headerView.setSubtitle(Localization.updating) } is UiListState.Empty -> { - removeActionIcons() + if (viewModel.hasNfts) { + applyActionIcons() + } else { + removeActionIcons() + } refreshView.isRefreshing = false setEmptyState() headerView.setSubtitle(null) - headerView.setAction(0) } is UiListState.Items -> { applyActionIcons() diff --git a/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/collectibles/main/CollectiblesViewModel.kt b/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/collectibles/main/CollectiblesViewModel.kt index b52b1eafd..e4fda8bdb 100644 --- a/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/collectibles/main/CollectiblesViewModel.kt +++ b/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/collectibles/main/CollectiblesViewModel.kt @@ -57,6 +57,9 @@ class CollectiblesViewModel( ) }.stateIn(viewModelScope, SharingStarted.Eagerly, null).filterNotNull().flattenFirst() + var hasNfts = false + private set + init { transactionManager.eventsFlow(wallet).collectFlow { _ltFlow.value = it.lt @@ -77,6 +80,7 @@ class CollectiblesViewModel( hiddenBalances: Boolean, isOnline: Boolean, ): Flow = collectiblesRepository.getFlow(wallet.address, wallet.testnet, isOnline).map { result -> + hasNfts = result.list.isNotEmpty() val safeMode = settingsRepository.isSafeModeEnabled(api) val uiItems = mutableListOf() for (nft in result.list) { diff --git a/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/send/main/SendScreen.kt b/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/send/main/SendScreen.kt index b92c6911b..43833eba3 100644 --- a/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/send/main/SendScreen.kt +++ b/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/send/main/SendScreen.kt @@ -709,20 +709,15 @@ class SendScreen(wallet: WalletEntity) : WalletContextScreen(R.layout.fragment_s } if (event.showToggle) { - val paymentMethodViewed = - requireContext().settingsRepository?.paymentMethodViewed ?: false - reviewRecipientFeeView.subtitle = getString(Localization.change_fee_method) + reviewRecipientFeeView.subtitle = getString(Localization.edit_full) reviewRecipientFeeView.setOnClickListener { showFeeMethods(event.fee, reviewRecipientFeeView) } reviewRecipientFeeView.subtitleView.expandTouchArea(8.dp) reviewRecipientFeeView.subtitleView.isEnabled = true - reviewRecipientFeeView.subtitleView.setTextColor(if (paymentMethodViewed) requireContext().textSecondaryColor else requireContext().textAccentColor) + reviewRecipientFeeView.subtitleView.setTextColor(requireContext().textAccentColor) reviewRecipientFeeView.subtitleView.setEndDrawable( - getDrawable( - UIKitIcon.ic_chevron_right_12, - if (paymentMethodViewed) requireContext().textSecondaryColor else requireContext().textAccentColor - ) + getDrawable(UIKitIcon.ic_chevron_right_12, requireContext().textAccentColor) ) } else { diff --git a/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/send/main/SendViewModel.kt b/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/send/main/SendViewModel.kt index 17abd70e2..74416c731 100644 --- a/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/send/main/SendViewModel.kt +++ b/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/send/main/SendViewModel.kt @@ -1005,7 +1005,7 @@ class SendViewModel( transfer: TransferEntity, ): SendFee.Ton { val message = transfer.signForEstimation( - internalMessage = false, jettonTransferAmount = TransferEntity.BASE_FORWARD_AMOUNT + internalMessage = false, jettonTransferAmount = TransferEntity.ONE_TON ) // Emulate with higher balance to calculate fair amount to send val emulated = api.emulate( @@ -1163,7 +1163,6 @@ class SendViewModel( is SendFee.Gasless -> PreferredFeeMethod.GASLESS } settingsRepository.setPreferredFeeMethod(wallet.id, preferredMethod) - settingsRepository.paymentMethodViewed = true viewModelScope.launch(Dispatchers.IO) { transferFlow.firstOrNull()?.let { transfer -> _feeFlow.tryEmit(fee) diff --git a/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/send/transaction/SendTransactionScreen.kt b/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/send/transaction/SendTransactionScreen.kt index a28b9d1ea..667a5e3df 100644 --- a/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/send/transaction/SendTransactionScreen.kt +++ b/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/send/transaction/SendTransactionScreen.kt @@ -55,6 +55,13 @@ import uikit.widget.SimpleRecyclerView import uikit.widget.SlideActionView import java.util.concurrent.CancellationException import androidx.core.view.isVisible +import com.tonapps.extensions.uri +import com.tonapps.icu.CurrencyFormatter +import com.tonapps.tonkeeper.popup.ActionSheet +import com.tonapps.tonkeeper.ui.screen.send.main.state.SendFee +import com.tonapps.uikit.color.accentGreenColor +import com.tonapps.wallet.localization.Plurals +import uikit.extensions.dp import uikit.extensions.getDimensionPixelSize class SendTransactionScreen(wallet: WalletEntity) : @@ -73,7 +80,17 @@ class SendTransactionScreen(wallet: WalletEntity) : parametersOf(args.request, args.batteryTransactionType, args.forceRelayer) } - private val historyAdapter = object : HistoryAdapter(disableOpenAction = true) { + private val feeMethodSelector: ActionSheet by lazy { + ActionSheet(requireContext()) + } + + private val historyAdapter = object : HistoryAdapter( + disableOpenAction = true, + shouldShowFeeToggle = { + viewModel.feeOptions.size > 1 + }, + showFeeMethods = ::showFeeMethods, + ) { override fun onAttachedToRecyclerView(recyclerView: RecyclerView) { super.onAttachedToRecyclerView(recyclerView) recyclerView.isNestedScrollingEnabled = true @@ -164,10 +181,7 @@ class SendTransactionScreen(wallet: WalletEntity) : slideTextBuilder.append("\n") slideTextBuilder.append(SpannableString(secondLineText).apply { setSpan( - RelativeSizeSpan(0.8f), - 0, - secondLineText.length, - Spannable.SPAN_EXCLUSIVE_EXCLUSIVE + RelativeSizeSpan(0.8f), 0, secondLineText.length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE ) setSpan( ForegroundColorSpan( @@ -326,6 +340,69 @@ class SendTransactionScreen(wallet: WalletEntity) : walletView.text = builder } + private fun showFeeMethods(currentFee: SendFee, targetView: View) { + feeMethodSelector.width = 264.dp + + if (feeMethodSelector.isShowing) { + return + } + + feeMethodSelector.clearItems() + + viewModel.feeOptions.forEach { fee -> + when (fee) { + is SendFee.TokenFee -> { + val formattedAmount = CurrencyFormatter.format( + fee.amount.token.symbol, + fee.amount.value, + 2 + ) + val formattedFiat = CurrencyFormatter.formatFiat( + fee.fiatCurrency.code, + fee.fiatAmount, + ) + feeMethodSelector.addItem( + id = fee.amount.token.symbol.hashCode().toLong(), + title = fee.amount.token.symbol, + subtitle = "≈ $formattedAmount · $formattedFiat", + imageUri = fee.amount.token.imageUri, + icon = if (currentFee == fee) { + getDrawable(UIKitIcon.ic_done_16) + } else null, + onClick = { + viewModel.setFeeMethod(fee) + } + ) + } + + is SendFee.Battery -> { + val formattedCharges = requireContext().resources.getQuantityString( + Plurals.battery_charges, + fee.charges, + CurrencyFormatter.format(value = fee.charges.toBigDecimal()) + ) + feeMethodSelector.addItem( + id = "battery".hashCode().toLong(), + title = getString(Localization.battery_refill_title), + subtitle = "≈ $formattedCharges", + imageUri = UIKitIcon.ic_flash_24.uri(), + imageTintColor = requireContext().accentGreenColor, + icon = if (currentFee == fee) { + getDrawable(UIKitIcon.ic_done_16) + } else null, + onClick = { + viewModel.setFeeMethod(fee) + } + ) + } + + else -> {} + } + } + + feeMethodSelector.showPopupAboveRight(targetView) + } + companion object { const val ERROR = "error" diff --git a/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/send/transaction/SendTransactionState.kt b/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/send/transaction/SendTransactionState.kt index b55294489..151d9b23b 100644 --- a/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/send/transaction/SendTransactionState.kt +++ b/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/send/transaction/SendTransactionState.kt @@ -5,6 +5,7 @@ import com.tonapps.tonkeeper.core.Amount import com.tonapps.tonkeeper.core.history.HistoryHelper import com.tonapps.tonkeeper.core.history.list.item.HistoryItem import com.tonapps.tonkeeper.ui.screen.send.main.helper.InsufficientBalanceType +import com.tonapps.tonkeeper.ui.screen.send.main.state.SendFee import com.tonapps.wallet.data.account.entities.WalletEntity sealed class SendTransactionState { @@ -26,7 +27,8 @@ sealed class SendTransactionState { val totalFormat: CharSequence, val isDangerous: Boolean, val nftCount: Int, - val failed: Boolean + val failed: Boolean, + val fee: SendFee, ): SendTransactionState() { val uiItems: List diff --git a/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/send/transaction/SendTransactionViewModel.kt b/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/send/transaction/SendTransactionViewModel.kt index bb1fc797b..8482cc3d4 100644 --- a/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/send/transaction/SendTransactionViewModel.kt +++ b/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/send/transaction/SendTransactionViewModel.kt @@ -13,12 +13,15 @@ import com.tonapps.icu.Coins import com.tonapps.ledger.ton.Transaction import com.tonapps.tonkeeper.core.Amount import com.tonapps.tonkeeper.core.AnalyticsHelper +import com.tonapps.tonkeeper.core.Fee import com.tonapps.tonkeeper.core.history.HistoryHelper import com.tonapps.tonkeeper.extensions.getTransfers import com.tonapps.tonkeeper.manager.assets.AssetsManager import com.tonapps.tonkeeper.manager.tx.TransactionManager import com.tonapps.tonkeeper.ui.base.BaseWalletVM import com.tonapps.tonkeeper.ui.screen.send.main.helper.InsufficientBalanceType +import com.tonapps.tonkeeper.ui.screen.send.main.state.SendFee +import com.tonapps.tonkeeper.usecase.emulation.Emulated import com.tonapps.tonkeeper.usecase.emulation.EmulationUseCase import com.tonapps.tonkeeper.usecase.sign.SignUseCase import com.tonapps.wallet.api.API @@ -28,18 +31,23 @@ import com.tonapps.wallet.api.getDebugMessage import com.tonapps.wallet.data.account.AccountRepository import com.tonapps.wallet.data.account.entities.MessageBodyEntity import com.tonapps.wallet.data.account.entities.WalletEntity +import com.tonapps.wallet.data.battery.BatteryMapper import com.tonapps.wallet.data.battery.BatteryRepository import com.tonapps.wallet.data.core.entity.SignRequestEntity import com.tonapps.wallet.data.events.EventsRepository +import com.tonapps.wallet.data.rates.RatesRepository import com.tonapps.wallet.data.settings.BatteryTransaction import com.tonapps.wallet.data.settings.SettingsRepository +import com.tonapps.wallet.data.settings.entities.PreferredFeeMethod import com.tonapps.wallet.data.token.TokenRepository import com.tonapps.wallet.data.token.entities.AccountTokenEntity import com.tonapps.wallet.localization.Localization import io.tonapi.models.JettonVerificationType import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.async import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.asStateFlow +import kotlinx.coroutines.flow.firstOrNull import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.flowOn import kotlinx.coroutines.launch @@ -48,6 +56,7 @@ import org.ton.cell.Cell import org.ton.contract.wallet.WalletTransfer import java.util.concurrent.atomic.AtomicBoolean import java.util.concurrent.atomic.AtomicLong +import kotlin.math.abs class SendTransactionViewModel( app: Application, @@ -64,7 +73,8 @@ class SendTransactionViewModel( private val emulationUseCase: EmulationUseCase, private val transactionManager: TransactionManager, private val batteryRepository: BatteryRepository, - private val assetsManager: AssetsManager + private val assetsManager: AssetsManager, + private val ratesRepository: RatesRepository, ) : BaseWalletVM(app) { private val currency = settingsRepository.currency @@ -77,8 +87,21 @@ class SendTransactionViewModel( var message: MessageBodyEntity? = null + private var tonDetails: SendTransactionState.Details? = null + private var batteryDetails: SendTransactionState.Details? = null + + val feeOptions: List + get() = listOfNotNull( + batteryDetails?.fee, + tonDetails?.fee, + ) + init { - AnalyticsHelper.tcViewConfirm(settingsRepository.installId, request.appUri.toString(), request.targetAddressValue) + AnalyticsHelper.tcViewConfirm( + settingsRepository.installId, + request.appUri.toString(), + request.targetAddressValue + ) viewModelScope.launch(Dispatchers.IO) { val tokens = getTokens() val useBattery = isBatteryIsEnabledTx() @@ -86,52 +109,103 @@ class SendTransactionViewModel( val transfers = transfers(tokens.filter { it.isRequestMinting }, true, useBattery) message = accountRepository.messageBody(wallet, request.validUntil, transfers) - val emulated = emulationUseCase( - message = message!!, - useBattery = useBattery, - forceRelayer = forceRelayer, - params = true - ) + val tonDeferred = async { + emulationUseCase( + message = message!!, + useBattery = false, + forceRelayer = false, + params = true + ) + } - isBattery.set(emulated.withBattery) + val batteryDeferred = async { + if (useBattery || forceRelayer) { + val emulated = emulationUseCase( + message = message!!, + useBattery = true, + forceRelayer = true, + params = true + ) + val chargesBalance = getBatteryCharges() + val charges = BatteryMapper.calculateChargesAmount( + emulated.extra.value.value, + api.config.batteryMeanFees + ) + if (charges > chargesBalance) { + null + } else { + emulated + } + } else { + + null + } + } + + val batteryEmulated = batteryDeferred.await() + + batteryDetails = if (batteryEmulated != null && !batteryEmulated.failed) { + createDetails(batteryEmulated) + } else { + null + } + + val tonEmulated = tonDeferred.await() + val tonBalance = getTONBalance() + val transferTonTotal = tonEmulated.totalTon + tonEmulated.totalFees emulationReadyDate.set(System.currentTimeMillis()) - val details = historyHelper.create(wallet, emulated) + if (transferTonTotal > tonBalance) { + if (batteryDetails == null) { + _stateFlow.value = SendTransactionState.InsufficientBalance( + wallet = wallet, + balance = Amount(tonBalance), + required = Amount(transferTonTotal), + withRechargeBattery = forceRelayer || useBattery, + singleWallet = isSingleWallet(), + type = InsufficientBalanceType.InsufficientTONBalance + ) + + return@launch + } + + tonDetails = null + } else { + tonDetails = createDetails(tonEmulated) + } - val totalFormatBuilder = StringBuilder(getString(Localization.total, emulated.totalFormat)) - if (emulated.nftCount > 0) { - totalFormatBuilder.append(" + ").append(emulated.nftCount).append(" NFT") + val preferredFeeMethod = settingsRepository.getPreferredFeeMethod(wallet.id) + if (preferredFeeMethod == PreferredFeeMethod.BATTERY && batteryDetails != null) { + _stateFlow.value = batteryDetails!! + isBattery.set(true) + return@launch + } + if (preferredFeeMethod == PreferredFeeMethod.TON && tonDetails != null) { + _stateFlow.value = tonDetails!! + isBattery.set(false) + return@launch } - // val jettons = emulated.loadTokens(wallet.testnet, tokenRepository) - // val hasCompressedJetton = jettons.any { it.isRequestMinting || it.customPayloadApiUri != null } - val tonBalance = getTONBalance() - val transferTonTotal = emulated.totalTon + emulated.totalFees - if (!emulated.withBattery && transferTonTotal > tonBalance) { - _stateFlow.value = SendTransactionState.InsufficientBalance( - wallet = wallet, - balance = Amount(tonBalance), - required = Amount(transferTonTotal), - withRechargeBattery = forceRelayer || useBattery, - singleWallet = isSingleWallet(), - type = InsufficientBalanceType.InsufficientTONBalance - ) + if (batteryDetails != null) { + _stateFlow.value = batteryDetails!! + isBattery.set(true) } else { - _stateFlow.value = SendTransactionState.Details( - emulated = details, - totalFormat = if (emulated.failed) getString(Localization.unknown) else totalFormatBuilder.toString(), - isDangerous = emulated.total.isDangerous, - nftCount = emulated.nftCount, - failed = emulated.failed - ) + _stateFlow.value = tonDetails!! + isBattery.set(false) } + } catch (e: Throwable) { - FirebaseCrashlytics.getInstance().recordException(APIException.Emulation( - boc = message?.createSignedBody(EmptyPrivateKeyEd25519.invoke(), forceRelayer || useBattery)?.base64() ?: "failed", - sourceUri = request.appUri, - cause = e - )) + FirebaseCrashlytics.getInstance().recordException( + APIException.Emulation( + boc = message?.createSignedBody( + EmptyPrivateKeyEd25519.invoke(), + forceRelayer || useBattery + )?.base64() ?: "failed", + sourceUri = request.appUri, + cause = e + ) + ) val tonBalance = getTONBalance() if (tonBalance == Coins.ZERO) { @@ -151,6 +225,57 @@ class SendTransactionViewModel( } } + private suspend fun getBatteryCharges(): Int = withContext(Dispatchers.IO) { + accountRepository.requestTonProofToken(wallet)?.let { + batteryRepository.getCharges(it, wallet.publicKey, wallet.testnet, true) + } ?: 0 + } + + private suspend fun createDetails(emulated: Emulated): SendTransactionState.Details { + val fee: SendFee = if (emulated.withBattery && emulated.consequences != null) { + val extra = emulated.consequences.event.extra + val chargesBalance = getBatteryCharges() + val charges = BatteryMapper.calculateChargesAmount( + Coins.of(abs(extra)).value, + api.config.batteryMeanFees + ) + val batteryConfig = batteryRepository.getConfig(wallet.testnet) + val excessesAddress = batteryConfig.excessesAddress + SendFee.Battery( + charges = charges, + chargesBalance = chargesBalance, + extra = extra, + excessesAddress = excessesAddress!!, + ) + } else { + val fee = Fee(emulated.extra.value, emulated.extra.isRefund) + val rates = ratesRepository.getTONRates(currency) + val converted = rates.convertTON(fee.value) + + SendFee.Ton( + amount = fee, + fiatAmount = converted, + fiatCurrency = currency, + extra = emulated.consequences?.event?.extra ?: 0 + ) + } + + val details = historyHelper.create(wallet, emulated, fee) + val totalFormatBuilder = StringBuilder(getString(Localization.total, emulated.totalFormat)) + if (emulated.nftCount > 0) { + totalFormatBuilder.append(" + ").append(emulated.nftCount).append(" NFT") + } + + return SendTransactionState.Details( + emulated = details, + totalFormat = if (emulated.failed) getString(Localization.unknown) else totalFormatBuilder.toString(), + isDangerous = emulated.total.isDangerous, + nftCount = emulated.nftCount, + failed = emulated.failed, + fee = fee, + ) + } + private suspend fun isBatteryIsEnabledTx(): Boolean = withContext(Dispatchers.IO) { if (settingsRepository.batteryIsEnabledTx(wallet.accountId, batteryTransactionType)) { getBatteryBalance().isPositive @@ -175,7 +300,11 @@ class SendTransactionViewModel( } private suspend fun getTONBalance(): Coins { - val balance = tokenRepository.getTON(settingsRepository.currency, wallet.accountId, wallet.testnet)?.balance?.value + val balance = tokenRepository.getTON( + settingsRepository.currency, + wallet.accountId, + wallet.testnet + )?.balance?.value return balance ?: Coins.ZERO } @@ -191,11 +320,13 @@ class SendTransactionViewModel( val transfer = message.transfers.firstOrNull() ?: return null */ val transactions = mutableListOf() for ((index, transfer) in message.transfers.withIndex()) { - transactions.add(Transaction.fromWalletTransfer( - walletTransfer = transfer, - seqno = message.seqNo + index, - timeout = message.validUntil - )) + transactions.add( + Transaction.fromWalletTransfer( + walletTransfer = transfer, + seqno = message.seqNo + index, + timeout = message.validUntil + ) + ) } return transactions.toList() @@ -279,7 +410,11 @@ class SendTransactionViewModel( return emulationReadyDate.get() - System.currentTimeMillis() } - private suspend fun transfers(compressedTokens: List, forEmulation: Boolean, batteryEnabled: Boolean): List { + private suspend fun transfers( + compressedTokens: List, + forEmulation: Boolean, + batteryEnabled: Boolean + ): List { val excessesAddress = if (!forEmulation && isBattery.get()) { batteryRepository.getConfig(wallet.testnet).excessesAddress } else null @@ -297,4 +432,21 @@ class SendTransactionViewModel( return tokenRepository.get(currency, wallet.accountId, wallet.testnet, true) ?: emptyList() } + fun setFeeMethod(fee: SendFee) { + val preferredMethod = when (fee) { + is SendFee.Ton -> PreferredFeeMethod.TON + is SendFee.Battery -> PreferredFeeMethod.BATTERY + is SendFee.Gasless -> PreferredFeeMethod.GASLESS + } + settingsRepository.setPreferredFeeMethod(wallet.id, preferredMethod) + + if (fee is SendFee.Battery) { + _stateFlow.value = batteryDetails!! + isBattery.set(true) + } else { + _stateFlow.value = tonDetails!! + isBattery.set(false) + } + } + } \ No newline at end of file diff --git a/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/usecase/emulation/EmulationUseCase.kt b/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/usecase/emulation/EmulationUseCase.kt index 5ee168aab..df8cfb2c3 100644 --- a/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/usecase/emulation/EmulationUseCase.kt +++ b/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/usecase/emulation/EmulationUseCase.kt @@ -45,7 +45,6 @@ class EmulationUseCase( emulateWithBattery( message = message, forceRelayer = forceRelayer, - params = params ) } else { emulate(message, params) @@ -75,30 +74,26 @@ class EmulationUseCase( private suspend fun emulateWithBattery( message: MessageBodyEntity, forceRelayer: Boolean, - params: Boolean, ): Emulated { - try { - if (api.config.isBatteryDisabled) { - throw IllegalStateException("Battery is disabled") - } - - val wallet = message.wallet - val tonProofToken = accountRepository.requestTonProofToken(wallet) ?: throw IllegalStateException("Can't find TonProof token") - val boc = createMessage(message, true) - - val (consequences, withBattery) = batteryRepository.emulate( - tonProofToken = tonProofToken, - publicKey = wallet.publicKey, - testnet = wallet.testnet, - boc = boc, - forceRelayer = forceRelayer, - safeModeEnabled = settingsRepository.isSafeModeEnabled(api) - ) ?: throw IllegalStateException("Failed to emulate battery") - - return parseEmulated(wallet, consequences, TransferType.Battery) - } catch (e: Throwable) { - return emulate(message, params) + if (api.config.isBatteryDisabled) { + throw IllegalStateException("Battery is disabled") } + + val wallet = message.wallet + val tonProofToken = accountRepository.requestTonProofToken(wallet) + ?: throw IllegalStateException("Can't find TonProof token") + val boc = createMessage(message, true) + + val (consequences, withBattery) = batteryRepository.emulate( + tonProofToken = tonProofToken, + publicKey = wallet.publicKey, + testnet = wallet.testnet, + boc = boc, + forceRelayer = forceRelayer, + safeModeEnabled = settingsRepository.isSafeModeEnabled(api) + ) ?: throw IllegalStateException("Failed to emulate battery") + + return parseEmulated(wallet, consequences, TransferType.Battery) } private suspend fun emulate(message: MessageBodyEntity, params: Boolean): Emulated { @@ -185,18 +180,22 @@ class EmulationUseCase( jettons: List ): List { val list = mutableListOf() - list.add(BalanceEntity.create( - accountId = wallet.address, - value = Coins.of(tonValue), - )) + list.add( + BalanceEntity.create( + accountId = wallet.address, + value = Coins.of(tonValue), + ) + ) for (jettonQuantity in jettons) { val token = TokenEntity(jettonQuantity.jetton) val value = Coins.ofNano(jettonQuantity.quantity, token.decimals) - list.add(BalanceEntity( - token = token, - value = value, - walletAddress = jettonQuantity.walletAddress.address - )) + list.add( + BalanceEntity( + token = token, + value = value, + walletAddress = jettonQuantity.walletAddress.address + ) + ) } return list.toList() } diff --git a/apps/wallet/localization/src/main/res/values-bg/strings.xml b/apps/wallet/localization/src/main/res/values-bg/strings.xml index eab9719e5..68b62747d 100644 --- a/apps/wallet/localization/src/main/res/values-bg/strings.xml +++ b/apps/wallet/localization/src/main/res/values-bg/strings.xml @@ -92,7 +92,6 @@ Минимален депозит %1$s. Опции Докоснете, за да платите в %1$s - Промяна на метода на плащане Едно таксуване покрива средната такса за транзакция. Някои транзакции може да струват повече. Възстановяване на покупките Заредена батерия @@ -498,7 +497,6 @@ ≈ %1$s заряд за %2$s ≈ %1$s заряда за %2$s - Ще бъде платено с батерията Настройки на батерията Избраните транзакции ще бъдат платени с батерията Tonkeeper. Презареждане diff --git a/apps/wallet/localization/src/main/res/values-es/strings.xml b/apps/wallet/localization/src/main/res/values-es/strings.xml index d2cb11b10..cfe106115 100644 --- a/apps/wallet/localization/src/main/res/values-es/strings.xml +++ b/apps/wallet/localization/src/main/res/values-es/strings.xml @@ -429,7 +429,6 @@ ≈ %1$s carga por %2$s ≈ %1$s cargas por %2$s - Se pagará con la batería Configuración de la batería Las transacciones seleccionadas serán pagadas por la batería de Tonkeeper. Recargar @@ -443,7 +442,6 @@ Código promocional Reembolso Toque para pagar en %1$s - Cambiar método de pago Grande Medio Pequeño diff --git a/apps/wallet/localization/src/main/res/values-in/strings.xml b/apps/wallet/localization/src/main/res/values-in/strings.xml index 865bbda09..ba5194fdf 100644 --- a/apps/wallet/localization/src/main/res/values-in/strings.xml +++ b/apps/wallet/localization/src/main/res/values-in/strings.xml @@ -427,7 +427,6 @@ ≈ %1$s pengisian per %2$s - Akan dibayar dengan Baterai Pengaturan Baterai Transaksi yang dipilih akan dibayar oleh Baterai Tonkeeper. Isi ulang @@ -441,7 +440,6 @@ Kode Promo Pengembalian Ketuk untuk membayar dalam %1$s - Ubah metode pembayaran Besar Sedang Kecil diff --git a/apps/wallet/localization/src/main/res/values-ru/strings.xml b/apps/wallet/localization/src/main/res/values-ru/strings.xml index 2ed9061f2..56aca9f9b 100644 --- a/apps/wallet/localization/src/main/res/values-ru/strings.xml +++ b/apps/wallet/localization/src/main/res/values-ru/strings.xml @@ -543,7 +543,6 @@ ≈ %1$s отправок токенов ≈ %1$s отправок токенов - Будет оплачена батарейкой Настройки батарейки Выбранные транзакции будут оплачены батарейкой Tonkeeper. Зарядка @@ -557,7 +556,6 @@ Промокод Возврат Оплатить в %1$s - Изменить способ оплаты или Большой Средний diff --git a/apps/wallet/localization/src/main/res/values-tr/strings.xml b/apps/wallet/localization/src/main/res/values-tr/strings.xml index 9508cfadc..bb60a4766 100644 --- a/apps/wallet/localization/src/main/res/values-tr/strings.xml +++ b/apps/wallet/localization/src/main/res/values-tr/strings.xml @@ -430,7 +430,6 @@ ≈ %1$s şarj başına %2$s ≈ %1$s şarj başına %2$s - Batarya ile ödenecek Batarya Ayarları Seçilen işlemler Tonkeeper Bataryası ile ödenecektir. Yeniden şarj et @@ -444,7 +443,6 @@ Promosyon Kodu Geri ödemek %1$s ile ödeme yapmak için dokunun - Ödeme yöntemini değiştir Büyük Orta Küçük diff --git a/apps/wallet/localization/src/main/res/values-uk/strings.xml b/apps/wallet/localization/src/main/res/values-uk/strings.xml index 0188ad800..a73075762 100644 --- a/apps/wallet/localization/src/main/res/values-uk/strings.xml +++ b/apps/wallet/localization/src/main/res/values-uk/strings.xml @@ -433,7 +433,6 @@ ≈ %1$s зарядів за %2$s ≈ %1$s зарядів за %2$s - Буде сплачено батареєю Налаштування батареї Вибрані транзакції будуть сплачені батареєю Tonkeeper. Перезарядка @@ -447,7 +446,6 @@ Промокод Повернення Торкніться, щоб оплатити %1$s - Змінити спосіб оплати Великий Середній Маленький diff --git a/apps/wallet/localization/src/main/res/values-uz/strings.xml b/apps/wallet/localization/src/main/res/values-uz/strings.xml index 0a9827050..0a598679c 100644 --- a/apps/wallet/localization/src/main/res/values-uz/strings.xml +++ b/apps/wallet/localization/src/main/res/values-uz/strings.xml @@ -432,7 +432,6 @@ ≈ %1$s zaryad %2$s uchun ≈ %1$s zaryadlar %2$s uchun - Batareya bilan to‘lanadi Batareya Sozlamalari Tanlangan tranzaktsiyalar Tonkeeper Batareya orqali to‘lanadi. Zaryadlash @@ -446,7 +445,6 @@ Kupon kodi To\'lovni qaytarish %1$s orqali toʻlash uchun bosing - Toʻlov usulini oʻzgartirish Katta O\'rta Kichik diff --git a/apps/wallet/localization/src/main/res/values-zh/strings.xml b/apps/wallet/localization/src/main/res/values-zh/strings.xml index 6580b81cf..e0ed422b4 100644 --- a/apps/wallet/localization/src/main/res/values-zh/strings.xml +++ b/apps/wallet/localization/src/main/res/values-zh/strings.xml @@ -428,7 +428,6 @@ ≈ 每 %2$s %1$s 次充电 - 将使用电池支付 电池设置 选定的交易将由 Tonkeeper 电池支付。 充值 @@ -442,7 +441,6 @@ 促销代码 退款 %1$s 后即可轻触付款 - 更改付款方式 大的 中等的 小的 diff --git a/apps/wallet/localization/src/main/res/values/strings.xml b/apps/wallet/localization/src/main/res/values/strings.xml index 0494a4642..c046abf46 100644 --- a/apps/wallet/localization/src/main/res/values/strings.xml +++ b/apps/wallet/localization/src/main/res/values/strings.xml @@ -624,7 +624,6 @@ ≈ %1$s token transfers ≈ %1$s token transfers - Will be paid with Battery Battery Settings Selected transactions will be paid by Tonkeeper Battery. Recharge @@ -638,7 +637,6 @@ Promo Code Refund Tap to pay in %1$s - Change Payment Method Recharge Battery or Large From 1a09ef3aebbb15add3e49a70f225e1093417c4f3 Mon Sep 17 00:00:00 2001 From: Anton Polstianka <110775852+polstianka@users.noreply.github.com> Date: Sat, 19 Jul 2025 00:23:43 -0400 Subject: [PATCH 04/36] Openapi/generator (#160) * release actions * update openapi generator and remove moshi json parser --- apps/wallet/api/build.gradle.kts | 2 - .../main/java/com/tonapps/wallet/api/API.kt | 51 +- .../java/com/tonapps/wallet/api/Extensions.kt | 29 +- .../java/com/tonapps/wallet/api/Provider.kt | 2 + .../com/tonapps/wallet/api/core/BaseAPI.kt | 4 +- .../wallet/api/entity/AccountDetailsEntity.kt | 17 + .../wallet/api/entity/AccountEntity.kt | 15 +- .../tonapps/wallet/api/entity/TokenEntity.kt | 2 +- .../com/tonapps/wallet/api/tron/TronApi.kt | 4 +- apps/wallet/data/battery/build.gradle.kts | 2 - .../collectibles/CollectiblesRepository.kt | 4 +- .../data/collectibles/entities/NftEntity.kt | 2 +- .../entities/NftMetadataEntity.kt | 19 +- .../wallet/data/core/BlobDataSource.kt | 9 +- .../tonapps/wallet/data/events/Extensions.kt | 2 +- .../data/events/source/DatabaseSource.kt | 8 +- apps/wallet/data/purchase/build.gradle.kts | 1 + .../data/purchase/PurchaseRepository.kt | 14 +- .../wallet/data/rates/RatesRepository.kt | 3 +- .../data/staking/entities/PoolEntity.kt | 2 +- apps/wallet/instance/app/build.gradle.kts | 3 - .../tonkeeper/core/history/HistoryHelper.kt | 5 +- build/reports/problems/problems-report.html | 2 +- buildSrc/src/main/kotlin/Dependence.kt | 2 - .../main/java/com/tonapps/extensions/JSON.kt | 7 - tonapi/battery-api.yml | 1692 +++++++++++++++++ tonapi/battery.sh | 3 + tonapi/build.gradle.kts | 5 +- tonapi/generate.sh | 54 + tonapi/proguard-rules.pro | 11 + tonapi/src/main/kotlin/io/JsonAny.kt | 73 + tonapi/src/main/kotlin/io/Serializer.kt | 31 + .../kotlin/io/batteryapi/apis/ConnectApi.kt | 55 +- .../apis/{BatteryApi.kt => DefaultApi.kt} | 1113 ++--------- .../kotlin/io/batteryapi/apis/EmulationApi.kt | 124 +- .../kotlin/io/batteryapi/apis/WalletApi.kt | 58 +- .../infrastructure/BigDecimalAdapter.kt | 17 - .../infrastructure/BigIntegerAdapter.kt | 17 - .../infrastructure/ByteArrayAdapter.kt | 12 - .../io/batteryapi/infrastructure/Errors.kt | 18 - .../infrastructure/LocalDateAdapter.kt | 19 - .../infrastructure/LocalDateTimeAdapter.kt | 19 - .../infrastructure/OffsetDateTimeAdapter.kt | 19 - .../batteryapi/infrastructure/PartConfig.kt | 11 - .../infrastructure/RequestMethod.kt | 8 - .../infrastructure/ResponseExtensions.kt | 24 - .../batteryapi/infrastructure/Serializer.kt | 23 - .../batteryapi/infrastructure/URIAdapter.kt | 13 - .../batteryapi/infrastructure/UUIDAdapter.kt | 13 - .../models/AndroidBatteryPurchaseRequest.kt | 13 +- ...oidBatteryPurchaseRequestPurchasesInner.kt | 19 +- .../models/AndroidBatteryPurchaseStatus.kt | 13 +- ...roidBatteryPurchaseStatusPurchasesInner.kt | 22 +- ...atteryPurchaseStatusPurchasesInnerError.kt | 28 +- .../models/AppStoreNotificationRequest.kt | 13 +- .../io/batteryapi/models/ApplyPromoRequest.kt | 16 +- .../kotlin/io/batteryapi/models/Balance.kt | 25 +- .../io/batteryapi/models/BatteryCharged.kt | 13 +- .../kotlin/io/batteryapi/models/Config.kt | 28 +- .../batteryapi/models/ConfigGasProxyInner.kt | 13 +- .../io/batteryapi/models/ConfigMeanPrices.kt | 22 +- .../models/CreateCustomRefundRequest.kt | 28 +- .../models/CreatePromoCampaign200Response.kt | 13 +- ...omoCampaign200ResponseParticipantsInner.kt | 19 +- .../models/CreatePromoCampaignRequest.kt | 16 +- ...tePromoCampaignRequestParticipantsInner.kt | 16 +- .../models/EmulateMessageToWalletRequest.kt | 13 +- .../models/EnterpriseEstimate200Response.kt | 16 +- .../models/EnterpriseEstimateRequest.kt | 16 +- .../models/EnterpriseGetMessage200Response.kt | 33 +- .../models/EnterpriseGetStatus200Response.kt | 16 +- .../models/EnterpriseSend200Response.kt | 13 +- .../models/EnterpriseWalletConfig.kt | 13 +- .../main/kotlin/io/batteryapi/models/Error.kt | 13 +- .../models/EstimateGaslessCostRequest.kt | 16 +- .../io/batteryapi/models/EstimatedTronTx.kt | 28 +- .../models/EstimatedTronTxInstantFee.kt | 39 + ...atedTronTxInstantFeeAcceptedAssetsInner.kt | 57 + .../io/batteryapi/models/GasProxyAddress.kt | 8 - .../io/batteryapi/models/GaslessEstimation.kt | 13 +- .../models/GetTonConnectPayload200Response.kt | 13 +- .../models/GetTronConfig200Response.kt | 13 +- .../models/IOSBatteryPurchaseStatus.kt | 13 +- ...SBatteryPurchaseStatusTransactionsInner.kt | 19 +- ...eryPurchaseStatusTransactionsInnerError.kt | 30 +- .../models/IncreaseUserBalanceRequest.kt | 40 + ...loadDefaultResponse.kt => InlineObject.kt} | 21 +- .../models/IosBatteryPurchaseRequest.kt | 13 +- ...BatteryPurchaseRequestTransactionsInner.kt | 16 +- .../models/PromoCodeBatteryPurchaseRequest.kt | 13 +- .../models/PromoCodeBatteryPurchaseStatus.kt | 19 +- .../PromoCodeBatteryPurchaseStatusError.kt | 24 +- .../kotlin/io/batteryapi/models/PromoUsed.kt | 18 +- .../kotlin/io/batteryapi/models/Purchases.kt | 16 +- .../models/PurchasesPurchasesInner.kt | 54 +- ...urchasesPurchasesInnerRefundInformation.kt | 25 +- ...PurchasesInnerRefundInformationRefunded.kt | 16 +- .../io/batteryapi/models/RechargeMethods.kt | 13 +- .../models/RechargeMethodsMethodsInner.kt | 43 +- .../models/RelayerSendingEstimation.kt | 13 +- .../batteryapi/models/RequestRefundRequest.kt | 16 +- .../models/ResetUserBalanceRequest.kt | 13 +- .../kotlin/io/batteryapi/models/SentTronTx.kt | 13 +- .../kotlin/io/batteryapi/models/Status.kt | 13 +- .../models/StatusPendingTransactionsInner.kt | 13 +- .../models/TonConnectProof200Response.kt | 13 +- .../models/TonConnectProofRequest.kt | 16 +- .../models/TonConnectProofRequestProof.kt | 25 +- .../TonConnectProofRequestProofDomain.kt | 16 +- .../io/batteryapi/models/Transactions.kt | 19 +- .../models/TransactionsTransactionsInner.kt | 30 +- .../io/batteryapi/models/TronSendRequest.kt | 28 +- .../batteryapi/models/TronTransactionsList.kt | 13 +- .../TronTransactionsListTransactionsInner.kt | 37 +- .../models/VerifyPurchasePromo200Response.kt | 35 + .../src/main/kotlin/io/extensions/NftItem.kt | 6 + .../infrastructure/ApiAbstractions.kt | 2 +- .../infrastructure/ApiClient.kt | 17 +- .../infrastructure/ApiResponse.kt | 2 +- .../io/infrastructure/AtomicBooleanAdapter.kt | 19 + .../io/infrastructure/AtomicIntegerAdapter.kt | 19 + .../io/infrastructure/AtomicLongAdapter.kt | 19 + .../io/infrastructure/BigDecimalAdapter.kt | 15 + .../io/infrastructure/BigIntegerAdapter.kt | 20 + .../io/{tonapi => }/infrastructure/Errors.kt | 3 +- .../io/infrastructure/LocalDateAdapter.kt | 22 + .../io/infrastructure/LocalDateTimeAdapter.kt | 22 + .../infrastructure/OffsetDateTimeAdapter.kt | 22 + .../{tonapi => }/infrastructure/PartConfig.kt | 2 +- .../infrastructure/RequestConfig.kt | 2 +- .../infrastructure/RequestMethod.kt | 2 +- .../infrastructure/ResponseExtensions.kt | 2 +- .../io/infrastructure/StringBuilderAdapter.kt | 18 + .../kotlin/io/infrastructure/URIAdapter.kt | 19 + .../kotlin/io/infrastructure/URLAdapter.kt | 19 + .../kotlin/io/infrastructure/UUIDAdapter.kt | 21 + .../kotlin/io/serializers/AnySerializer.kt | 51 + .../main/kotlin/io/tonapi/apis/AccountsApi.kt | 820 ++------ .../kotlin/io/tonapi/apis/BlockchainApi.kt | 749 ++------ .../main/kotlin/io/tonapi/apis/ConnectApi.kt | 88 +- .../src/main/kotlin/io/tonapi/apis/DNSApi.kt | 141 +- .../kotlin/io/tonapi/apis/EmulationApi.kt | 243 +-- .../main/kotlin/io/tonapi/apis/EventsApi.kt | 123 +- .../kotlin/io/tonapi/apis/ExtraCurrencyApi.kt | 99 + .../main/kotlin/io/tonapi/apis/GaslessApi.kt | 136 +- .../kotlin/io/tonapi/apis/InscriptionsApi.kt | 437 ----- .../main/kotlin/io/tonapi/apis/JettonsApi.kt | 229 +-- .../kotlin/io/tonapi/apis/LiteServerApi.kt | 477 +---- .../main/kotlin/io/tonapi/apis/MultisigApi.kt | 113 +- .../src/main/kotlin/io/tonapi/apis/NFTApi.kt | 328 +--- .../kotlin/io/tonapi/apis/PurchasesApi.kt | 107 ++ .../main/kotlin/io/tonapi/apis/RatesApi.kt | 128 +- .../main/kotlin/io/tonapi/apis/StakingApi.kt | 150 +- .../main/kotlin/io/tonapi/apis/StorageApi.kt | 57 +- .../main/kotlin/io/tonapi/apis/TracesApi.kt | 117 +- .../kotlin/io/tonapi/apis/UtilitiesApi.kt | 180 +- .../main/kotlin/io/tonapi/apis/WalletApi.kt | 254 +-- .../tonapi/infrastructure/ApiAbstractions.kt | 23 - .../io/tonapi/infrastructure/ApiClient.kt | 252 --- .../io/tonapi/infrastructure/ApiResponse.kt | 43 - .../infrastructure/BigDecimalAdapter.kt | 17 - .../infrastructure/BigIntegerAdapter.kt | 17 - .../tonapi/infrastructure/ByteArrayAdapter.kt | 12 - .../tonapi/infrastructure/LocalDateAdapter.kt | 19 - .../infrastructure/LocalDateTimeAdapter.kt | 19 - .../infrastructure/OffsetDateTimeAdapter.kt | 19 - .../io/tonapi/infrastructure/RequestConfig.kt | 18 - .../io/tonapi/infrastructure/Serializer.kt | 23 - .../io/tonapi/infrastructure/URIAdapter.kt | 13 - .../io/tonapi/infrastructure/UUIDAdapter.kt | 13 - .../io/tonapi/models/AccStatusChange.kt | 21 +- .../main/kotlin/io/tonapi/models/Account.kt | 60 +- .../kotlin/io/tonapi/models/AccountAddress.kt | 30 +- .../kotlin/io/tonapi/models/AccountEvent.kt | 44 +- .../kotlin/io/tonapi/models/AccountEvents.kt | 21 +- .../tonapi/models/AccountInfoByStateInit.kt | 21 +- .../io/tonapi/models/AccountPurchases.kt | 39 + .../kotlin/io/tonapi/models/AccountStaking.kt | 18 +- .../io/tonapi/models/AccountStakingInfo.kt | 30 +- .../kotlin/io/tonapi/models/AccountStatus.kt | 15 +- .../io/tonapi/models/AccountStorageInfo.kt | 30 +- .../main/kotlin/io/tonapi/models/Accounts.kt | 18 +- .../main/kotlin/io/tonapi/models/Action.kt | 133 +- .../kotlin/io/tonapi/models/ActionPhase.kt | 36 +- .../io/tonapi/models/ActionSimplePreview.kt | 33 +- .../tonapi/models/AddressParse200Response.kt | 30 +- .../AddressParse200ResponseBounceable.kt | 21 +- .../kotlin/io/tonapi/models/ApyHistory.kt | 23 +- .../main/kotlin/io/tonapi/models/Auction.kt | 30 +- .../io/tonapi/models/AuctionBidAction.kt | 40 +- .../main/kotlin/io/tonapi/models/Auctions.kt | 21 +- .../tonapi/models/BlockCurrencyCollection.kt | 21 +- .../BlockCurrencyCollectionOtherInner.kt | 21 +- .../kotlin/io/tonapi/models/BlockLimits.kt | 24 +- .../io/tonapi/models/BlockParamLimits.kt | 24 +- .../main/kotlin/io/tonapi/models/BlockRaw.kt | 30 +- .../kotlin/io/tonapi/models/BlockValueFlow.kt | 45 +- .../tonapi/models/BlockchainAccountInspect.kt | 44 +- .../io/tonapi/models/BlockchainBlock.kt | 105 +- .../io/tonapi/models/BlockchainBlockShards.kt | 18 +- .../BlockchainBlockShardsShardsInner.kt | 21 +- .../io/tonapi/models/BlockchainBlocks.kt | 18 +- .../io/tonapi/models/BlockchainConfig.kt | 151 +- .../io/tonapi/models/BlockchainConfig10.kt | 18 +- .../io/tonapi/models/BlockchainConfig11.kt | 21 +- .../io/tonapi/models/BlockchainConfig12.kt | 18 +- .../io/tonapi/models/BlockchainConfig13.kt | 24 +- .../io/tonapi/models/BlockchainConfig14.kt | 21 +- .../io/tonapi/models/BlockchainConfig15.kt | 27 +- .../io/tonapi/models/BlockchainConfig16.kt | 24 +- .../io/tonapi/models/BlockchainConfig17.kt | 27 +- .../io/tonapi/models/BlockchainConfig18.kt | 18 +- .../BlockchainConfig18StoragePricesInner.kt | 30 +- .../io/tonapi/models/BlockchainConfig20.kt | 18 +- .../io/tonapi/models/BlockchainConfig21.kt | 18 +- .../io/tonapi/models/BlockchainConfig22.kt | 18 +- .../io/tonapi/models/BlockchainConfig23.kt | 18 +- .../io/tonapi/models/BlockchainConfig24.kt | 18 +- .../io/tonapi/models/BlockchainConfig25.kt | 18 +- .../io/tonapi/models/BlockchainConfig28.kt | 33 +- .../io/tonapi/models/BlockchainConfig29.kt | 51 +- .../io/tonapi/models/BlockchainConfig31.kt | 18 +- .../io/tonapi/models/BlockchainConfig40.kt | 18 +- .../io/tonapi/models/BlockchainConfig43.kt | 18 +- .../io/tonapi/models/BlockchainConfig44.kt | 21 +- .../io/tonapi/models/BlockchainConfig45.kt | 36 + .../BlockchainConfig45ContractsInner.kt | 38 + .../io/tonapi/models/BlockchainConfig5.kt | 24 +- .../io/tonapi/models/BlockchainConfig6.kt | 21 +- .../io/tonapi/models/BlockchainConfig7.kt | 18 +- .../io/tonapi/models/BlockchainConfig71.kt | 18 +- .../io/tonapi/models/BlockchainConfig79.kt | 18 +- .../BlockchainConfig7CurrenciesInner.kt | 21 +- .../io/tonapi/models/BlockchainConfig8.kt | 21 +- .../io/tonapi/models/BlockchainConfig9.kt | 18 +- ...MessageRequest.kt => BlockchainLibrary.kt} | 20 +- .../io/tonapi/models/BlockchainRawAccount.kt | 51 +- .../BlockchainRawAccountLibrariesInner.kt | 21 +- .../io/tonapi/models/BouncePhaseType.kt | 21 +- .../kotlin/io/tonapi/models/ComputePhase.kt | 39 +- .../io/tonapi/models/ComputeSkipReason.kt | 24 +- .../io/tonapi/models/ConfigProposalSetup.kt | 39 +- .../io/tonapi/models/ContractDeployAction.kt | 21 +- .../kotlin/io/tonapi/models/CreditPhase.kt | 21 +- .../kotlin/io/tonapi/models/CurrencyType.kt | 68 + .../kotlin/io/tonapi/models/DecodedMessage.kt | 24 +- .../models/DecodedMessageExtInMsgDecoded.kt | 28 +- ...dMessageExtInMsgDecodedWalletHighloadV2.kt | 24 +- .../DecodedMessageExtInMsgDecodedWalletV3.kt | 27 +- .../DecodedMessageExtInMsgDecodedWalletV4.kt | 30 +- .../DecodedMessageExtInMsgDecodedWalletV5.kt | 39 + .../io/tonapi/models/DecodedRawMessage.kt | 21 +- .../tonapi/models/DecodedRawMessageMessage.kt | 27 +- .../io/tonapi/models/DepositStakeAction.kt | 27 +- .../kotlin/io/tonapi/models/DnsExpiring.kt | 18 +- .../io/tonapi/models/DnsExpiringItemsInner.kt | 24 +- .../main/kotlin/io/tonapi/models/DnsRecord.kt | 27 +- .../main/kotlin/io/tonapi/models/DomainBid.kt | 30 +- .../kotlin/io/tonapi/models/DomainBids.kt | 18 +- .../kotlin/io/tonapi/models/DomainInfo.kt | 24 +- .../kotlin/io/tonapi/models/DomainNames.kt | 18 +- .../io/tonapi/models/DomainRenewAction.kt | 24 +- .../main/kotlin/io/tonapi/models/EcPreview.kt | 44 + .../models/ElectionsDepositStakeAction.kt | 21 +- .../models/ElectionsRecoverStakeAction.kt | 21 +- .../models/EmulateMessageToWalletRequest.kt | 25 +- ...mulateMessageToWalletRequestParamsInner.kt | 21 +- .../io/tonapi/models/EncryptedComment.kt | 21 +- .../src/main/kotlin/io/tonapi/models/Error.kt | 18 +- .../src/main/kotlin/io/tonapi/models/Event.kt | 41 +- .../io/tonapi/models/ExecGetMethodArg.kt | 40 + .../io/tonapi/models/ExecGetMethodArgType.kt | 77 + ...thodWithBodyForBlockchainAccountRequest.kt | 36 + .../io/tonapi/models/ExtraCurrencies.kt | 36 + .../kotlin/io/tonapi/models/ExtraCurrency.kt | 39 + .../models/ExtraCurrencyTransferAction.kt | 54 + .../kotlin/io/tonapi/models/FoundAccounts.kt | 18 +- .../models/FoundAccountsAddressesInner.kt | 30 +- .../kotlin/io/tonapi/models/GasLimitPrices.kt | 42 +- .../kotlin/io/tonapi/models/GasRelayAction.kt | 42 + .../kotlin/io/tonapi/models/GaslessConfig.kt | 21 +- .../models/GaslessConfigGasJettonsInner.kt | 18 +- .../tonapi/models/GaslessEstimateRequest.kt | 35 +- .../GaslessEstimateRequestMessagesInner.kt | 18 +- .../io/tonapi/models/GaslessSendRequest.kt | 21 +- ...inBlockDefaultResponse.kt => GaslessTx.kt} | 22 +- .../models/GetAccountDiff200Response.kt | 18 +- .../GetAccountInfoByStateInitRequest.kt | 18 +- .../models/GetAccountPublicKey200Response.kt | 18 +- .../io/tonapi/models/GetAccountsRequest.kt | 18 +- .../models/GetAllRawShardsInfo200Response.kt | 24 +- .../tonapi/models/GetChartRates200Response.kt | 21 +- .../GetInscriptionOpTemplate200Response.kt | 39 - .../models/GetMarketsRates200Response.kt | 18 +- .../models/GetOpenapiJsonDefaultResponse.kt | 43 + .../models/GetOutMsgQueueSizes200Response.kt | 21 +- ...tOutMsgQueueSizes200ResponseShardsInner.kt | 21 +- .../io/tonapi/models/GetRates200Response.kt | 18 +- .../models/GetRawAccountState200Response.kt | 30 +- .../models/GetRawBlockProof200Response.kt | 27 +- .../GetRawBlockProof200ResponseStepsInner.kt | 21 +- ...sponseStepsInnerLiteServerBlockLinkBack.kt | 33 +- ...nseStepsInnerLiteServerBlockLinkForward.kt | 33 +- ...nerLiteServerBlockLinkForwardSignatures.kt | 24 +- ...ockLinkForwardSignaturesSignaturesInner.kt | 21 +- .../GetRawBlockchainBlock200Response.kt | 21 +- .../GetRawBlockchainBlockHeader200Response.kt | 24 +- .../GetRawBlockchainBlockState200Response.kt | 27 +- .../tonapi/models/GetRawConfig200Response.kt | 27 +- .../GetRawListBlockTransactions200Response.kt | 30 +- ...istBlockTransactions200ResponseIdsInner.kt | 27 +- .../GetRawMasterchainInfo200Response.kt | 24 +- .../GetRawMasterchainInfoExt200Response.kt | 39 +- .../GetRawShardBlockProof200Response.kt | 21 +- ...RawShardBlockProof200ResponseLinksInner.kt | 21 +- .../models/GetRawShardInfo200Response.kt | 27 +- .../io/tonapi/models/GetRawTime200Response.kt | 18 +- .../models/GetRawTransactions200Response.kt | 21 +- .../GetStakingPoolHistory200Response.kt | 18 +- .../models/GetStakingPoolInfo200Response.kt | 21 +- .../models/GetStakingPools200Response.kt | 21 +- .../models/GetStorageProviders200Response.kt | 18 +- .../models/GetTonConnectPayload200Response.kt | 18 +- .../models/GetWalletBackup200Response.kt | 35 - .../kotlin/io/tonapi/models/ImagePreview.kt | 21 +- .../kotlin/io/tonapi/models/InitStateRaw.kt | 24 +- .../kotlin/io/tonapi/models/InlineObject.kt | 38 + .../io/tonapi/models/InscriptionBalance.kt | 59 - .../io/tonapi/models/InscriptionBalances.kt | 36 - .../io/tonapi/models/InscriptionMintAction.kt | 65 - .../models/InscriptionTransferAction.kt | 73 - .../kotlin/io/tonapi/models/JettonBalance.kt | 33 +- .../io/tonapi/models/JettonBalanceLock.kt | 21 +- .../io/tonapi/models/JettonBridgeParams.kt | 36 +- .../io/tonapi/models/JettonBridgePrices.kt | 33 +- .../io/tonapi/models/JettonBurnAction.kt | 27 +- .../kotlin/io/tonapi/models/JettonHolders.kt | 21 +- .../models/JettonHoldersAddressesInner.kt | 24 +- .../kotlin/io/tonapi/models/JettonInfo.kt | 40 +- .../kotlin/io/tonapi/models/JettonMetadata.kt | 48 +- .../io/tonapi/models/JettonMintAction.kt | 27 +- .../io/tonapi/models/JettonOperation.kt | 78 + .../io/tonapi/models/JettonOperations.kt | 39 + .../kotlin/io/tonapi/models/JettonPreview.kt | 38 +- .../kotlin/io/tonapi/models/JettonQuantity.kt | 24 +- .../io/tonapi/models/JettonSwapAction.kt | 46 +- .../io/tonapi/models/JettonTransferAction.kt | 42 +- .../io/tonapi/models/JettonTransferPayload.kt | 21 +- .../tonapi/models/JettonVerificationType.kt | 17 +- .../main/kotlin/io/tonapi/models/Jettons.kt | 18 +- .../io/tonapi/models/JettonsBalances.kt | 18 +- .../kotlin/io/tonapi/models/MarketTonRates.kt | 26 +- .../main/kotlin/io/tonapi/models/Message.kt | 81 +- .../io/tonapi/models/MessageConsequences.kt | 24 +- .../main/kotlin/io/tonapi/models/Metadata.kt | 40 + ...ccountInspectMethodsInner.kt => Method.kt} | 23 +- .../io/tonapi/models/MethodExecutionResult.kt | 27 +- .../models/MisbehaviourPunishmentConfig.kt | 48 +- .../io/tonapi/models/MsgForwardPrices.kt | 33 +- .../main/kotlin/io/tonapi/models/Multisig.kt | 33 +- .../kotlin/io/tonapi/models/MultisigOrder.kt | 55 +- .../models/MultisigOrderChangingParameters.kt | 41 + .../main/kotlin/io/tonapi/models/Multisigs.kt | 18 +- .../kotlin/io/tonapi/models/NftCollection.kt | 43 +- .../kotlin/io/tonapi/models/NftCollections.kt | 18 +- .../main/kotlin/io/tonapi/models/NftItem.kt | 65 +- .../io/tonapi/models/NftItemCollection.kt | 24 +- .../io/tonapi/models/NftItemTransferAction.kt | 36 +- .../main/kotlin/io/tonapi/models/NftItems.kt | 18 +- .../kotlin/io/tonapi/models/NftOperation.kt | 55 + .../kotlin/io/tonapi/models/NftOperations.kt | 39 + .../io/tonapi/models/NftPurchaseAction.kt | 40 +- .../main/kotlin/io/tonapi/models/Oracle.kt | 21 +- .../io/tonapi/models/OracleBridgeParams.kt | 27 +- .../io/tonapi/models/PoolImplementation.kt | 27 +- .../tonapi/models/PoolImplementationType.kt | 13 +- .../main/kotlin/io/tonapi/models/PoolInfo.kt | 62 +- .../src/main/kotlin/io/tonapi/models/Price.kt | 40 +- .../main/kotlin/io/tonapi/models/Purchase.kt | 59 + .../kotlin/io/tonapi/models/PurchaseAction.kt | 50 + .../io/tonapi/models/RawBlockchainConfig.kt | 20 +- .../kotlin/io/tonapi/models/ReducedBlock.kt | 39 +- .../kotlin/io/tonapi/models/ReducedBlocks.kt | 18 +- .../main/kotlin/io/tonapi/models/Refund.kt | 29 +- .../src/main/kotlin/io/tonapi/models/Risk.kt | 27 +- .../src/main/kotlin/io/tonapi/models/Sale.kt | 27 +- .../models/SendBlockchainMessageRequest.kt | 30 +- .../models/SendRawMessage200Response.kt | 18 +- .../io/tonapi/models/SendRawMessageRequest.kt | 18 +- .../src/main/kotlin/io/tonapi/models/Seqno.kt | 18 +- .../kotlin/io/tonapi/models/ServiceStatus.kt | 24 +- .../kotlin/io/tonapi/models/SignRawMessage.kt | 27 +- .../kotlin/io/tonapi/models/SignRawParams.kt | 39 +- .../io/tonapi/models/SizeLimitsConfig.kt | 39 +- .../io/tonapi/models/SmartContractAction.kt | 33 +- .../main/kotlin/io/tonapi/models/Source.kt | 36 + .../kotlin/io/tonapi/models/SourceFile.kt | 47 + .../main/kotlin/io/tonapi/models/StateInit.kt | 23 +- .../io/tonapi/models/StatusDefaultResponse.kt | 35 - .../kotlin/io/tonapi/models/StoragePhase.kt | 24 +- .../io/tonapi/models/StorageProvider.kt | 33 +- .../kotlin/io/tonapi/models/Subscription.kt | 85 +- .../io/tonapi/models/SubscriptionAction.kt | 30 +- .../kotlin/io/tonapi/models/Subscriptions.kt | 18 +- .../kotlin/io/tonapi/models/TokenRates.kt | 29 +- .../models/TonConnectProof200Response.kt | 18 +- .../tonapi/models/TonConnectProofRequest.kt | 21 +- .../models/TonConnectProofRequestProof.kt | 30 +- .../TonConnectProofRequestProofDomain.kt | 21 +- .../io/tonapi/models/TonTransferAction.kt | 33 +- .../src/main/kotlin/io/tonapi/models/Trace.kt | 27 +- .../main/kotlin/io/tonapi/models/TraceID.kt | 21 +- .../main/kotlin/io/tonapi/models/TraceIDs.kt | 18 +- .../kotlin/io/tonapi/models/Transaction.kt | 94 +- .../io/tonapi/models/TransactionType.kt | 37 +- .../kotlin/io/tonapi/models/Transactions.kt | 18 +- .../main/kotlin/io/tonapi/models/TrustType.kt | 15 +- .../kotlin/io/tonapi/models/TvmStackRecord.kt | 38 +- .../io/tonapi/models/UnSubscriptionAction.kt | 24 +- .../main/kotlin/io/tonapi/models/Validator.kt | 27 +- .../kotlin/io/tonapi/models/Validators.kt | 30 +- .../kotlin/io/tonapi/models/ValidatorsSet.kt | 33 +- .../tonapi/models/ValidatorsSetListInner.kt | 24 +- .../main/kotlin/io/tonapi/models/ValueFlow.kt | 27 +- .../io/tonapi/models/ValueFlowJettonsInner.kt | 28 +- .../main/kotlin/io/tonapi/models/Wallet.kt | 79 + .../main/kotlin/io/tonapi/models/WalletDNS.kt | 33 +- .../kotlin/io/tonapi/models/WalletPlugin.kt | 42 + .../kotlin/io/tonapi/models/WalletStats.kt | 44 + ...ateMessageToEventRequest.kt => Wallets.kt} | 23 +- .../io/tonapi/models/WithdrawStakeAction.kt | 27 +- .../models/WithdrawStakeRequestAction.kt | 27 +- .../kotlin/io/tonapi/models/WorkchainDescr.kt | 51 +- tonapi/templates/data_class.mustache | 338 ++++ tonapi/templates/data_class_opt_var.mustache | 24 + tonapi/templates/data_class_req_var.mustache | 24 + .../libraries/jvm-okhttp/api.mustache | 252 +++ tonapi/tonapi.sh | 17 +- tonapi/upd.sh | 25 +- 439 files changed, 9352 insertions(+), 10235 deletions(-) delete mode 100644 lib/extensions/src/main/java/com/tonapps/extensions/JSON.kt create mode 100644 tonapi/battery-api.yml create mode 100644 tonapi/battery.sh create mode 100644 tonapi/generate.sh create mode 100644 tonapi/proguard-rules.pro create mode 100644 tonapi/src/main/kotlin/io/JsonAny.kt create mode 100644 tonapi/src/main/kotlin/io/Serializer.kt rename tonapi/src/main/kotlin/io/batteryapi/apis/{BatteryApi.kt => DefaultApi.kt} (69%) delete mode 100644 tonapi/src/main/kotlin/io/batteryapi/infrastructure/BigDecimalAdapter.kt delete mode 100644 tonapi/src/main/kotlin/io/batteryapi/infrastructure/BigIntegerAdapter.kt delete mode 100644 tonapi/src/main/kotlin/io/batteryapi/infrastructure/ByteArrayAdapter.kt delete mode 100644 tonapi/src/main/kotlin/io/batteryapi/infrastructure/Errors.kt delete mode 100644 tonapi/src/main/kotlin/io/batteryapi/infrastructure/LocalDateAdapter.kt delete mode 100644 tonapi/src/main/kotlin/io/batteryapi/infrastructure/LocalDateTimeAdapter.kt delete mode 100644 tonapi/src/main/kotlin/io/batteryapi/infrastructure/OffsetDateTimeAdapter.kt delete mode 100644 tonapi/src/main/kotlin/io/batteryapi/infrastructure/PartConfig.kt delete mode 100644 tonapi/src/main/kotlin/io/batteryapi/infrastructure/RequestMethod.kt delete mode 100644 tonapi/src/main/kotlin/io/batteryapi/infrastructure/ResponseExtensions.kt delete mode 100644 tonapi/src/main/kotlin/io/batteryapi/infrastructure/Serializer.kt delete mode 100644 tonapi/src/main/kotlin/io/batteryapi/infrastructure/URIAdapter.kt delete mode 100644 tonapi/src/main/kotlin/io/batteryapi/infrastructure/UUIDAdapter.kt create mode 100644 tonapi/src/main/kotlin/io/batteryapi/models/EstimatedTronTxInstantFee.kt create mode 100644 tonapi/src/main/kotlin/io/batteryapi/models/EstimatedTronTxInstantFeeAcceptedAssetsInner.kt delete mode 100644 tonapi/src/main/kotlin/io/batteryapi/models/GasProxyAddress.kt create mode 100644 tonapi/src/main/kotlin/io/batteryapi/models/IncreaseUserBalanceRequest.kt rename tonapi/src/main/kotlin/io/batteryapi/models/{GetTonConnectPayloadDefaultResponse.kt => InlineObject.kt} (60%) create mode 100644 tonapi/src/main/kotlin/io/batteryapi/models/VerifyPurchasePromo200Response.kt create mode 100644 tonapi/src/main/kotlin/io/extensions/NftItem.kt rename tonapi/src/main/kotlin/io/{batteryapi => }/infrastructure/ApiAbstractions.kt (95%) rename tonapi/src/main/kotlin/io/{batteryapi => }/infrastructure/ApiClient.kt (96%) rename tonapi/src/main/kotlin/io/{batteryapi => }/infrastructure/ApiResponse.kt (97%) create mode 100644 tonapi/src/main/kotlin/io/infrastructure/AtomicBooleanAdapter.kt create mode 100644 tonapi/src/main/kotlin/io/infrastructure/AtomicIntegerAdapter.kt create mode 100644 tonapi/src/main/kotlin/io/infrastructure/AtomicLongAdapter.kt create mode 100644 tonapi/src/main/kotlin/io/infrastructure/BigDecimalAdapter.kt create mode 100644 tonapi/src/main/kotlin/io/infrastructure/BigIntegerAdapter.kt rename tonapi/src/main/kotlin/io/{tonapi => }/infrastructure/Errors.kt (94%) create mode 100644 tonapi/src/main/kotlin/io/infrastructure/LocalDateAdapter.kt create mode 100644 tonapi/src/main/kotlin/io/infrastructure/LocalDateTimeAdapter.kt create mode 100644 tonapi/src/main/kotlin/io/infrastructure/OffsetDateTimeAdapter.kt rename tonapi/src/main/kotlin/io/{tonapi => }/infrastructure/PartConfig.kt (90%) rename tonapi/src/main/kotlin/io/{batteryapi => }/infrastructure/RequestConfig.kt (94%) rename tonapi/src/main/kotlin/io/{tonapi => }/infrastructure/RequestMethod.kt (78%) rename tonapi/src/main/kotlin/io/{tonapi => }/infrastructure/ResponseExtensions.kt (95%) create mode 100644 tonapi/src/main/kotlin/io/infrastructure/StringBuilderAdapter.kt create mode 100644 tonapi/src/main/kotlin/io/infrastructure/URIAdapter.kt create mode 100644 tonapi/src/main/kotlin/io/infrastructure/URLAdapter.kt create mode 100644 tonapi/src/main/kotlin/io/infrastructure/UUIDAdapter.kt create mode 100644 tonapi/src/main/kotlin/io/serializers/AnySerializer.kt create mode 100644 tonapi/src/main/kotlin/io/tonapi/apis/ExtraCurrencyApi.kt delete mode 100644 tonapi/src/main/kotlin/io/tonapi/apis/InscriptionsApi.kt create mode 100644 tonapi/src/main/kotlin/io/tonapi/apis/PurchasesApi.kt delete mode 100644 tonapi/src/main/kotlin/io/tonapi/infrastructure/ApiAbstractions.kt delete mode 100644 tonapi/src/main/kotlin/io/tonapi/infrastructure/ApiClient.kt delete mode 100644 tonapi/src/main/kotlin/io/tonapi/infrastructure/ApiResponse.kt delete mode 100644 tonapi/src/main/kotlin/io/tonapi/infrastructure/BigDecimalAdapter.kt delete mode 100644 tonapi/src/main/kotlin/io/tonapi/infrastructure/BigIntegerAdapter.kt delete mode 100644 tonapi/src/main/kotlin/io/tonapi/infrastructure/ByteArrayAdapter.kt delete mode 100644 tonapi/src/main/kotlin/io/tonapi/infrastructure/LocalDateAdapter.kt delete mode 100644 tonapi/src/main/kotlin/io/tonapi/infrastructure/LocalDateTimeAdapter.kt delete mode 100644 tonapi/src/main/kotlin/io/tonapi/infrastructure/OffsetDateTimeAdapter.kt delete mode 100644 tonapi/src/main/kotlin/io/tonapi/infrastructure/RequestConfig.kt delete mode 100644 tonapi/src/main/kotlin/io/tonapi/infrastructure/Serializer.kt delete mode 100644 tonapi/src/main/kotlin/io/tonapi/infrastructure/URIAdapter.kt delete mode 100644 tonapi/src/main/kotlin/io/tonapi/infrastructure/UUIDAdapter.kt create mode 100644 tonapi/src/main/kotlin/io/tonapi/models/AccountPurchases.kt create mode 100644 tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig45.kt create mode 100644 tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig45ContractsInner.kt rename tonapi/src/main/kotlin/io/tonapi/models/{DecodeMessageRequest.kt => BlockchainLibrary.kt} (61%) create mode 100644 tonapi/src/main/kotlin/io/tonapi/models/CurrencyType.kt create mode 100644 tonapi/src/main/kotlin/io/tonapi/models/DecodedMessageExtInMsgDecodedWalletV5.kt create mode 100644 tonapi/src/main/kotlin/io/tonapi/models/EcPreview.kt create mode 100644 tonapi/src/main/kotlin/io/tonapi/models/ExecGetMethodArg.kt create mode 100644 tonapi/src/main/kotlin/io/tonapi/models/ExecGetMethodArgType.kt create mode 100644 tonapi/src/main/kotlin/io/tonapi/models/ExecGetMethodWithBodyForBlockchainAccountRequest.kt create mode 100644 tonapi/src/main/kotlin/io/tonapi/models/ExtraCurrencies.kt create mode 100644 tonapi/src/main/kotlin/io/tonapi/models/ExtraCurrency.kt create mode 100644 tonapi/src/main/kotlin/io/tonapi/models/ExtraCurrencyTransferAction.kt create mode 100644 tonapi/src/main/kotlin/io/tonapi/models/GasRelayAction.kt rename tonapi/src/main/kotlin/io/tonapi/models/{GetBlockchainBlockDefaultResponse.kt => GaslessTx.kt} (55%) delete mode 100644 tonapi/src/main/kotlin/io/tonapi/models/GetInscriptionOpTemplate200Response.kt create mode 100644 tonapi/src/main/kotlin/io/tonapi/models/GetOpenapiJsonDefaultResponse.kt delete mode 100644 tonapi/src/main/kotlin/io/tonapi/models/GetWalletBackup200Response.kt create mode 100644 tonapi/src/main/kotlin/io/tonapi/models/InlineObject.kt delete mode 100644 tonapi/src/main/kotlin/io/tonapi/models/InscriptionBalance.kt delete mode 100644 tonapi/src/main/kotlin/io/tonapi/models/InscriptionBalances.kt delete mode 100644 tonapi/src/main/kotlin/io/tonapi/models/InscriptionMintAction.kt delete mode 100644 tonapi/src/main/kotlin/io/tonapi/models/InscriptionTransferAction.kt create mode 100644 tonapi/src/main/kotlin/io/tonapi/models/JettonOperation.kt create mode 100644 tonapi/src/main/kotlin/io/tonapi/models/JettonOperations.kt create mode 100644 tonapi/src/main/kotlin/io/tonapi/models/Metadata.kt rename tonapi/src/main/kotlin/io/tonapi/models/{BlockchainAccountInspectMethodsInner.kt => Method.kt} (61%) create mode 100644 tonapi/src/main/kotlin/io/tonapi/models/MultisigOrderChangingParameters.kt create mode 100644 tonapi/src/main/kotlin/io/tonapi/models/NftOperation.kt create mode 100644 tonapi/src/main/kotlin/io/tonapi/models/NftOperations.kt create mode 100644 tonapi/src/main/kotlin/io/tonapi/models/Purchase.kt create mode 100644 tonapi/src/main/kotlin/io/tonapi/models/PurchaseAction.kt create mode 100644 tonapi/src/main/kotlin/io/tonapi/models/Source.kt create mode 100644 tonapi/src/main/kotlin/io/tonapi/models/SourceFile.kt delete mode 100644 tonapi/src/main/kotlin/io/tonapi/models/StatusDefaultResponse.kt create mode 100644 tonapi/src/main/kotlin/io/tonapi/models/Wallet.kt create mode 100644 tonapi/src/main/kotlin/io/tonapi/models/WalletPlugin.kt create mode 100644 tonapi/src/main/kotlin/io/tonapi/models/WalletStats.kt rename tonapi/src/main/kotlin/io/tonapi/models/{EmulateMessageToEventRequest.kt => Wallets.kt} (51%) create mode 100644 tonapi/templates/data_class.mustache create mode 100644 tonapi/templates/data_class_opt_var.mustache create mode 100644 tonapi/templates/data_class_req_var.mustache create mode 100644 tonapi/templates/libraries/jvm-okhttp/api.mustache diff --git a/apps/wallet/api/build.gradle.kts b/apps/wallet/api/build.gradle.kts index 38e336367..0d33a6849 100644 --- a/apps/wallet/api/build.gradle.kts +++ b/apps/wallet/api/build.gradle.kts @@ -33,6 +33,4 @@ dependencies { implementation(Dependence.GooglePlay.cronet) implementation(Dependence.Squareup.okhttp) implementation(Dependence.Squareup.sse) - implementation(Dependence.Squareup.moshi) - implementation(Dependence.Squareup.moshiAdapters) } diff --git a/apps/wallet/api/src/main/java/com/tonapps/wallet/api/API.kt b/apps/wallet/api/src/main/java/com/tonapps/wallet/api/API.kt index 3ff24163f..f7d3081f7 100644 --- a/apps/wallet/api/src/main/java/com/tonapps/wallet/api/API.kt +++ b/apps/wallet/api/src/main/java/com/tonapps/wallet/api/API.kt @@ -3,7 +3,6 @@ package com.tonapps.wallet.api import android.content.Context import android.net.Uri import android.util.ArrayMap -import com.squareup.moshi.JsonAdapter import com.tonapps.blockchain.ton.contract.BaseWalletContract import com.tonapps.blockchain.ton.contract.WalletVersion import com.tonapps.blockchain.ton.extensions.EmptyPrivateKeyEd25519 @@ -33,13 +32,13 @@ import com.tonapps.wallet.api.entity.TokenEntity import com.tonapps.wallet.api.internal.ConfigRepository import com.tonapps.wallet.api.internal.InternalApi import com.tonapps.wallet.api.tron.TronApi -import io.batteryapi.apis.BatteryApi -import io.batteryapi.apis.BatteryApi.UnitsGetBalance +import io.Serializer +import io.batteryapi.apis.DefaultApi import io.batteryapi.models.Balance import io.batteryapi.models.Config +import io.batteryapi.models.EstimateGaslessCostRequest import io.batteryapi.models.RechargeMethods -import io.tonapi.infrastructure.ClientException -import io.tonapi.infrastructure.Serializer +import io.infrastructure.ClientException import io.tonapi.models.Account import io.tonapi.models.AccountAddress import io.tonapi.models.AccountEvent @@ -142,15 +141,11 @@ class API( private val batteryApi by lazy { SourceAPI( - BatteryApi(config.batteryHost, tonAPIHttpClient), - BatteryApi(config.batteryTestnetHost, tonAPIHttpClient) + DefaultApi(config.batteryHost, tonAPIHttpClient), + DefaultApi(config.batteryTestnetHost, tonAPIHttpClient) ) } - private val emulationJSONAdapter: JsonAdapter by lazy { - Serializer.moshi.adapter(MessageConsequences::class.java) - } - val tron = TronApi(config, defaultHttpClient, batteryApi.get(false)) fun accounts(testnet: Boolean) = provider.accounts.get(testnet) @@ -198,7 +193,7 @@ class API( fun getBatteryBalance( tonProofToken: String, testnet: Boolean, - units: UnitsGetBalance = UnitsGetBalance.ton + units: DefaultApi.UnitsGetBalance = DefaultApi.UnitsGetBalance.ton ): Balance? { return withRetry { battery(testnet).getBalance(tonProofToken, units) } } @@ -210,7 +205,7 @@ class API( private fun isOkStatus(testnet: Boolean): Boolean { try { val status = withRetry { - provider.blockchain.get(testnet).status() + provider.utilities.get(testnet).status() } ?: return false if (!status.restOnline) { return false @@ -329,6 +324,7 @@ class API( lt = event.lt, inProgress = event.inProgress, extra = 0L, + progress = 0f, ) listOf(accountEvent) } @@ -400,7 +396,7 @@ class API( accounts(testnet).getAccountJettonsBalances( accountId = accountId, currencies = currency?.let { listOf(it) }, - extensions = extensions, + supportedExtensions = extensions, ).balances } ?: return null return jettonsBalances.map { BalanceEntity(it) }.filter { it.value.isPositive } @@ -439,7 +435,11 @@ class API( val wallets = withRetry { wallet(testnet).getWalletsByPublicKey(query).accounts } ?: return emptyList() - wallets.map { AccountDetailsEntity(query, it, testnet) }.map { + wallets.map { AccountDetailsEntity( + query = query, + wallet = it, + testnet = testnet + ) }.map { if (it.walletVersion == WalletVersion.UNKNOWN) { it.copy( walletVersion = BaseWalletContract.resolveVersion( @@ -566,7 +566,7 @@ class API( cell: Cell, testnet: Boolean, ): String? { - val request = io.batteryapi.models.EstimateGaslessCostRequest(cell.base64(), false) + val request = EstimateGaslessCostRequest(cell.base64(), false) return withRetry { battery(testnet).estimateGaslessCost(jettonMaster, request, tonProofToken).commission @@ -601,7 +601,11 @@ class API( val withBattery = supportedByBattery && allowedByBattery val string = response.body?.string() ?: return null - val consequences = emulationJSONAdapter.fromJson(string) ?: return null + val consequences = try { + Serializer.JSON.decodeFromString(string) + } catch (e: Throwable) { + return null + } return Pair(consequences, withBattery) } @@ -619,7 +623,7 @@ class API( val request = EmulateMessageToWalletRequest( boc = boc, params = params, - safeMode = safeModeEnabled + // safeMode = safeModeEnabled ) withRetry { emulation(testnet).emulateMessageToWallet(request) @@ -667,12 +671,15 @@ class API( return@withContext SendBlockchainState.STATUS_ERROR } + val meta = hashMapOf( + "platform" to "android", + "version" to appVersionName, + "source" to source, + "confirmation_time" to confirmationTime.toString() + ) val request = SendBlockchainMessageRequest( boc = boc, - platform = "android", - version = appVersionName, - source = source, - confirmationTime = confirmationTime + meta = meta ) withRetry { blockchain(testnet).sendBlockchainMessage(request) diff --git a/apps/wallet/api/src/main/java/com/tonapps/wallet/api/Extensions.kt b/apps/wallet/api/src/main/java/com/tonapps/wallet/api/Extensions.kt index a299e0091..62ad1912a 100644 --- a/apps/wallet/api/src/main/java/com/tonapps/wallet/api/Extensions.kt +++ b/apps/wallet/api/src/main/java/com/tonapps/wallet/api/Extensions.kt @@ -1,35 +1,14 @@ package com.tonapps.wallet.api import android.os.SystemClock -import io.tonapi.infrastructure.Serializer -import com.squareup.moshi.adapter -import io.tonapi.infrastructure.ClientException -import android.util.Log -import android.widget.Toast -import com.google.firebase.crashlytics.BuildConfig import com.google.firebase.crashlytics.FirebaseCrashlytics import com.tonapps.network.OkHttpError -import io.tonapi.infrastructure.ClientError -import io.tonapi.infrastructure.Response -import io.tonapi.infrastructure.ServerError -import kotlinx.coroutines.delay +import io.infrastructure.ClientError +import io.infrastructure.ClientException +import io.infrastructure.ServerError import kotlinx.coroutines.CancellationException import kotlinx.io.IOException import java.net.SocketTimeoutException -import java.net.UnknownHostException - -@OptIn(ExperimentalStdlibApi::class) -inline fun toJSON(obj: T?): String { - if (obj == null) { - return "" - } - return Serializer.moshi.adapter().toJson(obj) -} - -@OptIn(ExperimentalStdlibApi::class) -inline fun fromJSON(json: String): T { - return Serializer.moshi.adapter().fromJson(json)!! -} fun withRetry( times: Int = 5, @@ -47,11 +26,9 @@ fun withRetry( SystemClock.sleep(delay + 100) return null } catch (e: IOException) { - Log.e("WithRetryLog", "IOException: ${e.message}", e) SystemClock.sleep(delay + 100) return null } catch (e: Throwable) { - Log.e("WithRetryLog", "Error: ${e.message}", e) val statusCode = e.getHttpStatusCode() if (statusCode == 429 || statusCode == 401 || statusCode == 502 || statusCode == 520) { SystemClock.sleep(delay + 100) diff --git a/apps/wallet/api/src/main/java/com/tonapps/wallet/api/Provider.kt b/apps/wallet/api/src/main/java/com/tonapps/wallet/api/Provider.kt index 05c65ed23..dd14fd69f 100644 --- a/apps/wallet/api/src/main/java/com/tonapps/wallet/api/Provider.kt +++ b/apps/wallet/api/src/main/java/com/tonapps/wallet/api/Provider.kt @@ -42,4 +42,6 @@ internal class Provider( val wallet = SourceAPI(main.wallet, test.wallet) val gasless = SourceAPI(main.gasless, test.gasless) + + val utilities = SourceAPI(main.utilities, test.utilities) } \ No newline at end of file diff --git a/apps/wallet/api/src/main/java/com/tonapps/wallet/api/core/BaseAPI.kt b/apps/wallet/api/src/main/java/com/tonapps/wallet/api/core/BaseAPI.kt index f9f003714..f4627c99d 100644 --- a/apps/wallet/api/src/main/java/com/tonapps/wallet/api/core/BaseAPI.kt +++ b/apps/wallet/api/src/main/java/com/tonapps/wallet/api/core/BaseAPI.kt @@ -1,6 +1,5 @@ package com.tonapps.wallet.api.core -import io.batteryapi.apis.BatteryApi import io.tonapi.apis.AccountsApi import io.tonapi.apis.BlockchainApi import io.tonapi.apis.ConnectApi @@ -15,6 +14,7 @@ import io.tonapi.apis.RatesApi import io.tonapi.apis.StakingApi import io.tonapi.apis.StorageApi import io.tonapi.apis.TracesApi +import io.tonapi.apis.UtilitiesApi import io.tonapi.apis.WalletApi import okhttp3.OkHttpClient @@ -53,4 +53,6 @@ class BaseAPI( val gasless: GaslessApi by lazy { GaslessApi(basePath, okHttpClient) } + val utilities: UtilitiesApi by lazy { UtilitiesApi(basePath, okHttpClient) } + } \ No newline at end of file diff --git a/apps/wallet/api/src/main/java/com/tonapps/wallet/api/entity/AccountDetailsEntity.kt b/apps/wallet/api/src/main/java/com/tonapps/wallet/api/entity/AccountDetailsEntity.kt index cb14f235a..2e1a7c20f 100644 --- a/apps/wallet/api/src/main/java/com/tonapps/wallet/api/entity/AccountDetailsEntity.kt +++ b/apps/wallet/api/src/main/java/com/tonapps/wallet/api/entity/AccountDetailsEntity.kt @@ -9,6 +9,7 @@ import com.tonapps.blockchain.ton.extensions.toRawAddress import com.tonapps.blockchain.ton.extensions.toUserFriendly import io.tonapi.models.Account import io.tonapi.models.AccountStatus +import io.tonapi.models.Wallet import kotlinx.parcelize.Parcelize @Parcelize @@ -61,6 +62,22 @@ data class AccountDetailsEntity( testnet = testnet, ) + constructor( + query: String, + wallet: Wallet, + testnet: Boolean, + new: Boolean = false + ) : this( + query = query, + preview = AccountEntity(wallet, testnet), + active = wallet.status == AccountStatus.active, + walletVersion = resolveVersion(testnet, wallet.interfaces, wallet.address), + balance = wallet.balance, + new = new, + initialized = wallet.status == AccountStatus.active || wallet.status == AccountStatus.frozen, + testnet = testnet, + ) + private companion object { private fun resolveVersion(testnet: Boolean, interfaces: List?, address: String): WalletVersion { diff --git a/apps/wallet/api/src/main/java/com/tonapps/wallet/api/entity/AccountEntity.kt b/apps/wallet/api/src/main/java/com/tonapps/wallet/api/entity/AccountEntity.kt index b72a2aa44..9d563eab0 100644 --- a/apps/wallet/api/src/main/java/com/tonapps/wallet/api/entity/AccountEntity.kt +++ b/apps/wallet/api/src/main/java/com/tonapps/wallet/api/entity/AccountEntity.kt @@ -9,8 +9,10 @@ import com.tonapps.blockchain.ton.extensions.toWalletAddress import com.tonapps.extensions.short4 import io.tonapi.models.Account import io.tonapi.models.AccountAddress +import io.tonapi.models.Wallet import kotlinx.parcelize.Parcelize import org.ton.block.AddrStd +import androidx.core.net.toUri @Parcelize data class AccountEntity( @@ -43,7 +45,7 @@ data class AccountEntity( address = model.address.toUserFriendly(model.isWallet, testnet), accountId = model.address.toRawAddress(), name = model.name, - iconUri = model.icon?.let { Uri.parse(it) }, + iconUri = model.icon?.toUri(), isWallet = model.isWallet, isScam = model.isScam ) @@ -52,8 +54,17 @@ data class AccountEntity( address = account.address.toUserFriendly(account.isWallet, testnet), accountId = account.address.toRawAddress(), name = account.name, - iconUri = account.icon?.let { Uri.parse(it) }, + iconUri = account.icon?.toUri(), isWallet = account.isWallet, isScam = account.isScam ?: false ) + + constructor(wallet: Wallet, testnet: Boolean) : this( + address = wallet.address.toUserFriendly(wallet.isWallet, testnet), + accountId = wallet.address.toRawAddress(), + name = wallet.name, + iconUri = wallet.icon?.toUri(), + isWallet = wallet.isWallet, + isScam = false + ) } diff --git a/apps/wallet/api/src/main/java/com/tonapps/wallet/api/entity/TokenEntity.kt b/apps/wallet/api/src/main/java/com/tonapps/wallet/api/entity/TokenEntity.kt index 4e01f4633..2005e65d4 100644 --- a/apps/wallet/api/src/main/java/com/tonapps/wallet/api/entity/TokenEntity.kt +++ b/apps/wallet/api/src/main/java/com/tonapps/wallet/api/entity/TokenEntity.kt @@ -194,6 +194,6 @@ data class TokenEntity( isRequestMinting = extensions?.contains(Extension.CustomPayload.value) == true, isTransferable = extensions?.contains(Extension.NonTransferable.value) != true, lock = lock?.let { Lock(it) }, - customPayloadApiUri = jetton.customPayloadApiUri + customPayloadApiUri = jetton.metadata.customPayloadApiUri ) } \ No newline at end of file diff --git a/apps/wallet/api/src/main/java/com/tonapps/wallet/api/tron/TronApi.kt b/apps/wallet/api/src/main/java/com/tonapps/wallet/api/tron/TronApi.kt index 407d8d9fe..53fd2f052 100644 --- a/apps/wallet/api/src/main/java/com/tonapps/wallet/api/tron/TronApi.kt +++ b/apps/wallet/api/src/main/java/com/tonapps/wallet/api/tron/TronApi.kt @@ -16,7 +16,7 @@ import com.tonapps.wallet.api.tron.entity.TronEstimationEntity import com.tonapps.wallet.api.tron.entity.TronEventEntity import com.tonapps.wallet.api.tron.entity.TronResourcesEntity import com.tonapps.wallet.api.withRetry -import io.batteryapi.apis.BatteryApi +import io.batteryapi.apis.DefaultApi import io.batteryapi.models.TronSendRequest import io.ktor.util.encodeBase64 import kotlinx.serialization.json.buildJsonObject @@ -28,7 +28,7 @@ import java.math.BigInteger class TronApi( private val config: ConfigEntity, private val okHttpClient: OkHttpClient, - private val batteryApi: BatteryApi + private val batteryApi: DefaultApi ) { companion object { diff --git a/apps/wallet/data/battery/build.gradle.kts b/apps/wallet/data/battery/build.gradle.kts index 56d40c87c..14eb14d87 100644 --- a/apps/wallet/data/battery/build.gradle.kts +++ b/apps/wallet/data/battery/build.gradle.kts @@ -8,8 +8,6 @@ android { } dependencies { - implementation(Dependence.Squareup.moshi) - implementation(Dependence.Squareup.moshiAdapters) implementation(Dependence.Squareup.okhttp) implementation(project(Dependence.Module.tonApi)) diff --git a/apps/wallet/data/collectibles/src/main/java/com/tonapps/wallet/data/collectibles/CollectiblesRepository.kt b/apps/wallet/data/collectibles/src/main/java/com/tonapps/wallet/data/collectibles/CollectiblesRepository.kt index ef5be2757..755fe994a 100644 --- a/apps/wallet/data/collectibles/src/main/java/com/tonapps/wallet/data/collectibles/CollectiblesRepository.kt +++ b/apps/wallet/data/collectibles/src/main/java/com/tonapps/wallet/data/collectibles/CollectiblesRepository.kt @@ -7,6 +7,8 @@ import com.tonapps.wallet.api.API import com.tonapps.wallet.data.collectibles.entities.NftEntity import com.tonapps.wallet.data.collectibles.entities.NftListResult import com.tonapps.wallet.data.collectibles.source.LocalDataSource +import io.extensions.renderType +import io.tonapi.models.TrustType import kotlinx.coroutines.flow.cancellable import kotlinx.coroutines.flow.flow @@ -64,7 +66,7 @@ class CollectiblesRepository( ): List? { val nftItems = api.getNftItems(address, testnet) ?: return null val items = nftItems.filter { - it.trust != "blacklist" && it.metadata["render_type"] != "hidden" + it.trust != TrustType.blacklist && it.renderType != "hidden" }.map { NftEntity(it, testnet) } localDataSource.save(address, testnet, items.toList()) diff --git a/apps/wallet/data/collectibles/src/main/java/com/tonapps/wallet/data/collectibles/entities/NftEntity.kt b/apps/wallet/data/collectibles/src/main/java/com/tonapps/wallet/data/collectibles/entities/NftEntity.kt index eaeb39552..6e3362af0 100644 --- a/apps/wallet/data/collectibles/src/main/java/com/tonapps/wallet/data/collectibles/entities/NftEntity.kt +++ b/apps/wallet/data/collectibles/src/main/java/com/tonapps/wallet/data/collectibles/entities/NftEntity.kt @@ -119,6 +119,6 @@ data class NftEntity( verified = item.approvedBy.isNotEmpty(), inSale = item.sale != null, dns = item.dns, - trust = Trust(item.trust), + trust = Trust(item.trust.value), ) } \ No newline at end of file diff --git a/apps/wallet/data/collectibles/src/main/java/com/tonapps/wallet/data/collectibles/entities/NftMetadataEntity.kt b/apps/wallet/data/collectibles/src/main/java/com/tonapps/wallet/data/collectibles/entities/NftMetadataEntity.kt index c7e52f642..6e3eaff71 100644 --- a/apps/wallet/data/collectibles/src/main/java/com/tonapps/wallet/data/collectibles/entities/NftMetadataEntity.kt +++ b/apps/wallet/data/collectibles/src/main/java/com/tonapps/wallet/data/collectibles/entities/NftMetadataEntity.kt @@ -3,6 +3,7 @@ package com.tonapps.wallet.data.collectibles.entities import android.os.Parcelable import android.util.Base64 import android.util.Log +import io.JsonAny import kotlinx.parcelize.IgnoredOnParcel import kotlinx.parcelize.Parcelize @@ -43,12 +44,18 @@ data class NftMetadataEntity( "https://c.tonapi.io/json?url=$encoded" } - constructor(map: Map) : this( - strings = map.filter { it.value is String }.mapValues { it.value as String } as HashMap, - buttons = map["buttons"]?.let { buttons -> - (buttons as List>).map { - Button(it) + constructor(map: Map) : this( + strings = HashMap(map.mapNotNull { (key, value) -> + value.asString()?.let { key to it } + }.toMap()), + + buttons = map["buttons"]?.asArray()?.mapNotNull { buttonElement -> + buttonElement.asObject()?.let { buttonMap -> + val stringMap = buttonMap.mapNotNull { (key, value) -> + value.asString()?.let { key to it } + }.toMap() + Button(stringMap) } - } ?: arrayListOf() + } ?: emptyList() ) } \ No newline at end of file diff --git a/apps/wallet/data/core/src/main/java/com/tonapps/wallet/data/core/BlobDataSource.kt b/apps/wallet/data/core/src/main/java/com/tonapps/wallet/data/core/BlobDataSource.kt index 944ebc8a3..88a9c5fa2 100644 --- a/apps/wallet/data/core/src/main/java/com/tonapps/wallet/data/core/BlobDataSource.kt +++ b/apps/wallet/data/core/src/main/java/com/tonapps/wallet/data/core/BlobDataSource.kt @@ -2,17 +2,14 @@ package com.tonapps.wallet.data.core import android.content.Context import android.os.Parcelable -import android.util.Log import com.google.firebase.crashlytics.FirebaseCrashlytics import com.tonapps.extensions.cacheFolder import com.tonapps.extensions.file import com.tonapps.extensions.toByteArray import com.tonapps.extensions.toParcel -import com.tonapps.wallet.api.fromJSON -import com.tonapps.wallet.api.toJSON +import io.Serializer import java.io.File import java.io.IOException -import java.util.concurrent.ConcurrentHashMap import java.util.concurrent.TimeUnit abstract class BlobDataSource( @@ -40,7 +37,7 @@ abstract class BlobDataSource( timeout: Long = TimeUnit.DAYS.toMillis(90) ): BlobDataSource { return object : BlobDataSource(context, path, timeout) { - override fun onMarshall(data: T) = toJSON(data).toByteArray() + override fun onMarshall(data: T) = Serializer.toJSON(data).toByteArray() override fun onUnmarshall(bytes: ByteArray): T? { if (bytes.isEmpty()) { @@ -48,7 +45,7 @@ abstract class BlobDataSource( } return try { val string = String(bytes) - fromJSON(string) + Serializer.fromJSON(string) } catch (e: Throwable) { FirebaseCrashlytics.getInstance().recordException(e) null diff --git a/apps/wallet/data/events/src/main/java/com/tonapps/wallet/data/events/Extensions.kt b/apps/wallet/data/events/src/main/java/com/tonapps/wallet/data/events/Extensions.kt index 5d84c8ab4..593446fbe 100644 --- a/apps/wallet/data/events/src/main/java/com/tonapps/wallet/data/events/Extensions.kt +++ b/apps/wallet/data/events/src/main/java/com/tonapps/wallet/data/events/Extensions.kt @@ -7,7 +7,7 @@ import io.tonapi.models.Action val Action.isTransfer: Boolean get() { - return type == TxActionType.TonTransfer || type == TxActionType.JettonTransfer || type == TxActionType.NftItemTransfer + return type == Action.Type.TonTransfer || type == Action.Type.JettonTransfer || type == Action.Type.NftItemTransfer || type == Action.Type.Purchase } fun AccountEvent.isOutTransfer(accountId: String): Boolean { diff --git a/apps/wallet/data/events/src/main/java/com/tonapps/wallet/data/events/source/DatabaseSource.kt b/apps/wallet/data/events/src/main/java/com/tonapps/wallet/data/events/source/DatabaseSource.kt index 71b863881..51fa3322c 100644 --- a/apps/wallet/data/events/src/main/java/com/tonapps/wallet/data/events/source/DatabaseSource.kt +++ b/apps/wallet/data/events/src/main/java/com/tonapps/wallet/data/events/source/DatabaseSource.kt @@ -3,12 +3,10 @@ package com.tonapps.wallet.data.events.source import android.content.ContentValues import android.content.Context import android.database.sqlite.SQLiteDatabase -import android.util.Log import com.tonapps.blockchain.ton.extensions.toRawAddress import com.tonapps.sqlite.SQLiteHelper import com.tonapps.sqlite.withTransaction -import com.tonapps.wallet.api.fromJSON -import com.tonapps.wallet.api.toJSON +import io.Serializer import io.tonapi.models.AccountEvent import kotlinx.coroutines.CoroutineScope @@ -37,7 +35,7 @@ internal class DatabaseSource( values.put(SPAM_TABLE_EVENT_ID_COLUMN, eventId) values.put(SPAM_TABLE_ACCOUNT_ID_COLUMN, accountId.toRawAddress()) values.put(SPAM_TABLE_TESTNET_COLUMN, if (testnet) 1 else 0) - values.put(SPAM_TABLE_BODY_COLUMN, toJSON(this)) + values.put(SPAM_TABLE_BODY_COLUMN, Serializer.toJSON(this)) values.put(SPAM_TABLE_DATE_COLUMN, timestamp) return values } @@ -81,7 +79,7 @@ internal class DatabaseSource( val events = mutableListOf() while (cursor.moveToNext()) { val body = cursor.getString(bodyIndex) - events.add(fromJSON(body)) + events.add(Serializer.fromJSON(body)) } cursor.close() return events.toList() diff --git a/apps/wallet/data/purchase/build.gradle.kts b/apps/wallet/data/purchase/build.gradle.kts index 1d81edf57..a5db540ea 100644 --- a/apps/wallet/data/purchase/build.gradle.kts +++ b/apps/wallet/data/purchase/build.gradle.kts @@ -12,6 +12,7 @@ dependencies { implementation(project(Dependence.Wallet.Data.core)) implementation(project(Dependence.Wallet.api)) implementation(project(Dependence.Lib.extensions)) + implementation(project(Dependence.Module.tonApi)) api(Dependence.TON.tvm) api(Dependence.TON.crypto) diff --git a/apps/wallet/data/purchase/src/main/java/com/tonapps/wallet/data/purchase/PurchaseRepository.kt b/apps/wallet/data/purchase/src/main/java/com/tonapps/wallet/data/purchase/PurchaseRepository.kt index bfa97715f..b93589d6e 100644 --- a/apps/wallet/data/purchase/src/main/java/com/tonapps/wallet/data/purchase/PurchaseRepository.kt +++ b/apps/wallet/data/purchase/src/main/java/com/tonapps/wallet/data/purchase/PurchaseRepository.kt @@ -1,13 +1,9 @@ package com.tonapps.wallet.data.purchase import android.content.Context -import android.util.Log -import com.tonapps.extensions.JSON import com.tonapps.extensions.getParcelable import com.tonapps.extensions.prefs import com.tonapps.extensions.putParcelable -import com.tonapps.extensions.putString -import com.tonapps.extensions.state import com.tonapps.extensions.toByteArray import com.tonapps.extensions.toParcel import com.tonapps.wallet.api.API @@ -17,17 +13,11 @@ import com.tonapps.wallet.data.purchase.entity.OnRamp import com.tonapps.wallet.data.purchase.entity.PurchaseCategoryEntity import com.tonapps.wallet.data.purchase.entity.PurchaseDataEntity import com.tonapps.wallet.data.purchase.entity.PurchaseMethodEntity +import io.Serializer import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.flow.MutableStateFlow -import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.asStateFlow -import kotlinx.coroutines.flow.callbackFlow -import kotlinx.coroutines.flow.filterNotNull -import kotlinx.coroutines.flow.flow -import kotlinx.coroutines.flow.flowOn -import kotlinx.coroutines.flow.map -import kotlinx.coroutines.flow.stateIn import kotlinx.coroutines.withContext import org.ton.crypto.digest.sha512 import org.ton.crypto.hex @@ -85,7 +75,7 @@ class PurchaseRepository( private suspend fun loadOnRampData(country: String): OnRamp.Data? = withContext(Dispatchers.IO) { val data = api.getOnRampData(country) ?: return@withContext null try { - JSON.decodeFromString(data) + Serializer.fromJSON(data) } catch (e: Throwable) { null } diff --git a/apps/wallet/data/rates/src/main/java/com/tonapps/wallet/data/rates/RatesRepository.kt b/apps/wallet/data/rates/src/main/java/com/tonapps/wallet/data/rates/RatesRepository.kt index 750c2582c..f0e5ce312 100644 --- a/apps/wallet/data/rates/src/main/java/com/tonapps/wallet/data/rates/RatesRepository.kt +++ b/apps/wallet/data/rates/src/main/java/com/tonapps/wallet/data/rates/RatesRepository.kt @@ -51,7 +51,8 @@ class RatesRepository( val entities = mutableListOf() for (rate in rates) { val value = rate.value - val bigDecimal = value.prices?.get(currency.code) ?: BigDecimal.ZERO + val prices = value.prices?.get(currency.code)?.let(::BigDecimal) + val bigDecimal = prices ?: BigDecimal.ZERO entities.add(RateEntity( tokenCode = rate.key, diff --git a/apps/wallet/data/staking/src/main/java/com/tonapps/wallet/data/staking/entities/PoolEntity.kt b/apps/wallet/data/staking/src/main/java/com/tonapps/wallet/data/staking/entities/PoolEntity.kt index 2961cea0d..67ffe01eb 100644 --- a/apps/wallet/data/staking/src/main/java/com/tonapps/wallet/data/staking/entities/PoolEntity.kt +++ b/apps/wallet/data/staking/src/main/java/com/tonapps/wallet/data/staking/entities/PoolEntity.kt @@ -35,7 +35,7 @@ data class PoolEntity( name = info.name, implementation = StakingPool.implementation(info.implementation), minStake = Coins.of(info.minStake), - apy = info.apy, + apy = BigDecimal(info.apy), verified = info.verified, cycleStart = info.cycleStart, cycleEnd = info.cycleEnd, diff --git a/apps/wallet/instance/app/build.gradle.kts b/apps/wallet/instance/app/build.gradle.kts index d422fcd35..db7ffd011 100644 --- a/apps/wallet/instance/app/build.gradle.kts +++ b/apps/wallet/instance/app/build.gradle.kts @@ -91,9 +91,6 @@ dependencies { implementation(Dependence.UI.material) implementation(Dependence.UI.flexbox) - implementation(Dependence.Squareup.moshi) - implementation(Dependence.Squareup.moshiAdapters) - implementation(platform(Dependence.Firebase.bom)) implementation(Dependence.Firebase.analytics) implementation(Dependence.Firebase.config) diff --git a/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/core/history/HistoryHelper.kt b/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/core/history/HistoryHelper.kt index 1a9f41f78..c45d07b8c 100644 --- a/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/core/history/HistoryHelper.kt +++ b/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/core/history/HistoryHelper.kt @@ -21,7 +21,6 @@ import com.tonapps.tonkeeper.core.history.list.item.HistoryItem import com.tonapps.tonkeeper.core.history.list.item.HistoryItem.Event.Comment.Type import io.tonapi.models.AccountAddress import io.tonapi.models.AccountEvent -import io.tonapi.models.Action import io.tonapi.models.ActionSimplePreview import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext @@ -42,12 +41,12 @@ import com.tonapps.wallet.data.collectibles.CollectiblesRepository import com.tonapps.wallet.data.core.currency.WalletCurrency import com.tonapps.wallet.data.events.CommentEncryption import com.tonapps.wallet.data.events.EventsRepository -import com.tonapps.wallet.data.events.TxActionType import com.tonapps.wallet.data.passcode.PasscodeManager import com.tonapps.wallet.data.rates.RatesRepository import com.tonapps.wallet.data.settings.SettingsRepository import com.tonapps.wallet.localization.Localization import com.tonapps.wallet.localization.Plurals +import io.tonapi.models.Action import io.tonapi.models.JettonVerificationType import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.flowOn @@ -1008,7 +1007,7 @@ class HistoryHelper( wallet = wallet, actionOutStatus = ActionOutStatus.Send ) - } else if (action.type == TxActionType.Unknown) { + } else if (action.type == Action.Type.Unknown) { return createUnknown( index, txId, diff --git a/build/reports/problems/problems-report.html b/build/reports/problems/problems-report.html index 8e699aca4..96f4a302d 100644 --- a/build/reports/problems/problems-report.html +++ b/build/reports/problems/problems-report.html @@ -650,7 +650,7 @@ diff --git a/buildSrc/src/main/kotlin/Dependence.kt b/buildSrc/src/main/kotlin/Dependence.kt index afd55ea10..78ffddb94 100644 --- a/buildSrc/src/main/kotlin/Dependence.kt +++ b/buildSrc/src/main/kotlin/Dependence.kt @@ -107,8 +107,6 @@ object Dependence { object Squareup { const val okhttp = "com.squareup.okhttp3:okhttp:4.12.0" const val sse = "com.squareup.okhttp3:okhttp-sse:4.12.0" - const val moshi = "com.squareup.moshi:moshi-kotlin:1.15.0" - const val moshiAdapters = "com.squareup.moshi:moshi-adapters:1.15.0" const val okio = "com.squareup.okio:okio:3.9.0" } diff --git a/lib/extensions/src/main/java/com/tonapps/extensions/JSON.kt b/lib/extensions/src/main/java/com/tonapps/extensions/JSON.kt deleted file mode 100644 index 1bc145704..000000000 --- a/lib/extensions/src/main/java/com/tonapps/extensions/JSON.kt +++ /dev/null @@ -1,7 +0,0 @@ -package com.tonapps.extensions - -import kotlinx.serialization.json.Json - -val JSON = Json { - ignoreUnknownKeys = true -} \ No newline at end of file diff --git a/tonapi/battery-api.yml b/tonapi/battery-api.yml new file mode 100644 index 000000000..dfc3c80d8 --- /dev/null +++ b/tonapi/battery-api.yml @@ -0,0 +1,1692 @@ +openapi: 3.0.2 +info: + title: Custodial-Battery REST API. + version: 0.0.1 + description: REST API for Custodial Battery which provides gas to different networks to help execute transactions. + contact: + name: Support + email: support@tonkeeper.com +servers: + - url: "https://battery.tonkeeper.com" + - url: "https://testnet-battery.tonkeeper.com" +paths: + /tonconnect/payload: + get: + description: Get a payload for further token receipt + operationId: getTonConnectPayload + tags: + - Connect + responses: + '200': + description: payload + content: + application/json: + schema: + type: object + required: + - payload + properties: + payload: + type: string + example: "84jHVNLQmZsAAAAAZB0Zryi2wqVJI-KaKNXOvCijEi46YyYzkaSHyJrMPBMOkVZa" + 'default': + $ref: '#/components/responses/Error' + /tonconnect/proof: + post: + description: Account verification and token issuance + operationId: tonConnectProof + tags: + - Wallet + requestBody: + $ref: "#/components/requestBodies/TonConnectProof" + responses: + '200': + description: auth token + content: + application/json: + schema: + type: object + required: + - token + properties: + token: + type: string + example: "NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2ODQ3..." + 'default': + $ref: '#/components/responses/Error' + /status: + get: + description: This method returns information about the current status of Battery Service. + operationId: getStatus + parameters: + - $ref: '#/components/parameters/token' + responses: + '200': + description: TBD + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + 'default': + $ref: '#/components/responses/Error' + /config: + get: + description: This method returns information about Battery Service. + operationId: getConfig + responses: + '200': + description: TBD + content: + application/json: + schema: + $ref: '#/components/schemas/Config' + 'default': + $ref: '#/components/responses/Error' + /promo-used: + get: + operationId: getPromoUsed + parameters: + - name: promo + in: query + required: true + schema: + type: string + responses: + '200': + description: TBD + content: + application/json: + schema: + $ref: '#/components/schemas/PromoUsed' + 'default': + $ref: '#/components/responses/Error' + /battery-charged: + get: + description: This method returns information about a user's balance. + operationId: getBatteryCharged + parameters: + - name: account_id + in: query + required: true + schema: + type: string + responses: + '200': + description: TBD + content: + application/json: + schema: + $ref: '#/components/schemas/BatteryCharged' + 'default': + $ref: '#/components/responses/Error' + /balance: + get: + description: This method returns information about a user's balance. + operationId: getBalance + parameters: + - $ref: '#/components/parameters/token' + - $ref: '#/components/parameters/balanceUnits' + - $ref: '#/components/parameters/region' + responses: + '200': + description: TBD + content: + application/json: + schema: + $ref: '#/components/schemas/Balance' + 'default': + $ref: '#/components/responses/Error' + /wallet/emulate: + post: + description: Emulate sending message to blockchain + operationId: emulateMessageToWallet + tags: + - Emulation + parameters: + - $ref: '#/components/parameters/i18n' + - $ref: '#/components/parameters/token' + - name: enable_validation + in: query + schema: + type: boolean + default: false + required: false + requestBody: + $ref: "#/components/requestBodies/Boc" + responses: + '200': + description: emulated message + headers: + Allowed-By-Battery: + required: true + schema: + type: boolean + example: "true" + Supported-By-Battery: + required: true + schema: + type: boolean + example: "true" + Reject-Reason: + schema: + type: string + example: "message is too large" + X-Battery-Protocol-Name: + schema: + type: string + content: + application/json: + schema: + additionalProperties: true + example: { } + 'default': + $ref: '#/components/responses/Error' + /message: + post: + description: Send message to blockchain + operationId: sendMessage + parameters: + - $ref: '#/components/parameters/token' + requestBody: + $ref: "#/components/requestBodies/Boc" + responses: + '200': + description: "success" + headers: + X-Battery-Protocol-Name: + schema: + type: string + 'default': + $ref: '#/components/responses/Error' + /v0/tron/config: + get: + operationId: getTronConfig + responses: + '200': + description: TBD + content: + application/json: + schema: + type: object + required: + - safety_margin_percent + properties: + safety_margin_percent: + type: string + example: "1.5" + 'default': + $ref: '#/components/responses/Error' + /v0/tron/estimate: + get: + description: Estimate cost of sending a tx in Tron network + operationId: tronEstimate + parameters: + - name: energy + in: query + required: false + schema: + type: integer + maximum: 1000000 + minimum: 0 + - name: bandwidth + in: query + required: false + schema: + type: integer + maximum: 2000 + minimum: 0 + - name: wallet + in: query + required: true + schema: + type: string + responses: + '200': + description: TBD + content: + application/json: + schema: + $ref: '#/components/schemas/EstimatedTronTx' + 'default': + $ref: '#/components/responses/Error' + /v0/tron/send: + post: + description: send TRON tx + operationId: tronSend + parameters: + - $ref: '#/components/parameters/token' + requestBody: + $ref: "#/components/requestBodies/TronTx" + responses: + '200': + description: TBD + content: + application/json: + schema: + $ref: '#/components/schemas/SentTronTx' + 'default': + $ref: '#/components/responses/Error' + /v0/tron/transactions: + get: + operationId: getTronTransactions + parameters: + - $ref: '#/components/parameters/token' + - $ref: '#/components/parameters/limitQuery' + - $ref: '#/components/parameters/maxTimestamp' + responses: + '200': + description: TBD + content: + application/json: + schema: + $ref: '#/components/schemas/TronTransactionsList' + 'default': + $ref: '#/components/responses/Error' + /v0/tron/itrx-io-callback: + post: + description: receive callback from itrx.io + operationId: itrxIoCallback + requestBody: + required: true + content: + application/json: + schema: + type: object + additionalProperties: true + responses: + '200': + description: TBD + content: + application/json: + schema: + additionalProperties: true + example: { } + 'default': + $ref: '#/components/responses/Error' + /purchase-battery/android: + post: + description: verify an in-app purchase + operationId: androidBatteryPurchase + parameters: + - $ref: '#/components/parameters/token' + requestBody: + $ref: "#/components/requestBodies/AndroidBatteryPurchase" + responses: + '200': + description: TBD + content: + application/json: + schema: + $ref: '#/components/schemas/AndroidBatteryPurchaseStatus' + 'default': + $ref: '#/components/responses/Error' + /purchase-battery/ios/app-store-notification: + post: + operationId: appStoreNotification + requestBody: + $ref: "#/components/requestBodies/appStoreNotification" + responses: + '200': + description: TBD + content: + application/json: + schema: + $ref: '#/components/schemas/appStoreResponse' + 'default': + $ref: '#/components/responses/Error' + /purchase-battery/ios: + post: + description: verify an in-app purchase + operationId: iosBatteryPurchase + parameters: + - $ref: '#/components/parameters/token' + requestBody: + $ref: "#/components/requestBodies/iOSBatteryPurchase" + responses: + '200': + description: TBD + content: + application/json: + schema: + $ref: '#/components/schemas/iOSBatteryPurchaseStatus' + 'default': + $ref: '#/components/responses/Error' + /purchase-battery/promo-code: + post: + description: charge battery with promo code + operationId: promoCodeBatteryPurchase + parameters: + - $ref: '#/components/parameters/i18n' + - $ref: '#/components/parameters/token' + requestBody: + $ref: "#/components/requestBodies/promoCodeBatteryPurchase" + responses: + '200': + description: TBD + content: + application/json: + schema: + $ref: '#/components/schemas/promoCodeBatteryPurchaseStatus' + 'default': + $ref: '#/components/responses/Error' + /purchase-battery/verify-purchase-promo: + get: + operationId: verifyPurchasePromo + parameters: + - name: promo + in: query + schema: + type: string + maxLength: 100 + responses: + '200': + description: "all good" + content: + application/json: + schema: + type: object + required: + - bonus_charges + properties: + bonus_charges: + type: string + example: "10.250" + 'default': + $ref: '#/components/responses/Error' + /recharge-methods: + get: + description: This method returns on-chain recharge methods. + operationId: getRechargeMethods + parameters: + - name: include_recharge_only + in: query + schema: + type: boolean + default: true + responses: + '200': + description: TBD + content: + application/json: + schema: + $ref: '#/components/schemas/RechargeMethods' + 'default': + $ref: '#/components/responses/Error' + /request-refund: + post: + operationId: requestRefund + parameters: + - $ref: '#/components/parameters/token' + requestBody: + $ref: "#/components/requestBodies/requestRefund" + responses: + '200': + description: success + 'default': + $ref: '#/components/responses/Error' + /purchases: + get: + description: This method returns a list of purchases made by a specific user. + operationId: getPurchases + parameters: + - $ref: '#/components/parameters/token' + - $ref: '#/components/parameters/limitQuery' + - $ref: '#/components/parameters/offsetQuery' + - name: include_gifts_on_the_way + in: query + schema: + type: boolean + default: false + responses: + '200': + description: TBD + content: + application/json: + schema: + $ref: '#/components/schemas/Purchases' + 'default': + $ref: '#/components/responses/Error' + /transactions: + get: + description: This method returns a list of transactions made by a specific user. + operationId: getTransactions + parameters: + - $ref: '#/components/parameters/token' + - $ref: '#/components/parameters/limitQuery' + - $ref: '#/components/parameters/offsetQuery' + responses: + '200': + description: TBD + content: + application/json: + schema: + $ref: '#/components/schemas/Transactions' + 'default': + $ref: '#/components/responses/Error' + /gasless/estimate-cost/{jetton_master}: + post: + operationId: estimateGaslessCost + parameters: + - $ref: '#/components/parameters/jettonMasterParameter' + - $ref: '#/components/parameters/optionalToken' + - name: wallet_address + in: query + schema: + type: string + required: false + - name: wallet_public_key + in: query + schema: + type: string + required: false + - name: enable_validation + in: query + schema: + type: boolean + default: false + required: false + requestBody: + $ref: "#/components/requestBodies/gaslessEstimateCost" + responses: + '200': + description: TBD + content: + application/json: + schema: + $ref: '#/components/schemas/GaslessEstimation' + 'default': + $ref: '#/components/responses/Error' + /restricted/promo-campaign: + post: + operationId: createPromoCampaign + parameters: + - $ref: '#/components/parameters/adminToken' + requestBody: + required: true + content: + application/json: + schema: + type: object + required: + - participants + - name + properties: + name: + type: string + participants: + type: array + items: + type: object + required: + - address + - amount + properties: + address: + type: string + amount: + type: string + description: amount in TON + responses: + '200': + description: success + content: + application/json: + schema: + type: object + required: + - participants + properties: + participants: + type: array + items: + type: object + required: + - address + properties: + address: + type: string + balance_increased: + type: string + error: + type: string + 'default': + $ref: '#/components/responses/Error' + /restricted/apply-promo: + post: + operationId: applyPromo + parameters: + - $ref: '#/components/parameters/adminToken' + requestBody: + required: true + content: + application/json: + schema: + type: object + required: + - promo_code + - public_key + properties: + public_key: + type: string + promo_code: + type: string + example: "1234567890" + responses: + '200': + description: TBD + content: + application/json: + schema: + $ref: '#/components/schemas/promoCodeBatteryPurchaseStatus' + 'default': + $ref: '#/components/responses/Error' + /restricted/create-custom-refund: + post: + operationId: createCustomRefund + parameters: + - $ref: '#/components/parameters/adminToken' + requestBody: + $ref: "#/components/requestBodies/customRefund" + responses: + '200': + description: "all good" + content: + application/json: + schema: + additionalProperties: true + example: { } + 'default': + $ref: '#/components/responses/Error' + /restricted/users/{user_id}/reset-balance: + post: + operationId: resetUserBalance + parameters: + - $ref: '#/components/parameters/adminToken' + - name: user_id + in: path + schema: + type: integer + format: int64 + required: true + requestBody: + $ref: "#/components/requestBodies/resetUserBalance" + responses: + '200': + description: "all good" + content: + application/json: + schema: + additionalProperties: true + example: { } + 'default': + $ref: '#/components/responses/Error' + /restricted/purchases/{purchase_id}/extend-refund-period: + post: + operationId: extendRefundPeriod + parameters: + - $ref: '#/components/parameters/adminToken' + - name: purchase_id + in: path + schema: + type: integer + format: int64 + required: true + responses: + '200': + description: "all good" + content: + application/json: + schema: + additionalProperties: true + example: { } + 'default': + $ref: '#/components/responses/Error' + /restricted/users/{user_id}/increase-balance: + post: + operationId: increaseUserBalance + parameters: + - $ref: '#/components/parameters/adminToken' + - name: user_id + in: path + schema: + type: integer + format: int64 + required: true + requestBody: + required: true + content: + application/json: + schema: + type: object + required: + - amount + properties: + amount: + type: string + description: amount in TON to increase balance by + reason: + type: string + description: reason for balance increase + responses: + '200': + description: "all good" + content: + application/json: + schema: + additionalProperties: true + example: { } + 'default': + $ref: '#/components/responses/Error' + /jetton-metadata/{name}.json: + get: + operationId: getJettonMetadata + tags: + - Emulation + parameters: + - name: name + in: path + schema: + type: string + required: true + responses: + '200': + description: "" + content: + application/json: + schema: + additionalProperties: true + example: { } + 'default': + $ref: '#/components/responses/Error' + /enterprise/wallets/{wallet_id}/config: + get: + operationId: enterpriseGetWalletConfig + parameters: + - $ref: '#/components/parameters/enterpriseAccessToken' + - name: wallet_id + in: path + schema: + type: string + required: true + responses: + '200': + description: TBD + content: + application/json: + schema: + $ref: '#/components/schemas/EnterpriseWalletConfig' + 'default': + $ref: '#/components/responses/Error' + /enterprise/wallets/{wallet_id}/estimate: + post: + operationId: enterpriseEstimate + parameters: + - $ref: '#/components/parameters/enterpriseAccessToken' + - $ref: '#/components/parameters/i18n' + - name: wallet_id + in: path + schema: + type: string + required: true + - name: emulate + in: query + schema: + type: boolean + default: false + requestBody: + $ref: "#/components/requestBodies/EnterpriseSendingBoc" + responses: + '200': + description: TBD + content: + application/json: + schema: + type: object + required: + - estimated_upfront_payment + properties: + estimated_upfront_payment: + type: string + emulation: + type: string + description: base64 encoded emulation results. The exact type can be taken from /v2/wallet/emulate (TONAPI). + 'default': + $ref: '#/components/responses/Error' + /enterprise/wallets/{wallet_id}/send: + post: + operationId: enterpriseSend + parameters: + - $ref: '#/components/parameters/enterpriseAccessToken' + - name: wallet_id + in: path + schema: + type: string + required: true + requestBody: + $ref: "#/components/requestBodies/EnterpriseSendingBoc" + responses: + '200': + description: "success" + content: + application/json: + schema: + type: object + required: + - msg_id + properties: + msg_id: + type: string + 'default': + $ref: '#/components/responses/Error' + /enterprise/messages/{msg_id}: + get: + operationId: enterpriseGetMessage + parameters: + - $ref: '#/components/parameters/enterpriseAccessToken' + - name: msg_id + in: path + schema: + type: string + required: true + responses: + '200': + description: "success" + content: + application/json: + schema: + type: object + required: + - status + properties: + payment_tx_hash: + type: string + committed_tx_hash: + type: string + status: + type: string + enum: + - pending + - completed + - failed + final_cost: + type: string + failed_reason: + type: string + 'default': + $ref: '#/components/responses/Error' + /enterprise/status: + get: + operationId: enterpriseGetStatus + parameters: + - $ref: '#/components/parameters/enterpriseAccessToken' + responses: + '200': + description: "success" + content: + application/json: + schema: + type: object + required: + - balance + - wallet + properties: + balance: + type: string + wallet: + type: string + 'default': + $ref: '#/components/responses/Error' +components: + parameters: + enterpriseAccessToken: + in: header + name: X-Enterprise-Auth + schema: + type: string + example: NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2ODQ3... + required: true + token: + in: header + name: X-TonConnect-Auth + schema: + type: string + example: NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2ODQ3... + required: true + optionalToken: + in: header + name: X-TonConnect-Auth + schema: + type: string + example: NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2ODQ3... + required: false + adminToken: + in: query + name: token + schema: + type: string + required: true + jettonMasterParameter: + in: path + name: jetton_master + required: true + schema: + type: string + purchaseId: + in: query + name: id + required: true + schema: + type: integer + limitQuery: + in: query + name: limit + required: false + schema: + type: integer + default: 1000 + maximum: 1000 + offsetQuery: + in: query + name: offset + required: false + schema: + type: integer + default: 0 + maxTimestamp: + in: query + name: max_timestamp + required: false + schema: + type: integer + format: int64 + i18n: + in: header + name: Accept-Language + required: false + schema: + type: string + example: "ru-RU,ru;q=0.5" + default: "en" + balanceUnits: + in: query + name: units + schema: + type: string + default: "usd" + enum: + - usd + - ton + region: + in: query + name: region + required: false + schema: + type: string + description: "User's region for analytics purposes" + requestBodies: + TonConnectProof: + description: "Data that is expected from TON Connect" + required: true + content: + application/json: + schema: + type: object + required: + - address + - proof + properties: + address: + type: string + example: "0:97146a46acc2654y27947f14c4a4b14273e954f78bc017790b41208b0043200b" + proof: + type: object + required: + - timestamp + - domain + - signature + - payload + properties: + timestamp: + type: integer + format: int64 + example: "1678275313" + domain: + type: object + required: + - value + properties: + length_bytes: + type: integer + format: int32 + value: + type: string + signature: + type: string + payload: + type: string + example: "84jHVNLQmZsAAAAAZB0Zryi2wqVJI-KaKNXOvCijEi46YyYzkaSHyJrMPBMOkVZa" + state_init: + type: string + EnterpriseSendingBoc: + description: bag-of-cells serialized to base64 + required: true + content: + application/json: + schema: + type: object + required: + - boc + - wallet_public_key + properties: + boc: + type: string + example: te6ccgECBQEAARUAAkWIAWTtae+KgtbrX26Bep8JSq8lFLfGOoyGR/xwdjfvpvEaHg + wallet_public_key: + type: string + + TronTx: + required: true + content: + application/json: + schema: + type: object + required: + - wallet + properties: + tx: + type: string + energy: + type: integer + bandwidth: + type: integer + wallet: + type: string + instant_fee_tx: + type: string + description: "base64 encoded payment transaction in the TON network" + Boc: + description: bag-of-cells serialized to base64 + required: true + content: + application/json: + schema: + type: object + required: + - boc + properties: + boc: + type: string + example: te6ccgECBQEAARUAAkWIAWTtae+KgtbrX26Bep8JSq8lFLfGOoyGR/xwdjfvpvEaHg + + AndroidBatteryPurchase: + description: In-App purchase + required: true + content: + application/json: + schema: + type: object + required: + - purchases + properties: + purchases: + type: array + items: + type: object + required: + - token + - product_id + properties: + token: + type: string + example: 0:2cf3b5b8c891e517c9addbda1c0386a09ccacbb0e3faf630b51cfc8152325acb + product_id: + type: string + example: 0:2cf3b5b8c891e517c9addbda1c0386a09ccacbb0e3faf630b51cfc8152325acb + promo: + type: string + example: "HAMSTER" + + appStoreNotification: + required: true + content: + application/json: + schema: + type: object + required: + - signedPayload + properties: + signedPayload: + type: string + iOSBatteryPurchase: + description: In-App purchase + required: true + content: + application/json: + schema: + type: object + required: + - transactions + properties: + transactions: + type: array + items: + type: object + required: + - id + properties: + id: + type: string + promo: + type: string + example: "HAMSTER" + gaslessEstimateCost: + required: true + content: + application/json: + schema: + type: object + required: + - payload + properties: + battery: + type: boolean + default: true + payload: + type: string + + resetUserBalance: + required: true + content: + application/json: + schema: + type: object + required: + - reason + properties: + reason: + type: string + customRefund: + required: true + content: + application/json: + schema: + type: object + required: + - amount + - currency + - comment + - reason + - destination + properties: + relayer_event_id: + type: integer + amount: + type: string + example: "10.250" + currency: + type: string + comment: + type: string + reason: + type: string + destination: + type: string + + requestRefund: + required: true + content: + application/json: + schema: + type: object + properties: + user_purchase_id: + type: integer + deprecated: true + example: 43 + purchase_id: + type: integer + example: 43 + promoCodeBatteryPurchase: + description: charge battery with promo code + required: true + content: + application/json: + schema: + type: object + required: + - promo_code + properties: + promo_code: + type: string + example: "1234567890" + schemas: + Error: + type: object + required: + - error + properties: + error: + type: string + example: error description + Status: + type: object + required: + - pending_transactions + properties: + pending_transactions: + type: array + items: + type: object + required: + - id + properties: + id: + type: string + EnterpriseWalletConfig: + type: object + required: + - excess_account + properties: + excess_account: + type: string + description: when building a message to transfer an NFT or Jetton, use this address to send excess funds back to Battery Service. + example: 0:da6b1b6663a0e4d18cc8574ccd9db5296e367dd9324706f3bbd9eb1cd2caf0bf + + RelayerSendingEstimation: + type: object + required: + - commission + properties: + commission: + type: string + Config: + type: object + required: + - excess_account + - fund_receiver + - message_ttl + - charge_cost + - gas_proxy + - mean_prices + properties: + charge_cost: + description: "cost of 1 charge in TON" + type: string + example: "0.0026" + fund_receiver: + type: string + description: "with zero balance it is possible to transfer some jettons (stablecoins, jusdt, etc) to this address to refill the balance. Such transfers would be paid by Battery Service." + example: 0:07331e629e39d006d86a8cc7659c10a97c671f7535dc8b7f251a1a944dda348e + excess_account: + type: string + description: when building a message to transfer an NFT or Jetton, use this address to send excess funds back to Battery Service. + example: 0:da6b1b6663a0e4d18cc8574ccd9db5296e367dd9324706f3bbd9eb1cd2caf0bf + message_ttl: + type: integer + description: "ttl for message in seconds" + example: 300 + gas_proxy: + type: array + items: + type: object + required: + - address + properties: + address: + type: string + mean_prices: + type: object + required: + - battery_mean_price_swap + - battery_mean_price_jetton + - battery_mean_price_nft + properties: + battery_mean_price_swap: + type: integer + battery_mean_price_jetton: + type: integer + battery_mean_price_nft: + type: integer + battery_mean_price_tron_usdt: + type: integer + GaslessEstimation: + type: object + required: + - commission + properties: + commission: + type: string + PromoUsed: + type: object + required: + - promo_used + - bonus_charges + properties: + promo_used: + type: boolean + bonus_charges: + type: string + example: "10.250" + BatteryCharged: + type: object + required: + - battery_charged + properties: + battery_charged: + type: boolean + Balance: + type: object + required: + - balance + - units + - reserved + properties: + balance: + type: string + example: "10.250" + reserved: + type: string + example: "0.3" + description: "reserved amount in units (TON/USD)" + units: + type: string + example: "usd" + enum: + - usd + - ton + RechargeMethods: + type: object + required: + - methods + properties: + methods: + type: array + items: + type: object + required: + - type + - symbol + - decimals + - rate + - support_gasless + - support_recharge + properties: + image: + type: string + example: "https://example.com/image.png" + jetton_master: + type: string + min_bootstrap_value: + type: string + example: "10.0" + type: + type: string + enum: + - jetton + - ton + rate: + type: string + example: "10.250" + symbol: + type: string + example: "usdt" + decimals: + type: integer + example: 6 + support_gasless: + type: boolean + example: true + support_recharge: + type: boolean + example: true + Purchases: + type: object + required: + - purchases + - total_purchases + properties: + total_purchases: + type: integer + example: 1 + purchases: + type: array + items: + type: object + required: + - user_purchase_id + - purchase_id + - type + - charges + - datetime + properties: + promo: + type: string + for_account_id: + type: string + user_purchase_id: + type: integer + deprecated: true + example: 2 + purchase_id: + type: integer + example: 2 + type: + type: string + example: "android" + enum: + - android + - ios + - promo-code + - crypto + - gift + - on-the-way-gift + amount: + description: "Amount describes the amount paid by the user for this purchase when we know it. For crypto purchases it is always set." + type: string + example: "10.250" + charges: + type: integer + example: 1200 + currency: + description: "Currency is set when we know it. For crypto purchases it is always set." + type: string + example: "USDT" + datetime: + type: string + example: "2006-01-02T15:04:05Z07:00" + refund_information: + type: object + required: + - pending_refund + - fully_refunded + - partially_refunded + properties: + fully_refunded: + type: boolean + partially_refunded: + type: boolean + pending_refund: + type: boolean + refunded: + type: object + required: + - amount + - charges + properties: + amount: + type: string + example: "10.250" + charges: + type: integer + example: 1200 + refundable: + type: object + required: + - amount + - charges + properties: + amount: + type: string + example: "10.250" + charges: + type: integer + example: 1200 + EstimatedTronTx: + type: object + required: + - energy_charges + - bandwidth_charges + - activation_charges + - total_charges + - instant_fee + properties: + energy_charges: + type: integer + bandwidth_charges: + type: integer + activation_charges: + type: integer + total_charges: + type: integer + instant_fee: + type: object + required: + - fee_address + - accepted_assets + properties: + fee_address: + type: string + accepted_assets: + type: array + items: + type: object + required: + - type + - amount_nano + - name + - decimals + properties: + type: + type: string + enum: + - jetton + - ton + name: + type: string + jetton_master_id: + type: string + amount_nano: + type: string + example: "10.250" + decimals: + type: integer + SentTronTx: + type: object + required: + - status + properties: + status: + type: string + TronTransactionsList: + type: object + required: + - transactions + properties: + transactions: + type: array + items: + type: object + required: + - txid + - timestamp + - from_account + - to_account + - amount + - is_pending + - is_failed + - battery_charges + properties: + txid: + type: string + from_account: + type: string + to_account: + type: string + amount: + type: string + is_pending: + type: boolean + is_failed: + type: boolean + battery_charges: + type: integer + timestamp: + type: integer + format: int64 + trongrid_result: + type: integer + AndroidBatteryPurchaseStatus: + type: object + required: + - purchases + properties: + purchases: + type: array + items: + type: object + required: + - product_id + - token + - success + properties: + product_id: + type: string + example: "1000000790000000" + token: + type: string + example: "1000000790000000" + success: + type: boolean + example: true + error: + type: object + required: + - msg + - code + properties: + msg: + type: string + example: "Temporary error. Try again later." + code: + type: string + example: "invalid-product-id" + enum: + - invalid-product-id + - user-not-found + - purchase-is-already-used + - temporary-error + - unknown + + appStoreResponse: + type: object + iOSBatteryPurchaseStatus: + type: object + required: + - transactions + properties: + transactions: + type: array + items: + type: object + required: + - transaction_id + - success + properties: + transaction_id: + type: string + example: "1000000790000000" + success: + type: boolean + example: true + error: + type: object + required: + - msg + - code + properties: + msg: + type: string + example: "Temporary error. Try again later." + code: + type: string + example: "invalid-bundle-id" + enum: + - invalid-bundle-id + - invalid-product-id + - user-not-found + - purchase-is-already-used + - temporary-error + - unknown + promoCodeBatteryPurchaseStatus: + type: object + required: + - success + - balance_change + properties: + balance_change: + type: string + example: "10.250" + success: + type: boolean + example: true + error: + type: object + required: + - msg + - code + properties: + msg: + type: string + example: "Temporary error. Try again later." + code: + type: string + example: "promo-code-not-found" + enum: + - promo-code-not-found + - promo-exceeded-attempts + - temporary-error + Transactions: + type: object + required: + - transactions + - total_transactions + properties: + total_transactions: + type: integer + example: 1 + next_offset: + type: integer + description: if set, then there are more transactions to be loaded. Use this value as offset parameter in the next request. + example: 10 + transactions: + type: array + items: + type: object + required: + - id + - paid_amount + - status + - created_at + properties: + id: + type: string + paid_amount: + type: string + description: represents the amount of money paid by the user for this transaction. + example: "10.250" + status: + type: string + example: "10.250" + enum: + - pending + - completed + - failed + created_at: + type: string + example: "2006-01-02T15:04:05Z07:00" + responses: + Error: + description: Some error during request processing + content: + application/json: + schema: + type: object + required: + - error + properties: + error: + type: string + error-key: + type: string + error-details: + type: string \ No newline at end of file diff --git a/tonapi/battery.sh b/tonapi/battery.sh new file mode 100644 index 000000000..1de8bc9b3 --- /dev/null +++ b/tonapi/battery.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +bash generate.sh "battery-api.yml" "batteryapi" \ No newline at end of file diff --git a/tonapi/build.gradle.kts b/tonapi/build.gradle.kts index 7254c1b9b..f9113ef9a 100644 --- a/tonapi/build.gradle.kts +++ b/tonapi/build.gradle.kts @@ -1,6 +1,7 @@ plugins { id("com.android.library") id("org.jetbrains.kotlin.android") + kotlin("plugin.serialization") } android { @@ -21,7 +22,7 @@ android { } dependencies { - implementation(Dependence.Squareup.moshi) - implementation(Dependence.Squareup.moshiAdapters) implementation(Dependence.Squareup.okhttp) + implementation(Dependence.KotlinX.serialization) + implementation(Dependence.KotlinX.serializationJSON) } \ No newline at end of file diff --git a/tonapi/generate.sh b/tonapi/generate.sh new file mode 100644 index 000000000..531c44d6b --- /dev/null +++ b/tonapi/generate.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +OPENAPI_URL="$1" +PACKAGE_NAME="io.$2" +TARGET_SRC_DIR='src/main/kotlin' +TEMP_DIR='temp_api_gen' +TEMPLATE_DIR='./templates' + +rm -rf "$TEMP_DIR" +mkdir -p "$TEMP_DIR" + +openapi-generator generate \ + -i "$OPENAPI_URL" \ + -g kotlin \ + -o "$TEMP_DIR" \ + -t "$TEMPLATE_DIR" \ + --library jvm-okhttp4 \ + --global-property apiTests=false,modelTests=false \ + --type-mappings "number=kotlin.String" \ + --additional-properties "serializationLibrary=kotlinx_serialization,packageName=$PACKAGE_NAME,platform=android,hideGenerationTimestamp=true" + +if [ $? -ne 0 ]; then + echo "Failed to generate API client." + rm -rf "$TEMP_DIR" + exit 1 +fi + +find "$TEMP_DIR" -type f -name "*.kt" -print0 | xargs -0 sed -i '' 's/kotlin.collections.Map/kotlin.collections.Map/g' + +GENERATED_SRC_PATH="$TEMP_DIR/src/main/kotlin/" +if [ ! -d "$GENERATED_SRC_PATH" ]; then + echo "Failed to find generated source directory: $GENERATED_SRC_PATH" + rm -rf "$TEMP_DIR" + exit 1 +fi +mkdir -p "$TARGET_SRC_DIR" +cp -r "$GENERATED_SRC_PATH"* "$TARGET_SRC_DIR/" +if [ $? -ne 0 ]; then + echo "Failed to copy generated sources to target directory: $TARGET_SRC_DIR" + rm -rf "$TEMP_DIR" + exit 1 +fi + +INFRA_DIR="$TARGET_SRC_DIR/io/$2/infrastructure" +if [ -d "$INFRA_DIR" ]; then + rm -rf "$INFRA_DIR" +else + echo "Failed to find infrastructure directory: $INFRA_DIR" +fi + +rm -rf "$TEMP_DIR" + +echo "Done" + diff --git a/tonapi/proguard-rules.pro b/tonapi/proguard-rules.pro new file mode 100644 index 000000000..7d677c8e1 --- /dev/null +++ b/tonapi/proguard-rules.pro @@ -0,0 +1,11 @@ +-keepattributes *Annotation*, InnerClasses +-dontnote kotlinx.serialization.AnnotationsKt # core serialization annotations + +# kotlinx-serialization-json specific. Add this if you have java.lang.NoClassDefFoundError kotlinx.serialization.json.JsonObjectSerializer +-keepclassmembers class kotlinx.serialization.json.** { *** Companion; } +-keepclasseswithmembers class kotlinx.serialization.json.** { kotlinx.serialization.KSerializer serializer(...); } + +# project specific. +-keep,includedescriptorclasses class io.tonapi.models.**$$serializer { *; } +-keepclassmembers class io.tonapi.models.** { *** Companion; } +-keepclasseswithmembers class io.tonapi.models.** { kotlinx.serialization.KSerializer serializer(...); } diff --git a/tonapi/src/main/kotlin/io/JsonAny.kt b/tonapi/src/main/kotlin/io/JsonAny.kt new file mode 100644 index 000000000..f0570d8b7 --- /dev/null +++ b/tonapi/src/main/kotlin/io/JsonAny.kt @@ -0,0 +1,73 @@ +package io + +import kotlinx.serialization.KSerializer +import kotlinx.serialization.Serializable +import kotlinx.serialization.descriptors.SerialDescriptor +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder +import kotlinx.serialization.json.JsonArray +import kotlinx.serialization.json.JsonDecoder +import kotlinx.serialization.json.JsonElement +import kotlinx.serialization.json.JsonEncoder +import kotlinx.serialization.json.JsonNull +import kotlinx.serialization.json.JsonObject +import kotlinx.serialization.json.JsonPrimitive +import kotlinx.serialization.json.booleanOrNull +import kotlinx.serialization.json.doubleOrNull +import kotlinx.serialization.json.longOrNull + +@Serializable(with = JsonAnySerializer::class) +sealed class JsonAny { + data class Object(val value: Map) : JsonAny() + data class Array(val value: List) : JsonAny() + data class Primitive(val value: Any?) : JsonAny() + + fun asObject(): Map? = (this as? Object)?.value + fun asArray(): List? = (this as? Array)?.value + fun asPrimitive(): Any? = (this as? Primitive)?.value + + fun asString(): String? = asPrimitive()?.toString() + fun asLong(): Long? = (asPrimitive() as? Number)?.toLong() + fun asDouble(): Double? = (asPrimitive() as? Number)?.toDouble() + fun asBoolean(): Boolean? = asPrimitive() as? Boolean +} + +object JsonAnySerializer : KSerializer { + override val descriptor: SerialDescriptor = JsonElement.serializer().descriptor + + override fun serialize(encoder: Encoder, value: JsonAny) { + val jsonEncoder = encoder as? JsonEncoder ?: return + val jsonElement = serializeJsonAny(value) + jsonEncoder.encodeJsonElement(jsonElement) + } + + private fun serializeJsonAny(value: JsonAny): JsonElement = when (value) { + is JsonAny.Object -> JsonObject(value.value.mapValues { serializeJsonAny(it.value) }) + is JsonAny.Array -> JsonArray(value.value.map { serializeJsonAny(it) }) + is JsonAny.Primitive -> when (val primitive = value.value) { + is String -> JsonPrimitive(primitive) + is Number -> JsonPrimitive(primitive) + is Boolean -> JsonPrimitive(primitive) + else -> JsonNull + } + } + + override fun deserialize(decoder: Decoder): JsonAny { + val jsonDecoder = decoder as? JsonDecoder ?: return JsonAny.Primitive(null) + val jsonElement = jsonDecoder.decodeJsonElement() + return deserializeJsonElement(jsonElement) + } + + private fun deserializeJsonElement(element: JsonElement): JsonAny = when (element) { + is JsonObject -> JsonAny.Object(element.mapValues { deserializeJsonElement(it.value) }) + is JsonArray -> JsonAny.Array(element.map { deserializeJsonElement(it) }) + is JsonPrimitive -> { + val value = if (element.isString) { + element.content + } else { + element.booleanOrNull ?: element.longOrNull ?: element.doubleOrNull ?: element.content + } + JsonAny.Primitive(value) + } + } +} diff --git a/tonapi/src/main/kotlin/io/Serializer.kt b/tonapi/src/main/kotlin/io/Serializer.kt new file mode 100644 index 000000000..354a0a075 --- /dev/null +++ b/tonapi/src/main/kotlin/io/Serializer.kt @@ -0,0 +1,31 @@ +package io + +import io.serializers.AnySerializer +import kotlinx.serialization.json.Json +import kotlinx.serialization.modules.SerializersModule +import kotlinx.serialization.modules.contextual + +object Serializer { + + private val contextualModule = SerializersModule { + contextual(AnySerializer) + } + + @JvmStatic + val JSON: Json by lazy { + Json { + encodeDefaults = false + ignoreUnknownKeys = true + isLenient = true + serializersModule = contextualModule + } + } + + inline fun toJSON(value: T): String { + return JSON.encodeToString(value) + } + + inline fun fromJSON(string: String): T { + return JSON.decodeFromString(string) + } +} \ No newline at end of file diff --git a/tonapi/src/main/kotlin/io/batteryapi/apis/ConnectApi.kt b/tonapi/src/main/kotlin/io/batteryapi/apis/ConnectApi.kt index 8ca1dfc8c..c7f6aec7b 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/apis/ConnectApi.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/apis/ConnectApi.kt @@ -20,23 +20,24 @@ import okhttp3.Call import okhttp3.HttpUrl import io.batteryapi.models.GetTonConnectPayload200Response -import io.batteryapi.models.GetTonConnectPayloadDefaultResponse +import io.batteryapi.models.InlineObject -import com.squareup.moshi.Json +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable -import io.batteryapi.infrastructure.ApiClient -import io.batteryapi.infrastructure.ApiResponse -import io.batteryapi.infrastructure.ClientException -import io.batteryapi.infrastructure.ClientError -import io.batteryapi.infrastructure.ServerException -import io.batteryapi.infrastructure.ServerError -import io.batteryapi.infrastructure.MultiValueMap -import io.batteryapi.infrastructure.PartConfig -import io.batteryapi.infrastructure.RequestConfig -import io.batteryapi.infrastructure.RequestMethod -import io.batteryapi.infrastructure.ResponseType -import io.batteryapi.infrastructure.Success -import io.batteryapi.infrastructure.toMultiValue +import io.infrastructure.ApiClient +import io.infrastructure.ApiResponse +import io.infrastructure.ClientException +import io.infrastructure.ClientError +import io.infrastructure.ServerException +import io.infrastructure.ServerError +import io.infrastructure.MultiValueMap +import io.infrastructure.PartConfig +import io.infrastructure.RequestConfig +import io.infrastructure.RequestMethod +import io.infrastructure.ResponseType +import io.infrastructure.Success +import io.infrastructure.toMultiValue class ConnectApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory = ApiClient.defaultClient) : ApiClient(basePath, client) { companion object { @@ -46,17 +47,6 @@ class ConnectApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory } } - /** - * GET /tonconnect/payload - * - * Get a payload for further token receipt - * @return GetTonConnectPayload200Response - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getTonConnectPayload() : GetTonConnectPayload200Response { @@ -77,14 +67,6 @@ class ConnectApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory } } - /** - * GET /tonconnect/payload - * - * Get a payload for further token receipt - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getTonConnectPayloadWithHttpInfo() : ApiResponse { @@ -95,11 +77,6 @@ class ConnectApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory ) } - /** - * To obtain the request config of the operation getTonConnectPayload - * - * @return RequestConfig - */ fun getTonConnectPayloadRequestConfig() : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() diff --git a/tonapi/src/main/kotlin/io/batteryapi/apis/BatteryApi.kt b/tonapi/src/main/kotlin/io/batteryapi/apis/DefaultApi.kt similarity index 69% rename from tonapi/src/main/kotlin/io/batteryapi/apis/BatteryApi.kt rename to tonapi/src/main/kotlin/io/batteryapi/apis/DefaultApi.kt index 8d310c67e..043d522db 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/apis/BatteryApi.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/apis/DefaultApi.kt @@ -39,9 +39,10 @@ import io.batteryapi.models.EnterpriseWalletConfig import io.batteryapi.models.EstimateGaslessCostRequest import io.batteryapi.models.EstimatedTronTx import io.batteryapi.models.GaslessEstimation -import io.batteryapi.models.GetTonConnectPayloadDefaultResponse import io.batteryapi.models.GetTronConfig200Response import io.batteryapi.models.IOSBatteryPurchaseStatus +import io.batteryapi.models.IncreaseUserBalanceRequest +import io.batteryapi.models.InlineObject import io.batteryapi.models.IosBatteryPurchaseRequest import io.batteryapi.models.PromoCodeBatteryPurchaseRequest import io.batteryapi.models.PromoCodeBatteryPurchaseStatus @@ -55,24 +56,26 @@ import io.batteryapi.models.Status import io.batteryapi.models.Transactions import io.batteryapi.models.TronSendRequest import io.batteryapi.models.TronTransactionsList - -import com.squareup.moshi.Json - -import io.batteryapi.infrastructure.ApiClient -import io.batteryapi.infrastructure.ApiResponse -import io.batteryapi.infrastructure.ClientException -import io.batteryapi.infrastructure.ClientError -import io.batteryapi.infrastructure.ServerException -import io.batteryapi.infrastructure.ServerError -import io.batteryapi.infrastructure.MultiValueMap -import io.batteryapi.infrastructure.PartConfig -import io.batteryapi.infrastructure.RequestConfig -import io.batteryapi.infrastructure.RequestMethod -import io.batteryapi.infrastructure.ResponseType -import io.batteryapi.infrastructure.Success -import io.batteryapi.infrastructure.toMultiValue - -class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory = ApiClient.defaultClient) : ApiClient(basePath, client) { +import io.batteryapi.models.VerifyPurchasePromo200Response + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +import io.infrastructure.ApiClient +import io.infrastructure.ApiResponse +import io.infrastructure.ClientException +import io.infrastructure.ClientError +import io.infrastructure.ServerException +import io.infrastructure.ServerError +import io.infrastructure.MultiValueMap +import io.infrastructure.PartConfig +import io.infrastructure.RequestConfig +import io.infrastructure.RequestMethod +import io.infrastructure.ResponseType +import io.infrastructure.Success +import io.infrastructure.toMultiValue + +class DefaultApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory = ApiClient.defaultClient) : ApiClient(basePath, client) { companion object { @JvmStatic val defaultBasePath: String by lazy { @@ -80,19 +83,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory } } - /** - * POST /purchase-battery/android - * - * verify an in-app purchase - * @param xTonConnectAuth - * @param androidBatteryPurchaseRequest In-App purchase - * @return AndroidBatteryPurchaseStatus - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun androidBatteryPurchase(xTonConnectAuth: kotlin.String, androidBatteryPurchaseRequest: AndroidBatteryPurchaseRequest) : AndroidBatteryPurchaseStatus { @@ -113,16 +103,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory } } - /** - * POST /purchase-battery/android - * - * verify an in-app purchase - * @param xTonConnectAuth - * @param androidBatteryPurchaseRequest In-App purchase - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun androidBatteryPurchaseWithHttpInfo(xTonConnectAuth: kotlin.String, androidBatteryPurchaseRequest: AndroidBatteryPurchaseRequest) : ApiResponse { @@ -133,13 +113,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory ) } - /** - * To obtain the request config of the operation androidBatteryPurchase - * - * @param xTonConnectAuth - * @param androidBatteryPurchaseRequest In-App purchase - * @return RequestConfig - */ fun androidBatteryPurchaseRequestConfig(xTonConnectAuth: kotlin.String, androidBatteryPurchaseRequest: AndroidBatteryPurchaseRequest) : RequestConfig { val localVariableBody = androidBatteryPurchaseRequest val localVariableQuery: MultiValueMap = mutableMapOf() @@ -158,18 +131,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory ) } - /** - * POST /purchase-battery/ios/app-store-notification - * - * - * @param appStoreNotificationRequest - * @return kotlin.Any - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun appStoreNotification(appStoreNotificationRequest: AppStoreNotificationRequest) : kotlin.Any { @@ -190,15 +151,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory } } - /** - * POST /purchase-battery/ios/app-store-notification - * - * - * @param appStoreNotificationRequest - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun appStoreNotificationWithHttpInfo(appStoreNotificationRequest: AppStoreNotificationRequest) : ApiResponse { @@ -209,12 +161,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory ) } - /** - * To obtain the request config of the operation appStoreNotification - * - * @param appStoreNotificationRequest - * @return RequestConfig - */ fun appStoreNotificationRequestConfig(appStoreNotificationRequest: AppStoreNotificationRequest) : RequestConfig { val localVariableBody = appStoreNotificationRequest val localVariableQuery: MultiValueMap = mutableMapOf() @@ -232,19 +178,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory ) } - /** - * POST /restricted/apply-promo - * - * - * @param token - * @param applyPromoRequest - * @return PromoCodeBatteryPurchaseStatus - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun applyPromo(token: kotlin.String, applyPromoRequest: ApplyPromoRequest) : PromoCodeBatteryPurchaseStatus { @@ -265,16 +198,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory } } - /** - * POST /restricted/apply-promo - * - * - * @param token - * @param applyPromoRequest - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun applyPromoWithHttpInfo(token: kotlin.String, applyPromoRequest: ApplyPromoRequest) : ApiResponse { @@ -285,13 +208,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory ) } - /** - * To obtain the request config of the operation applyPromo - * - * @param token - * @param applyPromoRequest - * @return RequestConfig - */ fun applyPromoRequestConfig(token: kotlin.String, applyPromoRequest: ApplyPromoRequest) : RequestConfig { val localVariableBody = applyPromoRequest val localVariableQuery: MultiValueMap = mutableMapOf>() @@ -312,26 +228,13 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory ) } - /** - * POST /restricted/create-custom-refund - * - * - * @param token - * @param createCustomRefundRequest - * @return kotlin.collections.Map - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createCustomRefund(token: kotlin.String, createCustomRefundRequest: CreateCustomRefundRequest) : kotlin.collections.Map { + fun createCustomRefund(token: kotlin.String, createCustomRefundRequest: CreateCustomRefundRequest) : kotlin.collections.Map { val localVarResponse = createCustomRefundWithHttpInfo(token = token, createCustomRefundRequest = createCustomRefundRequest) return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.Map + ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.Map ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") ResponseType.ClientError -> { @@ -345,33 +248,16 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory } } - /** - * POST /restricted/create-custom-refund - * - * - * @param token - * @param createCustomRefundRequest - * @return ApiResponse?> - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun createCustomRefundWithHttpInfo(token: kotlin.String, createCustomRefundRequest: CreateCustomRefundRequest) : ApiResponse?> { + fun createCustomRefundWithHttpInfo(token: kotlin.String, createCustomRefundRequest: CreateCustomRefundRequest) : ApiResponse?> { val localVariableConfig = createCustomRefundRequestConfig(token = token, createCustomRefundRequest = createCustomRefundRequest) - return request>( + return request>( localVariableConfig ) } - /** - * To obtain the request config of the operation createCustomRefund - * - * @param token - * @param createCustomRefundRequest - * @return RequestConfig - */ fun createCustomRefundRequestConfig(token: kotlin.String, createCustomRefundRequest: CreateCustomRefundRequest) : RequestConfig { val localVariableBody = createCustomRefundRequest val localVariableQuery: MultiValueMap = mutableMapOf>() @@ -392,19 +278,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory ) } - /** - * POST /restricted/promo-campaign - * - * - * @param token - * @param createPromoCampaignRequest - * @return CreatePromoCampaign200Response - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun createPromoCampaign(token: kotlin.String, createPromoCampaignRequest: CreatePromoCampaignRequest) : CreatePromoCampaign200Response { @@ -425,16 +298,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory } } - /** - * POST /restricted/promo-campaign - * - * - * @param token - * @param createPromoCampaignRequest - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun createPromoCampaignWithHttpInfo(token: kotlin.String, createPromoCampaignRequest: CreatePromoCampaignRequest) : ApiResponse { @@ -445,13 +308,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory ) } - /** - * To obtain the request config of the operation createPromoCampaign - * - * @param token - * @param createPromoCampaignRequest - * @return RequestConfig - */ fun createPromoCampaignRequestConfig(token: kotlin.String, createPromoCampaignRequest: CreatePromoCampaignRequest) : RequestConfig { val localVariableBody = createPromoCampaignRequest val localVariableQuery: MultiValueMap = mutableMapOf>() @@ -472,22 +328,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory ) } - /** - * POST /enterprise/wallets/{wallet_id}/estimate - * - * - * @param xEnterpriseAuth - * @param walletId - * @param enterpriseEstimateRequest bag-of-cells serialized to base64 - * @param acceptLanguage (optional, default to "en") - * @param emulate (optional, default to false) - * @return EnterpriseEstimate200Response - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun enterpriseEstimate(xEnterpriseAuth: kotlin.String, walletId: kotlin.String, enterpriseEstimateRequest: EnterpriseEstimateRequest, acceptLanguage: kotlin.String? = "en", emulate: kotlin.Boolean? = false) : EnterpriseEstimate200Response { @@ -508,19 +348,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory } } - /** - * POST /enterprise/wallets/{wallet_id}/estimate - * - * - * @param xEnterpriseAuth - * @param walletId - * @param enterpriseEstimateRequest bag-of-cells serialized to base64 - * @param acceptLanguage (optional, default to "en") - * @param emulate (optional, default to false) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun enterpriseEstimateWithHttpInfo(xEnterpriseAuth: kotlin.String, walletId: kotlin.String, enterpriseEstimateRequest: EnterpriseEstimateRequest, acceptLanguage: kotlin.String?, emulate: kotlin.Boolean?) : ApiResponse { @@ -531,16 +358,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory ) } - /** - * To obtain the request config of the operation enterpriseEstimate - * - * @param xEnterpriseAuth - * @param walletId - * @param enterpriseEstimateRequest bag-of-cells serialized to base64 - * @param acceptLanguage (optional, default to "en") - * @param emulate (optional, default to false) - * @return RequestConfig - */ fun enterpriseEstimateRequestConfig(xEnterpriseAuth: kotlin.String, walletId: kotlin.String, enterpriseEstimateRequest: EnterpriseEstimateRequest, acceptLanguage: kotlin.String?, emulate: kotlin.Boolean?) : RequestConfig { val localVariableBody = enterpriseEstimateRequest val localVariableQuery: MultiValueMap = mutableMapOf>() @@ -565,19 +382,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory ) } - /** - * GET /enterprise/messages/{msg_id} - * - * - * @param xEnterpriseAuth - * @param msgId - * @return EnterpriseGetMessage200Response - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun enterpriseGetMessage(xEnterpriseAuth: kotlin.String, msgId: kotlin.String) : EnterpriseGetMessage200Response { @@ -598,16 +402,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory } } - /** - * GET /enterprise/messages/{msg_id} - * - * - * @param xEnterpriseAuth - * @param msgId - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun enterpriseGetMessageWithHttpInfo(xEnterpriseAuth: kotlin.String, msgId: kotlin.String) : ApiResponse { @@ -618,13 +412,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory ) } - /** - * To obtain the request config of the operation enterpriseGetMessage - * - * @param xEnterpriseAuth - * @param msgId - * @return RequestConfig - */ fun enterpriseGetMessageRequestConfig(xEnterpriseAuth: kotlin.String, msgId: kotlin.String) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() @@ -642,18 +429,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory ) } - /** - * GET /enterprise/status - * - * - * @param xEnterpriseAuth - * @return EnterpriseGetStatus200Response - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun enterpriseGetStatus(xEnterpriseAuth: kotlin.String) : EnterpriseGetStatus200Response { @@ -674,15 +449,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory } } - /** - * GET /enterprise/status - * - * - * @param xEnterpriseAuth - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun enterpriseGetStatusWithHttpInfo(xEnterpriseAuth: kotlin.String) : ApiResponse { @@ -693,12 +459,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory ) } - /** - * To obtain the request config of the operation enterpriseGetStatus - * - * @param xEnterpriseAuth - * @return RequestConfig - */ fun enterpriseGetStatusRequestConfig(xEnterpriseAuth: kotlin.String) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() @@ -716,19 +476,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory ) } - /** - * GET /enterprise/wallets/{wallet_id}/config - * - * - * @param xEnterpriseAuth - * @param walletId - * @return EnterpriseWalletConfig - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun enterpriseGetWalletConfig(xEnterpriseAuth: kotlin.String, walletId: kotlin.String) : EnterpriseWalletConfig { @@ -749,16 +496,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory } } - /** - * GET /enterprise/wallets/{wallet_id}/config - * - * - * @param xEnterpriseAuth - * @param walletId - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun enterpriseGetWalletConfigWithHttpInfo(xEnterpriseAuth: kotlin.String, walletId: kotlin.String) : ApiResponse { @@ -769,13 +506,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory ) } - /** - * To obtain the request config of the operation enterpriseGetWalletConfig - * - * @param xEnterpriseAuth - * @param walletId - * @return RequestConfig - */ fun enterpriseGetWalletConfigRequestConfig(xEnterpriseAuth: kotlin.String, walletId: kotlin.String) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() @@ -793,20 +523,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory ) } - /** - * POST /enterprise/wallets/{wallet_id}/send - * - * - * @param xEnterpriseAuth - * @param walletId - * @param enterpriseEstimateRequest bag-of-cells serialized to base64 - * @return EnterpriseSend200Response - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun enterpriseSend(xEnterpriseAuth: kotlin.String, walletId: kotlin.String, enterpriseEstimateRequest: EnterpriseEstimateRequest) : EnterpriseSend200Response { @@ -827,17 +543,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory } } - /** - * POST /enterprise/wallets/{wallet_id}/send - * - * - * @param xEnterpriseAuth - * @param walletId - * @param enterpriseEstimateRequest bag-of-cells serialized to base64 - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun enterpriseSendWithHttpInfo(xEnterpriseAuth: kotlin.String, walletId: kotlin.String, enterpriseEstimateRequest: EnterpriseEstimateRequest) : ApiResponse { @@ -848,14 +553,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory ) } - /** - * To obtain the request config of the operation enterpriseSend - * - * @param xEnterpriseAuth - * @param walletId - * @param enterpriseEstimateRequest bag-of-cells serialized to base64 - * @return RequestConfig - */ fun enterpriseSendRequestConfig(xEnterpriseAuth: kotlin.String, walletId: kotlin.String, enterpriseEstimateRequest: EnterpriseEstimateRequest) : RequestConfig { val localVariableBody = enterpriseEstimateRequest val localVariableQuery: MultiValueMap = mutableMapOf() @@ -874,26 +571,10 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory ) } - /** - * POST /gasless/estimate-cost/{jetton_master} - * - * - * @param jettonMaster - * @param estimateGaslessCostRequest - * @param xTonConnectAuth (optional) - * @param walletAddress (optional) - * @param walletPublicKey (optional) - * @return GaslessEstimation - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun estimateGaslessCost(jettonMaster: kotlin.String, estimateGaslessCostRequest: EstimateGaslessCostRequest, xTonConnectAuth: kotlin.String? = null, walletAddress: kotlin.String? = null, walletPublicKey: kotlin.String? = null) : GaslessEstimation { - val localVarResponse = estimateGaslessCostWithHttpInfo(jettonMaster = jettonMaster, estimateGaslessCostRequest = estimateGaslessCostRequest, xTonConnectAuth = xTonConnectAuth, walletAddress = walletAddress, walletPublicKey = walletPublicKey) + fun estimateGaslessCost(jettonMaster: kotlin.String, estimateGaslessCostRequest: EstimateGaslessCostRequest, xTonConnectAuth: kotlin.String? = null, walletAddress: kotlin.String? = null, walletPublicKey: kotlin.String? = null, enableValidation: kotlin.Boolean? = false) : GaslessEstimation { + val localVarResponse = estimateGaslessCostWithHttpInfo(jettonMaster = jettonMaster, estimateGaslessCostRequest = estimateGaslessCostRequest, xTonConnectAuth = xTonConnectAuth, walletAddress = walletAddress, walletPublicKey = walletPublicKey, enableValidation = enableValidation) return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as GaslessEstimation @@ -910,40 +591,17 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory } } - /** - * POST /gasless/estimate-cost/{jetton_master} - * - * - * @param jettonMaster - * @param estimateGaslessCostRequest - * @param xTonConnectAuth (optional) - * @param walletAddress (optional) - * @param walletPublicKey (optional) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun estimateGaslessCostWithHttpInfo(jettonMaster: kotlin.String, estimateGaslessCostRequest: EstimateGaslessCostRequest, xTonConnectAuth: kotlin.String?, walletAddress: kotlin.String?, walletPublicKey: kotlin.String?) : ApiResponse { - val localVariableConfig = estimateGaslessCostRequestConfig(jettonMaster = jettonMaster, estimateGaslessCostRequest = estimateGaslessCostRequest, xTonConnectAuth = xTonConnectAuth, walletAddress = walletAddress, walletPublicKey = walletPublicKey) + fun estimateGaslessCostWithHttpInfo(jettonMaster: kotlin.String, estimateGaslessCostRequest: EstimateGaslessCostRequest, xTonConnectAuth: kotlin.String?, walletAddress: kotlin.String?, walletPublicKey: kotlin.String?, enableValidation: kotlin.Boolean?) : ApiResponse { + val localVariableConfig = estimateGaslessCostRequestConfig(jettonMaster = jettonMaster, estimateGaslessCostRequest = estimateGaslessCostRequest, xTonConnectAuth = xTonConnectAuth, walletAddress = walletAddress, walletPublicKey = walletPublicKey, enableValidation = enableValidation) return request( localVariableConfig ) } - /** - * To obtain the request config of the operation estimateGaslessCost - * - * @param jettonMaster - * @param estimateGaslessCostRequest - * @param xTonConnectAuth (optional) - * @param walletAddress (optional) - * @param walletPublicKey (optional) - * @return RequestConfig - */ - fun estimateGaslessCostRequestConfig(jettonMaster: kotlin.String, estimateGaslessCostRequest: EstimateGaslessCostRequest, xTonConnectAuth: kotlin.String?, walletAddress: kotlin.String?, walletPublicKey: kotlin.String?) : RequestConfig { + fun estimateGaslessCostRequestConfig(jettonMaster: kotlin.String, estimateGaslessCostRequest: EstimateGaslessCostRequest, xTonConnectAuth: kotlin.String?, walletAddress: kotlin.String?, walletPublicKey: kotlin.String?, enableValidation: kotlin.Boolean?) : RequestConfig { val localVariableBody = estimateGaslessCostRequest val localVariableQuery: MultiValueMap = mutableMapOf>() .apply { @@ -953,6 +611,9 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory if (walletPublicKey != null) { put("wallet_public_key", listOf(walletPublicKey.toString())) } + if (enableValidation != null) { + put("enable_validation", listOf(enableValidation.toString())) + } } val localVariableHeaders: MutableMap = mutableMapOf() xTonConnectAuth?.apply { localVariableHeaders["X-TonConnect-Auth"] = this.toString() } @@ -969,26 +630,13 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory ) } - /** - * POST /restricted/purchases/{purchase_id}/extend-refund-period - * - * - * @param purchaseId - * @param token - * @return kotlin.collections.Map - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun extendRefundPeriod(purchaseId: kotlin.Long, token: kotlin.String) : kotlin.collections.Map { + fun extendRefundPeriod(purchaseId: kotlin.Long, token: kotlin.String) : kotlin.collections.Map { val localVarResponse = extendRefundPeriodWithHttpInfo(purchaseId = purchaseId, token = token) return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.Map + ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.Map ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") ResponseType.ClientError -> { @@ -1002,33 +650,16 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory } } - /** - * POST /restricted/purchases/{purchase_id}/extend-refund-period - * - * - * @param purchaseId - * @param token - * @return ApiResponse?> - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun extendRefundPeriodWithHttpInfo(purchaseId: kotlin.Long, token: kotlin.String) : ApiResponse?> { + fun extendRefundPeriodWithHttpInfo(purchaseId: kotlin.Long, token: kotlin.String) : ApiResponse?> { val localVariableConfig = extendRefundPeriodRequestConfig(purchaseId = purchaseId, token = token) - return request>( + return request>( localVariableConfig ) } - /** - * To obtain the request config of the operation extendRefundPeriod - * - * @param purchaseId - * @param token - * @return RequestConfig - */ fun extendRefundPeriodRequestConfig(purchaseId: kotlin.Long, token: kotlin.String) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf>() @@ -1052,8 +683,8 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory * enum for parameter units */ enum class UnitsGetBalance(val value: kotlin.String) { - @Json(name = "usd") usd("usd"), - @Json(name = "ton") ton("ton"); + @SerialName(value = "usd") usd("usd"), + @SerialName(value = "ton") ton("ton"); /** * Override [toString()] to avoid using the enum variable name as the value, and instead use @@ -1065,23 +696,10 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory override fun toString(): kotlin.String = "$value" } - /** - * GET /balance - * - * This method returns information about a user's balance. - * @param xTonConnectAuth - * @param units (optional, default to usd) - * @return Balance - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getBalance(xTonConnectAuth: kotlin.String, units: UnitsGetBalance? = UnitsGetBalance.usd) : Balance { - val localVarResponse = getBalanceWithHttpInfo(xTonConnectAuth = xTonConnectAuth, units = units) + fun getBalance(xTonConnectAuth: kotlin.String, units: UnitsGetBalance? = UnitsGetBalance.usd, region: kotlin.String? = null) : Balance { + val localVarResponse = getBalanceWithHttpInfo(xTonConnectAuth = xTonConnectAuth, units = units, region = region) return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as Balance @@ -1098,40 +716,26 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory } } - /** - * GET /balance - * - * This method returns information about a user's balance. - * @param xTonConnectAuth - * @param units (optional, default to usd) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun getBalanceWithHttpInfo(xTonConnectAuth: kotlin.String, units: UnitsGetBalance?) : ApiResponse { - val localVariableConfig = getBalanceRequestConfig(xTonConnectAuth = xTonConnectAuth, units = units) + fun getBalanceWithHttpInfo(xTonConnectAuth: kotlin.String, units: UnitsGetBalance?, region: kotlin.String?) : ApiResponse { + val localVariableConfig = getBalanceRequestConfig(xTonConnectAuth = xTonConnectAuth, units = units, region = region) return request( localVariableConfig ) } - /** - * To obtain the request config of the operation getBalance - * - * @param xTonConnectAuth - * @param units (optional, default to usd) - * @return RequestConfig - */ - fun getBalanceRequestConfig(xTonConnectAuth: kotlin.String, units: UnitsGetBalance?) : RequestConfig { + fun getBalanceRequestConfig(xTonConnectAuth: kotlin.String, units: UnitsGetBalance?, region: kotlin.String?) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf>() .apply { if (units != null) { put("units", listOf(units.value)) } + if (region != null) { + put("region", listOf(region.toString())) + } } val localVariableHeaders: MutableMap = mutableMapOf() xTonConnectAuth.apply { localVariableHeaders["X-TonConnect-Auth"] = this.toString() } @@ -1147,18 +751,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory ) } - /** - * GET /battery-charged - * - * This method returns information about a user's balance. - * @param accountId - * @return BatteryCharged - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getBatteryCharged(accountId: kotlin.String) : BatteryCharged { @@ -1179,15 +771,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory } } - /** - * GET /battery-charged - * - * This method returns information about a user's balance. - * @param accountId - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getBatteryChargedWithHttpInfo(accountId: kotlin.String) : ApiResponse { @@ -1198,12 +781,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory ) } - /** - * To obtain the request config of the operation getBatteryCharged - * - * @param accountId - * @return RequestConfig - */ fun getBatteryChargedRequestConfig(accountId: kotlin.String) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf>() @@ -1223,17 +800,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory ) } - /** - * GET /config - * - * This method returns information about Battery Service. - * @return Config - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getConfig() : Config { @@ -1254,14 +820,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory } } - /** - * GET /config - * - * This method returns information about Battery Service. - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getConfigWithHttpInfo() : ApiResponse { @@ -1272,11 +830,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory ) } - /** - * To obtain the request config of the operation getConfig - * - * @return RequestConfig - */ fun getConfigRequestConfig() : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() @@ -1293,18 +846,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory ) } - /** - * GET /promo-used - * - * - * @param promo - * @return PromoUsed - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getPromoUsed(promo: kotlin.String) : PromoUsed { @@ -1325,15 +866,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory } } - /** - * GET /promo-used - * - * - * @param promo - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getPromoUsedWithHttpInfo(promo: kotlin.String) : ApiResponse { @@ -1344,12 +876,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory ) } - /** - * To obtain the request config of the operation getPromoUsed - * - * @param promo - * @return RequestConfig - */ fun getPromoUsedRequestConfig(promo: kotlin.String) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf>() @@ -1369,21 +895,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory ) } - /** - * GET /purchases - * - * This method returns a list of purchases made by a specific user. - * @param xTonConnectAuth - * @param limit (optional, default to 1000) - * @param offset (optional, default to 0) - * @param includeGiftsOnTheWay (optional, default to false) - * @return Purchases - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getPurchases(xTonConnectAuth: kotlin.String, limit: kotlin.Int? = 1000, offset: kotlin.Int? = 0, includeGiftsOnTheWay: kotlin.Boolean? = false) : Purchases { @@ -1404,18 +915,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory } } - /** - * GET /purchases - * - * This method returns a list of purchases made by a specific user. - * @param xTonConnectAuth - * @param limit (optional, default to 1000) - * @param offset (optional, default to 0) - * @param includeGiftsOnTheWay (optional, default to false) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getPurchasesWithHttpInfo(xTonConnectAuth: kotlin.String, limit: kotlin.Int?, offset: kotlin.Int?, includeGiftsOnTheWay: kotlin.Boolean?) : ApiResponse { @@ -1426,15 +925,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory ) } - /** - * To obtain the request config of the operation getPurchases - * - * @param xTonConnectAuth - * @param limit (optional, default to 1000) - * @param offset (optional, default to 0) - * @param includeGiftsOnTheWay (optional, default to false) - * @return RequestConfig - */ fun getPurchasesRequestConfig(xTonConnectAuth: kotlin.String, limit: kotlin.Int?, offset: kotlin.Int?, includeGiftsOnTheWay: kotlin.Boolean?) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf>() @@ -1463,18 +953,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory ) } - /** - * GET /recharge-methods - * - * This method returns on-chain recharge methods. - * @param includeRechargeOnly (optional, default to true) - * @return RechargeMethods - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getRechargeMethods(includeRechargeOnly: kotlin.Boolean? = true) : RechargeMethods { @@ -1495,15 +973,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory } } - /** - * GET /recharge-methods - * - * This method returns on-chain recharge methods. - * @param includeRechargeOnly (optional, default to true) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getRechargeMethodsWithHttpInfo(includeRechargeOnly: kotlin.Boolean?) : ApiResponse { @@ -1514,12 +983,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory ) } - /** - * To obtain the request config of the operation getRechargeMethods - * - * @param includeRechargeOnly (optional, default to true) - * @return RequestConfig - */ fun getRechargeMethodsRequestConfig(includeRechargeOnly: kotlin.Boolean?) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf>() @@ -1541,18 +1004,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory ) } - /** - * GET /status - * - * This method returns information about the current status of Battery Service. - * @param xTonConnectAuth - * @return Status - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getStatus(xTonConnectAuth: kotlin.String) : Status { @@ -1573,15 +1024,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory } } - /** - * GET /status - * - * This method returns information about the current status of Battery Service. - * @param xTonConnectAuth - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getStatusWithHttpInfo(xTonConnectAuth: kotlin.String) : ApiResponse { @@ -1592,12 +1034,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory ) } - /** - * To obtain the request config of the operation getStatus - * - * @param xTonConnectAuth - * @return RequestConfig - */ fun getStatusRequestConfig(xTonConnectAuth: kotlin.String) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() @@ -1615,20 +1051,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory ) } - /** - * GET /transactions - * - * This method returns a list of transactions made by a specific user. - * @param xTonConnectAuth - * @param limit (optional, default to 1000) - * @param offset (optional, default to 0) - * @return Transactions - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getTransactions(xTonConnectAuth: kotlin.String, limit: kotlin.Int? = 1000, offset: kotlin.Int? = 0) : Transactions { @@ -1649,17 +1071,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory } } - /** - * GET /transactions - * - * This method returns a list of transactions made by a specific user. - * @param xTonConnectAuth - * @param limit (optional, default to 1000) - * @param offset (optional, default to 0) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getTransactionsWithHttpInfo(xTonConnectAuth: kotlin.String, limit: kotlin.Int?, offset: kotlin.Int?) : ApiResponse { @@ -1670,14 +1081,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory ) } - /** - * To obtain the request config of the operation getTransactions - * - * @param xTonConnectAuth - * @param limit (optional, default to 1000) - * @param offset (optional, default to 0) - * @return RequestConfig - */ fun getTransactionsRequestConfig(xTonConnectAuth: kotlin.String, limit: kotlin.Int?, offset: kotlin.Int?) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf>() @@ -1703,17 +1106,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory ) } - /** - * GET /v0/tron/config - * - * - * @return GetTronConfig200Response - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getTronConfig() : GetTronConfig200Response { @@ -1734,14 +1126,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory } } - /** - * GET /v0/tron/config - * - * - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getTronConfigWithHttpInfo() : ApiResponse { @@ -1752,11 +1136,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory ) } - /** - * To obtain the request config of the operation getTronConfig - * - * @return RequestConfig - */ fun getTronConfigRequestConfig() : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() @@ -1773,20 +1152,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory ) } - /** - * GET /v0/tron/transactions - * - * - * @param xTonConnectAuth - * @param limit (optional, default to 1000) - * @param maxTimestamp (optional) - * @return TronTransactionsList - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getTronTransactions(xTonConnectAuth: kotlin.String, limit: kotlin.Int? = 1000, maxTimestamp: kotlin.Long? = null) : TronTransactionsList { @@ -1807,17 +1172,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory } } - /** - * GET /v0/tron/transactions - * - * - * @param xTonConnectAuth - * @param limit (optional, default to 1000) - * @param maxTimestamp (optional) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getTronTransactionsWithHttpInfo(xTonConnectAuth: kotlin.String, limit: kotlin.Int?, maxTimestamp: kotlin.Long?) : ApiResponse { @@ -1828,14 +1182,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory ) } - /** - * To obtain the request config of the operation getTronTransactions - * - * @param xTonConnectAuth - * @param limit (optional, default to 1000) - * @param maxTimestamp (optional) - * @return RequestConfig - */ fun getTronTransactionsRequestConfig(xTonConnectAuth: kotlin.String, limit: kotlin.Int?, maxTimestamp: kotlin.Long?) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf>() @@ -1861,19 +1207,56 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory ) } - /** - * POST /purchase-battery/ios - * - * verify an in-app purchase - * @param xTonConnectAuth - * @param iosBatteryPurchaseRequest In-App purchase - * @return IOSBatteryPurchaseStatus - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun increaseUserBalance(userId: kotlin.Long, token: kotlin.String, increaseUserBalanceRequest: IncreaseUserBalanceRequest) : kotlin.collections.Map { + val localVarResponse = increaseUserBalanceWithHttpInfo(userId = userId, token = token, increaseUserBalanceRequest = increaseUserBalanceRequest) + + return when (localVarResponse.responseType) { + ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.Map + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> { + val localVarError = localVarResponse as ClientError<*> + throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + } + ResponseType.ServerError -> { + val localVarError = localVarResponse as ServerError<*> + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) + } + } + } + + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun increaseUserBalanceWithHttpInfo(userId: kotlin.Long, token: kotlin.String, increaseUserBalanceRequest: IncreaseUserBalanceRequest) : ApiResponse?> { + val localVariableConfig = increaseUserBalanceRequestConfig(userId = userId, token = token, increaseUserBalanceRequest = increaseUserBalanceRequest) + + return request>( + localVariableConfig + ) + } + + fun increaseUserBalanceRequestConfig(userId: kotlin.Long, token: kotlin.String, increaseUserBalanceRequest: IncreaseUserBalanceRequest) : RequestConfig { + val localVariableBody = increaseUserBalanceRequest + val localVariableQuery: MultiValueMap = mutableMapOf>() + .apply { + put("token", listOf(token.toString())) + } + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "application/json" + + return RequestConfig( + method = RequestMethod.POST, + path = "/restricted/users/{user_id}/increase-balance".replace("{"+"user_id"+"}", encodeURIComponent(userId.toString())), + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun iosBatteryPurchase(xTonConnectAuth: kotlin.String, iosBatteryPurchaseRequest: IosBatteryPurchaseRequest) : IOSBatteryPurchaseStatus { @@ -1894,16 +1277,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory } } - /** - * POST /purchase-battery/ios - * - * verify an in-app purchase - * @param xTonConnectAuth - * @param iosBatteryPurchaseRequest In-App purchase - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun iosBatteryPurchaseWithHttpInfo(xTonConnectAuth: kotlin.String, iosBatteryPurchaseRequest: IosBatteryPurchaseRequest) : ApiResponse { @@ -1914,13 +1287,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory ) } - /** - * To obtain the request config of the operation iosBatteryPurchase - * - * @param xTonConnectAuth - * @param iosBatteryPurchaseRequest In-App purchase - * @return RequestConfig - */ fun iosBatteryPurchaseRequestConfig(xTonConnectAuth: kotlin.String, iosBatteryPurchaseRequest: IosBatteryPurchaseRequest) : RequestConfig { val localVariableBody = iosBatteryPurchaseRequest val localVariableQuery: MultiValueMap = mutableMapOf() @@ -1939,20 +1305,53 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory ) } - /** - * POST /purchase-battery/promo-code - * - * charge battery with promo code - * @param xTonConnectAuth - * @param promoCodeBatteryPurchaseRequest charge battery with promo code - * @param acceptLanguage (optional, default to "en") - * @return PromoCodeBatteryPurchaseStatus - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun itrxIoCallback(requestBody: kotlin.collections.Map) : kotlin.collections.Map { + val localVarResponse = itrxIoCallbackWithHttpInfo(requestBody = requestBody) + + return when (localVarResponse.responseType) { + ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.Map + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> { + val localVarError = localVarResponse as ClientError<*> + throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + } + ResponseType.ServerError -> { + val localVarError = localVarResponse as ServerError<*> + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) + } + } + } + + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun itrxIoCallbackWithHttpInfo(requestBody: kotlin.collections.Map) : ApiResponse?> { + val localVariableConfig = itrxIoCallbackRequestConfig(requestBody = requestBody) + + return request, kotlin.collections.Map>( + localVariableConfig + ) + } + + fun itrxIoCallbackRequestConfig(requestBody: kotlin.collections.Map) : RequestConfig> { + val localVariableBody = requestBody + val localVariableQuery: MultiValueMap = mutableMapOf() + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "application/json" + + return RequestConfig( + method = RequestMethod.POST, + path = "/v0/tron/itrx-io-callback", + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun promoCodeBatteryPurchase(xTonConnectAuth: kotlin.String, promoCodeBatteryPurchaseRequest: PromoCodeBatteryPurchaseRequest, acceptLanguage: kotlin.String? = "en") : PromoCodeBatteryPurchaseStatus { @@ -1973,17 +1372,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory } } - /** - * POST /purchase-battery/promo-code - * - * charge battery with promo code - * @param xTonConnectAuth - * @param promoCodeBatteryPurchaseRequest charge battery with promo code - * @param acceptLanguage (optional, default to "en") - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun promoCodeBatteryPurchaseWithHttpInfo(xTonConnectAuth: kotlin.String, promoCodeBatteryPurchaseRequest: PromoCodeBatteryPurchaseRequest, acceptLanguage: kotlin.String?) : ApiResponse { @@ -1994,14 +1382,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory ) } - /** - * To obtain the request config of the operation promoCodeBatteryPurchase - * - * @param xTonConnectAuth - * @param promoCodeBatteryPurchaseRequest charge battery with promo code - * @param acceptLanguage (optional, default to "en") - * @return RequestConfig - */ fun promoCodeBatteryPurchaseRequestConfig(xTonConnectAuth: kotlin.String, promoCodeBatteryPurchaseRequest: PromoCodeBatteryPurchaseRequest, acceptLanguage: kotlin.String?) : RequestConfig { val localVariableBody = promoCodeBatteryPurchaseRequest val localVariableQuery: MultiValueMap = mutableMapOf() @@ -2021,19 +1401,7 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory ) } - /** - * POST /request-refund - * - * - * @param xTonConnectAuth - * @param requestRefundRequest - * @return void - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun requestRefund(xTonConnectAuth: kotlin.String, requestRefundRequest: RequestRefundRequest) : Unit { val localVarResponse = requestRefundWithHttpInfo(xTonConnectAuth = xTonConnectAuth, requestRefundRequest = requestRefundRequest) @@ -2053,16 +1421,7 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory } } - /** - * POST /request-refund - * - * - * @param xTonConnectAuth - * @param requestRefundRequest - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ + @Throws(IllegalStateException::class, IOException::class) fun requestRefundWithHttpInfo(xTonConnectAuth: kotlin.String, requestRefundRequest: RequestRefundRequest) : ApiResponse { val localVariableConfig = requestRefundRequestConfig(xTonConnectAuth = xTonConnectAuth, requestRefundRequest = requestRefundRequest) @@ -2072,13 +1431,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory ) } - /** - * To obtain the request config of the operation requestRefund - * - * @param xTonConnectAuth - * @param requestRefundRequest - * @return RequestConfig - */ fun requestRefundRequestConfig(xTonConnectAuth: kotlin.String, requestRefundRequest: RequestRefundRequest) : RequestConfig { val localVariableBody = requestRefundRequest val localVariableQuery: MultiValueMap = mutableMapOf() @@ -2097,27 +1449,13 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory ) } - /** - * POST /restricted/users/{user_id}/reset-balance - * - * - * @param userId - * @param token - * @param resetUserBalanceRequest - * @return kotlin.collections.Map - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun resetUserBalance(userId: kotlin.Long, token: kotlin.String, resetUserBalanceRequest: ResetUserBalanceRequest) : kotlin.collections.Map { + fun resetUserBalance(userId: kotlin.Long, token: kotlin.String, resetUserBalanceRequest: ResetUserBalanceRequest) : kotlin.collections.Map { val localVarResponse = resetUserBalanceWithHttpInfo(userId = userId, token = token, resetUserBalanceRequest = resetUserBalanceRequest) return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.Map + ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.Map ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") ResponseType.ClientError -> { @@ -2131,35 +1469,16 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory } } - /** - * POST /restricted/users/{user_id}/reset-balance - * - * - * @param userId - * @param token - * @param resetUserBalanceRequest - * @return ApiResponse?> - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun resetUserBalanceWithHttpInfo(userId: kotlin.Long, token: kotlin.String, resetUserBalanceRequest: ResetUserBalanceRequest) : ApiResponse?> { + fun resetUserBalanceWithHttpInfo(userId: kotlin.Long, token: kotlin.String, resetUserBalanceRequest: ResetUserBalanceRequest) : ApiResponse?> { val localVariableConfig = resetUserBalanceRequestConfig(userId = userId, token = token, resetUserBalanceRequest = resetUserBalanceRequest) - return request>( + return request>( localVariableConfig ) } - /** - * To obtain the request config of the operation resetUserBalance - * - * @param userId - * @param token - * @param resetUserBalanceRequest - * @return RequestConfig - */ fun resetUserBalanceRequestConfig(userId: kotlin.Long, token: kotlin.String, resetUserBalanceRequest: ResetUserBalanceRequest) : RequestConfig { val localVariableBody = resetUserBalanceRequest val localVariableQuery: MultiValueMap = mutableMapOf>() @@ -2180,19 +1499,7 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory ) } - /** - * POST /message - * - * Send message to blockchain - * @param xTonConnectAuth - * @param emulateMessageToWalletRequest bag-of-cells serialized to base64 - * @return void - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun sendMessage(xTonConnectAuth: kotlin.String, emulateMessageToWalletRequest: EmulateMessageToWalletRequest) : Unit { val localVarResponse = sendMessageWithHttpInfo(xTonConnectAuth = xTonConnectAuth, emulateMessageToWalletRequest = emulateMessageToWalletRequest) @@ -2212,16 +1519,7 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory } } - /** - * POST /message - * - * Send message to blockchain - * @param xTonConnectAuth - * @param emulateMessageToWalletRequest bag-of-cells serialized to base64 - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ + @Throws(IllegalStateException::class, IOException::class) fun sendMessageWithHttpInfo(xTonConnectAuth: kotlin.String, emulateMessageToWalletRequest: EmulateMessageToWalletRequest) : ApiResponse { val localVariableConfig = sendMessageRequestConfig(xTonConnectAuth = xTonConnectAuth, emulateMessageToWalletRequest = emulateMessageToWalletRequest) @@ -2231,13 +1529,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory ) } - /** - * To obtain the request config of the operation sendMessage - * - * @param xTonConnectAuth - * @param emulateMessageToWalletRequest bag-of-cells serialized to base64 - * @return RequestConfig - */ fun sendMessageRequestConfig(xTonConnectAuth: kotlin.String, emulateMessageToWalletRequest: EmulateMessageToWalletRequest) : RequestConfig { val localVariableBody = emulateMessageToWalletRequest val localVariableQuery: MultiValueMap = mutableMapOf() @@ -2256,20 +1547,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory ) } - /** - * GET /v0/tron/estimate - * - * Estimate cost of sending a tx in Tron network - * @param wallet - * @param energy (optional) - * @param bandwidth (optional) - * @return EstimatedTronTx - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun tronEstimate(wallet: kotlin.String, energy: kotlin.Int? = null, bandwidth: kotlin.Int? = null) : EstimatedTronTx { @@ -2290,17 +1567,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory } } - /** - * GET /v0/tron/estimate - * - * Estimate cost of sending a tx in Tron network - * @param wallet - * @param energy (optional) - * @param bandwidth (optional) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun tronEstimateWithHttpInfo(wallet: kotlin.String, energy: kotlin.Int?, bandwidth: kotlin.Int?) : ApiResponse { @@ -2311,14 +1577,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory ) } - /** - * To obtain the request config of the operation tronEstimate - * - * @param wallet - * @param energy (optional) - * @param bandwidth (optional) - * @return RequestConfig - */ fun tronEstimateRequestConfig(wallet: kotlin.String, energy: kotlin.Int?, bandwidth: kotlin.Int?) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf>() @@ -2344,19 +1602,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory ) } - /** - * POST /v0/tron/send - * - * send TRON tx - * @param xTonConnectAuth - * @param tronSendRequest - * @return SentTronTx - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun tronSend(xTonConnectAuth: kotlin.String, tronSendRequest: TronSendRequest) : SentTronTx { @@ -2377,16 +1622,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory } } - /** - * POST /v0/tron/send - * - * send TRON tx - * @param xTonConnectAuth - * @param tronSendRequest - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun tronSendWithHttpInfo(xTonConnectAuth: kotlin.String, tronSendRequest: TronSendRequest) : ApiResponse { @@ -2397,13 +1632,6 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory ) } - /** - * To obtain the request config of the operation tronSend - * - * @param xTonConnectAuth - * @param tronSendRequest - * @return RequestConfig - */ fun tronSendRequestConfig(xTonConnectAuth: kotlin.String, tronSendRequest: TronSendRequest) : RequestConfig { val localVariableBody = tronSendRequest val localVariableQuery: MultiValueMap = mutableMapOf() @@ -2422,25 +1650,13 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory ) } - /** - * GET /purchase-battery/verify-purchase-promo - * - * - * @param promo (optional) - * @return kotlin.collections.Map - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun verifyPurchasePromo(promo: kotlin.String? = null) : kotlin.collections.Map { + fun verifyPurchasePromo(promo: kotlin.String? = null) : VerifyPurchasePromo200Response { val localVarResponse = verifyPurchasePromoWithHttpInfo(promo = promo) return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.Map + ResponseType.Success -> (localVarResponse as Success<*>).data as VerifyPurchasePromo200Response ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") ResponseType.ClientError -> { @@ -2454,31 +1670,16 @@ class BatteryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory } } - /** - * GET /purchase-battery/verify-purchase-promo - * - * - * @param promo (optional) - * @return ApiResponse?> - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun verifyPurchasePromoWithHttpInfo(promo: kotlin.String?) : ApiResponse?> { + fun verifyPurchasePromoWithHttpInfo(promo: kotlin.String?) : ApiResponse { val localVariableConfig = verifyPurchasePromoRequestConfig(promo = promo) - return request>( + return request( localVariableConfig ) } - /** - * To obtain the request config of the operation verifyPurchasePromo - * - * @param promo (optional) - * @return RequestConfig - */ fun verifyPurchasePromoRequestConfig(promo: kotlin.String?) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf>() diff --git a/tonapi/src/main/kotlin/io/batteryapi/apis/EmulationApi.kt b/tonapi/src/main/kotlin/io/batteryapi/apis/EmulationApi.kt index 4d7a4f916..61db803ed 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/apis/EmulationApi.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/apis/EmulationApi.kt @@ -20,23 +20,24 @@ import okhttp3.Call import okhttp3.HttpUrl import io.batteryapi.models.EmulateMessageToWalletRequest -import io.batteryapi.models.GetTonConnectPayloadDefaultResponse - -import com.squareup.moshi.Json - -import io.batteryapi.infrastructure.ApiClient -import io.batteryapi.infrastructure.ApiResponse -import io.batteryapi.infrastructure.ClientException -import io.batteryapi.infrastructure.ClientError -import io.batteryapi.infrastructure.ServerException -import io.batteryapi.infrastructure.ServerError -import io.batteryapi.infrastructure.MultiValueMap -import io.batteryapi.infrastructure.PartConfig -import io.batteryapi.infrastructure.RequestConfig -import io.batteryapi.infrastructure.RequestMethod -import io.batteryapi.infrastructure.ResponseType -import io.batteryapi.infrastructure.Success -import io.batteryapi.infrastructure.toMultiValue +import io.batteryapi.models.InlineObject + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +import io.infrastructure.ApiClient +import io.infrastructure.ApiResponse +import io.infrastructure.ClientException +import io.infrastructure.ClientError +import io.infrastructure.ServerException +import io.infrastructure.ServerError +import io.infrastructure.MultiValueMap +import io.infrastructure.PartConfig +import io.infrastructure.RequestConfig +import io.infrastructure.RequestMethod +import io.infrastructure.ResponseType +import io.infrastructure.Success +import io.infrastructure.toMultiValue class EmulationApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory = ApiClient.defaultClient) : ApiClient(basePath, client) { companion object { @@ -46,27 +47,13 @@ class EmulationApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto } } - /** - * POST /wallet/emulate - * - * Emulate sending message to blockchain - * @param xTonConnectAuth - * @param emulateMessageToWalletRequest bag-of-cells serialized to base64 - * @param acceptLanguage (optional, default to "en") - * @return kotlin.collections.Map - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun emulateMessageToWallet(xTonConnectAuth: kotlin.String, emulateMessageToWalletRequest: EmulateMessageToWalletRequest, acceptLanguage: kotlin.String? = "en") : kotlin.collections.Map { - val localVarResponse = emulateMessageToWalletWithHttpInfo(xTonConnectAuth = xTonConnectAuth, emulateMessageToWalletRequest = emulateMessageToWalletRequest, acceptLanguage = acceptLanguage) + fun emulateMessageToWallet(xTonConnectAuth: kotlin.String, emulateMessageToWalletRequest: EmulateMessageToWalletRequest, acceptLanguage: kotlin.String? = "en", enableValidation: kotlin.Boolean? = false) : kotlin.collections.Map { + val localVarResponse = emulateMessageToWalletWithHttpInfo(xTonConnectAuth = xTonConnectAuth, emulateMessageToWalletRequest = emulateMessageToWalletRequest, acceptLanguage = acceptLanguage, enableValidation = enableValidation) return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.Map + ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.Map ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") ResponseType.ClientError -> { @@ -80,38 +67,24 @@ class EmulationApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto } } - /** - * POST /wallet/emulate - * - * Emulate sending message to blockchain - * @param xTonConnectAuth - * @param emulateMessageToWalletRequest bag-of-cells serialized to base64 - * @param acceptLanguage (optional, default to "en") - * @return ApiResponse?> - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun emulateMessageToWalletWithHttpInfo(xTonConnectAuth: kotlin.String, emulateMessageToWalletRequest: EmulateMessageToWalletRequest, acceptLanguage: kotlin.String?) : ApiResponse?> { - val localVariableConfig = emulateMessageToWalletRequestConfig(xTonConnectAuth = xTonConnectAuth, emulateMessageToWalletRequest = emulateMessageToWalletRequest, acceptLanguage = acceptLanguage) + fun emulateMessageToWalletWithHttpInfo(xTonConnectAuth: kotlin.String, emulateMessageToWalletRequest: EmulateMessageToWalletRequest, acceptLanguage: kotlin.String?, enableValidation: kotlin.Boolean?) : ApiResponse?> { + val localVariableConfig = emulateMessageToWalletRequestConfig(xTonConnectAuth = xTonConnectAuth, emulateMessageToWalletRequest = emulateMessageToWalletRequest, acceptLanguage = acceptLanguage, enableValidation = enableValidation) - return request>( + return request>( localVariableConfig ) } - /** - * To obtain the request config of the operation emulateMessageToWallet - * - * @param xTonConnectAuth - * @param emulateMessageToWalletRequest bag-of-cells serialized to base64 - * @param acceptLanguage (optional, default to "en") - * @return RequestConfig - */ - fun emulateMessageToWalletRequestConfig(xTonConnectAuth: kotlin.String, emulateMessageToWalletRequest: EmulateMessageToWalletRequest, acceptLanguage: kotlin.String?) : RequestConfig { + fun emulateMessageToWalletRequestConfig(xTonConnectAuth: kotlin.String, emulateMessageToWalletRequest: EmulateMessageToWalletRequest, acceptLanguage: kotlin.String?, enableValidation: kotlin.Boolean?) : RequestConfig { val localVariableBody = emulateMessageToWalletRequest - val localVariableQuery: MultiValueMap = mutableMapOf() + val localVariableQuery: MultiValueMap = mutableMapOf>() + .apply { + if (enableValidation != null) { + put("enable_validation", listOf(enableValidation.toString())) + } + } val localVariableHeaders: MutableMap = mutableMapOf() acceptLanguage?.apply { localVariableHeaders["Accept-Language"] = this.toString() } xTonConnectAuth.apply { localVariableHeaders["X-TonConnect-Auth"] = this.toString() } @@ -128,25 +101,13 @@ class EmulationApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto ) } - /** - * GET /jetton-metadata/{name}.json - * - * - * @param name - * @return kotlin.collections.Map - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getJettonMetadata(name: kotlin.String) : kotlin.collections.Map { + fun getJettonMetadata(name: kotlin.String) : kotlin.collections.Map { val localVarResponse = getJettonMetadataWithHttpInfo(name = name) return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.Map + ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.Map ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") ResponseType.ClientError -> { @@ -160,31 +121,16 @@ class EmulationApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto } } - /** - * GET /jetton-metadata/{name}.json - * - * - * @param name - * @return ApiResponse?> - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun getJettonMetadataWithHttpInfo(name: kotlin.String) : ApiResponse?> { + fun getJettonMetadataWithHttpInfo(name: kotlin.String) : ApiResponse?> { val localVariableConfig = getJettonMetadataRequestConfig(name = name) - return request>( + return request>( localVariableConfig ) } - /** - * To obtain the request config of the operation getJettonMetadata - * - * @param name - * @return RequestConfig - */ fun getJettonMetadataRequestConfig(name: kotlin.String) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() diff --git a/tonapi/src/main/kotlin/io/batteryapi/apis/WalletApi.kt b/tonapi/src/main/kotlin/io/batteryapi/apis/WalletApi.kt index 4814347e1..accf86316 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/apis/WalletApi.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/apis/WalletApi.kt @@ -19,25 +19,26 @@ import java.io.IOException import okhttp3.Call import okhttp3.HttpUrl -import io.batteryapi.models.GetTonConnectPayloadDefaultResponse +import io.batteryapi.models.InlineObject import io.batteryapi.models.TonConnectProof200Response import io.batteryapi.models.TonConnectProofRequest -import com.squareup.moshi.Json +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable -import io.batteryapi.infrastructure.ApiClient -import io.batteryapi.infrastructure.ApiResponse -import io.batteryapi.infrastructure.ClientException -import io.batteryapi.infrastructure.ClientError -import io.batteryapi.infrastructure.ServerException -import io.batteryapi.infrastructure.ServerError -import io.batteryapi.infrastructure.MultiValueMap -import io.batteryapi.infrastructure.PartConfig -import io.batteryapi.infrastructure.RequestConfig -import io.batteryapi.infrastructure.RequestMethod -import io.batteryapi.infrastructure.ResponseType -import io.batteryapi.infrastructure.Success -import io.batteryapi.infrastructure.toMultiValue +import io.infrastructure.ApiClient +import io.infrastructure.ApiResponse +import io.infrastructure.ClientException +import io.infrastructure.ClientError +import io.infrastructure.ServerException +import io.infrastructure.ServerError +import io.infrastructure.MultiValueMap +import io.infrastructure.PartConfig +import io.infrastructure.RequestConfig +import io.infrastructure.RequestMethod +import io.infrastructure.ResponseType +import io.infrastructure.Success +import io.infrastructure.toMultiValue class WalletApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory = ApiClient.defaultClient) : ApiClient(basePath, client) { companion object { @@ -47,18 +48,6 @@ class WalletApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory } } - /** - * POST /tonconnect/proof - * - * Account verification and token issuance - * @param tonConnectProofRequest Data that is expected from TON Connect - * @return TonConnectProof200Response - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun tonConnectProof(tonConnectProofRequest: TonConnectProofRequest) : TonConnectProof200Response { @@ -79,15 +68,6 @@ class WalletApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory } } - /** - * POST /tonconnect/proof - * - * Account verification and token issuance - * @param tonConnectProofRequest Data that is expected from TON Connect - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun tonConnectProofWithHttpInfo(tonConnectProofRequest: TonConnectProofRequest) : ApiResponse { @@ -98,12 +78,6 @@ class WalletApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory ) } - /** - * To obtain the request config of the operation tonConnectProof - * - * @param tonConnectProofRequest Data that is expected from TON Connect - * @return RequestConfig - */ fun tonConnectProofRequestConfig(tonConnectProofRequest: TonConnectProofRequest) : RequestConfig { val localVariableBody = tonConnectProofRequest val localVariableQuery: MultiValueMap = mutableMapOf() diff --git a/tonapi/src/main/kotlin/io/batteryapi/infrastructure/BigDecimalAdapter.kt b/tonapi/src/main/kotlin/io/batteryapi/infrastructure/BigDecimalAdapter.kt deleted file mode 100644 index fc838489e..000000000 --- a/tonapi/src/main/kotlin/io/batteryapi/infrastructure/BigDecimalAdapter.kt +++ /dev/null @@ -1,17 +0,0 @@ -package io.batteryapi.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.math.BigDecimal - -class BigDecimalAdapter { - @ToJson - fun toJson(value: BigDecimal): String { - return value.toPlainString() - } - - @FromJson - fun fromJson(value: String): BigDecimal { - return BigDecimal(value) - } -} diff --git a/tonapi/src/main/kotlin/io/batteryapi/infrastructure/BigIntegerAdapter.kt b/tonapi/src/main/kotlin/io/batteryapi/infrastructure/BigIntegerAdapter.kt deleted file mode 100644 index 374f9fba6..000000000 --- a/tonapi/src/main/kotlin/io/batteryapi/infrastructure/BigIntegerAdapter.kt +++ /dev/null @@ -1,17 +0,0 @@ -package io.batteryapi.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.math.BigInteger - -class BigIntegerAdapter { - @ToJson - fun toJson(value: BigInteger): String { - return value.toString() - } - - @FromJson - fun fromJson(value: String): BigInteger { - return BigInteger(value) - } -} diff --git a/tonapi/src/main/kotlin/io/batteryapi/infrastructure/ByteArrayAdapter.kt b/tonapi/src/main/kotlin/io/batteryapi/infrastructure/ByteArrayAdapter.kt deleted file mode 100644 index 42aa4cfa7..000000000 --- a/tonapi/src/main/kotlin/io/batteryapi/infrastructure/ByteArrayAdapter.kt +++ /dev/null @@ -1,12 +0,0 @@ -package io.batteryapi.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson - -class ByteArrayAdapter { - @ToJson - fun toJson(data: ByteArray): String = String(data) - - @FromJson - fun fromJson(data: String): ByteArray = data.toByteArray() -} diff --git a/tonapi/src/main/kotlin/io/batteryapi/infrastructure/Errors.kt b/tonapi/src/main/kotlin/io/batteryapi/infrastructure/Errors.kt deleted file mode 100644 index a64ba33f3..000000000 --- a/tonapi/src/main/kotlin/io/batteryapi/infrastructure/Errors.kt +++ /dev/null @@ -1,18 +0,0 @@ -@file:Suppress("unused") -package io.batteryapi.infrastructure - -import java.lang.RuntimeException - -open class ClientException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) { - - companion object { - private const val serialVersionUID: Long = 123L - } -} - -open class ServerException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) { - - companion object { - private const val serialVersionUID: Long = 456L - } -} diff --git a/tonapi/src/main/kotlin/io/batteryapi/infrastructure/LocalDateAdapter.kt b/tonapi/src/main/kotlin/io/batteryapi/infrastructure/LocalDateAdapter.kt deleted file mode 100644 index 03fca3572..000000000 --- a/tonapi/src/main/kotlin/io/batteryapi/infrastructure/LocalDateAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package io.batteryapi.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.LocalDate -import java.time.format.DateTimeFormatter - -class LocalDateAdapter { - @ToJson - fun toJson(value: LocalDate): String { - return DateTimeFormatter.ISO_LOCAL_DATE.format(value) - } - - @FromJson - fun fromJson(value: String): LocalDate { - return LocalDate.parse(value, DateTimeFormatter.ISO_LOCAL_DATE) - } - -} diff --git a/tonapi/src/main/kotlin/io/batteryapi/infrastructure/LocalDateTimeAdapter.kt b/tonapi/src/main/kotlin/io/batteryapi/infrastructure/LocalDateTimeAdapter.kt deleted file mode 100644 index 3520c7c07..000000000 --- a/tonapi/src/main/kotlin/io/batteryapi/infrastructure/LocalDateTimeAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package io.batteryapi.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.LocalDateTime -import java.time.format.DateTimeFormatter - -class LocalDateTimeAdapter { - @ToJson - fun toJson(value: LocalDateTime): String { - return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(value) - } - - @FromJson - fun fromJson(value: String): LocalDateTime { - return LocalDateTime.parse(value, DateTimeFormatter.ISO_LOCAL_DATE_TIME) - } - -} diff --git a/tonapi/src/main/kotlin/io/batteryapi/infrastructure/OffsetDateTimeAdapter.kt b/tonapi/src/main/kotlin/io/batteryapi/infrastructure/OffsetDateTimeAdapter.kt deleted file mode 100644 index 6f867a2a1..000000000 --- a/tonapi/src/main/kotlin/io/batteryapi/infrastructure/OffsetDateTimeAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package io.batteryapi.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter - -class OffsetDateTimeAdapter { - @ToJson - fun toJson(value: OffsetDateTime): String { - return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value) - } - - @FromJson - fun fromJson(value: String): OffsetDateTime { - return OffsetDateTime.parse(value, DateTimeFormatter.ISO_OFFSET_DATE_TIME) - } - -} diff --git a/tonapi/src/main/kotlin/io/batteryapi/infrastructure/PartConfig.kt b/tonapi/src/main/kotlin/io/batteryapi/infrastructure/PartConfig.kt deleted file mode 100644 index eee5f0b93..000000000 --- a/tonapi/src/main/kotlin/io/batteryapi/infrastructure/PartConfig.kt +++ /dev/null @@ -1,11 +0,0 @@ -package io.batteryapi.infrastructure - -/** - * Defines a config object for a given part of a multi-part request. - * NOTE: Headers is a Map because rfc2616 defines - * multi-valued headers as csv-only. - */ -data class PartConfig( - val headers: MutableMap = mutableMapOf(), - val body: T? = null -) diff --git a/tonapi/src/main/kotlin/io/batteryapi/infrastructure/RequestMethod.kt b/tonapi/src/main/kotlin/io/batteryapi/infrastructure/RequestMethod.kt deleted file mode 100644 index a8466c3fe..000000000 --- a/tonapi/src/main/kotlin/io/batteryapi/infrastructure/RequestMethod.kt +++ /dev/null @@ -1,8 +0,0 @@ -package io.batteryapi.infrastructure - -/** - * Provides enumerated HTTP verbs - */ -enum class RequestMethod { - GET, DELETE, HEAD, OPTIONS, PATCH, POST, PUT -} diff --git a/tonapi/src/main/kotlin/io/batteryapi/infrastructure/ResponseExtensions.kt b/tonapi/src/main/kotlin/io/batteryapi/infrastructure/ResponseExtensions.kt deleted file mode 100644 index 1c454c0d8..000000000 --- a/tonapi/src/main/kotlin/io/batteryapi/infrastructure/ResponseExtensions.kt +++ /dev/null @@ -1,24 +0,0 @@ -package io.batteryapi.infrastructure - -import okhttp3.Response - -/** - * Provides an extension to evaluation whether the response is a 1xx code - */ -val Response.isInformational : Boolean get() = this.code in 100..199 - -/** - * Provides an extension to evaluation whether the response is a 3xx code - */ -@Suppress("EXTENSION_SHADOWED_BY_MEMBER") -val Response.isRedirect : Boolean get() = this.code in 300..399 - -/** - * Provides an extension to evaluation whether the response is a 4xx code - */ -val Response.isClientError : Boolean get() = this.code in 400..499 - -/** - * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code - */ -val Response.isServerError : Boolean get() = this.code in 500..999 diff --git a/tonapi/src/main/kotlin/io/batteryapi/infrastructure/Serializer.kt b/tonapi/src/main/kotlin/io/batteryapi/infrastructure/Serializer.kt deleted file mode 100644 index 39d9f9293..000000000 --- a/tonapi/src/main/kotlin/io/batteryapi/infrastructure/Serializer.kt +++ /dev/null @@ -1,23 +0,0 @@ -package io.batteryapi.infrastructure - -import com.squareup.moshi.Moshi -import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory - -object Serializer { - @JvmStatic - val moshiBuilder: Moshi.Builder = Moshi.Builder() - .add(OffsetDateTimeAdapter()) - .add(LocalDateTimeAdapter()) - .add(LocalDateAdapter()) - .add(UUIDAdapter()) - .add(ByteArrayAdapter()) - .add(URIAdapter()) - .add(KotlinJsonAdapterFactory()) - .add(BigDecimalAdapter()) - .add(BigIntegerAdapter()) - - @JvmStatic - val moshi: Moshi by lazy { - moshiBuilder.build() - } -} diff --git a/tonapi/src/main/kotlin/io/batteryapi/infrastructure/URIAdapter.kt b/tonapi/src/main/kotlin/io/batteryapi/infrastructure/URIAdapter.kt deleted file mode 100644 index d7f761568..000000000 --- a/tonapi/src/main/kotlin/io/batteryapi/infrastructure/URIAdapter.kt +++ /dev/null @@ -1,13 +0,0 @@ -package io.batteryapi.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.net.URI - -class URIAdapter { - @ToJson - fun toJson(uri: URI): String = uri.toString() - - @FromJson - fun fromJson(s: String): URI = URI.create(s) -} diff --git a/tonapi/src/main/kotlin/io/batteryapi/infrastructure/UUIDAdapter.kt b/tonapi/src/main/kotlin/io/batteryapi/infrastructure/UUIDAdapter.kt deleted file mode 100644 index 4ff8f621b..000000000 --- a/tonapi/src/main/kotlin/io/batteryapi/infrastructure/UUIDAdapter.kt +++ /dev/null @@ -1,13 +0,0 @@ -package io.batteryapi.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.util.UUID - -class UUIDAdapter { - @ToJson - fun toJson(uuid: UUID): String = uuid.toString() - - @FromJson - fun fromJson(s: String): UUID = UUID.fromString(s) -} diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/AndroidBatteryPurchaseRequest.kt b/tonapi/src/main/kotlin/io/batteryapi/models/AndroidBatteryPurchaseRequest.kt index 3d99d4a72..2457a9a46 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/AndroidBatteryPurchaseRequest.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/AndroidBatteryPurchaseRequest.kt @@ -17,19 +17,16 @@ package io.batteryapi.models import io.batteryapi.models.AndroidBatteryPurchaseRequestPurchasesInner -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param purchases - */ +@Serializable data class AndroidBatteryPurchaseRequest ( - @Json(name = "purchases") + @SerialName(value = "purchases") val purchases: kotlin.collections.List ) { diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/AndroidBatteryPurchaseRequestPurchasesInner.kt b/tonapi/src/main/kotlin/io/batteryapi/models/AndroidBatteryPurchaseRequestPurchasesInner.kt index e558324c4..6c81e740d 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/AndroidBatteryPurchaseRequestPurchasesInner.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/AndroidBatteryPurchaseRequestPurchasesInner.kt @@ -16,27 +16,22 @@ package io.batteryapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param token - * @param productId - * @param promo - */ +@Serializable data class AndroidBatteryPurchaseRequestPurchasesInner ( - @Json(name = "token") + @SerialName(value = "token") val token: kotlin.String, - @Json(name = "product_id") + @SerialName(value = "product_id") val productId: kotlin.String, - @Json(name = "promo") + @SerialName(value = "promo") val promo: kotlin.String? = null ) { diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/AndroidBatteryPurchaseStatus.kt b/tonapi/src/main/kotlin/io/batteryapi/models/AndroidBatteryPurchaseStatus.kt index c05509c8d..e2e1f7a2e 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/AndroidBatteryPurchaseStatus.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/AndroidBatteryPurchaseStatus.kt @@ -17,19 +17,16 @@ package io.batteryapi.models import io.batteryapi.models.AndroidBatteryPurchaseStatusPurchasesInner -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param purchases - */ +@Serializable data class AndroidBatteryPurchaseStatus ( - @Json(name = "purchases") + @SerialName(value = "purchases") val purchases: kotlin.collections.List ) { diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/AndroidBatteryPurchaseStatusPurchasesInner.kt b/tonapi/src/main/kotlin/io/batteryapi/models/AndroidBatteryPurchaseStatusPurchasesInner.kt index e76d03f8f..a31c26fee 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/AndroidBatteryPurchaseStatusPurchasesInner.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/AndroidBatteryPurchaseStatusPurchasesInner.kt @@ -17,31 +17,25 @@ package io.batteryapi.models import io.batteryapi.models.AndroidBatteryPurchaseStatusPurchasesInnerError -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param productId - * @param token - * @param success - * @param error - */ +@Serializable data class AndroidBatteryPurchaseStatusPurchasesInner ( - @Json(name = "product_id") + @SerialName(value = "product_id") val productId: kotlin.String, - @Json(name = "token") + @SerialName(value = "token") val token: kotlin.String, - @Json(name = "success") + @SerialName(value = "success") val success: kotlin.Boolean, - @Json(name = "error") + @SerialName(value = "error") val error: AndroidBatteryPurchaseStatusPurchasesInnerError? = null ) { diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/AndroidBatteryPurchaseStatusPurchasesInnerError.kt b/tonapi/src/main/kotlin/io/batteryapi/models/AndroidBatteryPurchaseStatusPurchasesInnerError.kt index 8fb814156..010aee49f 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/AndroidBatteryPurchaseStatusPurchasesInnerError.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/AndroidBatteryPurchaseStatusPurchasesInnerError.kt @@ -16,23 +16,19 @@ package io.batteryapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param msg - * @param code - */ +@Serializable data class AndroidBatteryPurchaseStatusPurchasesInnerError ( - @Json(name = "msg") + @SerialName(value = "msg") val msg: kotlin.String, - @Json(name = "code") + @SerialName(value = "code") val code: AndroidBatteryPurchaseStatusPurchasesInnerError.Code ) { @@ -42,13 +38,13 @@ data class AndroidBatteryPurchaseStatusPurchasesInnerError ( * * Values: invalidMinusProductMinusId,userMinusNotMinusFound,purchaseMinusIsMinusAlreadyMinusUsed,temporaryMinusError,unknown */ - @JsonClass(generateAdapter = false) + @Serializable enum class Code(val value: kotlin.String) { - @Json(name = "invalid-product-id") invalidMinusProductMinusId("invalid-product-id"), - @Json(name = "user-not-found") userMinusNotMinusFound("user-not-found"), - @Json(name = "purchase-is-already-used") purchaseMinusIsMinusAlreadyMinusUsed("purchase-is-already-used"), - @Json(name = "temporary-error") temporaryMinusError("temporary-error"), - @Json(name = "unknown") unknown("unknown"); + @SerialName(value = "invalid-product-id") invalidMinusProductMinusId("invalid-product-id"), + @SerialName(value = "user-not-found") userMinusNotMinusFound("user-not-found"), + @SerialName(value = "purchase-is-already-used") purchaseMinusIsMinusAlreadyMinusUsed("purchase-is-already-used"), + @SerialName(value = "temporary-error") temporaryMinusError("temporary-error"), + @SerialName(value = "unknown") unknown("unknown"); } } diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/AppStoreNotificationRequest.kt b/tonapi/src/main/kotlin/io/batteryapi/models/AppStoreNotificationRequest.kt index 31a89c08f..52723572a 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/AppStoreNotificationRequest.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/AppStoreNotificationRequest.kt @@ -16,19 +16,16 @@ package io.batteryapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param signedPayload - */ +@Serializable data class AppStoreNotificationRequest ( - @Json(name = "signedPayload") + @SerialName(value = "signedPayload") val signedPayload: kotlin.String ) { diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/ApplyPromoRequest.kt b/tonapi/src/main/kotlin/io/batteryapi/models/ApplyPromoRequest.kt index c9df47e04..aa2f1e709 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/ApplyPromoRequest.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/ApplyPromoRequest.kt @@ -16,23 +16,19 @@ package io.batteryapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param publicKey - * @param promoCode - */ +@Serializable data class ApplyPromoRequest ( - @Json(name = "public_key") + @SerialName(value = "public_key") val publicKey: kotlin.String, - @Json(name = "promo_code") + @SerialName(value = "promo_code") val promoCode: kotlin.String ) { diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/Balance.kt b/tonapi/src/main/kotlin/io/batteryapi/models/Balance.kt index 1bef4641a..3282e2fe5 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/Balance.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/Balance.kt @@ -16,28 +16,23 @@ package io.batteryapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param balance - * @param reserved reserved amount in units (TON/USD) - * @param units - */ +@Serializable data class Balance ( - @Json(name = "balance") + @SerialName(value = "balance") val balance: kotlin.String, /* reserved amount in units (TON/USD) */ - @Json(name = "reserved") + @SerialName(value = "reserved") val reserved: kotlin.String, - @Json(name = "units") + @SerialName(value = "units") val units: Balance.Units ) { @@ -47,10 +42,10 @@ data class Balance ( * * Values: usd,ton */ - @JsonClass(generateAdapter = false) + @Serializable enum class Units(val value: kotlin.String) { - @Json(name = "usd") usd("usd"), - @Json(name = "ton") ton("ton"); + @SerialName(value = "usd") usd("usd"), + @SerialName(value = "ton") ton("ton"); } } diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/BatteryCharged.kt b/tonapi/src/main/kotlin/io/batteryapi/models/BatteryCharged.kt index a43b1accf..987024408 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/BatteryCharged.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/BatteryCharged.kt @@ -16,19 +16,16 @@ package io.batteryapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param batteryCharged - */ +@Serializable data class BatteryCharged ( - @Json(name = "battery_charged") + @SerialName(value = "battery_charged") val batteryCharged: kotlin.Boolean ) { diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/Config.kt b/tonapi/src/main/kotlin/io/batteryapi/models/Config.kt index b01df59d4..74ed33beb 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/Config.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/Config.kt @@ -18,43 +18,35 @@ package io.batteryapi.models import io.batteryapi.models.ConfigGasProxyInner import io.batteryapi.models.ConfigMeanPrices -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param chargeCost cost of 1 charge in TON - * @param fundReceiver with zero balance it is possible to transfer some jettons (stablecoins, jusdt, etc) to this address to refill the balance. Such transfers would be paid by Battery Service. - * @param excessAccount when building a message to transfer an NFT or Jetton, use this address to send excess funds back to Battery Service. - * @param messageTtl ttl for message in seconds - * @param gasProxy - * @param meanPrices - */ +@Serializable data class Config ( /* cost of 1 charge in TON */ - @Json(name = "charge_cost") + @SerialName(value = "charge_cost") val chargeCost: kotlin.String, /* with zero balance it is possible to transfer some jettons (stablecoins, jusdt, etc) to this address to refill the balance. Such transfers would be paid by Battery Service. */ - @Json(name = "fund_receiver") + @SerialName(value = "fund_receiver") val fundReceiver: kotlin.String, /* when building a message to transfer an NFT or Jetton, use this address to send excess funds back to Battery Service. */ - @Json(name = "excess_account") + @SerialName(value = "excess_account") val excessAccount: kotlin.String, /* ttl for message in seconds */ - @Json(name = "message_ttl") + @SerialName(value = "message_ttl") val messageTtl: kotlin.Int, - @Json(name = "gas_proxy") + @SerialName(value = "gas_proxy") val gasProxy: kotlin.collections.List, - @Json(name = "mean_prices") + @SerialName(value = "mean_prices") val meanPrices: ConfigMeanPrices ) { diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/ConfigGasProxyInner.kt b/tonapi/src/main/kotlin/io/batteryapi/models/ConfigGasProxyInner.kt index aa8db9ddc..6a1eeed57 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/ConfigGasProxyInner.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/ConfigGasProxyInner.kt @@ -16,19 +16,16 @@ package io.batteryapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param address - */ +@Serializable data class ConfigGasProxyInner ( - @Json(name = "address") + @SerialName(value = "address") val address: kotlin.String ) { diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/ConfigMeanPrices.kt b/tonapi/src/main/kotlin/io/batteryapi/models/ConfigMeanPrices.kt index b09515cea..807168198 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/ConfigMeanPrices.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/ConfigMeanPrices.kt @@ -16,31 +16,25 @@ package io.batteryapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param batteryMeanPriceSwap - * @param batteryMeanPriceJetton - * @param batteryMeanPriceNft - * @param batteryMeanPriceTronUsdt - */ +@Serializable data class ConfigMeanPrices ( - @Json(name = "battery_mean_price_swap") + @SerialName(value = "battery_mean_price_swap") val batteryMeanPriceSwap: kotlin.Int, - @Json(name = "battery_mean_price_jetton") + @SerialName(value = "battery_mean_price_jetton") val batteryMeanPriceJetton: kotlin.Int, - @Json(name = "battery_mean_price_nft") + @SerialName(value = "battery_mean_price_nft") val batteryMeanPriceNft: kotlin.Int, - @Json(name = "battery_mean_price_tron_usdt") + @SerialName(value = "battery_mean_price_tron_usdt") val batteryMeanPriceTronUsdt: kotlin.Int? = null ) { diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/CreateCustomRefundRequest.kt b/tonapi/src/main/kotlin/io/batteryapi/models/CreateCustomRefundRequest.kt index d25bd7161..3c0b75ddb 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/CreateCustomRefundRequest.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/CreateCustomRefundRequest.kt @@ -16,39 +16,31 @@ package io.batteryapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param amount - * @param currency - * @param comment - * @param reason - * @param destination - * @param relayerEventId - */ +@Serializable data class CreateCustomRefundRequest ( - @Json(name = "amount") + @SerialName(value = "amount") val amount: kotlin.String, - @Json(name = "currency") + @SerialName(value = "currency") val currency: kotlin.String, - @Json(name = "comment") + @SerialName(value = "comment") val comment: kotlin.String, - @Json(name = "reason") + @SerialName(value = "reason") val reason: kotlin.String, - @Json(name = "destination") + @SerialName(value = "destination") val destination: kotlin.String, - @Json(name = "relayer_event_id") + @SerialName(value = "relayer_event_id") val relayerEventId: kotlin.Int? = null ) { diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/CreatePromoCampaign200Response.kt b/tonapi/src/main/kotlin/io/batteryapi/models/CreatePromoCampaign200Response.kt index 365a98fa6..4fc04afbf 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/CreatePromoCampaign200Response.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/CreatePromoCampaign200Response.kt @@ -17,19 +17,16 @@ package io.batteryapi.models import io.batteryapi.models.CreatePromoCampaign200ResponseParticipantsInner -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param participants - */ +@Serializable data class CreatePromoCampaign200Response ( - @Json(name = "participants") + @SerialName(value = "participants") val participants: kotlin.collections.List ) { diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/CreatePromoCampaign200ResponseParticipantsInner.kt b/tonapi/src/main/kotlin/io/batteryapi/models/CreatePromoCampaign200ResponseParticipantsInner.kt index 54f47aaba..23813ba66 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/CreatePromoCampaign200ResponseParticipantsInner.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/CreatePromoCampaign200ResponseParticipantsInner.kt @@ -16,27 +16,22 @@ package io.batteryapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param address - * @param balanceIncreased - * @param error - */ +@Serializable data class CreatePromoCampaign200ResponseParticipantsInner ( - @Json(name = "address") + @SerialName(value = "address") val address: kotlin.String, - @Json(name = "balance_increased") + @SerialName(value = "balance_increased") val balanceIncreased: kotlin.String? = null, - @Json(name = "error") + @SerialName(value = "error") val error: kotlin.String? = null ) { diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/CreatePromoCampaignRequest.kt b/tonapi/src/main/kotlin/io/batteryapi/models/CreatePromoCampaignRequest.kt index cda572ba6..c84b0d098 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/CreatePromoCampaignRequest.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/CreatePromoCampaignRequest.kt @@ -17,23 +17,19 @@ package io.batteryapi.models import io.batteryapi.models.CreatePromoCampaignRequestParticipantsInner -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param name - * @param participants - */ +@Serializable data class CreatePromoCampaignRequest ( - @Json(name = "name") + @SerialName(value = "name") val name: kotlin.String, - @Json(name = "participants") + @SerialName(value = "participants") val participants: kotlin.collections.List ) { diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/CreatePromoCampaignRequestParticipantsInner.kt b/tonapi/src/main/kotlin/io/batteryapi/models/CreatePromoCampaignRequestParticipantsInner.kt index 81f6d8355..745915334 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/CreatePromoCampaignRequestParticipantsInner.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/CreatePromoCampaignRequestParticipantsInner.kt @@ -16,24 +16,20 @@ package io.batteryapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param address - * @param amount amount in TON - */ +@Serializable data class CreatePromoCampaignRequestParticipantsInner ( - @Json(name = "address") + @SerialName(value = "address") val address: kotlin.String, /* amount in TON */ - @Json(name = "amount") + @SerialName(value = "amount") val amount: kotlin.String ) { diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/EmulateMessageToWalletRequest.kt b/tonapi/src/main/kotlin/io/batteryapi/models/EmulateMessageToWalletRequest.kt index 2c0e44410..0f076838e 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/EmulateMessageToWalletRequest.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/EmulateMessageToWalletRequest.kt @@ -16,19 +16,16 @@ package io.batteryapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param boc - */ +@Serializable data class EmulateMessageToWalletRequest ( - @Json(name = "boc") + @SerialName(value = "boc") val boc: kotlin.String ) { diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/EnterpriseEstimate200Response.kt b/tonapi/src/main/kotlin/io/batteryapi/models/EnterpriseEstimate200Response.kt index 013b3ebc0..8a40698ff 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/EnterpriseEstimate200Response.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/EnterpriseEstimate200Response.kt @@ -16,24 +16,20 @@ package io.batteryapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param estimatedUpfrontPayment - * @param emulation base64 encoded emulation results. The exact type can be taken from /v2/wallet/emulate (TONAPI). - */ +@Serializable data class EnterpriseEstimate200Response ( - @Json(name = "estimated_upfront_payment") + @SerialName(value = "estimated_upfront_payment") val estimatedUpfrontPayment: kotlin.String, /* base64 encoded emulation results. The exact type can be taken from /v2/wallet/emulate (TONAPI). */ - @Json(name = "emulation") + @SerialName(value = "emulation") val emulation: kotlin.String? = null ) { diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/EnterpriseEstimateRequest.kt b/tonapi/src/main/kotlin/io/batteryapi/models/EnterpriseEstimateRequest.kt index e5bf04083..55be8fd65 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/EnterpriseEstimateRequest.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/EnterpriseEstimateRequest.kt @@ -16,23 +16,19 @@ package io.batteryapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param boc - * @param walletPublicKey - */ +@Serializable data class EnterpriseEstimateRequest ( - @Json(name = "boc") + @SerialName(value = "boc") val boc: kotlin.String, - @Json(name = "wallet_public_key") + @SerialName(value = "wallet_public_key") val walletPublicKey: kotlin.String ) { diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/EnterpriseGetMessage200Response.kt b/tonapi/src/main/kotlin/io/batteryapi/models/EnterpriseGetMessage200Response.kt index 253795a7a..a4f5768ea 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/EnterpriseGetMessage200Response.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/EnterpriseGetMessage200Response.kt @@ -16,35 +16,28 @@ package io.batteryapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param status - * @param paymentTxHash - * @param committedTxHash - * @param finalCost - * @param failedReason - */ +@Serializable data class EnterpriseGetMessage200Response ( - @Json(name = "status") + @SerialName(value = "status") val status: EnterpriseGetMessage200Response.Status, - @Json(name = "payment_tx_hash") + @SerialName(value = "payment_tx_hash") val paymentTxHash: kotlin.String? = null, - @Json(name = "committed_tx_hash") + @SerialName(value = "committed_tx_hash") val committedTxHash: kotlin.String? = null, - @Json(name = "final_cost") + @SerialName(value = "final_cost") val finalCost: kotlin.String? = null, - @Json(name = "failed_reason") + @SerialName(value = "failed_reason") val failedReason: kotlin.String? = null ) { @@ -54,11 +47,11 @@ data class EnterpriseGetMessage200Response ( * * Values: pending,completed,failed */ - @JsonClass(generateAdapter = false) + @Serializable enum class Status(val value: kotlin.String) { - @Json(name = "pending") pending("pending"), - @Json(name = "completed") completed("completed"), - @Json(name = "failed") failed("failed"); + @SerialName(value = "pending") pending("pending"), + @SerialName(value = "completed") completed("completed"), + @SerialName(value = "failed") failed("failed"); } } diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/EnterpriseGetStatus200Response.kt b/tonapi/src/main/kotlin/io/batteryapi/models/EnterpriseGetStatus200Response.kt index d3a7e7b77..bca3a3a04 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/EnterpriseGetStatus200Response.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/EnterpriseGetStatus200Response.kt @@ -16,23 +16,19 @@ package io.batteryapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param balance - * @param wallet - */ +@Serializable data class EnterpriseGetStatus200Response ( - @Json(name = "balance") + @SerialName(value = "balance") val balance: kotlin.String, - @Json(name = "wallet") + @SerialName(value = "wallet") val wallet: kotlin.String ) { diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/EnterpriseSend200Response.kt b/tonapi/src/main/kotlin/io/batteryapi/models/EnterpriseSend200Response.kt index 839c4a207..fd89b397b 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/EnterpriseSend200Response.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/EnterpriseSend200Response.kt @@ -16,19 +16,16 @@ package io.batteryapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param msgId - */ +@Serializable data class EnterpriseSend200Response ( - @Json(name = "msg_id") + @SerialName(value = "msg_id") val msgId: kotlin.String ) { diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/EnterpriseWalletConfig.kt b/tonapi/src/main/kotlin/io/batteryapi/models/EnterpriseWalletConfig.kt index c321b0a38..5e82165b5 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/EnterpriseWalletConfig.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/EnterpriseWalletConfig.kt @@ -16,20 +16,17 @@ package io.batteryapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param excessAccount when building a message to transfer an NFT or Jetton, use this address to send excess funds back to Battery Service. - */ +@Serializable data class EnterpriseWalletConfig ( /* when building a message to transfer an NFT or Jetton, use this address to send excess funds back to Battery Service. */ - @Json(name = "excess_account") + @SerialName(value = "excess_account") val excessAccount: kotlin.String ) { diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/Error.kt b/tonapi/src/main/kotlin/io/batteryapi/models/Error.kt index de7235beb..6ffb57567 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/Error.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/Error.kt @@ -16,19 +16,16 @@ package io.batteryapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param error - */ +@Serializable data class Error ( - @Json(name = "error") + @SerialName(value = "error") val error: kotlin.String ) { diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/EstimateGaslessCostRequest.kt b/tonapi/src/main/kotlin/io/batteryapi/models/EstimateGaslessCostRequest.kt index 55ba0092d..34c58a49c 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/EstimateGaslessCostRequest.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/EstimateGaslessCostRequest.kt @@ -16,23 +16,19 @@ package io.batteryapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param payload - * @param battery - */ +@Serializable data class EstimateGaslessCostRequest ( - @Json(name = "payload") + @SerialName(value = "payload") val payload: kotlin.String, - @Json(name = "battery") + @SerialName(value = "battery") val battery: kotlin.Boolean? = true ) { diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/EstimatedTronTx.kt b/tonapi/src/main/kotlin/io/batteryapi/models/EstimatedTronTx.kt index ecfebc316..d90e059d0 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/EstimatedTronTx.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/EstimatedTronTx.kt @@ -15,33 +15,31 @@ package io.batteryapi.models +import io.batteryapi.models.EstimatedTronTxInstantFee -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param energyCharges - * @param bandwidthCharges - * @param activationCharges - * @param totalCharges - */ +@Serializable data class EstimatedTronTx ( - @Json(name = "energy_charges") + @SerialName(value = "energy_charges") val energyCharges: kotlin.Int, - @Json(name = "bandwidth_charges") + @SerialName(value = "bandwidth_charges") val bandwidthCharges: kotlin.Int, - @Json(name = "activation_charges") + @SerialName(value = "activation_charges") val activationCharges: kotlin.Int, - @Json(name = "total_charges") - val totalCharges: kotlin.Int + @SerialName(value = "total_charges") + val totalCharges: kotlin.Int, + + @SerialName(value = "instant_fee") + val instantFee: EstimatedTronTxInstantFee ) { diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/EstimatedTronTxInstantFee.kt b/tonapi/src/main/kotlin/io/batteryapi/models/EstimatedTronTxInstantFee.kt new file mode 100644 index 000000000..58c6c8366 --- /dev/null +++ b/tonapi/src/main/kotlin/io/batteryapi/models/EstimatedTronTxInstantFee.kt @@ -0,0 +1,39 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package io.batteryapi.models + +import io.batteryapi.models.EstimatedTronTxInstantFeeAcceptedAssetsInner + +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual + + +@Serializable + +data class EstimatedTronTxInstantFee ( + + @SerialName(value = "fee_address") + val feeAddress: kotlin.String, + + @SerialName(value = "accepted_assets") + val acceptedAssets: kotlin.collections.List + +) { + + +} + diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/EstimatedTronTxInstantFeeAcceptedAssetsInner.kt b/tonapi/src/main/kotlin/io/batteryapi/models/EstimatedTronTxInstantFeeAcceptedAssetsInner.kt new file mode 100644 index 000000000..1b77553f1 --- /dev/null +++ b/tonapi/src/main/kotlin/io/batteryapi/models/EstimatedTronTxInstantFeeAcceptedAssetsInner.kt @@ -0,0 +1,57 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package io.batteryapi.models + + +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual + + +@Serializable + +data class EstimatedTronTxInstantFeeAcceptedAssetsInner ( + + @SerialName(value = "type") + val type: EstimatedTronTxInstantFeeAcceptedAssetsInner.Type, + + @SerialName(value = "name") + val name: kotlin.String, + + @SerialName(value = "amount_nano") + val amountNano: kotlin.String, + + @SerialName(value = "decimals") + val decimals: kotlin.Int, + + @SerialName(value = "jetton_master_id") + val jettonMasterId: kotlin.String? = null + +) { + + /** + * + * + * Values: jetton,ton + */ + @Serializable + enum class Type(val value: kotlin.String) { + @SerialName(value = "jetton") jetton("jetton"), + @SerialName(value = "ton") ton("ton"); + } + +} + diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/GasProxyAddress.kt b/tonapi/src/main/kotlin/io/batteryapi/models/GasProxyAddress.kt deleted file mode 100644 index d22281cc8..000000000 --- a/tonapi/src/main/kotlin/io/batteryapi/models/GasProxyAddress.kt +++ /dev/null @@ -1,8 +0,0 @@ -package io.batteryapi.models - -import com.squareup.moshi.Json - -data class GasProxyAddress( - @Json(name = "address") - val address: String -) \ No newline at end of file diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/GaslessEstimation.kt b/tonapi/src/main/kotlin/io/batteryapi/models/GaslessEstimation.kt index a3a433cdf..19e7a5b89 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/GaslessEstimation.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/GaslessEstimation.kt @@ -16,19 +16,16 @@ package io.batteryapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param commission - */ +@Serializable data class GaslessEstimation ( - @Json(name = "commission") + @SerialName(value = "commission") val commission: kotlin.String ) { diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/GetTonConnectPayload200Response.kt b/tonapi/src/main/kotlin/io/batteryapi/models/GetTonConnectPayload200Response.kt index 718c852c1..104aa1432 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/GetTonConnectPayload200Response.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/GetTonConnectPayload200Response.kt @@ -16,19 +16,16 @@ package io.batteryapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param payload - */ +@Serializable data class GetTonConnectPayload200Response ( - @Json(name = "payload") + @SerialName(value = "payload") val payload: kotlin.String ) { diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/GetTronConfig200Response.kt b/tonapi/src/main/kotlin/io/batteryapi/models/GetTronConfig200Response.kt index 30fbcbd38..87a8589bd 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/GetTronConfig200Response.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/GetTronConfig200Response.kt @@ -16,19 +16,16 @@ package io.batteryapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param safetyMarginPercent - */ +@Serializable data class GetTronConfig200Response ( - @Json(name = "safety_margin_percent") + @SerialName(value = "safety_margin_percent") val safetyMarginPercent: kotlin.String ) { diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/IOSBatteryPurchaseStatus.kt b/tonapi/src/main/kotlin/io/batteryapi/models/IOSBatteryPurchaseStatus.kt index 9004569bf..fafd85018 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/IOSBatteryPurchaseStatus.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/IOSBatteryPurchaseStatus.kt @@ -17,19 +17,16 @@ package io.batteryapi.models import io.batteryapi.models.IOSBatteryPurchaseStatusTransactionsInner -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param transactions - */ +@Serializable data class IOSBatteryPurchaseStatus ( - @Json(name = "transactions") + @SerialName(value = "transactions") val transactions: kotlin.collections.List ) { diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/IOSBatteryPurchaseStatusTransactionsInner.kt b/tonapi/src/main/kotlin/io/batteryapi/models/IOSBatteryPurchaseStatusTransactionsInner.kt index 274ce23fb..c9213b221 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/IOSBatteryPurchaseStatusTransactionsInner.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/IOSBatteryPurchaseStatusTransactionsInner.kt @@ -17,27 +17,22 @@ package io.batteryapi.models import io.batteryapi.models.IOSBatteryPurchaseStatusTransactionsInnerError -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param transactionId - * @param success - * @param error - */ +@Serializable data class IOSBatteryPurchaseStatusTransactionsInner ( - @Json(name = "transaction_id") + @SerialName(value = "transaction_id") val transactionId: kotlin.String, - @Json(name = "success") + @SerialName(value = "success") val success: kotlin.Boolean, - @Json(name = "error") + @SerialName(value = "error") val error: IOSBatteryPurchaseStatusTransactionsInnerError? = null ) { diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/IOSBatteryPurchaseStatusTransactionsInnerError.kt b/tonapi/src/main/kotlin/io/batteryapi/models/IOSBatteryPurchaseStatusTransactionsInnerError.kt index c18aec4af..0a07da7ea 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/IOSBatteryPurchaseStatusTransactionsInnerError.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/IOSBatteryPurchaseStatusTransactionsInnerError.kt @@ -16,23 +16,19 @@ package io.batteryapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param msg - * @param code - */ +@Serializable data class IOSBatteryPurchaseStatusTransactionsInnerError ( - @Json(name = "msg") + @SerialName(value = "msg") val msg: kotlin.String, - @Json(name = "code") + @SerialName(value = "code") val code: IOSBatteryPurchaseStatusTransactionsInnerError.Code ) { @@ -42,14 +38,14 @@ data class IOSBatteryPurchaseStatusTransactionsInnerError ( * * Values: invalidMinusBundleMinusId,invalidMinusProductMinusId,userMinusNotMinusFound,purchaseMinusIsMinusAlreadyMinusUsed,temporaryMinusError,unknown */ - @JsonClass(generateAdapter = false) + @Serializable enum class Code(val value: kotlin.String) { - @Json(name = "invalid-bundle-id") invalidMinusBundleMinusId("invalid-bundle-id"), - @Json(name = "invalid-product-id") invalidMinusProductMinusId("invalid-product-id"), - @Json(name = "user-not-found") userMinusNotMinusFound("user-not-found"), - @Json(name = "purchase-is-already-used") purchaseMinusIsMinusAlreadyMinusUsed("purchase-is-already-used"), - @Json(name = "temporary-error") temporaryMinusError("temporary-error"), - @Json(name = "unknown") unknown("unknown"); + @SerialName(value = "invalid-bundle-id") invalidMinusBundleMinusId("invalid-bundle-id"), + @SerialName(value = "invalid-product-id") invalidMinusProductMinusId("invalid-product-id"), + @SerialName(value = "user-not-found") userMinusNotMinusFound("user-not-found"), + @SerialName(value = "purchase-is-already-used") purchaseMinusIsMinusAlreadyMinusUsed("purchase-is-already-used"), + @SerialName(value = "temporary-error") temporaryMinusError("temporary-error"), + @SerialName(value = "unknown") unknown("unknown"); } } diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/IncreaseUserBalanceRequest.kt b/tonapi/src/main/kotlin/io/batteryapi/models/IncreaseUserBalanceRequest.kt new file mode 100644 index 000000000..8c5108f36 --- /dev/null +++ b/tonapi/src/main/kotlin/io/batteryapi/models/IncreaseUserBalanceRequest.kt @@ -0,0 +1,40 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package io.batteryapi.models + + +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual + + +@Serializable + +data class IncreaseUserBalanceRequest ( + + /* amount in TON to increase balance by */ + @SerialName(value = "amount") + val amount: kotlin.String, + + /* reason for balance increase */ + @SerialName(value = "reason") + val reason: kotlin.String? = null + +) { + + +} + diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/GetTonConnectPayloadDefaultResponse.kt b/tonapi/src/main/kotlin/io/batteryapi/models/InlineObject.kt similarity index 60% rename from tonapi/src/main/kotlin/io/batteryapi/models/GetTonConnectPayloadDefaultResponse.kt rename to tonapi/src/main/kotlin/io/batteryapi/models/InlineObject.kt index 909a18b43..a37317ec3 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/GetTonConnectPayloadDefaultResponse.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/InlineObject.kt @@ -16,27 +16,22 @@ package io.batteryapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param error - * @param errorKey - * @param errorDetails - */ +@Serializable -data class GetTonConnectPayloadDefaultResponse ( +data class InlineObject ( - @Json(name = "error") + @SerialName(value = "error") val error: kotlin.String, - @Json(name = "error-key") + @SerialName(value = "error-key") val errorKey: kotlin.String? = null, - @Json(name = "error-details") + @SerialName(value = "error-details") val errorDetails: kotlin.String? = null ) { diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/IosBatteryPurchaseRequest.kt b/tonapi/src/main/kotlin/io/batteryapi/models/IosBatteryPurchaseRequest.kt index ed426738d..5f2aab375 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/IosBatteryPurchaseRequest.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/IosBatteryPurchaseRequest.kt @@ -17,19 +17,16 @@ package io.batteryapi.models import io.batteryapi.models.IosBatteryPurchaseRequestTransactionsInner -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param transactions - */ +@Serializable data class IosBatteryPurchaseRequest ( - @Json(name = "transactions") + @SerialName(value = "transactions") val transactions: kotlin.collections.List ) { diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/IosBatteryPurchaseRequestTransactionsInner.kt b/tonapi/src/main/kotlin/io/batteryapi/models/IosBatteryPurchaseRequestTransactionsInner.kt index b78519dfe..68860fc96 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/IosBatteryPurchaseRequestTransactionsInner.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/IosBatteryPurchaseRequestTransactionsInner.kt @@ -16,23 +16,19 @@ package io.batteryapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param id - * @param promo - */ +@Serializable data class IosBatteryPurchaseRequestTransactionsInner ( - @Json(name = "id") + @SerialName(value = "id") val id: kotlin.String, - @Json(name = "promo") + @SerialName(value = "promo") val promo: kotlin.String? = null ) { diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/PromoCodeBatteryPurchaseRequest.kt b/tonapi/src/main/kotlin/io/batteryapi/models/PromoCodeBatteryPurchaseRequest.kt index 01aae0599..042fe7458 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/PromoCodeBatteryPurchaseRequest.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/PromoCodeBatteryPurchaseRequest.kt @@ -16,19 +16,16 @@ package io.batteryapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param promoCode - */ +@Serializable data class PromoCodeBatteryPurchaseRequest ( - @Json(name = "promo_code") + @SerialName(value = "promo_code") val promoCode: kotlin.String ) { diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/PromoCodeBatteryPurchaseStatus.kt b/tonapi/src/main/kotlin/io/batteryapi/models/PromoCodeBatteryPurchaseStatus.kt index d1a6ca9e4..69dad8d0f 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/PromoCodeBatteryPurchaseStatus.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/PromoCodeBatteryPurchaseStatus.kt @@ -17,27 +17,22 @@ package io.batteryapi.models import io.batteryapi.models.PromoCodeBatteryPurchaseStatusError -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param balanceChange - * @param success - * @param error - */ +@Serializable data class PromoCodeBatteryPurchaseStatus ( - @Json(name = "balance_change") + @SerialName(value = "balance_change") val balanceChange: kotlin.String, - @Json(name = "success") + @SerialName(value = "success") val success: kotlin.Boolean, - @Json(name = "error") + @SerialName(value = "error") val error: PromoCodeBatteryPurchaseStatusError? = null ) { diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/PromoCodeBatteryPurchaseStatusError.kt b/tonapi/src/main/kotlin/io/batteryapi/models/PromoCodeBatteryPurchaseStatusError.kt index c92c46295..159e10517 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/PromoCodeBatteryPurchaseStatusError.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/PromoCodeBatteryPurchaseStatusError.kt @@ -16,23 +16,19 @@ package io.batteryapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param msg - * @param code - */ +@Serializable data class PromoCodeBatteryPurchaseStatusError ( - @Json(name = "msg") + @SerialName(value = "msg") val msg: kotlin.String, - @Json(name = "code") + @SerialName(value = "code") val code: PromoCodeBatteryPurchaseStatusError.Code ) { @@ -42,11 +38,11 @@ data class PromoCodeBatteryPurchaseStatusError ( * * Values: promoMinusCodeMinusNotMinusFound,promoMinusExceededMinusAttempts,temporaryMinusError */ - @JsonClass(generateAdapter = false) + @Serializable enum class Code(val value: kotlin.String) { - @Json(name = "promo-code-not-found") promoMinusCodeMinusNotMinusFound("promo-code-not-found"), - @Json(name = "promo-exceeded-attempts") promoMinusExceededMinusAttempts("promo-exceeded-attempts"), - @Json(name = "temporary-error") temporaryMinusError("temporary-error"); + @SerialName(value = "promo-code-not-found") promoMinusCodeMinusNotMinusFound("promo-code-not-found"), + @SerialName(value = "promo-exceeded-attempts") promoMinusExceededMinusAttempts("promo-exceeded-attempts"), + @SerialName(value = "temporary-error") temporaryMinusError("temporary-error"); } } diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/PromoUsed.kt b/tonapi/src/main/kotlin/io/batteryapi/models/PromoUsed.kt index bc619d712..491ef4dfe 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/PromoUsed.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/PromoUsed.kt @@ -16,20 +16,20 @@ package io.batteryapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param promoUsed - */ +@Serializable data class PromoUsed ( - @Json(name = "promo_used") - val promoUsed: kotlin.Boolean + @SerialName(value = "promo_used") + val promoUsed: kotlin.Boolean, + + @SerialName(value = "bonus_charges") + val bonusCharges: kotlin.String ) { diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/Purchases.kt b/tonapi/src/main/kotlin/io/batteryapi/models/Purchases.kt index eb5d8d0b1..d8e93d91b 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/Purchases.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/Purchases.kt @@ -17,23 +17,19 @@ package io.batteryapi.models import io.batteryapi.models.PurchasesPurchasesInner -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param totalPurchases - * @param purchases - */ +@Serializable data class Purchases ( - @Json(name = "total_purchases") + @SerialName(value = "total_purchases") val totalPurchases: kotlin.Int, - @Json(name = "purchases") + @SerialName(value = "purchases") val purchases: kotlin.collections.List ) { diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/PurchasesPurchasesInner.kt b/tonapi/src/main/kotlin/io/batteryapi/models/PurchasesPurchasesInner.kt index e4d979925..8b6323496 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/PurchasesPurchasesInner.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/PurchasesPurchasesInner.kt @@ -17,58 +17,46 @@ package io.batteryapi.models import io.batteryapi.models.PurchasesPurchasesInnerRefundInformation -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param userPurchaseId - * @param purchaseId - * @param type - * @param charges - * @param datetime - * @param promo - * @param forAccountId - * @param amount Amount describes the amount paid by the user for this purchase when we know it. For crypto purchases it is always set. - * @param currency Currency is set when we know it. For crypto purchases it is always set. - * @param refundInformation - */ +@Serializable data class PurchasesPurchasesInner ( - @Json(name = "user_purchase_id") + @SerialName(value = "user_purchase_id") @Deprecated(message = "This property is deprecated.") val userPurchaseId: kotlin.Int, - @Json(name = "purchase_id") + @SerialName(value = "purchase_id") val purchaseId: kotlin.Int, - @Json(name = "type") + @SerialName(value = "type") val type: PurchasesPurchasesInner.Type, - @Json(name = "charges") + @SerialName(value = "charges") val charges: kotlin.Int, - @Json(name = "datetime") + @SerialName(value = "datetime") val datetime: kotlin.String, - @Json(name = "promo") + @SerialName(value = "promo") val promo: kotlin.String? = null, - @Json(name = "for_account_id") + @SerialName(value = "for_account_id") val forAccountId: kotlin.String? = null, /* Amount describes the amount paid by the user for this purchase when we know it. For crypto purchases it is always set. */ - @Json(name = "amount") + @SerialName(value = "amount") val amount: kotlin.String? = null, /* Currency is set when we know it. For crypto purchases it is always set. */ - @Json(name = "currency") + @SerialName(value = "currency") val currency: kotlin.String? = null, - @Json(name = "refund_information") + @SerialName(value = "refund_information") val refundInformation: PurchasesPurchasesInnerRefundInformation? = null ) { @@ -78,14 +66,14 @@ data class PurchasesPurchasesInner ( * * Values: android,ios,promoMinusCode,crypto,gift,onMinusTheMinusWayMinusGift */ - @JsonClass(generateAdapter = false) + @Serializable enum class Type(val value: kotlin.String) { - @Json(name = "android") android("android"), - @Json(name = "ios") ios("ios"), - @Json(name = "promo-code") promoMinusCode("promo-code"), - @Json(name = "crypto") crypto("crypto"), - @Json(name = "gift") gift("gift"), - @Json(name = "on-the-way-gift") onMinusTheMinusWayMinusGift("on-the-way-gift"); + @SerialName(value = "android") android("android"), + @SerialName(value = "ios") ios("ios"), + @SerialName(value = "promo-code") promoMinusCode("promo-code"), + @SerialName(value = "crypto") crypto("crypto"), + @SerialName(value = "gift") gift("gift"), + @SerialName(value = "on-the-way-gift") onMinusTheMinusWayMinusGift("on-the-way-gift"); } } diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/PurchasesPurchasesInnerRefundInformation.kt b/tonapi/src/main/kotlin/io/batteryapi/models/PurchasesPurchasesInnerRefundInformation.kt index baef29114..1a590eadd 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/PurchasesPurchasesInnerRefundInformation.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/PurchasesPurchasesInnerRefundInformation.kt @@ -17,35 +17,28 @@ package io.batteryapi.models import io.batteryapi.models.PurchasesPurchasesInnerRefundInformationRefunded -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param fullyRefunded - * @param partiallyRefunded - * @param pendingRefund - * @param refunded - * @param refundable - */ +@Serializable data class PurchasesPurchasesInnerRefundInformation ( - @Json(name = "fully_refunded") + @SerialName(value = "fully_refunded") val fullyRefunded: kotlin.Boolean, - @Json(name = "partially_refunded") + @SerialName(value = "partially_refunded") val partiallyRefunded: kotlin.Boolean, - @Json(name = "pending_refund") + @SerialName(value = "pending_refund") val pendingRefund: kotlin.Boolean, - @Json(name = "refunded") + @SerialName(value = "refunded") val refunded: PurchasesPurchasesInnerRefundInformationRefunded? = null, - @Json(name = "refundable") + @SerialName(value = "refundable") val refundable: PurchasesPurchasesInnerRefundInformationRefunded? = null ) { diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/PurchasesPurchasesInnerRefundInformationRefunded.kt b/tonapi/src/main/kotlin/io/batteryapi/models/PurchasesPurchasesInnerRefundInformationRefunded.kt index efc958edf..aa6099f0d 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/PurchasesPurchasesInnerRefundInformationRefunded.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/PurchasesPurchasesInnerRefundInformationRefunded.kt @@ -16,23 +16,19 @@ package io.batteryapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param amount - * @param charges - */ +@Serializable data class PurchasesPurchasesInnerRefundInformationRefunded ( - @Json(name = "amount") + @SerialName(value = "amount") val amount: kotlin.String, - @Json(name = "charges") + @SerialName(value = "charges") val charges: kotlin.Int ) { diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/RechargeMethods.kt b/tonapi/src/main/kotlin/io/batteryapi/models/RechargeMethods.kt index eb031aad8..a66d41ffb 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/RechargeMethods.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/RechargeMethods.kt @@ -17,19 +17,16 @@ package io.batteryapi.models import io.batteryapi.models.RechargeMethodsMethodsInner -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param methods - */ +@Serializable data class RechargeMethods ( - @Json(name = "methods") + @SerialName(value = "methods") val methods: kotlin.collections.List ) { diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/RechargeMethodsMethodsInner.kt b/tonapi/src/main/kotlin/io/batteryapi/models/RechargeMethodsMethodsInner.kt index 6af745293..409785fd5 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/RechargeMethodsMethodsInner.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/RechargeMethodsMethodsInner.kt @@ -16,51 +16,40 @@ package io.batteryapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param type - * @param rate - * @param symbol - * @param decimals - * @param supportGasless - * @param supportRecharge - * @param image - * @param jettonMaster - * @param minBootstrapValue - */ +@Serializable data class RechargeMethodsMethodsInner ( - @Json(name = "type") + @SerialName(value = "type") val type: RechargeMethodsMethodsInner.Type, - @Json(name = "rate") + @SerialName(value = "rate") val rate: kotlin.String, - @Json(name = "symbol") + @SerialName(value = "symbol") val symbol: kotlin.String, - @Json(name = "decimals") + @SerialName(value = "decimals") val decimals: kotlin.Int, - @Json(name = "support_gasless") + @SerialName(value = "support_gasless") val supportGasless: kotlin.Boolean, - @Json(name = "support_recharge") + @SerialName(value = "support_recharge") val supportRecharge: kotlin.Boolean, - @Json(name = "image") + @SerialName(value = "image") val image: kotlin.String? = null, - @Json(name = "jetton_master") + @SerialName(value = "jetton_master") val jettonMaster: kotlin.String? = null, - @Json(name = "min_bootstrap_value") + @SerialName(value = "min_bootstrap_value") val minBootstrapValue: kotlin.String? = null ) { @@ -70,10 +59,10 @@ data class RechargeMethodsMethodsInner ( * * Values: jetton,ton */ - @JsonClass(generateAdapter = false) + @Serializable enum class Type(val value: kotlin.String) { - @Json(name = "jetton") jetton("jetton"), - @Json(name = "ton") ton("ton"); + @SerialName(value = "jetton") jetton("jetton"), + @SerialName(value = "ton") ton("ton"); } } diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/RelayerSendingEstimation.kt b/tonapi/src/main/kotlin/io/batteryapi/models/RelayerSendingEstimation.kt index f9c31f066..cf2ff81f4 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/RelayerSendingEstimation.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/RelayerSendingEstimation.kt @@ -16,19 +16,16 @@ package io.batteryapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param commission - */ +@Serializable data class RelayerSendingEstimation ( - @Json(name = "commission") + @SerialName(value = "commission") val commission: kotlin.String ) { diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/RequestRefundRequest.kt b/tonapi/src/main/kotlin/io/batteryapi/models/RequestRefundRequest.kt index cb4ceba3a..5f63c4935 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/RequestRefundRequest.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/RequestRefundRequest.kt @@ -16,24 +16,20 @@ package io.batteryapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param userPurchaseId - * @param purchaseId - */ +@Serializable data class RequestRefundRequest ( - @Json(name = "user_purchase_id") + @SerialName(value = "user_purchase_id") @Deprecated(message = "This property is deprecated.") val userPurchaseId: kotlin.Int? = null, - @Json(name = "purchase_id") + @SerialName(value = "purchase_id") val purchaseId: kotlin.Int? = null ) { diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/ResetUserBalanceRequest.kt b/tonapi/src/main/kotlin/io/batteryapi/models/ResetUserBalanceRequest.kt index 5012b3343..c43b3f896 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/ResetUserBalanceRequest.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/ResetUserBalanceRequest.kt @@ -16,19 +16,16 @@ package io.batteryapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param reason - */ +@Serializable data class ResetUserBalanceRequest ( - @Json(name = "reason") + @SerialName(value = "reason") val reason: kotlin.String ) { diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/SentTronTx.kt b/tonapi/src/main/kotlin/io/batteryapi/models/SentTronTx.kt index 32b15f78f..5ee833f63 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/SentTronTx.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/SentTronTx.kt @@ -16,19 +16,16 @@ package io.batteryapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param status - */ +@Serializable data class SentTronTx ( - @Json(name = "status") + @SerialName(value = "status") val status: kotlin.String ) { diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/Status.kt b/tonapi/src/main/kotlin/io/batteryapi/models/Status.kt index 5e4555484..965b80922 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/Status.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/Status.kt @@ -17,19 +17,16 @@ package io.batteryapi.models import io.batteryapi.models.StatusPendingTransactionsInner -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param pendingTransactions - */ +@Serializable data class Status ( - @Json(name = "pending_transactions") + @SerialName(value = "pending_transactions") val pendingTransactions: kotlin.collections.List ) { diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/StatusPendingTransactionsInner.kt b/tonapi/src/main/kotlin/io/batteryapi/models/StatusPendingTransactionsInner.kt index 6329fa7a8..01448927c 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/StatusPendingTransactionsInner.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/StatusPendingTransactionsInner.kt @@ -16,19 +16,16 @@ package io.batteryapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param id - */ +@Serializable data class StatusPendingTransactionsInner ( - @Json(name = "id") + @SerialName(value = "id") val id: kotlin.String ) { diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/TonConnectProof200Response.kt b/tonapi/src/main/kotlin/io/batteryapi/models/TonConnectProof200Response.kt index 7e95734a8..2fe8a1e49 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/TonConnectProof200Response.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/TonConnectProof200Response.kt @@ -16,19 +16,16 @@ package io.batteryapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param token - */ +@Serializable data class TonConnectProof200Response ( - @Json(name = "token") + @SerialName(value = "token") val token: kotlin.String ) { diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/TonConnectProofRequest.kt b/tonapi/src/main/kotlin/io/batteryapi/models/TonConnectProofRequest.kt index f90901fdd..42e8f8af0 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/TonConnectProofRequest.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/TonConnectProofRequest.kt @@ -17,23 +17,19 @@ package io.batteryapi.models import io.batteryapi.models.TonConnectProofRequestProof -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param address - * @param proof - */ +@Serializable data class TonConnectProofRequest ( - @Json(name = "address") + @SerialName(value = "address") val address: kotlin.String, - @Json(name = "proof") + @SerialName(value = "proof") val proof: TonConnectProofRequestProof ) { diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/TonConnectProofRequestProof.kt b/tonapi/src/main/kotlin/io/batteryapi/models/TonConnectProofRequestProof.kt index 3024447ee..fce06cdfe 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/TonConnectProofRequestProof.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/TonConnectProofRequestProof.kt @@ -17,35 +17,28 @@ package io.batteryapi.models import io.batteryapi.models.TonConnectProofRequestProofDomain -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param timestamp - * @param domain - * @param signature - * @param payload - * @param stateInit - */ +@Serializable data class TonConnectProofRequestProof ( - @Json(name = "timestamp") + @SerialName(value = "timestamp") val timestamp: kotlin.Long, - @Json(name = "domain") + @SerialName(value = "domain") val domain: TonConnectProofRequestProofDomain, - @Json(name = "signature") + @SerialName(value = "signature") val signature: kotlin.String, - @Json(name = "payload") + @SerialName(value = "payload") val payload: kotlin.String, - @Json(name = "state_init") + @SerialName(value = "state_init") val stateInit: kotlin.String? = null ) { diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/TonConnectProofRequestProofDomain.kt b/tonapi/src/main/kotlin/io/batteryapi/models/TonConnectProofRequestProofDomain.kt index d39135b54..dda61bdf8 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/TonConnectProofRequestProofDomain.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/TonConnectProofRequestProofDomain.kt @@ -16,23 +16,19 @@ package io.batteryapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param `value` - * @param lengthBytes - */ +@Serializable data class TonConnectProofRequestProofDomain ( - @Json(name = "value") + @SerialName(value = "value") val `value`: kotlin.String, - @Json(name = "length_bytes") + @SerialName(value = "length_bytes") val lengthBytes: kotlin.Int? = null ) { diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/Transactions.kt b/tonapi/src/main/kotlin/io/batteryapi/models/Transactions.kt index 74d2c37ba..a93975e43 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/Transactions.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/Transactions.kt @@ -17,28 +17,23 @@ package io.batteryapi.models import io.batteryapi.models.TransactionsTransactionsInner -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param totalTransactions - * @param transactions - * @param nextOffset if set, then there are more transactions to be loaded. Use this value as offset parameter in the next request. - */ +@Serializable data class Transactions ( - @Json(name = "total_transactions") + @SerialName(value = "total_transactions") val totalTransactions: kotlin.Int, - @Json(name = "transactions") + @SerialName(value = "transactions") val transactions: kotlin.collections.List, /* if set, then there are more transactions to be loaded. Use this value as offset parameter in the next request. */ - @Json(name = "next_offset") + @SerialName(value = "next_offset") val nextOffset: kotlin.Int? = null ) { diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/TransactionsTransactionsInner.kt b/tonapi/src/main/kotlin/io/batteryapi/models/TransactionsTransactionsInner.kt index a8e4f8715..e75840d93 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/TransactionsTransactionsInner.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/TransactionsTransactionsInner.kt @@ -16,32 +16,26 @@ package io.batteryapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param id - * @param paidAmount represents the amount of money paid by the user for this transaction. - * @param status - * @param createdAt - */ +@Serializable data class TransactionsTransactionsInner ( - @Json(name = "id") + @SerialName(value = "id") val id: kotlin.String, /* represents the amount of money paid by the user for this transaction. */ - @Json(name = "paid_amount") + @SerialName(value = "paid_amount") val paidAmount: kotlin.String, - @Json(name = "status") + @SerialName(value = "status") val status: TransactionsTransactionsInner.Status, - @Json(name = "created_at") + @SerialName(value = "created_at") val createdAt: kotlin.String ) { @@ -51,11 +45,11 @@ data class TransactionsTransactionsInner ( * * Values: pending,completed,failed */ - @JsonClass(generateAdapter = false) + @Serializable enum class Status(val value: kotlin.String) { - @Json(name = "pending") pending("pending"), - @Json(name = "completed") completed("completed"), - @Json(name = "failed") failed("failed"); + @SerialName(value = "pending") pending("pending"), + @SerialName(value = "completed") completed("completed"), + @SerialName(value = "failed") failed("failed"); } } diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/TronSendRequest.kt b/tonapi/src/main/kotlin/io/batteryapi/models/TronSendRequest.kt index ac5ce0d0e..3609a9313 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/TronSendRequest.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/TronSendRequest.kt @@ -16,32 +16,30 @@ package io.batteryapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param wallet - * @param tx - * @param energy - * @param bandwidth - */ +@Serializable data class TronSendRequest ( - @Json(name = "wallet") + @SerialName(value = "wallet") val wallet: kotlin.String, - @Json(name = "tx") + @SerialName(value = "tx") val tx: kotlin.String? = null, - @Json(name = "energy") + @SerialName(value = "energy") val energy: kotlin.Int? = null, - @Json(name = "bandwidth") - val bandwidth: kotlin.Int? = null + @SerialName(value = "bandwidth") + val bandwidth: kotlin.Int? = null, + + /* base64 encoded payment transaction in the TON network */ + @SerialName(value = "instant_fee_tx") + val instantFeeTx: kotlin.String? = null ) { diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/TronTransactionsList.kt b/tonapi/src/main/kotlin/io/batteryapi/models/TronTransactionsList.kt index a9ef821cd..86ade1867 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/TronTransactionsList.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/TronTransactionsList.kt @@ -17,19 +17,16 @@ package io.batteryapi.models import io.batteryapi.models.TronTransactionsListTransactionsInner -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param transactions - */ +@Serializable data class TronTransactionsList ( - @Json(name = "transactions") + @SerialName(value = "transactions") val transactions: kotlin.collections.List ) { diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/TronTransactionsListTransactionsInner.kt b/tonapi/src/main/kotlin/io/batteryapi/models/TronTransactionsListTransactionsInner.kt index 45177459e..0e3355ba6 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/models/TronTransactionsListTransactionsInner.kt +++ b/tonapi/src/main/kotlin/io/batteryapi/models/TronTransactionsListTransactionsInner.kt @@ -16,51 +16,40 @@ package io.batteryapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param txid - * @param fromAccount - * @param toAccount - * @param amount - * @param isPending - * @param isFailed - * @param batteryCharges - * @param timestamp - * @param trongridResult - */ +@Serializable data class TronTransactionsListTransactionsInner ( - @Json(name = "txid") + @SerialName(value = "txid") val txid: kotlin.String, - @Json(name = "from_account") + @SerialName(value = "from_account") val fromAccount: kotlin.String, - @Json(name = "to_account") + @SerialName(value = "to_account") val toAccount: kotlin.String, - @Json(name = "amount") + @SerialName(value = "amount") val amount: kotlin.String, - @Json(name = "is_pending") + @SerialName(value = "is_pending") val isPending: kotlin.Boolean, - @Json(name = "is_failed") + @SerialName(value = "is_failed") val isFailed: kotlin.Boolean, - @Json(name = "battery_charges") + @SerialName(value = "battery_charges") val batteryCharges: kotlin.Int, - @Json(name = "timestamp") + @SerialName(value = "timestamp") val timestamp: kotlin.Long, - @Json(name = "trongrid_result") + @SerialName(value = "trongrid_result") val trongridResult: kotlin.Int? = null ) { diff --git a/tonapi/src/main/kotlin/io/batteryapi/models/VerifyPurchasePromo200Response.kt b/tonapi/src/main/kotlin/io/batteryapi/models/VerifyPurchasePromo200Response.kt new file mode 100644 index 000000000..0e4e3d30a --- /dev/null +++ b/tonapi/src/main/kotlin/io/batteryapi/models/VerifyPurchasePromo200Response.kt @@ -0,0 +1,35 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package io.batteryapi.models + + +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual + + +@Serializable + +data class VerifyPurchasePromo200Response ( + + @SerialName(value = "bonus_charges") + val bonusCharges: kotlin.String + +) { + + +} + diff --git a/tonapi/src/main/kotlin/io/extensions/NftItem.kt b/tonapi/src/main/kotlin/io/extensions/NftItem.kt new file mode 100644 index 000000000..aefa83f03 --- /dev/null +++ b/tonapi/src/main/kotlin/io/extensions/NftItem.kt @@ -0,0 +1,6 @@ +package io.extensions + +import io.tonapi.models.NftItem + +val NftItem.renderType: String + get() = metadata["render_type"].toString() \ No newline at end of file diff --git a/tonapi/src/main/kotlin/io/batteryapi/infrastructure/ApiAbstractions.kt b/tonapi/src/main/kotlin/io/infrastructure/ApiAbstractions.kt similarity index 95% rename from tonapi/src/main/kotlin/io/batteryapi/infrastructure/ApiAbstractions.kt rename to tonapi/src/main/kotlin/io/infrastructure/ApiAbstractions.kt index 02fff23f2..84e25a19a 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/infrastructure/ApiAbstractions.kt +++ b/tonapi/src/main/kotlin/io/infrastructure/ApiAbstractions.kt @@ -1,4 +1,4 @@ -package io.batteryapi.infrastructure +package io.infrastructure typealias MultiValueMap = MutableMap> diff --git a/tonapi/src/main/kotlin/io/batteryapi/infrastructure/ApiClient.kt b/tonapi/src/main/kotlin/io/infrastructure/ApiClient.kt similarity index 96% rename from tonapi/src/main/kotlin/io/batteryapi/infrastructure/ApiClient.kt rename to tonapi/src/main/kotlin/io/infrastructure/ApiClient.kt index 2c9f4f574..45504ae5b 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/infrastructure/ApiClient.kt +++ b/tonapi/src/main/kotlin/io/infrastructure/ApiClient.kt @@ -1,5 +1,6 @@ -package io.batteryapi.infrastructure +package io.infrastructure +import io.Serializer import okhttp3.OkHttpClient import okhttp3.RequestBody import okhttp3.RequestBody.Companion.asRequestBody @@ -28,7 +29,8 @@ import java.time.OffsetDateTime import java.time.OffsetTime import java.util.Locale import java.util.regex.Pattern -import com.squareup.moshi.adapter +import kotlinx.serialization.decodeFromString +import kotlinx.serialization.encodeToString val EMPTY_REQUEST: RequestBody = ByteArray(0).toRequestBody() @@ -49,7 +51,7 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie var username: String? = null var password: String? = null var accessToken: String? = null - const val baseUrlKey: String = "io.batteryapi.baseUrl" + const val baseUrlKey: String = "io.tonapi.baseUrl" @JvmStatic val defaultClient: OkHttpClient by lazy { @@ -166,7 +168,7 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie if (content == null) { EMPTY_REQUEST } else { - Serializer.moshi.adapter(T::class.java).toJson(content) + Serializer.toJSON(content) .toRequestBody((mediaType ?: JsonMediaType).toMediaTypeOrNull()) } mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") @@ -176,7 +178,6 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie else -> throw UnsupportedOperationException("requestBody currently only supports JSON body, text body, byte body and File body.") } - @OptIn(ExperimentalStdlibApi::class) protected inline fun responseBody(response: Response, mediaType: String? = JsonMediaType): T? { val body = response.body if(body == null) { @@ -241,7 +242,7 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie if (bodyContent.isEmpty()) { return null } - Serializer.moshi.adapter().fromJson(bodyContent) + Serializer.fromJSON(bodyContent) } mediaType == OctetMediaType -> body.bytes() as? T mediaType == TextMediaType -> body.string() as? T @@ -341,8 +342,6 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie null -> "" is Array<*> -> toMultiValue(value, "csv").toString() is Iterable<*> -> toMultiValue(value, "csv").toString() - is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime -> - parseDateToQueryString(value) else -> value.toString() } @@ -353,6 +352,6 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie formatter. It also easily allows to provide a simple way to define a custom date format pattern inside a gson/moshi adapter. */ - return Serializer.moshi.adapter(T::class.java).toJson(value).replace("\"", "") + return Serializer.toJSON(value).replace("\"", "") } } diff --git a/tonapi/src/main/kotlin/io/batteryapi/infrastructure/ApiResponse.kt b/tonapi/src/main/kotlin/io/infrastructure/ApiResponse.kt similarity index 97% rename from tonapi/src/main/kotlin/io/batteryapi/infrastructure/ApiResponse.kt rename to tonapi/src/main/kotlin/io/infrastructure/ApiResponse.kt index 99586537f..8305b92c6 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/infrastructure/ApiResponse.kt +++ b/tonapi/src/main/kotlin/io/infrastructure/ApiResponse.kt @@ -1,4 +1,4 @@ -package io.batteryapi.infrastructure +package io.infrastructure enum class ResponseType { Success, Informational, Redirection, ClientError, ServerError diff --git a/tonapi/src/main/kotlin/io/infrastructure/AtomicBooleanAdapter.kt b/tonapi/src/main/kotlin/io/infrastructure/AtomicBooleanAdapter.kt new file mode 100644 index 000000000..94da7ddad --- /dev/null +++ b/tonapi/src/main/kotlin/io/infrastructure/AtomicBooleanAdapter.kt @@ -0,0 +1,19 @@ +package io.infrastructure + +import kotlinx.serialization.KSerializer +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder +import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor +import kotlinx.serialization.descriptors.PrimitiveKind +import kotlinx.serialization.descriptors.SerialDescriptor +import java.util.concurrent.atomic.AtomicBoolean + +object AtomicBooleanAdapter : KSerializer { + override fun serialize(encoder: Encoder, value: AtomicBoolean) { + encoder.encodeBoolean(value.get()) + } + + override fun deserialize(decoder: Decoder): AtomicBoolean = AtomicBoolean(decoder.decodeBoolean()) + + override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("AtomicBoolean", PrimitiveKind.BOOLEAN) +} diff --git a/tonapi/src/main/kotlin/io/infrastructure/AtomicIntegerAdapter.kt b/tonapi/src/main/kotlin/io/infrastructure/AtomicIntegerAdapter.kt new file mode 100644 index 000000000..ebaba5f17 --- /dev/null +++ b/tonapi/src/main/kotlin/io/infrastructure/AtomicIntegerAdapter.kt @@ -0,0 +1,19 @@ +package io.infrastructure + +import kotlinx.serialization.KSerializer +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder +import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor +import kotlinx.serialization.descriptors.PrimitiveKind +import kotlinx.serialization.descriptors.SerialDescriptor +import java.util.concurrent.atomic.AtomicInteger + +object AtomicIntegerAdapter : KSerializer { + override fun serialize(encoder: Encoder, value: AtomicInteger) { + encoder.encodeInt(value.get()) + } + + override fun deserialize(decoder: Decoder): AtomicInteger = AtomicInteger(decoder.decodeInt()) + + override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("AtomicInteger", PrimitiveKind.INT) +} diff --git a/tonapi/src/main/kotlin/io/infrastructure/AtomicLongAdapter.kt b/tonapi/src/main/kotlin/io/infrastructure/AtomicLongAdapter.kt new file mode 100644 index 000000000..bc4adfd96 --- /dev/null +++ b/tonapi/src/main/kotlin/io/infrastructure/AtomicLongAdapter.kt @@ -0,0 +1,19 @@ +package io.infrastructure + +import kotlinx.serialization.KSerializer +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder +import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor +import kotlinx.serialization.descriptors.PrimitiveKind +import kotlinx.serialization.descriptors.SerialDescriptor +import java.util.concurrent.atomic.AtomicLong + +object AtomicLongAdapter : KSerializer { + override fun serialize(encoder: Encoder, value: AtomicLong) { + encoder.encodeLong(value.get()) + } + + override fun deserialize(decoder: Decoder): AtomicLong = AtomicLong(decoder.decodeLong()) + + override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("AtomicLong", PrimitiveKind.LONG) +} diff --git a/tonapi/src/main/kotlin/io/infrastructure/BigDecimalAdapter.kt b/tonapi/src/main/kotlin/io/infrastructure/BigDecimalAdapter.kt new file mode 100644 index 000000000..6d2740f81 --- /dev/null +++ b/tonapi/src/main/kotlin/io/infrastructure/BigDecimalAdapter.kt @@ -0,0 +1,15 @@ +package io.infrastructure + +import kotlinx.serialization.KSerializer +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder +import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor +import kotlinx.serialization.descriptors.PrimitiveKind +import kotlinx.serialization.descriptors.SerialDescriptor +import java.math.BigDecimal + +object BigDecimalAdapter : KSerializer { + override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("BigDecimal", PrimitiveKind.STRING) + override fun deserialize(decoder: Decoder): BigDecimal = BigDecimal(decoder.decodeString()) + override fun serialize(encoder: Encoder, value: BigDecimal) = encoder.encodeString(value.toPlainString()) +} diff --git a/tonapi/src/main/kotlin/io/infrastructure/BigIntegerAdapter.kt b/tonapi/src/main/kotlin/io/infrastructure/BigIntegerAdapter.kt new file mode 100644 index 000000000..f59626c99 --- /dev/null +++ b/tonapi/src/main/kotlin/io/infrastructure/BigIntegerAdapter.kt @@ -0,0 +1,20 @@ +package io.infrastructure + +import kotlinx.serialization.KSerializer +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder +import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor +import kotlinx.serialization.descriptors.PrimitiveKind +import kotlinx.serialization.descriptors.SerialDescriptor +import java.math.BigInteger + +object BigIntegerAdapter : KSerializer { + override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("BigInteger", PrimitiveKind.STRING) + override fun deserialize(decoder: Decoder): BigInteger { + return BigInteger(decoder.decodeString()) + } + + override fun serialize(encoder: Encoder, value: BigInteger) { + encoder.encodeString(value.toString()) + } +} diff --git a/tonapi/src/main/kotlin/io/tonapi/infrastructure/Errors.kt b/tonapi/src/main/kotlin/io/infrastructure/Errors.kt similarity index 94% rename from tonapi/src/main/kotlin/io/tonapi/infrastructure/Errors.kt rename to tonapi/src/main/kotlin/io/infrastructure/Errors.kt index dc12358dc..0435a402b 100644 --- a/tonapi/src/main/kotlin/io/tonapi/infrastructure/Errors.kt +++ b/tonapi/src/main/kotlin/io/infrastructure/Errors.kt @@ -1,5 +1,6 @@ @file:Suppress("unused") -package io.tonapi.infrastructure + +package io.infrastructure import java.lang.RuntimeException diff --git a/tonapi/src/main/kotlin/io/infrastructure/LocalDateAdapter.kt b/tonapi/src/main/kotlin/io/infrastructure/LocalDateAdapter.kt new file mode 100644 index 000000000..3ef48d339 --- /dev/null +++ b/tonapi/src/main/kotlin/io/infrastructure/LocalDateAdapter.kt @@ -0,0 +1,22 @@ +package io.infrastructure + +import kotlinx.serialization.KSerializer +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder +import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor +import kotlinx.serialization.descriptors.PrimitiveKind +import kotlinx.serialization.descriptors.SerialDescriptor +import java.time.LocalDate +import java.time.format.DateTimeFormatter + +object LocalDateAdapter : KSerializer { + override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("LocalDate", PrimitiveKind.STRING) + + override fun serialize(encoder: Encoder, value: LocalDate) { + encoder.encodeString(DateTimeFormatter.ISO_LOCAL_DATE.format(value)) + } + + override fun deserialize(decoder: Decoder): LocalDate { + return LocalDate.parse(decoder.decodeString(), DateTimeFormatter.ISO_LOCAL_DATE) + } +} diff --git a/tonapi/src/main/kotlin/io/infrastructure/LocalDateTimeAdapter.kt b/tonapi/src/main/kotlin/io/infrastructure/LocalDateTimeAdapter.kt new file mode 100644 index 000000000..7e42fc408 --- /dev/null +++ b/tonapi/src/main/kotlin/io/infrastructure/LocalDateTimeAdapter.kt @@ -0,0 +1,22 @@ +package io.infrastructure + +import kotlinx.serialization.KSerializer +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder +import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor +import kotlinx.serialization.descriptors.PrimitiveKind +import kotlinx.serialization.descriptors.SerialDescriptor +import java.time.LocalDateTime +import java.time.format.DateTimeFormatter + +object LocalDateTimeAdapter : KSerializer { + override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("LocalDateTime", PrimitiveKind.STRING) + + override fun serialize(encoder: Encoder, value: LocalDateTime) { + encoder.encodeString(DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(value)) + } + + override fun deserialize(decoder: Decoder): LocalDateTime { + return LocalDateTime.parse(decoder.decodeString(), DateTimeFormatter.ISO_LOCAL_DATE_TIME) + } +} diff --git a/tonapi/src/main/kotlin/io/infrastructure/OffsetDateTimeAdapter.kt b/tonapi/src/main/kotlin/io/infrastructure/OffsetDateTimeAdapter.kt new file mode 100644 index 000000000..a5cc07c65 --- /dev/null +++ b/tonapi/src/main/kotlin/io/infrastructure/OffsetDateTimeAdapter.kt @@ -0,0 +1,22 @@ +package io.infrastructure + +import kotlinx.serialization.KSerializer +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder +import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor +import kotlinx.serialization.descriptors.PrimitiveKind +import kotlinx.serialization.descriptors.SerialDescriptor +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter + +object OffsetDateTimeAdapter : KSerializer { + override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("OffsetDateTime", PrimitiveKind.STRING) + + override fun serialize(encoder: Encoder, value: OffsetDateTime) { + encoder.encodeString(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value)) + } + + override fun deserialize(decoder: Decoder): OffsetDateTime { + return OffsetDateTime.parse(decoder.decodeString(), DateTimeFormatter.ISO_OFFSET_DATE_TIME) + } +} diff --git a/tonapi/src/main/kotlin/io/tonapi/infrastructure/PartConfig.kt b/tonapi/src/main/kotlin/io/infrastructure/PartConfig.kt similarity index 90% rename from tonapi/src/main/kotlin/io/tonapi/infrastructure/PartConfig.kt rename to tonapi/src/main/kotlin/io/infrastructure/PartConfig.kt index 1e932b0a8..bab67dc4b 100644 --- a/tonapi/src/main/kotlin/io/tonapi/infrastructure/PartConfig.kt +++ b/tonapi/src/main/kotlin/io/infrastructure/PartConfig.kt @@ -1,4 +1,4 @@ -package io.tonapi.infrastructure +package io.infrastructure /** * Defines a config object for a given part of a multi-part request. diff --git a/tonapi/src/main/kotlin/io/batteryapi/infrastructure/RequestConfig.kt b/tonapi/src/main/kotlin/io/infrastructure/RequestConfig.kt similarity index 94% rename from tonapi/src/main/kotlin/io/batteryapi/infrastructure/RequestConfig.kt rename to tonapi/src/main/kotlin/io/infrastructure/RequestConfig.kt index 974122e57..3ed43e1e9 100644 --- a/tonapi/src/main/kotlin/io/batteryapi/infrastructure/RequestConfig.kt +++ b/tonapi/src/main/kotlin/io/infrastructure/RequestConfig.kt @@ -1,4 +1,4 @@ -package io.batteryapi.infrastructure +package io.infrastructure /** * Defines a config object for a given request. diff --git a/tonapi/src/main/kotlin/io/tonapi/infrastructure/RequestMethod.kt b/tonapi/src/main/kotlin/io/infrastructure/RequestMethod.kt similarity index 78% rename from tonapi/src/main/kotlin/io/tonapi/infrastructure/RequestMethod.kt rename to tonapi/src/main/kotlin/io/infrastructure/RequestMethod.kt index bb7eacb92..73a6173e1 100644 --- a/tonapi/src/main/kotlin/io/tonapi/infrastructure/RequestMethod.kt +++ b/tonapi/src/main/kotlin/io/infrastructure/RequestMethod.kt @@ -1,4 +1,4 @@ -package io.tonapi.infrastructure +package io.infrastructure /** * Provides enumerated HTTP verbs diff --git a/tonapi/src/main/kotlin/io/tonapi/infrastructure/ResponseExtensions.kt b/tonapi/src/main/kotlin/io/infrastructure/ResponseExtensions.kt similarity index 95% rename from tonapi/src/main/kotlin/io/tonapi/infrastructure/ResponseExtensions.kt rename to tonapi/src/main/kotlin/io/infrastructure/ResponseExtensions.kt index 0d81acd92..91347f149 100644 --- a/tonapi/src/main/kotlin/io/tonapi/infrastructure/ResponseExtensions.kt +++ b/tonapi/src/main/kotlin/io/infrastructure/ResponseExtensions.kt @@ -1,4 +1,4 @@ -package io.tonapi.infrastructure +package io.infrastructure import okhttp3.Response diff --git a/tonapi/src/main/kotlin/io/infrastructure/StringBuilderAdapter.kt b/tonapi/src/main/kotlin/io/infrastructure/StringBuilderAdapter.kt new file mode 100644 index 000000000..55b5cd100 --- /dev/null +++ b/tonapi/src/main/kotlin/io/infrastructure/StringBuilderAdapter.kt @@ -0,0 +1,18 @@ +package io.infrastructure + +import kotlinx.serialization.KSerializer +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder +import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor +import kotlinx.serialization.descriptors.PrimitiveKind +import kotlinx.serialization.descriptors.SerialDescriptor + +object StringBuilderAdapter : KSerializer { + override fun serialize(encoder: Encoder, value: StringBuilder) { + encoder.encodeString(value.toString()) + } + + override fun deserialize(decoder: Decoder): StringBuilder = StringBuilder(decoder.decodeString()) + + override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("StringBuilder", PrimitiveKind.STRING) +} diff --git a/tonapi/src/main/kotlin/io/infrastructure/URIAdapter.kt b/tonapi/src/main/kotlin/io/infrastructure/URIAdapter.kt new file mode 100644 index 000000000..e43da27e6 --- /dev/null +++ b/tonapi/src/main/kotlin/io/infrastructure/URIAdapter.kt @@ -0,0 +1,19 @@ +package io.infrastructure + +import kotlinx.serialization.KSerializer +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder +import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor +import kotlinx.serialization.descriptors.PrimitiveKind +import kotlinx.serialization.descriptors.SerialDescriptor +import java.net.URI + +object URIAdapter : KSerializer { + override fun serialize(encoder: Encoder, value: URI) { + encoder.encodeString(value.toASCIIString()) + } + + override fun deserialize(decoder: Decoder): URI = URI(decoder.decodeString()) + + override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("URI", PrimitiveKind.STRING) +} diff --git a/tonapi/src/main/kotlin/io/infrastructure/URLAdapter.kt b/tonapi/src/main/kotlin/io/infrastructure/URLAdapter.kt new file mode 100644 index 000000000..d5653c9da --- /dev/null +++ b/tonapi/src/main/kotlin/io/infrastructure/URLAdapter.kt @@ -0,0 +1,19 @@ +package io.infrastructure + +import kotlinx.serialization.KSerializer +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder +import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor +import kotlinx.serialization.descriptors.PrimitiveKind +import kotlinx.serialization.descriptors.SerialDescriptor +import java.net.URL + +object URLAdapter : KSerializer { + override fun serialize(encoder: Encoder, value: URL) { + encoder.encodeString(value.toExternalForm()) + } + + override fun deserialize(decoder: Decoder): URL = URL(decoder.decodeString()) + + override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("URL", PrimitiveKind.STRING) +} diff --git a/tonapi/src/main/kotlin/io/infrastructure/UUIDAdapter.kt b/tonapi/src/main/kotlin/io/infrastructure/UUIDAdapter.kt new file mode 100644 index 000000000..348ecae78 --- /dev/null +++ b/tonapi/src/main/kotlin/io/infrastructure/UUIDAdapter.kt @@ -0,0 +1,21 @@ +package io.infrastructure + +import kotlinx.serialization.KSerializer +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder +import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor +import kotlinx.serialization.descriptors.PrimitiveKind +import kotlinx.serialization.descriptors.SerialDescriptor +import java.util.UUID + +object UUIDAdapter : KSerializer { + override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("UUID", PrimitiveKind.STRING) + + override fun serialize(encoder: Encoder, value: UUID) { + encoder.encodeString(value.toString()) + } + + override fun deserialize(decoder: Decoder): UUID { + return UUID.fromString(decoder.decodeString()) + } +} diff --git a/tonapi/src/main/kotlin/io/serializers/AnySerializer.kt b/tonapi/src/main/kotlin/io/serializers/AnySerializer.kt new file mode 100644 index 000000000..e97275680 --- /dev/null +++ b/tonapi/src/main/kotlin/io/serializers/AnySerializer.kt @@ -0,0 +1,51 @@ +package io.serializers + +import kotlinx.serialization.KSerializer +import kotlinx.serialization.descriptors.SerialDescriptor +import kotlinx.serialization.descriptors.buildClassSerialDescriptor +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder +import kotlinx.serialization.json.* + +object AnySerializer : KSerializer { + override val descriptor: SerialDescriptor = buildClassSerialDescriptor("Any") + + override fun serialize(encoder: Encoder, value: Any) { + val jsonEncoder = encoder as? JsonEncoder ?: error("This serializer can be used only with Json") + val jsonElement = serializeAny(value) + jsonEncoder.encodeJsonElement(jsonElement) + } + + private fun serializeAny(value: Any): JsonElement = when (value) { + is Map<*, *> -> { + val map = value as Map + JsonObject(map.mapValues { serializeAny(it.value) }) + } + is List<*> -> { + val list = value as List + JsonArray(list.map { serializeAny(it) }) + } + is String -> JsonPrimitive(value) + is Number -> JsonPrimitive(value) + is Boolean -> JsonPrimitive(value) + else -> JsonNull + } + + override fun deserialize(decoder: Decoder): Any { + val jsonDecoder = decoder as? JsonDecoder ?: error("This serializer can be used only with Json") + val element = jsonDecoder.decodeJsonElement() + return deserializeJsonElement(element) + } + + private fun deserializeJsonElement(element: JsonElement): Any = when (element) { + is JsonObject -> element.mapValues { deserializeJsonElement(it.value) } + is JsonArray -> element.map { deserializeJsonElement(it) } + is JsonPrimitive -> { + if (element.isString) { + element.content + } else { + element.content.toBooleanStrictOrNull() ?: element.content.toDoubleOrNull() ?: element.content + } + } + } +} diff --git a/tonapi/src/main/kotlin/io/tonapi/apis/AccountsApi.kt b/tonapi/src/main/kotlin/io/tonapi/apis/AccountsApi.kt index 68d204ca1..e6f84de0e 100644 --- a/tonapi/src/main/kotlin/io/tonapi/apis/AccountsApi.kt +++ b/tonapi/src/main/kotlin/io/tonapi/apis/AccountsApi.kt @@ -16,45 +16,47 @@ package io.tonapi.apis import java.io.IOException -import okhttp3.OkHttpClient +import okhttp3.Call import okhttp3.HttpUrl import io.tonapi.models.Account import io.tonapi.models.AccountEvent import io.tonapi.models.AccountEvents import io.tonapi.models.Accounts -import io.tonapi.models.AddressParse200Response import io.tonapi.models.DnsExpiring import io.tonapi.models.DomainNames import io.tonapi.models.FoundAccounts +import io.tonapi.models.GaslessEstimateRequestMessagesInner import io.tonapi.models.GetAccountDiff200Response import io.tonapi.models.GetAccountPublicKey200Response import io.tonapi.models.GetAccountsRequest +import io.tonapi.models.InlineObject import io.tonapi.models.JettonBalance +import io.tonapi.models.JettonOperations import io.tonapi.models.JettonsBalances import io.tonapi.models.Multisigs import io.tonapi.models.NftItems -import io.tonapi.models.StatusDefaultResponse import io.tonapi.models.Subscriptions import io.tonapi.models.TraceIDs -import com.squareup.moshi.Json - -import io.tonapi.infrastructure.ApiClient -import io.tonapi.infrastructure.ApiResponse -import io.tonapi.infrastructure.ClientException -import io.tonapi.infrastructure.ClientError -import io.tonapi.infrastructure.ServerException -import io.tonapi.infrastructure.ServerError -import io.tonapi.infrastructure.MultiValueMap -import io.tonapi.infrastructure.PartConfig -import io.tonapi.infrastructure.RequestConfig -import io.tonapi.infrastructure.RequestMethod -import io.tonapi.infrastructure.ResponseType -import io.tonapi.infrastructure.Success -import io.tonapi.infrastructure.toMultiValue - -class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = ApiClient.defaultClient) : ApiClient(basePath, client) { +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +import io.infrastructure.ApiClient +import io.infrastructure.ApiResponse +import io.infrastructure.ClientException +import io.infrastructure.ClientError +import io.infrastructure.ServerException +import io.infrastructure.ServerError +import io.infrastructure.MultiValueMap +import io.infrastructure.PartConfig +import io.infrastructure.RequestConfig +import io.infrastructure.RequestMethod +import io.infrastructure.ResponseType +import io.infrastructure.Success +import io.infrastructure.toMultiValue + +class AccountsApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory = ApiClient.defaultClient) : ApiClient(basePath, client) { companion object { @JvmStatic val defaultBasePath: String by lazy { @@ -62,17 +64,6 @@ class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien } } - /** - * - * Get account's domains - * @param accountId account ID - * @return DomainNames - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun accountDnsBackResolve(accountId: kotlin.String) : DomainNames { @@ -93,14 +84,6 @@ class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien } } - /** - * - * Get account's domains - * @param accountId account ID - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun accountDnsBackResolveWithHttpInfo(accountId: kotlin.String) : ApiResponse { @@ -111,12 +94,6 @@ class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien ) } - /** - * To obtain the request config of the operation accountDnsBackResolve - * - * @param accountId account ID - * @return RequestConfig - */ fun accountDnsBackResolveRequestConfig(accountId: kotlin.String) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() @@ -133,24 +110,13 @@ class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien ) } - /** - * - * parse address and display in all formats - * @param accountId account ID - * @return AddressParse200Response - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun addressParse(accountId: kotlin.String) : AddressParse200Response { - val localVarResponse = addressParseWithHttpInfo(accountId = accountId) + fun emulateMessageToAccountEvent(accountId: kotlin.String, gaslessEstimateRequestMessagesInner: GaslessEstimateRequestMessagesInner, acceptLanguage: kotlin.String? = "en", ignoreSignatureCheck: kotlin.Boolean? = null) : AccountEvent { + val localVarResponse = emulateMessageToAccountEventWithHttpInfo(accountId = accountId, gaslessEstimateRequestMessagesInner = gaslessEstimateRequestMessagesInner, acceptLanguage = acceptLanguage, ignoreSignatureCheck = ignoreSignatureCheck) return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as AddressParse200Response + ResponseType.Success -> (localVarResponse as Success<*>).data as AccountEvent ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") ResponseType.ClientError -> { @@ -164,39 +130,32 @@ class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien } } - /** - * - * parse address and display in all formats - * @param accountId account ID - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun addressParseWithHttpInfo(accountId: kotlin.String) : ApiResponse { - val localVariableConfig = addressParseRequestConfig(accountId = accountId) + fun emulateMessageToAccountEventWithHttpInfo(accountId: kotlin.String, gaslessEstimateRequestMessagesInner: GaslessEstimateRequestMessagesInner, acceptLanguage: kotlin.String?, ignoreSignatureCheck: kotlin.Boolean?) : ApiResponse { + val localVariableConfig = emulateMessageToAccountEventRequestConfig(accountId = accountId, gaslessEstimateRequestMessagesInner = gaslessEstimateRequestMessagesInner, acceptLanguage = acceptLanguage, ignoreSignatureCheck = ignoreSignatureCheck) - return request( + return request( localVariableConfig ) } - /** - * To obtain the request config of the operation addressParse - * - * @param accountId account ID - * @return RequestConfig - */ - fun addressParseRequestConfig(accountId: kotlin.String) : RequestConfig { - val localVariableBody = null - val localVariableQuery: MultiValueMap = mutableMapOf() + fun emulateMessageToAccountEventRequestConfig(accountId: kotlin.String, gaslessEstimateRequestMessagesInner: GaslessEstimateRequestMessagesInner, acceptLanguage: kotlin.String?, ignoreSignatureCheck: kotlin.Boolean?) : RequestConfig { + val localVariableBody = gaslessEstimateRequestMessagesInner + val localVariableQuery: MultiValueMap = mutableMapOf>() + .apply { + if (ignoreSignatureCheck != null) { + put("ignore_signature_check", listOf(ignoreSignatureCheck.toString())) + } + } val localVariableHeaders: MutableMap = mutableMapOf() + acceptLanguage?.apply { localVariableHeaders["Accept-Language"] = this.toString() } + localVariableHeaders["Content-Type"] = "application/json" localVariableHeaders["Accept"] = "application/json" return RequestConfig( - method = RequestMethod.GET, - path = "/v2/address/{account_id}/parse".replace("{"+"account_id"+"}", encodeURIComponent(accountId.toString())), + method = RequestMethod.POST, + path = "/v2/accounts/{account_id}/events/emulate".replace("{"+"account_id"+"}", encodeURIComponent(accountId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -204,17 +163,6 @@ class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien ) } - /** - * - * Get human-friendly information about an account without low-level details. - * @param accountId account ID - * @return Account - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getAccount(accountId: kotlin.String) : Account { @@ -235,14 +183,6 @@ class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien } } - /** - * - * Get human-friendly information about an account without low-level details. - * @param accountId account ID - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getAccountWithHttpInfo(accountId: kotlin.String) : ApiResponse { @@ -253,12 +193,6 @@ class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien ) } - /** - * To obtain the request config of the operation getAccount - * - * @param accountId account ID - * @return RequestConfig - */ fun getAccountRequestConfig(accountId: kotlin.String) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() @@ -275,19 +209,6 @@ class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien ) } - /** - * - * Get account's balance change - * @param accountId account ID - * @param startDate - * @param endDate - * @return GetAccountDiff200Response - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getAccountDiff(accountId: kotlin.String, startDate: kotlin.Long, endDate: kotlin.Long) : GetAccountDiff200Response { @@ -308,16 +229,6 @@ class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien } } - /** - * - * Get account's balance change - * @param accountId account ID - * @param startDate - * @param endDate - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getAccountDiffWithHttpInfo(accountId: kotlin.String, startDate: kotlin.Long, endDate: kotlin.Long) : ApiResponse { @@ -328,14 +239,6 @@ class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien ) } - /** - * To obtain the request config of the operation getAccountDiff - * - * @param accountId account ID - * @param startDate - * @param endDate - * @return RequestConfig - */ fun getAccountDiffRequestConfig(accountId: kotlin.String, startDate: kotlin.Long, endDate: kotlin.Long) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf>() @@ -356,18 +259,6 @@ class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien ) } - /** - * - * Get expiring account .ton dns - * @param accountId account ID - * @param period number of days before expiration (optional) - * @return DnsExpiring - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getAccountDnsExpiring(accountId: kotlin.String, period: kotlin.Int? = null) : DnsExpiring { @@ -388,15 +279,6 @@ class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien } } - /** - * - * Get expiring account .ton dns - * @param accountId account ID - * @param period number of days before expiration (optional) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getAccountDnsExpiringWithHttpInfo(accountId: kotlin.String, period: kotlin.Int?) : ApiResponse { @@ -407,13 +289,6 @@ class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien ) } - /** - * To obtain the request config of the operation getAccountDnsExpiring - * - * @param accountId account ID - * @param period number of days before expiration (optional) - * @return RequestConfig - */ fun getAccountDnsExpiringRequestConfig(accountId: kotlin.String, period: kotlin.Int?) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf>() @@ -435,20 +310,6 @@ class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien ) } - /** - * - * Get event for an account by event_id - * @param accountId account ID - * @param eventId event ID or transaction hash in hex (without 0x) or base64url format - * @param acceptLanguage (optional, default to "en") - * @param subjectOnly filter actions where requested account is not real subject (for example sender or receiver jettons) (optional, default to false) - * @return AccountEvent - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getAccountEvent(accountId: kotlin.String, eventId: kotlin.String, acceptLanguage: kotlin.String? = "en", subjectOnly: kotlin.Boolean? = false) : AccountEvent { @@ -469,17 +330,6 @@ class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien } } - /** - * - * Get event for an account by event_id - * @param accountId account ID - * @param eventId event ID or transaction hash in hex (without 0x) or base64url format - * @param acceptLanguage (optional, default to "en") - * @param subjectOnly filter actions where requested account is not real subject (for example sender or receiver jettons) (optional, default to false) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getAccountEventWithHttpInfo(accountId: kotlin.String, eventId: kotlin.String, acceptLanguage: kotlin.String?, subjectOnly: kotlin.Boolean?) : ApiResponse { @@ -490,15 +340,6 @@ class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien ) } - /** - * To obtain the request config of the operation getAccountEvent - * - * @param accountId account ID - * @param eventId event ID or transaction hash in hex (without 0x) or base64url format - * @param acceptLanguage (optional, default to "en") - * @param subjectOnly filter actions where requested account is not real subject (for example sender or receiver jettons) (optional, default to false) - * @return RequestConfig - */ fun getAccountEventRequestConfig(accountId: kotlin.String, eventId: kotlin.String, acceptLanguage: kotlin.String?, subjectOnly: kotlin.Boolean?) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf>() @@ -521,24 +362,6 @@ class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien ) } - /** - * - * Get events for an account. Each event is built on top of a trace which is a series of transactions caused by one inbound message. TonAPI looks for known patterns inside the trace and splits the trace into actions, where a single action represents a meaningful high-level operation like a Jetton Transfer or an NFT Purchase. Actions are expected to be shown to users. It is advised not to build any logic on top of actions because actions can be changed at any time. - * @param accountId account ID - * @param limit - * @param acceptLanguage (optional, default to "en") - * @param initiator Show only events that are initiated by this account (optional, default to false) - * @param subjectOnly filter actions where requested account is not real subject (for example sender or receiver jettons) (optional, default to false) - * @param beforeLt omit this parameter to get last events (optional) - * @param startDate (optional) - * @param endDate (optional) - * @return AccountEvents - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getAccountEvents(accountId: kotlin.String, limit: kotlin.Int, acceptLanguage: kotlin.String? = "en", initiator: kotlin.Boolean? = false, subjectOnly: kotlin.Boolean? = false, beforeLt: kotlin.Long? = null, startDate: kotlin.Long? = null, endDate: kotlin.Long? = null) : AccountEvents { @@ -559,21 +382,6 @@ class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien } } - /** - * - * Get events for an account. Each event is built on top of a trace which is a series of transactions caused by one inbound message. TonAPI looks for known patterns inside the trace and splits the trace into actions, where a single action represents a meaningful high-level operation like a Jetton Transfer or an NFT Purchase. Actions are expected to be shown to users. It is advised not to build any logic on top of actions because actions can be changed at any time. - * @param accountId account ID - * @param limit - * @param acceptLanguage (optional, default to "en") - * @param initiator Show only events that are initiated by this account (optional, default to false) - * @param subjectOnly filter actions where requested account is not real subject (for example sender or receiver jettons) (optional, default to false) - * @param beforeLt omit this parameter to get last events (optional) - * @param startDate (optional) - * @param endDate (optional) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getAccountEventsWithHttpInfo(accountId: kotlin.String, limit: kotlin.Int, acceptLanguage: kotlin.String?, initiator: kotlin.Boolean?, subjectOnly: kotlin.Boolean?, beforeLt: kotlin.Long?, startDate: kotlin.Long?, endDate: kotlin.Long?) : ApiResponse { @@ -584,19 +392,6 @@ class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien ) } - /** - * To obtain the request config of the operation getAccountEvents - * - * @param accountId account ID - * @param limit - * @param acceptLanguage (optional, default to "en") - * @param initiator Show only events that are initiated by this account (optional, default to false) - * @param subjectOnly filter actions where requested account is not real subject (for example sender or receiver jettons) (optional, default to false) - * @param beforeLt omit this parameter to get last events (optional) - * @param startDate (optional) - * @param endDate (optional) - * @return RequestConfig - */ fun getAccountEventsRequestConfig(accountId: kotlin.String, limit: kotlin.Int, acceptLanguage: kotlin.String?, initiator: kotlin.Boolean?, subjectOnly: kotlin.Boolean?, beforeLt: kotlin.Long?, startDate: kotlin.Long?, endDate: kotlin.Long?) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf>() @@ -632,23 +427,69 @@ class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien ) } - /** - * - * Get Jetton balance by owner address - * @param accountId account ID - * @param jettonId jetton ID - * @param currencies accept ton and all possible fiat currencies, separated by commas (optional) - * @return JettonBalance - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getAccountJettonBalance(accountId: kotlin.String, jettonId: kotlin.String, currencies: kotlin.collections.List? = null) : JettonBalance { - val localVarResponse = getAccountJettonBalanceWithHttpInfo(accountId = accountId, jettonId = jettonId, currencies = currencies) + fun getAccountExtraCurrencyHistoryByID(accountId: kotlin.String, id: kotlin.Int, limit: kotlin.Int, acceptLanguage: kotlin.String? = "en", beforeLt: kotlin.Long? = null, startDate: kotlin.Long? = null, endDate: kotlin.Long? = null) : AccountEvents { + val localVarResponse = getAccountExtraCurrencyHistoryByIDWithHttpInfo(accountId = accountId, id = id, limit = limit, acceptLanguage = acceptLanguage, beforeLt = beforeLt, startDate = startDate, endDate = endDate) + + return when (localVarResponse.responseType) { + ResponseType.Success -> (localVarResponse as Success<*>).data as AccountEvents + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> { + val localVarError = localVarResponse as ClientError<*> + throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + } + ResponseType.ServerError -> { + val localVarError = localVarResponse as ServerError<*> + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) + } + } + } + + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun getAccountExtraCurrencyHistoryByIDWithHttpInfo(accountId: kotlin.String, id: kotlin.Int, limit: kotlin.Int, acceptLanguage: kotlin.String?, beforeLt: kotlin.Long?, startDate: kotlin.Long?, endDate: kotlin.Long?) : ApiResponse { + val localVariableConfig = getAccountExtraCurrencyHistoryByIDRequestConfig(accountId = accountId, id = id, limit = limit, acceptLanguage = acceptLanguage, beforeLt = beforeLt, startDate = startDate, endDate = endDate) + + return request( + localVariableConfig + ) + } + + fun getAccountExtraCurrencyHistoryByIDRequestConfig(accountId: kotlin.String, id: kotlin.Int, limit: kotlin.Int, acceptLanguage: kotlin.String?, beforeLt: kotlin.Long?, startDate: kotlin.Long?, endDate: kotlin.Long?) : RequestConfig { + val localVariableBody = null + val localVariableQuery: MultiValueMap = mutableMapOf>() + .apply { + if (beforeLt != null) { + put("before_lt", listOf(beforeLt.toString())) + } + put("limit", listOf(limit.toString())) + if (startDate != null) { + put("start_date", listOf(startDate.toString())) + } + if (endDate != null) { + put("end_date", listOf(endDate.toString())) + } + } + val localVariableHeaders: MutableMap = mutableMapOf() + acceptLanguage?.apply { localVariableHeaders["Accept-Language"] = this.toString() } + localVariableHeaders["Accept"] = "application/json" + + return RequestConfig( + method = RequestMethod.GET, + path = "/v2/accounts/{account_id}/extra-currency/{id}/history".replace("{"+"account_id"+"}", encodeURIComponent(accountId.toString())).replace("{"+"id"+"}", encodeURIComponent(id.toString())), + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun getAccountJettonBalance(accountId: kotlin.String, jettonId: kotlin.String, currencies: kotlin.collections.List? = null, supportedExtensions: kotlin.collections.List? = null) : JettonBalance { + val localVarResponse = getAccountJettonBalanceWithHttpInfo(accountId = accountId, jettonId = jettonId, currencies = currencies, supportedExtensions = supportedExtensions) return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as JettonBalance @@ -665,41 +506,26 @@ class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien } } - /** - * - * Get Jetton balance by owner address - * @param accountId account ID - * @param jettonId jetton ID - * @param currencies accept ton and all possible fiat currencies, separated by commas (optional) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun getAccountJettonBalanceWithHttpInfo(accountId: kotlin.String, jettonId: kotlin.String, currencies: kotlin.collections.List?) : ApiResponse { - val localVariableConfig = getAccountJettonBalanceRequestConfig(accountId = accountId, jettonId = jettonId, currencies = currencies) + fun getAccountJettonBalanceWithHttpInfo(accountId: kotlin.String, jettonId: kotlin.String, currencies: kotlin.collections.List?, supportedExtensions: kotlin.collections.List?) : ApiResponse { + val localVariableConfig = getAccountJettonBalanceRequestConfig(accountId = accountId, jettonId = jettonId, currencies = currencies, supportedExtensions = supportedExtensions) return request( localVariableConfig ) } - /** - * To obtain the request config of the operation getAccountJettonBalance - * - * @param accountId account ID - * @param jettonId jetton ID - * @param currencies accept ton and all possible fiat currencies, separated by commas (optional) - * @return RequestConfig - */ - fun getAccountJettonBalanceRequestConfig(accountId: kotlin.String, jettonId: kotlin.String, currencies: kotlin.collections.List?) : RequestConfig { + fun getAccountJettonBalanceRequestConfig(accountId: kotlin.String, jettonId: kotlin.String, currencies: kotlin.collections.List?, supportedExtensions: kotlin.collections.List?) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf>() .apply { if (currencies != null) { put("currencies", toMultiValue(currencies.toList(), "csv")) } + if (supportedExtensions != null) { + put("supported_extensions", toMultiValue(supportedExtensions.toList(), "csv")) + } } val localVariableHeaders: MutableMap = mutableMapOf() localVariableHeaders["Accept"] = "application/json" @@ -714,26 +540,11 @@ class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien ) } - /** - * - * Get the transfer jetton history for account and jetton - * @param accountId account ID - * @param jettonId jetton ID - * @param limit - * @param acceptLanguage (optional, default to "en") - * @param beforeLt omit this parameter to get last events (optional) - * @param startDate (optional) - * @param endDate (optional) - * @return AccountEvents - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Deprecated(message = "This operation is deprecated.") fun getAccountJettonHistoryByID(accountId: kotlin.String, jettonId: kotlin.String, limit: kotlin.Int, acceptLanguage: kotlin.String? = "en", beforeLt: kotlin.Long? = null, startDate: kotlin.Long? = null, endDate: kotlin.Long? = null) : AccountEvents { + @Suppress("DEPRECATION") val localVarResponse = getAccountJettonHistoryByIDWithHttpInfo(accountId = accountId, jettonId = jettonId, limit = limit, acceptLanguage = acceptLanguage, beforeLt = beforeLt, startDate = startDate, endDate = endDate) return when (localVarResponse.responseType) { @@ -751,23 +562,11 @@ class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien } } - /** - * - * Get the transfer jetton history for account and jetton - * @param accountId account ID - * @param jettonId jetton ID - * @param limit - * @param acceptLanguage (optional, default to "en") - * @param beforeLt omit this parameter to get last events (optional) - * @param startDate (optional) - * @param endDate (optional) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) + @Deprecated(message = "This operation is deprecated.") fun getAccountJettonHistoryByIDWithHttpInfo(accountId: kotlin.String, jettonId: kotlin.String, limit: kotlin.Int, acceptLanguage: kotlin.String?, beforeLt: kotlin.Long?, startDate: kotlin.Long?, endDate: kotlin.Long?) : ApiResponse { + @Suppress("DEPRECATION") val localVariableConfig = getAccountJettonHistoryByIDRequestConfig(accountId = accountId, jettonId = jettonId, limit = limit, acceptLanguage = acceptLanguage, beforeLt = beforeLt, startDate = startDate, endDate = endDate) return request( @@ -775,18 +574,7 @@ class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien ) } - /** - * To obtain the request config of the operation getAccountJettonHistoryByID - * - * @param accountId account ID - * @param jettonId jetton ID - * @param limit - * @param acceptLanguage (optional, default to "en") - * @param beforeLt omit this parameter to get last events (optional) - * @param startDate (optional) - * @param endDate (optional) - * @return RequestConfig - */ + @Deprecated(message = "This operation is deprecated.") fun getAccountJettonHistoryByIDRequestConfig(accountId: kotlin.String, jettonId: kotlin.String, limit: kotlin.Int, acceptLanguage: kotlin.String?, beforeLt: kotlin.Long?, startDate: kotlin.Long?, endDate: kotlin.Long?) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf>() @@ -816,22 +604,10 @@ class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien ) } - /** - * - * Get all Jettons balances by owner address - * @param accountId account ID - * @param currencies accept ton and all possible fiat currencies, separated by commas (optional) - * @return JettonsBalances - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getAccountJettonsBalances(accountId: kotlin.String, currencies: kotlin.collections.List? = null, extensions: List? = null) : JettonsBalances { - val localVarResponse = getAccountJettonsBalancesWithHttpInfo(accountId = accountId, currencies = currencies, extensions = extensions) + fun getAccountJettonsBalances(accountId: kotlin.String, currencies: kotlin.collections.List? = null, supportedExtensions: kotlin.collections.List? = null) : JettonsBalances { + val localVarResponse = getAccountJettonsBalancesWithHttpInfo(accountId = accountId, currencies = currencies, supportedExtensions = supportedExtensions) return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as JettonsBalances @@ -848,41 +624,25 @@ class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien } } - /** - * - * Get all Jettons balances by owner address - * @param accountId account ID - * @param currencies accept ton and all possible fiat currencies, separated by commas (optional) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun getAccountJettonsBalancesWithHttpInfo(accountId: kotlin.String, currencies: kotlin.collections.List?, extensions: List?) : ApiResponse { - val localVariableConfig = getAccountJettonsBalancesRequestConfig(accountId = accountId, currencies = currencies, extensions = extensions) + fun getAccountJettonsBalancesWithHttpInfo(accountId: kotlin.String, currencies: kotlin.collections.List?, supportedExtensions: kotlin.collections.List?) : ApiResponse { + val localVariableConfig = getAccountJettonsBalancesRequestConfig(accountId = accountId, currencies = currencies, supportedExtensions = supportedExtensions) return request( localVariableConfig ) } - /** - * To obtain the request config of the operation getAccountJettonsBalances - * - * @param accountId account ID - * @param currencies accept ton and all possible fiat currencies, separated by commas (optional) - * @return RequestConfig - */ - fun getAccountJettonsBalancesRequestConfig(accountId: kotlin.String, currencies: kotlin.collections.List?, extensions: List?) : RequestConfig { + fun getAccountJettonsBalancesRequestConfig(accountId: kotlin.String, currencies: kotlin.collections.List?, supportedExtensions: kotlin.collections.List?) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf>() .apply { if (currencies != null) { put("currencies", toMultiValue(currencies.toList(), "csv")) } - if (extensions != null) { - put("supported_extensions", toMultiValue(extensions.toList(), "csv")) + if (supportedExtensions != null) { + put("supported_extensions", toMultiValue(supportedExtensions.toList(), "csv")) } } val localVariableHeaders: MutableMap = mutableMapOf() @@ -898,29 +658,13 @@ class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien ) } - /** - * - * Get the transfer jettons history for account - * @param accountId account ID - * @param limit - * @param acceptLanguage (optional, default to "en") - * @param beforeLt omit this parameter to get last events (optional) - * @param startDate (optional) - * @param endDate (optional) - * @return AccountEvents - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getAccountJettonsHistory(accountId: kotlin.String, limit: kotlin.Int, acceptLanguage: kotlin.String? = "en", beforeLt: kotlin.Long? = null, startDate: kotlin.Long? = null, endDate: kotlin.Long? = null) : AccountEvents { - val localVarResponse = getAccountJettonsHistoryWithHttpInfo(accountId = accountId, limit = limit, acceptLanguage = acceptLanguage, beforeLt = beforeLt, startDate = startDate, endDate = endDate) + fun getAccountJettonsHistory(accountId: kotlin.String, limit: kotlin.Int, beforeLt: kotlin.Long? = null) : JettonOperations { + val localVarResponse = getAccountJettonsHistoryWithHttpInfo(accountId = accountId, limit = limit, beforeLt = beforeLt) return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as AccountEvents + ResponseType.Success -> (localVarResponse as Success<*>).data as JettonOperations ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") ResponseType.ClientError -> { @@ -934,41 +678,17 @@ class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien } } - /** - * - * Get the transfer jettons history for account - * @param accountId account ID - * @param limit - * @param acceptLanguage (optional, default to "en") - * @param beforeLt omit this parameter to get last events (optional) - * @param startDate (optional) - * @param endDate (optional) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun getAccountJettonsHistoryWithHttpInfo(accountId: kotlin.String, limit: kotlin.Int, acceptLanguage: kotlin.String?, beforeLt: kotlin.Long?, startDate: kotlin.Long?, endDate: kotlin.Long?) : ApiResponse { - val localVariableConfig = getAccountJettonsHistoryRequestConfig(accountId = accountId, limit = limit, acceptLanguage = acceptLanguage, beforeLt = beforeLt, startDate = startDate, endDate = endDate) + fun getAccountJettonsHistoryWithHttpInfo(accountId: kotlin.String, limit: kotlin.Int, beforeLt: kotlin.Long?) : ApiResponse { + val localVariableConfig = getAccountJettonsHistoryRequestConfig(accountId = accountId, limit = limit, beforeLt = beforeLt) - return request( + return request( localVariableConfig ) } - /** - * To obtain the request config of the operation getAccountJettonsHistory - * - * @param accountId account ID - * @param limit - * @param acceptLanguage (optional, default to "en") - * @param beforeLt omit this parameter to get last events (optional) - * @param startDate (optional) - * @param endDate (optional) - * @return RequestConfig - */ - fun getAccountJettonsHistoryRequestConfig(accountId: kotlin.String, limit: kotlin.Int, acceptLanguage: kotlin.String?, beforeLt: kotlin.Long?, startDate: kotlin.Long?, endDate: kotlin.Long?) : RequestConfig { + fun getAccountJettonsHistoryRequestConfig(accountId: kotlin.String, limit: kotlin.Int, beforeLt: kotlin.Long?) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf>() .apply { @@ -976,15 +696,8 @@ class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien put("before_lt", listOf(beforeLt.toString())) } put("limit", listOf(limit.toString())) - if (startDate != null) { - put("start_date", listOf(startDate.toString())) - } - if (endDate != null) { - put("end_date", listOf(endDate.toString())) - } } val localVariableHeaders: MutableMap = mutableMapOf() - acceptLanguage?.apply { localVariableHeaders["Accept-Language"] = this.toString() } localVariableHeaders["Accept"] = "application/json" return RequestConfig( @@ -997,17 +710,6 @@ class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien ) } - /** - * - * Get account's multisigs - * @param accountId account ID - * @return Multisigs - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getAccountMultisigs(accountId: kotlin.String) : Multisigs { @@ -1028,14 +730,6 @@ class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien } } - /** - * - * Get account's multisigs - * @param accountId account ID - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getAccountMultisigsWithHttpInfo(accountId: kotlin.String) : ApiResponse { @@ -1046,12 +740,6 @@ class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien ) } - /** - * To obtain the request config of the operation getAccountMultisigs - * - * @param accountId account ID - * @return RequestConfig - */ fun getAccountMultisigsRequestConfig(accountId: kotlin.String) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() @@ -1068,21 +756,6 @@ class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien ) } - /** - * - * Get all NFT items by owner address - * @param accountId account ID - * @param collection nft collection (optional) - * @param limit (optional, default to 1000) - * @param offset (optional, default to 0) - * @param indirectOwnership Selling nft items in ton implemented usually via transfer items to special selling account. This option enables including items which owned not directly. (optional, default to false) - * @return NftItems - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getAccountNftItems(accountId: kotlin.String, collection: kotlin.String? = null, limit: kotlin.Int? = 1000, offset: kotlin.Int? = 0, indirectOwnership: kotlin.Boolean? = false) : NftItems { @@ -1103,18 +776,6 @@ class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien } } - /** - * - * Get all NFT items by owner address - * @param accountId account ID - * @param collection nft collection (optional) - * @param limit (optional, default to 1000) - * @param offset (optional, default to 0) - * @param indirectOwnership Selling nft items in ton implemented usually via transfer items to special selling account. This option enables including items which owned not directly. (optional, default to false) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getAccountNftItemsWithHttpInfo(accountId: kotlin.String, collection: kotlin.String?, limit: kotlin.Int?, offset: kotlin.Int?, indirectOwnership: kotlin.Boolean?) : ApiResponse { @@ -1125,16 +786,6 @@ class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien ) } - /** - * To obtain the request config of the operation getAccountNftItems - * - * @param accountId account ID - * @param collection nft collection (optional) - * @param limit (optional, default to 1000) - * @param offset (optional, default to 0) - * @param indirectOwnership Selling nft items in ton implemented usually via transfer items to special selling account. This option enables including items which owned not directly. (optional, default to false) - * @return RequestConfig - */ fun getAccountNftItemsRequestConfig(accountId: kotlin.String, collection: kotlin.String?, limit: kotlin.Int?, offset: kotlin.Int?, indirectOwnership: kotlin.Boolean?) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf>() @@ -1165,17 +816,6 @@ class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien ) } - /** - * - * Get public key by account id - * @param accountId account ID - * @return GetAccountPublicKey200Response - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getAccountPublicKey(accountId: kotlin.String) : GetAccountPublicKey200Response { @@ -1196,14 +836,6 @@ class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien } } - /** - * - * Get public key by account id - * @param accountId account ID - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getAccountPublicKeyWithHttpInfo(accountId: kotlin.String) : ApiResponse { @@ -1214,12 +846,6 @@ class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien ) } - /** - * To obtain the request config of the operation getAccountPublicKey - * - * @param accountId account ID - * @return RequestConfig - */ fun getAccountPublicKeyRequestConfig(accountId: kotlin.String) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() @@ -1236,17 +862,6 @@ class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien ) } - /** - * - * Get all subscriptions by wallet address - * @param accountId account ID - * @return Subscriptions - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getAccountSubscriptions(accountId: kotlin.String) : Subscriptions { @@ -1267,14 +882,6 @@ class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien } } - /** - * - * Get all subscriptions by wallet address - * @param accountId account ID - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getAccountSubscriptionsWithHttpInfo(accountId: kotlin.String) : ApiResponse { @@ -1285,12 +892,6 @@ class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien ) } - /** - * To obtain the request config of the operation getAccountSubscriptions - * - * @param accountId account ID - * @return RequestConfig - */ fun getAccountSubscriptionsRequestConfig(accountId: kotlin.String) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() @@ -1307,19 +908,6 @@ class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien ) } - /** - * - * Get traces for account - * @param accountId account ID - * @param beforeLt omit this parameter to get last events (optional) - * @param limit (optional, default to 100) - * @return TraceIDs - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getAccountTraces(accountId: kotlin.String, beforeLt: kotlin.Long? = null, limit: kotlin.Int? = 100) : TraceIDs { @@ -1340,16 +928,6 @@ class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien } } - /** - * - * Get traces for account - * @param accountId account ID - * @param beforeLt omit this parameter to get last events (optional) - * @param limit (optional, default to 100) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getAccountTracesWithHttpInfo(accountId: kotlin.String, beforeLt: kotlin.Long?, limit: kotlin.Int?) : ApiResponse { @@ -1360,14 +938,6 @@ class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien ) } - /** - * To obtain the request config of the operation getAccountTraces - * - * @param accountId account ID - * @param beforeLt omit this parameter to get last events (optional) - * @param limit (optional, default to 100) - * @return RequestConfig - */ fun getAccountTracesRequestConfig(accountId: kotlin.String, beforeLt: kotlin.Long?, limit: kotlin.Int?) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf>() @@ -1392,18 +962,6 @@ class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien ) } - /** - * - * Get human-friendly information about several accounts without low-level details. - * @param currency (optional) - * @param getAccountsRequest a list of account ids (optional) - * @return Accounts - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getAccounts(currency: kotlin.String? = null, getAccountsRequest: GetAccountsRequest? = null) : Accounts { @@ -1424,15 +982,6 @@ class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien } } - /** - * - * Get human-friendly information about several accounts without low-level details. - * @param currency (optional) - * @param getAccountsRequest a list of account ids (optional) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getAccountsWithHttpInfo(currency: kotlin.String?, getAccountsRequest: GetAccountsRequest?) : ApiResponse { @@ -1443,13 +992,6 @@ class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien ) } - /** - * To obtain the request config of the operation getAccounts - * - * @param currency (optional) - * @param getAccountsRequest a list of account ids (optional) - * @return RequestConfig - */ fun getAccountsRequestConfig(currency: kotlin.String?, getAccountsRequest: GetAccountsRequest?) : RequestConfig { val localVariableBody = getAccountsRequest val localVariableQuery: MultiValueMap = mutableMapOf>() @@ -1472,17 +1014,65 @@ class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien ) } - /** - * - * Update internal cache for a particular account - * @param accountId account ID - * @return void - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun getJettonAccountHistoryByID(accountId: kotlin.String, jettonId: kotlin.String, limit: kotlin.Int, beforeLt: kotlin.Long? = null, startDate: kotlin.Long? = null, endDate: kotlin.Long? = null) : JettonOperations { + val localVarResponse = getJettonAccountHistoryByIDWithHttpInfo(accountId = accountId, jettonId = jettonId, limit = limit, beforeLt = beforeLt, startDate = startDate, endDate = endDate) + + return when (localVarResponse.responseType) { + ResponseType.Success -> (localVarResponse as Success<*>).data as JettonOperations + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> { + val localVarError = localVarResponse as ClientError<*> + throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + } + ResponseType.ServerError -> { + val localVarError = localVarResponse as ServerError<*> + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) + } + } + } + + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun getJettonAccountHistoryByIDWithHttpInfo(accountId: kotlin.String, jettonId: kotlin.String, limit: kotlin.Int, beforeLt: kotlin.Long?, startDate: kotlin.Long?, endDate: kotlin.Long?) : ApiResponse { + val localVariableConfig = getJettonAccountHistoryByIDRequestConfig(accountId = accountId, jettonId = jettonId, limit = limit, beforeLt = beforeLt, startDate = startDate, endDate = endDate) + + return request( + localVariableConfig + ) + } + + fun getJettonAccountHistoryByIDRequestConfig(accountId: kotlin.String, jettonId: kotlin.String, limit: kotlin.Int, beforeLt: kotlin.Long?, startDate: kotlin.Long?, endDate: kotlin.Long?) : RequestConfig { + val localVariableBody = null + val localVariableQuery: MultiValueMap = mutableMapOf>() + .apply { + if (beforeLt != null) { + put("before_lt", listOf(beforeLt.toString())) + } + put("limit", listOf(limit.toString())) + if (startDate != null) { + put("start_date", listOf(startDate.toString())) + } + if (endDate != null) { + put("end_date", listOf(endDate.toString())) + } + } + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" + + return RequestConfig( + method = RequestMethod.GET, + path = "/v2/jettons/{jetton_id}/accounts/{account_id}/history".replace("{"+"account_id"+"}", encodeURIComponent(accountId.toString())).replace("{"+"jetton_id"+"}", encodeURIComponent(jettonId.toString())), + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun reindexAccount(accountId: kotlin.String) : Unit { val localVarResponse = reindexAccountWithHttpInfo(accountId = accountId) @@ -1502,14 +1092,7 @@ class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien } } - /** - * - * Update internal cache for a particular account - * @param accountId account ID - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ + @Throws(IllegalStateException::class, IOException::class) fun reindexAccountWithHttpInfo(accountId: kotlin.String) : ApiResponse { val localVariableConfig = reindexAccountRequestConfig(accountId = accountId) @@ -1519,12 +1102,6 @@ class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien ) } - /** - * To obtain the request config of the operation reindexAccount - * - * @param accountId account ID - * @return RequestConfig - */ fun reindexAccountRequestConfig(accountId: kotlin.String) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() @@ -1541,17 +1118,6 @@ class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien ) } - /** - * - * Search by account domain name - * @param name - * @return FoundAccounts - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun searchAccounts(name: kotlin.String) : FoundAccounts { @@ -1572,14 +1138,6 @@ class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien } } - /** - * - * Search by account domain name - * @param name - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun searchAccountsWithHttpInfo(name: kotlin.String) : ApiResponse { @@ -1590,12 +1148,6 @@ class AccountsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien ) } - /** - * To obtain the request config of the operation searchAccounts - * - * @param name - * @return RequestConfig - */ fun searchAccountsRequestConfig(name: kotlin.String) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf>() diff --git a/tonapi/src/main/kotlin/io/tonapi/apis/BlockchainApi.kt b/tonapi/src/main/kotlin/io/tonapi/apis/BlockchainApi.kt index f377e8522..cc34893ef 100644 --- a/tonapi/src/main/kotlin/io/tonapi/apis/BlockchainApi.kt +++ b/tonapi/src/main/kotlin/io/tonapi/apis/BlockchainApi.kt @@ -16,7 +16,7 @@ package io.tonapi.apis import java.io.IOException -import okhttp3.OkHttpClient +import okhttp3.Call import okhttp3.HttpUrl import io.tonapi.models.BlockchainAccountInspect @@ -24,34 +24,36 @@ import io.tonapi.models.BlockchainBlock import io.tonapi.models.BlockchainBlockShards import io.tonapi.models.BlockchainBlocks import io.tonapi.models.BlockchainConfig +import io.tonapi.models.BlockchainLibrary import io.tonapi.models.BlockchainRawAccount +import io.tonapi.models.ExecGetMethodWithBodyForBlockchainAccountRequest +import io.tonapi.models.InlineObject import io.tonapi.models.MethodExecutionResult import io.tonapi.models.RawBlockchainConfig import io.tonapi.models.ReducedBlocks import io.tonapi.models.SendBlockchainMessageRequest -import io.tonapi.models.ServiceStatus -import io.tonapi.models.StatusDefaultResponse import io.tonapi.models.Transaction import io.tonapi.models.Transactions import io.tonapi.models.Validators -import com.squareup.moshi.Json - -import io.tonapi.infrastructure.ApiClient -import io.tonapi.infrastructure.ApiResponse -import io.tonapi.infrastructure.ClientException -import io.tonapi.infrastructure.ClientError -import io.tonapi.infrastructure.ServerException -import io.tonapi.infrastructure.ServerError -import io.tonapi.infrastructure.MultiValueMap -import io.tonapi.infrastructure.PartConfig -import io.tonapi.infrastructure.RequestConfig -import io.tonapi.infrastructure.RequestMethod -import io.tonapi.infrastructure.ResponseType -import io.tonapi.infrastructure.Success -import io.tonapi.infrastructure.toMultiValue - -class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = ApiClient.defaultClient) : ApiClient(basePath, client) { +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +import io.infrastructure.ApiClient +import io.infrastructure.ApiResponse +import io.infrastructure.ClientException +import io.infrastructure.ClientError +import io.infrastructure.ServerException +import io.infrastructure.ServerError +import io.infrastructure.MultiValueMap +import io.infrastructure.PartConfig +import io.infrastructure.RequestConfig +import io.infrastructure.RequestMethod +import io.infrastructure.ResponseType +import io.infrastructure.Success +import io.infrastructure.toMultiValue + +class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory = ApiClient.defaultClient) : ApiClient(basePath, client) { companion object { @JvmStatic val defaultBasePath: String by lazy { @@ -59,17 +61,6 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli } } - /** - * - * Blockchain account inspect - * @param accountId account ID - * @return BlockchainAccountInspect - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun blockchainAccountInspect(accountId: kotlin.String) : BlockchainAccountInspect { @@ -90,14 +81,6 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli } } - /** - * - * Blockchain account inspect - * @param accountId account ID - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun blockchainAccountInspectWithHttpInfo(accountId: kotlin.String) : ApiResponse { @@ -108,12 +91,6 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * To obtain the request config of the operation blockchainAccountInspect - * - * @param accountId account ID - * @return RequestConfig - */ fun blockchainAccountInspectRequestConfig(accountId: kotlin.String) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() @@ -130,19 +107,52 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * - * Execute get method for account - * @param accountId account ID - * @param methodName contract get method name - * @param args (optional) - * @return MethodExecutionResult - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun downloadBlockchainBlockBoc(blockId: kotlin.String) : java.io.File { + val localVarResponse = downloadBlockchainBlockBocWithHttpInfo(blockId = blockId) + + return when (localVarResponse.responseType) { + ResponseType.Success -> (localVarResponse as Success<*>).data as java.io.File + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> { + val localVarError = localVarResponse as ClientError<*> + throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + } + ResponseType.ServerError -> { + val localVarError = localVarResponse as ServerError<*> + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) + } + } + } + + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun downloadBlockchainBlockBocWithHttpInfo(blockId: kotlin.String) : ApiResponse { + val localVariableConfig = downloadBlockchainBlockBocRequestConfig(blockId = blockId) + + return request( + localVariableConfig + ) + } + + fun downloadBlockchainBlockBocRequestConfig(blockId: kotlin.String) : RequestConfig { + val localVariableBody = null + val localVariableQuery: MultiValueMap = mutableMapOf() + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/octet-stream, application/json" + + return RequestConfig( + method = RequestMethod.GET, + path = "/v2/blockchain/blocks/{block_id}/boc".replace("{"+"block_id"+"}", encodeURIComponent(blockId.toString())), + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun execGetMethodForBlockchainAccount(accountId: kotlin.String, methodName: kotlin.String, args: kotlin.collections.List? = null) : MethodExecutionResult { @@ -163,16 +173,6 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli } } - /** - * - * Execute get method for account - * @param accountId account ID - * @param methodName contract get method name - * @param args (optional) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun execGetMethodForBlockchainAccountWithHttpInfo(accountId: kotlin.String, methodName: kotlin.String, args: kotlin.collections.List?) : ApiResponse { @@ -183,14 +183,6 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * To obtain the request config of the operation execGetMethodForBlockchainAccount - * - * @param accountId account ID - * @param methodName contract get method name - * @param args (optional) - * @return RequestConfig - */ fun execGetMethodForBlockchainAccountRequestConfig(accountId: kotlin.String, methodName: kotlin.String, args: kotlin.collections.List?) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf>() @@ -212,29 +204,70 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun execGetMethodWithBodyForBlockchainAccount(accountId: kotlin.String, methodName: kotlin.String, execGetMethodWithBodyForBlockchainAccountRequest: ExecGetMethodWithBodyForBlockchainAccountRequest? = null) : MethodExecutionResult { + val localVarResponse = execGetMethodWithBodyForBlockchainAccountWithHttpInfo(accountId = accountId, methodName = methodName, execGetMethodWithBodyForBlockchainAccountRequest = execGetMethodWithBodyForBlockchainAccountRequest) + + return when (localVarResponse.responseType) { + ResponseType.Success -> (localVarResponse as Success<*>).data as MethodExecutionResult + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> { + val localVarError = localVarResponse as ClientError<*> + throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + } + ResponseType.ServerError -> { + val localVarError = localVarResponse as ServerError<*> + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) + } + } + } + + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun execGetMethodWithBodyForBlockchainAccountWithHttpInfo(accountId: kotlin.String, methodName: kotlin.String, execGetMethodWithBodyForBlockchainAccountRequest: ExecGetMethodWithBodyForBlockchainAccountRequest?) : ApiResponse { + val localVariableConfig = execGetMethodWithBodyForBlockchainAccountRequestConfig(accountId = accountId, methodName = methodName, execGetMethodWithBodyForBlockchainAccountRequest = execGetMethodWithBodyForBlockchainAccountRequest) + + return request( + localVariableConfig + ) + } + + fun execGetMethodWithBodyForBlockchainAccountRequestConfig(accountId: kotlin.String, methodName: kotlin.String, execGetMethodWithBodyForBlockchainAccountRequest: ExecGetMethodWithBodyForBlockchainAccountRequest?) : RequestConfig { + val localVariableBody = execGetMethodWithBodyForBlockchainAccountRequest + val localVariableQuery: MultiValueMap = mutableMapOf() + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "application/json" + + return RequestConfig( + method = RequestMethod.POST, + path = "/v2/blockchain/accounts/{account_id}/methods/{method_name}".replace("{"+"account_id"+"}", encodeURIComponent(accountId.toString())).replace("{"+"method_name"+"}", encodeURIComponent(methodName.toString())), + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + /** * enum for parameter sortOrder */ enum class SortOrderGetBlockchainAccountTransactions(val value: kotlin.String) { - @Json(name = "desc") desc("desc"), - @Json(name = "asc") asc("asc") + @SerialName(value = "desc") desc("desc"), + @SerialName(value = "asc") asc("asc"); + + /** + * Override [toString()] to avoid using the enum variable name as the value, and instead use + * the actual value defined in the API spec file. + * + * This solves a problem when the variable name and its value are different, and ensures that + * the client sends the correct enum values to the server always. + */ + override fun toString(): kotlin.String = "$value" } - /** - * - * Get account transactions - * @param accountId account ID - * @param afterLt omit this parameter to get last transactions (optional) - * @param beforeLt omit this parameter to get last transactions (optional) - * @param limit (optional, default to 100) - * @param sortOrder (optional, default to desc) - * @return Transactions - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getBlockchainAccountTransactions(accountId: kotlin.String, afterLt: kotlin.Long? = null, beforeLt: kotlin.Long? = null, limit: kotlin.Int? = 100, sortOrder: SortOrderGetBlockchainAccountTransactions? = SortOrderGetBlockchainAccountTransactions.desc) : Transactions { @@ -255,18 +288,6 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli } } - /** - * - * Get account transactions - * @param accountId account ID - * @param afterLt omit this parameter to get last transactions (optional) - * @param beforeLt omit this parameter to get last transactions (optional) - * @param limit (optional, default to 100) - * @param sortOrder (optional, default to desc) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getBlockchainAccountTransactionsWithHttpInfo(accountId: kotlin.String, afterLt: kotlin.Long?, beforeLt: kotlin.Long?, limit: kotlin.Int?, sortOrder: SortOrderGetBlockchainAccountTransactions?) : ApiResponse { @@ -277,16 +298,6 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * To obtain the request config of the operation getBlockchainAccountTransactions - * - * @param accountId account ID - * @param afterLt omit this parameter to get last transactions (optional) - * @param beforeLt omit this parameter to get last transactions (optional) - * @param limit (optional, default to 100) - * @param sortOrder (optional, default to desc) - * @return RequestConfig - */ fun getBlockchainAccountTransactionsRequestConfig(accountId: kotlin.String, afterLt: kotlin.Long?, beforeLt: kotlin.Long?, limit: kotlin.Int?, sortOrder: SortOrderGetBlockchainAccountTransactions?) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf>() @@ -317,17 +328,6 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * - * Get blockchain block data - * @param blockId block ID - * @return BlockchainBlock - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getBlockchainBlock(blockId: kotlin.String) : BlockchainBlock { @@ -348,14 +348,6 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli } } - /** - * - * Get blockchain block data - * @param blockId block ID - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getBlockchainBlockWithHttpInfo(blockId: kotlin.String) : ApiResponse { @@ -366,12 +358,6 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * To obtain the request config of the operation getBlockchainBlock - * - * @param blockId block ID - * @return RequestConfig - */ fun getBlockchainBlockRequestConfig(blockId: kotlin.String) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() @@ -388,17 +374,6 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * - * Get transactions from block - * @param blockId block ID - * @return Transactions - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getBlockchainBlockTransactions(blockId: kotlin.String) : Transactions { @@ -419,14 +394,6 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli } } - /** - * - * Get transactions from block - * @param blockId block ID - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getBlockchainBlockTransactionsWithHttpInfo(blockId: kotlin.String) : ApiResponse { @@ -437,12 +404,6 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * To obtain the request config of the operation getBlockchainBlockTransactions - * - * @param blockId block ID - * @return RequestConfig - */ fun getBlockchainBlockTransactionsRequestConfig(blockId: kotlin.String) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() @@ -459,16 +420,6 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * - * Get blockchain config - * @return BlockchainConfig - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getBlockchainConfig() : BlockchainConfig { @@ -489,13 +440,6 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli } } - /** - * - * Get blockchain config - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getBlockchainConfigWithHttpInfo() : ApiResponse { @@ -506,11 +450,6 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * To obtain the request config of the operation getBlockchainConfig - * - * @return RequestConfig - */ fun getBlockchainConfigRequestConfig() : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() @@ -527,17 +466,6 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * - * Get blockchain config from a specific block, if present. - * @param masterchainSeqno masterchain block seqno - * @return BlockchainConfig - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getBlockchainConfigFromBlock(masterchainSeqno: kotlin.Int) : BlockchainConfig { @@ -558,14 +486,6 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli } } - /** - * - * Get blockchain config from a specific block, if present. - * @param masterchainSeqno masterchain block seqno - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getBlockchainConfigFromBlockWithHttpInfo(masterchainSeqno: kotlin.Int) : ApiResponse { @@ -576,12 +496,6 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * To obtain the request config of the operation getBlockchainConfigFromBlock - * - * @param masterchainSeqno masterchain block seqno - * @return RequestConfig - */ fun getBlockchainConfigFromBlockRequestConfig(masterchainSeqno: kotlin.Int) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() @@ -598,17 +512,6 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * - * Get all blocks in all shards and workchains between target and previous masterchain block according to shards last blocks snapshot in masterchain. We don't recommend to build your app around this method because it has problem with scalability and will work very slow in the future. - * @param masterchainSeqno masterchain block seqno - * @return BlockchainBlocks - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getBlockchainMasterchainBlocks(masterchainSeqno: kotlin.Int) : BlockchainBlocks { @@ -629,14 +532,6 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli } } - /** - * - * Get all blocks in all shards and workchains between target and previous masterchain block according to shards last blocks snapshot in masterchain. We don't recommend to build your app around this method because it has problem with scalability and will work very slow in the future. - * @param masterchainSeqno masterchain block seqno - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getBlockchainMasterchainBlocksWithHttpInfo(masterchainSeqno: kotlin.Int) : ApiResponse { @@ -647,12 +542,6 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * To obtain the request config of the operation getBlockchainMasterchainBlocks - * - * @param masterchainSeqno masterchain block seqno - * @return RequestConfig - */ fun getBlockchainMasterchainBlocksRequestConfig(masterchainSeqno: kotlin.Int) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() @@ -669,16 +558,6 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * - * Get last known masterchain block - * @return BlockchainBlock - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getBlockchainMasterchainHead() : BlockchainBlock { @@ -699,13 +578,6 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli } } - /** - * - * Get last known masterchain block - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getBlockchainMasterchainHeadWithHttpInfo() : ApiResponse { @@ -716,11 +588,6 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * To obtain the request config of the operation getBlockchainMasterchainHead - * - * @return RequestConfig - */ fun getBlockchainMasterchainHeadRequestConfig() : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() @@ -737,17 +604,6 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * - * Get blockchain block shards - * @param masterchainSeqno masterchain block seqno - * @return BlockchainBlockShards - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getBlockchainMasterchainShards(masterchainSeqno: kotlin.Int) : BlockchainBlockShards { @@ -768,14 +624,6 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli } } - /** - * - * Get blockchain block shards - * @param masterchainSeqno masterchain block seqno - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getBlockchainMasterchainShardsWithHttpInfo(masterchainSeqno: kotlin.Int) : ApiResponse { @@ -786,12 +634,6 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * To obtain the request config of the operation getBlockchainMasterchainShards - * - * @param masterchainSeqno masterchain block seqno - * @return RequestConfig - */ fun getBlockchainMasterchainShardsRequestConfig(masterchainSeqno: kotlin.Int) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() @@ -808,17 +650,6 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * - * Get all transactions in all shards and workchains between target and previous masterchain block according to shards last blocks snapshot in masterchain. We don't recommend to build your app around this method because it has problem with scalability and will work very slow in the future. - * @param masterchainSeqno masterchain block seqno - * @return Transactions - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getBlockchainMasterchainTransactions(masterchainSeqno: kotlin.Int) : Transactions { @@ -839,14 +670,6 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli } } - /** - * - * Get all transactions in all shards and workchains between target and previous masterchain block according to shards last blocks snapshot in masterchain. We don't recommend to build your app around this method because it has problem with scalability and will work very slow in the future. - * @param masterchainSeqno masterchain block seqno - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getBlockchainMasterchainTransactionsWithHttpInfo(masterchainSeqno: kotlin.Int) : ApiResponse { @@ -857,12 +680,6 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * To obtain the request config of the operation getBlockchainMasterchainTransactions - * - * @param masterchainSeqno masterchain block seqno - * @return RequestConfig - */ fun getBlockchainMasterchainTransactionsRequestConfig(masterchainSeqno: kotlin.Int) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() @@ -879,17 +696,6 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * - * Get low-level information about an account taken directly from the blockchain. - * @param accountId account ID - * @return BlockchainRawAccount - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getBlockchainRawAccount(accountId: kotlin.String) : BlockchainRawAccount { @@ -910,14 +716,6 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli } } - /** - * - * Get low-level information about an account taken directly from the blockchain. - * @param accountId account ID - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getBlockchainRawAccountWithHttpInfo(accountId: kotlin.String) : ApiResponse { @@ -928,12 +726,6 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * To obtain the request config of the operation getBlockchainRawAccount - * - * @param accountId account ID - * @return RequestConfig - */ fun getBlockchainRawAccountRequestConfig(accountId: kotlin.String) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() @@ -950,17 +742,6 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * - * Get transaction data - * @param transactionId transaction ID - * @return Transaction - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getBlockchainTransaction(transactionId: kotlin.String) : Transaction { @@ -981,14 +762,6 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli } } - /** - * - * Get transaction data - * @param transactionId transaction ID - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getBlockchainTransactionWithHttpInfo(transactionId: kotlin.String) : ApiResponse { @@ -999,12 +772,6 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * To obtain the request config of the operation getBlockchainTransaction - * - * @param transactionId transaction ID - * @return RequestConfig - */ fun getBlockchainTransactionRequestConfig(transactionId: kotlin.String) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() @@ -1021,17 +788,6 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * - * Get transaction data by message hash - * @param msgId message ID - * @return Transaction - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getBlockchainTransactionByMessageHash(msgId: kotlin.String) : Transaction { @@ -1052,14 +808,6 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli } } - /** - * - * Get transaction data by message hash - * @param msgId message ID - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getBlockchainTransactionByMessageHashWithHttpInfo(msgId: kotlin.String) : ApiResponse { @@ -1070,12 +818,6 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * To obtain the request config of the operation getBlockchainTransactionByMessageHash - * - * @param msgId message ID - * @return RequestConfig - */ fun getBlockchainTransactionByMessageHashRequestConfig(msgId: kotlin.String) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() @@ -1092,16 +834,6 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * - * Get blockchain validators - * @return Validators - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getBlockchainValidators() : Validators { @@ -1122,13 +854,6 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli } } - /** - * - * Get blockchain validators - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getBlockchainValidatorsWithHttpInfo() : ApiResponse { @@ -1139,11 +864,6 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * To obtain the request config of the operation getBlockchainValidators - * - * @return RequestConfig - */ fun getBlockchainValidatorsRequestConfig() : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() @@ -1160,16 +880,52 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * - * Get raw blockchain config - * @return RawBlockchainConfig - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun getLibraryByHash(hash: kotlin.String) : BlockchainLibrary { + val localVarResponse = getLibraryByHashWithHttpInfo(hash = hash) + + return when (localVarResponse.responseType) { + ResponseType.Success -> (localVarResponse as Success<*>).data as BlockchainLibrary + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> { + val localVarError = localVarResponse as ClientError<*> + throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + } + ResponseType.ServerError -> { + val localVarError = localVarResponse as ServerError<*> + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) + } + } + } + + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun getLibraryByHashWithHttpInfo(hash: kotlin.String) : ApiResponse { + val localVariableConfig = getLibraryByHashRequestConfig(hash = hash) + + return request( + localVariableConfig + ) + } + + fun getLibraryByHashRequestConfig(hash: kotlin.String) : RequestConfig { + val localVariableBody = null + val localVariableQuery: MultiValueMap = mutableMapOf() + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" + + return RequestConfig( + method = RequestMethod.GET, + path = "/v2/blockchain/libraries/{hash}".replace("{"+"hash"+"}", encodeURIComponent(hash.toString())), + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getRawBlockchainConfig() : RawBlockchainConfig { @@ -1190,13 +946,6 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli } } - /** - * - * Get raw blockchain config - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getRawBlockchainConfigWithHttpInfo() : ApiResponse { @@ -1207,11 +956,6 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * To obtain the request config of the operation getRawBlockchainConfig - * - * @return RequestConfig - */ fun getRawBlockchainConfigRequestConfig() : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() @@ -1228,17 +972,6 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * - * Get raw blockchain config from a specific block, if present. - * @param masterchainSeqno masterchain block seqno - * @return RawBlockchainConfig - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getRawBlockchainConfigFromBlock(masterchainSeqno: kotlin.Int) : RawBlockchainConfig { @@ -1259,14 +992,6 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli } } - /** - * - * Get raw blockchain config from a specific block, if present. - * @param masterchainSeqno masterchain block seqno - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getRawBlockchainConfigFromBlockWithHttpInfo(masterchainSeqno: kotlin.Int) : ApiResponse { @@ -1277,12 +1002,6 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * To obtain the request config of the operation getRawBlockchainConfigFromBlock - * - * @param masterchainSeqno masterchain block seqno - * @return RequestConfig - */ fun getRawBlockchainConfigFromBlockRequestConfig(masterchainSeqno: kotlin.Int) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() @@ -1299,18 +1018,6 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * - * Get reduced blockchain blocks data - * @param from - * @param to - * @return ReducedBlocks - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getReducedBlockchainBlocks(from: kotlin.Long, to: kotlin.Long) : ReducedBlocks { @@ -1331,15 +1038,6 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli } } - /** - * - * Get reduced blockchain blocks data - * @param from - * @param to - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getReducedBlockchainBlocksWithHttpInfo(from: kotlin.Long, to: kotlin.Long) : ApiResponse { @@ -1350,13 +1048,6 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * To obtain the request config of the operation getReducedBlockchainBlocks - * - * @param from - * @param to - * @return RequestConfig - */ fun getReducedBlockchainBlocksRequestConfig(from: kotlin.Long, to: kotlin.Long) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf>() @@ -1377,17 +1068,7 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * - * Send message to blockchain - * @param sendBlockchainMessageRequest both a single boc and a batch of boc serialized in base64/hex are accepted - * @return void - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun sendBlockchainMessage(sendBlockchainMessageRequest: SendBlockchainMessageRequest) : Unit { val localVarResponse = sendBlockchainMessageWithHttpInfo(sendBlockchainMessageRequest = sendBlockchainMessageRequest) @@ -1407,14 +1088,7 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli } } - /** - * - * Send message to blockchain - * @param sendBlockchainMessageRequest both a single boc and a batch of boc serialized in base64/hex are accepted - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ + @Throws(IllegalStateException::class, IOException::class) fun sendBlockchainMessageWithHttpInfo(sendBlockchainMessageRequest: SendBlockchainMessageRequest) : ApiResponse { val localVariableConfig = sendBlockchainMessageRequestConfig(sendBlockchainMessageRequest = sendBlockchainMessageRequest) @@ -1424,18 +1098,13 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * To obtain the request config of the operation sendBlockchainMessage - * - * @param sendBlockchainMessageRequest both a single boc and a batch of boc serialized in base64/hex are accepted - * @return RequestConfig - */ fun sendBlockchainMessageRequestConfig(sendBlockchainMessageRequest: SendBlockchainMessageRequest) : RequestConfig { val localVariableBody = sendBlockchainMessageRequest val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() localVariableHeaders["Content-Type"] = "application/json" localVariableHeaders["Accept"] = "application/json" + return RequestConfig( method = RequestMethod.POST, path = "/v2/blockchain/message", @@ -1446,74 +1115,6 @@ class BlockchainApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * - * Status - * @return ServiceStatus - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun status() : ServiceStatus { - val localVarResponse = statusWithHttpInfo() - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as ServiceStatus - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * - * Status - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ - @Suppress("UNCHECKED_CAST") - @Throws(IllegalStateException::class, IOException::class) - fun statusWithHttpInfo() : ApiResponse { - val localVariableConfig = statusRequestConfig() - - return request( - localVariableConfig - ) - } - - /** - * To obtain the request config of the operation status - * - * @return RequestConfig - */ - fun statusRequestConfig() : RequestConfig { - val localVariableBody = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - localVariableHeaders["Accept"] = "application/json" - - return RequestConfig( - method = RequestMethod.GET, - path = "/v2/status", - query = localVariableQuery, - headers = localVariableHeaders, - requiresAuthentication = false, - body = localVariableBody - ) - } - private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String = HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0] diff --git a/tonapi/src/main/kotlin/io/tonapi/apis/ConnectApi.kt b/tonapi/src/main/kotlin/io/tonapi/apis/ConnectApi.kt index d0cf1a167..38008532e 100644 --- a/tonapi/src/main/kotlin/io/tonapi/apis/ConnectApi.kt +++ b/tonapi/src/main/kotlin/io/tonapi/apis/ConnectApi.kt @@ -16,31 +16,32 @@ package io.tonapi.apis import java.io.IOException -import okhttp3.OkHttpClient +import okhttp3.Call import okhttp3.HttpUrl import io.tonapi.models.AccountInfoByStateInit import io.tonapi.models.GetAccountInfoByStateInitRequest import io.tonapi.models.GetTonConnectPayload200Response -import io.tonapi.models.StatusDefaultResponse - -import com.squareup.moshi.Json - -import io.tonapi.infrastructure.ApiClient -import io.tonapi.infrastructure.ApiResponse -import io.tonapi.infrastructure.ClientException -import io.tonapi.infrastructure.ClientError -import io.tonapi.infrastructure.ServerException -import io.tonapi.infrastructure.ServerError -import io.tonapi.infrastructure.MultiValueMap -import io.tonapi.infrastructure.PartConfig -import io.tonapi.infrastructure.RequestConfig -import io.tonapi.infrastructure.RequestMethod -import io.tonapi.infrastructure.ResponseType -import io.tonapi.infrastructure.Success -import io.tonapi.infrastructure.toMultiValue - -class ConnectApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = ApiClient.defaultClient) : ApiClient(basePath, client) { +import io.tonapi.models.InlineObject + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +import io.infrastructure.ApiClient +import io.infrastructure.ApiResponse +import io.infrastructure.ClientException +import io.infrastructure.ClientError +import io.infrastructure.ServerException +import io.infrastructure.ServerError +import io.infrastructure.MultiValueMap +import io.infrastructure.PartConfig +import io.infrastructure.RequestConfig +import io.infrastructure.RequestMethod +import io.infrastructure.ResponseType +import io.infrastructure.Success +import io.infrastructure.toMultiValue + +class ConnectApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory = ApiClient.defaultClient) : ApiClient(basePath, client) { companion object { @JvmStatic val defaultBasePath: String by lazy { @@ -48,17 +49,6 @@ class ConnectApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient } } - /** - * - * Get account info by state init - * @param getAccountInfoByStateInitRequest Data that is expected - * @return AccountInfoByStateInit - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getAccountInfoByStateInit(getAccountInfoByStateInitRequest: GetAccountInfoByStateInitRequest) : AccountInfoByStateInit { @@ -79,14 +69,6 @@ class ConnectApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient } } - /** - * - * Get account info by state init - * @param getAccountInfoByStateInitRequest Data that is expected - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getAccountInfoByStateInitWithHttpInfo(getAccountInfoByStateInitRequest: GetAccountInfoByStateInitRequest) : ApiResponse { @@ -97,12 +79,6 @@ class ConnectApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient ) } - /** - * To obtain the request config of the operation getAccountInfoByStateInit - * - * @param getAccountInfoByStateInitRequest Data that is expected - * @return RequestConfig - */ fun getAccountInfoByStateInitRequestConfig(getAccountInfoByStateInitRequest: GetAccountInfoByStateInitRequest) : RequestConfig { val localVariableBody = getAccountInfoByStateInitRequest val localVariableQuery: MultiValueMap = mutableMapOf() @@ -120,16 +96,6 @@ class ConnectApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient ) } - /** - * - * Get a payload for further token receipt - * @return GetTonConnectPayload200Response - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getTonConnectPayload() : GetTonConnectPayload200Response { @@ -150,13 +116,6 @@ class ConnectApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient } } - /** - * - * Get a payload for further token receipt - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getTonConnectPayloadWithHttpInfo() : ApiResponse { @@ -167,11 +126,6 @@ class ConnectApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient ) } - /** - * To obtain the request config of the operation getTonConnectPayload - * - * @return RequestConfig - */ fun getTonConnectPayloadRequestConfig() : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() diff --git a/tonapi/src/main/kotlin/io/tonapi/apis/DNSApi.kt b/tonapi/src/main/kotlin/io/tonapi/apis/DNSApi.kt index 642ad2860..7525badc5 100644 --- a/tonapi/src/main/kotlin/io/tonapi/apis/DNSApi.kt +++ b/tonapi/src/main/kotlin/io/tonapi/apis/DNSApi.kt @@ -16,32 +16,33 @@ package io.tonapi.apis import java.io.IOException -import okhttp3.OkHttpClient +import okhttp3.Call import okhttp3.HttpUrl import io.tonapi.models.Auctions import io.tonapi.models.DnsRecord import io.tonapi.models.DomainBids import io.tonapi.models.DomainInfo -import io.tonapi.models.StatusDefaultResponse - -import com.squareup.moshi.Json - -import io.tonapi.infrastructure.ApiClient -import io.tonapi.infrastructure.ApiResponse -import io.tonapi.infrastructure.ClientException -import io.tonapi.infrastructure.ClientError -import io.tonapi.infrastructure.ServerException -import io.tonapi.infrastructure.ServerError -import io.tonapi.infrastructure.MultiValueMap -import io.tonapi.infrastructure.PartConfig -import io.tonapi.infrastructure.RequestConfig -import io.tonapi.infrastructure.RequestMethod -import io.tonapi.infrastructure.ResponseType -import io.tonapi.infrastructure.Success -import io.tonapi.infrastructure.toMultiValue - -class DNSApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = ApiClient.defaultClient) : ApiClient(basePath, client) { +import io.tonapi.models.InlineObject + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +import io.infrastructure.ApiClient +import io.infrastructure.ApiResponse +import io.infrastructure.ClientException +import io.infrastructure.ClientError +import io.infrastructure.ServerException +import io.infrastructure.ServerError +import io.infrastructure.MultiValueMap +import io.infrastructure.PartConfig +import io.infrastructure.RequestConfig +import io.infrastructure.RequestMethod +import io.infrastructure.ResponseType +import io.infrastructure.Success +import io.infrastructure.toMultiValue + +class DNSApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory = ApiClient.defaultClient) : ApiClient(basePath, client) { companion object { @JvmStatic val defaultBasePath: String by lazy { @@ -49,17 +50,6 @@ class DNSApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A } } - /** - * - * DNS resolve for domain name - * @param domainName domain name with .ton or .t.me - * @return DnsRecord - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun dnsResolve(domainName: kotlin.String) : DnsRecord { @@ -80,14 +70,6 @@ class DNSApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A } } - /** - * - * DNS resolve for domain name - * @param domainName domain name with .ton or .t.me - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun dnsResolveWithHttpInfo(domainName: kotlin.String) : ApiResponse { @@ -98,12 +80,6 @@ class DNSApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A ) } - /** - * To obtain the request config of the operation dnsResolve - * - * @param domainName domain name with .ton or .t.me - * @return RequestConfig - */ fun dnsResolveRequestConfig(domainName: kotlin.String) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() @@ -120,17 +96,6 @@ class DNSApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A ) } - /** - * - * Get all auctions - * @param tld domain filter for current auctions \"ton\" or \"t.me\" (optional) - * @return Auctions - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getAllAuctions(tld: kotlin.String? = null) : Auctions { @@ -151,14 +116,6 @@ class DNSApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A } } - /** - * - * Get all auctions - * @param tld domain filter for current auctions \"ton\" or \"t.me\" (optional) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getAllAuctionsWithHttpInfo(tld: kotlin.String?) : ApiResponse { @@ -169,12 +126,6 @@ class DNSApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A ) } - /** - * To obtain the request config of the operation getAllAuctions - * - * @param tld domain filter for current auctions \"ton\" or \"t.me\" (optional) - * @return RequestConfig - */ fun getAllAuctionsRequestConfig(tld: kotlin.String?) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf>() @@ -196,17 +147,6 @@ class DNSApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A ) } - /** - * - * Get full information about domain name - * @param domainName domain name with .ton or .t.me - * @return DomainInfo - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getDnsInfo(domainName: kotlin.String) : DomainInfo { @@ -227,14 +167,6 @@ class DNSApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A } } - /** - * - * Get full information about domain name - * @param domainName domain name with .ton or .t.me - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getDnsInfoWithHttpInfo(domainName: kotlin.String) : ApiResponse { @@ -245,12 +177,6 @@ class DNSApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A ) } - /** - * To obtain the request config of the operation getDnsInfo - * - * @param domainName domain name with .ton or .t.me - * @return RequestConfig - */ fun getDnsInfoRequestConfig(domainName: kotlin.String) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() @@ -267,17 +193,6 @@ class DNSApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A ) } - /** - * - * Get domain bids - * @param domainName domain name with .ton or .t.me - * @return DomainBids - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getDomainBids(domainName: kotlin.String) : DomainBids { @@ -298,14 +213,6 @@ class DNSApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A } } - /** - * - * Get domain bids - * @param domainName domain name with .ton or .t.me - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getDomainBidsWithHttpInfo(domainName: kotlin.String) : ApiResponse { @@ -316,12 +223,6 @@ class DNSApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A ) } - /** - * To obtain the request config of the operation getDomainBids - * - * @param domainName domain name with .ton or .t.me - * @return RequestConfig - */ fun getDomainBidsRequestConfig(domainName: kotlin.String) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() diff --git a/tonapi/src/main/kotlin/io/tonapi/apis/EmulationApi.kt b/tonapi/src/main/kotlin/io/tonapi/apis/EmulationApi.kt index 5648012bf..b500b69eb 100644 --- a/tonapi/src/main/kotlin/io/tonapi/apis/EmulationApi.kt +++ b/tonapi/src/main/kotlin/io/tonapi/apis/EmulationApi.kt @@ -16,35 +16,36 @@ package io.tonapi.apis import java.io.IOException -import okhttp3.OkHttpClient +import okhttp3.Call import okhttp3.HttpUrl import io.tonapi.models.AccountEvent -import io.tonapi.models.DecodeMessageRequest import io.tonapi.models.DecodedMessage import io.tonapi.models.EmulateMessageToWalletRequest import io.tonapi.models.Event +import io.tonapi.models.GaslessEstimateRequestMessagesInner +import io.tonapi.models.InlineObject import io.tonapi.models.MessageConsequences -import io.tonapi.models.StatusDefaultResponse import io.tonapi.models.Trace -import com.squareup.moshi.Json - -import io.tonapi.infrastructure.ApiClient -import io.tonapi.infrastructure.ApiResponse -import io.tonapi.infrastructure.ClientException -import io.tonapi.infrastructure.ClientError -import io.tonapi.infrastructure.ServerException -import io.tonapi.infrastructure.ServerError -import io.tonapi.infrastructure.MultiValueMap -import io.tonapi.infrastructure.PartConfig -import io.tonapi.infrastructure.RequestConfig -import io.tonapi.infrastructure.RequestMethod -import io.tonapi.infrastructure.ResponseType -import io.tonapi.infrastructure.Success -import io.tonapi.infrastructure.toMultiValue - -class EmulationApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = ApiClient.defaultClient) : ApiClient(basePath, client) { +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +import io.infrastructure.ApiClient +import io.infrastructure.ApiResponse +import io.infrastructure.ClientException +import io.infrastructure.ClientError +import io.infrastructure.ServerException +import io.infrastructure.ServerError +import io.infrastructure.MultiValueMap +import io.infrastructure.PartConfig +import io.infrastructure.RequestConfig +import io.infrastructure.RequestMethod +import io.infrastructure.ResponseType +import io.infrastructure.Success +import io.infrastructure.toMultiValue + +class EmulationApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory = ApiClient.defaultClient) : ApiClient(basePath, client) { companion object { @JvmStatic val defaultBasePath: String by lazy { @@ -52,21 +53,10 @@ class EmulationApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClie } } - /** - * - * Decode a given message. Only external incoming messages can be decoded currently. - * @param decodeMessageRequest bag-of-cells serialized to hex - * @return DecodedMessage - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun decodeMessage(decodeMessageRequest: DecodeMessageRequest) : DecodedMessage { - val localVarResponse = decodeMessageWithHttpInfo(decodeMessageRequest = decodeMessageRequest) + fun decodeMessage(gaslessEstimateRequestMessagesInner: GaslessEstimateRequestMessagesInner) : DecodedMessage { + val localVarResponse = decodeMessageWithHttpInfo(gaslessEstimateRequestMessagesInner = gaslessEstimateRequestMessagesInner) return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as DecodedMessage @@ -83,32 +73,18 @@ class EmulationApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClie } } - /** - * - * Decode a given message. Only external incoming messages can be decoded currently. - * @param decodeMessageRequest bag-of-cells serialized to hex - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun decodeMessageWithHttpInfo(decodeMessageRequest: DecodeMessageRequest) : ApiResponse { - val localVariableConfig = decodeMessageRequestConfig(decodeMessageRequest = decodeMessageRequest) + fun decodeMessageWithHttpInfo(gaslessEstimateRequestMessagesInner: GaslessEstimateRequestMessagesInner) : ApiResponse { + val localVariableConfig = decodeMessageRequestConfig(gaslessEstimateRequestMessagesInner = gaslessEstimateRequestMessagesInner) - return request( + return request( localVariableConfig ) } - /** - * To obtain the request config of the operation decodeMessage - * - * @param decodeMessageRequest bag-of-cells serialized to hex - * @return RequestConfig - */ - fun decodeMessageRequestConfig(decodeMessageRequest: DecodeMessageRequest) : RequestConfig { - val localVariableBody = decodeMessageRequest + fun decodeMessageRequestConfig(gaslessEstimateRequestMessagesInner: GaslessEstimateRequestMessagesInner) : RequestConfig { + val localVariableBody = gaslessEstimateRequestMessagesInner val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() localVariableHeaders["Content-Type"] = "application/json" @@ -124,24 +100,10 @@ class EmulationApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClie ) } - /** - * - * Emulate sending message to blockchain - * @param accountId account ID - * @param decodeMessageRequest bag-of-cells serialized to hex - * @param acceptLanguage (optional, default to "en") - * @param ignoreSignatureCheck (optional) - * @return AccountEvent - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun emulateMessageToAccountEvent(accountId: kotlin.String, decodeMessageRequest: DecodeMessageRequest, acceptLanguage: kotlin.String? = "en", ignoreSignatureCheck: kotlin.Boolean? = null) : AccountEvent { - val localVarResponse = emulateMessageToAccountEventWithHttpInfo(accountId = accountId, decodeMessageRequest = decodeMessageRequest, acceptLanguage = acceptLanguage, ignoreSignatureCheck = ignoreSignatureCheck) + fun emulateMessageToAccountEvent(accountId: kotlin.String, gaslessEstimateRequestMessagesInner: GaslessEstimateRequestMessagesInner, acceptLanguage: kotlin.String? = "en", ignoreSignatureCheck: kotlin.Boolean? = null) : AccountEvent { + val localVarResponse = emulateMessageToAccountEventWithHttpInfo(accountId = accountId, gaslessEstimateRequestMessagesInner = gaslessEstimateRequestMessagesInner, acceptLanguage = acceptLanguage, ignoreSignatureCheck = ignoreSignatureCheck) return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as AccountEvent @@ -158,38 +120,18 @@ class EmulationApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClie } } - /** - * - * Emulate sending message to blockchain - * @param accountId account ID - * @param decodeMessageRequest bag-of-cells serialized to hex - * @param acceptLanguage (optional, default to "en") - * @param ignoreSignatureCheck (optional) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun emulateMessageToAccountEventWithHttpInfo(accountId: kotlin.String, decodeMessageRequest: DecodeMessageRequest, acceptLanguage: kotlin.String?, ignoreSignatureCheck: kotlin.Boolean?) : ApiResponse { - val localVariableConfig = emulateMessageToAccountEventRequestConfig(accountId = accountId, decodeMessageRequest = decodeMessageRequest, acceptLanguage = acceptLanguage, ignoreSignatureCheck = ignoreSignatureCheck) + fun emulateMessageToAccountEventWithHttpInfo(accountId: kotlin.String, gaslessEstimateRequestMessagesInner: GaslessEstimateRequestMessagesInner, acceptLanguage: kotlin.String?, ignoreSignatureCheck: kotlin.Boolean?) : ApiResponse { + val localVariableConfig = emulateMessageToAccountEventRequestConfig(accountId = accountId, gaslessEstimateRequestMessagesInner = gaslessEstimateRequestMessagesInner, acceptLanguage = acceptLanguage, ignoreSignatureCheck = ignoreSignatureCheck) - return request( + return request( localVariableConfig ) } - /** - * To obtain the request config of the operation emulateMessageToAccountEvent - * - * @param accountId account ID - * @param decodeMessageRequest bag-of-cells serialized to hex - * @param acceptLanguage (optional, default to "en") - * @param ignoreSignatureCheck (optional) - * @return RequestConfig - */ - fun emulateMessageToAccountEventRequestConfig(accountId: kotlin.String, decodeMessageRequest: DecodeMessageRequest, acceptLanguage: kotlin.String?, ignoreSignatureCheck: kotlin.Boolean?) : RequestConfig { - val localVariableBody = decodeMessageRequest + fun emulateMessageToAccountEventRequestConfig(accountId: kotlin.String, gaslessEstimateRequestMessagesInner: GaslessEstimateRequestMessagesInner, acceptLanguage: kotlin.String?, ignoreSignatureCheck: kotlin.Boolean?) : RequestConfig { + val localVariableBody = gaslessEstimateRequestMessagesInner val localVariableQuery: MultiValueMap = mutableMapOf>() .apply { if (ignoreSignatureCheck != null) { @@ -211,23 +153,10 @@ class EmulationApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClie ) } - /** - * - * Emulate sending message to blockchain - * @param decodeMessageRequest bag-of-cells serialized to hex - * @param acceptLanguage (optional, default to "en") - * @param ignoreSignatureCheck (optional) - * @return Event - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun emulateMessageToEvent(decodeMessageRequest: DecodeMessageRequest, acceptLanguage: kotlin.String? = "en", ignoreSignatureCheck: kotlin.Boolean? = null) : Event { - val localVarResponse = emulateMessageToEventWithHttpInfo(decodeMessageRequest = decodeMessageRequest, acceptLanguage = acceptLanguage, ignoreSignatureCheck = ignoreSignatureCheck) + fun emulateMessageToEvent(gaslessEstimateRequestMessagesInner: GaslessEstimateRequestMessagesInner, acceptLanguage: kotlin.String? = "en", ignoreSignatureCheck: kotlin.Boolean? = null) : Event { + val localVarResponse = emulateMessageToEventWithHttpInfo(gaslessEstimateRequestMessagesInner = gaslessEstimateRequestMessagesInner, acceptLanguage = acceptLanguage, ignoreSignatureCheck = ignoreSignatureCheck) return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as Event @@ -244,36 +173,18 @@ class EmulationApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClie } } - /** - * - * Emulate sending message to blockchain - * @param decodeMessageRequest bag-of-cells serialized to hex - * @param acceptLanguage (optional, default to "en") - * @param ignoreSignatureCheck (optional) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun emulateMessageToEventWithHttpInfo(decodeMessageRequest: DecodeMessageRequest, acceptLanguage: kotlin.String?, ignoreSignatureCheck: kotlin.Boolean?) : ApiResponse { - val localVariableConfig = emulateMessageToEventRequestConfig(decodeMessageRequest = decodeMessageRequest, acceptLanguage = acceptLanguage, ignoreSignatureCheck = ignoreSignatureCheck) + fun emulateMessageToEventWithHttpInfo(gaslessEstimateRequestMessagesInner: GaslessEstimateRequestMessagesInner, acceptLanguage: kotlin.String?, ignoreSignatureCheck: kotlin.Boolean?) : ApiResponse { + val localVariableConfig = emulateMessageToEventRequestConfig(gaslessEstimateRequestMessagesInner = gaslessEstimateRequestMessagesInner, acceptLanguage = acceptLanguage, ignoreSignatureCheck = ignoreSignatureCheck) - return request( + return request( localVariableConfig ) } - /** - * To obtain the request config of the operation emulateMessageToEvent - * - * @param decodeMessageRequest bag-of-cells serialized to hex - * @param acceptLanguage (optional, default to "en") - * @param ignoreSignatureCheck (optional) - * @return RequestConfig - */ - fun emulateMessageToEventRequestConfig(decodeMessageRequest: DecodeMessageRequest, acceptLanguage: kotlin.String?, ignoreSignatureCheck: kotlin.Boolean?) : RequestConfig { - val localVariableBody = decodeMessageRequest + fun emulateMessageToEventRequestConfig(gaslessEstimateRequestMessagesInner: GaslessEstimateRequestMessagesInner, acceptLanguage: kotlin.String?, ignoreSignatureCheck: kotlin.Boolean?) : RequestConfig { + val localVariableBody = gaslessEstimateRequestMessagesInner val localVariableQuery: MultiValueMap = mutableMapOf>() .apply { if (ignoreSignatureCheck != null) { @@ -295,22 +206,10 @@ class EmulationApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClie ) } - /** - * - * Emulate sending message to blockchain - * @param decodeMessageRequest bag-of-cells serialized to hex - * @param ignoreSignatureCheck (optional) - * @return Trace - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun emulateMessageToTrace(decodeMessageRequest: DecodeMessageRequest, ignoreSignatureCheck: kotlin.Boolean? = null) : Trace { - val localVarResponse = emulateMessageToTraceWithHttpInfo(decodeMessageRequest = decodeMessageRequest, ignoreSignatureCheck = ignoreSignatureCheck) + fun emulateMessageToTrace(gaslessEstimateRequestMessagesInner: GaslessEstimateRequestMessagesInner, ignoreSignatureCheck: kotlin.Boolean? = null) : Trace { + val localVarResponse = emulateMessageToTraceWithHttpInfo(gaslessEstimateRequestMessagesInner = gaslessEstimateRequestMessagesInner, ignoreSignatureCheck = ignoreSignatureCheck) return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as Trace @@ -327,34 +226,18 @@ class EmulationApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClie } } - /** - * - * Emulate sending message to blockchain - * @param decodeMessageRequest bag-of-cells serialized to hex - * @param ignoreSignatureCheck (optional) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun emulateMessageToTraceWithHttpInfo(decodeMessageRequest: DecodeMessageRequest, ignoreSignatureCheck: kotlin.Boolean?) : ApiResponse { - val localVariableConfig = emulateMessageToTraceRequestConfig(decodeMessageRequest = decodeMessageRequest, ignoreSignatureCheck = ignoreSignatureCheck) + fun emulateMessageToTraceWithHttpInfo(gaslessEstimateRequestMessagesInner: GaslessEstimateRequestMessagesInner, ignoreSignatureCheck: kotlin.Boolean?) : ApiResponse { + val localVariableConfig = emulateMessageToTraceRequestConfig(gaslessEstimateRequestMessagesInner = gaslessEstimateRequestMessagesInner, ignoreSignatureCheck = ignoreSignatureCheck) - return request( + return request( localVariableConfig ) } - /** - * To obtain the request config of the operation emulateMessageToTrace - * - * @param decodeMessageRequest bag-of-cells serialized to hex - * @param ignoreSignatureCheck (optional) - * @return RequestConfig - */ - fun emulateMessageToTraceRequestConfig(decodeMessageRequest: DecodeMessageRequest, ignoreSignatureCheck: kotlin.Boolean?) : RequestConfig { - val localVariableBody = decodeMessageRequest + fun emulateMessageToTraceRequestConfig(gaslessEstimateRequestMessagesInner: GaslessEstimateRequestMessagesInner, ignoreSignatureCheck: kotlin.Boolean?) : RequestConfig { + val localVariableBody = gaslessEstimateRequestMessagesInner val localVariableQuery: MultiValueMap = mutableMapOf>() .apply { if (ignoreSignatureCheck != null) { @@ -375,18 +258,6 @@ class EmulationApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClie ) } - /** - * - * Emulate sending message to blockchain - * @param emulateMessageToWalletRequest bag-of-cells serialized to base64/hex and additional parameters to configure emulation - * @param acceptLanguage (optional, default to "en") - * @return MessageConsequences - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun emulateMessageToWallet(emulateMessageToWalletRequest: EmulateMessageToWalletRequest, acceptLanguage: kotlin.String? = "en") : MessageConsequences { @@ -407,15 +278,6 @@ class EmulationApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClie } } - /** - * - * Emulate sending message to blockchain - * @param emulateMessageToWalletRequest bag-of-cells serialized to base64/hex and additional parameters to configure emulation - * @param acceptLanguage (optional, default to "en") - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun emulateMessageToWalletWithHttpInfo(emulateMessageToWalletRequest: EmulateMessageToWalletRequest, acceptLanguage: kotlin.String?) : ApiResponse { @@ -426,13 +288,6 @@ class EmulationApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClie ) } - /** - * To obtain the request config of the operation emulateMessageToWallet - * - * @param emulateMessageToWalletRequest bag-of-cells serialized to base64/hex and additional parameters to configure emulation - * @param acceptLanguage (optional, default to "en") - * @return RequestConfig - */ fun emulateMessageToWalletRequestConfig(emulateMessageToWalletRequest: EmulateMessageToWalletRequest, acceptLanguage: kotlin.String?) : RequestConfig { val localVariableBody = emulateMessageToWalletRequest val localVariableQuery: MultiValueMap = mutableMapOf() diff --git a/tonapi/src/main/kotlin/io/tonapi/apis/EventsApi.kt b/tonapi/src/main/kotlin/io/tonapi/apis/EventsApi.kt index 22f2f1d49..8b0aa45bc 100644 --- a/tonapi/src/main/kotlin/io/tonapi/apis/EventsApi.kt +++ b/tonapi/src/main/kotlin/io/tonapi/apis/EventsApi.kt @@ -16,29 +16,31 @@ package io.tonapi.apis import java.io.IOException -import okhttp3.OkHttpClient +import okhttp3.Call import okhttp3.HttpUrl import io.tonapi.models.Event -import io.tonapi.models.StatusDefaultResponse - -import com.squareup.moshi.Json - -import io.tonapi.infrastructure.ApiClient -import io.tonapi.infrastructure.ApiResponse -import io.tonapi.infrastructure.ClientException -import io.tonapi.infrastructure.ClientError -import io.tonapi.infrastructure.ServerException -import io.tonapi.infrastructure.ServerError -import io.tonapi.infrastructure.MultiValueMap -import io.tonapi.infrastructure.PartConfig -import io.tonapi.infrastructure.RequestConfig -import io.tonapi.infrastructure.RequestMethod -import io.tonapi.infrastructure.ResponseType -import io.tonapi.infrastructure.Success -import io.tonapi.infrastructure.toMultiValue - -class EventsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = ApiClient.defaultClient) : ApiClient(basePath, client) { +import io.tonapi.models.GaslessEstimateRequestMessagesInner +import io.tonapi.models.InlineObject + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +import io.infrastructure.ApiClient +import io.infrastructure.ApiResponse +import io.infrastructure.ClientException +import io.infrastructure.ClientError +import io.infrastructure.ServerException +import io.infrastructure.ServerError +import io.infrastructure.MultiValueMap +import io.infrastructure.PartConfig +import io.infrastructure.RequestConfig +import io.infrastructure.RequestMethod +import io.infrastructure.ResponseType +import io.infrastructure.Success +import io.infrastructure.toMultiValue + +class EventsApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory = ApiClient.defaultClient) : ApiClient(basePath, client) { companion object { @JvmStatic val defaultBasePath: String by lazy { @@ -46,18 +48,59 @@ class EventsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient } } - /** - * - * Get an event either by event ID or a hash of any transaction in a trace. An event is built on top of a trace which is a series of transactions caused by one inbound message. TonAPI looks for known patterns inside the trace and splits the trace into actions, where a single action represents a meaningful high-level operation like a Jetton Transfer or an NFT Purchase. Actions are expected to be shown to users. It is advised not to build any logic on top of actions because actions can be changed at any time. - * @param eventId event ID or transaction hash in hex (without 0x) or base64url format - * @param acceptLanguage (optional, default to "en") - * @return Event - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun emulateMessageToEvent(gaslessEstimateRequestMessagesInner: GaslessEstimateRequestMessagesInner, acceptLanguage: kotlin.String? = "en", ignoreSignatureCheck: kotlin.Boolean? = null) : Event { + val localVarResponse = emulateMessageToEventWithHttpInfo(gaslessEstimateRequestMessagesInner = gaslessEstimateRequestMessagesInner, acceptLanguage = acceptLanguage, ignoreSignatureCheck = ignoreSignatureCheck) + + return when (localVarResponse.responseType) { + ResponseType.Success -> (localVarResponse as Success<*>).data as Event + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> { + val localVarError = localVarResponse as ClientError<*> + throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + } + ResponseType.ServerError -> { + val localVarError = localVarResponse as ServerError<*> + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) + } + } + } + + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun emulateMessageToEventWithHttpInfo(gaslessEstimateRequestMessagesInner: GaslessEstimateRequestMessagesInner, acceptLanguage: kotlin.String?, ignoreSignatureCheck: kotlin.Boolean?) : ApiResponse { + val localVariableConfig = emulateMessageToEventRequestConfig(gaslessEstimateRequestMessagesInner = gaslessEstimateRequestMessagesInner, acceptLanguage = acceptLanguage, ignoreSignatureCheck = ignoreSignatureCheck) + + return request( + localVariableConfig + ) + } + + fun emulateMessageToEventRequestConfig(gaslessEstimateRequestMessagesInner: GaslessEstimateRequestMessagesInner, acceptLanguage: kotlin.String?, ignoreSignatureCheck: kotlin.Boolean?) : RequestConfig { + val localVariableBody = gaslessEstimateRequestMessagesInner + val localVariableQuery: MultiValueMap = mutableMapOf>() + .apply { + if (ignoreSignatureCheck != null) { + put("ignore_signature_check", listOf(ignoreSignatureCheck.toString())) + } + } + val localVariableHeaders: MutableMap = mutableMapOf() + acceptLanguage?.apply { localVariableHeaders["Accept-Language"] = this.toString() } + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "application/json" + + return RequestConfig( + method = RequestMethod.POST, + path = "/v2/events/emulate", + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getEvent(eventId: kotlin.String, acceptLanguage: kotlin.String? = "en") : Event { @@ -78,15 +121,6 @@ class EventsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient } } - /** - * - * Get an event either by event ID or a hash of any transaction in a trace. An event is built on top of a trace which is a series of transactions caused by one inbound message. TonAPI looks for known patterns inside the trace and splits the trace into actions, where a single action represents a meaningful high-level operation like a Jetton Transfer or an NFT Purchase. Actions are expected to be shown to users. It is advised not to build any logic on top of actions because actions can be changed at any time. - * @param eventId event ID or transaction hash in hex (without 0x) or base64url format - * @param acceptLanguage (optional, default to "en") - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getEventWithHttpInfo(eventId: kotlin.String, acceptLanguage: kotlin.String?) : ApiResponse { @@ -97,13 +131,6 @@ class EventsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient ) } - /** - * To obtain the request config of the operation getEvent - * - * @param eventId event ID or transaction hash in hex (without 0x) or base64url format - * @param acceptLanguage (optional, default to "en") - * @return RequestConfig - */ fun getEventRequestConfig(eventId: kotlin.String, acceptLanguage: kotlin.String?) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() diff --git a/tonapi/src/main/kotlin/io/tonapi/apis/ExtraCurrencyApi.kt b/tonapi/src/main/kotlin/io/tonapi/apis/ExtraCurrencyApi.kt new file mode 100644 index 000000000..fecb3f060 --- /dev/null +++ b/tonapi/src/main/kotlin/io/tonapi/apis/ExtraCurrencyApi.kt @@ -0,0 +1,99 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package io.tonapi.apis + +import java.io.IOException +import okhttp3.Call +import okhttp3.HttpUrl + +import io.tonapi.models.EcPreview +import io.tonapi.models.InlineObject + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +import io.infrastructure.ApiClient +import io.infrastructure.ApiResponse +import io.infrastructure.ClientException +import io.infrastructure.ClientError +import io.infrastructure.ServerException +import io.infrastructure.ServerError +import io.infrastructure.MultiValueMap +import io.infrastructure.PartConfig +import io.infrastructure.RequestConfig +import io.infrastructure.RequestMethod +import io.infrastructure.ResponseType +import io.infrastructure.Success +import io.infrastructure.toMultiValue + +class ExtraCurrencyApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory = ApiClient.defaultClient) : ApiClient(basePath, client) { + companion object { + @JvmStatic + val defaultBasePath: String by lazy { + System.getProperties().getProperty(ApiClient.baseUrlKey, "https://tonapi.io") + } + } + + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun getExtraCurrencyInfo(id: kotlin.Int) : EcPreview { + val localVarResponse = getExtraCurrencyInfoWithHttpInfo(id = id) + + return when (localVarResponse.responseType) { + ResponseType.Success -> (localVarResponse as Success<*>).data as EcPreview + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> { + val localVarError = localVarResponse as ClientError<*> + throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + } + ResponseType.ServerError -> { + val localVarError = localVarResponse as ServerError<*> + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) + } + } + } + + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun getExtraCurrencyInfoWithHttpInfo(id: kotlin.Int) : ApiResponse { + val localVariableConfig = getExtraCurrencyInfoRequestConfig(id = id) + + return request( + localVariableConfig + ) + } + + fun getExtraCurrencyInfoRequestConfig(id: kotlin.Int) : RequestConfig { + val localVariableBody = null + val localVariableQuery: MultiValueMap = mutableMapOf() + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" + + return RequestConfig( + method = RequestMethod.GET, + path = "/v2/extra-currency/{id}".replace("{"+"id"+"}", encodeURIComponent(id.toString())), + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + + + private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String = + HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0] +} diff --git a/tonapi/src/main/kotlin/io/tonapi/apis/GaslessApi.kt b/tonapi/src/main/kotlin/io/tonapi/apis/GaslessApi.kt index 91089b99d..c257bc869 100644 --- a/tonapi/src/main/kotlin/io/tonapi/apis/GaslessApi.kt +++ b/tonapi/src/main/kotlin/io/tonapi/apis/GaslessApi.kt @@ -16,32 +16,34 @@ package io.tonapi.apis import java.io.IOException -import okhttp3.OkHttpClient +import okhttp3.Call import okhttp3.HttpUrl import io.tonapi.models.GaslessConfig import io.tonapi.models.GaslessEstimateRequest import io.tonapi.models.GaslessSendRequest +import io.tonapi.models.GaslessTx +import io.tonapi.models.InlineObject import io.tonapi.models.SignRawParams -import io.tonapi.models.StatusDefaultResponse -import com.squareup.moshi.Json - -import io.tonapi.infrastructure.ApiClient -import io.tonapi.infrastructure.ApiResponse -import io.tonapi.infrastructure.ClientException -import io.tonapi.infrastructure.ClientError -import io.tonapi.infrastructure.ServerException -import io.tonapi.infrastructure.ServerError -import io.tonapi.infrastructure.MultiValueMap -import io.tonapi.infrastructure.PartConfig -import io.tonapi.infrastructure.RequestConfig -import io.tonapi.infrastructure.RequestMethod -import io.tonapi.infrastructure.ResponseType -import io.tonapi.infrastructure.Success -import io.tonapi.infrastructure.toMultiValue - -class GaslessApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = ApiClient.defaultClient) : ApiClient(basePath, client) { +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +import io.infrastructure.ApiClient +import io.infrastructure.ApiResponse +import io.infrastructure.ClientException +import io.infrastructure.ClientError +import io.infrastructure.ServerException +import io.infrastructure.ServerError +import io.infrastructure.MultiValueMap +import io.infrastructure.PartConfig +import io.infrastructure.RequestConfig +import io.infrastructure.RequestMethod +import io.infrastructure.ResponseType +import io.infrastructure.Success +import io.infrastructure.toMultiValue + +class GaslessApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory = ApiClient.defaultClient) : ApiClient(basePath, client) { companion object { @JvmStatic val defaultBasePath: String by lazy { @@ -49,16 +51,6 @@ class GaslessApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient } } - /** - * - * Returns configuration of gasless transfers - * @return GaslessConfig - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun gaslessConfig() : GaslessConfig { @@ -79,13 +71,6 @@ class GaslessApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient } } - /** - * - * Returns configuration of gasless transfers - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun gaslessConfigWithHttpInfo() : ApiResponse { @@ -96,11 +81,6 @@ class GaslessApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient ) } - /** - * To obtain the request config of the operation gaslessConfig - * - * @return RequestConfig - */ fun gaslessConfigRequestConfig() : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() @@ -117,22 +97,10 @@ class GaslessApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient ) } - /** - * - * Estimates the cost of the given messages and returns a payload to sign. - * @param masterId jetton to pay commission - * @param gaslessEstimateRequest bag-of-cells serialized to hex - * @return SignRawParams - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun gaslessEstimate(masterId: kotlin.String, gaslessEstimateRequest: GaslessEstimateRequest) : SignRawParams { - val localVarResponse = gaslessEstimateWithHttpInfo(masterId = masterId, gaslessEstimateRequest = gaslessEstimateRequest) + fun gaslessEstimate(masterId: kotlin.String, gaslessEstimateRequest: GaslessEstimateRequest, acceptLanguage: kotlin.String? = "en") : SignRawParams { + val localVarResponse = gaslessEstimateWithHttpInfo(masterId = masterId, gaslessEstimateRequest = gaslessEstimateRequest, acceptLanguage = acceptLanguage) return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as SignRawParams @@ -149,36 +117,21 @@ class GaslessApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient } } - /** - * - * Estimates the cost of the given messages and returns a payload to sign. - * @param masterId jetton to pay commission - * @param gaslessEstimateRequest bag-of-cells serialized to hex - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun gaslessEstimateWithHttpInfo(masterId: kotlin.String, gaslessEstimateRequest: GaslessEstimateRequest) : ApiResponse { - val localVariableConfig = gaslessEstimateRequestConfig(masterId = masterId, gaslessEstimateRequest = gaslessEstimateRequest) + fun gaslessEstimateWithHttpInfo(masterId: kotlin.String, gaslessEstimateRequest: GaslessEstimateRequest, acceptLanguage: kotlin.String?) : ApiResponse { + val localVariableConfig = gaslessEstimateRequestConfig(masterId = masterId, gaslessEstimateRequest = gaslessEstimateRequest, acceptLanguage = acceptLanguage) return request( localVariableConfig ) } - /** - * To obtain the request config of the operation gaslessEstimate - * - * @param masterId jetton to pay commission - * @param gaslessEstimateRequest bag-of-cells serialized to hex - * @return RequestConfig - */ - fun gaslessEstimateRequestConfig(masterId: kotlin.String, gaslessEstimateRequest: GaslessEstimateRequest) : RequestConfig { + fun gaslessEstimateRequestConfig(masterId: kotlin.String, gaslessEstimateRequest: GaslessEstimateRequest, acceptLanguage: kotlin.String?) : RequestConfig { val localVariableBody = gaslessEstimateRequest val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + acceptLanguage?.apply { localVariableHeaders["Accept-Language"] = this.toString() } localVariableHeaders["Content-Type"] = "application/json" localVariableHeaders["Accept"] = "application/json" @@ -192,23 +145,13 @@ class GaslessApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient ) } - /** - * - * - * @param gaslessSendRequest bag-of-cells serialized to hex - * @return void - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun gaslessSend(gaslessSendRequest: GaslessSendRequest) : Unit { + fun gaslessSend(gaslessSendRequest: GaslessSendRequest) : GaslessTx { val localVarResponse = gaslessSendWithHttpInfo(gaslessSendRequest = gaslessSendRequest) return when (localVarResponse.responseType) { - ResponseType.Success -> Unit + ResponseType.Success -> (localVarResponse as Success<*>).data as GaslessTx ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") ResponseType.ClientError -> { @@ -222,29 +165,16 @@ class GaslessApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient } } - /** - * - * - * @param gaslessSendRequest bag-of-cells serialized to hex - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ + @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun gaslessSendWithHttpInfo(gaslessSendRequest: GaslessSendRequest) : ApiResponse { + fun gaslessSendWithHttpInfo(gaslessSendRequest: GaslessSendRequest) : ApiResponse { val localVariableConfig = gaslessSendRequestConfig(gaslessSendRequest = gaslessSendRequest) - return request( + return request( localVariableConfig ) } - /** - * To obtain the request config of the operation gaslessSend - * - * @param gaslessSendRequest bag-of-cells serialized to hex - * @return RequestConfig - */ fun gaslessSendRequestConfig(gaslessSendRequest: GaslessSendRequest) : RequestConfig { val localVariableBody = gaslessSendRequest val localVariableQuery: MultiValueMap = mutableMapOf() diff --git a/tonapi/src/main/kotlin/io/tonapi/apis/InscriptionsApi.kt b/tonapi/src/main/kotlin/io/tonapi/apis/InscriptionsApi.kt deleted file mode 100644 index 98287e5fc..000000000 --- a/tonapi/src/main/kotlin/io/tonapi/apis/InscriptionsApi.kt +++ /dev/null @@ -1,437 +0,0 @@ -/** - * - * Please note: - * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * Do not edit this file manually. - * - */ - -@file:Suppress( - "ArrayInDataClass", - "EnumEntryName", - "RemoveRedundantQualifierName", - "UnusedImport" -) - -package io.tonapi.apis - -import java.io.IOException -import okhttp3.OkHttpClient -import okhttp3.HttpUrl - -import io.tonapi.models.AccountEvents -import io.tonapi.models.GetInscriptionOpTemplate200Response -import io.tonapi.models.InscriptionBalances -import io.tonapi.models.StatusDefaultResponse - -import com.squareup.moshi.Json - -import io.tonapi.infrastructure.ApiClient -import io.tonapi.infrastructure.ApiResponse -import io.tonapi.infrastructure.ClientException -import io.tonapi.infrastructure.ClientError -import io.tonapi.infrastructure.ServerException -import io.tonapi.infrastructure.ServerError -import io.tonapi.infrastructure.MultiValueMap -import io.tonapi.infrastructure.PartConfig -import io.tonapi.infrastructure.RequestConfig -import io.tonapi.infrastructure.RequestMethod -import io.tonapi.infrastructure.ResponseType -import io.tonapi.infrastructure.Success -import io.tonapi.infrastructure.toMultiValue - -class InscriptionsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = ApiClient.defaultClient) : ApiClient(basePath, client) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty(ApiClient.baseUrlKey, "https://tonapi.io") - } - } - - /** - * - * Get all inscriptions by owner address. It's experimental API and can be dropped in the future. - * @param accountId account ID - * @param limit (optional, default to 1000) - * @param offset (optional, default to 0) - * @return InscriptionBalances - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getAccountInscriptions(accountId: kotlin.String, limit: kotlin.Int? = 1000, offset: kotlin.Int? = 0) : InscriptionBalances { - val localVarResponse = getAccountInscriptionsWithHttpInfo(accountId = accountId, limit = limit, offset = offset) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as InscriptionBalances - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * - * Get all inscriptions by owner address. It's experimental API and can be dropped in the future. - * @param accountId account ID - * @param limit (optional, default to 1000) - * @param offset (optional, default to 0) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ - @Suppress("UNCHECKED_CAST") - @Throws(IllegalStateException::class, IOException::class) - fun getAccountInscriptionsWithHttpInfo(accountId: kotlin.String, limit: kotlin.Int?, offset: kotlin.Int?) : ApiResponse { - val localVariableConfig = getAccountInscriptionsRequestConfig(accountId = accountId, limit = limit, offset = offset) - - return request( - localVariableConfig - ) - } - - /** - * To obtain the request config of the operation getAccountInscriptions - * - * @param accountId account ID - * @param limit (optional, default to 1000) - * @param offset (optional, default to 0) - * @return RequestConfig - */ - fun getAccountInscriptionsRequestConfig(accountId: kotlin.String, limit: kotlin.Int?, offset: kotlin.Int?) : RequestConfig { - val localVariableBody = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - if (limit != null) { - put("limit", listOf(limit.toString())) - } - if (offset != null) { - put("offset", listOf(offset.toString())) - } - } - val localVariableHeaders: MutableMap = mutableMapOf() - localVariableHeaders["Accept"] = "application/json" - - return RequestConfig( - method = RequestMethod.GET, - path = "/v2/experimental/accounts/{account_id}/inscriptions".replace("{"+"account_id"+"}", encodeURIComponent(accountId.toString())), - query = localVariableQuery, - headers = localVariableHeaders, - requiresAuthentication = false, - body = localVariableBody - ) - } - - /** - * - * Get the transfer inscriptions history for account. It's experimental API and can be dropped in the future. - * @param accountId account ID - * @param acceptLanguage (optional, default to "en") - * @param beforeLt omit this parameter to get last events (optional) - * @param limit (optional, default to 100) - * @return AccountEvents - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getAccountInscriptionsHistory(accountId: kotlin.String, acceptLanguage: kotlin.String? = "en", beforeLt: kotlin.Long? = null, limit: kotlin.Int? = 100) : AccountEvents { - val localVarResponse = getAccountInscriptionsHistoryWithHttpInfo(accountId = accountId, acceptLanguage = acceptLanguage, beforeLt = beforeLt, limit = limit) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as AccountEvents - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * - * Get the transfer inscriptions history for account. It's experimental API and can be dropped in the future. - * @param accountId account ID - * @param acceptLanguage (optional, default to "en") - * @param beforeLt omit this parameter to get last events (optional) - * @param limit (optional, default to 100) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ - @Suppress("UNCHECKED_CAST") - @Throws(IllegalStateException::class, IOException::class) - fun getAccountInscriptionsHistoryWithHttpInfo(accountId: kotlin.String, acceptLanguage: kotlin.String?, beforeLt: kotlin.Long?, limit: kotlin.Int?) : ApiResponse { - val localVariableConfig = getAccountInscriptionsHistoryRequestConfig(accountId = accountId, acceptLanguage = acceptLanguage, beforeLt = beforeLt, limit = limit) - - return request( - localVariableConfig - ) - } - - /** - * To obtain the request config of the operation getAccountInscriptionsHistory - * - * @param accountId account ID - * @param acceptLanguage (optional, default to "en") - * @param beforeLt omit this parameter to get last events (optional) - * @param limit (optional, default to 100) - * @return RequestConfig - */ - fun getAccountInscriptionsHistoryRequestConfig(accountId: kotlin.String, acceptLanguage: kotlin.String?, beforeLt: kotlin.Long?, limit: kotlin.Int?) : RequestConfig { - val localVariableBody = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - if (beforeLt != null) { - put("before_lt", listOf(beforeLt.toString())) - } - if (limit != null) { - put("limit", listOf(limit.toString())) - } - } - val localVariableHeaders: MutableMap = mutableMapOf() - acceptLanguage?.apply { localVariableHeaders["Accept-Language"] = this.toString() } - localVariableHeaders["Accept"] = "application/json" - - return RequestConfig( - method = RequestMethod.GET, - path = "/v2/experimental/accounts/{account_id}/inscriptions/history".replace("{"+"account_id"+"}", encodeURIComponent(accountId.toString())), - query = localVariableQuery, - headers = localVariableHeaders, - requiresAuthentication = false, - body = localVariableBody - ) - } - - /** - * - * Get the transfer inscriptions history for account. It's experimental API and can be dropped in the future. - * @param accountId account ID - * @param ticker - * @param acceptLanguage (optional, default to "en") - * @param beforeLt omit this parameter to get last events (optional) - * @param limit (optional, default to 100) - * @return AccountEvents - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getAccountInscriptionsHistoryByTicker(accountId: kotlin.String, ticker: kotlin.String, acceptLanguage: kotlin.String? = "en", beforeLt: kotlin.Long? = null, limit: kotlin.Int? = 100) : AccountEvents { - val localVarResponse = getAccountInscriptionsHistoryByTickerWithHttpInfo(accountId = accountId, ticker = ticker, acceptLanguage = acceptLanguage, beforeLt = beforeLt, limit = limit) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as AccountEvents - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * - * Get the transfer inscriptions history for account. It's experimental API and can be dropped in the future. - * @param accountId account ID - * @param ticker - * @param acceptLanguage (optional, default to "en") - * @param beforeLt omit this parameter to get last events (optional) - * @param limit (optional, default to 100) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ - @Suppress("UNCHECKED_CAST") - @Throws(IllegalStateException::class, IOException::class) - fun getAccountInscriptionsHistoryByTickerWithHttpInfo(accountId: kotlin.String, ticker: kotlin.String, acceptLanguage: kotlin.String?, beforeLt: kotlin.Long?, limit: kotlin.Int?) : ApiResponse { - val localVariableConfig = getAccountInscriptionsHistoryByTickerRequestConfig(accountId = accountId, ticker = ticker, acceptLanguage = acceptLanguage, beforeLt = beforeLt, limit = limit) - - return request( - localVariableConfig - ) - } - - /** - * To obtain the request config of the operation getAccountInscriptionsHistoryByTicker - * - * @param accountId account ID - * @param ticker - * @param acceptLanguage (optional, default to "en") - * @param beforeLt omit this parameter to get last events (optional) - * @param limit (optional, default to 100) - * @return RequestConfig - */ - fun getAccountInscriptionsHistoryByTickerRequestConfig(accountId: kotlin.String, ticker: kotlin.String, acceptLanguage: kotlin.String?, beforeLt: kotlin.Long?, limit: kotlin.Int?) : RequestConfig { - val localVariableBody = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - if (beforeLt != null) { - put("before_lt", listOf(beforeLt.toString())) - } - if (limit != null) { - put("limit", listOf(limit.toString())) - } - } - val localVariableHeaders: MutableMap = mutableMapOf() - acceptLanguage?.apply { localVariableHeaders["Accept-Language"] = this.toString() } - localVariableHeaders["Accept"] = "application/json" - - return RequestConfig( - method = RequestMethod.GET, - path = "/v2/experimental/accounts/{account_id}/inscriptions/{ticker}/history".replace("{"+"account_id"+"}", encodeURIComponent(accountId.toString())).replace("{"+"ticker"+"}", encodeURIComponent(ticker.toString())), - query = localVariableQuery, - headers = localVariableHeaders, - requiresAuthentication = false, - body = localVariableBody - ) - } - - /** - * enum for parameter type - */ - enum class TypeGetInscriptionOpTemplate(val value: kotlin.String) { - @Json(name = "ton20") ton20("ton20"), - @Json(name = "gram20") gram20("gram20") - } - - /** - * enum for parameter operation - */ - enum class OperationGetInscriptionOpTemplate(val value: kotlin.String) { - @Json(name = "transfer") transfer("transfer") - } - - /** - * - * return comment for making operation with inscription. please don't use it if you don't know what you are doing - * @param type - * @param operation - * @param amount - * @param ticker - * @param who - * @param destination (optional) - * @param comment (optional) - * @return GetInscriptionOpTemplate200Response - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getInscriptionOpTemplate(type: TypeGetInscriptionOpTemplate, operation: OperationGetInscriptionOpTemplate, amount: kotlin.String, ticker: kotlin.String, who: kotlin.String, destination: kotlin.String? = null, comment: kotlin.String? = null) : GetInscriptionOpTemplate200Response { - val localVarResponse = getInscriptionOpTemplateWithHttpInfo(type = type, operation = operation, amount = amount, ticker = ticker, who = who, destination = destination, comment = comment) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as GetInscriptionOpTemplate200Response - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * - * return comment for making operation with inscription. please don't use it if you don't know what you are doing - * @param type - * @param operation - * @param amount - * @param ticker - * @param who - * @param destination (optional) - * @param comment (optional) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ - @Suppress("UNCHECKED_CAST") - @Throws(IllegalStateException::class, IOException::class) - fun getInscriptionOpTemplateWithHttpInfo(type: TypeGetInscriptionOpTemplate, operation: OperationGetInscriptionOpTemplate, amount: kotlin.String, ticker: kotlin.String, who: kotlin.String, destination: kotlin.String?, comment: kotlin.String?) : ApiResponse { - val localVariableConfig = getInscriptionOpTemplateRequestConfig(type = type, operation = operation, amount = amount, ticker = ticker, who = who, destination = destination, comment = comment) - - return request( - localVariableConfig - ) - } - - /** - * To obtain the request config of the operation getInscriptionOpTemplate - * - * @param type - * @param operation - * @param amount - * @param ticker - * @param who - * @param destination (optional) - * @param comment (optional) - * @return RequestConfig - */ - fun getInscriptionOpTemplateRequestConfig(type: TypeGetInscriptionOpTemplate, operation: OperationGetInscriptionOpTemplate, amount: kotlin.String, ticker: kotlin.String, who: kotlin.String, destination: kotlin.String?, comment: kotlin.String?) : RequestConfig { - val localVariableBody = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("type", listOf(type.value)) - if (destination != null) { - put("destination", listOf(destination.toString())) - } - if (comment != null) { - put("comment", listOf(comment.toString())) - } - put("operation", listOf(operation.value)) - put("amount", listOf(amount.toString())) - put("ticker", listOf(ticker.toString())) - put("who", listOf(who.toString())) - } - val localVariableHeaders: MutableMap = mutableMapOf() - localVariableHeaders["Accept"] = "application/json" - - return RequestConfig( - method = RequestMethod.GET, - path = "/v2/experimental/inscriptions/op-template", - query = localVariableQuery, - headers = localVariableHeaders, - requiresAuthentication = false, - body = localVariableBody - ) - } - - - private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String = - HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0] -} diff --git a/tonapi/src/main/kotlin/io/tonapi/apis/JettonsApi.kt b/tonapi/src/main/kotlin/io/tonapi/apis/JettonsApi.kt index 36d237161..5660e0956 100644 --- a/tonapi/src/main/kotlin/io/tonapi/apis/JettonsApi.kt +++ b/tonapi/src/main/kotlin/io/tonapi/apis/JettonsApi.kt @@ -16,33 +16,35 @@ package io.tonapi.apis import java.io.IOException -import okhttp3.OkHttpClient +import okhttp3.Call import okhttp3.HttpUrl import io.tonapi.models.Event +import io.tonapi.models.GetAccountsRequest +import io.tonapi.models.InlineObject import io.tonapi.models.JettonHolders import io.tonapi.models.JettonInfo import io.tonapi.models.JettonTransferPayload import io.tonapi.models.Jettons -import io.tonapi.models.StatusDefaultResponse - -import com.squareup.moshi.Json - -import io.tonapi.infrastructure.ApiClient -import io.tonapi.infrastructure.ApiResponse -import io.tonapi.infrastructure.ClientException -import io.tonapi.infrastructure.ClientError -import io.tonapi.infrastructure.ServerException -import io.tonapi.infrastructure.ServerError -import io.tonapi.infrastructure.MultiValueMap -import io.tonapi.infrastructure.PartConfig -import io.tonapi.infrastructure.RequestConfig -import io.tonapi.infrastructure.RequestMethod -import io.tonapi.infrastructure.ResponseType -import io.tonapi.infrastructure.Success -import io.tonapi.infrastructure.toMultiValue - -class JettonsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = ApiClient.defaultClient) : ApiClient(basePath, client) { + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +import io.infrastructure.ApiClient +import io.infrastructure.ApiResponse +import io.infrastructure.ClientException +import io.infrastructure.ClientError +import io.infrastructure.ServerException +import io.infrastructure.ServerError +import io.infrastructure.MultiValueMap +import io.infrastructure.PartConfig +import io.infrastructure.RequestConfig +import io.infrastructure.RequestMethod +import io.infrastructure.ResponseType +import io.infrastructure.Success +import io.infrastructure.toMultiValue + +class JettonsApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory = ApiClient.defaultClient) : ApiClient(basePath, client) { companion object { @JvmStatic val defaultBasePath: String by lazy { @@ -50,19 +52,6 @@ class JettonsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient } } - /** - * - * Get jetton's holders - * @param accountId account ID - * @param limit (optional, default to 1000) - * @param offset (optional, default to 0) - * @return JettonHolders - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getJettonHolders(accountId: kotlin.String, limit: kotlin.Int? = 1000, offset: kotlin.Int? = 0) : JettonHolders { @@ -83,16 +72,6 @@ class JettonsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient } } - /** - * - * Get jetton's holders - * @param accountId account ID - * @param limit (optional, default to 1000) - * @param offset (optional, default to 0) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getJettonHoldersWithHttpInfo(accountId: kotlin.String, limit: kotlin.Int?, offset: kotlin.Int?) : ApiResponse { @@ -103,14 +82,6 @@ class JettonsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient ) } - /** - * To obtain the request config of the operation getJettonHolders - * - * @param accountId account ID - * @param limit (optional, default to 1000) - * @param offset (optional, default to 0) - * @return RequestConfig - */ fun getJettonHoldersRequestConfig(accountId: kotlin.String, limit: kotlin.Int?, offset: kotlin.Int?) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf>() @@ -135,17 +106,6 @@ class JettonsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient ) } - /** - * - * Get jetton metadata by jetton master address - * @param accountId account ID - * @return JettonInfo - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getJettonInfo(accountId: kotlin.String) : JettonInfo { @@ -166,14 +126,6 @@ class JettonsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient } } - /** - * - * Get jetton metadata by jetton master address - * @param accountId account ID - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getJettonInfoWithHttpInfo(accountId: kotlin.String) : ApiResponse { @@ -184,12 +136,6 @@ class JettonsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient ) } - /** - * To obtain the request config of the operation getJettonInfo - * - * @param accountId account ID - * @return RequestConfig - */ fun getJettonInfoRequestConfig(accountId: kotlin.String) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() @@ -206,18 +152,53 @@ class JettonsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient ) } - /** - * - * Get jetton's custom payload and state init required for transfer - * @param accountId account ID - * @param jettonId jetton ID - * @return JettonTransferPayload - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun getJettonInfosByAddresses(getAccountsRequest: GetAccountsRequest? = null) : Jettons { + val localVarResponse = getJettonInfosByAddressesWithHttpInfo(getAccountsRequest = getAccountsRequest) + + return when (localVarResponse.responseType) { + ResponseType.Success -> (localVarResponse as Success<*>).data as Jettons + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> { + val localVarError = localVarResponse as ClientError<*> + throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + } + ResponseType.ServerError -> { + val localVarError = localVarResponse as ServerError<*> + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) + } + } + } + + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun getJettonInfosByAddressesWithHttpInfo(getAccountsRequest: GetAccountsRequest?) : ApiResponse { + val localVariableConfig = getJettonInfosByAddressesRequestConfig(getAccountsRequest = getAccountsRequest) + + return request( + localVariableConfig + ) + } + + fun getJettonInfosByAddressesRequestConfig(getAccountsRequest: GetAccountsRequest?) : RequestConfig { + val localVariableBody = getAccountsRequest + val localVariableQuery: MultiValueMap = mutableMapOf() + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "application/json" + + return RequestConfig( + method = RequestMethod.POST, + path = "/v2/jettons/_bulk", + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getJettonTransferPayload(accountId: kotlin.String, jettonId: kotlin.String) : JettonTransferPayload { @@ -238,15 +219,6 @@ class JettonsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient } } - /** - * - * Get jetton's custom payload and state init required for transfer - * @param accountId account ID - * @param jettonId jetton ID - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getJettonTransferPayloadWithHttpInfo(accountId: kotlin.String, jettonId: kotlin.String) : ApiResponse { @@ -257,13 +229,6 @@ class JettonsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient ) } - /** - * To obtain the request config of the operation getJettonTransferPayload - * - * @param accountId account ID - * @param jettonId jetton ID - * @return RequestConfig - */ fun getJettonTransferPayloadRequestConfig(accountId: kotlin.String, jettonId: kotlin.String) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() @@ -280,18 +245,6 @@ class JettonsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient ) } - /** - * - * Get a list of all indexed jetton masters in the blockchain. - * @param limit (optional, default to 100) - * @param offset (optional, default to 0) - * @return Jettons - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getJettons(limit: kotlin.Int? = 100, offset: kotlin.Int? = 0) : Jettons { @@ -312,15 +265,6 @@ class JettonsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient } } - /** - * - * Get a list of all indexed jetton masters in the blockchain. - * @param limit (optional, default to 100) - * @param offset (optional, default to 0) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getJettonsWithHttpInfo(limit: kotlin.Int?, offset: kotlin.Int?) : ApiResponse { @@ -331,13 +275,6 @@ class JettonsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient ) } - /** - * To obtain the request config of the operation getJettons - * - * @param limit (optional, default to 100) - * @param offset (optional, default to 0) - * @return RequestConfig - */ fun getJettonsRequestConfig(limit: kotlin.Int?, offset: kotlin.Int?) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf>() @@ -362,18 +299,6 @@ class JettonsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient ) } - /** - * - * Get only jetton transfers in the event - * @param eventId event ID or transaction hash in hex (without 0x) or base64url format - * @param acceptLanguage (optional, default to "en") - * @return Event - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getJettonsEvents(eventId: kotlin.String, acceptLanguage: kotlin.String? = "en") : Event { @@ -394,15 +319,6 @@ class JettonsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient } } - /** - * - * Get only jetton transfers in the event - * @param eventId event ID or transaction hash in hex (without 0x) or base64url format - * @param acceptLanguage (optional, default to "en") - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getJettonsEventsWithHttpInfo(eventId: kotlin.String, acceptLanguage: kotlin.String?) : ApiResponse { @@ -413,13 +329,6 @@ class JettonsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient ) } - /** - * To obtain the request config of the operation getJettonsEvents - * - * @param eventId event ID or transaction hash in hex (without 0x) or base64url format - * @param acceptLanguage (optional, default to "en") - * @return RequestConfig - */ fun getJettonsEventsRequestConfig(eventId: kotlin.String, acceptLanguage: kotlin.String?) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() diff --git a/tonapi/src/main/kotlin/io/tonapi/apis/LiteServerApi.kt b/tonapi/src/main/kotlin/io/tonapi/apis/LiteServerApi.kt index d1fc97eff..6fc23ae52 100644 --- a/tonapi/src/main/kotlin/io/tonapi/apis/LiteServerApi.kt +++ b/tonapi/src/main/kotlin/io/tonapi/apis/LiteServerApi.kt @@ -16,7 +16,7 @@ package io.tonapi.apis import java.io.IOException -import okhttp3.OkHttpClient +import okhttp3.Call import okhttp3.HttpUrl import io.tonapi.models.GetAllRawShardsInfo200Response @@ -34,27 +34,28 @@ import io.tonapi.models.GetRawShardBlockProof200Response import io.tonapi.models.GetRawShardInfo200Response import io.tonapi.models.GetRawTime200Response import io.tonapi.models.GetRawTransactions200Response +import io.tonapi.models.InlineObject import io.tonapi.models.SendRawMessage200Response import io.tonapi.models.SendRawMessageRequest -import io.tonapi.models.StatusDefaultResponse - -import com.squareup.moshi.Json - -import io.tonapi.infrastructure.ApiClient -import io.tonapi.infrastructure.ApiResponse -import io.tonapi.infrastructure.ClientException -import io.tonapi.infrastructure.ClientError -import io.tonapi.infrastructure.ServerException -import io.tonapi.infrastructure.ServerError -import io.tonapi.infrastructure.MultiValueMap -import io.tonapi.infrastructure.PartConfig -import io.tonapi.infrastructure.RequestConfig -import io.tonapi.infrastructure.RequestMethod -import io.tonapi.infrastructure.ResponseType -import io.tonapi.infrastructure.Success -import io.tonapi.infrastructure.toMultiValue - -class LiteServerApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = ApiClient.defaultClient) : ApiClient(basePath, client) { + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +import io.infrastructure.ApiClient +import io.infrastructure.ApiResponse +import io.infrastructure.ClientException +import io.infrastructure.ClientError +import io.infrastructure.ServerException +import io.infrastructure.ServerError +import io.infrastructure.MultiValueMap +import io.infrastructure.PartConfig +import io.infrastructure.RequestConfig +import io.infrastructure.RequestMethod +import io.infrastructure.ResponseType +import io.infrastructure.Success +import io.infrastructure.toMultiValue + +class LiteServerApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory = ApiClient.defaultClient) : ApiClient(basePath, client) { companion object { @JvmStatic val defaultBasePath: String by lazy { @@ -62,17 +63,6 @@ class LiteServerApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli } } - /** - * - * Get all raw shards info - * @param blockId block ID: (workchain,shard,seqno,root_hash,file_hash) - * @return GetAllRawShardsInfo200Response - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getAllRawShardsInfo(blockId: kotlin.String) : GetAllRawShardsInfo200Response { @@ -93,14 +83,6 @@ class LiteServerApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli } } - /** - * - * Get all raw shards info - * @param blockId block ID: (workchain,shard,seqno,root_hash,file_hash) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getAllRawShardsInfoWithHttpInfo(blockId: kotlin.String) : ApiResponse { @@ -111,12 +93,6 @@ class LiteServerApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * To obtain the request config of the operation getAllRawShardsInfo - * - * @param blockId block ID: (workchain,shard,seqno,root_hash,file_hash) - * @return RequestConfig - */ fun getAllRawShardsInfoRequestConfig(blockId: kotlin.String) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() @@ -133,16 +109,6 @@ class LiteServerApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * - * Get out msg queue sizes - * @return GetOutMsgQueueSizes200Response - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getOutMsgQueueSizes() : GetOutMsgQueueSizes200Response { @@ -163,13 +129,6 @@ class LiteServerApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli } } - /** - * - * Get out msg queue sizes - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getOutMsgQueueSizesWithHttpInfo() : ApiResponse { @@ -180,11 +139,6 @@ class LiteServerApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * To obtain the request config of the operation getOutMsgQueueSizes - * - * @return RequestConfig - */ fun getOutMsgQueueSizesRequestConfig() : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() @@ -201,18 +155,6 @@ class LiteServerApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * - * Get raw account state - * @param accountId account ID - * @param targetBlock target block: (workchain,shard,seqno,root_hash,file_hash) (optional) - * @return GetRawAccountState200Response - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getRawAccountState(accountId: kotlin.String, targetBlock: kotlin.String? = null) : GetRawAccountState200Response { @@ -233,15 +175,6 @@ class LiteServerApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli } } - /** - * - * Get raw account state - * @param accountId account ID - * @param targetBlock target block: (workchain,shard,seqno,root_hash,file_hash) (optional) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getRawAccountStateWithHttpInfo(accountId: kotlin.String, targetBlock: kotlin.String?) : ApiResponse { @@ -252,13 +185,6 @@ class LiteServerApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * To obtain the request config of the operation getRawAccountState - * - * @param accountId account ID - * @param targetBlock target block: (workchain,shard,seqno,root_hash,file_hash) (optional) - * @return RequestConfig - */ fun getRawAccountStateRequestConfig(accountId: kotlin.String, targetBlock: kotlin.String?) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf>() @@ -280,19 +206,6 @@ class LiteServerApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * - * Get raw block proof - * @param knownBlock known block: (workchain,shard,seqno,root_hash,file_hash) - * @param mode mode - * @param targetBlock target block: (workchain,shard,seqno,root_hash,file_hash) (optional) - * @return GetRawBlockProof200Response - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getRawBlockProof(knownBlock: kotlin.String, mode: kotlin.Int, targetBlock: kotlin.String? = null) : GetRawBlockProof200Response { @@ -313,16 +226,6 @@ class LiteServerApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli } } - /** - * - * Get raw block proof - * @param knownBlock known block: (workchain,shard,seqno,root_hash,file_hash) - * @param mode mode - * @param targetBlock target block: (workchain,shard,seqno,root_hash,file_hash) (optional) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getRawBlockProofWithHttpInfo(knownBlock: kotlin.String, mode: kotlin.Int, targetBlock: kotlin.String?) : ApiResponse { @@ -333,14 +236,6 @@ class LiteServerApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * To obtain the request config of the operation getRawBlockProof - * - * @param knownBlock known block: (workchain,shard,seqno,root_hash,file_hash) - * @param mode mode - * @param targetBlock target block: (workchain,shard,seqno,root_hash,file_hash) (optional) - * @return RequestConfig - */ fun getRawBlockProofRequestConfig(knownBlock: kotlin.String, mode: kotlin.Int, targetBlock: kotlin.String?) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf>() @@ -364,17 +259,6 @@ class LiteServerApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * - * Get raw blockchain block - * @param blockId block ID: (workchain,shard,seqno,root_hash,file_hash) - * @return GetRawBlockchainBlock200Response - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getRawBlockchainBlock(blockId: kotlin.String) : GetRawBlockchainBlock200Response { @@ -395,14 +279,6 @@ class LiteServerApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli } } - /** - * - * Get raw blockchain block - * @param blockId block ID: (workchain,shard,seqno,root_hash,file_hash) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getRawBlockchainBlockWithHttpInfo(blockId: kotlin.String) : ApiResponse { @@ -413,12 +289,6 @@ class LiteServerApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * To obtain the request config of the operation getRawBlockchainBlock - * - * @param blockId block ID: (workchain,shard,seqno,root_hash,file_hash) - * @return RequestConfig - */ fun getRawBlockchainBlockRequestConfig(blockId: kotlin.String) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() @@ -435,18 +305,6 @@ class LiteServerApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * - * Get raw blockchain block header - * @param blockId block ID: (workchain,shard,seqno,root_hash,file_hash) - * @param mode mode - * @return GetRawBlockchainBlockHeader200Response - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getRawBlockchainBlockHeader(blockId: kotlin.String, mode: kotlin.Int) : GetRawBlockchainBlockHeader200Response { @@ -467,15 +325,6 @@ class LiteServerApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli } } - /** - * - * Get raw blockchain block header - * @param blockId block ID: (workchain,shard,seqno,root_hash,file_hash) - * @param mode mode - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getRawBlockchainBlockHeaderWithHttpInfo(blockId: kotlin.String, mode: kotlin.Int) : ApiResponse { @@ -486,13 +335,6 @@ class LiteServerApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * To obtain the request config of the operation getRawBlockchainBlockHeader - * - * @param blockId block ID: (workchain,shard,seqno,root_hash,file_hash) - * @param mode mode - * @return RequestConfig - */ fun getRawBlockchainBlockHeaderRequestConfig(blockId: kotlin.String, mode: kotlin.Int) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf>() @@ -512,17 +354,6 @@ class LiteServerApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * - * Get raw blockchain block state - * @param blockId block ID: (workchain,shard,seqno,root_hash,file_hash) - * @return GetRawBlockchainBlockState200Response - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getRawBlockchainBlockState(blockId: kotlin.String) : GetRawBlockchainBlockState200Response { @@ -543,14 +374,6 @@ class LiteServerApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli } } - /** - * - * Get raw blockchain block state - * @param blockId block ID: (workchain,shard,seqno,root_hash,file_hash) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getRawBlockchainBlockStateWithHttpInfo(blockId: kotlin.String) : ApiResponse { @@ -561,12 +384,6 @@ class LiteServerApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * To obtain the request config of the operation getRawBlockchainBlockState - * - * @param blockId block ID: (workchain,shard,seqno,root_hash,file_hash) - * @return RequestConfig - */ fun getRawBlockchainBlockStateRequestConfig(blockId: kotlin.String) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() @@ -583,18 +400,6 @@ class LiteServerApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * - * Get raw config - * @param blockId block ID: (workchain,shard,seqno,root_hash,file_hash) - * @param mode mode - * @return GetRawConfig200Response - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getRawConfig(blockId: kotlin.String, mode: kotlin.Int) : GetRawConfig200Response { @@ -615,15 +420,6 @@ class LiteServerApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli } } - /** - * - * Get raw config - * @param blockId block ID: (workchain,shard,seqno,root_hash,file_hash) - * @param mode mode - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getRawConfigWithHttpInfo(blockId: kotlin.String, mode: kotlin.Int) : ApiResponse { @@ -634,13 +430,6 @@ class LiteServerApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * To obtain the request config of the operation getRawConfig - * - * @param blockId block ID: (workchain,shard,seqno,root_hash,file_hash) - * @param mode mode - * @return RequestConfig - */ fun getRawConfigRequestConfig(blockId: kotlin.String, mode: kotlin.Int) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf>() @@ -660,21 +449,6 @@ class LiteServerApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * - * Get raw list block transactions - * @param blockId block ID: (workchain,shard,seqno,root_hash,file_hash) - * @param mode mode - * @param count count - * @param accountId account ID (optional) - * @param lt lt (optional) - * @return GetRawListBlockTransactions200Response - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getRawListBlockTransactions(blockId: kotlin.String, mode: kotlin.Int, count: kotlin.Int, accountId: kotlin.String? = null, lt: kotlin.Long? = null) : GetRawListBlockTransactions200Response { @@ -695,18 +469,6 @@ class LiteServerApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli } } - /** - * - * Get raw list block transactions - * @param blockId block ID: (workchain,shard,seqno,root_hash,file_hash) - * @param mode mode - * @param count count - * @param accountId account ID (optional) - * @param lt lt (optional) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getRawListBlockTransactionsWithHttpInfo(blockId: kotlin.String, mode: kotlin.Int, count: kotlin.Int, accountId: kotlin.String?, lt: kotlin.Long?) : ApiResponse { @@ -717,16 +479,6 @@ class LiteServerApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * To obtain the request config of the operation getRawListBlockTransactions - * - * @param blockId block ID: (workchain,shard,seqno,root_hash,file_hash) - * @param mode mode - * @param count count - * @param accountId account ID (optional) - * @param lt lt (optional) - * @return RequestConfig - */ fun getRawListBlockTransactionsRequestConfig(blockId: kotlin.String, mode: kotlin.Int, count: kotlin.Int, accountId: kotlin.String?, lt: kotlin.Long?) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf>() @@ -753,16 +505,6 @@ class LiteServerApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * - * Get raw masterchain info - * @return GetRawMasterchainInfo200Response - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getRawMasterchainInfo() : GetRawMasterchainInfo200Response { @@ -783,13 +525,6 @@ class LiteServerApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli } } - /** - * - * Get raw masterchain info - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getRawMasterchainInfoWithHttpInfo() : ApiResponse { @@ -800,11 +535,6 @@ class LiteServerApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * To obtain the request config of the operation getRawMasterchainInfo - * - * @return RequestConfig - */ fun getRawMasterchainInfoRequestConfig() : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() @@ -821,17 +551,6 @@ class LiteServerApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * - * Get raw masterchain info ext - * @param mode mode - * @return GetRawMasterchainInfoExt200Response - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getRawMasterchainInfoExt(mode: kotlin.Int) : GetRawMasterchainInfoExt200Response { @@ -852,14 +571,6 @@ class LiteServerApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli } } - /** - * - * Get raw masterchain info ext - * @param mode mode - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getRawMasterchainInfoExtWithHttpInfo(mode: kotlin.Int) : ApiResponse { @@ -870,12 +581,6 @@ class LiteServerApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * To obtain the request config of the operation getRawMasterchainInfoExt - * - * @param mode mode - * @return RequestConfig - */ fun getRawMasterchainInfoExtRequestConfig(mode: kotlin.Int) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf>() @@ -895,17 +600,6 @@ class LiteServerApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * - * Get raw shard block proof - * @param blockId block ID: (workchain,shard,seqno,root_hash,file_hash) - * @return GetRawShardBlockProof200Response - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getRawShardBlockProof(blockId: kotlin.String) : GetRawShardBlockProof200Response { @@ -926,14 +620,6 @@ class LiteServerApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli } } - /** - * - * Get raw shard block proof - * @param blockId block ID: (workchain,shard,seqno,root_hash,file_hash) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getRawShardBlockProofWithHttpInfo(blockId: kotlin.String) : ApiResponse { @@ -944,12 +630,6 @@ class LiteServerApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * To obtain the request config of the operation getRawShardBlockProof - * - * @param blockId block ID: (workchain,shard,seqno,root_hash,file_hash) - * @return RequestConfig - */ fun getRawShardBlockProofRequestConfig(blockId: kotlin.String) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() @@ -966,20 +646,6 @@ class LiteServerApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * - * Get raw shard info - * @param blockId block ID: (workchain,shard,seqno,root_hash,file_hash) - * @param workchain workchain - * @param shard shard - * @param exact exact - * @return GetRawShardInfo200Response - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getRawShardInfo(blockId: kotlin.String, workchain: kotlin.Int, shard: kotlin.Long, exact: kotlin.Boolean) : GetRawShardInfo200Response { @@ -1000,17 +666,6 @@ class LiteServerApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli } } - /** - * - * Get raw shard info - * @param blockId block ID: (workchain,shard,seqno,root_hash,file_hash) - * @param workchain workchain - * @param shard shard - * @param exact exact - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getRawShardInfoWithHttpInfo(blockId: kotlin.String, workchain: kotlin.Int, shard: kotlin.Long, exact: kotlin.Boolean) : ApiResponse { @@ -1021,15 +676,6 @@ class LiteServerApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * To obtain the request config of the operation getRawShardInfo - * - * @param blockId block ID: (workchain,shard,seqno,root_hash,file_hash) - * @param workchain workchain - * @param shard shard - * @param exact exact - * @return RequestConfig - */ fun getRawShardInfoRequestConfig(blockId: kotlin.String, workchain: kotlin.Int, shard: kotlin.Long, exact: kotlin.Boolean) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf>() @@ -1051,16 +697,6 @@ class LiteServerApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * - * Get raw time - * @return GetRawTime200Response - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getRawTime() : GetRawTime200Response { @@ -1081,13 +717,6 @@ class LiteServerApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli } } - /** - * - * Get raw time - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getRawTimeWithHttpInfo() : ApiResponse { @@ -1098,11 +727,6 @@ class LiteServerApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * To obtain the request config of the operation getRawTime - * - * @return RequestConfig - */ fun getRawTimeRequestConfig() : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() @@ -1119,20 +743,6 @@ class LiteServerApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * - * Get raw transactions - * @param accountId account ID - * @param count count - * @param lt lt - * @param hash hash - * @return GetRawTransactions200Response - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getRawTransactions(accountId: kotlin.String, count: kotlin.Int, lt: kotlin.Long, hash: kotlin.String) : GetRawTransactions200Response { @@ -1153,17 +763,6 @@ class LiteServerApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli } } - /** - * - * Get raw transactions - * @param accountId account ID - * @param count count - * @param lt lt - * @param hash hash - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getRawTransactionsWithHttpInfo(accountId: kotlin.String, count: kotlin.Int, lt: kotlin.Long, hash: kotlin.String) : ApiResponse { @@ -1174,15 +773,6 @@ class LiteServerApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * To obtain the request config of the operation getRawTransactions - * - * @param accountId account ID - * @param count count - * @param lt lt - * @param hash hash - * @return RequestConfig - */ fun getRawTransactionsRequestConfig(accountId: kotlin.String, count: kotlin.Int, lt: kotlin.Long, hash: kotlin.String) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf>() @@ -1204,17 +794,6 @@ class LiteServerApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * - * Send raw message to blockchain - * @param sendRawMessageRequest Data that is expected - * @return SendRawMessage200Response - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun sendRawMessage(sendRawMessageRequest: SendRawMessageRequest) : SendRawMessage200Response { @@ -1235,14 +814,6 @@ class LiteServerApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli } } - /** - * - * Send raw message to blockchain - * @param sendRawMessageRequest Data that is expected - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun sendRawMessageWithHttpInfo(sendRawMessageRequest: SendRawMessageRequest) : ApiResponse { @@ -1253,12 +824,6 @@ class LiteServerApi(basePath: kotlin.String = defaultBasePath, client: OkHttpCli ) } - /** - * To obtain the request config of the operation sendRawMessage - * - * @param sendRawMessageRequest Data that is expected - * @return RequestConfig - */ fun sendRawMessageRequestConfig(sendRawMessageRequest: SendRawMessageRequest) : RequestConfig { val localVariableBody = sendRawMessageRequest val localVariableQuery: MultiValueMap = mutableMapOf() diff --git a/tonapi/src/main/kotlin/io/tonapi/apis/MultisigApi.kt b/tonapi/src/main/kotlin/io/tonapi/apis/MultisigApi.kt index ee94168b5..f09fd78b5 100644 --- a/tonapi/src/main/kotlin/io/tonapi/apis/MultisigApi.kt +++ b/tonapi/src/main/kotlin/io/tonapi/apis/MultisigApi.kt @@ -16,29 +16,31 @@ package io.tonapi.apis import java.io.IOException -import okhttp3.OkHttpClient +import okhttp3.Call import okhttp3.HttpUrl +import io.tonapi.models.InlineObject import io.tonapi.models.Multisig -import io.tonapi.models.StatusDefaultResponse - -import com.squareup.moshi.Json - -import io.tonapi.infrastructure.ApiClient -import io.tonapi.infrastructure.ApiResponse -import io.tonapi.infrastructure.ClientException -import io.tonapi.infrastructure.ClientError -import io.tonapi.infrastructure.ServerException -import io.tonapi.infrastructure.ServerError -import io.tonapi.infrastructure.MultiValueMap -import io.tonapi.infrastructure.PartConfig -import io.tonapi.infrastructure.RequestConfig -import io.tonapi.infrastructure.RequestMethod -import io.tonapi.infrastructure.ResponseType -import io.tonapi.infrastructure.Success -import io.tonapi.infrastructure.toMultiValue - -class MultisigApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = ApiClient.defaultClient) : ApiClient(basePath, client) { +import io.tonapi.models.MultisigOrder + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +import io.infrastructure.ApiClient +import io.infrastructure.ApiResponse +import io.infrastructure.ClientException +import io.infrastructure.ClientError +import io.infrastructure.ServerException +import io.infrastructure.ServerError +import io.infrastructure.MultiValueMap +import io.infrastructure.PartConfig +import io.infrastructure.RequestConfig +import io.infrastructure.RequestMethod +import io.infrastructure.ResponseType +import io.infrastructure.Success +import io.infrastructure.toMultiValue + +class MultisigApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory = ApiClient.defaultClient) : ApiClient(basePath, client) { companion object { @JvmStatic val defaultBasePath: String by lazy { @@ -46,17 +48,6 @@ class MultisigApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien } } - /** - * - * Get multisig account info - * @param accountId account ID - * @return Multisig - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getMultisigAccount(accountId: kotlin.String) : Multisig { @@ -77,14 +68,6 @@ class MultisigApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien } } - /** - * - * Get multisig account info - * @param accountId account ID - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getMultisigAccountWithHttpInfo(accountId: kotlin.String) : ApiResponse { @@ -95,12 +78,6 @@ class MultisigApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien ) } - /** - * To obtain the request config of the operation getMultisigAccount - * - * @param accountId account ID - * @return RequestConfig - */ fun getMultisigAccountRequestConfig(accountId: kotlin.String) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() @@ -117,6 +94,52 @@ class MultisigApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClien ) } + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun getMultisigOrder(accountId: kotlin.String) : MultisigOrder { + val localVarResponse = getMultisigOrderWithHttpInfo(accountId = accountId) + + return when (localVarResponse.responseType) { + ResponseType.Success -> (localVarResponse as Success<*>).data as MultisigOrder + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> { + val localVarError = localVarResponse as ClientError<*> + throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + } + ResponseType.ServerError -> { + val localVarError = localVarResponse as ServerError<*> + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) + } + } + } + + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun getMultisigOrderWithHttpInfo(accountId: kotlin.String) : ApiResponse { + val localVariableConfig = getMultisigOrderRequestConfig(accountId = accountId) + + return request( + localVariableConfig + ) + } + + fun getMultisigOrderRequestConfig(accountId: kotlin.String) : RequestConfig { + val localVariableBody = null + val localVariableQuery: MultiValueMap = mutableMapOf() + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" + + return RequestConfig( + method = RequestMethod.GET, + path = "/v2/multisig/order/{account_id}".replace("{"+"account_id"+"}", encodeURIComponent(accountId.toString())), + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String = HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0] diff --git a/tonapi/src/main/kotlin/io/tonapi/apis/NFTApi.kt b/tonapi/src/main/kotlin/io/tonapi/apis/NFTApi.kt index 121e9bb70..8e71a12c9 100644 --- a/tonapi/src/main/kotlin/io/tonapi/apis/NFTApi.kt +++ b/tonapi/src/main/kotlin/io/tonapi/apis/NFTApi.kt @@ -16,34 +16,36 @@ package io.tonapi.apis import java.io.IOException -import okhttp3.OkHttpClient +import okhttp3.Call import okhttp3.HttpUrl import io.tonapi.models.AccountEvents import io.tonapi.models.GetAccountsRequest +import io.tonapi.models.InlineObject import io.tonapi.models.NftCollection import io.tonapi.models.NftCollections import io.tonapi.models.NftItem import io.tonapi.models.NftItems -import io.tonapi.models.StatusDefaultResponse - -import com.squareup.moshi.Json - -import io.tonapi.infrastructure.ApiClient -import io.tonapi.infrastructure.ApiResponse -import io.tonapi.infrastructure.ClientException -import io.tonapi.infrastructure.ClientError -import io.tonapi.infrastructure.ServerException -import io.tonapi.infrastructure.ServerError -import io.tonapi.infrastructure.MultiValueMap -import io.tonapi.infrastructure.PartConfig -import io.tonapi.infrastructure.RequestConfig -import io.tonapi.infrastructure.RequestMethod -import io.tonapi.infrastructure.ResponseType -import io.tonapi.infrastructure.Success -import io.tonapi.infrastructure.toMultiValue - -class NFTApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = ApiClient.defaultClient) : ApiClient(basePath, client) { +import io.tonapi.models.NftOperations + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +import io.infrastructure.ApiClient +import io.infrastructure.ApiResponse +import io.infrastructure.ClientException +import io.infrastructure.ClientError +import io.infrastructure.ServerException +import io.infrastructure.ServerError +import io.infrastructure.MultiValueMap +import io.infrastructure.PartConfig +import io.infrastructure.RequestConfig +import io.infrastructure.RequestMethod +import io.infrastructure.ResponseType +import io.infrastructure.Success +import io.infrastructure.toMultiValue + +class NFTApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory = ApiClient.defaultClient) : ApiClient(basePath, client) { companion object { @JvmStatic val defaultBasePath: String by lazy { @@ -51,29 +53,13 @@ class NFTApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A } } - /** - * - * Get the transfer nft history - * @param accountId account ID - * @param limit - * @param acceptLanguage (optional, default to "en") - * @param beforeLt omit this parameter to get last events (optional) - * @param startDate (optional) - * @param endDate (optional) - * @return AccountEvents - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getAccountNftHistory(accountId: kotlin.String, limit: kotlin.Int, acceptLanguage: kotlin.String? = "en", beforeLt: kotlin.Long? = null, startDate: kotlin.Long? = null, endDate: kotlin.Long? = null) : AccountEvents { - val localVarResponse = getAccountNftHistoryWithHttpInfo(accountId = accountId, limit = limit, acceptLanguage = acceptLanguage, beforeLt = beforeLt, startDate = startDate, endDate = endDate) + fun getAccountNftHistory(accountId: kotlin.String, limit: kotlin.Int, acceptLanguage: kotlin.String? = "en", beforeLt: kotlin.Long? = null) : NftOperations { + val localVarResponse = getAccountNftHistoryWithHttpInfo(accountId = accountId, limit = limit, acceptLanguage = acceptLanguage, beforeLt = beforeLt) return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as AccountEvents + ResponseType.Success -> (localVarResponse as Success<*>).data as NftOperations ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") ResponseType.ClientError -> { @@ -87,41 +73,17 @@ class NFTApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A } } - /** - * - * Get the transfer nft history - * @param accountId account ID - * @param limit - * @param acceptLanguage (optional, default to "en") - * @param beforeLt omit this parameter to get last events (optional) - * @param startDate (optional) - * @param endDate (optional) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun getAccountNftHistoryWithHttpInfo(accountId: kotlin.String, limit: kotlin.Int, acceptLanguage: kotlin.String?, beforeLt: kotlin.Long?, startDate: kotlin.Long?, endDate: kotlin.Long?) : ApiResponse { - val localVariableConfig = getAccountNftHistoryRequestConfig(accountId = accountId, limit = limit, acceptLanguage = acceptLanguage, beforeLt = beforeLt, startDate = startDate, endDate = endDate) + fun getAccountNftHistoryWithHttpInfo(accountId: kotlin.String, limit: kotlin.Int, acceptLanguage: kotlin.String?, beforeLt: kotlin.Long?) : ApiResponse { + val localVariableConfig = getAccountNftHistoryRequestConfig(accountId = accountId, limit = limit, acceptLanguage = acceptLanguage, beforeLt = beforeLt) - return request( + return request( localVariableConfig ) } - /** - * To obtain the request config of the operation getAccountNftHistory - * - * @param accountId account ID - * @param limit - * @param acceptLanguage (optional, default to "en") - * @param beforeLt omit this parameter to get last events (optional) - * @param startDate (optional) - * @param endDate (optional) - * @return RequestConfig - */ - fun getAccountNftHistoryRequestConfig(accountId: kotlin.String, limit: kotlin.Int, acceptLanguage: kotlin.String?, beforeLt: kotlin.Long?, startDate: kotlin.Long?, endDate: kotlin.Long?) : RequestConfig { + fun getAccountNftHistoryRequestConfig(accountId: kotlin.String, limit: kotlin.Int, acceptLanguage: kotlin.String?, beforeLt: kotlin.Long?) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf>() .apply { @@ -129,12 +91,6 @@ class NFTApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A put("before_lt", listOf(beforeLt.toString())) } put("limit", listOf(limit.toString())) - if (startDate != null) { - put("start_date", listOf(startDate.toString())) - } - if (endDate != null) { - put("end_date", listOf(endDate.toString())) - } } val localVariableHeaders: MutableMap = mutableMapOf() acceptLanguage?.apply { localVariableHeaders["Accept-Language"] = this.toString() } @@ -150,19 +106,6 @@ class NFTApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A ) } - /** - * - * Get NFT items from collection by collection address - * @param accountId account ID - * @param limit (optional, default to 1000) - * @param offset (optional, default to 0) - * @return NftItems - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getItemsFromCollection(accountId: kotlin.String, limit: kotlin.Int? = 1000, offset: kotlin.Int? = 0) : NftItems { @@ -183,16 +126,6 @@ class NFTApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A } } - /** - * - * Get NFT items from collection by collection address - * @param accountId account ID - * @param limit (optional, default to 1000) - * @param offset (optional, default to 0) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getItemsFromCollectionWithHttpInfo(accountId: kotlin.String, limit: kotlin.Int?, offset: kotlin.Int?) : ApiResponse { @@ -203,14 +136,6 @@ class NFTApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A ) } - /** - * To obtain the request config of the operation getItemsFromCollection - * - * @param accountId account ID - * @param limit (optional, default to 1000) - * @param offset (optional, default to 0) - * @return RequestConfig - */ fun getItemsFromCollectionRequestConfig(accountId: kotlin.String, limit: kotlin.Int?, offset: kotlin.Int?) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf>() @@ -235,17 +160,6 @@ class NFTApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A ) } - /** - * - * Get NFT collection by collection address - * @param accountId account ID - * @return NftCollection - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getNftCollection(accountId: kotlin.String) : NftCollection { @@ -266,14 +180,6 @@ class NFTApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A } } - /** - * - * Get NFT collection by collection address - * @param accountId account ID - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getNftCollectionWithHttpInfo(accountId: kotlin.String) : ApiResponse { @@ -284,12 +190,6 @@ class NFTApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A ) } - /** - * To obtain the request config of the operation getNftCollection - * - * @param accountId account ID - * @return RequestConfig - */ fun getNftCollectionRequestConfig(accountId: kotlin.String) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() @@ -306,18 +206,53 @@ class NFTApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A ) } - /** - * - * Get NFT collections - * @param limit (optional, default to 100) - * @param offset (optional, default to 0) - * @return NftCollections - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun getNftCollectionItemsByAddresses(getAccountsRequest: GetAccountsRequest? = null) : NftCollections { + val localVarResponse = getNftCollectionItemsByAddressesWithHttpInfo(getAccountsRequest = getAccountsRequest) + + return when (localVarResponse.responseType) { + ResponseType.Success -> (localVarResponse as Success<*>).data as NftCollections + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> { + val localVarError = localVarResponse as ClientError<*> + throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + } + ResponseType.ServerError -> { + val localVarError = localVarResponse as ServerError<*> + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) + } + } + } + + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun getNftCollectionItemsByAddressesWithHttpInfo(getAccountsRequest: GetAccountsRequest?) : ApiResponse { + val localVariableConfig = getNftCollectionItemsByAddressesRequestConfig(getAccountsRequest = getAccountsRequest) + + return request( + localVariableConfig + ) + } + + fun getNftCollectionItemsByAddressesRequestConfig(getAccountsRequest: GetAccountsRequest?) : RequestConfig { + val localVariableBody = getAccountsRequest + val localVariableQuery: MultiValueMap = mutableMapOf() + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "application/json" + + return RequestConfig( + method = RequestMethod.POST, + path = "/v2/nfts/collections/_bulk", + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getNftCollections(limit: kotlin.Int? = 100, offset: kotlin.Int? = 0) : NftCollections { @@ -338,15 +273,6 @@ class NFTApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A } } - /** - * - * Get NFT collections - * @param limit (optional, default to 100) - * @param offset (optional, default to 0) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getNftCollectionsWithHttpInfo(limit: kotlin.Int?, offset: kotlin.Int?) : ApiResponse { @@ -357,13 +283,6 @@ class NFTApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A ) } - /** - * To obtain the request config of the operation getNftCollections - * - * @param limit (optional, default to 100) - * @param offset (optional, default to 0) - * @return RequestConfig - */ fun getNftCollectionsRequestConfig(limit: kotlin.Int?, offset: kotlin.Int?) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf>() @@ -388,25 +307,11 @@ class NFTApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A ) } - /** - * - * Get the transfer nfts history for account - * @param accountId account ID - * @param limit - * @param acceptLanguage (optional, default to "en") - * @param beforeLt omit this parameter to get last events (optional) - * @param startDate (optional) - * @param endDate (optional) - * @return AccountEvents - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Deprecated(message = "This operation is deprecated.") fun getNftHistoryByID(accountId: kotlin.String, limit: kotlin.Int, acceptLanguage: kotlin.String? = "en", beforeLt: kotlin.Long? = null, startDate: kotlin.Long? = null, endDate: kotlin.Long? = null) : AccountEvents { + @Suppress("DEPRECATION") val localVarResponse = getNftHistoryByIDWithHttpInfo(accountId = accountId, limit = limit, acceptLanguage = acceptLanguage, beforeLt = beforeLt, startDate = startDate, endDate = endDate) return when (localVarResponse.responseType) { @@ -424,22 +329,11 @@ class NFTApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A } } - /** - * - * Get the transfer nfts history for account - * @param accountId account ID - * @param limit - * @param acceptLanguage (optional, default to "en") - * @param beforeLt omit this parameter to get last events (optional) - * @param startDate (optional) - * @param endDate (optional) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) + @Deprecated(message = "This operation is deprecated.") fun getNftHistoryByIDWithHttpInfo(accountId: kotlin.String, limit: kotlin.Int, acceptLanguage: kotlin.String?, beforeLt: kotlin.Long?, startDate: kotlin.Long?, endDate: kotlin.Long?) : ApiResponse { + @Suppress("DEPRECATION") val localVariableConfig = getNftHistoryByIDRequestConfig(accountId = accountId, limit = limit, acceptLanguage = acceptLanguage, beforeLt = beforeLt, startDate = startDate, endDate = endDate) return request( @@ -447,17 +341,7 @@ class NFTApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A ) } - /** - * To obtain the request config of the operation getNftHistoryByID - * - * @param accountId account ID - * @param limit - * @param acceptLanguage (optional, default to "en") - * @param beforeLt omit this parameter to get last events (optional) - * @param startDate (optional) - * @param endDate (optional) - * @return RequestConfig - */ + @Deprecated(message = "This operation is deprecated.") fun getNftHistoryByIDRequestConfig(accountId: kotlin.String, limit: kotlin.Int, acceptLanguage: kotlin.String?, beforeLt: kotlin.Long?, startDate: kotlin.Long?, endDate: kotlin.Long?) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf>() @@ -487,17 +371,6 @@ class NFTApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A ) } - /** - * - * Get NFT item by its address - * @param accountId account ID - * @return NftItem - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getNftItemByAddress(accountId: kotlin.String) : NftItem { @@ -518,14 +391,6 @@ class NFTApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A } } - /** - * - * Get NFT item by its address - * @param accountId account ID - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getNftItemByAddressWithHttpInfo(accountId: kotlin.String) : ApiResponse { @@ -536,12 +401,6 @@ class NFTApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A ) } - /** - * To obtain the request config of the operation getNftItemByAddress - * - * @param accountId account ID - * @return RequestConfig - */ fun getNftItemByAddressRequestConfig(accountId: kotlin.String) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() @@ -558,17 +417,6 @@ class NFTApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A ) } - /** - * - * Get NFT items by their addresses - * @param getAccountsRequest a list of account ids (optional) - * @return NftItems - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getNftItemsByAddresses(getAccountsRequest: GetAccountsRequest? = null) : NftItems { @@ -589,14 +437,6 @@ class NFTApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A } } - /** - * - * Get NFT items by their addresses - * @param getAccountsRequest a list of account ids (optional) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getNftItemsByAddressesWithHttpInfo(getAccountsRequest: GetAccountsRequest?) : ApiResponse { @@ -607,12 +447,6 @@ class NFTApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A ) } - /** - * To obtain the request config of the operation getNftItemsByAddresses - * - * @param getAccountsRequest a list of account ids (optional) - * @return RequestConfig - */ fun getNftItemsByAddressesRequestConfig(getAccountsRequest: GetAccountsRequest?) : RequestConfig { val localVariableBody = getAccountsRequest val localVariableQuery: MultiValueMap = mutableMapOf() diff --git a/tonapi/src/main/kotlin/io/tonapi/apis/PurchasesApi.kt b/tonapi/src/main/kotlin/io/tonapi/apis/PurchasesApi.kt new file mode 100644 index 000000000..14e004d5a --- /dev/null +++ b/tonapi/src/main/kotlin/io/tonapi/apis/PurchasesApi.kt @@ -0,0 +1,107 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package io.tonapi.apis + +import java.io.IOException +import okhttp3.Call +import okhttp3.HttpUrl + +import io.tonapi.models.AccountPurchases +import io.tonapi.models.InlineObject + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +import io.infrastructure.ApiClient +import io.infrastructure.ApiResponse +import io.infrastructure.ClientException +import io.infrastructure.ClientError +import io.infrastructure.ServerException +import io.infrastructure.ServerError +import io.infrastructure.MultiValueMap +import io.infrastructure.PartConfig +import io.infrastructure.RequestConfig +import io.infrastructure.RequestMethod +import io.infrastructure.ResponseType +import io.infrastructure.Success +import io.infrastructure.toMultiValue + +class PurchasesApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory = ApiClient.defaultClient) : ApiClient(basePath, client) { + companion object { + @JvmStatic + val defaultBasePath: String by lazy { + System.getProperties().getProperty(ApiClient.baseUrlKey, "https://tonapi.io") + } + } + + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun getPurchaseHistory(accountId: kotlin.String, beforeLt: kotlin.Long? = null, limit: kotlin.Int? = 100) : AccountPurchases { + val localVarResponse = getPurchaseHistoryWithHttpInfo(accountId = accountId, beforeLt = beforeLt, limit = limit) + + return when (localVarResponse.responseType) { + ResponseType.Success -> (localVarResponse as Success<*>).data as AccountPurchases + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> { + val localVarError = localVarResponse as ClientError<*> + throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + } + ResponseType.ServerError -> { + val localVarError = localVarResponse as ServerError<*> + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) + } + } + } + + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun getPurchaseHistoryWithHttpInfo(accountId: kotlin.String, beforeLt: kotlin.Long?, limit: kotlin.Int?) : ApiResponse { + val localVariableConfig = getPurchaseHistoryRequestConfig(accountId = accountId, beforeLt = beforeLt, limit = limit) + + return request( + localVariableConfig + ) + } + + fun getPurchaseHistoryRequestConfig(accountId: kotlin.String, beforeLt: kotlin.Long?, limit: kotlin.Int?) : RequestConfig { + val localVariableBody = null + val localVariableQuery: MultiValueMap = mutableMapOf>() + .apply { + if (beforeLt != null) { + put("before_lt", listOf(beforeLt.toString())) + } + if (limit != null) { + put("limit", listOf(limit.toString())) + } + } + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" + + return RequestConfig( + method = RequestMethod.GET, + path = "/v2/purchases/{account_id}/history".replace("{"+"account_id"+"}", encodeURIComponent(accountId.toString())), + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + + + private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String = + HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0] +} diff --git a/tonapi/src/main/kotlin/io/tonapi/apis/RatesApi.kt b/tonapi/src/main/kotlin/io/tonapi/apis/RatesApi.kt index 1fac026ef..b44c69213 100644 --- a/tonapi/src/main/kotlin/io/tonapi/apis/RatesApi.kt +++ b/tonapi/src/main/kotlin/io/tonapi/apis/RatesApi.kt @@ -16,31 +16,32 @@ package io.tonapi.apis import java.io.IOException -import okhttp3.OkHttpClient +import okhttp3.Call import okhttp3.HttpUrl import io.tonapi.models.GetChartRates200Response import io.tonapi.models.GetMarketsRates200Response import io.tonapi.models.GetRates200Response -import io.tonapi.models.StatusDefaultResponse - -import com.squareup.moshi.Json - -import io.tonapi.infrastructure.ApiClient -import io.tonapi.infrastructure.ApiResponse -import io.tonapi.infrastructure.ClientException -import io.tonapi.infrastructure.ClientError -import io.tonapi.infrastructure.ServerException -import io.tonapi.infrastructure.ServerError -import io.tonapi.infrastructure.MultiValueMap -import io.tonapi.infrastructure.PartConfig -import io.tonapi.infrastructure.RequestConfig -import io.tonapi.infrastructure.RequestMethod -import io.tonapi.infrastructure.ResponseType -import io.tonapi.infrastructure.Success -import io.tonapi.infrastructure.toMultiValue - -class RatesApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = ApiClient.defaultClient) : ApiClient(basePath, client) { +import io.tonapi.models.InlineObject + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +import io.infrastructure.ApiClient +import io.infrastructure.ApiResponse +import io.infrastructure.ClientException +import io.infrastructure.ClientError +import io.infrastructure.ServerException +import io.infrastructure.ServerError +import io.infrastructure.MultiValueMap +import io.infrastructure.PartConfig +import io.infrastructure.RequestConfig +import io.infrastructure.RequestMethod +import io.infrastructure.ResponseType +import io.infrastructure.Success +import io.infrastructure.toMultiValue + +class RatesApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory = ApiClient.defaultClient) : ApiClient(basePath, client) { companion object { @JvmStatic val defaultBasePath: String by lazy { @@ -48,21 +49,6 @@ class RatesApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = } } - /** - * - * Get chart by token - * @param token accept jetton master address - * @param currency (optional) - * @param startDate (optional) - * @param endDate (optional) - * @param pointsCount (optional, default to 200) - * @return GetChartRates200Response - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getChartRates(token: kotlin.String, currency: kotlin.String? = null, startDate: kotlin.Long? = null, endDate: kotlin.Long? = null, pointsCount: kotlin.Int? = 200) : GetChartRates200Response { @@ -83,18 +69,6 @@ class RatesApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = } } - /** - * - * Get chart by token - * @param token accept jetton master address - * @param currency (optional) - * @param startDate (optional) - * @param endDate (optional) - * @param pointsCount (optional, default to 200) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getChartRatesWithHttpInfo(token: kotlin.String, currency: kotlin.String?, startDate: kotlin.Long?, endDate: kotlin.Long?, pointsCount: kotlin.Int?) : ApiResponse { @@ -105,16 +79,6 @@ class RatesApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = ) } - /** - * To obtain the request config of the operation getChartRates - * - * @param token accept jetton master address - * @param currency (optional) - * @param startDate (optional) - * @param endDate (optional) - * @param pointsCount (optional, default to 200) - * @return RequestConfig - */ fun getChartRatesRequestConfig(token: kotlin.String, currency: kotlin.String?, startDate: kotlin.Long?, endDate: kotlin.Long?, pointsCount: kotlin.Int?) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf>() @@ -146,16 +110,6 @@ class RatesApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = ) } - /** - * - * Get the TON price from markets - * @return GetMarketsRates200Response - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getMarketsRates() : GetMarketsRates200Response { @@ -176,13 +130,6 @@ class RatesApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = } } - /** - * - * Get the TON price from markets - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getMarketsRatesWithHttpInfo() : ApiResponse { @@ -193,11 +140,6 @@ class RatesApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = ) } - /** - * To obtain the request config of the operation getMarketsRates - * - * @return RequestConfig - */ fun getMarketsRatesRequestConfig() : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() @@ -214,18 +156,6 @@ class RatesApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = ) } - /** - * - * Get the token price to the currency - * @param tokens accept ton and jetton master addresses, separated by commas - * @param currencies accept ton and all possible fiat currencies, separated by commas - * @return GetRates200Response - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getRates(tokens: kotlin.collections.List, currencies: kotlin.collections.List) : GetRates200Response { @@ -246,15 +176,6 @@ class RatesApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = } } - /** - * - * Get the token price to the currency - * @param tokens accept ton and jetton master addresses, separated by commas - * @param currencies accept ton and all possible fiat currencies, separated by commas - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getRatesWithHttpInfo(tokens: kotlin.collections.List, currencies: kotlin.collections.List) : ApiResponse { @@ -265,13 +186,6 @@ class RatesApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = ) } - /** - * To obtain the request config of the operation getRates - * - * @param tokens accept ton and jetton master addresses, separated by commas - * @param currencies accept ton and all possible fiat currencies, separated by commas - * @return RequestConfig - */ fun getRatesRequestConfig(tokens: kotlin.collections.List, currencies: kotlin.collections.List) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf>() diff --git a/tonapi/src/main/kotlin/io/tonapi/apis/StakingApi.kt b/tonapi/src/main/kotlin/io/tonapi/apis/StakingApi.kt index 383e3922a..4ec9ba432 100644 --- a/tonapi/src/main/kotlin/io/tonapi/apis/StakingApi.kt +++ b/tonapi/src/main/kotlin/io/tonapi/apis/StakingApi.kt @@ -16,32 +16,33 @@ package io.tonapi.apis import java.io.IOException -import okhttp3.OkHttpClient +import okhttp3.Call import okhttp3.HttpUrl import io.tonapi.models.AccountStaking import io.tonapi.models.GetStakingPoolHistory200Response import io.tonapi.models.GetStakingPoolInfo200Response import io.tonapi.models.GetStakingPools200Response -import io.tonapi.models.StatusDefaultResponse - -import com.squareup.moshi.Json - -import io.tonapi.infrastructure.ApiClient -import io.tonapi.infrastructure.ApiResponse -import io.tonapi.infrastructure.ClientException -import io.tonapi.infrastructure.ClientError -import io.tonapi.infrastructure.ServerException -import io.tonapi.infrastructure.ServerError -import io.tonapi.infrastructure.MultiValueMap -import io.tonapi.infrastructure.PartConfig -import io.tonapi.infrastructure.RequestConfig -import io.tonapi.infrastructure.RequestMethod -import io.tonapi.infrastructure.ResponseType -import io.tonapi.infrastructure.Success -import io.tonapi.infrastructure.toMultiValue - -class StakingApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = ApiClient.defaultClient) : ApiClient(basePath, client) { +import io.tonapi.models.InlineObject + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +import io.infrastructure.ApiClient +import io.infrastructure.ApiResponse +import io.infrastructure.ClientException +import io.infrastructure.ClientError +import io.infrastructure.ServerException +import io.infrastructure.ServerError +import io.infrastructure.MultiValueMap +import io.infrastructure.PartConfig +import io.infrastructure.RequestConfig +import io.infrastructure.RequestMethod +import io.infrastructure.ResponseType +import io.infrastructure.Success +import io.infrastructure.toMultiValue + +class StakingApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory = ApiClient.defaultClient) : ApiClient(basePath, client) { companion object { @JvmStatic val defaultBasePath: String by lazy { @@ -49,17 +50,6 @@ class StakingApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient } } - /** - * - * All pools where account participates - * @param accountId account ID - * @return AccountStaking - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getAccountNominatorsPools(accountId: kotlin.String) : AccountStaking { @@ -80,14 +70,6 @@ class StakingApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient } } - /** - * - * All pools where account participates - * @param accountId account ID - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getAccountNominatorsPoolsWithHttpInfo(accountId: kotlin.String) : ApiResponse { @@ -98,12 +80,6 @@ class StakingApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient ) } - /** - * To obtain the request config of the operation getAccountNominatorsPools - * - * @param accountId account ID - * @return RequestConfig - */ fun getAccountNominatorsPoolsRequestConfig(accountId: kotlin.String) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() @@ -120,17 +96,6 @@ class StakingApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient ) } - /** - * - * Pool history - * @param accountId account ID - * @return GetStakingPoolHistory200Response - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getStakingPoolHistory(accountId: kotlin.String) : GetStakingPoolHistory200Response { @@ -151,14 +116,6 @@ class StakingApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient } } - /** - * - * Pool history - * @param accountId account ID - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getStakingPoolHistoryWithHttpInfo(accountId: kotlin.String) : ApiResponse { @@ -169,12 +126,6 @@ class StakingApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient ) } - /** - * To obtain the request config of the operation getStakingPoolHistory - * - * @param accountId account ID - * @return RequestConfig - */ fun getStakingPoolHistoryRequestConfig(accountId: kotlin.String) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() @@ -191,18 +142,6 @@ class StakingApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient ) } - /** - * - * Stacking pool info - * @param accountId account ID - * @param acceptLanguage (optional, default to "en") - * @return GetStakingPoolInfo200Response - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getStakingPoolInfo(accountId: kotlin.String, acceptLanguage: kotlin.String? = "en") : GetStakingPoolInfo200Response { @@ -223,15 +162,6 @@ class StakingApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient } } - /** - * - * Stacking pool info - * @param accountId account ID - * @param acceptLanguage (optional, default to "en") - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getStakingPoolInfoWithHttpInfo(accountId: kotlin.String, acceptLanguage: kotlin.String?) : ApiResponse { @@ -242,13 +172,6 @@ class StakingApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient ) } - /** - * To obtain the request config of the operation getStakingPoolInfo - * - * @param accountId account ID - * @param acceptLanguage (optional, default to "en") - * @return RequestConfig - */ fun getStakingPoolInfoRequestConfig(accountId: kotlin.String, acceptLanguage: kotlin.String?) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() @@ -266,19 +189,6 @@ class StakingApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient ) } - /** - * - * All pools available in network - * @param availableFor account ID (optional) - * @param includeUnverified return also pools not from white list - just compatible by interfaces (maybe dangerous!) (optional) - * @param acceptLanguage (optional, default to "en") - * @return GetStakingPools200Response - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getStakingPools(availableFor: kotlin.String? = null, includeUnverified: kotlin.Boolean? = null, acceptLanguage: kotlin.String? = "en") : GetStakingPools200Response { @@ -299,16 +209,6 @@ class StakingApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient } } - /** - * - * All pools available in network - * @param availableFor account ID (optional) - * @param includeUnverified return also pools not from white list - just compatible by interfaces (maybe dangerous!) (optional) - * @param acceptLanguage (optional, default to "en") - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getStakingPoolsWithHttpInfo(availableFor: kotlin.String?, includeUnverified: kotlin.Boolean?, acceptLanguage: kotlin.String?) : ApiResponse { @@ -319,14 +219,6 @@ class StakingApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient ) } - /** - * To obtain the request config of the operation getStakingPools - * - * @param availableFor account ID (optional) - * @param includeUnverified return also pools not from white list - just compatible by interfaces (maybe dangerous!) (optional) - * @param acceptLanguage (optional, default to "en") - * @return RequestConfig - */ fun getStakingPoolsRequestConfig(availableFor: kotlin.String?, includeUnverified: kotlin.Boolean?, acceptLanguage: kotlin.String?) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf>() diff --git a/tonapi/src/main/kotlin/io/tonapi/apis/StorageApi.kt b/tonapi/src/main/kotlin/io/tonapi/apis/StorageApi.kt index 5404bc6a4..40649fa6b 100644 --- a/tonapi/src/main/kotlin/io/tonapi/apis/StorageApi.kt +++ b/tonapi/src/main/kotlin/io/tonapi/apis/StorageApi.kt @@ -16,29 +16,30 @@ package io.tonapi.apis import java.io.IOException -import okhttp3.OkHttpClient +import okhttp3.Call import okhttp3.HttpUrl import io.tonapi.models.GetStorageProviders200Response -import io.tonapi.models.StatusDefaultResponse +import io.tonapi.models.InlineObject -import com.squareup.moshi.Json +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable -import io.tonapi.infrastructure.ApiClient -import io.tonapi.infrastructure.ApiResponse -import io.tonapi.infrastructure.ClientException -import io.tonapi.infrastructure.ClientError -import io.tonapi.infrastructure.ServerException -import io.tonapi.infrastructure.ServerError -import io.tonapi.infrastructure.MultiValueMap -import io.tonapi.infrastructure.PartConfig -import io.tonapi.infrastructure.RequestConfig -import io.tonapi.infrastructure.RequestMethod -import io.tonapi.infrastructure.ResponseType -import io.tonapi.infrastructure.Success -import io.tonapi.infrastructure.toMultiValue +import io.infrastructure.ApiClient +import io.infrastructure.ApiResponse +import io.infrastructure.ClientException +import io.infrastructure.ClientError +import io.infrastructure.ServerException +import io.infrastructure.ServerError +import io.infrastructure.MultiValueMap +import io.infrastructure.PartConfig +import io.infrastructure.RequestConfig +import io.infrastructure.RequestMethod +import io.infrastructure.ResponseType +import io.infrastructure.Success +import io.infrastructure.toMultiValue -class StorageApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = ApiClient.defaultClient) : ApiClient(basePath, client) { +class StorageApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory = ApiClient.defaultClient) : ApiClient(basePath, client) { companion object { @JvmStatic val defaultBasePath: String by lazy { @@ -46,16 +47,6 @@ class StorageApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient } } - /** - * - * Get TON storage providers deployed to the blockchain. - * @return GetStorageProviders200Response - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getStorageProviders() : GetStorageProviders200Response { @@ -76,13 +67,6 @@ class StorageApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient } } - /** - * - * Get TON storage providers deployed to the blockchain. - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getStorageProvidersWithHttpInfo() : ApiResponse { @@ -93,11 +77,6 @@ class StorageApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient ) } - /** - * To obtain the request config of the operation getStorageProviders - * - * @return RequestConfig - */ fun getStorageProvidersRequestConfig() : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() diff --git a/tonapi/src/main/kotlin/io/tonapi/apis/TracesApi.kt b/tonapi/src/main/kotlin/io/tonapi/apis/TracesApi.kt index 07bd9ac61..7f5fd6fe9 100644 --- a/tonapi/src/main/kotlin/io/tonapi/apis/TracesApi.kt +++ b/tonapi/src/main/kotlin/io/tonapi/apis/TracesApi.kt @@ -16,29 +16,31 @@ package io.tonapi.apis import java.io.IOException -import okhttp3.OkHttpClient +import okhttp3.Call import okhttp3.HttpUrl -import io.tonapi.models.StatusDefaultResponse +import io.tonapi.models.GaslessEstimateRequestMessagesInner +import io.tonapi.models.InlineObject import io.tonapi.models.Trace -import com.squareup.moshi.Json - -import io.tonapi.infrastructure.ApiClient -import io.tonapi.infrastructure.ApiResponse -import io.tonapi.infrastructure.ClientException -import io.tonapi.infrastructure.ClientError -import io.tonapi.infrastructure.ServerException -import io.tonapi.infrastructure.ServerError -import io.tonapi.infrastructure.MultiValueMap -import io.tonapi.infrastructure.PartConfig -import io.tonapi.infrastructure.RequestConfig -import io.tonapi.infrastructure.RequestMethod -import io.tonapi.infrastructure.ResponseType -import io.tonapi.infrastructure.Success -import io.tonapi.infrastructure.toMultiValue - -class TracesApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = ApiClient.defaultClient) : ApiClient(basePath, client) { +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +import io.infrastructure.ApiClient +import io.infrastructure.ApiResponse +import io.infrastructure.ClientException +import io.infrastructure.ClientError +import io.infrastructure.ServerException +import io.infrastructure.ServerError +import io.infrastructure.MultiValueMap +import io.infrastructure.PartConfig +import io.infrastructure.RequestConfig +import io.infrastructure.RequestMethod +import io.infrastructure.ResponseType +import io.infrastructure.Success +import io.infrastructure.toMultiValue + +class TracesApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory = ApiClient.defaultClient) : ApiClient(basePath, client) { companion object { @JvmStatic val defaultBasePath: String by lazy { @@ -46,17 +48,58 @@ class TracesApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient } } - /** - * - * Get the trace by trace ID or hash of any transaction in trace - * @param traceId trace ID or transaction hash in hex (without 0x) or base64url format - * @return Trace - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun emulateMessageToTrace(gaslessEstimateRequestMessagesInner: GaslessEstimateRequestMessagesInner, ignoreSignatureCheck: kotlin.Boolean? = null) : Trace { + val localVarResponse = emulateMessageToTraceWithHttpInfo(gaslessEstimateRequestMessagesInner = gaslessEstimateRequestMessagesInner, ignoreSignatureCheck = ignoreSignatureCheck) + + return when (localVarResponse.responseType) { + ResponseType.Success -> (localVarResponse as Success<*>).data as Trace + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> { + val localVarError = localVarResponse as ClientError<*> + throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + } + ResponseType.ServerError -> { + val localVarError = localVarResponse as ServerError<*> + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) + } + } + } + + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun emulateMessageToTraceWithHttpInfo(gaslessEstimateRequestMessagesInner: GaslessEstimateRequestMessagesInner, ignoreSignatureCheck: kotlin.Boolean?) : ApiResponse { + val localVariableConfig = emulateMessageToTraceRequestConfig(gaslessEstimateRequestMessagesInner = gaslessEstimateRequestMessagesInner, ignoreSignatureCheck = ignoreSignatureCheck) + + return request( + localVariableConfig + ) + } + + fun emulateMessageToTraceRequestConfig(gaslessEstimateRequestMessagesInner: GaslessEstimateRequestMessagesInner, ignoreSignatureCheck: kotlin.Boolean?) : RequestConfig { + val localVariableBody = gaslessEstimateRequestMessagesInner + val localVariableQuery: MultiValueMap = mutableMapOf>() + .apply { + if (ignoreSignatureCheck != null) { + put("ignore_signature_check", listOf(ignoreSignatureCheck.toString())) + } + } + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "application/json" + + return RequestConfig( + method = RequestMethod.POST, + path = "/v2/traces/emulate", + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getTrace(traceId: kotlin.String) : Trace { @@ -77,14 +120,6 @@ class TracesApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient } } - /** - * - * Get the trace by trace ID or hash of any transaction in trace - * @param traceId trace ID or transaction hash in hex (without 0x) or base64url format - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getTraceWithHttpInfo(traceId: kotlin.String) : ApiResponse { @@ -95,12 +130,6 @@ class TracesApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient ) } - /** - * To obtain the request config of the operation getTrace - * - * @param traceId trace ID or transaction hash in hex (without 0x) or base64url format - * @return RequestConfig - */ fun getTraceRequestConfig(traceId: kotlin.String) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() diff --git a/tonapi/src/main/kotlin/io/tonapi/apis/UtilitiesApi.kt b/tonapi/src/main/kotlin/io/tonapi/apis/UtilitiesApi.kt index 15d72ee9f..3ce508dba 100644 --- a/tonapi/src/main/kotlin/io/tonapi/apis/UtilitiesApi.kt +++ b/tonapi/src/main/kotlin/io/tonapi/apis/UtilitiesApi.kt @@ -16,30 +16,31 @@ package io.tonapi.apis import java.io.IOException -import okhttp3.OkHttpClient +import okhttp3.Call import okhttp3.HttpUrl import io.tonapi.models.AddressParse200Response +import io.tonapi.models.InlineObject import io.tonapi.models.ServiceStatus -import io.tonapi.models.StatusDefaultResponse - -import com.squareup.moshi.Json - -import io.tonapi.infrastructure.ApiClient -import io.tonapi.infrastructure.ApiResponse -import io.tonapi.infrastructure.ClientException -import io.tonapi.infrastructure.ClientError -import io.tonapi.infrastructure.ServerException -import io.tonapi.infrastructure.ServerError -import io.tonapi.infrastructure.MultiValueMap -import io.tonapi.infrastructure.PartConfig -import io.tonapi.infrastructure.RequestConfig -import io.tonapi.infrastructure.RequestMethod -import io.tonapi.infrastructure.ResponseType -import io.tonapi.infrastructure.Success -import io.tonapi.infrastructure.toMultiValue - -class UtilitiesApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = ApiClient.defaultClient) : ApiClient(basePath, client) { + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +import io.infrastructure.ApiClient +import io.infrastructure.ApiResponse +import io.infrastructure.ClientException +import io.infrastructure.ClientError +import io.infrastructure.ServerException +import io.infrastructure.ServerError +import io.infrastructure.MultiValueMap +import io.infrastructure.PartConfig +import io.infrastructure.RequestConfig +import io.infrastructure.RequestMethod +import io.infrastructure.ResponseType +import io.infrastructure.Success +import io.infrastructure.toMultiValue + +class UtilitiesApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory = ApiClient.defaultClient) : ApiClient(basePath, client) { companion object { @JvmStatic val defaultBasePath: String by lazy { @@ -47,17 +48,6 @@ class UtilitiesApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClie } } - /** - * - * parse address and display in all formats - * @param accountId account ID - * @return AddressParse200Response - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun addressParse(accountId: kotlin.String) : AddressParse200Response { @@ -78,14 +68,6 @@ class UtilitiesApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClie } } - /** - * - * parse address and display in all formats - * @param accountId account ID - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun addressParseWithHttpInfo(accountId: kotlin.String) : ApiResponse { @@ -96,12 +78,6 @@ class UtilitiesApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClie ) } - /** - * To obtain the request config of the operation addressParse - * - * @param accountId account ID - * @return RequestConfig - */ fun addressParseRequestConfig(accountId: kotlin.String) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() @@ -118,16 +94,98 @@ class UtilitiesApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClie ) } - /** - * - * Status - * @return ServiceStatus - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun getOpenapiJson() : kotlin.Any { + val localVarResponse = getOpenapiJsonWithHttpInfo() + + return when (localVarResponse.responseType) { + ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.Any + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> { + val localVarError = localVarResponse as ClientError<*> + throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + } + ResponseType.ServerError -> { + val localVarError = localVarResponse as ServerError<*> + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) + } + } + } + + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun getOpenapiJsonWithHttpInfo() : ApiResponse { + val localVariableConfig = getOpenapiJsonRequestConfig() + + return request( + localVariableConfig + ) + } + + fun getOpenapiJsonRequestConfig() : RequestConfig { + val localVariableBody = null + val localVariableQuery: MultiValueMap = mutableMapOf() + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" + + return RequestConfig( + method = RequestMethod.GET, + path = "/v2/openapi.json", + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun getOpenapiYml() : java.io.File { + val localVarResponse = getOpenapiYmlWithHttpInfo() + + return when (localVarResponse.responseType) { + ResponseType.Success -> (localVarResponse as Success<*>).data as java.io.File + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> { + val localVarError = localVarResponse as ClientError<*> + throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + } + ResponseType.ServerError -> { + val localVarError = localVarResponse as ServerError<*> + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) + } + } + } + + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun getOpenapiYmlWithHttpInfo() : ApiResponse { + val localVariableConfig = getOpenapiYmlRequestConfig() + + return request( + localVariableConfig + ) + } + + fun getOpenapiYmlRequestConfig() : RequestConfig { + val localVariableBody = null + val localVariableQuery: MultiValueMap = mutableMapOf() + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" + + return RequestConfig( + method = RequestMethod.GET, + path = "/v2/openapi.yml", + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun status() : ServiceStatus { @@ -148,13 +206,6 @@ class UtilitiesApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClie } } - /** - * - * Status - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun statusWithHttpInfo() : ApiResponse { @@ -165,11 +216,6 @@ class UtilitiesApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClie ) } - /** - * To obtain the request config of the operation status - * - * @return RequestConfig - */ fun statusRequestConfig() : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() diff --git a/tonapi/src/main/kotlin/io/tonapi/apis/WalletApi.kt b/tonapi/src/main/kotlin/io/tonapi/apis/WalletApi.kt index 155e2c22b..f158ab997 100644 --- a/tonapi/src/main/kotlin/io/tonapi/apis/WalletApi.kt +++ b/tonapi/src/main/kotlin/io/tonapi/apis/WalletApi.kt @@ -16,33 +16,36 @@ package io.tonapi.apis import java.io.IOException -import okhttp3.OkHttpClient +import okhttp3.Call import okhttp3.HttpUrl -import io.tonapi.models.Accounts -import io.tonapi.models.GetWalletBackup200Response +import io.tonapi.models.EmulateMessageToWalletRequest +import io.tonapi.models.InlineObject +import io.tonapi.models.MessageConsequences import io.tonapi.models.Seqno -import io.tonapi.models.StatusDefaultResponse import io.tonapi.models.TonConnectProof200Response import io.tonapi.models.TonConnectProofRequest - -import com.squareup.moshi.Json - -import io.tonapi.infrastructure.ApiClient -import io.tonapi.infrastructure.ApiResponse -import io.tonapi.infrastructure.ClientException -import io.tonapi.infrastructure.ClientError -import io.tonapi.infrastructure.ServerException -import io.tonapi.infrastructure.ServerError -import io.tonapi.infrastructure.MultiValueMap -import io.tonapi.infrastructure.PartConfig -import io.tonapi.infrastructure.RequestConfig -import io.tonapi.infrastructure.RequestMethod -import io.tonapi.infrastructure.ResponseType -import io.tonapi.infrastructure.Success -import io.tonapi.infrastructure.toMultiValue - -class WalletApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = ApiClient.defaultClient) : ApiClient(basePath, client) { +import io.tonapi.models.Wallet +import io.tonapi.models.Wallets + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +import io.infrastructure.ApiClient +import io.infrastructure.ApiResponse +import io.infrastructure.ClientException +import io.infrastructure.ClientError +import io.infrastructure.ServerException +import io.infrastructure.ServerError +import io.infrastructure.MultiValueMap +import io.infrastructure.PartConfig +import io.infrastructure.RequestConfig +import io.infrastructure.RequestMethod +import io.infrastructure.ResponseType +import io.infrastructure.Success +import io.infrastructure.toMultiValue + +class WalletApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory = ApiClient.defaultClient) : ApiClient(basePath, client) { companion object { @JvmStatic val defaultBasePath: String by lazy { @@ -50,24 +53,13 @@ class WalletApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient } } - /** - * - * Get account seqno - * @param accountId account ID - * @return Seqno - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getAccountSeqno(accountId: kotlin.String) : Seqno { - val localVarResponse = getAccountSeqnoWithHttpInfo(accountId = accountId) + fun emulateMessageToWallet(emulateMessageToWalletRequest: EmulateMessageToWalletRequest, acceptLanguage: kotlin.String? = "en") : MessageConsequences { + val localVarResponse = emulateMessageToWalletWithHttpInfo(emulateMessageToWalletRequest = emulateMessageToWalletRequest, acceptLanguage = acceptLanguage) return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Seqno + ResponseType.Success -> (localVarResponse as Success<*>).data as MessageConsequences ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") ResponseType.ClientError -> { @@ -81,39 +73,27 @@ class WalletApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient } } - /** - * - * Get account seqno - * @param accountId account ID - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun getAccountSeqnoWithHttpInfo(accountId: kotlin.String) : ApiResponse { - val localVariableConfig = getAccountSeqnoRequestConfig(accountId = accountId) + fun emulateMessageToWalletWithHttpInfo(emulateMessageToWalletRequest: EmulateMessageToWalletRequest, acceptLanguage: kotlin.String?) : ApiResponse { + val localVariableConfig = emulateMessageToWalletRequestConfig(emulateMessageToWalletRequest = emulateMessageToWalletRequest, acceptLanguage = acceptLanguage) - return request( + return request( localVariableConfig ) } - /** - * To obtain the request config of the operation getAccountSeqno - * - * @param accountId account ID - * @return RequestConfig - */ - fun getAccountSeqnoRequestConfig(accountId: kotlin.String) : RequestConfig { - val localVariableBody = null + fun emulateMessageToWalletRequestConfig(emulateMessageToWalletRequest: EmulateMessageToWalletRequest, acceptLanguage: kotlin.String?) : RequestConfig { + val localVariableBody = emulateMessageToWalletRequest val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + acceptLanguage?.apply { localVariableHeaders["Accept-Language"] = this.toString() } + localVariableHeaders["Content-Type"] = "application/json" localVariableHeaders["Accept"] = "application/json" return RequestConfig( - method = RequestMethod.GET, - path = "/v2/wallet/{account_id}/seqno".replace("{"+"account_id"+"}", encodeURIComponent(accountId.toString())), + method = RequestMethod.POST, + path = "/v2/wallet/emulate", query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -121,24 +101,13 @@ class WalletApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient ) } - /** - * - * Get backup info - * @param xTonConnectAuth - * @return GetWalletBackup200Response - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getWalletBackup(xTonConnectAuth: kotlin.String) : GetWalletBackup200Response { - val localVarResponse = getWalletBackupWithHttpInfo(xTonConnectAuth = xTonConnectAuth) + fun getAccountSeqno(accountId: kotlin.String) : Seqno { + val localVarResponse = getAccountSeqnoWithHttpInfo(accountId = accountId) return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as GetWalletBackup200Response + ResponseType.Success -> (localVarResponse as Success<*>).data as Seqno ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") ResponseType.ClientError -> { @@ -152,40 +121,25 @@ class WalletApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient } } - /** - * - * Get backup info - * @param xTonConnectAuth - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun getWalletBackupWithHttpInfo(xTonConnectAuth: kotlin.String) : ApiResponse { - val localVariableConfig = getWalletBackupRequestConfig(xTonConnectAuth = xTonConnectAuth) + fun getAccountSeqnoWithHttpInfo(accountId: kotlin.String) : ApiResponse { + val localVariableConfig = getAccountSeqnoRequestConfig(accountId = accountId) - return request( + return request( localVariableConfig ) } - /** - * To obtain the request config of the operation getWalletBackup - * - * @param xTonConnectAuth - * @return RequestConfig - */ - fun getWalletBackupRequestConfig(xTonConnectAuth: kotlin.String) : RequestConfig { + fun getAccountSeqnoRequestConfig(accountId: kotlin.String) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - xTonConnectAuth.apply { localVariableHeaders["X-TonConnect-Auth"] = this.toString() } localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, - path = "/v2/wallet/backup", + path = "/v2/wallet/{account_id}/seqno".replace("{"+"account_id"+"}", encodeURIComponent(accountId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -193,24 +147,13 @@ class WalletApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient ) } - /** - * - * Get wallets by public key - * @param publicKey - * @return Accounts - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getWalletsByPublicKey(publicKey: kotlin.String) : Accounts { - val localVarResponse = getWalletsByPublicKeyWithHttpInfo(publicKey = publicKey) + fun getWalletInfo(accountId: kotlin.String) : Wallet { + val localVarResponse = getWalletInfoWithHttpInfo(accountId = accountId) return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Accounts + ResponseType.Success -> (localVarResponse as Success<*>).data as Wallet ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") ResponseType.ClientError -> { @@ -224,31 +167,17 @@ class WalletApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient } } - /** - * - * Get wallets by public key - * @param publicKey - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun getWalletsByPublicKeyWithHttpInfo(publicKey: kotlin.String) : ApiResponse { - val localVariableConfig = getWalletsByPublicKeyRequestConfig(publicKey = publicKey) + fun getWalletInfoWithHttpInfo(accountId: kotlin.String) : ApiResponse { + val localVariableConfig = getWalletInfoRequestConfig(accountId = accountId) - return request( + return request( localVariableConfig ) } - /** - * To obtain the request config of the operation getWalletsByPublicKey - * - * @param publicKey - * @return RequestConfig - */ - fun getWalletsByPublicKeyRequestConfig(publicKey: kotlin.String) : RequestConfig { + fun getWalletInfoRequestConfig(accountId: kotlin.String) : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() @@ -256,7 +185,7 @@ class WalletApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient return RequestConfig( method = RequestMethod.GET, - path = "/v2/pubkeys/{public_key}/wallets".replace("{"+"public_key"+"}", encodeURIComponent(publicKey.toString())), + path = "/v2/wallet/{account_id}".replace("{"+"account_id"+"}", encodeURIComponent(accountId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -264,24 +193,13 @@ class WalletApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient ) } - /** - * - * Set backup info - * @param xTonConnectAuth - * @param body Information for saving backup - * @return void - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun setWalletBackup(xTonConnectAuth: kotlin.String, body: java.io.File) : Unit { - val localVarResponse = setWalletBackupWithHttpInfo(xTonConnectAuth = xTonConnectAuth, body = body) + fun getWalletsByPublicKey(publicKey: kotlin.String) : Wallets { + val localVarResponse = getWalletsByPublicKeyWithHttpInfo(publicKey = publicKey) return when (localVarResponse.responseType) { - ResponseType.Success -> Unit + ResponseType.Success -> (localVarResponse as Success<*>).data as Wallets ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") ResponseType.ClientError -> { @@ -295,42 +213,25 @@ class WalletApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient } } - /** - * - * Set backup info - * @param xTonConnectAuth - * @param body Information for saving backup - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ + @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun setWalletBackupWithHttpInfo(xTonConnectAuth: kotlin.String, body: java.io.File) : ApiResponse { - val localVariableConfig = setWalletBackupRequestConfig(xTonConnectAuth = xTonConnectAuth, body = body) + fun getWalletsByPublicKeyWithHttpInfo(publicKey: kotlin.String) : ApiResponse { + val localVariableConfig = getWalletsByPublicKeyRequestConfig(publicKey = publicKey) - return request( + return request( localVariableConfig ) } - /** - * To obtain the request config of the operation setWalletBackup - * - * @param xTonConnectAuth - * @param body Information for saving backup - * @return RequestConfig - */ - fun setWalletBackupRequestConfig(xTonConnectAuth: kotlin.String, body: java.io.File) : RequestConfig { - val localVariableBody = body + fun getWalletsByPublicKeyRequestConfig(publicKey: kotlin.String) : RequestConfig { + val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - xTonConnectAuth.apply { localVariableHeaders["X-TonConnect-Auth"] = this.toString() } - localVariableHeaders["Content-Type"] = "application/octet-stream" localVariableHeaders["Accept"] = "application/json" return RequestConfig( - method = RequestMethod.PUT, - path = "/v2/wallet/backup", + method = RequestMethod.GET, + path = "/v2/pubkeys/{public_key}/wallets".replace("{"+"public_key"+"}", encodeURIComponent(publicKey.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -338,17 +239,6 @@ class WalletApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient ) } - /** - * - * Account verification and token issuance - * @param tonConnectProofRequest Data that is expected from TON Connect - * @return TonConnectProof200Response - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun tonConnectProof(tonConnectProofRequest: TonConnectProofRequest) : TonConnectProof200Response { @@ -369,14 +259,6 @@ class WalletApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient } } - /** - * - * Account verification and token issuance - * @param tonConnectProofRequest Data that is expected from TON Connect - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun tonConnectProofWithHttpInfo(tonConnectProofRequest: TonConnectProofRequest) : ApiResponse { @@ -387,12 +269,6 @@ class WalletApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient ) } - /** - * To obtain the request config of the operation tonConnectProof - * - * @param tonConnectProofRequest Data that is expected from TON Connect - * @return RequestConfig - */ fun tonConnectProofRequestConfig(tonConnectProofRequest: TonConnectProofRequest) : RequestConfig { val localVariableBody = tonConnectProofRequest val localVariableQuery: MultiValueMap = mutableMapOf() diff --git a/tonapi/src/main/kotlin/io/tonapi/infrastructure/ApiAbstractions.kt b/tonapi/src/main/kotlin/io/tonapi/infrastructure/ApiAbstractions.kt deleted file mode 100644 index ca9d5b047..000000000 --- a/tonapi/src/main/kotlin/io/tonapi/infrastructure/ApiAbstractions.kt +++ /dev/null @@ -1,23 +0,0 @@ -package io.tonapi.infrastructure - -typealias MultiValueMap = MutableMap> - -fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { - "csv" -> "," - "tsv" -> "\t" - "pipe" -> "|" - "space" -> " " - else -> "" -} - -val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } - -fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) - = toMultiValue(items.asIterable(), collectionFormat, map) - -fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { - return when(collectionFormat) { - "multi" -> items.map(map) - else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map)) - } -} diff --git a/tonapi/src/main/kotlin/io/tonapi/infrastructure/ApiClient.kt b/tonapi/src/main/kotlin/io/tonapi/infrastructure/ApiClient.kt deleted file mode 100644 index f441883c9..000000000 --- a/tonapi/src/main/kotlin/io/tonapi/infrastructure/ApiClient.kt +++ /dev/null @@ -1,252 +0,0 @@ -package io.tonapi.infrastructure - -import android.util.Log -import okhttp3.OkHttpClient -import okhttp3.RequestBody -import okhttp3.RequestBody.Companion.asRequestBody -import okhttp3.RequestBody.Companion.toRequestBody -import okhttp3.FormBody -import okhttp3.HttpUrl.Companion.toHttpUrlOrNull -import okhttp3.ResponseBody -import okhttp3.MediaType.Companion.toMediaTypeOrNull -import okhttp3.Request -import okhttp3.Headers -import okhttp3.Headers.Companion.toHeaders -import okhttp3.MultipartBody -import okhttp3.Call -import okhttp3.Callback -import okhttp3.Response -import okhttp3.internal.EMPTY_REQUEST -import java.io.BufferedWriter -import java.io.File -import java.io.FileWriter -import java.io.IOException -import java.net.URLConnection -import java.time.LocalDate -import java.time.LocalDateTime -import java.time.LocalTime -import java.time.OffsetDateTime -import java.time.OffsetTime -import java.util.Locale -import com.squareup.moshi.adapter - -open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClient) { - companion object { - protected const val ContentType = "Content-Type" - protected const val Accept = "Accept" - protected const val Authorization = "Authorization" - protected const val JsonMediaType = "application/json" - protected const val FormDataMediaType = "multipart/form-data" - protected const val FormUrlEncMediaType = "application/x-www-form-urlencoded" - protected const val XmlMediaType = "application/xml" - protected const val OctetMediaType = "application/octet-stream" - - val apiKey: MutableMap = mutableMapOf() - val apiKeyPrefix: MutableMap = mutableMapOf() - var username: String? = null - var password: String? = null - var accessToken: String? = null - const val baseUrlKey = "io.tonapi.baseUrl" - - @JvmStatic - val defaultClient: OkHttpClient by lazy { - builder.build() - } - - @JvmStatic - val builder: OkHttpClient.Builder = OkHttpClient.Builder() - } - - /** - * Guess Content-Type header from the given file (defaults to "application/octet-stream"). - * - * @param file The given file - * @return The guessed Content-Type - */ - protected fun guessContentTypeFromFile(file: File): String { - val contentType = URLConnection.guessContentTypeFromName(file.name) - return contentType ?: "application/octet-stream" - } - - protected inline fun requestBody(content: T, mediaType: String?): RequestBody = - when { - content is File -> content.asRequestBody((mediaType ?: guessContentTypeFromFile(content)).toMediaTypeOrNull()) - mediaType == FormDataMediaType -> - MultipartBody.Builder() - .setType(MultipartBody.FORM) - .apply { - // content's type *must* be Map> - @Suppress("UNCHECKED_CAST") - (content as Map>).forEach { (name, part) -> - if (part.body is File) { - val partHeaders = part.headers.toMutableMap() + - ("Content-Disposition" to "form-data; name=\"$name\"; filename=\"${part.body.name}\"") - val fileMediaType = guessContentTypeFromFile(part.body).toMediaTypeOrNull() - addPart( - partHeaders.toHeaders(), - part.body.asRequestBody(fileMediaType) - ) - } else { - val partHeaders = part.headers.toMutableMap() + - ("Content-Disposition" to "form-data; name=\"$name\"") - addPart( - partHeaders.toHeaders(), - parameterToString(part.body).toRequestBody(null) - ) - } - } - }.build() - mediaType == FormUrlEncMediaType -> { - FormBody.Builder().apply { - // content's type *must* be Map> - @Suppress("UNCHECKED_CAST") - (content as Map>).forEach { (name, part) -> - add(name, parameterToString(part.body)) - } - }.build() - } - mediaType == null || mediaType.startsWith("application/") && mediaType.endsWith("json") -> - if (content == null) { - EMPTY_REQUEST - } else { - Serializer.moshi.adapter(T::class.java).toJson(content) - .toRequestBody((mediaType ?: JsonMediaType).toMediaTypeOrNull()) - } - mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") - mediaType == OctetMediaType && content is ByteArray -> - content.toRequestBody(OctetMediaType.toMediaTypeOrNull()) - // TODO: this should be extended with other serializers - else -> throw UnsupportedOperationException("requestBody currently only supports JSON body, byte body and File body.") - } - - @OptIn(ExperimentalStdlibApi::class) - protected inline fun responseBody(body: ResponseBody?, mediaType: String? = JsonMediaType): T? { - if(body == null) { - return null - } - if (T::class.java == File::class.java) { - // return tempFile - // Attention: if you are developing an android app that supports API Level 25 and bellow, please check flag supportAndroidApiLevel25AndBelow in https://openapi-generator.tech/docs/generators/kotlin#config-options - val tempFile = java.nio.file.Files.createTempFile("tmp.io.tonapi", null).toFile() - tempFile.deleteOnExit() - body.byteStream().use { inputStream -> - tempFile.outputStream().use { tempFileOutputStream -> - inputStream.copyTo(tempFileOutputStream) - } - } - return tempFile as T - } - - return when { - mediaType == null || (mediaType.startsWith("application/") && mediaType.endsWith("json")) -> { - val bodyContent = body.string() - if (bodyContent.isEmpty()) { - return null - } - Serializer.moshi.adapter().fromJson(bodyContent) - } - mediaType == OctetMediaType -> body.bytes() as? T - else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") - } - } - - - protected inline fun request(requestConfig: RequestConfig): ApiResponse { - val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") - - val url = httpUrl.newBuilder() - .addEncodedPathSegments(requestConfig.path.trimStart('/')) - .apply { - requestConfig.query.forEach { query -> - query.value.forEach { queryValue -> - addQueryParameter(query.key, queryValue) - } - } - }.build() - - // take content-type/accept from spec or set to default (application/json) if not defined - if (requestConfig.body != null && requestConfig.headers[ContentType].isNullOrEmpty()) { - requestConfig.headers[ContentType] = JsonMediaType - } - if (requestConfig.headers[Accept].isNullOrEmpty()) { - requestConfig.headers[Accept] = JsonMediaType - } - val headers = requestConfig.headers - - if (headers[Accept].isNullOrEmpty()) { - throw kotlin.IllegalStateException("Missing Accept header. This is required.") - } - - val contentType = if (headers[ContentType] != null) { - // TODO: support multiple contentType options here. - (headers[ContentType] as String).substringBefore(";").lowercase(Locale.US) - } else { - null - } - - val request = when (requestConfig.method) { - RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType)) - RequestMethod.GET -> Request.Builder().url(url) - RequestMethod.HEAD -> Request.Builder().url(url).head() - RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(requestConfig.body, contentType)) - RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(requestConfig.body, contentType)) - RequestMethod.POST -> Request.Builder().url(url).post(requestBody(requestConfig.body, contentType)) - RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null) - }.apply { - headers.forEach { header -> addHeader(header.key, header.value) } - }.build() - - val response = client.newCall(request).execute() - - val accept = response.header(ContentType)?.substringBefore(";")?.lowercase(Locale.US) - - // TODO: handle specific mapping types. e.g. Map> - return when { - response.isRedirect -> Redirection( - response.code, - response.headers.toMultimap() - ) - response.isInformational -> Informational( - response.message, - response.code, - response.headers.toMultimap() - ) - response.isSuccessful -> Success( - responseBody(response.body, accept), - response.code, - response.headers.toMultimap() - ) - response.isClientError -> ClientError( - response.message, - response.body?.string(), - response.code, - response.headers.toMultimap() - ) - else -> ServerError( - response.message, - response.body?.string(), - response.code, - response.headers.toMultimap() - ) - } - } - - protected fun parameterToString(value: Any?): String = when (value) { - null -> "" - is Array<*> -> toMultiValue(value, "csv").toString() - is Iterable<*> -> toMultiValue(value, "csv").toString() - is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime -> - parseDateToQueryString(value) - else -> value.toString() - } - - protected inline fun parseDateToQueryString(value : T): String { - /* - .replace("\"", "") converts the json object string to an actual string for the query parameter. - The moshi or gson adapter allows a more generic solution instead of trying to use a native - formatter. It also easily allows to provide a simple way to define a custom date format pattern - inside a gson/moshi adapter. - */ - return Serializer.moshi.adapter(T::class.java).toJson(value).replace("\"", "") - } -} diff --git a/tonapi/src/main/kotlin/io/tonapi/infrastructure/ApiResponse.kt b/tonapi/src/main/kotlin/io/tonapi/infrastructure/ApiResponse.kt deleted file mode 100644 index 0e202ffea..000000000 --- a/tonapi/src/main/kotlin/io/tonapi/infrastructure/ApiResponse.kt +++ /dev/null @@ -1,43 +0,0 @@ -package io.tonapi.infrastructure - -enum class ResponseType { - Success, Informational, Redirection, ClientError, ServerError -} - -interface Response - -abstract class ApiResponse(val responseType: ResponseType): Response { - abstract val statusCode: Int - abstract val headers: Map> -} - -class Success( - val data: T, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -): ApiResponse(ResponseType.Success) - -class Informational( - val statusText: String, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiResponse(ResponseType.Informational) - -class Redirection( - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiResponse(ResponseType.Redirection) - -class ClientError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiResponse(ResponseType.ClientError) - -class ServerError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> -): ApiResponse(ResponseType.ServerError) diff --git a/tonapi/src/main/kotlin/io/tonapi/infrastructure/BigDecimalAdapter.kt b/tonapi/src/main/kotlin/io/tonapi/infrastructure/BigDecimalAdapter.kt deleted file mode 100644 index 4246e0317..000000000 --- a/tonapi/src/main/kotlin/io/tonapi/infrastructure/BigDecimalAdapter.kt +++ /dev/null @@ -1,17 +0,0 @@ -package io.tonapi.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.math.BigDecimal - -class BigDecimalAdapter { - @ToJson - fun toJson(value: BigDecimal): String { - return value.toPlainString() - } - - @FromJson - fun fromJson(value: String): BigDecimal { - return BigDecimal(value) - } -} diff --git a/tonapi/src/main/kotlin/io/tonapi/infrastructure/BigIntegerAdapter.kt b/tonapi/src/main/kotlin/io/tonapi/infrastructure/BigIntegerAdapter.kt deleted file mode 100644 index 040d9346b..000000000 --- a/tonapi/src/main/kotlin/io/tonapi/infrastructure/BigIntegerAdapter.kt +++ /dev/null @@ -1,17 +0,0 @@ -package io.tonapi.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.math.BigInteger - -class BigIntegerAdapter { - @ToJson - fun toJson(value: BigInteger): String { - return value.toString() - } - - @FromJson - fun fromJson(value: String): BigInteger { - return BigInteger(value) - } -} diff --git a/tonapi/src/main/kotlin/io/tonapi/infrastructure/ByteArrayAdapter.kt b/tonapi/src/main/kotlin/io/tonapi/infrastructure/ByteArrayAdapter.kt deleted file mode 100644 index f49620dc4..000000000 --- a/tonapi/src/main/kotlin/io/tonapi/infrastructure/ByteArrayAdapter.kt +++ /dev/null @@ -1,12 +0,0 @@ -package io.tonapi.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson - -class ByteArrayAdapter { - @ToJson - fun toJson(data: ByteArray): String = String(data) - - @FromJson - fun fromJson(data: String): ByteArray = data.toByteArray() -} diff --git a/tonapi/src/main/kotlin/io/tonapi/infrastructure/LocalDateAdapter.kt b/tonapi/src/main/kotlin/io/tonapi/infrastructure/LocalDateAdapter.kt deleted file mode 100644 index 60d7a627e..000000000 --- a/tonapi/src/main/kotlin/io/tonapi/infrastructure/LocalDateAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package io.tonapi.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.LocalDate -import java.time.format.DateTimeFormatter - -class LocalDateAdapter { - @ToJson - fun toJson(value: LocalDate): String { - return DateTimeFormatter.ISO_LOCAL_DATE.format(value) - } - - @FromJson - fun fromJson(value: String): LocalDate { - return LocalDate.parse(value, DateTimeFormatter.ISO_LOCAL_DATE) - } - -} diff --git a/tonapi/src/main/kotlin/io/tonapi/infrastructure/LocalDateTimeAdapter.kt b/tonapi/src/main/kotlin/io/tonapi/infrastructure/LocalDateTimeAdapter.kt deleted file mode 100644 index b4ba2f36b..000000000 --- a/tonapi/src/main/kotlin/io/tonapi/infrastructure/LocalDateTimeAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package io.tonapi.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.LocalDateTime -import java.time.format.DateTimeFormatter - -class LocalDateTimeAdapter { - @ToJson - fun toJson(value: LocalDateTime): String { - return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(value) - } - - @FromJson - fun fromJson(value: String): LocalDateTime { - return LocalDateTime.parse(value, DateTimeFormatter.ISO_LOCAL_DATE_TIME) - } - -} diff --git a/tonapi/src/main/kotlin/io/tonapi/infrastructure/OffsetDateTimeAdapter.kt b/tonapi/src/main/kotlin/io/tonapi/infrastructure/OffsetDateTimeAdapter.kt deleted file mode 100644 index 39e12c265..000000000 --- a/tonapi/src/main/kotlin/io/tonapi/infrastructure/OffsetDateTimeAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package io.tonapi.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter - -class OffsetDateTimeAdapter { - @ToJson - fun toJson(value: OffsetDateTime): String { - return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value) - } - - @FromJson - fun fromJson(value: String): OffsetDateTime { - return OffsetDateTime.parse(value, DateTimeFormatter.ISO_OFFSET_DATE_TIME) - } - -} diff --git a/tonapi/src/main/kotlin/io/tonapi/infrastructure/RequestConfig.kt b/tonapi/src/main/kotlin/io/tonapi/infrastructure/RequestConfig.kt deleted file mode 100644 index d9a02f95e..000000000 --- a/tonapi/src/main/kotlin/io/tonapi/infrastructure/RequestConfig.kt +++ /dev/null @@ -1,18 +0,0 @@ -package io.tonapi.infrastructure - -/** - * Defines a config object for a given request. - * NOTE: This object doesn't include 'body' because it - * allows for caching of the constructed object - * for many request definitions. - * NOTE: Headers is a Map because rfc2616 defines - * multi-valued headers as csv-only. - */ -data class RequestConfig( - val method: RequestMethod, - val path: String, - val headers: MutableMap = mutableMapOf(), - val query: MutableMap> = mutableMapOf(), - val requiresAuthentication: Boolean, - val body: T? = null -) diff --git a/tonapi/src/main/kotlin/io/tonapi/infrastructure/Serializer.kt b/tonapi/src/main/kotlin/io/tonapi/infrastructure/Serializer.kt deleted file mode 100644 index fe632ebb2..000000000 --- a/tonapi/src/main/kotlin/io/tonapi/infrastructure/Serializer.kt +++ /dev/null @@ -1,23 +0,0 @@ -package io.tonapi.infrastructure - -import com.squareup.moshi.Moshi -import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory - -object Serializer { - @JvmStatic - val moshiBuilder: Moshi.Builder = Moshi.Builder() - .add(OffsetDateTimeAdapter()) - .add(LocalDateTimeAdapter()) - .add(LocalDateAdapter()) - .add(UUIDAdapter()) - .add(ByteArrayAdapter()) - .add(URIAdapter()) - .add(KotlinJsonAdapterFactory()) - .add(BigDecimalAdapter()) - .add(BigIntegerAdapter()) - - @JvmStatic - val moshi: Moshi by lazy { - moshiBuilder.build() - } -} diff --git a/tonapi/src/main/kotlin/io/tonapi/infrastructure/URIAdapter.kt b/tonapi/src/main/kotlin/io/tonapi/infrastructure/URIAdapter.kt deleted file mode 100644 index c570c4909..000000000 --- a/tonapi/src/main/kotlin/io/tonapi/infrastructure/URIAdapter.kt +++ /dev/null @@ -1,13 +0,0 @@ -package io.tonapi.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.net.URI - -class URIAdapter { - @ToJson - fun toJson(uri: URI) = uri.toString() - - @FromJson - fun fromJson(s: String): URI = URI.create(s) -} diff --git a/tonapi/src/main/kotlin/io/tonapi/infrastructure/UUIDAdapter.kt b/tonapi/src/main/kotlin/io/tonapi/infrastructure/UUIDAdapter.kt deleted file mode 100644 index 41fbb9ac8..000000000 --- a/tonapi/src/main/kotlin/io/tonapi/infrastructure/UUIDAdapter.kt +++ /dev/null @@ -1,13 +0,0 @@ -package io.tonapi.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.util.UUID - -class UUIDAdapter { - @ToJson - fun toJson(uuid: UUID) = uuid.toString() - - @FromJson - fun fromJson(s: String): UUID = UUID.fromString(s) -} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/AccStatusChange.kt b/tonapi/src/main/kotlin/io/tonapi/models/AccStatusChange.kt index 9db39edf7..a35297a59 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/AccStatusChange.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/AccStatusChange.kt @@ -16,26 +16,25 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable /** * * - * Values: unchanged,frozen,deleted + * Values: acst_unchanged,acst_frozen,acst_deleted */ - -@JsonClass(generateAdapter = false) +@Serializable enum class AccStatusChange(val value: kotlin.String) { - @Json(name = "acst_unchanged") - unchanged("acst_unchanged"), + @SerialName(value = "acst_unchanged") + acst_unchanged("acst_unchanged"), - @Json(name = "acst_frozen") - frozen("acst_frozen"), + @SerialName(value = "acst_frozen") + acst_frozen("acst_frozen"), - @Json(name = "acst_deleted") - deleted("acst_deleted"); + @SerialName(value = "acst_deleted") + acst_deleted("acst_deleted"); /** * Override [toString()] to avoid using the enum variable name as the value, and instead use diff --git a/tonapi/src/main/kotlin/io/tonapi/models/Account.kt b/tonapi/src/main/kotlin/io/tonapi/models/Account.kt index 8fbed658b..23d493107 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/Account.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/Account.kt @@ -16,71 +16,63 @@ package io.tonapi.models import io.tonapi.models.AccountStatus +import io.tonapi.models.ExtraCurrency -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param address - * @param balance - * @param lastActivity unix timestamp - * @param status - * @param getMethods - * @param isWallet - * @param currenciesBalance {'USD': 1, 'IDR': 1000} - * @param interfaces - * @param name - * @param isScam - * @param icon - * @param memoRequired - * @param isSuspended - */ +@Serializable data class Account ( - @Json(name = "address") + @SerialName(value = "address") val address: kotlin.String, - @Json(name = "balance") + @SerialName(value = "balance") val balance: kotlin.Long, /* unix timestamp */ - @Json(name = "last_activity") + @SerialName(value = "last_activity") val lastActivity: kotlin.Long, - @Json(name = "status") + @Contextual @SerialName(value = "status") val status: AccountStatus, - @Json(name = "get_methods") + @SerialName(value = "get_methods") val getMethods: kotlin.collections.List, - @Json(name = "is_wallet") + @SerialName(value = "is_wallet") val isWallet: kotlin.Boolean, + @SerialName(value = "extra_balance") + val extraBalance: kotlin.collections.List? = null, + /* {'USD': 1, 'IDR': 1000} */ - @Json(name = "currencies_balance") - val currenciesBalance: kotlin.collections.Map? = null, + @Contextual @SerialName(value = "currencies_balance") + val currenciesBalance: kotlin.collections.Map? = null, - @Json(name = "interfaces") + @SerialName(value = "interfaces") val interfaces: kotlin.collections.List? = null, - @Json(name = "name") + @SerialName(value = "name") val name: kotlin.String? = null, - @Json(name = "is_scam") + @SerialName(value = "is_scam") val isScam: kotlin.Boolean? = null, - @Json(name = "icon") + @SerialName(value = "icon") val icon: kotlin.String? = null, - @Json(name = "memo_required") + @SerialName(value = "memo_required") val memoRequired: kotlin.Boolean? = null, - @Json(name = "is_suspended") + @SerialName(value = "is_suspended") val isSuspended: kotlin.Boolean? = null -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/AccountAddress.kt b/tonapi/src/main/kotlin/io/tonapi/models/AccountAddress.kt index 898ea2894..e7a31025d 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/AccountAddress.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/AccountAddress.kt @@ -16,38 +16,34 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param address - * @param isScam Is this account was marked as part of scammers activity - * @param isWallet - * @param name Display name. Data collected from different sources like moderation lists, dns, collections names and over. - * @param icon - */ +@Serializable data class AccountAddress ( - @Json(name = "address") + @SerialName(value = "address") val address: kotlin.String, /* Is this account was marked as part of scammers activity */ - @Json(name = "is_scam") + @SerialName(value = "is_scam") val isScam: kotlin.Boolean, - @Json(name = "is_wallet") + @SerialName(value = "is_wallet") val isWallet: kotlin.Boolean, /* Display name. Data collected from different sources like moderation lists, dns, collections names and over. */ - @Json(name = "name") + @SerialName(value = "name") val name: kotlin.String? = null, - @Json(name = "icon") + @SerialName(value = "icon") val icon: kotlin.String? = null -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/AccountEvent.kt b/tonapi/src/main/kotlin/io/tonapi/models/AccountEvent.kt index 85f40bd67..7984a48ce 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/AccountEvent.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/AccountEvent.kt @@ -18,51 +18,47 @@ package io.tonapi.models import io.tonapi.models.AccountAddress import io.tonapi.models.Action -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * An event is built on top of a trace which is a series of transactions caused by one inbound message. TonAPI looks for known patterns inside the trace and splits the trace into actions, where a single action represents a meaningful high-level operation like a Jetton Transfer or an NFT Purchase. Actions are expected to be shown to users. It is advised not to build any logic on top of actions because actions can be changed at any time. - * - * @param eventId - * @param account - * @param timestamp - * @param actions - * @param isScam scam - * @param lt - * @param inProgress Event is not finished yet. Transactions still happening - * @param extra TODO - */ +@Serializable data class AccountEvent ( - @Json(name = "event_id") + @SerialName(value = "event_id") val eventId: kotlin.String, - @Json(name = "account") + @SerialName(value = "account") val account: AccountAddress, - @Json(name = "timestamp") + @SerialName(value = "timestamp") val timestamp: kotlin.Long, - @Json(name = "actions") + @SerialName(value = "actions") val actions: kotlin.collections.List, /* scam */ - @Json(name = "is_scam") + @SerialName(value = "is_scam") val isScam: kotlin.Boolean, - @Json(name = "lt") + @SerialName(value = "lt") val lt: kotlin.Long, /* Event is not finished yet. Transactions still happening */ - @Json(name = "in_progress") + @SerialName(value = "in_progress") val inProgress: kotlin.Boolean, /* TODO */ - @Json(name = "extra") - val extra: kotlin.Long + @SerialName(value = "extra") + val extra: kotlin.Long, -) + @SerialName(value = "progress") + val progress: kotlin.Float + +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/AccountEvents.kt b/tonapi/src/main/kotlin/io/tonapi/models/AccountEvents.kt index dfdc6d88c..8a591ed08 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/AccountEvents.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/AccountEvents.kt @@ -17,24 +17,23 @@ package io.tonapi.models import io.tonapi.models.AccountEvent -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param events - * @param nextFrom - */ +@Serializable data class AccountEvents ( - @Json(name = "events") + @SerialName(value = "events") val events: kotlin.collections.List, - @Json(name = "next_from") + @SerialName(value = "next_from") val nextFrom: kotlin.Long -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/AccountInfoByStateInit.kt b/tonapi/src/main/kotlin/io/tonapi/models/AccountInfoByStateInit.kt index f48b83541..b90288ef3 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/AccountInfoByStateInit.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/AccountInfoByStateInit.kt @@ -16,24 +16,23 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param publicKey - * @param address - */ +@Serializable data class AccountInfoByStateInit ( - @Json(name = "public_key") + @SerialName(value = "public_key") val publicKey: kotlin.String, - @Json(name = "address") + @SerialName(value = "address") val address: kotlin.String -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/AccountPurchases.kt b/tonapi/src/main/kotlin/io/tonapi/models/AccountPurchases.kt new file mode 100644 index 000000000..1e4ed2778 --- /dev/null +++ b/tonapi/src/main/kotlin/io/tonapi/models/AccountPurchases.kt @@ -0,0 +1,39 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package io.tonapi.models + +import io.tonapi.models.Purchase + +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual + + +@Serializable + +data class AccountPurchases ( + + @SerialName(value = "purchases") + val purchases: kotlin.collections.List, + + @SerialName(value = "next_from") + val nextFrom: kotlin.Long + +) { + + +} + diff --git a/tonapi/src/main/kotlin/io/tonapi/models/AccountStaking.kt b/tonapi/src/main/kotlin/io/tonapi/models/AccountStaking.kt index 06ea329a8..1e48237ce 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/AccountStaking.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/AccountStaking.kt @@ -17,20 +17,20 @@ package io.tonapi.models import io.tonapi.models.AccountStakingInfo -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param pools - */ +@Serializable data class AccountStaking ( - @Json(name = "pools") + @SerialName(value = "pools") val pools: kotlin.collections.List -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/AccountStakingInfo.kt b/tonapi/src/main/kotlin/io/tonapi/models/AccountStakingInfo.kt index d7c6fcab6..951c38517 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/AccountStakingInfo.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/AccountStakingInfo.kt @@ -16,36 +16,32 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param pool - * @param amount - * @param pendingDeposit - * @param pendingWithdraw - * @param readyWithdraw - */ +@Serializable data class AccountStakingInfo ( - @Json(name = "pool") + @SerialName(value = "pool") val pool: kotlin.String, - @Json(name = "amount") + @SerialName(value = "amount") val amount: kotlin.Long, - @Json(name = "pending_deposit") + @SerialName(value = "pending_deposit") val pendingDeposit: kotlin.Long, - @Json(name = "pending_withdraw") + @SerialName(value = "pending_withdraw") val pendingWithdraw: kotlin.Long, - @Json(name = "ready_withdraw") + @SerialName(value = "ready_withdraw") val readyWithdraw: kotlin.Long -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/AccountStatus.kt b/tonapi/src/main/kotlin/io/tonapi/models/AccountStatus.kt index bd2567b25..8901ef2ec 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/AccountStatus.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/AccountStatus.kt @@ -16,28 +16,27 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable /** * * * Values: nonexist,uninit,active,frozen */ - -@JsonClass(generateAdapter = false) +@Serializable enum class AccountStatus(val value: kotlin.String) { - @Json(name = "nonexist") + @SerialName(value = "nonexist") nonexist("nonexist"), - @Json(name = "uninit") + @SerialName(value = "uninit") uninit("uninit"), - @Json(name = "active") + @SerialName(value = "active") active("active"), - @Json(name = "frozen") + @SerialName(value = "frozen") frozen("frozen"); /** diff --git a/tonapi/src/main/kotlin/io/tonapi/models/AccountStorageInfo.kt b/tonapi/src/main/kotlin/io/tonapi/models/AccountStorageInfo.kt index e37a4e1b8..ecefe8902 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/AccountStorageInfo.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/AccountStorageInfo.kt @@ -16,37 +16,33 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param usedCells - * @param usedBits - * @param usedPublicCells - * @param lastPaid time of the last payment - * @param duePayment - */ +@Serializable data class AccountStorageInfo ( - @Json(name = "used_cells") + @SerialName(value = "used_cells") val usedCells: kotlin.Long, - @Json(name = "used_bits") + @SerialName(value = "used_bits") val usedBits: kotlin.Long, - @Json(name = "used_public_cells") + @SerialName(value = "used_public_cells") val usedPublicCells: kotlin.Long, /* time of the last payment */ - @Json(name = "last_paid") + @SerialName(value = "last_paid") val lastPaid: kotlin.Long, - @Json(name = "due_payment") + @SerialName(value = "due_payment") val duePayment: kotlin.Long -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/Accounts.kt b/tonapi/src/main/kotlin/io/tonapi/models/Accounts.kt index 07c1159dd..9b62afcfd 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/Accounts.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/Accounts.kt @@ -17,20 +17,20 @@ package io.tonapi.models import io.tonapi.models.Account -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param accounts - */ +@Serializable data class Accounts ( - @Json(name = "accounts") + @SerialName(value = "accounts") val accounts: kotlin.collections.List -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/Action.kt b/tonapi/src/main/kotlin/io/tonapi/models/Action.kt index cdcaf1a37..9b51f9dcc 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/Action.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/Action.kt @@ -22,14 +22,15 @@ import io.tonapi.models.DepositStakeAction import io.tonapi.models.DomainRenewAction import io.tonapi.models.ElectionsDepositStakeAction import io.tonapi.models.ElectionsRecoverStakeAction -import io.tonapi.models.InscriptionMintAction -import io.tonapi.models.InscriptionTransferAction +import io.tonapi.models.ExtraCurrencyTransferAction +import io.tonapi.models.GasRelayAction import io.tonapi.models.JettonBurnAction import io.tonapi.models.JettonMintAction import io.tonapi.models.JettonSwapAction import io.tonapi.models.JettonTransferAction import io.tonapi.models.NftItemTransferAction import io.tonapi.models.NftPurchaseAction +import io.tonapi.models.PurchaseAction import io.tonapi.models.SmartContractAction import io.tonapi.models.SubscriptionAction import io.tonapi.models.TonTransferAction @@ -37,123 +38,131 @@ import io.tonapi.models.UnSubscriptionAction import io.tonapi.models.WithdrawStakeAction import io.tonapi.models.WithdrawStakeRequestAction -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param type - * @param status - * @param simplePreview - * @param baseTransactions - * @param tonTransfer - * @param contractDeploy - * @param jettonTransfer - * @param jettonBurn - * @param jettonMint - * @param nftItemTransfer - * @param subscribe - * @param unSubscribe - * @param auctionBid - * @param nftPurchase - * @param depositStake - * @param withdrawStake - * @param withdrawStakeRequest - * @param electionsDepositStake - * @param electionsRecoverStake - * @param jettonSwap - * @param smartContractExec - * @param domainRenew - * @param inscriptionTransfer - * @param inscriptionMint - */ +@Serializable data class Action ( - @Json(name = "type") - val type: String, + @SerialName(value = "type") + val type: Action.Type, - @Json(name = "status") + @SerialName(value = "status") val status: Action.Status, - @Json(name = "simple_preview") + @SerialName(value = "simple_preview") val simplePreview: ActionSimplePreview, - @Json(name = "base_transactions") + @SerialName(value = "base_transactions") val baseTransactions: kotlin.collections.List, - @Json(name = "TonTransfer") + @SerialName(value = "TonTransfer") val tonTransfer: TonTransferAction? = null, - @Json(name = "ContractDeploy") + @SerialName(value = "ExtraCurrencyTransfer") + val extraCurrencyTransfer: ExtraCurrencyTransferAction? = null, + + @SerialName(value = "ContractDeploy") val contractDeploy: ContractDeployAction? = null, - @Json(name = "JettonTransfer") + @SerialName(value = "JettonTransfer") val jettonTransfer: JettonTransferAction? = null, - @Json(name = "JettonBurn") + @SerialName(value = "JettonBurn") val jettonBurn: JettonBurnAction? = null, - @Json(name = "JettonMint") + @SerialName(value = "JettonMint") val jettonMint: JettonMintAction? = null, - @Json(name = "NftItemTransfer") + @SerialName(value = "NftItemTransfer") val nftItemTransfer: NftItemTransferAction? = null, - @Json(name = "Subscribe") + @SerialName(value = "Subscribe") val subscribe: SubscriptionAction? = null, - @Json(name = "UnSubscribe") + @SerialName(value = "UnSubscribe") val unSubscribe: UnSubscriptionAction? = null, - @Json(name = "AuctionBid") + @SerialName(value = "AuctionBid") val auctionBid: AuctionBidAction? = null, - @Json(name = "NftPurchase") + @SerialName(value = "NftPurchase") val nftPurchase: NftPurchaseAction? = null, - @Json(name = "DepositStake") + @SerialName(value = "DepositStake") val depositStake: DepositStakeAction? = null, - @Json(name = "WithdrawStake") + @SerialName(value = "WithdrawStake") val withdrawStake: WithdrawStakeAction? = null, - @Json(name = "WithdrawStakeRequest") + @SerialName(value = "WithdrawStakeRequest") val withdrawStakeRequest: WithdrawStakeRequestAction? = null, - @Json(name = "ElectionsDepositStake") + @SerialName(value = "ElectionsDepositStake") val electionsDepositStake: ElectionsDepositStakeAction? = null, - @Json(name = "ElectionsRecoverStake") + @SerialName(value = "ElectionsRecoverStake") val electionsRecoverStake: ElectionsRecoverStakeAction? = null, - @Json(name = "JettonSwap") + @SerialName(value = "JettonSwap") val jettonSwap: JettonSwapAction? = null, - @Json(name = "SmartContractExec") + @SerialName(value = "SmartContractExec") val smartContractExec: SmartContractAction? = null, - @Json(name = "DomainRenew") + @SerialName(value = "DomainRenew") val domainRenew: DomainRenewAction? = null, - @Json(name = "InscriptionTransfer") - val inscriptionTransfer: InscriptionTransferAction? = null, + @SerialName(value = "Purchase") + val purchase: PurchaseAction? = null, - @Json(name = "InscriptionMint") - val inscriptionMint: InscriptionMintAction? = null + @SerialName(value = "GasRelay") + val gasRelay: GasRelayAction? = null ) { + + /** + * + * + * Values: TonTransfer,ExtraCurrencyTransfer,ContractDeploy,JettonTransfer,JettonBurn,JettonMint,NftItemTransfer,Subscribe,UnSubscribe,AuctionBid,NftPurchase,DepositStake,WithdrawStake,WithdrawStakeRequest,ElectionsDepositStake,ElectionsRecoverStake,JettonSwap,SmartContractExec,DomainRenew,Purchase,Unknown + */ + @Serializable + enum class Type(val value: kotlin.String) { + @SerialName(value = "TonTransfer") TonTransfer("TonTransfer"), + @SerialName(value = "ExtraCurrencyTransfer") ExtraCurrencyTransfer("ExtraCurrencyTransfer"), + @SerialName(value = "ContractDeploy") ContractDeploy("ContractDeploy"), + @SerialName(value = "JettonTransfer") JettonTransfer("JettonTransfer"), + @SerialName(value = "JettonBurn") JettonBurn("JettonBurn"), + @SerialName(value = "JettonMint") JettonMint("JettonMint"), + @SerialName(value = "NftItemTransfer") NftItemTransfer("NftItemTransfer"), + @SerialName(value = "Subscribe") Subscribe("Subscribe"), + @SerialName(value = "UnSubscribe") UnSubscribe("UnSubscribe"), + @SerialName(value = "AuctionBid") AuctionBid("AuctionBid"), + @SerialName(value = "NftPurchase") NftPurchase("NftPurchase"), + @SerialName(value = "DepositStake") DepositStake("DepositStake"), + @SerialName(value = "WithdrawStake") WithdrawStake("WithdrawStake"), + @SerialName(value = "WithdrawStakeRequest") WithdrawStakeRequest("WithdrawStakeRequest"), + @SerialName(value = "ElectionsDepositStake") ElectionsDepositStake("ElectionsDepositStake"), + @SerialName(value = "ElectionsRecoverStake") ElectionsRecoverStake("ElectionsRecoverStake"), + @SerialName(value = "JettonSwap") JettonSwap("JettonSwap"), + @SerialName(value = "SmartContractExec") SmartContractExec("SmartContractExec"), + @SerialName(value = "DomainRenew") DomainRenew("DomainRenew"), + @SerialName(value = "Purchase") Purchase("Purchase"), + @SerialName(value = "Unknown") Unknown("Unknown"); + } /** * * * Values: ok,failed */ - @JsonClass(generateAdapter = false) + @Serializable enum class Status(val value: kotlin.String) { - @Json(name = "ok") ok("ok"), - @Json(name = "failed") failed("failed"); + @SerialName(value = "ok") ok("ok"), + @SerialName(value = "failed") failed("failed"); } + } diff --git a/tonapi/src/main/kotlin/io/tonapi/models/ActionPhase.kt b/tonapi/src/main/kotlin/io/tonapi/models/ActionPhase.kt index 2a61cc40e..df5f03b3b 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/ActionPhase.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/ActionPhase.kt @@ -16,44 +16,38 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param success - * @param resultCode - * @param totalActions - * @param skippedActions - * @param fwdFees - * @param totalFees - * @param resultCodeDescription - */ +@Serializable data class ActionPhase ( - @Json(name = "success") + @SerialName(value = "success") val success: kotlin.Boolean, - @Json(name = "result_code") + @SerialName(value = "result_code") val resultCode: kotlin.Int, - @Json(name = "total_actions") + @SerialName(value = "total_actions") val totalActions: kotlin.Int, - @Json(name = "skipped_actions") + @SerialName(value = "skipped_actions") val skippedActions: kotlin.Int, - @Json(name = "fwd_fees") + @SerialName(value = "fwd_fees") val fwdFees: kotlin.Long, - @Json(name = "total_fees") + @SerialName(value = "total_fees") val totalFees: kotlin.Long, - @Json(name = "result_code_description") + @SerialName(value = "result_code_description") val resultCodeDescription: kotlin.String? = null -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/ActionSimplePreview.kt b/tonapi/src/main/kotlin/io/tonapi/models/ActionSimplePreview.kt index e4412b7a5..a79caa24a 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/ActionSimplePreview.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/ActionSimplePreview.kt @@ -17,42 +17,37 @@ package io.tonapi.models import io.tonapi.models.AccountAddress -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * shortly describes what this action is about. - * - * @param name - * @param description - * @param accounts - * @param actionImage a link to an image for this particular action. - * @param `value` - * @param valueImage a link to an image that depicts this action's asset. - */ +@Serializable data class ActionSimplePreview ( - @Json(name = "name") + @SerialName(value = "name") val name: kotlin.String, - @Json(name = "description") + @SerialName(value = "description") val description: kotlin.String, - @Json(name = "accounts") + @SerialName(value = "accounts") val accounts: kotlin.collections.List, /* a link to an image for this particular action. */ - @Json(name = "action_image") + @SerialName(value = "action_image") val actionImage: kotlin.String? = null, - @Json(name = "value") + @SerialName(value = "value") val `value`: kotlin.String? = null, /* a link to an image that depicts this action's asset. */ - @Json(name = "value_image") + @SerialName(value = "value_image") val valueImage: kotlin.String? = null -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/AddressParse200Response.kt b/tonapi/src/main/kotlin/io/tonapi/models/AddressParse200Response.kt index ece951668..ff4c6e006 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/AddressParse200Response.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/AddressParse200Response.kt @@ -17,36 +17,32 @@ package io.tonapi.models import io.tonapi.models.AddressParse200ResponseBounceable -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param rawForm - * @param bounceable - * @param nonBounceable - * @param givenType - * @param testOnly - */ +@Serializable data class AddressParse200Response ( - @Json(name = "raw_form") + @SerialName(value = "raw_form") val rawForm: kotlin.String, - @Json(name = "bounceable") + @SerialName(value = "bounceable") val bounceable: AddressParse200ResponseBounceable, - @Json(name = "non_bounceable") + @SerialName(value = "non_bounceable") val nonBounceable: AddressParse200ResponseBounceable, - @Json(name = "given_type") + @SerialName(value = "given_type") val givenType: kotlin.String, - @Json(name = "test_only") + @SerialName(value = "test_only") val testOnly: kotlin.Boolean -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/AddressParse200ResponseBounceable.kt b/tonapi/src/main/kotlin/io/tonapi/models/AddressParse200ResponseBounceable.kt index 1a13b8eb2..bc1d59139 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/AddressParse200ResponseBounceable.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/AddressParse200ResponseBounceable.kt @@ -16,24 +16,23 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param b64 - * @param b64url - */ +@Serializable data class AddressParse200ResponseBounceable ( - @Json(name = "b64") + @SerialName(value = "b64") val b64: kotlin.String, - @Json(name = "b64url") + @SerialName(value = "b64url") val b64url: kotlin.String -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/ApyHistory.kt b/tonapi/src/main/kotlin/io/tonapi/models/ApyHistory.kt index c16085e54..ce7ad1e61 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/ApyHistory.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/ApyHistory.kt @@ -16,24 +16,23 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param apy - * @param time - */ +@Serializable data class ApyHistory ( - @Json(name = "apy") - val apy: java.math.BigDecimal, + @SerialName(value = "apy") + val apy: kotlin.String, - @Json(name = "time") + @SerialName(value = "time") val time: kotlin.Int -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/Auction.kt b/tonapi/src/main/kotlin/io/tonapi/models/Auction.kt index 48663dc7c..d952c2b70 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/Auction.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/Auction.kt @@ -16,36 +16,32 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param domain - * @param owner - * @param price - * @param bids - * @param date - */ +@Serializable data class Auction ( - @Json(name = "domain") + @SerialName(value = "domain") val domain: kotlin.String, - @Json(name = "owner") + @SerialName(value = "owner") val owner: kotlin.String, - @Json(name = "price") + @SerialName(value = "price") val price: kotlin.Long, - @Json(name = "bids") + @SerialName(value = "bids") val bids: kotlin.Long, - @Json(name = "date") + @SerialName(value = "date") val date: kotlin.Long -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/AuctionBidAction.kt b/tonapi/src/main/kotlin/io/tonapi/models/AuctionBidAction.kt index 0ffcd9344..82dc9f8f0 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/AuctionBidAction.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/AuctionBidAction.kt @@ -19,35 +19,28 @@ import io.tonapi.models.AccountAddress import io.tonapi.models.NftItem import io.tonapi.models.Price -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param auctionType - * @param amount - * @param bidder - * @param auction - * @param nft - */ +@Serializable data class AuctionBidAction ( - @Json(name = "auction_type") - val auctionType: String, + @SerialName(value = "auction_type") + val auctionType: AuctionBidAction.AuctionType, - @Json(name = "amount") + @SerialName(value = "amount") val amount: Price, - @Json(name = "bidder") + @SerialName(value = "bidder") val bidder: AccountAddress, - @Json(name = "auction") + @SerialName(value = "auction") val auction: AccountAddress, - @Json(name = "nft") + @SerialName(value = "nft") val nft: NftItem? = null ) { @@ -55,14 +48,15 @@ data class AuctionBidAction ( /** * * - * Values: dNSPeriodTon,dNSPeriodTg,nUMBERPeriodTg,getgems + * Values: DNSPeriodTon,DNSPeriodTg,NUMBERPeriodTg,getgems */ - @JsonClass(generateAdapter = false) + @Serializable enum class AuctionType(val value: kotlin.String) { - @Json(name = "DNS.ton") dNSPeriodTon("DNS.ton"), - @Json(name = "DNS.tg") dNSPeriodTg("DNS.tg"), - @Json(name = "NUMBER.tg") nUMBERPeriodTg("NUMBER.tg"), - @Json(name = "getgems") getgems("getgems"); + @SerialName(value = "DNS.ton") DNSPeriodTon("DNS.ton"), + @SerialName(value = "DNS.tg") DNSPeriodTg("DNS.tg"), + @SerialName(value = "NUMBER.tg") NUMBERPeriodTg("NUMBER.tg"), + @SerialName(value = "getgems") getgems("getgems"); } + } diff --git a/tonapi/src/main/kotlin/io/tonapi/models/Auctions.kt b/tonapi/src/main/kotlin/io/tonapi/models/Auctions.kt index e9dbd1ec4..15672f3ef 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/Auctions.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/Auctions.kt @@ -17,24 +17,23 @@ package io.tonapi.models import io.tonapi.models.Auction -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param `data` - * @param total - */ +@Serializable data class Auctions ( - @Json(name = "data") + @SerialName(value = "data") val `data`: kotlin.collections.List, - @Json(name = "total") + @SerialName(value = "total") val total: kotlin.Long -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/BlockCurrencyCollection.kt b/tonapi/src/main/kotlin/io/tonapi/models/BlockCurrencyCollection.kt index 46d66230b..e553f7ef3 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/BlockCurrencyCollection.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/BlockCurrencyCollection.kt @@ -17,24 +17,23 @@ package io.tonapi.models import io.tonapi.models.BlockCurrencyCollectionOtherInner -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param grams - * @param other - */ +@Serializable data class BlockCurrencyCollection ( - @Json(name = "grams") + @SerialName(value = "grams") val grams: kotlin.Long, - @Json(name = "other") + @SerialName(value = "other") val other: kotlin.collections.List -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/BlockCurrencyCollectionOtherInner.kt b/tonapi/src/main/kotlin/io/tonapi/models/BlockCurrencyCollectionOtherInner.kt index 608f95037..49998b505 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/BlockCurrencyCollectionOtherInner.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/BlockCurrencyCollectionOtherInner.kt @@ -16,24 +16,23 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param id - * @param `value` - */ +@Serializable data class BlockCurrencyCollectionOtherInner ( - @Json(name = "id") + @SerialName(value = "id") val id: kotlin.Long, - @Json(name = "value") + @SerialName(value = "value") val `value`: kotlin.String -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/BlockLimits.kt b/tonapi/src/main/kotlin/io/tonapi/models/BlockLimits.kt index e40512d6e..00375d23c 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/BlockLimits.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/BlockLimits.kt @@ -17,28 +17,26 @@ package io.tonapi.models import io.tonapi.models.BlockParamLimits -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param bytes - * @param gas - * @param ltDelta - */ +@Serializable data class BlockLimits ( - @Json(name = "bytes") + @SerialName(value = "bytes") val bytes: BlockParamLimits, - @Json(name = "gas") + @SerialName(value = "gas") val gas: BlockParamLimits, - @Json(name = "lt_delta") + @SerialName(value = "lt_delta") val ltDelta: BlockParamLimits -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/BlockParamLimits.kt b/tonapi/src/main/kotlin/io/tonapi/models/BlockParamLimits.kt index 0b0964b98..7e7d02377 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/BlockParamLimits.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/BlockParamLimits.kt @@ -16,28 +16,26 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param underload - * @param softLimit - * @param hardLimit - */ +@Serializable data class BlockParamLimits ( - @Json(name = "underload") + @SerialName(value = "underload") val underload: kotlin.Long, - @Json(name = "soft_limit") + @SerialName(value = "soft_limit") val softLimit: kotlin.Long, - @Json(name = "hard_limit") + @SerialName(value = "hard_limit") val hardLimit: kotlin.Long -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/BlockRaw.kt b/tonapi/src/main/kotlin/io/tonapi/models/BlockRaw.kt index 74c8fa3f6..5b6643da7 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/BlockRaw.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/BlockRaw.kt @@ -16,36 +16,32 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param workchain - * @param shard - * @param seqno - * @param rootHash - * @param fileHash - */ +@Serializable data class BlockRaw ( - @Json(name = "workchain") + @SerialName(value = "workchain") val workchain: kotlin.Int, - @Json(name = "shard") + @SerialName(value = "shard") val shard: kotlin.String, - @Json(name = "seqno") + @SerialName(value = "seqno") val seqno: kotlin.Int, - @Json(name = "root_hash") + @SerialName(value = "root_hash") val rootHash: kotlin.String, - @Json(name = "file_hash") + @SerialName(value = "file_hash") val fileHash: kotlin.String -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/BlockValueFlow.kt b/tonapi/src/main/kotlin/io/tonapi/models/BlockValueFlow.kt index 2c4ccc80d..001cef1f7 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/BlockValueFlow.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/BlockValueFlow.kt @@ -17,56 +17,47 @@ package io.tonapi.models import io.tonapi.models.BlockCurrencyCollection -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param fromPrevBlk - * @param toNextBlk - * @param imported - * @param exported - * @param feesCollected - * @param feesImported - * @param recovered - * @param created - * @param minted - * @param burned - */ +@Serializable data class BlockValueFlow ( - @Json(name = "from_prev_blk") + @SerialName(value = "from_prev_blk") val fromPrevBlk: BlockCurrencyCollection, - @Json(name = "to_next_blk") + @SerialName(value = "to_next_blk") val toNextBlk: BlockCurrencyCollection, - @Json(name = "imported") + @SerialName(value = "imported") val imported: BlockCurrencyCollection, - @Json(name = "exported") + @SerialName(value = "exported") val exported: BlockCurrencyCollection, - @Json(name = "fees_collected") + @SerialName(value = "fees_collected") val feesCollected: BlockCurrencyCollection, - @Json(name = "fees_imported") + @SerialName(value = "fees_imported") val feesImported: BlockCurrencyCollection, - @Json(name = "recovered") + @SerialName(value = "recovered") val recovered: BlockCurrencyCollection, - @Json(name = "created") + @SerialName(value = "created") val created: BlockCurrencyCollection, - @Json(name = "minted") + @SerialName(value = "minted") val minted: BlockCurrencyCollection, - @Json(name = "burned") + @SerialName(value = "burned") val burned: BlockCurrencyCollection? = null -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainAccountInspect.kt b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainAccountInspect.kt index eddebca9a..04e0088eb 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainAccountInspect.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainAccountInspect.kt @@ -15,45 +15,49 @@ package io.tonapi.models -import io.tonapi.models.BlockchainAccountInspectMethodsInner +import io.tonapi.models.Method +import io.tonapi.models.Source -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param code - * @param codeHash - * @param methods - * @param compiler - */ +@Serializable data class BlockchainAccountInspect ( - @Json(name = "code") + @SerialName(value = "code") val code: kotlin.String, - @Json(name = "code_hash") + @SerialName(value = "code_hash") val codeHash: kotlin.String, - @Json(name = "methods") - val methods: kotlin.collections.List, + @SerialName(value = "methods") + val methods: kotlin.collections.List, - @Json(name = "compiler") - val compiler: BlockchainAccountInspect.Compiler? = null + @SerialName(value = "compiler") + val compiler: BlockchainAccountInspect.Compiler, + + @SerialName(value = "disassembled_code") + val disassembledCode: kotlin.String? = null, + + @SerialName(value = "source") + val source: Source? = null ) { /** * * - * Values: func + * Values: func,fift,tact */ - @JsonClass(generateAdapter = false) + @Serializable enum class Compiler(val value: kotlin.String) { - @Json(name = "func") func("func"); + @SerialName(value = "func") func("func"), + @SerialName(value = "fift") fift("fift"), + @SerialName(value = "tact") tact("tact"); } + } diff --git a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainBlock.kt b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainBlock.kt index 5e37116d3..523853c5f 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainBlock.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainBlock.kt @@ -17,136 +17,107 @@ package io.tonapi.models import io.tonapi.models.BlockValueFlow -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param txQuantity - * @param valueFlow - * @param workchainId - * @param shard - * @param seqno - * @param rootHash - * @param fileHash - * @param globalId - * @param version - * @param afterMerge - * @param beforeSplit - * @param afterSplit - * @param wantSplit - * @param wantMerge - * @param keyBlock - * @param genUtime - * @param startLt - * @param endLt - * @param vertSeqno - * @param genCatchainSeqno - * @param minRefMcSeqno - * @param prevKeyBlockSeqno - * @param prevRefs - * @param inMsgDescrLength - * @param outMsgDescrLength - * @param randSeed - * @param createdBy - * @param genSoftwareVersion - * @param genSoftwareCapabilities - * @param masterRef - */ +@Serializable data class BlockchainBlock ( - @Json(name = "tx_quantity") + @SerialName(value = "tx_quantity") val txQuantity: kotlin.Int, - @Json(name = "value_flow") + @SerialName(value = "value_flow") val valueFlow: BlockValueFlow, - @Json(name = "workchain_id") + @SerialName(value = "workchain_id") val workchainId: kotlin.Int, - @Json(name = "shard") + @SerialName(value = "shard") val shard: kotlin.String, - @Json(name = "seqno") + @SerialName(value = "seqno") val seqno: kotlin.Int, - @Json(name = "root_hash") + @SerialName(value = "root_hash") val rootHash: kotlin.String, - @Json(name = "file_hash") + @SerialName(value = "file_hash") val fileHash: kotlin.String, - @Json(name = "global_id") + @SerialName(value = "global_id") val globalId: kotlin.Int, - @Json(name = "version") + @SerialName(value = "version") val version: kotlin.Int, - @Json(name = "after_merge") + @SerialName(value = "after_merge") val afterMerge: kotlin.Boolean, - @Json(name = "before_split") + @SerialName(value = "before_split") val beforeSplit: kotlin.Boolean, - @Json(name = "after_split") + @SerialName(value = "after_split") val afterSplit: kotlin.Boolean, - @Json(name = "want_split") + @SerialName(value = "want_split") val wantSplit: kotlin.Boolean, - @Json(name = "want_merge") + @SerialName(value = "want_merge") val wantMerge: kotlin.Boolean, - @Json(name = "key_block") + @SerialName(value = "key_block") val keyBlock: kotlin.Boolean, - @Json(name = "gen_utime") + @SerialName(value = "gen_utime") val genUtime: kotlin.Long, - @Json(name = "start_lt") + @SerialName(value = "start_lt") val startLt: kotlin.Long, - @Json(name = "end_lt") + @SerialName(value = "end_lt") val endLt: kotlin.Long, - @Json(name = "vert_seqno") + @SerialName(value = "vert_seqno") val vertSeqno: kotlin.Int, - @Json(name = "gen_catchain_seqno") + @SerialName(value = "gen_catchain_seqno") val genCatchainSeqno: kotlin.Int, - @Json(name = "min_ref_mc_seqno") + @SerialName(value = "min_ref_mc_seqno") val minRefMcSeqno: kotlin.Int, - @Json(name = "prev_key_block_seqno") + @SerialName(value = "prev_key_block_seqno") val prevKeyBlockSeqno: kotlin.Int, - @Json(name = "prev_refs") + @SerialName(value = "prev_refs") val prevRefs: kotlin.collections.List, - @Json(name = "in_msg_descr_length") + @SerialName(value = "in_msg_descr_length") val inMsgDescrLength: kotlin.Long, - @Json(name = "out_msg_descr_length") + @SerialName(value = "out_msg_descr_length") val outMsgDescrLength: kotlin.Long, - @Json(name = "rand_seed") + @SerialName(value = "rand_seed") val randSeed: kotlin.String, - @Json(name = "created_by") + @SerialName(value = "created_by") val createdBy: kotlin.String, - @Json(name = "gen_software_version") + @SerialName(value = "gen_software_version") val genSoftwareVersion: kotlin.Int? = null, - @Json(name = "gen_software_capabilities") + @SerialName(value = "gen_software_capabilities") val genSoftwareCapabilities: kotlin.Long? = null, - @Json(name = "master_ref") + @SerialName(value = "master_ref") val masterRef: kotlin.String? = null -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainBlockShards.kt b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainBlockShards.kt index 488dc53c4..d6de5cb3e 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainBlockShards.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainBlockShards.kt @@ -17,20 +17,20 @@ package io.tonapi.models import io.tonapi.models.BlockchainBlockShardsShardsInner -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param shards - */ +@Serializable data class BlockchainBlockShards ( - @Json(name = "shards") + @SerialName(value = "shards") val shards: kotlin.collections.List -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainBlockShardsShardsInner.kt b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainBlockShardsShardsInner.kt index 95d855485..e82204031 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainBlockShardsShardsInner.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainBlockShardsShardsInner.kt @@ -17,24 +17,23 @@ package io.tonapi.models import io.tonapi.models.BlockchainBlock -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param lastKnownBlockId - * @param lastKnownBlock - */ +@Serializable data class BlockchainBlockShardsShardsInner ( - @Json(name = "last_known_block_id") + @SerialName(value = "last_known_block_id") val lastKnownBlockId: kotlin.String, - @Json(name = "last_known_block") + @SerialName(value = "last_known_block") val lastKnownBlock: BlockchainBlock -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainBlocks.kt b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainBlocks.kt index 8d9f3f968..cbf7ef5f3 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainBlocks.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainBlocks.kt @@ -17,20 +17,20 @@ package io.tonapi.models import io.tonapi.models.BlockchainBlock -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param blocks - */ +@Serializable data class BlockchainBlocks ( - @Json(name = "blocks") + @SerialName(value = "blocks") val blocks: kotlin.collections.List -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig.kt b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig.kt index f09bad85d..df24dabe7 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig.kt @@ -36,6 +36,7 @@ import io.tonapi.models.BlockchainConfig31 import io.tonapi.models.BlockchainConfig40 import io.tonapi.models.BlockchainConfig43 import io.tonapi.models.BlockchainConfig44 +import io.tonapi.models.BlockchainConfig45 import io.tonapi.models.BlockchainConfig5 import io.tonapi.models.BlockchainConfig6 import io.tonapi.models.BlockchainConfig7 @@ -45,198 +46,158 @@ import io.tonapi.models.BlockchainConfig8 import io.tonapi.models.BlockchainConfig9 import io.tonapi.models.ValidatorsSet -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param raw config boc in hex format - * @param _0 config address - * @param _1 elector address - * @param _2 minter address - * @param _4 dns root address - * @param _44 - * @param _3 The address of the transaction fee collector. - * @param _5 - * @param _6 - * @param _7 - * @param _8 - * @param _9 - * @param _10 - * @param _11 - * @param _12 - * @param _13 - * @param _14 - * @param _15 - * @param _16 - * @param _17 - * @param _18 - * @param _20 - * @param _21 - * @param _22 - * @param _23 - * @param _24 - * @param _25 - * @param _28 - * @param _29 - * @param _31 - * @param _32 - * @param _33 - * @param _34 - * @param _35 - * @param _36 - * @param _37 - * @param _40 - * @param _43 - * @param _71 - * @param _72 - * @param _73 - * @param _79 - * @param _81 - * @param _82 - */ +@Serializable data class BlockchainConfig ( /* config boc in hex format */ - @Json(name = "raw") + @SerialName(value = "raw") val raw: kotlin.String, /* config address */ - @Json(name = "0") + @SerialName(value = "0") val _0: kotlin.String, /* elector address */ - @Json(name = "1") + @SerialName(value = "1") val _1: kotlin.String, /* minter address */ - @Json(name = "2") + @SerialName(value = "2") val _2: kotlin.String, /* dns root address */ - @Json(name = "4") + @SerialName(value = "4") val _4: kotlin.String, - @Json(name = "44") + @SerialName(value = "44") val _44: BlockchainConfig44, /* The address of the transaction fee collector. */ - @Json(name = "3") + @SerialName(value = "3") val _3: kotlin.String? = null, - @Json(name = "5") + @SerialName(value = "5") val _5: BlockchainConfig5? = null, - @Json(name = "6") + @SerialName(value = "6") val _6: BlockchainConfig6? = null, - @Json(name = "7") + @SerialName(value = "7") val _7: BlockchainConfig7? = null, - @Json(name = "8") + @SerialName(value = "8") val _8: BlockchainConfig8? = null, - @Json(name = "9") + @SerialName(value = "9") val _9: BlockchainConfig9? = null, - @Json(name = "10") + @SerialName(value = "10") val _10: BlockchainConfig10? = null, - @Json(name = "11") + @SerialName(value = "11") val _11: BlockchainConfig11? = null, - @Json(name = "12") + @SerialName(value = "12") val _12: BlockchainConfig12? = null, - @Json(name = "13") + @SerialName(value = "13") val _13: BlockchainConfig13? = null, - @Json(name = "14") + @SerialName(value = "14") val _14: BlockchainConfig14? = null, - @Json(name = "15") + @SerialName(value = "15") val _15: BlockchainConfig15? = null, - @Json(name = "16") + @SerialName(value = "16") val _16: BlockchainConfig16? = null, - @Json(name = "17") + @SerialName(value = "17") val _17: BlockchainConfig17? = null, - @Json(name = "18") + @SerialName(value = "18") val _18: BlockchainConfig18? = null, - @Json(name = "20") + @SerialName(value = "20") val _20: BlockchainConfig20? = null, - @Json(name = "21") + @SerialName(value = "21") val _21: BlockchainConfig21? = null, - @Json(name = "22") + @SerialName(value = "22") val _22: BlockchainConfig22? = null, - @Json(name = "23") + @SerialName(value = "23") val _23: BlockchainConfig23? = null, - @Json(name = "24") + @SerialName(value = "24") val _24: BlockchainConfig24? = null, - @Json(name = "25") + @SerialName(value = "25") val _25: BlockchainConfig25? = null, - @Json(name = "28") + @SerialName(value = "28") val _28: BlockchainConfig28? = null, - @Json(name = "29") + @SerialName(value = "29") val _29: BlockchainConfig29? = null, - @Json(name = "31") + @SerialName(value = "31") val _31: BlockchainConfig31? = null, - @Json(name = "32") + @SerialName(value = "32") val _32: ValidatorsSet? = null, - @Json(name = "33") + @SerialName(value = "33") val _33: ValidatorsSet? = null, - @Json(name = "34") + @SerialName(value = "34") val _34: ValidatorsSet? = null, - @Json(name = "35") + @SerialName(value = "35") val _35: ValidatorsSet? = null, - @Json(name = "36") + @SerialName(value = "36") val _36: ValidatorsSet? = null, - @Json(name = "37") + @SerialName(value = "37") val _37: ValidatorsSet? = null, - @Json(name = "40") + @SerialName(value = "40") val _40: BlockchainConfig40? = null, - @Json(name = "43") + @SerialName(value = "43") val _43: BlockchainConfig43? = null, - @Json(name = "71") + @SerialName(value = "45") + val _45: BlockchainConfig45? = null, + + @SerialName(value = "71") val _71: BlockchainConfig71? = null, - @Json(name = "72") + @SerialName(value = "72") val _72: BlockchainConfig71? = null, - @Json(name = "73") + @SerialName(value = "73") val _73: BlockchainConfig71? = null, - @Json(name = "79") + @SerialName(value = "79") val _79: BlockchainConfig79? = null, - @Json(name = "81") + @SerialName(value = "81") val _81: BlockchainConfig79? = null, - @Json(name = "82") + @SerialName(value = "82") val _82: BlockchainConfig79? = null -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig10.kt b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig10.kt index 0c2a8dc50..dca4c71af 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig10.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig10.kt @@ -16,20 +16,20 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * List of critical TON parameters, the change of which significantly affects the network, so more voting rounds are held. - * - * @param criticalParams - */ +@Serializable data class BlockchainConfig10 ( - @Json(name = "critical_params") + @SerialName(value = "critical_params") val criticalParams: kotlin.collections.List -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig11.kt b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig11.kt index 67f4e7289..80602a40e 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig11.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig11.kt @@ -17,24 +17,23 @@ package io.tonapi.models import io.tonapi.models.ConfigProposalSetup -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * This parameter indicates under what conditions proposals to change the TON configuration are accepted. - * - * @param normalParams - * @param criticalParams - */ +@Serializable data class BlockchainConfig11 ( - @Json(name = "normal_params") + @SerialName(value = "normal_params") val normalParams: ConfigProposalSetup, - @Json(name = "critical_params") + @SerialName(value = "critical_params") val criticalParams: ConfigProposalSetup -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig12.kt b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig12.kt index 63f2434a0..8e2fc0898 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig12.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig12.kt @@ -17,20 +17,20 @@ package io.tonapi.models import io.tonapi.models.WorkchainDescr -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * Workchains in the TON Blockchain - * - * @param workchains - */ +@Serializable data class BlockchainConfig12 ( - @Json(name = "workchains") + @SerialName(value = "workchains") val workchains: kotlin.collections.List -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig13.kt b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig13.kt index b0f1e0a0c..5f69face6 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig13.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig13.kt @@ -16,28 +16,26 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * The cost of filing complaints about incorrect operation of validators. - * - * @param deposit - * @param bitPrice - * @param cellPrice - */ +@Serializable data class BlockchainConfig13 ( - @Json(name = "deposit") + @SerialName(value = "deposit") val deposit: kotlin.Long, - @Json(name = "bit_price") + @SerialName(value = "bit_price") val bitPrice: kotlin.Long, - @Json(name = "cell_price") + @SerialName(value = "cell_price") val cellPrice: kotlin.Long -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig14.kt b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig14.kt index 57243f0a1..61bbd28d7 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig14.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig14.kt @@ -16,24 +16,23 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * The reward in nanoTons for block creation in the TON blockchain. - * - * @param masterchainBlockFee - * @param basechainBlockFee - */ +@Serializable data class BlockchainConfig14 ( - @Json(name = "masterchain_block_fee") + @SerialName(value = "masterchain_block_fee") val masterchainBlockFee: kotlin.Long, - @Json(name = "basechain_block_fee") + @SerialName(value = "basechain_block_fee") val basechainBlockFee: kotlin.Long -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig15.kt b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig15.kt index f2d7e227f..661d7c4a3 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig15.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig15.kt @@ -16,32 +16,29 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * The reward in nanoTons for block creation in the TON blockchain. - * - * @param validatorsElectedFor - * @param electionsStartBefore - * @param electionsEndBefore - * @param stakeHeldFor - */ +@Serializable data class BlockchainConfig15 ( - @Json(name = "validators_elected_for") + @SerialName(value = "validators_elected_for") val validatorsElectedFor: kotlin.Long, - @Json(name = "elections_start_before") + @SerialName(value = "elections_start_before") val electionsStartBefore: kotlin.Long, - @Json(name = "elections_end_before") + @SerialName(value = "elections_end_before") val electionsEndBefore: kotlin.Long, - @Json(name = "stake_held_for") + @SerialName(value = "stake_held_for") val stakeHeldFor: kotlin.Long -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig16.kt b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig16.kt index 9093a4ee6..40903808d 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig16.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig16.kt @@ -16,28 +16,26 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * The limits on the number of validators in the TON blockchain. - * - * @param maxValidators - * @param maxMainValidators - * @param minValidators - */ +@Serializable data class BlockchainConfig16 ( - @Json(name = "max_validators") + @SerialName(value = "max_validators") val maxValidators: kotlin.Int, - @Json(name = "max_main_validators") + @SerialName(value = "max_main_validators") val maxMainValidators: kotlin.Int, - @Json(name = "min_validators") + @SerialName(value = "min_validators") val minValidators: kotlin.Int -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig17.kt b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig17.kt index 1fc6e01f0..23cc8ce37 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig17.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig17.kt @@ -16,32 +16,29 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * The stake parameters configuration in the TON blockchain. - * - * @param minStake - * @param maxStake - * @param minTotalStake - * @param maxStakeFactor - */ +@Serializable data class BlockchainConfig17 ( - @Json(name = "min_stake") + @SerialName(value = "min_stake") val minStake: kotlin.String, - @Json(name = "max_stake") + @SerialName(value = "max_stake") val maxStake: kotlin.String, - @Json(name = "min_total_stake") + @SerialName(value = "min_total_stake") val minTotalStake: kotlin.String, - @Json(name = "max_stake_factor") + @SerialName(value = "max_stake_factor") val maxStakeFactor: kotlin.Long -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig18.kt b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig18.kt index df4349548..2db455192 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig18.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig18.kt @@ -17,20 +17,20 @@ package io.tonapi.models import io.tonapi.models.BlockchainConfig18StoragePricesInner -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * The prices for data storage. - * - * @param storagePrices - */ +@Serializable data class BlockchainConfig18 ( - @Json(name = "storage_prices") + @SerialName(value = "storage_prices") val storagePrices: kotlin.collections.List -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig18StoragePricesInner.kt b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig18StoragePricesInner.kt index 700378c91..db730524a 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig18StoragePricesInner.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig18StoragePricesInner.kt @@ -16,36 +16,32 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param utimeSince - * @param bitPricePs - * @param cellPricePs - * @param mcBitPricePs - * @param mcCellPricePs - */ +@Serializable data class BlockchainConfig18StoragePricesInner ( - @Json(name = "utime_since") + @SerialName(value = "utime_since") val utimeSince: kotlin.Long, - @Json(name = "bit_price_ps") + @SerialName(value = "bit_price_ps") val bitPricePs: kotlin.Long, - @Json(name = "cell_price_ps") + @SerialName(value = "cell_price_ps") val cellPricePs: kotlin.Long, - @Json(name = "mc_bit_price_ps") + @SerialName(value = "mc_bit_price_ps") val mcBitPricePs: kotlin.Long, - @Json(name = "mc_cell_price_ps") + @SerialName(value = "mc_cell_price_ps") val mcCellPricePs: kotlin.Long -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig20.kt b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig20.kt index 55b00c1e5..ff6fc6138 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig20.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig20.kt @@ -17,20 +17,20 @@ package io.tonapi.models import io.tonapi.models.GasLimitPrices -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * The cost of computations in the masterchain. The complexity of any computation is estimated in gas units. - * - * @param gasLimitsPrices - */ +@Serializable data class BlockchainConfig20 ( - @Json(name = "gas_limits_prices") + @SerialName(value = "gas_limits_prices") val gasLimitsPrices: GasLimitPrices -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig21.kt b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig21.kt index 8d7853adc..871e31ba5 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig21.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig21.kt @@ -17,20 +17,20 @@ package io.tonapi.models import io.tonapi.models.GasLimitPrices -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * The cost of computations in the basechains. The complexity of any computation is estimated in gas units. - * - * @param gasLimitsPrices - */ +@Serializable data class BlockchainConfig21 ( - @Json(name = "gas_limits_prices") + @SerialName(value = "gas_limits_prices") val gasLimitsPrices: GasLimitPrices -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig22.kt b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig22.kt index ed1829ab0..0c45e672f 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig22.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig22.kt @@ -17,20 +17,20 @@ package io.tonapi.models import io.tonapi.models.BlockLimits -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * The limits on the block in the masterchain, upon reaching which the block is finalized and the callback of the remaining messages (if any) is carried over to the next block. - * - * @param blockLimits - */ +@Serializable data class BlockchainConfig22 ( - @Json(name = "block_limits") + @SerialName(value = "block_limits") val blockLimits: BlockLimits -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig23.kt b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig23.kt index 2751e1eaf..6db61404d 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig23.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig23.kt @@ -17,20 +17,20 @@ package io.tonapi.models import io.tonapi.models.BlockLimits -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * The limits on the block in the basechains, upon reaching which the block is finalized and the callback of the remaining messages (if any) is carried over to the next block. - * - * @param blockLimits - */ +@Serializable data class BlockchainConfig23 ( - @Json(name = "block_limits") + @SerialName(value = "block_limits") val blockLimits: BlockLimits -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig24.kt b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig24.kt index f41c1911e..5c72edb97 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig24.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig24.kt @@ -17,20 +17,20 @@ package io.tonapi.models import io.tonapi.models.MsgForwardPrices -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * The cost of sending messages in the masterchain of the TON blockchain. - * - * @param msgForwardPrices - */ +@Serializable data class BlockchainConfig24 ( - @Json(name = "msg_forward_prices") + @SerialName(value = "msg_forward_prices") val msgForwardPrices: MsgForwardPrices -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig25.kt b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig25.kt index 6f22a80db..cabfbf5f4 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig25.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig25.kt @@ -17,20 +17,20 @@ package io.tonapi.models import io.tonapi.models.MsgForwardPrices -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * The cost of sending messages in the basechains of the TON blockchain. - * - * @param msgForwardPrices - */ +@Serializable data class BlockchainConfig25 ( - @Json(name = "msg_forward_prices") + @SerialName(value = "msg_forward_prices") val msgForwardPrices: MsgForwardPrices -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig28.kt b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig28.kt index 13d7243f3..2b0850a50 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig28.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig28.kt @@ -16,40 +16,35 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * The configuration for the Catchain protocol. - * - * @param mcCatchainLifetime - * @param shardCatchainLifetime - * @param shardValidatorsLifetime - * @param shardValidatorsNum - * @param flags - * @param shuffleMcValidators - */ +@Serializable data class BlockchainConfig28 ( - @Json(name = "mc_catchain_lifetime") + @SerialName(value = "mc_catchain_lifetime") val mcCatchainLifetime: kotlin.Long, - @Json(name = "shard_catchain_lifetime") + @SerialName(value = "shard_catchain_lifetime") val shardCatchainLifetime: kotlin.Long, - @Json(name = "shard_validators_lifetime") + @SerialName(value = "shard_validators_lifetime") val shardValidatorsLifetime: kotlin.Long, - @Json(name = "shard_validators_num") + @SerialName(value = "shard_validators_num") val shardValidatorsNum: kotlin.Long, - @Json(name = "flags") + @SerialName(value = "flags") val flags: kotlin.Int? = null, - @Json(name = "shuffle_mc_validators") + @SerialName(value = "shuffle_mc_validators") val shuffleMcValidators: kotlin.Boolean? = null -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig29.kt b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig29.kt index 4a230b7cc..bd9aeaecc 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig29.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig29.kt @@ -16,64 +16,53 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * The configuration for the consensus protocol above catchain. - * - * @param roundCandidates - * @param nextCandidateDelayMs - * @param consensusTimeoutMs - * @param fastAttempts - * @param attemptDuration - * @param catchainMaxDeps - * @param maxBlockBytes - * @param maxCollatedBytes - * @param flags - * @param newCatchainIds - * @param protoVersion - * @param catchainMaxBlocksCoeff - */ +@Serializable data class BlockchainConfig29 ( - @Json(name = "round_candidates") + @SerialName(value = "round_candidates") val roundCandidates: kotlin.Long, - @Json(name = "next_candidate_delay_ms") + @SerialName(value = "next_candidate_delay_ms") val nextCandidateDelayMs: kotlin.Long, - @Json(name = "consensus_timeout_ms") + @SerialName(value = "consensus_timeout_ms") val consensusTimeoutMs: kotlin.Long, - @Json(name = "fast_attempts") + @SerialName(value = "fast_attempts") val fastAttempts: kotlin.Long, - @Json(name = "attempt_duration") + @SerialName(value = "attempt_duration") val attemptDuration: kotlin.Long, - @Json(name = "catchain_max_deps") + @SerialName(value = "catchain_max_deps") val catchainMaxDeps: kotlin.Long, - @Json(name = "max_block_bytes") + @SerialName(value = "max_block_bytes") val maxBlockBytes: kotlin.Long, - @Json(name = "max_collated_bytes") + @SerialName(value = "max_collated_bytes") val maxCollatedBytes: kotlin.Long, - @Json(name = "flags") + @SerialName(value = "flags") val flags: kotlin.Int? = null, - @Json(name = "new_catchain_ids") + @SerialName(value = "new_catchain_ids") val newCatchainIds: kotlin.Boolean? = null, - @Json(name = "proto_version") + @SerialName(value = "proto_version") val protoVersion: kotlin.Long? = null, - @Json(name = "catchain_max_blocks_coeff") + @SerialName(value = "catchain_max_blocks_coeff") val catchainMaxBlocksCoeff: kotlin.Long? = null -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig31.kt b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig31.kt index d7e62bbff..0264301bb 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig31.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig31.kt @@ -16,20 +16,20 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * The configuration for the consensus protocol above catchain. - * - * @param fundamentalSmcAddr - */ +@Serializable data class BlockchainConfig31 ( - @Json(name = "fundamental_smc_addr") + @SerialName(value = "fundamental_smc_addr") val fundamentalSmcAddr: kotlin.collections.List -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig40.kt b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig40.kt index 9608879ff..15a5b3dc7 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig40.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig40.kt @@ -17,20 +17,20 @@ package io.tonapi.models import io.tonapi.models.MisbehaviourPunishmentConfig -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * The configuration for punishment for improper behavior (non-validation). In the absence of the parameter, the default fine size is 101 TON - * - * @param misbehaviourPunishmentConfig - */ +@Serializable data class BlockchainConfig40 ( - @Json(name = "misbehaviour_punishment_config") + @SerialName(value = "misbehaviour_punishment_config") val misbehaviourPunishmentConfig: MisbehaviourPunishmentConfig -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig43.kt b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig43.kt index 0158884c0..4067c1090 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig43.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig43.kt @@ -17,20 +17,20 @@ package io.tonapi.models import io.tonapi.models.SizeLimitsConfig -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * The size limits and some other characteristics of accounts and messages. - * - * @param sizeLimitsConfig - */ +@Serializable data class BlockchainConfig43 ( - @Json(name = "size_limits_config") + @SerialName(value = "size_limits_config") val sizeLimitsConfig: SizeLimitsConfig -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig44.kt b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig44.kt index 92dd429ff..3b6dfb12c 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig44.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig44.kt @@ -16,24 +16,23 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * suspended accounts - * - * @param accounts - * @param suspendedUntil - */ +@Serializable data class BlockchainConfig44 ( - @Json(name = "accounts") + @SerialName(value = "accounts") val accounts: kotlin.collections.List, - @Json(name = "suspended_until") + @SerialName(value = "suspended_until") val suspendedUntil: kotlin.Int -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig45.kt b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig45.kt new file mode 100644 index 000000000..d32a44f2a --- /dev/null +++ b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig45.kt @@ -0,0 +1,36 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package io.tonapi.models + +import io.tonapi.models.BlockchainConfig45ContractsInner + +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual + + +@Serializable + +data class BlockchainConfig45 ( + + @SerialName(value = "contracts") + val contracts: kotlin.collections.List + +) { + + +} + diff --git a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig45ContractsInner.kt b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig45ContractsInner.kt new file mode 100644 index 000000000..52611be3d --- /dev/null +++ b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig45ContractsInner.kt @@ -0,0 +1,38 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package io.tonapi.models + + +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual + + +@Serializable + +data class BlockchainConfig45ContractsInner ( + + @SerialName(value = "code_hash") + val codeHash: kotlin.String, + + @SerialName(value = "gas_usage") + val gasUsage: kotlin.Long + +) { + + +} + diff --git a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig5.kt b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig5.kt index 25974308d..244427167 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig5.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig5.kt @@ -16,28 +16,26 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param feeBurnNom - * @param feeBurnDenom - * @param blackholeAddr - */ +@Serializable data class BlockchainConfig5 ( - @Json(name = "fee_burn_nom") + @SerialName(value = "fee_burn_nom") val feeBurnNom: kotlin.Long, - @Json(name = "fee_burn_denom") + @SerialName(value = "fee_burn_denom") val feeBurnDenom: kotlin.Long, - @Json(name = "blackhole_addr") + @SerialName(value = "blackhole_addr") val blackholeAddr: kotlin.String? = null -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig6.kt b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig6.kt index 54ff078bc..9e699f373 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig6.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig6.kt @@ -16,24 +16,23 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * Minting fees of new currencies. - * - * @param mintNewPrice - * @param mintAddPrice - */ +@Serializable data class BlockchainConfig6 ( - @Json(name = "mint_new_price") + @SerialName(value = "mint_new_price") val mintNewPrice: kotlin.Long, - @Json(name = "mint_add_price") + @SerialName(value = "mint_add_price") val mintAddPrice: kotlin.Long -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig7.kt b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig7.kt index 9f68bc246..3f77ea0e4 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig7.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig7.kt @@ -17,20 +17,20 @@ package io.tonapi.models import io.tonapi.models.BlockchainConfig7CurrenciesInner -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * The volume of each of the additional currencies in circulation. - * - * @param currencies - */ +@Serializable data class BlockchainConfig7 ( - @Json(name = "currencies") + @SerialName(value = "currencies") val currencies: kotlin.collections.List -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig71.kt b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig71.kt index 2b95db0b8..fa5d8e3ea 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig71.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig71.kt @@ -17,20 +17,20 @@ package io.tonapi.models import io.tonapi.models.OracleBridgeParams -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * Bridge parameters for wrapping TON in other networks. - * - * @param oracleBridgeParams - */ +@Serializable data class BlockchainConfig71 ( - @Json(name = "oracle_bridge_params") + @SerialName(value = "oracle_bridge_params") val oracleBridgeParams: OracleBridgeParams -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig79.kt b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig79.kt index 56fc62002..c4214d80b 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig79.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig79.kt @@ -17,20 +17,20 @@ package io.tonapi.models import io.tonapi.models.JettonBridgeParams -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * Bridge parameters for wrapping tokens from other networks into tokens on the TON network. - * - * @param jettonBridgeParams - */ +@Serializable data class BlockchainConfig79 ( - @Json(name = "jetton_bridge_params") + @SerialName(value = "jetton_bridge_params") val jettonBridgeParams: JettonBridgeParams -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig7CurrenciesInner.kt b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig7CurrenciesInner.kt index 407a69ea3..8bca407f8 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig7CurrenciesInner.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig7CurrenciesInner.kt @@ -16,24 +16,23 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param currencyId - * @param amount - */ +@Serializable data class BlockchainConfig7CurrenciesInner ( - @Json(name = "currency_id") + @SerialName(value = "currency_id") val currencyId: kotlin.Long, - @Json(name = "amount") + @SerialName(value = "amount") val amount: kotlin.String -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig8.kt b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig8.kt index 1a42c92d6..9de901d76 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig8.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig8.kt @@ -16,24 +16,23 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * The network version and additional capabilities supported by the validators. - * - * @param version - * @param capabilities - */ +@Serializable data class BlockchainConfig8 ( - @Json(name = "version") + @SerialName(value = "version") val version: kotlin.Long, - @Json(name = "capabilities") + @SerialName(value = "capabilities") val capabilities: kotlin.Long -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig9.kt b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig9.kt index 2432d02fb..059fa248f 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig9.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainConfig9.kt @@ -16,20 +16,20 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * List of mandatory parameters of the blockchain config. - * - * @param mandatoryParams - */ +@Serializable data class BlockchainConfig9 ( - @Json(name = "mandatory_params") + @SerialName(value = "mandatory_params") val mandatoryParams: kotlin.collections.List -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/DecodeMessageRequest.kt b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainLibrary.kt similarity index 61% rename from tonapi/src/main/kotlin/io/tonapi/models/DecodeMessageRequest.kt rename to tonapi/src/main/kotlin/io/tonapi/models/BlockchainLibrary.kt index 177132120..426ccec21 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/DecodeMessageRequest.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainLibrary.kt @@ -16,20 +16,20 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param boc - */ +@Serializable -data class DecodeMessageRequest ( +data class BlockchainLibrary ( - @Json(name = "boc") + @SerialName(value = "boc") val boc: kotlin.String -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainRawAccount.kt b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainRawAccount.kt index 6942c8a55..87bf76fe7 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainRawAccount.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainRawAccount.kt @@ -18,61 +18,52 @@ package io.tonapi.models import io.tonapi.models.AccountStatus import io.tonapi.models.AccountStorageInfo import io.tonapi.models.BlockchainRawAccountLibrariesInner +import io.tonapi.models.ExtraCurrency -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param address - * @param balance - * @param lastTransactionLt - * @param status - * @param storage - * @param extraBalance - * @param code - * @param `data` - * @param lastTransactionHash - * @param frozenHash - * @param libraries - */ +@Serializable data class BlockchainRawAccount ( - @Json(name = "address") + @SerialName(value = "address") val address: kotlin.String, - @Json(name = "balance") + @SerialName(value = "balance") val balance: kotlin.Long, - @Json(name = "last_transaction_lt") + @SerialName(value = "last_transaction_lt") val lastTransactionLt: kotlin.Long, - @Json(name = "status") + @Contextual @SerialName(value = "status") val status: AccountStatus, - @Json(name = "storage") + @SerialName(value = "storage") val storage: AccountStorageInfo, - @Json(name = "extra_balance") - val extraBalance: kotlin.collections.Map? = null, + @SerialName(value = "extra_balance") + val extraBalance: kotlin.collections.List? = null, - @Json(name = "code") + @SerialName(value = "code") val code: kotlin.String? = null, - @Json(name = "data") + @SerialName(value = "data") val `data`: kotlin.String? = null, - @Json(name = "last_transaction_hash") + @SerialName(value = "last_transaction_hash") val lastTransactionHash: kotlin.String? = null, - @Json(name = "frozen_hash") + @SerialName(value = "frozen_hash") val frozenHash: kotlin.String? = null, - @Json(name = "libraries") + @SerialName(value = "libraries") val libraries: kotlin.collections.List? = null -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainRawAccountLibrariesInner.kt b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainRawAccountLibrariesInner.kt index 9d1e86e0b..f496ab4fc 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainRawAccountLibrariesInner.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/BlockchainRawAccountLibrariesInner.kt @@ -16,24 +16,23 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param `public` - * @param root - */ +@Serializable data class BlockchainRawAccountLibrariesInner ( - @Json(name = "public") + @SerialName(value = "public") val `public`: kotlin.Boolean, - @Json(name = "root") + @SerialName(value = "root") val root: kotlin.String -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/BouncePhaseType.kt b/tonapi/src/main/kotlin/io/tonapi/models/BouncePhaseType.kt index 38bc00893..7c129e290 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/BouncePhaseType.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/BouncePhaseType.kt @@ -16,26 +16,25 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable /** * * - * Values: trPhaseBounceNegfunds,trPhaseBounceNofunds,trPhaseBounceOk + * Values: TrPhaseBounceNegfunds,TrPhaseBounceNofunds,TrPhaseBounceOk */ - -@JsonClass(generateAdapter = false) +@Serializable enum class BouncePhaseType(val value: kotlin.String) { - @Json(name = "TrPhaseBounceNegfunds") - trPhaseBounceNegfunds("TrPhaseBounceNegfunds"), + @SerialName(value = "TrPhaseBounceNegfunds") + TrPhaseBounceNegfunds("TrPhaseBounceNegfunds"), - @Json(name = "TrPhaseBounceNofunds") - trPhaseBounceNofunds("TrPhaseBounceNofunds"), + @SerialName(value = "TrPhaseBounceNofunds") + TrPhaseBounceNofunds("TrPhaseBounceNofunds"), - @Json(name = "TrPhaseBounceOk") - trPhaseBounceOk("TrPhaseBounceOk"); + @SerialName(value = "TrPhaseBounceOk") + TrPhaseBounceOk("TrPhaseBounceOk"); /** * Override [toString()] to avoid using the enum variable name as the value, and instead use diff --git a/tonapi/src/main/kotlin/io/tonapi/models/ComputePhase.kt b/tonapi/src/main/kotlin/io/tonapi/models/ComputePhase.kt index 5334ddb92..79159cdd9 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/ComputePhase.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/ComputePhase.kt @@ -17,48 +17,41 @@ package io.tonapi.models import io.tonapi.models.ComputeSkipReason -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param skipped - * @param skipReason - * @param success - * @param gasFees - * @param gasUsed - * @param vmSteps - * @param exitCode - * @param exitCodeDescription - */ +@Serializable data class ComputePhase ( - @Json(name = "skipped") + @SerialName(value = "skipped") val skipped: kotlin.Boolean, - @Json(name = "skip_reason") + @Contextual @SerialName(value = "skip_reason") val skipReason: ComputeSkipReason? = null, - @Json(name = "success") + @SerialName(value = "success") val success: kotlin.Boolean? = null, - @Json(name = "gas_fees") + @SerialName(value = "gas_fees") val gasFees: kotlin.Long? = null, - @Json(name = "gas_used") + @SerialName(value = "gas_used") val gasUsed: kotlin.Long? = null, - @Json(name = "vm_steps") + @SerialName(value = "vm_steps") val vmSteps: kotlin.Int? = null, - @Json(name = "exit_code") + @SerialName(value = "exit_code") val exitCode: kotlin.Int? = null, - @Json(name = "exit_code_description") + @SerialName(value = "exit_code_description") val exitCodeDescription: kotlin.String? = null -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/ComputeSkipReason.kt b/tonapi/src/main/kotlin/io/tonapi/models/ComputeSkipReason.kt index 7e134887e..5eb19e955 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/ComputeSkipReason.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/ComputeSkipReason.kt @@ -16,26 +16,28 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable /** * * - * Values: noState,badState,noGas + * Values: cskip_no_state,cskip_bad_state,cskip_no_gas,cskip_suspended */ - -@JsonClass(generateAdapter = false) +@Serializable enum class ComputeSkipReason(val value: kotlin.String) { - @Json(name = "cskip_no_state") - noState("cskip_no_state"), + @SerialName(value = "cskip_no_state") + cskip_no_state("cskip_no_state"), + + @SerialName(value = "cskip_bad_state") + cskip_bad_state("cskip_bad_state"), - @Json(name = "cskip_bad_state") - badState("cskip_bad_state"), + @SerialName(value = "cskip_no_gas") + cskip_no_gas("cskip_no_gas"), - @Json(name = "cskip_no_gas") - noGas("cskip_no_gas"); + @SerialName(value = "cskip_suspended") + cskip_suspended("cskip_suspended"); /** * Override [toString()] to avoid using the enum variable name as the value, and instead use diff --git a/tonapi/src/main/kotlin/io/tonapi/models/ConfigProposalSetup.kt b/tonapi/src/main/kotlin/io/tonapi/models/ConfigProposalSetup.kt index 8059e7036..6743a9354 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/ConfigProposalSetup.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/ConfigProposalSetup.kt @@ -16,48 +16,41 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param minTotRounds - * @param maxTotRounds - * @param minWins - * @param maxLosses - * @param minStoreSec - * @param maxStoreSec - * @param bitPrice - * @param cellPrice - */ +@Serializable data class ConfigProposalSetup ( - @Json(name = "min_tot_rounds") + @SerialName(value = "min_tot_rounds") val minTotRounds: kotlin.Int, - @Json(name = "max_tot_rounds") + @SerialName(value = "max_tot_rounds") val maxTotRounds: kotlin.Int, - @Json(name = "min_wins") + @SerialName(value = "min_wins") val minWins: kotlin.Int, - @Json(name = "max_losses") + @SerialName(value = "max_losses") val maxLosses: kotlin.Int, - @Json(name = "min_store_sec") + @SerialName(value = "min_store_sec") val minStoreSec: kotlin.Long, - @Json(name = "max_store_sec") + @SerialName(value = "max_store_sec") val maxStoreSec: kotlin.Long, - @Json(name = "bit_price") + @SerialName(value = "bit_price") val bitPrice: kotlin.Long, - @Json(name = "cell_price") + @SerialName(value = "cell_price") val cellPrice: kotlin.Long -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/ContractDeployAction.kt b/tonapi/src/main/kotlin/io/tonapi/models/ContractDeployAction.kt index 893b04221..fb8501473 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/ContractDeployAction.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/ContractDeployAction.kt @@ -16,24 +16,23 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param address - * @param interfaces - */ +@Serializable data class ContractDeployAction ( - @Json(name = "address") + @SerialName(value = "address") val address: kotlin.String, - @Json(name = "interfaces") + @SerialName(value = "interfaces") val interfaces: kotlin.collections.List -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/CreditPhase.kt b/tonapi/src/main/kotlin/io/tonapi/models/CreditPhase.kt index 79cbed997..461f08888 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/CreditPhase.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/CreditPhase.kt @@ -16,24 +16,23 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param feesCollected - * @param credit - */ +@Serializable data class CreditPhase ( - @Json(name = "fees_collected") + @SerialName(value = "fees_collected") val feesCollected: kotlin.Long, - @Json(name = "credit") + @SerialName(value = "credit") val credit: kotlin.Long -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/CurrencyType.kt b/tonapi/src/main/kotlin/io/tonapi/models/CurrencyType.kt new file mode 100644 index 000000000..3ddafd534 --- /dev/null +++ b/tonapi/src/main/kotlin/io/tonapi/models/CurrencyType.kt @@ -0,0 +1,68 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package io.tonapi.models + + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +/** + * + * + * Values: native,extra_currency,jetton,fiat + */ +@Serializable +enum class CurrencyType(val value: kotlin.String) { + + @SerialName(value = "native") + native("native"), + + @SerialName(value = "extra_currency") + extra_currency("extra_currency"), + + @SerialName(value = "jetton") + jetton("jetton"), + + @SerialName(value = "fiat") + fiat("fiat"); + + /** + * Override [toString()] to avoid using the enum variable name as the value, and instead use + * the actual value defined in the API spec file. + * + * This solves a problem when the variable name and its value are different, and ensures that + * the client sends the correct enum values to the server always. + */ + override fun toString(): kotlin.String = value + + companion object { + /** + * Converts the provided [data] to a [String] on success, null otherwise. + */ + fun encode(data: kotlin.Any?): kotlin.String? = if (data is CurrencyType) "$data" else null + + /** + * Returns a valid [CurrencyType] for [data], null otherwise. + */ + fun decode(data: kotlin.Any?): CurrencyType? = data?.let { + val normalizedData = "$it".lowercase() + values().firstOrNull { value -> + it == value || normalizedData == "$value".lowercase() + } + } + } +} + diff --git a/tonapi/src/main/kotlin/io/tonapi/models/DecodedMessage.kt b/tonapi/src/main/kotlin/io/tonapi/models/DecodedMessage.kt index 79ed72d8d..6bc3d4286 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/DecodedMessage.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/DecodedMessage.kt @@ -18,28 +18,26 @@ package io.tonapi.models import io.tonapi.models.AccountAddress import io.tonapi.models.DecodedMessageExtInMsgDecoded -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param destination - * @param destinationWalletVersion - * @param extInMsgDecoded - */ +@Serializable data class DecodedMessage ( - @Json(name = "destination") + @SerialName(value = "destination") val destination: AccountAddress, - @Json(name = "destination_wallet_version") + @SerialName(value = "destination_wallet_version") val destinationWalletVersion: kotlin.String, - @Json(name = "ext_in_msg_decoded") + @SerialName(value = "ext_in_msg_decoded") val extInMsgDecoded: DecodedMessageExtInMsgDecoded? = null -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/DecodedMessageExtInMsgDecoded.kt b/tonapi/src/main/kotlin/io/tonapi/models/DecodedMessageExtInMsgDecoded.kt index 5029b91e6..1c766ba9b 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/DecodedMessageExtInMsgDecoded.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/DecodedMessageExtInMsgDecoded.kt @@ -18,29 +18,31 @@ package io.tonapi.models import io.tonapi.models.DecodedMessageExtInMsgDecodedWalletHighloadV2 import io.tonapi.models.DecodedMessageExtInMsgDecodedWalletV3 import io.tonapi.models.DecodedMessageExtInMsgDecodedWalletV4 +import io.tonapi.models.DecodedMessageExtInMsgDecodedWalletV5 -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param walletV3 - * @param walletV4 - * @param walletHighloadV2 - */ +@Serializable data class DecodedMessageExtInMsgDecoded ( - @Json(name = "wallet_v3") + @SerialName(value = "wallet_v3") val walletV3: DecodedMessageExtInMsgDecodedWalletV3? = null, - @Json(name = "wallet_v4") + @SerialName(value = "wallet_v4") val walletV4: DecodedMessageExtInMsgDecodedWalletV4? = null, - @Json(name = "wallet_highload_v2") + @SerialName(value = "wallet_v5") + val walletV5: DecodedMessageExtInMsgDecodedWalletV5? = null, + + @SerialName(value = "wallet_highload_v2") val walletHighloadV2: DecodedMessageExtInMsgDecodedWalletHighloadV2? = null -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/DecodedMessageExtInMsgDecodedWalletHighloadV2.kt b/tonapi/src/main/kotlin/io/tonapi/models/DecodedMessageExtInMsgDecodedWalletHighloadV2.kt index b5b5b9a7b..d58c1c183 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/DecodedMessageExtInMsgDecodedWalletHighloadV2.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/DecodedMessageExtInMsgDecodedWalletHighloadV2.kt @@ -17,28 +17,26 @@ package io.tonapi.models import io.tonapi.models.DecodedRawMessage -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param subwalletId - * @param boundedQueryId - * @param rawMessages - */ +@Serializable data class DecodedMessageExtInMsgDecodedWalletHighloadV2 ( - @Json(name = "subwallet_id") + @SerialName(value = "subwallet_id") val subwalletId: kotlin.Long, - @Json(name = "bounded_query_id") + @SerialName(value = "bounded_query_id") val boundedQueryId: kotlin.String, - @Json(name = "raw_messages") + @SerialName(value = "raw_messages") val rawMessages: kotlin.collections.List -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/DecodedMessageExtInMsgDecodedWalletV3.kt b/tonapi/src/main/kotlin/io/tonapi/models/DecodedMessageExtInMsgDecodedWalletV3.kt index 437eba846..08659a0fd 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/DecodedMessageExtInMsgDecodedWalletV3.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/DecodedMessageExtInMsgDecodedWalletV3.kt @@ -17,32 +17,29 @@ package io.tonapi.models import io.tonapi.models.DecodedRawMessage -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param subwalletId - * @param validUntil - * @param seqno - * @param rawMessages - */ +@Serializable data class DecodedMessageExtInMsgDecodedWalletV3 ( - @Json(name = "subwallet_id") + @SerialName(value = "subwallet_id") val subwalletId: kotlin.Long, - @Json(name = "valid_until") + @SerialName(value = "valid_until") val validUntil: kotlin.Long, - @Json(name = "seqno") + @SerialName(value = "seqno") val seqno: kotlin.Long, - @Json(name = "raw_messages") + @SerialName(value = "raw_messages") val rawMessages: kotlin.collections.List -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/DecodedMessageExtInMsgDecodedWalletV4.kt b/tonapi/src/main/kotlin/io/tonapi/models/DecodedMessageExtInMsgDecodedWalletV4.kt index 1cb9c74c0..c055e9cd2 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/DecodedMessageExtInMsgDecodedWalletV4.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/DecodedMessageExtInMsgDecodedWalletV4.kt @@ -17,36 +17,32 @@ package io.tonapi.models import io.tonapi.models.DecodedRawMessage -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param subwalletId - * @param validUntil - * @param seqno - * @param op - * @param rawMessages - */ +@Serializable data class DecodedMessageExtInMsgDecodedWalletV4 ( - @Json(name = "subwallet_id") + @SerialName(value = "subwallet_id") val subwalletId: kotlin.Long, - @Json(name = "valid_until") + @SerialName(value = "valid_until") val validUntil: kotlin.Long, - @Json(name = "seqno") + @SerialName(value = "seqno") val seqno: kotlin.Long, - @Json(name = "op") + @SerialName(value = "op") val op: kotlin.Int, - @Json(name = "raw_messages") + @SerialName(value = "raw_messages") val rawMessages: kotlin.collections.List -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/DecodedMessageExtInMsgDecodedWalletV5.kt b/tonapi/src/main/kotlin/io/tonapi/models/DecodedMessageExtInMsgDecodedWalletV5.kt new file mode 100644 index 000000000..2cb4d6123 --- /dev/null +++ b/tonapi/src/main/kotlin/io/tonapi/models/DecodedMessageExtInMsgDecodedWalletV5.kt @@ -0,0 +1,39 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package io.tonapi.models + +import io.tonapi.models.DecodedRawMessage + +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual + + +@Serializable + +data class DecodedMessageExtInMsgDecodedWalletV5 ( + + @SerialName(value = "valid_until") + val validUntil: kotlin.Long, + + @SerialName(value = "raw_messages") + val rawMessages: kotlin.collections.List + +) { + + +} + diff --git a/tonapi/src/main/kotlin/io/tonapi/models/DecodedRawMessage.kt b/tonapi/src/main/kotlin/io/tonapi/models/DecodedRawMessage.kt index 0d8d535b5..ccb207d06 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/DecodedRawMessage.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/DecodedRawMessage.kt @@ -17,24 +17,23 @@ package io.tonapi.models import io.tonapi.models.DecodedRawMessageMessage -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param message - * @param mode - */ +@Serializable data class DecodedRawMessage ( - @Json(name = "message") + @SerialName(value = "message") val message: DecodedRawMessageMessage, - @Json(name = "mode") + @SerialName(value = "mode") val mode: kotlin.Int -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/DecodedRawMessageMessage.kt b/tonapi/src/main/kotlin/io/tonapi/models/DecodedRawMessageMessage.kt index 9a538c3ee..4a7393e6c 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/DecodedRawMessageMessage.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/DecodedRawMessageMessage.kt @@ -16,32 +16,29 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param boc - * @param decodedOpName - * @param opCode - * @param decodedBody - */ +@Serializable data class DecodedRawMessageMessage ( - @Json(name = "boc") + @SerialName(value = "boc") val boc: kotlin.String, - @Json(name = "decoded_op_name") + @SerialName(value = "decoded_op_name") val decodedOpName: kotlin.String? = null, - @Json(name = "op_code") + @SerialName(value = "op_code") val opCode: kotlin.String? = null, - @Json(name = "decoded_body") + @Contextual @SerialName(value = "decoded_body") val decodedBody: kotlin.Any? = null -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/DepositStakeAction.kt b/tonapi/src/main/kotlin/io/tonapi/models/DepositStakeAction.kt index b2bb0bc52..40a13b253 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/DepositStakeAction.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/DepositStakeAction.kt @@ -18,32 +18,29 @@ package io.tonapi.models import io.tonapi.models.AccountAddress import io.tonapi.models.PoolImplementationType -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * validator's participation in elections - * - * @param amount - * @param staker - * @param pool - * @param implementation - */ +@Serializable data class DepositStakeAction ( - @Json(name = "amount") + @SerialName(value = "amount") val amount: kotlin.Long, - @Json(name = "staker") + @SerialName(value = "staker") val staker: AccountAddress, - @Json(name = "pool") + @SerialName(value = "pool") val pool: AccountAddress, - @Json(name = "implementation") + @Contextual @SerialName(value = "implementation") val implementation: PoolImplementationType -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/DnsExpiring.kt b/tonapi/src/main/kotlin/io/tonapi/models/DnsExpiring.kt index c9663f4f2..f09f37505 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/DnsExpiring.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/DnsExpiring.kt @@ -17,20 +17,20 @@ package io.tonapi.models import io.tonapi.models.DnsExpiringItemsInner -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param items - */ +@Serializable data class DnsExpiring ( - @Json(name = "items") + @SerialName(value = "items") val items: kotlin.collections.List -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/DnsExpiringItemsInner.kt b/tonapi/src/main/kotlin/io/tonapi/models/DnsExpiringItemsInner.kt index 3c5e68fff..1ace1e467 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/DnsExpiringItemsInner.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/DnsExpiringItemsInner.kt @@ -17,28 +17,26 @@ package io.tonapi.models import io.tonapi.models.NftItem -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param expiringAt - * @param name - * @param dnsItem - */ +@Serializable data class DnsExpiringItemsInner ( - @Json(name = "expiring_at") + @SerialName(value = "expiring_at") val expiringAt: kotlin.Long, - @Json(name = "name") + @SerialName(value = "name") val name: kotlin.String, - @Json(name = "dns_item") + @SerialName(value = "dns_item") val dnsItem: NftItem? = null -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/DnsRecord.kt b/tonapi/src/main/kotlin/io/tonapi/models/DnsRecord.kt index aa6005d0f..565e7cedf 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/DnsRecord.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/DnsRecord.kt @@ -17,33 +17,30 @@ package io.tonapi.models import io.tonapi.models.WalletDNS -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param sites - * @param wallet - * @param nextResolver - * @param storage tonstorage bag id - */ +@Serializable data class DnsRecord ( - @Json(name = "sites") + @SerialName(value = "sites") val sites: kotlin.collections.List, - @Json(name = "wallet") + @SerialName(value = "wallet") val wallet: WalletDNS? = null, - @Json(name = "next_resolver") + @SerialName(value = "next_resolver") val nextResolver: kotlin.String? = null, /* tonstorage bag id */ - @Json(name = "storage") + @SerialName(value = "storage") val storage: kotlin.String? = null -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/DomainBid.kt b/tonapi/src/main/kotlin/io/tonapi/models/DomainBid.kt index 13bfcf238..92ec064ae 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/DomainBid.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/DomainBid.kt @@ -17,36 +17,32 @@ package io.tonapi.models import io.tonapi.models.AccountAddress -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param success - * @param `value` - * @param txTime - * @param txHash - * @param bidder - */ +@Serializable data class DomainBid ( - @Json(name = "success") + @SerialName(value = "success") val success: kotlin.Boolean = false, - @Json(name = "value") + @SerialName(value = "value") val `value`: kotlin.Long, - @Json(name = "txTime") + @SerialName(value = "txTime") val txTime: kotlin.Long, - @Json(name = "txHash") + @SerialName(value = "txHash") val txHash: kotlin.String, - @Json(name = "bidder") + @SerialName(value = "bidder") val bidder: AccountAddress -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/DomainBids.kt b/tonapi/src/main/kotlin/io/tonapi/models/DomainBids.kt index 90dc604d1..cf606fd4d 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/DomainBids.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/DomainBids.kt @@ -17,20 +17,20 @@ package io.tonapi.models import io.tonapi.models.DomainBid -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param `data` - */ +@Serializable data class DomainBids ( - @Json(name = "data") + @SerialName(value = "data") val `data`: kotlin.collections.List -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/DomainInfo.kt b/tonapi/src/main/kotlin/io/tonapi/models/DomainInfo.kt index 98b98b653..0918f3c72 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/DomainInfo.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/DomainInfo.kt @@ -17,29 +17,27 @@ package io.tonapi.models import io.tonapi.models.NftItem -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param name - * @param expiringAt date of expiring. optional. not all domain in ton has expiration date - * @param item - */ +@Serializable data class DomainInfo ( - @Json(name = "name") + @SerialName(value = "name") val name: kotlin.String, /* date of expiring. optional. not all domain in ton has expiration date */ - @Json(name = "expiring_at") + @SerialName(value = "expiring_at") val expiringAt: kotlin.Long? = null, - @Json(name = "item") + @SerialName(value = "item") val item: NftItem? = null -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/DomainNames.kt b/tonapi/src/main/kotlin/io/tonapi/models/DomainNames.kt index 6f219ede5..6761ea470 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/DomainNames.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/DomainNames.kt @@ -16,20 +16,20 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param domains - */ +@Serializable data class DomainNames ( - @Json(name = "domains") + @SerialName(value = "domains") val domains: kotlin.collections.List -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/DomainRenewAction.kt b/tonapi/src/main/kotlin/io/tonapi/models/DomainRenewAction.kt index c0fc2a463..0de029e91 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/DomainRenewAction.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/DomainRenewAction.kt @@ -17,28 +17,26 @@ package io.tonapi.models import io.tonapi.models.AccountAddress -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param domain - * @param contractAddress - * @param renewer - */ +@Serializable data class DomainRenewAction ( - @Json(name = "domain") + @SerialName(value = "domain") val domain: kotlin.String, - @Json(name = "contract_address") + @SerialName(value = "contract_address") val contractAddress: kotlin.String, - @Json(name = "renewer") + @SerialName(value = "renewer") val renewer: AccountAddress -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/EcPreview.kt b/tonapi/src/main/kotlin/io/tonapi/models/EcPreview.kt new file mode 100644 index 000000000..ca698cff9 --- /dev/null +++ b/tonapi/src/main/kotlin/io/tonapi/models/EcPreview.kt @@ -0,0 +1,44 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package io.tonapi.models + + +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual + + +@Serializable + +data class EcPreview ( + + @SerialName(value = "id") + val id: kotlin.Int, + + @SerialName(value = "symbol") + val symbol: kotlin.String, + + @SerialName(value = "decimals") + val decimals: kotlin.Int, + + @SerialName(value = "image") + val image: kotlin.String + +) { + + +} + diff --git a/tonapi/src/main/kotlin/io/tonapi/models/ElectionsDepositStakeAction.kt b/tonapi/src/main/kotlin/io/tonapi/models/ElectionsDepositStakeAction.kt index 28339925c..80f1b5310 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/ElectionsDepositStakeAction.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/ElectionsDepositStakeAction.kt @@ -17,24 +17,23 @@ package io.tonapi.models import io.tonapi.models.AccountAddress -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param amount - * @param staker - */ +@Serializable data class ElectionsDepositStakeAction ( - @Json(name = "amount") + @SerialName(value = "amount") val amount: kotlin.Long, - @Json(name = "staker") + @SerialName(value = "staker") val staker: AccountAddress -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/ElectionsRecoverStakeAction.kt b/tonapi/src/main/kotlin/io/tonapi/models/ElectionsRecoverStakeAction.kt index b8823aa39..41f480b1d 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/ElectionsRecoverStakeAction.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/ElectionsRecoverStakeAction.kt @@ -17,24 +17,23 @@ package io.tonapi.models import io.tonapi.models.AccountAddress -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param amount - * @param staker - */ +@Serializable data class ElectionsRecoverStakeAction ( - @Json(name = "amount") + @SerialName(value = "amount") val amount: kotlin.Long, - @Json(name = "staker") + @SerialName(value = "staker") val staker: AccountAddress -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/EmulateMessageToWalletRequest.kt b/tonapi/src/main/kotlin/io/tonapi/models/EmulateMessageToWalletRequest.kt index c920aa846..97195b032 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/EmulateMessageToWalletRequest.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/EmulateMessageToWalletRequest.kt @@ -17,27 +17,24 @@ package io.tonapi.models import io.tonapi.models.EmulateMessageToWalletRequestParamsInner -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param boc - * @param params additional per account configuration - */ +@Serializable data class EmulateMessageToWalletRequest ( - @Json(name = "boc") + @SerialName(value = "boc") val boc: kotlin.String, /* additional per account configuration */ - @Json(name = "params") - val params: kotlin.collections.List? = null, + @SerialName(value = "params") + val params: kotlin.collections.List? = null - @Json(name = "safe_mode") - val safeMode: kotlin.Boolean? = null -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/EmulateMessageToWalletRequestParamsInner.kt b/tonapi/src/main/kotlin/io/tonapi/models/EmulateMessageToWalletRequestParamsInner.kt index 8b8ee6eac..5cf8a4b78 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/EmulateMessageToWalletRequestParamsInner.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/EmulateMessageToWalletRequestParamsInner.kt @@ -16,24 +16,23 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param address - * @param balance - */ +@Serializable data class EmulateMessageToWalletRequestParamsInner ( - @Json(name = "address") + @SerialName(value = "address") val address: kotlin.String, - @Json(name = "balance") + @SerialName(value = "balance") val balance: kotlin.Long? = null -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/EncryptedComment.kt b/tonapi/src/main/kotlin/io/tonapi/models/EncryptedComment.kt index 666e08a1a..e06827149 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/EncryptedComment.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/EncryptedComment.kt @@ -16,24 +16,23 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param encryptionType - * @param cipherText - */ +@Serializable data class EncryptedComment ( - @Json(name = "encryption_type") + @SerialName(value = "encryption_type") val encryptionType: kotlin.String, - @Json(name = "cipher_text") + @SerialName(value = "cipher_text") val cipherText: kotlin.String -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/Error.kt b/tonapi/src/main/kotlin/io/tonapi/models/Error.kt index 606ec9d81..83e746aba 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/Error.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/Error.kt @@ -16,20 +16,20 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param error - */ +@Serializable data class Error ( - @Json(name = "error") + @SerialName(value = "error") val error: kotlin.String -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/Event.kt b/tonapi/src/main/kotlin/io/tonapi/models/Event.kt index dc906d010..b54c4f142 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/Event.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/Event.kt @@ -18,46 +18,43 @@ package io.tonapi.models import io.tonapi.models.Action import io.tonapi.models.ValueFlow -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param eventId - * @param timestamp - * @param actions - * @param valueFlow - * @param isScam scam - * @param lt - * @param inProgress Event is not finished yet. Transactions still happening - */ +@Serializable data class Event ( - @Json(name = "event_id") + @SerialName(value = "event_id") val eventId: kotlin.String, - @Json(name = "timestamp") + @SerialName(value = "timestamp") val timestamp: kotlin.Long, - @Json(name = "actions") + @SerialName(value = "actions") val actions: kotlin.collections.List, - @Json(name = "value_flow") + @SerialName(value = "value_flow") val valueFlow: kotlin.collections.List, /* scam */ - @Json(name = "is_scam") + @SerialName(value = "is_scam") val isScam: kotlin.Boolean, - @Json(name = "lt") + @SerialName(value = "lt") val lt: kotlin.Long, /* Event is not finished yet. Transactions still happening */ - @Json(name = "in_progress") - val inProgress: kotlin.Boolean + @SerialName(value = "in_progress") + val inProgress: kotlin.Boolean, -) + @SerialName(value = "progress") + val progress: kotlin.Float + +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/ExecGetMethodArg.kt b/tonapi/src/main/kotlin/io/tonapi/models/ExecGetMethodArg.kt new file mode 100644 index 000000000..8825337b8 --- /dev/null +++ b/tonapi/src/main/kotlin/io/tonapi/models/ExecGetMethodArg.kt @@ -0,0 +1,40 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package io.tonapi.models + +import io.tonapi.models.ExecGetMethodArgType + +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual + + +@Serializable + +data class ExecGetMethodArg ( + + @Contextual @SerialName(value = "type") + val type: ExecGetMethodArgType, + + /* String representation of the value according to the specified type */ + @SerialName(value = "value") + val `value`: kotlin.String + +) { + + +} + diff --git a/tonapi/src/main/kotlin/io/tonapi/models/ExecGetMethodArgType.kt b/tonapi/src/main/kotlin/io/tonapi/models/ExecGetMethodArgType.kt new file mode 100644 index 000000000..72dd08d5b --- /dev/null +++ b/tonapi/src/main/kotlin/io/tonapi/models/ExecGetMethodArgType.kt @@ -0,0 +1,77 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package io.tonapi.models + + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +/** + * Data type of the argument value: - `nan`: Not-a-Number value - `null`: Null value - `tinyint`: Decimal integer (e.g., `100500`) - `int257`: 257-bit integer in hex format with 0x prefix (e.g., `0xfa01d78381ae32`) - `slice`: TON blockchain address (e.g., `0:6e731f2e...`) - `cell_boc_base64`: Base64-encoded cell BOC (Binary Object Code) (e.g., `te6ccgEBAQEAAgAAAA==`) - `slice_boc_hex`: Hex-encoded slice BOC (e.g., `b5ee9c72...`) + * + * Values: nan,`null`,tinyint,int257,slice,cell_boc_base64,slice_boc_hex + */ +@Serializable +enum class ExecGetMethodArgType(val value: kotlin.String) { + + @SerialName(value = "nan") + nan("nan"), + + @SerialName(value = "null") + `null`("null"), + + @SerialName(value = "tinyint") + tinyint("tinyint"), + + @SerialName(value = "int257") + int257("int257"), + + @SerialName(value = "slice") + slice("slice"), + + @SerialName(value = "cell_boc_base64") + cell_boc_base64("cell_boc_base64"), + + @SerialName(value = "slice_boc_hex") + slice_boc_hex("slice_boc_hex"); + + /** + * Override [toString()] to avoid using the enum variable name as the value, and instead use + * the actual value defined in the API spec file. + * + * This solves a problem when the variable name and its value are different, and ensures that + * the client sends the correct enum values to the server always. + */ + override fun toString(): kotlin.String = value + + companion object { + /** + * Converts the provided [data] to a [String] on success, null otherwise. + */ + fun encode(data: kotlin.Any?): kotlin.String? = if (data is ExecGetMethodArgType) "$data" else null + + /** + * Returns a valid [ExecGetMethodArgType] for [data], null otherwise. + */ + fun decode(data: kotlin.Any?): ExecGetMethodArgType? = data?.let { + val normalizedData = "$it".lowercase() + values().firstOrNull { value -> + it == value || normalizedData == "$value".lowercase() + } + } + } +} + diff --git a/tonapi/src/main/kotlin/io/tonapi/models/ExecGetMethodWithBodyForBlockchainAccountRequest.kt b/tonapi/src/main/kotlin/io/tonapi/models/ExecGetMethodWithBodyForBlockchainAccountRequest.kt new file mode 100644 index 000000000..ef1d2b148 --- /dev/null +++ b/tonapi/src/main/kotlin/io/tonapi/models/ExecGetMethodWithBodyForBlockchainAccountRequest.kt @@ -0,0 +1,36 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package io.tonapi.models + +import io.tonapi.models.ExecGetMethodArg + +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual + + +@Serializable + +data class ExecGetMethodWithBodyForBlockchainAccountRequest ( + + @SerialName(value = "args") + val args: kotlin.collections.List + +) { + + +} + diff --git a/tonapi/src/main/kotlin/io/tonapi/models/ExtraCurrencies.kt b/tonapi/src/main/kotlin/io/tonapi/models/ExtraCurrencies.kt new file mode 100644 index 000000000..3151b81a4 --- /dev/null +++ b/tonapi/src/main/kotlin/io/tonapi/models/ExtraCurrencies.kt @@ -0,0 +1,36 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package io.tonapi.models + +import io.tonapi.models.EcPreview + +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual + + +@Serializable + +data class ExtraCurrencies ( + + @SerialName(value = "extra_currencies") + val extraCurrencies: kotlin.collections.List + +) { + + +} + diff --git a/tonapi/src/main/kotlin/io/tonapi/models/ExtraCurrency.kt b/tonapi/src/main/kotlin/io/tonapi/models/ExtraCurrency.kt new file mode 100644 index 000000000..e165da151 --- /dev/null +++ b/tonapi/src/main/kotlin/io/tonapi/models/ExtraCurrency.kt @@ -0,0 +1,39 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package io.tonapi.models + +import io.tonapi.models.EcPreview + +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual + + +@Serializable + +data class ExtraCurrency ( + + @SerialName(value = "amount") + val amount: kotlin.String, + + @SerialName(value = "preview") + val preview: EcPreview + +) { + + +} + diff --git a/tonapi/src/main/kotlin/io/tonapi/models/ExtraCurrencyTransferAction.kt b/tonapi/src/main/kotlin/io/tonapi/models/ExtraCurrencyTransferAction.kt new file mode 100644 index 000000000..34ee25bc3 --- /dev/null +++ b/tonapi/src/main/kotlin/io/tonapi/models/ExtraCurrencyTransferAction.kt @@ -0,0 +1,54 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package io.tonapi.models + +import io.tonapi.models.AccountAddress +import io.tonapi.models.EcPreview +import io.tonapi.models.EncryptedComment + +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual + + +@Serializable + +data class ExtraCurrencyTransferAction ( + + @SerialName(value = "sender") + val sender: AccountAddress, + + @SerialName(value = "recipient") + val recipient: AccountAddress, + + /* amount in quanta of tokens */ + @SerialName(value = "amount") + val amount: kotlin.String, + + @SerialName(value = "currency") + val currency: EcPreview, + + @SerialName(value = "comment") + val comment: kotlin.String? = null, + + @SerialName(value = "encrypted_comment") + val encryptedComment: EncryptedComment? = null + +) { + + +} + diff --git a/tonapi/src/main/kotlin/io/tonapi/models/FoundAccounts.kt b/tonapi/src/main/kotlin/io/tonapi/models/FoundAccounts.kt index d319d1db0..4a02bcee7 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/FoundAccounts.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/FoundAccounts.kt @@ -17,20 +17,20 @@ package io.tonapi.models import io.tonapi.models.FoundAccountsAddressesInner -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param addresses - */ +@Serializable data class FoundAccounts ( - @Json(name = "addresses") + @SerialName(value = "addresses") val addresses: kotlin.collections.List -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/FoundAccountsAddressesInner.kt b/tonapi/src/main/kotlin/io/tonapi/models/FoundAccountsAddressesInner.kt index 6f7f078be..217c2b143 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/FoundAccountsAddressesInner.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/FoundAccountsAddressesInner.kt @@ -15,29 +15,31 @@ package io.tonapi.models +import io.tonapi.models.TrustType -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param address - * @param name - * @param preview - */ +@Serializable data class FoundAccountsAddressesInner ( - @Json(name = "address") + @SerialName(value = "address") val address: kotlin.String, - @Json(name = "name") + @SerialName(value = "name") val name: kotlin.String, - @Json(name = "preview") - val preview: kotlin.String + @SerialName(value = "preview") + val preview: kotlin.String, -) + @Contextual @SerialName(value = "trust") + val trust: TrustType + +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/GasLimitPrices.kt b/tonapi/src/main/kotlin/io/tonapi/models/GasLimitPrices.kt index 3385ee989..6a82b30b2 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/GasLimitPrices.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/GasLimitPrices.kt @@ -16,52 +16,44 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param gasPrice - * @param gasLimit - * @param gasCredit - * @param blockGasLimit - * @param freezeDueLimit - * @param deleteDueLimit - * @param specialGasLimit - * @param flatGasLimit - * @param flatGasPrice - */ +@Serializable data class GasLimitPrices ( - @Json(name = "gas_price") + @SerialName(value = "gas_price") val gasPrice: kotlin.Long, - @Json(name = "gas_limit") + @SerialName(value = "gas_limit") val gasLimit: kotlin.Long, - @Json(name = "gas_credit") + @SerialName(value = "gas_credit") val gasCredit: kotlin.Long, - @Json(name = "block_gas_limit") + @SerialName(value = "block_gas_limit") val blockGasLimit: kotlin.Long, - @Json(name = "freeze_due_limit") + @SerialName(value = "freeze_due_limit") val freezeDueLimit: kotlin.Long, - @Json(name = "delete_due_limit") + @SerialName(value = "delete_due_limit") val deleteDueLimit: kotlin.Long, - @Json(name = "special_gas_limit") + @SerialName(value = "special_gas_limit") val specialGasLimit: kotlin.Long? = null, - @Json(name = "flat_gas_limit") + @SerialName(value = "flat_gas_limit") val flatGasLimit: kotlin.Long? = null, - @Json(name = "flat_gas_price") + @SerialName(value = "flat_gas_price") val flatGasPrice: kotlin.Long? = null -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/GasRelayAction.kt b/tonapi/src/main/kotlin/io/tonapi/models/GasRelayAction.kt new file mode 100644 index 000000000..758a5bddc --- /dev/null +++ b/tonapi/src/main/kotlin/io/tonapi/models/GasRelayAction.kt @@ -0,0 +1,42 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package io.tonapi.models + +import io.tonapi.models.AccountAddress + +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual + + +@Serializable + +data class GasRelayAction ( + + @SerialName(value = "amount") + val amount: kotlin.Long, + + @SerialName(value = "relayer") + val relayer: AccountAddress, + + @SerialName(value = "target") + val target: AccountAddress + +) { + + +} + diff --git a/tonapi/src/main/kotlin/io/tonapi/models/GaslessConfig.kt b/tonapi/src/main/kotlin/io/tonapi/models/GaslessConfig.kt index ddb69d1d4..64860cca8 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/GaslessConfig.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/GaslessConfig.kt @@ -17,26 +17,25 @@ package io.tonapi.models import io.tonapi.models.GaslessConfigGasJettonsInner -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param relayAddress sending excess to this address decreases the commission of a gasless transfer - * @param gasJettons list of jettons, any of them can be used to pay for gas - */ +@Serializable data class GaslessConfig ( /* sending excess to this address decreases the commission of a gasless transfer */ - @Json(name = "relay_address") + @SerialName(value = "relay_address") val relayAddress: kotlin.String, /* list of jettons, any of them can be used to pay for gas */ - @Json(name = "gas_jettons") + @SerialName(value = "gas_jettons") val gasJettons: kotlin.collections.List -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/GaslessConfigGasJettonsInner.kt b/tonapi/src/main/kotlin/io/tonapi/models/GaslessConfigGasJettonsInner.kt index 4e2b3ec3c..339e64096 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/GaslessConfigGasJettonsInner.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/GaslessConfigGasJettonsInner.kt @@ -16,20 +16,20 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param masterId - */ +@Serializable data class GaslessConfigGasJettonsInner ( - @Json(name = "master_id") + @SerialName(value = "master_id") val masterId: kotlin.String -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/GaslessEstimateRequest.kt b/tonapi/src/main/kotlin/io/tonapi/models/GaslessEstimateRequest.kt index 78c46a32a..cfb3fd912 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/GaslessEstimateRequest.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/GaslessEstimateRequest.kt @@ -15,30 +15,35 @@ package io.tonapi.models -import io.tonapi.models.DecodeMessageRequest +import io.tonapi.models.GaslessEstimateRequestMessagesInner -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param walletAddress - * @param walletPublicKey - * @param messages - */ +@Serializable data class GaslessEstimateRequest ( - @Json(name = "wallet_address") + @SerialName(value = "wallet_address") val walletAddress: kotlin.String, - @Json(name = "wallet_public_key") + @SerialName(value = "wallet_public_key") val walletPublicKey: kotlin.String, - @Json(name = "messages") - val messages: kotlin.collections.List + @SerialName(value = "messages") + val messages: kotlin.collections.List, -) + /* TONAPI verifies that the account has enough jettons to pay the commission and make a transfer. */ + @SerialName(value = "throw_error_if_not_enough_jettons") + val throwErrorIfNotEnoughJettons: kotlin.Boolean? = false, + + @SerialName(value = "return_emulation") + val returnEmulation: kotlin.Boolean? = false + +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/GaslessEstimateRequestMessagesInner.kt b/tonapi/src/main/kotlin/io/tonapi/models/GaslessEstimateRequestMessagesInner.kt index 1b86e157d..52f8d7f81 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/GaslessEstimateRequestMessagesInner.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/GaslessEstimateRequestMessagesInner.kt @@ -16,20 +16,20 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param boc - */ +@Serializable data class GaslessEstimateRequestMessagesInner ( - @Json(name = "boc") + @SerialName(value = "boc") val boc: kotlin.String -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/GaslessSendRequest.kt b/tonapi/src/main/kotlin/io/tonapi/models/GaslessSendRequest.kt index 9e28b0318..4eb3861d0 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/GaslessSendRequest.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/GaslessSendRequest.kt @@ -16,25 +16,24 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param walletPublicKey hex encoded public key - * @param boc - */ +@Serializable data class GaslessSendRequest ( /* hex encoded public key */ - @Json(name = "wallet_public_key") + @SerialName(value = "wallet_public_key") val walletPublicKey: kotlin.String, - @Json(name = "boc") + @SerialName(value = "boc") val boc: kotlin.String -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/GetBlockchainBlockDefaultResponse.kt b/tonapi/src/main/kotlin/io/tonapi/models/GaslessTx.kt similarity index 55% rename from tonapi/src/main/kotlin/io/tonapi/models/GetBlockchainBlockDefaultResponse.kt rename to tonapi/src/main/kotlin/io/tonapi/models/GaslessTx.kt index 7bd7b11f5..f74603a0a 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/GetBlockchainBlockDefaultResponse.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/GaslessTx.kt @@ -16,20 +16,20 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param error - */ +@Serializable -data class GetBlockchainBlockDefaultResponse ( +data class GaslessTx ( - @Json(name = "error") - val error: kotlin.String + @SerialName(value = "protocol_name") + val protocolName: kotlin.String -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/GetAccountDiff200Response.kt b/tonapi/src/main/kotlin/io/tonapi/models/GetAccountDiff200Response.kt index f40661543..4c3bf8fb9 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/GetAccountDiff200Response.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/GetAccountDiff200Response.kt @@ -16,20 +16,20 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param balanceChange - */ +@Serializable data class GetAccountDiff200Response ( - @Json(name = "balance_change") + @SerialName(value = "balance_change") val balanceChange: kotlin.Long -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/GetAccountInfoByStateInitRequest.kt b/tonapi/src/main/kotlin/io/tonapi/models/GetAccountInfoByStateInitRequest.kt index 065ea50a5..a0daa0335 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/GetAccountInfoByStateInitRequest.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/GetAccountInfoByStateInitRequest.kt @@ -16,20 +16,20 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param stateInit - */ +@Serializable data class GetAccountInfoByStateInitRequest ( - @Json(name = "state_init") + @SerialName(value = "state_init") val stateInit: kotlin.String -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/GetAccountPublicKey200Response.kt b/tonapi/src/main/kotlin/io/tonapi/models/GetAccountPublicKey200Response.kt index ec5e70ca4..e810e5d83 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/GetAccountPublicKey200Response.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/GetAccountPublicKey200Response.kt @@ -16,20 +16,20 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param publicKey - */ +@Serializable data class GetAccountPublicKey200Response ( - @Json(name = "public_key") + @SerialName(value = "public_key") val publicKey: kotlin.String -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/GetAccountsRequest.kt b/tonapi/src/main/kotlin/io/tonapi/models/GetAccountsRequest.kt index 74b08fdef..82226e4f7 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/GetAccountsRequest.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/GetAccountsRequest.kt @@ -16,20 +16,20 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param accountIds - */ +@Serializable data class GetAccountsRequest ( - @Json(name = "account_ids") + @SerialName(value = "account_ids") val accountIds: kotlin.collections.List -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/GetAllRawShardsInfo200Response.kt b/tonapi/src/main/kotlin/io/tonapi/models/GetAllRawShardsInfo200Response.kt index a727b6348..8b75407dd 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/GetAllRawShardsInfo200Response.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/GetAllRawShardsInfo200Response.kt @@ -17,28 +17,26 @@ package io.tonapi.models import io.tonapi.models.BlockRaw -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param id - * @param proof - * @param `data` - */ +@Serializable data class GetAllRawShardsInfo200Response ( - @Json(name = "id") + @SerialName(value = "id") val id: BlockRaw, - @Json(name = "proof") + @SerialName(value = "proof") val proof: kotlin.String, - @Json(name = "data") + @SerialName(value = "data") val `data`: kotlin.String -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/GetChartRates200Response.kt b/tonapi/src/main/kotlin/io/tonapi/models/GetChartRates200Response.kt index 136a7998e..76e2d20f8 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/GetChartRates200Response.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/GetChartRates200Response.kt @@ -16,20 +16,21 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param points - */ +@Serializable data class GetChartRates200Response ( - @Json(name = "points") - val points: kotlin.collections.Map + /* Each inner array is a pair [timestamp, price]: • index 0 — Unix timestamp (int64) • index 1 — token price (decimal) in the requested currency. */ + @SerialName(value = "points") + val points: kotlin.collections.List> -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/GetInscriptionOpTemplate200Response.kt b/tonapi/src/main/kotlin/io/tonapi/models/GetInscriptionOpTemplate200Response.kt deleted file mode 100644 index de3f58958..000000000 --- a/tonapi/src/main/kotlin/io/tonapi/models/GetInscriptionOpTemplate200Response.kt +++ /dev/null @@ -1,39 +0,0 @@ -/** - * - * Please note: - * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * Do not edit this file manually. - * - */ - -@file:Suppress( - "ArrayInDataClass", - "EnumEntryName", - "RemoveRedundantQualifierName", - "UnusedImport" -) - -package io.tonapi.models - - -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass - -/** - * - * - * @param comment - * @param destination - */ - - -data class GetInscriptionOpTemplate200Response ( - - @Json(name = "comment") - val comment: kotlin.String, - - @Json(name = "destination") - val destination: kotlin.String - -) - diff --git a/tonapi/src/main/kotlin/io/tonapi/models/GetMarketsRates200Response.kt b/tonapi/src/main/kotlin/io/tonapi/models/GetMarketsRates200Response.kt index 88f8ad03c..bc4871859 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/GetMarketsRates200Response.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/GetMarketsRates200Response.kt @@ -17,20 +17,20 @@ package io.tonapi.models import io.tonapi.models.MarketTonRates -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param markets - */ +@Serializable data class GetMarketsRates200Response ( - @Json(name = "markets") + @SerialName(value = "markets") val markets: kotlin.collections.List -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/GetOpenapiJsonDefaultResponse.kt b/tonapi/src/main/kotlin/io/tonapi/models/GetOpenapiJsonDefaultResponse.kt new file mode 100644 index 000000000..e45c3599e --- /dev/null +++ b/tonapi/src/main/kotlin/io/tonapi/models/GetOpenapiJsonDefaultResponse.kt @@ -0,0 +1,43 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package io.tonapi.models + + +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual + +/** + * + * + * @param error + * @param errorCode + */ +@Serializable + +data class GetOpenapiJsonDefaultResponse ( + + @SerialName(value = "error") + val error: kotlin.String, + + @SerialName(value = "error_code") + val errorCode: kotlin.Long? = null + +) { + + +} + diff --git a/tonapi/src/main/kotlin/io/tonapi/models/GetOutMsgQueueSizes200Response.kt b/tonapi/src/main/kotlin/io/tonapi/models/GetOutMsgQueueSizes200Response.kt index f86d5c6c1..bc9aa74e5 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/GetOutMsgQueueSizes200Response.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/GetOutMsgQueueSizes200Response.kt @@ -17,24 +17,23 @@ package io.tonapi.models import io.tonapi.models.GetOutMsgQueueSizes200ResponseShardsInner -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param extMsgQueueSizeLimit - * @param shards - */ +@Serializable data class GetOutMsgQueueSizes200Response ( - @Json(name = "ext_msg_queue_size_limit") + @SerialName(value = "ext_msg_queue_size_limit") val extMsgQueueSizeLimit: kotlin.Int, - @Json(name = "shards") + @SerialName(value = "shards") val shards: kotlin.collections.List -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/GetOutMsgQueueSizes200ResponseShardsInner.kt b/tonapi/src/main/kotlin/io/tonapi/models/GetOutMsgQueueSizes200ResponseShardsInner.kt index 09d6a135a..a59211d95 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/GetOutMsgQueueSizes200ResponseShardsInner.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/GetOutMsgQueueSizes200ResponseShardsInner.kt @@ -17,24 +17,23 @@ package io.tonapi.models import io.tonapi.models.BlockRaw -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param id - * @param propertySize - */ +@Serializable data class GetOutMsgQueueSizes200ResponseShardsInner ( - @Json(name = "id") + @SerialName(value = "id") val id: BlockRaw, - @Json(name = "size") + @SerialName(value = "size") val propertySize: kotlin.Int -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/GetRates200Response.kt b/tonapi/src/main/kotlin/io/tonapi/models/GetRates200Response.kt index 42b5a4c8b..4a8d51fe5 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/GetRates200Response.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/GetRates200Response.kt @@ -17,20 +17,20 @@ package io.tonapi.models import io.tonapi.models.TokenRates -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param rates - */ +@Serializable data class GetRates200Response ( - @Json(name = "rates") + @Contextual @SerialName(value = "rates") val rates: kotlin.collections.Map -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/GetRawAccountState200Response.kt b/tonapi/src/main/kotlin/io/tonapi/models/GetRawAccountState200Response.kt index 259b9735d..06cb2dbec 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/GetRawAccountState200Response.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/GetRawAccountState200Response.kt @@ -17,36 +17,32 @@ package io.tonapi.models import io.tonapi.models.BlockRaw -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param id - * @param shardblk - * @param shardProof - * @param proof - * @param state - */ +@Serializable data class GetRawAccountState200Response ( - @Json(name = "id") + @SerialName(value = "id") val id: BlockRaw, - @Json(name = "shardblk") + @SerialName(value = "shardblk") val shardblk: BlockRaw, - @Json(name = "shard_proof") + @SerialName(value = "shard_proof") val shardProof: kotlin.String, - @Json(name = "proof") + @SerialName(value = "proof") val proof: kotlin.String, - @Json(name = "state") + @SerialName(value = "state") val state: kotlin.String -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/GetRawBlockProof200Response.kt b/tonapi/src/main/kotlin/io/tonapi/models/GetRawBlockProof200Response.kt index d0e789dfa..d98265152 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/GetRawBlockProof200Response.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/GetRawBlockProof200Response.kt @@ -18,32 +18,29 @@ package io.tonapi.models import io.tonapi.models.BlockRaw import io.tonapi.models.GetRawBlockProof200ResponseStepsInner -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param complete - * @param from - * @param to - * @param steps - */ +@Serializable data class GetRawBlockProof200Response ( - @Json(name = "complete") + @SerialName(value = "complete") val complete: kotlin.Boolean, - @Json(name = "from") + @SerialName(value = "from") val from: BlockRaw, - @Json(name = "to") + @SerialName(value = "to") val to: BlockRaw, - @Json(name = "steps") + @SerialName(value = "steps") val steps: kotlin.collections.List -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/GetRawBlockProof200ResponseStepsInner.kt b/tonapi/src/main/kotlin/io/tonapi/models/GetRawBlockProof200ResponseStepsInner.kt index 0cc471cb6..5c0d147c0 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/GetRawBlockProof200ResponseStepsInner.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/GetRawBlockProof200ResponseStepsInner.kt @@ -18,24 +18,23 @@ package io.tonapi.models import io.tonapi.models.GetRawBlockProof200ResponseStepsInnerLiteServerBlockLinkBack import io.tonapi.models.GetRawBlockProof200ResponseStepsInnerLiteServerBlockLinkForward -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param liteServerBlockLinkBack - * @param liteServerBlockLinkForward - */ +@Serializable data class GetRawBlockProof200ResponseStepsInner ( - @Json(name = "lite_server_block_link_back") + @SerialName(value = "lite_server_block_link_back") val liteServerBlockLinkBack: GetRawBlockProof200ResponseStepsInnerLiteServerBlockLinkBack, - @Json(name = "lite_server_block_link_forward") + @SerialName(value = "lite_server_block_link_forward") val liteServerBlockLinkForward: GetRawBlockProof200ResponseStepsInnerLiteServerBlockLinkForward -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/GetRawBlockProof200ResponseStepsInnerLiteServerBlockLinkBack.kt b/tonapi/src/main/kotlin/io/tonapi/models/GetRawBlockProof200ResponseStepsInnerLiteServerBlockLinkBack.kt index 3b6a48ad6..b1801011f 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/GetRawBlockProof200ResponseStepsInnerLiteServerBlockLinkBack.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/GetRawBlockProof200ResponseStepsInnerLiteServerBlockLinkBack.kt @@ -17,40 +17,35 @@ package io.tonapi.models import io.tonapi.models.BlockRaw -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param toKeyBlock - * @param from - * @param to - * @param destProof - * @param proof - * @param stateProof - */ +@Serializable data class GetRawBlockProof200ResponseStepsInnerLiteServerBlockLinkBack ( - @Json(name = "to_key_block") + @SerialName(value = "to_key_block") val toKeyBlock: kotlin.Boolean, - @Json(name = "from") + @SerialName(value = "from") val from: BlockRaw, - @Json(name = "to") + @SerialName(value = "to") val to: BlockRaw, - @Json(name = "dest_proof") + @SerialName(value = "dest_proof") val destProof: kotlin.String, - @Json(name = "proof") + @SerialName(value = "proof") val proof: kotlin.String, - @Json(name = "state_proof") + @SerialName(value = "state_proof") val stateProof: kotlin.String -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/GetRawBlockProof200ResponseStepsInnerLiteServerBlockLinkForward.kt b/tonapi/src/main/kotlin/io/tonapi/models/GetRawBlockProof200ResponseStepsInnerLiteServerBlockLinkForward.kt index fe3211fa5..20f479cd2 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/GetRawBlockProof200ResponseStepsInnerLiteServerBlockLinkForward.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/GetRawBlockProof200ResponseStepsInnerLiteServerBlockLinkForward.kt @@ -18,40 +18,35 @@ package io.tonapi.models import io.tonapi.models.BlockRaw import io.tonapi.models.GetRawBlockProof200ResponseStepsInnerLiteServerBlockLinkForwardSignatures -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param toKeyBlock - * @param from - * @param to - * @param destProof - * @param configProof - * @param signatures - */ +@Serializable data class GetRawBlockProof200ResponseStepsInnerLiteServerBlockLinkForward ( - @Json(name = "to_key_block") + @SerialName(value = "to_key_block") val toKeyBlock: kotlin.Boolean, - @Json(name = "from") + @SerialName(value = "from") val from: BlockRaw, - @Json(name = "to") + @SerialName(value = "to") val to: BlockRaw, - @Json(name = "dest_proof") + @SerialName(value = "dest_proof") val destProof: kotlin.String, - @Json(name = "config_proof") + @SerialName(value = "config_proof") val configProof: kotlin.String, - @Json(name = "signatures") + @SerialName(value = "signatures") val signatures: GetRawBlockProof200ResponseStepsInnerLiteServerBlockLinkForwardSignatures -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/GetRawBlockProof200ResponseStepsInnerLiteServerBlockLinkForwardSignatures.kt b/tonapi/src/main/kotlin/io/tonapi/models/GetRawBlockProof200ResponseStepsInnerLiteServerBlockLinkForwardSignatures.kt index 938884dcd..9f041f80d 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/GetRawBlockProof200ResponseStepsInnerLiteServerBlockLinkForwardSignatures.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/GetRawBlockProof200ResponseStepsInnerLiteServerBlockLinkForwardSignatures.kt @@ -17,28 +17,26 @@ package io.tonapi.models import io.tonapi.models.GetRawBlockProof200ResponseStepsInnerLiteServerBlockLinkForwardSignaturesSignaturesInner -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param validatorSetHash - * @param catchainSeqno - * @param signatures - */ +@Serializable data class GetRawBlockProof200ResponseStepsInnerLiteServerBlockLinkForwardSignatures ( - @Json(name = "validator_set_hash") + @SerialName(value = "validator_set_hash") val validatorSetHash: kotlin.Long, - @Json(name = "catchain_seqno") + @SerialName(value = "catchain_seqno") val catchainSeqno: kotlin.Int, - @Json(name = "signatures") + @SerialName(value = "signatures") val signatures: kotlin.collections.List -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/GetRawBlockProof200ResponseStepsInnerLiteServerBlockLinkForwardSignaturesSignaturesInner.kt b/tonapi/src/main/kotlin/io/tonapi/models/GetRawBlockProof200ResponseStepsInnerLiteServerBlockLinkForwardSignaturesSignaturesInner.kt index 03e7a952d..54b20508d 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/GetRawBlockProof200ResponseStepsInnerLiteServerBlockLinkForwardSignaturesSignaturesInner.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/GetRawBlockProof200ResponseStepsInnerLiteServerBlockLinkForwardSignaturesSignaturesInner.kt @@ -16,24 +16,23 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param nodeIdShort - * @param signature - */ +@Serializable data class GetRawBlockProof200ResponseStepsInnerLiteServerBlockLinkForwardSignaturesSignaturesInner ( - @Json(name = "node_id_short") + @SerialName(value = "node_id_short") val nodeIdShort: kotlin.String, - @Json(name = "signature") + @SerialName(value = "signature") val signature: kotlin.String -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/GetRawBlockchainBlock200Response.kt b/tonapi/src/main/kotlin/io/tonapi/models/GetRawBlockchainBlock200Response.kt index 0bfa553fb..4895be64e 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/GetRawBlockchainBlock200Response.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/GetRawBlockchainBlock200Response.kt @@ -17,24 +17,23 @@ package io.tonapi.models import io.tonapi.models.BlockRaw -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param id - * @param `data` - */ +@Serializable data class GetRawBlockchainBlock200Response ( - @Json(name = "id") + @SerialName(value = "id") val id: BlockRaw, - @Json(name = "data") + @SerialName(value = "data") val `data`: kotlin.String -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/GetRawBlockchainBlockHeader200Response.kt b/tonapi/src/main/kotlin/io/tonapi/models/GetRawBlockchainBlockHeader200Response.kt index b1629cd6b..44893130b 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/GetRawBlockchainBlockHeader200Response.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/GetRawBlockchainBlockHeader200Response.kt @@ -17,28 +17,26 @@ package io.tonapi.models import io.tonapi.models.BlockRaw -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param id - * @param mode - * @param headerProof - */ +@Serializable data class GetRawBlockchainBlockHeader200Response ( - @Json(name = "id") + @SerialName(value = "id") val id: BlockRaw, - @Json(name = "mode") + @SerialName(value = "mode") val mode: kotlin.Int, - @Json(name = "header_proof") + @SerialName(value = "header_proof") val headerProof: kotlin.String -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/GetRawBlockchainBlockState200Response.kt b/tonapi/src/main/kotlin/io/tonapi/models/GetRawBlockchainBlockState200Response.kt index 68f1dfe78..362983f10 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/GetRawBlockchainBlockState200Response.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/GetRawBlockchainBlockState200Response.kt @@ -17,32 +17,29 @@ package io.tonapi.models import io.tonapi.models.BlockRaw -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param id - * @param rootHash - * @param fileHash - * @param `data` - */ +@Serializable data class GetRawBlockchainBlockState200Response ( - @Json(name = "id") + @SerialName(value = "id") val id: BlockRaw, - @Json(name = "root_hash") + @SerialName(value = "root_hash") val rootHash: kotlin.String, - @Json(name = "file_hash") + @SerialName(value = "file_hash") val fileHash: kotlin.String, - @Json(name = "data") + @SerialName(value = "data") val `data`: kotlin.String -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/GetRawConfig200Response.kt b/tonapi/src/main/kotlin/io/tonapi/models/GetRawConfig200Response.kt index 909b2744b..d0b195fb0 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/GetRawConfig200Response.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/GetRawConfig200Response.kt @@ -17,32 +17,29 @@ package io.tonapi.models import io.tonapi.models.BlockRaw -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param mode - * @param id - * @param stateProof - * @param configProof - */ +@Serializable data class GetRawConfig200Response ( - @Json(name = "mode") + @SerialName(value = "mode") val mode: kotlin.Int, - @Json(name = "id") + @SerialName(value = "id") val id: BlockRaw, - @Json(name = "state_proof") + @SerialName(value = "state_proof") val stateProof: kotlin.String, - @Json(name = "config_proof") + @SerialName(value = "config_proof") val configProof: kotlin.String -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/GetRawListBlockTransactions200Response.kt b/tonapi/src/main/kotlin/io/tonapi/models/GetRawListBlockTransactions200Response.kt index d81a0550f..52e4fd081 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/GetRawListBlockTransactions200Response.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/GetRawListBlockTransactions200Response.kt @@ -18,36 +18,32 @@ package io.tonapi.models import io.tonapi.models.BlockRaw import io.tonapi.models.GetRawListBlockTransactions200ResponseIdsInner -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param id - * @param reqCount - * @param incomplete - * @param ids - * @param proof - */ +@Serializable data class GetRawListBlockTransactions200Response ( - @Json(name = "id") + @SerialName(value = "id") val id: BlockRaw, - @Json(name = "req_count") + @SerialName(value = "req_count") val reqCount: kotlin.Int, - @Json(name = "incomplete") + @SerialName(value = "incomplete") val incomplete: kotlin.Boolean, - @Json(name = "ids") + @SerialName(value = "ids") val ids: kotlin.collections.List, - @Json(name = "proof") + @SerialName(value = "proof") val proof: kotlin.String -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/GetRawListBlockTransactions200ResponseIdsInner.kt b/tonapi/src/main/kotlin/io/tonapi/models/GetRawListBlockTransactions200ResponseIdsInner.kt index 183916d95..a228ed76f 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/GetRawListBlockTransactions200ResponseIdsInner.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/GetRawListBlockTransactions200ResponseIdsInner.kt @@ -16,32 +16,29 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param mode - * @param account - * @param lt - * @param hash - */ +@Serializable data class GetRawListBlockTransactions200ResponseIdsInner ( - @Json(name = "mode") + @SerialName(value = "mode") val mode: kotlin.Int, - @Json(name = "account") + @SerialName(value = "account") val account: kotlin.String? = null, - @Json(name = "lt") + @SerialName(value = "lt") val lt: kotlin.Long? = null, - @Json(name = "hash") + @SerialName(value = "hash") val hash: kotlin.String? = null -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/GetRawMasterchainInfo200Response.kt b/tonapi/src/main/kotlin/io/tonapi/models/GetRawMasterchainInfo200Response.kt index de7663bdd..b0fc0b704 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/GetRawMasterchainInfo200Response.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/GetRawMasterchainInfo200Response.kt @@ -18,28 +18,26 @@ package io.tonapi.models import io.tonapi.models.BlockRaw import io.tonapi.models.InitStateRaw -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param last - * @param stateRootHash - * @param `init` - */ +@Serializable data class GetRawMasterchainInfo200Response ( - @Json(name = "last") + @SerialName(value = "last") val last: BlockRaw, - @Json(name = "state_root_hash") + @SerialName(value = "state_root_hash") val stateRootHash: kotlin.String, - @Json(name = "init") + @SerialName(value = "init") val `init`: InitStateRaw -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/GetRawMasterchainInfoExt200Response.kt b/tonapi/src/main/kotlin/io/tonapi/models/GetRawMasterchainInfoExt200Response.kt index 4d34555cf..256b3ad0d 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/GetRawMasterchainInfoExt200Response.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/GetRawMasterchainInfoExt200Response.kt @@ -18,48 +18,41 @@ package io.tonapi.models import io.tonapi.models.BlockRaw import io.tonapi.models.InitStateRaw -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param mode - * @param version - * @param capabilities - * @param last - * @param lastUtime - * @param now - * @param stateRootHash - * @param `init` - */ +@Serializable data class GetRawMasterchainInfoExt200Response ( - @Json(name = "mode") + @SerialName(value = "mode") val mode: kotlin.Int, - @Json(name = "version") + @SerialName(value = "version") val version: kotlin.Int, - @Json(name = "capabilities") + @SerialName(value = "capabilities") val capabilities: kotlin.Long, - @Json(name = "last") + @SerialName(value = "last") val last: BlockRaw, - @Json(name = "last_utime") + @SerialName(value = "last_utime") val lastUtime: kotlin.Int, - @Json(name = "now") + @SerialName(value = "now") val now: kotlin.Int, - @Json(name = "state_root_hash") + @SerialName(value = "state_root_hash") val stateRootHash: kotlin.String, - @Json(name = "init") + @SerialName(value = "init") val `init`: InitStateRaw -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/GetRawShardBlockProof200Response.kt b/tonapi/src/main/kotlin/io/tonapi/models/GetRawShardBlockProof200Response.kt index 6bfd86be1..ef7226548 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/GetRawShardBlockProof200Response.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/GetRawShardBlockProof200Response.kt @@ -18,24 +18,23 @@ package io.tonapi.models import io.tonapi.models.BlockRaw import io.tonapi.models.GetRawShardBlockProof200ResponseLinksInner -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param masterchainId - * @param links - */ +@Serializable data class GetRawShardBlockProof200Response ( - @Json(name = "masterchain_id") + @SerialName(value = "masterchain_id") val masterchainId: BlockRaw, - @Json(name = "links") + @SerialName(value = "links") val links: kotlin.collections.List -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/GetRawShardBlockProof200ResponseLinksInner.kt b/tonapi/src/main/kotlin/io/tonapi/models/GetRawShardBlockProof200ResponseLinksInner.kt index 2ef9b4bfc..93a214a7a 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/GetRawShardBlockProof200ResponseLinksInner.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/GetRawShardBlockProof200ResponseLinksInner.kt @@ -17,24 +17,23 @@ package io.tonapi.models import io.tonapi.models.BlockRaw -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param id - * @param proof - */ +@Serializable data class GetRawShardBlockProof200ResponseLinksInner ( - @Json(name = "id") + @SerialName(value = "id") val id: BlockRaw, - @Json(name = "proof") + @SerialName(value = "proof") val proof: kotlin.String -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/GetRawShardInfo200Response.kt b/tonapi/src/main/kotlin/io/tonapi/models/GetRawShardInfo200Response.kt index 8856e3080..30cce60aa 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/GetRawShardInfo200Response.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/GetRawShardInfo200Response.kt @@ -17,32 +17,29 @@ package io.tonapi.models import io.tonapi.models.BlockRaw -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param id - * @param shardblk - * @param shardProof - * @param shardDescr - */ +@Serializable data class GetRawShardInfo200Response ( - @Json(name = "id") + @SerialName(value = "id") val id: BlockRaw, - @Json(name = "shardblk") + @SerialName(value = "shardblk") val shardblk: BlockRaw, - @Json(name = "shard_proof") + @SerialName(value = "shard_proof") val shardProof: kotlin.String, - @Json(name = "shard_descr") + @SerialName(value = "shard_descr") val shardDescr: kotlin.String -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/GetRawTime200Response.kt b/tonapi/src/main/kotlin/io/tonapi/models/GetRawTime200Response.kt index 936beb277..8809b6585 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/GetRawTime200Response.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/GetRawTime200Response.kt @@ -16,20 +16,20 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param time - */ +@Serializable data class GetRawTime200Response ( - @Json(name = "time") + @SerialName(value = "time") val time: kotlin.Int -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/GetRawTransactions200Response.kt b/tonapi/src/main/kotlin/io/tonapi/models/GetRawTransactions200Response.kt index 7fbc9eafa..bd8c75070 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/GetRawTransactions200Response.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/GetRawTransactions200Response.kt @@ -17,24 +17,23 @@ package io.tonapi.models import io.tonapi.models.BlockRaw -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param ids - * @param transactions - */ +@Serializable data class GetRawTransactions200Response ( - @Json(name = "ids") + @SerialName(value = "ids") val ids: kotlin.collections.List, - @Json(name = "transactions") + @SerialName(value = "transactions") val transactions: kotlin.String -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/GetStakingPoolHistory200Response.kt b/tonapi/src/main/kotlin/io/tonapi/models/GetStakingPoolHistory200Response.kt index 82f372100..d3d0d28ad 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/GetStakingPoolHistory200Response.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/GetStakingPoolHistory200Response.kt @@ -17,20 +17,20 @@ package io.tonapi.models import io.tonapi.models.ApyHistory -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param apy - */ +@Serializable data class GetStakingPoolHistory200Response ( - @Json(name = "apy") + @SerialName(value = "apy") val apy: kotlin.collections.List -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/GetStakingPoolInfo200Response.kt b/tonapi/src/main/kotlin/io/tonapi/models/GetStakingPoolInfo200Response.kt index d9a0d9a3e..13c5e5231 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/GetStakingPoolInfo200Response.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/GetStakingPoolInfo200Response.kt @@ -18,24 +18,23 @@ package io.tonapi.models import io.tonapi.models.PoolImplementation import io.tonapi.models.PoolInfo -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param implementation - * @param pool - */ +@Serializable data class GetStakingPoolInfo200Response ( - @Json(name = "implementation") + @SerialName(value = "implementation") val implementation: PoolImplementation, - @Json(name = "pool") + @SerialName(value = "pool") val pool: PoolInfo -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/GetStakingPools200Response.kt b/tonapi/src/main/kotlin/io/tonapi/models/GetStakingPools200Response.kt index 7662632c1..556f69de5 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/GetStakingPools200Response.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/GetStakingPools200Response.kt @@ -18,24 +18,23 @@ package io.tonapi.models import io.tonapi.models.PoolImplementation import io.tonapi.models.PoolInfo -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param pools - * @param implementations - */ +@Serializable data class GetStakingPools200Response ( - @Json(name = "pools") + @SerialName(value = "pools") val pools: kotlin.collections.List, - @Json(name = "implementations") + @Contextual @SerialName(value = "implementations") val implementations: kotlin.collections.Map -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/GetStorageProviders200Response.kt b/tonapi/src/main/kotlin/io/tonapi/models/GetStorageProviders200Response.kt index 5cf7bbb06..dcd8cdcc3 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/GetStorageProviders200Response.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/GetStorageProviders200Response.kt @@ -17,20 +17,20 @@ package io.tonapi.models import io.tonapi.models.StorageProvider -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param providers - */ +@Serializable data class GetStorageProviders200Response ( - @Json(name = "providers") + @SerialName(value = "providers") val providers: kotlin.collections.List -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/GetTonConnectPayload200Response.kt b/tonapi/src/main/kotlin/io/tonapi/models/GetTonConnectPayload200Response.kt index fce669d82..734c24c63 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/GetTonConnectPayload200Response.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/GetTonConnectPayload200Response.kt @@ -16,20 +16,20 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param payload - */ +@Serializable data class GetTonConnectPayload200Response ( - @Json(name = "payload") + @SerialName(value = "payload") val payload: kotlin.String -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/GetWalletBackup200Response.kt b/tonapi/src/main/kotlin/io/tonapi/models/GetWalletBackup200Response.kt deleted file mode 100644 index 59a63ae72..000000000 --- a/tonapi/src/main/kotlin/io/tonapi/models/GetWalletBackup200Response.kt +++ /dev/null @@ -1,35 +0,0 @@ -/** - * - * Please note: - * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * Do not edit this file manually. - * - */ - -@file:Suppress( - "ArrayInDataClass", - "EnumEntryName", - "RemoveRedundantQualifierName", - "UnusedImport" -) - -package io.tonapi.models - - -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass - -/** - * - * - * @param dump - */ - - -data class GetWalletBackup200Response ( - - @Json(name = "dump") - val dump: kotlin.String - -) - diff --git a/tonapi/src/main/kotlin/io/tonapi/models/ImagePreview.kt b/tonapi/src/main/kotlin/io/tonapi/models/ImagePreview.kt index edb47034e..2a84c4732 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/ImagePreview.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/ImagePreview.kt @@ -16,24 +16,23 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param resolution - * @param url - */ +@Serializable data class ImagePreview ( - @Json(name = "resolution") + @SerialName(value = "resolution") val resolution: kotlin.String, - @Json(name = "url") + @SerialName(value = "url") val url: kotlin.String -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/InitStateRaw.kt b/tonapi/src/main/kotlin/io/tonapi/models/InitStateRaw.kt index 0a7c55750..6bbe2e323 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/InitStateRaw.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/InitStateRaw.kt @@ -16,28 +16,26 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param workchain - * @param rootHash - * @param fileHash - */ +@Serializable data class InitStateRaw ( - @Json(name = "workchain") + @SerialName(value = "workchain") val workchain: kotlin.Int, - @Json(name = "root_hash") + @SerialName(value = "root_hash") val rootHash: kotlin.String, - @Json(name = "file_hash") + @SerialName(value = "file_hash") val fileHash: kotlin.String -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/InlineObject.kt b/tonapi/src/main/kotlin/io/tonapi/models/InlineObject.kt new file mode 100644 index 000000000..2313f42f6 --- /dev/null +++ b/tonapi/src/main/kotlin/io/tonapi/models/InlineObject.kt @@ -0,0 +1,38 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package io.tonapi.models + + +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual + + +@Serializable + +data class InlineObject ( + + @SerialName(value = "error") + val error: kotlin.String, + + @SerialName(value = "error_code") + val errorCode: kotlin.Long? = null + +) { + + +} + diff --git a/tonapi/src/main/kotlin/io/tonapi/models/InscriptionBalance.kt b/tonapi/src/main/kotlin/io/tonapi/models/InscriptionBalance.kt deleted file mode 100644 index dbb77ec98..000000000 --- a/tonapi/src/main/kotlin/io/tonapi/models/InscriptionBalance.kt +++ /dev/null @@ -1,59 +0,0 @@ -/** - * - * Please note: - * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * Do not edit this file manually. - * - */ - -@file:Suppress( - "ArrayInDataClass", - "EnumEntryName", - "RemoveRedundantQualifierName", - "UnusedImport" -) - -package io.tonapi.models - - -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass - -/** - * - * - * @param type - * @param ticker - * @param balance - * @param decimals - */ - - -data class InscriptionBalance ( - - @Json(name = "type") - val type: InscriptionBalance.Type, - - @Json(name = "ticker") - val ticker: kotlin.String, - - @Json(name = "balance") - val balance: kotlin.String, - - @Json(name = "decimals") - val decimals: kotlin.Int - -) { - - /** - * - * - * Values: ton20,gram20 - */ - @JsonClass(generateAdapter = false) - enum class Type(val value: kotlin.String) { - @Json(name = "ton20") ton20("ton20"), - @Json(name = "gram20") gram20("gram20"); - } -} - diff --git a/tonapi/src/main/kotlin/io/tonapi/models/InscriptionBalances.kt b/tonapi/src/main/kotlin/io/tonapi/models/InscriptionBalances.kt deleted file mode 100644 index 2fcf22c7e..000000000 --- a/tonapi/src/main/kotlin/io/tonapi/models/InscriptionBalances.kt +++ /dev/null @@ -1,36 +0,0 @@ -/** - * - * Please note: - * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * Do not edit this file manually. - * - */ - -@file:Suppress( - "ArrayInDataClass", - "EnumEntryName", - "RemoveRedundantQualifierName", - "UnusedImport" -) - -package io.tonapi.models - -import io.tonapi.models.InscriptionBalance - -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass - -/** - * - * - * @param inscriptions - */ - - -data class InscriptionBalances ( - - @Json(name = "inscriptions") - val inscriptions: kotlin.collections.List - -) - diff --git a/tonapi/src/main/kotlin/io/tonapi/models/InscriptionMintAction.kt b/tonapi/src/main/kotlin/io/tonapi/models/InscriptionMintAction.kt deleted file mode 100644 index f614fd371..000000000 --- a/tonapi/src/main/kotlin/io/tonapi/models/InscriptionMintAction.kt +++ /dev/null @@ -1,65 +0,0 @@ -/** - * - * Please note: - * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * Do not edit this file manually. - * - */ - -@file:Suppress( - "ArrayInDataClass", - "EnumEntryName", - "RemoveRedundantQualifierName", - "UnusedImport" -) - -package io.tonapi.models - -import io.tonapi.models.AccountAddress - -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass - -/** - * - * - * @param recipient - * @param amount amount in minimal particles - * @param type - * @param ticker - * @param decimals - */ - - -data class InscriptionMintAction ( - - @Json(name = "recipient") - val recipient: AccountAddress, - - /* amount in minimal particles */ - @Json(name = "amount") - val amount: kotlin.String, - - @Json(name = "type") - val type: InscriptionMintAction.Type, - - @Json(name = "ticker") - val ticker: kotlin.String, - - @Json(name = "decimals") - val decimals: kotlin.Int - -) { - - /** - * - * - * Values: ton20,gram20 - */ - @JsonClass(generateAdapter = false) - enum class Type(val value: kotlin.String) { - @Json(name = "ton20") ton20("ton20"), - @Json(name = "gram20") gram20("gram20"); - } -} - diff --git a/tonapi/src/main/kotlin/io/tonapi/models/InscriptionTransferAction.kt b/tonapi/src/main/kotlin/io/tonapi/models/InscriptionTransferAction.kt deleted file mode 100644 index 97d99c4d6..000000000 --- a/tonapi/src/main/kotlin/io/tonapi/models/InscriptionTransferAction.kt +++ /dev/null @@ -1,73 +0,0 @@ -/** - * - * Please note: - * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * Do not edit this file manually. - * - */ - -@file:Suppress( - "ArrayInDataClass", - "EnumEntryName", - "RemoveRedundantQualifierName", - "UnusedImport" -) - -package io.tonapi.models - -import io.tonapi.models.AccountAddress - -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass - -/** - * - * - * @param sender - * @param recipient - * @param amount amount in minimal particles - * @param type - * @param ticker - * @param decimals - * @param comment - */ - - -data class InscriptionTransferAction ( - - @Json(name = "sender") - val sender: AccountAddress, - - @Json(name = "recipient") - val recipient: AccountAddress, - - /* amount in minimal particles */ - @Json(name = "amount") - val amount: kotlin.String, - - @Json(name = "type") - val type: InscriptionTransferAction.Type, - - @Json(name = "ticker") - val ticker: kotlin.String, - - @Json(name = "decimals") - val decimals: kotlin.Int, - - @Json(name = "comment") - val comment: kotlin.String? = null - -) { - - /** - * - * - * Values: ton20,gram20 - */ - @JsonClass(generateAdapter = false) - enum class Type(val value: kotlin.String) { - @Json(name = "ton20") ton20("ton20"), - @Json(name = "gram20") gram20("gram20"); - } -} - diff --git a/tonapi/src/main/kotlin/io/tonapi/models/JettonBalance.kt b/tonapi/src/main/kotlin/io/tonapi/models/JettonBalance.kt index dd97d8ddd..af15932fd 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/JettonBalance.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/JettonBalance.kt @@ -20,40 +20,35 @@ import io.tonapi.models.JettonBalanceLock import io.tonapi.models.JettonPreview import io.tonapi.models.TokenRates -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param balance - * @param walletAddress - * @param jetton - * @param price - * @param extensions - * @param lock - */ +@Serializable data class JettonBalance ( - @Json(name = "balance") + @SerialName(value = "balance") val balance: kotlin.String, - @Json(name = "wallet_address") + @SerialName(value = "wallet_address") val walletAddress: AccountAddress, - @Json(name = "jetton") + @SerialName(value = "jetton") val jetton: JettonPreview, - @Json(name = "price") + @SerialName(value = "price") val price: TokenRates? = null, - @Json(name = "extensions") + @SerialName(value = "extensions") val extensions: kotlin.collections.List? = null, - @Json(name = "lock") + @SerialName(value = "lock") val lock: JettonBalanceLock? = null -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/JettonBalanceLock.kt b/tonapi/src/main/kotlin/io/tonapi/models/JettonBalanceLock.kt index ecae52444..5eb14277b 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/JettonBalanceLock.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/JettonBalanceLock.kt @@ -16,24 +16,23 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param amount - * @param till - */ +@Serializable data class JettonBalanceLock ( - @Json(name = "amount") + @SerialName(value = "amount") val amount: kotlin.String, - @Json(name = "till") + @SerialName(value = "till") val till: kotlin.Long -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/JettonBridgeParams.kt b/tonapi/src/main/kotlin/io/tonapi/models/JettonBridgeParams.kt index c929f80e0..dd58484ed 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/JettonBridgeParams.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/JettonBridgeParams.kt @@ -18,44 +18,38 @@ package io.tonapi.models import io.tonapi.models.JettonBridgePrices import io.tonapi.models.Oracle -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param bridgeAddress - * @param oraclesAddress - * @param stateFlags - * @param oracles - * @param burnBridgeFee - * @param externalChainAddress - * @param prices - */ +@Serializable data class JettonBridgeParams ( - @Json(name = "bridge_address") + @SerialName(value = "bridge_address") val bridgeAddress: kotlin.String, - @Json(name = "oracles_address") + @SerialName(value = "oracles_address") val oraclesAddress: kotlin.String, - @Json(name = "state_flags") + @SerialName(value = "state_flags") val stateFlags: kotlin.Int, - @Json(name = "oracles") + @SerialName(value = "oracles") val oracles: kotlin.collections.List, - @Json(name = "burn_bridge_fee") + @SerialName(value = "burn_bridge_fee") val burnBridgeFee: kotlin.Long? = null, - @Json(name = "external_chain_address") + @SerialName(value = "external_chain_address") val externalChainAddress: kotlin.String? = null, - @Json(name = "prices") + @SerialName(value = "prices") val prices: JettonBridgePrices? = null -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/JettonBridgePrices.kt b/tonapi/src/main/kotlin/io/tonapi/models/JettonBridgePrices.kt index 88b21935b..af9c3fa93 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/JettonBridgePrices.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/JettonBridgePrices.kt @@ -16,40 +16,35 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param bridgeBurnFee - * @param bridgeMintFee - * @param walletMinTonsForStorage - * @param walletGasConsumption - * @param minterMinTonsForStorage - * @param discoverGasConsumption - */ +@Serializable data class JettonBridgePrices ( - @Json(name = "bridge_burn_fee") + @SerialName(value = "bridge_burn_fee") val bridgeBurnFee: kotlin.Long, - @Json(name = "bridge_mint_fee") + @SerialName(value = "bridge_mint_fee") val bridgeMintFee: kotlin.Long, - @Json(name = "wallet_min_tons_for_storage") + @SerialName(value = "wallet_min_tons_for_storage") val walletMinTonsForStorage: kotlin.Long, - @Json(name = "wallet_gas_consumption") + @SerialName(value = "wallet_gas_consumption") val walletGasConsumption: kotlin.Long, - @Json(name = "minter_min_tons_for_storage") + @SerialName(value = "minter_min_tons_for_storage") val minterMinTonsForStorage: kotlin.Long, - @Json(name = "discover_gas_consumption") + @SerialName(value = "discover_gas_consumption") val discoverGasConsumption: kotlin.Long -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/JettonBurnAction.kt b/tonapi/src/main/kotlin/io/tonapi/models/JettonBurnAction.kt index 1131c01e2..6d2cf3c95 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/JettonBurnAction.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/JettonBurnAction.kt @@ -18,33 +18,30 @@ package io.tonapi.models import io.tonapi.models.AccountAddress import io.tonapi.models.JettonPreview -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param sender - * @param sendersWallet - * @param amount amount in quanta of tokens - * @param jetton - */ +@Serializable data class JettonBurnAction ( - @Json(name = "sender") + @SerialName(value = "sender") val sender: AccountAddress, - @Json(name = "senders_wallet") + @SerialName(value = "senders_wallet") val sendersWallet: kotlin.String, /* amount in quanta of tokens */ - @Json(name = "amount") + @SerialName(value = "amount") val amount: kotlin.String, - @Json(name = "jetton") + @SerialName(value = "jetton") val jetton: JettonPreview -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/JettonHolders.kt b/tonapi/src/main/kotlin/io/tonapi/models/JettonHolders.kt index 1e404421b..cd088d10e 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/JettonHolders.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/JettonHolders.kt @@ -17,25 +17,24 @@ package io.tonapi.models import io.tonapi.models.JettonHoldersAddressesInner -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param addresses - * @param total total number of holders - */ +@Serializable data class JettonHolders ( - @Json(name = "addresses") + @SerialName(value = "addresses") val addresses: kotlin.collections.List, /* total number of holders */ - @Json(name = "total") + @SerialName(value = "total") val total: kotlin.Long -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/JettonHoldersAddressesInner.kt b/tonapi/src/main/kotlin/io/tonapi/models/JettonHoldersAddressesInner.kt index a6cf9c456..b6bc551d4 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/JettonHoldersAddressesInner.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/JettonHoldersAddressesInner.kt @@ -17,29 +17,27 @@ package io.tonapi.models import io.tonapi.models.AccountAddress -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param address - * @param owner - * @param balance balance in the smallest jetton's units - */ +@Serializable data class JettonHoldersAddressesInner ( - @Json(name = "address") + @SerialName(value = "address") val address: kotlin.String, - @Json(name = "owner") + @SerialName(value = "owner") val owner: AccountAddress, /* balance in the smallest jetton's units */ - @Json(name = "balance") + @SerialName(value = "balance") val balance: kotlin.String -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/JettonInfo.kt b/tonapi/src/main/kotlin/io/tonapi/models/JettonInfo.kt index 8dd5f79ec..7366d52b0 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/JettonInfo.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/JettonInfo.kt @@ -19,46 +19,38 @@ import io.tonapi.models.AccountAddress import io.tonapi.models.JettonMetadata import io.tonapi.models.JettonVerificationType -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param mintable - * @param totalSupply - * @param metadata - * @param verification - * @param holdersCount - * @param admin - */ +@Serializable data class JettonInfo ( - @Json(name = "mintable") + @SerialName(value = "mintable") val mintable: kotlin.Boolean, - @Json(name = "total_supply") + @SerialName(value = "total_supply") val totalSupply: kotlin.String, - @Json(name = "metadata") + @SerialName(value = "metadata") val metadata: JettonMetadata, - @Json(name = "verification") + @SerialName(value = "preview") + val preview: kotlin.String, + + @Contextual @SerialName(value = "verification") val verification: JettonVerificationType, - @Json(name = "holders_count") + @SerialName(value = "holders_count") val holdersCount: kotlin.Int, - @Json(name = "admin") - val admin: AccountAddress? = null, + @SerialName(value = "admin") + val admin: AccountAddress? = null - @Json(name = "custom_payload_api_uri") - val customPayloadApiUri: kotlin.String? = null, +) { - @Json(name = "preview") - val preview: kotlin.String? = null -) +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/JettonMetadata.kt b/tonapi/src/main/kotlin/io/tonapi/models/JettonMetadata.kt index f397d1cf4..ac9fed2bf 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/JettonMetadata.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/JettonMetadata.kt @@ -16,52 +16,48 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param address - * @param name - * @param symbol - * @param decimals - * @param image - * @param description - * @param social - * @param websites - * @param catalogs - */ +@Serializable data class JettonMetadata ( - @Json(name = "address") + @SerialName(value = "address") val address: kotlin.String, - @Json(name = "name") + @SerialName(value = "name") val name: kotlin.String, - @Json(name = "symbol") + @SerialName(value = "symbol") val symbol: kotlin.String, - @Json(name = "decimals") + @SerialName(value = "decimals") val decimals: kotlin.String, - @Json(name = "image") + /* this field currently returns a cached image URL (e.g., \"https://cache.tonapi.io/images/jetton.jpg\"). In the future, this will be replaced with the original URL from the metadata. The cached image is already available in the `preview` field of `JettonInfo` and will remain there. */ + @SerialName(value = "image") val image: kotlin.String? = null, - @Json(name = "description") + @SerialName(value = "description") val description: kotlin.String? = null, - @Json(name = "social") + @SerialName(value = "social") val social: kotlin.collections.List? = null, - @Json(name = "websites") + @SerialName(value = "websites") val websites: kotlin.collections.List? = null, - @Json(name = "catalogs") - val catalogs: kotlin.collections.List? = null + @SerialName(value = "catalogs") + val catalogs: kotlin.collections.List? = null, -) + @SerialName(value = "custom_payload_api_uri") + val customPayloadApiUri: kotlin.String? = null + +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/JettonMintAction.kt b/tonapi/src/main/kotlin/io/tonapi/models/JettonMintAction.kt index dbe77a245..42b7b3c68 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/JettonMintAction.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/JettonMintAction.kt @@ -18,33 +18,30 @@ package io.tonapi.models import io.tonapi.models.AccountAddress import io.tonapi.models.JettonPreview -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param recipient - * @param recipientsWallet - * @param amount amount in quanta of tokens - * @param jetton - */ +@Serializable data class JettonMintAction ( - @Json(name = "recipient") + @SerialName(value = "recipient") val recipient: AccountAddress, - @Json(name = "recipients_wallet") + @SerialName(value = "recipients_wallet") val recipientsWallet: kotlin.String, /* amount in quanta of tokens */ - @Json(name = "amount") + @SerialName(value = "amount") val amount: kotlin.String, - @Json(name = "jetton") + @SerialName(value = "jetton") val jetton: JettonPreview -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/JettonOperation.kt b/tonapi/src/main/kotlin/io/tonapi/models/JettonOperation.kt new file mode 100644 index 000000000..611f10f6f --- /dev/null +++ b/tonapi/src/main/kotlin/io/tonapi/models/JettonOperation.kt @@ -0,0 +1,78 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package io.tonapi.models + +import io.tonapi.models.AccountAddress +import io.tonapi.models.JettonPreview + +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual + + +@Serializable + +data class JettonOperation ( + + @SerialName(value = "operation") + val operation: JettonOperation.Operation, + + @SerialName(value = "utime") + val utime: kotlin.Long, + + @SerialName(value = "lt") + val lt: kotlin.Long, + + @SerialName(value = "transaction_hash") + val transactionHash: kotlin.String, + + @SerialName(value = "amount") + val amount: kotlin.String, + + @SerialName(value = "jetton") + val jetton: JettonPreview, + + @SerialName(value = "trace_id") + val traceId: kotlin.String, + + @SerialName(value = "query_id") + val queryId: kotlin.String, + + @SerialName(value = "source") + val source: AccountAddress? = null, + + @SerialName(value = "destination") + val destination: AccountAddress? = null, + + @Contextual @SerialName(value = "payload") + val payload: kotlin.Any? = null + +) { + + /** + * + * + * Values: transfer,mint,burn + */ + @Serializable + enum class Operation(val value: kotlin.String) { + @SerialName(value = "transfer") transfer("transfer"), + @SerialName(value = "mint") mint("mint"), + @SerialName(value = "burn") burn("burn"); + } + +} + diff --git a/tonapi/src/main/kotlin/io/tonapi/models/JettonOperations.kt b/tonapi/src/main/kotlin/io/tonapi/models/JettonOperations.kt new file mode 100644 index 000000000..4ed1e1141 --- /dev/null +++ b/tonapi/src/main/kotlin/io/tonapi/models/JettonOperations.kt @@ -0,0 +1,39 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package io.tonapi.models + +import io.tonapi.models.JettonOperation + +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual + + +@Serializable + +data class JettonOperations ( + + @SerialName(value = "operations") + val operations: kotlin.collections.List, + + @SerialName(value = "next_from") + val nextFrom: kotlin.Long? = null + +) { + + +} + diff --git a/tonapi/src/main/kotlin/io/tonapi/models/JettonPreview.kt b/tonapi/src/main/kotlin/io/tonapi/models/JettonPreview.kt index 74681a3dd..825c05c42 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/JettonPreview.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/JettonPreview.kt @@ -17,43 +17,41 @@ package io.tonapi.models import io.tonapi.models.JettonVerificationType -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param address - * @param name - * @param symbol - * @param decimals - * @param image - * @param verification - */ +@Serializable data class JettonPreview ( - @Json(name = "address") + @SerialName(value = "address") val address: kotlin.String, - @Json(name = "name") + @SerialName(value = "name") val name: kotlin.String, - @Json(name = "symbol") + @SerialName(value = "symbol") val symbol: kotlin.String, - @Json(name = "decimals") + @SerialName(value = "decimals") val decimals: kotlin.Int, - @Json(name = "image") + @SerialName(value = "image") val image: kotlin.String, - @Json(name = "verification") + @Contextual @SerialName(value = "verification") val verification: JettonVerificationType, - @Json(name = "custom_payload_api_uri") + @SerialName(value = "score") + val score: kotlin.Int, + + @SerialName(value = "custom_payload_api_uri") val customPayloadApiUri: kotlin.String? = null -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/JettonQuantity.kt b/tonapi/src/main/kotlin/io/tonapi/models/JettonQuantity.kt index 92a4d983c..104b2f36f 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/JettonQuantity.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/JettonQuantity.kt @@ -18,28 +18,26 @@ package io.tonapi.models import io.tonapi.models.AccountAddress import io.tonapi.models.JettonPreview -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param quantity - * @param walletAddress - * @param jetton - */ +@Serializable data class JettonQuantity ( - @Json(name = "quantity") + @SerialName(value = "quantity") val quantity: kotlin.String, - @Json(name = "wallet_address") + @SerialName(value = "wallet_address") val walletAddress: AccountAddress, - @Json(name = "jetton") + @SerialName(value = "jetton") val jetton: JettonPreview -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/JettonSwapAction.kt b/tonapi/src/main/kotlin/io/tonapi/models/JettonSwapAction.kt index 6b04aa681..10f680f36 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/JettonSwapAction.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/JettonSwapAction.kt @@ -18,51 +18,40 @@ package io.tonapi.models import io.tonapi.models.AccountAddress import io.tonapi.models.JettonPreview -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param dex - * @param amountIn - * @param amountOut - * @param userWallet - * @param router - * @param tonIn - * @param tonOut - * @param jettonMasterIn - * @param jettonMasterOut - */ +@Serializable data class JettonSwapAction ( - @Json(name = "dex") + @SerialName(value = "dex") val dex: JettonSwapAction.Dex, - @Json(name = "amount_in") + @SerialName(value = "amount_in") val amountIn: kotlin.String, - @Json(name = "amount_out") + @SerialName(value = "amount_out") val amountOut: kotlin.String, - @Json(name = "user_wallet") + @SerialName(value = "user_wallet") val userWallet: AccountAddress, - @Json(name = "router") + @SerialName(value = "router") val router: AccountAddress, - @Json(name = "ton_in") + @SerialName(value = "ton_in") val tonIn: kotlin.Long? = null, - @Json(name = "ton_out") + @SerialName(value = "ton_out") val tonOut: kotlin.Long? = null, - @Json(name = "jetton_master_in") + @SerialName(value = "jetton_master_in") val jettonMasterIn: JettonPreview? = null, - @Json(name = "jetton_master_out") + @SerialName(value = "jetton_master_out") val jettonMasterOut: JettonPreview? = null ) { @@ -72,11 +61,12 @@ data class JettonSwapAction ( * * Values: stonfi,dedust,megatonfi */ - @JsonClass(generateAdapter = false) + @Serializable enum class Dex(val value: kotlin.String) { - @Json(name = "stonfi") stonfi("stonfi"), - @Json(name = "dedust") dedust("dedust"), - @Json(name = "megatonfi") megatonfi("megatonfi"); + @SerialName(value = "stonfi") stonfi("stonfi"), + @SerialName(value = "dedust") dedust("dedust"), + @SerialName(value = "megatonfi") megatonfi("megatonfi"); } + } diff --git a/tonapi/src/main/kotlin/io/tonapi/models/JettonTransferAction.kt b/tonapi/src/main/kotlin/io/tonapi/models/JettonTransferAction.kt index be1b8dddc..b91a4d242 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/JettonTransferAction.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/JettonTransferAction.kt @@ -20,53 +20,45 @@ import io.tonapi.models.EncryptedComment import io.tonapi.models.JettonPreview import io.tonapi.models.Refund -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param sendersWallet - * @param recipientsWallet - * @param amount amount in quanta of tokens - * @param jetton - * @param sender - * @param recipient - * @param comment - * @param encryptedComment - * @param refund - */ +@Serializable data class JettonTransferAction ( - @Json(name = "senders_wallet") + @SerialName(value = "senders_wallet") val sendersWallet: kotlin.String, - @Json(name = "recipients_wallet") + @SerialName(value = "recipients_wallet") val recipientsWallet: kotlin.String, /* amount in quanta of tokens */ - @Json(name = "amount") + @SerialName(value = "amount") val amount: kotlin.String, - @Json(name = "jetton") + @SerialName(value = "jetton") val jetton: JettonPreview, - @Json(name = "sender") + @SerialName(value = "sender") val sender: AccountAddress? = null, - @Json(name = "recipient") + @SerialName(value = "recipient") val recipient: AccountAddress? = null, - @Json(name = "comment") + @SerialName(value = "comment") val comment: kotlin.String? = null, - @Json(name = "encrypted_comment") + @SerialName(value = "encrypted_comment") val encryptedComment: EncryptedComment? = null, - @Json(name = "refund") + @SerialName(value = "refund") val refund: Refund? = null -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/JettonTransferPayload.kt b/tonapi/src/main/kotlin/io/tonapi/models/JettonTransferPayload.kt index 9cebef364..64027baca 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/JettonTransferPayload.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/JettonTransferPayload.kt @@ -16,26 +16,25 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param customPayload hex-encoded BoC - * @param stateInit hex-encoded BoC - */ +@Serializable data class JettonTransferPayload ( /* hex-encoded BoC */ - @Json(name = "custom_payload") + @SerialName(value = "custom_payload") val customPayload: kotlin.String? = null, /* hex-encoded BoC */ - @Json(name = "state_init") + @SerialName(value = "state_init") val stateInit: kotlin.String? = null -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/JettonVerificationType.kt b/tonapi/src/main/kotlin/io/tonapi/models/JettonVerificationType.kt index de07b415a..6732af77b 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/JettonVerificationType.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/JettonVerificationType.kt @@ -16,31 +16,26 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable /** * * * Values: whitelist,blacklist,none */ - -@JsonClass(generateAdapter = false) +@Serializable enum class JettonVerificationType(val value: kotlin.String) { - @Json(name = "whitelist") + @SerialName(value = "whitelist") whitelist("whitelist"), - @Json(name = "blacklist") + @SerialName(value = "blacklist") blacklist("blacklist"), - @Json(name = "graylist") - graylist("graylist"), - - @Json(name = "none") + @SerialName(value = "none") none("none"); - /** * Override [toString()] to avoid using the enum variable name as the value, and instead use * the actual value defined in the API spec file. diff --git a/tonapi/src/main/kotlin/io/tonapi/models/Jettons.kt b/tonapi/src/main/kotlin/io/tonapi/models/Jettons.kt index 74b425cea..de350e71d 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/Jettons.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/Jettons.kt @@ -17,20 +17,20 @@ package io.tonapi.models import io.tonapi.models.JettonInfo -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param jettons - */ +@Serializable data class Jettons ( - @Json(name = "jettons") + @SerialName(value = "jettons") val jettons: kotlin.collections.List -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/JettonsBalances.kt b/tonapi/src/main/kotlin/io/tonapi/models/JettonsBalances.kt index f62c577ac..a761e009e 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/JettonsBalances.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/JettonsBalances.kt @@ -17,20 +17,20 @@ package io.tonapi.models import io.tonapi.models.JettonBalance -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param balances - */ +@Serializable data class JettonsBalances ( - @Json(name = "balances") + @SerialName(value = "balances") val balances: kotlin.collections.List -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/MarketTonRates.kt b/tonapi/src/main/kotlin/io/tonapi/models/MarketTonRates.kt index 34f2ffbf9..461bebe86 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/MarketTonRates.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/MarketTonRates.kt @@ -16,28 +16,26 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param market - * @param usdPrice - * @param lastDateUpdate - */ +@Serializable data class MarketTonRates ( - @Json(name = "market") + @SerialName(value = "market") val market: kotlin.String, - @Json(name = "usd_price") - val usdPrice: java.math.BigDecimal, + @SerialName(value = "usd_price") + val usdPrice: kotlin.String, - @Json(name = "last_date_update") + @SerialName(value = "last_date_update") val lastDateUpdate: kotlin.Long -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/Message.kt b/tonapi/src/main/kotlin/io/tonapi/models/Message.kt index df636efdc..bdce57844 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/Message.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/Message.kt @@ -16,90 +16,74 @@ package io.tonapi.models import io.tonapi.models.AccountAddress +import io.tonapi.models.ExtraCurrency import io.tonapi.models.StateInit -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param msgType - * @param createdLt - * @param ihrDisabled - * @param bounce - * @param bounced - * @param `value` - * @param fwdFee - * @param ihrFee - * @param importFee - * @param createdAt - * @param hash - * @param destination - * @param source - * @param opCode - * @param `init` - * @param rawBody hex-encoded BoC with raw message body - * @param decodedOpName - * @param decodedBody - */ +@Serializable data class Message ( - @Json(name = "msg_type") + @SerialName(value = "msg_type") val msgType: Message.MsgType, - @Json(name = "created_lt") + @SerialName(value = "created_lt") val createdLt: kotlin.Long, - @Json(name = "ihr_disabled") + @SerialName(value = "ihr_disabled") val ihrDisabled: kotlin.Boolean, - @Json(name = "bounce") + @SerialName(value = "bounce") val bounce: kotlin.Boolean, - @Json(name = "bounced") + @SerialName(value = "bounced") val bounced: kotlin.Boolean, - @Json(name = "value") + @SerialName(value = "value") val `value`: kotlin.Long, - @Json(name = "fwd_fee") + @SerialName(value = "fwd_fee") val fwdFee: kotlin.Long, - @Json(name = "ihr_fee") + @SerialName(value = "ihr_fee") val ihrFee: kotlin.Long, - @Json(name = "import_fee") + @SerialName(value = "import_fee") val importFee: kotlin.Long, - @Json(name = "created_at") + @SerialName(value = "created_at") val createdAt: kotlin.Long, - @Json(name = "hash") - val hash: kotlin.String? = null, + @SerialName(value = "hash") + val hash: kotlin.String, - @Json(name = "destination") + @SerialName(value = "value_extra") + val valueExtra: kotlin.collections.List? = null, + + @SerialName(value = "destination") val destination: AccountAddress? = null, - @Json(name = "source") + @SerialName(value = "source") val source: AccountAddress? = null, - @Json(name = "op_code") + @SerialName(value = "op_code") val opCode: kotlin.String? = null, - @Json(name = "init") + @SerialName(value = "init") val `init`: StateInit? = null, /* hex-encoded BoC with raw message body */ - @Json(name = "raw_body") + @SerialName(value = "raw_body") val rawBody: kotlin.String? = null, - @Json(name = "decoded_op_name") + @SerialName(value = "decoded_op_name") val decodedOpName: kotlin.String? = null, - @Json(name = "decoded_body") + @Contextual @SerialName(value = "decoded_body") val decodedBody: kotlin.Any? = null ) { @@ -107,13 +91,14 @@ data class Message ( /** * * - * Values: intMsg,extInMsg,extOutMsg + * Values: int_msg,ext_in_msg,ext_out_msg */ - @JsonClass(generateAdapter = false) + @Serializable enum class MsgType(val value: kotlin.String) { - @Json(name = "int_msg") intMsg("int_msg"), - @Json(name = "ext_in_msg") extInMsg("ext_in_msg"), - @Json(name = "ext_out_msg") extOutMsg("ext_out_msg"); + @SerialName(value = "int_msg") int_msg("int_msg"), + @SerialName(value = "ext_in_msg") ext_in_msg("ext_in_msg"), + @SerialName(value = "ext_out_msg") ext_out_msg("ext_out_msg"); } + } diff --git a/tonapi/src/main/kotlin/io/tonapi/models/MessageConsequences.kt b/tonapi/src/main/kotlin/io/tonapi/models/MessageConsequences.kt index ac5a4c3da..5ee991222 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/MessageConsequences.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/MessageConsequences.kt @@ -19,28 +19,26 @@ import io.tonapi.models.AccountEvent import io.tonapi.models.Risk import io.tonapi.models.Trace -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param trace - * @param risk - * @param event - */ +@Serializable data class MessageConsequences ( - @Json(name = "trace") + @SerialName(value = "trace") val trace: Trace, - @Json(name = "risk") + @SerialName(value = "risk") val risk: Risk, - @Json(name = "event") + @SerialName(value = "event") val event: AccountEvent -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/Metadata.kt b/tonapi/src/main/kotlin/io/tonapi/models/Metadata.kt new file mode 100644 index 000000000..4f2bca41a --- /dev/null +++ b/tonapi/src/main/kotlin/io/tonapi/models/Metadata.kt @@ -0,0 +1,40 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package io.tonapi.models + + +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual + + +@Serializable + +data class Metadata ( + + /* hex encoded bytes */ + @SerialName(value = "encrypted_binary") + val encryptedBinary: kotlin.String, + + /* hex encoded bytes */ + @SerialName(value = "decryption_key") + val decryptionKey: kotlin.String? = null + +) { + + +} + diff --git a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainAccountInspectMethodsInner.kt b/tonapi/src/main/kotlin/io/tonapi/models/Method.kt similarity index 61% rename from tonapi/src/main/kotlin/io/tonapi/models/BlockchainAccountInspectMethodsInner.kt rename to tonapi/src/main/kotlin/io/tonapi/models/Method.kt index 7385f5189..58bf68103 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/BlockchainAccountInspectMethodsInner.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/Method.kt @@ -16,24 +16,23 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param id - * @param method - */ +@Serializable -data class BlockchainAccountInspectMethodsInner ( +data class Method ( - @Json(name = "id") + @SerialName(value = "id") val id: kotlin.Long, - @Json(name = "method") + @SerialName(value = "method") val method: kotlin.String -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/MethodExecutionResult.kt b/tonapi/src/main/kotlin/io/tonapi/models/MethodExecutionResult.kt index c0945bba7..eab48886e 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/MethodExecutionResult.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/MethodExecutionResult.kt @@ -17,33 +17,30 @@ package io.tonapi.models import io.tonapi.models.TvmStackRecord -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param success - * @param exitCode tvm exit code - * @param stack - * @param decoded - */ +@Serializable data class MethodExecutionResult ( - @Json(name = "success") + @SerialName(value = "success") val success: kotlin.Boolean, /* tvm exit code */ - @Json(name = "exit_code") + @SerialName(value = "exit_code") val exitCode: kotlin.Int, - @Json(name = "stack") + @SerialName(value = "stack") val stack: kotlin.collections.List, - @Json(name = "decoded") + @Contextual @SerialName(value = "decoded") val decoded: kotlin.Any? = null -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/MisbehaviourPunishmentConfig.kt b/tonapi/src/main/kotlin/io/tonapi/models/MisbehaviourPunishmentConfig.kt index 60b6e3b18..8847ec397 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/MisbehaviourPunishmentConfig.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/MisbehaviourPunishmentConfig.kt @@ -16,60 +16,50 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param defaultFlatFine - * @param defaultProportionalFine - * @param severityFlatMult - * @param severityProportionalMult - * @param unpunishableInterval - * @param longInterval - * @param longFlatMult - * @param longProportionalMult - * @param mediumInterval - * @param mediumFlatMult - * @param mediumProportionalMult - */ +@Serializable data class MisbehaviourPunishmentConfig ( - @Json(name = "default_flat_fine") + @SerialName(value = "default_flat_fine") val defaultFlatFine: kotlin.Long, - @Json(name = "default_proportional_fine") + @SerialName(value = "default_proportional_fine") val defaultProportionalFine: kotlin.Long, - @Json(name = "severity_flat_mult") + @SerialName(value = "severity_flat_mult") val severityFlatMult: kotlin.Int, - @Json(name = "severity_proportional_mult") + @SerialName(value = "severity_proportional_mult") val severityProportionalMult: kotlin.Int, - @Json(name = "unpunishable_interval") + @SerialName(value = "unpunishable_interval") val unpunishableInterval: kotlin.Int, - @Json(name = "long_interval") + @SerialName(value = "long_interval") val longInterval: kotlin.Int, - @Json(name = "long_flat_mult") + @SerialName(value = "long_flat_mult") val longFlatMult: kotlin.Int, - @Json(name = "long_proportional_mult") + @SerialName(value = "long_proportional_mult") val longProportionalMult: kotlin.Int, - @Json(name = "medium_interval") + @SerialName(value = "medium_interval") val mediumInterval: kotlin.Int, - @Json(name = "medium_flat_mult") + @SerialName(value = "medium_flat_mult") val mediumFlatMult: kotlin.Int, - @Json(name = "medium_proportional_mult") + @SerialName(value = "medium_proportional_mult") val mediumProportionalMult: kotlin.Int -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/MsgForwardPrices.kt b/tonapi/src/main/kotlin/io/tonapi/models/MsgForwardPrices.kt index 69918ac96..22819bff4 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/MsgForwardPrices.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/MsgForwardPrices.kt @@ -16,40 +16,35 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param lumpPrice - * @param bitPrice - * @param cellPrice - * @param ihrPriceFactor - * @param firstFrac - * @param nextFrac - */ +@Serializable data class MsgForwardPrices ( - @Json(name = "lump_price") + @SerialName(value = "lump_price") val lumpPrice: kotlin.Long, - @Json(name = "bit_price") + @SerialName(value = "bit_price") val bitPrice: kotlin.Long, - @Json(name = "cell_price") + @SerialName(value = "cell_price") val cellPrice: kotlin.Long, - @Json(name = "ihr_price_factor") + @SerialName(value = "ihr_price_factor") val ihrPriceFactor: kotlin.Long, - @Json(name = "first_frac") + @SerialName(value = "first_frac") val firstFrac: kotlin.Long, - @Json(name = "next_frac") + @SerialName(value = "next_frac") val nextFrac: kotlin.Long -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/Multisig.kt b/tonapi/src/main/kotlin/io/tonapi/models/Multisig.kt index 10358bf31..e5511ddd6 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/Multisig.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/Multisig.kt @@ -17,40 +17,35 @@ package io.tonapi.models import io.tonapi.models.MultisigOrder -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param address - * @param seqno - * @param threshold - * @param signers - * @param proposers - * @param orders - */ +@Serializable data class Multisig ( - @Json(name = "address") + @SerialName(value = "address") val address: kotlin.String, - @Json(name = "seqno") + @SerialName(value = "seqno") val seqno: kotlin.Long, - @Json(name = "threshold") + @SerialName(value = "threshold") val threshold: kotlin.Int, - @Json(name = "signers") + @SerialName(value = "signers") val signers: kotlin.collections.List, - @Json(name = "proposers") + @SerialName(value = "proposers") val proposers: kotlin.collections.List, - @Json(name = "orders") + @SerialName(value = "orders") val orders: kotlin.collections.List -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/MultisigOrder.kt b/tonapi/src/main/kotlin/io/tonapi/models/MultisigOrder.kt index a233af125..bb5b189b9 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/MultisigOrder.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/MultisigOrder.kt @@ -15,45 +15,56 @@ package io.tonapi.models +import io.tonapi.models.MultisigOrderChangingParameters +import io.tonapi.models.Risk -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param address - * @param orderSeqno - * @param threshold - * @param sentForExecution - * @param signers - * @param approvalsNum - * @param expirationDate - */ +@Serializable data class MultisigOrder ( - @Json(name = "address") + @SerialName(value = "address") val address: kotlin.String, - @Json(name = "order_seqno") + @SerialName(value = "order_seqno") val orderSeqno: kotlin.Long, - @Json(name = "threshold") + @SerialName(value = "threshold") val threshold: kotlin.Int, - @Json(name = "sent_for_execution") + @SerialName(value = "sent_for_execution") val sentForExecution: kotlin.Boolean, - @Json(name = "signers") + @SerialName(value = "signers") val signers: kotlin.collections.List, - @Json(name = "approvals_num") + @SerialName(value = "approvals_num") val approvalsNum: kotlin.Int, - @Json(name = "expiration_date") - val expirationDate: kotlin.Long + @SerialName(value = "expiration_date") + val expirationDate: kotlin.Long, -) + @SerialName(value = "risk") + val risk: Risk, + + @SerialName(value = "creation_date") + val creationDate: kotlin.Long, + + @SerialName(value = "signed_by") + val signedBy: kotlin.collections.List, + + @SerialName(value = "multisig_address") + val multisigAddress: kotlin.String, + + @SerialName(value = "changing_parameters") + val changingParameters: MultisigOrderChangingParameters? = null + +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/MultisigOrderChangingParameters.kt b/tonapi/src/main/kotlin/io/tonapi/models/MultisigOrderChangingParameters.kt new file mode 100644 index 000000000..320b40832 --- /dev/null +++ b/tonapi/src/main/kotlin/io/tonapi/models/MultisigOrderChangingParameters.kt @@ -0,0 +1,41 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package io.tonapi.models + + +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual + + +@Serializable + +data class MultisigOrderChangingParameters ( + + @SerialName(value = "threshold") + val threshold: kotlin.Int, + + @SerialName(value = "signers") + val signers: kotlin.collections.List, + + @SerialName(value = "proposers") + val proposers: kotlin.collections.List + +) { + + +} + diff --git a/tonapi/src/main/kotlin/io/tonapi/models/Multisigs.kt b/tonapi/src/main/kotlin/io/tonapi/models/Multisigs.kt index 2f699fb57..d0a420ca7 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/Multisigs.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/Multisigs.kt @@ -17,20 +17,20 @@ package io.tonapi.models import io.tonapi.models.Multisig -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param multisigs - */ +@Serializable data class Multisigs ( - @Json(name = "multisigs") + @SerialName(value = "multisigs") val multisigs: kotlin.collections.List -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/NftCollection.kt b/tonapi/src/main/kotlin/io/tonapi/models/NftCollection.kt index 53268bfd3..16261087e 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/NftCollection.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/NftCollection.kt @@ -18,43 +18,34 @@ package io.tonapi.models import io.tonapi.models.AccountAddress import io.tonapi.models.ImagePreview -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param address - * @param nextItemIndex - * @param rawCollectionContent - * @param approvedBy - * @param owner - * @param metadata - * @param previews - */ +@Serializable data class NftCollection ( - @Json(name = "address") + @SerialName(value = "address") val address: kotlin.String, - @Json(name = "next_item_index") + @SerialName(value = "next_item_index") val nextItemIndex: kotlin.Long, - @Json(name = "raw_collection_content") + @SerialName(value = "raw_collection_content") val rawCollectionContent: kotlin.String, - @Json(name = "approved_by") + @SerialName(value = "approved_by") val approvedBy: kotlin.collections.List, - @Json(name = "owner") + @SerialName(value = "owner") val owner: AccountAddress? = null, - @Json(name = "metadata") - val metadata: kotlin.collections.Map? = null, + @Contextual @SerialName(value = "metadata") + val metadata: kotlin.collections.Map? = null, - @Json(name = "previews") + @SerialName(value = "previews") val previews: kotlin.collections.List? = null ) { @@ -62,13 +53,13 @@ data class NftCollection ( /** * * - * Values: getgems,tonkeeper,tonPeriodDiamonds + * Values: getgems,tonkeeper */ - @JsonClass(generateAdapter = false) + @Serializable enum class ApprovedBy(val value: kotlin.String) { - @Json(name = "getgems") getgems("getgems"), - @Json(name = "tonkeeper") tonkeeper("tonkeeper"), - @Json(name = "ton.diamonds") tonPeriodDiamonds("ton.diamonds"); + @SerialName(value = "getgems") getgems("getgems"), + @SerialName(value = "tonkeeper") tonkeeper("tonkeeper"); } + } diff --git a/tonapi/src/main/kotlin/io/tonapi/models/NftCollections.kt b/tonapi/src/main/kotlin/io/tonapi/models/NftCollections.kt index fe107ce57..01763a973 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/NftCollections.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/NftCollections.kt @@ -17,20 +17,20 @@ package io.tonapi.models import io.tonapi.models.NftCollection -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param nftCollections - */ +@Serializable data class NftCollections ( - @Json(name = "nft_collections") + @SerialName(value = "nft_collections") val nftCollections: kotlin.collections.List -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/NftItem.kt b/tonapi/src/main/kotlin/io/tonapi/models/NftItem.kt index 86c57f22d..1b4977b7d 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/NftItem.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/NftItem.kt @@ -21,77 +21,66 @@ import io.tonapi.models.NftItemCollection import io.tonapi.models.Sale import io.tonapi.models.TrustType -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param address - * @param index - * @param verified - * @param metadata - * @param approvedBy - * @param trust - * @param owner - * @param collection - * @param sale - * @param previews - * @param dns - * @param includeCnft - */ +@Serializable data class NftItem ( - @Json(name = "address") + @SerialName(value = "address") val address: kotlin.String, - @Json(name = "index") + @SerialName(value = "index") val index: kotlin.Long, - @Json(name = "verified") + /* Collection master contract confirmed that this item is part of collection */ + @SerialName(value = "verified") val verified: kotlin.Boolean, - @Json(name = "metadata") - val metadata: kotlin.collections.Map, + @Contextual @SerialName(value = "metadata") + val metadata: kotlin.collections.Map, - @Json(name = "approved_by") + /* Please use trust field */ + @SerialName(value = "approved_by") + @Deprecated(message = "This property is deprecated.") val approvedBy: kotlin.collections.List, - @Json(name = "trust") - val trust: String, + @Contextual @SerialName(value = "trust") + val trust: TrustType, - @Json(name = "owner") + @SerialName(value = "owner") val owner: AccountAddress? = null, - @Json(name = "collection") + @SerialName(value = "collection") val collection: NftItemCollection? = null, - @Json(name = "sale") + @SerialName(value = "sale") val sale: Sale? = null, - @Json(name = "previews") + @SerialName(value = "previews") val previews: kotlin.collections.List? = null, - @Json(name = "dns") + @SerialName(value = "dns") val dns: kotlin.String? = null, - @Json(name = "include_cnft") + @SerialName(value = "include_cnft") val includeCnft: kotlin.Boolean? = null ) { /** - * + * Please use trust field * - * Values: getgems,tonkeeper,tonPeriodDiamonds + * Values: getgems,tonkeeper */ - @JsonClass(generateAdapter = false) + @Serializable enum class ApprovedBy(val value: kotlin.String) { - @Json(name = "getgems") getgems("getgems"), - @Json(name = "tonkeeper") tonkeeper("tonkeeper"), - @Json(name = "ton.diamonds") tonPeriodDiamonds("ton.diamonds"); + @SerialName(value = "getgems") getgems("getgems"), + @SerialName(value = "tonkeeper") tonkeeper("tonkeeper"); } + } diff --git a/tonapi/src/main/kotlin/io/tonapi/models/NftItemCollection.kt b/tonapi/src/main/kotlin/io/tonapi/models/NftItemCollection.kt index 27dd5051d..330edc5de 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/NftItemCollection.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/NftItemCollection.kt @@ -16,28 +16,26 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param address - * @param name - * @param description - */ +@Serializable data class NftItemCollection ( - @Json(name = "address") + @SerialName(value = "address") val address: kotlin.String, - @Json(name = "name") + @SerialName(value = "name") val name: kotlin.String, - @Json(name = "description") + @SerialName(value = "description") val description: kotlin.String -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/NftItemTransferAction.kt b/tonapi/src/main/kotlin/io/tonapi/models/NftItemTransferAction.kt index 6ab481aa4..f65724c23 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/NftItemTransferAction.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/NftItemTransferAction.kt @@ -19,45 +19,39 @@ import io.tonapi.models.AccountAddress import io.tonapi.models.EncryptedComment import io.tonapi.models.Refund -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param nft - * @param sender - * @param recipient - * @param comment - * @param encryptedComment - * @param payload raw hex encoded payload - * @param refund - */ +@Serializable data class NftItemTransferAction ( - @Json(name = "nft") + @SerialName(value = "nft") val nft: kotlin.String, - @Json(name = "sender") + @SerialName(value = "sender") val sender: AccountAddress? = null, - @Json(name = "recipient") + @SerialName(value = "recipient") val recipient: AccountAddress? = null, - @Json(name = "comment") + @SerialName(value = "comment") val comment: kotlin.String? = null, - @Json(name = "encrypted_comment") + @SerialName(value = "encrypted_comment") val encryptedComment: EncryptedComment? = null, /* raw hex encoded payload */ - @Json(name = "payload") + @SerialName(value = "payload") val payload: kotlin.String? = null, - @Json(name = "refund") + @SerialName(value = "refund") val refund: Refund? = null -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/NftItems.kt b/tonapi/src/main/kotlin/io/tonapi/models/NftItems.kt index fa1caf789..33b4f24d7 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/NftItems.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/NftItems.kt @@ -17,20 +17,20 @@ package io.tonapi.models import io.tonapi.models.NftItem -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param nftItems - */ +@Serializable data class NftItems ( - @Json(name = "nft_items") + @SerialName(value = "nft_items") val nftItems: kotlin.collections.List -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/NftOperation.kt b/tonapi/src/main/kotlin/io/tonapi/models/NftOperation.kt new file mode 100644 index 000000000..9912cee15 --- /dev/null +++ b/tonapi/src/main/kotlin/io/tonapi/models/NftOperation.kt @@ -0,0 +1,55 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package io.tonapi.models + +import io.tonapi.models.AccountAddress +import io.tonapi.models.NftItem + +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual + + +@Serializable + +data class NftOperation ( + + @SerialName(value = "operation") + val operation: kotlin.String, + + @SerialName(value = "utime") + val utime: kotlin.Long, + + @SerialName(value = "lt") + val lt: kotlin.Long, + + @SerialName(value = "transaction_hash") + val transactionHash: kotlin.String, + + @SerialName(value = "item") + val item: NftItem, + + @SerialName(value = "source") + val source: AccountAddress? = null, + + @SerialName(value = "destination") + val destination: AccountAddress? = null + +) { + + +} + diff --git a/tonapi/src/main/kotlin/io/tonapi/models/NftOperations.kt b/tonapi/src/main/kotlin/io/tonapi/models/NftOperations.kt new file mode 100644 index 000000000..7fbfbe509 --- /dev/null +++ b/tonapi/src/main/kotlin/io/tonapi/models/NftOperations.kt @@ -0,0 +1,39 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package io.tonapi.models + +import io.tonapi.models.NftOperation + +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual + + +@Serializable + +data class NftOperations ( + + @SerialName(value = "operations") + val operations: kotlin.collections.List, + + @SerialName(value = "next_from") + val nextFrom: kotlin.Long? = null + +) { + + +} + diff --git a/tonapi/src/main/kotlin/io/tonapi/models/NftPurchaseAction.kt b/tonapi/src/main/kotlin/io/tonapi/models/NftPurchaseAction.kt index dd6d277b2..b6c47c4af 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/NftPurchaseAction.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/NftPurchaseAction.kt @@ -19,35 +19,28 @@ import io.tonapi.models.AccountAddress import io.tonapi.models.NftItem import io.tonapi.models.Price -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param auctionType - * @param amount - * @param nft - * @param seller - * @param buyer - */ +@Serializable data class NftPurchaseAction ( - @Json(name = "auction_type") - val auctionType: String, + @SerialName(value = "auction_type") + val auctionType: NftPurchaseAction.AuctionType, - @Json(name = "amount") + @SerialName(value = "amount") val amount: Price, - @Json(name = "nft") + @SerialName(value = "nft") val nft: NftItem, - @Json(name = "seller") + @SerialName(value = "seller") val seller: AccountAddress, - @Json(name = "buyer") + @SerialName(value = "buyer") val buyer: AccountAddress ) { @@ -55,14 +48,15 @@ data class NftPurchaseAction ( /** * * - * Values: dNSPeriodTon,dNSPeriodTg,nUMBERPeriodTg,getgems + * Values: DNSPeriodTon,DNSPeriodTg,NUMBERPeriodTg,getgems */ - @JsonClass(generateAdapter = false) + @Serializable enum class AuctionType(val value: kotlin.String) { - @Json(name = "DNS.ton") dNSPeriodTon("DNS.ton"), - @Json(name = "DNS.tg") dNSPeriodTg("DNS.tg"), - @Json(name = "NUMBER.tg") nUMBERPeriodTg("NUMBER.tg"), - @Json(name = "getgems") getgems("getgems"); + @SerialName(value = "DNS.ton") DNSPeriodTon("DNS.ton"), + @SerialName(value = "DNS.tg") DNSPeriodTg("DNS.tg"), + @SerialName(value = "NUMBER.tg") NUMBERPeriodTg("NUMBER.tg"), + @SerialName(value = "getgems") getgems("getgems"); } + } diff --git a/tonapi/src/main/kotlin/io/tonapi/models/Oracle.kt b/tonapi/src/main/kotlin/io/tonapi/models/Oracle.kt index 8f3e817a6..12f7fcb19 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/Oracle.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/Oracle.kt @@ -16,24 +16,23 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param address - * @param secpPubkey - */ +@Serializable data class Oracle ( - @Json(name = "address") + @SerialName(value = "address") val address: kotlin.String, - @Json(name = "secp_pubkey") + @SerialName(value = "secp_pubkey") val secpPubkey: kotlin.String -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/OracleBridgeParams.kt b/tonapi/src/main/kotlin/io/tonapi/models/OracleBridgeParams.kt index 9bd74c80d..b81a9ad8b 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/OracleBridgeParams.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/OracleBridgeParams.kt @@ -17,32 +17,29 @@ package io.tonapi.models import io.tonapi.models.Oracle -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param bridgeAddr - * @param oracleMultisigAddress - * @param externalChainAddress - * @param oracles - */ +@Serializable data class OracleBridgeParams ( - @Json(name = "bridge_addr") + @SerialName(value = "bridge_addr") val bridgeAddr: kotlin.String, - @Json(name = "oracle_multisig_address") + @SerialName(value = "oracle_multisig_address") val oracleMultisigAddress: kotlin.String, - @Json(name = "external_chain_address") + @SerialName(value = "external_chain_address") val externalChainAddress: kotlin.String, - @Json(name = "oracles") + @SerialName(value = "oracles") val oracles: kotlin.collections.List -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/PoolImplementation.kt b/tonapi/src/main/kotlin/io/tonapi/models/PoolImplementation.kt index 5c4ef4f6a..003dba2d3 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/PoolImplementation.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/PoolImplementation.kt @@ -16,32 +16,29 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param name - * @param description - * @param url - * @param socials - */ +@Serializable data class PoolImplementation ( - @Json(name = "name") + @SerialName(value = "name") val name: kotlin.String, - @Json(name = "description") + @SerialName(value = "description") val description: kotlin.String, - @Json(name = "url") + @SerialName(value = "url") val url: kotlin.String, - @Json(name = "socials") + @SerialName(value = "socials") val socials: kotlin.collections.List -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/PoolImplementationType.kt b/tonapi/src/main/kotlin/io/tonapi/models/PoolImplementationType.kt index 47888ed2a..c95656104 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/PoolImplementationType.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/PoolImplementationType.kt @@ -16,25 +16,24 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable /** * * * Values: whales,tf,liquidTF */ - -@JsonClass(generateAdapter = false) +@Serializable enum class PoolImplementationType(val value: kotlin.String) { - @Json(name = "whales") + @SerialName(value = "whales") whales("whales"), - @Json(name = "tf") + @SerialName(value = "tf") tf("tf"), - @Json(name = "liquidTF") + @SerialName(value = "liquidTF") liquidTF("liquidTF"); /** diff --git a/tonapi/src/main/kotlin/io/tonapi/models/PoolInfo.kt b/tonapi/src/main/kotlin/io/tonapi/models/PoolInfo.kt index 8076f611d..18a329e40 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/PoolInfo.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/PoolInfo.kt @@ -17,85 +17,71 @@ package io.tonapi.models import io.tonapi.models.PoolImplementationType -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param address - * @param name - * @param totalAmount - * @param implementation - * @param apy APY in percent - * @param minStake - * @param cycleStart current nomination cycle beginning timestamp - * @param cycleEnd current nomination cycle ending timestamp - * @param verified this pool has verified source code or managed by trusted company - * @param currentNominators current number of nominators - * @param maxNominators maximum number of nominators - * @param nominatorsStake total stake of all nominators - * @param validatorStake stake of validator - * @param liquidJettonMaster for liquid staking master account of jetton - * @param cycleLength - */ +@Serializable data class PoolInfo ( - @Json(name = "address") + @SerialName(value = "address") val address: kotlin.String, - @Json(name = "name") + @SerialName(value = "name") val name: kotlin.String, - @Json(name = "total_amount") + @SerialName(value = "total_amount") val totalAmount: kotlin.Long, - @Json(name = "implementation") + @Contextual @SerialName(value = "implementation") val implementation: PoolImplementationType, /* APY in percent */ - @Json(name = "apy") - val apy: java.math.BigDecimal, + @SerialName(value = "apy") + val apy: kotlin.String, - @Json(name = "min_stake") + @SerialName(value = "min_stake") val minStake: kotlin.Long, /* current nomination cycle beginning timestamp */ - @Json(name = "cycle_start") + @SerialName(value = "cycle_start") val cycleStart: kotlin.Long, /* current nomination cycle ending timestamp */ - @Json(name = "cycle_end") + @SerialName(value = "cycle_end") val cycleEnd: kotlin.Long, /* this pool has verified source code or managed by trusted company */ - @Json(name = "verified") + @SerialName(value = "verified") val verified: kotlin.Boolean, /* current number of nominators */ - @Json(name = "current_nominators") + @SerialName(value = "current_nominators") val currentNominators: kotlin.Int, /* maximum number of nominators */ - @Json(name = "max_nominators") + @SerialName(value = "max_nominators") val maxNominators: kotlin.Int, /* total stake of all nominators */ - @Json(name = "nominators_stake") + @SerialName(value = "nominators_stake") val nominatorsStake: kotlin.Long, /* stake of validator */ - @Json(name = "validator_stake") + @SerialName(value = "validator_stake") val validatorStake: kotlin.Long, /* for liquid staking master account of jetton */ - @Json(name = "liquid_jetton_master") + @SerialName(value = "liquid_jetton_master") val liquidJettonMaster: kotlin.String? = null, - @Json(name = "cycle_length") + @SerialName(value = "cycle_length") val cycleLength: kotlin.Long? = null -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/Price.kt b/tonapi/src/main/kotlin/io/tonapi/models/Price.kt index 783004ab9..9cfd88f8f 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/Price.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/Price.kt @@ -15,25 +15,41 @@ package io.tonapi.models +import io.tonapi.models.CurrencyType +import io.tonapi.models.TrustType -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param `value` - * @param tokenName - */ +@Serializable data class Price ( - @Json(name = "value") + @Contextual @SerialName(value = "currency_type") + val currencyType: CurrencyType, + + @SerialName(value = "value") val `value`: kotlin.String, - @Json(name = "token_name") - val tokenName: kotlin.String + @SerialName(value = "decimals") + val decimals: kotlin.Int, -) + @SerialName(value = "token_name") + val tokenName: kotlin.String, + + @Contextual @SerialName(value = "verification") + val verification: TrustType, + + @SerialName(value = "image") + val image: kotlin.String, + + @SerialName(value = "jetton") + val jetton: kotlin.String? = null + +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/Purchase.kt b/tonapi/src/main/kotlin/io/tonapi/models/Purchase.kt new file mode 100644 index 000000000..2ab58539b --- /dev/null +++ b/tonapi/src/main/kotlin/io/tonapi/models/Purchase.kt @@ -0,0 +1,59 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package io.tonapi.models + +import io.tonapi.models.AccountAddress +import io.tonapi.models.Metadata +import io.tonapi.models.Price + +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual + + +@Serializable + +data class Purchase ( + + @SerialName(value = "event_id") + val eventId: kotlin.String, + + @SerialName(value = "invoice_id") + val invoiceId: kotlin.String, + + @SerialName(value = "source") + val source: AccountAddress, + + @SerialName(value = "destination") + val destination: AccountAddress, + + @SerialName(value = "lt") + val lt: kotlin.Long, + + @SerialName(value = "utime") + val utime: kotlin.Long, + + @SerialName(value = "amount") + val amount: Price, + + @SerialName(value = "metadata") + val metadata: Metadata + +) { + + +} + diff --git a/tonapi/src/main/kotlin/io/tonapi/models/PurchaseAction.kt b/tonapi/src/main/kotlin/io/tonapi/models/PurchaseAction.kt new file mode 100644 index 000000000..10f09c4f3 --- /dev/null +++ b/tonapi/src/main/kotlin/io/tonapi/models/PurchaseAction.kt @@ -0,0 +1,50 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package io.tonapi.models + +import io.tonapi.models.AccountAddress +import io.tonapi.models.Metadata +import io.tonapi.models.Price + +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual + + +@Serializable + +data class PurchaseAction ( + + @SerialName(value = "source") + val source: AccountAddress, + + @SerialName(value = "destination") + val destination: AccountAddress, + + @SerialName(value = "invoice_id") + val invoiceId: kotlin.String, + + @SerialName(value = "amount") + val amount: Price, + + @SerialName(value = "metadata") + val metadata: Metadata + +) { + + +} + diff --git a/tonapi/src/main/kotlin/io/tonapi/models/RawBlockchainConfig.kt b/tonapi/src/main/kotlin/io/tonapi/models/RawBlockchainConfig.kt index 719b915fc..ace8c6a44 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/RawBlockchainConfig.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/RawBlockchainConfig.kt @@ -16,20 +16,20 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param config - */ +@Serializable data class RawBlockchainConfig ( - @Json(name = "config") - val config: kotlin.collections.Map + @Contextual @SerialName(value = "config") + val config: kotlin.collections.Map -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/ReducedBlock.kt b/tonapi/src/main/kotlin/io/tonapi/models/ReducedBlock.kt index 97e5ddbb3..317ed9f47 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/ReducedBlock.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/ReducedBlock.kt @@ -16,48 +16,41 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param workchainId - * @param shard - * @param seqno - * @param txQuantity - * @param utime - * @param shardsBlocks - * @param parent - * @param masterRef - */ +@Serializable data class ReducedBlock ( - @Json(name = "workchain_id") + @SerialName(value = "workchain_id") val workchainId: kotlin.Int, - @Json(name = "shard") + @SerialName(value = "shard") val shard: kotlin.String, - @Json(name = "seqno") + @SerialName(value = "seqno") val seqno: kotlin.Int, - @Json(name = "tx_quantity") + @SerialName(value = "tx_quantity") val txQuantity: kotlin.Int, - @Json(name = "utime") + @SerialName(value = "utime") val utime: kotlin.Long, - @Json(name = "shards_blocks") + @SerialName(value = "shards_blocks") val shardsBlocks: kotlin.collections.List, - @Json(name = "parent") + @SerialName(value = "parent") val parent: kotlin.collections.List, - @Json(name = "master_ref") + @SerialName(value = "master_ref") val masterRef: kotlin.String? = null -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/ReducedBlocks.kt b/tonapi/src/main/kotlin/io/tonapi/models/ReducedBlocks.kt index 196407968..0618e738c 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/ReducedBlocks.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/ReducedBlocks.kt @@ -17,20 +17,20 @@ package io.tonapi.models import io.tonapi.models.ReducedBlock -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param blocks - */ +@Serializable data class ReducedBlocks ( - @Json(name = "blocks") + @SerialName(value = "blocks") val blocks: kotlin.collections.List -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/Refund.kt b/tonapi/src/main/kotlin/io/tonapi/models/Refund.kt index 82ac510f6..f0650a413 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/Refund.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/Refund.kt @@ -16,23 +16,19 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param type - * @param origin - */ +@Serializable data class Refund ( - @Json(name = "type") - val type: String, + @SerialName(value = "type") + val type: Refund.Type, - @Json(name = "origin") + @SerialName(value = "origin") val origin: kotlin.String ) { @@ -40,13 +36,14 @@ data class Refund ( /** * * - * Values: dNSPeriodTon,dNSPeriodTg,getGems + * Values: DNSPeriodTon,DNSPeriodTg,GetGems */ - @JsonClass(generateAdapter = false) + @Serializable enum class Type(val value: kotlin.String) { - @Json(name = "DNS.ton") dNSPeriodTon("DNS.ton"), - @Json(name = "DNS.tg") dNSPeriodTg("DNS.tg"), - @Json(name = "GetGems") getGems("GetGems"); + @SerialName(value = "DNS.ton") DNSPeriodTon("DNS.ton"), + @SerialName(value = "DNS.tg") DNSPeriodTg("DNS.tg"), + @SerialName(value = "GetGems") GetGems("GetGems"); } + } diff --git a/tonapi/src/main/kotlin/io/tonapi/models/Risk.kt b/tonapi/src/main/kotlin/io/tonapi/models/Risk.kt index d89625943..8619105ef 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/Risk.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/Risk.kt @@ -18,33 +18,30 @@ package io.tonapi.models import io.tonapi.models.JettonQuantity import io.tonapi.models.NftItem -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * Risk specifies assets that could be lost if a message would be sent to a malicious smart contract. It makes sense to understand the risk BEFORE sending a message to the blockchain. - * - * @param transferAllRemainingBalance transfer all the remaining balance of the wallet. - * @param ton - * @param jettons - * @param nfts - */ +@Serializable data class Risk ( /* transfer all the remaining balance of the wallet. */ - @Json(name = "transfer_all_remaining_balance") + @SerialName(value = "transfer_all_remaining_balance") val transferAllRemainingBalance: kotlin.Boolean, - @Json(name = "ton") + @SerialName(value = "ton") val ton: kotlin.Long, - @Json(name = "jettons") + @SerialName(value = "jettons") val jettons: kotlin.collections.List, - @Json(name = "nfts") + @SerialName(value = "nfts") val nfts: kotlin.collections.List -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/Sale.kt b/tonapi/src/main/kotlin/io/tonapi/models/Sale.kt index 4ea10f16a..1c767d485 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/Sale.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/Sale.kt @@ -18,32 +18,29 @@ package io.tonapi.models import io.tonapi.models.AccountAddress import io.tonapi.models.Price -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param address - * @param market - * @param price - * @param owner - */ +@Serializable data class Sale ( - @Json(name = "address") + @SerialName(value = "address") val address: kotlin.String, - @Json(name = "market") + @SerialName(value = "market") val market: AccountAddress, - @Json(name = "price") + @SerialName(value = "price") val price: Price, - @Json(name = "owner") + @SerialName(value = "owner") val owner: AccountAddress? = null -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/SendBlockchainMessageRequest.kt b/tonapi/src/main/kotlin/io/tonapi/models/SendBlockchainMessageRequest.kt index 458e5526c..d464c49f6 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/SendBlockchainMessageRequest.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/SendBlockchainMessageRequest.kt @@ -16,36 +16,26 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param boc - * @param batch - */ +@Serializable data class SendBlockchainMessageRequest ( - @Json(name = "boc") + @SerialName(value = "boc") val boc: kotlin.String? = null, - @Json(name = "batch") + @SerialName(value = "batch") val batch: kotlin.collections.List? = null, - @Json(name = "message") - val version: kotlin.String? = null, + @SerialName(value = "meta") + val meta: kotlin.collections.Map? = null - @Json(name = "platform") - val platform: kotlin.String? = null, +) { - @Json(name = "source") - val source: kotlin.String? = null, - @Json(name = "confirmation_time") - val confirmationTime: kotlin.Double? = null - -) +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/SendRawMessage200Response.kt b/tonapi/src/main/kotlin/io/tonapi/models/SendRawMessage200Response.kt index 8cac622d8..9d42023ca 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/SendRawMessage200Response.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/SendRawMessage200Response.kt @@ -16,20 +16,20 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param code - */ +@Serializable data class SendRawMessage200Response ( - @Json(name = "code") + @SerialName(value = "code") val code: kotlin.Int -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/SendRawMessageRequest.kt b/tonapi/src/main/kotlin/io/tonapi/models/SendRawMessageRequest.kt index 8a3aed2a0..db8429d91 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/SendRawMessageRequest.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/SendRawMessageRequest.kt @@ -16,20 +16,20 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param body - */ +@Serializable data class SendRawMessageRequest ( - @Json(name = "body") + @SerialName(value = "body") val body: kotlin.String -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/Seqno.kt b/tonapi/src/main/kotlin/io/tonapi/models/Seqno.kt index de3388eaa..c94771dbb 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/Seqno.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/Seqno.kt @@ -16,20 +16,20 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param seqno - */ +@Serializable data class Seqno ( - @Json(name = "seqno") + @SerialName(value = "seqno") val seqno: kotlin.Int -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/ServiceStatus.kt b/tonapi/src/main/kotlin/io/tonapi/models/ServiceStatus.kt index 2cdfba20a..95844e2f2 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/ServiceStatus.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/ServiceStatus.kt @@ -16,28 +16,26 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param restOnline - * @param indexingLatency - * @param lastKnownMasterchainSeqno - */ +@Serializable data class ServiceStatus ( - @Json(name = "rest_online") + @SerialName(value = "rest_online") val restOnline: kotlin.Boolean = true, - @Json(name = "indexing_latency") + @SerialName(value = "indexing_latency") val indexingLatency: kotlin.Int, - @Json(name = "last_known_masterchain_seqno") + @SerialName(value = "last_known_masterchain_seqno") val lastKnownMasterchainSeqno: kotlin.Int -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/SignRawMessage.kt b/tonapi/src/main/kotlin/io/tonapi/models/SignRawMessage.kt index 8c9e7f812..c480dab9d 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/SignRawMessage.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/SignRawMessage.kt @@ -16,35 +16,32 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param address - * @param amount Number of nanocoins to send. Decimal string. - * @param payload Raw one-cell BoC encoded in hex. - * @param stateInit Raw once-cell BoC encoded in hex. - */ +@Serializable data class SignRawMessage ( - @Json(name = "address") + @SerialName(value = "address") val address: kotlin.String, /* Number of nanocoins to send. Decimal string. */ - @Json(name = "amount") + @SerialName(value = "amount") val amount: kotlin.String, /* Raw one-cell BoC encoded in hex. */ - @Json(name = "payload") + @SerialName(value = "payload") val payload: kotlin.String? = null, /* Raw once-cell BoC encoded in hex. */ - @Json(name = "stateInit") + @SerialName(value = "stateInit") val stateInit: kotlin.String? = null -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/SignRawParams.kt b/tonapi/src/main/kotlin/io/tonapi/models/SignRawParams.kt index e79beed6c..227cb3377 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/SignRawParams.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/SignRawParams.kt @@ -15,39 +15,42 @@ package io.tonapi.models +import io.tonapi.models.MessageConsequences import io.tonapi.models.SignRawMessage -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param relayAddress - * @param commission Commission for the transaction. In nanocoins. - * @param from - * @param validUntil - * @param messages - */ +@Serializable data class SignRawParams ( - @Json(name = "relay_address") + @SerialName(value = "protocol_name") + val protocolName: kotlin.String, + + @SerialName(value = "relay_address") val relayAddress: kotlin.String, /* Commission for the transaction. In nanocoins. */ - @Json(name = "commission") + @SerialName(value = "commission") val commission: kotlin.String, - @Json(name = "from") + @SerialName(value = "from") val from: kotlin.String, - @Json(name = "valid_until") + @SerialName(value = "valid_until") val validUntil: kotlin.Long, - @Json(name = "messages") - val messages: kotlin.collections.List + @SerialName(value = "messages") + val messages: kotlin.collections.List, -) + @SerialName(value = "emulation") + val emulation: MessageConsequences? = null + +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/SizeLimitsConfig.kt b/tonapi/src/main/kotlin/io/tonapi/models/SizeLimitsConfig.kt index e647f49c7..a8d151c1f 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/SizeLimitsConfig.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/SizeLimitsConfig.kt @@ -16,48 +16,41 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param maxMsgBits - * @param maxMsgCells - * @param maxLibraryCells - * @param maxVmDataDepth - * @param maxExtMsgSize - * @param maxExtMsgDepth - * @param maxAccStateCells - * @param maxAccStateBits - */ +@Serializable data class SizeLimitsConfig ( - @Json(name = "max_msg_bits") + @SerialName(value = "max_msg_bits") val maxMsgBits: kotlin.Long, - @Json(name = "max_msg_cells") + @SerialName(value = "max_msg_cells") val maxMsgCells: kotlin.Long, - @Json(name = "max_library_cells") + @SerialName(value = "max_library_cells") val maxLibraryCells: kotlin.Long, - @Json(name = "max_vm_data_depth") + @SerialName(value = "max_vm_data_depth") val maxVmDataDepth: kotlin.Int, - @Json(name = "max_ext_msg_size") + @SerialName(value = "max_ext_msg_size") val maxExtMsgSize: kotlin.Long, - @Json(name = "max_ext_msg_depth") + @SerialName(value = "max_ext_msg_depth") val maxExtMsgDepth: kotlin.Int, - @Json(name = "max_acc_state_cells") + @SerialName(value = "max_acc_state_cells") val maxAccStateCells: kotlin.Long? = null, - @Json(name = "max_acc_state_bits") + @SerialName(value = "max_acc_state_bits") val maxAccStateBits: kotlin.Long? = null -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/SmartContractAction.kt b/tonapi/src/main/kotlin/io/tonapi/models/SmartContractAction.kt index 9f1e30bc6..3910fdb8f 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/SmartContractAction.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/SmartContractAction.kt @@ -18,41 +18,36 @@ package io.tonapi.models import io.tonapi.models.AccountAddress import io.tonapi.models.Refund -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param executor - * @param `contract` - * @param tonAttached amount in nanotons - * @param operation - * @param payload - * @param refund - */ +@Serializable data class SmartContractAction ( - @Json(name = "executor") + @SerialName(value = "executor") val executor: AccountAddress, - @Json(name = "contract") + @SerialName(value = "contract") val `contract`: AccountAddress, /* amount in nanotons */ - @Json(name = "ton_attached") + @SerialName(value = "ton_attached") val tonAttached: kotlin.Long, - @Json(name = "operation") + @SerialName(value = "operation") val operation: kotlin.String, - @Json(name = "payload") + @SerialName(value = "payload") val payload: kotlin.String? = null, - @Json(name = "refund") + @SerialName(value = "refund") val refund: Refund? = null -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/Source.kt b/tonapi/src/main/kotlin/io/tonapi/models/Source.kt new file mode 100644 index 000000000..f5e7c8cd6 --- /dev/null +++ b/tonapi/src/main/kotlin/io/tonapi/models/Source.kt @@ -0,0 +1,36 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package io.tonapi.models + +import io.tonapi.models.SourceFile + +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual + + +@Serializable + +data class Source ( + + @SerialName(value = "files") + val files: kotlin.collections.List + +) { + + +} + diff --git a/tonapi/src/main/kotlin/io/tonapi/models/SourceFile.kt b/tonapi/src/main/kotlin/io/tonapi/models/SourceFile.kt new file mode 100644 index 000000000..ee7e72c88 --- /dev/null +++ b/tonapi/src/main/kotlin/io/tonapi/models/SourceFile.kt @@ -0,0 +1,47 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package io.tonapi.models + + +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual + + +@Serializable + +data class SourceFile ( + + @SerialName(value = "name") + val name: kotlin.String, + + @SerialName(value = "content") + val content: kotlin.String, + + @SerialName(value = "is_entrypoint") + val isEntrypoint: kotlin.Boolean, + + @SerialName(value = "is_std_lib") + val isStdLib: kotlin.Boolean, + + @SerialName(value = "include_in_command") + val includeInCommand: kotlin.Boolean + +) { + + +} + diff --git a/tonapi/src/main/kotlin/io/tonapi/models/StateInit.kt b/tonapi/src/main/kotlin/io/tonapi/models/StateInit.kt index 6ee498353..33aa909c8 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/StateInit.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/StateInit.kt @@ -16,24 +16,23 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param boc - * @param interfaces - */ +@Serializable data class StateInit ( - @Json(name = "boc") + @SerialName(value = "boc") val boc: kotlin.String, - @Json(name = "interfaces") - val interfaces: kotlin.collections.List? = null + @SerialName(value = "interfaces") + val interfaces: kotlin.collections.List -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/StatusDefaultResponse.kt b/tonapi/src/main/kotlin/io/tonapi/models/StatusDefaultResponse.kt deleted file mode 100644 index c580b11d5..000000000 --- a/tonapi/src/main/kotlin/io/tonapi/models/StatusDefaultResponse.kt +++ /dev/null @@ -1,35 +0,0 @@ -/** - * - * Please note: - * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * Do not edit this file manually. - * - */ - -@file:Suppress( - "ArrayInDataClass", - "EnumEntryName", - "RemoveRedundantQualifierName", - "UnusedImport" -) - -package io.tonapi.models - - -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass - -/** - * - * - * @param error - */ - - -data class StatusDefaultResponse ( - - @Json(name = "error") - val error: kotlin.String - -) - diff --git a/tonapi/src/main/kotlin/io/tonapi/models/StoragePhase.kt b/tonapi/src/main/kotlin/io/tonapi/models/StoragePhase.kt index bf55dec9e..eb60a72d3 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/StoragePhase.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/StoragePhase.kt @@ -17,28 +17,26 @@ package io.tonapi.models import io.tonapi.models.AccStatusChange -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param feesCollected - * @param statusChange - * @param feesDue - */ +@Serializable data class StoragePhase ( - @Json(name = "fees_collected") + @SerialName(value = "fees_collected") val feesCollected: kotlin.Long, - @Json(name = "status_change") + @Contextual @SerialName(value = "status_change") val statusChange: AccStatusChange, - @Json(name = "fees_due") + @SerialName(value = "fees_due") val feesDue: kotlin.Long? = null -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/StorageProvider.kt b/tonapi/src/main/kotlin/io/tonapi/models/StorageProvider.kt index 5980e28cd..2460bd0ad 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/StorageProvider.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/StorageProvider.kt @@ -16,40 +16,35 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param address - * @param acceptNewContracts - * @param ratePerMbDay - * @param maxSpan - * @param minimalFileSize - * @param maximalFileSize - */ +@Serializable data class StorageProvider ( - @Json(name = "address") + @SerialName(value = "address") val address: kotlin.String, - @Json(name = "accept_new_contracts") + @SerialName(value = "accept_new_contracts") val acceptNewContracts: kotlin.Boolean, - @Json(name = "rate_per_mb_day") + @SerialName(value = "rate_per_mb_day") val ratePerMbDay: kotlin.Long, - @Json(name = "max_span") + @SerialName(value = "max_span") val maxSpan: kotlin.Long, - @Json(name = "minimal_file_size") + @SerialName(value = "minimal_file_size") val minimalFileSize: kotlin.Long, - @Json(name = "maximal_file_size") + @SerialName(value = "maximal_file_size") val maximalFileSize: kotlin.Long -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/Subscription.kt b/tonapi/src/main/kotlin/io/tonapi/models/Subscription.kt index 4aa859be5..1775aa479 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/Subscription.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/Subscription.kt @@ -15,61 +15,66 @@ package io.tonapi.models +import io.tonapi.models.AccountAddress +import io.tonapi.models.Metadata +import io.tonapi.models.Price -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param address - * @param walletAddress - * @param beneficiaryAddress - * @param amount - * @param period - * @param startTime - * @param timeout - * @param lastPaymentTime - * @param lastRequestTime - * @param subscriptionId - * @param failedAttempts - */ +@Serializable data class Subscription ( - @Json(name = "address") - val address: kotlin.String, + /* type of subscription */ + @SerialName(value = "type") + val type: kotlin.String, - @Json(name = "wallet_address") - val walletAddress: kotlin.String, + @SerialName(value = "status") + val status: Subscription.Status, - @Json(name = "beneficiary_address") - val beneficiaryAddress: kotlin.String, + /* payment period in seconds */ + @SerialName(value = "period") + val period: kotlin.Long, - @Json(name = "amount") - val amount: kotlin.Long, + /* common identifier */ + @SerialName(value = "subscription_id") + val subscriptionId: kotlin.String, - @Json(name = "period") - val period: kotlin.Long, + @SerialName(value = "payment_per_period") + val paymentPerPeriod: Price, - @Json(name = "start_time") - val startTime: kotlin.Long, + @SerialName(value = "wallet") + val wallet: AccountAddress, - @Json(name = "timeout") - val timeout: kotlin.Long, + @SerialName(value = "next_charge_at") + val nextChargeAt: kotlin.Long, - @Json(name = "last_payment_time") - val lastPaymentTime: kotlin.Long, + @SerialName(value = "metadata") + val metadata: Metadata, - @Json(name = "last_request_time") - val lastRequestTime: kotlin.Long, + @SerialName(value = "address") + val address: kotlin.String? = null, - @Json(name = "subscription_id") - val subscriptionId: kotlin.Long, + @SerialName(value = "beneficiary") + val beneficiary: AccountAddress? = null - @Json(name = "failed_attempts") - val failedAttempts: kotlin.Int +) { -) + /** + * + * + * Values: not_ready,active,suspended,cancelled + */ + @Serializable + enum class Status(val value: kotlin.String) { + @SerialName(value = "not_ready") not_ready("not_ready"), + @SerialName(value = "active") active("active"), + @SerialName(value = "suspended") suspended("suspended"), + @SerialName(value = "cancelled") cancelled("cancelled"); + } + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/SubscriptionAction.kt b/tonapi/src/main/kotlin/io/tonapi/models/SubscriptionAction.kt index c73bfff50..b1c1aa27e 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/SubscriptionAction.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/SubscriptionAction.kt @@ -17,36 +17,32 @@ package io.tonapi.models import io.tonapi.models.AccountAddress -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param subscriber - * @param subscription - * @param beneficiary - * @param amount - * @param initial - */ +@Serializable data class SubscriptionAction ( - @Json(name = "subscriber") + @SerialName(value = "subscriber") val subscriber: AccountAddress, - @Json(name = "subscription") + @SerialName(value = "subscription") val subscription: kotlin.String, - @Json(name = "beneficiary") + @SerialName(value = "beneficiary") val beneficiary: AccountAddress, - @Json(name = "amount") + @SerialName(value = "amount") val amount: kotlin.Long, - @Json(name = "initial") + @SerialName(value = "initial") val initial: kotlin.Boolean -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/Subscriptions.kt b/tonapi/src/main/kotlin/io/tonapi/models/Subscriptions.kt index 000986bac..8ed791f93 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/Subscriptions.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/Subscriptions.kt @@ -17,20 +17,20 @@ package io.tonapi.models import io.tonapi.models.Subscription -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param subscriptions - */ +@Serializable data class Subscriptions ( - @Json(name = "subscriptions") + @SerialName(value = "subscriptions") val subscriptions: kotlin.collections.List -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/TokenRates.kt b/tonapi/src/main/kotlin/io/tonapi/models/TokenRates.kt index f7c1e449b..1d2e9a49d 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/TokenRates.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/TokenRates.kt @@ -16,32 +16,29 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param prices - * @param diff24h - * @param diff7d - * @param diff30d - */ +@Serializable data class TokenRates ( - @Json(name = "prices") - val prices: kotlin.collections.Map? = null, + @SerialName(value = "prices") + val prices: kotlin.collections.Map? = null, - @Json(name = "diff_24h") + @SerialName(value = "diff_24h") val diff24h: kotlin.collections.Map? = null, - @Json(name = "diff_7d") + @SerialName(value = "diff_7d") val diff7d: kotlin.collections.Map? = null, - @Json(name = "diff_30d") + @SerialName(value = "diff_30d") val diff30d: kotlin.collections.Map? = null -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/TonConnectProof200Response.kt b/tonapi/src/main/kotlin/io/tonapi/models/TonConnectProof200Response.kt index 3bd2fe8b9..f04ae74c5 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/TonConnectProof200Response.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/TonConnectProof200Response.kt @@ -16,20 +16,20 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param token - */ +@Serializable data class TonConnectProof200Response ( - @Json(name = "token") + @SerialName(value = "token") val token: kotlin.String -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/TonConnectProofRequest.kt b/tonapi/src/main/kotlin/io/tonapi/models/TonConnectProofRequest.kt index c8343756c..bc2e20b73 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/TonConnectProofRequest.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/TonConnectProofRequest.kt @@ -17,24 +17,23 @@ package io.tonapi.models import io.tonapi.models.TonConnectProofRequestProof -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param address - * @param proof - */ +@Serializable data class TonConnectProofRequest ( - @Json(name = "address") + @SerialName(value = "address") val address: kotlin.String, - @Json(name = "proof") + @SerialName(value = "proof") val proof: TonConnectProofRequestProof -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/TonConnectProofRequestProof.kt b/tonapi/src/main/kotlin/io/tonapi/models/TonConnectProofRequestProof.kt index ecc7e092c..00a9d0379 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/TonConnectProofRequestProof.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/TonConnectProofRequestProof.kt @@ -17,36 +17,32 @@ package io.tonapi.models import io.tonapi.models.TonConnectProofRequestProofDomain -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param timestamp - * @param domain - * @param signature - * @param payload - * @param stateInit - */ +@Serializable data class TonConnectProofRequestProof ( - @Json(name = "timestamp") + @SerialName(value = "timestamp") val timestamp: kotlin.Long, - @Json(name = "domain") + @SerialName(value = "domain") val domain: TonConnectProofRequestProofDomain, - @Json(name = "signature") + @SerialName(value = "signature") val signature: kotlin.String, - @Json(name = "payload") + @SerialName(value = "payload") val payload: kotlin.String, - @Json(name = "state_init") + @SerialName(value = "state_init") val stateInit: kotlin.String? = null -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/TonConnectProofRequestProofDomain.kt b/tonapi/src/main/kotlin/io/tonapi/models/TonConnectProofRequestProofDomain.kt index 492d9f719..06f5f329f 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/TonConnectProofRequestProofDomain.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/TonConnectProofRequestProofDomain.kt @@ -16,24 +16,23 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param `value` - * @param lengthBytes - */ +@Serializable data class TonConnectProofRequestProofDomain ( - @Json(name = "value") + @SerialName(value = "value") val `value`: kotlin.String, - @Json(name = "length_bytes") + @SerialName(value = "length_bytes") val lengthBytes: kotlin.Int? = null -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/TonTransferAction.kt b/tonapi/src/main/kotlin/io/tonapi/models/TonTransferAction.kt index 429b4a44b..c37c6b6bb 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/TonTransferAction.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/TonTransferAction.kt @@ -19,41 +19,36 @@ import io.tonapi.models.AccountAddress import io.tonapi.models.EncryptedComment import io.tonapi.models.Refund -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param sender - * @param recipient - * @param amount amount in nanotons - * @param comment - * @param encryptedComment - * @param refund - */ +@Serializable data class TonTransferAction ( - @Json(name = "sender") + @SerialName(value = "sender") val sender: AccountAddress, - @Json(name = "recipient") + @SerialName(value = "recipient") val recipient: AccountAddress, /* amount in nanotons */ - @Json(name = "amount") + @SerialName(value = "amount") val amount: kotlin.Long, - @Json(name = "comment") + @SerialName(value = "comment") val comment: kotlin.String? = null, - @Json(name = "encrypted_comment") + @SerialName(value = "encrypted_comment") val encryptedComment: EncryptedComment? = null, - @Json(name = "refund") + @SerialName(value = "refund") val refund: Refund? = null -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/Trace.kt b/tonapi/src/main/kotlin/io/tonapi/models/Trace.kt index 44013185b..13c8c3b04 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/Trace.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/Trace.kt @@ -17,32 +17,29 @@ package io.tonapi.models import io.tonapi.models.Transaction -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param transaction - * @param interfaces - * @param children - * @param emulated - */ +@Serializable data class Trace ( - @Json(name = "transaction") + @SerialName(value = "transaction") val transaction: Transaction, - @Json(name = "interfaces") + @SerialName(value = "interfaces") val interfaces: kotlin.collections.List, - @Json(name = "children") + @SerialName(value = "children") val children: kotlin.collections.List? = null, - @Json(name = "emulated") + @SerialName(value = "emulated") val emulated: kotlin.Boolean? = null -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/TraceID.kt b/tonapi/src/main/kotlin/io/tonapi/models/TraceID.kt index d4a6709ca..0c03a694b 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/TraceID.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/TraceID.kt @@ -16,24 +16,23 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param id - * @param utime - */ +@Serializable data class TraceID ( - @Json(name = "id") + @SerialName(value = "id") val id: kotlin.String, - @Json(name = "utime") + @SerialName(value = "utime") val utime: kotlin.Long -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/TraceIDs.kt b/tonapi/src/main/kotlin/io/tonapi/models/TraceIDs.kt index 74d984256..c1e6e4612 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/TraceIDs.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/TraceIDs.kt @@ -17,20 +17,20 @@ package io.tonapi.models import io.tonapi.models.TraceID -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param traces - */ +@Serializable data class TraceIDs ( - @Json(name = "traces") + @SerialName(value = "traces") val traces: kotlin.collections.List -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/Transaction.kt b/tonapi/src/main/kotlin/io/tonapi/models/Transaction.kt index 710dde387..024981894 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/Transaction.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/Transaction.kt @@ -25,117 +25,93 @@ import io.tonapi.models.Message import io.tonapi.models.StoragePhase import io.tonapi.models.TransactionType -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param hash - * @param lt - * @param account - * @param success - * @param utime - * @param origStatus - * @param endStatus - * @param totalFees - * @param endBalance - * @param transactionType - * @param stateUpdateOld - * @param stateUpdateNew - * @param outMsgs - * @param block - * @param aborted - * @param destroyed - * @param raw hex encoded boc with raw transaction - * @param inMsg - * @param prevTransHash - * @param prevTransLt - * @param computePhase - * @param storagePhase - * @param creditPhase - * @param actionPhase - * @param bouncePhase - */ +@Serializable data class Transaction ( - @Json(name = "hash") - val hash: kotlin.String? = null, + @SerialName(value = "hash") + val hash: kotlin.String, - @Json(name = "lt") + @SerialName(value = "lt") val lt: kotlin.Long, - @Json(name = "account") + @SerialName(value = "account") val account: AccountAddress, - @Json(name = "success") + @SerialName(value = "success") val success: kotlin.Boolean, - @Json(name = "utime") + @SerialName(value = "utime") val utime: kotlin.Long, - @Json(name = "orig_status") + @Contextual @SerialName(value = "orig_status") val origStatus: AccountStatus, - @Json(name = "end_status") + @Contextual @SerialName(value = "end_status") val endStatus: AccountStatus, - @Json(name = "total_fees") + @SerialName(value = "total_fees") val totalFees: kotlin.Long, - @Json(name = "end_balance") + @SerialName(value = "end_balance") val endBalance: kotlin.Long, - @Json(name = "transaction_type") + @Contextual @SerialName(value = "transaction_type") val transactionType: TransactionType, - @Json(name = "state_update_old") + @SerialName(value = "state_update_old") val stateUpdateOld: kotlin.String, - @Json(name = "state_update_new") + @SerialName(value = "state_update_new") val stateUpdateNew: kotlin.String, - @Json(name = "out_msgs") + @SerialName(value = "out_msgs") val outMsgs: kotlin.collections.List, - @Json(name = "block") + @SerialName(value = "block") val block: kotlin.String, - @Json(name = "aborted") + @SerialName(value = "aborted") val aborted: kotlin.Boolean, - @Json(name = "destroyed") + @SerialName(value = "destroyed") val destroyed: kotlin.Boolean, /* hex encoded boc with raw transaction */ - @Json(name = "raw") - val raw: kotlin.String? = null, + @SerialName(value = "raw") + val raw: kotlin.String, - @Json(name = "in_msg") + @SerialName(value = "in_msg") val inMsg: Message? = null, - @Json(name = "prev_trans_hash") + @SerialName(value = "prev_trans_hash") val prevTransHash: kotlin.String? = null, - @Json(name = "prev_trans_lt") + @SerialName(value = "prev_trans_lt") val prevTransLt: kotlin.Long? = null, - @Json(name = "compute_phase") + @SerialName(value = "compute_phase") val computePhase: ComputePhase? = null, - @Json(name = "storage_phase") + @SerialName(value = "storage_phase") val storagePhase: StoragePhase? = null, - @Json(name = "credit_phase") + @SerialName(value = "credit_phase") val creditPhase: CreditPhase? = null, - @Json(name = "action_phase") + @SerialName(value = "action_phase") val actionPhase: ActionPhase? = null, - @Json(name = "bounce_phase") + @Contextual @SerialName(value = "bounce_phase") val bouncePhase: BouncePhaseType? = null -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/TransactionType.kt b/tonapi/src/main/kotlin/io/tonapi/models/TransactionType.kt index f9ed7da4d..33c573d0b 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/TransactionType.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/TransactionType.kt @@ -16,38 +16,37 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable /** * * - * Values: transOrd,transTickTock,transSplitPrepare,transSplitInstall,transMergePrepare,transMergeInstall,transStorage + * Values: TransOrd,TransTickTock,TransSplitPrepare,TransSplitInstall,TransMergePrepare,TransMergeInstall,TransStorage */ - -@JsonClass(generateAdapter = false) +@Serializable enum class TransactionType(val value: kotlin.String) { - @Json(name = "TransOrd") - transOrd("TransOrd"), + @SerialName(value = "TransOrd") + TransOrd("TransOrd"), - @Json(name = "TransTickTock") - transTickTock("TransTickTock"), + @SerialName(value = "TransTickTock") + TransTickTock("TransTickTock"), - @Json(name = "TransSplitPrepare") - transSplitPrepare("TransSplitPrepare"), + @SerialName(value = "TransSplitPrepare") + TransSplitPrepare("TransSplitPrepare"), - @Json(name = "TransSplitInstall") - transSplitInstall("TransSplitInstall"), + @SerialName(value = "TransSplitInstall") + TransSplitInstall("TransSplitInstall"), - @Json(name = "TransMergePrepare") - transMergePrepare("TransMergePrepare"), + @SerialName(value = "TransMergePrepare") + TransMergePrepare("TransMergePrepare"), - @Json(name = "TransMergeInstall") - transMergeInstall("TransMergeInstall"), + @SerialName(value = "TransMergeInstall") + TransMergeInstall("TransMergeInstall"), - @Json(name = "TransStorage") - transStorage("TransStorage"); + @SerialName(value = "TransStorage") + TransStorage("TransStorage"); /** * Override [toString()] to avoid using the enum variable name as the value, and instead use diff --git a/tonapi/src/main/kotlin/io/tonapi/models/Transactions.kt b/tonapi/src/main/kotlin/io/tonapi/models/Transactions.kt index 642dcd2ba..2e70ebe2e 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/Transactions.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/Transactions.kt @@ -17,20 +17,20 @@ package io.tonapi.models import io.tonapi.models.Transaction -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param transactions - */ +@Serializable data class Transactions ( - @Json(name = "transactions") + @SerialName(value = "transactions") val transactions: kotlin.collections.List -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/TrustType.kt b/tonapi/src/main/kotlin/io/tonapi/models/TrustType.kt index d93695bb6..284aab02c 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/TrustType.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/TrustType.kt @@ -16,28 +16,27 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable /** * * * Values: whitelist,graylist,blacklist,none */ - -@JsonClass(generateAdapter = false) +@Serializable enum class TrustType(val value: kotlin.String) { - @Json(name = "whitelist") + @SerialName(value = "whitelist") whitelist("whitelist"), - @Json(name = "graylist") + @SerialName(value = "graylist") graylist("graylist"), - @Json(name = "blacklist") + @SerialName(value = "blacklist") blacklist("blacklist"), - @Json(name = "none") + @SerialName(value = "none") none("none"); /** diff --git a/tonapi/src/main/kotlin/io/tonapi/models/TvmStackRecord.kt b/tonapi/src/main/kotlin/io/tonapi/models/TvmStackRecord.kt index 70e9bf916..45305838a 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/TvmStackRecord.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/TvmStackRecord.kt @@ -16,35 +16,28 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param type - * @param cell - * @param slice - * @param num - * @param tuple - */ +@Serializable data class TvmStackRecord ( - @Json(name = "type") + @SerialName(value = "type") val type: TvmStackRecord.Type, - @Json(name = "cell") + @SerialName(value = "cell") val cell: kotlin.String? = null, - @Json(name = "slice") + @SerialName(value = "slice") val slice: kotlin.String? = null, - @Json(name = "num") + @SerialName(value = "num") val num: kotlin.String? = null, - @Json(name = "tuple") + @SerialName(value = "tuple") val tuple: kotlin.collections.List? = null ) { @@ -54,13 +47,14 @@ data class TvmStackRecord ( * * Values: cell,num,nan,`null`,tuple */ - @JsonClass(generateAdapter = false) + @Serializable enum class Type(val value: kotlin.String) { - @Json(name = "cell") cell("cell"), - @Json(name = "num") num("num"), - @Json(name = "nan") nan("nan"), - @Json(name = "null") `null`("null"), - @Json(name = "tuple") tuple("tuple"); + @SerialName(value = "cell") cell("cell"), + @SerialName(value = "num") num("num"), + @SerialName(value = "nan") nan("nan"), + @SerialName(value = "null") `null`("null"), + @SerialName(value = "tuple") tuple("tuple"); } + } diff --git a/tonapi/src/main/kotlin/io/tonapi/models/UnSubscriptionAction.kt b/tonapi/src/main/kotlin/io/tonapi/models/UnSubscriptionAction.kt index 7769de767..b643557b2 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/UnSubscriptionAction.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/UnSubscriptionAction.kt @@ -17,28 +17,26 @@ package io.tonapi.models import io.tonapi.models.AccountAddress -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param subscriber - * @param subscription - * @param beneficiary - */ +@Serializable data class UnSubscriptionAction ( - @Json(name = "subscriber") + @SerialName(value = "subscriber") val subscriber: AccountAddress, - @Json(name = "subscription") + @SerialName(value = "subscription") val subscription: kotlin.String, - @Json(name = "beneficiary") + @SerialName(value = "beneficiary") val beneficiary: AccountAddress -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/Validator.kt b/tonapi/src/main/kotlin/io/tonapi/models/Validator.kt index 350d34009..f748b77e7 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/Validator.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/Validator.kt @@ -16,32 +16,29 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param address - * @param adnlAddress - * @param stake - * @param maxFactor - */ +@Serializable data class Validator ( - @Json(name = "address") + @SerialName(value = "address") val address: kotlin.String, - @Json(name = "adnl_address") + @SerialName(value = "adnl_address") val adnlAddress: kotlin.String, - @Json(name = "stake") + @SerialName(value = "stake") val stake: kotlin.Long, - @Json(name = "max_factor") + @SerialName(value = "max_factor") val maxFactor: kotlin.Long -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/Validators.kt b/tonapi/src/main/kotlin/io/tonapi/models/Validators.kt index b3e62f9ab..99425c3b6 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/Validators.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/Validators.kt @@ -17,36 +17,32 @@ package io.tonapi.models import io.tonapi.models.Validator -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param electAt - * @param electClose - * @param minStake - * @param totalStake - * @param validators - */ +@Serializable data class Validators ( - @Json(name = "elect_at") + @SerialName(value = "elect_at") val electAt: kotlin.Long, - @Json(name = "elect_close") + @SerialName(value = "elect_close") val electClose: kotlin.Long, - @Json(name = "min_stake") + @SerialName(value = "min_stake") val minStake: kotlin.Long, - @Json(name = "total_stake") + @SerialName(value = "total_stake") val totalStake: kotlin.Long, - @Json(name = "validators") + @SerialName(value = "validators") val validators: kotlin.collections.List -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/ValidatorsSet.kt b/tonapi/src/main/kotlin/io/tonapi/models/ValidatorsSet.kt index aa9048fd4..9bccdce94 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/ValidatorsSet.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/ValidatorsSet.kt @@ -17,40 +17,35 @@ package io.tonapi.models import io.tonapi.models.ValidatorsSetListInner -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param utimeSince - * @param utimeUntil - * @param total - * @param main - * @param list - * @param totalWeight - */ +@Serializable data class ValidatorsSet ( - @Json(name = "utime_since") + @SerialName(value = "utime_since") val utimeSince: kotlin.Int, - @Json(name = "utime_until") + @SerialName(value = "utime_until") val utimeUntil: kotlin.Int, - @Json(name = "total") + @SerialName(value = "total") val total: kotlin.Int, - @Json(name = "main") + @SerialName(value = "main") val main: kotlin.Int, - @Json(name = "list") + @SerialName(value = "list") val list: kotlin.collections.List, - @Json(name = "total_weight") + @SerialName(value = "total_weight") val totalWeight: kotlin.String? = null -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/ValidatorsSetListInner.kt b/tonapi/src/main/kotlin/io/tonapi/models/ValidatorsSetListInner.kt index 7573be370..7dd18258b 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/ValidatorsSetListInner.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/ValidatorsSetListInner.kt @@ -16,28 +16,26 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param publicKey - * @param weight - * @param adnlAddr - */ +@Serializable data class ValidatorsSetListInner ( - @Json(name = "public_key") + @SerialName(value = "public_key") val publicKey: kotlin.String, - @Json(name = "weight") + @SerialName(value = "weight") val weight: kotlin.Long, - @Json(name = "adnl_addr") + @SerialName(value = "adnl_addr") val adnlAddr: kotlin.String? = null -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/ValueFlow.kt b/tonapi/src/main/kotlin/io/tonapi/models/ValueFlow.kt index 986be96d7..bd5530a87 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/ValueFlow.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/ValueFlow.kt @@ -18,32 +18,29 @@ package io.tonapi.models import io.tonapi.models.AccountAddress import io.tonapi.models.ValueFlowJettonsInner -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param account - * @param ton - * @param fees - * @param jettons - */ +@Serializable data class ValueFlow ( - @Json(name = "account") + @SerialName(value = "account") val account: AccountAddress, - @Json(name = "ton") + @SerialName(value = "ton") val ton: kotlin.Long, - @Json(name = "fees") + @SerialName(value = "fees") val fees: kotlin.Long, - @Json(name = "jettons") + @SerialName(value = "jettons") val jettons: kotlin.collections.List? = null -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/ValueFlowJettonsInner.kt b/tonapi/src/main/kotlin/io/tonapi/models/ValueFlowJettonsInner.kt index e24d74f3d..7cb7a1a0d 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/ValueFlowJettonsInner.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/ValueFlowJettonsInner.kt @@ -18,28 +18,30 @@ package io.tonapi.models import io.tonapi.models.AccountAddress import io.tonapi.models.JettonPreview -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param account - * @param jetton - * @param quantity - */ +@Serializable data class ValueFlowJettonsInner ( - @Json(name = "account") + @SerialName(value = "account") val account: AccountAddress, - @Json(name = "jetton") + @SerialName(value = "jetton") val jetton: JettonPreview, - @Json(name = "quantity") + @SerialName(value = "qty") + val qty: kotlin.String, + + @SerialName(value = "quantity") + @Deprecated(message = "This property is deprecated.") val quantity: kotlin.Long -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/Wallet.kt b/tonapi/src/main/kotlin/io/tonapi/models/Wallet.kt new file mode 100644 index 000000000..6834abb7e --- /dev/null +++ b/tonapi/src/main/kotlin/io/tonapi/models/Wallet.kt @@ -0,0 +1,79 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package io.tonapi.models + +import io.tonapi.models.AccountStatus +import io.tonapi.models.WalletPlugin +import io.tonapi.models.WalletStats + +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual + + +@Serializable + +data class Wallet ( + + @SerialName(value = "address") + val address: kotlin.String, + + @SerialName(value = "is_wallet") + val isWallet: kotlin.Boolean, + + @SerialName(value = "balance") + val balance: kotlin.Long, + + @SerialName(value = "stats") + val stats: WalletStats, + + @SerialName(value = "plugins") + val plugins: kotlin.collections.List, + + @Contextual @SerialName(value = "status") + val status: AccountStatus, + + /* unix timestamp */ + @SerialName(value = "last_activity") + val lastActivity: kotlin.Long, + + @SerialName(value = "get_methods") + @Deprecated(message = "This property is deprecated.") + val getMethods: kotlin.collections.List, + + @SerialName(value = "last_lt") + val lastLt: kotlin.Long, + + @SerialName(value = "name") + val name: kotlin.String? = null, + + @SerialName(value = "icon") + val icon: kotlin.String? = null, + + @SerialName(value = "is_suspended") + val isSuspended: kotlin.Boolean? = null, + + @SerialName(value = "signature_disabled") + val signatureDisabled: kotlin.Boolean? = null, + + @SerialName(value = "interfaces") + val interfaces: kotlin.collections.List? = null + +) { + + +} + diff --git a/tonapi/src/main/kotlin/io/tonapi/models/WalletDNS.kt b/tonapi/src/main/kotlin/io/tonapi/models/WalletDNS.kt index 91a25716a..c00b23004 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/WalletDNS.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/WalletDNS.kt @@ -17,40 +17,35 @@ package io.tonapi.models import io.tonapi.models.AccountAddress -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param address - * @param account - * @param isWallet - * @param hasMethodPubkey - * @param hasMethodSeqno - * @param names - */ +@Serializable data class WalletDNS ( - @Json(name = "address") + @SerialName(value = "address") val address: kotlin.String, - @Json(name = "account") + @SerialName(value = "account") val account: AccountAddress, - @Json(name = "is_wallet") + @SerialName(value = "is_wallet") val isWallet: kotlin.Boolean, - @Json(name = "has_method_pubkey") + @SerialName(value = "has_method_pubkey") val hasMethodPubkey: kotlin.Boolean, - @Json(name = "has_method_seqno") + @SerialName(value = "has_method_seqno") val hasMethodSeqno: kotlin.Boolean, - @Json(name = "names") + @SerialName(value = "names") val names: kotlin.collections.List -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/WalletPlugin.kt b/tonapi/src/main/kotlin/io/tonapi/models/WalletPlugin.kt new file mode 100644 index 000000000..950c3b10b --- /dev/null +++ b/tonapi/src/main/kotlin/io/tonapi/models/WalletPlugin.kt @@ -0,0 +1,42 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package io.tonapi.models + +import io.tonapi.models.AccountStatus + +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual + + +@Serializable + +data class WalletPlugin ( + + @SerialName(value = "address") + val address: kotlin.String, + + @SerialName(value = "type") + val type: kotlin.String, + + @Contextual @SerialName(value = "status") + val status: AccountStatus + +) { + + +} + diff --git a/tonapi/src/main/kotlin/io/tonapi/models/WalletStats.kt b/tonapi/src/main/kotlin/io/tonapi/models/WalletStats.kt new file mode 100644 index 000000000..1ed68314a --- /dev/null +++ b/tonapi/src/main/kotlin/io/tonapi/models/WalletStats.kt @@ -0,0 +1,44 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package io.tonapi.models + + +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual + + +@Serializable + +data class WalletStats ( + + @SerialName(value = "nfts_count") + val nftsCount: kotlin.Int, + + @SerialName(value = "jettons_count") + val jettonsCount: kotlin.Int, + + @SerialName(value = "multisig_count") + val multisigCount: kotlin.Int, + + @SerialName(value = "staking_count") + val stakingCount: kotlin.Int + +) { + + +} + diff --git a/tonapi/src/main/kotlin/io/tonapi/models/EmulateMessageToEventRequest.kt b/tonapi/src/main/kotlin/io/tonapi/models/Wallets.kt similarity index 51% rename from tonapi/src/main/kotlin/io/tonapi/models/EmulateMessageToEventRequest.kt rename to tonapi/src/main/kotlin/io/tonapi/models/Wallets.kt index 68ac99ff0..49c01aed9 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/EmulateMessageToEventRequest.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/Wallets.kt @@ -15,21 +15,22 @@ package io.tonapi.models +import io.tonapi.models.Wallet -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param boc - */ +@Serializable -data class EmulateMessageToEventRequest ( +data class Wallets ( - @Json(name = "boc") - val boc: kotlin.String + @SerialName(value = "accounts") + val accounts: kotlin.collections.List -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/WithdrawStakeAction.kt b/tonapi/src/main/kotlin/io/tonapi/models/WithdrawStakeAction.kt index 1e7f95f5c..32dde8f19 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/WithdrawStakeAction.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/WithdrawStakeAction.kt @@ -18,32 +18,29 @@ package io.tonapi.models import io.tonapi.models.AccountAddress import io.tonapi.models.PoolImplementationType -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * validator's participation in elections - * - * @param amount - * @param staker - * @param pool - * @param implementation - */ +@Serializable data class WithdrawStakeAction ( - @Json(name = "amount") + @SerialName(value = "amount") val amount: kotlin.Long, - @Json(name = "staker") + @SerialName(value = "staker") val staker: AccountAddress, - @Json(name = "pool") + @SerialName(value = "pool") val pool: AccountAddress, - @Json(name = "implementation") + @Contextual @SerialName(value = "implementation") val implementation: PoolImplementationType -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/WithdrawStakeRequestAction.kt b/tonapi/src/main/kotlin/io/tonapi/models/WithdrawStakeRequestAction.kt index d7d126857..93158aa0b 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/WithdrawStakeRequestAction.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/WithdrawStakeRequestAction.kt @@ -18,32 +18,29 @@ package io.tonapi.models import io.tonapi.models.AccountAddress import io.tonapi.models.PoolImplementationType -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * validator's participation in elections - * - * @param staker - * @param pool - * @param implementation - * @param amount - */ +@Serializable data class WithdrawStakeRequestAction ( - @Json(name = "staker") + @SerialName(value = "staker") val staker: AccountAddress, - @Json(name = "pool") + @SerialName(value = "pool") val pool: AccountAddress, - @Json(name = "implementation") + @Contextual @SerialName(value = "implementation") val implementation: PoolImplementationType, - @Json(name = "amount") + @SerialName(value = "amount") val amount: kotlin.Long? = null -) +) { + + +} diff --git a/tonapi/src/main/kotlin/io/tonapi/models/WorkchainDescr.kt b/tonapi/src/main/kotlin/io/tonapi/models/WorkchainDescr.kt index 5aa18b8a3..b2e961cd4 100644 --- a/tonapi/src/main/kotlin/io/tonapi/models/WorkchainDescr.kt +++ b/tonapi/src/main/kotlin/io/tonapi/models/WorkchainDescr.kt @@ -16,64 +16,53 @@ package io.tonapi.models -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual -/** - * - * - * @param workchain - * @param enabledSince - * @param actualMinSplit - * @param minSplit - * @param maxSplit - * @param basic - * @param active - * @param acceptMsgs - * @param flags - * @param zerostateRootHash - * @param zerostateFileHash - * @param version - */ +@Serializable data class WorkchainDescr ( - @Json(name = "workchain") + @SerialName(value = "workchain") val workchain: kotlin.Int, - @Json(name = "enabled_since") + @SerialName(value = "enabled_since") val enabledSince: kotlin.Long, - @Json(name = "actual_min_split") + @SerialName(value = "actual_min_split") val actualMinSplit: kotlin.Int, - @Json(name = "min_split") + @SerialName(value = "min_split") val minSplit: kotlin.Int, - @Json(name = "max_split") + @SerialName(value = "max_split") val maxSplit: kotlin.Int, - @Json(name = "basic") + @SerialName(value = "basic") val basic: kotlin.Int, - @Json(name = "active") + @SerialName(value = "active") val active: kotlin.Boolean, - @Json(name = "accept_msgs") + @SerialName(value = "accept_msgs") val acceptMsgs: kotlin.Boolean, - @Json(name = "flags") + @SerialName(value = "flags") val flags: kotlin.Int, - @Json(name = "zerostate_root_hash") + @SerialName(value = "zerostate_root_hash") val zerostateRootHash: kotlin.String, - @Json(name = "zerostate_file_hash") + @SerialName(value = "zerostate_file_hash") val zerostateFileHash: kotlin.String, - @Json(name = "version") + @SerialName(value = "version") val version: kotlin.Long -) +) { + + +} diff --git a/tonapi/templates/data_class.mustache b/tonapi/templates/data_class.mustache new file mode 100644 index 000000000..0770bac18 --- /dev/null +++ b/tonapi/templates/data_class.mustache @@ -0,0 +1,338 @@ +{{^multiplatform}} +{{#kotlinx_serialization}} +import {{#serializableModel}}kotlinx.serialization.Serializable as KSerializable{{/serializableModel}}{{^serializableModel}}kotlinx.serialization.Serializable{{/serializableModel}} +import kotlinx.serialization.SerialName +import kotlinx.serialization.Contextual +{{#enumUnknownDefaultCase}} +import kotlinx.serialization.KSerializer +import kotlinx.serialization.Serializer +import kotlinx.serialization.builtins.serializer +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder +{{/enumUnknownDefaultCase}} +{{#hasEnums}} +{{/hasEnums}} +{{/kotlinx_serialization}} +{{#parcelizeModels}} +import android.os.Parcelable +import kotlinx.parcelize.Parcelize +{{/parcelizeModels}} +{{/multiplatform}} +{{#multiplatform}} +import kotlinx.serialization.* +import kotlinx.serialization.descriptors.* +import kotlinx.serialization.encoding.* +{{/multiplatform}} +{{#serializableModel}} +import java.io.Serializable +{{/serializableModel}} +{{#generateRoomModels}} +import {{roomModelPackage}}.{{classname}}RoomModel +import io.infrastructure.ITransformForStorage +{{/generateRoomModels}} + +{{#parcelizeModels}}@Parcelize{{/parcelizeModels}} +{{#multiplatform}}{{^discriminator}}@Serializable{{/discriminator}}{{/multiplatform}}{{#kotlinx_serialization}}{{#serializableModel}}@KSerializable{{/serializableModel}}{{^serializableModel}}@Serializable{{/serializableModel}}{{/kotlinx_serialization}}{{#moshi}}{{#moshiCodeGen}}@JsonClass(generateAdapter = true){{/moshiCodeGen}}{{/moshi}}{{#jackson}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}{{/jackson}} +{{#isDeprecated}} +@Deprecated(message = "This schema is deprecated.") +{{/isDeprecated}} +{{>additionalModelTypeAnnotations}} +{{#vendorExtensions.x-class-extra-annotation}} +{{{vendorExtensions.x-class-extra-annotation}}} +{{/vendorExtensions.x-class-extra-annotation}} +{{#nonPublicApi}}internal {{/nonPublicApi}}{{^nonPublicApi}}{{#explicitApi}}public {{/explicitApi}}{{/nonPublicApi}}{{#discriminator}}interface{{/discriminator}}{{^discriminator}}{{#hasVars}}data {{/hasVars}}class{{/discriminator}} {{classname}}{{^discriminator}} ( + +{{#allVars}} +{{#required}}{{>data_class_req_var}}{{/required}}{{^required}}{{>data_class_opt_var}}{{/required}}{{^-last}},{{/-last}} + +{{/allVars}} +){{/discriminator}}{{#parent}}{{^serializableModel}}{{^parcelizeModels}} : {{{parent}}}{{#isMap}}(){{/isMap}}{{#isArray}}(){{/isArray}}{{/parcelizeModels}}{{/serializableModel}}{{/parent}}{{#parent}}{{#serializableModel}}{{^parcelizeModels}} : {{{parent}}}{{#isMap}}(){{/isMap}}{{#isArray}}(){{/isArray}}, Serializable{{/parcelizeModels}}{{/serializableModel}}{{/parent}}{{#parent}}{{^serializableModel}}{{#parcelizeModels}} : {{{parent}}}{{#isMap}}(){{/isMap}}{{#isArray}}(){{/isArray}}, Parcelable{{/parcelizeModels}}{{/serializableModel}}{{/parent}}{{#parent}}{{#serializableModel}}{{#parcelizeModels}} : {{{parent}}}{{#isMap}}(){{/isMap}}{{#isArray}}(){{/isArray}}, Serializable, Parcelable{{/parcelizeModels}}{{/serializableModel}}{{/parent}}{{^parent}}{{#serializableModel}}{{^parcelizeModels}} : Serializable{{/parcelizeModels}}{{/serializableModel}}{{/parent}}{{^parent}}{{^serializableModel}}{{#parcelizeModels}} : Parcelable{{/parcelizeModels}}{{/serializableModel}}{{/parent}}{{^parent}}{{#serializableModel}}{{#parcelizeModels}} : Serializable, Parcelable{{/parcelizeModels}}{{/serializableModel}}{{/parent}}{{#generateRoomModels}}{{#parent}}, {{/parent}}{{^discriminator}}{{^parent}}:{{/parent}} ITransformForStorage<{{classname}}RoomModel>{{/discriminator}}{{/generateRoomModels}}{{#vendorExtensions.x-has-data-class-body}} { +{{/vendorExtensions.x-has-data-class-body}} +{{#generateRoomModels}} + companion object { } + {{^discriminator}}override fun toRoomModel(): {{classname}}RoomModel = + {{classname}}RoomModel(roomTableId = 0, + {{#allVars}}{{#items.isPrimitiveType}}{{#isArray}}{{#isList}}{{name}} = this.{{name}},{{/isList}}{{/isArray}}{{/items.isPrimitiveType}}{{^isEnum}}{{^isArray}}{{name}} = this.{{name}},{{/isArray}}{{/isEnum}}{{#isEnum}}{{^isArray}}{{name}} = this.{{name}},{{/isArray}}{{/isEnum}} + {{/allVars}} + ){{/discriminator}} +{{/generateRoomModels}} +{{#serializableModel}} + {{#nonPublicApi}}internal {{/nonPublicApi}}{{^nonPublicApi}}{{#explicitApi}}public {{/explicitApi}}{{/nonPublicApi}}companion object { + private const val serialVersionUID: Long = 123 + } +{{/serializableModel}} +{{#discriminator}}{{#vars}}{{#required}} +{{>interface_req_var}}{{/required}}{{^required}} +{{>interface_opt_var}}{{/required}}{{/vars}}{{/discriminator}} +{{#hasEnums}} +{{#vars}} +{{#isEnum}} + /** + * {{{description}}} + * + * Values: {{#allowableValues}}{{#enumVars}}{{&name}}{{^-last}},{{/-last}}{{/enumVars}}{{/allowableValues}} + */ + {{^multiplatform}} + {{#kotlinx_serialization}} + {{#serializableModel}}@KSerializable{{/serializableModel}}{{^serializableModel}}@Serializable{{#enumUnknownDefaultCase}}(with = {{{nameInPascalCase}}}Serializer::class){{/enumUnknownDefaultCase}}{{/serializableModel}} + {{/kotlinx_serialization}} + {{#moshi}} + @JsonClass(generateAdapter = false) + {{/moshi}} + {{/multiplatform}} + {{#multiplatform}} + @Serializable + {{/multiplatform}} + {{#nonPublicApi}}internal {{/nonPublicApi}}{{^nonPublicApi}}{{#explicitApi}}public {{/explicitApi}}{{/nonPublicApi}}enum class {{{nameInPascalCase}}}({{^nonPublicApi}}{{#explicitApi}}public {{/explicitApi}}{{/nonPublicApi}}val value: {{^isContainer}}{{dataType}}{{/isContainer}}{{#isContainer}}kotlin.String{{/isContainer}}) { + {{#allowableValues}} + {{#enumVars}} + {{^multiplatform}} + {{#moshi}} + @Json(name = {{#lambda.doublequote}}{{{value}}}{{/lambda.doublequote}}) {{&name}}({{{value}}}){{^-last}},{{/-last}}{{#-last}};{{/-last}} + {{/moshi}} + {{#gson}} + @SerializedName(value = {{#lambda.doublequote}}{{{value}}}{{/lambda.doublequote}}) {{&name}}({{{value}}}){{^-last}},{{/-last}}{{#-last}};{{/-last}} + {{/gson}} + {{#jackson}} + @JsonProperty(value = {{#lambda.doublequote}}{{{value}}}{{/lambda.doublequote}}) {{#enumUnknownDefaultCase}}{{#-last}}@JsonEnumDefaultValue {{/-last}}{{/enumUnknownDefaultCase}}{{&name}}({{{value}}}){{^-last}},{{/-last}}{{#-last}};{{/-last}} + {{/jackson}} + {{#kotlinx_serialization}} + @SerialName(value = {{#lambda.doublequote}}{{{value}}}{{/lambda.doublequote}}) {{&name}}({{{value}}}){{^-last}},{{/-last}}{{#-last}};{{/-last}} + {{/kotlinx_serialization}} + {{/multiplatform}} + {{#multiplatform}} + @SerialName(value = {{#lambda.doublequote}}{{{value}}}{{/lambda.doublequote}}) {{&name}}({{{value}}}){{^-last}},{{/-last}}{{#-last}};{{/-last}} + {{/multiplatform}} + {{/enumVars}} + {{/allowableValues}} + } + {{#kotlinx_serialization}} + {{#enumUnknownDefaultCase}} + + internal object {{nameInPascalCase}}Serializer : KSerializer<{{nameInPascalCase}}> { + override val descriptor = {{^isContainer}}{{dataType}}{{/isContainer}}{{#isContainer}}kotlin.String{{/isContainer}}.serializer().descriptor + + override fun deserialize(decoder: Decoder): {{nameInPascalCase}} { + val value = decoder.decodeSerializableValue({{^isContainer}}{{dataType}}{{/isContainer}}{{#isContainer}}kotlin.String{{/isContainer}}.serializer()) + return {{nameInPascalCase}}.values().firstOrNull { it.value == value } + ?: {{nameInPascalCase}}.{{#allowableValues}}{{#enumVars}}{{#-last}}{{&name}}{{/-last}}{{/enumVars}}{{/allowableValues}} + } + + override fun serialize(encoder: Encoder, value: {{nameInPascalCase}}) { + encoder.encodeSerializableValue({{^isContainer}}{{dataType}}{{/isContainer}}{{#isContainer}}kotlin.String{{/isContainer}}.serializer(), value.value) + } + } + {{/enumUnknownDefaultCase}} + {{/kotlinx_serialization}} +{{/isEnum}} +{{/vars}} +{{/hasEnums}} +{{#generateOneOfAnyOfWrappers}} + {{#gson}} + + class CustomTypeAdapterFactory : TypeAdapterFactory { + override fun create(gson: Gson, type: TypeToken): TypeAdapter? { + if (!{{classname}}::class.java.isAssignableFrom(type.rawType)) { + return null // this class only serializes '{{classname}}' and its subtypes + } + val elementAdapter = gson.getAdapter(JsonElement::class.java) + val thisAdapter = gson.getDelegateAdapter(this, TypeToken.get({{classname}}::class.java)) + + @Suppress("UNCHECKED_CAST") + return object : TypeAdapter<{{classname}}>() { + @Throws(IOException::class) + override fun write(out: JsonWriter, value: {{classname}}) { + val obj = thisAdapter.toJsonTree(value).getAsJsonObject() + elementAdapter.write(out, obj) + } + + @Throws(IOException::class) + override fun read(jsonReader: JsonReader): {{classname}} { + val jsonElement = elementAdapter.read(jsonReader) + validateJsonElement(jsonElement) + return thisAdapter.fromJsonTree(jsonElement) + } + }.nullSafe() as TypeAdapter + } + } + + companion object { + var openapiFields = HashSet() + var openapiRequiredFields = HashSet() + + init { + {{#allVars}} + {{#-first}} + // a set of all properties/fields (JSON key names) + {{/-first}} + openapiFields.add("{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}") + {{/allVars}} + + {{#requiredVars}} + {{#-first}} + // a set of required properties/fields (JSON key names) + {{/-first}} + openapiRequiredFields.add("{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}") + {{/requiredVars}} + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to {{classname}} + */ + @Throws(IOException::class) + fun validateJsonElement(jsonElement: JsonElement?) { + if (jsonElement == null) { + require(openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + String.format("The required field(s) %s in {{{classname}}} is not found in the empty JSON string", {{classname}}.openapiRequiredFields.toString()) + } + } + {{^hasChildren}} + {{#requiredVars}} + {{#-first}} + + // check to make sure all required properties/fields are present in the JSON string + for (requiredField in openapiRequiredFields) { + requireNotNull(jsonElement!!.getAsJsonObject()[requiredField]) { + String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString()) + } + } + {{/-first}} + {{/requiredVars}} + {{/hasChildren}} + {{^discriminator}} + {{#hasVars}} + val jsonObj = jsonElement!!.getAsJsonObject() + {{/hasVars}} + {{#vars}} + {{#isArray}} + {{#items.isModel}} + {{#required}} + // ensure the json data is an array + if (!jsonObj.get("{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}").isJsonArray) { + throw IllegalArgumentException(String.format("Expected the field `{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}` to be an array in the JSON string but got `%s`", jsonObj["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"].toString())) + } + + // validate the required field `{{{baseName}}}` (array) + for (i in 0 until jsonObj.getAsJsonArray("{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}").size()) { + {{{items.dataType}}}.validateJsonElement(jsonObj.getAsJsonArray("{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}").get(i)) + } + {{/required}} + {{^required}} + if (jsonObj["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"] != null && !jsonObj["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"].isJsonNull) { + if (jsonObj.getAsJsonArray("{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}") != null) { + // ensure the json data is an array + require(jsonObj["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"].isJsonArray) { + String.format("Expected the field `{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}` to be an array in the JSON string but got `%s`", jsonObj["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"].toString()) + } + + // validate the optional field `{{{baseName}}}` (array) + for (i in 0 until jsonObj.getAsJsonArray("{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}").size()) { + {{{items.dataType}}}.validateJsonElement(jsonObj.getAsJsonArray("{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}").get(i)) + } + } + } + {{/required}} + {{/items.isModel}} + {{^items.isModel}} + {{^required}} + // ensure the optional json data is an array if present + if (jsonObj["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"] != null && !jsonObj["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"].isJsonNull) { + require(jsonObj["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"].isJsonArray()) { + String.format("Expected the field `{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}` to be an array in the JSON string but got `%s`", jsonObj["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"].toString()) + } + } + {{/required}} + {{#required}} + // ensure the required json array is present + requireNotNull(jsonObj["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"]) { + "Expected the field `{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}` to be an array in the JSON string but got `null`" + } + require(jsonObj["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"].isJsonArray()) { + String.format("Expected the field `{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}` to be an array in the JSON string but got `%s`", jsonObj["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"].toString()) + } + {{/required}} + {{#items.isPrimitiveType}} + // ensure the items in json array are primitive + if (jsonObj["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"] != null) { + for (i in 0 until jsonObj.getAsJsonArray("{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}").size()) { + require(jsonObj.getAsJsonArray("{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}").get(i).isJsonPrimitive) { + String.format("Expected the property in array `{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}` to be primitive") + } + } + } + {{/items.isPrimitiveType}} + {{/items.isModel}} + {{/isArray}} + {{^isContainer}} + {{#isString}} + {{#notRequiredOrIsNullable}} + if (jsonObj["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"] != null && !jsonObj["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"].isJsonNull) { + require(jsonObj.get("{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}").isJsonPrimitive) { + String.format("Expected the field `{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}` to be a primitive type in the JSON string but got `%s`", jsonObj["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"].toString()) + } + } + {{/notRequiredOrIsNullable}} + {{^notRequiredOrIsNullable}} + require(jsonObj["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"].isJsonPrimitive) { + String.format("Expected the field `{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}` to be a primitive type in the JSON string but got `%s`", jsonObj["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"].toString()) + } + {{/notRequiredOrIsNullable}} + {{/isString}} + {{#isModel}} + {{#required}} + // validate the required field `{{{baseName}}}` + {{{dataType}}}.validateJsonElement(jsonObj["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"]) + {{/required}} + {{^required}} + // validate the optional field `{{{baseName}}}` + if (jsonObj["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"] != null && !jsonObj["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"].isJsonNull) { + {{{dataType}}}.validateJsonElement(jsonObj["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"]) + } + {{/required}} + {{/isModel}} + {{#isEnum}} + {{#required}} + // validate the required field `{{{baseName}}}` + require({{{datatypeWithEnum}}}.values().any { it.value == jsonObj["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"].asString }) { + String.format("Expected the field `{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}` to be valid `{{{datatypeWithEnum}}}` enum value in the JSON string but got `%s`", jsonObj["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"].toString()) + } + {{/required}} + {{^required}} + // validate the optional field `{{{baseName}}}` + if (jsonObj["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"] != null && !jsonObj["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"].isJsonNull) { + require({{{datatypeWithEnum}}}.values().any { it.value == jsonObj["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"].asString }) { + String.format("Expected the field `{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}` to be valid `{{{datatypeWithEnum}}}` enum value in the JSON string but got `%s`", jsonObj["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"].toString()) + } + } + {{/required}} + {{/isEnum}} + {{#isEnumRef}} + {{#required}} + // validate the required field `{{{baseName}}}` + require({{{dataType}}}.values().any { it.value == jsonObj["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"].asString }) { + String.format("Expected the field `{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}` to be valid `{{{dataType}}}` enum value in the JSON string but got `%s`", jsonObj["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"].toString()) + } + {{/required}} + {{^required}} + // validate the optional field `{{{baseName}}}` + if (jsonObj["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"] != null && !jsonObj["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"].isJsonNull) { + require({{{dataType}}}.values().any { it.value == jsonObj["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"].asString }) { + String.format("Expected the field `{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}` to be valid `{{{dataType}}}` enum value in the JSON string but got `%s`", jsonObj["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"].toString()) + } + } + {{/required}} + {{/isEnumRef}} + {{/isContainer}} + {{/vars}} + {{/discriminator}} + } + } + {{/gson}} +{{/generateOneOfAnyOfWrappers}} + +{{#vendorExtensions.x-has-data-class-body}} +} +{{/vendorExtensions.x-has-data-class-body}} diff --git a/tonapi/templates/data_class_opt_var.mustache b/tonapi/templates/data_class_opt_var.mustache new file mode 100644 index 000000000..897b18f9e --- /dev/null +++ b/tonapi/templates/data_class_opt_var.mustache @@ -0,0 +1,24 @@ +{{#description}} + /* {{{.}}} */ +{{/description}} + {{^multiplatform}} + {{#moshi}} + @Json(name = "{{{vendorExtensions.x-base-name-literal}}}") + {{/moshi}} + {{#gson}} + @SerializedName("{{{vendorExtensions.x-base-name-literal}}}") + {{/gson}} + {{#jackson}} + @get:JsonProperty("{{{vendorExtensions.x-base-name-literal}}}") + {{/jackson}} + {{#kotlinx_serialization}} + {{^isEnum}}{{^isArray}}{{^isPrimitiveType}}{{^isModel}}@Contextual {{/isModel}}{{/isPrimitiveType}}{{/isArray}}{{/isEnum}}@SerialName(value = "{{{vendorExtensions.x-base-name-literal}}}") + {{/kotlinx_serialization}} + {{/multiplatform}} + {{#vendorExtensions.x-field-extra-annotation}} + {{{vendorExtensions.x-field-extra-annotation}}} + {{/vendorExtensions.x-field-extra-annotation}} + {{#deprecated}} + @Deprecated(message = "This property is deprecated.") + {{/deprecated}} + {{#multiplatform}}@SerialName(value = "{{{vendorExtensions.x-base-name-literal}}}") {{/multiplatform}}{{#isInherited}}override {{/isInherited}}{{>modelMutable}} {{{name}}}: {{#isArray}}{{#isList}}{{#uniqueItems}}kotlin.collections.{{#modelMutable}}Mutable{{/modelMutable}}Set{{/uniqueItems}}{{^uniqueItems}}kotlin.collections.{{#modelMutable}}Mutable{{/modelMutable}}List{{/uniqueItems}}{{/isList}}{{^isList}}kotlin.Array{{/isList}}<{{^items.isEnum}}{{^items.isPrimitiveType}}{{^items.isModel}}{{#kotlinx_serialization}}@Contextual {{/kotlinx_serialization}}{{/items.isModel}}{{/items.isPrimitiveType}}{{{items.dataType}}}{{/items.isEnum}}{{#items.isEnum}}{{classname}}.{{{nameInPascalCase}}}{{/items.isEnum}}>{{/isArray}}{{^isEnum}}{{^isArray}}{{{dataType}}}{{/isArray}}{{/isEnum}}{{#isEnum}}{{^isArray}}{{classname}}.{{{nameInPascalCase}}}{{/isArray}}{{/isEnum}}? = {{^defaultValue}}null{{/defaultValue}}{{#defaultValue}}{{^isNumber}}{{{defaultValue}}}{{/isNumber}}{{#isNumber}}{{^multiplatform}}{{{dataType}}}("{{{defaultValue}}}"){{/multiplatform}}{{#multiplatform}}({{{defaultValue}}}).toDouble(){{/multiplatform}}{{/isNumber}}{{/defaultValue}} \ No newline at end of file diff --git a/tonapi/templates/data_class_req_var.mustache b/tonapi/templates/data_class_req_var.mustache new file mode 100644 index 000000000..811867dfc --- /dev/null +++ b/tonapi/templates/data_class_req_var.mustache @@ -0,0 +1,24 @@ +{{#description}} + /* {{{.}}} */ +{{/description}} + {{^multiplatform}} + {{#moshi}} + @Json(name = "{{{vendorExtensions.x-base-name-literal}}}") + {{/moshi}} + {{#gson}} + @SerializedName("{{{vendorExtensions.x-base-name-literal}}}") + {{/gson}} + {{#jackson}} + @get:JsonProperty("{{{vendorExtensions.x-base-name-literal}}}") + {{/jackson}} + {{#kotlinx_serialization}} + {{^isEnum}}{{^isArray}}{{^isPrimitiveType}}{{^isModel}}@Contextual {{/isModel}}{{/isPrimitiveType}}{{/isArray}}{{/isEnum}}@SerialName(value = "{{{vendorExtensions.x-base-name-literal}}}") + {{/kotlinx_serialization}} + {{/multiplatform}} + {{#vendorExtensions.x-field-extra-annotation}} + {{{vendorExtensions.x-field-extra-annotation}}} + {{/vendorExtensions.x-field-extra-annotation}} + {{#deprecated}} + @Deprecated(message = "This property is deprecated.") + {{/deprecated}} + {{#multiplatform}}@SerialName(value = "{{{vendorExtensions.x-base-name-literal}}}") @Required {{/multiplatform}}{{#isInherited}}override {{/isInherited}}{{>modelMutable}} {{{name}}}: {{#isArray}}{{#isList}}{{#uniqueItems}}kotlin.collections.{{#modelMutable}}Mutable{{/modelMutable}}Set{{/uniqueItems}}{{^uniqueItems}}kotlin.collections.{{#modelMutable}}Mutable{{/modelMutable}}List{{/uniqueItems}}{{/isList}}{{^isList}}kotlin.Array{{/isList}}<{{^items.isEnum}}{{^items.isPrimitiveType}}{{^items.isModel}}{{#kotlinx_serialization}}@Contextual {{/kotlinx_serialization}}{{/items.isModel}}{{/items.isPrimitiveType}}{{{items.dataType}}}{{/items.isEnum}}{{#items.isEnum}}{{classname}}.{{{nameInPascalCase}}}{{/items.isEnum}}>{{/isArray}}{{^isEnum}}{{^isArray}}{{{dataType}}}{{/isArray}}{{/isEnum}}{{#isEnum}}{{^isArray}}{{classname}}.{{{nameInPascalCase}}}{{/isArray}}{{/isEnum}}{{#isNullable}}?{{/isNullable}}{{#defaultValue}} = {{^isNumber}}{{{defaultValue}}}{{/isNumber}}{{#isNumber}}{{^multiplatform}}{{{dataType}}}("{{{defaultValue}}}"){{/multiplatform}}{{#multiplatform}}({{{defaultValue}}}).toDouble(){{/multiplatform}}{{/isNumber}}{{/defaultValue}} \ No newline at end of file diff --git a/tonapi/templates/libraries/jvm-okhttp/api.mustache b/tonapi/templates/libraries/jvm-okhttp/api.mustache new file mode 100644 index 000000000..86a54d587 --- /dev/null +++ b/tonapi/templates/libraries/jvm-okhttp/api.mustache @@ -0,0 +1,252 @@ +{{>licenseInfo}} +package {{apiPackage}} + +import java.io.IOException +import okhttp3.Call +import okhttp3.HttpUrl + +{{#imports}}import {{import}} +{{/imports}} + +{{^multiplatform}} +{{#gson}} +import com.google.gson.annotations.SerializedName +{{/gson}} +{{#moshi}} +import com.squareup.moshi.Json +{{/moshi}} +{{#jackson}} +import com.fasterxml.jackson.annotation.JsonProperty +{{/jackson}} +{{#kotlinx_serialization}} +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable +{{/kotlinx_serialization}} +{{/multiplatform}} +{{#multiplatform}} +import kotlinx.serialization.* +{{/multiplatform}} + +{{^doNotUseRxAndCoroutines}} +{{#useCoroutines}} +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.withContext +{{/useCoroutines}} +{{/doNotUseRxAndCoroutines}} +import io.infrastructure.ApiClient +import io.infrastructure.ApiResponse +import io.infrastructure.ClientException +import io.infrastructure.ClientError +import io.infrastructure.ServerException +import io.infrastructure.ServerError +import io.infrastructure.MultiValueMap +import io.infrastructure.PartConfig +import io.infrastructure.RequestConfig +import io.infrastructure.RequestMethod +import io.infrastructure.ResponseType +import io.infrastructure.Success +import io.infrastructure.toMultiValue + +{{#operations}} +{{#nonPublicApi}}internal {{/nonPublicApi}}{{^nonPublicApi}}{{#explicitApi}}public {{/explicitApi}}{{/nonPublicApi}}class {{classname}}(basePath: kotlin.String = defaultBasePath, client: Call.Factory = ApiClient.defaultClient) : ApiClient(basePath, client) { + {{^nonPublicApi}}{{#explicitApi}}public {{/explicitApi}}{{/nonPublicApi}}companion object { + @JvmStatic + {{^nonPublicApi}}{{#explicitApi}}public {{/explicitApi}}{{/nonPublicApi}}val defaultBasePath: String by lazy { + System.getProperties().getProperty(ApiClient.baseUrlKey, "{{{basePath}}}") + } + } + + {{#operation}} + {{#allParams}} + {{#isEnum}} + /** + * enum for parameter {{paramName}} + */ + {{#nonPublicApi}}internal {{/nonPublicApi}}{{^nonPublicApi}}{{#explicitApi}}public {{/explicitApi}}{{/nonPublicApi}}enum class {{enumName}}{{operationIdCamelCase}}({{^nonPublicApi}}{{#explicitApi}}public {{/explicitApi}}{{/nonPublicApi}}val value: {{^isContainer}}{{dataType}}{{/isContainer}}{{#isContainer}}kotlin.String{{/isContainer}}) { + {{^enumUnknownDefaultCase}} + {{#allowableValues}} + {{#enumVars}} + {{^multiplatform}} + {{#moshi}} + @Json(name = {{^isString}}"{{/isString}}{{{value}}}{{^isString}}"{{/isString}}) {{&name}}({{{value}}}){{^-last}},{{/-last}}{{#-last}};{{/-last}} + {{/moshi}} + {{#gson}} + @SerializedName(value = {{^isString}}"{{/isString}}{{{value}}}{{^isString}}"{{/isString}}) {{&name}}({{{value}}}){{^-last}},{{/-last}}{{#-last}};{{/-last}} + {{/gson}} + {{#jackson}} + @JsonProperty(value = {{^isString}}"{{/isString}}{{{value}}}{{^isString}}"{{/isString}}) {{&name}}({{{value}}}){{^-last}},{{/-last}}{{#-last}};{{/-last}} + {{/jackson}} + {{#kotlinx_serialization}} + @SerialName(value = {{^isString}}"{{/isString}}{{{value}}}{{^isString}}"{{/isString}}) {{&name}}({{{value}}}){{^-last}},{{/-last}}{{#-last}};{{/-last}} + {{/kotlinx_serialization}} + {{/multiplatform}} + {{#multiplatform}} + @SerialName(value = {{^isString}}"{{/isString}}{{{value}}}{{^isString}}"{{/isString}}) {{&name}}({{{value}}}){{^-last}},{{/-last}}{{#-last}};{{/-last}} + {{/multiplatform}} + {{/enumVars}} + {{/allowableValues}} + {{/enumUnknownDefaultCase}} + {{#enumUnknownDefaultCase}} + {{#allowableValues}} + {{#enumVars}} + {{^multiplatform}} + {{#moshi}} + @Json(name = {{^isString}}"{{/isString}}{{{value}}}{{^isString}}"{{/isString}}) {{&name}}({{{value}}}){{^-last}},{{/-last}}{{#-last}};{{/-last}} + {{/moshi}} + {{#gson}} + @SerializedName(value = {{^isString}}"{{/isString}}{{{value}}}{{^isString}}"{{/isString}}) {{&name}}({{{value}}}){{^-last}},{{/-last}}{{#-last}};{{/-last}} + {{/gson}} + {{#jackson}} + @JsonProperty(value = {{^isString}}"{{/isString}}{{{value}}}{{^isString}}"{{/isString}}) {{&name}}({{{value}}}){{^-last}},{{/-last}}{{#-last}};{{/-last}} + {{/jackson}} + {{#kotlinx_serialization}} + @SerialName(value = {{^isString}}"{{/isString}}{{{value}}}{{^isString}}"{{/isString}}) {{&name}}({{{value}}}){{^-last}},{{/-last}}{{#-last}};{{/-last}} + {{/kotlinx_serialization}} + {{/multiplatform}} + {{#multiplatform}} + @SerialName(value = {{^isString}}"{{/isString}}{{{value}}}{{^isString}}"{{/isString}}) {{&name}}({{{value}}}){{^-last}},{{/-last}}{{#-last}};{{/-last}} + {{/multiplatform}} + {{/enumVars}} + {{/allowableValues}} + {{/enumUnknownDefaultCase}} + + /** + * Override [toString()] to avoid using the enum variable name as the value, and instead use + * the actual value defined in the API spec file. + * + * This solves a problem when the variable name and its value are different, and ensures that + * the client sends the correct enum values to the server always. + */ + override fun toString(): kotlin.String = "$value" + } + + {{/isEnum}} + {{/allParams}} + {{#returnType}} + @Suppress("UNCHECKED_CAST"){{/returnType}} + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + {{#isDeprecated}} + @Deprecated(message = "This operation is deprecated.") + {{/isDeprecated}} + {{^nonPublicApi}}{{#explicitApi}}public {{/explicitApi}}{{/nonPublicApi}}{{^doNotUseRxAndCoroutines}}{{#useCoroutines}}suspend {{/useCoroutines}}{{/doNotUseRxAndCoroutines}}fun {{operationId}}({{#allParams}}{{{paramName}}}: {{#isEnum}}{{#isContainer}}kotlin.collections.List<{{enumName}}{{operationIdCamelCase}}>{{/isContainer}}{{^isContainer}}{{enumName}}{{operationIdCamelCase}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#required}}{{#defaultValue}} = {{^isNumber}}{{#isEnum}}{{enumName}}{{operationIdCamelCase}}.{{enumDefaultValue}}{{/isEnum}}{{^isEnum}}{{{defaultValue}}}{{/isEnum}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/defaultValue}}{{/required}}{{^required}}?{{#defaultValue}} = {{^isNumber}}{{#isEnum}}{{enumName}}{{operationIdCamelCase}}.{{enumDefaultValue}}{{/isEnum}}{{^isEnum}}{{{defaultValue}}}{{/isEnum}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/defaultValue}}{{^defaultValue}} = null{{/defaultValue}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}) : {{#returnType}}{{{returnType}}}{{#nullableReturnType}}?{{/nullableReturnType}}{{/returnType}}{{^returnType}}Unit{{/returnType}}{{^doNotUseRxAndCoroutines}}{{#useCoroutines}} = withContext(Dispatchers.IO){{/useCoroutines}}{{/doNotUseRxAndCoroutines}} { + {{#isDeprecated}} + @Suppress("DEPRECATION") + {{/isDeprecated}} + val localVarResponse = {{operationId}}WithHttpInfo({{#allParams}}{{{paramName}}} = {{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}}) + + return{{^doNotUseRxAndCoroutines}}{{#useCoroutines}}@withContext{{/useCoroutines}}{{/doNotUseRxAndCoroutines}} when (localVarResponse.responseType) { + ResponseType.Success -> {{#returnType}}(localVarResponse as Success<*>).data as {{{returnType}}}{{#nullableReturnType}}?{{/nullableReturnType}}{{/returnType}}{{^returnType}}Unit{{/returnType}} + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> { + val localVarError = localVarResponse as ClientError<*> + throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + } + ResponseType.ServerError -> { + val localVarError = localVarResponse as ServerError<*> + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) + } + } + } + + {{#returnType}} + @Suppress("UNCHECKED_CAST"){{/returnType}} + @Throws(IllegalStateException::class, IOException::class) + {{#isDeprecated}} + @Deprecated(message = "This operation is deprecated.") + {{/isDeprecated}} + {{^nonPublicApi}}{{#explicitApi}}public {{/explicitApi}}{{/nonPublicApi}}{{^doNotUseRxAndCoroutines}}{{#useCoroutines}}suspend {{/useCoroutines}}{{/doNotUseRxAndCoroutines}}fun {{operationId}}WithHttpInfo({{#allParams}}{{{paramName}}}: {{#isEnum}}{{#isContainer}}kotlin.collections.List<{{enumName}}{{operationIdCamelCase}}>{{/isContainer}}{{^isContainer}}{{enumName}}{{operationIdCamelCase}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}?{{/required}}{{^-last}}, {{/-last}}{{/allParams}}) : ApiResponse<{{#returnType}}{{{returnType}}}?{{/returnType}}{{^returnType}}Unit?{{/returnType}}>{{^doNotUseRxAndCoroutines}}{{#useCoroutines}} = withContext(Dispatchers.IO){{/useCoroutines}}{{/doNotUseRxAndCoroutines}} { + {{#isDeprecated}} + @Suppress("DEPRECATION") + {{/isDeprecated}} + val localVariableConfig = {{operationId}}RequestConfig({{#allParams}}{{{paramName}}} = {{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}}) + + return{{^doNotUseRxAndCoroutines}}{{#useCoroutines}}@withContext{{/useCoroutines}}{{/doNotUseRxAndCoroutines}} request<{{#hasBodyParam}}{{#bodyParams}}{{{dataType}}}{{/bodyParams}}{{/hasBodyParam}}{{^hasBodyParam}}{{^hasFormParams}}Unit{{/hasFormParams}}{{#hasFormParams}}Map>{{/hasFormParams}}{{/hasBodyParam}}, {{{returnType}}}{{^returnType}}Unit{{/returnType}}>( + localVariableConfig + ) + } + + {{#isDeprecated}} + @Deprecated(message = "This operation is deprecated.") + {{/isDeprecated}} + {{^nonPublicApi}}{{#explicitApi}}public {{/explicitApi}}{{/nonPublicApi}}fun {{operationId}}RequestConfig({{#allParams}}{{{paramName}}}: {{#isEnum}}{{#isContainer}}kotlin.collections.List<{{enumName}}{{operationIdCamelCase}}>{{/isContainer}}{{^isContainer}}{{enumName}}{{operationIdCamelCase}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}?{{/required}}{{^-last}}, {{/-last}}{{/allParams}}) : RequestConfig<{{#hasBodyParam}}{{#bodyParams}}{{{dataType}}}{{/bodyParams}}{{/hasBodyParam}}{{^hasBodyParam}}{{^hasFormParams}}Unit{{/hasFormParams}}{{#hasFormParams}}Map>{{/hasFormParams}}{{/hasBodyParam}}> { + val localVariableBody = {{#hasBodyParam}}{{! + }}{{#bodyParams}}{{{paramName}}}{{/bodyParams}}{{/hasBodyParam}}{{^hasBodyParam}}{{! + }}{{^hasFormParams}}null{{/hasFormParams}}{{! + }}{{#hasFormParams}}mapOf({{#formParams}} + "{{#lambda.escapeDollar}}{{{baseName}}}{{/lambda.escapeDollar}}" to PartConfig(body = {{{paramName}}}{{#isEnum}}{{^required}}?{{/required}}.value{{/isEnum}}, headers = mutableMapOf({{#contentType}}"Content-Type" to "{{contentType}}"{{/contentType}})),{{! + }}{{/formParams}}){{/hasFormParams}}{{! + }}{{/hasBodyParam}} + val localVariableQuery: MultiValueMap = {{^hasQueryParams}}mutableMapOf() +{{/hasQueryParams}}{{#hasQueryParams}}mutableMapOf>() + .apply { + {{#queryParams}} + {{^required}} + if ({{{paramName}}} != null) { + {{#isModel}} + {{#vars}} + if ({{{paramName}}}.{{name}} != null) { + put("{{#isDeepObject}}{{{paramName}}}[{{/isDeepObject}}{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}{{#isDeepObject}}]{{/isDeepObject}}", {{#isContainer}}toMultiValue({{{paramName}}}.{{name}}.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{#isDateTime}}parseDateToQueryString({{{paramName}}}.{{name}}){{/isDateTime}}{{#isDate}}parseDateToQueryString({{{paramName}}}.{{name}}){{/isDate}}{{#isEnum}}{{#isString}}{{{paramName}}}.{{name}}.value{{/isString}}{{^isString}}{{{paramName}}}.{{name}}.toString(){{/isString}}{{/isEnum}}{{^isEnum}}{{^isDateTime}}{{^isDate}}{{{paramName}}}.{{name}}.toString(){{/isDate}}{{/isDateTime}}{{/isEnum}}){{/isContainer}}) + } + {{/vars}} + {{/isModel}} + {{^isModel}} + put("{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}", {{#isContainer}}toMultiValue({{{paramName}}}.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{#isDateTime}}parseDateToQueryString({{{paramName}}}){{/isDateTime}}{{#isDate}}parseDateToQueryString({{{paramName}}}){{/isDate}}{{#isEnum}}{{#isString}}{{{paramName}}}.value{{/isString}}{{^isString}}{{{paramName}}}.toString(){{/isString}}{{/isEnum}}{{^isEnum}}{{^isDateTime}}{{^isDate}}{{{paramName}}}.toString(){{/isDate}}{{/isDateTime}}{{/isEnum}}){{/isContainer}}) + {{/isModel}} + } + {{/required}} + {{#required}} + {{#isNullable}} + if ({{{paramName}}} != null) { + {{#isModel}} + {{#vars}} + if ({{{paramName}}}.{{name}} != null) { + put("{{#isDeepObject}}{{{paramName}}}[{{/isDeepObject}}{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}{{#isDeepObject}}]{{/isDeepObject}}", {{#isContainer}}toMultiValue({{{paramName}}}.{{name}}.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{#isDateTime}}parseDateToQueryString({{{paramName}}}.{{name}}){{/isDateTime}}{{#isDate}}parseDateToQueryString({{{paramName}}}.{{name}}){{/isDate}}{{#isEnum}}{{#isString}}{{{paramName}}}.{{name}}.value{{/isString}}{{^isString}}{{{paramName}}}.{{name}}.toString(){{/isString}}{{/isEnum}}{{^isEnum}}{{^isDateTime}}{{^isDate}}{{{paramName}}}.{{name}}.toString(){{/isDate}}{{/isDateTime}}{{/isEnum}}){{/isContainer}}) + } + {{/vars}} + {{/isModel}} + {{^isModel}} + put("{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}", {{#isContainer}}toMultiValue({{{paramName}}}.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{#isDateTime}}parseDateToQueryString({{{paramName}}}){{/isDateTime}}{{#isDate}}parseDateToQueryString({{{paramName}}}){{/isDate}}{{#isEnum}}{{#isString}}{{{paramName}}}.value{{/isString}}{{^isString}}{{{paramName}}}.toString(){{/isString}}{{/isEnum}}{{^isEnum}}{{^isDateTime}}{{^isDate}}{{{paramName}}}.toString(){{/isDate}}{{/isDateTime}}{{/isEnum}}){{/isContainer}}) + {{/isModel}} + } + {{/isNullable}} + {{^isNullable}} + {{#isModel}} + {{#vars}} + if ({{{paramName}}}.{{name}} != null) { + put("{{#isDeepObject}}{{{paramName}}}[{{/isDeepObject}}{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}{{#isDeepObject}}]{{/isDeepObject}}", {{#isContainer}}toMultiValue({{{paramName}}}.{{name}}.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{#isDateTime}}parseDateToQueryString({{{paramName}}}.{{name}}){{/isDateTime}}{{#isDate}}parseDateToQueryString({{{paramName}}}.{{name}}){{/isDate}}{{#isEnum}}{{#isString}}{{{paramName}}}.{{name}}.value{{/isString}}{{^isString}}{{{paramName}}}.{{name}}.toString(){{/isString}}{{/isEnum}}{{^isEnum}}{{^isDateTime}}{{^isDate}}{{{paramName}}}.{{name}}.toString(){{/isDate}}{{/isDateTime}}{{/isEnum}}){{/isContainer}}) + } + {{/vars}} + {{/isModel}} + {{^isModel}} + put("{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}", {{#isContainer}}toMultiValue({{{paramName}}}.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{#isDateTime}}parseDateToQueryString({{{paramName}}}){{/isDateTime}}{{#isDate}}parseDateToQueryString({{{paramName}}}){{/isDate}}{{#isEnum}}{{#isString}}{{{paramName}}}.value{{/isString}}{{^isString}}{{{paramName}}}.toString(){{/isString}}{{/isEnum}}{{^isEnum}}{{^isDateTime}}{{^isDate}}{{{paramName}}}.toString(){{/isDate}}{{/isDateTime}}{{/isEnum}}){{/isContainer}}) + {{/isModel}} + {{/isNullable}} + {{/required}} + {{/queryParams}} + } + {{/hasQueryParams}} + val localVariableHeaders: MutableMap = mutableMapOf({{#hasFormParams}}"Content-Type" to {{^consumes}}"multipart/form-data"{{/consumes}}{{#consumes.0}}"{{{mediaType}}}"{{/consumes.0}}{{/hasFormParams}}) + {{#headerParams}} + {{{paramName}}}{{^required}}?{{/required}}.apply { localVariableHeaders["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"] = {{#isContainer}}this.joinToString(separator = collectionDelimiter("{{collectionFormat}}")){{/isContainer}}{{^isContainer}}this.toString(){{/isContainer}} } + {{/headerParams}} + {{^hasFormParams}}{{#hasConsumes}}{{#consumes}}localVariableHeaders["Content-Type"] = "{{{mediaType}}}" + {{/consumes}}{{/hasConsumes}}{{/hasFormParams}}{{#hasProduces}}localVariableHeaders["Accept"] = "{{#produces}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/produces}}" +{{/hasProduces}} + + return RequestConfig( + method = RequestMethod.{{httpMethod}}, + path = "{{{path}}}"{{#pathParams}}.replace("{"+"{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"+"}", encodeURIComponent({{#isContainer}}{{paramName}}.joinToString(","){{/isContainer}}{{^isContainer}}{{{paramName}}}{{#isEnum}}{{^required}}?{{/required}}.value{{/isEnum}}.toString(){{/isContainer}})){{/pathParams}}, + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = {{#hasAuthMethods}}true{{/hasAuthMethods}}{{^hasAuthMethods}}false{{/hasAuthMethods}}, + body = localVariableBody + ) + } + + {{/operation}} + + private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String = + HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0] +} +{{/operations}} diff --git a/tonapi/tonapi.sh b/tonapi/tonapi.sh index 797c385d5..9babd8f06 100644 --- a/tonapi/tonapi.sh +++ b/tonapi/tonapi.sh @@ -1,16 +1,3 @@ -curl -o openapi.yml 'https://raw.githubusercontent.com/tonkeeper/opentonapi/master/api/openapi.yml' +#!/bin/bash -openapi-generator generate -i openapi.yml -g kotlin --additional-properties packageName=io.tonapi - - -rm -rf openapi.yml -rm -rf settings.gradle -rm -rf docs -rm -rf gradle -rm -rf .openapi-generator -rm -rf README.md -rm -rf build.gradle -rm -rf .openapi-generator-ignore -rm -rf gradlew -rm -rf gradlew.bat -rm -rf src/test +bash generate.sh "https://raw.githubusercontent.com/tonkeeper/opentonapi/master/api/openapi.yml" "tonapi" \ No newline at end of file diff --git a/tonapi/upd.sh b/tonapi/upd.sh index 1ea4183de..19164e177 100644 --- a/tonapi/upd.sh +++ b/tonapi/upd.sh @@ -1,23 +1,4 @@ -curl -o openapi.yml 'https://raw.githubusercontent.com/tonkeeper/opentonapi/master/api/openapi.yml' -curl -o battery-api.yml 'https://raw.githubusercontent.com/tonkeeper/custodial-battery/master/api/battery-api.yml' +#!/bin/bash -openapi-generator generate -i openapi.yml -g kotlin --additional-properties packageName=io.tonapi -openapi-generator generate -i battery-api.yml -g kotlin --additional-properties packageName=io.batteryapi - -# Rename the file -mv src/main/kotlin/io/batteryapi/apis/DefaultApi.kt src/main/kotlin/io/batteryapi/apis/BatteryApi.kt -# Replace the class name inside the file -sed -i '' 's/class DefaultApi/class BatteryApi/' src/main/kotlin/io/batteryapi/apis/BatteryApi.kt - -rm -rf openapi.yml -rm -rf battery-api.yml -rm -rf settings.gradle -rm -rf docs -rm -rf gradle -rm -rf .openapi-generator -rm -rf README.md -rm -rf build.gradle -rm -rf .openapi-generator-ignore -rm -rf gradlew -rm -rf gradlew.bat -rm -rf src/test +bash tonapi.sh +bash battery.sh \ No newline at end of file From ce5906cf0534d1a3a31fa213c6f76d87316223ec Mon Sep 17 00:00:00 2001 From: Anton Polstianka <110775852+polstianka@users.noreply.github.com> Date: Thu, 24 Jul 2025 04:53:23 -0400 Subject: [PATCH 05/36] omniston realtime api (#150) * omniston realtime api Signed-off-by: polstianka * swap * switch to internall api * swap ui fixeds * swap fix ui * fixeds onramp * bug fixeds * gradle update * fix crash * bug fixeds for swap * fixeds for onramp * onramp bug fixeds --------- Signed-off-by: polstianka --- .idea/gradle.xml | 1 + .idea/kotlinc.xml | 2 +- apps/wallet/api/build.gradle.kts | 3 + .../main/java/com/tonapps/wallet/api/API.kt | 56 +- .../com/tonapps/wallet/api/BatteryProvider.kt | 23 + .../java/com/tonapps/wallet/api/Extensions.kt | 1 + .../tonapps/wallet/api/ServerTimeProvider.kt | 48 ++ .../com/tonapps/wallet/api/core/BatteryAPI.kt | 18 + .../wallet/api/entity/BalanceEntity.kt | 3 + .../tonapps/wallet/api/entity/ConfigEntity.kt | 20 + .../tonapps/wallet/api/entity/SwapEntity.kt | 32 + .../wallet/api/internal/InternalApi.kt | 26 +- .../tonapps/wallet/api/omniston/Omniston.kt | 155 +++++ .../tonapps/wallet/data/core/Extensions.kt | 6 + .../data/core/currency/CurrencyCountries.kt | 4 + .../data/core/currency/WalletCurrency.kt | 29 +- .../data/core/entity/RawMessageEntity.kt | 9 +- .../data/purchase/PurchaseRepository.kt | 48 +- .../wallet/data/purchase/entity/OnRamp.kt | 51 +- .../wallet/data/rates/RatesRepository.kt | 14 +- .../wallet/data/rates/entity/RatesEntity.kt | 46 +- .../data/settings/SettingsRepository.kt | 12 + .../settings/entities/PreferredFeeMethod.kt | 2 +- .../data/settings/folder/WalletPrefsFolder.kt | 1 - apps/wallet/data/swap/.gitignore | 1 + apps/wallet/data/swap/build.gradle.kts | 17 + .../data/swap/src/main/AndroidManifest.xml | 1 + .../com/tonapps/wallet/data/swap/Module.kt | 8 + .../wallet/data/swap/SwapRepository.kt | 56 ++ .../data/swap/entity/SwapAssetEntity.kt | 41 ++ .../data/token/entities/AccountTokenEntity.kt | 5 + apps/wallet/instance/app/build.gradle.kts | 1 + .../main/java/com/tonapps/tonkeeper/App.kt | 7 +- .../tonkeeper/core/entities/AssetsEntity.kt | 13 + .../tonkeeper/extensions/ActionSheet.kt | 39 ++ .../tonkeeper/extensions/BaseFragment.kt | 4 + .../extensions/PurchaseRepository.kt | 31 +- .../tonkeeper/extensions/RootViewModel.kt | 10 + .../tonapps/tonkeeper/extensions/SendFee.kt | 38 + .../tonkeeper/extensions/SignRequestEntity.kt | 1 - .../tonapps/tonkeeper/helper/BatteryHelper.kt | 80 +++ .../com/tonapps/tonkeeper/helper/TwinInput.kt | 205 ++++++ .../tonkeeper/koin/viewModelWalletModule.kt | 4 + .../tonkeeper/manager/assets/AssetsManager.kt | 19 +- .../tonapps/tonkeeper/ui/base/BaseWalletVM.kt | 8 +- .../picker/currency/CurrencyPickerScreen.kt | 4 +- .../currency/CurrencyPickerViewModel.kt | 26 +- .../ui/base/picker/currency/list/Item.kt | 5 +- .../tonkeeper/ui/component/PaymentTypeView.kt | 32 +- .../ui/component/coin/CoinEditText.kt | 175 +++-- .../ui/component/token/CurrencyPickerView.kt | 1 + .../tonkeeper/ui/screen/main/MainScreen.kt | 4 +- .../ui/screen/onramp/main/BaseOnRampScreen.kt | 224 ++++++ .../ui/screen/onramp/main/OnRampMerchant.kt | 13 - .../ui/screen/onramp/main/OnRampScreen.kt | 341 +++------ .../ui/screen/onramp/main/OnRampSettings.kt | 31 + .../ui/screen/onramp/main/OnRampUtils.kt | 44 ++ .../ui/screen/onramp/main/OnRampViewModel.kt | 653 +++++++++--------- .../onramp/main/entities/ProviderEntity.kt | 31 + .../onramp/main/state/CurrencyInputState.kt | 86 --- .../ui/screen/onramp/main/state/InputState.kt | 36 - .../onramp/main/state/OnRampBalanceState.kt | 9 - .../onramp/main/state/OnRampConfirmState.kt | 9 - .../onramp/main/state/OnRampCurrencyInputs.kt | 155 ----- .../onramp/main/state/OnRampInputsState.kt | 12 - .../main/state/OnRampPaymentMethodState.kt | 87 +++ .../ui/screen/onramp/main/state/UiState.kt | 77 +++ .../onramp/main/view/CurrencyInputView.kt | 67 +- .../onramp/main/view/ReviewInputView.kt | 13 + .../picker/currency/OnRampPickerArgs.kt | 27 + .../picker/currency/OnRampPickerCommand.kt | 7 +- .../picker/currency/OnRampPickerScreen.kt | 95 ++- .../picker/currency/OnRampPickerViewModel.kt | 93 ++- .../picker/currency/fiat/OnRampFiatScreen.kt | 10 +- .../main/OnRampCurrencyPickerScreen.kt | 12 +- .../onramp/picker/currency/main/list/Item.kt | 8 +- .../provider/OnRampProviderPickerScreen.kt | 39 +- .../provider/OnRampProviderPickerViewModel.kt | 42 +- .../onramp/picker/provider/list/Item.kt | 31 +- .../screen/purchase/PurchaseConfirmDialog.kt | 22 +- .../ui/screen/send/main/state/SendFee.kt | 3 +- .../send/transaction/SendTransactionScreen.kt | 59 +- .../transaction/SendTransactionViewModel.kt | 78 +-- .../tonkeeper/ui/screen/swap/SwapScreen.kt | 17 +- .../ui/screen/swap/omniston/OmnistonArgs.kt | 27 + .../ui/screen/swap/omniston/OmnistonScreen.kt | 352 ++++++++++ .../screen/swap/omniston/OmnistonViewModel.kt | 536 ++++++++++++++ .../swap/omniston/state/OmnistonStep.kt | 5 + .../swap/omniston/state/SwapInputsState.kt | 44 ++ .../swap/omniston/state/SwapQuoteState.kt | 93 +++ .../swap/omniston/state/SwapTokenState.kt | 22 + .../ui/screen/swap/picker/SwapPickerArgs.kt | 31 + .../ui/screen/swap/picker/SwapPickerScreen.kt | 124 ++++ .../screen/swap/picker/SwapPickerViewModel.kt | 78 +++ .../ui/screen/swap/picker/list/Adapter.kt | 25 + .../ui/screen/swap/picker/list/Item.kt | 35 + .../screen/swap/picker/list/holder/Holder.kt | 11 + .../swap/picker/list/holder/TokenHolder.kt | 44 ++ .../token/viewer/list/holder/ActionsHolder.kt | 7 +- .../ui/screen/tonconnect/TonConnectScreen.kt | 4 +- .../wallet/main/list/holder/ActionsHolder.kt | 6 +- .../tonkeeper/usecase/emulation/Emulated.kt | 47 ++ .../src/main/res/layout/fragment_omniston.xml | 36 + .../res/layout/fragment_omniston_inputs.xml | 82 +++ .../res/layout/fragment_omniston_review.xml | 121 ++++ .../src/main/res/layout/fragment_onramp.xml | 113 +-- .../res/layout/fragment_onramp_inputs.xml | 30 +- .../res/layout/fragment_onramp_picker.xml | 12 +- .../res/layout/fragment_onramp_review.xml | 40 +- .../res/layout/fragment_purchase_confirm.xml | 41 +- .../main/res/layout/fragment_swap_picker.xml | 51 ++ .../main/res/layout/view_currency_input.xml | 15 + .../main/res/layout/view_currency_item.xml | 2 +- .../src/main/res/layout/view_payment_type.xml | 3 +- .../app/src/main/res/values/styleable.xml | 3 + .../src/main/res/values/strings.xml | 7 +- build.gradle.kts | 6 +- build/reports/problems/problems-report.html | 4 +- buildSrc/src/main/kotlin/Dependence.kt | 1 + gradle/wrapper/gradle-wrapper.properties | 2 +- .../blockchain/ton/extensions/AddrStd.kt | 2 +- .../src/main/java/com/tonapps/icu/Coins.kt | 44 +- .../java/com/tonapps/icu/CurrencyFormatter.kt | 4 + .../com/tonapps/icu/format/CurrencyFormat.kt | 2 +- .../java/com/tonapps/network/OkHttpClient.kt | 6 + .../com/tonapps/network/ws/WSConnection.kt | 137 ++++ .../tonapps/network/ws/WSConnectionState.kt | 8 + .../java/com/tonapps/network/ws/WSEvent.kt | 8 + settings.gradle.kts | 1 + .../core/src/main/java/uikit/UiButtonState.kt | 6 + .../java/uikit/extensions/LifecycleOwner.kt | 2 +- .../java/uikit/extensions/RecyclerView.kt | 19 + .../extensions/SpannableStringBuilder.kt | 7 + .../src/main/java/uikit/extensions/String.kt | 47 +- .../src/main/java/uikit/extensions/View.kt | 44 +- .../java/uikit/span/ClickableSpanCompat.kt | 4 +- .../java/uikit/widget/BottomSheetLayout.kt | 33 +- .../main/java/uikit/widget/LoadableButton.kt | 10 + .../java/uikit/widget/SlideBetweenView.kt | 25 +- .../java/uikit/widget/item/ItemLineView.kt | 52 ++ .../main/res/drawable/bg_content_bottom.xml | 12 + .../main/res/drawable/bg_content_error.xml | 9 + .../src/main/res/drawable/bg_content_top.xml | 12 + .../src/main/res/layout/view_item_line.xml | 20 + .../core/src/main/res/values/styleable.xml | 5 + .../main/res/drawable/ic_arrow_down_16.xml | 9 + .../java/com/tonapps/uikit/list/ListCell.kt | 1 + 147 files changed, 4972 insertions(+), 1494 deletions(-) create mode 100644 apps/wallet/api/src/main/java/com/tonapps/wallet/api/BatteryProvider.kt create mode 100644 apps/wallet/api/src/main/java/com/tonapps/wallet/api/ServerTimeProvider.kt create mode 100644 apps/wallet/api/src/main/java/com/tonapps/wallet/api/core/BatteryAPI.kt create mode 100644 apps/wallet/api/src/main/java/com/tonapps/wallet/api/entity/SwapEntity.kt create mode 100644 apps/wallet/api/src/main/java/com/tonapps/wallet/api/omniston/Omniston.kt create mode 100644 apps/wallet/data/swap/.gitignore create mode 100644 apps/wallet/data/swap/build.gradle.kts create mode 100644 apps/wallet/data/swap/src/main/AndroidManifest.xml create mode 100644 apps/wallet/data/swap/src/main/java/com/tonapps/wallet/data/swap/Module.kt create mode 100644 apps/wallet/data/swap/src/main/java/com/tonapps/wallet/data/swap/SwapRepository.kt create mode 100644 apps/wallet/data/swap/src/main/java/com/tonapps/wallet/data/swap/entity/SwapAssetEntity.kt create mode 100644 apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/extensions/ActionSheet.kt create mode 100644 apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/extensions/RootViewModel.kt create mode 100644 apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/extensions/SendFee.kt create mode 100644 apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/helper/BatteryHelper.kt create mode 100644 apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/helper/TwinInput.kt create mode 100644 apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/onramp/main/BaseOnRampScreen.kt delete mode 100644 apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/onramp/main/OnRampMerchant.kt create mode 100644 apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/onramp/main/OnRampSettings.kt create mode 100644 apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/onramp/main/OnRampUtils.kt create mode 100644 apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/onramp/main/entities/ProviderEntity.kt delete mode 100644 apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/onramp/main/state/CurrencyInputState.kt delete mode 100644 apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/onramp/main/state/InputState.kt delete mode 100644 apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/onramp/main/state/OnRampBalanceState.kt delete mode 100644 apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/onramp/main/state/OnRampConfirmState.kt delete mode 100644 apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/onramp/main/state/OnRampCurrencyInputs.kt delete mode 100644 apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/onramp/main/state/OnRampInputsState.kt create mode 100644 apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/onramp/main/state/OnRampPaymentMethodState.kt create mode 100644 apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/onramp/main/state/UiState.kt create mode 100644 apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/onramp/picker/currency/OnRampPickerArgs.kt create mode 100644 apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/swap/omniston/OmnistonArgs.kt create mode 100644 apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/swap/omniston/OmnistonScreen.kt create mode 100644 apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/swap/omniston/OmnistonViewModel.kt create mode 100644 apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/swap/omniston/state/OmnistonStep.kt create mode 100644 apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/swap/omniston/state/SwapInputsState.kt create mode 100644 apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/swap/omniston/state/SwapQuoteState.kt create mode 100644 apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/swap/omniston/state/SwapTokenState.kt create mode 100644 apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/swap/picker/SwapPickerArgs.kt create mode 100644 apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/swap/picker/SwapPickerScreen.kt create mode 100644 apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/swap/picker/SwapPickerViewModel.kt create mode 100644 apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/swap/picker/list/Adapter.kt create mode 100644 apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/swap/picker/list/Item.kt create mode 100644 apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/swap/picker/list/holder/Holder.kt create mode 100644 apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/swap/picker/list/holder/TokenHolder.kt create mode 100644 apps/wallet/instance/app/src/main/res/layout/fragment_omniston.xml create mode 100644 apps/wallet/instance/app/src/main/res/layout/fragment_omniston_inputs.xml create mode 100644 apps/wallet/instance/app/src/main/res/layout/fragment_omniston_review.xml create mode 100644 apps/wallet/instance/app/src/main/res/layout/fragment_swap_picker.xml create mode 100644 lib/network/src/main/java/com/tonapps/network/ws/WSConnection.kt create mode 100644 lib/network/src/main/java/com/tonapps/network/ws/WSConnectionState.kt create mode 100644 lib/network/src/main/java/com/tonapps/network/ws/WSEvent.kt create mode 100644 ui/uikit/core/src/main/java/uikit/UiButtonState.kt create mode 100644 ui/uikit/core/src/main/java/uikit/widget/item/ItemLineView.kt create mode 100644 ui/uikit/core/src/main/res/drawable/bg_content_bottom.xml create mode 100644 ui/uikit/core/src/main/res/drawable/bg_content_error.xml create mode 100644 ui/uikit/core/src/main/res/drawable/bg_content_top.xml create mode 100644 ui/uikit/core/src/main/res/layout/view_item_line.xml create mode 100644 ui/uikit/icon/src/main/res/drawable/ic_arrow_down_16.xml diff --git a/.idea/gradle.xml b/.idea/gradle.xml index fb6ee35d1..96514a67c 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -47,6 +47,7 @@