Skip to content

Commit

Permalink
add setOwner script
Browse files Browse the repository at this point in the history
  • Loading branch information
peterjah committed Jan 6, 2025
1 parent 75b5cb3 commit 301761a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions smart-contract/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"migrate": "tsx src/migrate.ts",
"pause": "tsx src/pause.ts",
"unpause": "tsx src/unpause.ts",
"setOwner": "tsx src/setOwner.ts",
"prettier": "prettier '**/src/**/*.ts' --check && as-prettier --check assembly",
"prettier:fix": "prettier '**/src/**/*.ts' --write && as-prettier --write assembly",
"lint": "eslint .",
Expand Down
20 changes: 20 additions & 0 deletions smart-contract/src/setOwner.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Args, Mas, SmartContract } from '@massalabs/massa-web3';
import { initProvider } from './utils';
import { MNS_CONTRACT } from './config';

const provider = await initProvider();

const contract = new SmartContract(provider, MNS_CONTRACT);

const NEW_OWNER = 'XXXXX';

const op = await contract.call('setOwner', new Args().addString(NEW_OWNER), {
fee: Mas.fromString('0.1'),
});
const events = await op.getSpeculativeEvents();

for (const event of events) {
console.log('SetOwner Events:', event.data);
}

console.log('Owner updated! operation:', op.id);

0 comments on commit 301761a

Please sign in to comment.