* feat: v2 wallet * feat: Web3Wallet sign integration * chore: adds `core` to package.json * feat: Web3Wallet Auth integration * chore: core & web3wallet canary * chore: rm config * chore: force redeploy * chore: rm core & sign-client deps * fix: rm `sign-client` usage * refactor: updates README * feat: adds metadata mock obj & removes relay url param * refactor: more url mentions * refactor: rm v2 wallet readme references & uses web3wallet.core... * refactor: wallet -> web3wallet * refactor: rm wallet to web3wallet * fix: adds async to example listeners
57 lines
1.1 KiB
TypeScript
57 lines
1.1 KiB
TypeScript
import { SessionTypes, SignClientTypes } from '@walletconnect/types'
|
|
import { Web3WalletTypes } from '@walletconnect/web3wallet'
|
|
import { proxy } from 'valtio'
|
|
|
|
/**
|
|
* Types
|
|
*/
|
|
interface ModalData {
|
|
proposal?: SignClientTypes.EventArguments['session_proposal']
|
|
requestEvent?: SignClientTypes.EventArguments['session_request']
|
|
requestSession?: SessionTypes.Struct
|
|
request?: Web3WalletTypes.AuthRequest
|
|
}
|
|
|
|
interface State {
|
|
open: boolean
|
|
view?:
|
|
| 'SessionProposalModal'
|
|
| 'SessionSignModal'
|
|
| 'SessionSignTypedDataModal'
|
|
| 'SessionSendTransactionModal'
|
|
| 'SessionUnsuportedMethodModal'
|
|
| 'SessionSignCosmosModal'
|
|
| 'SessionSignSolanaModal'
|
|
| 'SessionSignPolkadotModal'
|
|
| 'SessionSignNearModal'
|
|
| 'SessionSignElrondModal'
|
|
| 'AuthRequestModal'
|
|
data?: ModalData
|
|
}
|
|
|
|
/**
|
|
* State
|
|
*/
|
|
const state = proxy<State>({
|
|
open: false
|
|
})
|
|
|
|
/**
|
|
* Store / Actions
|
|
*/
|
|
const ModalStore = {
|
|
state,
|
|
|
|
open(view: State['view'], data: State['data']) {
|
|
state.view = view
|
|
state.data = data
|
|
state.open = true
|
|
},
|
|
|
|
close() {
|
|
state.open = false
|
|
}
|
|
}
|
|
|
|
export default ModalStore
|