@1inch/fusion-sdk 2.3.7 → 2.3.8

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.
@@ -140,7 +140,7 @@ var Whitelist = /*#__PURE__*/ function() {
140
140
  {
141
141
  key: "isWhitelisted",
142
142
  value: function isWhitelisted(address) {
143
- var half = address.lastHalf();
143
+ var half = address.toString().slice(-20);
144
144
  return this.whitelist.some(function(w) {
145
145
  return w.addressHalf === half;
146
146
  });
@@ -65,4 +65,22 @@ describe('Whitelist', function() {
65
65
  expect(data.canExecuteAt(_limitordersdk.Address.fromBigInt(3n), start + 9n)).toEqual(false);
66
66
  expect(data.canExecuteAt(_limitordersdk.Address.fromBigInt(2n), start + 50n)).toEqual(false);
67
67
  });
68
+ it('should correctly identify whitelisted addresses with address half reconstruction', function() {
69
+ var start = 1708117482n;
70
+ var testAddress = new _limitordersdk.Address('0x1234567890abcdef1234567890abcdef12345678');
71
+ var whitelist = _whitelist.Whitelist.new(start, [
72
+ {
73
+ address: testAddress,
74
+ allowFrom: start + 10n
75
+ }
76
+ ]);
77
+ // Get the address half from the whitelist
78
+ var addressHalf = whitelist.whitelist[0].addressHalf;
79
+ expect(addressHalf).toBe('1234567890abcdef1234567890abcdef12345678'.slice(-20));
80
+ // Create a new address by duplicating the address half (like in the user's scenario)
81
+ var reconstructedAddress = new _limitordersdk.Address(addressHalf + addressHalf);
82
+ expect(whitelist.isWhitelisted(reconstructedAddress)).toBe(true);
83
+ expect(reconstructedAddress.toString().slice(-20)).toBe(addressHalf);
84
+ expect(reconstructedAddress.lastHalf()).toBe('0x' + addressHalf);
85
+ });
68
86
  });
@@ -125,7 +125,7 @@ export var Whitelist = /*#__PURE__*/ function() {
125
125
  {
126
126
  key: "isWhitelisted",
127
127
  value: function isWhitelisted(address) {
128
- var half = address.lastHalf();
128
+ var half = address.toString().slice(-20);
129
129
  return this.whitelist.some(function(w) {
130
130
  return w.addressHalf === half;
131
131
  });
@@ -61,4 +61,22 @@ describe('Whitelist', function() {
61
61
  expect(data.canExecuteAt(Address.fromBigInt(3n), start + 9n)).toEqual(false);
62
62
  expect(data.canExecuteAt(Address.fromBigInt(2n), start + 50n)).toEqual(false);
63
63
  });
64
+ it('should correctly identify whitelisted addresses with address half reconstruction', function() {
65
+ var start = 1708117482n;
66
+ var testAddress = new Address('0x1234567890abcdef1234567890abcdef12345678');
67
+ var whitelist = Whitelist.new(start, [
68
+ {
69
+ address: testAddress,
70
+ allowFrom: start + 10n
71
+ }
72
+ ]);
73
+ // Get the address half from the whitelist
74
+ var addressHalf = whitelist.whitelist[0].addressHalf;
75
+ expect(addressHalf).toBe('1234567890abcdef1234567890abcdef12345678'.slice(-20));
76
+ // Create a new address by duplicating the address half (like in the user's scenario)
77
+ var reconstructedAddress = new Address(addressHalf + addressHalf);
78
+ expect(whitelist.isWhitelisted(reconstructedAddress)).toBe(true);
79
+ expect(reconstructedAddress.toString().slice(-20)).toBe(addressHalf);
80
+ expect(reconstructedAddress.lastHalf()).toBe('0x' + addressHalf);
81
+ });
64
82
  });
@@ -1 +1 @@
1
- {"name":"@1inch/fusion-sdk","version":"2.3.7","type":"module"}
1
+ {"name":"@1inch/fusion-sdk","version":"2.3.8","type":"module"}