@farcaster/frame-core 0.2.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/dist/index.d.ts +372 -10
  2. package/dist/index.js +18 -33
  3. package/esm/index.d.ts +372 -10
  4. package/esm/index.js +17 -10
  5. package/esm/tsconfig.tsbuildinfo +1 -1
  6. package/package.json +6 -8
  7. package/src/index.ts +50 -10
  8. package/dist/actions/AddMiniApp.d.ts +0 -36
  9. package/dist/actions/AddMiniApp.js +0 -57
  10. package/dist/actions/ComposeCast.d.ts +0 -37
  11. package/dist/actions/ComposeCast.js +0 -2
  12. package/dist/actions/Haptics.d.ts +0 -5
  13. package/dist/actions/Haptics.js +0 -2
  14. package/dist/actions/Ready.d.ts +0 -13
  15. package/dist/actions/Ready.js +0 -6
  16. package/dist/actions/SendToken.d.ts +0 -48
  17. package/dist/actions/SendToken.js +0 -2
  18. package/dist/actions/SignIn.d.ts +0 -55
  19. package/dist/actions/SignIn.js +0 -47
  20. package/dist/actions/SwapToken.d.ts +0 -46
  21. package/dist/actions/SwapToken.js +0 -2
  22. package/dist/actions/ViewCast.d.ts +0 -25
  23. package/dist/actions/ViewCast.js +0 -2
  24. package/dist/actions/ViewProfile.d.ts +0 -4
  25. package/dist/actions/ViewProfile.js +0 -2
  26. package/dist/actions/ViewToken.d.ts +0 -4
  27. package/dist/actions/ViewToken.js +0 -2
  28. package/dist/actions/index.d.ts +0 -10
  29. package/dist/actions/index.js +0 -46
  30. package/dist/back.d.ts +0 -13
  31. package/dist/back.js +0 -6
  32. package/dist/context.d.ts +0 -94
  33. package/dist/context.js +0 -2
  34. package/dist/errors.d.ts +0 -13
  35. package/dist/errors.js +0 -12
  36. package/dist/internal/types.d.ts +0 -8
  37. package/dist/internal/types.js +0 -2
  38. package/dist/manifest.d.ts +0 -107
  39. package/dist/manifest.js +0 -2
  40. package/dist/schemas/embeds.d.ts +0 -243
  41. package/dist/schemas/embeds.js +0 -32
  42. package/dist/schemas/events.d.ts +0 -131
  43. package/dist/schemas/events.js +0 -25
  44. package/dist/schemas/index.d.ts +0 -5
  45. package/dist/schemas/index.js +0 -21
  46. package/dist/schemas/manifest.d.ts +0 -348
  47. package/dist/schemas/manifest.js +0 -114
  48. package/dist/schemas/notifications.d.ts +0 -60
  49. package/dist/schemas/notifications.js +0 -23
  50. package/dist/schemas/shared.d.ts +0 -40
  51. package/dist/schemas/shared.js +0 -83
  52. package/dist/solana.d.ts +0 -72
  53. package/dist/solana.js +0 -15
  54. package/dist/solanaWire.d.ts +0 -3
  55. package/dist/solanaWire.js +0 -84
  56. package/dist/types.d.ts +0 -87
  57. package/dist/types.js +0 -41
  58. package/dist/wallet/ethereum.d.ts +0 -47
  59. package/dist/wallet/ethereum.js +0 -2
  60. package/dist/wallet/index.d.ts +0 -1
  61. package/dist/wallet/index.js +0 -37
  62. package/esm/actions/AddMiniApp.d.ts +0 -36
  63. package/esm/actions/AddMiniApp.js +0 -19
  64. package/esm/actions/ComposeCast.d.ts +0 -37
  65. package/esm/actions/ComposeCast.js +0 -1
  66. package/esm/actions/Haptics.d.ts +0 -5
  67. package/esm/actions/Haptics.js +0 -1
  68. package/esm/actions/Ready.d.ts +0 -13
  69. package/esm/actions/Ready.js +0 -3
  70. package/esm/actions/SendToken.d.ts +0 -48
  71. package/esm/actions/SendToken.js +0 -1
  72. package/esm/actions/SignIn.d.ts +0 -55
  73. package/esm/actions/SignIn.js +0 -10
  74. package/esm/actions/SwapToken.d.ts +0 -46
  75. package/esm/actions/SwapToken.js +0 -1
  76. package/esm/actions/ViewCast.d.ts +0 -25
  77. package/esm/actions/ViewCast.js +0 -1
  78. package/esm/actions/ViewProfile.d.ts +0 -4
  79. package/esm/actions/ViewProfile.js +0 -1
  80. package/esm/actions/ViewToken.d.ts +0 -4
  81. package/esm/actions/ViewToken.js +0 -1
  82. package/esm/actions/index.d.ts +0 -10
  83. package/esm/actions/index.js +0 -10
  84. package/esm/back.d.ts +0 -13
  85. package/esm/back.js +0 -3
  86. package/esm/context.d.ts +0 -94
  87. package/esm/context.js +0 -1
  88. package/esm/errors.d.ts +0 -13
  89. package/esm/errors.js +0 -8
  90. package/esm/internal/types.d.ts +0 -8
  91. package/esm/internal/types.js +0 -1
  92. package/esm/manifest.d.ts +0 -107
  93. package/esm/manifest.js +0 -1
  94. package/esm/schemas/embeds.d.ts +0 -243
  95. package/esm/schemas/embeds.js +0 -28
  96. package/esm/schemas/events.d.ts +0 -131
  97. package/esm/schemas/events.js +0 -22
  98. package/esm/schemas/index.d.ts +0 -5
  99. package/esm/schemas/index.js +0 -5
  100. package/esm/schemas/manifest.d.ts +0 -348
  101. package/esm/schemas/manifest.js +0 -111
  102. package/esm/schemas/notifications.d.ts +0 -60
  103. package/esm/schemas/notifications.js +0 -20
  104. package/esm/schemas/shared.d.ts +0 -40
  105. package/esm/schemas/shared.js +0 -79
  106. package/esm/solana.d.ts +0 -72
  107. package/esm/solana.js +0 -11
  108. package/esm/solanaWire.d.ts +0 -3
  109. package/esm/solanaWire.js +0 -80
  110. package/esm/types.d.ts +0 -87
  111. package/esm/types.js +0 -23
  112. package/esm/wallet/ethereum.d.ts +0 -47
  113. package/esm/wallet/ethereum.js +0 -1
  114. package/esm/wallet/index.d.ts +0 -1
  115. package/esm/wallet/index.js +0 -1
  116. package/src/actions/AddMiniApp.ts +0 -51
  117. package/src/actions/ComposeCast.ts +0 -44
  118. package/src/actions/Haptics.ts +0 -9
  119. package/src/actions/Ready.ts +0 -15
  120. package/src/actions/SendToken.ts +0 -57
  121. package/src/actions/SignIn.ts +0 -67
  122. package/src/actions/SwapToken.ts +0 -54
  123. package/src/actions/ViewCast.ts +0 -27
  124. package/src/actions/ViewProfile.ts +0 -5
  125. package/src/actions/ViewToken.ts +0 -5
  126. package/src/actions/index.ts +0 -10
  127. package/src/back.ts +0 -15
  128. package/src/context.ts +0 -117
  129. package/src/errors.ts +0 -21
  130. package/src/internal/types.ts +0 -20
  131. package/src/manifest.ts +0 -120
  132. package/src/schemas/embeds.ts +0 -44
  133. package/src/schemas/events.ts +0 -41
  134. package/src/schemas/index.ts +0 -5
  135. package/src/schemas/manifest.ts +0 -125
  136. package/src/schemas/notifications.ts +0 -33
  137. package/src/schemas/shared.ts +0 -109
  138. package/src/solana.ts +0 -108
  139. package/src/solanaWire.ts +0 -120
  140. package/src/types.ts +0 -155
  141. package/src/wallet/ethereum.ts +0 -65
  142. package/src/wallet/index.ts +0 -1
