Skip to content

Commit

Permalink
Add timelock property to AddLockSig type and update useEVM to include it
Browse files Browse the repository at this point in the history
  • Loading branch information
arentant committed Dec 12, 2024
1 parent 49b2d13 commit 1e8bd23
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 17 deletions.
1 change: 1 addition & 0 deletions lib/layerSwapApiClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ export type AddLockSig = {
v: string
signer_address: string,
signature: string
timelock: number
}

export type CommitFromApi = {
Expand Down
36 changes: 19 additions & 17 deletions lib/wallets/evm/useEVM.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,30 +250,32 @@ export default function useEVM(): WalletProvider {
});

const sig = ethers.utils.splitSignature(signature)
debugger

const addLockSigResult = account.address && await apiClient.AddLockSig({
signature,
signer_address: account.address,
v: sig.v.toString(),
r: sig.r,
s: sig.s
s: sig.s,
timelock: timeLock,
}, id)

const { request, result } = await simulateContract(config, {
abi: abi,
address: contractAddress,
functionName: 'addLockSig',
args: [
message,
sig.r,
sig.s,
sig.v
],
chainId: Number(chainId),
})

const hash = await writeContract(config, request)
return { hash, result: result }
// const { request, result } = await simulateContract(config, {
// abi: abi,
// address: contractAddress,
// functionName: 'addLockSig',
// args: [
// message,
// sig.r,
// sig.s,
// sig.v
// ],
// chainId: Number(chainId),
// })

// const hash = await writeContract(config, request)
// return { hash, result: result }
return { hash: 'addLockSigResult', result: 'addLockSigResult' }
}

const refund = async (params: RefundParams) => {
Expand Down

0 comments on commit 1e8bd23

Please sign in to comment.