@propxchain/core-client 0.3.0 → 0.5.0-canary.42

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 (61) hide show
  1. package/dist/canisters/document_storage/document_storage.did.d.ts +169 -7
  2. package/dist/canisters/document_storage/document_storage.did.js +237 -148
  3. package/dist/canisters/document_verification/document_verification.did.d.ts +248 -7
  4. package/dist/canisters/document_verification/document_verification.did.js +322 -231
  5. package/dist/canisters/email_service/email_service.did.d.ts +92 -7
  6. package/dist/canisters/email_service/email_service.did.js +128 -73
  7. package/dist/canisters/land_registry_integration/land_registry_integration.did.d.ts +227 -7
  8. package/dist/canisters/land_registry_integration/land_registry_integration.did.js +264 -315
  9. package/dist/canisters/ledger_manager/ledger_manager.did.d.ts +215 -7
  10. package/dist/canisters/ledger_manager/ledger_manager.did.js +262 -198
  11. package/dist/canisters/property_registry/property_registry.did.d.ts +77 -7
  12. package/dist/canisters/property_registry/property_registry.did.js +84 -57
  13. package/dist/canisters/transaction_manager/transaction_manager.did.d.ts +960 -7
  14. package/dist/canisters/transaction_manager/transaction_manager.did.js +1081 -867
  15. package/dist/canisters/user_management/user_management.did.d.ts +314 -7
  16. package/dist/canisters/user_management/user_management.did.js +420 -254
  17. package/dist/jurisdiction.d.ts +50 -0
  18. package/dist/jurisdiction.d.ts.map +1 -0
  19. package/dist/jurisdiction.js +109 -0
  20. package/dist/jurisdiction.js.map +1 -0
  21. package/dist/mock.js +1 -1
  22. package/package.json +6 -2
  23. package/src/canisters/document_storage/document_storage.did +32 -21
  24. package/src/canisters/document_storage/document_storage.did.d.ts +34 -24
  25. package/src/canisters/document_storage/document_storage.did.js +31 -21
  26. package/src/canisters/document_verification/document_verification.did +6 -6
  27. package/src/canisters/document_verification/document_verification.did.d.ts +12 -12
  28. package/src/canisters/document_verification/document_verification.did.js +28 -28
  29. package/src/canisters/email_service/email_service.did.d.ts +3 -3
  30. package/src/canisters/land_registry_integration/land_registry_integration.did.d.ts +3 -3
  31. package/src/canisters/land_registry_integration/land_registry_integration.did.js +23 -139
  32. package/src/canisters/ledger_manager/ledger_manager.did +2 -1
  33. package/src/canisters/ledger_manager/ledger_manager.did.d.ts +4 -3
  34. package/src/canisters/ledger_manager/ledger_manager.did.js +2 -5
  35. package/src/canisters/property_registry/property_registry.did +7 -3
  36. package/src/canisters/property_registry/property_registry.did.d.ts +10 -6
  37. package/src/canisters/property_registry/property_registry.did.js +12 -4
  38. package/src/canisters/transaction_manager/transaction_manager.did +104 -44
  39. package/src/canisters/transaction_manager/transaction_manager.did.d.ts +93 -43
  40. package/src/canisters/transaction_manager/transaction_manager.did.js +117 -38
  41. package/src/canisters/user_management/user_management.did +62 -19
  42. package/src/canisters/user_management/user_management.did.d.ts +68 -21
  43. package/src/canisters/user_management/user_management.did.js +90 -19
  44. package/src/jurisdiction.ts +117 -0
  45. package/src/mock.ts +1 -1
  46. package/dist/canisters/document_storage/document_storage.did.d.ts.map +0 -1
  47. package/dist/canisters/document_storage/document_storage.did.js.map +0 -1
  48. package/dist/canisters/document_verification/document_verification.did.d.ts.map +0 -1
  49. package/dist/canisters/document_verification/document_verification.did.js.map +0 -1
  50. package/dist/canisters/email_service/email_service.did.d.ts.map +0 -1
  51. package/dist/canisters/email_service/email_service.did.js.map +0 -1
  52. package/dist/canisters/land_registry_integration/land_registry_integration.did.d.ts.map +0 -1
  53. package/dist/canisters/land_registry_integration/land_registry_integration.did.js.map +0 -1
  54. package/dist/canisters/ledger_manager/ledger_manager.did.d.ts.map +0 -1
  55. package/dist/canisters/ledger_manager/ledger_manager.did.js.map +0 -1
  56. package/dist/canisters/property_registry/property_registry.did.d.ts.map +0 -1
  57. package/dist/canisters/property_registry/property_registry.did.js.map +0 -1
  58. package/dist/canisters/transaction_manager/transaction_manager.did.d.ts.map +0 -1
  59. package/dist/canisters/transaction_manager/transaction_manager.did.js.map +0 -1
  60. package/dist/canisters/user_management/user_management.did.d.ts.map +0 -1
  61. package/dist/canisters/user_management/user_management.did.js.map +0 -1
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Copyright (C) 2025 PropXchain. All rights reserved.
3
+ * Proprietary and confidential.
4
+ *
5
+ * Which legal system a UK property sits in, from its postcode.
6
+ *
7
+ * PropXchain operates in England and Wales only. Scotland runs an entirely
8
+ * different conveyancing system — missives rather than exchange, the Land
9
+ * Register of Scotland rather than HM Land Registry, and no CON29 or LLC1 at
10
+ * all. Northern Ireland is different again. None of our searches, forms or
11
+ * title pulls mean anything there.
12
+ *
13
+ * This exists because nothing stopped an out-of-jurisdiction property entering
14
+ * the flow. On 2026-08-10 a Scottish UPRN went all the way to a priced tmGroup
15
+ * draft and came back at £0.00 with an empty failure list — the searches simply
16
+ * do not exist in Scotland, so there was nothing to price and nothing to
17
+ * report. tmGroup confirmed it: "That UPRN is in Scotland and therefore
18
+ * authority look-ups do not apply." A £0 quote is the LAST place that should be
19
+ * caught. The address is the first.
20
+ */
21
+ export type Jurisdiction = 'england-wales' | 'scotland' | 'northern-ireland' | 'crown-dependency' | 'ambiguous' | 'unknown';
22
+ /**
23
+ * The postcode AREA — the leading letters before the first digit. `EH10 6QL`
24
+ * gives `EH`, `G1 1AA` gives `G`.
25
+ *
26
+ * Deliberately tolerant of missing spaces and lower case, because this runs on
27
+ * whatever a person typed. It is deliberately NOT tolerant of things that are
28
+ * not postcodes: an unparseable value returns null and the caller decides,
29
+ * rather than being silently treated as England.
30
+ */
31
+ export declare function postcodeArea(postcode: string | null | undefined): string | null;
32
+ /** Which legal system this postcode falls in. */
33
+ export declare function jurisdictionFromPostcode(postcode: string | null | undefined): Jurisdiction;
34
+ /**
35
+ * Can PropXchain handle this property?
36
+ *
37
+ * 'ambiguous' and 'unknown' both pass. That is deliberate: this is a guard
38
+ * against the clearly-wrong, not an address validator. Refusing every postcode
39
+ * we failed to parse would turn a typo into a dead end, and refusing Berwick
40
+ * would turn a correct English address into one. What must never happen is a
41
+ * confidently Scottish property reaching a payment screen.
42
+ */
43
+ export declare function isSupportedJurisdiction(postcode: string | null | undefined): boolean;
44
+ /**
45
+ * What to tell the person, in their terms. Never "invalid postcode" — their
46
+ * postcode is perfectly valid, it is our coverage that is limited, and saying
47
+ * so plainly is the difference between a clear no and a broken form.
48
+ */
49
+ export declare function unsupportedJurisdictionMessage(postcode: string | null | undefined): string | null;
50
+ //# sourceMappingURL=jurisdiction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jurisdiction.d.ts","sourceRoot":"","sources":["../src/jurisdiction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAyBH,MAAM,MAAM,YAAY,GACpB,eAAe,GACf,UAAU,GACV,kBAAkB,GAClB,kBAAkB,GAClB,WAAW,GACX,SAAS,CAAC;AAEd;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAO/E;AAED,iDAAiD;AACjD,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,YAAY,CAQ1F;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAKpF;AAED;;;;GAIG;AACH,wBAAgB,8BAA8B,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAcjG"}
@@ -0,0 +1,109 @@
1
+ /**
2
+ * Copyright (C) 2025 PropXchain. All rights reserved.
3
+ * Proprietary and confidential.
4
+ *
5
+ * Which legal system a UK property sits in, from its postcode.
6
+ *
7
+ * PropXchain operates in England and Wales only. Scotland runs an entirely
8
+ * different conveyancing system — missives rather than exchange, the Land
9
+ * Register of Scotland rather than HM Land Registry, and no CON29 or LLC1 at
10
+ * all. Northern Ireland is different again. None of our searches, forms or
11
+ * title pulls mean anything there.
12
+ *
13
+ * This exists because nothing stopped an out-of-jurisdiction property entering
14
+ * the flow. On 2026-08-10 a Scottish UPRN went all the way to a priced tmGroup
15
+ * draft and came back at £0.00 with an empty failure list — the searches simply
16
+ * do not exist in Scotland, so there was nothing to price and nothing to
17
+ * report. tmGroup confirmed it: "That UPRN is in Scotland and therefore
18
+ * authority look-ups do not apply." A £0 quote is the LAST place that should be
19
+ * caught. The address is the first.
20
+ */
21
+ /** Postcode areas wholly within Scotland. */
22
+ const SCOTLAND_AREAS = new Set([
23
+ 'AB', 'DD', 'DG', 'EH', 'FK', 'G', 'HS', 'IV',
24
+ 'KA', 'KW', 'KY', 'ML', 'PA', 'PH', 'ZE',
25
+ ]);
26
+ /**
27
+ * Areas that straddle the border, so the postcode alone cannot decide.
28
+ *
29
+ * TD covers the Scottish Borders but also Berwick-upon-Tweed (TD15), which is
30
+ * in England. CA is Cumbria but a handful of CA6 addresses are Scottish.
31
+ * Guessing either way is wrong for real people in real houses, so these resolve
32
+ * to 'ambiguous' and the caller must confirm another way — for a tmGroup order
33
+ * the local-authority lookup is the answer, because it names the actual council.
34
+ */
35
+ const BORDER_AREAS = new Set(['TD', 'CA']);
36
+ /** Northern Ireland. Separate legal system, separate registry. */
37
+ const NORTHERN_IRELAND_AREAS = new Set(['BT']);
38
+ /** Crown dependencies. Not the UK for these purposes, and not our market. */
39
+ const CROWN_DEPENDENCY_AREAS = new Set(['IM', 'GY', 'JE']);
40
+ /**
41
+ * The postcode AREA — the leading letters before the first digit. `EH10 6QL`
42
+ * gives `EH`, `G1 1AA` gives `G`.
43
+ *
44
+ * Deliberately tolerant of missing spaces and lower case, because this runs on
45
+ * whatever a person typed. It is deliberately NOT tolerant of things that are
46
+ * not postcodes: an unparseable value returns null and the caller decides,
47
+ * rather than being silently treated as England.
48
+ */
49
+ export function postcodeArea(postcode) {
50
+ if (typeof postcode !== 'string')
51
+ return null;
52
+ const cleaned = postcode.trim().toUpperCase().replace(/\s+/g, '');
53
+ if (!cleaned)
54
+ return null;
55
+ // A UK outward code is 1-2 letters, then a digit. Anything else is not one.
56
+ const match = /^([A-Z]{1,2})[0-9]/.exec(cleaned);
57
+ return match ? match[1] : null;
58
+ }
59
+ /** Which legal system this postcode falls in. */
60
+ export function jurisdictionFromPostcode(postcode) {
61
+ const area = postcodeArea(postcode);
62
+ if (!area)
63
+ return 'unknown';
64
+ if (SCOTLAND_AREAS.has(area))
65
+ return 'scotland';
66
+ if (NORTHERN_IRELAND_AREAS.has(area))
67
+ return 'northern-ireland';
68
+ if (CROWN_DEPENDENCY_AREAS.has(area))
69
+ return 'crown-dependency';
70
+ if (BORDER_AREAS.has(area))
71
+ return 'ambiguous';
72
+ return 'england-wales';
73
+ }
74
+ /**
75
+ * Can PropXchain handle this property?
76
+ *
77
+ * 'ambiguous' and 'unknown' both pass. That is deliberate: this is a guard
78
+ * against the clearly-wrong, not an address validator. Refusing every postcode
79
+ * we failed to parse would turn a typo into a dead end, and refusing Berwick
80
+ * would turn a correct English address into one. What must never happen is a
81
+ * confidently Scottish property reaching a payment screen.
82
+ */
83
+ export function isSupportedJurisdiction(postcode) {
84
+ const jurisdiction = jurisdictionFromPostcode(postcode);
85
+ return jurisdiction !== 'scotland'
86
+ && jurisdiction !== 'northern-ireland'
87
+ && jurisdiction !== 'crown-dependency';
88
+ }
89
+ /**
90
+ * What to tell the person, in their terms. Never "invalid postcode" — their
91
+ * postcode is perfectly valid, it is our coverage that is limited, and saying
92
+ * so plainly is the difference between a clear no and a broken form.
93
+ */
94
+ export function unsupportedJurisdictionMessage(postcode) {
95
+ switch (jurisdictionFromPostcode(postcode)) {
96
+ case 'scotland':
97
+ return 'PropXchain currently covers England and Wales only. Scotland has a separate '
98
+ + 'conveyancing system and its own land register, so we cannot handle this property yet.';
99
+ case 'northern-ireland':
100
+ return 'PropXchain currently covers England and Wales only. Northern Ireland has a '
101
+ + 'separate conveyancing system and its own land registry, so we cannot handle this property yet.';
102
+ case 'crown-dependency':
103
+ return 'PropXchain currently covers England and Wales only, which does not include the '
104
+ + 'Isle of Man or the Channel Islands.';
105
+ default:
106
+ return null;
107
+ }
108
+ }
109
+ //# sourceMappingURL=jurisdiction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jurisdiction.js","sourceRoot":"","sources":["../src/jurisdiction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,6CAA6C;AAC7C,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC;IAC7B,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI;IAC7C,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;CACzC,CAAC,CAAC;AAEH;;;;;;;;GAQG;AACH,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AAE3C,kEAAkE;AAClE,MAAM,sBAAsB,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AAE/C,6EAA6E;AAC7E,MAAM,sBAAsB,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AAU3D;;;;;;;;GAQG;AACH,MAAM,UAAU,YAAY,CAAC,QAAmC;IAC9D,IAAI,OAAO,QAAQ,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC9C,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAClE,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAC1B,4EAA4E;IAC5E,MAAM,KAAK,GAAG,oBAAoB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACjD,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACjC,CAAC;AAED,iDAAiD;AACjD,MAAM,UAAU,wBAAwB,CAAC,QAAmC;IAC1E,MAAM,IAAI,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;IACpC,IAAI,CAAC,IAAI;QAAE,OAAO,SAAS,CAAC;IAC5B,IAAI,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC;QAAE,OAAO,UAAU,CAAC;IAChD,IAAI,sBAAsB,CAAC,GAAG,CAAC,IAAI,CAAC;QAAE,OAAO,kBAAkB,CAAC;IAChE,IAAI,sBAAsB,CAAC,GAAG,CAAC,IAAI,CAAC;QAAE,OAAO,kBAAkB,CAAC;IAChE,IAAI,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC;QAAE,OAAO,WAAW,CAAC;IAC/C,OAAO,eAAe,CAAC;AACzB,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,uBAAuB,CAAC,QAAmC;IACzE,MAAM,YAAY,GAAG,wBAAwB,CAAC,QAAQ,CAAC,CAAC;IACxD,OAAO,YAAY,KAAK,UAAU;WAC7B,YAAY,KAAK,kBAAkB;WACnC,YAAY,KAAK,kBAAkB,CAAC;AAC3C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,8BAA8B,CAAC,QAAmC;IAChF,QAAQ,wBAAwB,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC3C,KAAK,UAAU;YACb,OAAO,8EAA8E;kBACjF,uFAAuF,CAAC;QAC9F,KAAK,kBAAkB;YACrB,OAAO,6EAA6E;kBAChF,gGAAgG,CAAC;QACvG,KAAK,kBAAkB;YACrB,OAAO,iFAAiF;kBACpF,qCAAqC,CAAC;QAC5C;YACE,OAAO,IAAI,CAAC;IAChB,CAAC;AACH,CAAC"}
package/dist/mock.js CHANGED
@@ -66,7 +66,7 @@ export function createMockPropertyRegistry() {
66
66
  return mockService({
67
67
  getAllProperties: async () => [],
68
68
  getProperty: async () => [],
69
- verifyProperty: async () => false,
69
+ attestProperty: async () => false,
70
70
  transferOwnership: async () => false,
71
71
  });
72
72
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@propxchain/core-client",
3
- "version": "0.3.0",
3
+ "version": "0.5.0-canary.42",
4
4
  "description": "Typed TypeScript client for the PropXchain core canisters on the Internet Computer. Includes a deterministic mock mode for local development and tests.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -18,6 +18,10 @@
18
18
  "./auth": {
19
19
  "types": "./dist/auth.d.ts",
20
20
  "import": "./dist/auth.js"
21
+ },
22
+ "./jurisdiction": {
23
+ "types": "./dist/jurisdiction.d.ts",
24
+ "import": "./dist/jurisdiction.js"
21
25
  }
22
26
  },
