Skip to content

Commit

Permalink
fix wc v2 (#645)
Browse files Browse the repository at this point in the history
* fix kk rest

* fix kk rest

* fix wc v2
  • Loading branch information
amitojsingh366 authored Jun 16, 2023
1 parent 4ab2a65 commit aa5c26f
Show file tree
Hide file tree
Showing 14 changed files with 81 additions and 78 deletions.
24 changes: 12 additions & 12 deletions .pnp.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

Git LFS file not shown
Git LFS file not shown

This file was deleted.

3 changes: 0 additions & 3 deletions .yarn/cache/ethers-npm-6.4.1-4fa5cdd8df-7d268690ea.zip

This file was deleted.

3 changes: 3 additions & 0 deletions .yarn/cache/ethers-npm-6.6.0-36de8843c5-242f4fb205.zip
Git LFS file not shown
68 changes: 34 additions & 34 deletions packages/hdwallet-keepkey-rest/src/kkrest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1220,61 +1220,61 @@ export class KeepKeyRestHDWallet
{ signal },
)
).address

/*
*/

let signed: any
//switch statement
switch (msg.tx.msg[0].type) {
case 'thorchain/MsgDeposit':
console.log('thorchain/MsgDeposit MSG: ', msg)
signed = await this.sdk.thorchain.thorchainSignAminoDeposit(
{
signDoc: {
account_number: msg.account_number,
chain_id: msg.chain_id,
// TODO: busted openapi-generator types
// @ts-expect-error
msgs: msg.tx.msg,
memo: msg.tx.memo ?? '',
sequence: msg.sequence,
fee: {
gas: String(msg.fee ?? 0),
amount: [],
},
{
signDoc: {
account_number: msg.account_number,
chain_id: msg.chain_id,
// TODO: busted openapi-generator types
// @ts-expect-error
msgs: msg.tx.msg,
memo: msg.tx.memo ?? '',
sequence: msg.sequence,
fee: {
gas: String(msg.fee ?? 0),
amount: [],
},
signerAddress,
},
{ signal },
signerAddress,
},
{ signal },
)
break
case 'thorchain/MsgSend':
console.log('thorchain/MsgSend MSG: ', msg)
signed = await this.sdk.thorchain.thorchainSignAminoDeposit(
{
signDoc: {
account_number: msg.account_number,
chain_id: msg.chain_id,
// TODO: busted openapi-generator types
// @ts-expect-error
msgs: msg.tx.msg,
memo: msg.tx.memo ?? '',
sequence: msg.sequence,
fee: {
gas: String(msg.fee ?? 0),
amount: [],
},
{
signDoc: {
account_number: msg.account_number,
chain_id: msg.chain_id,
// TODO: busted openapi-generator types
// @ts-expect-error
msgs: msg.tx.msg,
memo: msg.tx.memo ?? '',
sequence: msg.sequence,
fee: {
gas: String(msg.fee ?? 0),
amount: [],
},
signerAddress,
},
{ signal },
signerAddress,
},
{ signal },
)
break
break
default:
throw Error('thorchain Msg not supported ' + msg.tx.msg[0].type)
}

return {
signatures: [signed.signature as string],
serialized: signed.serialized as string,
Expand Down
2 changes: 1 addition & 1 deletion packages/keepkey-desktop-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@
"eslint-plugin-jsx-a11y": "^6.6.1",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-simple-import-sort": "^7.0.0",
"ethers": "^6.4.1",
"ethers": "^6.6.0",
"fast-json-stable-stringify": "^2.1.0",
"fs-extra": "^10.0.0",
"git-semver-tags": "^4.1.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { getConfig } from 'config'
import { ethers } from 'ethers'
import { Interface } from 'ethers'
import type { FC, PropsWithChildren } from 'react'
import { createContext, useCallback, useContext, useEffect, useState } from 'react'

type ContractABIContextValue = {
contracts: Record<string, ethers.utils.Interface | null>
loadContract(address: string): Promise<ethers.utils.Interface>
contracts: Record<string, Interface | null>
loadContract(address: string): Promise<Interface>
}

const ContractABIContext = createContext<ContractABIContextValue>({
Expand All @@ -14,7 +14,7 @@ const ContractABIContext = createContext<ContractABIContextValue>({
})

export const ContractABIProvider: FC<PropsWithChildren> = ({ children }) => {
const [contracts, setMapping] = useState<Record<string, ethers.utils.Interface | null>>({})
const [contracts, setMapping] = useState<Record<string, Interface | null>>({})
const loadContract = useCallback(async (address: string) => {
try {
const res = await fetch(
Expand All @@ -25,7 +25,7 @@ export const ContractABIProvider: FC<PropsWithChildren> = ({ children }) => {
if (res.status !== '1') throw new Error(res.result)

const abi = JSON.parse(res.result)
const contract = new ethers.utils.Interface(abi)
const contract = new Interface(abi)
setMapping(prev => ({ ...prev, [address]: contract }))
return contract
} catch (error) {
Expand All @@ -41,7 +41,7 @@ export const ContractABIProvider: FC<PropsWithChildren> = ({ children }) => {
}

export function useContract(address: string): {
contract: ethers.utils.Interface | null
contract: Interface | null
loading: boolean
} {
const { contracts, loadContract } = useContext(ContractABIContext)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export const ContractInteractionBreakdown = ({ request }: { request: any }) => {

<Divider my={4} />
{!!transaction &&
transaction.functionFragment.inputs.map((input: any, index: any) => {
transaction.fragment.inputs.map((input: any, index: any) => {
return (
<Fragment key={index}>
<RawText ml={5} color='gray.500' fontWeight='medium'>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ import type { ethereum } from '@shapeshiftoss/chain-adapters'
import type { GasFeeDataEstimate } from '@shapeshiftoss/chain-adapters'
import { FeeDataKey } from '@shapeshiftoss/chain-adapters'
import type { BIP32Path } from '@shapeshiftoss/hdwallet-core'
import type { KeepKeyHDWallet } from '@shapeshiftoss/hdwallet-keepkey'
import { KnownChainIds } from '@shapeshiftoss/types'
import type { SignClientTypes } from '@walletconnect/types'
import axios from 'axios'
import { Card } from 'components/Card/Card'
import { KeepKeyIcon } from 'components/Icons/KeepKeyIcon'
import { Text } from 'components/Text'
import { getChainAdapterManager } from 'context/PluginProvider/chainAdapterSingleton'
import { useKeepKey } from 'context/WalletProvider/KeepKeyProvider'
import { useWallet } from 'hooks/useWallet/useWallet'
import { WalletConnectSignClient } from 'kkdesktop/walletconnect/utils'
import { bn, bnOrZero } from 'lib/bignumber/bignumber'
import { logger } from 'lib/logger'
Expand Down Expand Up @@ -58,7 +59,11 @@ const moduleLogger = logger.child({ namespace: 'EIP155SendTransactionConfirmatio
export const EIP155SendTransactionConfirmation = () => {
const translate = useTranslate()
const cardBg = useColorModeValue('white', 'gray.850')
const { keepKeyWallet } = useKeepKey()
const {
state: { wallet },
} = useWallet()

const keepKeyWallet = wallet as KeepKeyHDWallet | null

const adapterManager = useMemo(() => getChainAdapterManager(), [])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ import { useWalletConnect } from 'plugins/walletConnectToDapps/WalletConnectBrid
import { useState } from 'react'

export const SessionProposalModal = () => {
const { proposals, removeProposal, setPairingMeta, setCurrentSessionTopic, onDisconnect } =
useWalletConnect()
const { proposals, removeProposal, setPairingMeta, setCurrentSessionTopic } = useWalletConnect()

const currentProposal = proposals[0] as SignClientTypes.EventArguments['session_proposal']

Expand Down Expand Up @@ -91,7 +90,6 @@ export const SessionProposalModal = () => {
peer: { metadata },
topic,
} = await acknowledged()
onDisconnect()
setPairingMeta(metadata)
setCurrentSessionTopic(topic)
}
Expand Down
20 changes: 10 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ __metadata:
languageName: node
linkType: hard

"@adraffy/ens-normalize@git+https://github.com/ricmoo/ens-normalize.js.git":
version: 1.9.0
resolution: "@adraffy/ens-normalize@https://github.com/ricmoo/ens-normalize.js.git#commit=2d040533e57e4f25f9a7cc4715e219658ad454b5"
checksum: 5f5771008a78f1d819ddc2e7c27a5e48c269b491e9f17a52e2bdea2e42c7bdd9e1d812f37fe9cbc1379a755897b649b4375f4ad92140b92a9c04f8fcb2942788
"@adraffy/ens-normalize@npm:1.9.2":
version: 1.9.2
resolution: "@adraffy/ens-normalize@npm:1.9.2"
checksum: a9fdeb9e080774c19e4b7f9f60aa5b37cf23fe0e8fe80284bf8221f7396e9f78642bfd39a09a94a4dc3fb8e70f2ac81545204bdcaf222d93f4c4c2ae1f0dca0b
languageName: node
linkType: hard

Expand Down Expand Up @@ -14918,18 +14918,18 @@ __metadata:
languageName: node
linkType: hard

"ethers@npm:^6.4.1":
version: 6.4.1
resolution: "ethers@npm:6.4.1"
"ethers@npm:^6.6.0":
version: 6.6.0
resolution: "ethers@npm:6.6.0"
dependencies:
"@adraffy/ens-normalize": "git+https://github.com/ricmoo/ens-normalize.js.git"
"@adraffy/ens-normalize": 1.9.2
"@noble/hashes": 1.1.2
"@noble/secp256k1": 1.7.1
"@types/node": 18.15.13
aes-js: 4.0.0-beta.5
tslib: 2.4.0
ws: 8.5.0
checksum: 7d268690ea613537d81304d47ff7ee5147a499168a2eccf75499204fac05513ac82d57272cae070b346bce614c9e8afa96c7a47cb5c43a8029ed7616ddb12355
checksum: 242f4fb2050e7b3a3efc41fdf72965f2b128c4431f275cf1e34cf3accfb87102dfb72613f2d48aa075ba4462b6ef77bb990ba77c61ce6edac504532dbc06591c
languageName: node
linkType: hard

Expand Down Expand Up @@ -18335,7 +18335,7 @@ __metadata:
eslint-plugin-prettier: ^4.0.0
eslint-plugin-simple-import-sort: ^7.0.0
eth-url-parser: ^1.0.4
ethers: ^6.4.1
ethers: ^6.6.0
eventemitter2: ^6.4.9
express: ^4.18.2
fast-json-stable-stringify: ^2.1.0
Expand Down

0 comments on commit aa5c26f

Please sign in to comment.