@palindromepay/sdk 1.9.4

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.
package/dist/index.js ADDED
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./types/escrow"), exports);
18
+ __exportStar(require("./PalindromeEscrowSDK"), exports);
@@ -0,0 +1,21 @@
1
+ /**
2
+ * ESCROW QUERIES
3
+ */
4
+ export declare const ALL_ESCROWS_QUERY: import("graphql/language/ast").DocumentNode;
5
+ export declare const ESCROWS_BY_BUYER_QUERY: import("graphql/language/ast").DocumentNode;
6
+ export declare const ESCROWS_BY_SELLER_QUERY: import("graphql/language/ast").DocumentNode;
7
+ export declare const ESCROW_DETAIL_QUERY: import("graphql/language/ast").DocumentNode;
8
+ /**
9
+ * DISPUTE QUERIES
10
+ */
11
+ export declare const DISPUTE_MESSAGES_BY_ESCROW_QUERY: import("graphql/language/ast").DocumentNode;
12
+ export declare const ALL_DISPUTED_ESCROWS_QUERY: import("graphql/language/ast").DocumentNode;
13
+ export declare const ESCROW_WITH_DISPUTE_DETAILS_QUERY: import("graphql/language/ast").DocumentNode;
14
+ export declare const DISPUTED_ESCROWS_BY_BUYER_QUERY: import("graphql/language/ast").DocumentNode;
15
+ export declare const DISPUTED_ESCROWS_BY_SELLER_QUERY: import("graphql/language/ast").DocumentNode;
16
+ export declare const ESCROWS_PENDING_ARBITER_REVIEW_QUERY: import("graphql/language/ast").DocumentNode;
17
+ export declare const DISPUTE_MESSAGES_BY_ROLE_QUERY: import("graphql/language/ast").DocumentNode;
18
+ export declare const RECENT_DISPUTE_ACTIVITY_QUERY: import("graphql/language/ast").DocumentNode;
19
+ export declare const HAS_SUBMITTED_EVIDENCE_QUERY: import("graphql/language/ast").DocumentNode;
20
+ export declare const DISPUTE_SUBMISSION_STATUS_QUERY: import("graphql/language/ast").DocumentNode;
21
+ export declare const DISPUTED_ESCROW_EVENTS_QUERY: import("graphql/language/ast").DocumentNode;
@@ -0,0 +1,466 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DISPUTED_ESCROW_EVENTS_QUERY = exports.DISPUTE_SUBMISSION_STATUS_QUERY = exports.HAS_SUBMITTED_EVIDENCE_QUERY = exports.RECENT_DISPUTE_ACTIVITY_QUERY = exports.DISPUTE_MESSAGES_BY_ROLE_QUERY = exports.ESCROWS_PENDING_ARBITER_REVIEW_QUERY = exports.DISPUTED_ESCROWS_BY_SELLER_QUERY = exports.DISPUTED_ESCROWS_BY_BUYER_QUERY = exports.ESCROW_WITH_DISPUTE_DETAILS_QUERY = exports.ALL_DISPUTED_ESCROWS_QUERY = exports.DISPUTE_MESSAGES_BY_ESCROW_QUERY = exports.ESCROW_DETAIL_QUERY = exports.ESCROWS_BY_SELLER_QUERY = exports.ESCROWS_BY_BUYER_QUERY = exports.ALL_ESCROWS_QUERY = void 0;
4
+ const core_1 = require("@apollo/client/core");
5
+ /**
6
+ * ESCROW QUERIES
7
+ */
8
+ // Get all escrows (with dispute info)
9
+ exports.ALL_ESCROWS_QUERY = (0, core_1.gql) `
10
+ query AllEscrows {
11
+ escrows {
12
+ id
13
+ txUrl
14
+ token
15
+ buyer
16
+ seller
17
+ arbiter
18
+ wallet
19
+ amount
20
+ maturityTime
21
+ depositTime
22
+ state
23
+ title
24
+ ipfsHash
25
+ sellerWalletSig
26
+ buyerWalletSig
27
+ arbiterWalletSig
28
+ sellerAccepted
29
+ createdAt
30
+ updatedAt
31
+ buyerCancelRequested
32
+ sellerCancelRequested
33
+ fee
34
+ disputeStartTime
35
+ disputeLongDeadline
36
+ disputeStatus
37
+ disputeMessages {
38
+ id
39
+ role
40
+ roleValue
41
+ sender
42
+ ipfsHash
43
+ timestamp
44
+ txHash
45
+ }
46
+ }
47
+ }
48
+ `;
49
+ // Get escrows by buyer (with dispute info)
50
+ exports.ESCROWS_BY_BUYER_QUERY = (0, core_1.gql) `
51
+ query EscrowsByBuyer($buyer: Bytes!) {
52
+ escrows(where: { buyer: $buyer }) {
53
+ id
54
+ txUrl
55
+ token
56
+ arbiter
57
+ buyer
58
+ seller
59
+ wallet
60
+ amount
61
+ maturityTime
62
+ depositTime
63
+ state
64
+ title
65
+ ipfsHash
66
+ sellerWalletSig
67
+ buyerWalletSig
68
+ arbiterWalletSig
69
+ sellerAccepted
70
+ createdAt
71
+ updatedAt
72
+ buyerCancelRequested
73
+ sellerCancelRequested
74
+ fee
75
+ disputeStartTime
76
+ disputeLongDeadline
77
+ disputeStatus
78
+ disputeMessages {
79
+ id
80
+ role
81
+ roleValue
82
+ sender
83
+ ipfsHash
84
+ timestamp
85
+ txHash
86
+ }
87
+ }
88
+ }
89
+ `;
90
+ // Get escrows by seller (with dispute info)
91
+ exports.ESCROWS_BY_SELLER_QUERY = (0, core_1.gql) `
92
+ query EscrowsBySeller($seller: Bytes!) {
93
+ escrows(where: { seller: $seller }) {
94
+ id
95
+ txUrl
96
+ token
97
+ arbiter
98
+ buyer
99
+ seller
100
+ wallet
101
+ amount
102
+ maturityTime
103
+ depositTime
104
+ state
105
+ title
106
+ ipfsHash
107
+ sellerWalletSig
108
+ buyerWalletSig
109
+ arbiterWalletSig
110
+ sellerAccepted
111
+ createdAt
112
+ updatedAt
113
+ buyerCancelRequested
114
+ sellerCancelRequested
115
+ fee
116
+ disputeStartTime
117
+ disputeLongDeadline
118
+ disputeStatus
119
+ disputeMessages {
120
+ id
121
+ role
122
+ roleValue
123
+ sender
124
+ ipfsHash
125
+ timestamp
126
+ txHash
127
+ }
128
+ }
129
+ }
130
+ `;
131
+ // Detail for one escrow (with full dispute info and events)
132
+ exports.ESCROW_DETAIL_QUERY = (0, core_1.gql) `
133
+ query EscrowDetail($id: ID!) {
134
+ escrow(id: $id) {
135
+ id
136
+ txUrl
137
+ token
138
+ buyer
139
+ seller
140
+ arbiter
141
+ wallet
142
+ amount
143
+ maturityTime
144
+ depositTime
145
+ state
146
+ title
147
+ ipfsHash
148
+ sellerWalletSig
149
+ buyerWalletSig
150
+ arbiterWalletSig
151
+ sellerAccepted
152
+ createdAt
153
+ updatedAt
154
+ buyerCancelRequested
155
+ sellerCancelRequested
156
+ fee
157
+ disputeStartTime
158
+ disputeLongDeadline
159
+ disputeStatus
160
+ disputeMessages {
161
+ id
162
+ role
163
+ roleValue
164
+ sender
165
+ ipfsHash
166
+ timestamp
167
+ txHash
168
+ }
169
+ events {
170
+ id
171
+ type
172
+ sender
173
+ amount
174
+ fee
175
+ state
176
+ timestamp
177
+ details
178
+ }
179
+ }
180
+ }
181
+ `;
182
+ /**
183
+ * DISPUTE QUERIES
184
+ */
185
+ // Get all dispute messages for a specific escrow
186
+ exports.DISPUTE_MESSAGES_BY_ESCROW_QUERY = (0, core_1.gql) `
187
+ query DisputeMessagesByEscrow($escrowId: ID!) {
188
+ escrow(id: $escrowId) {
189
+ id
190
+ disputeMessages {
191
+ id
192
+ role
193
+ roleValue
194
+ sender
195
+ ipfsHash
196
+ timestamp
197
+ txHash
198
+ }
199
+ }
200
+ }
201
+ `;
202
+ // Get all disputed escrows with their messages
203
+ exports.ALL_DISPUTED_ESCROWS_QUERY = (0, core_1.gql) `
204
+ query AllDisputedEscrows {
205
+ escrows(where: { state: "DISPUTED" }) {
206
+ id
207
+ txUrl
208
+ token
209
+ arbiter
210
+ buyer
211
+ seller
212
+ wallet
213
+ amount
214
+ depositTime
215
+ state
216
+ title
217
+ ipfsHash
218
+ sellerWalletSig
219
+ buyerWalletSig
220
+ arbiterWalletSig
221
+ sellerAccepted
222
+ createdAt
223
+ updatedAt
224
+ fee
225
+ disputeStartTime
226
+ disputeLongDeadline
227
+ disputeStatus
228
+ disputeMessages {
229
+ id
230
+ role
231
+ roleValue
232
+ sender
233
+ ipfsHash
234
+ timestamp
235
+ txHash
236
+ }
237
+ }
238
+ }
239
+ `;
240
+ // Get escrow with full dispute details
241
+ exports.ESCROW_WITH_DISPUTE_DETAILS_QUERY = (0, core_1.gql) `
242
+ query EscrowWithDisputeDetails($escrowId: ID!) {
243
+ escrow(id: $escrowId) {
244
+ id
245
+ txUrl
246
+ token
247
+ arbiter
248
+ buyer
249
+ seller
250
+ wallet
251
+ amount
252
+ depositTime
253
+ state
254
+ title
255
+ ipfsHash
256
+ sellerWalletSig
257
+ buyerWalletSig
258
+ arbiterWalletSig
259
+ sellerAccepted
260
+ createdAt
261
+ updatedAt
262
+ buyerCancelRequested
263
+ sellerCancelRequested
264
+ fee
265
+ disputeStartTime
266
+ disputeLongDeadline
267
+ disputeStatus
268
+ disputeMessages {
269
+ id
270
+ role
271
+ roleValue
272
+ sender
273
+ ipfsHash
274
+ timestamp
275
+ txHash
276
+ }
277
+ events(orderBy: timestamp, orderDirection: desc) {
278
+ id
279
+ type
280
+ sender
281
+ amount
282
+ fee
283
+ state
284
+ timestamp
285
+ details
286
+ }
287
+ }
288
+ }
289
+ `;
290
+ // Get disputed escrows by buyer
291
+ exports.DISPUTED_ESCROWS_BY_BUYER_QUERY = (0, core_1.gql) `
292
+ query DisputedEscrowsByBuyer($buyer: Bytes!) {
293
+ escrows(where: { buyer: $buyer, state: "DISPUTED" }) {
294
+ id
295
+ txUrl
296
+ seller
297
+ arbiter
298
+ wallet
299
+ amount
300
+ title
301
+ ipfsHash
302
+ createdAt
303
+ fee
304
+ disputeStartTime
305
+ disputeLongDeadline
306
+ disputeStatus
307
+ disputeMessages {
308
+ id
309
+ role
310
+ roleValue
311
+ sender
312
+ ipfsHash
313
+ timestamp
314
+ txHash
315
+ }
316
+ }
317
+ }
318
+ `;
319
+ exports.DISPUTED_ESCROWS_BY_SELLER_QUERY = (0, core_1.gql) `
320
+ query DisputedEscrowsBySeller($seller: Bytes!) {
321
+ escrows(where: { seller: $seller, state: "DISPUTED" }) {
322
+ id
323
+ txUrl
324
+ buyer
325
+ arbiter
326
+ wallet
327
+ amount
328
+ title
329
+ ipfsHash
330
+ createdAt
331
+ fee
332
+ disputeStartTime
333
+ disputeLongDeadline
334
+ disputeStatus
335
+ disputeMessages {
336
+ id
337
+ role
338
+ roleValue
339
+ sender
340
+ ipfsHash
341
+ timestamp
342
+ txHash
343
+ }
344
+ }
345
+ }
346
+ `;
347
+ // Get escrows pending arbiter review (in dispute, not all messages submitted)
348
+ exports.ESCROWS_PENDING_ARBITER_REVIEW_QUERY = (0, core_1.gql) `
349
+ query EscrowsPendingArbiterReview($arbiter: Bytes!) {
350
+ escrows(where: { arbiter: $arbiter, state: "DISPUTED" }) {
351
+ id
352
+ txUrl
353
+ buyer
354
+ seller
355
+ wallet
356
+ amount
357
+ title
358
+ ipfsHash
359
+ createdAt
360
+ fee
361
+ disputeStartTime
362
+ disputeLongDeadline
363
+ disputeStatus
364
+ disputeMessages {
365
+ id
366
+ role
367
+ roleValue
368
+ sender
369
+ ipfsHash
370
+ timestamp
371
+ txHash
372
+ }
373
+ }
374
+ }
375
+ `;
376
+ // Get all dispute messages by role
377
+ exports.DISPUTE_MESSAGES_BY_ROLE_QUERY = (0, core_1.gql) `
378
+ query DisputeMessagesByRole($escrowId: ID!, $role: String!) {
379
+ disputeMessages(where: { escrow: $escrowId, role: $role }) {
380
+ id
381
+ role
382
+ roleValue
383
+ sender
384
+ ipfsHash
385
+ timestamp
386
+ txHash
387
+ }
388
+ }
389
+ `;
390
+ // Get recent dispute activity (last 10)
391
+ exports.RECENT_DISPUTE_ACTIVITY_QUERY = (0, core_1.gql) `
392
+ query RecentDisputeActivity {
393
+ disputeMessages(
394
+ first: 10
395
+ orderBy: timestamp
396
+ orderDirection: desc
397
+ ) {
398
+ id
399
+ escrow {
400
+ id
401
+ buyer
402
+ seller
403
+ amount
404
+ title
405
+ }
406
+ role
407
+ roleValue
408
+ sender
409
+ ipfsHash
410
+ timestamp
411
+ txHash
412
+ }
413
+ }
414
+ `;
415
+ // Check if specific address has submitted evidence for escrow
416
+ exports.HAS_SUBMITTED_EVIDENCE_QUERY = (0, core_1.gql) `
417
+ query HasSubmittedEvidence($escrowId: ID!, $sender: Bytes!) {
418
+ disputeMessages(where: { escrow: $escrowId, sender: $sender }) {
419
+ id
420
+ role
421
+ roleValue
422
+ timestamp
423
+ txHash
424
+ }
425
+ }
426
+ `;
427
+ // Get dispute submission status (check bits)
428
+ exports.DISPUTE_SUBMISSION_STATUS_QUERY = (0, core_1.gql) `
429
+ query DisputeSubmissionStatus($escrowId: ID!) {
430
+ escrow(id: $escrowId) {
431
+ id
432
+ disputeStatus
433
+ disputeStartTime
434
+ disputeLongDeadline
435
+ disputeMessages {
436
+ id
437
+ role
438
+ roleValue
439
+ sender
440
+ timestamp
441
+ }
442
+ }
443
+ }
444
+ `;
445
+ // Get all events for a disputed escrow
446
+ exports.DISPUTED_ESCROW_EVENTS_QUERY = (0, core_1.gql) `
447
+ query DisputedEscrowEvents($escrowId: ID!) {
448
+ escrow(id: $escrowId) {
449
+ id
450
+ state
451
+ disputeStatus
452
+ disputeStartTime
453
+ disputeLongDeadline
454
+ events(orderBy: timestamp, orderDirection: asc) {
455
+ id
456
+ type
457
+ sender
458
+ amount
459
+ fee
460
+ state
461
+ timestamp
462
+ details
463
+ }
464
+ }
465
+ }
466
+ `;
@@ -0,0 +1,48 @@
1
+ export interface Escrow {
2
+ id: string;
3
+ txUrl: string;
4
+ buyer: string;
5
+ seller: string;
6
+ arbiter: string;
7
+ token: string;
8
+ wallet: string;
9
+ amount: string;
10
+ depositTime?: string;
11
+ maturityTime?: string;
12
+ state: string;
13
+ title?: string;
14
+ ipfsHash?: string;
15
+ sellerWalletSig?: string;
16
+ buyerWalletSig?: string;
17
+ arbiterWalletSig?: string;
18
+ sellerAccepted: boolean;
19
+ createdAt: string;
20
+ updatedAt?: string;
21
+ buyerCancelRequested?: boolean;
22
+ sellerCancelRequested?: boolean;
23
+ fee?: string;
24
+ disputeStartTime?: string;
25
+ disputeLongDeadline?: string;
26
+ disputeStatus?: number;
27
+ disputeMessages?: DisputeMessage[];
28
+ events?: EscrowEvent[];
29
+ }
30
+ export interface EscrowEvent {
31
+ id: string;
32
+ type: string;
33
+ sender?: string;
34
+ amount?: string;
35
+ fee?: string;
36
+ state: string;
37
+ timestamp: string;
38
+ details?: string;
39
+ }
40
+ export interface DisputeMessage {
41
+ id: string;
42
+ role: string;
43
+ roleValue: number;
44
+ sender: string;
45
+ ipfsHash: string;
46
+ timestamp: string;
47
+ txHash: string;
48
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json ADDED
@@ -0,0 +1,68 @@
1
+ {
2
+ "name": "@palindromepay/sdk",
3
+ "version": "1.9.4",
4
+ "description": "TypeScript SDK for PalindromeCryptoEscrow - Secure blockchain escrow with buyer/seller protection",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "scripts": {
8
+ "build": "tsc",
9
+ "test": "ts-node tests/testCore.ts && ts-node tests/testSecurity.ts",
10
+ "test:core": "ts-node tests/testCore.ts",
11
+ "test:security": "ts-node tests/testSecurity.ts",
12
+ "prepublishOnly": "npm test && npm run build",
13
+ "version": "npm run build",
14
+ "clean": "rm -rf dist"
15
+ },
16
+ "keywords": [
17
+ "escrow",
18
+ "crypto",
19
+ "ethereum",
20
+ "blockchain",
21
+ "smart-contract",
22
+ "payment",
23
+ "web3",
24
+ "typescript",
25
+ "viem"
26
+ ],
27
+ "author": "Palindrome Finance",
28
+ "license": "MIT",
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "https://github.com/palindrome-finance/escrow-sdk.git"
32
+ },
33
+ "bugs": {
34
+ "url": "https://github.com/palindrome-finance/escrow-sdk/issues"
35
+ },
36
+ "homepage": "https://github.com/palindrome-finance/escrow-sdk#readme",
37
+ "files": [
38
+ "dist",
39
+ "README.md",
40
+ "LICENSE"
41
+ ],
42
+ "type": "commonjs",
43
+ "dependencies": {
44
+ "@babel/generator": "^7.28.3",
45
+ "@babel/parser": "^7.28.4",
46
+ "@babel/template": "^7.27.2",
47
+ "@babel/traverse": "^7.28.4",
48
+ "@babel/types": "^7.28.4",
49
+ "csstype": "^3.1.3",
50
+ "expect": "^30.2.0",
51
+ "graphql": "^16.11.0",
52
+ "pretty-format": "^30.2.0",
53
+ "react": "^19.2.0",
54
+ "react-window": "^1.8.7",
55
+ "undici-types": "^7.16.0",
56
+ "viem": "^2.38.0"
57
+ },
58
+ "devDependencies": {
59
+ "@apollo/client": "^4.0.7",
60
+ "@types/jest": "^30.0.0",
61
+ "@types/node": "^24.7.0",
62
+ "@types/react": "^19.2.2",
63
+ "jest": "^30.2.0",
64
+ "ts-jest": "^29.4.4",
65
+ "ts-node": "^10.9.2",
66
+ "typescript": "^5.9.3"
67
+ }
68
+ }