@@ -1,109 +0,0 @@
1
- import { z } from 'zod'
2
-
3
- const SPECIAL_CHARS_PATTERN = /[@#$%^&*+=\/\\|~«»]/
4
- const REPEATED_PUNCTUATION_PATTERN = /(!{2,}|\?{2,}|-{2,})/
5
-
6
- // Unicode ranges for emoji detection:
7
- // \u{1F300}-\u{1F9FF} - Miscellaneous Symbols, Pictographs, Emoticons, Transport, Map, and Supplemental
8
- // \u{2702}-\u{27B0} - Dingbats
9
- // \u{2600}-\u{26FF} - Miscellaneous Symbols
10
- // \u{2B00}-\u{2BFF} - Miscellaneous Symbols and Arrows
11
- const EMOJI_PATTERN =
12
- /[\u{1F300}-\u{1F9FF}]|[\u{2702}-\u{27B0}]|[\u{2600}-\u{26FF}]|[\u{2B00}-\u{2BFF}]/u
13
-
14
- export const createSimpleStringSchema = ({
15
- max,
16
- noSpaces,
17
- }: { max?: number; noSpaces?: boolean } = {}) => {
18
- const stringValidations = noSpaces
19
- ? z
20
- .string()
21
- .max(max ?? Number.POSITIVE_INFINITY)
22
- .regex(/^\S*$/, 'Spaces are not allowed')
23
- : z.string().max(max ?? Number.POSITIVE_INFINITY)
24
-
25
- return stringValidations
26
- .refine((value) => !EMOJI_PATTERN.test(value), {
27
- message: 'Emojis and symbols are not allowed',
28
- })
29
- .refine((value) => !SPECIAL_CHARS_PATTERN.test(value), {
30
- message:
31
- 'Special characters (@, #, $, %, ^, &, *, +, =, /, \\, |, ~, «, ») are not allowed',
32
- })
33
- .refine((value) => !REPEATED_PUNCTUATION_PATTERN.test(value), {
34
- message: 'Repeated punctuations (!!, ??, --) are not allowed',
35
- })
36
- }
37
-
38
- export const secureUrlSchema = z
39
- .string()
40
- .url()
41
- .startsWith('https://', { message: 'Must be an https url' })
42
- .max(1024)
43
-
44
- export const frameNameSchema = z.string().max(32)
45
- export const buttonTitleSchema = z.string().max(32)
46
-
47
- const CAIP_19_REGEX =
48
- /^[-a-z0-9]{3,8}:[-_a-zA-Z0-9]{1,32}\/(?:[-a-z0-9]{3,8}:[-.%a-zA-Z0-9]{1,128}(?:\/[-.%a-zA-Z0-9]{1,78})?|native)$/
49
-
50
- export const caip19TokenSchema = z
51
- .string()
52
- .regex(CAIP_19_REGEX, { message: 'Invalid CAIP-19 asset ID' })
53
-
54
- export const hexColorSchema = z
55
- .string()
56
- .regex(/^#([0-9A-F]{3}|[0-9A-F]{6})$/i, {
57
- message:
58
- 'Invalid hex color code. It should be in the format #RRGGBB or #RGB.',
59
- })
60
-
61
- // Domain validation regex:
62
- // - Each label (part between dots) must start and end with alphanumeric
63
- // - Labels can contain hyphens in the middle
64
- // - Cannot have consecutive dots
65
- // - Must have at least one dot (TLD required)
66
- // - TLD must be at least 2 characters and only letters
67
- const DOMAIN_REGEX =
68
- /^(?!.*\.\.)([a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/
69
-
70
- export const domainSchema = z
71
- .string()
72
- .max(1024)
73
- .regex(DOMAIN_REGEX, {
74
- message: 'Must be a valid domain name (e.g., example.com, sub.example.com)',
75
- })
76
- .refine((value) => !value.includes('://'), {
77
- message: 'Domain must not include protocol (http://, https://, etc.)',
78
- })
79
- .refine((value) => !value.includes('/'), {
80
- message: 'Domain must not include path separators',
81
- })
82
- .refine((value) => !value.includes('@'), {
83
- message: 'Domain must not include @ symbol',
84
- })
85
- .refine((value) => !value.includes(':'), {
86
- message: 'Domain must not include port numbers',
87
- })
88
-
89
- export const aspectRatioSchema = z.union([z.literal('1:1'), z.literal('3:2')])
90
-
91
- export const encodedJsonFarcasterSignatureSchema = z.object({
92
- header: z.string(),
93
- payload: z.string(),
94
- signature: z.string(),
95
- })
96
-
97
- export type EncodedJsonFarcasterSignatureSchema = z.infer<
98
- typeof encodedJsonFarcasterSignatureSchema
99
- >
100
-
101
- export const jsonFarcasterSignatureHeaderSchema = z.object({
102
- fid: z.number(),
103
- type: z.literal('app_key'),
104
- key: z.string().startsWith('0x'),
105
- })
106
-
107
- export type JsonFarcasterSignatureHeaderSchema = z.infer<
108
- typeof jsonFarcasterSignatureHeaderSchema
109
- >
package/src/solana.ts DELETED
@@ -1,108 +0,0 @@
1
- import {
2
- Connection as SolanaConnection,
3
- type SendOptions as SolanaSendOptions,
4
- type Transaction as SolanaTransaction,
5
- type VersionedTransaction as SolanaVersionedTransaction,
6
- } from '@solana/web3.js'
7
-
8
- export { SolanaConnection }
9
- export type { SolanaSendOptions }
10
-
11
- export type SolanaCombinedTransaction =
12
- | SolanaTransaction
13
- | SolanaVersionedTransaction
14
-
15
- export type SolanaConnectRequestArguments = {
16
- method: 'connect'
17
- }
18
- export type SolanaSignMessageRequestArguments = {
19
- method: 'signMessage'
20
- params: {
21
- message: string
22
- }
23
- }
24
- export type SolanaSignAndSendTransactionRequestArguments = {
25
- method: 'signAndSendTransaction'
26
- params: {
27
- transaction: SolanaCombinedTransaction
28
- options?: SolanaSendOptions
29
- }
30
- }
31
- export type SolanaSignTransactionRequestArguments<
32
- T extends SolanaCombinedTransaction = SolanaTransaction,
33
- > = {
34
- method: 'signTransaction'
35
- params: {
36
- transaction: T
37
- }
38
- }
39
-
40
- export type SolanaRequestFn = ((
41
- request: SolanaConnectRequestArguments,
42
- ) => Promise<{ publicKey: string }>) &
43
- ((request: SolanaSignMessageRequestArguments) => Promise<{
44
- signature: string
45
- }>) &
46
- ((request: SolanaSignAndSendTransactionRequestArguments) => Promise<{
47
- signature: string
48
- }>) &
49
- (<T extends SolanaCombinedTransaction>(
50
- request: SolanaSignTransactionRequestArguments<T>,
51
- ) => Promise<{ signedTransaction: T }>)
52
-
53
- export interface SolanaWalletProvider {
54
- request: SolanaRequestFn
55
-
56
- signMessage(message: string): Promise<{ signature: string }>
57
- signTransaction<T extends SolanaCombinedTransaction>(
58
- transaction: T,
59
- ): Promise<{ signedTransaction: T }>
60
- signAndSendTransaction(input: {
61
- transaction: SolanaCombinedTransaction
62
- }): Promise<{ signature: string }>
63
- }
64
-
65
- export const createSolanaWalletProvider = (
66
- request: SolanaRequestFn,
67
- ): SolanaWalletProvider => ({
68
- request,
69
- signMessage: (msg: string) =>
70
- request({ method: 'signMessage', params: { message: msg } }),
71
- signTransaction: <T extends SolanaCombinedTransaction>(transaction: T) =>
72
- request({ method: 'signTransaction', params: { transaction } }),
73
- signAndSendTransaction: (input: {
74
- transaction: SolanaCombinedTransaction
75
- }) =>
76
- request({
77
- method: 'signAndSendTransaction',
78
- params: input,
79
- }),
80
- })
81
-
82
- export type SolanaWireSignAndSendTransactionRequestArguments = {
83
- method: 'signAndSendTransaction'
84
- params: {
85
- transaction: string
86
- options?: SolanaSendOptions
87
- }
88
- }
89
-
90
- export type SolanaWireSignTransactionRequestArguments = {
91
- method: 'signTransaction'
92
- params: {
93
- transaction: string
94
- }
95
- }
96
-
97
- export type SolanaWireRequestFn = ((
98
- request: SolanaConnectRequestArguments,
99
- ) => Promise<{ publicKey: string }>) &
100
- ((request: SolanaSignMessageRequestArguments) => Promise<{
101
- signature: string
102
- }>) &
103
- ((request: SolanaWireSignAndSendTransactionRequestArguments) => Promise<{
104
- signature: string
105
- }>) &
106
- ((
107
- request: SolanaWireSignTransactionRequestArguments,
108
- ) => Promise<{ signedTransaction: string }>)
package/src/solanaWire.ts DELETED
@@ -1,120 +0,0 @@
1
- import {
2
- Transaction as SolanaTransaction,
3
- VersionedMessage as SolanaVersionedMessage,
4
- VersionedTransaction as SolanaVersionedTransaction,
5
- } from '@solana/web3.js'
6
-
7
- import type {
8
- SolanaCombinedTransaction,
9
- SolanaConnectRequestArguments,
10
- SolanaRequestFn,
11
- SolanaSignAndSendTransactionRequestArguments,
12
- SolanaSignMessageRequestArguments,
13
- SolanaSignTransactionRequestArguments,
14
- SolanaWireRequestFn,
15
- SolanaWireSignAndSendTransactionRequestArguments,
16
- SolanaWireSignTransactionRequestArguments,
17
- } from './solana.ts'
18
-
19
- function serializeTransaction(transaction: SolanaCombinedTransaction): string {
20
- return Buffer.from(
21
- transaction.serialize({
22
- verifySignatures: false,
23
- }),
24
- ).toString('base64')
25
- }
26
-
27
- function unserializeTransaction(
28
- transaction: string,
29
- ): SolanaCombinedTransaction {
30
- const bytes = Buffer.from(transaction, 'base64')
31
- const version = SolanaVersionedMessage.deserializeMessageVersion(bytes)
32
- return version === 'legacy'
33
- ? SolanaVersionedTransaction.deserialize(bytes)
34
- : SolanaTransaction.from(bytes)
35
- }
36
-
37
- export function wrapSolanaProviderRequest(
38
- requestFn: SolanaRequestFn,
39
- ): SolanaWireRequestFn {
40
- const wrappedFn = async (
41
- request:
42
- | SolanaConnectRequestArguments
43
- | SolanaSignMessageRequestArguments
44
- | SolanaWireSignAndSendTransactionRequestArguments
45
- | SolanaWireSignTransactionRequestArguments,
46
- ) => {
47
- if (request.method === 'connect') {
48
- return await requestFn(request)
49
- }
50
- if (request.method === 'signMessage') {
51
- return await requestFn(request)
52
- }
53
- if (request.method === 'signAndSendTransaction') {
54
- const { transaction, options } = request.params
55
- const params = {
56
- transaction: unserializeTransaction(transaction),
57
- options,
58
- }
59
- return await requestFn({
60
- method: 'signAndSendTransaction',
61
- params,
62
- })
63
- }
64
- if (request.method === 'signTransaction') {
65
- const { transaction } = request.params
66
- const params = {
67
- transaction: unserializeTransaction(transaction),
68
- }
69
- const { signedTransaction } = await requestFn({
70
- method: 'signTransaction',
71
- params,
72
- })
73
- return {
74
- signedTransaction: serializeTransaction(signedTransaction),
75
- }
76
- }
77
- }
78
- return wrappedFn as SolanaWireRequestFn
79
- }
80
-
81
- export function unwrapSolanaProviderRequest(
82
- wrappedRequestFn: SolanaWireRequestFn,
83
- ): SolanaRequestFn {
84
- const unwrappedFn = async <T extends SolanaCombinedTransaction>(
85
- request:
86
- | SolanaConnectRequestArguments
87
- | SolanaSignMessageRequestArguments
88
- | SolanaSignAndSendTransactionRequestArguments
89
- | SolanaSignTransactionRequestArguments<T>,
90
- ) => {
91
- if (request.method === 'connect') {
92
- return await wrappedRequestFn(request)
93
- }
94
- if (request.method === 'signMessage') {
95
- return await wrappedRequestFn(request)
96
- }
97
- if (request.method === 'signAndSendTransaction') {
98
- const { transaction, options } = request.params
99
- const params = {
100
- transaction: serializeTransaction(transaction),
101
- }
102
- return await wrappedRequestFn({
103
- method: 'signAndSendTransaction',
104
- params,
105
- })
106
- }
107
- if (request.method === 'signTransaction') {
108
- const { transaction } = request.params
109
- const params = {
110
- transaction: serializeTransaction(transaction),
111
- }
112
- const { signedTransaction } = await wrappedRequestFn({
113
- method: 'signTransaction',
114
- params,
115
- })
116
- return { signedTransaction: unserializeTransaction(signedTransaction) }
117
- }
118
- }
119
- return unwrappedFn as SolanaRequestFn
120
- }
package/src/types.ts DELETED
@@ -1,155 +0,0 @@
1
- import type {
2
- ImpactOccurred,
3
- NotificationOccurred,
4
- SelectionChanged,
5
- } from './actions/Haptics.ts'
6
- import type {
7
- AddMiniApp,
8
- ComposeCast,
9
- Ready,
10
- SendToken,
11
- SignIn,
12
- SwapToken,
13
- ViewCast,
14
- ViewProfile,
15
- ViewToken,
16
- } from './actions/index.ts'
17
- import type { UpdateBackState } from './back.ts'
18
- import type { FrameContext } from './context.ts'
19
- import type {
20
- EventFrameAdded,
21
- EventFrameRemoved,
22
- EventNotificationsDisabled,
23
- EventNotificationsEnabled,
24
- } from './schemas/index.ts'
25
- import type { SolanaRequestFn, SolanaWireRequestFn } from './solana.ts'
26
- import type { Ethereum } from './wallet/index.ts'
27
-
28
- export type SetPrimaryButtonOptions = {
29
- text: string
30
- loading?: boolean
31
- disabled?: boolean
32
- hidden?: boolean
33
- }
34
-
35
- // start backwards compat, remove in 1.0
36
- export * from './wallet/ethereum.ts'
37
- export { DEFAULT_READY_OPTIONS, ReadyOptions } from './actions/Ready.ts'
38
- export type SignInOptions = SignIn.SignInOptions
39
- // end backwards compat
40
-
41
- export type SetPrimaryButton = (options: SetPrimaryButtonOptions) => void
42
-
43
- // Export haptics types
44
- export type { ImpactOccurred, NotificationOccurred, SelectionChanged }
45
-
46
- export const miniAppHostCapabilityList = [
47
- 'wallet.getEthereumProvider',
48
- 'wallet.getSolanaProvider',
49
- 'actions.ready',
50
- 'actions.openUrl',
51
- 'actions.close',
52
- 'actions.setPrimaryButton',
53
- 'actions.addMiniApp',
54
- 'actions.signIn',
55
- 'actions.viewCast',
56
- 'actions.viewProfile',
57
- 'actions.composeCast',
58
- 'actions.viewToken',
59
- 'actions.sendToken',
60
- 'actions.swapToken',
61
- 'haptics.impactOccurred',
62
- 'haptics.notificationOccurred',
63
- 'haptics.selectionChanged',
64
- 'back',
65
- ] as const
66
-
67
- export type MiniAppHostCapability = (typeof miniAppHostCapabilityList)[number]
68
-
69
- export type GetCapabilities = () => Promise<MiniAppHostCapability[]>
70
-
71
- // Returns a list of CAIP-2 identifiers
72
- export type GetChains = () => Promise<string[]>
73
-
74
- export type WireFrameHost = {
75
- context: FrameContext
76
- close: () => void
77
- ready: Ready.Ready
78
- openUrl: (url: string) => void
79
- signIn: SignIn.WireSignIn
80
- setPrimaryButton: SetPrimaryButton
81
- ethProviderRequest: Ethereum.EthProvideRequest
82
- ethProviderRequestV2: Ethereum.RpcTransport
83
- eip6963RequestProvider: () => void
84
- solanaProviderRequest?: SolanaWireRequestFn
85
- addFrame: AddMiniApp.WireAddMiniApp
86
- viewCast: ViewCast.ViewCast
87
- viewProfile: ViewProfile.ViewProfile
88
- viewToken: ViewToken.ViewToken
89
- sendToken: SendToken.SendToken
90
- swapToken: SwapToken.SwapToken
91
- composeCast: <close extends boolean | undefined = undefined>(
92
- options: ComposeCast.Options<close>,
93
- ) => Promise<ComposeCast.Result<close>>
94
- impactOccurred: ImpactOccurred
95
- notificationOccurred: NotificationOccurred
96
- selectionChanged: SelectionChanged
97
- getCapabilities: GetCapabilities
98
- getChains: GetChains
99
- updateBackState: UpdateBackState
100
- }
101
-
102
- export type FrameHost = {
103
- context: FrameContext
104
- close: () => void
105
- ready: Ready.Ready
106
- openUrl: (url: string) => void
107
- signIn: SignIn.SignIn
108
- setPrimaryButton: SetPrimaryButton
109
- ethProviderRequest: Ethereum.EthProvideRequest
110
- ethProviderRequestV2: Ethereum.RpcTransport
111
- /**
112
- * Receive forwarded eip6963:requestProvider events from the frame document.
113
- * Hosts must emit an EventEip6963AnnounceProvider in response.
114
- */
115
- eip6963RequestProvider: () => void
116
- solanaProviderRequest?: SolanaRequestFn
117
- addFrame: AddMiniApp.AddMiniApp
118
- viewCast: ViewCast.ViewCast
119
- viewProfile: ViewProfile.ViewProfile
120
- viewToken: ViewToken.ViewToken
121
- sendToken: SendToken.SendToken
122
- swapToken: SwapToken.SwapToken
123
- composeCast: <close extends boolean | undefined = undefined>(
124
- options: ComposeCast.Options<close>,
125
- ) => Promise<ComposeCast.Result<close>>
126
- impactOccurred: ImpactOccurred
127
- notificationOccurred: NotificationOccurred
128
- selectionChanged: SelectionChanged
129
- getCapabilities: GetCapabilities
130
- getChains: GetChains
131
- updateBackState: UpdateBackState
132
- }
133
-
134
- export type EventFrameAddRejected = {
135
- event: 'frame_add_rejected'
136
- reason: AddMiniApp.AddMiniAppRejectedReason
137
- }
138
-
139
- export type EventPrimaryButtonClicked = {
140
- event: 'primary_button_clicked'
141
- }
142
-
143
- export type EventBackNavigationTriggered = {
144
- event: 'back_navigation_triggered'
145
- }
146
-
147
- export type FrameClientEvent =
148
- | EventFrameAdded
149
- | EventFrameAddRejected
150
- | EventFrameRemoved
151
- | EventNotificationsEnabled
152
- | EventNotificationsDisabled
153
- | EventPrimaryButtonClicked
154
- | EventBackNavigationTriggered
155
- | Ethereum.EventEip6963AnnounceProvider
@@ -1,65 +0,0 @@
1
- import type * as Address from 'ox/Address'
2
- import type * as Provider from 'ox/Provider'
3
- import type * as RpcRequest from 'ox/RpcRequest'
4
- import type * as RpcResponse from 'ox/RpcResponse'
5
- import type * as RpcSchema from 'ox/RpcSchema'
6
-
7
- export type EthProvideRequest<
8
- schema extends RpcSchema.Generic = RpcSchema.Default,
9
- > = Provider.RequestFn<schema>
10
-
11
- export type FrameEthProviderEventData = {
12
- type: 'frame_eth_provider_event'
13
- } & EthProviderWireEvent
14
-
15
- export type RpcTransport = (
16
- request: RpcRequest.RpcRequest,
17
- ) => Promise<RpcResponse.RpcResponse>
18
-
19
- export type ProviderRpcError = {
20
- code: number
21
- details?: string
22
- message?: string
23
- }
24
-
25
- export type EthProviderWireEvent =
26
- | {
27
- event: 'accountsChanged'
28
- params: [readonly Address.Address[]]
29
- }
30
- | {
31
- event: 'chainChanged'
32
- params: [string]
33
- }
34
- | {
35
- event: 'connect'
36
- params: [Provider.ConnectInfo]
37
- }
38
- | {
39
- event: 'disconnect'
40
- params: [ProviderRpcError]
41
- }
42
- | {
43
- event: 'message'
44
- params: [Provider.Message]
45
- }
46
-
47
- export type EmitEthProvider = <event extends EthProviderWireEvent['event']>(
48
- event: event,
49
- params: Extract<EthProviderWireEvent, { event: event }>['params'],
50
- ) => void
51
-
52
- /**
53
- * Metadata of the EIP-1193 Provider.
54
- */
55
- export interface EIP6963ProviderInfo {
56
- icon: `data:image/${string}` // RFC-2397
57
- name: string
58
- rdns: string
59
- uuid: string
60
- }
61
-
62
- export type EventEip6963AnnounceProvider = {
63
- event: 'eip6963:announceProvider'
64
- info: EIP6963ProviderInfo
65
- }
@@ -1 +0,0 @@
1
- export * as Ethereum from './ethereum.ts'