@kynesyslabs/demosdk 2.5.13 → 2.6.0
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/build/types/blockchain/Transaction.d.ts +3 -2
- package/build/types/blockchain/Transaction.js.map +1 -1
- package/build/types/blockchain/TransactionSubtypes/IPFSTransaction.d.ts +92 -0
- package/build/types/blockchain/TransactionSubtypes/IPFSTransaction.js +49 -0
- package/build/types/blockchain/TransactionSubtypes/IPFSTransaction.js.map +1 -0
- package/build/types/blockchain/TransactionSubtypes/index.d.ts +3 -1
- package/build/types/blockchain/TransactionSubtypes/index.js +1 -0
- package/build/types/blockchain/TransactionSubtypes/index.js.map +1 -1
- package/build/types/index.d.ts +1 -1
- package/build/types/index.js +7 -1
- package/build/types/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -16,9 +16,10 @@ import { ContractDeployPayload } from "./TransactionSubtypes/ContractDeployTrans
|
|
|
16
16
|
import { ContractCallPayload } from "./TransactionSubtypes/ContractCallTransaction";
|
|
17
17
|
import { D402PaymentPayload } from "./TransactionSubtypes/D402PaymentTransaction";
|
|
18
18
|
import { EscrowPayload } from "./TransactionSubtypes/EscrowTransaction";
|
|
19
|
-
|
|
19
|
+
import { IPFSPayload } from "./TransactionSubtypes/IPFSTransaction";
|
|
20
|
+
export type TransactionContentData = ["web2Request", IWeb2Payload] | ["crosschainOperation", XMScript] | ["native", INativePayload] | ["demoswork", DemoScript] | ["l2psEncryptedTx", L2PSEncryptedPayload] | ["identity", IdentityPayload] | ["instantMessaging", InstantMessagingPayload] | ["nativeBridge", NativeBridgeTxPayload] | ["storage", StoragePayload] | ["storageProgram", StorageProgramPayload] | ["l2ps_hash_update", L2PSHashPayload] | ["contractDeploy", ContractDeployPayload] | ["contractCall", ContractCallPayload] | ["d402_payment", D402PaymentPayload] | ["escrow", EscrowPayload] | ["ipfs", IPFSPayload];
|
|
20
21
|
export interface TransactionContent {
|
|
21
|
-
type: "web2Request" | "crosschainOperation" | "subnet" | "native" | "demoswork" | "genesis" | "NODE_ONLINE" | "identity" | "instantMessaging" | "nativeBridge" | "l2psEncryptedTx" | "storage" | "storageProgram" | "l2ps_hash_update" | "contractDeploy" | "contractCall" | "d402_payment" | "escrow";
|
|
22
|
+
type: "web2Request" | "crosschainOperation" | "subnet" | "native" | "demoswork" | "genesis" | "NODE_ONLINE" | "identity" | "instantMessaging" | "nativeBridge" | "l2psEncryptedTx" | "storage" | "storageProgram" | "l2ps_hash_update" | "contractDeploy" | "contractCall" | "d402_payment" | "escrow" | "ipfs";
|
|
22
23
|
from: string;
|
|
23
24
|
from_ed25519_address: string;
|
|
24
25
|
to: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Transaction.js","sourceRoot":"","sources":["../../../../src/types/blockchain/Transaction.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"Transaction.js","sourceRoot":"","sources":["../../../../src/types/blockchain/Transaction.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAiGA,uCAAuC;AACvC,wDAAqC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IPFS Transaction Types
|
|
3
|
+
*
|
|
4
|
+
* Defines transaction types for IPFS operations on the Demos Network.
|
|
5
|
+
* - IPFS_ADD: Upload content and auto-pin
|
|
6
|
+
* - IPFS_PIN: Pin existing CID
|
|
7
|
+
* - IPFS_UNPIN: Remove pin from account
|
|
8
|
+
*
|
|
9
|
+
* @fileoverview IPFS transaction type definitions for SDK
|
|
10
|
+
*/
|
|
11
|
+
import { Transaction, TransactionContent } from "../Transaction";
|
|
12
|
+
/**
|
|
13
|
+
* IPFS operation type constants
|
|
14
|
+
*/
|
|
15
|
+
export type IPFSOperationType = "IPFS_ADD" | "IPFS_PIN" | "IPFS_UNPIN";
|
|
16
|
+
/**
|
|
17
|
+
* Payload for IPFS_ADD operation
|
|
18
|
+
*
|
|
19
|
+
* Uploads content to IPFS and automatically pins it to the sender's account.
|
|
20
|
+
* Content is base64 encoded for JSON compatibility.
|
|
21
|
+
*/
|
|
22
|
+
export interface IPFSAddPayload {
|
|
23
|
+
/** The IPFS operation type */
|
|
24
|
+
operation: "IPFS_ADD";
|
|
25
|
+
/** Base64-encoded content to upload */
|
|
26
|
+
content: string;
|
|
27
|
+
/** Optional filename for the content */
|
|
28
|
+
filename?: string;
|
|
29
|
+
/** Optional metadata to associate with the pin */
|
|
30
|
+
metadata?: Record<string, unknown>;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Payload for IPFS_PIN operation
|
|
34
|
+
*
|
|
35
|
+
* Pins an existing CID to the sender's account.
|
|
36
|
+
* Used when content already exists on IPFS and user wants to ensure availability.
|
|
37
|
+
*/
|
|
38
|
+
export interface IPFSPinPayload {
|
|
39
|
+
/** The IPFS operation type */
|
|
40
|
+
operation: "IPFS_PIN";
|
|
41
|
+
/** Content Identifier to pin */
|
|
42
|
+
cid: string;
|
|
43
|
+
/** Optional duration in blocks (0 = indefinite) */
|
|
44
|
+
duration?: number;
|
|
45
|
+
/** Optional metadata to associate with the pin */
|
|
46
|
+
metadata?: Record<string, unknown>;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Payload for IPFS_UNPIN operation
|
|
50
|
+
*
|
|
51
|
+
* Removes a pin from the sender's account.
|
|
52
|
+
* Content may still exist on IPFS but sender no longer pays for hosting.
|
|
53
|
+
*/
|
|
54
|
+
export interface IPFSUnpinPayload {
|
|
55
|
+
/** The IPFS operation type */
|
|
56
|
+
operation: "IPFS_UNPIN";
|
|
57
|
+
/** Content Identifier to unpin */
|
|
58
|
+
cid: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Union type for all IPFS payloads
|
|
62
|
+
*/
|
|
63
|
+
export type IPFSPayload = IPFSAddPayload | IPFSPinPayload | IPFSUnpinPayload;
|
|
64
|
+
/**
|
|
65
|
+
* Transaction content type for IPFS operations
|
|
66
|
+
*/
|
|
67
|
+
export type IPFSTransactionContent = Omit<TransactionContent, "type" | "data"> & {
|
|
68
|
+
type: "ipfs";
|
|
69
|
+
data: ["ipfs", IPFSPayload];
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Complete IPFS transaction interface
|
|
73
|
+
*/
|
|
74
|
+
export interface IPFSTransaction extends Omit<Transaction, "content"> {
|
|
75
|
+
content: IPFSTransactionContent;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Check if a payload is an IPFS_ADD operation
|
|
79
|
+
*/
|
|
80
|
+
export declare function isIPFSAddPayload(payload: IPFSPayload): payload is IPFSAddPayload;
|
|
81
|
+
/**
|
|
82
|
+
* Check if a payload is an IPFS_PIN operation
|
|
83
|
+
*/
|
|
84
|
+
export declare function isIPFSPinPayload(payload: IPFSPayload): payload is IPFSPinPayload;
|
|
85
|
+
/**
|
|
86
|
+
* Check if a payload is an IPFS_UNPIN operation
|
|
87
|
+
*/
|
|
88
|
+
export declare function isIPFSUnpinPayload(payload: IPFSPayload): payload is IPFSUnpinPayload;
|
|
89
|
+
/**
|
|
90
|
+
* Check if any payload is an IPFS payload
|
|
91
|
+
*/
|
|
92
|
+
export declare function isIPFSPayload(payload: unknown): payload is IPFSPayload;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* IPFS Transaction Types
|
|
4
|
+
*
|
|
5
|
+
* Defines transaction types for IPFS operations on the Demos Network.
|
|
6
|
+
* - IPFS_ADD: Upload content and auto-pin
|
|
7
|
+
* - IPFS_PIN: Pin existing CID
|
|
8
|
+
* - IPFS_UNPIN: Remove pin from account
|
|
9
|
+
*
|
|
10
|
+
* @fileoverview IPFS transaction type definitions for SDK
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.isIPFSAddPayload = isIPFSAddPayload;
|
|
14
|
+
exports.isIPFSPinPayload = isIPFSPinPayload;
|
|
15
|
+
exports.isIPFSUnpinPayload = isIPFSUnpinPayload;
|
|
16
|
+
exports.isIPFSPayload = isIPFSPayload;
|
|
17
|
+
// ============================================================================
|
|
18
|
+
// Type Guards
|
|
19
|
+
// ============================================================================
|
|
20
|
+
/**
|
|
21
|
+
* Check if a payload is an IPFS_ADD operation
|
|
22
|
+
*/
|
|
23
|
+
function isIPFSAddPayload(payload) {
|
|
24
|
+
return payload.operation === "IPFS_ADD";
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Check if a payload is an IPFS_PIN operation
|
|
28
|
+
*/
|
|
29
|
+
function isIPFSPinPayload(payload) {
|
|
30
|
+
return payload.operation === "IPFS_PIN";
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Check if a payload is an IPFS_UNPIN operation
|
|
34
|
+
*/
|
|
35
|
+
function isIPFSUnpinPayload(payload) {
|
|
36
|
+
return payload.operation === "IPFS_UNPIN";
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Check if any payload is an IPFS payload
|
|
40
|
+
*/
|
|
41
|
+
function isIPFSPayload(payload) {
|
|
42
|
+
if (!payload || typeof payload !== "object")
|
|
43
|
+
return false;
|
|
44
|
+
const p = payload;
|
|
45
|
+
return (p.operation === "IPFS_ADD" ||
|
|
46
|
+
p.operation === "IPFS_PIN" ||
|
|
47
|
+
p.operation === "IPFS_UNPIN");
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=IPFSTransaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IPFSTransaction.js","sourceRoot":"","sources":["../../../../../src/types/blockchain/TransactionSubtypes/IPFSTransaction.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;AAsGH,4CAEC;AAKD,4CAEC;AAKD,gDAEC;AAKD,sCAQC;AApCD,+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;;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,CAC/B,CAAA;AACL,CAAC"}
|
|
@@ -13,6 +13,7 @@ export * from './ContractDeployTransaction';
|
|
|
13
13
|
export * from './ContractCallTransaction';
|
|
14
14
|
export * from './D402PaymentTransaction';
|
|
15
15
|
export * from './EscrowTransaction';
|
|
16
|
+
export * from './IPFSTransaction';
|
|
16
17
|
import { L2PSTransaction } from './L2PSTransaction';
|
|
17
18
|
import { L2PSHashTransaction } from './L2PSHashTransaction';
|
|
18
19
|
import { Web2Transaction } from './Web2Transaction';
|
|
@@ -28,4 +29,5 @@ import { ContractDeployTransaction } from './ContractDeployTransaction';
|
|
|
28
29
|
import { ContractCallTransaction } from './ContractCallTransaction';
|
|
29
30
|
import { D402PaymentTransaction } from './D402PaymentTransaction';
|
|
30
31
|
import { EscrowTransaction } from './EscrowTransaction';
|
|
31
|
-
|
|
32
|
+
import { IPFSTransaction } from './IPFSTransaction';
|
|
33
|
+
export type SpecificTransaction = L2PSTransaction | L2PSHashTransaction | Web2Transaction | CrosschainTransaction | NativeTransaction | DemosworkTransaction | IdentityTransaction | InstantMessagingTransaction | NativeBridgeTransaction | StorageTransaction | StorageProgramTransaction | ContractDeployTransaction | ContractCallTransaction | D402PaymentTransaction | EscrowTransaction | IPFSTransaction;
|
|
@@ -29,4 +29,5 @@ __exportStar(require("./ContractDeployTransaction"), exports);
|
|
|
29
29
|
__exportStar(require("./ContractCallTransaction"), exports);
|
|
30
30
|
__exportStar(require("./D402PaymentTransaction"), exports);
|
|
31
31
|
__exportStar(require("./EscrowTransaction"), exports);
|
|
32
|
+
__exportStar(require("./IPFSTransaction"), exports);
|
|
32
33
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/types/blockchain/TransactionSubtypes/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAiC;AACjC,wDAAqC;AACrC,oDAAiC;AACjC,0DAAuC;AACvC,sDAAmC;AACnC,yDAAsC;AACtC,wDAAqC;AACrC,gEAA6C;AAC7C,4DAAyC;AACzC,uDAAoC;AACpC,8DAA2C;AAC3C,8DAA2C;AAC3C,4DAAyC;AACzC,2DAAwC;AACxC,sDAAmC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/types/blockchain/TransactionSubtypes/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAiC;AACjC,wDAAqC;AACrC,oDAAiC;AACjC,0DAAuC;AACvC,sDAAmC;AACnC,yDAAsC;AACtC,wDAAqC;AACrC,gEAA6C;AAC7C,4DAAyC;AACzC,uDAAoC;AACpC,8DAA2C;AAC3C,8DAA2C;AAC3C,4DAAyC;AACzC,2DAAwC;AACxC,sDAAmC;AACnC,oDAAiC"}
|
package/build/types/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export { Block, BlockContent, NativeTablesHashes, GenesisBlock } from "./blockch
|
|
|
3
3
|
export { ISignature } from "./blockchain/ISignature";
|
|
4
4
|
export { RawTransaction } from "./blockchain/rawTransaction";
|
|
5
5
|
export { Transaction, TransactionContent, TransactionContentData, } from "./blockchain/Transaction";
|
|
6
|
-
export { L2PSTransaction, Web2Transaction, CrosschainTransaction, NativeTransaction, DemosworkTransaction, IdentityTransaction, InstantMessagingTransaction, NativeBridgeTransaction, SpecificTransaction, } from "./blockchain/TransactionSubtypes";
|
|
6
|
+
export { L2PSTransaction, Web2Transaction, CrosschainTransaction, NativeTransaction, DemosworkTransaction, IdentityTransaction, InstantMessagingTransaction, NativeBridgeTransaction, SpecificTransaction, IPFSTransaction, type IPFSTransactionContent, type IPFSPayload, type IPFSAddPayload, type IPFSPinPayload, type IPFSUnpinPayload, type IPFSOperationType, isIPFSAddPayload, isIPFSPinPayload, isIPFSUnpinPayload, isIPFSPayload, } from "./blockchain/TransactionSubtypes";
|
|
7
7
|
export { INativePayload } from "./native/INativePayload";
|
|
8
8
|
export { InstantMessagingPayload } from "./instantMessaging";
|
|
9
9
|
export { TxFee } from "./blockchain/TxFee";
|
package/build/types/index.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isTransactionDataType = exports.isTransactionType = exports.SupportedTokens = exports.SupportedChains = exports.ChainProviders = exports.RPCResponseSkeleton = exports.stepKeysEnum = exports.XmStepResult = exports.DataTypes = exports.EnumWeb2Actions = exports.CValidityData = void 0;
|
|
3
|
+
exports.isTransactionDataType = exports.isTransactionType = exports.SupportedTokens = exports.SupportedChains = exports.ChainProviders = exports.RPCResponseSkeleton = exports.stepKeysEnum = exports.XmStepResult = exports.DataTypes = exports.EnumWeb2Actions = exports.CValidityData = exports.isIPFSPayload = exports.isIPFSUnpinPayload = exports.isIPFSPinPayload = exports.isIPFSAddPayload = void 0;
|
|
4
|
+
// Export all specific transaction types
|
|
5
|
+
var TransactionSubtypes_1 = require("./blockchain/TransactionSubtypes");
|
|
6
|
+
Object.defineProperty(exports, "isIPFSAddPayload", { enumerable: true, get: function () { return TransactionSubtypes_1.isIPFSAddPayload; } });
|
|
7
|
+
Object.defineProperty(exports, "isIPFSPinPayload", { enumerable: true, get: function () { return TransactionSubtypes_1.isIPFSPinPayload; } });
|
|
8
|
+
Object.defineProperty(exports, "isIPFSUnpinPayload", { enumerable: true, get: function () { return TransactionSubtypes_1.isIPFSUnpinPayload; } });
|
|
9
|
+
Object.defineProperty(exports, "isIPFSPayload", { enumerable: true, get: function () { return TransactionSubtypes_1.isIPFSPayload; } });
|
|
4
10
|
var ValidityData_1 = require("./blockchain/ValidityData");
|
|
5
11
|
Object.defineProperty(exports, "CValidityData", { enumerable: true, get: function () { return ValidityData_1.CValidityData; } });
|
|
6
12
|
// web2
|
package/build/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":";;;AAmBA,wCAAwC;AACxC,wEAsByC;AAJrC,uHAAA,gBAAgB,OAAA;AAChB,uHAAA,gBAAgB,OAAA;AAChB,yHAAA,kBAAkB,OAAA;AAClB,oHAAA,aAAa,OAAA;AAUjB,0DAAuE;AAA9D,6GAAA,aAAa,OAAA;AA6CtB,OAAO;AACP,+BAce;AADX,uGAAA,eAAe,OAAA;AAgBnB,mDAA4D;AAAnD,sGAAA,SAAS,OAAA;AAOlB,2CAQ0B;AAHtB,qGAAA,YAAY,OAAA;AAEZ,qGAAA,YAAY,OAAA;AAGhB,2CAU4B;AADxB,0GAAA,aAAa,OAAuB;AAgBxC,gDAI2B;AAHvB,2GAAA,cAAc,OAAA;AACd,4GAAA,eAAe,OAAA;AACf,4GAAA,eAAe,OAAA;AAanB,+BAA+B;AAC/B,gEAG+C;AAF3C,0GAAA,iBAAiB,OAAA;AACjB,8GAAA,qBAAqB,OAAA"}
|
package/package.json
CHANGED