@0xsequence/dapp-client 3.0.0-beta.18 → 3.0.0-beta.19
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/.turbo/turbo-build.log +1 -1
- package/.turbo/turbo-lint.log +4 -0
- package/.turbo/turbo-typecheck.log +4 -0
- package/CHANGELOG.md +11 -0
- package/dist/ChainSessionManager.js +0 -2
- package/dist/DappClient.d.ts +1 -1
- package/dist/DappClient.d.ts.map +1 -1
- package/dist/DappClient.js +1 -3
- package/package.json +13 -11
- package/src/ChainSessionManager.ts +3 -3
- package/src/DappClient.ts +5 -6
- package/test/ethauth-proof.test.ts +35 -36
- /package/{eslint.config.mjs → eslint.config.js} +0 -0
package/.turbo/turbo-build.log
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @0xsequence/dapp-client
|
|
2
2
|
|
|
3
|
+
## 3.0.0-beta.19
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Final RC before 3.0.0
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @0xsequence/guard@3.0.0-beta.19
|
|
10
|
+
- @0xsequence/relayer@3.0.0-beta.19
|
|
11
|
+
- @0xsequence/wallet-core@3.0.0-beta.19
|
|
12
|
+
- @0xsequence/wallet-primitives@3.0.0-beta.19
|
|
13
|
+
|
|
3
14
|
## 3.0.0-beta.18
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
|
@@ -75,10 +75,8 @@ export class ChainSessionManager {
|
|
|
75
75
|
if (!this.eventListeners[event]) {
|
|
76
76
|
this.eventListeners[event] = new Set();
|
|
77
77
|
}
|
|
78
|
-
;
|
|
79
78
|
this.eventListeners[event].add(listener);
|
|
80
79
|
return () => {
|
|
81
|
-
;
|
|
82
80
|
this.eventListeners[event]?.delete(listener);
|
|
83
81
|
};
|
|
84
82
|
}
|
package/dist/DappClient.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { type ExplicitSession, type ExplicitSessionConfig, type ImplicitSession,
|
|
|
3
3
|
import { SequenceStorage, type SessionlessConnectionData } from './utils/storage.js';
|
|
4
4
|
import { DappClientExplicitSessionEventListener, DappClientWalletActionEventListener, FeeOption, GetFeeTokensResponse, GuardConfig, LoginMethod, EthAuthSettings, RandomPrivateKeyFn, ETHAuthProof, SequenceSessionStorage, Transaction, TransactionRequest, TransportMode } from './types/index.js';
|
|
5
5
|
import { TypedData } from 'ox/TypedData';
|
|
6
|
-
export type DappClientEventListener = (data?:
|
|
6
|
+
export type DappClientEventListener = (data?: unknown) => void;
|
|
7
7
|
interface DappClientEventMap {
|
|
8
8
|
sessionsUpdated: () => void;
|
|
9
9
|
walletActionResponse: DappClientWalletActionEventListener;
|
package/dist/DappClient.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DappClient.d.ts","sourceRoot":"","sources":["../src/DappClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,IAAI,CAAA;AAEjC,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,qBAAqB,EAAE,KAAK,eAAe,EAAE,KAAK,OAAO,EAAE,MAAM,YAAY,CAAA;AAKjH,OAAO,EAAE,eAAe,EAAc,KAAK,yBAAyB,EAAE,MAAM,oBAAoB,CAAA;AAChG,OAAO,EAEL,sCAAsC,EACtC,mCAAmC,EACnC,SAAS,EACT,oBAAoB,EACpB,WAAW,EACX,WAAW,EACX,eAAe,EACf,kBAAkB,EAElB,YAAY,EAEZ,sBAAsB,EAGtB,WAAW,EACX,kBAAkB,EAClB,aAAa,EAEd,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAKxC,MAAM,MAAM,uBAAuB,GAAG,CAAC,IAAI,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"DappClient.d.ts","sourceRoot":"","sources":["../src/DappClient.ts"],"names":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AIG;IACH,OAAO,CAAC,IAAI;IAOZ,OAAO,CAAC,eAAe;YAgBT,+BAA+B;YAyB/B,oBAAoB;IAuClC;;;;OAIG;YACW,2BAA2B;IAiBzC;;;;OAIG;IACH,OAAO,CAAC,sBAAsB;CAyB/B"}
|
package/dist/DappClient.js
CHANGED
|
@@ -111,12 +111,11 @@ export class DappClient {
|
|
|
111
111
|
*/
|
|
112
112
|
on(event, listener) {
|
|
113
113
|
if (!this.eventListeners[event]) {
|
|
114
|
+
// @ts-expect-error - indexing into evenListeners will improperly create a union of all the possible types
|
|
114
115
|
this.eventListeners[event] = new Set();
|
|
115
116
|
}
|
|
116
|
-
;
|
|
117
117
|
this.eventListeners[event].add(listener);
|
|
118
118
|
return () => {
|
|
119
|
-
;
|
|
120
119
|
this.eventListeners[event]?.delete(listener);
|
|
121
120
|
};
|
|
122
121
|
}
|
|
@@ -800,7 +799,6 @@ export class DappClient {
|
|
|
800
799
|
*/
|
|
801
800
|
async disconnect(options) {
|
|
802
801
|
const keepSessionlessConnection = options?.keepSessionlessConnection ?? true;
|
|
803
|
-
const transportMode = this.transportMode;
|
|
804
802
|
if (this.transport) {
|
|
805
803
|
this.transport.destroy();
|
|
806
804
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xsequence/dapp-client",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.19",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -14,26 +14,28 @@
|
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
|
-
"@types/node": "^25.0
|
|
18
|
-
"@vitest/coverage-v8": "^4.0.
|
|
19
|
-
"dotenv": "^17.
|
|
17
|
+
"@types/node": "^25.3.0",
|
|
18
|
+
"@vitest/coverage-v8": "^4.0.18",
|
|
19
|
+
"dotenv": "^17.3.1",
|
|
20
20
|
"fake-indexeddb": "^6.2.5",
|
|
21
|
-
"happy-dom": "^20.0
|
|
21
|
+
"happy-dom": "^20.7.0",
|
|
22
22
|
"typescript": "^5.9.3",
|
|
23
|
-
"vitest": "^4.0.
|
|
23
|
+
"vitest": "^4.0.18",
|
|
24
|
+
"@repo/eslint-config": "^0.0.1-beta.1",
|
|
24
25
|
"@repo/typescript-config": "^0.0.1-beta.1"
|
|
25
26
|
},
|
|
26
27
|
"dependencies": {
|
|
27
28
|
"ox": "^0.9.17",
|
|
28
|
-
"@0xsequence/guard": "^3.0.0-beta.
|
|
29
|
-
"@0xsequence/wallet-
|
|
30
|
-
"@0xsequence/wallet-
|
|
31
|
-
"@0xsequence/relayer": "^3.0.0-beta.
|
|
29
|
+
"@0xsequence/guard": "^3.0.0-beta.19",
|
|
30
|
+
"@0xsequence/wallet-primitives": "^3.0.0-beta.19",
|
|
31
|
+
"@0xsequence/wallet-core": "^3.0.0-beta.19",
|
|
32
|
+
"@0xsequence/relayer": "^3.0.0-beta.19"
|
|
32
33
|
},
|
|
33
34
|
"scripts": {
|
|
34
35
|
"build": "tsc",
|
|
35
36
|
"dev": "tsc --watch",
|
|
36
37
|
"typecheck": "tsc --noEmit",
|
|
37
|
-
"clean": "rimraf dist"
|
|
38
|
+
"clean": "rimraf dist",
|
|
39
|
+
"lint": "eslint . --max-warnings 0"
|
|
38
40
|
}
|
|
39
41
|
}
|
|
@@ -158,11 +158,11 @@ export class ChainSessionManager {
|
|
|
158
158
|
listener: ChainSessionManagerEventMap[K],
|
|
159
159
|
): () => void {
|
|
160
160
|
if (!this.eventListeners[event]) {
|
|
161
|
-
this.eventListeners[event] = new Set()
|
|
161
|
+
this.eventListeners[event] = new Set<ChainSessionManagerEventMap[K]>()
|
|
162
162
|
}
|
|
163
|
-
|
|
163
|
+
this.eventListeners[event].add(listener)
|
|
164
164
|
return () => {
|
|
165
|
-
|
|
165
|
+
this.eventListeners[event]?.delete(listener)
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
|
package/src/DappClient.ts
CHANGED
|
@@ -32,7 +32,7 @@ import { KEYMACHINE_URL, NODES_URL, RELAYER_URL } from './utils/constants.js'
|
|
|
32
32
|
import { getRelayerUrl, getRpcUrl } from './utils/index.js'
|
|
33
33
|
import { Relayer } from '@0xsequence/relayer'
|
|
34
34
|
|
|
35
|
-
export type DappClientEventListener = (data?:
|
|
35
|
+
export type DappClientEventListener = (data?: unknown) => void
|
|
36
36
|
|
|
37
37
|
interface DappClientEventMap {
|
|
38
38
|
sessionsUpdated: () => void
|
|
@@ -182,11 +182,12 @@ export class DappClient {
|
|
|
182
182
|
*/
|
|
183
183
|
public on<K extends keyof DappClientEventMap>(event: K, listener: DappClientEventMap[K]): () => void {
|
|
184
184
|
if (!this.eventListeners[event]) {
|
|
185
|
-
|
|
185
|
+
// @ts-expect-error - indexing into evenListeners will improperly create a union of all the possible types
|
|
186
|
+
this.eventListeners[event] = new Set<DappClientEventMap[K]>()
|
|
186
187
|
}
|
|
187
|
-
|
|
188
|
+
this.eventListeners[event].add(listener)
|
|
188
189
|
return () => {
|
|
189
|
-
|
|
190
|
+
this.eventListeners[event]?.delete(listener)
|
|
190
191
|
}
|
|
191
192
|
}
|
|
192
193
|
|
|
@@ -976,8 +977,6 @@ export class DappClient {
|
|
|
976
977
|
async disconnect(options?: { keepSessionlessConnection?: boolean }): Promise<void> {
|
|
977
978
|
const keepSessionlessConnection = options?.keepSessionlessConnection ?? true
|
|
978
979
|
|
|
979
|
-
const transportMode = this.transportMode
|
|
980
|
-
|
|
981
980
|
if (this.transport) {
|
|
982
981
|
this.transport.destroy()
|
|
983
982
|
}
|
|
@@ -11,34 +11,33 @@ describe('ETHAuth proof persistence', () => {
|
|
|
11
11
|
vi.unstubAllGlobals()
|
|
12
12
|
})
|
|
13
13
|
|
|
14
|
-
const createSequenceStorageMock = () =>
|
|
15
|
-
(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}) as any
|
|
14
|
+
const createSequenceStorageMock = () => ({
|
|
15
|
+
setPendingRedirectRequest: vi.fn().mockResolvedValue(undefined),
|
|
16
|
+
isRedirectRequestPending: vi.fn().mockResolvedValue(false),
|
|
17
|
+
saveTempSessionPk: vi.fn().mockResolvedValue(undefined),
|
|
18
|
+
getAndClearTempSessionPk: vi.fn().mockResolvedValue(null),
|
|
19
|
+
savePendingRequest: vi.fn().mockResolvedValue(undefined),
|
|
20
|
+
getAndClearPendingRequest: vi.fn().mockResolvedValue(null),
|
|
21
|
+
peekPendingRequest: vi.fn().mockResolvedValue(null),
|
|
22
|
+
saveExplicitSession: vi.fn().mockResolvedValue(undefined),
|
|
23
|
+
getExplicitSessions: vi.fn().mockResolvedValue([]),
|
|
24
|
+
clearExplicitSessions: vi.fn().mockResolvedValue(undefined),
|
|
25
|
+
saveImplicitSession: vi.fn().mockResolvedValue(undefined),
|
|
26
|
+
getImplicitSession: vi.fn().mockResolvedValue(null),
|
|
27
|
+
clearImplicitSession: vi.fn().mockResolvedValue(undefined),
|
|
28
|
+
saveSessionlessConnection: vi.fn().mockResolvedValue(undefined),
|
|
29
|
+
getSessionlessConnection: vi.fn().mockResolvedValue(null),
|
|
30
|
+
clearSessionlessConnection: vi.fn().mockResolvedValue(undefined),
|
|
31
|
+
saveEthAuthProof: vi.fn().mockResolvedValue(undefined),
|
|
32
|
+
getEthAuthProof: vi.fn().mockResolvedValue(null),
|
|
33
|
+
clearEthAuthProof: vi.fn().mockResolvedValue(undefined),
|
|
34
|
+
clearAllData: vi.fn().mockResolvedValue(undefined),
|
|
35
|
+
})
|
|
37
36
|
|
|
38
37
|
it('persists ETHAuth proof when connect requests ethAuth in redirect mode', async () => {
|
|
39
38
|
const fetchMock = vi.fn()
|
|
40
39
|
vi.stubGlobal('fetch', fetchMock)
|
|
41
|
-
vi.stubGlobal('window', { fetch: fetchMock }
|
|
40
|
+
vi.stubGlobal('window', { fetch: fetchMock })
|
|
42
41
|
|
|
43
42
|
const ethAuthProof = {
|
|
44
43
|
typedData: {
|
|
@@ -47,13 +46,13 @@ describe('ETHAuth proof persistence', () => {
|
|
|
47
46
|
message: {},
|
|
48
47
|
},
|
|
49
48
|
ewtString: 'proof-string',
|
|
50
|
-
}
|
|
49
|
+
}
|
|
51
50
|
|
|
52
51
|
const sequenceStorage = createSequenceStorageMock()
|
|
53
52
|
const sendRequestMock = vi.spyOn(DappTransport.prototype, 'sendRequest').mockResolvedValue({
|
|
54
53
|
walletAddress: '0x1111111111111111111111111111111111111111',
|
|
55
54
|
ethAuthProof,
|
|
56
|
-
}
|
|
55
|
+
})
|
|
57
56
|
|
|
58
57
|
const client = new DappClient('https://wallet.example', 'https://dapp.example', 'test-project-access-key', {
|
|
59
58
|
sequenceStorage,
|
|
@@ -84,8 +83,8 @@ describe('ETHAuth proof persistence', () => {
|
|
|
84
83
|
it('persists ETHAuth proof when connect requests ethAuth in popup mode', async () => {
|
|
85
84
|
const fetchMock = vi.fn()
|
|
86
85
|
vi.stubGlobal('fetch', fetchMock)
|
|
87
|
-
vi.stubGlobal('window', { fetch: fetchMock }
|
|
88
|
-
vi.stubGlobal('document', {}
|
|
86
|
+
vi.stubGlobal('window', { fetch: fetchMock })
|
|
87
|
+
vi.stubGlobal('document', {})
|
|
89
88
|
|
|
90
89
|
const ethAuthProof = {
|
|
91
90
|
typedData: {
|
|
@@ -94,13 +93,13 @@ describe('ETHAuth proof persistence', () => {
|
|
|
94
93
|
message: {},
|
|
95
94
|
},
|
|
96
95
|
ewtString: 'proof-string',
|
|
97
|
-
}
|
|
96
|
+
}
|
|
98
97
|
|
|
99
98
|
const sequenceStorage = createSequenceStorageMock()
|
|
100
99
|
const sendRequestMock = vi.spyOn(DappTransport.prototype, 'sendRequest').mockResolvedValue({
|
|
101
100
|
walletAddress: '0x1111111111111111111111111111111111111111',
|
|
102
101
|
ethAuthProof,
|
|
103
|
-
}
|
|
102
|
+
})
|
|
104
103
|
|
|
105
104
|
const client = new DappClient('https://wallet.example', 'https://dapp.example', 'test-project-access-key', {
|
|
106
105
|
sequenceStorage,
|
|
@@ -130,7 +129,7 @@ describe('ETHAuth proof persistence', () => {
|
|
|
130
129
|
it('does not persist ETHAuth proof when connect does not request ethAuth', async () => {
|
|
131
130
|
const fetchMock = vi.fn()
|
|
132
131
|
vi.stubGlobal('fetch', fetchMock)
|
|
133
|
-
vi.stubGlobal('window', { fetch: fetchMock }
|
|
132
|
+
vi.stubGlobal('window', { fetch: fetchMock })
|
|
134
133
|
|
|
135
134
|
const ethAuthProof = {
|
|
136
135
|
typedData: {
|
|
@@ -139,13 +138,13 @@ describe('ETHAuth proof persistence', () => {
|
|
|
139
138
|
message: {},
|
|
140
139
|
},
|
|
141
140
|
ewtString: 'proof-string',
|
|
142
|
-
}
|
|
141
|
+
}
|
|
143
142
|
|
|
144
143
|
const sequenceStorage = createSequenceStorageMock()
|
|
145
144
|
const sendRequestMock = vi.spyOn(DappTransport.prototype, 'sendRequest').mockResolvedValue({
|
|
146
145
|
walletAddress: '0x1111111111111111111111111111111111111111',
|
|
147
146
|
ethAuthProof,
|
|
148
|
-
}
|
|
147
|
+
})
|
|
149
148
|
|
|
150
149
|
const client = new DappClient('https://wallet.example', 'https://dapp.example', 'test-project-access-key', {
|
|
151
150
|
sequenceStorage,
|
|
@@ -170,7 +169,7 @@ describe('ETHAuth proof persistence', () => {
|
|
|
170
169
|
it('clears ETHAuth proof on disconnect', async () => {
|
|
171
170
|
const fetchMock = vi.fn()
|
|
172
171
|
vi.stubGlobal('fetch', fetchMock)
|
|
173
|
-
vi.stubGlobal('window', { fetch: fetchMock }
|
|
172
|
+
vi.stubGlobal('window', { fetch: fetchMock })
|
|
174
173
|
|
|
175
174
|
const ethAuthProof = {
|
|
176
175
|
typedData: {
|
|
@@ -179,12 +178,12 @@ describe('ETHAuth proof persistence', () => {
|
|
|
179
178
|
message: {},
|
|
180
179
|
},
|
|
181
180
|
ewtString: 'proof-string',
|
|
182
|
-
}
|
|
181
|
+
}
|
|
183
182
|
|
|
184
183
|
vi.spyOn(DappTransport.prototype, 'sendRequest').mockResolvedValue({
|
|
185
184
|
walletAddress: '0x1111111111111111111111111111111111111111',
|
|
186
185
|
ethAuthProof,
|
|
187
|
-
}
|
|
186
|
+
})
|
|
188
187
|
|
|
189
188
|
const client = new DappClient('https://wallet.example', 'https://dapp.example', 'test-project-access-key', {
|
|
190
189
|
sequenceStorage: new WebStorage(),
|
|
File without changes
|