Skip to content

Commit

Permalink
feat: FRAME_READY event schema (#3001)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomiir authored Oct 3, 2024
1 parent e1081e9 commit 6ad2530
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 1 deletion.
40 changes: 40 additions & 0 deletions .changeset/proud-pugs-kneel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
'@reown/appkit-wallet': patch
'@apps/demo': patch
'@apps/gallery': patch
'@apps/laboratory': patch
'@examples/html-ethers': patch
'@examples/html-ethers5': patch
'@examples/html-wagmi': patch
'@examples/next-ethers': patch
'@examples/next-wagmi': patch
'@examples/next-wagmi-app-router': patch
'@examples/next-wagmi-pages-router': patch
'@examples/react-ethers': patch
'@examples/react-ethers5': patch
'@examples/react-solana': patch
'@examples/react-wagmi': patch
'@examples/vue-ethers5': patch
'@examples/vue-solana': patch
'@examples/vue-wagmi': patch
'@reown/appkit-adapter-ethers': patch
'@reown/appkit-adapter-ethers5': patch
'@reown/appkit-adapter-polkadot': patch
'@reown/appkit-adapter-solana': patch
'@reown/appkit-adapter-wagmi': patch
'@reown/appkit': patch
'@reown/appkit-utils': patch
'@reown/appkit-cdn': patch
'@reown/appkit-common': patch
'@reown/appkit-core': patch
'@reown/appkit-ethers': patch
'@reown/appkit-ethers5': patch
'@reown/appkit-polyfills': patch
'@reown/appkit-scaffold-ui': patch
'@reown/appkit-siwe': patch
'@reown/appkit-solana': patch
'@reown/appkit-ui': patch
'@reown/appkit-wagmi': patch
---

Adds FRAME_READY event for W3mFrameProvider
1 change: 1 addition & 0 deletions packages/wallet/src/W3mFrameConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export const W3mFrameConstants = {
FRAME_INIT_SMART_ACCOUNT_ERROR: '@w3m-frame/INIT_SMART_ACCOUNT_ERROR',
FRAME_SET_PREFERRED_ACCOUNT_SUCCESS: '@w3m-frame/SET_PREFERRED_ACCOUNT_SUCCESS',
FRAME_SET_PREFERRED_ACCOUNT_ERROR: '@w3m-frame/SET_PREFERRED_ACCOUNT_ERROR',
FRAME_READY: '@w3m-frame/READY',

RPC_RESPONSE_TYPE_ERROR: 'RPC_RESPONSE_ERROR',
RPC_RESPONSE_TYPE_TX: 'RPC_RESPONSE_TRANSACTION_HASH',
Expand Down
7 changes: 7 additions & 0 deletions packages/wallet/src/W3mFrameSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,12 @@ export const FrameInitSmartAccountResponse = z.object({
address: z.string(),
isDeployed: z.boolean()
})

export const FrameReadyResponse = z.object({
// Placeholder for future data
version: z.string().optional()
})

export const FrameSetPreferredAccountResponse = z.object({ type: z.string(), address: z.string() })

export const RpcResponse = z.any()
Expand Down Expand Up @@ -719,4 +725,5 @@ export const W3mFrameSchema = {
payload: zError
})
)
.or(EventSchema.extend({ type: zType('FRAME_READY'), payload: FrameReadyResponse }))
}
4 changes: 3 additions & 1 deletion packages/wallet/src/W3mFrameTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ import {
RpcSolanaSignMessageRequest,
RpcSolanaSignTransactionRequest,
RpcSolanaSignAndSendTransactionRequest,
RpcSolanaSignAllTransactionsRequest
RpcSolanaSignAllTransactionsRequest,
FrameReadyResponse
} from './W3mFrameSchema.js'
import type { W3mFrameRpcConstants } from './W3mFrameConstants.js'
import type { CaipNetworkId } from '@reown/appkit-common'
Expand Down Expand Up @@ -128,6 +129,7 @@ export namespace W3mFrameTypes {
FrameSetPreferredAccountResponse: z.infer<typeof FrameSetPreferredAccountResponse>
FrameSignOutResponse: undefined
FrameRpcResponse: RPCResponse
FrameReadyResponse: z.infer<typeof FrameReadyResponse>
}

export interface Network {
Expand Down

0 comments on commit 6ad2530

Please sign in to comment.