Skip to content

Commit

Permalink
Merge branch 'main' into feat/sui-operators
Browse files Browse the repository at this point in the history
  • Loading branch information
npty committed Aug 1, 2024
2 parents 153108b + a674c87 commit 9e06029
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 22 deletions.
14 changes: 1 addition & 13 deletions common/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,7 @@ const {
const { normalizeBech32 } = require('@cosmjs/encoding');

function loadConfig(env) {
const config = require(`${__dirname}/../axelar-chains-config/info/${env}.json`);

if (!config.sui) {
config.sui = {
networkType: env === 'local' ? 'localnet' : env,
name: 'Sui',
contracts: {
AxelarGateway: {},
},
};
}

return config;
return require(`${__dirname}/../axelar-chains-config/info/${env}.json`);
}

function saveConfig(config, env) {
Expand Down
21 changes: 12 additions & 9 deletions sui/deploy-contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ const PACKAGE_DIRS = ['gas_service', 'test', 'axelar_gateway', 'operators'];
/**
* Package Mapping Object for Command Options and Post-Deployment Functions
*/
const PACKAGE_MAPPING = {
CMD_OPTIONS: {
AxelarGateway: () => [...DEPLOY_CMD_OPTIONS, ...GATEWAY_CMD_OPTIONS],
GasService: () => DEPLOY_CMD_OPTIONS,
Test: () => DEPLOY_CMD_OPTIONS,
Operators: () => DEPLOY_CMD_OPTIONS,
const PACKAGE_CONFIGS = {
cmdOptions: {
AxelarGateway: () => GATEWAY_CMD_OPTIONS,
GasService: () => [],
Test: () => [],
Operators: () => [],
},
POST_DEPLOY_FUNCTIONS: {
postDeployFunctions: {
AxelarGateway: postDeployAxelarGateway,
GasService: postDeployGasService,
Test: postDeployTest,
Expand Down Expand Up @@ -205,7 +205,7 @@ async function deploy(keypair, client, supportedContract, config, chain, options
};

// Execute post-deployment function
const executePostDeploymentFn = PACKAGE_MAPPING.POST_DEPLOY_FUNCTIONS[packageName];
const executePostDeploymentFn = PACKAGE_CONFIGS.postDeployFunctions[packageName];
await executePostDeploymentFn(published, keypair, client, config, chain, options);

printInfo(`${packageName} Configuration Updated`, JSON.stringify(chain.contracts[packageName], null, 2));
Expand Down Expand Up @@ -284,11 +284,14 @@ const addDeployOptions = (program) => {
const packageName = program.name();

// Find the corresponding options for the package
const options = PACKAGE_MAPPING.CMD_OPTIONS[packageName]();
const options = PACKAGE_CONFIGS.cmdOptions[packageName]();

// Add the options to the program
options.forEach((option) => program.addOption(option));

// Add the base deploy options to the program
DEPLOY_CMD_OPTIONS.forEach((option) => program.addOption(option));

return program;
};

Expand Down

0 comments on commit 9e06029

Please sign in to comment.