23
27
  "files": [
@@ -29,7 +33,7 @@
29
33
  "access": "public"
30
34
  },
31
35
  "scripts": {
32
- "build": "tsc -p tsconfig.json",
36
+ "build": "tsc -p tsconfig.json && node scripts/copy-candid-artifacts.mjs",
33
37
  "clean": "rm -rf dist",
34
38
  "test": "node --import tsx --test tests/*.test.ts",
35
39
  "typecheck": "tsc -p tsconfig.json --noEmit"
@@ -1,10 +1,10 @@
1
1
  type Time = int;
2
- type Result_6 =
2
+ type Result_7 =
3
3
  variant {
4
4
  err: text;
5
5
  ok: blob;
6
6
  };
7
- type Result_5 =
7
+ type Result_6 =
8
8
  variant {
9
9
  err: text;
10
10
  ok:
@@ -19,9 +19,10 @@ type Result_5 =
19
19
  transactionId: opt text;
20
20
  uploadedAt: int;
21
21
  uploadedBy: principal;
22
+ verified: bool;
22
23
  };
23
24
  };
24
- type Result_4 =
25
+ type Result_5 =
25
26
  variant {
26
27
  err: text;
27
28
  ok:
@@ -32,17 +33,17 @@ type Result_4 =
32
33
  uploadedChunks: nat;
33
34
  };
