diff --git a/CHANGELOG.md b/CHANGELOG.md index a3ec565..67e2a53 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.1.0 + +* Enhanced compatibility with the latest features of the Osmosis network.. + ## 0.0.10 * Fix importing issue diff --git a/example/test/widget_test.dart b/example/test/widget_test.dart index dc3a784..9a1df4a 100755 --- a/example/test/widget_test.dart +++ b/example/test/widget_test.dart @@ -22,21 +22,13 @@ // final publickey = privateKey.toPublicKey(); // // print(pr.toPublicKey().toAddresss(hrp: "osmo")); +// // final provider = TendermintProvider( +// // TendermintHTTPProvider(url: "https://lcd.osmotest5.osmosis.zone/")); // final provider = TendermintProvider( // TendermintHTTPProvider(url: "https://rpc.testnet.osmosis.zone/")); - -// final message = OsmosisValidatorPreferenceMsgDelegateToValidatorSet( +// final message = OsmosisValSetprefMsgDelegateToValidatorSet( // 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( @@ -48,11 +40,11 @@ // TendermintRequestAbciQuery(request: const GetLatestBlockRequest())); // final accountBalances = await provider.request(TendermintRequestAbciQuery( -// request: QueryAllBalancesRequest( -// address: publickey.toAddresss(hrp: CosmosAddrConst.osmosis)))); - -// /// OsmosisGammQueryPoolsRequest -// print("balances $accountBalances"); +// request: OsmosisConcentratedLiquidityPoolsRequest())); +// print(accountBalances.pools?.map((e) => e.typeUrl).toList().toSet()); +// return; +// // /// OsmosisGammQueryPoolsRequest +// // print("balances $accountBalances"); // // return; // /// Creating authentication info for transaction diff --git a/lib/src/models/core/account/account.dart b/lib/src/models/core/account/account.dart index b5cd295..34cacb6 100644 --- a/lib/src/models/core/account/account.dart +++ b/lib/src/models/core/account/account.dart @@ -1,6 +1,8 @@ import 'package:blockchain_utils/exception/exception.dart'; -import 'package:cosmos_sdk/cosmos_sdk.dart'; +import 'package:cosmos_sdk/src/models/sdk_v1beta1/cosmos_auth_v1beta1/messages/base_account.dart'; +import 'package:cosmos_sdk/src/models/sdk_v1beta1/cosmos_auth_v1beta1/messages/module_account.dart'; import 'package:cosmos_sdk/src/models/sdk_v1beta1/cosmos_auth_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; abstract class CosmosBaseAccount extends CosmosMessage { const CosmosBaseAccount(); diff --git a/lib/src/models/networks/osmosis/omosis.dart b/lib/src/models/networks/osmosis/omosis.dart index e777d5c..e4ea7a9 100644 --- a/lib/src/models/networks/osmosis/omosis.dart +++ b/lib/src/models/networks/osmosis/omosis.dart @@ -15,3 +15,12 @@ export 'osmosis_twap_v1beta1/osmosis_twap_v1beta1.dart'; export 'osmosis_txfees_v1beta1/osmosis_txfees_v1beta1.dart'; export 'osmosis_validator_preference_v1beta1/osmosis_validator_preference_v1beta1.dart'; export 'osmosis_stream_swap_v1/osmosis_stream_swap_v1.dart'; +export 'osmosis_concentrated_liquidity_v1beta1/osmosis_concentrated_liquidity_v1beta1.dart'; +export 'osmosis_concentratedliquidity_poolmodel_concentrated_1beta1/osmosis_concentratedliquidity_poolmodel_concentrated_1beta1.dart'; +export 'osmosis_protorev_v1beta1/osmosis_protorev_v1beta1.dart'; +export 'osmosis_valsetpref_v1beta1/osmosis_valsetpref_v1beta1.dart'; +export 'osmosis_poolmanager_v2/osmosis_poolmanager_v2.dart'; +export 'osmosis_poolmanager_v1beta1/osmosis_poolmanager_v1beta1.dart'; +export 'osmosis_ibchooks/osmosis_ibchooks.dart'; +export 'osmosis_concentratedliquidity/osmosis_concentratedliquidity.dart'; +export 'osmosis_accum_v1beta1/osmosis_accum_v1beta1.dart'; 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 index 19ae4ff..fe58a4d 100644 Binary files a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/.DS_Store and b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/.DS_Store differ diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/pool.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/pool.dart new file mode 100644 index 0000000..4d1d46c --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/pool.dart @@ -0,0 +1,108 @@ +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 OsmosisConcentratedLiquidityPool extends CosmosMessage { + /// pool's address holding all liquidity tokens. + final String? address; + + /// address holding the incentives liquidity. + final String? incentivesAddress; + + /// address holding spread rewards from swaps. + final String? spreadRewardsAddress; + final BigInt? id; + + /// Amount of total liquidity + final String currentTickLiquidity; + final String? token0; + final String? token1; + final String currentSqrtPrice; + final BigInt? currentTick; + + /// tick_spacing must be one of the authorized_tick_spacing values set in the + /// concentrated-liquidity parameters + final BigInt? tickSpacing; + final BigInt? exponentAtPriceOne; + + /// spread_factor is the ratio that is charged on the amount of token in. + final String spreadFactor; + + /// last_liquidity_update is the last time either the pool liquidity or the + /// active tick changed + final ProtobufTimestamp lastLiquidityUpdate; + OsmosisConcentratedLiquidityPool( + {this.address, + this.incentivesAddress, + this.spreadRewardsAddress, + this.id, + required this.currentTickLiquidity, + this.token0, + this.token1, + required this.currentSqrtPrice, + this.currentTick, + this.tickSpacing, + this.exponentAtPriceOne, + required this.spreadFactor, + required this.lastLiquidityUpdate}); + factory OsmosisConcentratedLiquidityPool.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityPool( + address: decode.getField(1), + incentivesAddress: decode.getField(2), + spreadRewardsAddress: decode.getField(3), + id: decode.getField(4), + currentTickLiquidity: decode.getField(5), + token0: decode.getField(6), + token1: decode.getField(7), + currentSqrtPrice: decode.getField(8), + currentTick: decode.getField(9), + tickSpacing: decode.getField(10), + exponentAtPriceOne: decode.getField(11), + spreadFactor: decode.getField(12), + lastLiquidityUpdate: + ProtobufTimestamp.deserialize(decode.getField(13))); + } + + @override + List get fieldIds => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]; + + @override + Map toJson() { + return { + "address": address, + "incentives_address": incentivesAddress, + "spread_rewards_address": spreadRewardsAddress, + "id": id?.toString(), + "current_tick_liquidity": currentTickLiquidity, + "token0": token0, + "token1": token1, + "current_sqrt_price": currentSqrtPrice, + "current_tick": currentTick?.toString(), + "tick_spacing": tickSpacing?.toString(), + "exponent_at_price_one": exponentAtPriceOne?.toString(), + "spread_factor": spreadFactor, + "last_liquidity_update": lastLiquidityUpdate.toJson() + }; + } + + @override + List get values => [ + address, + incentivesAddress, + spreadRewardsAddress, + id, + currentTickLiquidity, + token0, + token1, + currentSqrtPrice, + currentTick, + tickSpacing, + exponentAtPriceOne, + spreadFactor, + lastLiquidityUpdate + ]; + + @override + String get typeUrl => OsmosisConcentratedLiquidityV1beta1Types.pool.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 index f0208d2..3b3563b 100644 --- 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 @@ -3,30 +3,28 @@ import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentrated_liqu 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 { +class OsmosisConcentratedLiquidityPoolRecord extends CosmosMessage { final String? denom0; final String? denom1; final BigInt? tickSpacing; final String spreadFactor; - OsmosisConcentratedLiquidityPoolIdToTickSpacingRecord({ + OsmosisConcentratedLiquidityPoolRecord({ this.denom0, this.denom1, this.tickSpacing, required this.spreadFactor, }); - factory OsmosisConcentratedLiquidityPoolIdToTickSpacingRecord.deserialize( - List bytes) { + factory OsmosisConcentratedLiquidityPoolRecord.deserialize(List bytes) { final decode = CosmosProtocolBuffer.decode(bytes); - return OsmosisConcentratedLiquidityPoolIdToTickSpacingRecord( + return OsmosisConcentratedLiquidityPoolRecord( denom0: decode.getField(1), denom1: decode.getField(2), tickSpacing: decode.getField(3), spreadFactor: decode.getField(5)); } - factory OsmosisConcentratedLiquidityPoolIdToTickSpacingRecord.fromRpc( + factory OsmosisConcentratedLiquidityPoolRecord.fromRpc( Map json) { - return OsmosisConcentratedLiquidityPoolIdToTickSpacingRecord( + return OsmosisConcentratedLiquidityPoolRecord( denom0: json["denom0"], denom1: json["denom1"], tickSpacing: BigintUtils.tryParse(json["tick_spacing"]), diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/osmosis_concentrated_liquidity_v1beta1.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/osmosis_concentrated_liquidity_v1beta1.dart new file mode 100644 index 0000000..3f8d3d0 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/osmosis_concentrated_liquidity_v1beta1.dart @@ -0,0 +1,61 @@ +export 'messages/accum_object.dart'; +export 'messages/full_position_breakdown.dart'; +export 'messages/full_tick.dart'; +export 'messages/genesis_state.dart'; +export 'messages/incentive_record.dart'; +export 'messages/incentive_record_body.dart'; +export 'messages/liquidity_depth_with_range.dart'; +export 'messages/pool_data.dart'; +export 'messages/pool_id_to_tick_spacing_record.dart'; +export 'messages/pool_record.dart'; +export 'messages/position.dart'; +export 'messages/position_data.dart'; +export 'messages/position_with_period_lock.dart'; +export 'messages/tick_info.dart'; +export 'messages/tick_liquidity_net.dart'; +export 'messages/tick_spacing_decrease_proposal.dart'; +export 'messages/uptime_tracker.dart'; +export 'messages/uptime_trackers.dart'; + +export 'query/cfmm_pool_id_link_from_concentrated_pool_id_request.dart'; +export 'query/cfmm_pool_id_link_from_concentrated_pool_id_response.dart'; +export 'query/claimable_incentives_request.dart'; +export 'query/claimable_incentives_response.dart'; +export 'query/claimable_spread_rewards_request.dart'; +export 'query/claimable_spread_rewards_response.dart'; +export 'query/get_total_liquidity_request.dart'; +export 'query/get_total_liquidity_response.dart'; +export 'query/incentive_records_request.dart'; +export 'query/incentive_records_response.dart'; +export 'query/liquidity_net_in_direction_request.dart'; +export 'query/liquidity_net_in_direction_response.dart'; +export 'query/liquidity_per_tick_range_request.dart'; +export 'query/liquidity_per_tick_range_response.dart'; +export 'query/num_next_initialized_ticks_request.dart'; +export 'query/num_next_initialized_ticks_response.dart'; +export 'query/params_request.dart'; +export 'query/params_response.dart'; +export 'query/pool_accumulator_rewards_request.dart'; +export 'query/pool_accumulator_rewards_response.dart'; +export 'query/pools_request.dart'; +export 'query/pools_response.dart'; +export 'query/position_by_id_request.dart'; +export 'query/position_by_id_response.dart'; +export 'query/tick_accumulator_trackers_request.dart'; +export 'query/tick_accumulator_trackers_response.dart'; +export 'query/user_positions_request.dart'; +export 'query/user_positions_response.dart'; +export 'query/user_unbonding_positions_request.dart'; +export 'query/user_unbonding_positions_response.dart'; + +export 'services/msg_add_to_position.dart'; +export 'services/msg_add_to_position_response.dart'; +export 'services/msg_collect_incentives.dart'; +export 'services/msg_collect_incentives_response.dart'; +export 'services/msg_collect_spread_rewards.dart'; +export 'services/msg_collect_spread_rewards_response.dart'; +export 'services/msg_create_position.dart'; +export 'services/msg_create_position_response.dart'; +export 'services/msg_transfer_positions.dart'; +export 'services/msg_withdraw_position.dart'; +export 'services/msg_withdraw_position_response.dart'; diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/cfmm_pool_id_link_from_concentrated_pool_id_request.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/cfmm_pool_id_link_from_concentrated_pool_id_request.dart new file mode 100644 index 0000000..1a92746 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/cfmm_pool_id_link_from_concentrated_pool_id_request.dart @@ -0,0 +1,63 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'cfmm_pool_id_link_from_concentrated_pool_id_response.dart'; + +class OsmosisConcentratedLiquidityCFMMPoolIdLinkFromConcentratedPoolIdRequest + extends CosmosMessage + with + QueryMessage< + OsmosisConcentratedLiquidityCFMMPoolIdLinkFromConcentratedPoolIdResponse>, + RPCMessage< + OsmosisConcentratedLiquidityCFMMPoolIdLinkFromConcentratedPoolIdResponse> { + final BigInt? concentratedPoolId; + + const OsmosisConcentratedLiquidityCFMMPoolIdLinkFromConcentratedPoolIdRequest( + {this.concentratedPoolId}); + factory OsmosisConcentratedLiquidityCFMMPoolIdLinkFromConcentratedPoolIdRequest.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityCFMMPoolIdLinkFromConcentratedPoolIdRequest( + concentratedPoolId: decode.getField(1)); + } + + @override + List get fieldIds => [1]; + + @override + Map get queryParameters => {}; + + @override + String get queryPath => OsmosisConcentratedLiquidityV1beta1Types + .cFMMPoolIdLinkFromConcentratedPoolId.typeUrl; + + @override + String get rpcPath => OsmosisConcentratedLiquidityV1beta1Types + .cFMMPoolIdLinkFromConcentratedPoolId + .rpcUrl(pathParameters: [concentratedPoolId?.toString()]); + + @override + Map toJson() { + return {"concentrated_pool_id": concentratedPoolId?.toString()}; + } + + @override + String get typeUrl => OsmosisConcentratedLiquidityV1beta1Types + .cFMMPoolIdLinkFromConcentratedPoolIdRequest.typeUrl; + + @override + List get values => [concentratedPoolId]; + + @override + OsmosisConcentratedLiquidityCFMMPoolIdLinkFromConcentratedPoolIdResponse + onJsonResponse(Map json) { + return OsmosisConcentratedLiquidityCFMMPoolIdLinkFromConcentratedPoolIdResponse + .fromRpc(json); + } + + @override + OsmosisConcentratedLiquidityCFMMPoolIdLinkFromConcentratedPoolIdResponse + onResponse(List bytes) { + return OsmosisConcentratedLiquidityCFMMPoolIdLinkFromConcentratedPoolIdResponse + .deserialize(bytes); + } +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/cfmm_pool_id_link_from_concentrated_pool_id_response.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/cfmm_pool_id_link_from_concentrated_pool_id_response.dart new file mode 100644 index 0000000..b3cd6f3 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/cfmm_pool_id_link_from_concentrated_pool_id_response.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 OsmosisConcentratedLiquidityCFMMPoolIdLinkFromConcentratedPoolIdResponse + extends CosmosMessage { + final BigInt? cfmmPoolId; + + OsmosisConcentratedLiquidityCFMMPoolIdLinkFromConcentratedPoolIdResponse( + {this.cfmmPoolId}); + factory OsmosisConcentratedLiquidityCFMMPoolIdLinkFromConcentratedPoolIdResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityCFMMPoolIdLinkFromConcentratedPoolIdResponse( + cfmmPoolId: decode.getField(1)); + } + factory OsmosisConcentratedLiquidityCFMMPoolIdLinkFromConcentratedPoolIdResponse.fromRpc( + Map json) { + return OsmosisConcentratedLiquidityCFMMPoolIdLinkFromConcentratedPoolIdResponse( + cfmmPoolId: BigintUtils.tryParse(json["cfmm_pool_id"])); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"cfmm_pool_id": cfmmPoolId?.toString()}; + } + + @override + String get typeUrl => OsmosisConcentratedLiquidityV1beta1Types + .cFMMPoolIdLinkFromConcentratedPoolIdResponse.typeUrl; + + @override + List get values => [cfmmPoolId]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/claimable_incentives_request.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/claimable_incentives_request.dart new file mode 100644 index 0000000..ac8044b --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/claimable_incentives_request.dart @@ -0,0 +1,63 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'claimable_incentives_response.dart'; + +class OsmosisConcentratedLiquidityClaimableIncentivesRequest + extends CosmosMessage + with + QueryMessage, + RPCMessage { + final BigInt? positionId; + + const OsmosisConcentratedLiquidityClaimableIncentivesRequest({ + this.positionId, + }); + factory OsmosisConcentratedLiquidityClaimableIncentivesRequest.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityClaimableIncentivesRequest( + positionId: decode.getField(1)); + } + + @override + List get fieldIds => [1]; + + @override + Map get queryParameters => + {"position_id": positionId?.toString()}; + + @override + String get queryPath => + OsmosisConcentratedLiquidityV1beta1Types.claimableIncentives.typeUrl; + + @override + String get rpcPath => + OsmosisConcentratedLiquidityV1beta1Types.claimableIncentives + .rpcUrl(pathParameters: []); + + @override + Map toJson() { + return {"position_id": positionId?.toString()}; + } + + @override + String get typeUrl => OsmosisConcentratedLiquidityV1beta1Types + .claimableIncentivesRequest.typeUrl; + + @override + List get values => [positionId]; + + @override + OsmosisConcentratedLiquidityClaimableIncentivesResponse onJsonResponse( + Map json) { + return OsmosisConcentratedLiquidityClaimableIncentivesResponse.fromRpc( + json); + } + + @override + OsmosisConcentratedLiquidityClaimableIncentivesResponse onResponse( + List bytes) { + return OsmosisConcentratedLiquidityClaimableIncentivesResponse.deserialize( + bytes); + } +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/claimable_incentives_response.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/claimable_incentives_response.dart new file mode 100644 index 0000000..4140183 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/claimable_incentives_response.dart @@ -0,0 +1,57 @@ +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 OsmosisConcentratedLiquidityClaimableIncentivesResponse + extends CosmosMessage { + final List claimableIncentives; + final List forfeitedIncentives; + + OsmosisConcentratedLiquidityClaimableIncentivesResponse({ + required List claimableIncentives, + required List forfeitedIncentives, + }) : claimableIncentives = claimableIncentives.mutable, + forfeitedIncentives = forfeitedIncentives.mutable; + factory OsmosisConcentratedLiquidityClaimableIncentivesResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityClaimableIncentivesResponse( + claimableIncentives: + decode.getFields(1).map((e) => Coin.deserialize(e)).toList(), + forfeitedIncentives: + decode.getFields(2).map((e) => Coin.deserialize(e)).toList()); + } + factory OsmosisConcentratedLiquidityClaimableIncentivesResponse.fromRpc( + Map json) { + return OsmosisConcentratedLiquidityClaimableIncentivesResponse( + claimableIncentives: (json["claimable_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 { + "claimable_incentives": + claimableIncentives.map((e) => e.toJson()).toList(), + "forfeited_incentives": + forfeitedIncentives.map((e) => e.toJson()).toList(), + }; + } + + @override + String get typeUrl => OsmosisConcentratedLiquidityV1beta1Types + .claimableIncentivesResponse.typeUrl; + + @override + List get values => [claimableIncentives, forfeitedIncentives]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/claimable_spread_rewards_request.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/claimable_spread_rewards_request.dart new file mode 100644 index 0000000..f4ff547 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/claimable_spread_rewards_request.dart @@ -0,0 +1,65 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'claimable_spread_rewards_response.dart'; + +/// ClaimableSpreadRewards returns the amount of spread rewards that can be claimed by a position with the given id. +class OsmosisConcentratedLiquidityClaimableSpreadRewardsRequest + extends CosmosMessage + with + QueryMessage< + OsmosisConcentratedLiquidityClaimableSpreadRewardsResponse>, + RPCMessage { + final BigInt? positionId; + + const OsmosisConcentratedLiquidityClaimableSpreadRewardsRequest( + {this.positionId}); + factory OsmosisConcentratedLiquidityClaimableSpreadRewardsRequest.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityClaimableSpreadRewardsRequest( + positionId: decode.getField(1)); + } + + @override + List get fieldIds => [1]; + + @override + Map get queryParameters => { + "position_id": positionId?.toString(), + }; + + @override + String get queryPath => + OsmosisConcentratedLiquidityV1beta1Types.claimableSpreadRewards.typeUrl; + + @override + String get rpcPath => + OsmosisConcentratedLiquidityV1beta1Types.claimableSpreadRewards + .rpcUrl(pathParameters: []); + + @override + Map toJson() { + return {"position_id": positionId?.toString()}; + } + + @override + String get typeUrl => OsmosisConcentratedLiquidityV1beta1Types + .claimableSpreadRewardsRequest.typeUrl; + + @override + List get values => [positionId]; + + @override + OsmosisConcentratedLiquidityClaimableSpreadRewardsResponse onJsonResponse( + Map json) { + return OsmosisConcentratedLiquidityClaimableSpreadRewardsResponse.fromRpc( + json); + } + + @override + OsmosisConcentratedLiquidityClaimableSpreadRewardsResponse onResponse( + List bytes) { + return OsmosisConcentratedLiquidityClaimableSpreadRewardsResponse + .deserialize(bytes); + } +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/claimable_spread_rewards_response.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/claimable_spread_rewards_response.dart new file mode 100644 index 0000000..d99bb64 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/claimable_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/messages/coin.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; + +class OsmosisConcentratedLiquidityClaimableSpreadRewardsResponse + extends CosmosMessage { + final List claimableSpreadRewards; + + OsmosisConcentratedLiquidityClaimableSpreadRewardsResponse( + List claimableSpreadRewards) + : claimableSpreadRewards = claimableSpreadRewards.mutable; + factory OsmosisConcentratedLiquidityClaimableSpreadRewardsResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityClaimableSpreadRewardsResponse( + decode.getFields(1).map((e) => Coin.deserialize(e)).toList()); + } + factory OsmosisConcentratedLiquidityClaimableSpreadRewardsResponse.fromRpc( + Map json) { + return OsmosisConcentratedLiquidityClaimableSpreadRewardsResponse( + (json["claimable_spread_rewards"] as List?) + ?.map((e) => Coin.fromRpc(e)) + .toList() ?? + [], + ); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return { + "claimable_spread_rewards": + claimableSpreadRewards.map((e) => e.toJson()).toList() + }; + } + + @override + String get typeUrl => OsmosisConcentratedLiquidityV1beta1Types + .claimableSpreadRewardsResponse.typeUrl; + + @override + List get values => [claimableSpreadRewards]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/get_total_liquidity_request.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/get_total_liquidity_request.dart new file mode 100644 index 0000000..d1e7cdf --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/get_total_liquidity_request.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/protobuf/protobuf.dart'; +import 'get_total_liquidity_response.dart'; + +class OsmosisConcentratedLiquidityGetTotalLiquidityRequest extends CosmosMessage + with + QueryMessage, + RPCMessage { + const OsmosisConcentratedLiquidityGetTotalLiquidityRequest(); + factory OsmosisConcentratedLiquidityGetTotalLiquidityRequest.deserialize( + List bytes) { + return OsmosisConcentratedLiquidityGetTotalLiquidityRequest(); + } + + @override + List get fieldIds => []; + + @override + Map get queryParameters => {}; + + @override + String get queryPath => + OsmosisConcentratedLiquidityV1beta1Types.getTotalLiquidity.typeUrl; + + @override + String get rpcPath => + OsmosisConcentratedLiquidityV1beta1Types.getTotalLiquidity + .rpcUrl(pathParameters: []); + + @override + Map toJson() { + return {}; + } + + @override + String get typeUrl => + OsmosisConcentratedLiquidityV1beta1Types.getTotalLiquidityRequest.typeUrl; + + @override + List get values => []; + + @override + OsmosisConcentratedLiquidityGetTotalLiquidityResponse onJsonResponse( + Map json) { + return OsmosisConcentratedLiquidityGetTotalLiquidityResponse.fromRpc(json); + } + + @override + OsmosisConcentratedLiquidityGetTotalLiquidityResponse onResponse( + List bytes) { + return OsmosisConcentratedLiquidityGetTotalLiquidityResponse.deserialize( + bytes); + } +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/get_total_liquidity_response.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/get_total_liquidity_response.dart new file mode 100644 index 0000000..8330f49 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/get_total_liquidity_response.dart @@ -0,0 +1,43 @@ +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 OsmosisConcentratedLiquidityGetTotalLiquidityResponse + extends CosmosMessage { + final List totalLiquidity; + + OsmosisConcentratedLiquidityGetTotalLiquidityResponse( + List totalLiquidity) + : totalLiquidity = totalLiquidity.mutable; + factory OsmosisConcentratedLiquidityGetTotalLiquidityResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityGetTotalLiquidityResponse( + decode.getFields(1).map((e) => Coin.deserialize(e)).toList()); + } + factory OsmosisConcentratedLiquidityGetTotalLiquidityResponse.fromRpc( + Map json) { + return OsmosisConcentratedLiquidityGetTotalLiquidityResponse( + (json["total_liquidity"] as List?) + ?.map((e) => Coin.fromRpc(e)) + .toList() ?? + [], + ); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"total_liquidity": totalLiquidity.map((e) => e.toJson()).toList()}; + } + + @override + String get typeUrl => OsmosisConcentratedLiquidityV1beta1Types + .getTotalLiquidityResponse.typeUrl; + + @override + List get values => [totalLiquidity]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/incentive_records_request.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/incentive_records_request.dart new file mode 100644 index 0000000..b7fab23 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/incentive_records_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/models/sdk_v1beta1/cosmos_base_query_v1beta1/messages/page_request.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'incentive_records_response.dart'; + +class OsmosisConcentratedLiquidityIncentiveRecordsRequest extends CosmosMessage + with + QueryMessage, + RPCMessage { + final BigInt? poolId; + final PageRequest? pagination; + + const OsmosisConcentratedLiquidityIncentiveRecordsRequest( + {this.poolId, this.pagination}); + factory OsmosisConcentratedLiquidityIncentiveRecordsRequest.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityIncentiveRecordsRequest( + poolId: decode.getField(1), + pagination: decode + .getResult(2) + ?.to>((e) => PageRequest.deserialize(e))); + } + + @override + List get fieldIds => [1, 2]; + + @override + Map get queryParameters => {"pool_id": poolId?.toString()}; + + @override + String get queryPath => + OsmosisConcentratedLiquidityV1beta1Types.incentiveRecords.typeUrl; + + @override + String get rpcPath => + OsmosisConcentratedLiquidityV1beta1Types.incentiveRecords + .rpcUrl(pathParameters: []); + + @override + Map toJson() { + return {"pool_id": poolId?.toString(), "pagination": pagination?.toJson()}; + } + + @override + String get typeUrl => + OsmosisConcentratedLiquidityV1beta1Types.incentiveRecordsRequest.typeUrl; + + @override + List get values => [poolId, pagination]; + + @override + OsmosisConcentratedLiquidityIncentiveRecordsResponse onJsonResponse( + Map json) { + return OsmosisConcentratedLiquidityIncentiveRecordsResponse.fromRpc(json); + } + + @override + OsmosisConcentratedLiquidityIncentiveRecordsResponse onResponse( + List bytes) { + return OsmosisConcentratedLiquidityIncentiveRecordsResponse.deserialize( + bytes); + } +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/incentive_records_response.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/incentive_records_response.dart new file mode 100644 index 0000000..e8ddf64 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/incentive_records_response.dart @@ -0,0 +1,62 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/incentive_record.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 OsmosisConcentratedLiquidityIncentiveRecordsResponse + extends CosmosMessage { + final List incentiveRecords; + + /// pagination defines the pagination in the response. + final PageResponse? pagination; + + OsmosisConcentratedLiquidityIncentiveRecordsResponse( + {required List + incentiveRecords, + this.pagination}) + : incentiveRecords = incentiveRecords.mutable; + factory OsmosisConcentratedLiquidityIncentiveRecordsResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityIncentiveRecordsResponse( + incentiveRecords: decode + .getFields(1) + .map((e) => + OsmosisConcentratedLiquidityIncentiveRecord.deserialize(e)) + .toList(), + pagination: decode + .getResult(2) + ?.to>((e) => PageResponse.deserialize(e))); + } + factory OsmosisConcentratedLiquidityIncentiveRecordsResponse.fromRpc( + Map json) { + return OsmosisConcentratedLiquidityIncentiveRecordsResponse( + incentiveRecords: (json["incentive_records"] as List?) + ?.map((e) => + OsmosisConcentratedLiquidityIncentiveRecord.fromRpc(e)) + .toList() ?? + [], + pagination: json["pagination"] == null + ? null + : PageResponse.fromRpc(json["pagination"])); + } + + @override + List get fieldIds => [1, 2]; + + @override + Map toJson() { + return { + "incentive_records": incentiveRecords.map((e) => e.toJson()).toList(), + "pagination": pagination?.toJson() + }; + } + + @override + String get typeUrl => + OsmosisConcentratedLiquidityV1beta1Types.incentiveRecordsResponse.typeUrl; + + @override + List get values => [incentiveRecords, pagination]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/liquidity_net_in_direction_request.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/liquidity_net_in_direction_request.dart new file mode 100644 index 0000000..4400bbf --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/liquidity_net_in_direction_request.dart @@ -0,0 +1,93 @@ +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_net_in_direction_response.dart'; + +class OsmosisConcentratedLiquidityLiquidityNetInDirectionRequest + extends CosmosMessage + with + QueryMessage< + OsmosisConcentratedLiquidityLiquidityNetInDirectionResponse>, + RPCMessage< + OsmosisConcentratedLiquidityLiquidityNetInDirectionResponse> { + final BigInt? poolId; + final String? tokenIn; + final BigInt? startTick; + final bool? useCurTick; + final BigInt? boundTick; + final bool? useNoBound; + + const OsmosisConcentratedLiquidityLiquidityNetInDirectionRequest( + {this.poolId, + this.tokenIn, + this.startTick, + this.useCurTick, + this.boundTick, + this.useNoBound}); + factory OsmosisConcentratedLiquidityLiquidityNetInDirectionRequest.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityLiquidityNetInDirectionRequest( + poolId: decode.getField(1), + tokenIn: decode.getField(2), + startTick: decode.getField(3), + useCurTick: decode.getField(4), + boundTick: decode.getField(5), + useNoBound: decode.getField(6)); + } + + @override + List get fieldIds => [1, 2, 3, 4, 5, 6]; + + @override + Map get queryParameters => { + "pool_id": poolId?.toString(), + "token_in": tokenIn, + "start_tick": startTick?.toString(), + "use_cur_tick": useCurTick?.toString(), + "bound_tick": boundTick?.toString(), + "use_no_bound": useNoBound?.toString() + }; + + @override + String get queryPath => + OsmosisConcentratedLiquidityV1beta1Types.liquidityNetInDirection.typeUrl; + + @override + String get rpcPath => + OsmosisConcentratedLiquidityV1beta1Types.liquidityNetInDirection + .rpcUrl(pathParameters: []); + + @override + Map toJson() { + return { + "pool_id": poolId?.toString(), + "token_in": tokenIn, + "start_tick": startTick?.toString(), + "use_cur_tick": useCurTick, + "bound_tick": boundTick?.toString(), + "use_no_bound": useNoBound + }; + } + + @override + String get typeUrl => OsmosisConcentratedLiquidityV1beta1Types + .liquidityNetInDirectionRequest.typeUrl; + + @override + List get values => + [poolId, tokenIn, startTick, useCurTick, boundTick, useNoBound]; + + @override + OsmosisConcentratedLiquidityLiquidityNetInDirectionResponse onJsonResponse( + Map json) { + return OsmosisConcentratedLiquidityLiquidityNetInDirectionResponse.fromRpc( + json); + } + + @override + OsmosisConcentratedLiquidityLiquidityNetInDirectionResponse onResponse( + List bytes) { + return OsmosisConcentratedLiquidityLiquidityNetInDirectionResponse + .deserialize(bytes); + } +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/liquidity_net_in_direction_response.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/liquidity_net_in_direction_response.dart new file mode 100644 index 0000000..c534764 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/liquidity_net_in_direction_response.dart @@ -0,0 +1,67 @@ +import 'package:blockchain_utils/numbers/numbers.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/tick_liquidity_net.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 OsmosisConcentratedLiquidityLiquidityNetInDirectionResponse + extends CosmosMessage { + final List liquidityDepths; + final BigInt? currentTick; + final String currentLiquidity; + final String currentSqrtPrice; + OsmosisConcentratedLiquidityLiquidityNetInDirectionResponse( + {required List + liquidityDepths, + this.currentTick, + required this.currentLiquidity, + required this.currentSqrtPrice}) + : liquidityDepths = liquidityDepths.mutable; + factory OsmosisConcentratedLiquidityLiquidityNetInDirectionResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityLiquidityNetInDirectionResponse( + liquidityDepths: decode + .getFields(1) + .map((e) => + OsmosisConcentratedLiquidityTickLiquidityNet.deserialize(e)) + .toList(), + currentTick: decode.getField(2), + currentLiquidity: decode.getField(3), + currentSqrtPrice: decode.getField(4)); + } + factory OsmosisConcentratedLiquidityLiquidityNetInDirectionResponse.fromRpc( + Map json) { + return OsmosisConcentratedLiquidityLiquidityNetInDirectionResponse( + currentLiquidity: json["current_liquidity"], + currentSqrtPrice: json["current_sqrt_price"], + currentTick: BigintUtils.tryParse(json["current_tick"]), + liquidityDepths: (json["liquidity_depths"] as List?) + ?.map((e) => + OsmosisConcentratedLiquidityTickLiquidityNet.fromRpc(e)) + .toList() ?? + [], + ); + } + + @override + List get fieldIds => [1, 2, 3, 4]; + + @override + Map toJson() { + return { + "liquidity_depths": liquidityDepths.map((e) => e.toJson()).toList(), + "current_tick": currentTick?.toString(), + "current_liquidity": currentLiquidity, + "current_sqrt_price": currentSqrtPrice + }; + } + + @override + String get typeUrl => OsmosisConcentratedLiquidityV1beta1Types + .liquidityNetInDirectionResponse.typeUrl; + + @override + List get values => + [liquidityDepths, currentTick, currentLiquidity, currentSqrtPrice]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/num_next_initialized_ticks_request.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/num_next_initialized_ticks_request.dart new file mode 100644 index 0000000..a1a9a6c --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/num_next_initialized_ticks_request.dart @@ -0,0 +1,83 @@ +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 'num_next_initialized_ticks_response.dart'; + +class OsmosisConcentratedLiquidityNumNextInitializedTicksRequest + extends CosmosMessage + with + QueryMessage< + OsmosisConcentratedLiquidityNumNextInitializedTicksResponse>, + RPCMessage< + OsmosisConcentratedLiquidityNumNextInitializedTicksResponse> { + final BigInt? poolId; + final String? tokenInDenom; + final BigInt? numNextInitializedTicks; + OsmosisConcentratedLiquidityNumNextInitializedTicksRequest( + {this.poolId, this.tokenInDenom, this.numNextInitializedTicks}); + factory OsmosisConcentratedLiquidityNumNextInitializedTicksRequest.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityNumNextInitializedTicksRequest( + poolId: decode.getField(1), + tokenInDenom: decode.getField(2), + numNextInitializedTicks: decode.getField(3)); + } + factory OsmosisConcentratedLiquidityNumNextInitializedTicksRequest.fromRpc( + Map json) { + return OsmosisConcentratedLiquidityNumNextInitializedTicksRequest( + poolId: BigintUtils.tryParse(json["pool_id"]), + numNextInitializedTicks: + BigintUtils.tryParse(json["num_next_initialized_ticks"]), + tokenInDenom: json["token_in_denom"]); + } + + @override + List get fieldIds => [1, 2, 3]; + + @override + Map toJson() { + return { + "pool_id": poolId?.toString(), + "token_in_denom": tokenInDenom, + "num_next_initialized_ticks": numNextInitializedTicks?.toString() + }; + } + + @override + String get typeUrl => OsmosisConcentratedLiquidityV1beta1Types + .numNextInitializedTicksRequest.typeUrl; + + @override + List get values => [poolId, tokenInDenom, numNextInitializedTicks]; + + @override + Map get queryParameters => { + "pool_id": poolId?.toString(), + "token_in_denom": tokenInDenom, + "num_next_initialized_ticks": numNextInitializedTicks?.toString() + }; + + @override + String get queryPath => + OsmosisConcentratedLiquidityV1beta1Types.numNextInitializedTicks.typeUrl; + + @override + String get rpcPath => + OsmosisConcentratedLiquidityV1beta1Types.numNextInitializedTicks.rpcUrl(); + + @override + OsmosisConcentratedLiquidityNumNextInitializedTicksResponse onJsonResponse( + Map json) { + return OsmosisConcentratedLiquidityNumNextInitializedTicksResponse.fromRpc( + json); + } + + @override + OsmosisConcentratedLiquidityNumNextInitializedTicksResponse onResponse( + List bytes) { + return OsmosisConcentratedLiquidityNumNextInitializedTicksResponse + .deserialize(bytes); + } +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/num_next_initialized_ticks_response.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/num_next_initialized_ticks_response.dart new file mode 100644 index 0000000..1fae209 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/num_next_initialized_ticks_response.dart @@ -0,0 +1,60 @@ +import 'package:blockchain_utils/numbers/numbers.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/tick_liquidity_net.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 OsmosisConcentratedLiquidityNumNextInitializedTicksResponse + extends CosmosMessage { + final List liquidityDepths; + final BigInt? currentTick; + final String currentLiquidity; + + OsmosisConcentratedLiquidityNumNextInitializedTicksResponse({ + required List liquidityDepths, + this.currentTick, + required this.currentLiquidity, + }) : liquidityDepths = liquidityDepths.mutable; + factory OsmosisConcentratedLiquidityNumNextInitializedTicksResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityNumNextInitializedTicksResponse( + liquidityDepths: decode + .getFields(1) + .map((e) => + OsmosisConcentratedLiquidityTickLiquidityNet.deserialize(e)) + .toList(), + currentTick: decode.getField(2), + currentLiquidity: decode.getField(3)); + } + factory OsmosisConcentratedLiquidityNumNextInitializedTicksResponse.fromRpc( + Map json) { + return OsmosisConcentratedLiquidityNumNextInitializedTicksResponse( + liquidityDepths: (json["liquidity_depths"] as List?) + ?.map((e) => + OsmosisConcentratedLiquidityTickLiquidityNet.fromRpc(e)) + .toList() ?? + [], + currentTick: BigintUtils.tryParse(json["current_tick"]), + currentLiquidity: json["current_liquidity"]); + } + + @override + List get fieldIds => [1, 2, 3]; + + @override + Map toJson() { + return { + "liquidity_depths": liquidityDepths.map((e) => e.toJson()).toList(), + "current_tick": currentTick?.toString(), + "current_liquidity": currentLiquidity + }; + } + + @override + String get typeUrl => OsmosisConcentratedLiquidityV1beta1Types + .numNextInitializedTicksResponse.typeUrl; + + @override + List get values => [liquidityDepths, currentTick, currentLiquidity]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/pool_accumulator_rewards_request.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/pool_accumulator_rewards_request.dart new file mode 100644 index 0000000..05c366d --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/pool_accumulator_rewards_request.dart @@ -0,0 +1,59 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'pool_accumulator_rewards_response.dart'; + +class OsmosisConcentratedLiquidityPoolAccumulatorRewardsRequest + extends CosmosMessage + with + QueryMessage< + OsmosisConcentratedLiquidityPoolAccumulatorRewardsResponse>, + RPCMessage { + final BigInt? poolId; + OsmosisConcentratedLiquidityPoolAccumulatorRewardsRequest({this.poolId}); + factory OsmosisConcentratedLiquidityPoolAccumulatorRewardsRequest.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityPoolAccumulatorRewardsRequest( + poolId: decode.getField(1)); + } + + @override + List get fieldIds => [1]; + + @override + Map get queryParameters => {"pool_id": poolId?.toString()}; + + @override + String get queryPath => + OsmosisConcentratedLiquidityV1beta1Types.poolAccumulatorRewards.typeUrl; + + @override + String get rpcPath => + OsmosisConcentratedLiquidityV1beta1Types.poolAccumulatorRewards.rpcUrl(); + + @override + Map toJson() { + return {"pool_id": poolId?.toString()}; + } + + @override + String get typeUrl => OsmosisConcentratedLiquidityV1beta1Types + .poolAccumulatorRewardsRequest.typeUrl; + + @override + List get values => [poolId]; + + @override + OsmosisConcentratedLiquidityPoolAccumulatorRewardsResponse onJsonResponse( + Map json) { + return OsmosisConcentratedLiquidityPoolAccumulatorRewardsResponse.fromRpc( + json); + } + + @override + OsmosisConcentratedLiquidityPoolAccumulatorRewardsResponse onResponse( + List bytes) { + return OsmosisConcentratedLiquidityPoolAccumulatorRewardsResponse + .deserialize(bytes); + } +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/pool_accumulator_rewards_response.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/pool_accumulator_rewards_response.dart new file mode 100644 index 0000000..4f962e3 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/pool_accumulator_rewards_response.dart @@ -0,0 +1,62 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/uptime_trackers.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_v1beta1/messages/dec_coin.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; + +class OsmosisConcentratedLiquidityPoolAccumulatorRewardsResponse + extends CosmosMessage { + final List spreadRewardGrowthGlobal; + final List uptimeGrowthGlobal; + + OsmosisConcentratedLiquidityPoolAccumulatorRewardsResponse( + {required List spreadRewardGrowthGlobal, + required List + uptimeGrowthGlobal}) + : spreadRewardGrowthGlobal = spreadRewardGrowthGlobal.mutable, + uptimeGrowthGlobal = uptimeGrowthGlobal.mutable; + factory OsmosisConcentratedLiquidityPoolAccumulatorRewardsResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityPoolAccumulatorRewardsResponse( + spreadRewardGrowthGlobal: + decode.getFields(1).map((e) => DecCoin.deserialize(e)).toList(), + uptimeGrowthGlobal: decode + .getFields(2) + .map( + (e) => OsmosisConcentratedLiquidityUptimeTracker.deserialize(e)) + .toList()); + } + factory OsmosisConcentratedLiquidityPoolAccumulatorRewardsResponse.fromRpc( + Map json) { + return OsmosisConcentratedLiquidityPoolAccumulatorRewardsResponse( + spreadRewardGrowthGlobal: (json["spread_reward_growth_global"] as List?) + ?.map((e) => DecCoin.fromRpc(e)) + .toList() ?? + [], + uptimeGrowthGlobal: (json["uptime_growth_global"] as List?) + ?.map( + (e) => OsmosisConcentratedLiquidityUptimeTracker.fromRpc(e)) + .toList() ?? + []); + } + + @override + List get fieldIds => [1, 2]; + + @override + Map toJson() { + return { + "spread_reward_growth_global": + spreadRewardGrowthGlobal.map((e) => e.toJson()).toList(), + "uptime_growth_global": uptimeGrowthGlobal.map((e) => e.toJson()).toList() + }; + } + + @override + String get typeUrl => OsmosisConcentratedLiquidityV1beta1Types + .poolAccumulatorRewardsResponse.typeUrl; + + @override + List get values => [spreadRewardGrowthGlobal, uptimeGrowthGlobal]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/position_by_id_request.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/position_by_id_request.dart new file mode 100644 index 0000000..2736603 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/position_by_id_request.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/protobuf/protobuf.dart'; +import 'position_by_id_response.dart'; + +class OsmosisConcentratedLiquidityPositionByIdRequest extends CosmosMessage + with + QueryMessage, + RPCMessage { + final BigInt? positionId; + OsmosisConcentratedLiquidityPositionByIdRequest({this.positionId}); + factory OsmosisConcentratedLiquidityPositionByIdRequest.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityPositionByIdRequest( + positionId: decode.getField(1)); + } + + @override + List get fieldIds => [1]; + + @override + Map get queryParameters => {}; + + @override + String get queryPath => + OsmosisConcentratedLiquidityV1beta1Types.positionById.typeUrl; + + @override + String get rpcPath => + OsmosisConcentratedLiquidityV1beta1Types.positionById.rpcUrl(); + + @override + Map toJson() { + return {"position_id": positionId?.toString()}; + } + + @override + String get typeUrl => + OsmosisConcentratedLiquidityV1beta1Types.positionByIdRequest.typeUrl; + + @override + List get values => [positionId]; + + @override + OsmosisConcentratedLiquidityPositionByIdResponse onJsonResponse( + Map json) { + return OsmosisConcentratedLiquidityPositionByIdResponse.fromRpc(json); + } + + @override + OsmosisConcentratedLiquidityPositionByIdResponse onResponse(List bytes) { + return OsmosisConcentratedLiquidityPositionByIdResponse.deserialize(bytes); + } +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/position_by_id_response.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/position_by_id_response.dart new file mode 100644 index 0000000..1ab9b9b --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/position_by_id_response.dart @@ -0,0 +1,35 @@ +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/protobuf/protobuf.dart'; + +class OsmosisConcentratedLiquidityPositionByIdResponse extends CosmosMessage { + final FullPositionBreakdown position; + + OsmosisConcentratedLiquidityPositionByIdResponse(this.position); + factory OsmosisConcentratedLiquidityPositionByIdResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityPositionByIdResponse( + FullPositionBreakdown.deserialize(decode.getField(1))); + } + factory OsmosisConcentratedLiquidityPositionByIdResponse.fromRpc( + Map json) { + return OsmosisConcentratedLiquidityPositionByIdResponse( + FullPositionBreakdown.fromRpc(json["position"])); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"position": position.toJson()}; + } + + @override + String get typeUrl => + OsmosisConcentratedLiquidityV1beta1Types.positionByIdResponse.typeUrl; + + @override + List get values => [position]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/tick_accumulator_trackers_request.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/tick_accumulator_trackers_request.dart new file mode 100644 index 0000000..657fbe9 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/tick_accumulator_trackers_request.dart @@ -0,0 +1,63 @@ +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_accumulator_trackers_response.dart'; + +class OsmosisConcentratedLiquidityTickAccumulatorTrackersRequest + extends CosmosMessage + with + QueryMessage< + OsmosisConcentratedLiquidityTickAccumulatorTrackersResponse>, + RPCMessage< + OsmosisConcentratedLiquidityTickAccumulatorTrackersResponse> { + final BigInt? poolId; + final BigInt? tickIndex; + OsmosisConcentratedLiquidityTickAccumulatorTrackersRequest( + {this.poolId, this.tickIndex}); + factory OsmosisConcentratedLiquidityTickAccumulatorTrackersRequest.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityTickAccumulatorTrackersRequest( + poolId: decode.getField(1), tickIndex: decode.getField(2)); + } + + @override + List get fieldIds => [1, 2]; + + @override + Map get queryParameters => + {"pool_id": poolId?.toString(), "tick_index": tickIndex?.toString()}; + + @override + String get queryPath => + OsmosisConcentratedLiquidityV1beta1Types.tickAccumulatorTrackers.typeUrl; + + @override + String get rpcPath => + OsmosisConcentratedLiquidityV1beta1Types.tickAccumulatorTrackers.rpcUrl(); + + @override + Map toJson() { + return {"pool_id": poolId?.toString(), "tick_index": tickIndex?.toString()}; + } + + @override + String get typeUrl => OsmosisConcentratedLiquidityV1beta1Types + .tickAccumulatorTrackersRequest.typeUrl; + + @override + List get values => [poolId, tickIndex]; + + @override + OsmosisConcentratedLiquidityTickAccumulatorTrackersResponse onJsonResponse( + Map json) { + return OsmosisConcentratedLiquidityTickAccumulatorTrackersResponse.fromRpc( + json); + } + + @override + OsmosisConcentratedLiquidityTickAccumulatorTrackersResponse onResponse( + List bytes) { + return OsmosisConcentratedLiquidityTickAccumulatorTrackersResponse + .deserialize(bytes); + } +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/tick_accumulator_trackers_response.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/tick_accumulator_trackers_response.dart new file mode 100644 index 0000000..e4abd84 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/tick_accumulator_trackers_response.dart @@ -0,0 +1,68 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/uptime_trackers.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_v1beta1/messages/dec_coin.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; + +class OsmosisConcentratedLiquidityTickAccumulatorTrackersResponse + extends CosmosMessage { + final List spreadRewardGrowthOppositeDirectionOfLastTraversal; + final List uptimeTrackers; + + OsmosisConcentratedLiquidityTickAccumulatorTrackersResponse( + {required List + spreadRewardGrowthOppositeDirectionOfLastTraversal, + required List uptimeTrackers}) + : spreadRewardGrowthOppositeDirectionOfLastTraversal = + spreadRewardGrowthOppositeDirectionOfLastTraversal.mutable, + uptimeTrackers = uptimeTrackers.mutable; + factory OsmosisConcentratedLiquidityTickAccumulatorTrackersResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityTickAccumulatorTrackersResponse( + spreadRewardGrowthOppositeDirectionOfLastTraversal: + decode.getFields(1).map((e) => DecCoin.deserialize(e)).toList(), + uptimeTrackers: decode + .getFields(2) + .map( + (e) => OsmosisConcentratedLiquidityUptimeTracker.deserialize(e)) + .toList()); + } + factory OsmosisConcentratedLiquidityTickAccumulatorTrackersResponse.fromRpc( + Map json) { + return OsmosisConcentratedLiquidityTickAccumulatorTrackersResponse( + spreadRewardGrowthOppositeDirectionOfLastTraversal: + (json["spread_reward_growth_opposite_direction_of_last_traversal"] + as List?) + ?.map((e) => DecCoin.fromRpc(e)) + .toList() ?? + [], + uptimeTrackers: (json["uptime_trackers"] as List?) + ?.map( + (e) => OsmosisConcentratedLiquidityUptimeTracker.fromRpc(e)) + .toList() ?? + []); + } + + @override + List get fieldIds => [1, 2]; + + @override + Map toJson() { + return { + "spread_reward_growth_opposite_direction_of_last_traversal": + spreadRewardGrowthOppositeDirectionOfLastTraversal + .map((e) => e.toJson()) + .toList(), + "uptime_trackers": uptimeTrackers.map((e) => e.toJson()).toList() + }; + } + + @override + String get typeUrl => OsmosisConcentratedLiquidityV1beta1Types + .tickAccumulatorTrackersResponse.typeUrl; + + @override + List get values => + [spreadRewardGrowthOppositeDirectionOfLastTraversal, uptimeTrackers]; +} 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 index 39d763b..d31c039 100644 --- 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 @@ -56,7 +56,7 @@ class OsmosisConcentratedLiquidityUserPositionsRequest extends CosmosMessage OsmosisConcentratedLiquidityV1beta1Types.userPositionsRequest.typeUrl; @override - List get values => [pagination]; + List get values => [address, poolId, pagination]; @override OsmosisConcentratedLiquidityUserPositionsResponse onJsonResponse( diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/user_unbonding_positions_request.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/user_unbonding_positions_request.dart new file mode 100644 index 0000000..e7f8caf --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/user_unbonding_positions_request.dart @@ -0,0 +1,62 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'user_unbonding_positions_response.dart'; + +class OsmosisConcentratedLiquidityUserUnbondingPositionsRequest + extends CosmosMessage + with + QueryMessage< + OsmosisConcentratedLiquidityUserUnbondingPositionsResponse>, + RPCMessage { + final String? address; + + const OsmosisConcentratedLiquidityUserUnbondingPositionsRequest( + {this.address}); + factory OsmosisConcentratedLiquidityUserUnbondingPositionsRequest.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityUserUnbondingPositionsRequest( + address: decode.getField(1)); + } + + @override + List get fieldIds => [1]; + + @override + Map get queryParameters => {}; + + @override + String get queryPath => + OsmosisConcentratedLiquidityV1beta1Types.userUnbondingPositions.typeUrl; + + @override + String get rpcPath => + OsmosisConcentratedLiquidityV1beta1Types.userUnbondingPositions + .rpcUrl(pathParameters: [address]); + + @override + Map toJson() { + return {"address": address}; + } + + @override + String get typeUrl => OsmosisConcentratedLiquidityV1beta1Types + .userUnbondingPositionsRequest.typeUrl; + + @override + List get values => [address]; + + @override + OsmosisConcentratedLiquidityUserUnbondingPositionsResponse onJsonResponse( + Map json) { + return OsmosisConcentratedLiquidityUserUnbondingPositionsResponse.fromRpc( + json); + } + + @override + OsmosisConcentratedLiquidityUserUnbondingPositionsResponse onResponse( + List bytes) { + return OsmosisConcentratedLiquidityUserUnbondingPositionsResponse + .deserialize(bytes); + } +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/user_unbonding_positions_response.dart b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/user_unbonding_positions_response.dart new file mode 100644 index 0000000..04be5ec --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/query/user_unbonding_positions_response.dart @@ -0,0 +1,50 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentrated_liquidity_v1beta1/messages/position_with_period_lock.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 OsmosisConcentratedLiquidityUserUnbondingPositionsResponse + extends CosmosMessage { + final List positions; + + OsmosisConcentratedLiquidityUserUnbondingPositionsResponse( + {required List + positions}) + : positions = positions.mutable; + factory OsmosisConcentratedLiquidityUserUnbondingPositionsResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedLiquidityUserUnbondingPositionsResponse( + positions: decode + .getFields(1) + .map((e) => + OsmosisConcentratedLiquidityPositionWithPeriodLock.deserialize( + e)) + .toList()); + } + factory OsmosisConcentratedLiquidityUserUnbondingPositionsResponse.fromRpc( + Map json) { + return OsmosisConcentratedLiquidityUserUnbondingPositionsResponse( + positions: (json["positions"] as List?) + ?.map((e) => + OsmosisConcentratedLiquidityPositionWithPeriodLock.fromRpc( + e)) + .toList() ?? + []); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"positions": positions.map((e) => e.toJson()).toList()}; + } + + @override + String get typeUrl => OsmosisConcentratedLiquidityV1beta1Types + .userUnbondingPositionsResponse.typeUrl; + + @override + List get values => [positions]; +} 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 index ffbf7ab..9b96c6f 100644 --- 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 @@ -4,19 +4,19 @@ import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentrated_liqu import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; -class OsmosisConcentratedLiquidityMsgCollectSpreadRewards extends CosmosMessage - with ServiceMessage { +class OsmosisConcentratedLiquidityMsgTransferPositionsResponse + extends CosmosMessage with ServiceMessage { final List? positionIds; final String? sender; final String? newOwner; - OsmosisConcentratedLiquidityMsgCollectSpreadRewards( + OsmosisConcentratedLiquidityMsgTransferPositionsResponse( {List? positionIds, this.sender, this.newOwner}) : positionIds = positionIds?.nullOnEmpy; - factory OsmosisConcentratedLiquidityMsgCollectSpreadRewards.deserialize( + factory OsmosisConcentratedLiquidityMsgTransferPositionsResponse.deserialize( List bytes) { final decode = CosmosProtocolBuffer.decode(bytes); - return OsmosisConcentratedLiquidityMsgCollectSpreadRewards( + return OsmosisConcentratedLiquidityMsgTransferPositionsResponse( positionIds: decode .getResult(1) ?.to, List>( 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 index e4da25f..3ddf4e9 100644 --- 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 @@ -18,6 +18,9 @@ class OsmosisConcentratedLiquidityV1beta1Types extends TypeUrl { static const OsmosisConcentratedLiquidityV1beta1Types poolRecord = OsmosisConcentratedLiquidityV1beta1Types._( "/osmosis.concentratedliquidity.v1beta1.PoolRecord"); + static const OsmosisConcentratedLiquidityV1beta1Types pool = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.Pool"); static const OsmosisConcentratedLiquidityV1beta1Types tickSpacingDecreaseProposal = OsmosisConcentratedLiquidityV1beta1Types._( @@ -143,7 +146,157 @@ class OsmosisConcentratedLiquidityV1beta1Types extends TypeUrl { OsmosisConcentratedLiquidityV1beta1Types._( "/osmosis.concentratedliquidity.v1beta1.LiquidityPerTickRangeResponse"); + static const OsmosisConcentratedLiquidityV1beta1Types + liquidityNetInDirectionRequest = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.LiquidityNetInDirectionRequest"); + static const OsmosisConcentratedLiquidityV1beta1Types + liquidityNetInDirectionResponse = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.LiquidityPerTickRangeResponse"); + + static const OsmosisConcentratedLiquidityV1beta1Types + claimableSpreadRewardsRequest = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.ClaimableSpreadRewardsRequest"); + static const OsmosisConcentratedLiquidityV1beta1Types + claimableSpreadRewardsResponse = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.ClaimableSpreadRewardsResponse"); + + static const OsmosisConcentratedLiquidityV1beta1Types + claimableIncentivesRequest = OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.ClaimableIncentivesRequest"); + static const OsmosisConcentratedLiquidityV1beta1Types + claimableIncentivesResponse = OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.ClaimableIncentivesResponse"); + + static const OsmosisConcentratedLiquidityV1beta1Types positionByIdRequest = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.PositionByIdRequest"); + static const OsmosisConcentratedLiquidityV1beta1Types positionByIdResponse = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.PositionByIdResponse"); + + static const OsmosisConcentratedLiquidityV1beta1Types + poolAccumulatorRewardsRequest = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.PoolAccumulatorRewardsRequest"); + static const OsmosisConcentratedLiquidityV1beta1Types + poolAccumulatorRewardsResponse = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.PoolAccumulatorRewardsResponse"); + + static const OsmosisConcentratedLiquidityV1beta1Types + incentiveRecordsRequest = OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.IncentiveRecordsRequest"); + static const OsmosisConcentratedLiquidityV1beta1Types + incentiveRecordsResponse = OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.IncentiveRecordsResponse"); + + static const OsmosisConcentratedLiquidityV1beta1Types + tickAccumulatorTrackersRequest = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.TickAccumulatorTrackersRequest"); + static const OsmosisConcentratedLiquidityV1beta1Types + tickAccumulatorTrackersResponse = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.TickAccumulatorTrackersResponse"); + + static const OsmosisConcentratedLiquidityV1beta1Types + cFMMPoolIdLinkFromConcentratedPoolIdRequest = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.CFMMPoolIdLinkFromConcentratedPoolIdRequest"); + static const OsmosisConcentratedLiquidityV1beta1Types + cFMMPoolIdLinkFromConcentratedPoolIdResponse = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.CFMMPoolIdLinkFromConcentratedPoolIdResponse"); + + static const OsmosisConcentratedLiquidityV1beta1Types + userUnbondingPositionsRequest = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.UserUnbondingPositionsRequest"); + static const OsmosisConcentratedLiquidityV1beta1Types + userUnbondingPositionsResponse = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.UserUnbondingPositionsResponse"); + + static const OsmosisConcentratedLiquidityV1beta1Types + getTotalLiquidityRequest = OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.GetTotalLiquidityRequest"); + static const OsmosisConcentratedLiquidityV1beta1Types + getTotalLiquidityResponse = OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.GetTotalLiquidityResponse"); + + static const OsmosisConcentratedLiquidityV1beta1Types + numNextInitializedTicksRequest = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.NumNextInitializedTicksRequest"); + static const OsmosisConcentratedLiquidityV1beta1Types + numNextInitializedTicksResponse = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.NumNextInitializedTicksResponse"); + /// query + static const OsmosisConcentratedLiquidityV1beta1Types + numNextInitializedTicks = OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.Query/NumNextInitializedTicks", + rpc: + "/osmosis/concentratedliquidity/v1beta1/num_next_initialized_ticks"); + + static const OsmosisConcentratedLiquidityV1beta1Types getTotalLiquidity = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.Query/GetTotalLiquidity", + rpc: "/osmosis/concentratedliquidity/v1beta1/get_total_liquidity"); + + static const OsmosisConcentratedLiquidityV1beta1Types userUnbondingPositions = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.Query/UserUnbondingPositions", + rpc: + "/osmosis/concentratedliquidity/v1beta1/user_unbonding_positions/:address"); + + static const OsmosisConcentratedLiquidityV1beta1Types + cFMMPoolIdLinkFromConcentratedPoolId = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.Query/CFMMPoolIdLinkFromConcentratedPoolId", + rpc: + "/osmosis/concentratedliquidity/v1beta1/cfmm_pool_id_link_from_concentrated/:concentrated_pool_id"); + + static const OsmosisConcentratedLiquidityV1beta1Types + tickAccumulatorTrackers = OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.Query/TickAccumulatorTrackers", + rpc: "/osmosis/concentratedliquidity/v1beta1/tick_accum_trackers"); + + static const OsmosisConcentratedLiquidityV1beta1Types incentiveRecords = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.Query/IncentiveRecords", + rpc: "/osmosis/concentratedliquidity/v1beta1/incentive_records"); + + static const OsmosisConcentratedLiquidityV1beta1Types poolAccumulatorRewards = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.Query/PoolAccumulatorRewards", + rpc: "/osmosis/concentratedliquidity/v1beta1/pool_accum_rewards"); + + static const OsmosisConcentratedLiquidityV1beta1Types positionById = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.Query/PositionById", + rpc: "/osmosis/concentratedliquidity/v1beta1/position_by_id"); + + static const OsmosisConcentratedLiquidityV1beta1Types claimableIncentives = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.Query/ClaimableIncentives", + rpc: "/osmosis/concentratedliquidity/v1beta1/claimable_incentives"); + static const OsmosisConcentratedLiquidityV1beta1Types claimableSpreadRewards = + OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.Query/ClaimableSpreadRewards", + rpc: + "/osmosis/concentratedliquidity/v1beta1/claimable_spread_rewards"); + + static const OsmosisConcentratedLiquidityV1beta1Types + liquidityNetInDirection = OsmosisConcentratedLiquidityV1beta1Types._( + "/osmosis.concentratedliquidity.v1beta1.Query/LiquidityNetInDirection", + rpc: + "/osmosis/concentratedliquidity/v1beta1/liquidity_net_in_direction"); static const OsmosisConcentratedLiquidityV1beta1Types liquidityDepthWithRangeQuery = OsmosisConcentratedLiquidityV1beta1Types._( "/osmosis.concentratedliquidity.v1beta1.Query/LiquidityDepthWithRange", diff --git a/lib/src/models/networks/osmosis/osmosis_concentratedliquidity_poolmodel_concentrated_1beta1/osmosis_concentratedliquidity_poolmodel_concentrated_1beta1.dart b/lib/src/models/networks/osmosis/osmosis_concentratedliquidity_poolmodel_concentrated_1beta1/osmosis_concentratedliquidity_poolmodel_concentrated_1beta1.dart new file mode 100644 index 0000000..d5c2280 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentratedliquidity_poolmodel_concentrated_1beta1/osmosis_concentratedliquidity_poolmodel_concentrated_1beta1.dart @@ -0,0 +1,2 @@ +export 'services/msg_create_concentrated_pool.dart'; +export 'services/msg_create_concentrated_pool_response.dart'; diff --git a/lib/src/models/networks/osmosis/osmosis_concentratedliquidity_poolmodel_concentrated_1beta1/services/msg_create_concentrated_pool.dart b/lib/src/models/networks/osmosis/osmosis_concentratedliquidity_poolmodel_concentrated_1beta1/services/msg_create_concentrated_pool.dart new file mode 100644 index 0000000..9b05310 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentratedliquidity_poolmodel_concentrated_1beta1/services/msg_create_concentrated_pool.dart @@ -0,0 +1,68 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentratedliquidity_poolmodel_concentrated_1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +class OsmosisConcentratedliquidityPoolmodelConcentratedMsgCreateConcentratedPool + extends CosmosMessage + with + ServiceMessage< + OsmosisConcentratedliquidityPoolmodelConcentratedMsgCreateConcentratedPool> { + final String? sender; + final String? denom0; + final String? denom1; + final BigInt? tickSpacing; + final String? spreadFactor; + + const OsmosisConcentratedliquidityPoolmodelConcentratedMsgCreateConcentratedPool( + {this.sender, + this.denom0, + this.denom1, + this.tickSpacing, + this.spreadFactor}); + factory OsmosisConcentratedliquidityPoolmodelConcentratedMsgCreateConcentratedPool.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedliquidityPoolmodelConcentratedMsgCreateConcentratedPool( + sender: decode.getField(1), + denom0: decode.getField(2), + denom1: decode.getField(3), + tickSpacing: decode.getField(4), + spreadFactor: decode.getField(5)); + } + + @override + List get fieldIds => [1, 2, 3, 4, 5]; + + @override + OsmosisConcentratedliquidityPoolmodelConcentratedMsgCreateConcentratedPool + onResponse(List bytes) { + return OsmosisConcentratedliquidityPoolmodelConcentratedMsgCreateConcentratedPool + .deserialize(bytes); + } + + @override + String get service => + OsmosisConcentratedliquidityPoolmodelConcentratedV1beta1Types + .createConcentratedPool.typeUrl; + + @override + List get signers => [sender]; + + @override + Map toJson() { + return { + "sender": sender, + "denom0": denom0, + "denom1": denom1, + "tick_spacing": tickSpacing?.toString(), + "spread_factor": spreadFactor + }; + } + + @override + String get typeUrl => + OsmosisConcentratedliquidityPoolmodelConcentratedV1beta1Types + .msgCreateConcentratedPool.typeUrl; + + @override + List get values => [sender, denom0, denom1, tickSpacing, spreadFactor]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentratedliquidity_poolmodel_concentrated_1beta1/services/msg_create_concentrated_pool_response.dart b/lib/src/models/networks/osmosis/osmosis_concentratedliquidity_poolmodel_concentrated_1beta1/services/msg_create_concentrated_pool_response.dart new file mode 100644 index 0000000..d630fa5 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentratedliquidity_poolmodel_concentrated_1beta1/services/msg_create_concentrated_pool_response.dart @@ -0,0 +1,32 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_concentratedliquidity_poolmodel_concentrated_1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +class OsmosisConcentratedliquidityPoolmodelConcentratedMsgCreateConcentratedPoolResponse + extends CosmosMessage { + final BigInt? poolId; + + const OsmosisConcentratedliquidityPoolmodelConcentratedMsgCreateConcentratedPoolResponse( + {this.poolId}); + factory OsmosisConcentratedliquidityPoolmodelConcentratedMsgCreateConcentratedPoolResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisConcentratedliquidityPoolmodelConcentratedMsgCreateConcentratedPoolResponse( + poolId: decode.getField(1)); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"pool_id": poolId?.toString()}; + } + + @override + String get typeUrl => + OsmosisConcentratedliquidityPoolmodelConcentratedV1beta1Types + .msgCreateConcentratedPoolResponse.typeUrl; + + @override + List get values => [poolId]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_concentratedliquidity_poolmodel_concentrated_1beta1/types/types.dart b/lib/src/models/networks/osmosis/osmosis_concentratedliquidity_poolmodel_concentrated_1beta1/types/types.dart new file mode 100644 index 0000000..6b44931 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_concentratedliquidity_poolmodel_concentrated_1beta1/types/types.dart @@ -0,0 +1,25 @@ +import 'package:cosmos_sdk/src/models/core/type_url/type_url.dart'; + +class OsmosisConcentratedliquidityPoolmodelConcentratedV1beta1Types + extends TypeUrl { + @override + final String typeUrl; + @override + final String? rpc = null; + const OsmosisConcentratedliquidityPoolmodelConcentratedV1beta1Types._( + this.typeUrl); + static const OsmosisConcentratedliquidityPoolmodelConcentratedV1beta1Types + msgCreateConcentratedPool = + OsmosisConcentratedliquidityPoolmodelConcentratedV1beta1Types._( + "/osmosis.concentratedliquidity.poolmodel.concentrated.v1beta1.MsgCreateConcentratedPool"); + static const OsmosisConcentratedliquidityPoolmodelConcentratedV1beta1Types + msgCreateConcentratedPoolResponse = + OsmosisConcentratedliquidityPoolmodelConcentratedV1beta1Types._( + "/osmosis.concentratedliquidity.poolmodel.concentrated.v1beta1.MsgCreateConcentratedPoolResponse"); + + /// service + static const OsmosisConcentratedliquidityPoolmodelConcentratedV1beta1Types + createConcentratedPool = + OsmosisConcentratedliquidityPoolmodelConcentratedV1beta1Types._( + "/osmosis.concentratedliquidity.poolmodel.concentrated.v1beta1.Msg/CreateConcentratedPool"); +} diff --git a/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/messages/calc_out_amt_given_in.dart b/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/messages/calc_out_amt_given_in.dart new file mode 100644 index 0000000..be0a3f0 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/messages/calc_out_amt_given_in.dart @@ -0,0 +1,43 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_cosmwasmpool_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'; + +class OsmosisCosmWasmPoolCalcOutAmtGivenIn extends CosmosMessage { + /// [tokenIn] is the token to be sent to the pool. + final Coin tokenIn; + + /// [tokenOutDenom] is the token denom to be received from the pool + final String? tokenOutDenom; + + /// [swapFee] is the swap fee for this swap estimate. + final String swapFee; + + OsmosisCosmWasmPoolCalcOutAmtGivenIn( + {required this.tokenIn, this.tokenOutDenom, required this.swapFee}); + factory OsmosisCosmWasmPoolCalcOutAmtGivenIn.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisCosmWasmPoolCalcOutAmtGivenIn( + tokenIn: Coin.deserialize(decode.getField(1)), + tokenOutDenom: decode.getField(2), + swapFee: decode.getField(3)); + } + + @override + List get fieldIds => [1, 2, 3]; + + @override + Map toJson() { + return { + "token_in": tokenIn.toJson(), + "token_out_denom": tokenOutDenom, + "swap_fee": swapFee + }; + } + + @override + String get typeUrl => + OsmosisCosmWasmPoolV1beta1Types.calcOutAmtGivenIn.typeUrl; + + @override + List get values => [tokenIn, tokenOutDenom, swapFee]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/messages/calc_out_amt_given_out.dart b/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/messages/calc_out_amt_given_out.dart new file mode 100644 index 0000000..fcbce61 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/messages/calc_out_amt_given_out.dart @@ -0,0 +1,43 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_cosmwasmpool_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'; + +class OsmosisCosmWasmPoolCalcInAmtGivenOut extends CosmosMessage { + /// [tokenOut] is the token out to be receoved from the pool. + final Coin tokenOut; + + /// [tokenInDenom] is the token denom to be sentt to the pool. + final String? tokenInDenom; + + /// [swapFee] is the swap fee for this swap estimate. + final String swapFee; + + OsmosisCosmWasmPoolCalcInAmtGivenOut( + {required this.tokenOut, this.tokenInDenom, required this.swapFee}); + factory OsmosisCosmWasmPoolCalcInAmtGivenOut.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisCosmWasmPoolCalcInAmtGivenOut( + tokenOut: Coin.deserialize(decode.getField(1)), + tokenInDenom: decode.getField(2), + swapFee: decode.getField(3)); + } + + @override + List get fieldIds => [1, 2, 3]; + + @override + Map toJson() { + return { + "token_out": tokenOut.toJson(), + "token_out_denom": tokenInDenom, + "swap_fee": swapFee + }; + } + + @override + String get typeUrl => + OsmosisCosmWasmPoolV1beta1Types.calcInAmtGivenOut.typeUrl; + + @override + List get values => [tokenOut, tokenInDenom, swapFee]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/messages/cosm_wasm_pool.dart b/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/messages/cosm_wasm_pool.dart new file mode 100644 index 0000000..d336671 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/messages/cosm_wasm_pool.dart @@ -0,0 +1,53 @@ +import 'package:blockchain_utils/binary/binary.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +/// CosmWasmPool represents the data serialized into state for each CW pool. +/// Note: CW Pool has 2 pool models: +/// CosmWasmPool which is a proto-generated store model used for serialization into state. +/// Pool struct that encapsulates the CosmWasmPool and wasmKeeper for calling the contract. +/// CosmWasmPool implements the poolmanager.PoolI interface but it panics on all methods. +/// The reason is that access to wasmKeeper is required to call the contract. +/// Instead, all interactions and poolmanager.PoolI methods are to be performed on the Pool struct. +/// The reason why we cannot have a Pool struct only is because it cannot be serialized +/// into state due to having a non-serializable wasmKeeper field. +class OsmosisCosmWasmPoolCosmWasmPool extends CosmosMessage { + final String? contractAddress; + final BigInt? poolId; + final BigInt? codeId; + final List? instantiateMsg; + OsmosisCosmWasmPoolCosmWasmPool( + {this.contractAddress, + this.poolId, + this.codeId, + List? instantiateMsg}) + : instantiateMsg = + BytesUtils.tryToBytes(instantiateMsg, unmodifiable: true); + factory OsmosisCosmWasmPoolCosmWasmPool.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisCosmWasmPoolCosmWasmPool( + contractAddress: decode.getField(1), + poolId: decode.getField(2), + codeId: decode.getField(3), + instantiateMsg: decode.getField(4)); + } + + @override + List get fieldIds => [1, 2, 3, 4]; + + @override + Map toJson() { + return { + "contract_address": contractAddress, + "pool_id": poolId?.toString(), + "code_id": codeId?.toString(), + "instantiate_msg": BytesUtils.tryToHexString(instantiateMsg) + }; + } + + @override + String get typeUrl => OsmosisCosmWasmPoolV1beta1Types.cosmWasmPool.typeUrl; + + @override + List get values => [contractAddress, poolId, codeId, instantiateMsg]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/messages/empty_request.dart b/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/messages/empty_request.dart new file mode 100644 index 0000000..ed8e7ca --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/messages/empty_request.dart @@ -0,0 +1,23 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +class OsmosisCosmWasmPoolEmptyRequest extends CosmosMessage { + OsmosisCosmWasmPoolEmptyRequest(); + factory OsmosisCosmWasmPoolEmptyRequest.deserialize(List bytes) { + return OsmosisCosmWasmPoolEmptyRequest(); + } + + @override + List get fieldIds => []; + + @override + Map toJson() { + return {}; + } + + @override + String get typeUrl => OsmosisCosmWasmPoolV1beta1Types.emptyRequest.typeUrl; + + @override + List get values => []; +} diff --git a/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/messages/empty_struct.dart b/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/messages/empty_struct.dart new file mode 100644 index 0000000..de6bb51 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/messages/empty_struct.dart @@ -0,0 +1,23 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +class OsmosisCosmWasmPoolEmptyStruct extends CosmosMessage { + OsmosisCosmWasmPoolEmptyStruct(); + factory OsmosisCosmWasmPoolEmptyStruct.deserialize(List bytes) { + return OsmosisCosmWasmPoolEmptyStruct(); + } + + @override + List get fieldIds => []; + + @override + Map toJson() { + return {}; + } + + @override + String get typeUrl => OsmosisCosmWasmPoolV1beta1Types.emptyStruct.typeUrl; + + @override + List get values => []; +} diff --git a/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/messages/genesis_state.dart b/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/messages/genesis_state.dart new file mode 100644 index 0000000..ea93da3 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/messages/genesis_state.dart @@ -0,0 +1,37 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/messages/params.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; + +/// GenesisState defines the cosmwasmpool module's genesis state. +class OsmosisCosmWasmPoolGenesisState extends CosmosMessage { + /// params is the container of cosmwasmpool parameters. + final OsmosisCosmWasmPoolParams params; + final List? pools; + + OsmosisCosmWasmPoolGenesisState({required this.params, List? pools}) + : pools = pools?.nullOnEmpy; + factory OsmosisCosmWasmPoolGenesisState.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisCosmWasmPoolGenesisState( + params: OsmosisCosmWasmPoolParams.deserialize(decode.getField(1)), + pools: decode.getFields(2).map((e) => Any.deserialize(e)).toList()); + } + + @override + List get fieldIds => [1, 2]; + + @override + Map toJson() { + return { + "params": params.toJson(), + "pools": pools?.map((e) => e.toJson()).toList() + }; + } + + @override + String get typeUrl => OsmosisCosmWasmPoolV1beta1Types.gnesisState.typeUrl; + + @override + List get values => [params, pools]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/messages/instantiate_msg.dart b/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/messages/instantiate_msg.dart new file mode 100644 index 0000000..213b243 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/messages/instantiate_msg.dart @@ -0,0 +1,31 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; + +class OsmosisCosmWasmPoolInstantiateMsg extends CosmosMessage { + /// [poolAssetDenoms] is the list of asset denoms that are initialized + /// at pool creation time. + final List? poolAssetDenoms; + + OsmosisCosmWasmPoolInstantiateMsg({List? poolAssetDenoms}) + : poolAssetDenoms = poolAssetDenoms?.nullOnEmpy; + factory OsmosisCosmWasmPoolInstantiateMsg.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisCosmWasmPoolInstantiateMsg( + poolAssetDenoms: decode.getFields(1)); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"poolAssetDenoms": poolAssetDenoms}; + } + + @override + String get typeUrl => OsmosisCosmWasmPoolV1beta1Types.instantiateMsg.typeUrl; + + @override + List get values => [poolAssetDenoms]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/messages/migrate_pool_contracts_proposal.dart b/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/messages/migrate_pool_contracts_proposal.dart new file mode 100644 index 0000000..0061e06 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/messages/migrate_pool_contracts_proposal.dart @@ -0,0 +1,90 @@ +import 'package:blockchain_utils/binary/binary.dart'; +import 'package:blockchain_utils/numbers/numbers.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; + +/// MigratePoolContractsProposal is a gov Content type for migrating given pools to the new +/// contract code and adding to internal whitelist if needed. It has two options to perform the migration: +/// If the codeID is non-zero, it will migrate the pool contracts to a given codeID assuming that +/// it has already been uploaded. uploadByteCode must be empty in such a case. Fails if codeID does +/// not exist. Fails if uploadByteCode is not empty. +/// If the codeID is zero, it will upload the given uploadByteCode and use the new resulting code +/// id to migrate the pool to. Errors if uploadByteCode is empty or invalid. +/// In both cases, if one of the pools specified by the given poolID does not exist, the proposal fails. +/// The reason for having poolIDs be a slice of ids is to account for the potential need for emergency +/// migration of all old code ids associated with particular pools to new code ids, or simply having the +/// flexibility of migrating multiple older pool contracts to a new one at once when there is a release. +/// poolD count to be submitted at once is gated by a governance paramets (20 at launch). The proposal +/// fails if more. Note that 20 was chosen arbitrarily to have a constant bound on the number of pools +/// migrated at once. This size will be configured by a module parameter so it can be changed by a constant. +class OsmosisCosmWasmPoolMigratePoolContractsProposal extends CosmosMessage { + final String? title; + final String? description; + + /// pool_ids are the pool ids of the contracts to be migrated + /// either to the new_code_id that is already uploaded to chain or to + /// the given wasm_byte_code. + final List? poolIds; + + /// new_code_id is the code id of the contract code to migrate to. + /// Assumes that the code is already uploaded to chain. Only one of + /// new_code_id and wasm_byte_code should be set. + final BigInt? newCodeId; + + /// WASMByteCode can be raw or gzip compressed. Assumes that the code id + /// has not been uploaded yet so uploads the given code and migrates to it. + /// Only one of new_code_id and wasm_byte_code should be set. + final List? wasmByteCode; + + /// MigrateMsg migrate message to be used for migrating the pool contracts. + final List? migrateMsg; + OsmosisCosmWasmPoolMigratePoolContractsProposal( + {this.title, + this.description, + List? poolIds, + this.newCodeId, + List? wasmByteCode, + List? migrateMsg}) + : poolIds = poolIds?.nullOnEmpy, + wasmByteCode = BytesUtils.tryToBytes(wasmByteCode, unmodifiable: true), + migrateMsg = BytesUtils.tryToBytes(migrateMsg, unmodifiable: true); + factory OsmosisCosmWasmPoolMigratePoolContractsProposal.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisCosmWasmPoolMigratePoolContractsProposal( + title: decode.getField(1), + description: decode.getField(2), + poolIds: decode + .getResult(3) + ?.to, List>( + (e) => e.map((e) => BigintUtils.parse(e)).toList()) ?? + [], + newCodeId: decode.getField(4), + wasmByteCode: decode.getField(5), + migrateMsg: decode.getField(6)); + } + + @override + List get fieldIds => [1, 2, 3, 4, 5, 6]; + + @override + Map toJson() { + return { + "title": title, + "description": description, + "pool_ids": poolIds?.map((e) => e.toString()).toList(), + "new_code_id": newCodeId?.toString(), + "wasm_byte_code": BytesUtils.tryToHexString(wasmByteCode), + "migrate_msg": BytesUtils.tryToHexString(migrateMsg), + }; + } + + @override + String get typeUrl => + OsmosisCosmWasmPoolV1beta1Types.migratePoolContractsProposal.typeUrl; + + @override + List get values => + [title, description, poolIds, newCodeId, wasmByteCode, migrateMsg]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/messages/params.dart b/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/messages/params.dart new file mode 100644 index 0000000..1dcc839 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/messages/params.dart @@ -0,0 +1,45 @@ +import 'package:blockchain_utils/numbers/numbers.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +class OsmosisCosmWasmPoolParams extends CosmosMessage { + /// [codeIdWhitelist] contains the list of code ids that are allowed to be + /// instantiated. + final BigInt? codeIdWhitelist; + + /// [poolMigrationLimit] is the maximum number of pools that can be migrated + /// at once via governance proposal. This is to have a constant bound on the + /// number of pools that can be migrated at once and remove the possibility + /// of an unlikely scenario of causing a chain halt due to a large migration. + final BigInt? poolMigrationLimit; + + OsmosisCosmWasmPoolParams({this.codeIdWhitelist, this.poolMigrationLimit}); + factory OsmosisCosmWasmPoolParams.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisCosmWasmPoolParams( + codeIdWhitelist: decode.getField(1), + poolMigrationLimit: decode.getField(2)); + } + factory OsmosisCosmWasmPoolParams.fromRpc(Map json) { + return OsmosisCosmWasmPoolParams( + poolMigrationLimit: BigintUtils.tryParse(json["pool_migration_limit"]), + codeIdWhitelist: BigintUtils.tryParse(json["code_id_whitelist"])); + } + + @override + List get fieldIds => [1, 2]; + + @override + Map toJson() { + return { + "code_id_whitelist": codeIdWhitelist?.toString(), + "pool_migration_limit": poolMigrationLimit?.toString() + }; + } + + @override + String get typeUrl => OsmosisCosmWasmPoolV1beta1Types.params.typeUrl; + + @override + List get values => [codeIdWhitelist, poolMigrationLimit]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/messages/spot_price.dart b/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/messages/spot_price.dart new file mode 100644 index 0000000..0522b01 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/messages/spot_price.dart @@ -0,0 +1,36 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +class OsmosisCosmWasmPoolSpotPrice extends CosmosMessage { + /// quote_asset_denom is the quote asset of the spot query + final String? quoteAssetDenom; + + /// base_asset_denom is the base asset of the spot query. + final String? baseAssetDenom; + + OsmosisCosmWasmPoolSpotPrice( + {this.quoteAssetDenom, required this.baseAssetDenom}); + factory OsmosisCosmWasmPoolSpotPrice.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisCosmWasmPoolSpotPrice( + quoteAssetDenom: decode.getField(1), + baseAssetDenom: decode.getField(2)); + } + + @override + List get fieldIds => [1, 2]; + + @override + Map toJson() { + return { + "quote_asset_denom": quoteAssetDenom, + "base_asset_denom": baseAssetDenom + }; + } + + @override + String get typeUrl => OsmosisCosmWasmPoolV1beta1Types.spotPrice.typeUrl; + + @override + List get values => [quoteAssetDenom, baseAssetDenom]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/messages/swap_exact_amount_in.dart b/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/messages/swap_exact_amount_in.dart new file mode 100644 index 0000000..e198c13 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/messages/swap_exact_amount_in.dart @@ -0,0 +1,58 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_cosmwasmpool_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'; + +class OsmosisCosmWasmPoolSwapExactAmountIn extends CosmosMessage { + final String? sender; + + /// [tokenIn] is the token to be sent to the pool. + final Coin tokenIn; + + /// [tokenOutDenom] is the token denom to be received from the pool. + final String? tokenOutDenom; + + /// [tokenOutMinAmount] is the minimum amount of token_out to be received from + /// the pool. + final BigInt tokenOutMinAmount; + + /// [swapFee] is the swap fee for this swap estimate. + final String swapFee; + + OsmosisCosmWasmPoolSwapExactAmountIn( + {this.sender, + required this.tokenIn, + this.tokenOutDenom, + required this.tokenOutMinAmount, + required this.swapFee}); + factory OsmosisCosmWasmPoolSwapExactAmountIn.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisCosmWasmPoolSwapExactAmountIn( + sender: decode.getField(1), + tokenIn: Coin.deserialize(decode.getField(2)), + tokenOutDenom: decode.getField(3), + tokenOutMinAmount: BigInt.parse(decode.getField(4)), + swapFee: decode.getField(5)); + } + + @override + List get fieldIds => [1, 2, 3, 4, 5]; + + @override + Map toJson() { + return { + "sender": sender, + "token_in": tokenIn.toJson(), + "token_out_denom": tokenOutDenom, + "token_out_min_amount": tokenOutMinAmount.toString(), + "swap_fee": swapFee + }; + } + + @override + String get typeUrl => + OsmosisCosmWasmPoolV1beta1Types.swapExactAmountIn.typeUrl; + + @override + List get values => + [sender, tokenIn, tokenOutDenom, tokenOutMinAmount.toString(), swapFee]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/messages/swap_exact_amount_out.dart b/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/messages/swap_exact_amount_out.dart new file mode 100644 index 0000000..b1788ba --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/messages/swap_exact_amount_out.dart @@ -0,0 +1,58 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_cosmwasmpool_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'; + +class OsmosisCosmWasmPoolSwapExactAmountOut extends CosmosMessage { + final String? sender; + + /// [tokenOut] is the token to be sent out of the pool. + final Coin tokenOut; + + /// [tokenInDenom] is the token denom to be sent too the pool. + final String? tokenInDenom; + + /// [tokenInMaxAmount] is the maximum amount of token_in to be sent to the + /// pool. + final BigInt tokenInMaxAmount; + + /// [swapFee] is the swap fee for this swap estimate. + final String swapFee; + + OsmosisCosmWasmPoolSwapExactAmountOut( + {this.sender, + required this.tokenOut, + this.tokenInDenom, + required this.tokenInMaxAmount, + required this.swapFee}); + factory OsmosisCosmWasmPoolSwapExactAmountOut.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisCosmWasmPoolSwapExactAmountOut( + sender: decode.getField(1), + tokenOut: Coin.deserialize(decode.getField(2)), + tokenInDenom: decode.getField(3), + tokenInMaxAmount: BigInt.parse(decode.getField(4)), + swapFee: decode.getField(5)); + } + + @override + List get fieldIds => [1, 2, 3, 4, 5]; + + @override + Map toJson() { + return { + "sender": sender, + "token_out": tokenOut.toJson(), + "token_in_denom": tokenInDenom, + "token_in_max_amount": tokenInMaxAmount.toString(), + "swap_fee": swapFee + }; + } + + @override + String get typeUrl => + OsmosisCosmWasmPoolV1beta1Types.swapExactAmountOut.typeUrl; + + @override + List get values => + [sender, tokenOut, tokenInDenom, tokenInMaxAmount.toString(), swapFee]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/messages/upload_cosm_wasm_pool_code_and_white_list_proposal.dart b/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/messages/upload_cosm_wasm_pool_code_and_white_list_proposal.dart new file mode 100644 index 0000000..127c218 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/messages/upload_cosm_wasm_pool_code_and_white_list_proposal.dart @@ -0,0 +1,46 @@ +import 'package:blockchain_utils/blockchain_utils.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +/// UploadCosmWasmPoolCodeAndWhiteListProposal is a gov Content type for uploading coswasm pool code +/// and adding it to internal whitelist. Only the code ids created by this message are eligible +/// for being x/cosmwasmpool pools. +class OsmosisCosmWasmPoolUploadCosmWasmPoolCodeAndWhiteListProposal + extends CosmosMessage { + final String? title; + final String? description; + + /// WASMByteCode can be raw or gzip compressed + final List? wasmByteCode; + + OsmosisCosmWasmPoolUploadCosmWasmPoolCodeAndWhiteListProposal( + {this.title, this.description, List? wasmByteCode}) + : wasmByteCode = BytesUtils.tryToBytes(wasmByteCode, unmodifiable: true); + factory OsmosisCosmWasmPoolUploadCosmWasmPoolCodeAndWhiteListProposal.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisCosmWasmPoolUploadCosmWasmPoolCodeAndWhiteListProposal( + title: decode.getField(1), + description: decode.getField(2), + wasmByteCode: decode.getField(3)); + } + + @override + List get fieldIds => [1, 2, 3]; + + @override + Map toJson() { + return { + "title": title, + "description": description, + "wasm_byte_code": BytesUtils.tryToHexString(wasmByteCode) + }; + } + + @override + String get typeUrl => OsmosisCosmWasmPoolV1beta1Types + .uploadCosmWasmPoolCodeAndWhiteListProposal.typeUrl; + + @override + List get values => [title, description, wasmByteCode]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/osmosis_cosmwasmpool_v1beta1.dart b/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/osmosis_cosmwasmpool_v1beta1.dart new file mode 100644 index 0000000..88bcc47 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/osmosis_cosmwasmpool_v1beta1.dart @@ -0,0 +1,23 @@ +export 'messages/calc_out_amt_given_in.dart'; +export 'messages/calc_out_amt_given_out.dart'; +export 'messages/cosm_wasm_pool.dart'; +export 'messages/empty_request.dart'; +export 'messages/empty_struct.dart'; +export 'messages/genesis_state.dart'; +export 'messages/instantiate_msg.dart'; +export 'messages/migrate_pool_contracts_proposal.dart'; +export 'messages/params.dart'; +export 'messages/spot_price.dart'; +export 'messages/swap_exact_amount_in.dart'; +export 'messages/swap_exact_amount_out.dart'; +export 'messages/upload_cosm_wasm_pool_code_and_white_list_proposal.dart'; + +export 'query/contract_info_by_pool_id_request.dart'; +export 'query/contract_info_by_pool_id_response.dart'; +export 'query/params_request.dart'; +export 'query/params_response.dart'; +export 'query/pool_request.dart'; +export 'query/pools_response.dart'; + +export 'service/msg_create_cosm_wasm_pool_response.dart'; +export 'service/msg_create_cosmsasm_pool.dart'; diff --git a/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/query/contract_info_by_pool_id_request.dart b/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/query/contract_info_by_pool_id_request.dart new file mode 100644 index 0000000..920b9ae --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/query/contract_info_by_pool_id_request.dart @@ -0,0 +1,54 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'contract_info_by_pool_id_response.dart'; + +class OsmosisCosmWasmPoolContractInfoByPoolIdRequest extends CosmosMessage + with + QueryMessage, + RPCMessage { + /// pool_id is the pool id of the requested pool + final BigInt? poolId; + OsmosisCosmWasmPoolContractInfoByPoolIdRequest({this.poolId}); + factory OsmosisCosmWasmPoolContractInfoByPoolIdRequest.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisCosmWasmPoolContractInfoByPoolIdRequest( + poolId: decode.getField(1)); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"pool_id": poolId?.toString()}; + } + + @override + String get typeUrl => + OsmosisCosmWasmPoolV1beta1Types.contractInfoByPoolIdRequest.typeUrl; + + @override + List get values => [poolId]; + + @override + OsmosisCosmWasmContractInfoByPoolIdResponse onResponse(List bytes) { + return OsmosisCosmWasmContractInfoByPoolIdResponse.deserialize(bytes); + } + + @override + OsmosisCosmWasmContractInfoByPoolIdResponse onJsonResponse( + Map json) { + return OsmosisCosmWasmContractInfoByPoolIdResponse.fromRpc(json); + } + + @override + Map get queryParameters => {"pool_id": poolId?.toString()}; + @override + String get queryPath => + OsmosisCosmWasmPoolV1beta1Types.contractInfoByPoolId.typeUrl; + + @override + String get rpcPath => + OsmosisCosmWasmPoolV1beta1Types.contractInfoByPoolId.rpcUrl(); +} diff --git a/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/query/contract_info_by_pool_id_response.dart b/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/query/contract_info_by_pool_id_response.dart new file mode 100644 index 0000000..12fc63a --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/query/contract_info_by_pool_id_response.dart @@ -0,0 +1,41 @@ +import 'package:blockchain_utils/numbers/numbers.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +class OsmosisCosmWasmContractInfoByPoolIdResponse extends CosmosMessage { + /// [contractAddress] is the pool address and contract address + /// of the requested pool id. + final String? contractAddress; + + /// [codeId] is the code id of the requested pool id + final BigInt? codeId; + OsmosisCosmWasmContractInfoByPoolIdResponse( + {this.contractAddress, this.codeId}); + factory OsmosisCosmWasmContractInfoByPoolIdResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisCosmWasmContractInfoByPoolIdResponse( + contractAddress: decode.getField(1), codeId: decode.getField(2)); + } + factory OsmosisCosmWasmContractInfoByPoolIdResponse.fromRpc( + Map json) { + return OsmosisCosmWasmContractInfoByPoolIdResponse( + codeId: BigintUtils.tryParse(json["code_id"]), + contractAddress: json["contract_address"]); + } + + @override + List get fieldIds => [1, 2]; + + @override + Map toJson() { + return {"code_id": codeId?.toString(), "contract_address": contractAddress}; + } + + @override + String get typeUrl => + OsmosisCosmWasmPoolV1beta1Types.contractInfoByPoolIdResponse.typeUrl; + + @override + List get values => [codeId, contractAddress]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/query/params_request.dart b/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/query/params_request.dart new file mode 100644 index 0000000..1af5de0 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/query/params_request.dart @@ -0,0 +1,45 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'params_response.dart'; + +class OsmosisCosmWasmPoolParamsRequest extends CosmosMessage + with + QueryMessage, + RPCMessage { + OsmosisCosmWasmPoolParamsRequest(); + factory OsmosisCosmWasmPoolParamsRequest.deserialize(List bytes) { + return OsmosisCosmWasmPoolParamsRequest(); + } + + @override + List get fieldIds => []; + + @override + Map toJson() { + return {}; + } + + @override + String get typeUrl => OsmosisCosmWasmPoolV1beta1Types.paramsRequest.typeUrl; + + @override + List get values => []; + + @override + OsmosisCosmWasmPoolParamsResponse onResponse(List bytes) { + return OsmosisCosmWasmPoolParamsResponse.deserialize(bytes); + } + + @override + OsmosisCosmWasmPoolParamsResponse onJsonResponse(Map json) { + return OsmosisCosmWasmPoolParamsResponse.fromRpc(json); + } + + @override + Map get queryParameters => {}; + @override + String get queryPath => OsmosisCosmWasmPoolV1beta1Types.queryParams.typeUrl; + + @override + String get rpcPath => OsmosisCosmWasmPoolV1beta1Types.queryParams.rpcUrl(); +} diff --git a/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/query/params_response.dart b/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/query/params_response.dart new file mode 100644 index 0000000..9a5eda8 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/query/params_response.dart @@ -0,0 +1,32 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/messages/params.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +class OsmosisCosmWasmPoolParamsResponse extends CosmosMessage { + final OsmosisCosmWasmPoolParams params; + + OsmosisCosmWasmPoolParamsResponse(this.params); + factory OsmosisCosmWasmPoolParamsResponse.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisCosmWasmPoolParamsResponse( + OsmosisCosmWasmPoolParams.deserialize(decode.getField(1))); + } + factory OsmosisCosmWasmPoolParamsResponse.fromRpc(Map json) { + return OsmosisCosmWasmPoolParamsResponse( + OsmosisCosmWasmPoolParams.fromRpc(json["params"])); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"params": params.toJson()}; + } + + @override + String get typeUrl => OsmosisCosmWasmPoolV1beta1Types.paramsResponse.typeUrl; + + @override + List get values => [params]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/query/pool_request.dart b/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/query/pool_request.dart new file mode 100644 index 0000000..1e2e10d --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/query/pool_request.dart @@ -0,0 +1,53 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/query/pools_response.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/models/sdk_v1beta1/cosmos_base_query_v1beta1/cosmos_base_query_v1beta1.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +class OsmosisCosmWasmPoolPoolsRequest extends CosmosMessage + with + QueryMessage, + RPCMessage { + /// pagination defines an optional pagination for the request + final PageRequest? pagination; + + OsmosisCosmWasmPoolPoolsRequest({this.pagination}); + factory OsmosisCosmWasmPoolPoolsRequest.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisCosmWasmPoolPoolsRequest( + pagination: decode + .getResult(1) + ?.to>((e) => PageRequest.deserialize(e))); + } + + @override + List get fieldIds => [2]; + + @override + Map toJson() { + return {"pagination": pagination?.toJson()}; + } + + @override + String get typeUrl => OsmosisCosmWasmPoolV1beta1Types.poolsRequest.typeUrl; + + @override + List get values => [pagination]; + + @override + OsmosisCosmWasmPoolPoolsResponse onResponse(List bytes) { + return OsmosisCosmWasmPoolPoolsResponse.deserialize(bytes); + } + + @override + OsmosisCosmWasmPoolPoolsResponse onJsonResponse(Map json) { + return OsmosisCosmWasmPoolPoolsResponse.fromRpc(json); + } + + @override + Map get queryParameters => {}; + @override + String get queryPath => OsmosisCosmWasmPoolV1beta1Types.pools.typeUrl; + + @override + String get rpcPath => OsmosisCosmWasmPoolV1beta1Types.pools.rpcUrl(); +} diff --git a/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/query/pools_response.dart b/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/query/pools_response.dart new file mode 100644 index 0000000..76f3447 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/query/pools_response.dart @@ -0,0 +1,49 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_cosmwasmpool_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 OsmosisCosmWasmPoolPoolsResponse extends CosmosMessage { + final List? pools; + final PageResponse? pagination; + + OsmosisCosmWasmPoolPoolsResponse({List? pools, required this.pagination}) + : pools = pools?.nullOnEmpy; + factory OsmosisCosmWasmPoolPoolsResponse.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisCosmWasmPoolPoolsResponse( + pools: decode + .getFields>(1) + .map((e) => Any.deserialize(e)) + .toList(), + pagination: decode + .getResult(2) + ?.to>((e) => PageResponse.deserialize(e)), + ); + } + factory OsmosisCosmWasmPoolPoolsResponse.fromRpc(Map json) { + return OsmosisCosmWasmPoolPoolsResponse( + 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 => OsmosisCosmWasmPoolV1beta1Types.poolsResponse.typeUrl; + + @override + List get values => [pools, pagination]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/service/msg_create_cosm_wasm_pool_response.dart b/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/service/msg_create_cosm_wasm_pool_response.dart new file mode 100644 index 0000000..a41a49f --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/service/msg_create_cosm_wasm_pool_response.dart @@ -0,0 +1,28 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +class OsmosisCosmWasmPoolMsgCreateCosmWasmPoolResponse extends CosmosMessage { + final BigInt? poolId; + OsmosisCosmWasmPoolMsgCreateCosmWasmPoolResponse({this.poolId}); + factory OsmosisCosmWasmPoolMsgCreateCosmWasmPoolResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisCosmWasmPoolMsgCreateCosmWasmPoolResponse( + poolId: decode.getField(1)); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"pool_id": poolId?.toString()}; + } + + @override + String get typeUrl => + OsmosisCosmWasmPoolV1beta1Types.msgCreateCosmWasmPoolResponse.typeUrl; + + @override + List get values => [poolId?.toString()]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/service/msg_create_cosmsasm_pool.dart b/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/service/msg_create_cosmsasm_pool.dart new file mode 100644 index 0000000..723f205 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/service/msg_create_cosmsasm_pool.dart @@ -0,0 +1,55 @@ +import 'package:blockchain_utils/blockchain_utils.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +import 'msg_create_cosm_wasm_pool_response.dart'; + +class OsmosisCosmWasmPoolMsgCreateCosmWasmPool extends CosmosMessage + with ServiceMessage { + final BigInt? codeIn; + final List? instantiateMsg; + final String? sender; + + OsmosisCosmWasmPoolMsgCreateCosmWasmPool( + {this.codeIn, List? instantiateMsg, required this.sender}) + : instantiateMsg = BytesUtils.tryToBytes(instantiateMsg); + factory OsmosisCosmWasmPoolMsgCreateCosmWasmPool.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisCosmWasmPoolMsgCreateCosmWasmPool( + codeIn: decode.getField(1), + instantiateMsg: decode.getField(2), + sender: decode.getField(3)); + } + + @override + List get fieldIds => [1, 2, 3]; + + @override + Map toJson() { + return { + "code_id": codeIn?.toString(), + "instantiate_msg": BytesUtils.tryToHexString(instantiateMsg), + "sender": sender + }; + } + + @override + String get typeUrl => + OsmosisCosmWasmPoolV1beta1Types.msgCreateCosmWasmPool.typeUrl; + + @override + List get values => [codeIn, instantiateMsg, sender]; + + @override + OsmosisCosmWasmPoolMsgCreateCosmWasmPoolResponse onResponse(List bytes) { + return OsmosisCosmWasmPoolMsgCreateCosmWasmPoolResponse.deserialize(bytes); + } + + @override + String get service => + OsmosisCosmWasmPoolV1beta1Types.createCosmWasmPool.typeUrl; + + @override + List get signers => [sender]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/types/types.dart b/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/types/types.dart new file mode 100644 index 0000000..ce97d8c --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_cosmwasmpool_v1beta1/types/types.dart @@ -0,0 +1,97 @@ +import 'package:cosmos_sdk/src/models/core/type_url/type_url.dart'; + +class OsmosisCosmWasmPoolV1beta1Types extends TypeUrl { + @override + final String typeUrl; + @override + final String? rpc; + const OsmosisCosmWasmPoolV1beta1Types._(this.typeUrl, {this.rpc}); + static const OsmosisCosmWasmPoolV1beta1Types + uploadCosmWasmPoolCodeAndWhiteListProposal = + OsmosisCosmWasmPoolV1beta1Types._( + "/osmosis.cosmwasmpool.v1beta1.UploadCosmWasmPoolCodeAndWhiteListProposal"); + static const OsmosisCosmWasmPoolV1beta1Types swapExactAmountOut = + OsmosisCosmWasmPoolV1beta1Types._( + "/osmosis.cosmwasmpool.v1beta1.SwapExactAmountOut"); + static const OsmosisCosmWasmPoolV1beta1Types swapExactAmountIn = + OsmosisCosmWasmPoolV1beta1Types._( + "/osmosis.cosmwasmpool.v1beta1.SwapExactAmountIn"); + static const OsmosisCosmWasmPoolV1beta1Types spotPrice = + OsmosisCosmWasmPoolV1beta1Types._( + "/osmosis.cosmwasmpool.v1beta1.SpotPrice"); + static const OsmosisCosmWasmPoolV1beta1Types params = + OsmosisCosmWasmPoolV1beta1Types._("/osmosis.cosmwasmpool.v1beta1.Params"); + static const OsmosisCosmWasmPoolV1beta1Types migratePoolContractsProposal = + OsmosisCosmWasmPoolV1beta1Types._( + "/osmosis.cosmwasmpool.v1beta1.MigratePoolContractsProposal"); + static const OsmosisCosmWasmPoolV1beta1Types instantiateMsg = + OsmosisCosmWasmPoolV1beta1Types._( + "/osmosis.cosmwasmpool.v1beta1.InstantiateMsg"); + static const OsmosisCosmWasmPoolV1beta1Types gnesisState = + OsmosisCosmWasmPoolV1beta1Types._( + "/osmosis.cosmwasmpool.v1beta1.GenesisState"); + static const OsmosisCosmWasmPoolV1beta1Types emptyStruct = + OsmosisCosmWasmPoolV1beta1Types._( + "/osmosis.cosmwasmpool.v1beta1.EmptyStruct"); + static const OsmosisCosmWasmPoolV1beta1Types emptyRequest = + OsmosisCosmWasmPoolV1beta1Types._( + "/osmosis.cosmwasmpool.v1beta1.EmptyRequest"); + static const OsmosisCosmWasmPoolV1beta1Types cosmWasmPool = + OsmosisCosmWasmPoolV1beta1Types._( + "/osmosis.cosmwasmpool.v1beta1.CosmWasmPool"); + static const OsmosisCosmWasmPoolV1beta1Types calcOutAmtGivenIn = + OsmosisCosmWasmPoolV1beta1Types._( + "/osmosis.cosmwasmpool.v1beta1.CalcOutAmtGivenIn"); + static const OsmosisCosmWasmPoolV1beta1Types calcInAmtGivenOut = + OsmosisCosmWasmPoolV1beta1Types._( + "/osmosis.cosmwasmpool.v1beta1.CalcInAmtGivenOut"); + + static const OsmosisCosmWasmPoolV1beta1Types msgCreateCosmWasmPool = + OsmosisCosmWasmPoolV1beta1Types._( + "/osmosis.cosmwasmpool.v1beta1.MsgCreateCosmWasmPool"); + static const OsmosisCosmWasmPoolV1beta1Types msgCreateCosmWasmPoolResponse = + OsmosisCosmWasmPoolV1beta1Types._( + "/osmosis.cosmwasmpool.v1beta1.MsgCreateCosmWasmPoolResponse"); + + static const OsmosisCosmWasmPoolV1beta1Types poolsRequest = + OsmosisCosmWasmPoolV1beta1Types._( + "/osmosis.cosmwasmpool.v1beta1.PoolsRequest"); + static const OsmosisCosmWasmPoolV1beta1Types poolsResponse = + OsmosisCosmWasmPoolV1beta1Types._( + "/osmosis.cosmwasmpool.v1beta1.PoolsResponse"); + + static const OsmosisCosmWasmPoolV1beta1Types paramsRequest = + OsmosisCosmWasmPoolV1beta1Types._( + "/osmosis.cosmwasmpool.v1beta1.ParamsRequest"); + static const OsmosisCosmWasmPoolV1beta1Types paramsResponse = + OsmosisCosmWasmPoolV1beta1Types._( + "/osmosis.cosmwasmpool.v1beta1.ParamsResponse"); + + static const OsmosisCosmWasmPoolV1beta1Types contractInfoByPoolIdRequest = + OsmosisCosmWasmPoolV1beta1Types._( + "/osmosis.cosmwasmpool.v1beta1.ContractInfoByPoolIdRequest"); + static const OsmosisCosmWasmPoolV1beta1Types contractInfoByPoolIdResponse = + OsmosisCosmWasmPoolV1beta1Types._( + "/osmosis.cosmwasmpool.v1beta1.ContractInfoByPoolIdResponse"); + + /// query + static const OsmosisCosmWasmPoolV1beta1Types contractInfoByPoolId = + OsmosisCosmWasmPoolV1beta1Types._( + "/osmosis.cosmwasmpool.v1beta1.Query/ContractInfoByPoolId", + rpc: "/osmosis/cosmwasmpool/v1beta1/contract_info"); + + static const OsmosisCosmWasmPoolV1beta1Types queryParams = + OsmosisCosmWasmPoolV1beta1Types._( + "/osmosis.cosmwasmpool.v1beta1.Query/Params", + rpc: "/osmosis/cosmwasmpool/v1beta1/params"); + + static const OsmosisCosmWasmPoolV1beta1Types pools = + OsmosisCosmWasmPoolV1beta1Types._( + "/osmosis.cosmwasmpool.v1beta1.Query/Pools", + rpc: "/osmosis/cosmwasmpool/v1beta1/pools"); + + ///service + static const OsmosisCosmWasmPoolV1beta1Types createCosmWasmPool = + OsmosisCosmWasmPoolV1beta1Types._( + "/osmosis.cosmwasmpool.v1beta1.MsgCreator/CreateCosmWasmPool"); +} diff --git a/lib/src/models/networks/osmosis/osmosis_downtimedetector_v1beta1/messages/down_time.dart b/lib/src/models/networks/osmosis/osmosis_downtimedetector_v1beta1/messages/down_time.dart new file mode 100644 index 0000000..9213ae4 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_downtimedetector_v1beta1/messages/down_time.dart @@ -0,0 +1,105 @@ +import 'package:blockchain_utils/exception/exception.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +class OsmosisDowntimeDetectorDowntime implements CosmosEnum { + @override + final int value; + @override + final String name; + const OsmosisDowntimeDetectorDowntime._(this.name, this.value); + + static const OsmosisDowntimeDetectorDowntime duration30S = + OsmosisDowntimeDetectorDowntime._("DURATION_30S", 0); + static const OsmosisDowntimeDetectorDowntime duration1M = + OsmosisDowntimeDetectorDowntime._("DURATION_1M", 1); + static const OsmosisDowntimeDetectorDowntime duration2M = + OsmosisDowntimeDetectorDowntime._("DURATION_2M", 2); + static const OsmosisDowntimeDetectorDowntime duration3M = + OsmosisDowntimeDetectorDowntime._("DURATION_3M", 3); + static const OsmosisDowntimeDetectorDowntime duration4M = + OsmosisDowntimeDetectorDowntime._("DURATION_4M", 4); + static const OsmosisDowntimeDetectorDowntime duration5M = + OsmosisDowntimeDetectorDowntime._("DURATION_5M", 5); + static const OsmosisDowntimeDetectorDowntime duration10M = + OsmosisDowntimeDetectorDowntime._("DURATION_10M", 6); + static const OsmosisDowntimeDetectorDowntime duration20M = + OsmosisDowntimeDetectorDowntime._("DURATION_20M", 7); + static const OsmosisDowntimeDetectorDowntime duration30M = + OsmosisDowntimeDetectorDowntime._("DURATION_30M", 8); + static const OsmosisDowntimeDetectorDowntime duration40M = + OsmosisDowntimeDetectorDowntime._("DURATION_40M", 9); + static const OsmosisDowntimeDetectorDowntime duration50M = + OsmosisDowntimeDetectorDowntime._("DURATION_50M", 10); + static const OsmosisDowntimeDetectorDowntime duration1H = + OsmosisDowntimeDetectorDowntime._("DURATION_1H", 11); + static const OsmosisDowntimeDetectorDowntime duration1_5H = + OsmosisDowntimeDetectorDowntime._("DURATION_1_5H", 12); + static const OsmosisDowntimeDetectorDowntime duration2H = + OsmosisDowntimeDetectorDowntime._("DURATION_2H", 13); + static const OsmosisDowntimeDetectorDowntime duration2_5H = + OsmosisDowntimeDetectorDowntime._("DURATION_2_5H", 14); + static const OsmosisDowntimeDetectorDowntime duration3H = + OsmosisDowntimeDetectorDowntime._("DURATION_3H", 15); + static const OsmosisDowntimeDetectorDowntime duration4H = + OsmosisDowntimeDetectorDowntime._("DURATION_4H", 16); + static const OsmosisDowntimeDetectorDowntime duration5H = + OsmosisDowntimeDetectorDowntime._("DURATION_5H", 17); + static const OsmosisDowntimeDetectorDowntime duration6H = + OsmosisDowntimeDetectorDowntime._("DURATION_6H", 18); + static const OsmosisDowntimeDetectorDowntime duration9H = + OsmosisDowntimeDetectorDowntime._("DURATION_9H", 19); + static const OsmosisDowntimeDetectorDowntime duration12H = + OsmosisDowntimeDetectorDowntime._("DURATION_12H", 20); + static const OsmosisDowntimeDetectorDowntime duration18H = + OsmosisDowntimeDetectorDowntime._("DURATION_18H", 21); + static const OsmosisDowntimeDetectorDowntime duration24H = + OsmosisDowntimeDetectorDowntime._("DURATION_24H", 22); + static const OsmosisDowntimeDetectorDowntime duration36H = + OsmosisDowntimeDetectorDowntime._("DURATION_36H", 23); + static const OsmosisDowntimeDetectorDowntime duration48H = + OsmosisDowntimeDetectorDowntime._("DURATION_48H", 24); + static const List values = [ + OsmosisDowntimeDetectorDowntime.duration30S, + OsmosisDowntimeDetectorDowntime.duration1M, + OsmosisDowntimeDetectorDowntime.duration2M, + OsmosisDowntimeDetectorDowntime.duration3M, + OsmosisDowntimeDetectorDowntime.duration4M, + OsmosisDowntimeDetectorDowntime.duration5M, + OsmosisDowntimeDetectorDowntime.duration10M, + OsmosisDowntimeDetectorDowntime.duration20M, + OsmosisDowntimeDetectorDowntime.duration30M, + OsmosisDowntimeDetectorDowntime.duration40M, + OsmosisDowntimeDetectorDowntime.duration50M, + OsmosisDowntimeDetectorDowntime.duration1H, + OsmosisDowntimeDetectorDowntime.duration1_5H, + OsmosisDowntimeDetectorDowntime.duration2H, + OsmosisDowntimeDetectorDowntime.duration2_5H, + OsmosisDowntimeDetectorDowntime.duration3H, + OsmosisDowntimeDetectorDowntime.duration4H, + OsmosisDowntimeDetectorDowntime.duration5H, + OsmosisDowntimeDetectorDowntime.duration6H, + OsmosisDowntimeDetectorDowntime.duration9H, + OsmosisDowntimeDetectorDowntime.duration12H, + OsmosisDowntimeDetectorDowntime.duration18H, + OsmosisDowntimeDetectorDowntime.duration24H, + OsmosisDowntimeDetectorDowntime.duration36H, + OsmosisDowntimeDetectorDowntime.duration48H, + ]; + static OsmosisDowntimeDetectorDowntime fromValue(int? value) { + return values.firstWhere( + (e) => e.value == value, + orElse: () => throw MessageException( + "No OsmosisDowntimeDetectorDowntime element found for the given value.", + details: {"value": value}), + ); + } + + static OsmosisDowntimeDetectorDowntime fromName(String? name) { + return values.firstWhere( + (e) => e.name == name, + orElse: () => throw MessageException( + "No OsmosisDowntimeDetectorDowntime element found for the given name.", + details: {"name": name}), + ); + } +} diff --git a/lib/src/models/networks/osmosis/osmosis_downtimedetector_v1beta1/messages/genesis_downtime_entry.dart b/lib/src/models/networks/osmosis/osmosis_downtimedetector_v1beta1/messages/genesis_downtime_entry.dart new file mode 100644 index 0000000..41dbc1c --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_downtimedetector_v1beta1/messages/genesis_downtime_entry.dart @@ -0,0 +1,35 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_downtimedetector_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +import 'down_time.dart'; + +class OsmosisDowntimeDetectorGenesisDowntimeEntry extends CosmosMessage { + final OsmosisDowntimeDetectorDowntime? duration; + final ProtobufTimestamp lastDowntime; + const OsmosisDowntimeDetectorGenesisDowntimeEntry( + {this.duration, required this.lastDowntime}); + factory OsmosisDowntimeDetectorGenesisDowntimeEntry.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisDowntimeDetectorGenesisDowntimeEntry( + lastDowntime: ProtobufTimestamp.fromString(decode.getField(2)), + duration: decode.getResult(1)?.to( + (e) => OsmosisDowntimeDetectorDowntime.fromValue(e)), + ); + } + + @override + List get fieldIds => [1, 2]; + + @override + Map toJson() { + return {"duration": duration?.name, "last_downtime": lastDowntime.toJson()}; + } + + @override + String get typeUrl => + OsmosisDowntimeDetectorV1beta1Types.genesisDowntimeEntry.typeUrl; + + @override + List get values => [duration, lastDowntime]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_downtimedetector_v1beta1/messages/genesis_state.dart b/lib/src/models/networks/osmosis/osmosis_downtimedetector_v1beta1/messages/genesis_state.dart new file mode 100644 index 0000000..c2a74f6 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_downtimedetector_v1beta1/messages/genesis_state.dart @@ -0,0 +1,42 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_downtimedetector_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; +import 'genesis_downtime_entry.dart'; + +/// GenesisState defines the twap module's genesis state. +class OsmosisDowntimeDetectorGenesisState extends CosmosMessage { + final List downtimes; + final ProtobufTimestamp lastBlockTime; + OsmosisDowntimeDetectorGenesisState( + {required List downtimes, + required this.lastBlockTime}) + : downtimes = downtimes.mutable; + factory OsmosisDowntimeDetectorGenesisState.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisDowntimeDetectorGenesisState( + downtimes: decode + .getFields(1) + .map((e) => + OsmosisDowntimeDetectorGenesisDowntimeEntry.deserialize(e)) + .toList(), + lastBlockTime: ProtobufTimestamp.deserialize(decode.getField(2))); + } + + @override + List get fieldIds => [1, 2]; + + @override + Map toJson() { + return { + "downtimes": downtimes.map((e) => e.toJson()).toList(), + "last_block_time": lastBlockTime.toJson() + }; + } + + @override + String get typeUrl => + OsmosisDowntimeDetectorV1beta1Types.genesisState.typeUrl; + + @override + List get values => [downtimes, lastBlockTime]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_downtimedetector_v1beta1/osmosis_downtimedetector_v1beta1.dart b/lib/src/models/networks/osmosis/osmosis_downtimedetector_v1beta1/osmosis_downtimedetector_v1beta1.dart new file mode 100644 index 0000000..5988b9c --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_downtimedetector_v1beta1/osmosis_downtimedetector_v1beta1.dart @@ -0,0 +1,5 @@ +export 'messages/down_time.dart'; +export 'messages/genesis_downtime_entry.dart'; +export 'messages/genesis_state.dart'; +export 'query/recovered_since_downtime_of_length_request.dart'; +export 'query/recovered_since_downtime_of_length_response.dart'; diff --git a/lib/src/models/networks/osmosis/osmosis_downtimedetector_v1beta1/query/recovered_since_downtime_of_length_request.dart b/lib/src/models/networks/osmosis/osmosis_downtimedetector_v1beta1/query/recovered_since_downtime_of_length_request.dart new file mode 100644 index 0000000..e224430 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_downtimedetector_v1beta1/query/recovered_since_downtime_of_length_request.dart @@ -0,0 +1,68 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_downtimedetector_v1beta1/messages/down_time.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_downtimedetector_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +import 'recovered_since_downtime_of_length_response.dart'; + +class OsmosisDowntimeDetectorRecoveredSinceDowntimeOfLengthRequest + extends CosmosMessage + with + QueryMessage< + OsmosisDowntimeDetectorRecoveredSinceDowntimeOfLengthResponse>, + RPCMessage< + OsmosisDowntimeDetectorRecoveredSinceDowntimeOfLengthResponse> { + final OsmosisDowntimeDetectorDowntime? downtime; + final ProtobufDuration recovery; + const OsmosisDowntimeDetectorRecoveredSinceDowntimeOfLengthRequest( + {this.downtime, required this.recovery}); + factory OsmosisDowntimeDetectorRecoveredSinceDowntimeOfLengthRequest.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisDowntimeDetectorRecoveredSinceDowntimeOfLengthRequest( + recovery: ProtobufDuration.fromString(decode.getField(2)), + downtime: decode.getResult(1)?.to( + (e) => OsmosisDowntimeDetectorDowntime.fromValue(e)), + ); + } + + @override + List get fieldIds => [1, 2]; + + @override + OsmosisDowntimeDetectorRecoveredSinceDowntimeOfLengthResponse onJsonResponse( + Map json) { + return OsmosisDowntimeDetectorRecoveredSinceDowntimeOfLengthResponse + .fromRpc(json); + } + + @override + OsmosisDowntimeDetectorRecoveredSinceDowntimeOfLengthResponse onResponse( + List bytes) { + return OsmosisDowntimeDetectorRecoveredSinceDowntimeOfLengthResponse + .deserialize(bytes); + } + + @override + Map get queryParameters => {}; + + @override + String get queryPath => OsmosisDowntimeDetectorV1beta1Types + .recoveredSinceDowntimeOfLength.typeUrl; + + @override + String get rpcPath => + OsmosisDowntimeDetectorV1beta1Types.recoveredSinceDowntimeOfLength + .rpcUrl(); + + @override + Map toJson() { + return {"downtime": downtime?.name, "recovery": recovery.toJson()}; + } + + @override + String get typeUrl => OsmosisDowntimeDetectorV1beta1Types + .recoveredSinceDowntimeOfLengthRequest.typeUrl; + + @override + List get values => [downtime?.value, recovery]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_downtimedetector_v1beta1/query/recovered_since_downtime_of_length_response.dart b/lib/src/models/networks/osmosis/osmosis_downtimedetector_v1beta1/query/recovered_since_downtime_of_length_response.dart new file mode 100644 index 0000000..ed45869 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_downtimedetector_v1beta1/query/recovered_since_downtime_of_length_response.dart @@ -0,0 +1,35 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_downtimedetector_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +class OsmosisDowntimeDetectorRecoveredSinceDowntimeOfLengthResponse + extends CosmosMessage { + final bool? succesfullyRecovered; + OsmosisDowntimeDetectorRecoveredSinceDowntimeOfLengthResponse( + {this.succesfullyRecovered}); + factory OsmosisDowntimeDetectorRecoveredSinceDowntimeOfLengthResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisDowntimeDetectorRecoveredSinceDowntimeOfLengthResponse( + succesfullyRecovered: decode.getField(1)); + } + factory OsmosisDowntimeDetectorRecoveredSinceDowntimeOfLengthResponse.fromRpc( + Map json) { + return OsmosisDowntimeDetectorRecoveredSinceDowntimeOfLengthResponse( + succesfullyRecovered: json["succesfully_recovered"]); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"succesfully_recovered": succesfullyRecovered}; + } + + @override + String get typeUrl => OsmosisDowntimeDetectorV1beta1Types + .recoveredSinceDowntimeOfLengthResponse.typeUrl; + + @override + List get values => [succesfullyRecovered]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_downtimedetector_v1beta1/types/types.dart b/lib/src/models/networks/osmosis/osmosis_downtimedetector_v1beta1/types/types.dart new file mode 100644 index 0000000..24bd80a --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_downtimedetector_v1beta1/types/types.dart @@ -0,0 +1,31 @@ +import 'package:cosmos_sdk/src/models/core/type_url/type_url.dart'; + +class OsmosisDowntimeDetectorV1beta1Types extends TypeUrl { + @override + final String typeUrl; + @override + final String? rpc; + const OsmosisDowntimeDetectorV1beta1Types._(this.typeUrl, {this.rpc}); + static const OsmosisDowntimeDetectorV1beta1Types genesisDowntimeEntry = + OsmosisDowntimeDetectorV1beta1Types._( + "/osmosis.downtimedetector.v1beta1.GenesisDowntimeEntry"); + static const OsmosisDowntimeDetectorV1beta1Types genesisState = + OsmosisDowntimeDetectorV1beta1Types._( + "/osmosis.downtimedetector.v1beta1.GenesisState"); + + static const OsmosisDowntimeDetectorV1beta1Types + recoveredSinceDowntimeOfLengthRequest = + OsmosisDowntimeDetectorV1beta1Types._( + "/osmosis.downtimedetector.v1beta1.RecoveredSinceDowntimeOfLengthRequest"); + static const OsmosisDowntimeDetectorV1beta1Types + recoveredSinceDowntimeOfLengthResponse = + OsmosisDowntimeDetectorV1beta1Types._( + "/osmosis.downtimedetector.v1beta1.RecoveredSinceDowntimeOfLengthResponse"); + + /// query + static const OsmosisDowntimeDetectorV1beta1Types + recoveredSinceDowntimeOfLength = OsmosisDowntimeDetectorV1beta1Types._( + "/osmosis.downtimedetector.v1beta1.Query/RecoveredSinceDowntimeOfLength", + rpc: + "/osmosis/downtime-detector/v1beta1/RecoveredSinceDowntimeOfLength"); +} diff --git a/lib/src/models/networks/osmosis/osmosis_gamm_pool_models_balancer_v1beta1/service/msg_create_balancer_pool.dart b/lib/src/models/networks/osmosis/osmosis_gamm_pool_models_balancer_v1beta1/service/msg_create_balancer_pool.dart index 858bfde..20051e6 100644 --- a/lib/src/models/networks/osmosis/osmosis_gamm_pool_models_balancer_v1beta1/service/msg_create_balancer_pool.dart +++ b/lib/src/models/networks/osmosis/osmosis_gamm_pool_models_balancer_v1beta1/service/msg_create_balancer_pool.dart @@ -58,7 +58,7 @@ class OsmosisGammPoolmodelsBalancerMsgCreateBalancerPool extends CosmosMessage OsmosisGammPoolmodelsBalancerV1beta1Types.createBalancerPool.typeUrl; @override - List get signers => []; + List get signers => [sender]; @override OsmosisGammPoolmodelsBalancerMsgCreateBalancerPoolResponse onResponse( 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 98ae535..f6b5b7a 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 @@ -47,7 +47,6 @@ 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), diff --git a/lib/src/models/networks/osmosis/osmosis_ibchooks/messages/genesis_state.dart b/lib/src/models/networks/osmosis/osmosis_ibchooks/messages/genesis_state.dart new file mode 100644 index 0000000..0c76e79 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_ibchooks/messages/genesis_state.dart @@ -0,0 +1,28 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_ibchooks/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +import 'params.dart'; + +class OsmosisIbchooksGenesisState extends CosmosMessage { + final OsmosisIbchooksParams params; + OsmosisIbchooksGenesisState(this.params); + factory OsmosisIbchooksGenesisState.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisIbchooksGenesisState( + OsmosisIbchooksParams.deserialize(decode.getField(1))); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"params": params.toJson()}; + } + + @override + String get typeUrl => OsmosisIbchooksTypes.genesisState.typeUrl; + + @override + List get values => [params]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_ibchooks/messages/params.dart b/lib/src/models/networks/osmosis/osmosis_ibchooks/messages/params.dart new file mode 100644 index 0000000..912b222 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_ibchooks/messages/params.dart @@ -0,0 +1,27 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_ibchooks/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; + +class OsmosisIbchooksParams extends CosmosMessage { + final List allowedSsyncAckContracts; + OsmosisIbchooksParams(List allowedSsyncAckContracts) + : allowedSsyncAckContracts = allowedSsyncAckContracts.mutable; + factory OsmosisIbchooksParams.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisIbchooksParams(decode.getFields(1)); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"allowed_async_ack_contracts": allowedSsyncAckContracts}; + } + + @override + String get typeUrl => OsmosisIbchooksTypes.params.typeUrl; + + @override + List get values => [allowedSsyncAckContracts]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_ibchooks/osmosis_ibchooks.dart b/lib/src/models/networks/osmosis/osmosis_ibchooks/osmosis_ibchooks.dart new file mode 100644 index 0000000..2f93a4e --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_ibchooks/osmosis_ibchooks.dart @@ -0,0 +1,5 @@ +export 'messages/genesis_state.dart'; +export 'messages/params.dart'; + +export 'services/msg_emit_ibc_ack.dart'; +export 'services/msg_emit_ibc_ack_response.dart'; diff --git a/lib/src/models/networks/osmosis/osmosis_ibchooks/services/msg_emit_ibc_ack.dart b/lib/src/models/networks/osmosis/osmosis_ibchooks/services/msg_emit_ibc_ack.dart new file mode 100644 index 0000000..80f3621 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_ibchooks/services/msg_emit_ibc_ack.dart @@ -0,0 +1,49 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_ibchooks/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +import 'msg_emit_ibc_ack_response.dart'; + +class OsmosisIbchooksMsgEmitIBCAck extends CosmosMessage + with ServiceMessage { + final String? sender; + final BigInt? packetSequence; + final String? channel; + const OsmosisIbchooksMsgEmitIBCAck( + {this.sender, this.packetSequence, this.channel}); + factory OsmosisIbchooksMsgEmitIBCAck.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisIbchooksMsgEmitIBCAck( + sender: decode.getField(1), + packetSequence: decode.getField(2), + channel: decode.getField(3)); + } + + @override + List get fieldIds => [1, 2, 3]; + + @override + OsmosisIbchooksMsgEmitIBCAckResponse onResponse(List bytes) { + return OsmosisIbchooksMsgEmitIBCAckResponse.deserialize(bytes); + } + + @override + String get service => OsmosisIbchooksTypes.emitIBCAck.typeUrl; + + @override + List get signers => [sender]; + + @override + Map toJson() { + return { + "sender": sender, + "packet_sequence": packetSequence?.toString(), + "channel": channel + }; + } + + @override + String get typeUrl => OsmosisIbchooksTypes.msgEmitIBCAck.typeUrl; + + @override + List get values => [sender, packetSequence, channel]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_ibchooks/services/msg_emit_ibc_ack_response.dart b/lib/src/models/networks/osmosis/osmosis_ibchooks/services/msg_emit_ibc_ack_response.dart new file mode 100644 index 0000000..91e7f40 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_ibchooks/services/msg_emit_ibc_ack_response.dart @@ -0,0 +1,27 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_ibchooks/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +class OsmosisIbchooksMsgEmitIBCAckResponse extends CosmosMessage { + final String? contractResult; + final String? ibcAck; + OsmosisIbchooksMsgEmitIBCAckResponse({this.contractResult, this.ibcAck}); + factory OsmosisIbchooksMsgEmitIBCAckResponse.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisIbchooksMsgEmitIBCAckResponse( + contractResult: decode.getField(1), ibcAck: decode.getField(2)); + } + + @override + List get fieldIds => [1, 2]; + + @override + Map toJson() { + return {"contract_result": contractResult?.toString(), "ibc_ack": ibcAck}; + } + + @override + String get typeUrl => OsmosisIbchooksTypes.msgEmitIBCAckResponse.typeUrl; + + @override + List get values => [contractResult, ibcAck]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_ibchooks/types/types.dart b/lib/src/models/networks/osmosis/osmosis_ibchooks/types/types.dart new file mode 100644 index 0000000..2e96141 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_ibchooks/types/types.dart @@ -0,0 +1,22 @@ +import 'package:cosmos_sdk/src/models/core/type_url/type_url.dart'; + +class OsmosisIbchooksTypes extends TypeUrl { + @override + final String typeUrl; + @override + final String? rpc = null; + const OsmosisIbchooksTypes._(this.typeUrl); + static const OsmosisIbchooksTypes params = + OsmosisIbchooksTypes._("/osmosis.ibchooks.Params"); + static const OsmosisIbchooksTypes genesisState = + OsmosisIbchooksTypes._("/osmosis.ibchooks.GenesisState"); + + static const OsmosisIbchooksTypes msgEmitIBCAck = + OsmosisIbchooksTypes._("/osmosis.ibchooks.MsgEmitIBCAck"); + static const OsmosisIbchooksTypes msgEmitIBCAckResponse = + OsmosisIbchooksTypes._("/osmosis.ibchooks.MsgEmitIBCAckResponse"); + + /// service + static const OsmosisIbchooksTypes emitIBCAck = + OsmosisIbchooksTypes._("/osmosis.ibchooks.Msg/EmitIBCAck"); +} diff --git a/lib/src/models/networks/osmosis/osmosis_incentives/query/active_gauges_per_denom_request.dart b/lib/src/models/networks/osmosis/osmosis_incentives/query/active_gauges_per_denom_request.dart index 65722e9..43cb785 100644 --- a/lib/src/models/networks/osmosis/osmosis_incentives/query/active_gauges_per_denom_request.dart +++ b/lib/src/models/networks/osmosis/osmosis_incentives/query/active_gauges_per_denom_request.dart @@ -54,9 +54,7 @@ class OsmosisIncentiveActiveGaugesPerDenomRequest extends CosmosMessage } @override - Map get queryParameters => { - "denom": denom, - }; + Map get queryParameters => {"denom": denom}; @override String get rpcPath => diff --git a/lib/src/models/networks/osmosis/osmosis_incentives/services/msg_add_to_gauge.dart b/lib/src/models/networks/osmosis/osmosis_incentives/services/msg_add_to_gauge.dart index 8cfcca8..ba4827b 100644 --- a/lib/src/models/networks/osmosis/osmosis_incentives/services/msg_add_to_gauge.dart +++ b/lib/src/models/networks/osmosis/osmosis_incentives/services/msg_add_to_gauge.dart @@ -1,5 +1,8 @@ -import 'package:cosmos_sdk/cosmos_sdk.dart'; +import 'package:cosmos_sdk/src/models/global_messages/service_empty_response.dart'; import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_incentives/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'; /// MsgAddToGauge adds coins to a previously created gauge class OsmosisIncentiveMsgAddToGauge extends CosmosMessage diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/messages/denom_pair_taker_fee.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/messages/denom_pair_taker_fee.dart new file mode 100644 index 0000000..7bbb8cb --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/messages/denom_pair_taker_fee.dart @@ -0,0 +1,35 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +class OsmosisPoolManagerDenomPairTakerFee extends CosmosMessage { + /// denom0 and denom1 get automatically lexigographically sorted + /// when being stored, so the order of input here does not matter. + final String? denom0; + final String? denom1; + final String takerFee; + + OsmosisPoolManagerDenomPairTakerFee( + {this.denom0, this.denom1, required this.takerFee}); + factory OsmosisPoolManagerDenomPairTakerFee.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisPoolManagerDenomPairTakerFee( + denom0: decode.getField(1), + denom1: decode.getField(2), + takerFee: decode.getField(3)); + } + + @override + List get fieldIds => [1, 2, 3]; + + @override + Map toJson() { + return {"denom0": denom0, "denom1": denom1, "taker_fee": takerFee}; + } + + @override + String get typeUrl => + OsmosisPoolManagerV1beta1Types.denomPairTakerFee.typeUrl; + + @override + List get values => [denom0, denom1, takerFee]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/messages/denom_pair_taker_fee_proposal.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/messages/denom_pair_taker_fee_proposal.dart new file mode 100644 index 0000000..942e029 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/messages/denom_pair_taker_fee_proposal.dart @@ -0,0 +1,48 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; + +import 'denom_pair_taker_fee.dart'; + +/// DenomPairTakerFeeProposal is a type for adding/removing a custom taker fee(s) for one or more denom pairs. +class OsmosisPoolManagerDenomPairTakerFeeProposal extends CosmosMessage { + final String? title; + final String? description; + final List denomPairTakerFee; + + OsmosisPoolManagerDenomPairTakerFeeProposal({ + this.title, + this.description, + required List denomPairTakerFee, + }) : denomPairTakerFee = denomPairTakerFee.mutable; + factory OsmosisPoolManagerDenomPairTakerFeeProposal.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisPoolManagerDenomPairTakerFeeProposal( + title: decode.getField(1), + description: decode.getField(2), + denomPairTakerFee: decode + .getFields(3) + .map((e) => OsmosisPoolManagerDenomPairTakerFee.deserialize(e)) + .toList()); + } + + @override + List get fieldIds => [1, 2, 3]; + + @override + Map toJson() { + return { + "title": title, + "description": description, + "denom_pair_taker_fee": denomPairTakerFee.map((e) => e.toJson()).toList() + }; + } + + @override + String get typeUrl => + OsmosisPoolManagerV1beta1Types.denomPairTakerFeeProposal.typeUrl; + + @override + List get values => [title, description, denomPairTakerFee]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/messages/genesis_state.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/messages/genesis_state.dart new file mode 100644 index 0000000..47f9882 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/messages/genesis_state.dart @@ -0,0 +1,86 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; +import 'denom_pair_taker_fee.dart'; +import 'module_route.dart'; +import 'params.dart'; +import 'pool_volume.dart'; +import 'taker_fees_tracker.dart'; + +/// GenesisState defines the poolmanager module's genesis state. +class OsmosisPoolGenesisState extends CosmosMessage { + /// the [nextPoolId] + final BigInt? nextPoolId; + + /// params is the container of poolmanager parameters. + final OsmosisPoolManagerParams params; + + /// [poolRoutes] is the container of the mappings from pool id to pool type + final List poolRoutes; + + /// KVStore state + final OsmosisPoolManagerTakerFeesTracker takerFeesTracker; + final List poolVolumes; + final List denomPairTakerFeeStore; + OsmosisPoolGenesisState( + {this.nextPoolId, + required this.params, + required List poolRoutes, + required this.takerFeesTracker, + required List poolVolumes, + required List + denomPairTakerFeeStore}) + : poolRoutes = poolRoutes.mutable, + poolVolumes = poolVolumes.mutable, + denomPairTakerFeeStore = denomPairTakerFeeStore.mutable; + factory OsmosisPoolGenesisState.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisPoolGenesisState( + nextPoolId: decode.getField(1), + params: OsmosisPoolManagerParams.deserialize(decode.getField(2)), + poolRoutes: decode + .getFields(3) + .map((e) => OsmosisPoolManagerModuleRoute.deserialize(e)) + .toList(), + takerFeesTracker: + OsmosisPoolManagerTakerFeesTracker.deserialize(decode.getField(4)), + poolVolumes: decode + .getFields(5) + .map((e) => OsmosisPoolManagerPoolVolume.deserialize(e)) + .toList(), + denomPairTakerFeeStore: decode + .getFields(6) + .map((e) => OsmosisPoolManagerDenomPairTakerFee.deserialize(e)) + .toList(), + ); + } + + @override + List get fieldIds => [1, 2, 3, 4, 5, 6]; + + @override + Map toJson() { + return { + "next_pool_id": nextPoolId?.toString(), + "params": params.toJson(), + "pool_routes": poolRoutes.map((e) => e.toJson()).toList(), + "taker_fees_tracker": takerFeesTracker.toJson(), + "pool_volumes": poolVolumes.map((e) => e.toJson()).toList(), + "denom_pair_taker_fee_store": + denomPairTakerFeeStore.map((e) => e.toJson()).toList() + }; + } + + @override + String get typeUrl => OsmosisPoolManagerV1beta1Types.genesisState.typeUrl; + + @override + List get values => [ + nextPoolId, + params, + poolRoutes, + takerFeesTracker, + poolVolumes, + denomPairTakerFeeStore + ]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/messages/module_route.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/messages/module_route.dart new file mode 100644 index 0000000..be7f074 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/messages/module_route.dart @@ -0,0 +1,34 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'pool_type.dart'; + +/// ModuleRouter defines a route encapsulating pool type. It is used as the value of a mapping from pool id to the +/// pool type, allowing the pool manager to know which module to route swaps to given the pool id. +class OsmosisPoolManagerModuleRoute extends CosmosMessage { + /// pool_type specifies the type of the pool + final OsmosisPoolManagerPoolType? poolType; + final BigInt? poolId; + OsmosisPoolManagerModuleRoute({this.poolType, this.poolId}); + factory OsmosisPoolManagerModuleRoute.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisPoolManagerModuleRoute( + poolType: decode.getResult(1)?.to( + (e) => OsmosisPoolManagerPoolType.fromValue(e)), + poolId: decode.getField(2), + ); + } + + @override + List get fieldIds => [1, 2]; + + @override + Map toJson() { + return {"pool_type": poolType?.name, "pool_id": poolId?.toString()}; + } + + @override + String get typeUrl => OsmosisPoolManagerV1beta1Types.moduleRoute.typeUrl; + + @override + List get values => [poolType, poolId]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/messages/params.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/messages/params.dart new file mode 100644 index 0000000..5c1f091 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/messages/params.dart @@ -0,0 +1,67 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_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 'taker_fee_params.dart'; + +/// Params holds parameters for the poolmanager module. +class OsmosisPoolManagerParams extends CosmosMessage { + final List poolCreationFee; + + /// [takerFeeParams] is the container of taker fee parameters. + final OsmosisPoolManagerTakerFeeParams takerFeeParams; + + /// authorized_quote_denoms is a list of quote denoms that can be used as + /// token1 when creating a concentrated 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; + + OsmosisPoolManagerParams({ + required List poolCreationFee, + required this.takerFeeParams, + List? authorizedQuoteDenoms, + }) : poolCreationFee = poolCreationFee.mutable, + authorizedQuoteDenoms = authorizedQuoteDenoms?.nullOnEmpy; + factory OsmosisPoolManagerParams.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisPoolManagerParams( + poolCreationFee: + decode.getFields(1).map((e) => Coin.deserialize(e)).toList(), + takerFeeParams: + OsmosisPoolManagerTakerFeeParams.deserialize(decode.getField(2)), + authorizedQuoteDenoms: decode.getFields(3)); + } + factory OsmosisPoolManagerParams.fromRpc(Map json) { + return OsmosisPoolManagerParams( + poolCreationFee: (json["pool_creation_fee"] as List?) + ?.map((e) => Coin.fromRpc(e)) + .toList() ?? + [], + takerFeeParams: + OsmosisPoolManagerTakerFeeParams.fromRpc(json["taker_fee_params"]), + authorizedQuoteDenoms: json["authorized_quote_denoms"]); + } + + @override + List get fieldIds => [1, 2, 3]; + + @override + Map toJson() { + return { + "pool_creation_fee": poolCreationFee.map((e) => e.toJson()).toList(), + "taker_fee_params": takerFeeParams.toJson(), + "authorized_quote_denoms": authorizedQuoteDenoms + }; + } + + @override + String get typeUrl => OsmosisPoolManagerV1beta1Types.params.typeUrl; + + @override + List get values => [poolCreationFee, takerFeeParams, authorizedQuoteDenoms]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/messages/pool_type.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/messages/pool_type.dart new file mode 100644 index 0000000..6cc7b64 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/messages/pool_type.dart @@ -0,0 +1,53 @@ +import 'package:blockchain_utils/exception/exceptions.dart'; +import 'package:cosmos_sdk/src/protobuf/types/cosmos_enum.dart'; + +class OsmosisPoolManagerPoolType implements CosmosEnum { + @override + final String name; + @override + final int value; + const OsmosisPoolManagerPoolType(this.name, this.value); + + /// Balancer is the standard xy=k curve. Its pool model is defined in x/gamm. + static const OsmosisPoolManagerPoolType balancer = + OsmosisPoolManagerPoolType("Balancer", 0); + + /// Stableswap is the Solidly cfmm stable swap curve. Its pool model is defined + /// in x/gamm. + static const OsmosisPoolManagerPoolType stableswap = + OsmosisPoolManagerPoolType("Stableswap", 1); + + /// Concentrated is the pool model specific to concentrated liquidity. It is + /// defined in x/concentrated-liquidity. + static const OsmosisPoolManagerPoolType concentrated = + OsmosisPoolManagerPoolType("Concentrated", 2); + + /// CosmWasm is the pool model specific to CosmWasm. It is defined in + /// x/cosmwasmpool. + static const OsmosisPoolManagerPoolType cosmWasm = + OsmosisPoolManagerPoolType("CosmWasm", 3); + + static const List values = [ + balancer, + stableswap, + concentrated, + cosmWasm + ]; + static OsmosisPoolManagerPoolType fromValue(int? value) { + return values.firstWhere( + (element) => element.value == value, + orElse: () => throw MessageException( + "No OsmosisPoolManagerPoolType element found for the given value.", + details: {"value": value}), + ); + } + + static OsmosisPoolManagerPoolType fromName(String? name) { + return values.firstWhere( + (element) => element.name == name, + orElse: () => throw MessageException( + "No OsmosisPoolManagerPoolType element found for the given name.", + details: {"name": name}), + ); + } +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/messages/pool_volume.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/messages/pool_volume.dart new file mode 100644 index 0000000..288a06d --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/messages/pool_volume.dart @@ -0,0 +1,41 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_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'; + +/// PoolVolume stores the KVStore entries for each pool's volume, which is used in export/import genesis. +class OsmosisPoolManagerPoolVolume extends CosmosMessage { + /// [poolId] is the id of the pool + final BigInt? poolId; + + /// [poolVolume] is the cumulative volume of the pool. + final List poolVolume; + + OsmosisPoolManagerPoolVolume( + {required this.poolId, required List poolVolume}) + : poolVolume = poolVolume.mutable; + factory OsmosisPoolManagerPoolVolume.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisPoolManagerPoolVolume( + poolId: decode.getField(1), + poolVolume: + decode.getFields(2).map((e) => Coin.deserialize(e)).toList()); + } + + @override + List get fieldIds => [1, 2]; + + @override + Map toJson() { + return { + "pool_id": poolId?.toString(), + "pool_volume": poolVolume.map((e) => e.toJson()).toList() + }; + } + + @override + String get typeUrl => OsmosisPoolManagerV1beta1Types.poolVolume.typeUrl; + + @override + List get values => [poolId, poolVolume]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/messages/swap_amount_in_route.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/messages/swap_amount_in_route.dart new file mode 100644 index 0000000..d275404 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/messages/swap_amount_in_route.dart @@ -0,0 +1,36 @@ +import 'package:blockchain_utils/numbers/numbers.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +class OsmosisPoolManagerSwapAmountInRoute extends CosmosMessage { + final BigInt? poolId; + final String? tokenOutDenom; + + const OsmosisPoolManagerSwapAmountInRoute({this.poolId, this.tokenOutDenom}); + factory OsmosisPoolManagerSwapAmountInRoute.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisPoolManagerSwapAmountInRoute( + poolId: decode.getField(1), tokenOutDenom: decode.getField(2)); + } + factory OsmosisPoolManagerSwapAmountInRoute.fromRpc( + Map json) { + return OsmosisPoolManagerSwapAmountInRoute( + poolId: BigintUtils.tryParse(json["pool_id"]), + tokenOutDenom: json["token_out_denom"]); + } + + @override + List get fieldIds => [1, 2]; + + @override + Map toJson() { + return {"pool_id": poolId?.toString(), "token_out_denom": tokenOutDenom}; + } + + @override + String get typeUrl => + OsmosisPoolManagerV1beta1Types.swapAmountInRoute.typeUrl; + + @override + List get values => [poolId, tokenOutDenom]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/messages/swap_amount_out_route.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/messages/swap_amount_out_route.dart new file mode 100644 index 0000000..0113118 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/messages/swap_amount_out_route.dart @@ -0,0 +1,30 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +class OsmosisPoolManagerSwapAmountOutRoute extends CosmosMessage { + final BigInt? poolId; + final String? tokenInDenom; + + OsmosisPoolManagerSwapAmountOutRoute( + {required this.poolId, required this.tokenInDenom}); + factory OsmosisPoolManagerSwapAmountOutRoute.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisPoolManagerSwapAmountOutRoute( + poolId: decode.getField(1), tokenInDenom: decode.getField(2)); + } + + @override + List get fieldIds => [1, 2]; + + @override + Map toJson() { + return {"pool_id": poolId?.toString(), "token_in_denom": tokenInDenom}; + } + + @override + String get typeUrl => + OsmosisPoolManagerV1beta1Types.swapAmountOutRoute.typeUrl; + + @override + List get values => [poolId, tokenInDenom]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/messages/swap_amount_out_split_route.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/messages/swap_amount_out_split_route.dart new file mode 100644 index 0000000..a2a9c26 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/messages/swap_amount_out_split_route.dart @@ -0,0 +1,40 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +import 'swap_amount_out_route.dart'; + +class OsmosisPoolManagerSwapAmountOutSplitRoute extends CosmosMessage { + final List pools; + final String tokenOutAmount; + + OsmosisPoolManagerSwapAmountOutSplitRoute( + {required this.pools, required this.tokenOutAmount}); + factory OsmosisPoolManagerSwapAmountOutSplitRoute.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisPoolManagerSwapAmountOutSplitRoute( + pools: decode + .getFields(1) + .map((e) => OsmosisPoolManagerSwapAmountOutRoute.deserialize(e)) + .toList(), + tokenOutAmount: decode.getField(2)); + } + + @override + List get fieldIds => [1, 2]; + + @override + Map toJson() { + return { + "pools": pools.map((e) => e.toJson()).toList(), + "token_out_amount": tokenOutAmount + }; + } + + @override + String get typeUrl => + OsmosisPoolManagerV1beta1Types.swapAmountOutSplitRoute.typeUrl; + + @override + List get values => [pools, tokenOutAmount]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/messages/taker_fee_distribution_percentage.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/messages/taker_fee_distribution_percentage.dart new file mode 100644 index 0000000..89a7101 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/messages/taker_fee_distribution_percentage.dart @@ -0,0 +1,38 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +/// TakerFeeDistributionPercentage defines what percent of the taker fee category gets distributed to the available categories. +class OsmosisPoolManagerTakerFeeDistributionPercentage extends CosmosMessage { + final String stakingRewards; + final String communityPool; + + OsmosisPoolManagerTakerFeeDistributionPercentage( + {required this.stakingRewards, required this.communityPool}); + factory OsmosisPoolManagerTakerFeeDistributionPercentage.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisPoolManagerTakerFeeDistributionPercentage( + stakingRewards: decode.getField(1), communityPool: decode.getField(2)); + } + factory OsmosisPoolManagerTakerFeeDistributionPercentage.fromRpc( + Map json) { + return OsmosisPoolManagerTakerFeeDistributionPercentage( + stakingRewards: json["staking_rewards"], + communityPool: json["community_pool"]); + } + + @override + List get fieldIds => [1, 2]; + + @override + Map toJson() { + return {"staking_rewards": stakingRewards, "community_pool": communityPool}; + } + + @override + String get typeUrl => + OsmosisPoolManagerV1beta1Types.takerFeeDistributionPercentage.typeUrl; + + @override + List get values => [stakingRewards, communityPool]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/messages/taker_fee_params.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/messages/taker_fee_params.dart new file mode 100644 index 0000000..d41fd30 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/messages/taker_fee_params.dart @@ -0,0 +1,120 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; + +import 'taker_fee_distribution_percentage.dart'; + +/// TakerFeeParams consolidates the taker fee parameters for the poolmanager. +class OsmosisPoolManagerTakerFeeParams extends CosmosMessage { + /// [defaultTakerFee] is the fee used when creating a new pool that doesn't + /// fall under a custom pool taker fee or stableswap taker fee category. + final String defaultTakerFee; + + /// [osmoTakerFeeDistribution] defines the distribution of taker fees + /// generated in OSMO. As of this writing, it has two catagories: + /// - staking_rewards: the percent of the taker fee that gets distributed to + /// stakers. + /// - community_pool: the percent of the taker fee that gets sent to the + /// community pool. + final OsmosisPoolManagerTakerFeeDistributionPercentage + osmoTakerFeeDistribution; + + /// [nonOsmoTakerFeeDistribution] defines the distribution of taker fees + /// generated in non-OSMO. As of this writing, it has two categories: + /// - staking_rewards: the percent of the taker fee that gets swapped to OSMO + /// and then distirbuted to stakers. + /// - community_pool: the percent of the taker fee that gets sent to the + /// community pool. Note: If the non-OSMO asset is an authorized_quote_denom, + /// that denom is sent directly to the community pool. Otherwise, it is + /// swapped to the community_pool_denom_to_swap_non_whitelisted_assets_to and + /// then sent to the community pool as that denom. + final OsmosisPoolManagerTakerFeeDistributionPercentage + nonOsmoTakerFeeDistribution; + + /// [adminAddresses] is a list of addresses that are allowed to set and remove + /// custom taker fees for denom pairs. Governance also has the ability to set + /// and remove custom taker fees for denom pairs, but with the normal + /// governance delay. + final List? adminAddresses; + + /// [communityPoolDenomToSwapNonWhitelistedAssetsTo] is the denom that + /// non-whitelisted taker fees will be swapped to before being sent to + /// the community pool. + final String? communityPoolDenomToSwapNonWhitelistedAssetsTo; + + /// [reducedFeeWhitelist] is a list of addresses that are + /// allowed to pay a reduce taker fee when performing a swap + /// (i.e. swap without paying the taker fee). + /// It is intended to be used for integrators who meet qualifying factors + /// that are approved by governance. + /// Initially, the taker fee is allowed to be bypassed completely. However + /// In the future, we will charge a reduced taker fee instead of no fee at all. + final List? reducedFeeWhitelist; + + OsmosisPoolManagerTakerFeeParams( + {required this.defaultTakerFee, + required this.osmoTakerFeeDistribution, + required this.nonOsmoTakerFeeDistribution, + List? adminAddresses, + this.communityPoolDenomToSwapNonWhitelistedAssetsTo, + List? reducedFeeWhitelist}) + : adminAddresses = adminAddresses?.nullOnEmpy, + reducedFeeWhitelist = reducedFeeWhitelist?.nullOnEmpy; + factory OsmosisPoolManagerTakerFeeParams.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisPoolManagerTakerFeeParams( + defaultTakerFee: decode.getField(1), + osmoTakerFeeDistribution: + OsmosisPoolManagerTakerFeeDistributionPercentage.deserialize( + decode.getField(2)), + nonOsmoTakerFeeDistribution: + OsmosisPoolManagerTakerFeeDistributionPercentage.deserialize( + decode.getField(3)), + adminAddresses: decode.getFields(4), + communityPoolDenomToSwapNonWhitelistedAssetsTo: decode.getField(5), + reducedFeeWhitelist: decode.getFields(6)); + } + factory OsmosisPoolManagerTakerFeeParams.fromRpc(Map json) { + return OsmosisPoolManagerTakerFeeParams( + defaultTakerFee: json["default_taker_fee"], + osmoTakerFeeDistribution: + OsmosisPoolManagerTakerFeeDistributionPercentage.fromRpc( + json["osmo_taker_fee_distribution"]), + nonOsmoTakerFeeDistribution: + OsmosisPoolManagerTakerFeeDistributionPercentage.fromRpc( + json["non_osmo_taker_fee_distribution"]), + adminAddresses: (json["admin_addresses"] as List?)?.cast(), + communityPoolDenomToSwapNonWhitelistedAssetsTo: + json["community_pool_denom_to_swap_non_whitelisted_assets_to"], + reducedFeeWhitelist: (json["reduced_fee_whitelist"] as List?)?.cast()); + } + + @override + List get fieldIds => [1, 2, 3, 4, 5, 6]; + + @override + Map toJson() { + return { + "default_taker_fee": defaultTakerFee, + "osmo_taker_fee_distribution": osmoTakerFeeDistribution.toJson(), + "non_osmo_taker_fee_distribution": nonOsmoTakerFeeDistribution.toJson(), + "admin_addresses": adminAddresses, + "community_pool_denom_to_swap_non_whitelisted_assets_to": + communityPoolDenomToSwapNonWhitelistedAssetsTo, + "reduced_fee_whitelist": reducedFeeWhitelist + }; + } + + @override + String get typeUrl => OsmosisPoolManagerV1beta1Types.takerFeeParams.typeUrl; + + @override + List get values => [ + defaultTakerFee, + osmoTakerFeeDistribution, + nonOsmoTakerFeeDistribution, + adminAddresses, + communityPoolDenomToSwapNonWhitelistedAssetsTo, + reducedFeeWhitelist + ]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/messages/taker_fees_tracker.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/messages/taker_fees_tracker.dart new file mode 100644 index 0000000..6d5336a --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/messages/taker_fees_tracker.dart @@ -0,0 +1,65 @@ +import 'package:blockchain_utils/numbers/bigint_utils.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_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 OsmosisPoolManagerTakerFeesTracker extends CosmosMessage { + final List takerFeesToStakers; + final List takerFeesToCommunityPool; + final BigInt? heightAccountingStartsFrom; + OsmosisPoolManagerTakerFeesTracker( + {required List takerFeesToStakers, + required List takerFeesToCommunityPool, + this.heightAccountingStartsFrom}) + : takerFeesToStakers = takerFeesToStakers.mutable, + takerFeesToCommunityPool = takerFeesToCommunityPool.mutable; + factory OsmosisPoolManagerTakerFeesTracker.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisPoolManagerTakerFeesTracker( + takerFeesToStakers: + decode.getFields(1).map((e) => Coin.deserialize(e)).toList(), + takerFeesToCommunityPool: + decode.getFields(2).map((e) => Coin.deserialize(e)).toList(), + heightAccountingStartsFrom: decode.getField(3)); + } + factory OsmosisPoolManagerTakerFeesTracker.fromRpc( + Map json) { + return OsmosisPoolManagerTakerFeesTracker( + takerFeesToStakers: (json["taker_fees_to_stakers"] as List?) + ?.map((e) => Coin.fromRpc(e)) + .toList() ?? + [], + takerFeesToCommunityPool: + (json["taker_fees_to_community_pool"] as List?) + ?.map((e) => Coin.fromRpc(e)) + .toList() ?? + [], + heightAccountingStartsFrom: + BigintUtils.tryParse(json["height_accounting_starts_from"])); + } + + @override + List get fieldIds => [1, 2, 3]; + + @override + Map toJson() { + return { + "taker_fees_to_stakers": + takerFeesToStakers.map((e) => e.toJson()).toList(), + "taker_fees_to_community_pool": + takerFeesToCommunityPool.map((e) => e.toJson()).toList(), + "height_accounting_starts_from": heightAccountingStartsFrom?.toString() + }; + } + + @override + String get typeUrl => OsmosisPoolManagerV1beta1Types.takerFeesTracker.typeUrl; + + @override + List get values => [ + takerFeesToStakers, + takerFeesToCommunityPool, + heightAccountingStartsFrom + ]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/messages/tracked_volume.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/messages/tracked_volume.dart new file mode 100644 index 0000000..b3a8b2f --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/messages/tracked_volume.dart @@ -0,0 +1,28 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_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 OsmosisPoolManagerTrackedVolume extends CosmosMessage { + final List amount; + OsmosisPoolManagerTrackedVolume(List amount) : amount = amount.mutable; + factory OsmosisPoolManagerTrackedVolume.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisPoolManagerTrackedVolume( + decode.getFields(1).map((e) => Coin.deserialize(e)).toList()); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"amount": amount.map((e) => e.toJson()).toList()}; + } + + @override + String get typeUrl => OsmosisPoolManagerV1beta1Types.trackedVolume.typeUrl; + + @override + List get values => [amount]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/osmosis_poolmanager_v1beta1.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/osmosis_poolmanager_v1beta1.dart new file mode 100644 index 0000000..60e5a56 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/osmosis_poolmanager_v1beta1.dart @@ -0,0 +1,54 @@ +export 'messages/denom_pair_taker_fee.dart'; +export 'messages/denom_pair_taker_fee_proposal.dart'; +export 'messages/genesis_state.dart'; +export 'messages/module_route.dart'; +export 'messages/params.dart'; +export 'messages/pool_type.dart'; +export 'messages/pool_volume.dart'; +export 'messages/swap_amount_in_route.dart'; +export 'messages/swap_amount_out_route.dart'; +export 'messages/swap_amount_out_split_route.dart'; +export 'messages/taker_fee_distribution_percentage.dart'; +export 'messages/taker_fee_params.dart'; +export 'messages/taker_fees_tracker.dart'; +export 'messages/tracked_volume.dart'; + +export 'query/all_pools_request.dart'; +export 'query/all_pools_response.dart'; +export 'query/estimate_single_pool_swap_exact_amount_out_request.dart'; +export 'query/estimate_swap_exact_amount_in_request.dart'; +export 'query/estimate_swap_exact_amount_in_with_primitive_types_request.dart'; +export 'query/estimate_swap_exact_amount_out_request.dart'; +export 'query/estimate_swap_exact_amount_out_response.dart'; +export 'query/estimate_swap_exact_amount_out_with_primitive_types_request.dart'; +export 'query/estimate_swap_exact_mount_in_response.dart'; +export 'query/estimate_trade_based_on_price_impact_response.dart'; +export 'query/estimate_trade_based_pn_price_impact_request.dart'; +export 'query/list_pools_by_denom_request.dart'; +export 'query/list_pools_by_denom_response.dart'; +export 'query/num_pools_request.dart'; +export 'query/num_pools_response.dart'; +export 'query/params_request.dart'; +export 'query/params_response.dart'; +export 'query/pool_request.dart'; +export 'query/pool_response.dart'; +export 'query/spot_price_request.dart'; +export 'query/spot_price_response.dart'; +export 'query/total_liquidity_request.dart'; +export 'query/total_pool_liquidity_request.dart'; +export 'query/total_liquidity_response.dart'; +export 'query/total_pool_liquidity_response.dart'; +export 'query/total_volume_for_pool_request.dart'; +export 'query/total_volume_for_pool_response.dart'; +export 'query/trading_pair_taker_fee_request.dart'; +export 'query/trading_pair_taker_fee_response.dart'; + +export 'services/msg_set_denom_pair_taker_fee.dart'; +export 'services/msg_set_denom_pair_taker_fee_response.dart'; +export 'services/msg_split_route_swap_exact_amount_in.dart'; +export 'services/msg_split_route_swap_exact_amount_in_response.dart'; +export 'services/msg_split_route_swap_exact_amount_out.dart'; +export 'services/msg_swap_exact_amount_in.dart'; +export 'services/msg_swap_exact_amount_in_response.dart'; +export 'services/msg_swap_exact_amount_out.dart'; +export 'services/msg_swap_exact_amount_out_response.dart'; diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/all_pools_request.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/all_pools_request.dart new file mode 100644 index 0000000..032ef82 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/all_pools_request.dart @@ -0,0 +1,45 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'all_pools_response.dart'; + +class OsmosisPoolManagerAllPoolsRequest extends CosmosMessage + with + QueryMessage, + RPCMessage { + const OsmosisPoolManagerAllPoolsRequest(); + factory OsmosisPoolManagerAllPoolsRequest.deserialize(List bytes) { + return OsmosisPoolManagerAllPoolsRequest(); + } + @override + List get fieldIds => []; + + @override + OsmosisPoolManagerAllPoolsResponse onJsonResponse(Map json) { + return OsmosisPoolManagerAllPoolsResponse.fromRpc(json); + } + + @override + OsmosisPoolManagerAllPoolsResponse onResponse(List bytes) { + return OsmosisPoolManagerAllPoolsResponse.deserialize(bytes); + } + + @override + Map get queryParameters => {}; + + @override + String get queryPath => OsmosisPoolManagerV1beta1Types.allPools.typeUrl; + + @override + String get rpcPath => OsmosisPoolManagerV1beta1Types.allPools.rpcUrl(); + + @override + Map toJson() { + return {}; + } + + @override + String get typeUrl => OsmosisPoolManagerV1beta1Types.allPoolsRequest.typeUrl; + + @override + List get values => []; +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/all_pools_response.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/all_pools_response.dart new file mode 100644 index 0000000..8737038 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/all_pools_response.dart @@ -0,0 +1,33 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; + +class OsmosisPoolManagerAllPoolsResponse extends CosmosMessage { + final List? pools; + OsmosisPoolManagerAllPoolsResponse({List? pools}) + : pools = pools?.nullOnEmpy; + factory OsmosisPoolManagerAllPoolsResponse.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisPoolManagerAllPoolsResponse( + pools: decode.getFields(1).map((e) => Any.deserialize(e)).toList()); + } + factory OsmosisPoolManagerAllPoolsResponse.fromRpc( + Map json) { + return OsmosisPoolManagerAllPoolsResponse( + pools: (json["pools"] as List?)?.map((e) => Any.fromRpc(e)).toList()); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"pools": pools?.map((e) => e.toJson()).toList()}; + } + + @override + String get typeUrl => OsmosisPoolManagerV1beta1Types.allPoolsResponse.typeUrl; + + @override + List get values => [pools]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/estimate_single_pool_swap_exact_amount_out_request.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/estimate_single_pool_swap_exact_amount_out_request.dart new file mode 100644 index 0000000..d09966e --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/estimate_single_pool_swap_exact_amount_out_request.dart @@ -0,0 +1,70 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'estimate_swap_exact_amount_out_response.dart'; + +class OsmosisPoolManagerEstimateSinglePoolSwapExactAmountOutRequest + extends CosmosMessage + with + QueryMessage, + RPCMessage { + final BigInt? poolId; + final String? tokenInDenom; + final String? tokenOut; + + OsmosisPoolManagerEstimateSinglePoolSwapExactAmountOutRequest( + {this.poolId, this.tokenInDenom, this.tokenOut}); + factory OsmosisPoolManagerEstimateSinglePoolSwapExactAmountOutRequest.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisPoolManagerEstimateSinglePoolSwapExactAmountOutRequest( + poolId: decode.getField(1), + tokenInDenom: decode.getField(2), + tokenOut: decode.getField(3)); + } + + @override + List get fieldIds => [1, 2, 3]; + + @override + OsmosisPoolManagerEstimateSwapExactAmountOutResponse onJsonResponse( + Map json) { + return OsmosisPoolManagerEstimateSwapExactAmountOutResponse.fromRpc(json); + } + + @override + OsmosisPoolManagerEstimateSwapExactAmountOutResponse onResponse( + List bytes) { + return OsmosisPoolManagerEstimateSwapExactAmountOutResponse.deserialize( + bytes); + } + + @override + Map get queryParameters => { + "token_out": tokenOut, + }; + + @override + String get queryPath => OsmosisPoolManagerV1beta1Types + .estimateSinglePoolSwapExactAmountOut.typeUrl; + + @override + String get rpcPath => + OsmosisPoolManagerV1beta1Types.estimateSinglePoolSwapExactAmountOut + .rpcUrl(pathParameters: [poolId?.toString()]); + + @override + Map toJson() { + return { + "pool_id": poolId?.toString(), + "token_out": tokenOut, + "token_in_denom": tokenInDenom + }; + } + + @override + String get typeUrl => OsmosisPoolManagerV1beta1Types + .estimateSinglePoolSwapExactAmountOutRequest.typeUrl; + + @override + List get values => [poolId, tokenInDenom, tokenOut]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/estimate_swap_exact_amount_in_request.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/estimate_swap_exact_amount_in_request.dart new file mode 100644 index 0000000..913d452 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/estimate_swap_exact_amount_in_request.dart @@ -0,0 +1,77 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/messages/swap_amount_in_route.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; +import 'estimate_swap_exact_mount_in_response.dart'; + +class OsmosisPoolManagerEstimateSwapExactAmountInRequest extends CosmosMessage + with + QueryMessage, + RPCMessage { + final BigInt? poolId; + final String? tokenIn; + final List routes; + + OsmosisPoolManagerEstimateSwapExactAmountInRequest( + {this.poolId, + this.tokenIn, + required List routes}) + : routes = routes.mutable; + factory OsmosisPoolManagerEstimateSwapExactAmountInRequest.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisPoolManagerEstimateSwapExactAmountInRequest( + poolId: decode.getField(2), + tokenIn: decode.getField(3), + routes: decode + .getFields(4) + .map((e) => OsmosisPoolManagerSwapAmountInRoute.deserialize(e)) + .toList(), + ); + } + + @override + List get fieldIds => [2, 3, 4]; + + @override + OsmosisPoolManagerEstimateSwapExactAmountInResponse onJsonResponse( + Map json) { + return OsmosisPoolManagerEstimateSwapExactAmountInResponse.fromRpc(json); + } + + @override + OsmosisPoolManagerEstimateSwapExactAmountInResponse onResponse( + List bytes) { + return OsmosisPoolManagerEstimateSwapExactAmountInResponse.deserialize( + bytes); + } + + @override + Map get queryParameters => { + "token_in": tokenIn, + }; + + @override + String get queryPath => + OsmosisPoolManagerV1beta1Types.estimateSwapExactAmountIn.typeUrl; + + @override + String get rpcPath => OsmosisPoolManagerV1beta1Types.estimateSwapExactAmountIn + .rpcUrl(pathParameters: [poolId?.toString()]); + + @override + Map toJson() { + return { + "pool_id": poolId?.toString(), + "token_in": tokenIn, + "routes": routes.map((e) => e.toJson()).toList() + }; + } + + @override + String get typeUrl => + OsmosisPoolManagerV1beta1Types.estimateSwapExactAmountInRequest.typeUrl; + + @override + List get values => [poolId, tokenIn, routes]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/estimate_swap_exact_amount_in_with_primitive_types_request.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/estimate_swap_exact_amount_in_with_primitive_types_request.dart new file mode 100644 index 0000000..906396e --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/estimate_swap_exact_amount_in_with_primitive_types_request.dart @@ -0,0 +1,84 @@ +import 'package:blockchain_utils/numbers/numbers.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; +import 'estimate_swap_exact_mount_in_response.dart'; + +class OsmosisPoolManagerEstimateSwapExactAmountInWithPrimitiveTypesRequest + extends CosmosMessage + with + QueryMessage, + RPCMessage { + final BigInt? poolId; + final String? tokenIn; + final List? routesPoolId; + final List? routesTokenOutDenom; + + OsmosisPoolManagerEstimateSwapExactAmountInWithPrimitiveTypesRequest( + {this.poolId, + this.tokenIn, + List? routesPoolId, + List? routesTokenOutDenom}) + : routesPoolId = routesPoolId?.nullOnEmpy, + routesTokenOutDenom = routesTokenOutDenom?.nullOnEmpy; + factory OsmosisPoolManagerEstimateSwapExactAmountInWithPrimitiveTypesRequest.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisPoolManagerEstimateSwapExactAmountInWithPrimitiveTypesRequest( + poolId: decode.getField(1), + tokenIn: decode.getField(2), + routesPoolId: decode + .getResult(3) + ?.to, List>( + (e) => e.map((e) => BigintUtils.parse(e)).toList()) ?? + [], + routesTokenOutDenom: decode.getFields(4)); + } + + @override + List get fieldIds => [1, 2, 3, 4]; + + @override + OsmosisPoolManagerEstimateSwapExactAmountInResponse onJsonResponse( + Map json) { + return OsmosisPoolManagerEstimateSwapExactAmountInResponse.fromRpc(json); + } + + @override + OsmosisPoolManagerEstimateSwapExactAmountInResponse onResponse( + List bytes) { + return OsmosisPoolManagerEstimateSwapExactAmountInResponse.deserialize( + bytes); + } + + @override + Map get queryParameters => { + "token_in": tokenIn, + }; + + @override + String get queryPath => OsmosisPoolManagerV1beta1Types + .estimateSwapExactAmountInWithPrimitiveTypes.typeUrl; + + @override + String get rpcPath => + OsmosisPoolManagerV1beta1Types.estimateSwapExactAmountInWithPrimitiveTypes + .rpcUrl(pathParameters: [poolId?.toString()]); + + @override + Map toJson() { + return { + "pool_id": poolId?.toString(), + "token_in": tokenIn, + "routes_pool_id": routesPoolId?.map((e) => e.toString()).toList(), + "routes_token_out_denom": routesTokenOutDenom + }; + } + + @override + String get typeUrl => OsmosisPoolManagerV1beta1Types + .estimateSwapExactAmountInWithPrimitiveTypesRequest.typeUrl; + + @override + List get values => [poolId, tokenIn, routesPoolId, routesTokenOutDenom]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/estimate_swap_exact_amount_out_request.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/estimate_swap_exact_amount_out_request.dart new file mode 100644 index 0000000..abb87fe --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/estimate_swap_exact_amount_out_request.dart @@ -0,0 +1,77 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/messages/swap_amount_out_route.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; +import 'estimate_swap_exact_amount_out_response.dart'; + +class OsmosisPoolManagerEstimateSwapExactAmountOutRequest extends CosmosMessage + with + QueryMessage, + RPCMessage { + final BigInt? poolId; + final List routes; + final String? tokenOut; + + OsmosisPoolManagerEstimateSwapExactAmountOutRequest( + {this.poolId, + required List routes, + this.tokenOut}) + : routes = routes.mutable; + factory OsmosisPoolManagerEstimateSwapExactAmountOutRequest.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisPoolManagerEstimateSwapExactAmountOutRequest( + poolId: decode.getField(2), + routes: decode + .getFields(3) + .map((e) => OsmosisPoolManagerSwapAmountOutRoute.deserialize(e)) + .toList(), + tokenOut: decode.getField(4)); + } + + @override + List get fieldIds => [2, 3, 4]; + + @override + OsmosisPoolManagerEstimateSwapExactAmountOutResponse onJsonResponse( + Map json) { + return OsmosisPoolManagerEstimateSwapExactAmountOutResponse.fromRpc(json); + } + + @override + OsmosisPoolManagerEstimateSwapExactAmountOutResponse onResponse( + List bytes) { + return OsmosisPoolManagerEstimateSwapExactAmountOutResponse.deserialize( + bytes); + } + + @override + Map get queryParameters => { + "token_out": tokenOut, + }; + + @override + String get queryPath => + OsmosisPoolManagerV1beta1Types.estimateSwapExactAmountOut.typeUrl; + + @override + String get rpcPath => + OsmosisPoolManagerV1beta1Types.estimateSwapExactAmountOut + .rpcUrl(pathParameters: [poolId?.toString()]); + + @override + Map toJson() { + return { + "pool_id": poolId?.toString(), + "routes": routes.map((e) => e.toJson()).toList(), + "token_out": tokenOut + }; + } + + @override + String get typeUrl => + OsmosisPoolManagerV1beta1Types.estimateSwapExactAmountOutRequest.typeUrl; + + @override + List get values => [poolId, routes, tokenOut]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/estimate_swap_exact_amount_out_response.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/estimate_swap_exact_amount_out_response.dart new file mode 100644 index 0000000..bf2f6b2 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/estimate_swap_exact_amount_out_response.dart @@ -0,0 +1,36 @@ +import 'package:blockchain_utils/numbers/numbers.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +class OsmosisPoolManagerEstimateSwapExactAmountOutResponse + extends CosmosMessage { + final BigInt tokenInAmount; + const OsmosisPoolManagerEstimateSwapExactAmountOutResponse( + this.tokenInAmount); + factory OsmosisPoolManagerEstimateSwapExactAmountOutResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisPoolManagerEstimateSwapExactAmountOutResponse( + BigInt.parse(decode.getField(1))); + } + factory OsmosisPoolManagerEstimateSwapExactAmountOutResponse.fromRpc( + Map json) { + return OsmosisPoolManagerEstimateSwapExactAmountOutResponse( + BigintUtils.parse(json["token_in_amount"])); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"token_in_amount": tokenInAmount.toString()}; + } + + @override + String get typeUrl => + OsmosisPoolManagerV1beta1Types.estimateSwapExactAmountOutResponse.typeUrl; + + @override + List get values => [tokenInAmount.toString()]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/estimate_swap_exact_amount_out_with_primitive_types_request.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/estimate_swap_exact_amount_out_with_primitive_types_request.dart new file mode 100644 index 0000000..d0af2ae --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/estimate_swap_exact_amount_out_with_primitive_types_request.dart @@ -0,0 +1,84 @@ +import 'package:blockchain_utils/numbers/numbers.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; +import 'estimate_swap_exact_amount_out_response.dart'; + +class OsmosisPoolManagerEstimateSwapExactAmountOutWithPrimitiveTypesRequest + extends CosmosMessage + with + QueryMessage, + RPCMessage { + final BigInt? poolId; + final List? routesPoolId; + final List? routesTokenInDenom; + final String? tokenOut; + + OsmosisPoolManagerEstimateSwapExactAmountOutWithPrimitiveTypesRequest( + {this.poolId, + this.tokenOut, + List? routesPoolId, + List? routesTokenInDenom}) + : routesPoolId = routesPoolId?.nullOnEmpy, + routesTokenInDenom = routesTokenInDenom?.nullOnEmpy; + factory OsmosisPoolManagerEstimateSwapExactAmountOutWithPrimitiveTypesRequest.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisPoolManagerEstimateSwapExactAmountOutWithPrimitiveTypesRequest( + poolId: decode.getField(1), + routesPoolId: decode + .getResult(2) + ?.to, List>( + (e) => e.map((e) => BigintUtils.parse(e)).toList()) ?? + [], + routesTokenInDenom: decode.getFields(3), + tokenOut: decode.getField(4)); + } + + @override + List get fieldIds => [1, 2, 3, 4]; + + @override + OsmosisPoolManagerEstimateSwapExactAmountOutResponse onJsonResponse( + Map json) { + return OsmosisPoolManagerEstimateSwapExactAmountOutResponse.fromRpc(json); + } + + @override + OsmosisPoolManagerEstimateSwapExactAmountOutResponse onResponse( + List bytes) { + return OsmosisPoolManagerEstimateSwapExactAmountOutResponse.deserialize( + bytes); + } + + @override + Map get queryParameters => { + "token_out": tokenOut, + }; + + @override + String get queryPath => OsmosisPoolManagerV1beta1Types + .estimateSwapExactAmountOutWithPrimitiveTypes.typeUrl; + + @override + String get rpcPath => OsmosisPoolManagerV1beta1Types + .estimateSwapExactAmountOutWithPrimitiveTypes + .rpcUrl(pathParameters: [poolId?.toString()]); + + @override + Map toJson() { + return { + "pool_id": poolId?.toString(), + "token_out": tokenOut, + "routes_pool_id": routesPoolId?.map((e) => e.toString()).toList(), + "routes_token_in_denom": routesTokenInDenom + }; + } + + @override + String get typeUrl => OsmosisPoolManagerV1beta1Types + .estimateSwapExactAmountOutWithPrimitiveTypesRequest.typeUrl; + + @override + List get values => [poolId, routesPoolId, routesTokenInDenom, tokenOut]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/estimate_swap_exact_mount_in_response.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/estimate_swap_exact_mount_in_response.dart new file mode 100644 index 0000000..4dd48c8 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/estimate_swap_exact_mount_in_response.dart @@ -0,0 +1,36 @@ +import 'package:blockchain_utils/numbers/numbers.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +class OsmosisPoolManagerEstimateSwapExactAmountInResponse + extends CosmosMessage { + final BigInt tokenOutAmount; + const OsmosisPoolManagerEstimateSwapExactAmountInResponse( + this.tokenOutAmount); + factory OsmosisPoolManagerEstimateSwapExactAmountInResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisPoolManagerEstimateSwapExactAmountInResponse( + BigInt.parse(decode.getField(1))); + } + factory OsmosisPoolManagerEstimateSwapExactAmountInResponse.fromRpc( + Map json) { + return OsmosisPoolManagerEstimateSwapExactAmountInResponse( + BigintUtils.parse(json["token_out_amount"])); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"token_out_amount": tokenOutAmount.toString()}; + } + + @override + String get typeUrl => + OsmosisPoolManagerV1beta1Types.estimateSwapExactAmountInResponse.typeUrl; + + @override + List get values => [tokenOutAmount.toString()]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/estimate_trade_based_on_price_impact_response.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/estimate_trade_based_on_price_impact_response.dart new file mode 100644 index 0000000..7283218 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/estimate_trade_based_on_price_impact_response.dart @@ -0,0 +1,47 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_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'; + +class OsmosisPoolManagerEstimateTradeBasedOnPriceImpactResponse + extends CosmosMessage { + /// input_coin is the actual input amount that would be tradeable + /// under the specified price impact + final Coin inputCoin; + + /// output_coin is the amount of tokens of the ToCoinDenom type + /// that will be received for the actual InputCoin trade. + final Coin outputCoin; + const OsmosisPoolManagerEstimateTradeBasedOnPriceImpactResponse( + {required this.inputCoin, required this.outputCoin}); + factory OsmosisPoolManagerEstimateTradeBasedOnPriceImpactResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisPoolManagerEstimateTradeBasedOnPriceImpactResponse( + inputCoin: Coin.deserialize(decode.getField(1)), + outputCoin: Coin.deserialize(decode.getField(2))); + } + factory OsmosisPoolManagerEstimateTradeBasedOnPriceImpactResponse.fromRpc( + Map json) { + return OsmosisPoolManagerEstimateTradeBasedOnPriceImpactResponse( + inputCoin: Coin.fromRpc(json["input_coin"]), + outputCoin: Coin.fromRpc(json["output_coin"])); + } + + @override + List get fieldIds => [1, 2]; + + @override + Map toJson() { + return { + "input_coin": inputCoin.toJson(), + "output_coin": outputCoin.toJson() + }; + } + + @override + String get typeUrl => OsmosisPoolManagerV1beta1Types + .estimateTradeBasedOnPriceImpactResponse.typeUrl; + + @override + List get values => [inputCoin, outputCoin]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/estimate_trade_based_pn_price_impact_request.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/estimate_trade_based_pn_price_impact_request.dart new file mode 100644 index 0000000..accc7db --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/estimate_trade_based_pn_price_impact_request.dart @@ -0,0 +1,100 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_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 'estimate_trade_based_on_price_impact_response.dart'; + +class OsmosisPoolManagerEstimateTradeBasedOnPriceImpactRequest + extends CosmosMessage + with + QueryMessage, + RPCMessage { + /// from_coin is the total amount of tokens that the user wants to sell. + final Coin fromCoin; + + /// to_coin_denom is the denom identifier of the token that the user wants to + /// buy. + final String? toCoinDenom; + + /// pool_id is the identifier of the liquidity pool that the trade will occur + /// on. + final BigInt? poolId; + + /// max_price_impact is the maximum percentage that the user is willing + /// to affect the price of the liquidity pool. + final String maxPriceImpact; + + /// external_price is an optional external price that the user can enter. + /// It adjusts the MaxPriceImpact as the SpotPrice of a pool can be changed at + /// any time. + final String externalPrice; + + OsmosisPoolManagerEstimateTradeBasedOnPriceImpactRequest({ + required this.fromCoin, + this.toCoinDenom, + this.poolId, + required this.maxPriceImpact, + required this.externalPrice, + }); + factory OsmosisPoolManagerEstimateTradeBasedOnPriceImpactRequest.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisPoolManagerEstimateTradeBasedOnPriceImpactRequest( + fromCoin: Coin.deserialize(decode.getField(1)), + toCoinDenom: decode.getField(2), + poolId: decode.getField(3), + maxPriceImpact: decode.getField(4), + externalPrice: decode.getField(5)); + } + + @override + List get fieldIds => [1, 2, 3, 4, 5]; + + @override + OsmosisPoolManagerEstimateTradeBasedOnPriceImpactResponse onJsonResponse( + Map json) { + return OsmosisPoolManagerEstimateTradeBasedOnPriceImpactResponse.fromRpc( + json); + } + + @override + OsmosisPoolManagerEstimateTradeBasedOnPriceImpactResponse onResponse( + List bytes) { + return OsmosisPoolManagerEstimateTradeBasedOnPriceImpactResponse + .deserialize(bytes); + } + + @override + Map get queryParameters => { + "to_coin_denom": toCoinDenom, + "max_price_impact": maxPriceImpact, + "external_price": externalPrice + }; + + @override + String get queryPath => + OsmosisPoolManagerV1beta1Types.estimateTradeBasedOnPriceImpact.typeUrl; + + @override + String get rpcPath => + OsmosisPoolManagerV1beta1Types.estimateTradeBasedOnPriceImpact + .rpcUrl(pathParameters: [poolId?.toString()]); + + @override + Map toJson() { + return { + "from_coin": fromCoin.toJson(), + "to_coin_denom": toCoinDenom, + "pool_id": poolId?.toString(), + "max_price_impact": maxPriceImpact, + "external_price": externalPrice + }; + } + + @override + String get typeUrl => OsmosisPoolManagerV1beta1Types + .estimateTradeBasedOnPriceImpactRequest.typeUrl; + + @override + List get values => + [fromCoin, toCoinDenom, poolId, maxPriceImpact, externalPrice]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/list_pools_by_denom_request.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/list_pools_by_denom_request.dart new file mode 100644 index 0000000..815ddf6 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/list_pools_by_denom_request.dart @@ -0,0 +1,52 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'list_pools_by_denom_response.dart'; + +class OsmosisPoolManagerListPoolsByDenomRequest extends CosmosMessage + with + QueryMessage, + RPCMessage { + final String? denom; + const OsmosisPoolManagerListPoolsByDenomRequest({this.denom}); + factory OsmosisPoolManagerListPoolsByDenomRequest.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisPoolManagerListPoolsByDenomRequest(denom: decode.getField(1)); + } + @override + List get fieldIds => [1]; + + @override + OsmosisPoolManagerListPoolsByDenomResponse onJsonResponse( + Map json) { + return OsmosisPoolManagerListPoolsByDenomResponse.fromRpc(json); + } + + @override + OsmosisPoolManagerListPoolsByDenomResponse onResponse(List bytes) { + return OsmosisPoolManagerListPoolsByDenomResponse.deserialize(bytes); + } + + @override + Map get queryParameters => {"denom": denom}; + + @override + String get queryPath => + OsmosisPoolManagerV1beta1Types.listPoolsByDenom.typeUrl; + + @override + String get rpcPath => + OsmosisPoolManagerV1beta1Types.listPoolsByDenom.rpcUrl(); + + @override + Map toJson() { + return {"denom": denom}; + } + + @override + String get typeUrl => + OsmosisPoolManagerV1beta1Types.listPoolsByDenomRequest.typeUrl; + + @override + List get values => [denom]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/list_pools_by_denom_response.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/list_pools_by_denom_response.dart new file mode 100644 index 0000000..73d4b2f --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/list_pools_by_denom_response.dart @@ -0,0 +1,35 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; + +class OsmosisPoolManagerListPoolsByDenomResponse extends CosmosMessage { + final List? pools; + OsmosisPoolManagerListPoolsByDenomResponse({List? pools}) + : pools = pools?.nullOnEmpy; + factory OsmosisPoolManagerListPoolsByDenomResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisPoolManagerListPoolsByDenomResponse( + pools: decode.getFields(1).map((e) => Any.deserialize(e)).toList()); + } + factory OsmosisPoolManagerListPoolsByDenomResponse.fromRpc( + Map json) { + return OsmosisPoolManagerListPoolsByDenomResponse( + pools: (json["pools"] as List?)?.map((e) => Any.fromRpc(e)).toList()); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"pools": pools?.map((e) => e.toJson()).toList()}; + } + + @override + String get typeUrl => + OsmosisPoolManagerV1beta1Types.listPoolsByDenomResponse.typeUrl; + + @override + List get values => [pools]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/num_pools_request.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/num_pools_request.dart new file mode 100644 index 0000000..7d14849 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/num_pools_request.dart @@ -0,0 +1,45 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'num_pools_response.dart'; + +class OsmosisPoolManagerNumPoolsRequest extends CosmosMessage + with + QueryMessage, + RPCMessage { + const OsmosisPoolManagerNumPoolsRequest(); + factory OsmosisPoolManagerNumPoolsRequest.deserialize() { + return OsmosisPoolManagerNumPoolsRequest(); + } + @override + List get fieldIds => []; + + @override + OsmosisPoolManagerNumPoolsResponse onJsonResponse(Map json) { + return OsmosisPoolManagerNumPoolsResponse.fromRpc(json); + } + + @override + OsmosisPoolManagerNumPoolsResponse onResponse(List bytes) { + return OsmosisPoolManagerNumPoolsResponse.deserialize(bytes); + } + + @override + Map get queryParameters => {}; + + @override + String get queryPath => OsmosisPoolManagerV1beta1Types.numPools.typeUrl; + + @override + String get rpcPath => OsmosisPoolManagerV1beta1Types.numPools.rpcUrl(); + + @override + Map toJson() { + return {}; + } + + @override + String get typeUrl => OsmosisPoolManagerV1beta1Types.numPoolsRequest.typeUrl; + + @override + List get values => []; +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/num_pools_response.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/num_pools_response.dart new file mode 100644 index 0000000..2af0dc4 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/num_pools_response.dart @@ -0,0 +1,31 @@ +import 'package:blockchain_utils/numbers/numbers.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +class OsmosisPoolManagerNumPoolsResponse extends CosmosMessage { + final BigInt? numPools; + const OsmosisPoolManagerNumPoolsResponse({this.numPools}); + factory OsmosisPoolManagerNumPoolsResponse.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisPoolManagerNumPoolsResponse(numPools: decode.getField(1)); + } + factory OsmosisPoolManagerNumPoolsResponse.fromRpc( + Map json) { + return OsmosisPoolManagerNumPoolsResponse( + numPools: BigintUtils.tryParse(json["num_pools"])); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"num_pools": numPools.toString()}; + } + + @override + String get typeUrl => OsmosisPoolManagerV1beta1Types.numPoolsResponse.typeUrl; + + @override + List get values => [numPools]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/params_request.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/params_request.dart new file mode 100644 index 0000000..7b63d37 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/params_request.dart @@ -0,0 +1,42 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +import 'params_response.dart'; + +class OsmosisPoolManagerParamsRequest extends CosmosMessage + with + QueryMessage, + RPCMessage { + @override + List get fieldIds => []; + + @override + OsmosisPoolManagerParamsResponse onJsonResponse(Map json) { + return OsmosisPoolManagerParamsResponse.fromRpc(json); + } + + @override + OsmosisPoolManagerParamsResponse onResponse(List bytes) { + return OsmosisPoolManagerParamsResponse.deserialize(bytes); + } + + @override + Map get queryParameters => {}; + + @override + String get queryPath => OsmosisPoolManagerV1beta1Types.queryParams.typeUrl; + + @override + String get rpcPath => OsmosisPoolManagerV1beta1Types.queryParams.rpcUrl(); + + @override + Map toJson() { + return {}; + } + + @override + String get typeUrl => OsmosisPoolManagerV1beta1Types.paramsRequest.typeUrl; + + @override + List get values => []; +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/params_response.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/params_response.dart new file mode 100644 index 0000000..9d9c2b4 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/params_response.dart @@ -0,0 +1,31 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/messages/params.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +class OsmosisPoolManagerParamsResponse extends CosmosMessage { + final OsmosisPoolManagerParams params; + const OsmosisPoolManagerParamsResponse(this.params); + factory OsmosisPoolManagerParamsResponse.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisPoolManagerParamsResponse( + OsmosisPoolManagerParams.deserialize(decode.getField(1))); + } + factory OsmosisPoolManagerParamsResponse.fromRpc(Map json) { + return OsmosisPoolManagerParamsResponse( + OsmosisPoolManagerParams.fromRpc(json["params"])); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"params": params.toJson()}; + } + + @override + String get typeUrl => OsmosisPoolManagerV1beta1Types.paramsResponse.typeUrl; + + @override + List get values => [params]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/pool_request.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/pool_request.dart new file mode 100644 index 0000000..46e9850 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/pool_request.dart @@ -0,0 +1,48 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'pool_response.dart'; + +class OsmosisPoolManagerPoolRequest extends CosmosMessage + with + QueryMessage, + RPCMessage { + final BigInt? poolId; + const OsmosisPoolManagerPoolRequest({this.poolId}); + factory OsmosisPoolManagerPoolRequest.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisPoolManagerPoolRequest(poolId: decode.getField(1)); + } + @override + List get fieldIds => [1]; + + @override + OsmosisPoolManagerPoolResponse onJsonResponse(Map json) { + return OsmosisPoolManagerPoolResponse.fromRpc(json); + } + + @override + OsmosisPoolManagerPoolResponse onResponse(List bytes) { + return OsmosisPoolManagerPoolResponse.deserialize(bytes); + } + + @override + Map get queryParameters => {}; + + @override + String get queryPath => OsmosisPoolManagerV1beta1Types.pool.typeUrl; + + @override + String get rpcPath => OsmosisPoolManagerV1beta1Types.pool + .rpcUrl(pathParameters: [poolId?.toString()]); + + @override + Map toJson() { + return {"pool_id": poolId?.toString()}; + } + + @override + String get typeUrl => OsmosisPoolManagerV1beta1Types.poolRequest.typeUrl; + + @override + List get values => [poolId]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/pool_response.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/pool_response.dart new file mode 100644 index 0000000..28aecb3 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/pool_response.dart @@ -0,0 +1,28 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +class OsmosisPoolManagerPoolResponse extends CosmosMessage { + final Any pool; + const OsmosisPoolManagerPoolResponse(this.pool); + factory OsmosisPoolManagerPoolResponse.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisPoolManagerPoolResponse(Any.deserialize(decode.getField(1))); + } + factory OsmosisPoolManagerPoolResponse.fromRpc(Map json) { + return OsmosisPoolManagerPoolResponse(Any.fromRpc(json["pool"])); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"pool": pool.toJson()}; + } + + @override + String get typeUrl => OsmosisPoolManagerV1beta1Types.poolResponse.typeUrl; + + @override + List get values => [pool]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/spot_price_request.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/spot_price_request.dart new file mode 100644 index 0000000..504133c --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/spot_price_request.dart @@ -0,0 +1,62 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'spot_price_response.dart'; + +class OsmosisPoolManagerSpotPriceRequest extends CosmosMessage + with + QueryMessage, + RPCMessage { + final BigInt? poolId; + final String? baseAssetDenom; + final String? quoteAssetDenom; + const OsmosisPoolManagerSpotPriceRequest( + {this.poolId, this.baseAssetDenom, this.quoteAssetDenom}); + factory OsmosisPoolManagerSpotPriceRequest.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisPoolManagerSpotPriceRequest( + poolId: decode.getField(1), + baseAssetDenom: decode.getField(2), + quoteAssetDenom: decode.getField(3)); + } + @override + List get fieldIds => [1, 2, 3]; + + @override + OsmosisPoolManagerSpotPriceResponse onJsonResponse( + Map json) { + return OsmosisPoolManagerSpotPriceResponse.fromRpc(json); + } + + @override + OsmosisPoolManagerSpotPriceResponse onResponse(List bytes) { + return OsmosisPoolManagerSpotPriceResponse.deserialize(bytes); + } + + @override + Map get queryParameters => { + "base_asset_denom": baseAssetDenom, + "quote_asset_denom": quoteAssetDenom + }; + + @override + String get queryPath => OsmosisPoolManagerV1beta1Types.spotPrice.typeUrl; + + @override + String get rpcPath => OsmosisPoolManagerV1beta1Types.spotPrice + .rpcUrl(pathParameters: [poolId?.toString()]); + + @override + Map toJson() { + return { + "pool_id": poolId?.toString(), + "base_asset_denom": baseAssetDenom, + "quote_asset_denom": quoteAssetDenom + }; + } + + @override + String get typeUrl => OsmosisPoolManagerV1beta1Types.spotPriceRequest.typeUrl; + + @override + List get values => [poolId, baseAssetDenom, quoteAssetDenom]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/spot_price_response.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/spot_price_response.dart new file mode 100644 index 0000000..f16883f --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/spot_price_response.dart @@ -0,0 +1,31 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +class OsmosisPoolManagerSpotPriceResponse extends CosmosMessage { + /// String of the Dec. Ex) 10.203uatom + final String? spotPrice; + const OsmosisPoolManagerSpotPriceResponse({this.spotPrice}); + factory OsmosisPoolManagerSpotPriceResponse.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisPoolManagerSpotPriceResponse(spotPrice: decode.getField(1)); + } + factory OsmosisPoolManagerSpotPriceResponse.fromRpc( + Map json) { + return OsmosisPoolManagerSpotPriceResponse(spotPrice: json["spot_price"]); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"spot_price": spotPrice}; + } + + @override + String get typeUrl => + OsmosisPoolManagerV1beta1Types.spotPriceResponse.typeUrl; + + @override + List get values => [spotPrice]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/total_liquidity_request.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/total_liquidity_request.dart new file mode 100644 index 0000000..b3c5e5a --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/total_liquidity_request.dart @@ -0,0 +1,47 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'total_liquidity_response.dart'; + +class OsmosisPoolManagerTotalLiquidityRequest extends CosmosMessage + with + QueryMessage, + RPCMessage { + const OsmosisPoolManagerTotalLiquidityRequest(); + factory OsmosisPoolManagerTotalLiquidityRequest.deserialize(List bytes) { + return OsmosisPoolManagerTotalLiquidityRequest(); + } + @override + List get fieldIds => []; + + @override + OsmosisPoolManagerTotalLiquidityResponse onJsonResponse( + Map json) { + return OsmosisPoolManagerTotalLiquidityResponse.fromRpc(json); + } + + @override + OsmosisPoolManagerTotalLiquidityResponse onResponse(List bytes) { + return OsmosisPoolManagerTotalLiquidityResponse.deserialize(bytes); + } + + @override + Map get queryParameters => {}; + + @override + String get queryPath => OsmosisPoolManagerV1beta1Types.totalLiquidity.typeUrl; + + @override + String get rpcPath => OsmosisPoolManagerV1beta1Types.totalLiquidity.rpcUrl(); + + @override + Map toJson() { + return {}; + } + + @override + String get typeUrl => + OsmosisPoolManagerV1beta1Types.totalLiquidityRequest.typeUrl; + + @override + List get values => []; +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/total_liquidity_response.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/total_liquidity_response.dart new file mode 100644 index 0000000..bf14932 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/total_liquidity_response.dart @@ -0,0 +1,37 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_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'; + +class OsmosisPoolManagerTotalLiquidityResponse extends CosmosMessage { + final List liquidity; + OsmosisPoolManagerTotalLiquidityResponse(List liquidity) + : liquidity = liquidity.mutable; + factory OsmosisPoolManagerTotalLiquidityResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisPoolManagerTotalLiquidityResponse( + decode.getFields(1).map((e) => Coin.deserialize(e)).toList()); + } + factory OsmosisPoolManagerTotalLiquidityResponse.fromRpc( + Map json) { + return OsmosisPoolManagerTotalLiquidityResponse( + (json["liquidity"] as List?)?.map((e) => Coin.fromRpc(e)).toList() ?? + []); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"liquidity": liquidity.map((e) => e.toJson()).toList()}; + } + + @override + String get typeUrl => + OsmosisPoolManagerV1beta1Types.totalLiquidityResponse.typeUrl; + + @override + List get values => [liquidity]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/total_pool_liquidity_request.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/total_pool_liquidity_request.dart new file mode 100644 index 0000000..f6eb5d5 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/total_pool_liquidity_request.dart @@ -0,0 +1,53 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'total_pool_liquidity_response.dart'; + +class OsmosisPoolManagerTotalPoolLiquidityRequest extends CosmosMessage + with + QueryMessage, + RPCMessage { + final BigInt? poolId; + const OsmosisPoolManagerTotalPoolLiquidityRequest({this.poolId}); + factory OsmosisPoolManagerTotalPoolLiquidityRequest.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisPoolManagerTotalPoolLiquidityRequest( + poolId: decode.getField(1)); + } + @override + List get fieldIds => [1]; + + @override + OsmosisPoolManagerTotalPoolLiquidityResponse onJsonResponse( + Map json) { + return OsmosisPoolManagerTotalPoolLiquidityResponse.fromRpc(json); + } + + @override + OsmosisPoolManagerTotalPoolLiquidityResponse onResponse(List bytes) { + return OsmosisPoolManagerTotalPoolLiquidityResponse.deserialize(bytes); + } + + @override + Map get queryParameters => {}; + + @override + String get queryPath => + OsmosisPoolManagerV1beta1Types.totalPoolLiquidity.typeUrl; + + @override + String get rpcPath => OsmosisPoolManagerV1beta1Types.totalPoolLiquidity + .rpcUrl(pathParameters: [poolId?.toString()]); + + @override + Map toJson() { + return {"pool_id": poolId?.toString()}; + } + + @override + String get typeUrl => + OsmosisPoolManagerV1beta1Types.totalPoolLiquidityRequest.typeUrl; + + @override + List get values => [poolId]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/total_pool_liquidity_response.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/total_pool_liquidity_response.dart new file mode 100644 index 0000000..8a143a4 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/total_pool_liquidity_response.dart @@ -0,0 +1,37 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_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'; + +class OsmosisPoolManagerTotalPoolLiquidityResponse extends CosmosMessage { + final List liquidity; + OsmosisPoolManagerTotalPoolLiquidityResponse(List liquidity) + : liquidity = liquidity.mutable; + factory OsmosisPoolManagerTotalPoolLiquidityResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisPoolManagerTotalPoolLiquidityResponse( + decode.getFields(1).map((e) => Coin.deserialize(e)).toList()); + } + factory OsmosisPoolManagerTotalPoolLiquidityResponse.fromRpc( + Map json) { + return OsmosisPoolManagerTotalPoolLiquidityResponse( + (json["liquidity"] as List?)?.map((e) => Coin.fromRpc(e)).toList() ?? + []); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"liquidity": liquidity.map((e) => e.toJson()).toList()}; + } + + @override + String get typeUrl => + OsmosisPoolManagerV1beta1Types.totalPoolLiquidityResponse.typeUrl; + + @override + List get values => [liquidity]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/total_volume_for_pool_request.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/total_volume_for_pool_request.dart new file mode 100644 index 0000000..52e61da --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/total_volume_for_pool_request.dart @@ -0,0 +1,53 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'total_volume_for_pool_response.dart'; + +class OsmosisPoolManagerTotalVolumeForPoolRequest extends CosmosMessage + with + QueryMessage, + RPCMessage { + final BigInt? poolId; + const OsmosisPoolManagerTotalVolumeForPoolRequest({this.poolId}); + factory OsmosisPoolManagerTotalVolumeForPoolRequest.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisPoolManagerTotalVolumeForPoolRequest( + poolId: decode.getField(1)); + } + @override + List get fieldIds => [1]; + + @override + OsmosisPoolManagerTotalVolumeForPoolResponse onJsonResponse( + Map json) { + return OsmosisPoolManagerTotalVolumeForPoolResponse.fromRpc(json); + } + + @override + OsmosisPoolManagerTotalVolumeForPoolResponse onResponse(List bytes) { + return OsmosisPoolManagerTotalVolumeForPoolResponse.deserialize(bytes); + } + + @override + Map get queryParameters => {}; + + @override + String get queryPath => + OsmosisPoolManagerV1beta1Types.totalVolumeForPool.typeUrl; + + @override + String get rpcPath => OsmosisPoolManagerV1beta1Types.totalVolumeForPool + .rpcUrl(pathParameters: [poolId?.toString()]); + + @override + Map toJson() { + return {"pool_id": poolId?.toString()}; + } + + @override + String get typeUrl => + OsmosisPoolManagerV1beta1Types.totalVolumeForPoolRequest.typeUrl; + + @override + List get values => [poolId]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/total_volume_for_pool_response.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/total_volume_for_pool_response.dart new file mode 100644 index 0000000..cdf5c2b --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/total_volume_for_pool_response.dart @@ -0,0 +1,37 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_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'; + +class OsmosisPoolManagerTotalVolumeForPoolResponse extends CosmosMessage { + final List volume; + OsmosisPoolManagerTotalVolumeForPoolResponse(List volume) + : volume = volume.mutable; + factory OsmosisPoolManagerTotalVolumeForPoolResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisPoolManagerTotalVolumeForPoolResponse( + decode.getFields(1).map((e) => Coin.deserialize(e)).toList()); + } + factory OsmosisPoolManagerTotalVolumeForPoolResponse.fromRpc( + Map json) { + return OsmosisPoolManagerTotalVolumeForPoolResponse( + (json["volume"] as List?)?.map((e) => Coin.fromRpc(e)).toList() ?? + []); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"volume": volume.map((e) => e.toJson()).toList()}; + } + + @override + String get typeUrl => + OsmosisPoolManagerV1beta1Types.totalVolumeForPoolResponse.typeUrl; + + @override + List get values => [volume]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/trading_pair_taker_fee_request.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/trading_pair_taker_fee_request.dart new file mode 100644 index 0000000..670b1ed --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/trading_pair_taker_fee_request.dart @@ -0,0 +1,56 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'trading_pair_taker_fee_response.dart'; + +class OsmosisPoolManagerTradingPairTakerFeeRequest extends CosmosMessage + with + QueryMessage, + RPCMessage { + final String? denom0; + final String? denom1; + const OsmosisPoolManagerTradingPairTakerFeeRequest( + {this.denom0, this.denom1}); + factory OsmosisPoolManagerTradingPairTakerFeeRequest.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisPoolManagerTradingPairTakerFeeRequest( + denom0: decode.getField(1), denom1: decode.getField(2)); + } + @override + List get fieldIds => [1, 2]; + + @override + OsmosisPoolManagerTradingPairTakerFeeResponse onJsonResponse( + Map json) { + return OsmosisPoolManagerTradingPairTakerFeeResponse.fromRpc(json); + } + + @override + OsmosisPoolManagerTradingPairTakerFeeResponse onResponse(List bytes) { + return OsmosisPoolManagerTradingPairTakerFeeResponse.deserialize(bytes); + } + + @override + Map get queryParameters => + {"denom_0": denom0, "denom_1": denom1}; + + @override + String get queryPath => + OsmosisPoolManagerV1beta1Types.tradingPairTakerFee.typeUrl; + + @override + String get rpcPath => + OsmosisPoolManagerV1beta1Types.tradingPairTakerFee.rpcUrl(); + + @override + Map toJson() { + return {"denom_0": denom0, "denom_1": denom1}; + } + + @override + String get typeUrl => + OsmosisPoolManagerV1beta1Types.tradingPairTakerFeeRequest.typeUrl; + + @override + List get values => [denom0, denom1]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/trading_pair_taker_fee_response.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/trading_pair_taker_fee_response.dart new file mode 100644 index 0000000..95d967e --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/query/trading_pair_taker_fee_response.dart @@ -0,0 +1,31 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +class OsmosisPoolManagerTradingPairTakerFeeResponse extends CosmosMessage { + final String takerFee; + OsmosisPoolManagerTradingPairTakerFeeResponse(this.takerFee); + factory OsmosisPoolManagerTradingPairTakerFeeResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisPoolManagerTradingPairTakerFeeResponse(decode.getField(1)); + } + factory OsmosisPoolManagerTradingPairTakerFeeResponse.fromRpc( + Map json) { + return OsmosisPoolManagerTradingPairTakerFeeResponse(json["taker_fee"]); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"taker_fee": takerFee}; + } + + @override + String get typeUrl => + OsmosisPoolManagerV1beta1Types.tradingPairTakerFeeResponse.typeUrl; + + @override + List get values => [takerFee]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/services/msg_set_denom_pair_taker_fee.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/services/msg_set_denom_pair_taker_fee.dart new file mode 100644 index 0000000..65bdd55 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/services/msg_set_denom_pair_taker_fee.dart @@ -0,0 +1,57 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/messages/denom_pair_taker_fee.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; +import 'msg_set_denom_pair_taker_fee_response.dart'; + +class OsmosisPoolManagerMsgSetDenomPairTakerFee extends CosmosMessage + with ServiceMessage { + final String? sender; + final List denomPairTakerFee; + + OsmosisPoolManagerMsgSetDenomPairTakerFee({ + this.sender, + required List denomPairTakerFee, + }) : denomPairTakerFee = denomPairTakerFee.mutable; + factory OsmosisPoolManagerMsgSetDenomPairTakerFee.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisPoolManagerMsgSetDenomPairTakerFee( + sender: decode.getField(1), + denomPairTakerFee: decode + .getFields(2) + .map((e) => OsmosisPoolManagerDenomPairTakerFee.deserialize(e)) + .toList()); + } + + @override + List get fieldIds => [1, 2]; + + @override + Map toJson() { + return { + "sender": sender, + "denom_pair_taker_fee": denomPairTakerFee.map((e) => e.toJson()).toList() + }; + } + + @override + String get typeUrl => + OsmosisPoolManagerV1beta1Types.msgSetDenomPairTakerFee.typeUrl; + + @override + List get values => [sender, denomPairTakerFee]; + + @override + String get service => + OsmosisPoolManagerV1beta1Types.setDenomPairTakerFee.typeUrl; + + @override + List get signers => [sender]; + + @override + OsmosisPoolManagerMsgSetDenomPairTakerFeeResponse onResponse( + List bytes) { + return OsmosisPoolManagerMsgSetDenomPairTakerFeeResponse.deserialize(bytes); + } +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/services/msg_set_denom_pair_taker_fee_response.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/services/msg_set_denom_pair_taker_fee_response.dart new file mode 100644 index 0000000..9d50b8e --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/services/msg_set_denom_pair_taker_fee_response.dart @@ -0,0 +1,29 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +class OsmosisPoolManagerMsgSetDenomPairTakerFeeResponse extends CosmosMessage { + final bool? success; + + OsmosisPoolManagerMsgSetDenomPairTakerFeeResponse(this.success); + factory OsmosisPoolManagerMsgSetDenomPairTakerFeeResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisPoolManagerMsgSetDenomPairTakerFeeResponse( + decode.getField(1)); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"success": success}; + } + + @override + String get typeUrl => + OsmosisPoolManagerV1beta1Types.msgSetDenomPairTakerFeeResponse.typeUrl; + + @override + List get values => [success]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/services/msg_split_route_swap_exact_amount_in.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/services/msg_split_route_swap_exact_amount_in.dart new file mode 100644 index 0000000..6cce99c --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/services/msg_split_route_swap_exact_amount_in.dart @@ -0,0 +1,70 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/messages/swap_amount_out_split_route.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; +import 'msg_split_route_swap_exact_amount_in_response.dart'; + +class OsmosisPoolManagerMsgSplitRouteSwapExactAmountIn extends CosmosMessage + with + ServiceMessage< + OsmosisPoolManagerMsgSplitRouteSwapExactAmountInResponse> { + final String? sender; + final List routes; + final String? tokenInDenom; + final BigInt tokenOutMinAmount; + + OsmosisPoolManagerMsgSplitRouteSwapExactAmountIn({ + this.sender, + required List routes, + this.tokenInDenom, + required this.tokenOutMinAmount, + }) : routes = routes.mutable; + factory OsmosisPoolManagerMsgSplitRouteSwapExactAmountIn.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisPoolManagerMsgSplitRouteSwapExactAmountIn( + sender: decode.getField(1), + routes: decode + .getFields(2) + .map( + (e) => OsmosisPoolManagerSwapAmountOutSplitRoute.deserialize(e)) + .toList(), + tokenInDenom: decode.getField(3), + tokenOutMinAmount: BigInt.parse(decode.getField(4))); + } + + @override + List get fieldIds => [1, 2, 3, 4]; + + @override + Map toJson() { + return { + "sender": sender, + "routes": routes.map((e) => e.toJson()).toList(), + "token_in_denom": tokenInDenom, + "token_out_min_amount": tokenOutMinAmount.toString() + }; + } + + @override + String get typeUrl => + OsmosisPoolManagerV1beta1Types.msgSplitRouteSwapExactAmountIn.typeUrl; + + @override + List get values => + [sender, routes, tokenInDenom, tokenOutMinAmount.toString()]; + + @override + String get service => + OsmosisPoolManagerV1beta1Types.splitRouteSwapExactAmountIn.typeUrl; + + @override + List get signers => [sender]; + + @override + OsmosisPoolManagerMsgSplitRouteSwapExactAmountInResponse onResponse( + List bytes) { + return OsmosisPoolManagerMsgSplitRouteSwapExactAmountInResponse.deserialize( + bytes); + } +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/services/msg_split_route_swap_exact_amount_in_response.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/services/msg_split_route_swap_exact_amount_in_response.dart new file mode 100644 index 0000000..69f2170 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/services/msg_split_route_swap_exact_amount_in_response.dart @@ -0,0 +1,30 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +class OsmosisPoolManagerMsgSplitRouteSwapExactAmountInResponse + extends CosmosMessage { + final BigInt tokenOutAmount; + + OsmosisPoolManagerMsgSplitRouteSwapExactAmountInResponse(this.tokenOutAmount); + factory OsmosisPoolManagerMsgSplitRouteSwapExactAmountInResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisPoolManagerMsgSplitRouteSwapExactAmountInResponse( + BigInt.parse(decode.getField(1))); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"token_out_amount": tokenOutAmount.toString()}; + } + + @override + String get typeUrl => OsmosisPoolManagerV1beta1Types + .msgSplitRouteSwapExactAmountInResponse.typeUrl; + + @override + List get values => [tokenOutAmount.toString()]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/services/msg_split_route_swap_exact_amount_out.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/services/msg_split_route_swap_exact_amount_out.dart new file mode 100644 index 0000000..4dac49b --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/services/msg_split_route_swap_exact_amount_out.dart @@ -0,0 +1,70 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/messages/swap_amount_out_split_route.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; +import 'msg_split_route_swap_exact_amount_out_response.dart'; + +class OsmosisPoolManagerMsgSplitRouteSwapExactAmountOut extends CosmosMessage + with + ServiceMessage< + OsmosisPoolManagerMsgSplitRouteSwapExactAmountOutResponse> { + final String? sender; + final List routes; + final String? tokenOutDenom; + final BigInt tokenInMaxAmount; + + OsmosisPoolManagerMsgSplitRouteSwapExactAmountOut({ + this.sender, + required List routes, + required this.tokenInMaxAmount, + this.tokenOutDenom, + }) : routes = routes.mutable; + factory OsmosisPoolManagerMsgSplitRouteSwapExactAmountOut.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisPoolManagerMsgSplitRouteSwapExactAmountOut( + sender: decode.getField(1), + routes: decode + .getFields(2) + .map((e) => OsmosisPoolManagerSwapAmountOutSplitRoute.deserialize(e)) + .toList(), + tokenOutDenom: decode.getField(3), + tokenInMaxAmount: BigInt.parse(decode.getField(4)), + ); + } + + @override + List get fieldIds => [1, 2, 3, 4]; + + @override + Map toJson() { + return { + "sender": sender, + "routes": routes.map((e) => e.toJson()).toList(), + "token_in_max_amount": tokenInMaxAmount.toString(), + "token_out_denom": tokenOutDenom, + }; + } + + @override + String get typeUrl => + OsmosisPoolManagerV1beta1Types.msgSplitRouteSwapExactAmountOut.typeUrl; + + @override + List get values => + [sender, routes, tokenOutDenom, tokenInMaxAmount.toString()]; + + @override + String get service => + OsmosisPoolManagerV1beta1Types.splitRouteSwapExactAmountOut.typeUrl; + + @override + List get signers => [sender]; + + @override + OsmosisPoolManagerMsgSplitRouteSwapExactAmountOutResponse onResponse( + List bytes) { + return OsmosisPoolManagerMsgSplitRouteSwapExactAmountOutResponse + .deserialize(bytes); + } +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/services/msg_split_route_swap_exact_amount_out_response.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/services/msg_split_route_swap_exact_amount_out_response.dart new file mode 100644 index 0000000..a8e5ed6 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/services/msg_split_route_swap_exact_amount_out_response.dart @@ -0,0 +1,30 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +class OsmosisPoolManagerMsgSplitRouteSwapExactAmountOutResponse + extends CosmosMessage { + final BigInt tokenInAmount; + + OsmosisPoolManagerMsgSplitRouteSwapExactAmountOutResponse(this.tokenInAmount); + factory OsmosisPoolManagerMsgSplitRouteSwapExactAmountOutResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisPoolManagerMsgSplitRouteSwapExactAmountOutResponse( + BigInt.parse(decode.getField(1))); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"token_in_amount": tokenInAmount.toString()}; + } + + @override + String get typeUrl => OsmosisPoolManagerV1beta1Types + .msgSplitRouteSwapExactAmountOutResponse.typeUrl; + + @override + List get values => [tokenInAmount.toString()]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/services/msg_swap_exact_amount_in.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/services/msg_swap_exact_amount_in.dart new file mode 100644 index 0000000..014c8ce --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/services/msg_swap_exact_amount_in.dart @@ -0,0 +1,65 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/messages/swap_amount_in_route.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_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_swap_exact_amount_in_response.dart'; + +class OsmosisPoolManagerMsgSwapExactAmountIn extends CosmosMessage + with ServiceMessage { + final String? sender; + final List routes; + final Coin tokenIn; + final BigInt tokenOutMinAmount; + + OsmosisPoolManagerMsgSwapExactAmountIn({ + this.sender, + required List routes, + required this.tokenIn, + required this.tokenOutMinAmount, + }) : routes = routes.mutable; + factory OsmosisPoolManagerMsgSwapExactAmountIn.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisPoolManagerMsgSwapExactAmountIn( + sender: decode.getField(1), + routes: decode + .getFields(2) + .map((e) => OsmosisPoolManagerSwapAmountInRoute.deserialize(e)) + .toList(), + tokenIn: Coin.deserialize(decode.getField(3)), + tokenOutMinAmount: BigInt.parse(decode.getField(4))); + } + + @override + List get fieldIds => [1, 2, 3, 4]; + + @override + Map toJson() { + return { + "sender": sender, + "routes": routes.map((e) => e.toJson()).toList(), + "token_in": tokenIn.toJson(), + "token_out_min_amount": tokenOutMinAmount.toString() + }; + } + + @override + String get typeUrl => + OsmosisPoolManagerV1beta1Types.msgSwapExactAmountIn.typeUrl; + + @override + List get values => [sender, routes, tokenIn, tokenOutMinAmount.toString()]; + + @override + String get service => + OsmosisPoolManagerV1beta1Types.swapExactAmountIn.typeUrl; + + @override + List get signers => [sender]; + + @override + OsmosisPoolManagerMsgSwapExactAmountInResponse onResponse(List bytes) { + return OsmosisPoolManagerMsgSwapExactAmountInResponse.deserialize(bytes); + } +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/services/msg_swap_exact_amount_in_response.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/services/msg_swap_exact_amount_in_response.dart new file mode 100644 index 0000000..39de39f --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/services/msg_swap_exact_amount_in_response.dart @@ -0,0 +1,29 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +class OsmosisPoolManagerMsgSwapExactAmountInResponse extends CosmosMessage { + final BigInt tokenOutAmount; + + OsmosisPoolManagerMsgSwapExactAmountInResponse(this.tokenOutAmount); + factory OsmosisPoolManagerMsgSwapExactAmountInResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisPoolManagerMsgSwapExactAmountInResponse( + BigInt.parse(decode.getField(1))); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"token_out_amount": tokenOutAmount.toString()}; + } + + @override + String get typeUrl => + OsmosisPoolManagerV1beta1Types.msgSwapExactAmountInResponse.typeUrl; + + @override + List get values => [tokenOutAmount.toString()]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/services/msg_swap_exact_amount_out.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/services/msg_swap_exact_amount_out.dart new file mode 100644 index 0000000..ebbb6c8 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/services/msg_swap_exact_amount_out.dart @@ -0,0 +1,65 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/messages/swap_amount_out_route.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/services/msg_swap_exact_amount_out_response.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_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 OsmosisPoolManagerMsgSwapExactAmountOut extends CosmosMessage + with ServiceMessage { + final String? sender; + final List routes; + final BigInt tokenInMaxAmount; + final Coin tokenOut; + + OsmosisPoolManagerMsgSwapExactAmountOut({ + this.sender, + required List routes, + required this.tokenInMaxAmount, + required this.tokenOut, + }) : routes = routes.mutable; + factory OsmosisPoolManagerMsgSwapExactAmountOut.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisPoolManagerMsgSwapExactAmountOut( + sender: decode.getField(1), + routes: decode + .getFields(2) + .map((e) => OsmosisPoolManagerSwapAmountOutRoute.deserialize(e)) + .toList(), + tokenInMaxAmount: BigInt.parse(decode.getField(3)), + tokenOut: Coin.deserialize(decode.getField(4)), + ); + } + + @override + List get fieldIds => [1, 2, 3, 4]; + + @override + Map toJson() { + return { + "sender": sender, + "routes": routes.map((e) => e.toJson()).toList(), + "token_in_max_amount": tokenInMaxAmount.toString(), + "token_out": tokenOut.toJson(), + }; + } + + @override + String get typeUrl => + OsmosisPoolManagerV1beta1Types.msgSwapExactAmountOut.typeUrl; + + @override + List get values => [sender, routes, tokenInMaxAmount.toString(), tokenOut]; + + @override + String get service => + OsmosisPoolManagerV1beta1Types.swapExactAmountOut.typeUrl; + + @override + List get signers => [sender]; + + @override + OsmosisPoolManagerMsgSwapExactAmountOutResponse onResponse(List bytes) { + return OsmosisPoolManagerMsgSwapExactAmountOutResponse.deserialize(bytes); + } +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/services/msg_swap_exact_amount_out_response.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/services/msg_swap_exact_amount_out_response.dart new file mode 100644 index 0000000..387905f --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/services/msg_swap_exact_amount_out_response.dart @@ -0,0 +1,29 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +class OsmosisPoolManagerMsgSwapExactAmountOutResponse extends CosmosMessage { + final BigInt tokenInAmount; + + OsmosisPoolManagerMsgSwapExactAmountOutResponse(this.tokenInAmount); + factory OsmosisPoolManagerMsgSwapExactAmountOutResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisPoolManagerMsgSwapExactAmountOutResponse( + BigInt.parse(decode.getField(1))); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"token_in_amount": tokenInAmount.toString()}; + } + + @override + String get typeUrl => + OsmosisPoolManagerV1beta1Types.msgSwapExactAmountOutResponse.typeUrl; + + @override + List get values => [tokenInAmount.toString()]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/types/types.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/types/types.dart new file mode 100644 index 0000000..52e14df --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/types/types.dart @@ -0,0 +1,291 @@ +import 'package:cosmos_sdk/src/models/core/type_url/type_url.dart'; + +class OsmosisPoolManagerV1beta1Types extends TypeUrl { + @override + final String typeUrl; + @override + final String? rpc; + const OsmosisPoolManagerV1beta1Types._(this.typeUrl, {this.rpc}); + static const OsmosisPoolManagerV1beta1Types trackedVolume = + OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.TrackedVolume"); + static const OsmosisPoolManagerV1beta1Types takerFeesTracker = + OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.TakerFeesTracker"); + static const OsmosisPoolManagerV1beta1Types takerFeeDistributionPercentage = + OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.TakerFeeDistributionPercentage"); + static const OsmosisPoolManagerV1beta1Types takerFeeParams = + OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.TakerFeeParams"); + static const OsmosisPoolManagerV1beta1Types swapAmountOutRoute = + OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.SwapAmountOutRoute"); + + static const OsmosisPoolManagerV1beta1Types swapAmountOutSplitRoute = + OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.SwapAmountOutSplitRoute"); + static const OsmosisPoolManagerV1beta1Types denomPairTakerFee = + OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.DenomPairTakerFee"); + + static const OsmosisPoolManagerV1beta1Types denomPairTakerFeeProposal = + OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.DenomPairTakerFeeProposal"); + static const OsmosisPoolManagerV1beta1Types params = + OsmosisPoolManagerV1beta1Types._("/smosis.poolmanager.v1beta1.params"); + + static const OsmosisPoolManagerV1beta1Types moduleRoute = + OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.ModuleRoute"); + + static const OsmosisPoolManagerV1beta1Types genesisState = + OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.GenesisState"); + static const OsmosisPoolManagerV1beta1Types poolVolume = + OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.PoolVolume"); + static const OsmosisPoolManagerV1beta1Types swapAmountInRoute = + OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.SwapAmountInRoute"); + + static const OsmosisPoolManagerV1beta1Types msgSwapExactAmountIn = + OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.MsgSwapExactAmountIn"); + static const OsmosisPoolManagerV1beta1Types msgSwapExactAmountInResponse = + OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.MsgSwapExactAmountInResponse"); + + static const OsmosisPoolManagerV1beta1Types msgSwapExactAmountOut = + OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.MsgSwapExactAmountOut"); + static const OsmosisPoolManagerV1beta1Types msgSwapExactAmountOutResponse = + OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.MsgSwapExactAmountOutResponse"); + + static const OsmosisPoolManagerV1beta1Types msgSplitRouteSwapExactAmountIn = + OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.MsgSplitRouteSwapExactAmountIn"); + static const OsmosisPoolManagerV1beta1Types + msgSplitRouteSwapExactAmountInResponse = OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.MsgSplitRouteSwapExactAmountInResponse"); + + static const OsmosisPoolManagerV1beta1Types msgSplitRouteSwapExactAmountOut = + OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.MsgSplitRouteSwapExactAmountOut"); + static const OsmosisPoolManagerV1beta1Types + msgSplitRouteSwapExactAmountOutResponse = + OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.MsgSplitRouteSwapExactAmountOutResponse"); + + static const OsmosisPoolManagerV1beta1Types msgSetDenomPairTakerFee = + OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.MsgSetDenomPairTakerFee"); + static const OsmosisPoolManagerV1beta1Types msgSetDenomPairTakerFeeResponse = + OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.MsgSetDenomPairTakerFeeResponse"); + + static const OsmosisPoolManagerV1beta1Types paramsRequest = + OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.ParamsRequest"); + static const OsmosisPoolManagerV1beta1Types paramsResponse = + OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.ParamsResponse"); + + static const OsmosisPoolManagerV1beta1Types estimateSwapExactAmountInRequest = + OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.EstimateSwapExactAmountInRequest"); + static const OsmosisPoolManagerV1beta1Types + estimateSwapExactAmountInResponse = OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.EstimateSwapExactAmountInResponse"); + + static const OsmosisPoolManagerV1beta1Types + estimateSwapExactAmountInWithPrimitiveTypesRequest = + OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.EstimateSwapExactAmountInWithPrimitiveTypesRequest"); + + static const OsmosisPoolManagerV1beta1Types + estimateSwapExactAmountOutRequest = OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.EstimateSwapExactAmountOutRequest"); + static const OsmosisPoolManagerV1beta1Types + estimateSwapExactAmountOutResponse = OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.EstimateSwapExactAmountOutResponse"); + + static const OsmosisPoolManagerV1beta1Types + estimateSwapExactAmountOutWithPrimitiveTypesRequest = + OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.EstimateSwapExactAmountOutWithPrimitiveTypesRequest"); + + static const OsmosisPoolManagerV1beta1Types + estimateSinglePoolSwapExactAmountOutRequest = + OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.EstimateSinglePoolSwapExactAmountOutRequest"); + + static const OsmosisPoolManagerV1beta1Types numPoolsRequest = + OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.NumPoolsRequest"); + static const OsmosisPoolManagerV1beta1Types numPoolsResponse = + OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.NumPoolsResponse"); + + static const OsmosisPoolManagerV1beta1Types poolRequest = + OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.PoolRequest"); + static const OsmosisPoolManagerV1beta1Types poolResponse = + OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.PoolResponse"); + + static const OsmosisPoolManagerV1beta1Types allPoolsRequest = + OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.AllPoolsRequest"); + static const OsmosisPoolManagerV1beta1Types allPoolsResponse = + OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.AllPoolsResponse"); + + static const OsmosisPoolManagerV1beta1Types listPoolsByDenomRequest = + OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.ListPoolsByDenomRequest"); + static const OsmosisPoolManagerV1beta1Types listPoolsByDenomResponse = + OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.ListPoolsByDenomResponse"); + + static const OsmosisPoolManagerV1beta1Types spotPriceRequest = + OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.SpotPriceRequest"); + static const OsmosisPoolManagerV1beta1Types spotPriceResponse = + OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.SpotPriceResponse"); + + static const OsmosisPoolManagerV1beta1Types totalPoolLiquidityRequest = + OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.TotalPoolLiquidityRequest"); + static const OsmosisPoolManagerV1beta1Types totalPoolLiquidityResponse = + OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.TotalPoolLiquidityResponse"); + + static const OsmosisPoolManagerV1beta1Types totalLiquidityRequest = + OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.TotalLiquidityRequest"); + static const OsmosisPoolManagerV1beta1Types totalLiquidityResponse = + OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.TotalLiquidityResponse"); + + static const OsmosisPoolManagerV1beta1Types totalVolumeForPoolRequest = + OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.TotalVolumeForPoolRequest"); + static const OsmosisPoolManagerV1beta1Types totalVolumeForPoolResponse = + OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.TotalVolumeForPoolResponse"); + + static const OsmosisPoolManagerV1beta1Types tradingPairTakerFeeRequest = + OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.TradingPairTakerFeeRequest"); + static const OsmosisPoolManagerV1beta1Types tradingPairTakerFeeResponse = + OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.TradingPairTakerFeeResponse"); + + static const OsmosisPoolManagerV1beta1Types + estimateTradeBasedOnPriceImpactRequest = OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.EstimateTradeBasedOnPriceImpactRequest"); + static const OsmosisPoolManagerV1beta1Types + estimateTradeBasedOnPriceImpactResponse = + OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.EstimateTradeBasedOnPriceImpactResponse"); + + /// query + static const OsmosisPoolManagerV1beta1Types estimateTradeBasedOnPriceImpact = + OsmosisPoolManagerV1beta1Types._( + "/osmosis.poolmanager.v1beta1.Query/EstimateTradeBasedOnPriceImpact", + rpc: "/osmosis/poolmanager/v1beta1/:pool_id/estimate_trade"); + static const OsmosisPoolManagerV1beta1Types tradingPairTakerFee = + OsmosisPoolManagerV1beta1Types._( + "/osmosis.poolmanager.v1beta1.Query/TradingPairTakerFee", + rpc: "/osmosis/poolmanager/v1beta1/trading_pair_takerfee"); + static const OsmosisPoolManagerV1beta1Types totalVolumeForPool = + OsmosisPoolManagerV1beta1Types._( + "/osmosis.poolmanager.v1beta1.Query/TotalVolumeForPool", + rpc: "/osmosis/poolmanager/v1beta1/pools/:pool_id/total_volume"); + static const OsmosisPoolManagerV1beta1Types totalLiquidity = + OsmosisPoolManagerV1beta1Types._( + "/osmosis.poolmanager.v1beta1.Query/TotalLiquidity", + rpc: "/osmosis/poolmanager/v1beta1/pools/total_liquidity"); + static const OsmosisPoolManagerV1beta1Types totalPoolLiquidity = + OsmosisPoolManagerV1beta1Types._( + "/osmosis.poolmanager.v1beta1.Query/TotalPoolLiquidity", + rpc: + "/osmosis/poolmanager/v1beta1/pools/:pool_id/total_pool_liquidity"); + static const OsmosisPoolManagerV1beta1Types spotPrice = + OsmosisPoolManagerV1beta1Types._( + "/osmosis.poolmanager.v1beta1.Query/SpotPrice", + rpc: "/osmosis/poolmanager/pools/:pool_id/prices"); + static const OsmosisPoolManagerV1beta1Types listPoolsByDenom = + OsmosisPoolManagerV1beta1Types._( + "/osmosis.poolmanager.v1beta1.Query/ListPoolsByDenom", + rpc: "/osmosis/poolmanager/v1beta1/list-pools-by-denom"); + static const OsmosisPoolManagerV1beta1Types allPools = + OsmosisPoolManagerV1beta1Types._( + "/osmosis.poolmanager.v1beta1.Query/AllPools", + rpc: "/osmosis/poolmanager/v1beta1/all-pools"); + static const OsmosisPoolManagerV1beta1Types pool = + OsmosisPoolManagerV1beta1Types._( + "/osmosis.poolmanager.v1beta1.Query/Pool", + rpc: "/osmosis/poolmanager/v1beta1/pools/:pool_id"); + + static const OsmosisPoolManagerV1beta1Types numPools = + OsmosisPoolManagerV1beta1Types._( + "/osmosis.poolmanager.v1beta1.Query/NumPools", + rpc: "/osmosis/poolmanager/v1beta1/num_pools"); + + static const OsmosisPoolManagerV1beta1Types + estimateSinglePoolSwapExactAmountOut = OsmosisPoolManagerV1beta1Types._( + "/osmosis.poolmanager.v1beta1.Query/EstimateSinglePoolSwapExactAmountOut", + rpc: + "/osmosis/poolmanager/v1beta1/:pool_id/estimate_out/single_pool_swap_exact_amount_out"); + static const OsmosisPoolManagerV1beta1Types + estimateSwapExactAmountOutWithPrimitiveTypes = + OsmosisPoolManagerV1beta1Types._( + "/osmosis.poolmanager.v1beta1.Query/EstimateSwapExactAmountOutWithPrimitiveTypes", + rpc: + "/osmosis/poolmanager/v1beta1/:pool_id/estimate/swap_exact_amount_out_with_primitive_types"); + static const OsmosisPoolManagerV1beta1Types estimateSwapExactAmountOut = + OsmosisPoolManagerV1beta1Types._( + "/osmosis.poolmanager.v1beta1.Query/EstimateSwapExactAmountOut", + rpc: + "/osmosis/poolmanager/v1beta1/:pool_id/estimate/swap_exact_amount_out"); + + static const OsmosisPoolManagerV1beta1Types + estimateSwapExactAmountInWithPrimitiveTypes = + OsmosisPoolManagerV1beta1Types._( + "/osmosis.poolmanager.v1beta1.Query/EstimateSwapExactAmountInWithPrimitiveTypes", + rpc: + "/osmosis/poolmanager/v1beta1/:pool_id/estimate/swap_exact_amount_in_with_primitive_types"); + + static const OsmosisPoolManagerV1beta1Types estimateSwapExactAmountIn = + OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.Query/EstimateSwapExactAmountIn", + rpc: + "/osmosis/poolmanager/v1beta1/:pool_id/estimate/swap_exact_amount_in"); + + static const OsmosisPoolManagerV1beta1Types queryParams = + OsmosisPoolManagerV1beta1Types._( + "/osmosis.poolmanager.v1beta1.Query/Params", + rpc: "/osmosis/poolmanager/v1beta1/Params"); + + /// services + + static const OsmosisPoolManagerV1beta1Types setDenomPairTakerFee = + OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.Msg/SetDenomPairTakerFee"); + static const OsmosisPoolManagerV1beta1Types splitRouteSwapExactAmountOut = + OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.Msg/SplitRouteSwapExactAmountOut"); + static const OsmosisPoolManagerV1beta1Types splitRouteSwapExactAmountIn = + OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.Msg/SplitRouteSwapExactAmountIn"); + static const OsmosisPoolManagerV1beta1Types swapExactAmountOut = + OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.Msg/SwapExactAmountOut"); + static const OsmosisPoolManagerV1beta1Types swapExactAmountIn = + OsmosisPoolManagerV1beta1Types._( + "/smosis.poolmanager.v1beta1.Msg/SwapExactAmountIn"); +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v2/osmosis_poolmanager_v2.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v2/osmosis_poolmanager_v2.dart new file mode 100644 index 0000000..cb955b9 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v2/osmosis_poolmanager_v2.dart @@ -0,0 +1,2 @@ +export 'query/spot_price_request.dart'; +export 'query/spot_price_response.dart'; diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v2/query/spot_price_request.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v2/query/spot_price_request.dart new file mode 100644 index 0000000..bf38f57 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v2/query/spot_price_request.dart @@ -0,0 +1,65 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_v2/query/spot_price_response.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_v2/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +/// SpotPriceRequest defines the gRPC request structure for a SpotPrice query. +class OsmosisPoolManagerV2SpotPriceRequest extends CosmosMessage + with + QueryMessage, + RPCMessage { + final BigInt? poolId; + final String? baseAssetDenom; + final String? quoteAssetDenom; + + const OsmosisPoolManagerV2SpotPriceRequest( + {this.poolId, this.baseAssetDenom, this.quoteAssetDenom}); + factory OsmosisPoolManagerV2SpotPriceRequest.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisPoolManagerV2SpotPriceRequest( + poolId: decode.getField(1), + baseAssetDenom: decode.getField(2), + quoteAssetDenom: decode.getField(3)); + } + + @override + List get fieldIds => [1, 2, 3]; + + @override + OsmosisPoolManagerV2SpotPriceResponse onJsonResponse( + Map json) { + return OsmosisPoolManagerV2SpotPriceResponse.fromRpc(json); + } + + @override + OsmosisPoolManagerV2SpotPriceResponse onResponse(List bytes) { + return OsmosisPoolManagerV2SpotPriceResponse.deserialize(bytes); + } + + @override + Map get queryParameters => { + "base_asset_denom": baseAssetDenom, + "quote_asset_denom": quoteAssetDenom + }; + + @override + String get queryPath => OsmosisPoolManagerV2Types.spotPriceV2.typeUrl; + + @override + String get rpcPath => OsmosisPoolManagerV2Types.spotPriceV2 + .rpcUrl(pathParameters: [poolId?.toString()]); + + @override + Map toJson() { + return { + "pool_id": poolId?.toString(), + "base_asset_denom": baseAssetDenom, + "quote_asset_denom": quoteAssetDenom + }; + } + + @override + String get typeUrl => OsmosisPoolManagerV2Types.spotPriceRequest.typeUrl; + + @override + List get values => [poolId, baseAssetDenom, quoteAssetDenom]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v2/query/spot_price_response.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v2/query/spot_price_response.dart new file mode 100644 index 0000000..5128dfa --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v2/query/spot_price_response.dart @@ -0,0 +1,30 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_v2/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +class OsmosisPoolManagerV2SpotPriceResponse extends CosmosMessage { + /// String of the BigDec. Ex) 10.203uatom + final String spotPrice; + const OsmosisPoolManagerV2SpotPriceResponse(this.spotPrice); + factory OsmosisPoolManagerV2SpotPriceResponse.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisPoolManagerV2SpotPriceResponse(decode.getField(1)); + } + factory OsmosisPoolManagerV2SpotPriceResponse.fromRpc( + Map json) { + return OsmosisPoolManagerV2SpotPriceResponse(json["spot_price"]); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"spot_price": spotPrice}; + } + + @override + String get typeUrl => OsmosisPoolManagerV2Types.spotPriceResponse.typeUrl; + + @override + List get values => [spotPrice]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_poolmanager_v2/types/types.dart b/lib/src/models/networks/osmosis/osmosis_poolmanager_v2/types/types.dart new file mode 100644 index 0000000..e0003f4 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_poolmanager_v2/types/types.dart @@ -0,0 +1,18 @@ +import 'package:cosmos_sdk/src/models/core/type_url/type_url.dart'; + +class OsmosisPoolManagerV2Types extends TypeUrl { + @override + final String typeUrl; + @override + final String? rpc; + const OsmosisPoolManagerV2Types._(this.typeUrl, {this.rpc}); + static const OsmosisPoolManagerV2Types spotPriceRequest = + OsmosisPoolManagerV2Types._("/osmosis.poolmanager.v2.SpotPriceRequest"); + static const OsmosisPoolManagerV2Types spotPriceResponse = + OsmosisPoolManagerV2Types._("/osmosis.poolmanager.v2.SpotPriceResponse"); + + /// query + static const OsmosisPoolManagerV2Types spotPriceV2 = + OsmosisPoolManagerV2Types._("/osmosis.poolmanager.v2.Query/SpotPriceV2", + rpc: "/osmosis/poolmanager/v2/pools/:pool_id/prices"); +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/all_protocol_revenue.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/all_protocol_revenue.dart new file mode 100644 index 0000000..bacc462 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/all_protocol_revenue.dart @@ -0,0 +1,54 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_poolmanager_v1beta1/messages/taker_fees_tracker.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_txfees_v1beta1/messages/tx_fees_tracker.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'cyclic_arb_tracker.dart'; + +class OsmosisProtorevAllProtocolRevenue extends CosmosMessage { + final OsmosisPoolManagerTakerFeesTracker takerFeesTracker; + final OsmosisTxfeesTxFeesTracker txFeesTracker; + final OsmosisProtorevRouteCyclicArbTracker cyclicArbTracker; + + const OsmosisProtorevAllProtocolRevenue( + {required this.takerFeesTracker, + required this.txFeesTracker, + required this.cyclicArbTracker}); + + factory OsmosisProtorevAllProtocolRevenue.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisProtorevAllProtocolRevenue( + takerFeesTracker: + OsmosisPoolManagerTakerFeesTracker.deserialize(decode.getField(1)), + txFeesTracker: + OsmosisTxfeesTxFeesTracker.deserialize(decode.getField(2)), + cyclicArbTracker: OsmosisProtorevRouteCyclicArbTracker.deserialize( + decode.getField(3))); + } + factory OsmosisProtorevAllProtocolRevenue.fromRpc(Map json) { + return OsmosisProtorevAllProtocolRevenue( + takerFeesTracker: OsmosisPoolManagerTakerFeesTracker.fromRpc( + json["taker_fees_tracker"]), + txFeesTracker: + OsmosisTxfeesTxFeesTracker.fromRpc(json["tx_fees_tracker"]), + cyclicArbTracker: OsmosisProtorevRouteCyclicArbTracker.fromRpc( + json["cyclic_arb_tracker"])); + } + + @override + List get fieldIds => [1, 2, 3]; + + @override + Map toJson() { + return { + "taker_fees_tracker": takerFeesTracker.toJson(), + "tx_fees_tracker": txFeesTracker.toJson(), + "cyclic_arb_tracker": cyclicArbTracker.toJson() + }; + } + + @override + String get typeUrl => OsmosisProtorevV1beta1Types.allProtocolRevenue.typeUrl; + + @override + List get values => [takerFeesTracker, txFeesTracker, cyclicArbTracker]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/balancer_pool_info.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/balancer_pool_info.dart new file mode 100644 index 0000000..25d104b --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/balancer_pool_info.dart @@ -0,0 +1,34 @@ +import 'package:blockchain_utils/numbers/numbers.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +/// BalancerPoolInfo contains meta data pertaining to a balancer pool type. +class OsmosisProtorevBalancerPoolInfo extends CosmosMessage { + /// The weight of a stableswap pool + final BigInt? weight; + + const OsmosisProtorevBalancerPoolInfo({this.weight}); + + factory OsmosisProtorevBalancerPoolInfo.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisProtorevBalancerPoolInfo(weight: decode.getField(1)); + } + factory OsmosisProtorevBalancerPoolInfo.fromRpc(Map json) { + return OsmosisProtorevBalancerPoolInfo( + weight: BigintUtils.tryParse(json["weight"])); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"weight": weight?.toString()}; + } + + @override + String get typeUrl => OsmosisProtorevV1beta1Types.balancerPoolInfo.typeUrl; + + @override + List get values => [weight]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/base_denom.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/base_denom.dart new file mode 100644 index 0000000..bbaacf6 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/base_denom.dart @@ -0,0 +1,40 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +/// BaseDenom represents a single base denom that the module uses for its arbitrage trades. +/// It contains the denom name alongside the step size of the binary search +/// that is used to find the optimal swap amount +class OsmosisProtorevBaseDenom extends CosmosMessage { + /// The denom i.e. name of the base denom (ex. uosmo) + final String? denom; + + /// The step size of the binary search that is used to find the optimal swap + /// amount + final String? stepSize; + + const OsmosisProtorevBaseDenom({this.denom, this.stepSize}); + + factory OsmosisProtorevBaseDenom.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisProtorevBaseDenom( + denom: decode.getField(1), stepSize: decode.getField(2)); + } + factory OsmosisProtorevBaseDenom.fromRpc(Map json) { + return OsmosisProtorevBaseDenom( + denom: json["denom"], stepSize: json["step_size"]); + } + + @override + List get fieldIds => [1, 2]; + + @override + Map toJson() { + return {"denom": denom, "step_size": stepSize}; + } + + @override + String get typeUrl => OsmosisProtorevV1beta1Types.baseDenom.typeUrl; + + @override + List get values => [denom, stepSize]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/concentrated_pool_info.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/concentrated_pool_info.dart new file mode 100644 index 0000000..70df6e4 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/concentrated_pool_info.dart @@ -0,0 +1,45 @@ +import 'package:blockchain_utils/numbers/numbers.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +/// ConcentratedPoolInfo contains meta data pertaining to a concentrated pool type. +class OsmosisProtorevConcentratedPoolInfo extends CosmosMessage { + /// The weight of a concentrated pool + final BigInt? weight; + + /// The maximum number of ticks we can move when rebalancing + final BigInt? maxTicksCrossed; + + const OsmosisProtorevConcentratedPoolInfo( + {this.weight, this.maxTicksCrossed}); + + factory OsmosisProtorevConcentratedPoolInfo.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisProtorevConcentratedPoolInfo( + weight: decode.getField(1), maxTicksCrossed: decode.getField(2)); + } + factory OsmosisProtorevConcentratedPoolInfo.fromRpc( + Map json) { + return OsmosisProtorevConcentratedPoolInfo( + weight: BigintUtils.tryParse(json["weight"]), + maxTicksCrossed: BigintUtils.tryParse(json["max_ticks_crossed"])); + } + + @override + List get fieldIds => [1, 2]; + + @override + Map toJson() { + return { + "weight": weight?.toString(), + "max_ticks_crossed": maxTicksCrossed?.toString() + }; + } + + @override + String get typeUrl => + OsmosisProtorevV1beta1Types.concentratedPoolInfo.typeUrl; + + @override + List get values => [weight, maxTicksCrossed]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/cosmwasm_pool_info.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/cosmwasm_pool_info.dart new file mode 100644 index 0000000..4f524b6 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/cosmwasm_pool_info.dart @@ -0,0 +1,45 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; + +import 'weight_map.dart'; + +/// CosmwasmPoolInfo contains meta data pertaining to a cosmwasm pool type. +class OsmosisProtorevCosmwasmPoolInfo extends CosmosMessage { + /// he weight of a cosmwasm pool (by contract address) + final List weightMaps; + + OsmosisProtorevCosmwasmPoolInfo( + {required List weightMaps}) + : weightMaps = weightMaps.mutable; + + factory OsmosisProtorevCosmwasmPoolInfo.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisProtorevCosmwasmPoolInfo( + weightMaps: decode + .getFields(1) + .map((e) => OsmosisProtorevWeightMap.deserialize(e)) + .toList()); + } + factory OsmosisProtorevCosmwasmPoolInfo.fromRpc(Map json) { + return OsmosisProtorevCosmwasmPoolInfo( + weightMaps: (json["weight_maps"] as List?) + ?.map((e) => OsmosisProtorevWeightMap.fromRpc(e)) + .toList() ?? + []); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"weight_maps": weightMaps.map((e) => e.toJson()).toList()}; + } + + @override + String get typeUrl => OsmosisProtorevV1beta1Types.cosmwasmPoolInfo.typeUrl; + + @override + List get values => [weightMaps]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/cyclic_arb_tracker.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/cyclic_arb_tracker.dart new file mode 100644 index 0000000..6c91a69 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/cyclic_arb_tracker.dart @@ -0,0 +1,50 @@ +import 'package:blockchain_utils/numbers/numbers.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_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'; + +class OsmosisProtorevRouteCyclicArbTracker extends CosmosMessage { + /// profits is the total profit from all trades on this route) + final List cyclicArb; + + final BigInt? heightAccountingStartsFrom; + + OsmosisProtorevRouteCyclicArbTracker( + {required List cyclicArb, this.heightAccountingStartsFrom}) + : cyclicArb = cyclicArb.mutable; + + factory OsmosisProtorevRouteCyclicArbTracker.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisProtorevRouteCyclicArbTracker( + cyclicArb: decode.getFields(1).map((e) => Coin.deserialize(e)).toList(), + heightAccountingStartsFrom: decode.getField(2)); + } + factory OsmosisProtorevRouteCyclicArbTracker.fromRpc( + Map json) { + return OsmosisProtorevRouteCyclicArbTracker( + cyclicArb: (json["cyclic_arb"] as List?) + ?.map((e) => Coin.fromRpc(e)) + .toList() ?? + [], + heightAccountingStartsFrom: + BigintUtils.tryParse(json["height_accounting_starts_from"])); + } + + @override + List get fieldIds => [1, 2]; + + @override + Map toJson() { + return { + "height_accounting_starts_from": heightAccountingStartsFrom?.toString(), + "cyclic_arb": cyclicArb.map((e) => e.toJson()).toList() + }; + } + + @override + String get typeUrl => OsmosisProtorevV1beta1Types.cyclicArbTracker.typeUrl; + + @override + List get values => [cyclicArb, heightAccountingStartsFrom]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/info_by_pool_type.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/info_by_pool_type.dart new file mode 100644 index 0000000..ae379f9 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/info_by_pool_type.dart @@ -0,0 +1,69 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'balancer_pool_info.dart'; +import 'concentrated_pool_info.dart'; +import 'cosmwasm_pool_info.dart'; +import 'stable_pool_info.dart'; + +/// InfoByPoolType contains information pertaining to how expensive (in terms of gas and time) +/// it is to execute a swap on a given pool type. This distinction is made and necessary because +/// the execution time ranges significantly between the different pool types. +class OsmosisProtorevInfoByPoolType extends CosmosMessage { + /// The stable pool info + final OsmosisProtorevStablePoolInfo stable; + + /// The balancer pool info + final OsmosisProtorevBalancerPoolInfo balancer; + + /// The concentrated pool info + final OsmosisProtorevConcentratedPoolInfo concentrated; + + /// The cosmwasm pool info + final OsmosisProtorevCosmwasmPoolInfo cosmwasm; + + OsmosisProtorevInfoByPoolType({ + required this.stable, + required this.balancer, + required this.concentrated, + required this.cosmwasm, + }); + + factory OsmosisProtorevInfoByPoolType.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisProtorevInfoByPoolType( + stable: OsmosisProtorevStablePoolInfo.deserialize(decode.getField(1)), + balancer: + OsmosisProtorevBalancerPoolInfo.deserialize(decode.getField(2)), + concentrated: + OsmosisProtorevConcentratedPoolInfo.deserialize(decode.getField(3)), + cosmwasm: + OsmosisProtorevCosmwasmPoolInfo.deserialize(decode.getField(4))); + } + factory OsmosisProtorevInfoByPoolType.fromRpc(Map json) { + return OsmosisProtorevInfoByPoolType( + stable: OsmosisProtorevStablePoolInfo.fromRpc(json["stable"]), + balancer: OsmosisProtorevBalancerPoolInfo.fromRpc(json["balancer"]), + concentrated: + OsmosisProtorevConcentratedPoolInfo.fromRpc(json["concentrated"]), + cosmwasm: OsmosisProtorevCosmwasmPoolInfo.fromRpc(json["cosmwasm"])); + } + + @override + List get fieldIds => [1, 2, 3, 4]; + + @override + Map toJson() { + return { + "stable": stable.toJson(), + "balancer": balancer.toJson(), + "concentrated": concentrated.toJson(), + "cosmwasm": cosmwasm.toJson() + }; + } + + @override + String get typeUrl => OsmosisProtorevV1beta1Types.infoByPoolType.typeUrl; + + @override + List get values => [stable, balancer, concentrated, cosmwasm]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/params.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/params.dart new file mode 100644 index 0000000..d72e463 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/params.dart @@ -0,0 +1,36 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +/// Params defines the parameters for the module +class OsmosisProtorevParams extends CosmosMessage { + /// The weight of a stableswap pool + final bool? enabled; + // The admin account (settings manager) of the protorev module. + final String? admin; + + OsmosisProtorevParams({this.enabled, this.admin}); + + factory OsmosisProtorevParams.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisProtorevParams( + enabled: decode.getField(1), admin: decode.getField(2)); + } + factory OsmosisProtorevParams.fromRpc(Map json) { + return OsmosisProtorevParams( + admin: json["admin"], enabled: json["enabled"]); + } + + @override + List get fieldIds => [1, 2]; + + @override + Map toJson() { + return {"enabled": enabled, "admin": admin}; + } + + @override + String get typeUrl => OsmosisProtorevV1beta1Types.params.typeUrl; + + @override + List get values => [enabled, admin]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/pool_weights.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/pool_weights.dart new file mode 100644 index 0000000..9c7aa08 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/pool_weights.dart @@ -0,0 +1,58 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +/// PoolWeights contains the weights of all of the different pool types. +/// This distinction is made and necessary because the execution time ranges +/// significantly between the different pool types. Each weight roughly corresponds +/// to the amount of time (in ms) it takes to execute a swap on that pool type. +/// +/// DEPRECATED: This field is deprecated and will be removed in the next release. +/// It is replaced by the info_by_pool_type field. +class OsmosisProtorevPoolWeights extends CosmosMessage { + /// The weight of a stableswap pool + final BigInt? stableWeight; + + /// The weight of a balancer pool + final BigInt? balancerWeight; + + /// The weight of a concentrated pool + final BigInt? concentratedWeight; + + /// The weight of a cosmwasm pool + final BigInt? cosmwasmWeight; + + OsmosisProtorevPoolWeights( + {this.stableWeight, + this.balancerWeight, + this.concentratedWeight, + this.cosmwasmWeight}); + + factory OsmosisProtorevPoolWeights.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisProtorevPoolWeights( + stableWeight: decode.getField(1), + balancerWeight: decode.getField(2), + concentratedWeight: decode.getField(3), + cosmwasmWeight: decode.getField(4)); + } + + @override + List get fieldIds => [1, 2, 3, 4]; + + @override + Map toJson() { + return { + "stable_weight": stableWeight?.toString(), + "balancer_weight": balancerWeight?.toString(), + "concentrated_weight": concentratedWeight?.toString(), + "cosmwasm_weight": cosmwasmWeight?.toString() + }; + } + + @override + String get typeUrl => OsmosisProtorevV1beta1Types.poolWeights.typeUrl; + + @override + List get values => + [stableWeight, balancerWeight, concentratedWeight, cosmwasmWeight]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/route.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/route.dart new file mode 100644 index 0000000..9b85cb6 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/route.dart @@ -0,0 +1,55 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; + +import 'trade.dart'; + +/// Route is a hot route for a given pair of tokens +class OsmosisProtorevRoute extends CosmosMessage { + /// The pool IDs that are travered in the directed cyclic graph (traversed left + /// -> right) + final List trades; + + /// The step size that will be used to find the optimal swap amount in the + /// binary search + final String? stepSize; + + OsmosisProtorevRoute( + {required List trades, this.stepSize}) + : trades = trades.mutable; + + factory OsmosisProtorevRoute.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisProtorevRoute( + trades: decode + .getFields(1) + .map((e) => OsmosisProtorevTrade.deserialize(e)) + .toList(), + stepSize: decode.getField(2)); + } + factory OsmosisProtorevRoute.fromRpc(Map json) { + return OsmosisProtorevRoute( + trades: (json["trades"] as List?) + ?.map((e) => OsmosisProtorevTrade.fromRpc(e)) + .toList() ?? + [], + stepSize: json["step_size"]); + } + + @override + List get fieldIds => [1, 2]; + + @override + Map toJson() { + return { + "trades": trades.map((e) => e.toJson()).toList(), + "step_size": stepSize + }; + } + + @override + String get typeUrl => OsmosisProtorevV1beta1Types.route.typeUrl; + + @override + List get values => [trades, stepSize]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/route_statistics.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/route_statistics.dart new file mode 100644 index 0000000..73abe7b --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/route_statistics.dart @@ -0,0 +1,66 @@ +import 'package:blockchain_utils/numbers/numbers.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_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'; + +/// RouteStatistics contains the number of trades the module has executed +/// after a swap on a given route and the profits from the trades +class OsmosisProtorevRouteStatistics extends CosmosMessage { + /// profits is the total profit from all trades on this route) + final List profits; + + /// number_of_trades is the number of trades the module has executed using this + /// route + final BigInt numberOfTrades; + + /// route is the route that was used (pool ids along the arbitrage route) + final List? route; + + OsmosisProtorevRouteStatistics( + {required List profits, + required this.numberOfTrades, + List? route}) + : route = route?.nullOnEmpy, + profits = profits.mutable; + + factory OsmosisProtorevRouteStatistics.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisProtorevRouteStatistics( + profits: decode.getFields(1).map((e) => Coin.deserialize(e)).toList(), + numberOfTrades: decode.getField(2), + route: decode + .getResult(3) + ?.to, List>( + (e) => e.map((e) => BigintUtils.parse(e)).toList()) ?? + []); + } + factory OsmosisProtorevRouteStatistics.fromRpc(Map json) { + return OsmosisProtorevRouteStatistics( + profits: + (json["profits"] as List?)?.map((e) => Coin.fromRpc(e)).toList() ?? + [], + numberOfTrades: BigintUtils.parse(json["number_of_trades"]), + route: (json["route"] as List?) + ?.map((e) => BigintUtils.parse(e)) + .toList()); + } + + @override + List get fieldIds => [1, 2, 3]; + + @override + Map toJson() { + return { + "profits": profits.map((e) => e.toJson()).toList(), + "number_of_trades": numberOfTrades.toString(), + "route": route?.map((e) => e.toString()).toList() + }; + } + + @override + String get typeUrl => OsmosisProtorevV1beta1Types.routeStatistics.typeUrl; + + @override + List get values => [profits, numberOfTrades, route]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/set_proto_rev_admin_account_proposal.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/set_proto_rev_admin_account_proposal.dart new file mode 100644 index 0000000..96d20f6 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/set_proto_rev_admin_account_proposal.dart @@ -0,0 +1,37 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +/// SetProtoRevAdminAccountProposal is a gov Content type to set the admin account that will +/// receive permissions to alter hot routes and set the developer address that will be receiving +/// a share of profits from the module +class OsmosisProtorevSetProtoRevAdminAccountProposal extends CosmosMessage { + final String? title; + final String? description; + final String? account; + OsmosisProtorevSetProtoRevAdminAccountProposal( + {this.title, this.description, this.account}); + + factory OsmosisProtorevSetProtoRevAdminAccountProposal.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisProtorevSetProtoRevAdminAccountProposal( + title: decode.getField(1), + description: decode.getField(2), + account: decode.getField(3)); + } + + @override + List get fieldIds => [1, 2, 3]; + + @override + Map toJson() { + return {"title": title, "description": description, "account": account}; + } + + @override + String get typeUrl => + OsmosisProtorevV1beta1Types.setProtoRevAdminAccountProposal.typeUrl; + + @override + List get values => [title, description, account]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/set_proto_rev_enabled_proposal.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/set_proto_rev_enabled_proposal.dart new file mode 100644 index 0000000..43ff1a4 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/set_proto_rev_enabled_proposal.dart @@ -0,0 +1,35 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +/// SetProtoRevEnabledProposal is a gov Content type to update whether the protorev module is enabled +class OsmosisProtorevSetProtoRevEnabledProposal extends CosmosMessage { + final String? title; + final String? description; + final bool? enabled; + OsmosisProtorevSetProtoRevEnabledProposal( + {this.title, this.description, this.enabled}); + + factory OsmosisProtorevSetProtoRevEnabledProposal.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisProtorevSetProtoRevEnabledProposal( + title: decode.getField(1), + description: decode.getField(2), + enabled: decode.getField(3)); + } + + @override + List get fieldIds => [1, 2, 3]; + + @override + Map toJson() { + return {"title": title, "description": description, "enabled": enabled}; + } + + @override + String get typeUrl => + OsmosisProtorevV1beta1Types.setProtoRevEnabledProposal.typeUrl; + + @override + List get values => [title, description, enabled]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/stable_pool_info.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/stable_pool_info.dart new file mode 100644 index 0000000..e61809f --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/stable_pool_info.dart @@ -0,0 +1,36 @@ +import 'package:blockchain_utils/numbers/numbers.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +/// StablePoolInfo contains meta data pertaining to a stableswap pool type. +class OsmosisProtorevStablePoolInfo extends CosmosMessage { + /// The weight of a stableswap pool + final BigInt? weight; + + OsmosisProtorevStablePoolInfo({this.weight}); + + factory OsmosisProtorevStablePoolInfo.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisProtorevStablePoolInfo(weight: decode.getField(1)); + } + factory OsmosisProtorevStablePoolInfo.fromRpc(Map json) { + return OsmosisProtorevStablePoolInfo( + weight: BigintUtils.tryParse(json["weight"])); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return { + "weight": weight?.toString(), + }; + } + + @override + String get typeUrl => OsmosisProtorevV1beta1Types.stablePoolInfo.typeUrl; + + @override + List get values => [weight]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/token_pair_arb_routes.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/token_pair_arb_routes.dart new file mode 100644 index 0000000..00f2b87 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/token_pair_arb_routes.dart @@ -0,0 +1,60 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; +import 'route.dart'; + +/// TokenPairArbRoutes tracks all of the hot routes for a given pair of tokens +class OsmosisProtorevTokenPairArbRoutes extends CosmosMessage { + /// Stores all of the possible hot paths for a given pair of tokens + final List arbRsoutes; + + /// Token denomination of the first asset + final String? tokenIn; + + /// Token denomination of the second asset + final String? tokenOut; + + OsmosisProtorevTokenPairArbRoutes( + {required List arbRsoutes, + this.tokenIn, + this.tokenOut}) + : arbRsoutes = arbRsoutes.mutable; + + factory OsmosisProtorevTokenPairArbRoutes.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisProtorevTokenPairArbRoutes( + arbRsoutes: decode + .getFields(1) + .map((e) => OsmosisProtorevRoute.deserialize(e)) + .toList(), + tokenIn: decode.getField(2), + tokenOut: decode.getField(3)); + } + factory OsmosisProtorevTokenPairArbRoutes.fromRpc(Map json) { + return OsmosisProtorevTokenPairArbRoutes( + arbRsoutes: (json["arb_routes"] as List?) + ?.map((e) => OsmosisProtorevRoute.fromRpc(e)) + .toList() ?? + [], + tokenIn: json["token_in"], + tokenOut: json["token_out"]); + } + + @override + List get fieldIds => [1, 2, 3]; + + @override + Map toJson() { + return { + "arb_routes": arbRsoutes.map((e) => e.toJson()).toList(), + "token_in": tokenIn, + "token_out": tokenOut + }; + } + + @override + String get typeUrl => OsmosisProtorevV1beta1Types.tokenPairArbRoutes.typeUrl; + + @override + List get values => [arbRsoutes, tokenIn, tokenOut]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/trade.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/trade.dart new file mode 100644 index 0000000..7ef465b --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/trade.dart @@ -0,0 +1,48 @@ +import 'package:blockchain_utils/numbers/numbers.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +/// Trade is a single trade in a route +class OsmosisProtorevTrade extends CosmosMessage { + /// The pool id of the pool that is traded on + final BigInt? pool; + + /// The denom of the token that is traded + final String? tokenIn; + + /// The denom of the token that is received + final String? tokenOut; + const OsmosisProtorevTrade({this.pool, this.tokenIn, this.tokenOut}); + + factory OsmosisProtorevTrade.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisProtorevTrade( + pool: decode.getField(1), + tokenIn: decode.getField(2), + tokenOut: decode.getField(3)); + } + factory OsmosisProtorevTrade.fromRpc(Map json) { + return OsmosisProtorevTrade( + pool: BigintUtils.tryParse(json["pool"]), + tokenIn: json["token_in"], + tokenOut: json["token_out"]); + } + + @override + List get fieldIds => [1, 2, 3]; + + @override + Map toJson() { + return { + "pool": pool?.toString(), + "token_in": tokenIn, + "token_out": tokenOut + }; + } + + @override + String get typeUrl => OsmosisProtorevV1beta1Types.trade.typeUrl; + + @override + List get values => [pool, tokenIn, tokenOut]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/weight_map.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/weight_map.dart new file mode 100644 index 0000000..fb80f98 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/weight_map.dart @@ -0,0 +1,40 @@ +import 'package:blockchain_utils/numbers/numbers.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +/// WeightMap maps a contract address to a weight. +/// The weight of an address corresponds to the amount of ms required to execute a swap on that contract. +class OsmosisProtorevWeightMap extends CosmosMessage { + /// The weight of a cosmwasm pool (by contract address) + final BigInt? weight; + + /// The contract address + final String? contractAddress; + const OsmosisProtorevWeightMap({this.weight, this.contractAddress}); + + factory OsmosisProtorevWeightMap.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisProtorevWeightMap( + weight: decode.getField(1), contractAddress: decode.getField(2)); + } + + factory OsmosisProtorevWeightMap.fromRpc(Map json) { + return OsmosisProtorevWeightMap( + weight: BigintUtils.tryParse(json["weight"]), + contractAddress: json["contractAddress"]); + } + + @override + List get fieldIds => [1, 2]; + + @override + Map toJson() { + return {"weight": weight?.toString(), "contract_address": contractAddress}; + } + + @override + String get typeUrl => OsmosisProtorevV1beta1Types.weightMap.typeUrl; + + @override + List get values => [weight, contractAddress]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/osmosis_protorev_v1beta1.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/osmosis_protorev_v1beta1.dart new file mode 100644 index 0000000..0dc20bc --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/osmosis_protorev_v1beta1.dart @@ -0,0 +1,56 @@ +export 'messages/all_protocol_revenue.dart'; +export 'messages/balancer_pool_info.dart'; +export 'messages/base_denom.dart'; +export 'messages/concentrated_pool_info.dart'; +export 'messages/cosmwasm_pool_info.dart'; +export 'messages/cyclic_arb_tracker.dart'; +export 'messages/info_by_pool_type.dart'; +export 'messages/params.dart'; +export 'messages/pool_weights.dart'; +export 'messages/route.dart'; +export 'messages/route_statistics.dart'; +export 'messages/set_proto_rev_admin_account_proposal.dart'; +export 'messages/set_proto_rev_enabled_proposal.dart'; +export 'messages/stable_pool_info.dart'; +export 'messages/token_pair_arb_routes.dart'; +export 'messages/trade.dart'; +export 'messages/weight_map.dart'; + +export 'query/query_get_all_protocol_revenue_request.dart'; +export 'query/query_get_all_protocol_revenue_response.dart'; +export 'query/query_get_proto_rev_admin_account_request.dart'; +export 'query/query_get_proto_rev_admin_account_response.dart'; +export 'query/query_get_proto_rev_all_profits_request.dart'; +export 'query/query_get_proto_rev_all_profits_response.dart'; +export 'query/query_get_proto_rev_all_route_statistics_request.dart'; +export 'query/query_get_proto_rev_all_route_statistics_response.dart'; +export 'query/query_get_proto_rev_base_denom_request.dart'; +export 'query/query_get_proto_rev_base_denoms_response.dart'; +export 'query/query_get_proto_rev_developer_account_request.dart'; +export 'query/query_get_proto_rev_developer_account_response.dart'; +export 'query/query_get_proto_rev_enabled_request.dart'; +export 'query/query_get_proto_rev_enabled_response.dart'; +export 'query/query_get_proto_rev_info_by_pool_type_request.dart'; +export 'query/query_get_proto_rev_info_by_pool_type_response.dart'; +export 'query/query_get_proto_rev_max_pool_points_per_block_request.dart'; +export 'query/query_get_proto_rev_max_pool_points_per_block_response.dart'; +export 'query/query_get_proto_rev_max_pool_points_per_tx_request.dart'; +export 'query/query_get_proto_rev_max_pool_points_per_tx_response.dart'; +export 'query/query_get_proto_rev_number_of_trades_response.dart'; +export 'query/query_get_proto_rev_pool_request.dart'; +export 'query/query_get_proto_rev_profits_by_denom_request.dart'; +export 'query/query_get_proto_rev_statistics_by_route_request.dart'; +export 'query/query_get_proto_rev_statistics_by_route_response.dart'; +export 'query/query_get_proto_rev_token_pair_arb_routes_request.dart'; +export 'query/query_get_proto_rev_token_pair_arb_routes_response.dart'; +export 'query/query_get_protorev_number_of_trades_request.dart'; +export 'query/query_get_protorev_profits_by_denom_response.dart'; +export 'query/query_params_request.dart'; +export 'query/query_params_response.dart'; + +export 'services/msg_set_base_denoms.dart'; +export 'services/msg_set_developer_account.dart'; +export 'services/msg_set_hot_routes.dart'; +export 'services/msg_set_info_by_pool_type.dart'; +export 'services/msg_set_max_pool_points_per_block.dart'; +export 'services/msg_set_max_pool_points_per_tx.dart'; diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_all_protocol_revenue_request.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_all_protocol_revenue_request.dart new file mode 100644 index 0000000..a8a7699 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_all_protocol_revenue_request.dart @@ -0,0 +1,53 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'query_get_all_protocol_revenue_response.dart'; + +/// GetAllProtocolRevenue queries all of the protocol revenue that has been accumulated by any module. +class OsmosisProtorevQueryGetAllProtocolRevenueRequest extends CosmosMessage + with + QueryMessage, + RPCMessage { + const OsmosisProtorevQueryGetAllProtocolRevenueRequest(); + factory OsmosisProtorevQueryGetAllProtocolRevenueRequest.deserialize( + List bytes) { + return OsmosisProtorevQueryGetAllProtocolRevenueRequest(); + } + + @override + List get fieldIds => []; + + @override + Map toJson() { + return {}; + } + + @override + List get values => []; + + @override + OsmosisProtorevQueryGetAllProtocolRevenueResponse onResponse( + List bytes) { + return OsmosisProtorevQueryGetAllProtocolRevenueResponse.deserialize(bytes); + } + + @override + OsmosisProtorevQueryGetAllProtocolRevenueResponse onJsonResponse( + Map json) { + return OsmosisProtorevQueryGetAllProtocolRevenueResponse.fromRpc(json); + } + + @override + String get typeUrl => + OsmosisProtorevV1beta1Types.queryGetAllProtocolRevenueRequest.typeUrl; + + @override + String get queryPath => + OsmosisProtorevV1beta1Types.getAllProtocolRevenue.typeUrl; + + @override + Map get queryParameters => {}; + + @override + String get rpcPath => + OsmosisProtorevV1beta1Types.getAllProtocolRevenue.rpcUrl(); +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_all_protocol_revenue_response.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_all_protocol_revenue_response.dart new file mode 100644 index 0000000..9b77da7 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_all_protocol_revenue_response.dart @@ -0,0 +1,36 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/all_protocol_revenue.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +class OsmosisProtorevQueryGetAllProtocolRevenueResponse extends CosmosMessage { + final OsmosisProtorevAllProtocolRevenue allProtocolRevenue; + const OsmosisProtorevQueryGetAllProtocolRevenueResponse( + this.allProtocolRevenue); + factory OsmosisProtorevQueryGetAllProtocolRevenueResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisProtorevQueryGetAllProtocolRevenueResponse( + OsmosisProtorevAllProtocolRevenue.deserialize(decode.getField(1))); + } + factory OsmosisProtorevQueryGetAllProtocolRevenueResponse.fromRpc( + Map json) { + return OsmosisProtorevQueryGetAllProtocolRevenueResponse( + OsmosisProtorevAllProtocolRevenue.fromRpc( + json["all_protocol_revenue"])); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"all_protocol_revenue": allProtocolRevenue.toJson()}; + } + + @override + List get values => [allProtocolRevenue]; + + @override + String get typeUrl => + OsmosisProtorevV1beta1Types.queryGetAllProtocolRevenueResponse.typeUrl; +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_admin_account_request.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_admin_account_request.dart new file mode 100644 index 0000000..7dff540 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_admin_account_request.dart @@ -0,0 +1,54 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'query_get_proto_rev_admin_account_response.dart'; + +/// QueryGetProtoRevAdminAccountResponse is response type for the Query/GetProtoRevAdminAccount RPC method. +class OsmosisProtorevQueryGetProtoRevAdminAccountRequest extends CosmosMessage + with + QueryMessage, + RPCMessage { + const OsmosisProtorevQueryGetProtoRevAdminAccountRequest(); + factory OsmosisProtorevQueryGetProtoRevAdminAccountRequest.deserialize( + List bytes) { + return OsmosisProtorevQueryGetProtoRevAdminAccountRequest(); + } + + @override + List get fieldIds => []; + + @override + Map toJson() { + return {}; + } + + @override + List get values => []; + + @override + OsmosisProtorevQueryGetProtoRevAdminAccountResponse onResponse( + List bytes) { + return OsmosisProtorevQueryGetProtoRevAdminAccountResponse.deserialize( + bytes); + } + + @override + OsmosisProtorevQueryGetProtoRevAdminAccountResponse onJsonResponse( + Map json) { + return OsmosisProtorevQueryGetProtoRevAdminAccountResponse.fromRpc(json); + } + + @override + String get typeUrl => + OsmosisProtorevV1beta1Types.queryGetProtoRevAdminAccountRequest.typeUrl; + + @override + String get queryPath => + OsmosisProtorevV1beta1Types.getProtoRevAdminAccount.typeUrl; + + @override + Map get queryParameters => {}; + + @override + String get rpcPath => + OsmosisProtorevV1beta1Types.getProtoRevAdminAccount.rpcUrl(); +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_admin_account_response.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_admin_account_response.dart new file mode 100644 index 0000000..a216d78 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_admin_account_response.dart @@ -0,0 +1,37 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +/// QueryGetProtoRevAdminAccountResponse is response type for the Query/GetProtoRevAdminAccount RPC method. +class OsmosisProtorevQueryGetProtoRevAdminAccountResponse + extends CosmosMessage { + /// [adminAccount] is the admin account of the module + final String? adminAccount; + const OsmosisProtorevQueryGetProtoRevAdminAccountResponse( + {this.adminAccount}); + factory OsmosisProtorevQueryGetProtoRevAdminAccountResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisProtorevQueryGetProtoRevAdminAccountResponse( + adminAccount: decode.getField(1)); + } + factory OsmosisProtorevQueryGetProtoRevAdminAccountResponse.fromRpc( + Map json) { + return OsmosisProtorevQueryGetProtoRevAdminAccountResponse( + adminAccount: json["admin_account"]); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"admin_account": adminAccount}; + } + + @override + List get values => [adminAccount]; + + @override + String get typeUrl => + OsmosisProtorevV1beta1Types.queryGetProtoRevAdminAccountResponse.typeUrl; +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_all_profits_request.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_all_profits_request.dart new file mode 100644 index 0000000..5580124 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_all_profits_request.dart @@ -0,0 +1,53 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'query_get_proto_rev_all_profits_response.dart'; + +/// GetProtoRevAllProfits queries all of the profits from the module. +class OsmosisProtorevQueryGetProtoRevAllProfitsRequest extends CosmosMessage + with + QueryMessage, + RPCMessage { + const OsmosisProtorevQueryGetProtoRevAllProfitsRequest(); + factory OsmosisProtorevQueryGetProtoRevAllProfitsRequest.deserialize( + List bytes) { + return OsmosisProtorevQueryGetProtoRevAllProfitsRequest(); + } + + @override + List get fieldIds => []; + + @override + Map toJson() { + return {}; + } + + @override + List get values => []; + + @override + OsmosisProtorevQueryGetProtoRevAllProfitsResponse onResponse( + List bytes) { + return OsmosisProtorevQueryGetProtoRevAllProfitsResponse.deserialize(bytes); + } + + @override + OsmosisProtorevQueryGetProtoRevAllProfitsResponse onJsonResponse( + Map json) { + return OsmosisProtorevQueryGetProtoRevAllProfitsResponse.fromRpc(json); + } + + @override + String get typeUrl => + OsmosisProtorevV1beta1Types.queryGetProtoRevAllProfitsRequest.typeUrl; + + @override + String get queryPath => + OsmosisProtorevV1beta1Types.getProtoRevAllProfits.typeUrl; + + @override + Map get queryParameters => {}; + + @override + String get rpcPath => + OsmosisProtorevV1beta1Types.getProtoRevAllProfits.rpcUrl(); +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_all_profits_response.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_all_profits_response.dart new file mode 100644 index 0000000..1b5cb26 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_all_profits_response.dart @@ -0,0 +1,38 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_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'; + +class OsmosisProtorevQueryGetProtoRevAllProfitsResponse extends CosmosMessage { + /// pprofits is a list of all of the profits from the module + final List profits; + OsmosisProtorevQueryGetProtoRevAllProfitsResponse(List profits) + : profits = profits.mutable; + factory OsmosisProtorevQueryGetProtoRevAllProfitsResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisProtorevQueryGetProtoRevAllProfitsResponse( + decode.getFields(1).map((e) => Coin.deserialize(e)).toList()); + } + factory OsmosisProtorevQueryGetProtoRevAllProfitsResponse.fromRpc( + Map json) { + return OsmosisProtorevQueryGetProtoRevAllProfitsResponse( + (json["profits"] as List?)?.map((e) => Coin.fromRpc(e)).toList() ?? + []); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"profits": profits.map((e) => e.toJson())}; + } + + @override + List get values => [profits]; + + @override + String get typeUrl => + OsmosisProtorevV1beta1Types.queryGetProtoRevAllProfitsResponse.typeUrl; +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_all_route_statistics_request.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_all_route_statistics_request.dart new file mode 100644 index 0000000..5597dc0 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_all_route_statistics_request.dart @@ -0,0 +1,57 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'query_get_proto_rev_all_route_statistics_response.dart'; + +/// GetProtoRevAllRouteStatistics queries all of routes that the module has arbitraged against and the +/// number of trades and profits that have been accumulated for each route +class OsmosisProtorevQueryGetProtoRevAllRouteStatisticsRequest + extends CosmosMessage + with + QueryMessage, + RPCMessage { + const OsmosisProtorevQueryGetProtoRevAllRouteStatisticsRequest(); + factory OsmosisProtorevQueryGetProtoRevAllRouteStatisticsRequest.deserialize( + List bytes) { + return OsmosisProtorevQueryGetProtoRevAllRouteStatisticsRequest(); + } + + @override + List get fieldIds => []; + + @override + Map toJson() { + return {}; + } + + @override + List get values => []; + + @override + OsmosisProtorevQueryGetProtoRevAllRouteStatisticsResponse onResponse( + List bytes) { + return OsmosisProtorevQueryGetProtoRevAllRouteStatisticsResponse + .deserialize(bytes); + } + + @override + OsmosisProtorevQueryGetProtoRevAllRouteStatisticsResponse onJsonResponse( + Map json) { + return OsmosisProtorevQueryGetProtoRevAllRouteStatisticsResponse.fromRpc( + json); + } + + @override + String get typeUrl => OsmosisProtorevV1beta1Types + .queryGetProtoRevAllRouteStatisticsRequest.typeUrl; + + @override + String get queryPath => + OsmosisProtorevV1beta1Types.getProtoRevAllRouteStatistics.typeUrl; + + @override + Map get queryParameters => {}; + + @override + String get rpcPath => + OsmosisProtorevV1beta1Types.getProtoRevAllRouteStatistics.rpcUrl(); +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_all_route_statistics_response.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_all_route_statistics_response.dart new file mode 100644 index 0000000..f158704 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_all_route_statistics_response.dart @@ -0,0 +1,47 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/route_statistics.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; + +/// GetProtoRevAllRouteStatistics queries all of routes that the module has arbitraged +/// against and the number of trades and profits that have been accumulated for each route +class OsmosisProtorevQueryGetProtoRevAllRouteStatisticsResponse + extends CosmosMessage { + /// statistics contains the number of trades/profits the module has executed on + /// all routes it has successfully executed a trade on + final List statistics; + OsmosisProtorevQueryGetProtoRevAllRouteStatisticsResponse( + List statistics) + : statistics = statistics.mutable; + factory OsmosisProtorevQueryGetProtoRevAllRouteStatisticsResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisProtorevQueryGetProtoRevAllRouteStatisticsResponse(decode + .getFields(1) + .map((e) => OsmosisProtorevRouteStatistics.deserialize(e)) + .toList()); + } + factory OsmosisProtorevQueryGetProtoRevAllRouteStatisticsResponse.fromRpc( + Map json) { + return OsmosisProtorevQueryGetProtoRevAllRouteStatisticsResponse( + (json["statistics"] as List?) + ?.map((e) => OsmosisProtorevRouteStatistics.fromRpc(e)) + .toList() ?? + []); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"statistics": statistics.map((e) => e.toJson())}; + } + + @override + List get values => [statistics]; + + @override + String get typeUrl => OsmosisProtorevV1beta1Types + .queryGetProtoRevAllRouteStatisticsResponse.typeUrl; +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_base_denom_request.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_base_denom_request.dart new file mode 100644 index 0000000..523553b --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_base_denom_request.dart @@ -0,0 +1,53 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'query_get_proto_rev_base_denoms_response.dart'; + +/// GetProtoRevBaseDenoms queries the base denoms that the module is currently utilizing for arbitrage +class OsmosisProtorevQueryGetProtoRevBaseDenomsRequest extends CosmosMessage + with + QueryMessage, + RPCMessage { + const OsmosisProtorevQueryGetProtoRevBaseDenomsRequest(); + factory OsmosisProtorevQueryGetProtoRevBaseDenomsRequest.deserialize( + List bytes) { + return OsmosisProtorevQueryGetProtoRevBaseDenomsRequest(); + } + + @override + List get fieldIds => []; + + @override + Map toJson() { + return {}; + } + + @override + List get values => []; + + @override + OsmosisProtorevQueryGetProtoRevBaseDenomsResponse onResponse( + List bytes) { + return OsmosisProtorevQueryGetProtoRevBaseDenomsResponse.deserialize(bytes); + } + + @override + OsmosisProtorevQueryGetProtoRevBaseDenomsResponse onJsonResponse( + Map json) { + return OsmosisProtorevQueryGetProtoRevBaseDenomsResponse.fromRpc(json); + } + + @override + String get typeUrl => + OsmosisProtorevV1beta1Types.queryGetProtoRevBaseDenomsRequest.typeUrl; + + @override + String get queryPath => + OsmosisProtorevV1beta1Types.getProtoRevBaseDenoms.typeUrl; + + @override + Map get queryParameters => {}; + + @override + String get rpcPath => + OsmosisProtorevV1beta1Types.getProtoRevBaseDenoms.rpcUrl(); +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_base_denoms_response.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_base_denoms_response.dart new file mode 100644 index 0000000..b824016 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_base_denoms_response.dart @@ -0,0 +1,44 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/base_denom.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; + +/// QueryGetProtoRevBaseDenomsResponse is response type for the Query/GetProtoRevBaseDenoms RPC method. +class OsmosisProtorevQueryGetProtoRevBaseDenomsResponse extends CosmosMessage { + /// [baseDenoms] is a list of all of the base denoms and step sizes + final List baseDenoms; + OsmosisProtorevQueryGetProtoRevBaseDenomsResponse( + List baseDenoms) + : baseDenoms = baseDenoms.mutable; + factory OsmosisProtorevQueryGetProtoRevBaseDenomsResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisProtorevQueryGetProtoRevBaseDenomsResponse(decode + .getFields(1) + .map((e) => OsmosisProtorevBaseDenom.deserialize(e)) + .toList()); + } + factory OsmosisProtorevQueryGetProtoRevBaseDenomsResponse.fromRpc( + Map json) { + return OsmosisProtorevQueryGetProtoRevBaseDenomsResponse( + (json["base_denoms"] as List?) + ?.map((e) => OsmosisProtorevBaseDenom.fromRpc(e)) + .toList() ?? + []); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"base_denoms": baseDenoms.map((e) => e.toJson())}; + } + + @override + List get values => [baseDenoms]; + + @override + String get typeUrl => + OsmosisProtorevV1beta1Types.queryGetProtoRevBaseDenomsResponse.typeUrl; +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_developer_account_request.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_developer_account_request.dart new file mode 100644 index 0000000..1056d29 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_developer_account_request.dart @@ -0,0 +1,56 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'query_get_proto_rev_developer_account_response.dart'; + +/// QueryGetProtoRevDeveloperAccountRequest is request type for the Query/GetProtoRevDeveloperAccount RPC method. +class OsmosisProtorevQueryGetProtoRevDeveloperAccountRequest + extends CosmosMessage + with + QueryMessage, + RPCMessage { + const OsmosisProtorevQueryGetProtoRevDeveloperAccountRequest(); + factory OsmosisProtorevQueryGetProtoRevDeveloperAccountRequest.deserialize( + List bytes) { + return OsmosisProtorevQueryGetProtoRevDeveloperAccountRequest(); + } + + @override + List get fieldIds => []; + + @override + Map toJson() { + return {}; + } + + @override + List get values => []; + + @override + OsmosisProtorevQueryGetProtoRevDeveloperAccountResponse onResponse( + List bytes) { + return OsmosisProtorevQueryGetProtoRevDeveloperAccountResponse.deserialize( + bytes); + } + + @override + OsmosisProtorevQueryGetProtoRevDeveloperAccountResponse onJsonResponse( + Map json) { + return OsmosisProtorevQueryGetProtoRevDeveloperAccountResponse.fromRpc( + json); + } + + @override + String get typeUrl => OsmosisProtorevV1beta1Types + .queryGetProtoRevDeveloperAccountRequest.typeUrl; + + @override + String get queryPath => + OsmosisProtorevV1beta1Types.getProtoRevDeveloperAccount.typeUrl; + + @override + Map get queryParameters => {}; + + @override + String get rpcPath => + OsmosisProtorevV1beta1Types.getProtoRevDeveloperAccount.rpcUrl(); +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_developer_account_response.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_developer_account_response.dart new file mode 100644 index 0000000..ee48543 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_developer_account_response.dart @@ -0,0 +1,37 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +/// QueryGetProtoRevDeveloperAccountResponse is response type for the Query/GetProtoRevDeveloperAccount RPC method. +class OsmosisProtorevQueryGetProtoRevDeveloperAccountResponse + extends CosmosMessage { + /// [developerAccount] is the developer account of the module + final String? developerAccount; + const OsmosisProtorevQueryGetProtoRevDeveloperAccountResponse( + {this.developerAccount}); + factory OsmosisProtorevQueryGetProtoRevDeveloperAccountResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisProtorevQueryGetProtoRevDeveloperAccountResponse( + developerAccount: decode.getField(1)); + } + factory OsmosisProtorevQueryGetProtoRevDeveloperAccountResponse.fromRpc( + Map json) { + return OsmosisProtorevQueryGetProtoRevDeveloperAccountResponse( + developerAccount: json["developer_account"]); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"developer_account": developerAccount}; + } + + @override + List get values => [developerAccount]; + + @override + String get typeUrl => OsmosisProtorevV1beta1Types + .queryGetProtoRevDeveloperAccountResponse.typeUrl; +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_enabled_request.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_enabled_request.dart new file mode 100644 index 0000000..07001aa --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_enabled_request.dart @@ -0,0 +1,51 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'query_get_proto_rev_enabled_response.dart'; + +/// GetProtoRevEnabled queries whether the module is enabled or not +class OsmosisProtorevQueryGetProtoRevEnabledRequest extends CosmosMessage + with + QueryMessage, + RPCMessage { + const OsmosisProtorevQueryGetProtoRevEnabledRequest(); + factory OsmosisProtorevQueryGetProtoRevEnabledRequest.deserialize( + List bytes) { + return OsmosisProtorevQueryGetProtoRevEnabledRequest(); + } + + @override + List get fieldIds => []; + + @override + Map toJson() { + return {}; + } + + @override + List get values => []; + + @override + OsmosisProtorevQueryGetProtoRevEnabledResponse onResponse(List bytes) { + return OsmosisProtorevQueryGetProtoRevEnabledResponse.deserialize(bytes); + } + + @override + OsmosisProtorevQueryGetProtoRevEnabledResponse onJsonResponse( + Map json) { + return OsmosisProtorevQueryGetProtoRevEnabledResponse.fromRpc(json); + } + + @override + String get typeUrl => + OsmosisProtorevV1beta1Types.queryGetProtoRevEnabledRequest.typeUrl; + + @override + String get queryPath => + OsmosisProtorevV1beta1Types.getProtoRevEnabled.typeUrl; + + @override + Map get queryParameters => {}; + + @override + String get rpcPath => OsmosisProtorevV1beta1Types.getProtoRevEnabled.rpcUrl(); +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_enabled_response.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_enabled_response.dart new file mode 100644 index 0000000..178ee56 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_enabled_response.dart @@ -0,0 +1,35 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +/// QueryGetProtoRevEnabledResponse is response type for the Query/GetProtoRevEnabled RPC method. +class OsmosisProtorevQueryGetProtoRevEnabledResponse extends CosmosMessage { + /// [enabled] is whether the module is enabled + final bool? enabled; + const OsmosisProtorevQueryGetProtoRevEnabledResponse({this.enabled}); + factory OsmosisProtorevQueryGetProtoRevEnabledResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisProtorevQueryGetProtoRevEnabledResponse( + enabled: decode.getField(1)); + } + factory OsmosisProtorevQueryGetProtoRevEnabledResponse.fromRpc( + Map json) { + return OsmosisProtorevQueryGetProtoRevEnabledResponse( + enabled: json["enabled"]); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"enabled": enabled}; + } + + @override + List get values => [enabled]; + + @override + String get typeUrl => + OsmosisProtorevV1beta1Types.queryGetProtoRevEnabledResponse.typeUrl; +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_info_by_pool_type_request.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_info_by_pool_type_request.dart new file mode 100644 index 0000000..0541610 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_info_by_pool_type_request.dart @@ -0,0 +1,54 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'query_get_proto_rev_info_by_pool_type_response.dart'; + +/// QueryGetProtoRevInfoByPoolTypeRequest is request type for the Query/GetProtoRevInfoByPoolType RPC method. +class OsmosisProtorevQueryGetProtoRevInfoByPoolTypeRequest extends CosmosMessage + with + QueryMessage, + RPCMessage { + const OsmosisProtorevQueryGetProtoRevInfoByPoolTypeRequest(); + factory OsmosisProtorevQueryGetProtoRevInfoByPoolTypeRequest.deserialize( + List bytes) { + return OsmosisProtorevQueryGetProtoRevInfoByPoolTypeRequest(); + } + + @override + List get fieldIds => []; + + @override + Map toJson() { + return {}; + } + + @override + List get values => []; + + @override + OsmosisProtorevQueryGetProtoRevInfoByPoolTypeResponse onResponse( + List bytes) { + return OsmosisProtorevQueryGetProtoRevInfoByPoolTypeResponse.deserialize( + bytes); + } + + @override + OsmosisProtorevQueryGetProtoRevInfoByPoolTypeResponse onJsonResponse( + Map json) { + return OsmosisProtorevQueryGetProtoRevInfoByPoolTypeResponse.fromRpc(json); + } + + @override + String get typeUrl => + OsmosisProtorevV1beta1Types.queryGetProtoRevInfoByPoolTypeRequest.typeUrl; + + @override + String get queryPath => + OsmosisProtorevV1beta1Types.getProtoRevInfoByPoolType.typeUrl; + + @override + Map get queryParameters => {}; + + @override + String get rpcPath => + OsmosisProtorevV1beta1Types.getProtoRevInfoByPoolType.rpcUrl(); +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_info_by_pool_type_response.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_info_by_pool_type_response.dart new file mode 100644 index 0000000..46caa40 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_info_by_pool_type_response.dart @@ -0,0 +1,39 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/info_by_pool_type.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +/// QueryGetProtoRevInfoByPoolTypeResponse is response type for the Query/GetProtoRevInfoByPoolType RPC method. +class OsmosisProtorevQueryGetProtoRevInfoByPoolTypeResponse + extends CosmosMessage { + /// [infoByPoolType] contains all information pertaining to how different + /// pool types are handled by the module. + final OsmosisProtorevInfoByPoolType infoByPoolType; + const OsmosisProtorevQueryGetProtoRevInfoByPoolTypeResponse( + this.infoByPoolType); + factory OsmosisProtorevQueryGetProtoRevInfoByPoolTypeResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisProtorevQueryGetProtoRevInfoByPoolTypeResponse( + OsmosisProtorevInfoByPoolType.deserialize(decode.getField(1))); + } + factory OsmosisProtorevQueryGetProtoRevInfoByPoolTypeResponse.fromRpc( + Map json) { + return OsmosisProtorevQueryGetProtoRevInfoByPoolTypeResponse( + OsmosisProtorevInfoByPoolType.fromRpc(json["info_by_pool_type"])); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"info_by_pool_type": infoByPoolType.toJson()}; + } + + @override + List get values => [infoByPoolType]; + + @override + String get typeUrl => OsmosisProtorevV1beta1Types + .queryGetProtoRevInfoByPoolTypeResponse.typeUrl; +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_max_pool_points_per_block_request.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_max_pool_points_per_block_request.dart new file mode 100644 index 0000000..0cb3d8b --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_max_pool_points_per_block_request.dart @@ -0,0 +1,58 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'query_get_proto_rev_max_pool_points_per_block_response.dart'; + +/// GetProtoRevMaxPoolPointsPerBlock queries the maximum number of pool points that can consumed per block +class OsmosisProtorevQueryGetProtoRevMaxPoolPointsPerBlockRequest + extends CosmosMessage + with + QueryMessage< + OsmosisProtorevQueryGetProtoRevMaxPoolPointsPerBlockResponse>, + RPCMessage< + OsmosisProtorevQueryGetProtoRevMaxPoolPointsPerBlockResponse> { + const OsmosisProtorevQueryGetProtoRevMaxPoolPointsPerBlockRequest(); + factory OsmosisProtorevQueryGetProtoRevMaxPoolPointsPerBlockRequest.deserialize( + List bytes) { + return OsmosisProtorevQueryGetProtoRevMaxPoolPointsPerBlockRequest(); + } + + @override + List get fieldIds => []; + + @override + Map toJson() { + return {}; + } + + @override + List get values => []; + + @override + OsmosisProtorevQueryGetProtoRevMaxPoolPointsPerBlockResponse onResponse( + List bytes) { + return OsmosisProtorevQueryGetProtoRevMaxPoolPointsPerBlockResponse + .deserialize(bytes); + } + + @override + OsmosisProtorevQueryGetProtoRevMaxPoolPointsPerBlockResponse onJsonResponse( + Map json) { + return OsmosisProtorevQueryGetProtoRevMaxPoolPointsPerBlockResponse.fromRpc( + json); + } + + @override + String get typeUrl => OsmosisProtorevV1beta1Types + .queryGetProtoRevMaxPoolPointsPerBlockRequest.typeUrl; + + @override + String get queryPath => + OsmosisProtorevV1beta1Types.getProtoRevMaxPoolPointsPerBlock.typeUrl; + + @override + Map get queryParameters => {}; + + @override + String get rpcPath => + OsmosisProtorevV1beta1Types.getProtoRevMaxPoolPointsPerBlock.rpcUrl(); +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_max_pool_points_per_block_response.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_max_pool_points_per_block_response.dart new file mode 100644 index 0000000..e3840d4 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_max_pool_points_per_block_response.dart @@ -0,0 +1,40 @@ +import 'package:blockchain_utils/numbers/bigint_utils.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +/// GetProtoRevMaxPoolPointsPerBlock queries the maximum number of pool points that can consumed per block. +class OsmosisProtorevQueryGetProtoRevMaxPoolPointsPerBlockResponse + extends CosmosMessage { + /// [maxPoolPointsPerBlock] is the maximum number of pool points that can be + /// consumed per block + final BigInt? maxPoolPointsPerBlock; + const OsmosisProtorevQueryGetProtoRevMaxPoolPointsPerBlockResponse( + {this.maxPoolPointsPerBlock}); + factory OsmosisProtorevQueryGetProtoRevMaxPoolPointsPerBlockResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisProtorevQueryGetProtoRevMaxPoolPointsPerBlockResponse( + maxPoolPointsPerBlock: BigInt.parse(decode.getField(1))); + } + factory OsmosisProtorevQueryGetProtoRevMaxPoolPointsPerBlockResponse.fromRpc( + Map json) { + return OsmosisProtorevQueryGetProtoRevMaxPoolPointsPerBlockResponse( + maxPoolPointsPerBlock: + BigintUtils.parse(json["max_pool_points_per_block"])); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"max_pool_points_per_block": maxPoolPointsPerBlock.toString()}; + } + + @override + List get values => [maxPoolPointsPerBlock]; + + @override + String get typeUrl => OsmosisProtorevV1beta1Types + .queryGetProtoRevMaxPoolPointsPerBlockResponse.typeUrl; +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_max_pool_points_per_tx_request.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_max_pool_points_per_tx_request.dart new file mode 100644 index 0000000..f36ead2 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_max_pool_points_per_tx_request.dart @@ -0,0 +1,56 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'query_get_proto_rev_max_pool_points_per_tx_response.dart'; + +/// GetProtoRevMaxPoolPointsPerTx queries the maximum number of pool points that can be consumed per transaction. +class OsmosisProtorevQueryGetProtoRevMaxPoolPointsPerTxRequest + extends CosmosMessage + with + QueryMessage, + RPCMessage { + const OsmosisProtorevQueryGetProtoRevMaxPoolPointsPerTxRequest(); + factory OsmosisProtorevQueryGetProtoRevMaxPoolPointsPerTxRequest.deserialize( + List bytes) { + return OsmosisProtorevQueryGetProtoRevMaxPoolPointsPerTxRequest(); + } + + @override + List get fieldIds => []; + + @override + Map toJson() { + return {}; + } + + @override + List get values => []; + + @override + OsmosisProtorevQueryGetProtoRevMaxPoolPointsPerTxResponse onResponse( + List bytes) { + return OsmosisProtorevQueryGetProtoRevMaxPoolPointsPerTxResponse + .deserialize(bytes); + } + + @override + OsmosisProtorevQueryGetProtoRevMaxPoolPointsPerTxResponse onJsonResponse( + Map json) { + return OsmosisProtorevQueryGetProtoRevMaxPoolPointsPerTxResponse.fromRpc( + json); + } + + @override + String get typeUrl => OsmosisProtorevV1beta1Types + .queryGetProtoRevMaxPoolPointsPerTxRequest.typeUrl; + + @override + String get queryPath => + OsmosisProtorevV1beta1Types.getProtoRevMaxPoolPointsPerTx.typeUrl; + + @override + Map get queryParameters => {}; + + @override + String get rpcPath => + OsmosisProtorevV1beta1Types.getProtoRevMaxPoolPointsPerTx.rpcUrl(); +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_max_pool_points_per_tx_response.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_max_pool_points_per_tx_response.dart new file mode 100644 index 0000000..ce3efd6 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_max_pool_points_per_tx_response.dart @@ -0,0 +1,39 @@ +import 'package:blockchain_utils/numbers/bigint_utils.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +/// QueryGetProtoRevMaxPoolPointsPerTxResponse is response type for the Query/GetProtoRevMaxPoolPointsPerTx RPC method.. +class OsmosisProtorevQueryGetProtoRevMaxPoolPointsPerTxResponse + extends CosmosMessage { + /// [maxPoolPointsPerTx] is the maximum number of pool points that can be + /// consumed per transaction + final BigInt? maxPoolPointsPerTx; + const OsmosisProtorevQueryGetProtoRevMaxPoolPointsPerTxResponse( + {this.maxPoolPointsPerTx}); + factory OsmosisProtorevQueryGetProtoRevMaxPoolPointsPerTxResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisProtorevQueryGetProtoRevMaxPoolPointsPerTxResponse( + maxPoolPointsPerTx: BigInt.parse(decode.getField(1))); + } + factory OsmosisProtorevQueryGetProtoRevMaxPoolPointsPerTxResponse.fromRpc( + Map json) { + return OsmosisProtorevQueryGetProtoRevMaxPoolPointsPerTxResponse( + maxPoolPointsPerTx: BigintUtils.parse(json["max_pool_points_per_tx"])); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"max_pool_points_per_tx": maxPoolPointsPerTx.toString()}; + } + + @override + List get values => [maxPoolPointsPerTx]; + + @override + String get typeUrl => OsmosisProtorevV1beta1Types + .queryGetProtoRevMaxPoolPointsPerTxResponse.typeUrl; +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_number_of_trades_response.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_number_of_trades_response.dart new file mode 100644 index 0000000..8634722 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_number_of_trades_response.dart @@ -0,0 +1,38 @@ +import 'package:blockchain_utils/numbers/bigint_utils.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +/// QueryGetProtoRevNumberOfTradesResponse is response type for the Query/GetProtoRevNumberOfTrades RPC method. +class OsmosisProtorevQueryGetProtoRevNumberOfTradesResponse + extends CosmosMessage { + /// [numberOfTrades] is the number of trades the module has executed + final BigInt numberOfTrades; + const OsmosisProtorevQueryGetProtoRevNumberOfTradesResponse( + this.numberOfTrades); + factory OsmosisProtorevQueryGetProtoRevNumberOfTradesResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisProtorevQueryGetProtoRevNumberOfTradesResponse( + BigInt.parse(decode.getField(1))); + } + factory OsmosisProtorevQueryGetProtoRevNumberOfTradesResponse.fromRpc( + Map json) { + return OsmosisProtorevQueryGetProtoRevNumberOfTradesResponse( + BigintUtils.parse(json["number_of_trades"])); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"number_of_trades": numberOfTrades.toString()}; + } + + @override + List get values => [numberOfTrades.toString()]; + + @override + String get typeUrl => OsmosisProtorevV1beta1Types + .queryGetProtoRevNumberOfTradesResponse.typeUrl; +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_pool_request.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_pool_request.dart new file mode 100644 index 0000000..0a66087 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_pool_request.dart @@ -0,0 +1,59 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'query_get_proto_rev_pool_response.dart'; + +/// GetProtoRevPool queries the pool id used via the highest liquidity method for arbitrage route building given a pair of denominations +class OsmosisProtorevQueryGetProtoRevPoolRequest extends CosmosMessage + with + QueryMessage, + RPCMessage { + /// base_denom is the base denom set in protorev for the denom pair to pool + /// mapping + final String? baseDenom; + + /// other_denom is the other denom for the denom pair to pool mapping + final String? otherDenom; + const OsmosisProtorevQueryGetProtoRevPoolRequest( + {this.baseDenom, this.otherDenom}); + factory OsmosisProtorevQueryGetProtoRevPoolRequest.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisProtorevQueryGetProtoRevPoolRequest( + baseDenom: decode.getField(1), otherDenom: decode.getField(2)); + } + + @override + List get fieldIds => [1, 2]; + + @override + Map toJson() { + return {"base_denom": baseDenom, "other_denom": otherDenom}; + } + + @override + List get values => [baseDenom, otherDenom]; + + @override + OsmosisProtorevQueryGetProtoRevPoolResponse onResponse(List bytes) { + return OsmosisProtorevQueryGetProtoRevPoolResponse.deserialize(bytes); + } + + @override + OsmosisProtorevQueryGetProtoRevPoolResponse onJsonResponse( + Map json) { + return OsmosisProtorevQueryGetProtoRevPoolResponse.fromRpc(json); + } + + @override + String get typeUrl => + OsmosisProtorevV1beta1Types.queryGetProtoRevPoolRequest.typeUrl; + + @override + String get queryPath => OsmosisProtorevV1beta1Types.getProtoRevPool.typeUrl; + + @override + Map get queryParameters => {}; + + @override + String get rpcPath => OsmosisProtorevV1beta1Types.getProtoRevPool.rpcUrl(); +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_pool_response.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_pool_response.dart new file mode 100644 index 0000000..fbf556b --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_pool_response.dart @@ -0,0 +1,36 @@ +import 'package:blockchain_utils/numbers/numbers.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +/// QueryGetProtoRevPoolResponse is response type for the Query/GetProtoRevPool RPC method. +class OsmosisProtorevQueryGetProtoRevPoolResponse extends CosmosMessage { + /// [poolId] is the pool_id stored for the denom pair + final BigInt? poolId; + const OsmosisProtorevQueryGetProtoRevPoolResponse({this.poolId}); + factory OsmosisProtorevQueryGetProtoRevPoolResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisProtorevQueryGetProtoRevPoolResponse( + poolId: decode.getField(1)); + } + factory OsmosisProtorevQueryGetProtoRevPoolResponse.fromRpc( + Map json) { + return OsmosisProtorevQueryGetProtoRevPoolResponse( + poolId: BigintUtils.tryParse(json["pool_id"])); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"pool_id": poolId?.toString()}; + } + + @override + List get values => [poolId]; + + @override + String get typeUrl => + OsmosisProtorevV1beta1Types.queryGetProtoRevPoolResponse.typeUrl; +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_profits_by_denom_request.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_profits_by_denom_request.dart new file mode 100644 index 0000000..65306ae --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_profits_by_denom_request.dart @@ -0,0 +1,61 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'query_get_protorev_profits_by_denom_response.dart'; + +/// QueryGetProtoRevProfitsByDenomRequest is request type for the Query/GetProtoRevProfitsByDenom RPC method. +class OsmosisProtorevOsmosisProtorevQueryQueryGetProtoRevProfitsByDenomRequest + extends CosmosMessage + with + QueryMessage, + RPCMessage { + /// [denom] is the denom to query profits by + final String? denom; + + const OsmosisProtorevOsmosisProtorevQueryQueryGetProtoRevProfitsByDenomRequest( + {this.denom}); + factory OsmosisProtorevOsmosisProtorevQueryQueryGetProtoRevProfitsByDenomRequest.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisProtorevOsmosisProtorevQueryQueryGetProtoRevProfitsByDenomRequest( + denom: decode.getField(1)); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"denom": denom}; + } + + @override + List get values => [denom]; + + @override + OsmosisProtorevQueryGetProtoRevProfitsByDenomResponse onResponse( + List bytes) { + return OsmosisProtorevQueryGetProtoRevProfitsByDenomResponse.deserialize( + bytes); + } + + @override + OsmosisProtorevQueryGetProtoRevProfitsByDenomResponse onJsonResponse( + Map json) { + return OsmosisProtorevQueryGetProtoRevProfitsByDenomResponse.fromRpc(json); + } + + @override + String get typeUrl => + OsmosisProtorevV1beta1Types.queryGetProtoRevProfitsByDenomRequest.typeUrl; + + @override + String get queryPath => + OsmosisProtorevV1beta1Types.getProtoRevProfitsByDenom.typeUrl; + + @override + Map get queryParameters => {"denom": denom}; + + @override + String get rpcPath => + OsmosisProtorevV1beta1Types.getProtoRevProfitsByDenom.rpcUrl(); +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_statistics_by_route_request.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_statistics_by_route_request.dart new file mode 100644 index 0000000..c1812e4 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_statistics_by_route_request.dart @@ -0,0 +1,69 @@ +import 'package:blockchain_utils/numbers/numbers.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; +import 'query_get_proto_rev_statistics_by_route_response.dart'; + +/// GetProtoRevStatisticsByRoute queries the number of arbitrages and profits that have been executed for a given route. +class OsmosisProtorevQueryGetProtoRevStatisticsByRouteRequest + extends CosmosMessage + with + QueryMessage, + RPCMessage { + /// [route] is the set of pool ids to query statistics by i.e. 1,2,3 + final List? route; + + OsmosisProtorevQueryGetProtoRevStatisticsByRouteRequest({List? route}) + : route = route?.nullOnEmpy; + factory OsmosisProtorevQueryGetProtoRevStatisticsByRouteRequest.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisProtorevQueryGetProtoRevStatisticsByRouteRequest( + route: decode + .getResult(1) + ?.to, List>( + (e) => e.map((e) => BigintUtils.parse(e)).toList()) ?? + []); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"route": route?.map((e) => e.toString()).toList()}; + } + + @override + List get values => [route]; + + @override + OsmosisProtorevQueryGetProtoRevStatisticsByRouteResponse onResponse( + List bytes) { + return OsmosisProtorevQueryGetProtoRevStatisticsByRouteResponse.deserialize( + bytes); + } + + @override + OsmosisProtorevQueryGetProtoRevStatisticsByRouteResponse onJsonResponse( + Map json) { + return OsmosisProtorevQueryGetProtoRevStatisticsByRouteResponse.fromRpc( + json); + } + + @override + String get typeUrl => OsmosisProtorevV1beta1Types + .queryGetProtoRevStatisticsByRouteRequest.typeUrl; + + @override + String get queryPath => + OsmosisProtorevV1beta1Types.getProtoRevStatisticsByRoute.typeUrl; + + @override + Map get queryParameters => + {"route": route?.map((e) => e.toString()).join(",")}; + + @override + String get rpcPath => + OsmosisProtorevV1beta1Types.getProtoRevStatisticsByRoute.rpcUrl(); +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_statistics_by_route_response.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_statistics_by_route_response.dart new file mode 100644 index 0000000..2802a37 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_statistics_by_route_response.dart @@ -0,0 +1,39 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/route_statistics.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +/// GetProtoRevStatisticsByRoute queries the number of arbitrages and profits that have been executed for a given route. +class OsmosisProtorevQueryGetProtoRevStatisticsByRouteResponse + extends CosmosMessage { + /// statistics contains the number of trades the module has executed after a + /// swap on a given pool and the profits from the trades + final OsmosisProtorevRouteStatistics statistics; + const OsmosisProtorevQueryGetProtoRevStatisticsByRouteResponse( + this.statistics); + factory OsmosisProtorevQueryGetProtoRevStatisticsByRouteResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisProtorevQueryGetProtoRevStatisticsByRouteResponse( + OsmosisProtorevRouteStatistics.deserialize(decode.getField(1))); + } + factory OsmosisProtorevQueryGetProtoRevStatisticsByRouteResponse.fromRpc( + Map json) { + return OsmosisProtorevQueryGetProtoRevStatisticsByRouteResponse( + OsmosisProtorevRouteStatistics.fromRpc(json["statistics"])); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"statistics": statistics.toJson()}; + } + + @override + List get values => [statistics]; + + @override + String get typeUrl => OsmosisProtorevV1beta1Types + .queryGetProtoRevStatisticsByRouteResponse.typeUrl; +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_token_pair_arb_routes_request.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_token_pair_arb_routes_request.dart new file mode 100644 index 0000000..e809745 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_token_pair_arb_routes_request.dart @@ -0,0 +1,56 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'query_get_proto_rev_token_pair_arb_routes_response.dart'; + +/// QueryGetProtoRevTokenPairArbRoutesRequest is request type for the Query/GetProtoRevTokenPairArbRoutes RPC method. +class OsmosisProtorevQueryGetProtoRevTokenPairArbRoutesRequest + extends CosmosMessage + with + QueryMessage, + RPCMessage { + const OsmosisProtorevQueryGetProtoRevTokenPairArbRoutesRequest(); + factory OsmosisProtorevQueryGetProtoRevTokenPairArbRoutesRequest.deserialize( + List bytes) { + return OsmosisProtorevQueryGetProtoRevTokenPairArbRoutesRequest(); + } + + @override + List get fieldIds => []; + + @override + Map toJson() { + return {}; + } + + @override + List get values => []; + + @override + OsmosisProtorevQueryGetProtoRevTokenPairArbRoutesResponse onResponse( + List bytes) { + return OsmosisProtorevQueryGetProtoRevTokenPairArbRoutesResponse + .deserialize(bytes); + } + + @override + OsmosisProtorevQueryGetProtoRevTokenPairArbRoutesResponse onJsonResponse( + Map json) { + return OsmosisProtorevQueryGetProtoRevTokenPairArbRoutesResponse.fromRpc( + json); + } + + @override + String get typeUrl => OsmosisProtorevV1beta1Types + .queryGetProtoRevTokenPairArbRoutesRequest.typeUrl; + + @override + String get queryPath => + OsmosisProtorevV1beta1Types.getProtoRevTokenPairArbRoutes.typeUrl; + + @override + Map get queryParameters => {}; + + @override + String get rpcPath => + OsmosisProtorevV1beta1Types.getProtoRevTokenPairArbRoutes.rpcUrl(); +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_token_pair_arb_routes_response.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_token_pair_arb_routes_response.dart new file mode 100644 index 0000000..9928b38 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_proto_rev_token_pair_arb_routes_response.dart @@ -0,0 +1,46 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/token_pair_arb_routes.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; + +/// QueryGetProtoRevTokenPairArbRoutesResponse is response type for the Query/GetProtoRevTokenPairArbRoutes RPC method. +class OsmosisProtorevQueryGetProtoRevTokenPairArbRoutesResponse + extends CosmosMessage { + /// routes is a list of all of the hot routes that the module is currently + /// arbitraging + final List routes; + OsmosisProtorevQueryGetProtoRevTokenPairArbRoutesResponse( + List routes) + : routes = routes.mutable; + factory OsmosisProtorevQueryGetProtoRevTokenPairArbRoutesResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisProtorevQueryGetProtoRevTokenPairArbRoutesResponse(decode + .getFields(1) + .map((e) => OsmosisProtorevTokenPairArbRoutes.deserialize(e)) + .toList()); + } + factory OsmosisProtorevQueryGetProtoRevTokenPairArbRoutesResponse.fromRpc( + Map json) { + return OsmosisProtorevQueryGetProtoRevTokenPairArbRoutesResponse( + (json["routes"] as List?) + ?.map((e) => OsmosisProtorevTokenPairArbRoutes.fromRpc(e)) + .toList() ?? + []); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"routes": routes.map((e) => e.toJson())}; + } + + @override + List get values => [routes]; + + @override + String get typeUrl => OsmosisProtorevV1beta1Types + .queryGetProtoRevTokenPairArbRoutesResponse.typeUrl; +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_protorev_number_of_trades_request.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_protorev_number_of_trades_request.dart new file mode 100644 index 0000000..978826c --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_protorev_number_of_trades_request.dart @@ -0,0 +1,54 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'query_get_proto_rev_number_of_trades_response.dart'; + +/// QueryGetProtoRevNumberOfTradesRequest is request type for the Query/GetProtoRevNumberOfTrades RPC method. +class OsmosisProtorevQueryGetProtoRevNumberOfTradesRequest extends CosmosMessage + with + QueryMessage, + RPCMessage { + const OsmosisProtorevQueryGetProtoRevNumberOfTradesRequest(); + factory OsmosisProtorevQueryGetProtoRevNumberOfTradesRequest.deserialize( + List bytes) { + return OsmosisProtorevQueryGetProtoRevNumberOfTradesRequest(); + } + + @override + List get fieldIds => []; + + @override + Map toJson() { + return {}; + } + + @override + List get values => []; + + @override + OsmosisProtorevQueryGetProtoRevNumberOfTradesResponse onResponse( + List bytes) { + return OsmosisProtorevQueryGetProtoRevNumberOfTradesResponse.deserialize( + bytes); + } + + @override + OsmosisProtorevQueryGetProtoRevNumberOfTradesResponse onJsonResponse( + Map json) { + return OsmosisProtorevQueryGetProtoRevNumberOfTradesResponse.fromRpc(json); + } + + @override + String get typeUrl => + OsmosisProtorevV1beta1Types.queryGetProtoRevNumberOfTradesRequest.typeUrl; + + @override + String get queryPath => + OsmosisProtorevV1beta1Types.getProtoRevNumberOfTrades.typeUrl; + + @override + Map get queryParameters => {}; + + @override + String get rpcPath => + OsmosisProtorevV1beta1Types.getProtoRevNumberOfTrades.rpcUrl(); +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_protorev_profits_by_denom_response.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_protorev_profits_by_denom_response.dart new file mode 100644 index 0000000..541bb80 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_get_protorev_profits_by_denom_response.dart @@ -0,0 +1,37 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_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'; + +/// QueryGetProtoRevProfitsByDenomResponse is response type for the Query/GetProtoRevProfitsByDenom RPC method. +class OsmosisProtorevQueryGetProtoRevProfitsByDenomResponse + extends CosmosMessage { + /// profit is the profits of the module by the selected denom + final Coin profit; + const OsmosisProtorevQueryGetProtoRevProfitsByDenomResponse(this.profit); + factory OsmosisProtorevQueryGetProtoRevProfitsByDenomResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisProtorevQueryGetProtoRevProfitsByDenomResponse( + Coin.deserialize(decode.getField(1))); + } + factory OsmosisProtorevQueryGetProtoRevProfitsByDenomResponse.fromRpc( + Map json) { + return OsmosisProtorevQueryGetProtoRevProfitsByDenomResponse( + Coin.fromRpc(json["profit"])); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"profit": profit.toJson()}; + } + + @override + List get values => [profit]; + + @override + String get typeUrl => OsmosisProtorevV1beta1Types + .queryGetProtoRevProfitsByDenomResponse.typeUrl; +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_params_request.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_params_request.dart new file mode 100644 index 0000000..5a7bc38 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_params_request.dart @@ -0,0 +1,46 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_params_response.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +class OsmosisProtorevQueryParamsRequest extends CosmosMessage + with + QueryMessage, + RPCMessage { + const OsmosisProtorevQueryParamsRequest(); + factory OsmosisProtorevQueryParamsRequest.deserialize(List bytes) { + return OsmosisProtorevQueryParamsRequest(); + } + + @override + List get fieldIds => []; + + @override + Map toJson() { + return {}; + } + + @override + List get values => []; + + @override + OsmosisProtorevQueryParamsResponse onResponse(List bytes) { + return OsmosisProtorevQueryParamsResponse.deserialize(bytes); + } + + @override + OsmosisProtorevQueryParamsResponse onJsonResponse(Map json) { + return OsmosisProtorevQueryParamsResponse.fromRpc(json); + } + + @override + String get typeUrl => OsmosisProtorevV1beta1Types.queryParamsRequest.typeUrl; + + @override + String get queryPath => OsmosisProtorevV1beta1Types.queryParams.typeUrl; + + @override + Map get queryParameters => {}; + + @override + String get rpcPath => OsmosisProtorevV1beta1Types.queryParams.rpcUrl(); +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_params_response.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_params_response.dart new file mode 100644 index 0000000..ca9d13b --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/query/query_params_response.dart @@ -0,0 +1,34 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/params.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +/// QueryParamsResponse is response type for the Query/Params RPC method. +class OsmosisProtorevQueryParamsResponse extends CosmosMessage { + /// params holds all the parameters of this module. + final OsmosisProtorevParams params; + const OsmosisProtorevQueryParamsResponse(this.params); + factory OsmosisProtorevQueryParamsResponse.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisProtorevQueryParamsResponse( + OsmosisProtorevParams.deserialize(decode.getField(1))); + } + factory OsmosisProtorevQueryParamsResponse.fromRpc( + Map json) { + return OsmosisProtorevQueryParamsResponse( + OsmosisProtorevParams.fromRpc(json["params"])); + } + + @override + List get fieldIds => []; + + @override + Map toJson() { + return {"params": params.toJson()}; + } + + @override + List get values => []; + + @override + String get typeUrl => OsmosisProtorevV1beta1Types.queryParamsResponse.typeUrl; +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/services/msg_set_base_denoms.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/services/msg_set_base_denoms.dart new file mode 100644 index 0000000..bacd65d --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/services/msg_set_base_denoms.dart @@ -0,0 +1,59 @@ +import 'package:cosmos_sdk/src/models/global_messages/service_empty_response.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/base_denom.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; + +/// SetBaseDenoms sets the base denoms that will be used to create cyclic arbitrage routes. +/// Can only be called by the admin account. +class OsmosisProtorevMsgSetBaseDenoms extends CosmosMessage + with ServiceMessage { + /// [admin] is the account that is authorized to set the base denoms. + final String? admin; + + /// [baseDenoms] is the list of base denoms to set. + final List baseDenoms; + + OsmosisProtorevMsgSetBaseDenoms( + {this.admin, required List baseDenoms}) + : baseDenoms = baseDenoms.mutable; + + factory OsmosisProtorevMsgSetBaseDenoms.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisProtorevMsgSetBaseDenoms( + admin: decode.getField(1), + baseDenoms: decode + .getFields(2) + .map((e) => OsmosisProtorevBaseDenom.deserialize(e)) + .toList()); + } + + @override + List get fieldIds => [1, 2]; + + @override + Map toJson() { + return { + "admin": admin, + "base_denoms": baseDenoms.map((e) => e.toJson()).toList() + }; + } + + @override + String get typeUrl => OsmosisProtorevV1beta1Types.msgSetBaseDenoms.typeUrl; + + @override + List get values => [admin, baseDenoms]; + + @override + EmptyServiceRequestResponse onResponse(List bytes) { + return EmptyServiceRequestResponse( + OsmosisProtorevV1beta1Types.msgSetBaseDenomsResponse.typeUrl); + } + + @override + String get service => OsmosisProtorevV1beta1Types.setBaseDenoms.typeUrl; + + @override + List get signers => [admin]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/services/msg_set_developer_account.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/services/msg_set_developer_account.dart new file mode 100644 index 0000000..bb41627 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/services/msg_set_developer_account.dart @@ -0,0 +1,50 @@ +import 'package:cosmos_sdk/src/models/global_messages/service_empty_response.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +/// MsgSetDeveloperAccount defines the Msg/SetDeveloperAccount request type. +class OsmosisProtorevMsgSetDeveloperAccount extends CosmosMessage + with ServiceMessage { + /// [admin] is the account that is authorized to set the developer account. + final String? admin; + + /// [developerAccount] is the account that will receive a portion of the profits + /// from the protorev module. + final String? developerAccount; + + const OsmosisProtorevMsgSetDeveloperAccount( + {this.admin, this.developerAccount}); + + factory OsmosisProtorevMsgSetDeveloperAccount.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisProtorevMsgSetDeveloperAccount( + admin: decode.getField(1), developerAccount: decode.getField(2)); + } + + @override + List get fieldIds => [1, 2]; + + @override + Map toJson() { + return {"admin": admin, "developer_account": developerAccount}; + } + + @override + String get typeUrl => + OsmosisProtorevV1beta1Types.msgSetDeveloperAccount.typeUrl; + + @override + List get values => [admin, developerAccount]; + + @override + EmptyServiceRequestResponse onResponse(List bytes) { + return EmptyServiceRequestResponse( + OsmosisProtorevV1beta1Types.msgSetDeveloperAccountResponse.typeUrl); + } + + @override + String get service => OsmosisProtorevV1beta1Types.setDeveloperAccount.typeUrl; + + @override + List get signers => [admin]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/services/msg_set_hot_routes.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/services/msg_set_hot_routes.dart new file mode 100644 index 0000000..062d448 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/services/msg_set_hot_routes.dart @@ -0,0 +1,59 @@ +import 'package:cosmos_sdk/src/models/global_messages/service_empty_response.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/token_pair_arb_routes.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; + +/// SetHotRoutes sets the hot routes that will be explored when +/// creating cyclic arbitrage routes. Can only be called by the admin account. +class OsmosisProtorevMsgSetHotRoutes extends CosmosMessage + with ServiceMessage { + /// [admin] is the account that is authorized to set the hot routes. + final String? admin; + + /// [hotRoutes] is the list of hot routes to set. + final List hotRoutes; + + OsmosisProtorevMsgSetHotRoutes( + {this.admin, required List hotRoutes}) + : hotRoutes = hotRoutes.mutable; + + factory OsmosisProtorevMsgSetHotRoutes.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisProtorevMsgSetHotRoutes( + admin: decode.getField(1), + hotRoutes: decode + .getFields(2) + .map((e) => OsmosisProtorevTokenPairArbRoutes.deserialize(e)) + .toList()); + } + + @override + List get fieldIds => [1, 2]; + + @override + Map toJson() { + return { + "admin": admin, + "hot_routes": hotRoutes.map((e) => e.toJson()).toList() + }; + } + + @override + String get typeUrl => OsmosisProtorevV1beta1Types.msgSetHotRoutes.typeUrl; + + @override + List get values => [admin, hotRoutes]; + + @override + EmptyServiceRequestResponse onResponse(List bytes) { + return EmptyServiceRequestResponse( + OsmosisProtorevV1beta1Types.msgSetHotRoutesResponse.typeUrl); + } + + @override + String get service => OsmosisProtorevV1beta1Types.setHotRoutes.typeUrl; + + @override + List get signers => [admin]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/services/msg_set_info_by_pool_type.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/services/msg_set_info_by_pool_type.dart new file mode 100644 index 0000000..daa61d6 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/services/msg_set_info_by_pool_type.dart @@ -0,0 +1,52 @@ +import 'package:cosmos_sdk/src/models/global_messages/service_empty_response.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/messages/info_by_pool_type.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +/// SetInfoByPoolType sets the pool type information needed to make smart assumptions about swapping on different pool types +class OsmosisProtorevMsgSetInfoByPoolType extends CosmosMessage + with ServiceMessage { + /// [admin] is the account that is authorized to set the pool weights. + final String? admin; + + /// [infoByPoolType] contains information about the pool types. + final OsmosisProtorevInfoByPoolType infoByPoolType; + + const OsmosisProtorevMsgSetInfoByPoolType( + {this.admin, required this.infoByPoolType}); + + factory OsmosisProtorevMsgSetInfoByPoolType.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisProtorevMsgSetInfoByPoolType( + admin: decode.getField(1), + infoByPoolType: + OsmosisProtorevInfoByPoolType.deserialize(decode.getField(2))); + } + + @override + List get fieldIds => [1, 2]; + + @override + Map toJson() { + return {"admin": admin, "info_by_pool_type": infoByPoolType.toJson()}; + } + + @override + String get typeUrl => + OsmosisProtorevV1beta1Types.msgSetInfoByPoolType.typeUrl; + + @override + List get values => [admin, infoByPoolType]; + + @override + EmptyServiceRequestResponse onResponse(List bytes) { + return EmptyServiceRequestResponse( + OsmosisProtorevV1beta1Types.msgSetInfoByPoolTypeResponse.typeUrl); + } + + @override + String get service => OsmosisProtorevV1beta1Types.setInfoByPoolType.typeUrl; + + @override + List get signers => [admin]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/services/msg_set_max_pool_points_per_block.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/services/msg_set_max_pool_points_per_block.dart new file mode 100644 index 0000000..f4e51bb --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/services/msg_set_max_pool_points_per_block.dart @@ -0,0 +1,56 @@ +import 'package:cosmos_sdk/src/models/global_messages/service_empty_response.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +/// MsgSetMaxPoolPointsPerBlock defines the Msg/SetMaxPoolPointsPerBlock request type +class OsmosisProtorevMsgSetMsgSetMaxPoolPointsPerBlock extends CosmosMessage + with ServiceMessage { + /// [admin] is the account that is authorized to set the max pool points per + /// block. + final String? admin; + + /// [maxPoolPointsPerBlock] is the maximum number of pool points that can be + /// consumed per block. + final BigInt? maxPoolPointsPerBlock; + + const OsmosisProtorevMsgSetMsgSetMaxPoolPointsPerBlock( + {this.admin, this.maxPoolPointsPerBlock}); + + factory OsmosisProtorevMsgSetMsgSetMaxPoolPointsPerBlock.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisProtorevMsgSetMsgSetMaxPoolPointsPerBlock( + admin: decode.getField(1), maxPoolPointsPerBlock: decode.getField(2)); + } + + @override + List get fieldIds => [1, 2]; + + @override + Map toJson() { + return { + "admin": admin, + "max_pool_points_per_block": maxPoolPointsPerBlock?.toString() + }; + } + + @override + String get typeUrl => + OsmosisProtorevV1beta1Types.msgSetMaxPoolPointsPerBlock.typeUrl; + + @override + List get values => [admin, maxPoolPointsPerBlock]; + + @override + EmptyServiceRequestResponse onResponse(List bytes) { + return EmptyServiceRequestResponse(OsmosisProtorevV1beta1Types + .msgSetMaxPoolPointsPerBlockResponse.typeUrl); + } + + @override + String get service => + OsmosisProtorevV1beta1Types.setMaxPoolPointsPerBlock.typeUrl; + + @override + List get signers => [admin]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/services/msg_set_max_pool_points_per_tx.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/services/msg_set_max_pool_points_per_tx.dart new file mode 100644 index 0000000..ac10335 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/services/msg_set_max_pool_points_per_tx.dart @@ -0,0 +1,53 @@ +import 'package:cosmos_sdk/src/models/global_messages/service_empty_response.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_protorev_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +class OsmosisProtorevMsgSetMaxPoolPointsPerTx extends CosmosMessage + with ServiceMessage { + /// [admin] is the account that is authorized to set the max pool points per tx. + final String? admin; + + /// [maxPoolPointsPerTx] is the maximum number of pool points that can be + /// consumed per transaction. + final BigInt? maxPoolPointsPerTx; + + const OsmosisProtorevMsgSetMaxPoolPointsPerTx( + {this.admin, this.maxPoolPointsPerTx}); + + factory OsmosisProtorevMsgSetMaxPoolPointsPerTx.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisProtorevMsgSetMaxPoolPointsPerTx( + admin: decode.getField(1), maxPoolPointsPerTx: decode.getField(2)); + } + + @override + List get fieldIds => [1, 2]; + + @override + Map toJson() { + return { + "admin": admin, + "max_pool_points_per_tx": maxPoolPointsPerTx?.toString() + }; + } + + @override + String get typeUrl => + OsmosisProtorevV1beta1Types.msgSetMaxPoolPointsPerTx.typeUrl; + + @override + List get values => [admin, maxPoolPointsPerTx]; + + @override + EmptyServiceRequestResponse onResponse(List bytes) { + return EmptyServiceRequestResponse( + OsmosisProtorevV1beta1Types.msgSetMaxPoolPointsPerTxResponse.typeUrl); + } + + @override + String get service => + OsmosisProtorevV1beta1Types.setMaxPoolPointsPerTx.typeUrl; + + @override + List get signers => [admin]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/types/types.dart b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/types/types.dart new file mode 100644 index 0000000..cd7a660 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_protorev_v1beta1/types/types.dart @@ -0,0 +1,307 @@ +import 'package:cosmos_sdk/src/models/core/type_url/type_url.dart'; + +class OsmosisProtorevV1beta1Types extends TypeUrl { + @override + final String typeUrl; + @override + final String? rpc; + const OsmosisProtorevV1beta1Types._(this.typeUrl, {this.rpc}); + static const OsmosisProtorevV1beta1Types weightMap = + OsmosisProtorevV1beta1Types._("/osmosis.protorev.v1beta1.WeightMap"); + static const OsmosisProtorevV1beta1Types trade = + OsmosisProtorevV1beta1Types._("/osmosis.protorev.v1beta1.Trade"); + + static const OsmosisProtorevV1beta1Types route = + OsmosisProtorevV1beta1Types._("/osmosis.protorev.v1beta1.Route"); + static const OsmosisProtorevV1beta1Types cyclicArbTracker = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.CyclicArbTracker"); + static const OsmosisProtorevV1beta1Types routeStatistics = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.RouteStatistics"); + static const OsmosisProtorevV1beta1Types setProtoRevAdminAccountProposal = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.SetProtoRevAdminAccountProposal"); + static const OsmosisProtorevV1beta1Types setProtoRevEnabledProposal = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.SetProtoRevEnabledProposal"); + static const OsmosisProtorevV1beta1Types tokenPairArbRoutes = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.TokenPairArbRoutes"); + static const OsmosisProtorevV1beta1Types stablePoolInfo = + OsmosisProtorevV1beta1Types._("/osmosis.protorev.v1beta1.StablePoolInfo"); + static const OsmosisProtorevV1beta1Types params = + OsmosisProtorevV1beta1Types._("/osmosis.protorev.v1beta1.Params"); + + static const OsmosisProtorevV1beta1Types poolWeights = + OsmosisProtorevV1beta1Types._("/osmosis.protorev.v1beta1.PoolWeights"); + + static const OsmosisProtorevV1beta1Types balancerPoolInfo = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.BalancerPoolInfo"); + + static const OsmosisProtorevV1beta1Types concentratedPoolInfo = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.ConcentratedPoolInfo"); + + static const OsmosisProtorevV1beta1Types baseDenom = + OsmosisProtorevV1beta1Types._("/osmosis.protorev.v1beta1.BaseDenom"); + static const OsmosisProtorevV1beta1Types cosmwasmPoolInfo = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.CosmwasmPoolInfo"); + static const OsmosisProtorevV1beta1Types infoByPoolType = + OsmosisProtorevV1beta1Types._("/osmosis.protorev.v1beta1.InfoByPoolType"); + + static const OsmosisProtorevV1beta1Types msgSetHotRoutes = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.MsgSetHotRoutes"); + static const OsmosisProtorevV1beta1Types msgSetHotRoutesResponse = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.MsgSetHotRoutesResponse"); + + static const OsmosisProtorevV1beta1Types msgSetDeveloperAccount = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.MsgSetDeveloperAccount"); + static const OsmosisProtorevV1beta1Types msgSetDeveloperAccountResponse = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.MsgSetDeveloperAccountResponse"); + + static const OsmosisProtorevV1beta1Types msgSetMaxPoolPointsPerTx = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.MsgSetMaxPoolPointsPerTx"); + static const OsmosisProtorevV1beta1Types msgSetMaxPoolPointsPerTxResponse = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.MsgSetMaxPoolPointsPerTxResponse"); + + static const OsmosisProtorevV1beta1Types msgSetMaxPoolPointsPerBlock = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.MsgSetMaxPoolPointsPerBlock"); + static const OsmosisProtorevV1beta1Types msgSetMaxPoolPointsPerBlockResponse = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.MsgSetMaxPoolPointsPerBlockResponse"); + + static const OsmosisProtorevV1beta1Types msgSetInfoByPoolType = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.MsgSetInfoByPoolType"); + static const OsmosisProtorevV1beta1Types msgSetInfoByPoolTypeResponse = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.MsgSetInfoByPoolTypeResponse"); + + static const OsmosisProtorevV1beta1Types msgSetBaseDenoms = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.MsgSetBaseDenoms"); + static const OsmosisProtorevV1beta1Types msgSetBaseDenomsResponse = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.MsgSetBaseDenomsResponse"); + + static const OsmosisProtorevV1beta1Types queryParamsRequest = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.QueryParamsRequest"); + static const OsmosisProtorevV1beta1Types queryParamsResponse = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.QueryParamsResponse"); + + static const OsmosisProtorevV1beta1Types + queryGetProtoRevNumberOfTradesRequest = OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.QueryGetProtoRevNumberOfTradesRequest"); + static const OsmosisProtorevV1beta1Types + queryGetProtoRevNumberOfTradesResponse = OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.QueryGetProtoRevNumberOfTradesResponse"); + + static const OsmosisProtorevV1beta1Types + queryGetProtoRevProfitsByDenomRequest = OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.QueryGetProtoRevProfitsByDenomRequest"); + static const OsmosisProtorevV1beta1Types + queryGetProtoRevProfitsByDenomResponse = OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.QueryGetProtoRevProfitsByDenomResponse"); + + static const OsmosisProtorevV1beta1Types queryGetProtoRevAllProfitsRequest = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.QueryGetProtoRevAllProfitsRequest"); + static const OsmosisProtorevV1beta1Types queryGetProtoRevAllProfitsResponse = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.QueryGetProtoRevAllProfitsResponse"); + + static const OsmosisProtorevV1beta1Types + queryGetProtoRevStatisticsByRouteRequest = OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.QueryGetProtoRevStatisticsByRouteRequest"); + static const OsmosisProtorevV1beta1Types + queryGetProtoRevStatisticsByRouteResponse = OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.QueryGetProtoRevStatisticsByRouteResponse"); + + static const OsmosisProtorevV1beta1Types + queryGetProtoRevAllRouteStatisticsRequest = OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.QueryGetProtoRevAllRouteStatisticsRequest"); + static const OsmosisProtorevV1beta1Types + queryGetProtoRevAllRouteStatisticsResponse = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.QueryGetProtoRevAllRouteStatisticsResponse"); + + static const OsmosisProtorevV1beta1Types + queryGetProtoRevTokenPairArbRoutesRequest = OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.QueryGetProtoRevTokenPairArbRoutesRequest"); + static const OsmosisProtorevV1beta1Types + queryGetProtoRevTokenPairArbRoutesResponse = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.QueryGetProtoRevTokenPairArbRoutesResponse"); + + static const OsmosisProtorevV1beta1Types queryGetProtoRevAdminAccountRequest = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.QueryGetProtoRevAdminAccountRequest"); + static const OsmosisProtorevV1beta1Types + queryGetProtoRevAdminAccountResponse = OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.QueryGetProtoRevAdminAccountResponse"); + + static const OsmosisProtorevV1beta1Types + queryGetProtoRevDeveloperAccountRequest = OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.QueryGetProtoRevDeveloperAccountRequest"); + static const OsmosisProtorevV1beta1Types + queryGetProtoRevDeveloperAccountResponse = OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.QueryGetProtoRevDeveloperAccountResponse"); + + static const OsmosisProtorevV1beta1Types + queryGetProtoRevInfoByPoolTypeRequest = OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.QueryGetProtoRevInfoByPoolTypeRequest"); + static const OsmosisProtorevV1beta1Types + queryGetProtoRevInfoByPoolTypeResponse = OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.QueryGetProtoRevInfoByPoolTypeResponse"); + + static const OsmosisProtorevV1beta1Types + queryGetProtoRevMaxPoolPointsPerTxRequest = OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.QueryGetProtoRevMaxPoolPointsPerTxRequest"); + static const OsmosisProtorevV1beta1Types + queryGetProtoRevMaxPoolPointsPerTxResponse = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.QueryGetProtoRevMaxPoolPointsPerTxResponse"); + + static const OsmosisProtorevV1beta1Types + queryGetProtoRevMaxPoolPointsPerBlockRequest = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.QueryGetProtoRevMaxPoolPointsPerBlockRequest"); + static const OsmosisProtorevV1beta1Types + queryGetProtoRevMaxPoolPointsPerBlockResponse = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.QueryGetProtoRevMaxPoolPointsPerBlockResponse"); + + static const OsmosisProtorevV1beta1Types queryGetProtoRevBaseDenomsRequest = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.QueryGetProtoRevBaseDenomsRequest"); + static const OsmosisProtorevV1beta1Types queryGetProtoRevBaseDenomsResponse = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.QueryGetProtoRevBaseDenomsResponse"); + + static const OsmosisProtorevV1beta1Types queryGetProtoRevEnabledRequest = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.QueryGetProtoRevEnabledRequest"); + static const OsmosisProtorevV1beta1Types queryGetProtoRevEnabledResponse = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.QueryGetProtoRevEnabledResponse"); + + static const OsmosisProtorevV1beta1Types queryGetProtoRevPoolRequest = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.QueryGetProtoRevPoolRequest"); + static const OsmosisProtorevV1beta1Types queryGetProtoRevPoolResponse = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.QueryGetProtoRevPoolResponse"); + static const OsmosisProtorevV1beta1Types allProtocolRevenue = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.AllProtocolRevenue"); + static const OsmosisProtorevV1beta1Types queryGetAllProtocolRevenueRequest = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.QueryGetAllProtocolRevenueRequest"); + static const OsmosisProtorevV1beta1Types queryGetAllProtocolRevenueResponse = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.QueryGetAllProtocolRevenueResponse"); + + /// query + static const OsmosisProtorevV1beta1Types getAllProtocolRevenue = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.Query/GetAllProtocolRevenue", + rpc: "/osmosis/protorev/all_protocol_revenue"); + + static const OsmosisProtorevV1beta1Types getProtoRevPool = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.Query/GetProtoRevPool", + rpc: "/osmosis/protorev/pool"); + + static const OsmosisProtorevV1beta1Types getProtoRevEnabled = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.Query/GetProtoRevEnabled", + rpc: "/osmosis/protorev/enabled"); + static const OsmosisProtorevV1beta1Types getProtoRevBaseDenoms = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.Query/GetProtoRevBaseDenoms", + rpc: "/osmosis/protorev/base_denoms"); + + static const OsmosisProtorevV1beta1Types getProtoRevMaxPoolPointsPerBlock = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.Query/GetProtoRevMaxPoolPointsPerBlock", + rpc: "/osmosis/protorev/max_pool_points_per_block"); + + static const OsmosisProtorevV1beta1Types getProtoRevMaxPoolPointsPerTx = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.Query/GetProtoRevMaxPoolPointsPerTx", + rpc: "/osmosis/protorev/max_pool_points_per_tx"); + + static const OsmosisProtorevV1beta1Types getProtoRevInfoByPoolType = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.Query/GetProtoRevInfoByPoolType", + rpc: "/osmosis/protorev/info_by_pool_type"); + static const OsmosisProtorevV1beta1Types getProtoRevDeveloperAccount = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.Query/GetProtoRevDeveloperAccount", + rpc: "/osmosis/protorev/developer_account"); + static const OsmosisProtorevV1beta1Types getProtoRevAdminAccount = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.Query/GetProtoRevAdminAccount", + rpc: "/osmosis/protorev/admin_account"); + static const OsmosisProtorevV1beta1Types getProtoRevTokenPairArbRoutes = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.Query/GetProtoRevTokenPairArbRoutes", + rpc: "/osmosis/protorev/token_pair_arb_routes"); + static const OsmosisProtorevV1beta1Types getProtoRevAllRouteStatistics = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.Query/GetProtoRevAllRouteStatistics", + rpc: "/osmosis/protorev/all_route_statistics"); + + static const OsmosisProtorevV1beta1Types getProtoRevStatisticsByRoute = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.Query/GetProtoRevStatisticsByRoute", + rpc: "/osmosis/protorev/statistics_by_route"); + static const OsmosisProtorevV1beta1Types getProtoRevAllProfits = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.Query/GetProtoRevAllProfits", + rpc: "/osmosis/protorev/all_profits"); + static const OsmosisProtorevV1beta1Types getProtoRevProfitsByDenom = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.Query/GetProtoRevProfitsByDenom", + rpc: "/osmosis/protorev/profits_by_denom"); + static const OsmosisProtorevV1beta1Types getProtoRevNumberOfTrades = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.Query/GetProtoRevNumberOfTrades", + rpc: "/osmosis/protorev/number_of_trades"); + static const OsmosisProtorevV1beta1Types queryParams = + OsmosisProtorevV1beta1Types._("/osmosis.protorev.v1beta1.Query/Params", + rpc: "/osmosis/protorev/params"); + + /// services + static const OsmosisProtorevV1beta1Types setBaseDenoms = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.Msg/SetBaseDenoms"); + static const OsmosisProtorevV1beta1Types setInfoByPoolType = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.Msg/SetInfoByPoolType"); + static const OsmosisProtorevV1beta1Types setMaxPoolPointsPerBlock = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.Msg/SetMaxPoolPointsPerBlock"); + static const OsmosisProtorevV1beta1Types setMaxPoolPointsPerTx = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.Msg/SetMaxPoolPointsPerTx"); + + static const OsmosisProtorevV1beta1Types setDeveloperAccount = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.Msg/SetDeveloperAccount"); + static const OsmosisProtorevV1beta1Types setHotRoutes = + OsmosisProtorevV1beta1Types._( + "/osmosis.protorev.v1beta1.Msg/SetHotRoutes"); +} diff --git a/lib/src/models/networks/osmosis/osmosis_store_v1beta1/messages/child.dart b/lib/src/models/networks/osmosis/osmosis_store_v1beta1/messages/child.dart index c2982a4..8cc9fc7 100644 --- a/lib/src/models/networks/osmosis/osmosis_store_v1beta1/messages/child.dart +++ b/lib/src/models/networks/osmosis/osmosis_store_v1beta1/messages/child.dart @@ -1,6 +1,6 @@ import 'package:blockchain_utils/binary/utils.dart'; -import 'package:cosmos_sdk/cosmos_sdk.dart'; import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_store_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; class OsmosisStoreChild extends CosmosMessage { final List? index; 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 index d8bd19a..304f5df 100644 --- 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 @@ -1,3 +1,4 @@ +import 'package:blockchain_utils/bip/electrum/mnemonic_v1/wrodlist/languages.dart'; 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'; @@ -64,6 +65,12 @@ class OsmosisSuperfluidConcentratedPoolUserPositionRecord OsmosisSuperfluidTypes.concentratedPoolUserPositionRecord.typeUrl; @override - List get values => - [validatorAddress, positionId, lockId, syntheticLock, delegationAmount]; + List get values => [ + validatorAddress, + positionId, + lockId, + syntheticLock, + delegationAmount, + elctrumMnemonicWordsList + ]; } 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 deleted file mode 100644 index e69de29..0000000 diff --git a/lib/src/models/networks/osmosis/osmosis_twap_v1beta1/messages/params.dart b/lib/src/models/networks/osmosis/osmosis_twap_v1beta1/messages/params.dart index 3160238..f1560cc 100644 --- a/lib/src/models/networks/osmosis/osmosis_twap_v1beta1/messages/params.dart +++ b/lib/src/models/networks/osmosis/osmosis_twap_v1beta1/messages/params.dart @@ -1,5 +1,5 @@ -import 'package:cosmos_sdk/cosmos_sdk.dart'; import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_twap_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; /// Params holds parameters for the twap module. class OsmosisTwapParams extends CosmosMessage { diff --git a/lib/src/models/networks/osmosis/osmosis_twap_v1beta1/messages/twap_record.dart b/lib/src/models/networks/osmosis/osmosis_twap_v1beta1/messages/twap_record.dart index f3311e4..d85e693 100644 --- a/lib/src/models/networks/osmosis/osmosis_twap_v1beta1/messages/twap_record.dart +++ b/lib/src/models/networks/osmosis/osmosis_twap_v1beta1/messages/twap_record.dart @@ -1,5 +1,5 @@ -import 'package:cosmos_sdk/cosmos_sdk.dart'; import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_twap_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; /// A TWAP record should be indexed in state by pool_id, (asset pair), timestamp The asset /// pair assets should be lexicographically sorted. Technically (pool_id, asset_0_denom, diff --git a/lib/src/models/networks/osmosis/osmosis_txfees_v1beta1/messages/fee_token.dart b/lib/src/models/networks/osmosis/osmosis_txfees_v1beta1/messages/fee_token.dart index 53e18e6..4948641 100644 --- a/lib/src/models/networks/osmosis/osmosis_txfees_v1beta1/messages/fee_token.dart +++ b/lib/src/models/networks/osmosis/osmosis_txfees_v1beta1/messages/fee_token.dart @@ -1,5 +1,5 @@ -import 'package:cosmos_sdk/cosmos_sdk.dart'; import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_txfees_v1beta1/type/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; /// FeeToken is a struct that specifies a coin denom, and pool ID pair. /// This marks the token as eligible for use as a tx fee asset in Osmosis. diff --git a/lib/src/models/networks/osmosis/osmosis_txfees_v1beta1/messages/tx_fees_tracker.dart b/lib/src/models/networks/osmosis/osmosis_txfees_v1beta1/messages/tx_fees_tracker.dart new file mode 100644 index 0000000..8492c9c --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_txfees_v1beta1/messages/tx_fees_tracker.dart @@ -0,0 +1,45 @@ +import 'package:blockchain_utils/numbers/numbers.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_txfees_v1beta1/type/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 OsmosisTxfeesTxFeesTracker extends CosmosMessage { + final List txFees; + final BigInt? heightAccountingStartsFrom; + OsmosisTxfeesTxFeesTracker( + {required List txFees, this.heightAccountingStartsFrom}) + : txFees = txFees.mutable; + factory OsmosisTxfeesTxFeesTracker.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisTxfeesTxFeesTracker( + txFees: decode.getFields(1).map((e) => Coin.deserialize(e)).toList(), + heightAccountingStartsFrom: decode.getField(2), + ); + } + factory OsmosisTxfeesTxFeesTracker.fromRpc(Map json) { + return OsmosisTxfeesTxFeesTracker( + txFees: + (json["tx_fees"] as List?)?.map((e) => Coin.fromRpc(e)).toList() ?? + [], + heightAccountingStartsFrom: + BigintUtils.tryParse(json["height_accounting_starts_from"])); + } + + @override + List get fieldIds => [1, 2]; + + @override + Map toJson() { + return { + "height_accounting_starts_from": heightAccountingStartsFrom?.toString(), + "pootx_feeslID": txFees.map((e) => e.toJson()).toList() + }; + } + + @override + String get typeUrl => OsmosisTxfeesV1beta1Types.txFeesTracker.typeUrl; + + @override + List get values => [txFees, heightAccountingStartsFrom]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_txfees_v1beta1/query/query_denom_pool_id_response.dart b/lib/src/models/networks/osmosis/osmosis_txfees_v1beta1/query/query_denom_pool_id_response.dart index aa3f4de..5637cd5 100644 --- a/lib/src/models/networks/osmosis/osmosis_txfees_v1beta1/query/query_denom_pool_id_response.dart +++ b/lib/src/models/networks/osmosis/osmosis_txfees_v1beta1/query/query_denom_pool_id_response.dart @@ -1,6 +1,6 @@ import 'package:blockchain_utils/numbers/numbers.dart'; -import 'package:cosmos_sdk/cosmos_sdk.dart'; import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_txfees_v1beta1/type/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; class OsmosisTxfeesQueryDenomPoolIdResponse extends CosmosMessage { final BigInt? poolID; diff --git a/lib/src/models/networks/osmosis/osmosis_txfees_v1beta1/type/types.dart b/lib/src/models/networks/osmosis/osmosis_txfees_v1beta1/type/types.dart index aeab53d..978ab68 100644 --- a/lib/src/models/networks/osmosis/osmosis_txfees_v1beta1/type/types.dart +++ b/lib/src/models/networks/osmosis/osmosis_txfees_v1beta1/type/types.dart @@ -9,6 +9,8 @@ class OsmosisTxfeesV1beta1Types extends TypeUrl { static const OsmosisTxfeesV1beta1Types updateFeeTokenProposal = OsmosisTxfeesV1beta1Types._( "/osmosis.txfees.v1beta1.UpdateFeeTokenProposal"); + static const OsmosisTxfeesV1beta1Types txFeesTracker = + OsmosisTxfeesV1beta1Types._("/osmosis.txfees.v1beta1.TxFeesTracker"); static const OsmosisTxfeesV1beta1Types feeToken = OsmosisTxfeesV1beta1Types._("/osmosis.txfees.v1beta1.FeeToken"); static const OsmosisTxfeesV1beta1Types genesisState = diff --git a/lib/src/models/networks/osmosis/osmosis_validator_preference_v1beta1/messages/validator_preference.dart b/lib/src/models/networks/osmosis/osmosis_validator_preference_v1beta1/messages/validator_preference.dart index 8fa669c..6325a20 100644 --- a/lib/src/models/networks/osmosis/osmosis_validator_preference_v1beta1/messages/validator_preference.dart +++ b/lib/src/models/networks/osmosis/osmosis_validator_preference_v1beta1/messages/validator_preference.dart @@ -1,5 +1,5 @@ -import 'package:cosmos_sdk/cosmos_sdk.dart'; import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_validator_preference_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; /// ValidatorPreference defines the message structure for CreateValidatorSetPreference. /// It allows a user to set {val_addr, weight} in state. If a user does not have a validator diff --git a/lib/src/models/networks/osmosis/osmosis_valsetpref_v1beta1/messages/validator_preference.dart b/lib/src/models/networks/osmosis/osmosis_valsetpref_v1beta1/messages/validator_preference.dart new file mode 100644 index 0000000..aac2859 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_valsetpref_v1beta1/messages/validator_preference.dart @@ -0,0 +1,43 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_valsetpref_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +/// ValidatorPreference defines the message structure for CreateValidatorSetPreference. +/// It allows a user to set {val_addr, weight} in state. If a user does not have a +/// validator set preference list set, and has staked, make their preference +/// list default to their current staking distribution. +class OsmosisValSetprefValidatorPreference extends CosmosMessage { + /// val_oper_address holds the validator address the user wants to delegate + /// funds to. + final String? valOperAddress; + + /// weight is decimal between 0 and 1, and they all sum to 1. + final String weight; + + const OsmosisValSetprefValidatorPreference( + {this.valOperAddress, required this.weight}); + factory OsmosisValSetprefValidatorPreference.deserialize(List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisValSetprefValidatorPreference( + weight: decode.getField(2), valOperAddress: decode.getField(1)); + } + factory OsmosisValSetprefValidatorPreference.fromRpc( + Map json) { + return OsmosisValSetprefValidatorPreference( + weight: json["weight"], valOperAddress: json["val_oper_address"]); + } + + @override + List get fieldIds => [1, 2]; + + @override + Map toJson() { + return {"val_oper_address": valOperAddress, "weight": weight}; + } + + @override + String get typeUrl => + OsmosisValSetprefV1beta1Types.validatorPreference.typeUrl; + + @override + List get values => [valOperAddress, weight]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_valsetpref_v1beta1/messages/validator_set_preferences.dart b/lib/src/models/networks/osmosis/osmosis_valsetpref_v1beta1/messages/validator_set_preferences.dart new file mode 100644 index 0000000..6dbd202 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_valsetpref_v1beta1/messages/validator_set_preferences.dart @@ -0,0 +1,38 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_valsetpref_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; +import 'validator_preference.dart'; + +/// ValidatorSetPreferences defines a delegator's validator set preference. It contains a +/// list of (validator, percent_allocation) pairs. The percent allocation are arranged in +/// decimal notation from 0 to 1 and must add up to 1. +class OsmosisValSetprefValidatorSetPreferences extends CosmosMessage { + /// preference holds {valAddr, weight} for the user who created it. + final List preferences; + OsmosisValSetprefValidatorSetPreferences( + List preferences) + : preferences = preferences.mutable; + factory OsmosisValSetprefValidatorSetPreferences.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisValSetprefValidatorSetPreferences(decode + .getFields(1) + .map((e) => OsmosisValSetprefValidatorPreference.deserialize(e)) + .toList()); + } + + @override + List get fieldIds => [2]; + + @override + Map toJson() { + return {"preferences": preferences.map((e) => e.toJson()).toList()}; + } + + @override + String get typeUrl => + OsmosisValSetprefV1beta1Types.validatorSetPreferences.typeUrl; + + @override + List get values => [preferences]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_valsetpref_v1beta1/osmosis_valsetpref_v1beta1.dart b/lib/src/models/networks/osmosis/osmosis_valsetpref_v1beta1/osmosis_valsetpref_v1beta1.dart new file mode 100644 index 0000000..9c43dbb --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_valsetpref_v1beta1/osmosis_valsetpref_v1beta1.dart @@ -0,0 +1,12 @@ +export 'messages/validator_preference.dart'; +export 'messages/validator_set_preferences.dart'; +export 'services/delegate_bonded_tokens.dart'; +export 'services/delegate_to_validator_set.dart'; +export 'services/msg_withdraw_delegation_rewards.dart'; +export 'services/redelegate_validator_set.dart'; +export 'services/set_validator_set_preference.dart'; +export 'services/undelegate_from_rebalanced_validator_set.dart'; +export 'services/undelegate_from_validator_set.dart'; + +export 'query/user_validator_preferences_request.dart'; +export 'query/user_validator_preferences_response.dart'; diff --git a/lib/src/models/networks/osmosis/osmosis_valsetpref_v1beta1/query/user_validator_preferences_request.dart b/lib/src/models/networks/osmosis/osmosis_valsetpref_v1beta1/query/user_validator_preferences_request.dart new file mode 100644 index 0000000..d4f02b3 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_valsetpref_v1beta1/query/user_validator_preferences_request.dart @@ -0,0 +1,63 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_valsetpref_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +import 'user_validator_preferences_response.dart'; + +/// Request type for UserValidatorPreferences. +class OsmosisValSetprefUserValidatorPreferencesRequest extends CosmosMessage + with + RPCMessage, + QueryMessage { + /// user account address + final String? address; + OsmosisValSetprefUserValidatorPreferencesRequest({this.address}); + factory OsmosisValSetprefUserValidatorPreferencesRequest.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisValSetprefUserValidatorPreferencesRequest( + address: decode.getField(1)); + } + factory OsmosisValSetprefUserValidatorPreferencesRequest.fromRpc( + Map json) { + return OsmosisValSetprefUserValidatorPreferencesRequest( + address: json["address"]); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"address": address}; + } + + @override + String get typeUrl => + OsmosisValSetprefV1beta1Types.userValidatorPreferencesRequest.typeUrl; + + @override + List get values => [address]; + + @override + OsmosisValSetprefUserValidatorPreferencesResponse onJsonResponse( + Map json) { + return OsmosisValSetprefUserValidatorPreferencesResponse.fromRpc(json); + } + + @override + OsmosisValSetprefUserValidatorPreferencesResponse onResponse( + List bytes) { + return OsmosisValSetprefUserValidatorPreferencesResponse.deserialize(bytes); + } + + @override + Map get queryParameters => {}; + + @override + String get queryPath => OsmosisValSetprefV1beta1Types.userValidatorPreferences + .rpcUrl(pathParameters: [address]); + + @override + String get rpcPath => + OsmosisValSetprefV1beta1Types.userValidatorPreferences.typeUrl; +} diff --git a/lib/src/models/networks/osmosis/osmosis_valsetpref_v1beta1/query/user_validator_preferences_response.dart b/lib/src/models/networks/osmosis/osmosis_valsetpref_v1beta1/query/user_validator_preferences_response.dart new file mode 100644 index 0000000..45c17b1 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_valsetpref_v1beta1/query/user_validator_preferences_response.dart @@ -0,0 +1,44 @@ +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_valsetpref_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; + +import '../messages/validator_preference.dart'; + +/// Response type the QueryUserValidatorPreferences query request +class OsmosisValSetprefUserValidatorPreferencesResponse extends CosmosMessage { + final List preferences; + OsmosisValSetprefUserValidatorPreferencesResponse( + List preferences) + : preferences = preferences.mutable; + factory OsmosisValSetprefUserValidatorPreferencesResponse.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisValSetprefUserValidatorPreferencesResponse(decode + .getFields(1) + .map((e) => OsmosisValSetprefValidatorPreference.deserialize(e)) + .toList()); + } + factory OsmosisValSetprefUserValidatorPreferencesResponse.fromRpc( + Map json) { + return OsmosisValSetprefUserValidatorPreferencesResponse( + (json["preferences"] as List?) + ?.map((e) => OsmosisValSetprefValidatorPreference.fromRpc(e)) + .toList() ?? + []); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"preferences": preferences.map((e) => e.toJson()).toList()}; + } + + @override + String get typeUrl => + OsmosisValSetprefV1beta1Types.userValidatorPreferencesResponse.typeUrl; + + @override + List get values => [preferences]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_valsetpref_v1beta1/services/delegate_bonded_tokens.dart b/lib/src/models/networks/osmosis/osmosis_valsetpref_v1beta1/services/delegate_bonded_tokens.dart new file mode 100644 index 0000000..34d2cf4 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_valsetpref_v1beta1/services/delegate_bonded_tokens.dart @@ -0,0 +1,57 @@ +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_valsetpref_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +/// MsgDelegateBondedTokens breaks bonded lockup (by ID) of osmo, of length <= 2 weeks and takes all +/// that osmo and delegates according to delegator's current validator set preference. +class OsmosisValSetprefMsgDelegateBondedTokens extends CosmosMessage + with ServiceMessage { + /// delegator is the user who is trying to force unbond osmo and delegate + final String? delegator; + + /// lockup id of osmo in the pool + final BigInt? lockId; + + OsmosisValSetprefMsgDelegateBondedTokens({this.delegator, this.lockId}); + factory OsmosisValSetprefMsgDelegateBondedTokens.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisValSetprefMsgDelegateBondedTokens( + delegator: decode.getField(1), lockId: decode.getField(2)); + } + factory OsmosisValSetprefMsgDelegateBondedTokens.fromRpc( + Map json) { + return OsmosisValSetprefMsgDelegateBondedTokens( + delegator: json["delegator"], + lockId: BigintUtils.tryParse(json["lockID"])); + } + + @override + List get fieldIds => [1, 2]; + + @override + Map toJson() { + return {"delegator": delegator, "lockID": lockId?.toString()}; + } + + @override + String get typeUrl => + OsmosisValSetprefV1beta1Types.msgDelegateBondedTokens.typeUrl; + + @override + List get values => [delegator, lockId]; + + @override + EmptyServiceRequestResponse onResponse(List bytes) { + return EmptyServiceRequestResponse( + OsmosisValSetprefV1beta1Types.msgDelegateBondedTokensResponse.typeUrl); + } + + @override + String get service => + OsmosisValSetprefV1beta1Types.delegateBondedTokens.typeUrl; + + @override + List get signers => [delegator]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_valsetpref_v1beta1/services/delegate_to_validator_set.dart b/lib/src/models/networks/osmosis/osmosis_valsetpref_v1beta1/services/delegate_to_validator_set.dart new file mode 100644 index 0000000..2fa1306 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_valsetpref_v1beta1/services/delegate_to_validator_set.dart @@ -0,0 +1,58 @@ +import 'package:cosmos_sdk/src/models/global_messages/service_empty_response.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_valsetpref_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'; + +/// DelegateToValidatorSet gets the owner, coins and delegates to a validator-set. +class OsmosisValSetprefMsgDelegateToValidatorSet extends CosmosMessage + with ServiceMessage { + /// delegator is the user who is trying to delegate. + final String? delegator; + + /// list of {valAddr, weight} to delegate to + final Coin coin; + + OsmosisValSetprefMsgDelegateToValidatorSet( + {this.delegator, required this.coin}); + factory OsmosisValSetprefMsgDelegateToValidatorSet.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisValSetprefMsgDelegateToValidatorSet( + delegator: decode.getField(1), + coin: Coin.deserialize(decode.getField(2)), + ); + } + factory OsmosisValSetprefMsgDelegateToValidatorSet.fromRpc( + Map json) { + return OsmosisValSetprefMsgDelegateToValidatorSet( + delegator: json["delegator"], coin: Coin.fromRpc(json["coin"])); + } + + @override + List get fieldIds => [1, 2]; + + @override + Map toJson() { + return {"delegator": delegator, "coin": coin.toJson()}; + } + + @override + String get typeUrl => + OsmosisValSetprefV1beta1Types.msgDelegateToValidatorSet.typeUrl; + + @override + List get values => [delegator, coin]; + + @override + EmptyServiceRequestResponse onResponse(List bytes) { + return EmptyServiceRequestResponse(OsmosisValSetprefV1beta1Types + .msgDelegateToValidatorSetResponse.typeUrl); + } + + @override + String get service => + OsmosisValSetprefV1beta1Types.delegateToValidatorSet.typeUrl; + + @override + List get signers => [delegator]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_valsetpref_v1beta1/services/msg_withdraw_delegation_rewards.dart b/lib/src/models/networks/osmosis/osmosis_valsetpref_v1beta1/services/msg_withdraw_delegation_rewards.dart new file mode 100644 index 0000000..f41700b --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_valsetpref_v1beta1/services/msg_withdraw_delegation_rewards.dart @@ -0,0 +1,50 @@ +import 'package:cosmos_sdk/src/models/global_messages/service_empty_response.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_valsetpref_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; + +class OsmosisValSetprefMsgWithdrawDelegationRewards extends CosmosMessage + with ServiceMessage { + /// delegator is the user who is trying to claim staking rewards. + final String? delegator; + + OsmosisValSetprefMsgWithdrawDelegationRewards({this.delegator}); + factory OsmosisValSetprefMsgWithdrawDelegationRewards.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisValSetprefMsgWithdrawDelegationRewards( + delegator: decode.getField(1)); + } + factory OsmosisValSetprefMsgWithdrawDelegationRewards.fromRpc( + Map json) { + return OsmosisValSetprefMsgWithdrawDelegationRewards( + delegator: json["delegator"]); + } + + @override + List get fieldIds => [1]; + + @override + Map toJson() { + return {"delegator": delegator}; + } + + @override + String get typeUrl => + OsmosisValSetprefV1beta1Types.msgWithdrawDelegationRewards.typeUrl; + + @override + List get values => [delegator]; + + @override + EmptyServiceRequestResponse onResponse(List bytes) { + return EmptyServiceRequestResponse(OsmosisValSetprefV1beta1Types + .msgWithdrawDelegationRewardsResponse.typeUrl); + } + + @override + String get service => + OsmosisValSetprefV1beta1Types.withdrawDelegationRewards.typeUrl; + + @override + List get signers => [delegator]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_valsetpref_v1beta1/services/redelegate_validator_set.dart b/lib/src/models/networks/osmosis/osmosis_valsetpref_v1beta1/services/redelegate_validator_set.dart new file mode 100644 index 0000000..b39c432 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_valsetpref_v1beta1/services/redelegate_validator_set.dart @@ -0,0 +1,71 @@ +import 'package:cosmos_sdk/src/models/global_messages/service_empty_response.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_valsetpref_v1beta1/messages/validator_preference.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_valsetpref_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; + +class OsmosisValSetprefMsgRedelegateValidatorSet extends CosmosMessage + with ServiceMessage { + /// delegator is the user who is trying to create a validator-set. + final String? delegator; + + /// list of {valAddr, weight} to delegate to + final List preferences; + + OsmosisValSetprefMsgRedelegateValidatorSet( + {this.delegator, + required List preferences}) + : preferences = preferences.mutable; + factory OsmosisValSetprefMsgRedelegateValidatorSet.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisValSetprefMsgRedelegateValidatorSet( + delegator: decode.getField(1), + preferences: decode + .getFields(2) + .map((e) => OsmosisValSetprefValidatorPreference.deserialize(e)) + .toList(), + ); + } + factory OsmosisValSetprefMsgRedelegateValidatorSet.fromRpc( + Map json) { + return OsmosisValSetprefMsgRedelegateValidatorSet( + delegator: json["delegator"], + preferences: (json["preferences"] as List?) + ?.map( + (e) => OsmosisValSetprefValidatorPreference.deserialize(e)) + .toList() ?? + []); + } + + @override + List get fieldIds => [1, 2]; + + @override + Map toJson() { + return { + "delegator": delegator, + "preferences": preferences.map((e) => e.toJson()).toList() + }; + } + + @override + String get typeUrl => + OsmosisValSetprefV1beta1Types.msgRedelegateValidatorSet.typeUrl; + + @override + List get values => [delegator, preferences]; + + @override + EmptyServiceRequestResponse onResponse(List bytes) { + return EmptyServiceRequestResponse(OsmosisValSetprefV1beta1Types + .msgRedelegateValidatorSetResponse.typeUrl); + } + + @override + String get service => + OsmosisValSetprefV1beta1Types.redelegateValidatorSet.typeUrl; + + @override + List get signers => [delegator]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_valsetpref_v1beta1/services/set_validator_set_preference.dart b/lib/src/models/networks/osmosis/osmosis_valsetpref_v1beta1/services/set_validator_set_preference.dart new file mode 100644 index 0000000..fb64c8e --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_valsetpref_v1beta1/services/set_validator_set_preference.dart @@ -0,0 +1,72 @@ +import 'package:cosmos_sdk/src/models/global_messages/service_empty_response.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_valsetpref_v1beta1/messages/validator_preference.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_valsetpref_v1beta1/types/types.dart'; +import 'package:cosmos_sdk/src/protobuf/protobuf.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; + +/// MsgCreateValidatorSetPreference is a list that holds validator-set. +class OsmosisValSetprefMsgSetValidatorSetPreference extends CosmosMessage + with ServiceMessage { + /// delegator is the user who is trying to create a validator-set. + final String? delegator; + + /// list of {valAddr, weight} to delegate to + final List preferences; + + OsmosisValSetprefMsgSetValidatorSetPreference( + {this.delegator, + required List preferences}) + : preferences = preferences.mutable; + factory OsmosisValSetprefMsgSetValidatorSetPreference.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisValSetprefMsgSetValidatorSetPreference( + delegator: decode.getField(1), + preferences: decode + .getFields(2) + .map((e) => OsmosisValSetprefValidatorPreference.deserialize(e)) + .toList(), + ); + } + factory OsmosisValSetprefMsgSetValidatorSetPreference.fromRpc( + Map json) { + return OsmosisValSetprefMsgSetValidatorSetPreference( + delegator: json["delegator"], + preferences: (json["preferences"] as List?) + ?.map((e) => OsmosisValSetprefValidatorPreference.fromRpc(e)) + .toList() ?? + [], + ); + } + + @override + List get fieldIds => [1, 2]; + + @override + Map toJson() { + return { + "delegator": delegator, + "preferences": preferences.map((e) => e.toJson()).toList() + }; + } + + @override + String get typeUrl => + OsmosisValSetprefV1beta1Types.msgSetValidatorSetPreference.typeUrl; + + @override + List get values => [delegator, preferences]; + + @override + EmptyServiceRequestResponse onResponse(List bytes) { + return EmptyServiceRequestResponse(OsmosisValSetprefV1beta1Types + .msgSetValidatorSetPreferenceResponse.typeUrl); + } + + @override + String get service => + OsmosisValSetprefV1beta1Types.setValidatorSetPreference.typeUrl; + + @override + List get signers => [delegator]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_valsetpref_v1beta1/services/undelegate_from_rebalanced_validator_set.dart b/lib/src/models/networks/osmosis/osmosis_valsetpref_v1beta1/services/undelegate_from_rebalanced_validator_set.dart new file mode 100644 index 0000000..0926351 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_valsetpref_v1beta1/services/undelegate_from_rebalanced_validator_set.dart @@ -0,0 +1,63 @@ +import 'package:cosmos_sdk/src/models/global_messages/service_empty_response.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_valsetpref_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'; + +class OsmosisValSetprefMsgUndelegateFromRebalancedValidatorSet + extends CosmosMessage with ServiceMessage { + /// delegator is the user who is trying to delegate. + final String? delegator; + + /// the amount the user wants to undelegate + /// For ex: Undelegate 50 osmo with validator-set {ValA -> 0.5, ValB -> 0.5} + /// Our undelegate logic would first check the current delegation balance. + /// If the user has 90 osmo delegated to ValA and 10 osmo delegated to ValB, + /// the rebalanced validator set would be {ValA -> 0.9, ValB -> 0.1} + /// So now the 45 osmo would be undelegated from ValA and 5 osmo would be + /// undelegated from ValB. + final Coin coin; + + OsmosisValSetprefMsgUndelegateFromRebalancedValidatorSet( + {this.delegator, required this.coin}); + factory OsmosisValSetprefMsgUndelegateFromRebalancedValidatorSet.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisValSetprefMsgUndelegateFromRebalancedValidatorSet( + delegator: decode.getField(1), + coin: Coin.deserialize(decode.getField(2)), + ); + } + factory OsmosisValSetprefMsgUndelegateFromRebalancedValidatorSet.fromRpc( + Map json) { + return OsmosisValSetprefMsgUndelegateFromRebalancedValidatorSet( + delegator: json["delegator"], coin: Coin.fromRpc(json["coin"])); + } + + @override + List get fieldIds => [1, 2]; + + @override + Map toJson() { + return {"delegator": delegator, "coin": coin.toJson()}; + } + + @override + String get typeUrl => OsmosisValSetprefV1beta1Types + .msgUndelegateFromRebalancedValidatorSet.typeUrl; + + @override + List get values => [delegator, coin]; + + @override + EmptyServiceRequestResponse onResponse(List bytes) { + return EmptyServiceRequestResponse(OsmosisValSetprefV1beta1Types + .msgUndelegateFromRebalancedValidatorSetResponse.typeUrl); + } + + @override + String get service => OsmosisValSetprefV1beta1Types + .undelegateFromRebalancedValidatorSet.typeUrl; + + @override + List get signers => [delegator]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_valsetpref_v1beta1/services/undelegate_from_validator_set.dart b/lib/src/models/networks/osmosis/osmosis_valsetpref_v1beta1/services/undelegate_from_validator_set.dart new file mode 100644 index 0000000..b58b2a1 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_valsetpref_v1beta1/services/undelegate_from_validator_set.dart @@ -0,0 +1,63 @@ +import 'package:cosmos_sdk/src/models/global_messages/service_empty_response.dart'; +import 'package:cosmos_sdk/src/models/networks/osmosis/osmosis_valsetpref_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'; + +/// UndelegateFromValidatorSet gets the owner and coins and undelegates from validator-set. +/// The unbonding logic will follow the Undelegate logic from the sdk. +class OsmosisValSetprefMsgUndelegateFromValidatorSet extends CosmosMessage + with ServiceMessage { + /// delegator is the user who is trying to delegate. + final String? delegator; + + /// the amount the user wants to undelegate + /// For ex: Undelegate 10osmo with validator-set {ValA -> 0.5, ValB -> 0.3, + /// ValC + /// -> 0.2} our undelegate logic would attempt to undelegate 5osmo from A , + /// 3osmo from B, 2osmo from C + final Coin coin; + + OsmosisValSetprefMsgUndelegateFromValidatorSet( + {this.delegator, required this.coin}); + factory OsmosisValSetprefMsgUndelegateFromValidatorSet.deserialize( + List bytes) { + final decode = CosmosProtocolBuffer.decode(bytes); + return OsmosisValSetprefMsgUndelegateFromValidatorSet( + delegator: decode.getField(1), + coin: Coin.deserialize(decode.getField(3)), + ); + } + factory OsmosisValSetprefMsgUndelegateFromValidatorSet.fromRpc( + Map json) { + return OsmosisValSetprefMsgUndelegateFromValidatorSet( + delegator: json["delegator"], coin: Coin.fromRpc(json["coin"])); + } + + @override + List get fieldIds => [1, 3]; + + @override + Map toJson() { + return {"delegator": delegator, "coin": coin.toJson()}; + } + + @override + String get typeUrl => + OsmosisValSetprefV1beta1Types.msgUndelegateFromValidatorSet.typeUrl; + + @override + List get values => [delegator, coin]; + + @override + EmptyServiceRequestResponse onResponse(List bytes) { + return EmptyServiceRequestResponse(OsmosisValSetprefV1beta1Types + .msgUndelegateFromValidatorSetResponse.typeUrl); + } + + @override + String get service => + OsmosisValSetprefV1beta1Types.undelegateFromValidatorSet.typeUrl; + + @override + List get signers => [delegator]; +} diff --git a/lib/src/models/networks/osmosis/osmosis_valsetpref_v1beta1/types/types.dart b/lib/src/models/networks/osmosis/osmosis_valsetpref_v1beta1/types/types.dart new file mode 100644 index 0000000..1565732 --- /dev/null +++ b/lib/src/models/networks/osmosis/osmosis_valsetpref_v1beta1/types/types.dart @@ -0,0 +1,103 @@ +import 'package:cosmos_sdk/src/models/core/type_url/type_url.dart'; + +class OsmosisValSetprefV1beta1Types extends TypeUrl { + @override + final String typeUrl; + @override + final String? rpc; + const OsmosisValSetprefV1beta1Types._(this.typeUrl, {this.rpc}); + static const OsmosisValSetprefV1beta1Types validatorPreference = + OsmosisValSetprefV1beta1Types._( + "/osmosis.valsetpref.v1beta1.ValidatorPreference"); + + static const OsmosisValSetprefV1beta1Types validatorSetPreferences = + OsmosisValSetprefV1beta1Types._( + "/osmosis.valsetpref.v1beta1.ValidatorSetPreferences"); + static const OsmosisValSetprefV1beta1Types userValidatorPreferencesResponse = + OsmosisValSetprefV1beta1Types._( + "/osmosis.valsetpref.v1beta1.UserValidatorPreferencesResponse"); + + static const OsmosisValSetprefV1beta1Types msgSetValidatorSetPreference = + OsmosisValSetprefV1beta1Types._( + "/osmosis.valsetpref.v1beta1.MsgSetValidatorSetPreference"); + static const OsmosisValSetprefV1beta1Types + msgSetValidatorSetPreferenceResponse = OsmosisValSetprefV1beta1Types._( + "/osmosis.valsetpref.v1beta1.MsgSetValidatorSetPreferenceResponse"); + + static const OsmosisValSetprefV1beta1Types msgDelegateToValidatorSet = + OsmosisValSetprefV1beta1Types._( + "/osmosis.valsetpref.v1beta1.MsgDelegateToValidatorSet"); + static const OsmosisValSetprefV1beta1Types msgDelegateToValidatorSetResponse = + OsmosisValSetprefV1beta1Types._( + "/osmosis.valsetpref.v1beta1.MsgDelegateToValidatorSetResponse"); + + static const OsmosisValSetprefV1beta1Types msgUndelegateFromValidatorSet = + OsmosisValSetprefV1beta1Types._( + "/osmosis.valsetpref.v1beta1.MsgUndelegateFromValidatorSet"); + static const OsmosisValSetprefV1beta1Types + msgUndelegateFromValidatorSetResponse = OsmosisValSetprefV1beta1Types._( + "/osmosis.valsetpref.v1beta1.MsgUndelegateFromValidatorSetResponse"); + + static const OsmosisValSetprefV1beta1Types + msgUndelegateFromRebalancedValidatorSet = OsmosisValSetprefV1beta1Types._( + "/osmosis.valsetpref.v1beta1.MsgUndelegateFromRebalancedValidatorSet"); + static const OsmosisValSetprefV1beta1Types + msgUndelegateFromRebalancedValidatorSetResponse = + OsmosisValSetprefV1beta1Types._( + "/osmosis.valsetpref.v1beta1.MsgUndelegateFromRebalancedValidatorSetResponse"); + + static const OsmosisValSetprefV1beta1Types msgRedelegateValidatorSet = + OsmosisValSetprefV1beta1Types._( + "/osmosis.valsetpref.v1beta1.MsgRedelegateValidatorSet"); + static const OsmosisValSetprefV1beta1Types msgRedelegateValidatorSetResponse = + OsmosisValSetprefV1beta1Types._( + "/osmosis.valsetpref.v1beta1.MsgRedelegateValidatorSetResponse"); + + static const OsmosisValSetprefV1beta1Types msgWithdrawDelegationRewards = + OsmosisValSetprefV1beta1Types._( + "/osmosis.valsetpref.v1beta1.MsgWithdrawDelegationRewards"); + static const OsmosisValSetprefV1beta1Types + msgWithdrawDelegationRewardsResponse = OsmosisValSetprefV1beta1Types._( + "/osmosis.valsetpref.v1beta1.MsgWithdrawDelegationRewardsResponse"); + + static const OsmosisValSetprefV1beta1Types msgDelegateBondedTokens = + OsmosisValSetprefV1beta1Types._( + "/osmosis.valsetpref.v1beta1.MsgDelegateBondedTokens"); + static const OsmosisValSetprefV1beta1Types msgDelegateBondedTokensResponse = + OsmosisValSetprefV1beta1Types._( + "/osmosis.valsetpref.v1beta1.MsgDelegateBondedTokensResponse"); + + static const OsmosisValSetprefV1beta1Types userValidatorPreferencesRequest = + OsmosisValSetprefV1beta1Types._( + "/osmosis.valsetpref.v1beta1.UserValidatorPreferencesRequest"); + + /// query + static const OsmosisValSetprefV1beta1Types userValidatorPreferences = + OsmosisValSetprefV1beta1Types._( + "/osmosis.valsetpref.v1beta1.Query/UserValidatorPreferences", + rpc: "/osmosis/valset-pref/v1beta1/:address"); + + /// services + static const OsmosisValSetprefV1beta1Types delegateBondedTokens = + OsmosisValSetprefV1beta1Types._( + "/osmosis.valsetpref.v1beta1.Msg/DelegateBondedTokens"); + static const OsmosisValSetprefV1beta1Types withdrawDelegationRewards = + OsmosisValSetprefV1beta1Types._( + "/osmosis.valsetpref.v1beta1.Msg/WithdrawDelegationRewards"); + static const OsmosisValSetprefV1beta1Types redelegateValidatorSet = + OsmosisValSetprefV1beta1Types._( + "/osmosis.valsetpref.v1beta1.Msg/RedelegateValidatorSet"); + static const OsmosisValSetprefV1beta1Types + undelegateFromRebalancedValidatorSet = OsmosisValSetprefV1beta1Types._( + "/osmosis.valsetpref.v1beta1.Msg/UndelegateFromRebalancedValidatorSet"); + + static const OsmosisValSetprefV1beta1Types undelegateFromValidatorSet = + OsmosisValSetprefV1beta1Types._( + "/osmosis.valsetpref.v1beta1.Msg/UndelegateFromValidatorSet"); + static const OsmosisValSetprefV1beta1Types delegateToValidatorSet = + OsmosisValSetprefV1beta1Types._( + "/osmosis.valsetpref.v1beta1.Msg/DelegateToValidatorSet"); + static const OsmosisValSetprefV1beta1Types setValidatorSetPreference = + OsmosisValSetprefV1beta1Types._( + "/osmosis.valsetpref.v1beta1.Msg/SetValidatorSetPreference"); +} diff --git a/lib/src/protobuf/message/duration.dart b/lib/src/protobuf/message/duration.dart index e733bfe..0f1067b 100755 --- a/lib/src/protobuf/message/duration.dart +++ b/lib/src/protobuf/message/duration.dart @@ -7,7 +7,7 @@ class ProtobufDuration extends CosmosProtocolBuffer { /// Signed seconds of the span of time. Must be from -315,576,000,000 /// to +315,576,000,000 inclusive. Note: these bounds are computed from: /// 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years - final BigInt seconds; + final BigInt? seconds; /// Signed fractions of a second at nanosecond resolution of the span /// of time. Durations less than one second are represented with a 0 diff --git a/lib/src/provider/thornode/models/models/ban_status_response.dart b/lib/src/provider/thornode/models/models/ban_status_response.dart index 2f25506..092c404 100644 --- a/lib/src/provider/thornode/models/models/ban_status_response.dart +++ b/lib/src/provider/thornode/models/models/ban_status_response.dart @@ -1,4 +1,4 @@ -import 'package:cosmos_sdk/cosmos_sdk.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; class ThorBanStatusResponse { final String nodeAddress; diff --git a/lib/src/provider/thornode/models/models/streaming_swap_state.dart b/lib/src/provider/thornode/models/models/streaming_swap_state.dart index 7fcfac5..10efd07 100644 --- a/lib/src/provider/thornode/models/models/streaming_swap_state.dart +++ b/lib/src/provider/thornode/models/models/streaming_swap_state.dart @@ -1,4 +1,4 @@ -import 'package:cosmos_sdk/cosmos_sdk.dart'; +import 'package:cosmos_sdk/src/utils/quick_extensions.dart'; class StreamingSwapStateResponse { final String txId; diff --git a/pubspec.yaml b/pubspec.yaml index fdfdacf..62e870f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,13 +1,15 @@ name: cosmos_sdk -description: Engage seamlessly with a Cosmos SDK-based network, enabling the creation, signing, and transmission of transactions. (Beta version) -version: 0.0.10 +description: Engage seamlessly with a Cosmos SDK-based network (cosmos hub, osmosis, thor, kujira and etc ... ), enabling the creation, signing, and transmission of transactions. (Beta version) +version: 0.1.0 homepage: "https://github.com/mrtnetwork/cosmos_sdk" repository: "https://github.com/mrtnetwork/cosmos_sdk" Author: mrhaydari.t@gmail.com topics: - cosmos - - blockchain - wallet + - osmosis + - thor + - maya environment: sdk: '>=2.15.0 <4.0.0'