Skip to content

Commit

Permalink
feat: get ts scripts building
Browse files Browse the repository at this point in the history
  • Loading branch information
drewstone committed Nov 19, 2024
1 parent 67ea64d commit 97ba0fc
Show file tree
Hide file tree
Showing 43 changed files with 1,051 additions and 450 deletions.
8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,11 @@ The blueprint provides several management jobs that can be triggered through the
- Configure privileged executors
- Manage executor permissions

3. **Batch Poster Configuration**
- Set batch poster addresses
- Enable/disable batch posters

4. **Fee Management**
3. **Fee Management**
- Configure fee recipients
- Set fee distribution weights

5. **Fast Withdrawals**
4. **Fast Withdrawals**
- Configure withdrawal confirmers
- Enable/disable fast withdrawal functionality

Expand Down
1 change: 1 addition & 0 deletions blueprints/arbitrum-orbit/dist/add-executors.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
54 changes: 54 additions & 0 deletions blueprints/arbitrum-orbit/dist/add-executors.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const arbitrum_orbit_toolkit_1 = require("arbitrum-orbit-toolkit");
const viem_1 = require("viem");
const accounts_1 = require("viem/accounts");
function validateParams(params) {
if (!params || typeof params !== "object") {
throw new Error("Invalid params: must be an object");
}
const requiredFields = [
"parentChainRpc",
"orbitChainRpc",
"chainId",
"chainName",
"chainNetworkName",
"nativeCurrency",
"ownerPrivateKey",
"rollupAddress",
"upgradeExecutor",
"newExecutors",
];
for (const field of requiredFields) {
if (!(field in params)) {
throw new Error(`Missing required field: ${field}`);
}
}
}
async function main() {
const params = JSON.parse(process.argv[2]);
validateParams(params);
const parentChainClient = (0, viem_1.createPublicClient)({
transport: (0, viem_1.http)(params.parentChainRpc),
});
const orbitChainClient = (0, arbitrum_orbit_toolkit_1.createOrbitChainClient)(params.chainId, params.chainName, params.chainNetworkName, {
name: params.currencyName,
symbol: params.currencySymbol,
decimals: params.currencyDecimals,
}, params.orbitChainRpc, params.rollupAddress);
let account = (0, accounts_1.privateKeyToAccount)(params.ownerPrivateKey);
try {
const result = await (0, arbitrum_orbit_toolkit_1.addPrivilegedExecutors)({
rollupAddress: params.rollupAddress,
newExecutors: params.newExecutors,
upgradeExecutor: params.upgradeExecutor,
owner: account,
}, parentChainClient, orbitChainClient);
console.log(JSON.stringify({ transactionHash: result }));
}
catch (error) {
console.error(error);
process.exit(1);
}
}
main().catch(console.error);
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
47 changes: 47 additions & 0 deletions blueprints/arbitrum-orbit/dist/configure-fast-withdrawals.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const arbitrum_orbit_toolkit_1 = require("arbitrum-orbit-toolkit");
const viem_1 = require("viem");
const accounts_1 = require("viem/accounts");
function validateParams(params) {
if (!params || typeof params !== "object") {
throw new Error("Invalid params: must be an object");
}
const requiredFields = [
"parentChainRpc",
"ownerPrivateKey",
"ownerAddress",
"rollupAddress",
"upgradeExecutor",
"minimumAssertionPeriod",
"fastConfirmer",
];
for (const field of requiredFields) {
if (!(field in params)) {
throw new Error(`Missing required field: ${field}`);
}
}
}
async function main() {
const params = JSON.parse(process.argv[2]);
validateParams(params);
const parentChainClient = (0, viem_1.createPublicClient)({
transport: (0, viem_1.http)(params.parentChainRpc),
});
const account = (0, accounts_1.privateKeyToAccount)(params.ownerPrivateKey);
try {
const result = await (0, arbitrum_orbit_toolkit_1.setupFastWithdrawal)({
rollupAddress: params.rollupAddress,
owner: account,
upgradeExecutor: params.upgradeExecutor,
minimumAssertionPeriod: params.minimumAssertionPeriod,
fastConfirmer: params.fastConfirmer,
}, parentChainClient);
console.log(JSON.stringify(result));
}
catch (error) {
console.error(error);
process.exit(1);
}
}
main().catch(console.error);
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { setFeeRecipients } from 'arbitrum-orbit-toolkit';
import { createPublicClient, http } from 'viem';

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const arbitrum_orbit_toolkit_1 = require("arbitrum-orbit-toolkit");
const viem_1 = require("viem");
async function main() {
const params = JSON.parse(process.argv[2]);
const parentChainClient = createPublicClient({
transport: http(process.env.PARENT_CHAIN_RPC)
const parentChainClient = (0, viem_1.createPublicClient)({
transport: (0, viem_1.http)(process.env.PARENT_CHAIN_RPC)
});

try {
const result = await setFeeRecipients({
const result = await (0, arbitrum_orbit_toolkit_1.setFeeRecipients)({
rollupAddress: params.rollup_address,
recipients: params.recipients,
weights: params.weights,
Expand All @@ -18,12 +18,11 @@ async function main() {
account: process.env.OWNER_PRIVATE_KEY
}
}, parentChainClient);

console.log(JSON.stringify({ transactionHash: result }));
} catch (error) {
}
catch (error) {
console.error(error);
process.exit(1);
}
}

main().catch(console.error);
main().catch(console.error);
1 change: 1 addition & 0 deletions blueprints/arbitrum-orbit/dist/configure-token-bridge.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
53 changes: 53 additions & 0 deletions blueprints/arbitrum-orbit/dist/configure-token-bridge.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const arbitrum_orbit_toolkit_1 = require("arbitrum-orbit-toolkit");
const viem_1 = require("viem");
const accounts_1 = require("viem/accounts");
function validateParams(params) {
if (!params || typeof params !== "object") {
throw new Error("Invalid params: must be an object");
}
const requiredFields = [
"parentChainRpc",
"orbitChainRpc",
"chainName",
"chainNetworkName",
"currencyName",
"currencySymbol",
"currencyDecimals",
"ownerPrivateKey",
"rollupAddress",
"nativeToken",
];
for (const field of requiredFields) {
if (!(field in params)) {
throw new Error(`Missing required field: ${field}`);
}
}
}
async function main() {
const params = JSON.parse(process.argv[2]);
validateParams(params);
const parentChainClient = (0, viem_1.createPublicClient)({
transport: (0, viem_1.http)(params.parentChainRpc),
});
const orbitChainClient = (0, arbitrum_orbit_toolkit_1.createOrbitChainClient)(params.orbitChainId, params.chainName, params.chainNetworkName, {
name: params.currencyName,
symbol: params.currencySymbol,
decimals: params.currencyDecimals,
}, params.orbitChainRpc, params.rollupAddress);
const account = (0, accounts_1.privateKeyToAccount)(params.ownerPrivateKey);
try {
const result = await (0, arbitrum_orbit_toolkit_1.createTokenBridge)({
rollupAddress: params.rollupAddress,
nativeToken: params.nativeToken,
owner: account,
}, parentChainClient, orbitChainClient);
console.log(JSON.stringify(result));
}
catch (error) {
console.error(error);
process.exit(1);
}
}
main().catch(console.error);
1 change: 1 addition & 0 deletions blueprints/arbitrum-orbit/dist/deploy-rollup.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
55 changes: 55 additions & 0 deletions blueprints/arbitrum-orbit/dist/deploy-rollup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const arbitrum_orbit_toolkit_1 = require("arbitrum-orbit-toolkit");
const viem_1 = require("viem");
const accounts_1 = require("viem/accounts");
function validateParams(params) {
if (!params || typeof params !== "object") {
throw new Error("Invalid params: must be an object");
}
const requiredFields = [
"ownerPrivateKey",
"chainId",
"validators",
"batchPosters",
"nativeToken",
"dataAvailabilityCommittee",
];
for (const field of requiredFields) {
if (!(field in params)) {
throw new Error(`Missing required field: ${field}`);
}
}
}
async function main() {
const params = JSON.parse(process.argv[2]);
validateParams(params);
const parentChainClient = (0, viem_1.createPublicClient)({
transport: (0, viem_1.http)(process.env.PARENT_CHAIN_RPC),
});
const account = (0, accounts_1.privateKeyToAccount)(params.ownerPrivateKey);
// Prepare complete rollup parameters
const rollupParams = {
chainId: params.chainId,
owner: account,
validators: params.validators,
batchPosters: params.batchPosters,
nativeToken: params.nativeToken,
dataAvailabilityCommittee: params.dataAvailabilityCommittee,
};
try {
const result = await (0, arbitrum_orbit_toolkit_1.createRollup)(rollupParams, parentChainClient);
console.log(JSON.stringify({
rollupAddress: result.rollupAddress,
inboxAddress: result.inboxAddress,
adminAddress: result.adminAddress,
sequencerInboxAddress: result.sequencerInboxAddress,
transactionHash: result.transactionHash,
}));
}
catch (error) {
console.error(error);
process.exit(1);
}
}
main().catch(console.error);
1 change: 1 addition & 0 deletions blueprints/arbitrum-orbit/dist/manage-batch-posters.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { setBatchPosters } from 'arbitrum-orbit-toolkit';
import { createPublicClient, http } from 'viem';

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const arbitrum_orbit_toolkit_1 = require("arbitrum-orbit-toolkit");
const viem_1 = require("viem");
async function main() {
const params = JSON.parse(process.argv[2]);
const parentChainClient = createPublicClient({
transport: http(process.env.PARENT_CHAIN_RPC)
const parentChainClient = (0, viem_1.createPublicClient)({
transport: (0, viem_1.http)(process.env.PARENT_CHAIN_RPC)
});

try {
const result = await setBatchPosters({
const result = await (0, arbitrum_orbit_toolkit_1.setBatchPosters)({
rollupAddress: params.rollup_address,
batchPosters: params.batch_posters,
isActive: params.is_active,
Expand All @@ -18,12 +18,11 @@ async function main() {
account: process.env.OWNER_PRIVATE_KEY
}
}, parentChainClient);

console.log(JSON.stringify({ transactionHash: result }));
} catch (error) {
}
catch (error) {
console.error(error);
process.exit(1);
}
}

main().catch(console.error);
main().catch(console.error);
1 change: 1 addition & 0 deletions blueprints/arbitrum-orbit/dist/set-validators.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
46 changes: 46 additions & 0 deletions blueprints/arbitrum-orbit/dist/set-validators.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const arbitrum_orbit_toolkit_1 = require("arbitrum-orbit-toolkit");
const viem_1 = require("viem");
const accounts_1 = require("viem/accounts");
function validateParams(params) {
if (!params || typeof params !== "object") {
throw new Error("Invalid params: must be an object");
}
const requiredFields = [
"parentChainRpc",
"ownerPrivateKey",
"upgradeExecutor",
"rollupAddress",
"validators",
"isActive",
];
for (const field of requiredFields) {
if (!(field in params)) {
throw new Error(`Missing required field: ${field}`);
}
}
}
async function main() {
const params = JSON.parse(process.argv[2]);
validateParams(params);
const parentChainClient = (0, viem_1.createPublicClient)({
transport: (0, viem_1.http)(params.parentChainRpc),
});
const account = (0, accounts_1.privateKeyToAccount)(params.ownerPrivateKey);
try {
const result = await (0, arbitrum_orbit_toolkit_1.setValidators)({
rollupAddress: params.rollupAddress,
validators: params.validators,
isActive: params.isActive,
upgradeExecutor: process.env.UPGRADE_EXECUTOR_ADDRESS,
owner: account,
}, parentChainClient);
console.log(JSON.stringify({ transactionHash: result }));
}
catch (error) {
console.error(error);
process.exit(1);
}
}
main().catch(console.error);
Loading

0 comments on commit 97ba0fc

Please sign in to comment.