Skip to content

Commit

Permalink
Merge pull request #53 from mateumiralles/dappnode-incentive-program-…
Browse files Browse the repository at this point in the history
…fixes

Dappnode Incentive program fixes
  • Loading branch information
Wagalidoom authored Aug 14, 2024
2 parents 583dcf5 + 082fffa commit d4dc12b
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions hooks/use-dappnode-deposit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ function useDappnodeDeposit(contractConfig: ContractNetwork | undefined, address

return { deposits: newDeposits, hasDuplicates, _isBatch };
},
[address, contractConfig, deposits]
[address, contractConfig, deposits, user]
);

const setDappnodeDepositData = useCallback(
Expand Down Expand Up @@ -202,9 +202,15 @@ function useDappnodeDeposit(contractConfig: ContractNetwork | undefined, address
deposit_data_roots: string[]
} = {pubkeys:'',signatures:'',deposit_data_roots:[]};

deposits.forEach((deposit) => {
data.pubkeys += deposit.pubkey.startsWith('0x') ? deposit.pubkey : `0x${deposit.pubkey}`;
data.signatures += deposit.signature.startsWith('0x') ? deposit.signature : `0x${deposit.signature}`;
deposits.forEach((deposit, i) => {
if (i === 0) {
data.pubkeys += deposit.pubkey.startsWith('0x') ? deposit.pubkey : `0x${deposit.pubkey}`;
data.signatures += deposit.signature.startsWith('0x') ? deposit.signature : `0x${deposit.signature}`;
} else {
data.pubkeys += deposit.pubkey.startsWith('0x') ? deposit.pubkey.slice(2) : deposit.pubkey;
data.signatures += deposit.signature.startsWith('0x') ? deposit.signature.slice(2) : deposit.signature;
}

data.deposit_data_roots.push(deposit.deposit_data_root.startsWith('0x') ? deposit.deposit_data_root : `0x${deposit.deposit_data_root}`);
});

Expand Down

0 comments on commit d4dc12b

Please sign in to comment.