From 5578430c44a68ec5602834124344389ea1946394 Mon Sep 17 00:00:00 2001 From: Mohsen <56779182+mrtnetwork@users.noreply.github.com> Date: Mon, 6 May 2024 20:32:45 +0330 Subject: [PATCH] osmosis liquidity support --- example/test/widget_test.dart | 38 ++-- ...query_packet_acknowledgements_request.dart | 7 +- .../query/query_unreceived_acks_request.dart | 7 +- .../query/query_unreceived_acks_response.dart | 7 +- .../query_unreceived_packets_request.dart | 7 +- .../query_unreceived_packets_response.dart | 7 +- lib/src/models/networks/osmosis/omosis.dart | 2 +- .../messages/accumulator_content.dart | 48 +++++ .../messages/options.dart | 23 +++ .../messages/record_msg.dart | 85 ++++++++ .../osmosis_accum_v1beta1.dart | 3 + .../osmosis_accum_v1beta1/types/types.dart | 15 ++ .../.DS_Store | Bin 0 -> 6148 bytes .../messages/accum_object.dart | 42 ++++ .../messages/full_position_breakdown.dart | 98 +++++++++ .../messages/full_tick.dart | 52 +++++ .../messages/genesis_state.dart | 83 ++++++++ .../messages/incentive_record.dart | 69 +++++++ .../messages/incentive_record_body.dart | 54 +++++ .../messages/liquidity_depth_with_range.dart | 47 +++++ .../messages/pool_data.dart | 103 ++++++++++ .../pool_id_to_tick_spacing_record.dart | 42 ++++ .../messages/pool_record.dart | 55 ++++++ .../messages/position.dart | 68 +++++++ .../messages/position_data.dart | 72 +++++++ .../messages/position_with_period_lock.dart | 42 ++++ .../messages/tick_info.dart | 95 +++++++++ .../messages/tick_liquidity_net.dart | 37 ++++ .../tick_spacing_decrease_proposal.dart | 66 +++++++ .../messages/uptime_tracker.dart | 41 ++++ .../messages/uptime_trackers.dart | 42 ++++ .../liquidity_per_tick_range_request.dart | 64 ++++++ .../liquidity_per_tick_range_response.dart | 56 ++++++ .../query/params_request.dart | 51 +++++ .../query/params_response.dart | 34 ++++ .../query/pools_request.dart | 58 ++++++ .../query/pools_response.dart | 50 +++++ .../query/user_positions_request.dart | 72 +++++++ .../query/user_positions_response.dart | 57 ++++++ .../services/msg_add_to_position.dart | 89 +++++++++ .../msg_add_to_position_response.dart | 47 +++++ .../services/msg_collect_incentives.dart | 65 ++++++ .../msg_collect_incentives_response.dart | 58 ++++++ .../services/msg_collect_spread_rewards.dart | 65 ++++++ .../msg_collect_spread_rewards_response.dart | 46 +++++ .../services/msg_create_position.dart | 89 +++++++++ .../msg_create_position_response.dart | 77 ++++++++ .../services/msg_transfer_positions.dart | 60 ++++++ .../services/msg_withdraw_position.dart | 56 ++++++ .../msg_withdraw_position_response.dart | 44 +++++ .../types/types.dart | 187 ++++++++++++++++++ .../messages/params.dart | 135 +++++++++++++ .../osmosis_concentratedliquidity.dart | 1 + .../types/types.dart | 13 ++ .../messages/epoch_info.dart | 2 +- .../messages/senesis_state.dart | 2 +- .../omosis_epochs_v1beta1.dart | 0 .../query/query_current_epoch_request.dart | 2 +- .../query/query_current_epoch_response.dart | 2 +- .../query/query_epochs_info_request.dart | 2 +- .../query/query_epochs_info_response.dart | 4 +- .../types/types.dart | 0 .../messages/pool.dart | 29 ++- .../services/msg_create_stable_swap_pool.dart | 7 +- ...sg_stable_swap_adjust_scaling_factors.dart | 7 +- .../osmosis_gamm_v1beta1/messages/pool.dart | 96 +++++++++ .../osmosis_gamm_v1beta1.dart | 1 + .../query/query_pool_request.dart | 6 +- .../osmosis_gamm_v1beta1/types/types.dart | 4 +- .../query/rewards_est_request.dart | 7 +- ...oncentrated_pool_user_position_record.dart | 69 +++++++ .../messages/super_fluid_asset_type.dart | 7 +- .../messages/unpool_whitelisted_pools.dart | 7 +- .../query/query_unpool_whitelist_request.dart | 50 +++++ .../query_unpool_whitelist_response.dart | 43 ++++ ...er_fluid_positions_delegated_response.dart | 53 +++++ ..._fluid_positions_undelegating_request.dart | 62 ++++++ ...fluid_positions_undelegating_response.dart | 53 +++++ ...uperfluid_positions_delegated_request.dart | 61 ++++++ ...trated_liquidity_super_fluid_position.dart | 63 ++++++ ...quidity_super_fluid_position_response.dart | 54 +++++ ...nge_position_and_super_fluid_delegate.dart | 64 ++++++ ...ion_and_super_fluid_delegate_response.dart | 32 +++ ...sg_un_pool_white_listed_pool_response.dart | 7 +- .../msg_unbond_convert_and_staked.dart | 0 ...uper_fluid_undelegate_and_unbond_lock.dart | 58 ++++++ ...d_undelegate_and_unbond_lock_response.dart | 33 ++++ .../services/unbond_convert_and_stake.dart | 77 ++++++++ .../unbond_convert_and_stake_response.dart | 31 +++ ...s_to_full_range_concentrated_position.dart | 68 +++++++ ..._range_concentrated_position_response.dart | 46 +++++ .../osmosis_superfluid/types/types.dart | 99 ++++++++++ .../types/types.dart | 2 +- .../v1/events/event_streaming_swap.dart | 6 +- .../thorchain/v1/messages/streaming_swap.dart | 7 +- .../networks/thorchain/v1/messages/vault.dart | 7 +- .../messages/dec_coin.dart | 3 + .../messages/validator.dart | 6 +- 98 files changed, 4018 insertions(+), 52 deletions(-) create mode 100644 lib/src/models/networks/osmosis/osmosis_accum_v1beta1/messages/accumulator_content.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_accum_v1beta1/messages/options.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_accum_v1beta1/messages/record_msg.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_accum_v1beta1/osmosis_accum_v1beta1.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_accum_v1beta1/types/types.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/.DS_Store create mode 100644 lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/accum_object.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/full_position_breakdown.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/full_tick.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/genesis_state.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/incentive_record.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/incentive_record_body.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/liquidity_depth_with_range.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/pool_data.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/pool_id_to_tick_spacing_record.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/pool_record.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/position.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/position_data.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/position_with_period_lock.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/tick_info.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/tick_liquidity_net.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/tick_spacing_decrease_proposal.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/uptime_tracker.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/uptime_trackers.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/liquidity_per_tick_range_request.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/liquidity_per_tick_range_response.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/params_request.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/params_response.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/pools_request.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/pools_response.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/user_positions_request.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/user_positions_response.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/services/msg_add_to_position.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/services/msg_add_to_position_response.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/services/msg_collect_incentives.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/services/msg_collect_incentives_response.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/services/msg_collect_spread_rewards.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/services/msg_collect_spread_rewards_response.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/services/msg_create_position.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/services/msg_create_position_response.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/services/msg_transfer_positions.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/services/msg_withdraw_position.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/services/msg_withdraw_position_response.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/types/types.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_concentratedliquidity/messages/params.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_concentratedliquidity/osmosis_concentratedliquidity.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_concentratedliquidity/types/types.dart rename lib/src/models/networks/osmosis/{omosis_epochs_v1beta1 => osmosis_epochs_v1beta1}/messages/epoch_info.dart (98%) rename lib/src/models/networks/osmosis/{omosis_epochs_v1beta1 => osmosis_epochs_v1beta1}/messages/senesis_state.dart (91%) rename lib/src/models/networks/osmosis/{omosis_epochs_v1beta1 => osmosis_epochs_v1beta1}/omosis_epochs_v1beta1.dart (100%) rename lib/src/models/networks/osmosis/{omosis_epochs_v1beta1 => osmosis_epochs_v1beta1}/query/query_current_epoch_request.dart (93%) rename lib/src/models/networks/osmosis/{omosis_epochs_v1beta1 => osmosis_epochs_v1beta1}/query/query_current_epoch_response.dart (91%) rename lib/src/models/networks/osmosis/{omosis_epochs_v1beta1 => osmosis_epochs_v1beta1}/query/query_epochs_info_request.dart (92%) rename lib/src/models/networks/osmosis/{omosis_epochs_v1beta1 => osmosis_epochs_v1beta1}/query/query_epochs_info_response.dart (84%) rename lib/src/models/networks/osmosis/{omosis_epochs_v1beta1 => osmosis_epochs_v1beta1}/types/types.dart (100%) create mode 100644 lib/src/models/networks/osmosis/osmosis_gamm_v1beta1/messages/pool.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_superfluid/messages/concentrated_pool_user_position_record.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_superfluid/query/query_unpool_whitelist_request.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_superfluid/query/query_unpool_whitelist_response.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_superfluid/query/user_concentrated_super_fluid_positions_delegated_response.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_superfluid/query/user_concentrated_super_fluid_positions_undelegating_request.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_superfluid/query/user_concentrated_super_fluid_positions_undelegating_response.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_superfluid/query/user_concentrated_superfluid_positions_delegated_request.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_superfluid/services/add_to_concentrated_liquidity_super_fluid_position.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_superfluid/services/add_to_concentrated_liquidity_super_fluid_position_response.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_superfluid/services/create_full_range_position_and_super_fluid_delegate.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_superfluid/services/create_full_range_position_and_super_fluid_delegate_response.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_superfluid/services/msg_unbond_convert_and_staked.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_superfluid/services/super_fluid_undelegate_and_unbond_lock.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_superfluid/services/super_fluid_undelegate_and_unbond_lock_response.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_superfluid/services/unbond_convert_and_stake.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_superfluid/services/unbond_convert_and_stake_response.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_superfluid/services/unlock_and_migrate_shares_to_full_range_concentrated_position.dart create mode 100644 lib/src/models/networks/osmosis/osmosis_superfluid/services/unlock_and_migrate_shares_to_full_range_concentrated_position_response.dart diff --git a/example/test/widget_test.dart b/example/test/widget_test.dart index 23a765c..dc3a784 100755 --- a/example/test/widget_test.dart +++ b/example/test/widget_test.dart @@ -25,18 +25,19 @@ // final provider = TendermintProvider( // TendermintHTTPProvider(url: "https://rpc.testnet.osmosis.zone/")); -// final message = MsgSend( -// fromAddress: publickey.toAddresss(hrp: CosmosAddrConst.osmosis), -// toAddress: -// CosmosBaseAddress("osmo1wqzpmju4gl0kcajhjls6ufrqecaedxm9udt80k"), -// amount: [ -// Coin( -// denom: "factory/osmo1htg7dmhelazdsmuwm9ngtg0tpe82006ugka49q/MRT", -// amount: BigInt.from(100)) -// ]); +// final message = OsmosisValidatorPreferenceMsgDelegateToValidatorSet( +// delegator: publickey.toAddresss(hrp: CosmosAddrConst.osmosis).address, +// coin: Coin(denom: "uosmo", amount: BigInt.from(10000000))); // // print( // // "address ${publickey.toAddresss(hrp: CosmosAddrConst.osmosis).address}"); +// final all = await provider.request(TendermintRequestAbciQuery( +// request: const OsmosisSuperfluidAllIntermediaryAccountsRequest())); + +// /// OsmosisGammQueryPoolsRequest +// print("balances $all"); +// return; + // /// Querying account info from the blockchain // final accountInfo = await provider.request(TendermintRequestAbciQuery( // request: QueryAccountInfoRequest( @@ -50,7 +51,8 @@ // request: QueryAllBalancesRequest( // address: publickey.toAddresss(hrp: CosmosAddrConst.osmosis)))); -// // print("balances $accountBalances"); +// /// OsmosisGammQueryPoolsRequest +// print("balances $accountBalances"); // // return; // /// Creating authentication info for transaction @@ -85,15 +87,15 @@ // authInfoBytes: authInfo.toBuffer(), // signatures: [sign]); -// // final txForSimulate = -// // Tx(body: txbody, authInfo: authInfo, signatures: [sign]); +// final txForSimulate = +// Tx(body: txbody, authInfo: authInfo, signatures: [sign]); -// // final simulateRequest = await provider.request(TendermintRequestAbciQuery( -// // request: SimulateRequest(txForSimulate.toBuffer()))); -// // print("simulate $simulateRequest"); -// final resp = await provider.request(TendermintRequestBroadcastTxCommit( -// BytesUtils.toHexString(txRaw.toBuffer(), prefix: "0x"))); -// print("resp $resp"); +// final simulateRequest = await provider.request(TendermintRequestAbciQuery( +// request: SimulateRequest(txForSimulate.toBuffer()))); +// print("simulate $simulateRequest"); +// // final resp = await provider.request(TendermintRequestBroadcastTxCommit( +// // BytesUtils.toHexString(txRaw.toBuffer(), prefix: "0x"))); +// // print("resp $resp"); // /// https://celatone.osmosis.zone/osmo-test-5/txs/7C66B231A02BE52E2E42127A6BAAC35C24AEC35519E3FED4545982BEE781EBA8 // } diff --git a/lib/src/models/ibc/ibc_core_channel_v1/query/query_packet_acknowledgements_request.dart b/lib/src/models/ibc/ibc_core_channel_v1/query/query_packet_acknowledgements_request.dart index 174fe86..6fece1b 100755 --- a/lib/src/models/ibc/ibc_core_channel_v1/query/query_packet_acknowledgements_request.dart +++ b/lib/src/models/ibc/ibc_core_channel_v1/query/query_packet_acknowledgements_request.dart @@ -1,3 +1,4 @@ +import 'package:blockchain_utils/numbers/numbers.dart'; import 'package:cosmos_sdk/src/models/sdk_v1beta1/cosmos_base_query_v1beta1/messages/page_request.dart'; import 'package:cosmos_sdk/src/models/ibc/ibc_core_channel_v1/query/query_packet_acknowledgements_response.dart'; @@ -33,7 +34,11 @@ class QueryPacketAcknowledgementsRequest extends CosmosMessage pagination: decode .getResult(3) ?.to>((e) => PageRequest.deserialize(e)), - packetCommitmentSequences: decode.getFields(4)); + packetCommitmentSequences: decode + .getResult(4) + ?.to, List>( + (e) => e.map((e) => BigintUtils.parse(e)).toList()) ?? + []); } @override diff --git a/lib/src/models/ibc/ibc_core_channel_v1/query/query_unreceived_acks_request.dart b/lib/src/models/ibc/ibc_core_channel_v1/query/query_unreceived_acks_request.dart index 7afa9e2..16461d6 100755 --- a/lib/src/models/ibc/ibc_core_channel_v1/query/query_unreceived_acks_request.dart +++ b/lib/src/models/ibc/ibc_core_channel_v1/query/query_unreceived_acks_request.dart @@ -1,3 +1,4 @@ +import 'package:blockchain_utils/numbers/numbers.dart'; import 'package:cosmos_sdk/src/models/ibc/ibc_core_channel_v1/query/query_unreceived_acks_response.dart'; import 'package:cosmos_sdk/src/models/ibc/types/types.dart'; @@ -23,7 +24,11 @@ class QueryUnreceivedAcksRequest extends CosmosMessage return QueryUnreceivedAcksRequest( portId: decode.getField(1), channelId: decode.getField(2), - packetAckSequences: decode.getFields(3)); + packetAckSequences: decode + .getResult(3) + ?.to, List>( + (e) => e.map((e) => BigintUtils.parse(e)).toList()) ?? + []); } @override diff --git a/lib/src/models/ibc/ibc_core_channel_v1/query/query_unreceived_acks_response.dart b/lib/src/models/ibc/ibc_core_channel_v1/query/query_unreceived_acks_response.dart index ad27b00..df4e5a7 100755 --- a/lib/src/models/ibc/ibc_core_channel_v1/query/query_unreceived_acks_response.dart +++ b/lib/src/models/ibc/ibc_core_channel_v1/query/query_unreceived_acks_response.dart @@ -1,3 +1,4 @@ +import 'package:blockchain_utils/numbers/numbers.dart'; import 'package:cosmos_sdk/src/models/ibc/ibc_core_client_v1/messages/height.dart'; import 'package:cosmos_sdk/src/models/ibc/types/types.dart'; import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; @@ -15,7 +16,11 @@ class QueryUnreceivedAcksResponse extends CosmosMessage { factory QueryUnreceivedAcksResponse.deserialize(List bytes) { final decode = CosmosProtocolBuffer.decode(bytes); return QueryUnreceivedAcksResponse( - sequences: decode.getFields(1), + sequences: decode + .getResult(1) + ?.to, List>( + (e) => e.map((e) => BigintUtils.parse(e)).toList()) ?? + [], height: IbcClientHeight.deserialize(decode.getField(2))); } diff --git a/lib/src/models/ibc/ibc_core_channel_v1/query/query_unreceived_packets_request.dart b/lib/src/models/ibc/ibc_core_channel_v1/query/query_unreceived_packets_request.dart index fd60c69..c47bb51 100755 --- a/lib/src/models/ibc/ibc_core_channel_v1/query/query_unreceived_packets_request.dart +++ b/lib/src/models/ibc/ibc_core_channel_v1/query/query_unreceived_packets_request.dart @@ -1,3 +1,4 @@ +import 'package:blockchain_utils/numbers/numbers.dart'; import 'package:cosmos_sdk/src/models/ibc/ibc_core_channel_v1/query/query_unreceived_packets_response.dart'; import 'package:cosmos_sdk/src/models/ibc/types/types.dart'; @@ -23,7 +24,11 @@ class QueryUnreceivedPacketsRequest extends CosmosMessage return QueryUnreceivedPacketsRequest( portId: decode.getField(1), channelId: decode.getField(2), - packetCommitmentSequences: decode.getFields(3)); + packetCommitmentSequences: decode + .getResult(3) + ?.to, List>( + (e) => e.map((e) => BigintUtils.parse(e)).toList()) ?? + []); } @override diff --git a/lib/src/models/ibc/ibc_core_channel_v1/query/query_unreceived_packets_response.dart b/lib/src/models/ibc/ibc_core_channel_v1/query/query_unreceived_packets_response.dart index b65aa0f..8fe8d74 100755 --- a/lib/src/models/ibc/ibc_core_channel_v1/query/query_unreceived_packets_response.dart +++ b/lib/src/models/ibc/ibc_core_channel_v1/query/query_unreceived_packets_response.dart @@ -1,3 +1,4 @@ +import 'package:blockchain_utils/numbers/numbers.dart'; import 'package:cosmos_sdk/src/models/ibc/ibc_core_client_v1/messages/height.dart'; import 'package:cosmos_sdk/src/models/ibc/types/types.dart'; import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; @@ -16,7 +17,11 @@ class QueryUnreceivedPacketsResponse extends CosmosMessage { factory QueryUnreceivedPacketsResponse.deserialize(List bytes) { final decode = CosmosProtocolBuffer.decode(bytes); return QueryUnreceivedPacketsResponse( - sequences: decode.getFields(1), + sequences: decode + .getResult(1) + ?.to, List>( + (e) => e.map((e) => BigintUtils.parse(e)).toList()) ?? + [], height: IbcClientHeight.deserialize(decode.getField(2))); } diff --git a/lib/src/models/networks/osmosis/omosis.dart b/lib/src/models/networks/osmosis/omosis.dart index 269a8c1..e777d5c 100644 --- a/lib/src/models/networks/osmosis/omosis.dart +++ b/lib/src/models/networks/osmosis/omosis.dart @@ -1,4 +1,4 @@ -export 'omosis_epochs_v1beta1/omosis_epochs_v1beta1.dart'; +export 'osmosis_epochs_v1beta1/omosis_epochs_v1beta1.dart'; export 'osmosis_gamm_pool_models_balancer_v1beta1/osmosis_gamm_pool_models_balancer_v1beta1.dart'; export 'osmosis_gamm_poolmodels_stableswap_v1beta1/osmosis_gamm_poolmodels_stableswap_v1beta1.dart'; export 'osmosis_gamm_v1beta1/osmosis_gamm_v1beta1.dart'; diff --git a/lib/src/models/networks/osmosis/osmosis_accum_v1beta1/messages/accumulator_content.dart b/lib/src/models/networks/osmosis/osmosis_accum_v1beta1/messages/accumulator_content.dart new file mode 100644 index 0000000..4c4b57c --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_accum_v1beta1/messages/accumulator_content.dart @@ -0,0 +1,48 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_accum_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/models/sdk_v1beta1/cosmos_base_v1beta1/messages/dec_coin.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; + +/// AccumulatorContent is the state-entry for the global accumulator. +/// It contains the name of the global accumulator and the total value of shares belonging to it from all positions. +class OsmosisAccumAccumulatorContent extends CosmosMessage { + final List accumValue; + final String totalShares; + OsmosisAccumAccumulatorContent( + {required List accumValue, required this.totalShares}) + : accumValue = accumValue.mutable; + factory OsmosisAccumAccumulatorContent.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisAccumAccumulatorContent( + accumValue: + decode.getFields(1).map((e) => DecCoin.deserialize(e)).toList(), + totalShares: decode.getField(2), + ); + } + factory OsmosisAccumAccumulatorContent.fromRpc(Map json) { + return OsmosisAccumAccumulatorContent( + accumValue: (json["accum_value"] as List?) + ?.map((e) => DecCoin.fromRpc(e)) + .toList() ?? + [], + totalShares: json["total_shares"], + ); + } + + @override + List get fieldIds => [1, 2]; + + @override + Map toJson() { + return { + "accum_value": accumValue.map((e) => e.toJson()).toList(), + "total_shares": totalShares, + }; + } + + @override + String get typeUrl => OsmosisAccumV1beta1Types.accumulatorContent.typeUrl; + + @override + List get values => [accumValue, totalShares]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_accum_v1beta1/messages/options.dart b/lib/src/models/networks/osmosis/osmosis_accum_v1beta1/messages/options.dart new file mode 100644 index 0000000..8b52172 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_accum_v1beta1/messages/options.dart @@ -0,0 +1,23 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_accum_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +class OsmosisAccumOptions extends CosmosMessage { + OsmosisAccumOptions(); + factory OsmosisAccumOptions.deserialize(List bytes) { + return OsmosisAccumOptions(); + } + + @override + List get fieldIds => []; + + @override + Map toJson() { + return {}; + } + + @override + String get typeUrl => OsmosisAccumV1beta1Types.options.typeUrl; + + @override + List get values => []; +} diff --git a/lib/src/models/networks/osmosis/osmosis_accum_v1beta1/messages/record_msg.dart b/lib/src/models/networks/osmosis/osmosis_accum_v1beta1/messages/record_msg.dart new file mode 100644 index 0000000..9ff90e5 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_accum_v1beta1/messages/record_msg.dart @@ -0,0 +1,85 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_accum_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/models/sdk_v1beta1/cosmos_base_v1beta1/messages/dec_coin.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; + +/// Record corresponds to an individual position value belonging to the global accumulator. +class OsmosisAccumRecord extends CosmosMessage { + /// num_shares is the number of shares belonging to the position associated + /// with this record. + final String numShares; + + /// accum_value_per_share is the subset of coins per shar of the global + /// accumulator value that allows to infer how much a position is entitled to + /// per share that it owns. + /// + /// In the default case with no intervals, this value equals to the global + /// accumulator value at the time of the position creation, the last update or + /// reward claim. + /// + /// In the interval case such as concentrated liquidity, this value equals to + /// the global growth of rewards inside the interval during one of: the time of + /// the position creation, the last update or reward claim. Note, that + // immediately prior to claiming or updating rewards, this value must be + /// updated to "the growth inside at the time of last update + the growth + /// outside at the time of the current block". This is so that the claiming + /// logic can subtract this updated value from the global accumulator value to + /// get the growth inside the interval from the time of last update up until + /// the current block time. + final List accumValuePerShare; + + /// unclaimed_rewards_total is the total amount of unclaimed rewards that the + /// position is entitled to. This value is updated whenever shares are added or + /// removed from an existing position. We also expose API for manually updating + /// this value for some custom use cases such as merging pre-existing positions + /// into a single one.s + final List unclaimedRewardsTotal; + OsmosisAccumRecord({ + required this.numShares, + required List accumValuePerShare, + required List unclaimedRewardsTotal, + }) : accumValuePerShare = accumValuePerShare.mutable, + unclaimedRewardsTotal = unclaimedRewardsTotal.mutable; + factory OsmosisAccumRecord.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisAccumRecord( + numShares: decode.getField(1), + accumValuePerShare: + decode.getFields(2).map((e) => DecCoin.deserialize(e)).toList(), + unclaimedRewardsTotal: + decode.getFields(3).map((e) => DecCoin.deserialize(e)).toList(), + ); + } + factory OsmosisAccumRecord.fromRpc(Map json) { + return OsmosisAccumRecord( + numShares: json["num_shares"], + accumValuePerShare: (json["accum_value_per_share"] as List?) + ?.map((e) => DecCoin.deserialize(e)) + .toList() ?? + [], + unclaimedRewardsTotal: (json["unclaimed_rewards_total"] as List?) + ?.map((e) => DecCoin.deserialize(e)) + .toList() ?? + []); + } + + @override + List get fieldIds => [1, 2, 3]; + + @override + Map toJson() { + return { + "num_shares": numShares, + "accum_value_per_share": + accumValuePerShare.map((e) => e.toJson()).toList(), + "unclaimed_rewards_total": + unclaimedRewardsTotal.map((e) => e.toJson()).toList() + }; + } + + @override + String get typeUrl => OsmosisAccumV1beta1Types.record.typeUrl; + + @override + List get values => [numShares, accumValuePerShare, unclaimedRewardsTotal]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_accum_v1beta1/osmosis_accum_v1beta1.dart b/lib/src/models/networks/osmosis/osmosis_accum_v1beta1/osmosis_accum_v1beta1.dart new file mode 100644 index 0000000..eef83af --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_accum_v1beta1/osmosis_accum_v1beta1.dart @@ -0,0 +1,3 @@ +export 'messages/accumulator_content.dart'; +export 'messages/options.dart'; +export 'messages/record_msg.dart'; diff --git a/lib/src/models/networks/osmosis/osmosis_accum_v1beta1/types/types.dart b/lib/src/models/networks/osmosis/osmosis_accum_v1beta1/types/types.dart new file mode 100644 index 0000000..20319c3 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_accum_v1beta1/types/types.dart @@ -0,0 +1,15 @@ +import 'package:cosmos_sdk/src/models/core/type_url/type_url.dart'; + +class OsmosisAccumV1beta1Types extends TypeUrl { + @override + final String typeUrl; + @override + final String? rpc = null; + const OsmosisAccumV1beta1Types._(this.typeUrl); + static const OsmosisAccumV1beta1Types accumulatorContent = + OsmosisAccumV1beta1Types._("/osmosis.accum.v1beta1.AccumulatorContent"); + static const OsmosisAccumV1beta1Types options = + OsmosisAccumV1beta1Types._("/osmosis.accum.v1beta1.Options"); + static const OsmosisAccumV1beta1Types record = + OsmosisAccumV1beta1Types._("/osmosis.accum.v1beta1.Record"); +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/.DS_Store b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..19ae4ff381b7e4ebf5d397ab49d2a3b3e2be0f9b GIT binary patch literal 6148 zcmeHKy-ou$47Q<2C$V&7%*K3ga8$<=+zUV{Dnn0Kf!I%-y7M;dybl8p!1u-G=R^hu zgb=c;_;X@A$$e6jSVVMjzp6#%B2u9dl}150Ty!0H@C>MVj!Rj~wcKsibyt|^FAj0< zmGs;-exLS#HS}BC@a<74rXSjNxfz!9JwEJC_b*Rp<+#tUb(7`}35DdIC!1E!Y5gW(RFdrRIxdZ_68Jz_-YYFBg$Hs9qga@LQ z3ba)95<@K=L?< literal 0 HcmV?d00001 diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/accum_object.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/accum_object.dart new file mode 100644 index 0000000..0746a98 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/accum_object.dart @@ -0,0 +1,42 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_accum_v1beta1/osmosis_accum_v1beta1.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +class OsmosisConcentratedLiquidityAccumObject extends CosmosMessage { + /// Accumulator's name (pulled from AccumulatorContent) + final String? name; + final OsmosisAccumAccumulatorContent? accumContent; + OsmosisConcentratedLiquidityAccumObject({this.name, this.accumContent}); + factory OsmosisConcentratedLiquidityAccumObject.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityAccumObject( + name: decode.getField(1), + accumContent: decode + .getResult(2) + ?.to>( + (e) => OsmosisAccumAccumulatorContent.deserialize(e))); + } + factory OsmosisConcentratedLiquidityAccumObject.fromRpc( + Map json) { + return OsmosisConcentratedLiquidityAccumObject( + name: json["name"], + accumContent: json["accum_content"] == null + ? null + : OsmosisAccumAccumulatorContent.fromRpc(json["accum_content"])); + } + + @override + List get fieldIds => [1, 2]; + + @override + Map toJson() { + return {"name": name, "accum_content": accumContent?.toJson()}; + } + + @override + List get values => [name, accumContent]; + + @override + String get typeUrl => + OsmosisConcentratedLiquidityV1beta1Types.accumObject.typeUrl; +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/full_position_breakdown.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/full_position_breakdown.dart new file mode 100644 index 0000000..fd96121 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/full_position_breakdown.dart @@ -0,0 +1,98 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/models/sdk_v1beta1/cosmos_base_v1beta1/cosmos_base_v1beta1.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; + +import 'position.dart'; + +/// FullPositionBreakdown returns: +/// the position itself +/// the amount the position translates in terms of asset0 and asset1 +/// the amount of claimable fees +/// the amount of claimable incentives +/// the amount of incentives that would be forfeited if the position was closed now +class FullPositionBreakdown extends CosmosMessage { + final OsmosisConcentratedLiquidityPosition position; + final Coin asset0; + final Coin asset1; + final List claimableSpreadRewards; + final List claimableIncentives; + final List forfeitedIncentives; + + FullPositionBreakdown( + {required this.position, + required this.asset0, + required this.asset1, + required List claimableSpreadRewards, + required List claimableIncentives, + required List forfeitedIncentives}) + : claimableSpreadRewards = claimableSpreadRewards.mutable, + claimableIncentives = claimableIncentives.mutable, + forfeitedIncentives = forfeitedIncentives.mutable; + factory FullPositionBreakdown.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return FullPositionBreakdown( + position: OsmosisConcentratedLiquidityPosition.deserialize( + decode.getField(1)), + asset0: Coin.deserialize(decode.getField(2)), + asset1: Coin.deserialize(decode.getField(3)), + claimableSpreadRewards: + decode.getFields(4).map((e) => Coin.deserialize(e)).toList(), + claimableIncentives: + decode.getFields(5).map((e) => Coin.deserialize(e)).toList(), + forfeitedIncentives: + decode.getFields(6).map((e) => Coin.deserialize(e)).toList()); + } + + factory FullPositionBreakdown.fromRpc(Map json) { + return FullPositionBreakdown( + position: + OsmosisConcentratedLiquidityPosition.deserialize(json["position"]), + asset0: Coin.fromRpc(json["asset0"]), + asset1: Coin.fromRpc(json["asset1"]), + claimableSpreadRewards: (json["claimable_spread_rewards"] as List?) + ?.map((e) => Coin.deserialize(e)) + .toList() ?? + [], + claimableIncentives: (json["claimable_incentives"] as List?) + ?.map((e) => Coin.deserialize(e)) + .toList() ?? + [], + forfeitedIncentives: (json["forfeited_incentives"] as List?) + ?.map((e) => Coin.deserialize(e)) + .toList() ?? + []); + } + + @override + List get fieldIds => [1, 2, 3, 4, 5, 6]; + + @override + Map toJson() { + return { + "position": position.toJson(), + "asset0": asset0.toJson(), + "asset1": asset1.toJson(), + "claimable_spread_rewards": + claimableSpreadRewards.map((e) => e.toJson()).toList(), + "claimable_incentives": + claimableIncentives.map((e) => e.toJson()).toList(), + "forfeited_incentives": + forfeitedIncentives.map((e) => e.toJson()).toList() + }; + } + + @override + String get typeUrl => + OsmosisConcentratedLiquidityV1beta1Types.fullPositionBreakdown.typeUrl; + + @override + List get values => [ + position, + asset0, + asset1, + claimableSpreadRewards, + claimableIncentives, + forfeitedIncentives + ]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/full_tick.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/full_tick.dart new file mode 100644 index 0000000..fe15007 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/full_tick.dart @@ -0,0 +1,52 @@ +import 'package:blockchain_utils/numbers/bigint_utils.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'tick_info.dart'; + +/// FullTick contains tick index and pool id along with other tick model information. +class OsmosisConcentratedLiquidityFullTick extends CosmosMessage { + /// pool id associated with the tick. + final BigInt? poolId; + + /// tick's index. + final BigInt? tickIndex; + + /// tick's info. + final OsmosisConcentratedLiquidityTickInfo info; + OsmosisConcentratedLiquidityFullTick( + {this.poolId, this.tickIndex, required this.info}); + factory OsmosisConcentratedLiquidityFullTick.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityFullTick( + poolId: decode.getField(1), + tickIndex: decode.getField(2), + info: OsmosisConcentratedLiquidityTickInfo.deserialize( + decode.getField(3))); + } + factory OsmosisConcentratedLiquidityFullTick.fromRpc( + Map json) { + return OsmosisConcentratedLiquidityFullTick( + poolId: BigintUtils.tryParse(json["pool_id"]), + tickIndex: BigintUtils.tryParse(json["tick_index"]), + info: OsmosisConcentratedLiquidityTickInfo.fromRpc(json["info"])); + } + + @override + List get fieldIds => [1, 2, 3]; + + @override + Map toJson() { + return { + "pool_id": poolId?.toString(), + "tick_index": tickIndex?.toString(), + "info": info.toJson() + }; + } + + @override + List get values => [poolId, tickIndex, info]; + + @override + String get typeUrl => + OsmosisConcentratedLiquidityV1beta1Types.fullTick.typeUrl; +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/genesis_state.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/genesis_state.dart new file mode 100644 index 0000000..189de67 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/genesis_state.dart @@ -0,0 +1,83 @@ +import 'package:blockchain_utils/numbers/bigint_utils.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentratedliquidity/messages/params.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'pool_data.dart'; +import 'position_data.dart'; + +/// GenesisState defines the concentrated liquidity module's genesis state. +class OsmosisConcentratedLiquidityGenesisState extends CosmosMessage { + /// params are all the parameters of the module + final OsmosisConcentratedLiquidityParams params; + + /// pool data containining serialized pool struct and ticks. + final List poolData; + final List positionData; + + /// tick's index. + final BigInt? nextPositionId; + final BigInt? nextIncentiveRecordId; + + OsmosisConcentratedLiquidityGenesisState( + {required this.params, + required this.poolData, + required this.positionData, + this.nextPositionId, + this.nextIncentiveRecordId}); + factory OsmosisConcentratedLiquidityGenesisState.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityGenesisState( + params: + OsmosisConcentratedLiquidityParams.deserialize(decode.getField(1)), + poolData: decode + .getFields(2) + .map((e) => OsmosisConcentratedLiquidityPoolData.deserialize(e)) + .toList(), + positionData: decode + .getFields(3) + .map((e) => OsmosisConcentratedLiquidityPositionData.deserialize(e)) + .toList(), + nextPositionId: decode.getField(4), + nextIncentiveRecordId: decode.getField(5)); + } + factory OsmosisConcentratedLiquidityGenesisState.fromRpc( + Map json) { + return OsmosisConcentratedLiquidityGenesisState( + params: OsmosisConcentratedLiquidityParams.fromRpc(json["params"]), + poolData: (json["pool_data"] as List?) + ?.map((e) => OsmosisConcentratedLiquidityPoolData.fromRpc(e)) + .toList() ?? + [], + positionData: (json["position_data"] as List?) + ?.map( + (e) => OsmosisConcentratedLiquidityPositionData.fromRpc(e)) + .toList() ?? + [], + nextPositionId: BigintUtils.tryParse(json["next_position_id"]), + nextIncentiveRecordId: + BigintUtils.tryParse(json["next_incentive_record_id"])); + } + + @override + List get fieldIds => [1, 2, 3, 4, 5]; + + @override + Map toJson() { + return { + "params": params.toJson(), + "pool_data": poolData.map((e) => e.toJson()).toList(), + "position_data": positionData.map((e) => e.toJson()).toList(), + "next_position_id": nextPositionId?.toString(), + "next_incentive_record_id": nextIncentiveRecordId?.toString() + }; + } + + @override + List get values => + [params, poolData, positionData, nextPositionId, nextIncentiveRecordId]; + + @override + String get typeUrl => + OsmosisConcentratedLiquidityV1beta1Types.genesisState.typeUrl; +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/incentive_record.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/incentive_record.dart new file mode 100644 index 0000000..039a071 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/incentive_record.dart @@ -0,0 +1,69 @@ +import 'package:blockchain_utils/numbers/numbers.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +import 'incentive_record_body.dart'; + +/// IncentiveRecord is the high-level struct we use to deal with an independent incentive being distributed on a pool. +/// Note that PoolId, Denom, and MinUptime are included in the key so we avoid storing them in state, +/// hence the distinction between IncentiveRecord and IncentiveRecordBody. +class OsmosisConcentratedLiquidityIncentiveRecord extends CosmosMessage { + /// incentive_id is the id uniquely identifying this incentive record. + final BigInt? incentiveId; + final BigInt? poolId; + + /// incentive record body holds necessary + final OsmosisConcentratedLiquidityIncentiveRecordBody incentiveRecordBody; + + /// min_uptime is the minimum uptime required for liquidity to qualify for this + /// incentive. It should be always be one of the supported uptimes in + /// types.SupportedUptimes + final ProtobufDuration minUptime; + + OsmosisConcentratedLiquidityIncentiveRecord( + {this.incentiveId, + this.poolId, + required this.incentiveRecordBody, + required this.minUptime}); + factory OsmosisConcentratedLiquidityIncentiveRecord.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityIncentiveRecord( + incentiveId: decode.getField(1), + poolId: decode.getField(2), + incentiveRecordBody: + OsmosisConcentratedLiquidityIncentiveRecordBody.deserialize( + decode.getField(4)), + minUptime: ProtobufDuration.deserialize(decode.getField(5))); + } + factory OsmosisConcentratedLiquidityIncentiveRecord.fromRpc( + Map json) { + return OsmosisConcentratedLiquidityIncentiveRecord( + incentiveId: BigintUtils.tryParse(json["incentive_id"]), + poolId: BigintUtils.tryParse(json["pool_id"]), + incentiveRecordBody: + OsmosisConcentratedLiquidityIncentiveRecordBody.fromRpc( + json["incentive_record_body"]), + minUptime: ProtobufDuration.fromString(json["min_uptime"])); + } + + @override + List get fieldIds => [1, 2, 4, 5]; + + @override + Map toJson() { + return { + "incentive_id": incentiveId?.toString(), + "pool_id": poolId?.toString(), + "incentive_record_body": incentiveRecordBody.toJson(), + "min_uptime": minUptime.toJson() + }; + } + + @override + List get values => [incentiveId, poolId, incentiveRecordBody, minUptime]; + + @override + String get typeUrl => + OsmosisConcentratedLiquidityV1beta1Types.incentiveRecord.typeUrl; +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/incentive_record_body.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/incentive_record_body.dart new file mode 100644 index 0000000..cb70fad --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/incentive_record_body.dart @@ -0,0 +1,54 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/models/sdk_v1beta1/cosmos_base_v1beta1/messages/dec_coin.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +/// IncentiveRecordBody represents the body stored in state for each individual record. +class OsmosisConcentratedLiquidityIncentiveRecordBody extends CosmosMessage { + /// [remainingCoin] is the total amount of incentives to be distributed + final DecCoin remainingCoin; + + /// emission_rate is the incentive emission rate per second + final String emissionRate; + + /// start_time is the time when the incentive starts distributing + final ProtobufTimestamp startTime; + + OsmosisConcentratedLiquidityIncentiveRecordBody( + {required this.remainingCoin, + required this.emissionRate, + required this.startTime}); + factory OsmosisConcentratedLiquidityIncentiveRecordBody.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityIncentiveRecordBody( + remainingCoin: DecCoin.deserialize(decode.getField(1)), + emissionRate: decode.getField(2), + startTime: ProtobufTimestamp.deserialize(decode.getField(3))); + } + factory OsmosisConcentratedLiquidityIncentiveRecordBody.fromRpc( + Map json) { + return OsmosisConcentratedLiquidityIncentiveRecordBody( + remainingCoin: DecCoin.fromRpc(json["remaining_coin"]), + emissionRate: json["emission_rate"], + startTime: ProtobufTimestamp.fromString(json["start_time"])); + } + + @override + List get fieldIds => [1, 2, 3]; + + @override + Map toJson() { + return { + "remaining_coin": remainingCoin.toJson(), + "emission_rate": emissionRate, + "start_time": startTime.toJson() + }; + } + + @override + List get values => [remainingCoin, emissionRate, startTime]; + + @override + String get typeUrl => + OsmosisConcentratedLiquidityV1beta1Types.incentiveRecordBody.typeUrl; +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/liquidity_depth_with_range.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/liquidity_depth_with_range.dart new file mode 100644 index 0000000..33f34a2 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/liquidity_depth_with_range.dart @@ -0,0 +1,47 @@ +import 'package:blockchain_utils/numbers/numbers.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +class OsmosisConcentratedLiquidityLiquidityDepthWithRange + extends CosmosMessage { + final String liquidityAmount; + final BigInt? lowerTick; + final BigInt? upperTick; + + OsmosisConcentratedLiquidityLiquidityDepthWithRange( + {required this.liquidityAmount, this.lowerTick, this.upperTick}); + factory OsmosisConcentratedLiquidityLiquidityDepthWithRange.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityLiquidityDepthWithRange( + liquidityAmount: decode.getField(1), + lowerTick: decode.getField(2), + upperTick: decode.getField(3)); + } + factory OsmosisConcentratedLiquidityLiquidityDepthWithRange.fromRpc( + Map json) { + return OsmosisConcentratedLiquidityLiquidityDepthWithRange( + liquidityAmount: json["liquidity_amount"], + lowerTick: BigintUtils.tryParse(json["lower_tick"]), + upperTick: BigintUtils.tryParse(json["upper_tick"])); + } + + @override + List get fieldIds => [1, 2, 3]; + + @override + Map toJson() { + return { + "liquidity_amount": liquidityAmount, + "lower_tick": lowerTick?.toString(), + "upper_tick": upperTick?.toString(), + }; + } + + @override + List get values => [liquidityAmount, lowerTick, upperTick]; + + @override + String get typeUrl => + OsmosisConcentratedLiquidityV1beta1Types.liquidityDepthWithRange.typeUrl; +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/pool_data.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/pool_data.dart new file mode 100644 index 0000000..bf445d1 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/pool_data.dart @@ -0,0 +1,103 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; +import 'accum_object.dart'; +import 'full_tick.dart'; +import 'incentive_record.dart'; + +/// PoolData represents a serialized pool along with its ticks for genesis state. +class OsmosisConcentratedLiquidityPoolData extends CosmosMessage { + /// pool struct. + final Any? pool; + + /// pool's ticks + final List ticks; + final OsmosisConcentratedLiquidityAccumObject spreadRewardAccumulator; + final List incentivesAccumulators; + + /// incentive records to be set + final List incentiveRecords; + + OsmosisConcentratedLiquidityPoolData( + {this.pool, + required List ticks, + required this.spreadRewardAccumulator, + required List + incentivesAccumulators, + required List + incentiveRecords}) + : ticks = ticks.mutable, + incentivesAccumulators = incentivesAccumulators.mutable, + incentiveRecords = incentiveRecords.mutable; + factory OsmosisConcentratedLiquidityPoolData.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityPoolData( + pool: + decode.getResult(1)?.to>((e) => Any.deserialize(e)), + ticks: decode + .getFields(2) + .map((e) => OsmosisConcentratedLiquidityFullTick.deserialize(e)) + .toList(), + spreadRewardAccumulator: + OsmosisConcentratedLiquidityAccumObject.deserialize( + decode.getField(3)), + incentivesAccumulators: decode + .getFields(4) + .map((e) => OsmosisConcentratedLiquidityAccumObject.deserialize(e)) + .toList(), + incentiveRecords: decode + .getFields(5) + .map((e) => + OsmosisConcentratedLiquidityIncentiveRecord.deserialize(e)) + .toList()); + } + factory OsmosisConcentratedLiquidityPoolData.fromRpc( + Map json) { + return OsmosisConcentratedLiquidityPoolData( + pool: json["pool"] == null ? null : Any.fromRpc(json["pool"]), + incentiveRecords: (json["incentive_records"] as List?) + ?.map((e) => + OsmosisConcentratedLiquidityIncentiveRecord.fromRpc(e)) + .toList() ?? + [], + spreadRewardAccumulator: + OsmosisConcentratedLiquidityAccumObject.fromRpc( + json["incentives_accumulators"]), + incentivesAccumulators: (json["incentives_accumulators"] as List?) + ?.map((e) => OsmosisConcentratedLiquidityAccumObject.fromRpc(e)) + .toList() ?? + [], + ticks: (json["ticks"] as List?) + ?.map((e) => OsmosisConcentratedLiquidityFullTick.fromRpc(e)) + .toList() ?? + []); + } + + @override + List get fieldIds => [1, 2, 3, 4, 5]; + + @override + Map toJson() { + return { + "pool": pool?.toJson(), + "ticks": ticks.map((e) => e.toJson()).toList(), + "spread_reward_accumulator": spreadRewardAccumulator.toJson(), + "incentives_accumulators": + incentivesAccumulators.map((e) => e.toJson()).toList(), + "incentive_records": incentiveRecords.map((e) => e.toJson()).toList() + }; + } + + @override + List get values => [ + pool, + ticks, + spreadRewardAccumulator, + incentivesAccumulators, + incentiveRecords, + ]; + + @override + String get typeUrl => + OsmosisConcentratedLiquidityV1beta1Types.poolData.typeUrl; +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/pool_id_to_tick_spacing_record.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/pool_id_to_tick_spacing_record.dart new file mode 100644 index 0000000..9d3339e --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/pool_id_to_tick_spacing_record.dart @@ -0,0 +1,42 @@ +import 'package:blockchain_utils/numbers/bigint_utils.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +/// PoolIdToTickSpacingRecord is a struct that contains a pool id to new tick spacing pair. +class OsmosisConcentratedLiquidityPoolIdToTickSpacingRecord + extends CosmosMessage { + final BigInt? poolId; + final BigInt? newTickspacing; + OsmosisConcentratedLiquidityPoolIdToTickSpacingRecord( + {this.poolId, this.newTickspacing}); + factory OsmosisConcentratedLiquidityPoolIdToTickSpacingRecord.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityPoolIdToTickSpacingRecord( + poolId: decode.getField(1), newTickspacing: decode.getField(2)); + } + factory OsmosisConcentratedLiquidityPoolIdToTickSpacingRecord.fromRpc( + Map json) { + return OsmosisConcentratedLiquidityPoolIdToTickSpacingRecord( + poolId: BigintUtils.tryParse(json["pool_id"]), + newTickspacing: BigintUtils.tryParse(json["new_tick_spacing"])); + } + + @override + List get fieldIds => [1, 2]; + + @override + Map toJson() { + return { + "pool_id": poolId?.toString(), + "new_tick_spacing": newTickspacing?.toString() + }; + } + + @override + List get values => [poolId, newTickspacing]; + + @override + String get typeUrl => OsmosisConcentratedLiquidityV1beta1Types + .poolIdToTickSpacingRecord.typeUrl; +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/pool_record.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/pool_record.dart new file mode 100644 index 0000000..f0208d2 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/pool_record.dart @@ -0,0 +1,55 @@ +import 'package:blockchain_utils/numbers/bigint_utils.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +/// PoolIdToTickSpacingRecord is a struct that contains a pool id to new tick spacing pair. +class OsmosisConcentratedLiquidityPoolIdToTickSpacingRecord + extends CosmosMessage { + final String? denom0; + final String? denom1; + final BigInt? tickSpacing; + final String spreadFactor; + OsmosisConcentratedLiquidityPoolIdToTickSpacingRecord({ + this.denom0, + this.denom1, + this.tickSpacing, + required this.spreadFactor, + }); + factory OsmosisConcentratedLiquidityPoolIdToTickSpacingRecord.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityPoolIdToTickSpacingRecord( + denom0: decode.getField(1), + denom1: decode.getField(2), + tickSpacing: decode.getField(3), + spreadFactor: decode.getField(5)); + } + factory OsmosisConcentratedLiquidityPoolIdToTickSpacingRecord.fromRpc( + Map json) { + return OsmosisConcentratedLiquidityPoolIdToTickSpacingRecord( + denom0: json["denom0"], + denom1: json["denom1"], + tickSpacing: BigintUtils.tryParse(json["tick_spacing"]), + spreadFactor: json["spread_factor"]); + } + + @override + List get fieldIds => [1, 2, 3, 5]; + + @override + Map toJson() { + return { + "denom0": denom0, + "denom1": denom1, + "tick_spacing": tickSpacing?.toString(), + "spread_factor": spreadFactor + }; + } + + @override + List get values => [denom0, denom1, tickSpacing, spreadFactor]; + + @override + String get typeUrl => + OsmosisConcentratedLiquidityV1beta1Types.poolRecord.typeUrl; +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/position.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/position.dart new file mode 100644 index 0000000..82247ff --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/position.dart @@ -0,0 +1,68 @@ +import 'package:blockchain_utils/numbers/bigint_utils.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +/// Position contains position's id, address, pool id, lower tick, upper tick join time, and liquidity. +class OsmosisConcentratedLiquidityPosition extends CosmosMessage { + final BigInt? positionId; + final String? address; + final BigInt? poolId; + final BigInt? lowerTick; + final BigInt? upperTick; + final ProtobufTimestamp joinTime; + final String liquidity; + OsmosisConcentratedLiquidityPosition( + {this.positionId, + this.address, + this.poolId, + this.lowerTick, + this.upperTick, + required this.joinTime, + required this.liquidity}); + factory OsmosisConcentratedLiquidityPosition.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityPosition( + positionId: decode.getField(1), + address: decode.getField(2), + poolId: decode.getField(3), + lowerTick: decode.getField(4), + upperTick: decode.getField(5), + joinTime: ProtobufTimestamp.deserialize(decode.getField(6)), + liquidity: decode.getField(7)); + } + factory OsmosisConcentratedLiquidityPosition.fromRpc( + Map json) { + return OsmosisConcentratedLiquidityPosition( + positionId: BigintUtils.tryParse(json["position_id"]), + address: json["address"], + poolId: BigintUtils.tryParse(json["pool_id"]), + lowerTick: BigintUtils.tryParse(json["lower_tick"]), + upperTick: BigintUtils.tryParse(json["upper_tick"]), + joinTime: ProtobufTimestamp.fromString(json["join_time"]), + liquidity: json["liquidity"]); + } + + @override + List get fieldIds => [1, 2, 3, 4, 5, 6, 7]; + + @override + Map toJson() { + return { + "position_id": positionId?.toString(), + "address": address, + "pool_id": poolId?.toString(), + "lower_tick": lowerTick?.toString(), + "upper_tick": upperTick?.toString(), + "join_time": joinTime.toJson(), + "liquidity": liquidity + }; + } + + @override + List get values => + [positionId, address, poolId, lowerTick, upperTick, joinTime, liquidity]; + + @override + String get typeUrl => + OsmosisConcentratedLiquidityV1beta1Types.position.typeUrl; +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/position_data.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/position_data.dart new file mode 100644 index 0000000..bcfd5f4 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/position_data.dart @@ -0,0 +1,72 @@ +import 'package:blockchain_utils/numbers/bigint_utils.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_accum_v1beta1/messages/record_msg.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; + +import 'position.dart'; + +/// Position contains position's id, address, pool id, lower tick, upper tick join time, and liquidity. +class OsmosisConcentratedLiquidityPositionData extends CosmosMessage { + final OsmosisConcentratedLiquidityPosition? position; + final BigInt? lockId; + final OsmosisAccumRecord spreadRewardAccumRecord; + final List uptimeAccumRecords; + OsmosisConcentratedLiquidityPositionData({ + this.position, + this.lockId, + required this.spreadRewardAccumRecord, + required List uptimeAccumRecords, + }) : uptimeAccumRecords = uptimeAccumRecords.mutable; + factory OsmosisConcentratedLiquidityPositionData.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityPositionData( + position: decode + .getResult(1) + ?.to>( + (e) => OsmosisConcentratedLiquidityPosition.deserialize(e)), + lockId: decode.getField(2), + spreadRewardAccumRecord: + OsmosisAccumRecord.deserialize(decode.getField(3)), + uptimeAccumRecords: decode + .getFields(4) + .map((e) => OsmosisAccumRecord.deserialize(e)) + .toList()); + } + factory OsmosisConcentratedLiquidityPositionData.fromRpc( + Map json) { + return OsmosisConcentratedLiquidityPositionData( + position: json["position"] == null + ? null + : OsmosisConcentratedLiquidityPosition.fromRpc(json["position"]), + lockId: BigintUtils.tryParse(json["lock_id"]), + spreadRewardAccumRecord: + OsmosisAccumRecord.fromRpc(json["spread_reward_accum_record"]), + uptimeAccumRecords: (json["uptime_accum_records"] as List?) + ?.map((e) => OsmosisAccumRecord.deserialize(e)) + .toList() ?? + []); + } + + @override + List get fieldIds => [1, 2, 3, 4]; + + @override + Map toJson() { + return { + "position": position?.toJson(), + "lock_id": lockId?.toString(), + "spread_reward_accum_record": spreadRewardAccumRecord.toJson(), + "uptime_accum_records": uptimeAccumRecords.map((e) => e.toJson()).toList() + }; + } + + @override + List get values => + [position, lockId, spreadRewardAccumRecord, uptimeAccumRecords]; + + @override + String get typeUrl => + OsmosisConcentratedLiquidityV1beta1Types.positionData.typeUrl; +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/position_with_period_lock.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/position_with_period_lock.dart new file mode 100644 index 0000000..612ca11 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/position_with_period_lock.dart @@ -0,0 +1,42 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_lockup/messages/period_lock.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'position.dart'; + +/// Position contains position's id, address, pool id, lower tick, upper tick join time, and liquidity. +class OsmosisConcentratedLiquidityPositionWithPeriodLock extends CosmosMessage { + final OsmosisConcentratedLiquidityPosition position; + final OsmosisLockupPeriodLock locks; + const OsmosisConcentratedLiquidityPositionWithPeriodLock( + {required this.position, required this.locks}); + factory OsmosisConcentratedLiquidityPositionWithPeriodLock.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityPositionWithPeriodLock( + position: OsmosisConcentratedLiquidityPosition.deserialize( + decode.getField(1)), + locks: OsmosisLockupPeriodLock.deserialize(decode.getField(2))); + } + factory OsmosisConcentratedLiquidityPositionWithPeriodLock.fromRpc( + Map json) { + return OsmosisConcentratedLiquidityPositionWithPeriodLock( + position: OsmosisConcentratedLiquidityPosition.fromRpc(json["position"]), + locks: OsmosisLockupPeriodLock.fromRpc(json["locks"]), + ); + } + + @override + List get fieldIds => [1, 2]; + + @override + Map toJson() { + return {"position": position.toJson(), "locks": locks.toJson()}; + } + + @override + List get values => [position, locks]; + + @override + String get typeUrl => + OsmosisConcentratedLiquidityV1beta1Types.positionWithPeriodLock.typeUrl; +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/tick_info.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/tick_info.dart new file mode 100644 index 0000000..e6cb089 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/tick_info.dart @@ -0,0 +1,95 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/models/sdk_v1beta1/cosmos_base_v1beta1/messages/dec_coin.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; +import 'uptime_tracker.dart'; + +/// PoolIdToTickSpacingRecord is a struct that contains a pool id to new tick spacing pair. +class OsmosisConcentratedLiquidityTickInfo extends CosmosMessage { + final String liquidityGross; + final String liquidityNet; + + /// Total spread rewards accumulated in the opposite direction that the tick + /// was last crossed. i.e. if the current tick is to the right of this tick + /// (meaning its currently a greater price), then this is the total spread + /// rewards accumulated below the tick. If the current tick is to the left of + /// this tick (meaning its currently at a lower price), then this is the total + /// spread rewards accumulated above the tick. + /// + /// Note: the way this value is used depends on the direction of spread rewards + /// we are calculating for. If we are calculating spread rewards below the + /// lower tick and the lower tick is the active tick, then this is the + /// spreadRewardGrowthGlobal - the lower tick's + /// spreadRewardGrowthOppositeDirectionOfLastTraversal. If we are calculating + /// spread rewards above the upper tick and the upper tick is the active tick, + /// then this is just the tick's + /// spreadRewardGrowthOppositeDirectionOfLastTraversal value. + final List spreadRewardGrowthOsppositeDirectionOfLastTraversal; + + /// uptime_trackers is a container encapsulating the uptime trackers. + /// We use a container instead of a "repeated UptimeTracker" directly + /// because we need the ability to serialize and deserialize the + /// container easily for events when crossing a tick. + final OsmosisConcentratedLiquidityUptimeTrackers uptimeTrackers; + + OsmosisConcentratedLiquidityTickInfo( + {required this.liquidityGross, + required this.liquidityNet, + required List + spreadRewardGrowthOsppositeDirectionOfLastTraversal, + required this.uptimeTrackers}) + : spreadRewardGrowthOsppositeDirectionOfLastTraversal = + spreadRewardGrowthOsppositeDirectionOfLastTraversal.mutable; + factory OsmosisConcentratedLiquidityTickInfo.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityTickInfo( + liquidityGross: decode.getField(1), + liquidityNet: decode.getField(2), + spreadRewardGrowthOsppositeDirectionOfLastTraversal: + decode.getFields(3).map((e) => DecCoin.deserialize(e)).toList(), + uptimeTrackers: OsmosisConcentratedLiquidityUptimeTrackers.deserialize( + decode.getField(4))); + } + factory OsmosisConcentratedLiquidityTickInfo.fromRpc( + Map json) { + return OsmosisConcentratedLiquidityTickInfo( + liquidityGross: json["liquidity_gross"], + liquidityNet: json["liquidity_net"], + spreadRewardGrowthOsppositeDirectionOfLastTraversal: + (json["spread_reward_growth_opposite_direction_of_last_traversal"] + as List?) + ?.map((e) => DecCoin.fromRpc(e)) + .toList() ?? + [], + uptimeTrackers: OsmosisConcentratedLiquidityUptimeTrackers.deserialize( + json["uptime_trackers"])); + } + + @override + List get fieldIds => [1, 2, 3, 4]; + + @override + Map toJson() { + return { + "liquidity_gross": liquidityGross, + "liquidity_net": liquidityNet, + "spread_reward_growth_opposite_direction_of_last_traversal": + spreadRewardGrowthOsppositeDirectionOfLastTraversal + .map((e) => e.toJson()) + .toList(), + "uptime_trackers": uptimeTrackers.toJson() + }; + } + + @override + List get values => [ + liquidityGross, + liquidityNet, + spreadRewardGrowthOsppositeDirectionOfLastTraversal, + uptimeTrackers + ]; + + @override + String get typeUrl => + OsmosisConcentratedLiquidityV1beta1Types.tickInfo.typeUrl; +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/tick_liquidity_net.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/tick_liquidity_net.dart new file mode 100644 index 0000000..abe22c3 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/tick_liquidity_net.dart @@ -0,0 +1,37 @@ +import 'package:blockchain_utils/numbers/numbers.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +class OsmosisConcentratedLiquidityTickLiquidityNet extends CosmosMessage { + final String liquidityNet; + final BigInt? tickIndex; + OsmosisConcentratedLiquidityTickLiquidityNet( + {required this.liquidityNet, this.tickIndex}); + factory OsmosisConcentratedLiquidityTickLiquidityNet.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityTickLiquidityNet( + liquidityNet: decode.getField(1), tickIndex: decode.getField(2)); + } + factory OsmosisConcentratedLiquidityTickLiquidityNet.fromRpc( + Map json) { + return OsmosisConcentratedLiquidityTickLiquidityNet( + liquidityNet: json["liquidity_net"], + tickIndex: BigintUtils.tryParse(json["tick_index"])); + } + + @override + List get fieldIds => [1, 2]; + + @override + Map toJson() { + return {"liquidity_net": liquidityNet, "tick_index": tickIndex?.toString()}; + } + + @override + List get values => [liquidityNet, tickIndex]; + + @override + String get typeUrl => + OsmosisConcentratedLiquidityV1beta1Types.tickLiquidityNet.typeUrl; +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/tick_spacing_decrease_proposal.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/tick_spacing_decrease_proposal.dart new file mode 100644 index 0000000..b9c4b8e --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/tick_spacing_decrease_proposal.dart @@ -0,0 +1,66 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; +import 'pool_id_to_tick_spacing_record.dart'; + +/// TickSpacingDecreaseProposal is a gov Content type for proposing a tick spacing decrease for a pool. +/// The proposal will fail if one of the pools do not exist, or if the new tick spacing is not less than the current tick spacing. +class OsmosisConcentratedLiquidityTickSpacingDecreaseProposal + extends CosmosMessage { + final String? title; + final String? description; + final List + poolIdToTickSpacingRecords; + + OsmosisConcentratedLiquidityTickSpacingDecreaseProposal({ + this.title, + this.description, + required List + poolIdToTickSpacingRecords, + }) : poolIdToTickSpacingRecords = poolIdToTickSpacingRecords.mutable; + factory OsmosisConcentratedLiquidityTickSpacingDecreaseProposal.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityTickSpacingDecreaseProposal( + title: decode.getField(1), + description: decode.getField(2), + poolIdToTickSpacingRecords: decode + .getFields(3) + .map((e) => OsmosisConcentratedLiquidityPoolIdToTickSpacingRecord + .deserialize(e)) + .toList()); + } + factory OsmosisConcentratedLiquidityTickSpacingDecreaseProposal.fromRpc( + Map json) { + return OsmosisConcentratedLiquidityTickSpacingDecreaseProposal( + title: json["title"], + description: json["description"], + poolIdToTickSpacingRecords: + (json["pool_id_to_tick_spacing_records"] as List?) + ?.map((e) => + OsmosisConcentratedLiquidityPoolIdToTickSpacingRecord + .fromRpc(e)) + .toList() ?? + []); + } + + @override + List get fieldIds => [1, 2, 3]; + + @override + Map toJson() { + return { + "title": title, + "description": description, + "pool_id_to_tick_spacing_records": + poolIdToTickSpacingRecords.map((e) => e.toJson()).toList() + }; + } + + @override + List get values => [title, description, poolIdToTickSpacingRecords]; + + @override + String get typeUrl => OsmosisConcentratedLiquidityV1beta1Types + .tickSpacingDecreaseProposal.typeUrl; +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/uptime_tracker.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/uptime_tracker.dart new file mode 100644 index 0000000..e015ffd --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/uptime_tracker.dart @@ -0,0 +1,41 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; +import 'uptime_trackers.dart'; + +class OsmosisConcentratedLiquidityUptimeTrackers extends CosmosMessage { + final List list; + OsmosisConcentratedLiquidityUptimeTrackers( + List list) + : list = list.mutable; + factory OsmosisConcentratedLiquidityUptimeTrackers.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityUptimeTrackers(decode + .getFields(1) + .map((e) => OsmosisConcentratedLiquidityUptimeTracker.deserialize(e)) + .toList()); + } + factory OsmosisConcentratedLiquidityUptimeTrackers.fromRpc( + Map json) { + return OsmosisConcentratedLiquidityUptimeTrackers((json["list"] as List?) + ?.map((e) => OsmosisConcentratedLiquidityUptimeTracker.fromRpc(e)) + .toList() ?? + []); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"list": list.map((e) => e.toJson()).toList()}; + } + + @override + List get values => [list]; + + @override + String get typeUrl => + OsmosisConcentratedLiquidityV1beta1Types.uptimeTrackers.typeUrl; +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/uptime_trackers.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/uptime_trackers.dart new file mode 100644 index 0000000..c116e1f --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/uptime_trackers.dart @@ -0,0 +1,42 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/models/sdk_v1beta1/cosmos_base_v1beta1/messages/dec_coin.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; + +class OsmosisConcentratedLiquidityUptimeTracker extends CosmosMessage { + final List uptimeGrowthOutside; + OsmosisConcentratedLiquidityUptimeTracker(List uptimeGrowthOutside) + : uptimeGrowthOutside = uptimeGrowthOutside.mutable; + factory OsmosisConcentratedLiquidityUptimeTracker.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityUptimeTracker( + decode.getFields(1).map((e) => DecCoin.deserialize(e)).toList()); + } + factory OsmosisConcentratedLiquidityUptimeTracker.fromRpc( + Map json) { + return OsmosisConcentratedLiquidityUptimeTracker( + (json["uptime_growth_outside"] as List?) + ?.map((e) => DecCoin.fromRpc(e)) + .toList() ?? + []); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return { + "uptime_growth_outside": + uptimeGrowthOutside.map((e) => e.toJson()).toList() + }; + } + + @override + List get values => [uptimeGrowthOutside]; + + @override + String get typeUrl => + OsmosisConcentratedLiquidityV1beta1Types.uptimeTracker.typeUrl; +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/liquidity_per_tick_range_request.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/liquidity_per_tick_range_request.dart new file mode 100644 index 0000000..4beb30f --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/liquidity_per_tick_range_request.dart @@ -0,0 +1,64 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'liquidity_per_tick_range_response.dart'; + +class OsmosisConcentratedLiquidityLiquidityPerTickRangeRequest + extends CosmosMessage + with + QueryMessage, + RPCMessage { + final BigInt? poolId; + + OsmosisConcentratedLiquidityLiquidityPerTickRangeRequest({ + this.poolId, + }); + factory OsmosisConcentratedLiquidityLiquidityPerTickRangeRequest.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityLiquidityPerTickRangeRequest( + poolId: decode.getField(1)); + } + + @override + List get fieldIds => [1]; + + @override + Map get queryParameters => {"pool_id": poolId?.toString()}; + + @override + String get queryPath => OsmosisConcentratedLiquidityV1beta1Types + .liquidityDepthWithRangeQuery.typeUrl; + + @override + String get rpcPath => + OsmosisConcentratedLiquidityV1beta1Types.liquidityDepthWithRangeQuery + .rpcUrl(pathParameters: []); + + @override + Map toJson() { + return { + "pool_id": poolId?.toString(), + }; + } + + @override + String get typeUrl => OsmosisConcentratedLiquidityV1beta1Types + .liquidityPerTickRangeRequest.typeUrl; + + @override + List get values => [poolId]; + + @override + OsmosisConcentratedLiquidityLiquidityPerTickRangeResponse onJsonResponse( + Map json) { + return OsmosisConcentratedLiquidityLiquidityPerTickRangeResponse.fromRpc( + json); + } + + @override + OsmosisConcentratedLiquidityLiquidityPerTickRangeResponse onResponse( + List bytes) { + return OsmosisConcentratedLiquidityLiquidityPerTickRangeResponse + .deserialize(bytes); + } +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/liquidity_per_tick_range_response.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/liquidity_per_tick_range_response.dart new file mode 100644 index 0000000..3c1e2a5 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/liquidity_per_tick_range_response.dart @@ -0,0 +1,56 @@ +import 'package:blockchain_utils/numbers/numbers.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/liquidity_depth_with_range.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; + +class OsmosisConcentratedLiquidityLiquidityPerTickRangeResponse + extends CosmosMessage { + final List liquidity; + final BigInt? bucketIndex; + OsmosisConcentratedLiquidityLiquidityPerTickRangeResponse( + {required List + liquidity, + this.bucketIndex}) + : liquidity = liquidity.mutable; + factory OsmosisConcentratedLiquidityLiquidityPerTickRangeResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityLiquidityPerTickRangeResponse( + liquidity: decode + .getFields(1) + .map((e) => + OsmosisConcentratedLiquidityLiquidityDepthWithRange.deserialize( + e)) + .toList(), + bucketIndex: decode.getField(2)); + } + factory OsmosisConcentratedLiquidityLiquidityPerTickRangeResponse.fromRpc( + Map json) { + return OsmosisConcentratedLiquidityLiquidityPerTickRangeResponse( + liquidity: (json["liquidity"] as List?) + ?.map((e) => OsmosisConcentratedLiquidityLiquidityDepthWithRange + .deserialize(e)) + .toList() ?? + [], + bucketIndex: BigintUtils.tryParse(json["bucket_index"])); + } + + @override + List get fieldIds => [1, 2]; + + @override + Map toJson() { + return { + "liquidity": liquidity.map((e) => e.toJson()).toList(), + "bucket_index": bucketIndex?.toString() + }; + } + + @override + String get typeUrl => OsmosisConcentratedLiquidityV1beta1Types + .liquidityPerTickRangeResponse.typeUrl; + + @override + List get values => [liquidity, bucketIndex]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/params_request.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/params_request.dart new file mode 100644 index 0000000..549ca48 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/params_request.dart @@ -0,0 +1,51 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'params_response.dart'; + +class OsmosisConcentratedLiquidityParamsRequest extends CosmosMessage + with + QueryMessage, + RPCMessage { + OsmosisConcentratedLiquidityParamsRequest(); + factory OsmosisConcentratedLiquidityParamsRequest.deserialize( + List bytes) { + return OsmosisConcentratedLiquidityParamsRequest(); + } + + @override + List get fieldIds => []; + + @override + Map get queryParameters => {}; + + @override + String get queryPath => + OsmosisConcentratedLiquidityV1beta1Types.params.typeUrl; + + @override + String get rpcPath => + OsmosisConcentratedLiquidityV1beta1Types.params.rpcUrl(); + + @override + Map toJson() { + return {}; + } + + @override + String get typeUrl => + OsmosisConcentratedLiquidityV1beta1Types.paramsRequest.typeUrl; + + @override + List get values => []; + + @override + OsmosisConcentratedLiquidityParamsResponse onJsonResponse( + Map json) { + return OsmosisConcentratedLiquidityParamsResponse.fromRpc(json); + } + + @override + OsmosisConcentratedLiquidityParamsResponse onResponse(List bytes) { + return OsmosisConcentratedLiquidityParamsResponse.deserialize(bytes); + } +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/params_response.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/params_response.dart new file mode 100644 index 0000000..f28ddff --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/params_response.dart @@ -0,0 +1,34 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentratedliquidity/osmosis_concentratedliquidity.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +class OsmosisConcentratedLiquidityParamsResponse extends CosmosMessage { + final OsmosisConcentratedLiquidityParams params; + OsmosisConcentratedLiquidityParamsResponse(this.params); + factory OsmosisConcentratedLiquidityParamsResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityParamsResponse( + OsmosisConcentratedLiquidityParams.deserialize(decode.getField(1))); + } + factory OsmosisConcentratedLiquidityParamsResponse.fromRpc( + Map json) { + return OsmosisConcentratedLiquidityParamsResponse( + OsmosisConcentratedLiquidityParams.fromRpc(json["params"])); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"params": params.toJson()}; + } + + @override + String get typeUrl => + OsmosisConcentratedLiquidityV1beta1Types.paramsResponse.typeUrl; + + @override + List get values => [params]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/pools_request.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/pools_request.dart new file mode 100644 index 0000000..25e1da7 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/pools_request.dart @@ -0,0 +1,58 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +import '../../../../sdk_v1beta1/cosmos_base_query_v1beta1/messages/page_request.dart'; +import 'pools_response.dart'; + +class OsmosisConcentratedLiquidityPoolsRequest extends CosmosMessage + with + QueryMessage, + RPCMessage { + /// pagination defines an optional pagination for the request. + final PageRequest? pagination; + OsmosisConcentratedLiquidityPoolsRequest({this.pagination}); + factory OsmosisConcentratedLiquidityPoolsRequest.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityPoolsRequest( + pagination: decode + .getResult(2) + ?.to>((e) => PageRequest.deserialize(e))); + } + + @override + List get fieldIds => [2]; + + @override + Map get queryParameters => {}; + + @override + String get queryPath => + OsmosisConcentratedLiquidityV1beta1Types.pools.typeUrl; + + @override + String get rpcPath => OsmosisConcentratedLiquidityV1beta1Types.pools.rpcUrl(); + + @override + Map toJson() { + return {"pagination": pagination?.toJson()}; + } + + @override + String get typeUrl => + OsmosisConcentratedLiquidityV1beta1Types.poolsRequest.typeUrl; + + @override + List get values => [pagination]; + + @override + OsmosisConcentratedLiquidityPoolsResponse onJsonResponse( + Map json) { + return OsmosisConcentratedLiquidityPoolsResponse.fromRpc(json); + } + + @override + OsmosisConcentratedLiquidityPoolsResponse onResponse(List bytes) { + return OsmosisConcentratedLiquidityPoolsResponse.deserialize(bytes); + } +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/pools_response.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/pools_response.dart new file mode 100644 index 0000000..9a9a9f4 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/pools_response.dart @@ -0,0 +1,50 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/models/sdk_v1beta1/cosmos_base_query_v1beta1/messages/page_response.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; + +class OsmosisConcentratedLiquidityPoolsResponse extends CosmosMessage { + /// pagination defines an optional pagination for the request. + final List? pools; + + /// pagination defines the pagination in the response. + final PageResponse? pagination; + + OsmosisConcentratedLiquidityPoolsResponse({List? pools, this.pagination}) + : pools = pools?.nullOnEmpy; + factory OsmosisConcentratedLiquidityPoolsResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityPoolsResponse( + pools: decode.getFields(1).map((e) => Any.deserialize(e)).toList(), + pagination: decode + .getResult(2) + ?.to>((e) => PageResponse.deserialize(e))); + } + factory OsmosisConcentratedLiquidityPoolsResponse.fromRpc( + Map json) { + return OsmosisConcentratedLiquidityPoolsResponse( + pools: (json["pools"] as List?)?.map((e) => Any.fromRpc(e)).toList(), + pagination: json["pagination"] == null + ? null + : PageResponse.fromRpc(json["pagination"])); + } + + @override + List get fieldIds => [1, 2]; + + @override + Map toJson() { + return { + "pools": pools?.map((e) => e.toJson()).toList(), + "pagination": pagination?.toJson() + }; + } + + @override + String get typeUrl => + OsmosisConcentratedLiquidityV1beta1Types.poolsResponse.typeUrl; + + @override + List get values => [pools, pagination]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/user_positions_request.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/user_positions_request.dart new file mode 100644 index 0000000..39d763b --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/user_positions_request.dart @@ -0,0 +1,72 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/models/sdk_v1beta1/cosmos_base_query_v1beta1/messages/page_request.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'user_positions_response.dart'; + +class OsmosisConcentratedLiquidityUserPositionsRequest extends CosmosMessage + with + QueryMessage, + RPCMessage { + final String? address; + final BigInt? poolId; + + /// pagination defines an optional pagination for the request. + final PageRequest? pagination; + OsmosisConcentratedLiquidityUserPositionsRequest({ + this.address, + this.poolId, + this.pagination, + }); + factory OsmosisConcentratedLiquidityUserPositionsRequest.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityUserPositionsRequest( + address: decode.getField(1), + poolId: decode.getField(2), + pagination: decode + .getResult(3) + ?.to>((e) => PageRequest.deserialize(e))); + } + + @override + List get fieldIds => [1, 2, 3]; + + @override + Map get queryParameters => {"pool_id": poolId?.toString()}; + + @override + String get queryPath => + OsmosisConcentratedLiquidityV1beta1Types.userPositions.typeUrl; + + @override + String get rpcPath => OsmosisConcentratedLiquidityV1beta1Types.userPositions + .rpcUrl(pathParameters: [address]); + + @override + Map toJson() { + return { + "pagination": pagination?.toJson(), + "pool_id": poolId?.toString(), + "address": address + }; + } + + @override + String get typeUrl => + OsmosisConcentratedLiquidityV1beta1Types.userPositionsRequest.typeUrl; + + @override + List get values => [pagination]; + + @override + OsmosisConcentratedLiquidityUserPositionsResponse onJsonResponse( + Map json) { + return OsmosisConcentratedLiquidityUserPositionsResponse.fromRpc(json); + } + + @override + OsmosisConcentratedLiquidityUserPositionsResponse onResponse( + List bytes) { + return OsmosisConcentratedLiquidityUserPositionsResponse.deserialize(bytes); + } +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/user_positions_response.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/user_positions_response.dart new file mode 100644 index 0000000..d763249 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/user_positions_response.dart @@ -0,0 +1,57 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/full_position_breakdown.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/models/sdk_v1beta1/cosmos_base_query_v1beta1/messages/page_response.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; + +class OsmosisConcentratedLiquidityUserPositionsResponse extends CosmosMessage { + final List positions; + + /// pagination defines the pagination in the response. + final PageResponse? pagination; + + OsmosisConcentratedLiquidityUserPositionsResponse( + {required List positions, this.pagination}) + : positions = positions.mutable; + factory OsmosisConcentratedLiquidityUserPositionsResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityUserPositionsResponse( + positions: decode + .getFields(1) + .map((e) => FullPositionBreakdown.deserialize(e)) + .toList(), + pagination: decode + .getResult(2) + ?.to>((e) => PageResponse.deserialize(e))); + } + factory OsmosisConcentratedLiquidityUserPositionsResponse.fromRpc( + Map json) { + return OsmosisConcentratedLiquidityUserPositionsResponse( + positions: (json["positions"] as List?) + ?.map((e) => FullPositionBreakdown.fromRpc(e)) + .toList() ?? + [], + pagination: json["pagination"] == null + ? null + : PageResponse.fromRpc(json["pagination"])); + } + + @override + List get fieldIds => [1, 2]; + + @override + Map toJson() { + return { + "positions": positions.map((e) => e.toJson()).toList(), + "pagination": pagination?.toJson() + }; + } + + @override + String get typeUrl => + OsmosisConcentratedLiquidityV1beta1Types.userPositionsResponse.typeUrl; + + @override + List get values => [positions, pagination]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/services/msg_add_to_position.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/services/msg_add_to_position.dart new file mode 100644 index 0000000..7e8d71b --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/services/msg_add_to_position.dart @@ -0,0 +1,89 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'msg_add_to_position_response.dart'; + +class OsmosisConcentratedLiquidityMsgAddToPosition extends CosmosMessage + with ServiceMessage { + final BigInt? positionId; + final String? sender; + + /// amount0 represents the amount of token0 willing to put in. + final BigInt amount0; + + /// amount1 represents the amount of token1 willing to put in. + final BigInt amount1; + + /// token_min_amount0 represents the minimum amount of token0 desired from the + /// new position being created. Note that this field indicates the min amount0 + /// corresponding to the liquidity that is being added, not the total + /// liquidity of the position. + final BigInt tokenMinAmount0; + + /// token_min_amount1 represents the minimum amount of token1 desired from the + /// new position being created. Note that this field indicates the min amount1 + /// corresponding to the liquidity that is being added, not the total + /// liquidity of the position. + final BigInt tokenMinAmount1; + + OsmosisConcentratedLiquidityMsgAddToPosition( + {this.positionId, + this.sender, + required this.amount0, + required this.amount1, + required this.tokenMinAmount0, + required this.tokenMinAmount1}); + factory OsmosisConcentratedLiquidityMsgAddToPosition.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityMsgAddToPosition( + positionId: decode.getField(1), + sender: decode.getField(2), + amount0: BigInt.parse(decode.getField(3)), + amount1: BigInt.parse(decode.getField(4)), + tokenMinAmount0: BigInt.parse(decode.getField(5)), + tokenMinAmount1: BigInt.parse(decode.getField(6))); + } + + @override + List get fieldIds => [1, 2, 3, 4, 5, 6]; + + @override + Map toJson() { + return { + "position_id": positionId?.toString(), + "sender": sender, + "amount0": amount0.toString(), + "amount1": amount1.toString(), + "token_min_amount0": tokenMinAmount0.toString(), + "token_min_amount1": tokenMinAmount1.toString() + }; + } + + @override + List get values => [ + positionId, + sender, + amount0.toString(), + amount1.toString(), + tokenMinAmount0.toString(), + tokenMinAmount1.toString() + ]; + + @override + String get typeUrl => + OsmosisConcentratedLiquidityV1beta1Types.msgAddToPosition.typeUrl; + + @override + OsmosisConcentratedLiquidityMsgAddToPositionResponse onResponse( + List bytes) { + return OsmosisConcentratedLiquidityMsgAddToPositionResponse.deserialize( + bytes); + } + + @override + String get service => + OsmosisConcentratedLiquidityV1beta1Types.addToPosition.typeUrl; + + @override + List get signers => [sender]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/services/msg_add_to_position_response.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/services/msg_add_to_position_response.dart new file mode 100644 index 0000000..2b5e2ce --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/services/msg_add_to_position_response.dart @@ -0,0 +1,47 @@ +import 'package:blockchain_utils/numbers/bigint_utils.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +class OsmosisConcentratedLiquidityMsgAddToPositionResponse + extends CosmosMessage { + final BigInt? positionId; + final BigInt amount0; + final BigInt amount1; + + OsmosisConcentratedLiquidityMsgAddToPositionResponse( + {this.positionId, required this.amount0, required this.amount1}); + factory OsmosisConcentratedLiquidityMsgAddToPositionResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityMsgAddToPositionResponse( + positionId: decode.getField(1), + amount0: BigInt.parse(decode.getField(2)), + amount1: BigInt.parse(decode.getField(3))); + } + factory OsmosisConcentratedLiquidityMsgAddToPositionResponse.fromRpc( + Map json) { + return OsmosisConcentratedLiquidityMsgAddToPositionResponse( + positionId: BigintUtils.tryParse(json["position_id"]), + amount0: BigintUtils.parse(json["amount0"]), + amount1: BigintUtils.parse(json["amount1"])); + } + + @override + List get fieldIds => [1, 2, 3]; + + @override + Map toJson() { + return { + "position_id": positionId?.toString(), + "amount0": amount0.toString(), + "amount1": amount1.toString() + }; + } + + @override + List get values => [positionId, amount0.toString(), amount1.toString()]; + + @override + String get typeUrl => + OsmosisConcentratedLiquidityV1beta1Types.msgAddToPositionResponse.typeUrl; +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/services/msg_collect_incentives.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/services/msg_collect_incentives.dart new file mode 100644 index 0000000..3cf9621 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/services/msg_collect_incentives.dart @@ -0,0 +1,65 @@ +import 'package:blockchain_utils/numbers/numbers.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; + +import 'msg_collect_spread_rewards_response.dart'; + +class OsmosisConcentratedLiquidityMsgCollectIncentives extends CosmosMessage + with + ServiceMessage< + OsmosisConcentratedLiquidityMsgCollectSpreadRewardsResponse> { + final List? positionIds; + final String? sender; + + OsmosisConcentratedLiquidityMsgCollectIncentives( + {List? positionIds, this.sender}) + : positionIds = positionIds?.nullOnEmpy; + factory OsmosisConcentratedLiquidityMsgCollectIncentives.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityMsgCollectIncentives( + positionIds: decode + .getResult(1) + ?.to, List>( + (e) => e.map((e) => BigintUtils.parse(e)).toList()) ?? + [], + sender: decode.getField(2), + ); + } + + @override + List get fieldIds => [1, 2]; + + @override + Map toJson() { + return { + "position_ids": positionIds?.map((e) => e.toString()).toList(), + "sender": sender, + }; + } + + @override + List get values => [ + positionIds, + sender, + ]; + + @override + String get typeUrl => + OsmosisConcentratedLiquidityV1beta1Types.msgCollectIncentives.typeUrl; + + @override + OsmosisConcentratedLiquidityMsgCollectSpreadRewardsResponse onResponse( + List bytes) { + return OsmosisConcentratedLiquidityMsgCollectSpreadRewardsResponse + .deserialize(bytes); + } + + @override + String get service => + OsmosisConcentratedLiquidityV1beta1Types.collectIncentives.typeUrl; + + @override + List get signers => [sender]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/services/msg_collect_incentives_response.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/services/msg_collect_incentives_response.dart new file mode 100644 index 0000000..b08ddb1 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/services/msg_collect_incentives_response.dart @@ -0,0 +1,58 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/models/sdk_v1beta1/cosmos_base_v1beta1/messages/coin.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; + +class OsmosisConcentratedLiquidityMsgCollectIncentivesResponse + extends CosmosMessage { + final List collectedIncentives; + final List forfeitedIncentives; + + OsmosisConcentratedLiquidityMsgCollectIncentivesResponse( + {required List collectedIncentives, + required List forfeitedIncentives}) + : collectedIncentives = collectedIncentives.mutable, + forfeitedIncentives = forfeitedIncentives.mutable; + factory OsmosisConcentratedLiquidityMsgCollectIncentivesResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityMsgCollectIncentivesResponse( + collectedIncentives: + decode.getFields(1).map((e) => Coin.deserialize(e)).toList(), + forfeitedIncentives: + decode.getFields(2).map((e) => Coin.deserialize(e)).toList()); + } + factory OsmosisConcentratedLiquidityMsgCollectIncentivesResponse.fromRpc( + Map json) { + return OsmosisConcentratedLiquidityMsgCollectIncentivesResponse( + collectedIncentives: (json["collected_incentives"] as List?) + ?.map((e) => Coin.fromRpc(e)) + .toList() ?? + [], + forfeitedIncentives: (json["forfeited_incentives"] as List?) + ?.map((e) => Coin.fromRpc(e)) + .toList() ?? + [], + ); + } + + @override + List get fieldIds => [1, 2]; + + @override + Map toJson() { + return { + "collected_incentives": + collectedIncentives.map((e) => e.toJson()).toList(), + "forfeited_incentives": + forfeitedIncentives.map((e) => e.toJson()).toList() + }; + } + + @override + List get values => [collectedIncentives, forfeitedIncentives]; + + @override + String get typeUrl => OsmosisConcentratedLiquidityV1beta1Types + .msgCollectIncentivesResponse.typeUrl; +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/services/msg_collect_spread_rewards.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/services/msg_collect_spread_rewards.dart new file mode 100644 index 0000000..b22e087 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/services/msg_collect_spread_rewards.dart @@ -0,0 +1,65 @@ +import 'package:blockchain_utils/numbers/numbers.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; + +import 'msg_collect_spread_rewards_response.dart'; + +class OsmosisConcentratedLiquidityMsgCollectSpreadRewards extends CosmosMessage + with + ServiceMessage< + OsmosisConcentratedLiquidityMsgCollectSpreadRewardsResponse> { + final List? positionIds; + final String? sender; + + OsmosisConcentratedLiquidityMsgCollectSpreadRewards( + {List? positionIds, this.sender}) + : positionIds = positionIds?.nullOnEmpy; + factory OsmosisConcentratedLiquidityMsgCollectSpreadRewards.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityMsgCollectSpreadRewards( + positionIds: decode + .getResult(1) + ?.to, List>( + (e) => e.map((e) => BigintUtils.parse(e)).toList()) ?? + [], + sender: decode.getField(2), + ); + } + + @override + List get fieldIds => [1, 2]; + + @override + Map toJson() { + return { + "sender": sender, + "position_ids": positionIds?.map((e) => e.toString()).toList() + }; + } + + @override + List get values => [ + positionIds, + sender, + ]; + + @override + String get typeUrl => + OsmosisConcentratedLiquidityV1beta1Types.msgCollectSpreadRewards.typeUrl; + + @override + OsmosisConcentratedLiquidityMsgCollectSpreadRewardsResponse onResponse( + List bytes) { + return OsmosisConcentratedLiquidityMsgCollectSpreadRewardsResponse + .deserialize(bytes); + } + + @override + String get service => + OsmosisConcentratedLiquidityV1beta1Types.collectSpreadRewards.typeUrl; + + @override + List get signers => [sender]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/services/msg_collect_spread_rewards_response.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/services/msg_collect_spread_rewards_response.dart new file mode 100644 index 0000000..6fed5b5 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/services/msg_collect_spread_rewards_response.dart @@ -0,0 +1,46 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/models/sdk_v1beta1/cosmos_base_v1beta1/cosmos_base_v1beta1.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; + +/// Position contains position's id, address, pool id, lower tick, upper tick join time, and liquidity. +class OsmosisConcentratedLiquidityMsgCollectSpreadRewardsResponse + extends CosmosMessage { + final List collectedSpreadRewards; + + OsmosisConcentratedLiquidityMsgCollectSpreadRewardsResponse( + List collectedSpreadRewards) + : collectedSpreadRewards = collectedSpreadRewards.mutable; + factory OsmosisConcentratedLiquidityMsgCollectSpreadRewardsResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityMsgCollectSpreadRewardsResponse( + decode.getFields(1).map((e) => Coin.deserialize(e)).toList()); + } + factory OsmosisConcentratedLiquidityMsgCollectSpreadRewardsResponse.fromRpc( + Map json) { + return OsmosisConcentratedLiquidityMsgCollectSpreadRewardsResponse( + (json["collected_spread_rewards"] as List?) + ?.map((e) => Coin.fromRpc(e)) + .toList() ?? + []); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return { + "collected_spread_rewards": + collectedSpreadRewards.map((e) => e.toJson()).toList() + }; + } + + @override + List get values => [collectedSpreadRewards]; + + @override + String get typeUrl => OsmosisConcentratedLiquidityV1beta1Types + .msgCollectSpreadRewardsResponse.typeUrl; +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/services/msg_create_position.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/services/msg_create_position.dart new file mode 100644 index 0000000..6d99cb1 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/services/msg_create_position.dart @@ -0,0 +1,89 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/models/sdk_v1beta1/cosmos_base_v1beta1/messages/coin.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; + +import 'msg_create_position_response.dart'; + +class OsmosisConcentratedLiquidityMsgCreatePosition extends CosmosMessage + with ServiceMessage { + final BigInt? poolId; + final String? sender; + final BigInt? lowerTick; + final BigInt? upperTick; + + /// tokens_provided is the amount of tokens provided for the position. + /// It must at a minimum be of length 1 (for a single sided position) + /// and at a maximum be of length 2 (for a position that straddles the current + /// tick). + final List tokensProvided; + final BigInt tokenMinAmount0; + final BigInt tokenMinAmount1; + OsmosisConcentratedLiquidityMsgCreatePosition( + {this.poolId, + this.sender, + this.lowerTick, + this.upperTick, + required List tokensProvided, + required this.tokenMinAmount0, + required this.tokenMinAmount1}) + : tokensProvided = tokensProvided.mutable; + factory OsmosisConcentratedLiquidityMsgCreatePosition.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityMsgCreatePosition( + poolId: decode.getField(1), + sender: decode.getField(2), + lowerTick: decode.getField(3), + upperTick: decode.getField(4), + tokensProvided: + decode.getFields(5).map((e) => Coin.deserialize(e)).toList(), + tokenMinAmount0: BigInt.parse(decode.getField(6)), + tokenMinAmount1: BigInt.parse(decode.getField(7))); + } + + @override + List get fieldIds => [1, 2, 3, 4, 5, 6, 7]; + + @override + Map toJson() { + return { + "pool_id": poolId?.toString(), + "sender": sender, + "lower_tick": lowerTick?.toString(), + "upper_tick": upperTick?.toString(), + "tokens_provided": tokensProvided.map((e) => e.toJson()).toList(), + "token_min_amount0": tokenMinAmount0.toString(), + "token_min_amount1": tokenMinAmount1.toString() + }; + } + + @override + List get values => [ + poolId, + sender, + lowerTick, + upperTick, + tokensProvided, + tokenMinAmount0.toString(), + tokenMinAmount1.toString() + ]; + + @override + String get typeUrl => + OsmosisConcentratedLiquidityV1beta1Types.msgCreatePosition.typeUrl; + + @override + OsmosisConcentratedLiquidityMsgCreatePositionResponse onResponse( + List bytes) { + return OsmosisConcentratedLiquidityMsgCreatePositionResponse.deserialize( + bytes); + } + + @override + String get service => + OsmosisConcentratedLiquidityV1beta1Types.createPosition.typeUrl; + + @override + List get signers => [sender]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/services/msg_create_position_response.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/services/msg_create_position_response.dart new file mode 100644 index 0000000..da782cd --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/services/msg_create_position_response.dart @@ -0,0 +1,77 @@ +import 'package:blockchain_utils/numbers/bigint_utils.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +/// Position contains position's id, address, pool id, lower tick, upper tick join time, and liquidity. +class OsmosisConcentratedLiquidityMsgCreatePositionResponse + extends CosmosMessage { + final BigInt? positionId; + final BigInt amount0; + final BigInt amount1; + final String liquidityCreated; + + /// the lower and upper tick are in the response because there are + /// instances in which multiple ticks represent the same price, so + /// we may move their provided tick to the canonical tick that represents + /// the same price. + final BigInt? lowerTick; + final BigInt? upperTick; + + OsmosisConcentratedLiquidityMsgCreatePositionResponse( + {this.positionId, + required this.amount0, + required this.amount1, + required this.liquidityCreated, + this.lowerTick, + this.upperTick}); + factory OsmosisConcentratedLiquidityMsgCreatePositionResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityMsgCreatePositionResponse( + positionId: decode.getField(1), + amount0: BigInt.parse(decode.getField(2)), + amount1: BigInt.parse(decode.getField(3)), + liquidityCreated: decode.getField(5), + lowerTick: decode.getField(6), + upperTick: decode.getField(7)); + } + factory OsmosisConcentratedLiquidityMsgCreatePositionResponse.fromRpc( + Map json) { + return OsmosisConcentratedLiquidityMsgCreatePositionResponse( + positionId: BigintUtils.tryParse(json["position_id"]), + amount0: BigintUtils.parse(json["amount0"]), + amount1: BigintUtils.parse(json["amount1"]), + liquidityCreated: json["liquidity_created"], + lowerTick: BigintUtils.tryParse(json["lower_tick"]), + upperTick: BigintUtils.tryParse(json["upper_tick"])); + } + + @override + List get fieldIds => [1, 2, 3, 5, 6, 7]; + + @override + Map toJson() { + return { + "position_id": positionId?.toString(), + "amount0": amount0.toString(), + "amount1": amount1.toString(), + "liquidity_created": liquidityCreated, + "lower_tick": lowerTick?.toString(), + "upper_tick": upperTick?.toString() + }; + } + + @override + List get values => [ + positionId, + amount0.toString(), + amount1.toString(), + liquidityCreated, + lowerTick, + upperTick + ]; + + @override + String get typeUrl => OsmosisConcentratedLiquidityV1beta1Types + .msgCreatePositionResponse.typeUrl; +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/services/msg_transfer_positions.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/services/msg_transfer_positions.dart new file mode 100644 index 0000000..ffbf7ab --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/services/msg_transfer_positions.dart @@ -0,0 +1,60 @@ +import 'package:blockchain_utils/numbers/numbers.dart'; +import 'package:cosmos_sdk/src/models/global_messages/service_empty_response.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; + +class OsmosisConcentratedLiquidityMsgCollectSpreadRewards extends CosmosMessage + with ServiceMessage { + final List? positionIds; + final String? sender; + final String? newOwner; + + OsmosisConcentratedLiquidityMsgCollectSpreadRewards( + {List? positionIds, this.sender, this.newOwner}) + : positionIds = positionIds?.nullOnEmpy; + factory OsmosisConcentratedLiquidityMsgCollectSpreadRewards.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityMsgCollectSpreadRewards( + positionIds: decode + .getResult(1) + ?.to, List>( + (e) => e.map((e) => BigintUtils.parse(e)).toList()) ?? + [], + sender: decode.getField(2), + newOwner: decode.getField(3)); + } + + @override + List get fieldIds => [1, 2, 3]; + + @override + Map toJson() { + return { + "sender": sender, + "position_ids": positionIds?.map((e) => e.toString()).toList(), + "new_owner": newOwner + }; + } + + @override + List get values => [positionIds, sender, newOwner]; + + @override + String get typeUrl => + OsmosisConcentratedLiquidityV1beta1Types.msgTransferPositions.typeUrl; + + @override + EmptyServiceRequestResponse onResponse(List bytes) { + return EmptyServiceRequestResponse(OsmosisConcentratedLiquidityV1beta1Types + .msgTransferPositionsResponse.typeUrl); + } + + @override + String get service => + OsmosisConcentratedLiquidityV1beta1Types.transferPositions.typeUrl; + + @override + List get signers => [sender]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/services/msg_withdraw_position.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/services/msg_withdraw_position.dart new file mode 100644 index 0000000..330356e --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/services/msg_withdraw_position.dart @@ -0,0 +1,56 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'msg_withdraw_position_response.dart'; + +class OsmosisConcentratedLiquidityMsgWithdrawPosition extends CosmosMessage + with + ServiceMessage< + OsmosisConcentratedLiquidityMsgWithdrawPositionResponse> { + final BigInt? positionId; + final String? sender; + final String liquidityAmount; + + OsmosisConcentratedLiquidityMsgWithdrawPosition( + {this.positionId, this.sender, required this.liquidityAmount}); + factory OsmosisConcentratedLiquidityMsgWithdrawPosition.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityMsgWithdrawPosition( + positionId: decode.getField(1), + sender: decode.getField(2), + liquidityAmount: decode.getField(3)); + } + + @override + List get fieldIds => [1, 2, 3]; + + @override + Map toJson() { + return { + "position_id": positionId?.toString(), + "sender": sender, + "liquidity_amount": liquidityAmount + }; + } + + @override + List get values => [positionId, sender, liquidityAmount]; + + @override + String get typeUrl => + OsmosisConcentratedLiquidityV1beta1Types.msgWithdrawPosition.typeUrl; + + @override + OsmosisConcentratedLiquidityMsgWithdrawPositionResponse onResponse( + List bytes) { + return OsmosisConcentratedLiquidityMsgWithdrawPositionResponse.deserialize( + bytes); + } + + @override + String get service => + OsmosisConcentratedLiquidityV1beta1Types.withdrawPosition.typeUrl; + + @override + List get signers => [sender]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/services/msg_withdraw_position_response.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/services/msg_withdraw_position_response.dart new file mode 100644 index 0000000..afd1a34 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/services/msg_withdraw_position_response.dart @@ -0,0 +1,44 @@ +import 'package:blockchain_utils/numbers/bigint_utils.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +/// Position contains position's id, address, pool id, lower tick, upper tick join time, and liquidity. +class OsmosisConcentratedLiquidityMsgWithdrawPositionResponse + extends CosmosMessage { + final BigInt amount0; + final BigInt amount1; + + OsmosisConcentratedLiquidityMsgWithdrawPositionResponse( + {required this.amount0, required this.amount1}); + factory OsmosisConcentratedLiquidityMsgWithdrawPositionResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityMsgWithdrawPositionResponse( + amount0: BigInt.parse(decode.getField(2)), + amount1: BigInt.parse(decode.getField(3))); + } + factory OsmosisConcentratedLiquidityMsgWithdrawPositionResponse.fromRpc( + Map json) { + return OsmosisConcentratedLiquidityMsgWithdrawPositionResponse( + amount0: BigintUtils.parse(json["amount0"]), + amount1: BigintUtils.parse(json["amount1"])); + } + + @override + List get fieldIds => [1, 2]; + + @override + Map toJson() { + return {"amount0": amount0.toString(), "amount1": amount1.toString()}; + } + + @override + List get values => [ + amount0.toString(), + amount1.toString(), + ]; + + @override + String get typeUrl => OsmosisConcentratedLiquidityV1beta1Types + .msgWithdrawPositionResponse.typeUrl; +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/types/types.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/types/types.dart new file mode 100644 index 0000000..e4da25f --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/types/types.dart @@ -0,0 +1,187 @@ +import 'package:cosmos_sdk/src/models/core/type_url/type_url.dart'; + +class OsmosisConcentratedLiquidityV1beta1Types extends TypeUrl { + @override + final String typeUrl; + @override + final String? rpc; + const OsmosisConcentratedLiquidityV1beta1Types._(this.typeUrl, {this.rpc}); + static const OsmosisConcentratedLiquidityV1beta1Types uptimeTrackers = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.UptimeTrackers"); + static const OsmosisConcentratedLiquidityV1beta1Types uptimeTracker = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.UptimeTracker"); + static const OsmosisConcentratedLiquidityV1beta1Types + poolIdToTickSpacingRecord = OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.PoolIdToTickSpacingRecord"); + static const OsmosisConcentratedLiquidityV1beta1Types poolRecord = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.PoolRecord"); + + static const OsmosisConcentratedLiquidityV1beta1Types + tickSpacingDecreaseProposal = OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.TickSpacingDecreaseProposal"); + + static const OsmosisConcentratedLiquidityV1beta1Types tickLiquidityNet = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.TickLiquidityNet"); + + static const OsmosisConcentratedLiquidityV1beta1Types tickInfo = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.TickInfo"); + + static const OsmosisConcentratedLiquidityV1beta1Types position = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.Position"); + + static const OsmosisConcentratedLiquidityV1beta1Types positionData = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.PositionData"); + + static const OsmosisConcentratedLiquidityV1beta1Types positionWithPeriodLock = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.PositionWithPeriodLock"); + static const OsmosisConcentratedLiquidityV1beta1Types fullTick = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.FullTick"); + + static const OsmosisConcentratedLiquidityV1beta1Types accumObject = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.AccumObject"); + + static const OsmosisConcentratedLiquidityV1beta1Types incentiveRecordBody = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.IncentiveRecordBody"); + + static const OsmosisConcentratedLiquidityV1beta1Types + liquidityDepthWithRange = OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.LiquidityDepthWithRange"); + static const OsmosisConcentratedLiquidityV1beta1Types incentiveRecord = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.IncentiveRecord"); + static const OsmosisConcentratedLiquidityV1beta1Types poolData = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.PoolData"); + static const OsmosisConcentratedLiquidityV1beta1Types genesisState = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.GenesisState"); + + static const OsmosisConcentratedLiquidityV1beta1Types msgCreatePosition = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.MsgCreatePosition"); + static const OsmosisConcentratedLiquidityV1beta1Types + msgCreatePositionResponse = OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.msgCreatePositionResponse"); + + static const OsmosisConcentratedLiquidityV1beta1Types msgWithdrawPosition = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.MsgWithdrawPosition"); + static const OsmosisConcentratedLiquidityV1beta1Types + msgWithdrawPositionResponse = OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.MsgWithdrawPositionResponse"); + + static const OsmosisConcentratedLiquidityV1beta1Types msgAddToPosition = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.MsgAddToPosition"); + static const OsmosisConcentratedLiquidityV1beta1Types + msgAddToPositionResponse = OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.MsgAddToPositionResponse"); + + static const OsmosisConcentratedLiquidityV1beta1Types + msgCollectSpreadRewards = OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.MsgCollectSpreadRewards"); + static const OsmosisConcentratedLiquidityV1beta1Types + msgCollectSpreadRewardsResponse = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.MsgCollectSpreadRewardsResponse"); + + static const OsmosisConcentratedLiquidityV1beta1Types msgCollectIncentives = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.MsgCollectIncentives"); + static const OsmosisConcentratedLiquidityV1beta1Types + msgCollectIncentivesResponse = OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.MsgCollectIncentivesResponse"); + + static const OsmosisConcentratedLiquidityV1beta1Types msgTransferPositions = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.MsgTransferPositions"); + static const OsmosisConcentratedLiquidityV1beta1Types + msgTransferPositionsResponse = OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.MsgTransferPositionsResponse"); + + static const OsmosisConcentratedLiquidityV1beta1Types poolsRequest = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.PoolsRequest"); + static const OsmosisConcentratedLiquidityV1beta1Types poolsResponse = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.PoolsResponse"); + + static const OsmosisConcentratedLiquidityV1beta1Types fullPositionBreakdown = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.FullPositionBreakdown"); + + static const OsmosisConcentratedLiquidityV1beta1Types paramsRequest = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.ParamsRequest"); + static const OsmosisConcentratedLiquidityV1beta1Types paramsResponse = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.ParamsResponse"); + + static const OsmosisConcentratedLiquidityV1beta1Types userPositionsRequest = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.UserPositionsRequest"); + static const OsmosisConcentratedLiquidityV1beta1Types userPositionsResponse = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.UserPositionsResponse"); + + static const OsmosisConcentratedLiquidityV1beta1Types + liquidityPerTickRangeRequest = OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.LiquidityPerTickRangeRequest"); + static const OsmosisConcentratedLiquidityV1beta1Types + liquidityPerTickRangeResponse = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.LiquidityPerTickRangeResponse"); + + /// query + static const OsmosisConcentratedLiquidityV1beta1Types + liquidityDepthWithRangeQuery = OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.Query/LiquidityDepthWithRange", + rpc: + "/osmosis/concentratedliquidity/v1beta1/liquidity_per_tick_range"); + static const OsmosisConcentratedLiquidityV1beta1Types userPositions = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.Query/UserPositions", + rpc: "/osmosis/concentratedliquidity/v1beta1/positions/:address"); + static const OsmosisConcentratedLiquidityV1beta1Types params = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.Query/Params", + rpc: "/osmosis/concentratedliquidity/v1beta1/params"); + + static const OsmosisConcentratedLiquidityV1beta1Types pools = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.Query/Pools", + rpc: "/osmosis/concentratedliquidity/v1beta1/pools"); + + /// services + static const OsmosisConcentratedLiquidityV1beta1Types transferPositions = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.Msg/TransferPositions"); + static const OsmosisConcentratedLiquidityV1beta1Types collectIncentives = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.Msg/CollectIncentives"); + + static const OsmosisConcentratedLiquidityV1beta1Types collectSpreadRewards = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.Msg/CollectSpreadRewards"); + + static const OsmosisConcentratedLiquidityV1beta1Types addToPosition = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.Msg/AddToPosition"); + static const OsmosisConcentratedLiquidityV1beta1Types withdrawPosition = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.Msg/WithdrawPosition"); + static const OsmosisConcentratedLiquidityV1beta1Types createPosition = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.Msg/CreatePosition"); +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentratedliquidity/messages/params.dart b/lib/src/models/networks/osmosis/osmosis_concentratedliquidity/messages/params.dart new file mode 100644 index 0000000..1e7ac40 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentratedliquidity/messages/params.dart @@ -0,0 +1,135 @@ +import 'package:blockchain_utils/numbers/numbers.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentratedliquidity/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; + +class OsmosisConcentratedLiquidityParams extends CosmosMessage { + /// [authorizedTickSpacing] is an array of uint64s that represents the tick + /// spacing values concentrated-liquidity pools can be created with. For + /// example, an authorized_tick_spacing of [1, 10, 30] allows for pools + /// to be created with tick spacing of 1, 10, or 30. + final List? authorizedTickSpacing; + final List authorizedSpreadFactors; + + /// [balancerSharesRewardDiscount] is the rate by which incentives flowing + /// from CL to Balancer pools will be discounted to encourage LPs to migrate. + /// e.g. a rate of 0.05 means Balancer LPs get 5% less incentives than full + /// range CL LPs. + /// This field can range from (0,1]. If set to 1, it indicates that all + /// incentives stay at cl pool. + final String balancerSharesRewardDiscount; + + /// authorized_quote_denoms is a list of quote denoms that can be used as + /// token1 when creating a pool. We limit the quote assets to a small set for + /// the purposes of having convinient price increments stemming from tick to + /// price conversion. These increments are in a human readable magnitude only + /// for token1 as a quote. For limit orders in the future, this will be a + /// desirable property in terms of UX as to allow users to set limit orders at + /// prices in terms of token1 (quote asset) that are easy to reason about. + final List? authorizedQuoteDenoms; + final List authorizedUptimes; + + /// is_permissionless_pool_creation_enabled is a boolean that determines if + /// concentrated liquidity pools can be created via message. At launch, + /// we consider allowing only governance to create pools, and then later + /// allowing permissionless pool creation by switching this flag to true + /// with a governance proposal. + final bool? isPermissionlessPoolCreationEnabled; + + /// unrestricted_pool_creator_whitelist is a list of addresses that are + /// allowed to bypass restrictions on permissionless supercharged pool + /// creation, like pool_creation_enabled, restricted quote assets, no + /// double creation of pools, etc. + final List? unrestrictedPoolCreatorWhitelist; + final BigInt? hookGasLimit; + OsmosisConcentratedLiquidityParams( + {List? authorizedTickSpacing, + required List authorizedSpreadFactors, + required this.balancerSharesRewardDiscount, + List? authorizedQuoteDenoms, + required List authorizedUptimes, + this.isPermissionlessPoolCreationEnabled, + List? unrestrictedPoolCreatorWhitelist, + this.hookGasLimit}) + : authorizedTickSpacing = authorizedTickSpacing?.nullOnEmpy, + authorizedSpreadFactors = authorizedSpreadFactors.mutable, + authorizedQuoteDenoms = authorizedQuoteDenoms?.nullOnEmpy, + authorizedUptimes = authorizedUptimes.mutable, + unrestrictedPoolCreatorWhitelist = + unrestrictedPoolCreatorWhitelist?.nullOnEmpy; + factory OsmosisConcentratedLiquidityParams.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityParams( + authorizedTickSpacing: decode + .getResult(1) + ?.to, List>( + (e) => e.map((e) => BigintUtils.parse(e)).toList()) ?? + [], + authorizedSpreadFactors: decode.getFields(2), + balancerSharesRewardDiscount: decode.getField(3), + authorizedQuoteDenoms: decode.getFields(4), + authorizedUptimes: decode + .getFields(5) + .map((e) => ProtobufDuration.deserialize(e)) + .toList(), + isPermissionlessPoolCreationEnabled: decode.getField(6), + unrestrictedPoolCreatorWhitelist: decode.getFields(7), + hookGasLimit: decode.getField(8)); + } + factory OsmosisConcentratedLiquidityParams.fromRpc( + Map json) { + return OsmosisConcentratedLiquidityParams( + authorizedTickSpacing: (json["authorized_tick_spacing"] as List?) + ?.map((e) => BigintUtils.parse(e)) + .toList(), + authorizedSpreadFactors: + (json["authorized_spread_factors"] as List?)?.cast() ?? [], + balancerSharesRewardDiscount: json["balancer_shares_reward_discount"], + authorizedQuoteDenoms: + (json["authorized_quote_denoms"] as List?)?.cast() ?? [], + authorizedUptimes: (json["authorized_uptimes"] as List?) + ?.map((e) => ProtobufDuration.fromString(e)) + .toList() ?? + [], + hookGasLimit: BigintUtils.tryParse(json["hook_gas_limit"]), + isPermissionlessPoolCreationEnabled: + json["is_permissionless_pool_creation_enabled"], + unrestrictedPoolCreatorWhitelist: + (json["unrestricted_pool_creator_whitelist"] as List?)?.cast() ?? + []); + } + + @override + List get fieldIds => [1, 2, 3, 4, 5, 6, 7, 8]; + + @override + Map toJson() { + return { + "authorized_tick_spacing": + authorizedTickSpacing?.map((e) => e.toString()).toList(), + "authorized_spread_factors": authorizedSpreadFactors, + "balancer_shares_reward_discount": balancerSharesRewardDiscount, + "authorized_quote_denoms": authorizedQuoteDenoms, + "authorized_uptimes": authorizedUptimes.map((e) => e.toJson()).toList(), + "is_permissionless_pool_creation_enabled": + isPermissionlessPoolCreationEnabled, + "unrestricted_pool_creator_whitelist": unrestrictedPoolCreatorWhitelist, + "hook_gas_limit": hookGasLimit?.toString() + }; + } + + @override + String get typeUrl => OsmosisConcentratedLiquidityTypes.params.typeUrl; + + @override + List get values => [ + authorizedTickSpacing, + authorizedSpreadFactors, + balancerSharesRewardDiscount, + authorizedQuoteDenoms, + authorizedUptimes, + isPermissionlessPoolCreationEnabled, + unrestrictedPoolCreatorWhitelist, + hookGasLimit + ]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentratedliquidity/osmosis_concentratedliquidity.dart b/lib/src/models/networks/osmosis/osmosis_concentratedliquidity/osmosis_concentratedliquidity.dart new file mode 100644 index 0000000..3216693 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentratedliquidity/osmosis_concentratedliquidity.dart @@ -0,0 +1 @@ +export 'messages/params.dart'; diff --git a/lib/src/models/networks/osmosis/osmosis_concentratedliquidity/types/types.dart b/lib/src/models/networks/osmosis/osmosis_concentratedliquidity/types/types.dart new file mode 100644 index 0000000..54ed81a --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentratedliquidity/types/types.dart @@ -0,0 +1,13 @@ +import 'package:cosmos_sdk/src/models/core/type_url/type_url.dart'; + +class OsmosisConcentratedLiquidityTypes extends TypeUrl { + @override + final String typeUrl; + @override + final String? rpc = null; + const OsmosisConcentratedLiquidityTypes._(this.typeUrl); + + static const OsmosisConcentratedLiquidityTypes params = + OsmosisConcentratedLiquidityTypes._( + "/osmosis.concentratedliquidity.Params"); +} diff --git a/lib/src/models/networks/osmosis/omosis_epochs_v1beta1/messages/epoch_info.dart b/lib/src/models/networks/osmosis/osmosis_epochs_v1beta1/messages/epoch_info.dart similarity index 98% rename from lib/src/models/networks/osmosis/omosis_epochs_v1beta1/messages/epoch_info.dart rename to lib/src/models/networks/osmosis/osmosis_epochs_v1beta1/messages/epoch_info.dart index 6698563..f378366 100644 --- a/lib/src/models/networks/osmosis/omosis_epochs_v1beta1/messages/epoch_info.dart +++ b/lib/src/models/networks/osmosis/osmosis_epochs_v1beta1/messages/epoch_info.dart @@ -1,5 +1,5 @@ import 'package:blockchain_utils/numbers/numbers.dart'; -import 'package:cosmos_sdk/src/models/networks/osmosis/omosis_epochs_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_epochs_v1beta1/types/types.dart'; import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; /// EpochInfo is a struct that describes the data going into a timer defined by the x/epochs module. diff --git a/lib/src/models/networks/osmosis/omosis_epochs_v1beta1/messages/senesis_state.dart b/lib/src/models/networks/osmosis/osmosis_epochs_v1beta1/messages/senesis_state.dart similarity index 91% rename from lib/src/models/networks/osmosis/omosis_epochs_v1beta1/messages/senesis_state.dart rename to lib/src/models/networks/osmosis/osmosis_epochs_v1beta1/messages/senesis_state.dart index fbabb43..4959579 100644 --- a/lib/src/models/networks/osmosis/omosis_epochs_v1beta1/messages/senesis_state.dart +++ b/lib/src/models/networks/osmosis/osmosis_epochs_v1beta1/messages/senesis_state.dart @@ -1,4 +1,4 @@ -import 'package:cosmos_sdk/src/models/networks/osmosis/omosis_epochs_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_epochs_v1beta1/types/types.dart'; import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; diff --git a/lib/src/models/networks/osmosis/omosis_epochs_v1beta1/omosis_epochs_v1beta1.dart b/lib/src/models/networks/osmosis/osmosis_epochs_v1beta1/omosis_epochs_v1beta1.dart similarity index 100% rename from lib/src/models/networks/osmosis/omosis_epochs_v1beta1/omosis_epochs_v1beta1.dart rename to lib/src/models/networks/osmosis/osmosis_epochs_v1beta1/omosis_epochs_v1beta1.dart diff --git a/lib/src/models/networks/osmosis/omosis_epochs_v1beta1/query/query_current_epoch_request.dart b/lib/src/models/networks/osmosis/osmosis_epochs_v1beta1/query/query_current_epoch_request.dart similarity index 93% rename from lib/src/models/networks/osmosis/omosis_epochs_v1beta1/query/query_current_epoch_request.dart rename to lib/src/models/networks/osmosis/osmosis_epochs_v1beta1/query/query_current_epoch_request.dart index a9bf33c..52ffd77 100644 --- a/lib/src/models/networks/osmosis/omosis_epochs_v1beta1/query/query_current_epoch_request.dart +++ b/lib/src/models/networks/osmosis/osmosis_epochs_v1beta1/query/query_current_epoch_request.dart @@ -1,4 +1,4 @@ -import 'package:cosmos_sdk/src/models/networks/osmosis/omosis_epochs_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_epochs_v1beta1/types/types.dart'; import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; import 'query_current_epoch_response.dart'; diff --git a/lib/src/models/networks/osmosis/omosis_epochs_v1beta1/query/query_current_epoch_response.dart b/lib/src/models/networks/osmosis/osmosis_epochs_v1beta1/query/query_current_epoch_response.dart similarity index 91% rename from lib/src/models/networks/osmosis/omosis_epochs_v1beta1/query/query_current_epoch_response.dart rename to lib/src/models/networks/osmosis/osmosis_epochs_v1beta1/query/query_current_epoch_response.dart index 781c900..cd39244 100644 --- a/lib/src/models/networks/osmosis/omosis_epochs_v1beta1/query/query_current_epoch_response.dart +++ b/lib/src/models/networks/osmosis/osmosis_epochs_v1beta1/query/query_current_epoch_response.dart @@ -1,5 +1,5 @@ import 'package:blockchain_utils/numbers/bigint_utils.dart'; -import 'package:cosmos_sdk/src/models/networks/osmosis/omosis_epochs_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_epochs_v1beta1/types/types.dart'; import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; class OmosisEpochsQueryCurrentEpochResponse extends CosmosMessage { diff --git a/lib/src/models/networks/osmosis/omosis_epochs_v1beta1/query/query_epochs_info_request.dart b/lib/src/models/networks/osmosis/osmosis_epochs_v1beta1/query/query_epochs_info_request.dart similarity index 92% rename from lib/src/models/networks/osmosis/omosis_epochs_v1beta1/query/query_epochs_info_request.dart rename to lib/src/models/networks/osmosis/osmosis_epochs_v1beta1/query/query_epochs_info_request.dart index 9167995..51226cf 100644 --- a/lib/src/models/networks/osmosis/omosis_epochs_v1beta1/query/query_epochs_info_request.dart +++ b/lib/src/models/networks/osmosis/osmosis_epochs_v1beta1/query/query_epochs_info_request.dart @@ -1,4 +1,4 @@ -import 'package:cosmos_sdk/src/models/networks/osmosis/omosis_epochs_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_epochs_v1beta1/types/types.dart'; import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; import 'query_epochs_info_response.dart'; diff --git a/lib/src/models/networks/osmosis/omosis_epochs_v1beta1/query/query_epochs_info_response.dart b/lib/src/models/networks/osmosis/osmosis_epochs_v1beta1/query/query_epochs_info_response.dart similarity index 84% rename from lib/src/models/networks/osmosis/omosis_epochs_v1beta1/query/query_epochs_info_response.dart rename to lib/src/models/networks/osmosis/osmosis_epochs_v1beta1/query/query_epochs_info_response.dart index 1030c37..11714e8 100644 --- a/lib/src/models/networks/osmosis/omosis_epochs_v1beta1/query/query_epochs_info_response.dart +++ b/lib/src/models/networks/osmosis/osmosis_epochs_v1beta1/query/query_epochs_info_response.dart @@ -1,5 +1,5 @@ -import 'package:cosmos_sdk/src/models/networks/osmosis/omosis_epochs_v1beta1/messages/epoch_info.dart'; -import 'package:cosmos_sdk/src/models/networks/osmosis/omosis_epochs_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_epochs_v1beta1/messages/epoch_info.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_epochs_v1beta1/types/types.dart'; import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; class OmosisEpochsQueryEpochsInfoResponse extends CosmosMessage { diff --git a/lib/src/models/networks/osmosis/omosis_epochs_v1beta1/types/types.dart b/lib/src/models/networks/osmosis/osmosis_epochs_v1beta1/types/types.dart similarity index 100% rename from lib/src/models/networks/osmosis/omosis_epochs_v1beta1/types/types.dart rename to lib/src/models/networks/osmosis/osmosis_epochs_v1beta1/types/types.dart diff --git a/lib/src/models/networks/osmosis/osmosis_gamm_poolmodels_stableswap_v1beta1/messages/pool.dart b/lib/src/models/networks/osmosis/osmosis_gamm_poolmodels_stableswap_v1beta1/messages/pool.dart index b265b64..98ae535 100644 --- a/lib/src/models/networks/osmosis/osmosis_gamm_poolmodels_stableswap_v1beta1/messages/pool.dart +++ b/lib/src/models/networks/osmosis/osmosis_gamm_poolmodels_stableswap_v1beta1/messages/pool.dart @@ -1,4 +1,6 @@ +import 'package:blockchain_utils/exception/exceptions.dart'; import 'package:blockchain_utils/numbers/numbers.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_gamm_poolmodels_stableswap_v1beta1/messages/pool_params.dart'; import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_gamm_poolmodels_stableswap_v1beta1/types/types.dart'; import 'package:cosmos_sdk/src/models/sdk_v1beta1/cosmos_base_v1beta1/cosmos_base_v1beta1.dart'; import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; @@ -8,7 +10,7 @@ import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; class OsmosisGammPoolmodelsStableSwapPool extends CosmosMessage { final String? address; final BigInt? id; - final OsmosisGammPoolmodelsStableSwapPool poolParams; + final OsmosisGammPoolmodelsStableSwapPoolParams poolParams; /// This string specifies who will govern the pool in the future. /// Valid forms of this are: @@ -45,16 +47,21 @@ class OsmosisGammPoolmodelsStableSwapPool extends CosmosMessage { scalingFactor = scalingFactor.mutable; factory OsmosisGammPoolmodelsStableSwapPool.deserialize(List bytes) { final decode = CosmosProtocolBuffer.decode(bytes); + print("sevent ${decode.getFields(7)}"); return OsmosisGammPoolmodelsStableSwapPool( address: decode.getField(1), id: decode.getField(2), - poolParams: - OsmosisGammPoolmodelsStableSwapPool.deserialize(decode.getField(3)), + poolParams: OsmosisGammPoolmodelsStableSwapPoolParams.deserialize( + decode.getField(3)), futurePoolGovernor: decode.getField(4), totalShares: Coin.deserialize(decode.getField(5)), poolLiquidity: decode.getFields(6).map((e) => Coin.deserialize(e)).toList(), - scalingFactor: decode.getFields(7), + scalingFactor: decode + .getResult(7) + ?.to, List>( + (e) => e.map((e) => BigintUtils.parse(e)).toList()) ?? + [], scalingFactorController: decode.getField(8)); } factory OsmosisGammPoolmodelsStableSwapPool.fromRpc( @@ -62,8 +69,8 @@ class OsmosisGammPoolmodelsStableSwapPool extends CosmosMessage { return OsmosisGammPoolmodelsStableSwapPool( address: json["address"], id: BigintUtils.tryParse(json["id"]), - poolParams: - OsmosisGammPoolmodelsStableSwapPool.fromRpc(json["pool_params"]), + poolParams: OsmosisGammPoolmodelsStableSwapPoolParams.fromRpc( + json["pool_params"]), futurePoolGovernor: json["future_pool_governor"], totalShares: Coin.fromRpc(json["total_shares"]), poolLiquidity: (json["pool_liquidity"] as List?) @@ -77,6 +84,16 @@ class OsmosisGammPoolmodelsStableSwapPool extends CosmosMessage { scalingFactorController: json["scaling_factor_controller"], ); } + factory OsmosisGammPoolmodelsStableSwapPool.fromAny(Any any) { + if (any.typeUrl != + OsmosisGammPoolmodelsStableswaPV1beta1Types.pool.typeUrl) { + throw MessageException("Invalid type url.", details: { + "excepted": OsmosisGammPoolmodelsStableswaPV1beta1Types.pool.typeUrl, + "type_url": any.typeUrl + }); + } + return OsmosisGammPoolmodelsStableSwapPool.deserialize(any.value); + } @override List get fieldIds => [1, 2, 3, 4, 5, 6, 7, 8]; diff --git a/lib/src/models/networks/osmosis/osmosis_gamm_poolmodels_stableswap_v1beta1/services/msg_create_stable_swap_pool.dart b/lib/src/models/networks/osmosis/osmosis_gamm_poolmodels_stableswap_v1beta1/services/msg_create_stable_swap_pool.dart index 12b2862..87daa2f 100644 --- a/lib/src/models/networks/osmosis/osmosis_gamm_poolmodels_stableswap_v1beta1/services/msg_create_stable_swap_pool.dart +++ b/lib/src/models/networks/osmosis/osmosis_gamm_poolmodels_stableswap_v1beta1/services/msg_create_stable_swap_pool.dart @@ -1,3 +1,4 @@ +import 'package:blockchain_utils/numbers/numbers.dart'; import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_gamm_poolmodels_stableswap_v1beta1/types/types.dart'; import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_gamm_v1beta1/messages/pool_params.dart'; import 'package:cosmos_sdk/src/models/sdk_v1beta1/cosmos_base_v1beta1/messages/coin.dart'; @@ -36,7 +37,11 @@ class OsmosisGammPoolmodelsStableSwapMsgCreateStableswapPool (e) => OsmosisGammPoolParams.deserialize(e)), initialPoolLiquidity: decode.getFields(3).map((e) => Coin.deserialize(e)).toList(), - scalingFactors: decode.getFields(4), + scalingFactors: decode + .getResult(4) + ?.to, List>( + (e) => e.map((e) => BigintUtils.parse(e)).toList()) ?? + [], futurePoolGovernor: decode.getField(5), scalingFactorController: decode.getField(6)); } diff --git a/lib/src/models/networks/osmosis/osmosis_gamm_poolmodels_stableswap_v1beta1/services/msg_stable_swap_adjust_scaling_factors.dart b/lib/src/models/networks/osmosis/osmosis_gamm_poolmodels_stableswap_v1beta1/services/msg_stable_swap_adjust_scaling_factors.dart index 6f952ee..29c8833 100644 --- a/lib/src/models/networks/osmosis/osmosis_gamm_poolmodels_stableswap_v1beta1/services/msg_stable_swap_adjust_scaling_factors.dart +++ b/lib/src/models/networks/osmosis/osmosis_gamm_poolmodels_stableswap_v1beta1/services/msg_stable_swap_adjust_scaling_factors.dart @@ -1,3 +1,4 @@ +import 'package:blockchain_utils/numbers/numbers.dart'; import 'package:cosmos_sdk/src/models/global_messages/service_empty_response.dart'; import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_gamm_poolmodels_stableswap_v1beta1/types/types.dart'; import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; @@ -19,7 +20,11 @@ class OsmosisGammPoolmodelsStableSwapMsgStableSwapAdjustScalingFactors return OsmosisGammPoolmodelsStableSwapMsgStableSwapAdjustScalingFactors( sender: decode.getField(1), poolId: decode.getField(2), - scalingFactors: decode.getFields(3), + scalingFactors: decode + .getResult(3) + ?.to, List>( + (e) => e.map((e) => BigintUtils.parse(e)).toList()) ?? + [], ); } diff --git a/lib/src/models/networks/osmosis/osmosis_gamm_v1beta1/messages/pool.dart b/lib/src/models/networks/osmosis/osmosis_gamm_v1beta1/messages/pool.dart new file mode 100644 index 0000000..758b8c3 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_gamm_v1beta1/messages/pool.dart @@ -0,0 +1,96 @@ +import 'package:blockchain_utils/blockchain_utils.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_gamm_v1beta1/messages/pool_asset.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_gamm_v1beta1/messages/pool_params.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_gamm_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/models/sdk_v1beta1/cosmos_base_v1beta1/messages/coin.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; + +class OsmosisGammPool extends CosmosMessage { + final String? address; + final BigInt? id; + final OsmosisGammPoolParams poolParams; + + /// This string specifies who will govern the pool in the future. + /// Valid forms of this are: + /// {token name},{duration} + /// {duration} + /// where {token name} if specified is the token which determines the + /// governor, and if not specified is the LP token for this pool.duration is + /// a time specified as 0w,1w,2w, etc. which specifies how long the token + /// would need to be locked up to count in governance. 0w means no lockup. + final String? futurePoolGovernor; + + /// sum of all LP tokens sent out + final Coin totalShares; + + /// These are assumed to be sorted by denomiation. + /// They contain the pool asset and the information about the weight + final List poolAssets; + + /// sum of all non-normalized pool weights + final String totalWeight; + + OsmosisGammPool( + {this.address, + this.id, + required this.poolParams, + this.futurePoolGovernor, + required this.totalShares, + required List poolAssets, + required this.totalWeight}) + : poolAssets = poolAssets.mutable; + factory OsmosisGammPool.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisGammPool( + address: decode.getField(1), + id: decode.getField(2), + poolParams: OsmosisGammPoolParams.deserialize(decode.getField(3)), + futurePoolGovernor: decode.getField(4), + totalShares: Coin.deserialize(decode.getField(5)), + poolAssets: decode + .getFields>(6) + .map((e) => OsmosisGammPoolAsset.deserialize(e)) + .toList(), + totalWeight: decode.getField(7)); + } + factory OsmosisGammPool.fromAny(Any any) { + if (any.typeUrl != OsmosisGammV1beta1Types.pool.typeUrl) { + throw MessageException("Invalid type url.", details: { + "excepted": OsmosisGammV1beta1Types.pool.typeUrl, + "type_url": any.typeUrl + }); + } + return OsmosisGammPool.deserialize(any.value); + } + + @override + List get fieldIds => [1, 2, 3, 4, 5, 6, 7]; + + @override + Map toJson() { + return { + "address": address, + "id": id?.toString(), + "pool_params": poolParams.toJson(), + "future_pool_governor": futurePoolGovernor, + "total_shares": totalShares.toJson(), + "pool_assets": poolAssets.map((e) => e.toJson()).toList(), + "total_weight": totalWeight + }; + } + + @override + String get typeUrl => OsmosisGammV1beta1Types.pool.typeUrl; + + @override + List get values => [ + address, + id, + poolParams, + futurePoolGovernor, + totalShares, + poolAssets, + totalWeight + ]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_gamm_v1beta1/osmosis_gamm_v1beta1.dart b/lib/src/models/networks/osmosis/osmosis_gamm_v1beta1/osmosis_gamm_v1beta1.dart index 5d0ca15..acf37b4 100644 --- a/lib/src/models/networks/osmosis/osmosis_gamm_v1beta1/osmosis_gamm_v1beta1.dart +++ b/lib/src/models/networks/osmosis/osmosis_gamm_v1beta1/osmosis_gamm_v1beta1.dart @@ -5,6 +5,7 @@ export 'messages/pool_params.dart'; export 'messages/sawap_ammount_in_route.dart'; export 'messages/sawap_ammount_out_route.dart'; export 'messages/smooth_weight_change_params.dart'; +export 'messages/pool.dart'; export 'query/query_num_pools_request.dart'; export 'query/query_num_pools_response.dart'; diff --git a/lib/src/models/networks/osmosis/osmosis_gamm_v1beta1/query/query_pool_request.dart b/lib/src/models/networks/osmosis/osmosis_gamm_v1beta1/query/query_pool_request.dart index 0493b44..dfae602 100644 --- a/lib/src/models/networks/osmosis/osmosis_gamm_v1beta1/query/query_pool_request.dart +++ b/lib/src/models/networks/osmosis/osmosis_gamm_v1beta1/query/query_pool_request.dart @@ -24,7 +24,7 @@ class OsmosisGammQueryPoolRequest extends CosmosMessage } @override - String get queryPath => OsmosisGammV1beta1Types.pool.typeUrl; + String get queryPath => OsmosisGammV1beta1Types.queryPool.typeUrl; @override Map toJson() { @@ -46,6 +46,6 @@ class OsmosisGammQueryPoolRequest extends CosmosMessage Map get queryParameters => {}; @override - String get rpcPath => - OsmosisGammV1beta1Types.pool.rpcUrl(pathParameters: [poolId?.toString()]); + String get rpcPath => OsmosisGammV1beta1Types.queryPool + .rpcUrl(pathParameters: [poolId?.toString()]); } diff --git a/lib/src/models/networks/osmosis/osmosis_gamm_v1beta1/types/types.dart b/lib/src/models/networks/osmosis/osmosis_gamm_v1beta1/types/types.dart index 5049d45..978e162 100644 --- a/lib/src/models/networks/osmosis/osmosis_gamm_v1beta1/types/types.dart +++ b/lib/src/models/networks/osmosis/osmosis_gamm_v1beta1/types/types.dart @@ -8,6 +8,8 @@ class OsmosisGammV1beta1Types extends TypeUrl { const OsmosisGammV1beta1Types._(this.typeUrl, {this.rpc}); static const OsmosisGammV1beta1Types poolAsset = OsmosisGammV1beta1Types._("/osmosis.gamm.v1beta1.PoolAsset"); + static const OsmosisGammV1beta1Types pool = + OsmosisGammV1beta1Types._("/osmosis.gamm.v1beta1.Pool"); static const OsmosisGammV1beta1Types smoothWeightChangeParams = OsmosisGammV1beta1Types._( "/osmosis.gamm.v1beta1.SmoothWeightChangeParams"); @@ -162,7 +164,7 @@ class OsmosisGammV1beta1Types extends TypeUrl { OsmosisGammV1beta1Types._("/osmosis.gamm.v1beta1.Query/TotalLiquidity", rpc: "/osmosis/gamm/v1beta1/total_liquidity"); - static const OsmosisGammV1beta1Types pool = OsmosisGammV1beta1Types._( + static const OsmosisGammV1beta1Types queryPool = OsmosisGammV1beta1Types._( "/osmosis.gamm.v1beta1.Query/Pool", rpc: "/osmosis/gamm/v1beta1/pools/:pool"); static const OsmosisGammV1beta1Types poolType = OsmosisGammV1beta1Types._( diff --git a/lib/src/models/networks/osmosis/osmosis_incentives/query/rewards_est_request.dart b/lib/src/models/networks/osmosis/osmosis_incentives/query/rewards_est_request.dart index 3d8f2b4..82700f8 100644 --- a/lib/src/models/networks/osmosis/osmosis_incentives/query/rewards_est_request.dart +++ b/lib/src/models/networks/osmosis/osmosis_incentives/query/rewards_est_request.dart @@ -1,3 +1,4 @@ +import 'package:blockchain_utils/numbers/numbers.dart'; import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_incentives/types/types.dart'; import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; @@ -26,7 +27,11 @@ class OsmosisIncentiveRewardsEstRequest extends CosmosMessage final decode = CosmosProtocolBuffer.decode(bytes); return OsmosisIncentiveRewardsEstRequest( owner: decode.getField(1), - lockIds: decode.getFields(2), + lockIds: decode + .getResult(2) + ?.to, List>( + (e) => e.map((e) => BigintUtils.parse(e)).toList()) ?? + [], endEpoch: decode.getField(3)); } diff --git a/lib/src/models/networks/osmosis/osmosis_superfluid/messages/concentrated_pool_user_position_record.dart b/lib/src/models/networks/osmosis/osmosis_superfluid/messages/concentrated_pool_user_position_record.dart new file mode 100644 index 0000000..d8bd19a --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_superfluid/messages/concentrated_pool_user_position_record.dart @@ -0,0 +1,69 @@ +import 'package:blockchain_utils/numbers/bigint_utils.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_lockup/messages/synthetic_lock.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_superfluid/types/types.dart'; +import 'package:cosmos_sdk/src/models/sdk_v1beta1/cosmos_base_v1beta1/messages/coin.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +class OsmosisSuperfluidConcentratedPoolUserPositionRecord + extends CosmosMessage { + final String? validatorAddress; + final BigInt? positionId; + final BigInt? lockId; + final OsmosisLockupSyntheticLock syntheticLock; + final Coin delegationAmount; + final Coin equivalentStakedAmount; + + const OsmosisSuperfluidConcentratedPoolUserPositionRecord( + {this.validatorAddress, + this.positionId, + this.lockId, + required this.syntheticLock, + required this.delegationAmount, + required this.equivalentStakedAmount}); + factory OsmosisSuperfluidConcentratedPoolUserPositionRecord.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisSuperfluidConcentratedPoolUserPositionRecord( + validatorAddress: decode.getField(1), + positionId: decode.getField(2), + lockId: decode.getField(3), + syntheticLock: + OsmosisLockupSyntheticLock.deserialize(decode.getField(4)), + delegationAmount: Coin.deserialize(decode.getField(5)), + equivalentStakedAmount: Coin.deserialize(decode.getField(6))); + } + factory OsmosisSuperfluidConcentratedPoolUserPositionRecord.fromRpc( + Map json) { + return OsmosisSuperfluidConcentratedPoolUserPositionRecord( + validatorAddress: json["validator_address"], + positionId: BigintUtils.tryParse(json["position_id"]), + lockId: BigintUtils.tryParse(json["lock_id"]), + syntheticLock: + OsmosisLockupSyntheticLock.fromRpc(json["synthetic_lock"]), + delegationAmount: Coin.fromRpc(json["delegation_amount"]), + equivalentStakedAmount: Coin.fromRpc(json["equivalent_staked_amount"])); + } + + @override + List get fieldIds => [1, 2, 3, 4, 5, 6]; + + @override + Map toJson() { + return { + "validator_address": validatorAddress, + "position_id": positionId?.toString(), + "lock_id": lockId?.toString(), + "synthetic_lock": syntheticLock.toJson(), + "delegation_amount": delegationAmount.toJson(), + "equivalent_staked_amount": equivalentStakedAmount.toJson() + }; + } + + @override + String get typeUrl => + OsmosisSuperfluidTypes.concentratedPoolUserPositionRecord.typeUrl; + + @override + List get values => + [validatorAddress, positionId, lockId, syntheticLock, delegationAmount]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_superfluid/messages/super_fluid_asset_type.dart b/lib/src/models/networks/osmosis/osmosis_superfluid/messages/super_fluid_asset_type.dart index 2e18370..2668652 100644 --- a/lib/src/models/networks/osmosis/osmosis_superfluid/messages/super_fluid_asset_type.dart +++ b/lib/src/models/networks/osmosis/osmosis_superfluid/messages/super_fluid_asset_type.dart @@ -7,6 +7,10 @@ class OsmosisSuperfluidSuperfluidAssetType implements CosmosEnum { OsmosisSuperfluidSuperfluidAssetType._(0, "SuperfluidAssetTypeNative"); static const OsmosisSuperfluidSuperfluidAssetType superfluidAssetTypeLPShare = OsmosisSuperfluidSuperfluidAssetType._(1, "SuperfluidAssetTypeLPShare"); + static const OsmosisSuperfluidSuperfluidAssetType + superfluidAssetTypeConcentratedShare = + OsmosisSuperfluidSuperfluidAssetType._( + 2, "SuperfluidAssetTypeConcentratedShare"); @override final int value; @@ -16,7 +20,8 @@ class OsmosisSuperfluidSuperfluidAssetType implements CosmosEnum { const OsmosisSuperfluidSuperfluidAssetType._(this.value, this.name); static const List values = [ superfluidAssetTypeNative, - superfluidAssetTypeLPShare + superfluidAssetTypeLPShare, + superfluidAssetTypeConcentratedShare ]; static OsmosisSuperfluidSuperfluidAssetType fromValue(int? value) { diff --git a/lib/src/models/networks/osmosis/osmosis_superfluid/messages/unpool_whitelisted_pools.dart b/lib/src/models/networks/osmosis/osmosis_superfluid/messages/unpool_whitelisted_pools.dart index 08f78d7..970536b 100644 --- a/lib/src/models/networks/osmosis/osmosis_superfluid/messages/unpool_whitelisted_pools.dart +++ b/lib/src/models/networks/osmosis/osmosis_superfluid/messages/unpool_whitelisted_pools.dart @@ -1,3 +1,4 @@ +import 'package:blockchain_utils/numbers/numbers.dart'; import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_superfluid/types/types.dart'; import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; @@ -7,7 +8,11 @@ class OsmosisSuperfluidUnpoolWhitelistedPools extends CosmosMessage { factory OsmosisSuperfluidUnpoolWhitelistedPools.deserialize(List bytes) { final decode = CosmosProtocolBuffer.decode(bytes); return OsmosisSuperfluidUnpoolWhitelistedPools( - ids: decode.getFields(1)); + ids: decode + .getResult(1) + ?.to, List>( + (e) => e.map((e) => BigintUtils.parse(e)).toList()) ?? + []); } @override diff --git a/lib/src/models/networks/osmosis/osmosis_superfluid/query/query_unpool_whitelist_request.dart b/lib/src/models/networks/osmosis/osmosis_superfluid/query/query_unpool_whitelist_request.dart new file mode 100644 index 0000000..826d204 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_superfluid/query/query_unpool_whitelist_request.dart @@ -0,0 +1,50 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_superfluid/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'query_unpool_whitelist_response.dart'; + +/// Params returns the total set of superfluid parameters. +class OsmosisSuperfluidQueryUnpoolWhitelistRequest extends CosmosMessage + with + QueryMessage, + RPCMessage { + const OsmosisSuperfluidQueryUnpoolWhitelistRequest(); + factory OsmosisSuperfluidQueryUnpoolWhitelistRequest.deserialize( + List bytes) { + return const OsmosisSuperfluidQueryUnpoolWhitelistRequest(); + } + + @override + List get fieldIds => []; + + @override + Map toJson() { + return {}; + } + + @override + String get typeUrl => + OsmosisSuperfluidTypes.queryUnpoolWhitelistRequest.typeUrl; + + @override + List get values => []; + + @override + Map get queryParameters => {}; + + @override + String get queryPath => OsmosisSuperfluidTypes.unpoolWhitelist.typeUrl; + + @override + String get rpcPath => OsmosisSuperfluidTypes.unpoolWhitelist.rpcUrl(); + + @override + OsmosisSuperfluidQueryUnpoolWhitelistResponse onJsonResponse( + Map json) { + return OsmosisSuperfluidQueryUnpoolWhitelistResponse.fromRpc(json); + } + + @override + OsmosisSuperfluidQueryUnpoolWhitelistResponse onResponse(List bytes) { + return OsmosisSuperfluidQueryUnpoolWhitelistResponse.deserialize(bytes); + } +} diff --git a/lib/src/models/networks/osmosis/osmosis_superfluid/query/query_unpool_whitelist_response.dart b/lib/src/models/networks/osmosis/osmosis_superfluid/query/query_unpool_whitelist_response.dart new file mode 100644 index 0000000..927f1bc --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_superfluid/query/query_unpool_whitelist_response.dart @@ -0,0 +1,43 @@ +import 'package:blockchain_utils/numbers/numbers.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_superfluid/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; + +class OsmosisSuperfluidQueryUnpoolWhitelistResponse extends CosmosMessage { + final List? poolIds; + OsmosisSuperfluidQueryUnpoolWhitelistResponse({List? poolIds}) + : poolIds = poolIds?.nullOnEmpy; + factory OsmosisSuperfluidQueryUnpoolWhitelistResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisSuperfluidQueryUnpoolWhitelistResponse( + poolIds: decode + .getResult(1) + ?.to, List>( + (e) => e.map((e) => BigintUtils.parse(e)).toList()) ?? + []); + } + factory OsmosisSuperfluidQueryUnpoolWhitelistResponse.fromRpc( + Map json) { + return OsmosisSuperfluidQueryUnpoolWhitelistResponse( + poolIds: (json["pool_ids"] as List?) + ?.map((e) => BigintUtils.parse(e)) + .toList() ?? + []); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"pool_ids": poolIds?.map((e) => e.toString()).toList()}; + } + + @override + String get typeUrl => + OsmosisSuperfluidTypes.queryUnpoolWhitelistResponse.typeUrl; + + @override + List get values => [poolIds]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_superfluid/query/user_concentrated_super_fluid_positions_delegated_response.dart b/lib/src/models/networks/osmosis/osmosis_superfluid/query/user_concentrated_super_fluid_positions_delegated_response.dart new file mode 100644 index 0000000..6a26ddf --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_superfluid/query/user_concentrated_super_fluid_positions_delegated_response.dart @@ -0,0 +1,53 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_superfluid/messages/concentrated_pool_user_position_record.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_superfluid/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; + +class OsmosisSuperfluidUserConcentratedSuperfluidPositionsDelegatedResponse + extends CosmosMessage { + final List + clPoolUserPositionRecords; + OsmosisSuperfluidUserConcentratedSuperfluidPositionsDelegatedResponse( + List + clPoolUserPositionRecords) + : clPoolUserPositionRecords = clPoolUserPositionRecords.mutable; + factory OsmosisSuperfluidUserConcentratedSuperfluidPositionsDelegatedResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisSuperfluidUserConcentratedSuperfluidPositionsDelegatedResponse( + decode + .getFields(1) + .map((e) => + OsmosisSuperfluidConcentratedPoolUserPositionRecord.deserialize( + e)) + .toList()); + } + factory OsmosisSuperfluidUserConcentratedSuperfluidPositionsDelegatedResponse.fromRpc( + Map json) { + return OsmosisSuperfluidUserConcentratedSuperfluidPositionsDelegatedResponse( + (json["cl_pool_user_position_records"] as List?) + ?.map((e) => + OsmosisSuperfluidConcentratedPoolUserPositionRecord.fromRpc( + e)) + .toList() ?? + []); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return { + "cl_pool_user_position_records": + clPoolUserPositionRecords.map((e) => e.toJson()).toList() + }; + } + + @override + String get typeUrl => OsmosisSuperfluidTypes + .userConcentratedSuperfluidPositionsDelegatedResponse.typeUrl; + + @override + List get values => [clPoolUserPositionRecords]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_superfluid/query/user_concentrated_super_fluid_positions_undelegating_request.dart b/lib/src/models/networks/osmosis/osmosis_superfluid/query/user_concentrated_super_fluid_positions_undelegating_request.dart new file mode 100644 index 0000000..79e2c3c --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_superfluid/query/user_concentrated_super_fluid_positions_undelegating_request.dart @@ -0,0 +1,62 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_superfluid/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'user_concentrated_super_fluid_positions_undelegating_response.dart'; + +class OsmosisSuperfluidUserConcentratedSuperfluidPositionsUndelegatingRequest + extends CosmosMessage + with + QueryMessage< + OsmosisSuperfluidUserConcentratedSuperfluidPositionsUndelegatingResponse>, + RPCMessage< + OsmosisSuperfluidUserConcentratedSuperfluidPositionsUndelegatingResponse> { + final String? delegatorAddress; + const OsmosisSuperfluidUserConcentratedSuperfluidPositionsUndelegatingRequest( + {this.delegatorAddress}); + factory OsmosisSuperfluidUserConcentratedSuperfluidPositionsUndelegatingRequest.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisSuperfluidUserConcentratedSuperfluidPositionsUndelegatingRequest( + delegatorAddress: decode.getField(1)); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"delegator_address": delegatorAddress?.toString()}; + } + + @override + String get typeUrl => OsmosisSuperfluidTypes + .userConcentratedSuperfluidPositionsUndelegatingRequest.typeUrl; + + @override + List get values => [delegatorAddress]; + + @override + Map get queryParameters => {}; + + @override + String get queryPath => OsmosisSuperfluidTypes + .userConcentratedSuperfluidPositionsUndelegating.typeUrl; + + @override + String get rpcPath => + OsmosisSuperfluidTypes.userConcentratedSuperfluidPositionsUndelegating + .rpcUrl(pathParameters: [delegatorAddress]); + + @override + OsmosisSuperfluidUserConcentratedSuperfluidPositionsUndelegatingResponse + onJsonResponse(Map json) { + return OsmosisSuperfluidUserConcentratedSuperfluidPositionsUndelegatingResponse + .fromRpc(json); + } + + @override + OsmosisSuperfluidUserConcentratedSuperfluidPositionsUndelegatingResponse + onResponse(List bytes) { + return OsmosisSuperfluidUserConcentratedSuperfluidPositionsUndelegatingResponse + .deserialize(bytes); + } +} diff --git a/lib/src/models/networks/osmosis/osmosis_superfluid/query/user_concentrated_super_fluid_positions_undelegating_response.dart b/lib/src/models/networks/osmosis/osmosis_superfluid/query/user_concentrated_super_fluid_positions_undelegating_response.dart new file mode 100644 index 0000000..1f783df --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_superfluid/query/user_concentrated_super_fluid_positions_undelegating_response.dart @@ -0,0 +1,53 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_superfluid/messages/concentrated_pool_user_position_record.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_superfluid/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; + +class OsmosisSuperfluidUserConcentratedSuperfluidPositionsUndelegatingResponse + extends CosmosMessage { + final List + clPoolUserPositionRecords; + OsmosisSuperfluidUserConcentratedSuperfluidPositionsUndelegatingResponse( + List + clPoolUserPositionRecords) + : clPoolUserPositionRecords = clPoolUserPositionRecords.mutable; + factory OsmosisSuperfluidUserConcentratedSuperfluidPositionsUndelegatingResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisSuperfluidUserConcentratedSuperfluidPositionsUndelegatingResponse( + decode + .getFields(1) + .map((e) => + OsmosisSuperfluidConcentratedPoolUserPositionRecord.deserialize( + e)) + .toList()); + } + factory OsmosisSuperfluidUserConcentratedSuperfluidPositionsUndelegatingResponse.fromRpc( + Map json) { + return OsmosisSuperfluidUserConcentratedSuperfluidPositionsUndelegatingResponse( + (json["cl_pool_user_position_records"] as List?) + ?.map((e) => + OsmosisSuperfluidConcentratedPoolUserPositionRecord.fromRpc( + e)) + .toList() ?? + []); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return { + "cl_pool_user_position_records": + clPoolUserPositionRecords.map((e) => e.toJson()).toList() + }; + } + + @override + String get typeUrl => OsmosisSuperfluidTypes + .userConcentratedSuperfluidPositionsUndelegatingResponse.typeUrl; + + @override + List get values => [clPoolUserPositionRecords]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_superfluid/query/user_concentrated_superfluid_positions_delegated_request.dart b/lib/src/models/networks/osmosis/osmosis_superfluid/query/user_concentrated_superfluid_positions_delegated_request.dart new file mode 100644 index 0000000..f0b3ded --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_superfluid/query/user_concentrated_superfluid_positions_delegated_request.dart @@ -0,0 +1,61 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_superfluid/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'user_concentrated_super_fluid_positions_delegated_response.dart'; + +class OsmosisSuperfluidTotalSuperfluidDelegationsRequest extends CosmosMessage + with + QueryMessage< + OsmosisSuperfluidUserConcentratedSuperfluidPositionsDelegatedResponse>, + RPCMessage< + OsmosisSuperfluidUserConcentratedSuperfluidPositionsDelegatedResponse> { + final String? delegatorAddress; + const OsmosisSuperfluidTotalSuperfluidDelegationsRequest( + {this.delegatorAddress}); + factory OsmosisSuperfluidTotalSuperfluidDelegationsRequest.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisSuperfluidTotalSuperfluidDelegationsRequest( + delegatorAddress: decode.getField(1)); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"delegator_address": delegatorAddress?.toString()}; + } + + @override + String get typeUrl => OsmosisSuperfluidTypes + .userConcentratedSuperfluidPositionsDelegatedRequest.typeUrl; + + @override + List get values => [delegatorAddress]; + + @override + Map get queryParameters => {}; + + @override + String get queryPath => OsmosisSuperfluidTypes + .userConcentratedSuperfluidPositionsDelegated.typeUrl; + + @override + String get rpcPath => + OsmosisSuperfluidTypes.userConcentratedSuperfluidPositionsDelegated + .rpcUrl(pathParameters: [delegatorAddress]); + + @override + OsmosisSuperfluidUserConcentratedSuperfluidPositionsDelegatedResponse + onJsonResponse(Map json) { + return OsmosisSuperfluidUserConcentratedSuperfluidPositionsDelegatedResponse + .fromRpc(json); + } + + @override + OsmosisSuperfluidUserConcentratedSuperfluidPositionsDelegatedResponse + onResponse(List bytes) { + return OsmosisSuperfluidUserConcentratedSuperfluidPositionsDelegatedResponse + .deserialize(bytes); + } +} diff --git a/lib/src/models/networks/osmosis/osmosis_superfluid/services/add_to_concentrated_liquidity_super_fluid_position.dart b/lib/src/models/networks/osmosis/osmosis_superfluid/services/add_to_concentrated_liquidity_super_fluid_position.dart new file mode 100644 index 0000000..87a0d3a --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_superfluid/services/add_to_concentrated_liquidity_super_fluid_position.dart @@ -0,0 +1,63 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_superfluid/types/types.dart'; +import 'package:cosmos_sdk/src/models/sdk_v1beta1/sdk_v1beta1.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'add_to_concentrated_liquidity_super_fluid_position_response.dart'; + +class OsmosisSuperfluidMsgAddToConcentratedLiquiditySuperfluidPosition + extends CosmosMessage + with + ServiceMessage< + OsmosisSuperfluidMsgAddToConcentratedLiquiditySuperfluidPositionResponse> { + final BigInt? positionId; + final String? sender; + final Coin tokenDesired0; + final Coin tokenDesired1; + + OsmosisSuperfluidMsgAddToConcentratedLiquiditySuperfluidPosition( + {this.positionId, + this.sender, + required this.tokenDesired0, + required this.tokenDesired1}); + factory OsmosisSuperfluidMsgAddToConcentratedLiquiditySuperfluidPosition.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisSuperfluidMsgAddToConcentratedLiquiditySuperfluidPosition( + positionId: decode.getField(1), + sender: decode.getField(2), + tokenDesired0: Coin.deserialize(decode.getField(3)), + tokenDesired1: Coin.deserialize(decode.getField(4))); + } + + @override + List get fieldIds => [1, 2, 3, 4]; + + @override + Map toJson() { + return { + "position_id": positionId?.toString(), + "sender": sender, + "token_desired0": tokenDesired0.toJson(), + "token_desired1": tokenDesired1.toJson() + }; + } + + @override + String get typeUrl => OsmosisSuperfluidTypes + .msgAddToConcentratedLiquiditySuperfluidPosition.typeUrl; + + @override + List get values => [positionId, sender, tokenDesired0, tokenDesired1]; + + @override + String get service => OsmosisSuperfluidTypes + .adToConcentratedLiquiditySuperfluidPosition.typeUrl; + + @override + List get signers => [sender]; + @override + OsmosisSuperfluidMsgAddToConcentratedLiquiditySuperfluidPositionResponse + onResponse(List bytes) { + return OsmosisSuperfluidMsgAddToConcentratedLiquiditySuperfluidPositionResponse + .deserialize(bytes); + } +} diff --git a/lib/src/models/networks/osmosis/osmosis_superfluid/services/add_to_concentrated_liquidity_super_fluid_position_response.dart b/lib/src/models/networks/osmosis/osmosis_superfluid/services/add_to_concentrated_liquidity_super_fluid_position_response.dart new file mode 100644 index 0000000..2771739 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_superfluid/services/add_to_concentrated_liquidity_super_fluid_position_response.dart @@ -0,0 +1,54 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_superfluid/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +class OsmosisSuperfluidMsgAddToConcentratedLiquiditySuperfluidPositionResponse + extends CosmosMessage { + final BigInt? positionId; + final BigInt amount0; + final BigInt amount1; + + /// new_liquidity is the final liquidity after the add. + /// It includes the liquidity that existed before in the position + /// and the new liquidity that was added to the position. + final String? newLiquidity; + final BigInt? lockId; + + OsmosisSuperfluidMsgAddToConcentratedLiquiditySuperfluidPositionResponse( + {this.positionId, + required this.amount0, + required this.amount1, + this.newLiquidity, + this.lockId}); + factory OsmosisSuperfluidMsgAddToConcentratedLiquiditySuperfluidPositionResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisSuperfluidMsgAddToConcentratedLiquiditySuperfluidPositionResponse( + positionId: decode.getField(1), + amount0: BigInt.parse(decode.getField(2)), + amount1: BigInt.parse(decode.getField(3)), + lockId: decode.getField(4), + newLiquidity: decode.getField(5), + ); + } + + @override + List get fieldIds => [1, 2, 3, 4, 5]; + + @override + Map toJson() { + return { + "position_id": positionId?.toString(), + "amount0": amount0.toString(), + "amount1": amount1.toString(), + "new_liquidity": newLiquidity, + "lock_id": lockId?.toString() + }; + } + + @override + String get typeUrl => OsmosisSuperfluidTypes + .msgAddToConcentratedLiquiditySuperfluidPositionResponse.typeUrl; + + @override + List get values => [positionId, amount0, amount1, lockId, newLiquidity]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_superfluid/services/create_full_range_position_and_super_fluid_delegate.dart b/lib/src/models/networks/osmosis/osmosis_superfluid/services/create_full_range_position_and_super_fluid_delegate.dart new file mode 100644 index 0000000..633a572 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_superfluid/services/create_full_range_position_and_super_fluid_delegate.dart @@ -0,0 +1,64 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_superfluid/types/types.dart'; +import 'package:cosmos_sdk/src/models/sdk_v1beta1/sdk_v1beta1.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; +import 'create_full_range_position_and_super_fluid_delegate_response.dart'; + +/// MsgCreateFullRangePositionAndSuperfluidDelegate creates a full range position +/// in a concentrated liquidity pool, then superfluid delegates. +class OsmosisSuperfluidMsgCreateFullRangePositionAndSuperfluidDelegate + extends CosmosMessage + with + ServiceMessage< + OsmosisSuperfluidMsgCreateFullRangePositionAndSuperfluidDelegateResponse> { + final String? sender; + final List coins; + final String? valAddr; + final BigInt? poolId; + + OsmosisSuperfluidMsgCreateFullRangePositionAndSuperfluidDelegate( + {this.sender, required List coins, this.valAddr, this.poolId}) + : coins = coins.mutable; + factory OsmosisSuperfluidMsgCreateFullRangePositionAndSuperfluidDelegate.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisSuperfluidMsgCreateFullRangePositionAndSuperfluidDelegate( + coins: decode.getFields(2).map((e) => Coin.deserialize(e)).toList(), + sender: decode.getField(1), + valAddr: decode.getField(3), + poolId: decode.getField(4)); + } + + @override + List get fieldIds => [1, 2, 3, 4]; + + @override + Map toJson() { + return { + "sender": sender, + "coins": coins.map((e) => e.toJson()).toList(), + "val_addr": valAddr, + "pool_id": poolId?.toString() + }; + } + + @override + String get typeUrl => OsmosisSuperfluidTypes + .msgCreateFullRangePositionAndSuperfluidDelegate.typeUrl; + + @override + List get values => [sender, coins, valAddr, poolId]; + + @override + String get service => OsmosisSuperfluidTypes + .createFullRangePositionAndSuperfluidDelegate.typeUrl; + + @override + List get signers => [sender]; + @override + OsmosisSuperfluidMsgCreateFullRangePositionAndSuperfluidDelegateResponse + onResponse(List bytes) { + return OsmosisSuperfluidMsgCreateFullRangePositionAndSuperfluidDelegateResponse + .deserialize(bytes); + } +} diff --git a/lib/src/models/networks/osmosis/osmosis_superfluid/services/create_full_range_position_and_super_fluid_delegate_response.dart b/lib/src/models/networks/osmosis/osmosis_superfluid/services/create_full_range_position_and_super_fluid_delegate_response.dart new file mode 100644 index 0000000..7167b46 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_superfluid/services/create_full_range_position_and_super_fluid_delegate_response.dart @@ -0,0 +1,32 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_superfluid/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +class OsmosisSuperfluidMsgCreateFullRangePositionAndSuperfluidDelegateResponse + extends CosmosMessage { + final BigInt? lockId; + final BigInt? positionId; + + OsmosisSuperfluidMsgCreateFullRangePositionAndSuperfluidDelegateResponse( + {this.lockId, this.positionId}); + factory OsmosisSuperfluidMsgCreateFullRangePositionAndSuperfluidDelegateResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisSuperfluidMsgCreateFullRangePositionAndSuperfluidDelegateResponse( + lockId: decode.getField(1), positionId: decode.getField(2)); + } + + @override + List get fieldIds => [1, 2]; + + @override + Map toJson() { + return {"lockID": lockId?.toString(), "positionID": positionId?.toString()}; + } + + @override + String get typeUrl => OsmosisSuperfluidTypes + .msgCreateFullRangePositionAndSuperfluidDelegateResponse.typeUrl; + + @override + List get values => [lockId, positionId]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_superfluid/services/msg_un_pool_white_listed_pool_response.dart b/lib/src/models/networks/osmosis/osmosis_superfluid/services/msg_un_pool_white_listed_pool_response.dart index b5861aa..72ede47 100644 --- a/lib/src/models/networks/osmosis/osmosis_superfluid/services/msg_un_pool_white_listed_pool_response.dart +++ b/lib/src/models/networks/osmosis/osmosis_superfluid/services/msg_un_pool_white_listed_pool_response.dart @@ -1,3 +1,4 @@ +import 'package:blockchain_utils/numbers/numbers.dart'; import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_superfluid/types/types.dart'; import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; @@ -13,7 +14,11 @@ class OsmosisSuperfluidMsgUnPoolWhitelistedPoolResponse extends CosmosMessage { List bytes) { final decode = CosmosProtocolBuffer.decode(bytes); return OsmosisSuperfluidMsgUnPoolWhitelistedPoolResponse( - exitedLockIds: decode.getFields(1)); + exitedLockIds: decode + .getResult(1) + ?.to, List>( + (e) => e.map((e) => BigintUtils.parse(e)).toList()) ?? + []); } @override diff --git a/lib/src/models/networks/osmosis/osmosis_superfluid/services/msg_unbond_convert_and_staked.dart b/lib/src/models/networks/osmosis/osmosis_superfluid/services/msg_unbond_convert_and_staked.dart new file mode 100644 index 0000000..e69de29 diff --git a/lib/src/models/networks/osmosis/osmosis_superfluid/services/super_fluid_undelegate_and_unbond_lock.dart b/lib/src/models/networks/osmosis/osmosis_superfluid/services/super_fluid_undelegate_and_unbond_lock.dart new file mode 100644 index 0000000..cdfd885 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_superfluid/services/super_fluid_undelegate_and_unbond_lock.dart @@ -0,0 +1,58 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_superfluid/types/types.dart'; +import 'package:cosmos_sdk/src/models/sdk_v1beta1/cosmos_base_v1beta1/cosmos_base_v1beta1.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'super_fluid_undelegate_and_unbond_lock_response.dart'; + +class OsmosisSuperfluidMsgSuperfluidUndelegateAndUnbondLock + extends CosmosMessage + with + ServiceMessage< + OsmosisSuperfluidMsgSuperfluidUndelegateAndUnbondLockResponse> { + final String? sender; + final BigInt? lockId; + + /// Amount of unlocking coin. + final Coin coin; + const OsmosisSuperfluidMsgSuperfluidUndelegateAndUnbondLock( + {this.sender, this.lockId, required this.coin}); + factory OsmosisSuperfluidMsgSuperfluidUndelegateAndUnbondLock.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisSuperfluidMsgSuperfluidUndelegateAndUnbondLock( + sender: decode.getField(1), + lockId: decode.getField(2), + coin: Coin.deserialize(decode.getField(3))); + } + + @override + List get fieldIds => [1, 2, 3]; + + @override + Map toJson() { + return { + "sender": sender, + "lock_id": lockId?.toString(), + "coin": coin.toJson() + }; + } + + @override + String get typeUrl => + OsmosisSuperfluidTypes.msgSuperfluidUndelegateAndUnbondLock.typeUrl; + + @override + List get values => [sender, lockId]; + + @override + String get service => + OsmosisSuperfluidTypes.superfluidUndelegateAndUnbondLock.typeUrl; + + @override + List get signers => [sender]; + @override + OsmosisSuperfluidMsgSuperfluidUndelegateAndUnbondLockResponse onResponse( + List bytes) { + return OsmosisSuperfluidMsgSuperfluidUndelegateAndUnbondLockResponse + .deserialize(bytes); + } +} diff --git a/lib/src/models/networks/osmosis/osmosis_superfluid/services/super_fluid_undelegate_and_unbond_lock_response.dart b/lib/src/models/networks/osmosis/osmosis_superfluid/services/super_fluid_undelegate_and_unbond_lock_response.dart new file mode 100644 index 0000000..b87f86d --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_superfluid/services/super_fluid_undelegate_and_unbond_lock_response.dart @@ -0,0 +1,33 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_superfluid/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +class OsmosisSuperfluidMsgSuperfluidUndelegateAndUnbondLockResponse + extends CosmosMessage { + /// lock id of the new lock created for the remaining amount. + /// returns the original lockid if the unlocked amount is equal to the + /// original lock's amount. + final BigInt? lockId; + + OsmosisSuperfluidMsgSuperfluidUndelegateAndUnbondLockResponse({this.lockId}); + factory OsmosisSuperfluidMsgSuperfluidUndelegateAndUnbondLockResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisSuperfluidMsgSuperfluidUndelegateAndUnbondLockResponse( + lockId: decode.getField(1)); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"lock_id": lockId?.toString()}; + } + + @override + String get typeUrl => OsmosisSuperfluidTypes + .msgSuperfluidUndelegateAndUnbondLockResponse.typeUrl; + + @override + List get values => [lockId]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_superfluid/services/unbond_convert_and_stake.dart b/lib/src/models/networks/osmosis/osmosis_superfluid/services/unbond_convert_and_stake.dart new file mode 100644 index 0000000..4065190 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_superfluid/services/unbond_convert_and_stake.dart @@ -0,0 +1,77 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_superfluid/types/types.dart'; +import 'package:cosmos_sdk/src/models/sdk_v1beta1/cosmos_base_v1beta1/cosmos_base_v1beta1.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'super_fluid_undelegate_and_unbond_lock_response.dart'; + +class OsmosisSuperfluidMsgUnbondConvertAndStake extends CosmosMessage + with + ServiceMessage< + OsmosisSuperfluidMsgSuperfluidUndelegateAndUnbondLockResponse> { + /// lock ID to convert and stake. + /// lock id with 0 should be provided if converting liquid gamm shares to stake + final BigInt? lockId; + final String? sender; + + /// validator address to delegate to. + /// If provided empty string, we use the validators returned from + /// valset-preference module. + final String? valAddr; + + /// min_amt_to_stake indicates the minimum amount to stake after conversion + final BigInt minAmtToStake; + + /// shares_to_convert indicates shares wanted to stake. + /// Note that this field is only used for liquid(unlocked) gamm shares. + /// For all other cases, this field would be disregarded. + final Coin sharesToConvert; + + OsmosisSuperfluidMsgUnbondConvertAndStake( + {this.lockId, + this.sender, + this.valAddr, + required this.minAmtToStake, + required this.sharesToConvert}); + factory OsmosisSuperfluidMsgUnbondConvertAndStake.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisSuperfluidMsgUnbondConvertAndStake( + lockId: decode.getField(1), + sender: decode.getField(2), + valAddr: decode.getField(3), + minAmtToStake: BigInt.parse(decode.getField(4)), + sharesToConvert: Coin.deserialize(decode.getField(5))); + } + + @override + List get fieldIds => [1, 2, 3, 4, 5]; + + @override + Map toJson() { + return { + "lock_id": lockId?.toString(), + "sender": sender, + "val_addr": valAddr, + "min_amt_to_stake": minAmtToStake.toString(), + "shares_to_convert": sharesToConvert.toJson() + }; + } + + @override + String get typeUrl => OsmosisSuperfluidTypes.msgUnbondConvertAndStake.typeUrl; + + @override + List get values => + [lockId, sender, valAddr, minAmtToStake.toString(), sharesToConvert]; + + @override + String get service => OsmosisSuperfluidTypes.unbondConvertAndStake.typeUrl; + + @override + List get signers => [sender]; + @override + OsmosisSuperfluidMsgSuperfluidUndelegateAndUnbondLockResponse onResponse( + List bytes) { + return OsmosisSuperfluidMsgSuperfluidUndelegateAndUnbondLockResponse + .deserialize(bytes); + } +} diff --git a/lib/src/models/networks/osmosis/osmosis_superfluid/services/unbond_convert_and_stake_response.dart b/lib/src/models/networks/osmosis/osmosis_superfluid/services/unbond_convert_and_stake_response.dart new file mode 100644 index 0000000..1abe877 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_superfluid/services/unbond_convert_and_stake_response.dart @@ -0,0 +1,31 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_superfluid/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +class OsmosisSuperfluidMsgSuperfluidUndelegateAndUnbondLockResponse + extends CosmosMessage { + final BigInt totalAmtStaked; + + OsmosisSuperfluidMsgSuperfluidUndelegateAndUnbondLockResponse( + this.totalAmtStaked); + factory OsmosisSuperfluidMsgSuperfluidUndelegateAndUnbondLockResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisSuperfluidMsgSuperfluidUndelegateAndUnbondLockResponse( + BigInt.parse(decode.getField(1))); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"total_amt_staked": totalAmtStaked.toString()}; + } + + @override + String get typeUrl => + OsmosisSuperfluidTypes.msgUnbondConvertAndStakeResponse.typeUrl; + + @override + List get values => [totalAmtStaked.toString()]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_superfluid/services/unlock_and_migrate_shares_to_full_range_concentrated_position.dart b/lib/src/models/networks/osmosis/osmosis_superfluid/services/unlock_and_migrate_shares_to_full_range_concentrated_position.dart new file mode 100644 index 0000000..76a28a6 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_superfluid/services/unlock_and_migrate_shares_to_full_range_concentrated_position.dart @@ -0,0 +1,68 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_superfluid/types/types.dart'; +import 'package:cosmos_sdk/src/models/sdk_v1beta1/cosmos_base_v1beta1/cosmos_base_v1beta1.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; +import 'unlock_and_migrate_shares_to_full_range_concentrated_position_response.dart'; + +class OsmosisSuperfluidMsgUnlockAndMigrateSharesToFullRangeConcentratedPosition + extends CosmosMessage + with + ServiceMessage< + OsmosisSuperfluidMsgUnlockAndMigrateSharesToFullRangeConcentratedPositionResponse> { + final String? sender; + final BigInt? lockId; + final Coin sharesToMigrate; + + /// token_out_mins indicates minimum token to exit Balancer pool with. + final List tokenOutMins; + OsmosisSuperfluidMsgUnlockAndMigrateSharesToFullRangeConcentratedPosition({ + this.sender, + this.lockId, + required this.sharesToMigrate, + required List tokenOutMins, + }) : tokenOutMins = tokenOutMins.mutable; + factory OsmosisSuperfluidMsgUnlockAndMigrateSharesToFullRangeConcentratedPosition.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisSuperfluidMsgUnlockAndMigrateSharesToFullRangeConcentratedPosition( + sender: decode.getField(1), + lockId: decode.getField(2), + sharesToMigrate: Coin.deserialize(decode.getField(3)), + tokenOutMins: + decode.getFields(4).map((e) => Coin.deserialize(e)).toList(), + ); + } + + @override + List get fieldIds => [1, 2, 3, 4]; + + @override + Map toJson() { + return { + "sender": sender, + "lock_id": lockId?.toString(), + "shares_to_migrate": sharesToMigrate.toJson(), + "token_out_mins": tokenOutMins.map((e) => e.toJson()).toList() + }; + } + + @override + String get typeUrl => OsmosisSuperfluidTypes + .msgUnlockAndMigrateSharesToFullRangeConcentratedPosition.typeUrl; + + @override + List get values => [sender, lockId, sharesToMigrate, tokenOutMins]; + + @override + String get service => OsmosisSuperfluidTypes + .unlockAndMigrateSharesToFullRangeConcentratedPosition.typeUrl; + + @override + List get signers => [sender]; + @override + OsmosisSuperfluidMsgUnlockAndMigrateSharesToFullRangeConcentratedPositionResponse + onResponse(List bytes) { + return OsmosisSuperfluidMsgUnlockAndMigrateSharesToFullRangeConcentratedPositionResponse + .deserialize(bytes); + } +} diff --git a/lib/src/models/networks/osmosis/osmosis_superfluid/services/unlock_and_migrate_shares_to_full_range_concentrated_position_response.dart b/lib/src/models/networks/osmosis/osmosis_superfluid/services/unlock_and_migrate_shares_to_full_range_concentrated_position_response.dart new file mode 100644 index 0000000..797ba69 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_superfluid/services/unlock_and_migrate_shares_to_full_range_concentrated_position_response.dart @@ -0,0 +1,46 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_superfluid/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +class OsmosisSuperfluidMsgUnlockAndMigrateSharesToFullRangeConcentratedPositionResponse + extends CosmosMessage { + final BigInt amount0; + final BigInt amount1; + final String liquidityCreated; + final ProtobufTimestamp joinTime; + + OsmosisSuperfluidMsgUnlockAndMigrateSharesToFullRangeConcentratedPositionResponse( + {required this.amount0, + required this.amount1, + required this.liquidityCreated, + required this.joinTime}); + factory OsmosisSuperfluidMsgUnlockAndMigrateSharesToFullRangeConcentratedPositionResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisSuperfluidMsgUnlockAndMigrateSharesToFullRangeConcentratedPositionResponse( + amount0: BigInt.parse(decode.getField(1)), + amount1: BigInt.parse(decode.getField(2)), + liquidityCreated: decode.getField(3), + joinTime: ProtobufTimestamp.deserialize(decode.getField(4))); + } + + @override + List get fieldIds => [1, 2, 3, 4]; + + @override + Map toJson() { + return { + "amount0": amount0.toString(), + "amount1": amount1.toString(), + "liquidity_created": liquidityCreated, + "join_time": joinTime.toJson() + }; + } + + @override + String get typeUrl => OsmosisSuperfluidTypes + .msgUnlockAndMigrateSharesToFullRangeConcentratedPositionResponse.typeUrl; + + @override + List get values => + [amount0.toString(), amount1.toString(), liquidityCreated, joinTime]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_superfluid/types/types.dart b/lib/src/models/networks/osmosis/osmosis_superfluid/types/types.dart index e73c42a..b7b8f17 100644 --- a/lib/src/models/networks/osmosis/osmosis_superfluid/types/types.dart +++ b/lib/src/models/networks/osmosis/osmosis_superfluid/types/types.dart @@ -146,8 +146,92 @@ class OsmosisSuperfluidTypes extends TypeUrl { OsmosisSuperfluidTypes._( "/osmosis.superfluid.QueryTotalDelegationByDelegatorResponse"); + static const OsmosisSuperfluidTypes msgSuperfluidUndelegateAndUnbondLock = + OsmosisSuperfluidTypes._( + "/osmosis.superfluid.MsgSuperfluidUndelegateAndUnbondLock"); + static const OsmosisSuperfluidTypes + msgSuperfluidUndelegateAndUnbondLockResponse = OsmosisSuperfluidTypes._( + "/osmosis.superfluid.MsgSuperfluidUndelegateAndUnbondLockResponse"); + + static const OsmosisSuperfluidTypes + msgCreateFullRangePositionAndSuperfluidDelegate = + OsmosisSuperfluidTypes._( + "/osmosis.superfluid.MsgCreateFullRangePositionAndSuperfluidDelegate"); + static const OsmosisSuperfluidTypes + msgCreateFullRangePositionAndSuperfluidDelegateResponse = + OsmosisSuperfluidTypes._( + "/osmosis.superfluid.MsgCreateFullRangePositionAndSuperfluidDelegateResponse"); + + static const OsmosisSuperfluidTypes + msgUnlockAndMigrateSharesToFullRangeConcentratedPosition = + OsmosisSuperfluidTypes._( + "/osmosis.superfluid.MsgUnlockAndMigrateSharesToFullRangeConcentratedPosition"); + static const OsmosisSuperfluidTypes + msgUnlockAndMigrateSharesToFullRangeConcentratedPositionResponse = + OsmosisSuperfluidTypes._( + "/osmosis.superfluid.MsgUnlockAndMigrateSharesToFullRangeConcentratedPositionResponse"); + + static const OsmosisSuperfluidTypes + msgAddToConcentratedLiquiditySuperfluidPosition = + OsmosisSuperfluidTypes._( + "/osmosis.superfluid.MsgAddToConcentratedLiquiditySuperfluidPosition"); + static const OsmosisSuperfluidTypes + msgAddToConcentratedLiquiditySuperfluidPositionResponse = + OsmosisSuperfluidTypes._( + "/osmosis.superfluid.MsgAddToConcentratedLiquiditySuperfluidPositionResponse"); + + static const OsmosisSuperfluidTypes msgUnbondConvertAndStake = + OsmosisSuperfluidTypes._("/osmosis.superfluid.MsgUnbondConvertAndStake"); + static const OsmosisSuperfluidTypes msgUnbondConvertAndStakeResponse = + OsmosisSuperfluidTypes._( + "/osmosis.superfluid.MsgUnbondConvertAndStakeResponse"); + + static const OsmosisSuperfluidTypes queryUnpoolWhitelistRequest = + OsmosisSuperfluidTypes._( + "/osmosis.superfluid.QueryUnpoolWhitelistRequest"); + static const OsmosisSuperfluidTypes queryUnpoolWhitelistResponse = + OsmosisSuperfluidTypes._( + "/osmosis.superfluid.QueryUnpoolWhitelistResponse"); + + static const OsmosisSuperfluidTypes concentratedPoolUserPositionRecord = + OsmosisSuperfluidTypes._( + "/osmosis.superfluid.ConcentratedPoolUserPositionRecord"); + + static const OsmosisSuperfluidTypes + userConcentratedSuperfluidPositionsDelegatedRequest = + OsmosisSuperfluidTypes._( + "/osmosis.superfluid.UserConcentratedSuperfluidPositionsDelegatedRequest"); + static const OsmosisSuperfluidTypes + userConcentratedSuperfluidPositionsDelegatedResponse = + OsmosisSuperfluidTypes._( + "/osmosis.superfluid.UserConcentratedSuperfluidPositionsDelegatedResponse"); + + static const OsmosisSuperfluidTypes + userConcentratedSuperfluidPositionsUndelegatingRequest = + OsmosisSuperfluidTypes._( + "/osmosis.superfluid.UserConcentratedSuperfluidPositionsUndelegatingRequest"); + static const OsmosisSuperfluidTypes + userConcentratedSuperfluidPositionsUndelegatingResponse = + OsmosisSuperfluidTypes._( + "/osmosis.superfluid.UserConcentratedSuperfluidPositionsUndelegatingResponse"); + /// query + static const OsmosisSuperfluidTypes + userConcentratedSuperfluidPositionsUndelegating = + OsmosisSuperfluidTypes._( + "/osmosis.superfluid.Query/UserConcentratedSuperfluidPositionsUndelegating", + rpc: + "/osmosis/superfluid/v1beta1/account_undelegating_cl_positions/:delegator_address"); + static const OsmosisSuperfluidTypes + userConcentratedSuperfluidPositionsDelegated = OsmosisSuperfluidTypes._( + "/osmosis.superfluid.Query/UserConcentratedSuperfluidPositionsDelegated", + rpc: + "/osmosis/superfluid/v1beta1/account_delegated_cl_positions/:delegator_address"); + + static const OsmosisSuperfluidTypes unpoolWhitelist = + OsmosisSuperfluidTypes._("/osmosis.superfluid.Query/UnpoolWhitelist", + rpc: "/osmosis/superfluid/v1beta1/unpool_whitelist"); static const OsmosisSuperfluidTypes totalDelegationByDelegator = OsmosisSuperfluidTypes._( "/osmosis.superfluid.Query/TotalDelegationByDelegator", @@ -209,6 +293,21 @@ class OsmosisSuperfluidTypes extends TypeUrl { rpc: "/osmosis/superfluid/v1beta1/params"); /// services + static const OsmosisSuperfluidTypes unbondConvertAndStake = + OsmosisSuperfluidTypes._("/osmosis.superfluid.Msg/UnbondConvertAndStake"); + static const OsmosisSuperfluidTypes + adToConcentratedLiquiditySuperfluidPosition = OsmosisSuperfluidTypes._( + "/osmosis.superfluid.Msg/AddToConcentratedLiquiditySuperfluidPosition"); + static const OsmosisSuperfluidTypes + unlockAndMigrateSharesToFullRangeConcentratedPosition = + OsmosisSuperfluidTypes._( + "/osmosis.superfluid.Msg/UnlockAndMigrateSharesToFullRangeConcentratedPosition"); + static const OsmosisSuperfluidTypes + createFullRangePositionAndSuperfluidDelegate = OsmosisSuperfluidTypes._( + "/osmosis.superfluid.Msg/CreateFullRangePositionAndSuperfluidDelegate"); + static const OsmosisSuperfluidTypes superfluidUndelegateAndUnbondLock = + OsmosisSuperfluidTypes._( + "/osmosis.superfluid.Msg/SuperfluidUndelegateAndUnbondLock"); static const OsmosisSuperfluidTypes unPoolWhitelistedPool = OsmosisSuperfluidTypes._("/osmosis.superfluid.Msg/UnPoolWhitelistedPool"); static const OsmosisSuperfluidTypes lockAndSuperfluidDelegate = diff --git a/lib/src/models/networks/osmosis/osmosis_validator_preference_v1beta1/types/types.dart b/lib/src/models/networks/osmosis/osmosis_validator_preference_v1beta1/types/types.dart index 9794816..fbad98c 100644 --- a/lib/src/models/networks/osmosis/osmosis_validator_preference_v1beta1/types/types.dart +++ b/lib/src/models/networks/osmosis/osmosis_validator_preference_v1beta1/types/types.dart @@ -25,7 +25,7 @@ class OsmosisValidatorPreferenceV1beta1Types extends TypeUrl { static const OsmosisValidatorPreferenceV1beta1Types msgDelegateToValidatorSet = OsmosisValidatorPreferenceV1beta1Types._( - "/osmosis.validatorpreference.v1beta1.MsgDelegateToValidatorSet"); + "/osmosis.validatorpreference.v1beta1.Msg.DelegateToValidatorSet"); static const OsmosisValidatorPreferenceV1beta1Types msgDelegateToValidatorSetResponse = OsmosisValidatorPreferenceV1beta1Types._( diff --git a/lib/src/models/networks/thorchain/v1/events/event_streaming_swap.dart b/lib/src/models/networks/thorchain/v1/events/event_streaming_swap.dart index ff96c23..3b2cad7 100644 --- a/lib/src/models/networks/thorchain/v1/events/event_streaming_swap.dart +++ b/lib/src/models/networks/thorchain/v1/events/event_streaming_swap.dart @@ -41,7 +41,11 @@ class ThorchainEventStreamingSwap extends CosmosMessage { deposit: ThorchainCoin.deserialize(decode.getField(7)), inCoin: ThorchainCoin.deserialize(decode.getField(8)), outCoin: ThorchainCoin.deserialize(decode.getField(9)), - failedSwaps: decode.getFields(10), + failedSwaps: decode + .getResult(10) + ?.to, List>( + (e) => e.map((e) => BigintUtils.parse(e)).toList()) ?? + [], failedSwapReasonss: decode.getFields(11)); } diff --git a/lib/src/models/networks/thorchain/v1/messages/streaming_swap.dart b/lib/src/models/networks/thorchain/v1/messages/streaming_swap.dart index 8346489..2160c4f 100644 --- a/lib/src/models/networks/thorchain/v1/messages/streaming_swap.dart +++ b/lib/src/models/networks/thorchain/v1/messages/streaming_swap.dart @@ -1,3 +1,4 @@ +import 'package:blockchain_utils/numbers/numbers.dart'; import 'package:cosmos_sdk/src/models/models.dart'; import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; @@ -40,7 +41,11 @@ class ThorchainStreamingSwap extends CosmosMessage { deposit: BigInt.parse(decode.getField(7)), inValue: BigInt.parse(decode.getField(8)), outValue: BigInt.parse(decode.getField(9)), - failedSwaps: decode.getField(10), + failedSwaps: decode + .getResult(10) + ?.to, List>( + (e) => e.map((e) => BigintUtils.parse(e)).toList()) ?? + [], failedSwapReasons: decode.getField(11), ); } diff --git a/lib/src/models/networks/thorchain/v1/messages/vault.dart b/lib/src/models/networks/thorchain/v1/messages/vault.dart index 7c730ef..df20f52 100644 --- a/lib/src/models/networks/thorchain/v1/messages/vault.dart +++ b/lib/src/models/networks/thorchain/v1/messages/vault.dart @@ -1,3 +1,4 @@ +import 'package:blockchain_utils/numbers/numbers.dart'; import 'package:cosmos_sdk/src/models/models.dart'; import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; @@ -54,7 +55,11 @@ class ThorchainVault extends CosmosMessage { chains: decode.getFields(8), inboundTxCount: decode.getField(9), outboundTxCount: decode.getField(10), - pendingTxBlockHeights: decode.getFields(11), + pendingTxBlockHeights: decode + .getResult(11) + ?.to, List>( + (e) => e.map((e) => BigintUtils.parse(e)).toList()) ?? + [], routers: decode .getFields(22) .map((e) => ThorchainChainContract.deserialize(e)) diff --git a/lib/src/models/sdk_v1beta1/cosmos_base_v1beta1/messages/dec_coin.dart b/lib/src/models/sdk_v1beta1/cosmos_base_v1beta1/messages/dec_coin.dart index 771b8ab..2226d20 100755 --- a/lib/src/models/sdk_v1beta1/cosmos_base_v1beta1/messages/dec_coin.dart +++ b/lib/src/models/sdk_v1beta1/cosmos_base_v1beta1/messages/dec_coin.dart @@ -14,6 +14,9 @@ class DecCoin extends CosmosMessage { final decode = CosmosProtocolBuffer.decode(bytes); return DecCoin(denom: decode.getField(1), amount: decode.getField(2)); } + factory DecCoin.fromRpc(Map json) { + return DecCoin(denom: json["denom"], amount: json["amount"]); + } @override List get fieldIds => [1, 2]; diff --git a/lib/src/models/sdk_v1beta1/cosmos_staking_v1beta1/messages/validator.dart b/lib/src/models/sdk_v1beta1/cosmos_staking_v1beta1/messages/validator.dart index c0dca70..6427c63 100755 --- a/lib/src/models/sdk_v1beta1/cosmos_staking_v1beta1/messages/validator.dart +++ b/lib/src/models/sdk_v1beta1/cosmos_staking_v1beta1/messages/validator.dart @@ -93,7 +93,11 @@ class StakingValidator extends CosmosMessage { commission: Commission.deserialize(decode.getField(10)), minSelfDelegation: BigintUtils.parse(decode.getField(11)), unbondingOnHoldRefCount: decode.getField(12), - unbondingIds: decode.getFields(13)); + unbondingIds: decode + .getResult(13) + ?.to, List>( + (e) => e.map((e) => BigintUtils.parse(e)).toList()) ?? + []); } @override