34
35
  };
35
- type Result_3 =
36
+ type Result_4 =
36
37
  variant {
37
38
  err: text;
38
39
  ok: nat;
39
40
  };
40
- type Result_2 =
41
+ type Result_3 =
41
42
  variant {
42
43
  err: text;
43
44
  ok: text;
44
45
  };
45
- type Result_1 =
46
+ type Result_2 =
46
47
  variant {
47
48
  err: text;
48
49
  ok: record {
@@ -51,11 +52,20 @@ type Result_1 =
51
52
  uploadedChunks: nat;
52
53
  };
53
54
  };
54
- type Result =
55
+ type Result_1 =
55
56
  variant {
56
57
  err: text;
57
58
  ok: bool;
58
59
  };
60
+ type Result =
61
+ variant {
62
+ err: text;
63
+ ok: record {
64
+ computedHash: text;
65
+ matches: bool;
66
+ registeredHash: text;
67
+ };
68
+ };
59
69
  type DocumentSource =
60
70
  variant {
61
71
  LandRegistryAPI;
@@ -104,17 +114,17 @@ type ActorType =
104
114
  user;
105
115
  };
106
116
  service : {
107
- deleteDocument: (documentId: nat, csrfToken: text) -> (Result_2);
108
- downloadDocumentChunk: (documentId: nat, chunkIndex: nat) -> (Result_6);
117
+ deleteDocument: (documentId: nat, csrfToken: text) -> (Result_3);
118
+ downloadDocumentChunk: (documentId: nat, chunkIndex: nat) -> (Result_7);
109
119
  generateCSRFToken: () -> (text);
110
120
  getAuditLogs: (documentId: nat) -> (vec AuditLog) query;
111
121
  getCSRFToken: () -> (opt text) query;
112
122
  getCycles: () -> (nat) query;
113
123
  getDocumentByLandRegistryReference: (lrRef: text) ->
114
124
  (opt DocumentProof) query;
115
- getDocumentMetadata: (documentId: nat) -> (Result_5) query;
125
+ getDocumentMetadata: (documentId: nat) -> (Result_6) query;
116
126
  getDocumentProof: (documentId: nat) -> (opt DocumentProof) query;
117
- getDocumentUploadStatus: (documentId: nat) -> (Result_4) query;
127
+ getDocumentUploadStatus: (documentId: nat) -> (Result_5) query;
118
128
  getDocumentVerificationCanister: () -> (opt principal) query;
119
129
  getExpiredLandRegistryDocuments: () -> (vec DocumentProof) query;
120
130
  getLandRegistryCanister: () -> (opt principal) query;
@@ -134,26 +144,27 @@ service : {
134
144
  getTransactionDocuments: (transactionId: text) -> (vec DocumentProof) query;
135
145
  getTransactionManagerCanister: () -> (opt principal) query;
136
146
  getUserManagementCanister: () -> (opt principal) query;
137
- markDocumentDeleted: (documentId: nat, csrfToken: text) -> (Result_2);
147
+ markDocumentDeleted: (documentId: nat, csrfToken: text) -> (Result_3);
138
148
  recordAuditEntry: (actorType: ActorType, delegatedBy: opt principal,
139
149
  action: text, documentId: nat, success: bool, metadata: text) ->
140
- (Result_3);
150
+ (Result_4);
141
151
  registerDocumentProof: (fileName: text, fileHash: text, fileSize: nat,
142
152
  contentType: text, storageLocation: text, transactionId: opt text,
143
- docType: text, csrfToken: text) -> (Result_3);
153
+ docType: text, csrfToken: text) -> (Result_4);
144
154
  registerLandRegistryDocument: (transactionId: text, titleNumber: text,
145
155
  documentType: text, fileHash: text, fileSize: nat, contentType: text,
146
156
  landRegistryReference: text, validUntil: opt int, costPence: nat) ->
147
- (Result_3);
148
- setDocumentVerificationCanister: (canisterId: principal) -> (Result_2);
149
- setLandRegistryCanister: (canisterId: principal) -> (Result_2);
157
+ (Result_4);
158
+ setDocumentVerificationCanister: (canisterId: principal) -> (Result_3);
159
+ setLandRegistryCanister: (canisterId: principal) -> (Result_3);
150
160
  setTransactionManagerCanister: (canisterId: principal, _csrfToken:
151
- text) -> (Result_2);
161
+ text) -> (Result_3);
152
162
  setUserManagementCanister: (canisterId: principal, _csrfToken: text) ->
