@farcaster/frame-core 0.0.27 → 0.0.29
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.
- package/LICENSE +21 -0
- package/dist/actions/Ready.d.ts +13 -0
- package/dist/actions/Ready.js +6 -0
- package/dist/actions/index.d.ts +3 -2
- package/dist/actions/index.js +4 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/types.d.ts +12 -77
- package/dist/types.js +18 -3
- package/dist/wallet/ethereum.d.ts +43 -0
- package/dist/wallet/ethereum.js +2 -0
- package/dist/wallet/index.d.ts +1 -0
- package/dist/wallet/index.js +37 -0
- package/esm/actions/AddFrame.d.ts +27 -23
- package/esm/actions/AddFrame.js +9 -9
- package/esm/actions/Ready.d.ts +13 -0
- package/esm/actions/Ready.js +3 -0
- package/esm/actions/SignIn.d.ts +35 -33
- package/esm/actions/SignIn.js +5 -5
- package/esm/actions/Swap.d.ts +44 -43
- package/esm/actions/Swap.js +1 -1
- package/esm/actions/ViewProfile.d.ts +3 -3
- package/esm/actions/ViewProfile.js +1 -1
- package/esm/actions/ViewToken.d.ts +3 -3
- package/esm/actions/ViewToken.js +1 -1
- package/esm/actions/index.d.ts +6 -5
- package/esm/actions/index.js +6 -5
- package/esm/context.d.ts +65 -61
- package/esm/context.js +1 -1
- package/esm/errors.d.ts +9 -7
- package/esm/errors.js +6 -6
- package/esm/index.d.ts +5 -4
- package/esm/index.js +5 -4
- package/esm/internal/types.d.ts +18 -7
- package/esm/internal/types.js +1 -1
- package/esm/schemas/embeds.d.ts +346 -239
- package/esm/schemas/embeds.js +31 -23
- package/esm/schemas/events.d.ts +225 -129
- package/esm/schemas/events.js +17 -17
- package/esm/schemas/index.d.ts +5 -5
- package/esm/schemas/index.js +5 -5
- package/esm/schemas/manifest.d.ts +154 -110
- package/esm/schemas/manifest.js +29 -23
- package/esm/schemas/notifications.d.ts +86 -58
- package/esm/schemas/notifications.js +17 -17
- package/esm/schemas/shared.d.ts +53 -35
- package/esm/schemas/shared.js +25 -23
- package/esm/tsconfig.tsbuildinfo +1 -1
- package/esm/types.d.ts +69 -115
- package/esm/types.js +3 -3
- package/esm/wallet/ethereum.d.ts +58 -0
- package/esm/wallet/ethereum.js +1 -0
- package/esm/wallet/index.d.ts +1 -0
- package/esm/wallet/index.js +1 -0
- package/package.json +8 -2
- package/src/actions/Ready.ts +15 -0
- package/src/actions/index.ts +3 -2
- package/src/index.ts +1 -0
- package/src/types.ts +22 -100
- package/src/wallet/ethereum.ts +61 -0
- package/src/wallet/index.ts +1 -0
package/esm/types.d.ts
CHANGED
|
@@ -1,121 +1,75 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import type {
|
|
2
|
+
AddFrame,
|
|
3
|
+
Ready,
|
|
4
|
+
SignIn,
|
|
5
|
+
Swap,
|
|
6
|
+
ViewProfile,
|
|
7
|
+
ViewToken,
|
|
8
|
+
} from './actions'
|
|
9
|
+
import type { FrameContext } from './context'
|
|
10
|
+
import type {
|
|
11
|
+
EventFrameAdded,
|
|
12
|
+
EventFrameRemoved,
|
|
13
|
+
EventNotificationsDisabled,
|
|
14
|
+
EventNotificationsEnabled,
|
|
15
|
+
} from './schemas'
|
|
16
|
+
import type { Ethereum } from './wallet'
|
|
5
17
|
export type SetPrimaryButtonOptions = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
export type
|
|
14
|
-
|
|
15
|
-
* Disable native gestures. Use this option if your frame uses gestures
|
|
16
|
-
* that conflict with native gestures.
|
|
17
|
-
*
|
|
18
|
-
* @defaultValue false
|
|
19
|
-
*/
|
|
20
|
-
disableNativeGestures: boolean;
|
|
21
|
-
};
|
|
22
|
-
export declare const DEFAULT_READY_OPTIONS: ReadyOptions;
|
|
23
|
-
export type SignInOptions = {
|
|
24
|
-
/**
|
|
25
|
-
* A random string used to prevent replay attacks.
|
|
26
|
-
*/
|
|
27
|
-
nonce: string;
|
|
28
|
-
/**
|
|
29
|
-
* Start time at which the signature becomes valid.
|
|
30
|
-
* ISO 8601 datetime.
|
|
31
|
-
*/
|
|
32
|
-
notBefore?: string;
|
|
33
|
-
/**
|
|
34
|
-
* Expiration time at which the signature is no longer valid.
|
|
35
|
-
* ISO 8601 datetime.
|
|
36
|
-
*/
|
|
37
|
-
expirationTime?: string;
|
|
38
|
-
};
|
|
18
|
+
text: string
|
|
19
|
+
loading?: boolean
|
|
20
|
+
disabled?: boolean
|
|
21
|
+
hidden?: boolean
|
|
22
|
+
}
|
|
23
|
+
export * from './wallet/ethereum'
|
|
24
|
+
export { DEFAULT_READY_OPTIONS, ReadyOptions } from './actions/Ready'
|
|
25
|
+
export type SignInOptions = SignIn.SignInOptions
|
|
26
|
+
export type SetPrimaryButton = (options: SetPrimaryButtonOptions) => void
|
|
39
27
|
export type WireFrameHost = {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
28
|
+
context: FrameContext
|
|
29
|
+
close: () => void
|
|
30
|
+
ready: Ready.Ready
|
|
31
|
+
openUrl: (url: string) => void
|
|
32
|
+
signIn: SignIn.WireSignIn
|
|
33
|
+
setPrimaryButton: SetPrimaryButton
|
|
34
|
+
ethProviderRequest: Ethereum.EthProvideRequest
|
|
35
|
+
ethProviderRequestV2: Ethereum.RpcTransport
|
|
36
|
+
eip6963RequestProvider: () => void
|
|
37
|
+
addFrame: AddFrame.WireAddFrame
|
|
38
|
+
viewProfile: ViewProfile.ViewProfile
|
|
39
|
+
viewToken: ViewToken.ViewToken
|
|
40
|
+
swap: Swap.Swap
|
|
41
|
+
}
|
|
54
42
|
export type FrameHost = {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
export type FrameEthProviderEventData = {
|
|
74
|
-
type: 'frame_eth_provider_event';
|
|
75
|
-
} & EthProviderWireEvent;
|
|
76
|
-
export type RpcTransport = (request: RpcRequest.RpcRequest) => Promise<RpcResponse.RpcResponse>;
|
|
77
|
-
export type ProviderRpcError = {
|
|
78
|
-
code: number;
|
|
79
|
-
details?: string;
|
|
80
|
-
message?: string;
|
|
81
|
-
};
|
|
82
|
-
export type EthProviderWireEvent = {
|
|
83
|
-
event: 'accountsChanged';
|
|
84
|
-
params: [readonly Address.Address[]];
|
|
85
|
-
} | {
|
|
86
|
-
event: 'chainChanged';
|
|
87
|
-
params: [string];
|
|
88
|
-
} | {
|
|
89
|
-
event: 'connect';
|
|
90
|
-
params: [Provider.ConnectInfo];
|
|
91
|
-
} | {
|
|
92
|
-
event: 'disconnect';
|
|
93
|
-
params: [ProviderRpcError];
|
|
94
|
-
} | {
|
|
95
|
-
event: 'message';
|
|
96
|
-
params: [Provider.Message];
|
|
97
|
-
};
|
|
98
|
-
export type EmitEthProvider = <event extends EthProviderWireEvent['event']>(event: event, params: Extract<EthProviderWireEvent, {
|
|
99
|
-
event: event;
|
|
100
|
-
}>['params']) => void;
|
|
43
|
+
context: FrameContext
|
|
44
|
+
close: () => void
|
|
45
|
+
ready: Ready.Ready
|
|
46
|
+
openUrl: (url: string) => void
|
|
47
|
+
signIn: SignIn.SignIn
|
|
48
|
+
setPrimaryButton: SetPrimaryButton
|
|
49
|
+
ethProviderRequest: Ethereum.EthProvideRequest
|
|
50
|
+
ethProviderRequestV2: Ethereum.RpcTransport
|
|
51
|
+
/**
|
|
52
|
+
* Receive forwarded eip6963:requestProvider events from the frame document.
|
|
53
|
+
* Hosts must emit an EventEip6963AnnounceProvider in response.
|
|
54
|
+
*/
|
|
55
|
+
eip6963RequestProvider: () => void
|
|
56
|
+
addFrame: AddFrame.AddFrame
|
|
57
|
+
viewProfile: ViewProfile.ViewProfile
|
|
58
|
+
viewToken: ViewToken.ViewToken
|
|
59
|
+
swap: Swap.Swap
|
|
60
|
+
}
|
|
101
61
|
export type EventFrameAddRejected = {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
62
|
+
event: 'frame_add_rejected'
|
|
63
|
+
reason: AddFrame.AddFrameRejectedReason
|
|
64
|
+
}
|
|
105
65
|
export type EventPrimaryButtonClicked = {
|
|
106
|
-
|
|
107
|
-
};
|
|
108
|
-
/**
|
|
109
|
-
* Metadata of the EIP-1193 Provider.
|
|
110
|
-
*/
|
|
111
|
-
export interface EIP6963ProviderInfo {
|
|
112
|
-
icon: `data:image/${string}`;
|
|
113
|
-
name: string;
|
|
114
|
-
rdns: string;
|
|
115
|
-
uuid: string;
|
|
66
|
+
event: 'primary_button_clicked'
|
|
116
67
|
}
|
|
117
|
-
export type
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
68
|
+
export type FrameClientEvent =
|
|
69
|
+
| EventFrameAdded
|
|
70
|
+
| EventFrameAddRejected
|
|
71
|
+
| EventFrameRemoved
|
|
72
|
+
| EventNotificationsEnabled
|
|
73
|
+
| EventNotificationsDisabled
|
|
74
|
+
| EventPrimaryButtonClicked
|
|
75
|
+
| Ethereum.EventEip6963AnnounceProvider
|
package/esm/types.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
}
|
|
1
|
+
// start backwards compat, remove in 1.0
|
|
2
|
+
export * from './wallet/ethereum'
|
|
3
|
+
export { DEFAULT_READY_OPTIONS } from './actions/Ready'
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { Address, Provider, RpcRequest, RpcResponse, RpcSchema } from 'ox'
|
|
2
|
+
export type EthProvideRequest<
|
|
3
|
+
schema extends RpcSchema.Generic = RpcSchema.Default,
|
|
4
|
+
> = Provider.RequestFn<schema>
|
|
5
|
+
export type FrameEthProviderEventData = {
|
|
6
|
+
type: 'frame_eth_provider_event'
|
|
7
|
+
} & EthProviderWireEvent
|
|
8
|
+
export type RpcTransport = (
|
|
9
|
+
request: RpcRequest.RpcRequest,
|
|
10
|
+
) => Promise<RpcResponse.RpcResponse>
|
|
11
|
+
export type ProviderRpcError = {
|
|
12
|
+
code: number
|
|
13
|
+
details?: string
|
|
14
|
+
message?: string
|
|
15
|
+
}
|
|
16
|
+
export type EthProviderWireEvent =
|
|
17
|
+
| {
|
|
18
|
+
event: 'accountsChanged'
|
|
19
|
+
params: [readonly Address.Address[]]
|
|
20
|
+
}
|
|
21
|
+
| {
|
|
22
|
+
event: 'chainChanged'
|
|
23
|
+
params: [string]
|
|
24
|
+
}
|
|
25
|
+
| {
|
|
26
|
+
event: 'connect'
|
|
27
|
+
params: [Provider.ConnectInfo]
|
|
28
|
+
}
|
|
29
|
+
| {
|
|
30
|
+
event: 'disconnect'
|
|
31
|
+
params: [ProviderRpcError]
|
|
32
|
+
}
|
|
33
|
+
| {
|
|
34
|
+
event: 'message'
|
|
35
|
+
params: [Provider.Message]
|
|
36
|
+
}
|
|
37
|
+
export type EmitEthProvider = <event extends EthProviderWireEvent['event']>(
|
|
38
|
+
event: event,
|
|
39
|
+
params: Extract<
|
|
40
|
+
EthProviderWireEvent,
|
|
41
|
+
{
|
|
42
|
+
event: event
|
|
43
|
+
}
|
|
44
|
+
>['params'],
|
|
45
|
+
) => void
|
|
46
|
+
/**
|
|
47
|
+
* Metadata of the EIP-1193 Provider.
|
|
48
|
+
*/
|
|
49
|
+
export interface EIP6963ProviderInfo {
|
|
50
|
+
icon: `data:image/${string}`
|
|
51
|
+
name: string
|
|
52
|
+
rdns: string
|
|
53
|
+
uuid: string
|
|
54
|
+
}
|
|
55
|
+
export type EventEip6963AnnounceProvider = {
|
|
56
|
+
event: 'eip6963:announceProvider'
|
|
57
|
+
info: EIP6963ProviderInfo
|
|
58
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as Ethereum from './ethereum'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as Ethereum from './ethereum'
|
package/package.json
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@farcaster/frame-core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.29",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/farcasterxyz/frames.git",
|
|
8
|
+
"directory": "packages/frame-core"
|
|
9
|
+
},
|
|
4
10
|
"main": "dist/index.js",
|
|
5
11
|
"module": "esm/index.js",
|
|
6
12
|
"files": [
|
|
@@ -11,7 +17,7 @@
|
|
|
11
17
|
"devDependencies": {
|
|
12
18
|
"@vitest/coverage-v8": "^2.1.8",
|
|
13
19
|
"typescript": "^5.7.2",
|
|
14
|
-
"vitest": "^2.1.
|
|
20
|
+
"vitest": "^2.1.9",
|
|
15
21
|
"@farcaster/tsconfig": "0.0.2"
|
|
16
22
|
},
|
|
17
23
|
"dependencies": {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type ReadyOptions = {
|
|
2
|
+
/**
|
|
3
|
+
* Disable native gestures. Use this option if your frame uses gestures
|
|
4
|
+
* that conflict with native gestures.
|
|
5
|
+
*
|
|
6
|
+
* @defaultValue false
|
|
7
|
+
*/
|
|
8
|
+
disableNativeGestures: boolean
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const DEFAULT_READY_OPTIONS = {
|
|
12
|
+
disableNativeGestures: false,
|
|
13
|
+
} satisfies ReadyOptions
|
|
14
|
+
|
|
15
|
+
export type Ready = (options?: Partial<ReadyOptions>) => void
|
package/src/actions/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * as AddFrame from './AddFrame'
|
|
2
|
-
export * as
|
|
3
|
-
export * as ViewToken from './ViewToken'
|
|
2
|
+
export * as Ready from './Ready'
|
|
4
3
|
export * as SignIn from './SignIn'
|
|
5
4
|
export * as Swap from './Swap'
|
|
5
|
+
export * as ViewProfile from './ViewProfile'
|
|
6
|
+
export * as ViewToken from './ViewToken'
|
package/src/index.ts
CHANGED
package/src/types.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type {
|
|
2
|
+
AddFrame,
|
|
3
|
+
Ready,
|
|
4
|
+
SignIn,
|
|
5
|
+
Swap,
|
|
6
|
+
ViewProfile,
|
|
7
|
+
ViewToken,
|
|
8
|
+
} from './actions'
|
|
3
9
|
import type { FrameContext } from './context'
|
|
4
10
|
import type {
|
|
5
11
|
EventFrameAdded,
|
|
@@ -7,6 +13,7 @@ import type {
|
|
|
7
13
|
EventNotificationsDisabled,
|
|
8
14
|
EventNotificationsEnabled,
|
|
9
15
|
} from './schemas'
|
|
16
|
+
import type { Ethereum } from './wallet'
|
|
10
17
|
|
|
11
18
|
export type SetPrimaryButtonOptions = {
|
|
12
19
|
text: string
|
|
@@ -15,52 +22,23 @@ export type SetPrimaryButtonOptions = {
|
|
|
15
22
|
hidden?: boolean
|
|
16
23
|
}
|
|
17
24
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
export
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Disable native gestures. Use this option if your frame uses gestures
|
|
25
|
-
* that conflict with native gestures.
|
|
26
|
-
*
|
|
27
|
-
* @defaultValue false
|
|
28
|
-
*/
|
|
29
|
-
disableNativeGestures: boolean
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export const DEFAULT_READY_OPTIONS: ReadyOptions = {
|
|
33
|
-
disableNativeGestures: false,
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export type SignInOptions = {
|
|
37
|
-
/**
|
|
38
|
-
* A random string used to prevent replay attacks.
|
|
39
|
-
*/
|
|
40
|
-
nonce: string
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Start time at which the signature becomes valid.
|
|
44
|
-
* ISO 8601 datetime.
|
|
45
|
-
*/
|
|
46
|
-
notBefore?: string
|
|
25
|
+
// start backwards compat, remove in 1.0
|
|
26
|
+
export * from './wallet/ethereum'
|
|
27
|
+
export { DEFAULT_READY_OPTIONS, ReadyOptions } from './actions/Ready'
|
|
28
|
+
export type SignInOptions = SignIn.SignInOptions
|
|
29
|
+
// end backwards compat
|
|
47
30
|
|
|
48
|
-
|
|
49
|
-
* Expiration time at which the signature is no longer valid.
|
|
50
|
-
* ISO 8601 datetime.
|
|
51
|
-
*/
|
|
52
|
-
expirationTime?: string
|
|
53
|
-
}
|
|
31
|
+
export type SetPrimaryButton = (options: SetPrimaryButtonOptions) => void
|
|
54
32
|
|
|
55
33
|
export type WireFrameHost = {
|
|
56
34
|
context: FrameContext
|
|
57
35
|
close: () => void
|
|
58
|
-
ready:
|
|
36
|
+
ready: Ready.Ready
|
|
59
37
|
openUrl: (url: string) => void
|
|
60
38
|
signIn: SignIn.WireSignIn
|
|
61
39
|
setPrimaryButton: SetPrimaryButton
|
|
62
|
-
ethProviderRequest:
|
|
63
|
-
ethProviderRequestV2: RpcTransport
|
|
40
|
+
ethProviderRequest: Ethereum.EthProvideRequest
|
|
41
|
+
ethProviderRequestV2: Ethereum.RpcTransport
|
|
64
42
|
eip6963RequestProvider: () => void
|
|
65
43
|
addFrame: AddFrame.WireAddFrame
|
|
66
44
|
viewProfile: ViewProfile.ViewProfile
|
|
@@ -71,12 +49,12 @@ export type WireFrameHost = {
|
|
|
71
49
|
export type FrameHost = {
|
|
72
50
|
context: FrameContext
|
|
73
51
|
close: () => void
|
|
74
|
-
ready:
|
|
52
|
+
ready: Ready.Ready
|
|
75
53
|
openUrl: (url: string) => void
|
|
76
54
|
signIn: SignIn.SignIn
|
|
77
55
|
setPrimaryButton: SetPrimaryButton
|
|
78
|
-
ethProviderRequest:
|
|
79
|
-
ethProviderRequestV2: RpcTransport
|
|
56
|
+
ethProviderRequest: Ethereum.EthProvideRequest
|
|
57
|
+
ethProviderRequestV2: Ethereum.RpcTransport
|
|
80
58
|
/**
|
|
81
59
|
* Receive forwarded eip6963:requestProvider events from the frame document.
|
|
82
60
|
* Hosts must emit an EventEip6963AnnounceProvider in response.
|
|
@@ -88,47 +66,6 @@ export type FrameHost = {
|
|
|
88
66
|
swap: Swap.Swap
|
|
89
67
|
}
|
|
90
68
|
|
|
91
|
-
export type FrameEthProviderEventData = {
|
|
92
|
-
type: 'frame_eth_provider_event'
|
|
93
|
-
} & EthProviderWireEvent
|
|
94
|
-
|
|
95
|
-
export type RpcTransport = (
|
|
96
|
-
request: RpcRequest.RpcRequest,
|
|
97
|
-
) => Promise<RpcResponse.RpcResponse>
|
|
98
|
-
|
|
99
|
-
export type ProviderRpcError = {
|
|
100
|
-
code: number
|
|
101
|
-
details?: string
|
|
102
|
-
message?: string
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
export type EthProviderWireEvent =
|
|
106
|
-
| {
|
|
107
|
-
event: 'accountsChanged'
|
|
108
|
-
params: [readonly Address.Address[]]
|
|
109
|
-
}
|
|
110
|
-
| {
|
|
111
|
-
event: 'chainChanged'
|
|
112
|
-
params: [string]
|
|
113
|
-
}
|
|
114
|
-
| {
|
|
115
|
-
event: 'connect'
|
|
116
|
-
params: [Provider.ConnectInfo]
|
|
117
|
-
}
|
|
118
|
-
| {
|
|
119
|
-
event: 'disconnect'
|
|
120
|
-
params: [ProviderRpcError]
|
|
121
|
-
}
|
|
122
|
-
| {
|
|
123
|
-
event: 'message'
|
|
124
|
-
params: [Provider.Message]
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
export type EmitEthProvider = <event extends EthProviderWireEvent['event']>(
|
|
128
|
-
event: event,
|
|
129
|
-
params: Extract<EthProviderWireEvent, { event: event }>['params'],
|
|
130
|
-
) => void
|
|
131
|
-
|
|
132
69
|
export type EventFrameAddRejected = {
|
|
133
70
|
event: 'frame_add_rejected'
|
|
134
71
|
reason: AddFrame.AddFrameRejectedReason
|
|
@@ -138,21 +75,6 @@ export type EventPrimaryButtonClicked = {
|
|
|
138
75
|
event: 'primary_button_clicked'
|
|
139
76
|
}
|
|
140
77
|
|
|
141
|
-
/**
|
|
142
|
-
* Metadata of the EIP-1193 Provider.
|
|
143
|
-
*/
|
|
144
|
-
export interface EIP6963ProviderInfo {
|
|
145
|
-
icon: `data:image/${string}` // RFC-2397
|
|
146
|
-
name: string
|
|
147
|
-
rdns: string
|
|
148
|
-
uuid: string
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
export type EventEip6963AnnounceProvider = {
|
|
152
|
-
event: 'eip6963:announceProvider'
|
|
153
|
-
info: EIP6963ProviderInfo
|
|
154
|
-
}
|
|
155
|
-
|
|
156
78
|
export type FrameClientEvent =
|
|
157
79
|
| EventFrameAdded
|
|
158
80
|
| EventFrameAddRejected
|
|
@@ -160,4 +82,4 @@ export type FrameClientEvent =
|
|
|
160
82
|
| EventNotificationsEnabled
|
|
161
83
|
| EventNotificationsDisabled
|
|
162
84
|
| EventPrimaryButtonClicked
|
|
163
|
-
| EventEip6963AnnounceProvider
|
|
85
|
+
| Ethereum.EventEip6963AnnounceProvider
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { Address, Provider, RpcRequest, RpcResponse, RpcSchema } from 'ox'
|
|
2
|
+
|
|
3
|
+
export type EthProvideRequest<
|
|
4
|
+
schema extends RpcSchema.Generic = RpcSchema.Default,
|
|
5
|
+
> = Provider.RequestFn<schema>
|
|
6
|
+
|
|
7
|
+
export type FrameEthProviderEventData = {
|
|
8
|
+
type: 'frame_eth_provider_event'
|
|
9
|
+
} & EthProviderWireEvent
|
|
10
|
+
|
|
11
|
+
export type RpcTransport = (
|
|
12
|
+
request: RpcRequest.RpcRequest,
|
|
13
|
+
) => Promise<RpcResponse.RpcResponse>
|
|
14
|
+
|
|
15
|
+
export type ProviderRpcError = {
|
|
16
|
+
code: number
|
|
17
|
+
details?: string
|
|
18
|
+
message?: string
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type EthProviderWireEvent =
|
|
22
|
+
| {
|
|
23
|
+
event: 'accountsChanged'
|
|
24
|
+
params: [readonly Address.Address[]]
|
|
25
|
+
}
|
|
26
|
+
| {
|
|
27
|
+
event: 'chainChanged'
|
|
28
|
+
params: [string]
|
|
29
|
+
}
|
|
30
|
+
| {
|
|
31
|
+
event: 'connect'
|
|
32
|
+
params: [Provider.ConnectInfo]
|
|
33
|
+
}
|
|
34
|
+
| {
|
|
35
|
+
event: 'disconnect'
|
|
36
|
+
params: [ProviderRpcError]
|
|
37
|
+
}
|
|
38
|
+
| {
|
|
39
|
+
event: 'message'
|
|
40
|
+
params: [Provider.Message]
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export type EmitEthProvider = <event extends EthProviderWireEvent['event']>(
|
|
44
|
+
event: event,
|
|
45
|
+
params: Extract<EthProviderWireEvent, { event: event }>['params'],
|
|
46
|
+
) => void
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Metadata of the EIP-1193 Provider.
|
|
50
|
+
*/
|
|
51
|
+
export interface EIP6963ProviderInfo {
|
|
52
|
+
icon: `data:image/${string}` // RFC-2397
|
|
53
|
+
name: string
|
|
54
|
+
rdns: string
|
|
55
|
+
uuid: string
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export type EventEip6963AnnounceProvider = {
|
|
59
|
+
event: 'eip6963:announceProvider'
|
|
60
|
+
info: EIP6963ProviderInfo
|
|
61
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as Ethereum from './ethereum'
|