This guide details the steps required to add a new chain to the XP Validator for the decentralized bridge project.
- Create a new directory structure for the chain using the provided command:
CHAIN_NAME='YourChainNameHere' && \ mkdir -p src/handler/${CHAIN_NAME}/utils && \ touch src/handler/${CHAIN_NAME}/{index.ts,utils/{addSelfAsValidator.ts,generateWallet.ts,getBalance.ts,index.ts,listenForLockEvents.ts,log.ts,nftData.ts,selfIsValidator.ts,signClaimData.ts}}
utils/addSelfAsValidator.ts
: Returns a function allowing the running node to add itself as a validator in the bridge.utils/generateWallet.ts
: Returns a function to generate wallet keys for the chain.utils/getBalance.ts
: function to get native balance of chainutils/listenForLockEvents.ts
: Returns a function to listen to blockchain events.utils/log.ts
: returns a function for Chain colored logsutils/nftData.ts
: Returns a function to retrieve metadata for a specific NFT or NFT collection.utils/selfIsValidator.ts
: Returns a function to check if the node is currently added as a validator.utils/signClaimData.ts
: : Returns a function to sign NFT details.index.ts
: utilizes the created utility function to create chain handler
Add a configuration function for the chain in the src/deps.ts
file similar to other chains in the same file.
Add the chain to the configDeps()
function in src/deps.ts
as a new key with the chain name.
add chain's secret key pattern in secrets.example.json
file.