rise-wallet 0.3.0 → 0.3.2

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 (98) hide show
  1. package/dist/cli/bin/commands-f0vN9Upd.js +50 -0
  2. package/dist/cli/bin/index.js +1 -1
  3. package/dist/core/Chains.d.ts +14 -283
  4. package/dist/core/Chains.d.ts.map +1 -1
  5. package/dist/core/Dialog.d.ts.map +1 -1
  6. package/dist/core/Dialog.js +8 -0
  7. package/dist/core/Dialog.js.map +1 -1
  8. package/dist/core/Porto.d.ts +201 -293
  9. package/dist/core/Porto.d.ts.map +1 -1
  10. package/dist/core/internal/_generated/chains.d.ts +1 -1
  11. package/dist/core/internal/_generated/chains.d.ts.map +1 -1
  12. package/dist/core/internal/_generated/chains.js +1 -1
  13. package/dist/core/internal/_generated/chains.js.map +1 -1
  14. package/dist/core/internal/mode.d.ts +4 -0
  15. package/dist/core/internal/mode.d.ts.map +1 -1
  16. package/dist/core/internal/mode.js.map +1 -1
  17. package/dist/core/internal/modes/dialog.d.ts +47 -7
  18. package/dist/core/internal/modes/dialog.d.ts.map +1 -1
  19. package/dist/core/internal/modes/reactNative.d.ts +187 -10
  20. package/dist/core/internal/modes/reactNative.d.ts.map +1 -1
  21. package/dist/core/internal/modes/relay.d.ts +140 -3
  22. package/dist/core/internal/modes/relay.d.ts.map +1 -1
  23. package/dist/core/internal/modes/relay.js +102 -26
  24. package/dist/core/internal/modes/relay.js.map +1 -1
  25. package/dist/core/internal/permissions.d.ts +1 -1
  26. package/dist/core/internal/permissionsRequest.d.ts +1 -1
  27. package/dist/core/internal/provider.d.ts.map +1 -1
  28. package/dist/core/internal/provider.js +12 -1
  29. package/dist/core/internal/provider.js.map +1 -1
  30. package/dist/core/internal/relay/rpcSchema.d.ts +3 -0
  31. package/dist/core/internal/relay/rpcSchema.d.ts.map +1 -1
  32. package/dist/core/internal/relay/schema/rpc.d.ts +23 -0
  33. package/dist/core/internal/relay/schema/rpc.d.ts.map +1 -1
  34. package/dist/core/internal/relay/schema/rpc.js +18 -0
  35. package/dist/core/internal/relay/schema/rpc.js.map +1 -1
  36. package/dist/core/internal/schema/capabilities.d.ts +2 -2
  37. package/dist/core/internal/schema/key.d.ts +2 -2
  38. package/dist/core/internal/schema/key.d.ts.map +1 -1
  39. package/dist/core/internal/schema/key.js +1 -0
  40. package/dist/core/internal/schema/key.js.map +1 -1
  41. package/dist/core/internal/schema/permissions.d.ts +2 -2
  42. package/dist/core/internal/schema/request.d.ts +18 -16
  43. package/dist/core/internal/schema/request.d.ts.map +1 -1
  44. package/dist/core/internal/schema/rpc.d.ts +52 -46
  45. package/dist/core/internal/schema/rpc.d.ts.map +1 -1
  46. package/dist/core/internal/schema/rpc.js +1 -0
  47. package/dist/core/internal/schema/rpc.js.map +1 -1
  48. package/dist/core/react-native/Porto.d.ts +201 -293
  49. package/dist/core/react-native/Porto.d.ts.map +1 -1
  50. package/dist/remote/Events.d.ts.map +1 -1
  51. package/dist/remote/Events.js +10 -3
  52. package/dist/remote/Events.js.map +1 -1
  53. package/dist/remote/Hooks.d.ts +42 -38
  54. package/dist/remote/Hooks.d.ts.map +1 -1
  55. package/dist/remote/Porto.d.ts +154 -286
  56. package/dist/remote/Porto.d.ts.map +1 -1
  57. package/dist/trusted-hosts.d.ts.map +1 -1
  58. package/dist/trusted-hosts.js +5 -0
  59. package/dist/trusted-hosts.js.map +1 -1
  60. package/dist/tsconfig.tmp.tsbuildinfo +1 -1
  61. package/dist/viem/Account.d.ts +3 -0
  62. package/dist/viem/Account.d.ts.map +1 -1
  63. package/dist/viem/Account.js +16 -12
  64. package/dist/viem/Account.js.map +1 -1
  65. package/dist/viem/Key.d.ts +96 -1
  66. package/dist/viem/Key.d.ts.map +1 -1
  67. package/dist/viem/Key.js +102 -3
  68. package/dist/viem/Key.js.map +1 -1
  69. package/dist/viem/RelayActions.d.ts +12 -1
  70. package/dist/viem/RelayActions.d.ts.map +1 -1
  71. package/dist/viem/RelayActions.js +8 -3
  72. package/dist/viem/RelayActions.js.map +1 -1
  73. package/dist/viem/internal/provider.d.ts +9 -0
  74. package/dist/viem/internal/provider.d.ts.map +1 -0
  75. package/dist/viem/internal/provider.js +15 -0
  76. package/dist/viem/internal/provider.js.map +1 -0
  77. package/dist/viem/internal/relayActions.d.ts +16 -0
  78. package/dist/viem/internal/relayActions.d.ts.map +1 -1
  79. package/dist/viem/internal/relayActions.js +29 -0
  80. package/dist/viem/internal/relayActions.js.map +1 -1
  81. package/package.json +3 -2
  82. package/src/core/Dialog.ts +10 -0
  83. package/src/core/internal/_generated/chains.ts +1 -1
  84. package/src/core/internal/mode.ts +5 -1
  85. package/src/core/internal/modes/relay.ts +158 -56
  86. package/src/core/internal/provider.ts +14 -0
  87. package/src/core/internal/relay/rpcSchema.ts +4 -0
  88. package/src/core/internal/relay/schema/rpc.ts +23 -0
  89. package/src/core/internal/schema/key.ts +1 -0
  90. package/src/core/internal/schema/rpc.ts +1 -0
  91. package/src/remote/Events.ts +10 -3
  92. package/src/trusted-hosts.ts +5 -0
  93. package/src/viem/Account.ts +30 -12
  94. package/src/viem/Key.ts +163 -4
  95. package/src/viem/RelayActions.ts +30 -8
  96. package/src/viem/internal/provider.ts +19 -0
  97. package/src/viem/internal/relayActions.ts +42 -0
  98. package/dist/cli/bin/commands-GxQUW4ck.js +0 -50
