rise-wallet 0.3.4 → 0.3.5
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/dist/cli/bin/{commands-BlFKgr_f.js → commands-DT48KEhi.js} +5 -5
- package/dist/cli/bin/index.js +1 -1
- package/dist/core/Dialog.d.ts.map +1 -1
- package/dist/core/Dialog.js +16 -0
- package/dist/core/Dialog.js.map +1 -1
- package/dist/core/Messenger.d.ts +3 -0
- package/dist/core/Messenger.d.ts.map +1 -1
- package/dist/core/Messenger.js +5 -2
- package/dist/core/Messenger.js.map +1 -1
- package/dist/core/internal/modes/relay.d.ts.map +1 -1
- package/dist/core/internal/modes/relay.js +1 -0
- package/dist/core/internal/modes/relay.js.map +1 -1
- package/dist/tsconfig.tmp.tsbuildinfo +1 -1
- package/dist/viem/Key.d.ts +1 -0
- package/dist/viem/Key.d.ts.map +1 -1
- package/dist/viem/Key.js +3 -3
- package/dist/viem/Key.js.map +1 -1
- package/package.json +1 -1
- package/src/cli/bin/tsconfig.tsbuildinfo +1 -0
- package/src/core/Dialog.ts +20 -0
- package/src/core/Messenger.ts +10 -5
- package/src/core/internal/modes/relay.ts +1 -0
- package/src/tsconfig.tsbuildinfo +1 -0
- package/src/viem/Key.ts +11 -3
package/src/core/Dialog.ts
CHANGED
|
@@ -224,6 +224,26 @@ export function iframe(options: iframe.Options = {}) {
|
|
|
224
224
|
}
|
|
225
225
|
})
|
|
226
226
|
|
|
227
|
+
// Safari ITP workaround: When accounts are set in the parent's store
|
|
228
|
+
// (after wallet_connect via popup), sync them to the iframe via postMessage.
|
|
229
|
+
// This is necessary because Safari's ITP partitions storage between windows
|
|
230
|
+
// opened from different origins, preventing the iframe from reading accounts
|
|
231
|
+
// stored by the popup even though they share the same origin.
|
|
232
|
+
if (UserAgent.isSafari()) {
|
|
233
|
+
internal.store.subscribe(
|
|
234
|
+
(state) => state.accounts,
|
|
235
|
+
(accounts, prevAccounts) => {
|
|
236
|
+
// Only sync when accounts are added (not when cleared)
|
|
237
|
+
if (accounts.length > 0 && prevAccounts.length === 0) {
|
|
238
|
+
messenger.send('__internal', {
|
|
239
|
+
accounts,
|
|
240
|
+
type: 'sync-accounts',
|
|
241
|
+
})
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
)
|
|
245
|
+
}
|
|
246
|
+
|
|
227
247
|
let bodyStyle: CSSStyleDeclaration | null = null
|
|
228
248
|
|
|
229
249
|
// store the opening element to restore the focus
|
package/src/core/Messenger.ts
CHANGED
|
@@ -118,6 +118,11 @@ export type Schema = [
|
|
|
118
118
|
type: 'dialog-lifecycle'
|
|
119
119
|
action: 'request:close' | 'done:close'
|
|
120
120
|
}
|
|
121
|
+
| {
|
|
122
|
+
// Sync accounts from popup to iframe (Safari ITP workaround)
|
|
123
|
+
type: 'sync-accounts'
|
|
124
|
+
accounts: Porto.State['accounts']
|
|
125
|
+
}
|
|
121
126
|
response: undefined
|
|
122
127
|
},
|
|
123
128
|
]
|
|
@@ -176,10 +181,8 @@ export function fromWindow(
|
|
|
176
181
|
},
|
|
177
182
|
async send(topic, payload, target) {
|
|
178
183
|
const id = Utils.uuidv4()
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
target ?? targetOrigin ?? '*',
|
|
182
|
-
)
|
|
184
|
+
const normalizedPayload = Utils.normalizeValue({ id, payload, topic })
|
|
185
|
+
w.postMessage(normalizedPayload, target ?? targetOrigin ?? '*')
|
|
183
186
|
return { id, payload, topic } as never
|
|
184
187
|
},
|
|
185
188
|
async sendAsync(topic, payload, target) {
|
|
@@ -210,13 +213,15 @@ export function bridge(parameters: bridge.Parameters): Bridge {
|
|
|
210
213
|
let pending = false
|
|
211
214
|
|
|
212
215
|
const ready = promise.withResolvers<ReadyOptions>()
|
|
216
|
+
// Prevent unhandled rejection if ready is rejected during destroy
|
|
217
|
+
ready.promise.catch(() => {})
|
|
213
218
|
from_.on('ready', ready.resolve)
|
|
214
219
|
|
|
215
220
|
const messenger = from({
|
|
216
221
|
destroy() {
|
|
217
222
|
from_.destroy()
|
|
218
223
|
to.destroy()
|
|
219
|
-
if (pending) ready.reject()
|
|
224
|
+
if (pending) ready.reject(new Error('Messenger destroyed'))
|
|
220
225
|
},
|
|
221
226
|
on(topic, listener, id) {
|
|
222
227
|
return from_.on(topic, listener, id)
|