Skip to content

Commit

Permalink
feat: export getPredicateRoot from predicate package (#1653)
Browse files Browse the repository at this point in the history
  • Loading branch information
Torres-ssf authored Jan 16, 2024
1 parent be38167 commit cc2b2d1
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/plenty-seals-pay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@fuel-ts/predicate": minor
---

exporting getPredicateRoot from the predicate package
1 change: 1 addition & 0 deletions packages/predicate/src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from './predicate';
export * from './utils/getPredicateRoot';
18 changes: 18 additions & 0 deletions packages/predicate/src/utils/getPredicateRoot.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { getBytesCopy } from 'ethers';

import { getPredicateRoot } from './getPredicateRoot';

describe('getPredicateRoot', () => {
it('should return the correct predicate root', () => {
const predicateBytes = getBytesCopy(
'0x740000034700000000000000000000805dfcc00110fff3001aec5000910000207144000361491200764800026141120c74000007724c0002134924c05a492001764800026141124a74000001240000005c450000504900085c43f0001341044076400001740000055d43f005104103007244002028ed0440a1412ee0244000000a0000000000000038966262edb5997574be45f94c665aedb41a1663f5b0528e765f355086eebf960000000000000088'
);

const predicateRoot = getPredicateRoot(predicateBytes);

const expectedPredicateRoot =
'0xd8fe10a7e398a8af7235e0a7d43388179d89c59d521dcf314e7ee407af8cddce';

expect(predicateRoot).toEqual(expectedPredicateRoot);
});
});

0 comments on commit cc2b2d1

Please sign in to comment.