MCPcopy Create free account
hub / github.com/api3dao/airnode / verifyAirnodeXpub

Function verifyAirnodeXpub

packages/airnode-admin/src/implementation.ts:138–147  ·  view source on GitHub ↗
(airnodeXpub: string, airnodeAddress: string)

Source from the content-addressed store, hash-verified

136};
137
138export const verifyAirnodeXpub = (airnodeXpub: string, airnodeAddress: string): ethers.utils.HDNode => {
139 // The xpub is expected to belong to the hardened path m/44'/60'/0'
140 // so we must derive the child default derivation path m/44'/60'/0'/0/0
141 // to compare it and check if xpub belongs to the Airnode wallet
142 const hdNode = ethers.utils.HDNode.fromExtendedKey(airnodeXpub);
143 if (airnodeAddress !== hdNode.derivePath('0/0').address) {
144 throw new Error(`xpub does not belong to Airnode: ${airnodeAddress}`);
145 }
146 return hdNode;
147};
148
149export function deriveSponsorWalletAddress(airnodeXpub: string, airnodeAddress: string, sponsorAddress: string) {
150 const hdNode = verifyAirnodeXpub(airnodeXpub, airnodeAddress);

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected