Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: upgrade starship cli and starship-action #100

Merged
merged 2 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .github/workflows/e2e-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,10 @@ jobs:

- name: Set Up Starship Infrastructure
id: starship-infra
uses: cosmology-tech/starship-action@0.3.0
uses: cosmology-tech/starship-action@0.5.3
with:
values: packages/osmojs/starship/configs/config.workflow.yaml
port-forward: true
version: 0.2.3
config: packages/osmojs/starship/configs/config.workflow.yaml
version: 0.2.5

- name: Run E2E Tests
run: cd ./packages/osmojs && yarn starship:test
4 changes: 2 additions & 2 deletions packages/osmojs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
"@protobufs/ibc": "^0.1.0",
"@protobufs/osmosis": "^0.4.0",
"@protobufs/tendermint": "^0.0.10",
"@starship-ci/cli": "^2.1.0",
"starshipjs": "^2.1.0"
"@starship-ci/cli": "^2.7.0",
"starshipjs": "^2.3.0"
},
"dependencies": {
"@cosmjs/amino": "0.32.3",
Expand Down
14 changes: 7 additions & 7 deletions packages/osmojs/starship/__tests__/gov.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import { waitUntil } from '../src';
describe('Governance tests for osmosis', () => {
let protoSigner, aminoSigner, denom, address;
let chainInfo: ChainInfo;
let getCoin: () => Asset;
let getRpcEndpoint: () => string;
let getCoin: () => Promise<Asset>;
let getRpcEndpoint: () => Promise<string>;
let creditFromFaucet: (address: string, denom?: string | null) => Promise<void>;

// Variables used accross testcases
Expand All @@ -38,7 +38,7 @@ describe('Governance tests for osmosis', () => {
getRpcEndpoint,
creditFromFaucet
} = useChain('osmosis'));
denom = getCoin().base;
denom = (await getCoin()).base;

const mnemonic = generateMnemonic();
// Initialize wallet
Expand All @@ -52,7 +52,7 @@ describe('Governance tests for osmosis', () => {

// Create custom cosmos interchain client
queryClient = await cosmos.ClientFactory.createRPCQueryClient({
rpcEndpoint: getRpcEndpoint()
rpcEndpoint: (await getRpcEndpoint())
});

// Transfer osmosis to address
Expand Down Expand Up @@ -89,7 +89,7 @@ describe('Governance tests for osmosis', () => {

it('stake tokens to genesis validator', async () => {
const signingClient = await getSigningOsmosisClient({
rpcEndpoint: getRpcEndpoint(),
rpcEndpoint: await getRpcEndpoint(),
signer: protoSigner
});

Expand Down Expand Up @@ -126,7 +126,7 @@ describe('Governance tests for osmosis', () => {

it('submit a txt proposal', async () => {
const signingClient = await getSigningCosmosClient({
rpcEndpoint: getRpcEndpoint(),
rpcEndpoint: await getRpcEndpoint(),
signer: protoSigner
});

Expand Down Expand Up @@ -189,7 +189,7 @@ describe('Governance tests for osmosis', () => {
it('vote on proposal from address', async () => {
// create genesis address signing client
const signingClient = await getSigningCosmosClient({
rpcEndpoint: getRpcEndpoint(),
rpcEndpoint: await getRpcEndpoint(),
signer: protoSigner
});

Expand Down
20 changes: 10 additions & 10 deletions packages/osmojs/starship/__tests__/pools.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ describe('Pool testing over IBC tokens', () => {
let protoSigner, aminoSigner, denom, address;

let chainInfo: ChainInfo;
let getCoin: () => Asset;
let getRpcEndpoint: () => string;
let getCoin: () => Promise<Asset>;
let getRpcEndpoint: () => Promise<string>;
let creditFromFaucet: (address: string, denom?: string | null) => Promise<void>;

// Variables used accross testcases
Expand All @@ -33,7 +33,7 @@ describe('Pool testing over IBC tokens', () => {
getRpcEndpoint,
creditFromFaucet
} = useChain('osmosis'));
denom = getCoin().base;
denom = (await getCoin()).base;

const mnemonic = generateMnemonic();
// Initialize wallet
Expand All @@ -51,7 +51,7 @@ describe('Pool testing over IBC tokens', () => {
}, 200000);

it('check address has tokens', async () => {
const client = await StargateClient.connect(getRpcEndpoint());
const client = await StargateClient.connect(await getRpcEndpoint());
const balances = await client.getAllBalances(address);

expect(balances.length).toEqual(2);
Expand All @@ -62,7 +62,7 @@ describe('Pool testing over IBC tokens', () => {

it('create ibc pools with ibc atom osmo', async () => {
const signingClient = await getSigningOsmosisClient({
rpcEndpoint: getRpcEndpoint(),
rpcEndpoint: await getRpcEndpoint(),
signer: protoSigner
});

Expand Down Expand Up @@ -128,10 +128,10 @@ describe('Pool testing over IBC tokens', () => {
it('query pool via id, verify creation', async () => {
// Query the created pool
const queryClient = await osmosis.ClientFactory.createRPCQueryClient({
rpcEndpoint: getRpcEndpoint()
rpcEndpoint: await getRpcEndpoint()
});

const client = await StargateClient.connect(getRpcEndpoint());
const client = await StargateClient.connect(await getRpcEndpoint());

const poolResponse = await queryClient.osmosis.gamm.v1beta1.pool({
poolId
Expand Down Expand Up @@ -160,7 +160,7 @@ describe('Pool testing over IBC tokens', () => {

it('join pool', async () => {
const signingClient = await getSigningOsmosisClient({
rpcEndpoint: getRpcEndpoint(),
rpcEndpoint: await getRpcEndpoint(),
signer: aminoSigner
});

Expand Down Expand Up @@ -208,7 +208,7 @@ describe('Pool testing over IBC tokens', () => {

it('lock tokens', async () => {
const signingClient = await getSigningOsmosisClient({
rpcEndpoint: getRpcEndpoint(),
rpcEndpoint: await getRpcEndpoint(),
signer: aminoSigner
});

Expand Down Expand Up @@ -251,7 +251,7 @@ describe('Pool testing over IBC tokens', () => {

it('swap tokens using pool, to address without ibc token', async () => {
const signingClient = await getSigningOsmosisClient({
rpcEndpoint: getRpcEndpoint(),
rpcEndpoint: await getRpcEndpoint(),
signer: aminoSigner
});

Expand Down
2 changes: 1 addition & 1 deletion packages/osmojs/starship/__tests__/setup.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('Test clients', () => {

beforeAll(async () => {
const { getRpcEndpoint } = useChain('osmosis');
client = await StargateClient.connect(getRpcEndpoint());
client = await StargateClient.connect(await getRpcEndpoint());
});

it('check chain height', async () => {
Expand Down
6 changes: 3 additions & 3 deletions packages/osmojs/starship/__tests__/staking.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('Staking tokens testing', () => {
getRpcEndpoint,
creditFromFaucet
} = useChain('osmosis'));
denom = getCoin().base;
denom = (await getCoin()).base;

// Initialize wallet
wallet = await DirectSecp256k1HdWallet.fromMnemonic(generateMnemonic(), {
Expand All @@ -34,7 +34,7 @@ describe('Staking tokens testing', () => {

// Create custom cosmos interchain client
queryClient = await cosmos.ClientFactory.createRPCQueryClient({
rpcEndpoint: getRpcEndpoint()
rpcEndpoint: await getRpcEndpoint()
});

// Transfer osmosis and ibc tokens to address, send only osmo to address
Expand Down Expand Up @@ -71,7 +71,7 @@ describe('Staking tokens testing', () => {

it('stake tokens to genesis validator', async () => {
const signingClient = await getSigningOsmosisClient({
rpcEndpoint: getRpcEndpoint(),
rpcEndpoint: await getRpcEndpoint(),
signer: wallet
});

Expand Down
16 changes: 8 additions & 8 deletions packages/osmojs/starship/__tests__/token.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('Token transfers', () => {
getRpcEndpoint,
creditFromFaucet
} = useChain('osmosis'));
denom = getCoin().base;
denom = (await getCoin()).base;

// Initialize wallet
wallet = await DirectSecp256k1HdWallet.fromMnemonic(generateMnemonic(), {
Expand All @@ -38,7 +38,7 @@ describe('Token transfers', () => {
const address2 = (await wallet2.getAccounts())[0].address;

const signingClient = await getSigningOsmosisClient({
rpcEndpoint: getRpcEndpoint(),
rpcEndpoint: await getRpcEndpoint(),
signer: wallet
});

Expand Down Expand Up @@ -74,7 +74,7 @@ describe('Token transfers', () => {

it('send ibc osmo tokens to address on cosmos chain', async () => {
const signingClient = await getSigningOsmosisClient({
rpcEndpoint: getRpcEndpoint(),
rpcEndpoint: await getRpcEndpoint(),
signer: wallet
});

Expand All @@ -95,12 +95,12 @@ describe('Token transfers', () => {
const cosmosAddress = (await cosmosWallet.getAccounts())[0].address;

const ibcInfos = chainInfo.fetcher.getChainIbcData(
chainInfo.chain.chain_id
chainInfo.chain.chain_name
);
const ibcInfo = ibcInfos.find(
(i) =>
i.chain_1.chain_name === chainInfo.chain.chain_id &&
i.chain_2.chain_name === cosmosChainInfo.chain.chain_id
i.chain_1.chain_name === chainInfo.chain.chain_name &&
i.chain_2.chain_name === cosmosChainInfo.chain.chain_name
);

expect(ibcInfo).toBeTruthy();
Expand Down Expand Up @@ -142,7 +142,7 @@ describe('Token transfers', () => {
assertIsDeliverTxSuccess(resp);

// Check osmos in address on cosmos chain
const cosmosClient = await StargateClient.connect(cosmosRpcEndpoint());
const cosmosClient = await StargateClient.connect(await cosmosRpcEndpoint());
const balances = await cosmosClient.getAllBalances(cosmosAddress);

// check balances
Expand All @@ -157,7 +157,7 @@ describe('Token transfers', () => {

// check ibc denom trace of the same
const queryClient = await ibc.ClientFactory.createRPCQueryClient({
rpcEndpoint: cosmosRpcEndpoint()
rpcEndpoint: await cosmosRpcEndpoint()
});
const trace = await queryClient.ibc.applications.transfer.v1.denomTrace({
// @ts-ignore
Expand Down
2 changes: 1 addition & 1 deletion packages/osmojs/starship/configs/starship.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
helmName: osmojs
helmFile: ./config.yaml
helmVersion: v0.2.3
helmVersion: v0.2.5
10 changes: 5 additions & 5 deletions packages/osmojs/starship/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ export const transferIbcTokens = async (fromChain: string, toChain: string, toAd

await fromChainData.creditFromFaucet(fromAddress);

const fromClient = await setupIbcClient(fromChainData.getRpcEndpoint(), wallet);
const token = { denom: fromChainData.getCoin().base, amount };
const fromClient = await setupIbcClient(await fromChainData.getRpcEndpoint(), wallet);
const token = { denom: (await fromChainData.getCoin()).base, amount };

const resp = await sendIbcTokens(fromClient, fromAddress, toAddress, token, ibcInfo, amount);

Expand All @@ -53,10 +53,10 @@ export const transferIbcTokens = async (fromChain: string, toChain: string, toAd

const findIbcInfo = (chainInfo: ChainInfo, toChainInfo: ChainInfo) => {
const registry = ConfigContext.registry;
const ibcInfos = registry!.getChainIbcData(chainInfo.chain.chain_id);
const ibcInfos = registry!.getChainIbcData(chainInfo.chain.chain_name);
const found = ibcInfos.find(
i => i.chain_1.chain_name === chainInfo.chain.chain_id &&
i.chain_2.chain_name === toChainInfo.chain.chain_id
i => i.chain_1.chain_name === chainInfo.chain.chain_name &&
i.chain_2.chain_name === toChainInfo.chain.chain_name
);
if (!found) throw new Error('Cannot find IBC info');
return found;
Expand Down
26 changes: 13 additions & 13 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2516,22 +2516,22 @@
dependencies:
"@sinonjs/commons" "^3.0.0"

"@starship-ci/cli@^2.1.0":
version "2.1.0"
resolved "https://registry.yarnpkg.com/@starship-ci/cli/-/cli-2.1.0.tgz#4e469edf6dceea42fe9a9ed92e4f35b167438e82"
integrity sha512-rngL4hWQyHwJjnMd1UfsP2IcCKsBJUw7zHf2V1cwq8NRS7g7FRkWSSbyCN1F6LjIEbuP216eI1/qwnNDd56bwQ==
"@starship-ci/cli@^2.7.0":
version "2.7.0"
resolved "https://registry.yarnpkg.com/@starship-ci/cli/-/cli-2.7.0.tgz#706a90ae6f3e3e1c784b28fe260e9388dbe95c83"
integrity sha512-gcLT0hA/wQJtidHZiIb1ICgJtF2ISSpiUVb/3dGU/1tBYKKOgYMuTkmTUOnocGI3QdkAwOB+7Rlw0BeH4fieFg==
dependencies:
"@starship-ci/client" "^2.1.0"
"@starship-ci/client" "^2.7.0"
chalk "^4.1.0"
deepmerge "^4.3.1"
inquirerer "^1.9.0"
js-yaml "^4.1.0"
minimist "^1.2.8"

"@starship-ci/client@^2.1.0":
version "2.1.0"
resolved "https://registry.yarnpkg.com/@starship-ci/client/-/client-2.1.0.tgz#e316af56a7055c198c71104d9d58df6f02dd80bc"
integrity sha512-n8l+bpSGW86fHKpbmP6JGCJxJ2mDzsF6Dm40YUx9FZW44qrjiFVy4eJ67xL8psQ8e3367mSuduFbvdnNUZvzOQ==
"@starship-ci/client@^2.7.0":
version "2.7.0"
resolved "https://registry.yarnpkg.com/@starship-ci/client/-/client-2.7.0.tgz#b85fce50267b909a11eeed6e3ff8f45b318b505a"
integrity sha512-xoo5Feu0MxT5yCg9dDBsxN/Tl/GRazAMEAsPtHSFTBf7FokGMGmFgkcuXR4g2VSTy6qmHC69iKQORIlhir9s2g==
dependencies:
chalk "^4.1.0"
deepmerge "^4.3.1"
Expand Down Expand Up @@ -8313,10 +8313,10 @@ stack-utils@^2.0.3:
dependencies:
escape-string-regexp "^2.0.0"

starshipjs@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/starshipjs/-/starshipjs-2.1.0.tgz#6e3462af8d8b3eaadbed37e236c9e00f99f5cfc5"
integrity sha512-z41NLSnBlCZ1yarcwgMFYioJYHiLZ2hMF9qvqmvg0vJ8lyVfWCRYYDYFFtZTcjKsbZgiayW6vP7HLRMqYq1c7g==
starshipjs@^2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/starshipjs/-/starshipjs-2.3.0.tgz#074a0aae279a8ca589e0aeddf823fe2f7854fb29"
integrity sha512-XdHMuyDXVeZe63GawkD71xKXuuXH2MQ12Qr3p5XbYoMfP6TsVvgwf5g5hE9KJ6lYR2uXXhjL5DaVZPGyvku7hA==
dependencies:
"@chain-registry/client" "1.18.1"
bip39 "^3.1.0"
Expand Down
Loading