@0xsequence/guard 3.0.2 → 3.0.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/guard@3.0.2 build /home/taylan/development/sequence/sequence.js/packages/services/guard
3
+ > @0xsequence/guard@3.0.3 build /home/taylan/development/sequence/sequence.js/packages/services/guard
4
4
  > tsc
5
5
 
@@ -1,4 +1,4 @@
1
1
 
2
- > @0xsequence/guard@3.0.2 lint /home/taylan/development/sequence/sequence.js/packages/services/guard
2
+ > @0xsequence/guard@3.0.3 lint /home/taylan/development/sequence/sequence.js/packages/services/guard
3
3
  > eslint . --max-warnings 0
4
4
 
@@ -1,4 +1,4 @@
1
1
 
2
- > @0xsequence/guard@3.0.2 typecheck /home/taylan/development/sequence/sequence.js/packages/services/guard
2
+ > @0xsequence/guard@3.0.3 typecheck /home/taylan/development/sequence/sequence.js/packages/services/guard
3
3
  > tsc --noEmit
4
4
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @0xsequence/guard
2
2
 
3
+ ## 3.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 3.0.3
8
+
3
9
  ## 3.0.2
4
10
 
5
11
  ### Patch Changes
package/dist/sequence.js CHANGED
@@ -38,7 +38,7 @@ export class Guard {
38
38
  throw new Types.AuthRequiredError('PIN');
39
39
  }
40
40
  console.error(error);
41
- throw new Error('Error signing with guard');
41
+ throw new Error('Error signing with guard', { cause: error });
42
42
  }
43
43
  }
44
44
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xsequence/guard",
3
- "version": "3.0.2",
3
+ "version": "3.0.3",
4
4
  "description": "guard sub-package for Sequence",
5
5
  "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/services/guard",
6
6
  "author": "Sequence Platforms ULC",
@@ -20,8 +20,8 @@
20
20
  "@types/node": "^25.3.0",
21
21
  "typescript": "^5.9.3",
22
22
  "vitest": "^4.0.18",
23
- "@repo/typescript-config": "^0.0.1",
24
- "@repo/eslint-config": "^0.0.1"
23
+ "@repo/eslint-config": "^0.0.1",
24
+ "@repo/typescript-config": "^0.0.1"
25
25
  },
26
26
  "dependencies": {
27
27
  "ox": "^0.9.17"
package/src/sequence.ts CHANGED
@@ -50,7 +50,7 @@ export class Guard implements Types.Guard {
50
50
  throw new Types.AuthRequiredError('PIN')
51
51
  }
52
52
  console.error(error)
53
- throw new Error('Error signing with guard')
53
+ throw new Error('Error signing with guard', { cause: error })
54
54
  }
55
55
  }
56
56
  }
@@ -116,6 +116,21 @@ describe('Sequence', () => {
116
116
  ).rejects.toThrow('Error signing with guard')
117
117
  })
118
118
 
119
+ it('Should preserve the original guard failure as cause', async () => {
120
+ mockFetch.mockRejectedValueOnce(new Error('Network error'))
121
+
122
+ try {
123
+ await guard.signPayload(testWallet, 42161, PayloadType.ConfigUpdate, testMessageDigest, testMessage)
124
+ throw new Error('Expected signPayload to throw')
125
+ } catch (error) {
126
+ expect(error).toBeInstanceOf(Error)
127
+ expect((error as Error).message).toBe('Error signing with guard')
128
+ expect((error as Error & { cause?: unknown }).cause).toBeInstanceOf(Error)
129
+ expect((error as Error & { cause?: Error }).cause?.name).toBe('WebrpcRequestFailed')
130
+ expect((error as Error & { cause?: Error }).cause?.message).toBe('request failed')
131
+ }
132
+ })
133
+
119
134
  it('Should include proper headers and signer address in request', async () => {
120
135
  const mockGuardAddress = '0x9876543210987654321098765432109876543210' as Address.Address
121
136
  const customGuard = new Guard('https://guard.sequence.app', mockGuardAddress, fetch)