@kynesyslabs/demosdk 2.8.4 → 2.8.5
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.
|
@@ -13,7 +13,7 @@ import { CustomCharges } from "../CustomCharges";
|
|
|
13
13
|
/**
|
|
14
14
|
* IPFS operation type constants
|
|
15
15
|
*/
|
|
16
|
-
export type IPFSOperationType = "IPFS_ADD" | "IPFS_PIN" | "IPFS_UNPIN";
|
|
16
|
+
export type IPFSOperationType = "IPFS_ADD" | "IPFS_PIN" | "IPFS_UNPIN" | "IPFS_EXTEND_PIN";
|
|
17
17
|
/**
|
|
18
18
|
* Payload for IPFS_ADD operation
|
|
19
19
|
*
|
|
@@ -29,6 +29,13 @@ export interface IPFSAddPayload {
|
|
|
29
29
|
filename?: string;
|
|
30
30
|
/** Optional metadata to associate with the pin */
|
|
31
31
|
metadata?: Record<string, unknown>;
|
|
32
|
+
/**
|
|
33
|
+
* Optional pin duration
|
|
34
|
+
* - Preset string: 'permanent' | 'week' | 'month' | 'quarter' | 'year'
|
|
35
|
+
* - Custom number: duration in seconds (min 1 day, max 10 years)
|
|
36
|
+
* - undefined or 'permanent': pin never expires
|
|
37
|
+
*/
|
|
38
|
+
duration?: "permanent" | "week" | "month" | "quarter" | "year" | number;
|
|
32
39
|
/** Optional custom charges configuration (from ipfsQuote) */
|
|
33
40
|
custom_charges?: CustomCharges;
|
|
34
41
|
}
|
|
@@ -43,8 +50,13 @@ export interface IPFSPinPayload {
|
|
|
43
50
|
operation: "IPFS_PIN";
|
|
44
51
|
/** Content Identifier to pin */
|
|
45
52
|
cid: string;
|
|
46
|
-
/**
|
|
47
|
-
|
|
53
|
+
/**
|
|
54
|
+
* Optional pin duration
|
|
55
|
+
* - Preset string: 'permanent' | 'week' | 'month' | 'quarter' | 'year'
|
|
56
|
+
* - Custom number: duration in seconds (min 1 day, max 10 years)
|
|
57
|
+
* - undefined or 'permanent': pin never expires
|
|
58
|
+
*/
|
|
59
|
+
duration?: "permanent" | "week" | "month" | "quarter" | "year" | number;
|
|
48
60
|
/** Optional metadata to associate with the pin */
|
|
49
61
|
metadata?: Record<string, unknown>;
|
|
50
62
|
/** Optional custom charges configuration (from ipfsQuote) */
|
|
@@ -62,10 +74,31 @@ export interface IPFSUnpinPayload {
|
|
|
62
74
|
/** Content Identifier to unpin */
|
|
63
75
|
cid: string;
|
|
64
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* Payload for IPFS_EXTEND_PIN operation
|
|
79
|
+
*
|
|
80
|
+
* Extends the expiration time of an existing pin.
|
|
81
|
+
* User pays additional cost based on the extension duration.
|
|
82
|
+
*/
|
|
83
|
+
export interface IPFSExtendPinPayload {
|
|
84
|
+
/** The IPFS operation type */
|
|
85
|
+
operation: "IPFS_EXTEND_PIN";
|
|
86
|
+
/** Content Identifier of the pin to extend */
|
|
87
|
+
cid: string;
|
|
88
|
+
/**
|
|
89
|
+
* Additional duration to add
|
|
90
|
+
* - Preset string: 'week' | 'month' | 'quarter' | 'year'
|
|
91
|
+
* - Custom number: additional duration in seconds (min 1 day, max 10 years)
|
|
92
|
+
* Note: 'permanent' converts the pin to never expire
|
|
93
|
+
*/
|
|
94
|
+
additionalDuration: "permanent" | "week" | "month" | "quarter" | "year" | number;
|
|
95
|
+
/** Optional custom charges configuration (from ipfsQuote) */
|
|
96
|
+
custom_charges?: CustomCharges;
|
|
97
|
+
}
|
|
65
98
|
/**
|
|
66
99
|
* Union type for all IPFS payloads
|
|
67
100
|
*/
|
|
68
|
-
export type IPFSPayload = IPFSAddPayload | IPFSPinPayload | IPFSUnpinPayload;
|
|
101
|
+
export type IPFSPayload = IPFSAddPayload | IPFSPinPayload | IPFSUnpinPayload | IPFSExtendPinPayload;
|
|
69
102
|
/**
|
|
70
103
|
* Transaction content type for IPFS operations
|
|
71
104
|
*/
|
|
@@ -91,6 +124,10 @@ export declare function isIPFSPinPayload(payload: IPFSPayload): payload is IPFSP
|
|
|
91
124
|
* Check if a payload is an IPFS_UNPIN operation
|
|
92
125
|
*/
|
|
93
126
|
export declare function isIPFSUnpinPayload(payload: IPFSPayload): payload is IPFSUnpinPayload;
|
|
127
|
+
/**
|
|
128
|
+
* Check if a payload is an IPFS_EXTEND_PIN operation
|
|
129
|
+
*/
|
|
130
|
+
export declare function isIPFSExtendPinPayload(payload: IPFSPayload): payload is IPFSExtendPinPayload;
|
|
94
131
|
/**
|
|
95
132
|
* Check if any payload is an IPFS payload
|
|
96
133
|
*/
|
|
@@ -13,6 +13,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
13
13
|
exports.isIPFSAddPayload = isIPFSAddPayload;
|
|
14
14
|
exports.isIPFSPinPayload = isIPFSPinPayload;
|
|
15
15
|
exports.isIPFSUnpinPayload = isIPFSUnpinPayload;
|
|
16
|
+
exports.isIPFSExtendPinPayload = isIPFSExtendPinPayload;
|
|
16
17
|
exports.isIPFSPayload = isIPFSPayload;
|
|
17
18
|
// ============================================================================
|
|
18
19
|
// Type Guards
|
|
@@ -35,6 +36,13 @@ function isIPFSPinPayload(payload) {
|
|
|
35
36
|
function isIPFSUnpinPayload(payload) {
|
|
36
37
|
return payload.operation === "IPFS_UNPIN";
|
|
37
38
|
}
|
|
39
|
+
// REVIEW: DEM-481 - Pin extension type guard
|
|
40
|
+
/**
|
|
41
|
+
* Check if a payload is an IPFS_EXTEND_PIN operation
|
|
42
|
+
*/
|
|
43
|
+
function isIPFSExtendPinPayload(payload) {
|
|
44
|
+
return payload.operation === "IPFS_EXTEND_PIN";
|
|
45
|
+
}
|
|
38
46
|
/**
|
|
39
47
|
* Check if any payload is an IPFS payload
|
|
40
48
|
*/
|
|
@@ -44,6 +52,7 @@ function isIPFSPayload(payload) {
|
|
|
44
52
|
const p = payload;
|
|
45
53
|
return (p.operation === "IPFS_ADD" ||
|
|
46
54
|
p.operation === "IPFS_PIN" ||
|
|
47
|
-
p.operation === "IPFS_UNPIN"
|
|
55
|
+
p.operation === "IPFS_UNPIN" ||
|
|
56
|
+
p.operation === "IPFS_EXTEND_PIN");
|
|
48
57
|
}
|
|
49
58
|
//# sourceMappingURL=IPFSTransaction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IPFSTransaction.js","sourceRoot":"","sources":["../../../../../src/types/blockchain/TransactionSubtypes/IPFSTransaction.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;
|
|
1
|
+
{"version":3,"file":"IPFSTransaction.js","sourceRoot":"","sources":["../../../../../src/types/blockchain/TransactionSubtypes/IPFSTransaction.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;AAyJH,4CAEC;AAKD,4CAEC;AAKD,gDAEC;AAMD,wDAEC;AAKD,sCASC;AA7CD,+EAA+E;AAC/E,cAAc;AACd,+EAA+E;AAE/E;;GAEG;AACH,SAAgB,gBAAgB,CAAC,OAAoB;IACjD,OAAO,OAAO,CAAC,SAAS,KAAK,UAAU,CAAA;AAC3C,CAAC;AAED;;GAEG;AACH,SAAgB,gBAAgB,CAAC,OAAoB;IACjD,OAAO,OAAO,CAAC,SAAS,KAAK,UAAU,CAAA;AAC3C,CAAC;AAED;;GAEG;AACH,SAAgB,kBAAkB,CAAC,OAAoB;IACnD,OAAO,OAAO,CAAC,SAAS,KAAK,YAAY,CAAA;AAC7C,CAAC;AAED,6CAA6C;AAC7C;;GAEG;AACH,SAAgB,sBAAsB,CAAC,OAAoB;IACvD,OAAO,OAAO,CAAC,SAAS,KAAK,iBAAiB,CAAA;AAClD,CAAC;AAED;;GAEG;AACH,SAAgB,aAAa,CAAC,OAAgB;IAC1C,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAA;IACzD,MAAM,CAAC,GAAG,OAAkC,CAAA;IAC5C,OAAO,CACH,CAAC,CAAC,SAAS,KAAK,UAAU;QAC1B,CAAC,CAAC,SAAS,KAAK,UAAU;QAC1B,CAAC,CAAC,SAAS,KAAK,YAAY;QAC5B,CAAC,CAAC,SAAS,KAAK,iBAAiB,CACpC,CAAA;AACL,CAAC"}
|
package/package.json
CHANGED