153
- (Result_2);
163
+ (Result_3);
154
164
  uploadDocumentChunk: (documentId: nat, chunkIndex: nat, data: blob,
155
- csrfToken: text) -> (Result_1);
165
+ csrfToken: text) -> (Result_2);
156
166
  validateCSRFToken: (token: text) -> (bool);
157
167
  verifyDocumentHash: (documentId: nat, providedHash: text, csrfToken:
158
- text) -> (Result);
168
+ text) -> (Result_1);
169
+ verifyOnChainIntegrity: (documentId: nat) -> (Result);
159
170
  }
@@ -1,6 +1,6 @@
1
- import type { Principal } from '@dfinity/principal';
2
- import type { ActorMethod } from '@dfinity/agent';
3
- import type { IDL } from '@dfinity/candid';
1
+ import type { Principal } from '@icp-sdk/core/principal';
2
+ import type { ActorMethod } from '@icp-sdk/core/agent';
3
+ import type { IDL } from '@icp-sdk/core/candid';
4
4
 
5
5
  export type ActorType = { 'agent' : null } |
6
6
  { 'systemActor' : null } |
@@ -41,9 +41,17 @@ export type DocumentSource = { 'UserUploaded' : null } |
41
41
  { 'LandRegistryAPI' : null } |
42
42
  { 'LandRegistryNotification' : null } |
