Skip to content

Commit

Permalink
Merge pull request #257 from neutron-org/feat/LIDO-68-query-siginig-info
Browse files Browse the repository at this point in the history
feat: LIDO-68. Signing info query
  • Loading branch information
pr0n00gler authored Feb 22, 2024
2 parents dd5e0cf + a1e464c commit 52ead23
Show file tree
Hide file tree
Showing 3 changed files with 342 additions and 11 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ git clone [email protected]:neutron-org/neutron.git
git clone [email protected]:neutron-org/neutron-query-relayer.git
```

We use the Gaia network as a host network, so you need to clone it next to the neutron repos. We use v9.0.3 for the tests.
We use the Gaia network as a host network, so you need to clone it next to the neutron repos. We use v13.0.0 for the tests.

```shell
git clone [email protected]:cosmos/gaia.git
git checkout v9.0.3
git checkout v13.0.0
```

### 2. Prepare docker environment
Expand Down
52 changes: 52 additions & 0 deletions src/helpers/gaia.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { BroadcastTx200ResponseTxResponse } from '@cosmos-client/core/cjs/openapi/api';
import {
MsgDelegate,
MsgUndelegate,
} from '@neutron-org/neutronjsplus/dist/proto/cosmos_sdk/cosmos/staking/v1beta1/tx_pb';
import {
packAnyMsg,
WalletWrapper,
} from '@neutron-org/neutronjsplus/dist/cosmos';
import Long from 'long';

export const msgDelegate = async (
wallet: WalletWrapper,
delegatorAddress: string,
validatorAddress: string,
amount: string,
): Promise<BroadcastTx200ResponseTxResponse> => {
const msgDelegate = new MsgDelegate({
delegatorAddress,
validatorAddress,
amount: { denom: wallet.chain.denom, amount: amount },
});
const res = await wallet.execTx(
{
gas_limit: Long.fromString('500000'),
amount: [{ denom: wallet.chain.denom, amount: '5000' }],
},
[packAnyMsg('/cosmos.staking.v1beta1.MsgDelegate', msgDelegate)],
);
return res?.tx_response;
};

export const msgUndelegate = async (
wallet: WalletWrapper,
delegatorAddress: string,
validatorAddress: string,
amount: string,
): Promise<BroadcastTx200ResponseTxResponse> => {
const msgUndelegate = new MsgUndelegate({
delegatorAddress,
validatorAddress,
amount: { denom: wallet.chain.denom, amount: amount },
});
const res = await wallet.execTx(
{
gas_limit: Long.fromString('500000'),
amount: [{ denom: wallet.chain.denom, amount: '5000' }],
},
[packAnyMsg('/cosmos.staking.v1beta1.MsgUndelegate', msgUndelegate)],
);
return res?.tx_response;
};
Loading

0 comments on commit 52ead23

Please sign in to comment.