Skip to content

Commit

Permalink
v0.1.0
Browse files Browse the repository at this point in the history
Enhanced compatibility with the latest features of the Osmosis network.
  • Loading branch information
mrtnetwork committed May 8, 2024
1 parent 5578430 commit 9067ef4
Show file tree
Hide file tree
Showing 220 changed files with 10,262 additions and 51 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.1.0

* Enhanced compatibility with the latest features of the Osmosis network..

## 0.0.10

* Fix importing issue
Expand Down
24 changes: 8 additions & 16 deletions example/test/widget_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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
Expand Down
4 changes: 3 additions & 1 deletion lib/src/models/core/account/account.dart
Original file line number Diff line number Diff line change
@@ -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();
Expand Down
9 changes: 9 additions & 0 deletions lib/src/models/networks/osmosis/omosis.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -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<int> 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<int> get fieldIds => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13];

@override
Map<String, dynamic> 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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<int> bytes) {
factory OsmosisConcentratedLiquidityPoolRecord.deserialize(List<int> 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<String, dynamic> json) {
return OsmosisConcentratedLiquidityPoolIdToTickSpacingRecord(
return OsmosisConcentratedLiquidityPoolRecord(
denom0: json["denom0"],
denom1: json["denom1"],
tickSpacing: BigintUtils.tryParse(json["tick_spacing"]),
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Original file line number Diff line number Diff line change
@@ -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<int> bytes) {
final decode = CosmosProtocolBuffer.decode(bytes);
return OsmosisConcentratedLiquidityCFMMPoolIdLinkFromConcentratedPoolIdRequest(
concentratedPoolId: decode.getField(1));
}

@override
List<int> get fieldIds => [1];

@override
Map<String, String?> get queryParameters => {};

@override
String get queryPath => OsmosisConcentratedLiquidityV1beta1Types
.cFMMPoolIdLinkFromConcentratedPoolId.typeUrl;

@override
String get rpcPath => OsmosisConcentratedLiquidityV1beta1Types
.cFMMPoolIdLinkFromConcentratedPoolId
.rpcUrl(pathParameters: [concentratedPoolId?.toString()]);

@override
Map<String, dynamic> toJson() {
return {"concentrated_pool_id": concentratedPoolId?.toString()};
}

@override
String get typeUrl => OsmosisConcentratedLiquidityV1beta1Types
.cFMMPoolIdLinkFromConcentratedPoolIdRequest.typeUrl;

@override
List get values => [concentratedPoolId];

@override
OsmosisConcentratedLiquidityCFMMPoolIdLinkFromConcentratedPoolIdResponse
onJsonResponse(Map<String, dynamic> json) {
return OsmosisConcentratedLiquidityCFMMPoolIdLinkFromConcentratedPoolIdResponse
.fromRpc(json);
}

@override
OsmosisConcentratedLiquidityCFMMPoolIdLinkFromConcentratedPoolIdResponse
onResponse(List<int> bytes) {
return OsmosisConcentratedLiquidityCFMMPoolIdLinkFromConcentratedPoolIdResponse
.deserialize(bytes);
}
}
Original file line number Diff line number Diff line change
@@ -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<int> bytes) {
final decode = CosmosProtocolBuffer.decode(bytes);
return OsmosisConcentratedLiquidityCFMMPoolIdLinkFromConcentratedPoolIdResponse(
cfmmPoolId: decode.getField(1));
}
factory OsmosisConcentratedLiquidityCFMMPoolIdLinkFromConcentratedPoolIdResponse.fromRpc(
Map<String, dynamic> json) {
return OsmosisConcentratedLiquidityCFMMPoolIdLinkFromConcentratedPoolIdResponse(
cfmmPoolId: BigintUtils.tryParse(json["cfmm_pool_id"]));
}

@override
List<int> get fieldIds => [1];

@override
Map<String, dynamic> toJson() {
return {"cfmm_pool_id": cfmmPoolId?.toString()};
}

@override
String get typeUrl => OsmosisConcentratedLiquidityV1beta1Types
.cFMMPoolIdLinkFromConcentratedPoolIdResponse.typeUrl;

@override
List get values => [cfmmPoolId];
}
Loading

0 comments on commit 9067ef4

Please sign in to comment.