Skip to content

Commit

Permalink
feat: remove unused methods
Browse files Browse the repository at this point in the history
  • Loading branch information
JoseRFelix committed Nov 26, 2024
1 parent 71527bf commit c61b997
Showing 1 changed file with 0 additions and 150 deletions.
150 changes: 0 additions & 150 deletions packages/stores/src/account/osmosis/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
import * as OsmosisMath from "@osmosis-labs/math";
import { maxTick, minTick } from "@osmosis-labs/math";
import {
makeAddAuthenticatorMsg,
makeAddToConcentratedLiquiditySuperfluidPositionMsg,
makeAddToPositionMsg,
makeBeginUnlockingMsg,
Expand All @@ -27,7 +26,6 @@ import {
makeJoinSwapExternAmountInMsg,
makeLockAndSuperfluidDelegateMsg,
makeLockTokensMsg,
makeRemoveAuthenticatorMsg,
makeSetValidatorSetPreferenceMsg,
makeSplitRoutesSwapExactAmountInMsg,
makeSplitRoutesSwapExactAmountOutMsg,
Expand Down Expand Up @@ -2203,154 +2201,6 @@ export class OsmosisAccountImpl {
);
}

async sendAddOrRemoveAuthenticatorsMsg({
addAuthenticators,
removeAuthenticators,
memo = "",
onFulfill,
onBroadcasted,
signOptions,
}: {
addAuthenticators: { authenticatorType: string; data: Uint8Array }[];
removeAuthenticators: bigint[];
memo?: string;
onFulfill?: (tx: DeliverTxResponse) => void;
onBroadcasted?: () => void;
signOptions?: SignOptions;
}) {
const addAuthenticatorMsgs = addAuthenticators.map((authenticator) =>
makeAddAuthenticatorMsg({
authenticatorType: authenticator.authenticatorType,
data: authenticator.data,
sender: this.address,
})
);
const removeAuthenticatorMsgs = removeAuthenticators.map((id) =>
makeRemoveAuthenticatorMsg({
id,
sender: this.address,
})
);
const msgs = await Promise.all([
...removeAuthenticatorMsgs,
...addAuthenticatorMsgs,
]);

await this.base.signAndBroadcast(
this.chainId,
"addOrRemoveAuthenticators",
msgs,
memo,
undefined,
signOptions,
{
onBroadcasted,
onFulfill: (tx) => {
if (!tx.code) {
// Refresh the balances
const queries = this.queriesStore.get(this.chainId);

queries.queryBalances
.getQueryBech32Address(this.address)
.balances.forEach((balance) => balance.waitFreshResponse());

queries.cosmos.queryDelegations
.getQueryBech32Address(this.address)
.waitFreshResponse();

queries.cosmos.queryRewards
.getQueryBech32Address(this.address)
.waitFreshResponse();
}
onFulfill?.(tx);
},
}
);
}

async sendAddAuthenticatorsMsg(
authenticators: { authenticatorType: string; data: any }[],
memo: string = "",
onFulfill?: (tx: DeliverTxResponse) => void
) {
const addAuthenticatorMsgs = await Promise.all(
authenticators.map((authenticator) =>
makeAddAuthenticatorMsg({
authenticatorType: authenticator.authenticatorType,
data: authenticator.data,
sender: this.address,
})
)
);

await this.base.signAndBroadcast(
this.chainId,
"addAuthenticator",
addAuthenticatorMsgs,
memo,
undefined,
undefined,
(tx) => {
if (!tx.code) {
// Refresh the balances
const queries = this.queriesStore.get(this.chainId);

queries.queryBalances
.getQueryBech32Address(this.address)
.balances.forEach((balance) => balance.waitFreshResponse());

queries.cosmos.queryDelegations
.getQueryBech32Address(this.address)
.waitFreshResponse();

queries.cosmos.queryRewards
.getQueryBech32Address(this.address)
.waitFreshResponse();
}
onFulfill?.(tx);
}
);
}

async sendRemoveAuthenticatorMsg(
id: bigint,
memo: string = "",
onFulfill?: (tx: DeliverTxResponse) => void
) {
const removeAuthenticatorMsg = await makeRemoveAuthenticatorMsg({
id: id,
sender: this.address,
});

await this.base.signAndBroadcast(
this.chainId,
"removeAuthenticator",
[removeAuthenticatorMsg],
memo,
undefined,
undefined,
(tx) => {
if (!tx.code) {
// Refresh the balances
const queries = this.queriesStore.get(this.chainId);

queries.queryBalances
.getQueryBech32Address(this.address)
.balances.forEach((balance) => balance.waitFreshResponse());

queries.cosmos.queryDelegations
.getQueryBech32Address(this.address)
.waitFreshResponse();

queries.cosmos.queryRewards
.getQueryBech32Address(this.address)
.waitFreshResponse();
}
onFulfill?.(tx);
}
);
}

protected get queries() {
return this.queriesStore.get(this.chainId).osmosis!;
}
Expand Down

0 comments on commit c61b997

Please sign in to comment.