43
43
  { 'SystemGenerated' : null };
44
- export type Result = { 'ok' : boolean } |
44
+ export type Result = {
45
+ 'ok' : {
46
+ 'matches' : boolean,
47
+ 'computedHash' : string,
48
+ 'registeredHash' : string,
49
+ }
50
+ } |
45
51
  { 'err' : string };
46
- export type Result_1 = {
52
+ export type Result_1 = { 'ok' : boolean } |
53
+ { 'err' : string };
54
+ export type Result_2 = {
47
55
  'ok' : {
48
56
  'uploadedChunks' : bigint,
49
57
  'totalChunks' : bigint,
@@ -51,11 +59,11 @@ export type Result_1 = {
51
59
  }
52
60
  } |
53
61
  { 'err' : string };
54
- export type Result_2 = { 'ok' : string } |
62
+ export type Result_3 = { 'ok' : string } |
55
63
  { 'err' : string };
56
- export type Result_3 = { 'ok' : bigint } |
64
+ export type Result_4 = { 'ok' : bigint } |
57
65
  { 'err' : string };
58
- export type Result_4 = {
66
+ export type Result_5 = {
59
67
  'ok' : {
60
68
  'uploadedChunks' : bigint,
61
69
  'totalChunks' : bigint,
@@ -64,9 +72,10 @@ export type Result_4 = {
64
72
  }
65
73
  } |
66
74
  { 'err' : string };
67
- export type Result_5 = {
75
+ export type Result_6 = {
68
76
  'ok' : {
69
77
  'id' : bigint,
78
+ 'verified' : boolean,
70
79
  'contentType' : string,
71
80
  'fileHash' : string,
72
81
  'fileName' : string,
@@ -79,12 +88,12 @@ export type Result_5 = {
79
88
  }
80
89
  } |
81
90
  { 'err' : string };
82
- export type Result_6 = { 'ok' : Uint8Array | number[] } |
91
+ export type Result_7 = { 'ok' : Uint8Array | number[] } |
83
92
  { 'err' : string };
84
93
  export type Time = bigint;
85
94
  export interface _SERVICE {
86
- 'deleteDocument' : ActorMethod<[bigint, string], Result_2>,
87
- 'downloadDocumentChunk' : ActorMethod<[bigint, bigint], Result_6>,
95
+ 'deleteDocument' : ActorMethod<[bigint, string], Result_3>,
96
+ 'downloadDocumentChunk' : ActorMethod<[bigint, bigint], Result_7>,
88
97
  'generateCSRFToken' : ActorMethod<[], string>,
89
98
  'getAuditLogs' : ActorMethod<[bigint], Array<AuditLog>>,
90
99
  'getCSRFToken' : ActorMethod<[], [] | [string]>,
@@ -93,9 +102,9 @@ export interface _SERVICE {
93
102
  [string],
94
103
  [] | [DocumentProof]
95
104
  >,
96
- 'getDocumentMetadata' : ActorMethod<[bigint], Result_5>,
105
+ 'getDocumentMetadata' : ActorMethod<[bigint], Result_6>,
97
106
  'getDocumentProof' : ActorMethod<[bigint], [] | [DocumentProof]>,
98
- 'getDocumentUploadStatus' : ActorMethod<[bigint], Result_4>,
107
+ 'getDocumentUploadStatus' : ActorMethod<[bigint], Result_5>,
99
108
  'getDocumentVerificationCanister' : ActorMethod<[], [] | [Principal]>,
100
109
  'getExpiredLandRegistryDocuments' : ActorMethod<[], Array<DocumentProof>>,
101
110
  'getLandRegistryCanister' : ActorMethod<[], [] | [Principal]>,
@@ -121,14 +130,14 @@ export interface _SERVICE {
121
130
  'getTransactionDocuments' : ActorMethod<[string], Array<DocumentProof>>,
122
131
  'getTransactionManagerCanister' : ActorMethod<[], [] | [Principal]>,
123
132
  'getUserManagementCanister' : ActorMethod<[], [] | [Principal]>,
124
- 'markDocumentDeleted' : ActorMethod<[bigint, string], Result_2>,
133
+ 'markDocumentDeleted' : ActorMethod<[bigint, string], Result_3>,
125
134
  'recordAuditEntry' : ActorMethod<
126
135
  [ActorType, [] | [Principal], string, bigint, boolean, string],
127
- Result_3
136
+ Result_4
128
137
  >,
129
138
  'registerDocumentProof' : ActorMethod<
130
139
  [string, string, bigint, string, string, [] | [string], string, string],
131
- Result_3
140
+ Result_4
132
141
  >,
133
142
  'registerLandRegistryDocument' : ActorMethod<
134
143
  [
@@ -142,18 +151,19 @@ export interface _SERVICE {
142
151
  [] | [bigint],
143
152
  bigint,
144
153
  ],
145
- Result_3
154
+ Result_4
146
155
  >,
147
- 'setDocumentVerificationCanister' : ActorMethod<[Principal], Result_2>,
148
- 'setLandRegistryCanister' : ActorMethod<[Principal], Result_2>,
149
- 'setTransactionManagerCanister' : ActorMethod<[Principal, string], Result_2>,
150
- 'setUserManagementCanister' : ActorMethod<[Principal, string], Result_2>,
156
+ 'setDocumentVerificationCanister' : ActorMethod<[Principal], Result_3>,
157
+ 'setLandRegistryCanister' : ActorMethod<[Principal], Result_3>,
158
+ 'setTransactionManagerCanister' : ActorMethod<[Principal, string], Result_3>,
159
+ 'setUserManagementCanister' : ActorMethod<[Principal, string], Result_3>,
151
160
  'uploadDocumentChunk' : ActorMethod<
152
161
  [bigint, bigint, Uint8Array | number[], string],
153
- Result_1
162
+ Result_2
154
163
  >,
155
164
  'validateCSRFToken' : ActorMethod<[string], boolean>,
156
- 'verifyDocumentHash' : ActorMethod<[bigint, string, string], Result>,
165
+ 'verifyDocumentHash' : ActorMethod<[bigint, string, string], Result_1>,
166
+ 'verifyOnChainIntegrity' : ActorMethod<[bigint], Result>,
157
167
  }
158
168
  export declare const idlFactory: IDL.InterfaceFactory;
159
169
  export declare const init: (args: { IDL: typeof IDL }) => IDL.Type[];
@@ -1,6 +1,6 @@
1
1
  export const idlFactory = ({ IDL }) => {
2
- const Result_2 = IDL.Variant({ 'ok' : IDL.Text, 'err' : IDL.Text });
3
- const Result_6 = IDL.Variant({ 'ok' : IDL.Vec(IDL.Nat8), 'err' : IDL.Text });
2
+ const Result_3 = IDL.Variant({ 'ok' : IDL.Text, 'err' : IDL.Text });
3
+ const Result_7 = IDL.Variant({ 'ok' : IDL.Vec(IDL.Nat8), 'err' : IDL.Text });
4
4
  const ActorType = IDL.Variant({
5
5
  'agent' : IDL.Null,
6
6
  'systemActor' : IDL.Null,
@@ -45,9 +45,10 @@ export const idlFactory = ({ IDL }) => {
45
45
  'validUntil' : IDL.Opt(IDL.Int),
46
46
  'transactionId' : IDL.Opt(IDL.Text),
47
47
  });
48
- const Result_5 = IDL.Variant({
48
+ const Result_6 = IDL.Variant({
49
49
  'ok' : IDL.Record({
50
50
  'id' : IDL.Nat,
51
+ 'verified' : IDL.Bool,
51
52
  'contentType' : IDL.Text,
52
53
  'fileHash' : IDL.Text,
53
54
  'fileName' : IDL.Text,
@@ -60,7 +61,7 @@ export const idlFactory = ({ IDL }) => {
60
61
  }),
61
62
  'err' : IDL.Text,
62
63
  });
63
- const Result_4 = IDL.Variant({
64
+ const Result_5 = IDL.Variant({
64
65
  'ok' : IDL.Record({
65
66
  'uploadedChunks' : IDL.Nat,
66
67
  'totalChunks' : IDL.Nat,
@@ -69,8 +70,8 @@ export const idlFactory = ({ IDL }) => {
69
70
  }),
70
71
  'err' : IDL.Text,
71
72
  });
72
- const Result_3 = IDL.Variant({ 'ok' : IDL.Nat, 'err' : IDL.Text });
73
- const Result_1 = IDL.Variant({
73
+ const Result_4 = IDL.Variant({ 'ok' : IDL.Nat, 'err' : IDL.Text });
74
+ const Result_2 = IDL.Variant({
74
75
  'ok' : IDL.Record({
75
76
  'uploadedChunks' : IDL.Nat,
76
77
  'totalChunks' : IDL.Nat,
@@ -78,10 +79,18 @@ export const idlFactory = ({ IDL }) => {
78
79
  }),
79
80
  'err' : IDL.Text,
80
81
  });
81
- const Result = IDL.Variant({ 'ok' : IDL.Bool, 'err' : IDL.Text });
82
+ const Result_1 = IDL.Variant({ 'ok' : IDL.Bool, 'err' : IDL.Text });
83
+ const Result = IDL.Variant({
84
+ 'ok' : IDL.Record({
85
+ 'matches' : IDL.Bool,
86
+ 'computedHash' : IDL.Text,
87
+ 'registeredHash' : IDL.Text,
88
+ }),
89
+ 'err' : IDL.Text,
90
+ });
82
91
  return IDL.Service({
83
- 'deleteDocument' : IDL.Func([IDL.Nat, IDL.Text], [Result_2], []),
84
- 'downloadDocumentChunk' : IDL.Func([IDL.Nat, IDL.Nat], [Result_6], []),
92
+ 'deleteDocument' : IDL.Func([IDL.Nat, IDL.Text], [Result_3], []),
93
+ 'downloadDocumentChunk' : IDL.Func([IDL.Nat, IDL.Nat], [Result_7], []),
85
94
  'generateCSRFToken' : IDL.Func([], [IDL.Text], []),
86
95
  'getAuditLogs' : IDL.Func([IDL.Nat], [IDL.Vec(AuditLog)], ['query']),
87
96
  'getCSRFToken' : IDL.Func([], [IDL.Opt(IDL.Text)], ['query']),
@@ -91,13 +100,13 @@ export const idlFactory = ({ IDL }) => {
91
100
  [IDL.Opt(DocumentProof)],
92
101
  ['query'],
93
102
  ),
94
- 'getDocumentMetadata' : IDL.Func([IDL.Nat], [Result_5], ['query']),
103
+ 'getDocumentMetadata' : IDL.Func([IDL.Nat], [Result_6], ['query']),
95
104
  'getDocumentProof' : IDL.Func(
96
105
  [IDL.Nat],
97
106
  [IDL.Opt(DocumentProof)],
98
107
  ['query'],
99
108
  ),
100
- 'getDocumentUploadStatus' : IDL.Func([IDL.Nat], [Result_4], ['query']),
109
+ 'getDocumentUploadStatus' : IDL.Func([IDL.Nat], [Result_5], ['query']),
101
110
  'getDocumentVerificationCanister' : IDL.Func(
102
111
  [],
103
112
  [IDL.Opt(IDL.Principal)],
@@ -156,7 +165,7 @@ export const idlFactory = ({ IDL }) => {
156
165
  [IDL.Opt(IDL.Principal)],
157
166
  ['query'],
158
167
  ),
159
- 'markDocumentDeleted' : IDL.Func([IDL.Nat, IDL.Text], [Result_2], []),
168
+ 'markDocumentDeleted' : IDL.Func([IDL.Nat, IDL.Text], [Result_3], []),
160
169
  'recordAuditEntry' : IDL.Func(
161
170
  [
162
171
  ActorType,
@@ -166,7 +175,7 @@ export const idlFactory = ({ IDL }) => {
166
175
  IDL.Bool,
167
176
  IDL.Text,
168
177
  ],
169
- [Result_3],
178
+ [Result_4],
170
179
  [],
171
180
  ),
172
181
  'registerDocumentProof' : IDL.Func(
@@ -180,7 +189,7 @@ export const idlFactory = ({ IDL }) => {
180
189
  IDL.Text,
181
190
  IDL.Text,
182
191
  ],
183
- [Result_3],
192
+ [Result_4],
184
193
  [],
185
194
  ),
186
195
  'registerLandRegistryDocument' : IDL.Func(
@@ -195,36 +204,37 @@ export const idlFactory = ({ IDL }) => {
195
204
  IDL.Opt(IDL.Int),
196
205
  IDL.Nat,
197
206
  ],
198
- [Result_3],
207
+ [Result_4],
199
208
  [],
200
209
  ),
201
210
  'setDocumentVerificationCanister' : IDL.Func(
202
211
  [IDL.Principal],
203
- [Result_2],
212
+ [Result_3],
204
213
  [],
205
214
  ),
206
- 'setLandRegistryCanister' : IDL.Func([IDL.Principal], [Result_2], []),
215
+ 'setLandRegistryCanister' : IDL.Func([IDL.Principal], [Result_3], []),
207
216
  'setTransactionManagerCanister' : IDL.Func(
208
217
  [IDL.Principal, IDL.Text],
209
- [Result_2],
218
+ [Result_3],
210
219
  [],
211
220
  ),
212
221
  'setUserManagementCanister' : IDL.Func(
213
222
  [IDL.Principal, IDL.Text],
214
- [Result_2],
223
+ [Result_3],
215
224
  [],
216
225
  ),
217
226
  'uploadDocumentChunk' : IDL.Func(
218
227
  [IDL.Nat, IDL.Nat, IDL.Vec(IDL.Nat8), IDL.Text],
219
- [Result_1],
228
+ [Result_2],
220
229
  [],
221
230
  ),
222
231
  'validateCSRFToken' : IDL.Func([IDL.Text], [IDL.Bool], []),
223
232
  'verifyDocumentHash' : IDL.Func(
224
233
  [IDL.Nat, IDL.Text, IDL.Text],
225
- [Result],
234
+ [Result_1],
226
235
  [],
227
236
  ),
237
+ 'verifyOnChainIntegrity' : IDL.Func([IDL.Nat], [Result], []),
228
238
  });
229
239
  };
230
240
  export const init = ({ IDL }) => { return []; };
@@ -196,6 +196,12 @@ service : {
196
196
  err: text;
197
197
  ok;
198
198
  });
199
+ fetchDocument: (id: nat) -> (opt DocumentMetadata);
200
+ fetchDocumentVerifications: (documentId: nat) -> (vec DocumentVerification);
201
+ fetchPropertyDocuments: (propertyId: nat) -> (vec DocumentMetadata);
202
+ fetchUnverifiedDocuments: (propertyId: nat) -> (vec DocumentMetadata);
203
+ fetchVerification: (verificationId: nat) -> (opt DocumentVerification);
204
+ fetchVerificationsByTransaction: (txId: nat) -> (vec DocumentVerification);
199
205
  getAuditLogs: () -> (vec AuditLog) query;
200
206
  getConfiguration: () ->
201
207
  (record {
@@ -204,12 +210,6 @@ service : {
204
210
  }) query;
205
211
  getCycles: () -> (nat) query;
206
212
  getDocument: (id: nat) -> (opt DocumentMetadata) query;
207
- fetchDocument: (id: nat) -> (opt DocumentMetadata);
208
- fetchDocumentVerifications: (documentId: nat) -> (vec DocumentVerification);
209
- fetchPropertyDocuments: (propertyId: nat) -> (vec DocumentMetadata);
210
- fetchUnverifiedDocuments: (propertyId: nat) -> (vec DocumentMetadata);
211
- fetchVerification: (verificationId: nat) -> (opt DocumentVerification);
212
- fetchVerificationsByTransaction: (txId: nat) -> (vec DocumentVerification);
213
213
  getDocumentVerifications: (documentId: nat) ->
214
214
  (vec DocumentVerification) query;
215
215
  getOscarVerificationDetails: (verificationId: nat) ->