@@ -62,6 +62,7 @@ export function relay(parameters: relay.Parameters = {}) {
62
62
  permissions,
63
63
  internal,
64
64
  signInWithEthereum,
65
+ providerRdns,
65
66
  } = parameters
66
67
  const { client } = internal
67
68
 
@@ -70,14 +71,16 @@ export function relay(parameters: relay.Parameters = {}) {
70
71
  const feeTokens = await Tokens.getTokens(client)
71
72
 
72
73
  const adminKey = !mock
73
- ? await Key.createWebAuthnP256({
74
- createFn: webAuthn?.createFn,
75
- label:
76
- label ||
77
- `${eoa.address.slice(0, 8)}\u2026${eoa.address.slice(-6)}`,
78
- rpId: keystoreHost,
79
- userId: Bytes.from(eoa.address),
80
- })
74
+ ? providerRdns
75
+ ? await Key.createEip1193Provider({ rdns: providerRdns })
76
+ : await Key.createWebAuthnP256({
77
+ createFn: webAuthn?.createFn,
78
+ label:
79
+ label ||
80
+ `${eoa.address.slice(0, 8)}\u2026${eoa.address.slice(-6)}`,
81
+ rpId: keystoreHost,
82
+ userId: Bytes.from(eoa.address),
83
+ })
81
84
  : Key.createHeadlessWebAuthnP256()
82
85
  const sessionKey = await PermissionsRequest.toKey(permissions, {
83
86
  chainId: client.chain.id,
@@ -86,14 +89,47 @@ export function relay(parameters: relay.Parameters = {}) {
86
89
 
87
90
  const adminKeys = admins?.map((admin) => Key.from(admin))
88
91
 
89
- const account = await RelayActions.upgradeAccount(client, {
90
- account: eoa,
91
- authorizeKeys: [
92
- adminKey,
93
- ...(adminKeys ?? []),
94
- ...(sessionKey ? [sessionKey] : []),
95
- ],
96
- })
92
+ const { address: existingAccount } = providerRdns
93
+ ? await RelayActions.getAccount(client, { keyHash: adminKey.hash })
94
+ : { address: null }
95
+
96
+ const account = existingAccount
97
+ ? Account.from({
98
+ address: existingAccount,
99
+ keys: [
100
+ adminKey,
101
+ ...(adminKeys ?? []),
102
+ ...(sessionKey ? [sessionKey] : []),
103
+ ],
104
+ })
105
+ : await RelayActions.upgradeAccount(client, {
106
+ account: eoa,
107
+ authorizeKeys: [
108
+ adminKey,
109
+ ...(adminKeys ?? []),
110
+ ...(sessionKey ? [sessionKey] : []),
111
+ ],
112
+ })
113
+
114
+ if (existingAccount && sessionKey) {
115
+ const { context, digest, typedData } =
116
+ await RelayActions.prepareCalls(client, {
117
+ account,
118
+ authorizeKeys: [sessionKey],
119
+ key: adminKey,
120
+ preCalls: true,
121
+ })
122
+ const signature = await Key.sign(adminKey, {
123
+ address: null,
124
+ payload: digest,
125
+ typedData,
126
+ })
127
+ await RelayActions.sendPreparedCalls(client, {
128
+ context,
129
+ key: adminKey,
130
+ signature,
131
+ })
132
+ }
97
133
 
98
134
  address_internal = eoa.address
99
135
 
@@ -306,15 +342,19 @@ export function relay(parameters: relay.Parameters = {}) {
306
342
  )
307
343
  if (!adminKey) throw new Error('admin key not found.')
308
344
 
309
- const { context, digest } = await RelayActions.prepareCalls(client, {
310
- account,
311
- authorizeKeys: [authorizeKey],
312
- key: adminKey,
313
- preCalls: true,
314
- })
345
+ const { context, digest, typedData } = await RelayActions.prepareCalls(
346
+ client,
347
+ {
348
+ account,
349
+ authorizeKeys: [authorizeKey],
350
+ key: adminKey,
351
+ preCalls: true,
352
+ },
353
+ )
315
354
  const signature = await Key.sign(adminKey, {
316
355
  address: null,
317
356
  payload: digest,
357
+ typedData,
318
358
  })
319
359
  await RelayActions.sendPreparedCalls(client, {
320
360
  context,
@@ -326,7 +366,12 @@ export function relay(parameters: relay.Parameters = {}) {
326
366
  },
327
367
 
328
368
  async loadAccounts(parameters) {
329
- const { internal, permissions, signInWithEthereum } = parameters
369
+ const {
370
+ internal,
371
+ permissions,
372
+ signInWithEthereum,
373
+ providerRdns: _providerRdns,
374
+ } = parameters
330
375
  const { client } = internal
331
376
 
332
377
  const feeTokens = await Tokens.getTokens(client)
@@ -362,42 +407,86 @@ export function relay(parameters: relay.Parameters = {}) {
362
407
  } as const
363
408
  })()
364
409
 
365
- const { address, credentialId, webAuthnSignature } =
366
- await (async () => {
367
- if (mock) {
368
- if (!address_internal)
369
- throw new Error('address_internal not found.')
370
- return {
371
- address: address_internal,
372
- credentialId: undefined,
373
- } as const
374
- }
410
+ const {
411
+ address,
412
+ credentialId,
413
+ webAuthnSignature,
414
+ rdns,
415
+ providerSignature,
416
+ } = await (async () => {
417
+ if (mock) {
418
+ if (!address_internal)
419
+ throw new Error('address_internal not found.')
420
+ return {
421
+ address: address_internal,
422
+ credentialId: undefined,
423
+ } as const
424
+ }
375
425
 
376
- // If the address and credentialId are provided, we can skip the
377
- // WebAuthn discovery step.
378
- if (parameters.address && parameters.key)
426
+ // If the address and credentialId are provided, we can skip the
427
+ // WebAuthn discovery step.
428
+ if (parameters.address && parameters.key) {
429
+ if ('credentialId' in parameters.key)
379
430
  return {
380
431
  address: parameters.address,
381
432
  credentialId: parameters.key.credentialId,
382
433
  }
434
+ if ('rdns' in parameters.key)
435
+ return {
436
+ address: parameters.address,
437
+ rdns: parameters.key.rdns,
438
+ }
439
+ }
383
440
 
384
- // Discovery step. We need to do this to extract the key id
385
- // to query for the Account.
386
- // We will also optionally sign over a digest to authorize
387
- // a session key if the user has provided one.
388
- const webAuthnSignature = await WebAuthnP256.sign({
389
- challenge: digest,
390
- getFn: webAuthn?.getFn,
391
- rpId: keystoreHost,
441
+ if (_providerRdns) {
442
+ const key = await Key.createEip1193Provider({
443
+ rdns: _providerRdns,
392
444
  })
393
- const response = webAuthnSignature.raw
394
- .response as AuthenticatorAssertionResponse
395
445
 
396
- const address = Bytes.toHex(new Uint8Array(response.userHandle!))
397
- const credentialId = webAuthnSignature.raw.id
446
+ const account = await RelayActions.getAccount(client, {
447
+ keyHash: key.hash,
448
+ })
398
449
 
399
- return { address, credentialId, webAuthnSignature }
400
- })()
450
+ if (account.address) {
451
+ const signature =
452
+ digest !== '0x'
453
+ ? await Key.sign(key, {
454
+ address: null,
455
+ payload: message as Hex.Hex,
456
+ wrap: true,
457
+ })
458
+ : undefined
459
+
460
+ return {
461
+ address: account.address,
462
+ providerSignature: signature,
463
+ rdns: _providerRdns,
464
+ }
465
+ }
466
+ throw new Error(
467
+ `No account found for external wallet ${key.publicKey}`,
468
+ )
469
+ }
470
+
471
+ // Discovery step. We need to do this to extract the key id
472
+ // to query for the Account.
473
+ // We will also optionally sign over a digest to authorize
474
+ // a session key if the user has provided one.
475
+ const webAuthnSignature = await WebAuthnP256.sign({
476
+ challenge: digest,
477
+ getFn: webAuthn?.getFn,
478
+ rpId: keystoreHost,
479
+ })
480
+ const response = webAuthnSignature.raw
481
+ .response as AuthenticatorAssertionResponse
482
+
483
+ const address = Bytes.toHex(new Uint8Array(response.userHandle!))
484
+ const credentialId = webAuthnSignature.raw.id
485
+
486
+ return { address, credentialId, webAuthnSignature }
487
+ })()
488
+
489
+ const providerRdns = rdns ?? _providerRdns
401
490
 
402
491
  const keys = await RelayActions.getKeys(client, {
403
492
  account: address,
@@ -421,6 +510,12 @@ export function relay(parameters: relay.Parameters = {}) {
421
510
  id: address,
422
511
  rpId: keystoreHost,
423
512
  })
513
+ if (key.type === 'address' && providerRdns)
514
+ return Key.fromEip1193Provider({
515
+ ...key,
516
+ account: key.publicKey,
517
+ rdns: providerRdns,
518
+ })
424
519
  }
425
520
  return key
426
521
  },
@@ -446,6 +541,8 @@ export function relay(parameters: relay.Parameters = {}) {
446
541
  },
447
542
  )
448
543
 
544
+ if (providerSignature) return providerSignature
545
+
449
546
  // Otherwise, we will sign over the digest for authorizing
450
547
  // the session key.
451
548
  return await Key.sign(adminKey, {
@@ -456,14 +553,16 @@ export function relay(parameters: relay.Parameters = {}) {
456
553
 
457
554
  // Prepare and send the authorize key pre-call.
458
555
  if (authorizeKey) {
459
- const { context, digest } = await RelayActions.prepareCalls(client, {
460
- account,
461
- authorizeKeys: [authorizeKey],
462
- preCalls: true,
463
- })
556
+ const { context, digest, typedData } =
557
+ await RelayActions.prepareCalls(client, {
558
+ account,
559
+ authorizeKeys: [authorizeKey],
560
+ preCalls: true,
561
+ })
464
562
  const signature = await Key.sign(adminKey, {
465
563
  address: null,
466
564
  payload: digest,
565
+ typedData,
467
566
  })
468
567
  await RelayActions.sendPreparedCalls(client, {
469
568
  context,
@@ -492,7 +591,9 @@ export function relay(parameters: relay.Parameters = {}) {
492
591
  },
493
592
  )
494
593
  const signature = await Account.sign(account, {
495
- payload: PersonalMessage.getSignPayload(Hex.fromString(message)),
594
+ payload: providerRdns
595
+ ? (message as Hex.Hex)
596
+ : PersonalMessage.getSignPayload(Hex.fromString(message)),
496
597
  role: 'admin',
497
598
  })
498
599
  const signature_erc8010 = await Erc8010.wrap(client, {
@@ -803,6 +904,7 @@ export function relay(parameters: relay.Parameters = {}) {
803
904
  payload: TypedData.getSignPayload(data),
804
905
  // If the domain is the Orchestrator, we don't need to replay-safe sign.
805
906
  replaySafe: !isOrchestrator,
907
+ typedData: data,
806
908
  webAuthn,
807
909
  })
808
910
 
@@ -783,6 +783,7 @@ export function from<
783
783
  grantPermissions: permissions,
784
784
  selectAccount,
785
785
  signInWithEthereum,
786
+ providerRdns,
786
787
  } = capabilities ?? {}
787
788
 
788
789
  const internal = {
@@ -802,6 +803,7 @@ export function from<
802
803
  internal,
803
804
  label,
804
805
  permissions,
806
+ providerRdns,
805
807
  signInWithEthereum,
806
808
  })
807
809
  return { accounts: [account] }
@@ -826,6 +828,17 @@ export function from<
826
828
  publicKey: key.publicKey,
827
829
  },
828
830
  }
831
+ if (
832
+ key.type === 'eip1193provider' &&
833
+ key.role === 'admin' &&
834
+ !providerRdns
835
+ )
836
+ return {
837
+ address: account?.address,
838
+ key: {
839
+ rdns: key.privateKey?.rdns,
840
+ },
841
+ }
829
842
  }
830
843
  return {
831
844
  address: undefined,
@@ -835,6 +848,7 @@ export function from<
835
848
  const loadAccountsParams = {
836
849
  internal,
837
850
  permissions,
851
+ providerRdns,
838
852
  signInWithEthereum,
839
853
  }
840
854
  try {
@@ -52,6 +52,10 @@ export type Schema = RpcSchema_ox.From<
52
52
  Request: z.input<typeof Rpc.wallet_feeTokens.Request>
53
53
  ReturnType: z.input<typeof Rpc.wallet_feeTokens.Response>
54
54
  }
55
+ | {
56
+ Request: z.input<typeof Rpc.wallet_getAccount.Request>
57
+ ReturnType: z.input<typeof Rpc.wallet_getAccount.Response>
58
+ }
55
59
  | {
56
60
  Request: z.input<typeof Rpc.wallet_getAccounts.Request>
57
61
  ReturnType: z.input<typeof Rpc.wallet_getAccounts.Response>
@@ -231,6 +231,29 @@ export namespace wallet_addFaucetFunds {
231
231
  export type Response = z.infer<typeof Response>
232
232
  }
233
233
 
234
+ export namespace wallet_getAccount {
235
+ /** Parameters for `wallet_getAccount` request. */
236
+ export const Parameters = z.object({
237
+ /** Key hash to look up account by. */
238
+ keyHash: u.hex(),
239
+ })
240
+ export type Parameters = z.infer<typeof Parameters>
241
+
242
+ /** Request for `wallet_getAccount`. */
243
+ export const Request = z.object({
244
+ method: z.literal('wallet_getAccount'),
245
+ params: z.readonly(z.tuple([Parameters])),
246
+ })
247
+ export type Request = z.infer<typeof Request>
248
+
249
+ /** Response for `wallet_getAccount`. */
250
+ export const Response = z.object({
251
+ /** Account address. */
252
+ address: z.nullable(u.address()),
253
+ })
254
+ export type Response = z.infer<typeof Response>
255
+ }
256
+
234
257
  export namespace wallet_getAccounts {
235
258
  /** Parameters for `wallet_getAccounts` request. */
236
259
  export const Parameters = z.object({
@@ -23,6 +23,7 @@ export const Base = z.object({
23
23
  z.literal('p256'),
24
24
  z.literal('secp256k1'),
25
25
  z.literal('webauthn-p256'),
26
+ z.literal('eip1193provider'),
26
27
  ]),
27
28
  })
28
29
  export type Base = z.infer<typeof Base>
@@ -465,6 +465,7 @@ export namespace wallet_connect {
465
465
  ),
466
466
  grantPermissions: z.optional(C.grantPermissions.Request),
467
467
  preCalls: z.optional(C.preCalls.Request),
468
+ providerRdns: z.optional(z.string()),
468
469
  selectAccount: z.optional(
469
470
  z.union([
470
471
  z.boolean(),
@@ -7,7 +7,11 @@ import type { Payload } from '../core/Messenger.js'
7
7
  import * as Actions from './Actions.js'
8
8
  import type * as Remote from './Porto.js'
9
9
 
10
- const trustedOrigins = ['id.porto.sh', 'localhost:5174', 'localhost:5173']
10
+ const trustedOrigins = [
11
+ 'wallet.risechain.com',
12
+ 'localhost:5174',
13
+ 'localhost:5173',
14
+ ]
11
15
 
12
16
  /**
13
17
  * Event listener which is triggered when a request is ready
@@ -87,8 +91,11 @@ export function onDialogRequest(
87
91
  typeof rule === 'object' &&
88
92
  rule.sameOrigin &&
89
93
  event.origin !== window.location.origin
90
- )
91
- return false
94
+ ) {
95
+ // Allow bypass for RISEx origins
96
+ const risexOrigins = ['localhost:3009', 'rise.trade']
97
+ return risexOrigins.some((origin) => event.origin.endsWith(origin))
98
+ }
92
99
  return true
93
100
  }
94
101
 
@@ -40,4 +40,9 @@ export const hostnames = [
40
40
  'swap.defillama.com',
41
41
  'uniswap.org',
42
42
  'www.bungee.exchange',
43
+ 'wallet.risechain.com',
44
+ 'risechain.com',
45
+ 'testnet.rise.trade',
46
+ 'dev.rise.trade',
47
+ 'rise.trade',
43
48
  ]
@@ -13,6 +13,7 @@ import {
13
13
  import { toAccount } from 'viem/accounts'
14
14
  import type { Assign, Compute } from '../core/internal/types.js'
15
15
  import type * as Storage from '../core/Storage.js'
16
+ import type { prepareCalls } from './internal/relayActions.js'
16
17
  import * as Key from './Key.js'
17
18
 
18
19
  export type Account<
@@ -164,7 +165,9 @@ export function getKey(
164
165
  if (account.keys && account.keys.length > 0) {
165
166
  if (typeof key === 'number') return account.keys[key]
166
167
  return account.keys.find(
167
- (key) => key.privateKey && (!role || key.role === role),
168
+ (key) =>
169
+ (key.privateKey && (!role || key.role === role)) ||
170
+ key.type === 'eip1193provider',
168
171
  )
169
172
  }
170
173
 
@@ -191,24 +194,34 @@ export async function sign(
191
194
  account: Account,
192
195
  parameters: sign.Parameters,
193
196
  ): Promise<Compute<Hex.Hex>> {
194
- const { storage, replaySafe = true, wrap = true, webAuthn } = parameters
197
+ const {
198
+ storage,
199
+ replaySafe = true,
200
+ wrap = true,
201
+ webAuthn,
202
+ typedData,
203
+ } = parameters
195
204
 
196
205
  const key = getKey(account, parameters)
197
206
 
207
+ const wrapped = {
208
+ domain: { verifyingContract: account.address },
209
+ message: {
210
+ digest: parameters.payload,
211
+ },
212
+ primaryType: 'ERC1271Sign',
213
+ types: {
214
+ ERC1271Sign: [{ name: 'digest', type: 'bytes32' }],
215
+ },
216
+ } as TypedData.Definition
217
+
198
218
  const payload = (() => {
199
219
  if (!replaySafe) return parameters.payload
200
- return TypedData.getSignPayload({
201
- domain: { verifyingContract: account.address },
202
- message: {
203
- digest: parameters.payload,
204
- },
205
- primaryType: 'ERC1271Sign',
206
- types: {
207
- ERC1271Sign: [{ name: 'digest', type: 'bytes32' }],
208
- },
209
- })
220
+ return TypedData.getSignPayload(wrapped)
210
221
  })()
211
222
 
223
+ const typedDataPayload = !replaySafe ? typedData : wrapped
224
+
212
225
  const sign = (() => {
213
226
  if (!key) {
214
227
  if (account.source === 'privateKey') return account.sign
@@ -219,6 +232,7 @@ export async function sign(
219
232
  address: null,
220
233
  payload: hash,
221
234
  storage,
235
+ typedData: typedDataPayload,
222
236
  webAuthn,
223
237
  wrap,
224
238
  })
@@ -274,5 +288,9 @@ export declare namespace sign {
274
288
  getFn?: WebAuthnP256.sign.Options['getFn'] | undefined
275
289
  }
276
290
  | undefined
291
+ typedData?:
292
+ | prepareCalls.ReturnType['typedData']
293
+ | TypedData.Definition
294
+ | undefined
277
295
  }
278
296
  }