Context
The chain-sdk needs viem-friendly wrappers around new arbitrum-sdk retryable primitives to support cross-chain scripting workflows like ownership transfer. The bridging pattern already exists in createTokenBridge-ethers.ts using publicClientToProvider.
Depends on: OffchainLabs/arbitrum-sdk#639
Scope
Viem wrappers (in src/)
encodeRetryableTicket -- wraps the arbitrum-sdk function, accepts viem PublicClient, converts via publicClientToProvider, returns viem-friendly types (bigint, hex)
encodeSendL2Message -- thin wrapper if needed (may just re-export since it's pure encoding)
Schemas (in src/scripting/schemas/)
- Schema for
encodeRetryableTicket params (addresses, gas params, calldata)
- Schema for
arbOwnerPrepareTransactionRequest params (functionName, upgradeExecutor, account)
- Type tests verifying schema outputs match function params
- Export from
schemas/index.ts
Example script: transferOwnership.ts
- Accepts: parentChainRpcUrl, privateKey, upgradeExecutorAddress, childUpgradeExecutorAddress, inboxAddress, newOwnerAddress, maxGasLimit, maxGasPrice, nativeToken (defaults to zeroAddress)
- Implements all 6 steps of the ownership transfer:
- Add new owner as executor on parent-chain UpgradeExecutor
- Grant new owner executor role on child-chain UpgradeExecutor (retryable ticket through parent UE)
- Add child-chain UpgradeExecutor as chain owner via ArbOwner (signed L2 message through Inbox)
- Remove deployer as chain owner via ArbOwner (signed L2 message through Inbox)
- Revoke deployer executor role on child-chain UpgradeExecutor (retryable ticket through parent UE)
- Remove deployer as executor on parent-chain UpgradeExecutor
- Uses
runScript harness with zod schema + transform
Out of scope
- Generic
prepareRetryableTicketTransactionRequest (callers compose encodeRetryableTicket output with either direct Inbox call or UpgradeExecutor wrapping as needed)
Motivation
Mirrors the transferOwnership script from chains-playground, but using SDK functions and the scripting harness. Steps 1 and 6 already work with existing upgradeExecutorPrepareAdd/RemoveExecutorTransactionRequest functions. Steps 2-5 need the new retryable/L2 message primitives from OffchainLabs/arbitrum-sdk#639.
Context
The chain-sdk needs viem-friendly wrappers around new arbitrum-sdk retryable primitives to support cross-chain scripting workflows like ownership transfer. The bridging pattern already exists in
createTokenBridge-ethers.tsusingpublicClientToProvider.Depends on: OffchainLabs/arbitrum-sdk#639
Scope
Viem wrappers (in
src/)encodeRetryableTicket-- wraps the arbitrum-sdk function, accepts viemPublicClient, converts viapublicClientToProvider, returns viem-friendly types (bigint, hex)encodeSendL2Message-- thin wrapper if needed (may just re-export since it's pure encoding)Schemas (in
src/scripting/schemas/)encodeRetryableTicketparams (addresses, gas params, calldata)arbOwnerPrepareTransactionRequestparams (functionName, upgradeExecutor, account)schemas/index.tsExample script:
transferOwnership.tsrunScriptharness with zod schema + transformOut of scope
prepareRetryableTicketTransactionRequest(callers composeencodeRetryableTicketoutput with either direct Inbox call or UpgradeExecutor wrapping as needed)Motivation
Mirrors the
transferOwnershipscript from chains-playground, but using SDK functions and the scripting harness. Steps 1 and 6 already work with existingupgradeExecutorPrepareAdd/RemoveExecutorTransactionRequestfunctions. Steps 2-5 need the new retryable/L2 message primitives from OffchainLabs/arbitrum-sdk#639.