(airnodeXpub: string, airnodeAddress: string)
| 136 | }; |
| 137 | |
| 138 | export 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 | |
| 149 | export function deriveSponsorWalletAddress(airnodeXpub: string, airnodeAddress: string, sponsorAddress: string) { |
| 150 | const hdNode = verifyAirnodeXpub(airnodeXpub, airnodeAddress); |
no outgoing calls
no test coverage detected