@0xsequence/wallet-core 3.0.0-beta.2 → 3.0.0-beta.3

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.
@@ -1,5 +1,5 @@
1
1
 
2
2
  
3
- > @0xsequence/wallet-core@3.0.0-beta.2 build /Users/taylan/Development/Horizon/sequence.js/packages/wallet/core
3
+ > @0xsequence/wallet-core@3.0.0-beta.3 build /Users/taylan/Development/Horizon/sequence.js/packages/wallet/core
4
4
  > tsc
5
5
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @0xsequence/wallet-core
2
2
 
3
+ ## 3.0.0-beta.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 3.0.0-beta.3 with fixes
8
+ - Updated dependencies
9
+ - @0xsequence/guard@3.0.0-beta.3
10
+ - @0xsequence/relayer@3.0.0-beta.3
11
+ - @0xsequence/wallet-primitives@3.0.0-beta.3
12
+
3
13
  ## 3.0.0-beta.2
4
14
 
5
15
  ### Patch Changes
@@ -1,8 +1,8 @@
1
1
  import { Address, PublicKey, Bytes } from 'ox';
2
2
  import { PkStore } from './index.js';
3
3
  export interface EncryptedData {
4
- iv: Uint8Array;
5
- data: ArrayBuffer;
4
+ iv: BufferSource;
5
+ data: BufferSource;
6
6
  keyPointer: string;
7
7
  address: Address.Address;
8
8
  publicKey: PublicKey.PublicKey;
@@ -1 +1 @@
1
- {"version":3,"file":"encrypted.d.ts","sourceRoot":"","sources":["../../../src/signers/pk/encrypted.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,OAAO,EAAE,SAAS,EAAa,KAAK,EAAE,MAAM,IAAI,CAAA;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAEpC,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,UAAU,CAAA;IACd,IAAI,EAAE,WAAW,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,OAAO,CAAC,OAAO,CA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+277,13 @@ const passkeySigners = [
277
277
  const recoverSapientSignatureCompactSignature = 'function recoverSapientSignatureCompact(bytes32 _digest, bytes _signature) view returns (bytes32)';
278
278
  const recoverSapientSignatureCompactFunction = AbiFunction.from(recoverSapientSignatureCompactSignature);
279
279
  class PasskeySignatureValidator {
280
- request = (({ method, params }) => {
281
- switch (method) {
280
+ request = (async (request) => {
281
+ switch (request.method) {
282
282
  case 'eth_call':
283
- const transaction = params[0];
283
+ if (!request.params || !Array.isArray(request.params) || request.params.length === 0) {
284
+ throw new Error('eth_call requires transaction parameters');
285
+ }
286
+ const transaction = request.params[0];
284
287
  if (!transaction.data?.startsWith(AbiFunction.getSelector(recoverSapientSignatureCompactFunction))) {
285
288
  throw new Error(`unknown selector ${transaction.data?.slice(0, 10)}, expected selector ${AbiFunction.getSelector(recoverSapientSignatureCompactFunction)} for ${recoverSapientSignatureCompactSignature}`);
286
289
  }
@@ -296,15 +299,15 @@ class PasskeySignatureValidator {
296
299
  throw new Error(`invalid passkey signature ${signature} for digest ${digest}`);
297
300
  }
298
301
  default:
299
- throw new Error(`method ${method} not implemented`);
302
+ throw new Error(`method ${request.method} not implemented`);
300
303
  }
301
304
  });
302
- on(event) {
305
+ on = (event) => {
303
306
  throw new Error(`unable to listen for ${event}: not implemented`);
304
- }
305
- removeListener(event) {
307
+ };
308
+ removeListener = (event) => {
306
309
  throw new Error(`unable to remove listener for ${event}: not implemented`);
307
- }
310
+ };
308
311
  }
309
312
  const passkeySignatureValidator = new PasskeySignatureValidator();
310
313
  function getServiceConfig(config) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xsequence/wallet-core",
3
- "version": "3.0.0-beta.2",
3
+ "version": "3.0.0-beta.3",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -14,21 +14,21 @@
14
14
  }
15
15
  },
16
16
  "devDependencies": {
17
- "@types/node": "^22.15.29",
18
- "@vitest/coverage-v8": "^3.2.4",
19
- "dotenv": "^16.5.0",
20
- "fake-indexeddb": "^6.0.1",
21
- "typescript": "^5.8.3",
22
- "vitest": "^3.2.1",
23
- "@repo/typescript-config": "^0.0.0"
17
+ "@types/node": "^24.10.1",
18
+ "@vitest/coverage-v8": "^4.0.14",
19
+ "dotenv": "^17.2.3",
20
+ "fake-indexeddb": "^6.2.5",
21
+ "typescript": "^5.9.3",
22
+ "vitest": "^4.0.14",
23
+ "@repo/typescript-config": "^0.0.1-beta.0"
24
24
  },
25
25
  "dependencies": {
26
26
  "mipd": "^0.0.7",
27
- "ox": "^0.7.2",
28
- "viem": "^2.30.6",
29
- "@0xsequence/wallet-primitives": "^3.0.0-beta.2",
30
- "@0xsequence/guard": "^3.0.0-beta.2",
31
- "@0xsequence/relayer": "^3.0.0-beta.2"
27
+ "ox": "^0.9.17",
28
+ "viem": "^2.40.3",
29
+ "@0xsequence/guard": "^3.0.0-beta.3",
30
+ "@0xsequence/relayer": "^3.0.0-beta.3",
31
+ "@0xsequence/wallet-primitives": "^3.0.0-beta.3"
32
32
  },
33
33
  "scripts": {
34
34
  "build": "tsc",
@@ -2,8 +2,8 @@ import { Hex, Address, PublicKey, Secp256k1, Bytes } from 'ox'
2
2
  import { PkStore } from './index.js'
3
3
 
4
4
  export interface EncryptedData {
5
- iv: Uint8Array
6
- data: ArrayBuffer
5
+ iv: BufferSource
6
+ data: BufferSource
7
7
  keyPointer: string
8
8
  address: Address.Address
9
9
  publicKey: PublicKey.PublicKey
@@ -377,10 +377,14 @@ const recoverSapientSignatureCompactSignature =
377
377
  const recoverSapientSignatureCompactFunction = AbiFunction.from(recoverSapientSignatureCompactSignature)
378
378
 
379
379
  class PasskeySignatureValidator implements oxProvider.Provider {
380
- request: oxProvider.Provider['request'] = (({ method, params }: { method: string; params: unknown }) => {
381
- switch (method) {
380
+ request: oxProvider.Provider['request'] = (async (request) => {
381
+ switch (request.method) {
382
382
  case 'eth_call':
383
- const transaction: TransactionRequest.Rpc = (params as any)[0]
383
+ if (!request.params || !Array.isArray(request.params) || request.params.length === 0) {
384
+ throw new Error('eth_call requires transaction parameters')
385
+ }
386
+
387
+ const transaction: TransactionRequest.Rpc = request.params[0]
384
388
 
385
389
  if (!transaction.data?.startsWith(AbiFunction.getSelector(recoverSapientSignatureCompactFunction))) {
386
390
  throw new Error(
@@ -403,15 +407,15 @@ class PasskeySignatureValidator implements oxProvider.Provider {
403
407
  }
404
408
 
405
409
  default:
406
- throw new Error(`method ${method} not implemented`)
410
+ throw new Error(`method ${request.method} not implemented`)
407
411
  }
408
- }) as any
412
+ }) as oxProvider.Provider['request']
409
413
 
410
- on(event: string) {
414
+ on: oxProvider.Provider['on'] = (event: string) => {
411
415
  throw new Error(`unable to listen for ${event}: not implemented`)
412
416
  }
413
417
 
414
- removeListener(event: string) {
418
+ removeListener: oxProvider.Provider['removeListener'] = (event: string) => {
415
419
  throw new Error(`unable to remove listener for ${event}: not implemented`)
416
420
  }
417
421
  }
@@ -59,8 +59,8 @@ export class PermissionBuilder {
59
59
  throw new Error(`cannot call exactCalldata() after calling allowAll() or adding rules`)
60
60
  }
61
61
  for (let offset = 0; offset < calldata.length; offset += 32) {
62
- let value = calldata.slice(offset, offset + 32)
63
- let mask = Permission.MASK.BYTES32
62
+ let value: Bytes.Bytes = calldata.slice(offset, offset + 32)
63
+ let mask: Bytes.Bytes = Permission.MASK.BYTES32
64
64
  if (value.length < 32) {
65
65
  mask = Bytes.fromHex(`0x${'ff'.repeat(value.length)}${'00'.repeat(32 - value.length)}`)
66
66
  value = Bytes.padRight(value, 32)
package/test/constants.ts CHANGED
@@ -17,5 +17,3 @@ export const USDC_ADDRESS: Address.Address = '0xaf88d065e77c8cc2239327c5edb3a432
17
17
 
18
18
  // Environment variables
19
19
  export const LOCAL_RPC_URL = process.env.LOCAL_RPC_URL || 'http://localhost:8545'
20
- export const { RPC_URL, PRIVATE_KEY } = process.env
21
- export const CAN_RUN_LIVE = !!RPC_URL && !!PRIVATE_KEY
@@ -1,20 +1,17 @@
1
+ import { Extensions } from '@0xsequence/wallet-primitives'
1
2
  import { AbiEvent, AbiFunction, Address, Bytes, Hex, Provider, RpcTransport, Secp256k1 } from 'ox'
2
3
  import { describe, expect, it } from 'vitest'
3
-
4
4
  import { Attestation, GenericTree, Payload, Permission, SessionConfig } from '../../primitives/src/index.js'
5
5
  import { Envelope, Signers, State, Utils, Wallet } from '../src/index.js'
6
-
6
+ import { ExplicitSessionConfig } from '../src/utils/session/types.js'
7
7
  import {
8
- EMITTER_FUNCTIONS,
9
8
  EMITTER_ADDRESS1,
10
9
  EMITTER_ADDRESS2,
11
10
  EMITTER_EVENT_TOPICS,
11
+ EMITTER_FUNCTIONS,
12
12
  LOCAL_RPC_URL,
13
13
  USDC_ADDRESS,
14
14
  } from './constants'
15
- import { Extensions } from '@0xsequence/wallet-primitives'
16
- import { ExplicitSessionConfig } from '../src/utils/session/types.js'
17
-
18
15
  const { PermissionBuilder, ERC20PermissionBuilder } = Utils
19
16
 
20
17
  function randomAddress(): Address.Address {
@@ -605,10 +602,26 @@ for (const extension of ALL_EXTENSIONS) {
605
602
  transaction: { to: Address.Address; data: Hex.Hex },
606
603
  expectedEventTopic?: Hex.Hex,
607
604
  ) => {
605
+ // Generate and use a random sender address to prevent race conditions
606
+ const senderAddress = Address.fromPublicKey(Secp256k1.getPublicKey({ privateKey: Secp256k1.randomPrivateKey() }))
607
+ await provider.request({
608
+ method: 'anvil_setBalance',
609
+ params: [senderAddress, Hex.fromNumber(1000000000000000000n)],
610
+ })
611
+ await provider.request({
612
+ method: 'anvil_impersonateAccount',
613
+ params: [senderAddress],
614
+ })
615
+
608
616
  console.log('Simulating transaction', transaction)
609
617
  const txHash = await provider.request({
610
618
  method: 'eth_sendTransaction',
611
- params: [transaction],
619
+ params: [
620
+ {
621
+ ...transaction,
622
+ from: senderAddress,
623
+ },
624
+ ],
612
625
  })
613
626
  console.log('Transaction hash:', txHash)
614
627
 
package/vitest.config.ts DELETED
@@ -1,9 +0,0 @@
1
- import { defineConfig } from 'vitest/config'
2
-
3
- export default defineConfig({
4
- test: {
5
- poolOptions: {
6
- singleThread: true,
7
- },
8
- },
9
- })