From e9bd89cfb2704d33735a6c949451011d1d582767 Mon Sep 17 00:00:00 2001 From: Justin Enerio Date: Fri, 25 Oct 2024 13:08:30 +0800 Subject: [PATCH] upd --- packages/espressocash_app/lib/data/db/db.dart | 8 +- .../service/moneygram_fees_service.dart | 86 +++++++++++++++++++ .../service/moneygram_off_ramp_service.dart | 20 ++++- .../partners/moneygram/widgets/launch.dart | 83 ++++++------------ .../moor_schemas/moor_schema_v59.json | 1 + 5 files changed, 137 insertions(+), 61 deletions(-) create mode 100644 packages/espressocash_app/lib/features/ramp/partners/moneygram/service/moneygram_fees_service.dart create mode 100644 packages/espressocash_app/moor_schemas/moor_schema_v59.json diff --git a/packages/espressocash_app/lib/data/db/db.dart b/packages/espressocash_app/lib/data/db/db.dart index aa7b626fd..e2a4a3801 100644 --- a/packages/espressocash_app/lib/data/db/db.dart +++ b/packages/espressocash_app/lib/data/db/db.dart @@ -24,7 +24,7 @@ class OutgoingTransferRows extends Table { Set> get primaryKey => {id}; } -const int latestVersion = 58; +const int latestVersion = 59; const _tables = [ OutgoingTransferRows, @@ -164,6 +164,10 @@ class MyDatabase extends _$MyDatabase { if (from < 58) { await m.createTable(tokenRows); } + if (from < 59) { + await m.addColumn(offRampOrderRows, offRampOrderRows.priorityFee); + await m.addColumn(offRampOrderRows, offRampOrderRows.gasFee); + } }, ); } @@ -224,6 +228,8 @@ class OffRampOrderRows extends Table with AmountMixin, EntityMixin { IntColumn get bridgeAmount => integer().nullable()(); TextColumn get referenceNumber => text().nullable()(); IntColumn get refundAmount => integer().nullable()(); + IntColumn get priorityFee => integer().nullable()(); + IntColumn get gasFee => integer().nullable()(); } enum OnRampOrderStatus { diff --git a/packages/espressocash_app/lib/features/ramp/partners/moneygram/service/moneygram_fees_service.dart b/packages/espressocash_app/lib/features/ramp/partners/moneygram/service/moneygram_fees_service.dart new file mode 100644 index 000000000..3d1b92735 --- /dev/null +++ b/packages/espressocash_app/lib/features/ramp/partners/moneygram/service/moneygram_fees_service.dart @@ -0,0 +1,86 @@ +import 'package:async/async.dart'; +import 'package:decimal/decimal.dart'; +import 'package:espressocash_api/espressocash_api.dart'; +import 'package:injectable/injectable.dart'; + +import '../../../../accounts/auth_scope.dart'; +import '../../../../currency/models/amount.dart'; +import '../../../../currency/models/currency.dart'; +import '../../../models/ramp_type.dart'; + +typedef MoneygramFees = ({ + Amount receiveAmount, + Amount moneygramFee, + Amount bridgeFee, + Amount gasFeeInUsdc, + int? priorityFee, +}); + +@Singleton(scope: authScope) +class MoneygramFeesService { + MoneygramFeesService(this._client); + + final EspressoCashClient _client; + final _cache = AsyncCache(const Duration(seconds: 30)); + + Amount? _lastAmount; + RampType? _lastType; + + Future fetchFees({ + required Amount amount, + required RampType type, + }) { + if (amount != _lastAmount || type != _lastType) { + _cache.invalidate(); + _lastAmount = amount; + _lastType = type; + } + + return _cache.fetch(() => _fetchFeesFromApi(amount: amount, type: type)); + } + + Future _fetchFeesFromApi({ + required Amount amount, + required RampType type, + }) async { + final fee = await _client.calculateMoneygramFee( + MoneygramFeeRequestDto( + type: type.toDto(), + amount: amount.decimal.toString(), + ), + ); + + return ( + receiveAmount: Amount.fromDecimal( + value: Decimal.parse(fee.totalAmount), + currency: switch (type) { + RampType.onRamp => Currency.usdc, + RampType.offRamp => Currency.usd + }, + ), + moneygramFee: Amount.fromDecimal( + value: Decimal.parse(fee.moneygramFee), + currency: switch (type) { + RampType.onRamp => Currency.usd, + RampType.offRamp => Currency.usdc + }, + ), + bridgeFee: Amount.fromDecimal( + value: Decimal.parse(fee.bridgeFee), + currency: Currency.usdc, + ), + gasFeeInUsdc: Amount.fromDecimal( + value: Decimal.parse(fee.gasFeeInUsdc ?? '0'), + currency: Currency.usdc, + ), + priorityFee: fee.priorityFee, + ); + } +} + +extension on RampType { + RampTypeDto toDto() => switch (this) { + RampType.onRamp => RampTypeDto.onRamp, + RampType.offRamp => RampTypeDto.offRamp + }; +} diff --git a/packages/espressocash_app/lib/features/ramp/partners/moneygram/service/moneygram_off_ramp_service.dart b/packages/espressocash_app/lib/features/ramp/partners/moneygram/service/moneygram_off_ramp_service.dart index a5c5bec0d..30e2f5f6f 100644 --- a/packages/espressocash_app/lib/features/ramp/partners/moneygram/service/moneygram_off_ramp_service.dart +++ b/packages/espressocash_app/lib/features/ramp/partners/moneygram/service/moneygram_off_ramp_service.dart @@ -172,8 +172,10 @@ class MoneygramOffRampOrderService implements Disposable { AsyncResult createMoneygramOrder({ required CryptoAmount submittedAmount, - required FiatAmount? receiveAmount, + required FiatAmount receiveAmount, required String countryCode, + required int priorityFee, + required CryptoAmount gasFee, }) => tryEitherAsync((_) async { { @@ -182,8 +184,8 @@ class MoneygramOffRampOrderService implements Disposable { partnerOrderId: '', amount: submittedAmount.value, token: Token.usdc.address, - receiveAmount: receiveAmount?.value, - fiatSymbol: receiveAmount?.fiatCurrency.symbol, + receiveAmount: receiveAmount.value, + fiatSymbol: receiveAmount.fiatCurrency.symbol, created: DateTime.now(), humanStatus: '', machineStatus: '', @@ -193,6 +195,8 @@ class MoneygramOffRampOrderService implements Disposable { depositAddress: '', slot: BigInt.zero, bridgeAmount: null, + priorityFee: priorityFee, + gasFee: gasFee.value, ); await _db.into(_db.offRampOrderRows).insert(order); @@ -343,11 +347,18 @@ class MoneygramOffRampOrderService implements Disposable { ) async { final accountId = _stellarWallet.address; - final cashOutAmount = CryptoAmount( + final gasFee = CryptoAmount( + value: order.gasFee ?? 0, + cryptoCurrency: Currency.usdc, + ); + + final inputAmount = CryptoAmount( value: order.amount, cryptoCurrency: Currency.usdc, ); + final cashOutAmount = inputAmount - gasFee; + final xlmBalance = await _stellarClient.getXlmBalance(); if (xlmBalance <= _minimumInitBalance) { @@ -368,6 +379,7 @@ class MoneygramOffRampOrderService implements Disposable { amount: cashOutAmount.value.toString(), solanaSenderAddress: _ecWallet.address, stellarReceiverAddress: accountId, + priorityFee: order.priorityFee, ), ) .then((e) => e.encodedTx); diff --git a/packages/espressocash_app/lib/features/ramp/partners/moneygram/widgets/launch.dart b/packages/espressocash_app/lib/features/ramp/partners/moneygram/widgets/launch.dart index bb617cd72..ab7ece566 100644 --- a/packages/espressocash_app/lib/features/ramp/partners/moneygram/widgets/launch.dart +++ b/packages/espressocash_app/lib/features/ramp/partners/moneygram/widgets/launch.dart @@ -1,6 +1,4 @@ -import 'package:decimal/decimal.dart'; import 'package:dfunc/dfunc.dart'; -import 'package:espressocash_api/espressocash_api.dart'; import 'package:flutter/material.dart'; import 'package:flutter_inappwebview/flutter_inappwebview.dart'; @@ -28,6 +26,7 @@ import '../../../screens/on_ramp_order_screen.dart'; import '../../../screens/ramp_amount_screen.dart'; import '../data/dto.dart'; import '../data/moneygram_client.dart'; +import '../service/moneygram_fees_service.dart'; import '../service/moneygram_off_ramp_service.dart'; import '../service/moneygram_on_ramp_service.dart'; import 'style.dart'; @@ -80,7 +79,8 @@ extension BuildContextExt on BuildContext { final receiveAmount = await runWithLoader( this, - () async => _fetchFees(amount: usdcAmount, type: type) + () async => sl() + .fetchFees(amount: usdcAmount, type: type) .letAsync((p) => p.receiveAmount), ) as CryptoAmount; @@ -200,17 +200,26 @@ window.addEventListener("message", (event) => { if (submittedAmount is! CryptoAmount) return; - final receiveAmount = await runWithLoader( + final fees = await runWithLoader( this, - () async => _fetchFees(amount: submittedAmount, type: type) - .letAsync((p) => p.receiveAmount), - ) as FiatAmount; + () => sl() + .fetchFees(amount: submittedAmount, type: type), + ); + + final priorityFee = fees.priorityFee; + if (priorityFee == null) { + showCpErrorSnackbar(this, message: l10n.tryAgainLater); + + return; + } await sl() .createMoneygramOrder( submittedAmount: submittedAmount, - receiveAmount: receiveAmount, + receiveAmount: fees.receiveAmount as FiatAmount, countryCode: profile.country.code, + priorityFee: priorityFee, + gasFee: fees.gasFeeInUsdc as CryptoAmount, ) .then((order) { switch (order) { @@ -261,7 +270,7 @@ window.addEventListener("message", (event) => { required Amount amount, required RampType type, }) async { - final fees = await _fetchFees( + final fees = await sl().fetchFees( amount: amount, type: type, ); @@ -273,22 +282,27 @@ window.addEventListener("message", (event) => { required Amount amount, required RampType type, }) async { - final fees = await _fetchFees( + final fees = await sl().fetchFees( amount: amount, type: type, ); final totalFees = switch (type) { RampType.onRamp => fees.bridgeFee, - RampType.offRamp => fees.moneygramFee + fees.bridgeFee, + RampType.offRamp => + fees.moneygramFee + fees.bridgeFee + fees.gasFeeInUsdc, }; - final bridgeFee = fees.bridgeFee.format(locale, maxDecimals: 2); final moneygramFee = fees.moneygramFee.format(locale, maxDecimals: 2); + final bridgeFee = fees.bridgeFee.format(locale, maxDecimals: 2); + final withdrawFee = (fees.gasFeeInUsdc + fees.bridgeFee).format( + locale, + maxDecimals: 2, + ); final partnerFee = switch (type) { RampType.onRamp => bridgeFee, - RampType.offRamp => '$moneygramFee + $bridgeFee', + RampType.offRamp => '$moneygramFee + $withdrawFee ', }; final extraFee = switch (type) { @@ -305,47 +319,4 @@ window.addEventListener("message", (event) => { ), ); } - - Future<({Amount receiveAmount, Amount moneygramFee, Amount bridgeFee})> - _fetchFees({ - required Amount amount, - required RampType type, - }) async { - final client = sl(); - - final fee = await client.calculateMoneygramFee( - MoneygramFeeRequestDto( - type: type.toDto(), - amount: amount.decimal.toString(), - ), - ); - - return ( - receiveAmount: Amount.fromDecimal( - value: Decimal.parse(fee.totalAmount), - currency: switch (type) { - RampType.onRamp => Currency.usdc, - RampType.offRamp => Currency.usd - }, - ), - moneygramFee: Amount.fromDecimal( - value: Decimal.parse(fee.moneygramFee), - currency: switch (type) { - RampType.onRamp => Currency.usd, - RampType.offRamp => Currency.usdc - }, - ), - bridgeFee: Amount.fromDecimal( - value: Decimal.parse(fee.bridgeFee), - currency: Currency.usdc, - ), - ); - } -} - -extension on RampType { - RampTypeDto toDto() => switch (this) { - RampType.onRamp => RampTypeDto.onRamp, - RampType.offRamp => RampTypeDto.offRamp - }; } diff --git a/packages/espressocash_app/moor_schemas/moor_schema_v59.json b/packages/espressocash_app/moor_schemas/moor_schema_v59.json new file mode 100644 index 000000000..450eb920a --- /dev/null +++ b/packages/espressocash_app/moor_schemas/moor_schema_v59.json @@ -0,0 +1 @@ +{"_meta":{"description":"This file contains a serialized version of schema entities for drift.","version":"1.1.0"},"options":{"store_date_time_values_as_text":false},"entities":[{"id":0,"references":[],"type":"table","data":{"name":"outgoing_transfer_rows","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created","getter_name":"created","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"data","getter_name":"data","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[],"explicit_pk":["id"]}},{"id":1,"references":[],"type":"table","data":{"name":"payment_request_rows","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created","getter_name":"created","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"dynamic_link","getter_name":"dynamicLink","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"short_link","getter_name":"shortLink","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"state","getter_name":"state","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumIndexConverter(PaymentRequestStateDto.values)","dart_type_name":"PaymentRequestStateDto"}},{"name":"transaction_id","getter_name":"transactionId","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"resolved_at","getter_name":"resolvedAt","moor_type":"dateTime","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"recipient","getter_name":"recipient","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"amount","getter_name":"amount","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"splt_token","getter_name":"spltToken","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"reference","getter_name":"reference","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"message","getter_name":"message","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"memo","getter_name":"memo","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[],"explicit_pk":["id"]}},{"id":2,"references":[],"type":"table","data":{"name":"o_d_p_rows","was_declared_in_moor":false,"columns":[{"name":"amount","getter_name":"amount","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"token","getter_name":"token","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"id","getter_name":"id","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created","getter_name":"created","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"receiver","getter_name":"receiver","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"reference","getter_name":"reference","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"status","getter_name":"status","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumIndexConverter(ODPStatusDto.values)","dart_type_name":"ODPStatusDto"}},{"name":"tx","getter_name":"tx","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"tx_id","getter_name":"txId","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"tx_failure_reason","getter_name":"txFailureReason","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumIndexConverter(TxFailureReason.values)","dart_type_name":"TxFailureReason"}},{"name":"slot","getter_name":"slot","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[],"explicit_pk":["id"]}},{"id":3,"references":[],"type":"table","data":{"name":"transaction_rows","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created","getter_name":"created","moor_type":"dateTime","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"encoded_tx","getter_name":"encodedTx","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"status","getter_name":"status","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumIndexConverter(TxCommonStatus.values)","dart_type_name":"TxCommonStatus"}},{"name":"amount","getter_name":"amount","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[],"explicit_pk":["id"]}},{"id":4,"references":[],"type":"table","data":{"name":"o_l_p_rows","was_declared_in_moor":false,"columns":[{"name":"amount","getter_name":"amount","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"token","getter_name":"token","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"id","getter_name":"id","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created","getter_name":"created","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"status","getter_name":"status","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumIndexConverter(OLPStatusDto.values)","dart_type_name":"OLPStatusDto"}},{"name":"tx","getter_name":"tx","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"tx_id","getter_name":"txId","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"withdraw_tx_id","getter_name":"withdrawTxId","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"private_key","getter_name":"privateKey","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"link","getter_name":"link","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"tx_failure_reason","getter_name":"txFailureReason","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumIndexConverter(TxFailureReason.values)","dart_type_name":"TxFailureReason"}},{"name":"cancel_tx","getter_name":"cancelTx","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"cancel_tx_id","getter_name":"cancelTxId","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"generated_links_at","getter_name":"generatedLinksAt","moor_type":"dateTime","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"resolved_at","getter_name":"resolvedAt","moor_type":"dateTime","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"slot","getter_name":"slot","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[],"explicit_pk":["id"]}},{"id":5,"references":[],"type":"table","data":{"name":"i_l_p_rows","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created","getter_name":"created","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"tx","getter_name":"tx","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"tx_id","getter_name":"txId","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"tx_failure_reason","getter_name":"txFailureReason","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumIndexConverter(TxFailureReason.values)","dart_type_name":"TxFailureReason"}},{"name":"slot","getter_name":"slot","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"private_key","getter_name":"privateKey","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"status","getter_name":"status","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumIndexConverter(ILPStatusDto.values)","dart_type_name":"ILPStatusDto"}},{"name":"fee_amount","getter_name":"feeAmount","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[],"explicit_pk":["id"]}},{"id":6,"references":[],"type":"table","data":{"name":"on_ramp_order_rows","was_declared_in_moor":false,"columns":[{"name":"amount","getter_name":"amount","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"token","getter_name":"token","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"id","getter_name":"id","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created","getter_name":"created","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"is_completed","getter_name":"isCompleted","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"is_completed\" IN (0, 1))","default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"human_status","getter_name":"humanStatus","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"machine_status","getter_name":"machineStatus","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"partner_order_id","getter_name":"partnerOrderId","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"receive_amount","getter_name":"receiveAmount","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"tx_hash","getter_name":"txHash","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"partner","getter_name":"partner","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":"const Constant('kado')","default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(RampPartner.values)","dart_type_name":"RampPartner"}},{"name":"status","getter_name":"status","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(OnRampOrderStatus.values)","dart_type_name":"OnRampOrderStatus"}},{"name":"bank_name","getter_name":"bankName","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"bank_account","getter_name":"bankAccount","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"bank_transfer_expiry","getter_name":"bankTransferExpiry","moor_type":"dateTime","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"bank_transfer_amount","getter_name":"bankTransferAmount","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"fiat_symbol","getter_name":"fiatSymbol","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"auth_token","getter_name":"authToken","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"more_info_url","getter_name":"moreInfoUrl","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"stellar_tx_hash","getter_name":"stellarTxHash","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"fee_amount","getter_name":"feeAmount","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"reference_number","getter_name":"referenceNumber","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"bridge_amount","getter_name":"bridgeAmount","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[],"explicit_pk":["id"]}},{"id":7,"references":[],"type":"table","data":{"name":"off_ramp_order_rows","was_declared_in_moor":false,"columns":[{"name":"amount","getter_name":"amount","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"token","getter_name":"token","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"id","getter_name":"id","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created","getter_name":"created","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"status","getter_name":"status","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(OffRampOrderStatus.values)","dart_type_name":"OffRampOrderStatus"}},{"name":"human_status","getter_name":"humanStatus","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"machine_status","getter_name":"machineStatus","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"partner_order_id","getter_name":"partnerOrderId","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"transaction","getter_name":"transaction","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"deposit_address","getter_name":"depositAddress","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"slot","getter_name":"slot","moor_type":"bigInt","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"resolved_at","getter_name":"resolvedAt","moor_type":"dateTime","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"receive_amount","getter_name":"receiveAmount","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"fiat_symbol","getter_name":"fiatSymbol","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"partner","getter_name":"partner","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":"const Constant('kado')","default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(RampPartner.values)","dart_type_name":"RampPartner"}},{"name":"fee_amount","getter_name":"feeAmount","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"fee_token","getter_name":"feeToken","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"auth_token","getter_name":"authToken","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"withdraw_anchor_account","getter_name":"withdrawAnchorAccount","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"withdraw_memo","getter_name":"withdrawMemo","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"withdraw_url","getter_name":"withdrawUrl","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"more_info_url","getter_name":"moreInfoUrl","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"solana_bridge_tx","getter_name":"solanaBridgeTx","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"stellar_tx_hash","getter_name":"stellarTxHash","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"bridge_amount","getter_name":"bridgeAmount","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"reference_number","getter_name":"referenceNumber","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"refund_amount","getter_name":"refundAmount","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"priority_fee","getter_name":"priorityFee","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"gas_fee","getter_name":"gasFee","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[],"explicit_pk":["id"]}},{"id":8,"references":[],"type":"table","data":{"name":"outgoing_dln_payment_rows","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created","getter_name":"created","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"tx","getter_name":"tx","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"tx_id","getter_name":"txId","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"tx_failure_reason","getter_name":"txFailureReason","moor_type":"int","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumIndexConverter(TxFailureReason.values)","dart_type_name":"TxFailureReason"}},{"name":"slot","getter_name":"slot","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"receiver_blockchain","getter_name":"receiverBlockchain","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(BlockchainDto.values)","dart_type_name":"BlockchainDto"}},{"name":"receiver_address","getter_name":"receiverAddress","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"amount","getter_name":"amount","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"status","getter_name":"status","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumIndexConverter(ODLNPaymentStatusDto.values)","dart_type_name":"ODLNPaymentStatusDto"}},{"name":"order_id","getter_name":"orderId","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[],"explicit_pk":["id"]}},{"id":9,"references":[],"type":"table","data":{"name":"transaction_request_rows","was_declared_in_moor":false,"columns":[{"name":"amount","getter_name":"amount","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"token","getter_name":"token","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"id","getter_name":"id","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created","getter_name":"created","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"label","getter_name":"label","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"transaction","getter_name":"transaction","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"slot","getter_name":"slot","moor_type":"bigInt","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"status","getter_name":"status","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(TRStatusDto.values)","dart_type_name":"TRStatusDto"}}],"is_virtual":false,"without_rowid":false,"constraints":[],"explicit_pk":["id"]}},{"id":10,"references":[],"type":"table","data":{"name":"token_balance_rows","was_declared_in_moor":false,"columns":[{"name":"amount","getter_name":"amount","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"token","getter_name":"token","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[],"explicit_pk":["token"]}},{"id":11,"references":[],"type":"table","data":{"name":"conversion_rates_rows","was_declared_in_moor":false,"columns":[{"name":"token","getter_name":"token","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"fiat_currency","getter_name":"fiatCurrency","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"rate","getter_name":"rate","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"updated_at","getter_name":"updatedAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[],"explicit_pk":["token","fiat_currency"]}},{"id":12,"references":[],"type":"table","data":{"name":"token_rows","was_declared_in_moor":false,"columns":[{"name":"chain_id","getter_name":"chainId","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"address","getter_name":"address","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"symbol","getter_name":"symbol","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"name","getter_name":"name","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"decimals","getter_name":"decimals","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"logo_u_r_i","getter_name":"logoURI","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"is_stablecoin","getter_name":"isStablecoin","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"is_stablecoin\" IN (0, 1))","default_dart":null,"default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[],"explicit_pk":["chain_id","address"]}}]} \ No newline at end of file