Skip to content
Draft
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
51 changes: 51 additions & 0 deletions common/its.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';

const { Command } = require('commander');
const { execSync } = require('child_process');
const { addBaseOptions, addOptionsToCommands, encodeITSDestination, loadConfig, printInfo } = require('../common');

async function encodeRecipient(config, args, _) {
Expand All @@ -12,6 +13,49 @@ async function encodeRecipient(config, args, _) {
printInfo('Encoded ITS destination address', itsDestinationAddress);
}

async function setTrustedChainsAll(config, args, options) {
const chain = process.env.CHAIN;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

avoid parsing env vars/cli args directly. Use the commander library to get CLI inputs like we do in all our scripts

Copy link
Contributor

@blockchainguyy blockchainguyy Jul 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also ignoreChainNames can be set to true, if u need a chain name in script.

if (!chain) {
throw new Error('CHAIN environment variable must be set');
}

const requiredKeys = [
'PRIVATE_KEY_EVM',
'PRIVATE_KEY_SUI',
'PRIVATE_KEY_STELLAR'
];
for (const key of requiredKeys) {
if (!process.env[key]) {
throw new Error(`${key} must be set in .env file`);
}
}

const commands = [
{
cmd: `ts-node evm/its.js set-trusted-chains ${chain} hub -n all`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ideally, we should just import the functions directly and call it instead of via a shell. But in this case, it might be more effort to do that, so maybe this is fine

privateKeyEnv: 'PRIVATE_KEY_EVM'
},
{
cmd: `ts-node sui/its.js add-trusted-chains ${chain}`,
privateKeyEnv: 'PRIVATE_KEY_SUI'
},
{
cmd: `ts-node stellar/its.js add-trusted-chains ${chain}`,
privateKeyEnv: 'PRIVATE_KEY_STELLAR'
}
];

for (const { cmd, privateKeyEnv } of commands) {
execSync(cmd, {
stdio: 'inherit',
env: {
...process.env,
PRIVATE_KEY: process.env[privateKeyEnv]
}
});
}
}

async function mainProcessor(processor, args, options) {
const config = loadConfig(options.env);

Expand All @@ -29,6 +73,13 @@ if (require.main === module) {
.action((destinationChain, destinationAddress, options) => {
mainProcessor(encodeRecipient, [destinationChain, destinationAddress], options);
});

program
.command('set-trusted-chains-all')
.description('Set trusted chains for all chains')
.action((options) => {
mainProcessor(setTrustedChainsAll, [], options);
});

addOptionsToCommands(program, addBaseOptions, { ignoreChainNames: true });

Expand Down
22 changes: 9 additions & 13 deletions releases/evm/EVM-ITS-Release-Template.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,25 +58,21 @@ ts-node evm/deploy-its.js -s "v2.1.0" -m create2 --proxySalt 'v1.0.0'

Please follow this [instruction](https://github.com/axelarnetwork/axelar-contract-deployments/tree/main/evm#contract-verification) to verify ITS contracts on EVM chains.

## Set <ChainName> as trusted chain on remote ITS contracts
## Set as trusted chain on remote ITS contracts

#### Note: Ensure that <ChainName> is registered on ITS hub
- Ensure that `<ChainName>` is registered on ITS hub

Set `<ChainName>` as trusted chain on all EVM chains
```bash
ts-node evm/its.js set-trusted-chains $CHAIN hub -n all
```

Set `<ChainName>` as trusted chain on Sui
- Set the following addresses in `.env`. Refer to ITS release docs for owner addresses.

```bash
ts-node sui/its.js add-trusted-chains $CHAIN
```yaml
PRIVATE_KEY_EVM=<EVM ITS owner>
PRIVATE_KEY_SUI=<Sui ITS owner>
PRIVATE_KEY_STELLAR=<Stellar ITS owner>
```

Set `<ChainName>` as trusted chain on Stellar

- Set chain as trusted chain on all ITS edge contracts:
```bash
ts-node stellar/its.js add-trusted-chains $CHAIN
ts-node common/its.js set-trusted-chains-all
```

## Checklist
Expand Down
Loading