@kynesyslabs/demosdk 1.0.15 → 1.0.17

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 (38) hide show
  1. package/build/encryption/Cryptography.d.ts +11 -0
  2. package/build/encryption/Cryptography.js +105 -0
  3. package/build/encryption/Cryptography.js.map +1 -0
  4. package/build/encryption/FHE/index.d.ts +10 -0
  5. package/build/encryption/FHE/index.js +29 -0
  6. package/build/encryption/FHE/index.js.map +1 -0
  7. package/build/encryption/Hashing.d.ts +3 -0
  8. package/build/encryption/Hashing.js +25 -0
  9. package/build/encryption/Hashing.js.map +1 -0
  10. package/build/encryption/PQC/index.d.ts +2 -0
  11. package/build/encryption/PQC/index.js +6 -0
  12. package/build/encryption/PQC/index.js.map +1 -0
  13. package/build/encryption/index.d.ts +3 -0
  14. package/build/encryption/index.js +30 -0
  15. package/build/encryption/index.js.map +1 -0
  16. package/build/encryption/zK/index.d.ts +2 -0
  17. package/build/encryption/zK/index.js +6 -0
  18. package/build/encryption/zK/index.js.map +1 -0
  19. package/build/index.d.ts +2 -0
  20. package/build/index.js +6 -1
  21. package/build/index.js.map +1 -1
  22. package/build/multichain/core/index.d.ts +1 -0
  23. package/build/multichain/core/index.js +3 -1
  24. package/build/multichain/core/index.js.map +1 -1
  25. package/build/multichain/core/solana.d.ts +40 -11
  26. package/build/multichain/core/solana.js +155 -63
  27. package/build/multichain/core/solana.js.map +1 -1
  28. package/build/multichain/core/types/defaultChain.d.ts +22 -1
  29. package/build/multichain/core/types/defaultChain.js.map +1 -1
  30. package/build/types/blockchain/blocks.d.ts +9 -0
  31. package/build/types/index.d.ts +1 -1
  32. package/build/utils/dataManipulation.d.ts +4 -0
  33. package/build/utils/dataManipulation.js +41 -0
  34. package/build/utils/dataManipulation.js.map +1 -0
  35. package/build/utils/index.d.ts +1 -0
  36. package/build/utils/index.js +28 -0
  37. package/build/utils/index.js.map +1 -0
  38. package/package.json +4 -2
@@ -0,0 +1,11 @@
1
+ import forge from "node-forge";
2
+ export default class Cryptography {
3
+ static ed25519: {
4
+ sign: (message: string, privateKey: forge.pki.ed25519.BinaryBuffer | any) => forge.pki.ed25519.NativeBuffer;
5
+ verify: (signed: string, signature: any | forge.pki.ed25519.BinaryBuffer, publicKey: any | forge.pki.ed25519.BinaryBuffer) => boolean;
6
+ };
7
+ static rsa: {
8
+ encrypt: (message: string, publicKey: any | forge.pki.rsa.PublicKey) => [boolean, any];
9
+ decrypt: (message: string, privateKey?: any | forge.pki.rsa.PrivateKey) => [boolean, any];
10
+ };
11
+ }
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ /* LICENSE
3
+
4
+ © 2023 by KyneSys Labs, licensed under CC BY-NC-ND 4.0
5
+
6
+ Full license text: https://creativecommons.org/licenses/by-nc-nd/4.0/legalcode
7
+ Human readable license: https://creativecommons.org/licenses/by-nc-nd/4.0/
8
+
9
+ KyneSys Labs: https://www.kynesys.xyz/
10
+
11
+ */
12
+ var __importDefault = (this && this.__importDefault) || function (mod) {
13
+ return (mod && mod.__esModule) ? mod : { "default": mod };
14
+ };
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ const node_forge_1 = __importDefault(require("node-forge"));
17
+ const dataManipulation_1 = require("../utils/dataManipulation");
18
+ const algorithm = "aes-256-cbc";
19
+ class Cryptography {
20
+ }
21
+ Cryptography.ed25519 = {
22
+ sign: (message, privateKey) => {
23
+ // REVIEW Test HexToForge support
24
+ if (privateKey.type == "string") {
25
+ console.log("[HexToForge] Deriving a buffer from privateKey...");
26
+ privateKey = (0, dataManipulation_1.HexToForge)(privateKey);
27
+ }
28
+ return node_forge_1.default.pki.ed25519.sign({
29
+ message,
30
+ encoding: "utf8",
31
+ privateKey,
32
+ });
33
+ },
34
+ verify: (signed, signature, publicKey) => {
35
+ // REVIEW Test HexToForge support
36
+ if (signature.type == "string") {
37
+ console.log("[HexToForge] Deriving a buffer from signature...");
38
+ signature = (0, dataManipulation_1.HexToForge)(signature);
39
+ }
40
+ if (publicKey.type == "string") {
41
+ console.log("[HexToForge] Deriving a buffer from publicKey...");
42
+ publicKey = (0, dataManipulation_1.HexToForge)(publicKey);
43
+ }
44
+ // Also, we have to sanitize buffers so that they are forge compatible
45
+ if (signature.type == "Buffer") {
46
+ console.log("[*] Normalizing signature...");
47
+ console.log(typeof signature);
48
+ signature = Buffer.from(signature); // REVIEW Does not work in bun
49
+ }
50
+ if (publicKey.type == "Buffer") {
51
+ console.log("[*] Normalizing publicKey...");
52
+ publicKey = Buffer.from(publicKey); // REVIEW Does not work in bun
53
+ }
54
+ console.log("[*] Verifying the signature of: " + signed + "\n");
55
+ console.log("[*] Using the signature: ");
56
+ console.log(signature);
57
+ console.log("[*] And the public key: ");
58
+ console.log(publicKey);
59
+ return node_forge_1.default.pki.ed25519.verify({
60
+ message: signed,
61
+ encoding: "utf8",
62
+ signature: signature,
63
+ publicKey: publicKey,
64
+ });
65
+ }
66
+ };
67
+ Cryptography.rsa = {
68
+ // INFO Encryption method using the public key
69
+ encrypt: (message, publicKey) => {
70
+ // NOTE Supporting "fake buffers" from web browsers
71
+ if (publicKey.type == "Buffer") {
72
+ console.log("[ENCRYPTION] Normalizing publicKey...");
73
+ publicKey = Buffer.from(publicKey);
74
+ }
75
+ // Converting the message and decrypting it
76
+ let based = node_forge_1.default.util.encode64(message);
77
+ const encrypted = publicKey.encrypt(based);
78
+ return [true, encrypted];
79
+ },
80
+ // INFO Decryption method using the private key
81
+ decrypt: (message, privateKey = null) => {
82
+ // NOTE Supporting "fake buffers" from web browsers
83
+ try {
84
+ if (privateKey.type == "Buffer") {
85
+ console.log("[DECRYPTION] Normalizing privateKey...\n");
86
+ privateKey = Buffer.from(privateKey);
87
+ }
88
+ }
89
+ catch (e) {
90
+ console.log("[DECRYPTION] Looks like there is nothing to normalize here, let's proceed\n");
91
+ console.log(e);
92
+ }
93
+ // Converting back the message and decrypting it
94
+ // NOTE If no private key is provided, we try to use our one
95
+ if (!privateKey) {
96
+ console.log("[DECRYPTION] No private key provided!\n");
97
+ return [false, "No private key found"];
98
+ }
99
+ let debased = node_forge_1.default.util.decode64(message);
100
+ const decrypted = privateKey.decrypt(debased);
101
+ return [true, decrypted.toString()];
102
+ },
103
+ };
104
+ exports.default = Cryptography;
105
+ //# sourceMappingURL=Cryptography.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Cryptography.js","sourceRoot":"","sources":["../../../src/encryption/Cryptography.ts"],"names":[],"mappings":";AAAA;;;;;;;;;EASE;;;;;AAIF,4DAA8B;AAE9B,+DAAqD;AAGrD,MAAM,SAAS,GAAG,aAAa,CAAA;AAE/B,MAAqB,YAAY;;AAEtB,oBAAO,GAAG;IACb,IAAI,EAAE,CACF,OAAe,EACf,UAAgD,EAClD,EAAE;QACA,iCAAiC;QACjC,IAAI,UAAU,CAAC,IAAI,IAAI,QAAQ,EAAE,CAAC;YAC9B,OAAO,CAAC,GAAG,CAAC,mDAAmD,CAAC,CAAA;YAChE,UAAU,GAAG,IAAA,6BAAU,EAAC,UAAU,CAAC,CAAA;QACvC,CAAC;QAED,OAAO,oBAAK,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC;YAC1B,OAAO;YACP,QAAQ,EAAE,MAAM;YAChB,UAAU;SACb,CAAC,CAAA;IACN,CAAC;IAED,MAAM,EAAE,CACJ,MAAc,EACd,SAA+C,EAC/C,SAA+C,EACjD,EAAE;QACA,iCAAiC;QACjC,IAAI,SAAS,CAAC,IAAI,IAAI,QAAQ,EAAE,CAAC;YAC7B,OAAO,CAAC,GAAG,CAAC,kDAAkD,CAAC,CAAA;YAC/D,SAAS,GAAG,IAAA,6BAAU,EAAC,SAAS,CAAC,CAAA;QACrC,CAAC;QACD,IAAI,SAAS,CAAC,IAAI,IAAI,QAAQ,EAAE,CAAC;YAC7B,OAAO,CAAC,GAAG,CAAC,kDAAkD,CAAC,CAAA;YAC/D,SAAS,GAAG,IAAA,6BAAU,EAAC,SAAS,CAAC,CAAA;QACrC,CAAC;QA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I,KAAK,GAAG,oBAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;QACxC,MAAM,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;QAC1C,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC,CAAA;IAC5B,CAAC;IAED,+CAA+C;IAC/C,OAAO,EAAE,CACL,OAAe,EACf,aAA6C,IAAI,EACnC,EAAE;QAChB,mDAAmD;QACnD,IAAI,CAAC;YACD,IAAI,UAAU,CAAC,IAAI,IAAI,QAAQ,EAAE,CAAC;gBAC9B,OAAO,CAAC,GAAG,CAAC,0CAA0C,CAAC,CAAA;gBACvD,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;YACxC,CAAC;QACL,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACT,OAAO,CAAC,GAAG,CACP,6EAA6E,CAChF,CAAA;YACD,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;QAClB,CAAC;QACD,gDAAgD;QAChD,4DAA4D;QAC5D,IAAI,CAAC,UAAU,EAAE,CAAC;YACd,OAAO,CAAC,GAAG,CACP,yCAAyC,CAC5C,CAAA;YACD,OAAO,CAAC,KAAK,EAAE,sBAAsB,CAAC,CAAA;QAC1C,CAAC;QACD,IAAI,OAAO,GAAG,oBAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;QAC1C,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;QAC7C,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC,QAAQ,EAAE,CAAC,CAAA;IACvC,CAAC;CACJ,CAAA;kBA1GgB,YAAY"}
@@ -0,0 +1,10 @@
1
+ import { EncryptionParameters } from 'node-seal/implementation/encryption-parameters';
2
+ export default class FHE {
3
+ schemeType: any;
4
+ securityLevel: any;
5
+ polyModulusDegree: number;
6
+ bitSizes: number[];
7
+ bitSize: number;
8
+ parms: EncryptionParameters;
9
+ constructor();
10
+ }
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ // LINK https://github.com/s0l0ist/node-seal/blob/main/USAGE.md
7
+ // LINK https://s0l0ist.github.io/seal-sandbox/
8
+ const node_seal_1 = __importDefault(require("node-seal"));
9
+ // Initialize SEAL completely
10
+ // @ts-expect-error
11
+ let seal = null;
12
+ (async () => {
13
+ seal = await (0, node_seal_1.default)();
14
+ })();
15
+ class FHE {
16
+ constructor() {
17
+ // Encryption Parameters
18
+ this.schemeType = seal.SchemeType.bfv;
19
+ this.securityLevel = seal.SecurityLevel.tc128;
20
+ this.polyModulusDegree = 4096;
21
+ this.bitSizes = [36, 36, 37];
22
+ this.bitSize = 20;
23
+ // Create the parameters object
24
+ this.parms = seal.EncryptionParameters(this.schemeType);
25
+ // TODO Continue from here
26
+ }
27
+ }
28
+ exports.default = FHE;
29
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/encryption/FHE/index.ts"],"names":[],"mappings":";;;;;AAAA,+DAA+D;AAC/D,+CAA+C;AAC/C,0DAA4B;AAI5B,6BAA6B;AAC7B,mBAAmB;AACnB,IAAI,IAAI,GAAgB,IAAI,CAAC;AAC7B,CAAC,KAAK,IAAG,EAAE;IACP,IAAI,GAAG,MAAM,IAAA,mBAAI,GAAE,CAAC;AACxB,CAAC,CAAC,EAAE,CAAC;AAEL,MAAqB,GAAG;IAUpB;QACI,wBAAwB;QACxB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;QACtC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,CAAA;QAC7C,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAA;QAC7B,IAAI,CAAC,QAAQ,GAAG,CAAC,EAAE,EAAC,EAAE,EAAC,EAAE,CAAC,CAAA;QAC1B,IAAI,CAAC,OAAO,GAAG,EAAE,CAAA;QACjB,+BAA+B;QAC/B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;QACvD,0BAA0B;IAC9B,CAAC;CAEJ;AAtBD,sBAsBC"}
@@ -0,0 +1,3 @@
1
+ export default class Hashing {
2
+ static sha256(message: string): string;
3
+ }
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ /* LICENSE
3
+
4
+ © 2023 by KyneSys Labs, licensed under CC BY-NC-ND 4.0
5
+
6
+ Full license text: https://creativecommons.org/licenses/by-nc-nd/4.0/legalcode
7
+ Human readable license: https://creativecommons.org/licenses/by-nc-nd/4.0/
8
+
9
+ KyneSys Labs: https://www.kynesys.xyz/
10
+
11
+ */
12
+ var __importDefault = (this && this.__importDefault) || function (mod) {
13
+ return (mod && mod.__esModule) ? mod : { "default": mod };
14
+ };
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ const node_forge_1 = __importDefault(require("node-forge"));
17
+ class Hashing {
18
+ static sha256(message) {
19
+ const md = node_forge_1.default.sha256.create();
20
+ md.update(message);
21
+ return md.digest().toHex();
22
+ }
23
+ }
24
+ exports.default = Hashing;
25
+ //# sourceMappingURL=Hashing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Hashing.js","sourceRoot":"","sources":["../../../src/encryption/Hashing.ts"],"names":[],"mappings":";AAAA;;;;;;;;;EASE;;;;;AAEF,4DAA8B;AAE9B,MAAqB,OAAO;IACxB,MAAM,CAAC,MAAM,CAAC,OAAe;QACzB,MAAM,EAAE,GAAG,oBAAK,CAAC,MAAM,CAAC,MAAM,EAAE,CAAA;QAChC,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;QAClB,OAAO,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,CAAA;IAC9B,CAAC;CACJ;AAND,0BAMC"}
@@ -0,0 +1,2 @@
1
+ export default class PQC {
2
+ }
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class PQC {
4
+ }
5
+ exports.default = PQC;
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/encryption/PQC/index.ts"],"names":[],"mappings":";;AAAA,MAAqB,GAAG;CAEvB;AAFD,sBAEC"}
@@ -0,0 +1,3 @@
1
+ export * as FHE from './FHE';
2
+ export * as PQC from './PQC';
3
+ export * as zK from './zK';
@@ -0,0 +1,30 @@
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.zK = exports.PQC = exports.FHE = void 0;
27
+ exports.FHE = __importStar(require("./FHE"));
28
+ exports.PQC = __importStar(require("./PQC"));
29
+ exports.zK = __importStar(require("./zK"));
30
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/encryption/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA4B;AAC5B,6CAA4B;AAC5B,2CAA0B"}
@@ -0,0 +1,2 @@
1
+ export default class zK {
2
+ }
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class zK {
4
+ }
5
+ exports.default = zK;
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/encryption/zK/index.ts"],"names":[],"mappings":";;AAAA,MAAqB,EAAE;CAEtB;AAFD,qBAEC"}
package/build/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
1
  export * as types from './types';
2
+ export * as encryption from './encryption';
3
+ export * as utils from './utils';
2
4
  export * as xmlocalsdk from './multichain/localsdk';
3
5
  export * as xmwebsdk from './multichain/websdk';
package/build/index.js CHANGED
@@ -23,8 +23,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.xmwebsdk = exports.xmlocalsdk = exports.types = void 0;
26
+ exports.xmwebsdk = exports.xmlocalsdk = exports.utils = exports.encryption = exports.types = void 0;
27
+ // Common types and constants
27
28
  exports.types = __importStar(require("./types"));
29
+ // Basic cryptographic and data manipulation functions
30
+ exports.encryption = __importStar(require("./encryption"));
31
+ exports.utils = __importStar(require("./utils"));
32
+ // Specific features of the SDK
28
33
  exports.xmlocalsdk = __importStar(require("./multichain/localsdk"));
29
34
  exports.xmwebsdk = __importStar(require("./multichain/websdk"));
30
35
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAgC;AAChC,oEAAmD;AACnD,gEAA+C"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6BAA6B;AAC7B,iDAAgC;AAChC,sDAAsD;AACtD,2DAA0C;AAC1C,iDAAgC;AAChC,gCAAgC;AAChC,oEAAmD;AACnD,gEAA+C"}
@@ -3,5 +3,6 @@ export { EGLDSignTxOptions, IBCConnectWalletOptions, IBCGetBalanceOptions, IBCPr
3
3
  export { required } from './utils';
4
4
  export { EVM } from './evm';
5
5
  export { IBC } from './ibc';
6
+ export { SOLANA } from './solana';
6
7
  export { MULTIVERSX } from './multiversx';
7
8
  export { XRPL, xrplGetLastSequence } from './xrp';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.xrplGetLastSequence = exports.XRPL = exports.MULTIVERSX = exports.IBC = exports.EVM = exports.required = exports.DefaultChain = void 0;
3
+ exports.xrplGetLastSequence = exports.XRPL = exports.MULTIVERSX = exports.SOLANA = exports.IBC = exports.EVM = exports.required = exports.DefaultChain = void 0;
4
4
  var defaultChain_1 = require("./types/defaultChain");
5
5
  Object.defineProperty(exports, "DefaultChain", { enumerable: true, get: function () { return defaultChain_1.DefaultChain; } });
6
6
  var utils_1 = require("./utils");
@@ -10,6 +10,8 @@ var evm_1 = require("./evm");
10
10
  Object.defineProperty(exports, "EVM", { enumerable: true, get: function () { return evm_1.EVM; } });
11
11
  var ibc_1 = require("./ibc");
12
12
  Object.defineProperty(exports, "IBC", { enumerable: true, get: function () { return ibc_1.IBC; } });
13
+ var solana_1 = require("./solana");
14
+ Object.defineProperty(exports, "SOLANA", { enumerable: true, get: function () { return solana_1.SOLANA; } });
13
15
  var multiversx_1 = require("./multiversx");
14
16
  Object.defineProperty(exports, "MULTIVERSX", { enumerable: true, get: function () { return multiversx_1.MULTIVERSX; } });
15
17
  // The official XRPL Library is called "xrpl" which conflicts with the name of our XRPL SDK
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/multichain/core/index.ts"],"names":[],"mappings":";;;AAAA,qDAM6B;AALzB,4GAAA,YAAY,OAAA;AAkBhB,iCAAkC;AAAzB,iGAAA,QAAQ,OAAA;AAEjB,sBAAsB;AACtB,6BAA2B;AAAlB,0FAAA,GAAG,OAAA;AACZ,6BAA2B;AAAlB,0FAAA,GAAG,OAAA;AACZ,2CAAyC;AAAhC,wGAAA,UAAU,OAAA;AAEnB,2FAA2F;AAC3F,6BAAiD;AAAxC,2FAAA,IAAI,OAAA;AAAE,0GAAA,mBAAmB,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/multichain/core/index.ts"],"names":[],"mappings":";;;AAAA,qDAM6B;AALzB,4GAAA,YAAY,OAAA;AAkBhB,iCAAkC;AAAzB,iGAAA,QAAQ,OAAA;AAEjB,sBAAsB;AACtB,6BAA2B;AAAlB,0FAAA,GAAG,OAAA;AACZ,6BAA2B;AAAlB,0FAAA,GAAG,OAAA;AACZ,mCAAiC;AAAxB,gGAAA,MAAM,OAAA;AACf,2CAAyC;AAAhC,wGAAA,UAAU,OAAA;AAEnB,2FAA2F;AAC3F,6BAAiD;AAAxC,2FAAA,IAAI,OAAA;AAAE,0GAAA,mBAAmB,OAAA"}
@@ -1,19 +1,48 @@
1
- import * as solanaWeb3 from '@solana/web3.js';
2
- import { DefaultChain } from './types/defaultChain';
3
- export default class SOLANA extends DefaultChain {
1
+ import { Keypair, Connection, Transaction, NonceAccount } from "@solana/web3.js";
2
+ import { IPayOptions } from "./types/interfaces";
3
+ import { DefaultChain, SolanaDefaultChain } from "./types/defaultChain";
4
+ interface SignTxOptions {
5
+ /**
6
+ * The private key to sign the transaction with, instead of the connected wallet.
7
+ */
8
+ privateKey?: string;
9
+ /**
10
+ * The address of your nonce account for signing with durable nonces.
11
+ */
12
+ nonceAccountAddress?: string;
13
+ /**
14
+ * The secret key of the nonce account authority, for signing the tx.
15
+ *
16
+ * Defaults to the connected wallet's secret key.
17
+ */
18
+ nonceAccountAuthority?: string;
19
+ }
20
+ export declare class SOLANA extends DefaultChain implements SolanaDefaultChain {
4
21
  private static instance;
5
- wallet: solanaWeb3.Keypair;
6
- provider: solanaWeb3.Connection;
22
+ wallet: Keypair;
23
+ provider: Connection;
7
24
  constructor(rpc_url: string);
8
25
  connect(): Promise<boolean>;
9
- disconnect(): Promise<any>;
10
- createWallet(): any;
11
- connectWallet(privateKey: string): Promise<solanaWeb3.Keypair>;
26
+ disconnect(): Promise<boolean>;
27
+ connectWallet(privateKey: string, options?: {
28
+ /**
29
+ * If the private key is in base58 format
30
+ */
31
+ base58: boolean;
32
+ }): Promise<Keypair>;
12
33
  getBalance(address: string): Promise<string>;
13
- pay(to: string, amount: string): Promise<any>;
14
34
  info(): Promise<string>;
15
- createRawTransaction(): Promise<solanaWeb3.Transaction>;
16
- signTransaction(raw_transaction: any): Promise<any>;
35
+ signTransaction(tx: Transaction, options?: SignTxOptions): Promise<Transaction>;
36
+ readNonce(address: string): Promise<NonceAccount | null>;
37
+ createNonceAccount(): Promise<string>;
38
+ signTransactions(transactions: Transaction[], options?: SignTxOptions): Promise<Transaction[]>;
39
+ getAddress(): string;
40
+ getEmptyTransaction(): Transaction;
41
+ preparePay(receiver: string, amount: string, options?: SignTxOptions): Promise<Transaction>;
42
+ preparePays(payments: IPayOptions[], options?: SignTxOptions): Promise<Transaction[]>;
43
+ prepareTransfer(receiver: string, amount: string, options: {}): Promise<Transaction>;
44
+ prepareTransfers(transfers: IPayOptions[], options: {}): Promise<Transaction[]>;
17
45
  static getInstance(): SOLANA | boolean;
18
46
  static createInstance(rpc_url: string): SOLANA;
19
47
  }
48
+ export {};
@@ -1,102 +1,194 @@
1
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
24
4
  };
25
5
  Object.defineProperty(exports, "__esModule", { value: true });
26
- const solanaWeb3 = __importStar(require("@solana/web3.js"));
6
+ exports.SOLANA = void 0;
7
+ const bs58_1 = __importDefault(require("bs58"));
8
+ const web3_js_1 = require("@solana/web3.js");
27
9
  const utils_1 = require("./utils");
28
10
  const defaultChain_1 = require("./types/defaultChain");
29
- /* LICENSE
30
-
31
- © 2023 by KyneSys Labs, licensed under CC BY-NC-ND 4.0
32
-
33
- Full license text: https://creativecommons.org/licenses/by-nc-nd/4.0/legalcode
34
- Human readable license: https://creativecommons.org/licenses/by-nc-nd/4.0/
35
-
36
- KyneSys Labs: https://www.kynesys.xyz/
37
-
38
- */
39
- // LINK https://docs.solana.com/developing/clients/javascript-api
40
- // @ts-expect-error
41
11
  class SOLANA extends defaultChain_1.DefaultChain {
42
12
  constructor(rpc_url) {
43
13
  super(rpc_url);
44
- this.name = 'solana';
14
+ this.name = "solana";
45
15
  }
46
16
  async connect() {
47
- this.provider = new solanaWeb3.Connection(this.rpc_url);
48
- // TODO Check connectivity
49
- return true;
17
+ this.provider = new web3_js_1.Connection(this.rpc_url);
18
+ const version = await this.provider.getVersion();
19
+ this.connected = Number.isInteger(version["feature-set"]);
20
+ return this.connected;
50
21
  }
51
22
  async disconnect() {
52
23
  this.resetInstance();
53
- // TODO If something is to do, do it here
24
+ return true;
54
25
  }
55
- createWallet() { }
26
+ // async createWallet() {}
56
27
  // ANCHOR Public methods
57
- async connectWallet(privateKey) {
58
- this.wallet = solanaWeb3.Keypair.fromSecretKey(Buffer.from(privateKey, 'hex')); // REVIEW is this ok?
28
+ async connectWallet(privateKey, options) {
29
+ let privateKeyBuffer;
30
+ if (options && options.base58) {
31
+ privateKeyBuffer = bs58_1.default.decode(privateKey);
32
+ }
33
+ else {
34
+ const pk = privateKey.split(",").map(x => parseInt(x));
35
+ privateKeyBuffer = Buffer.from(pk);
36
+ }
37
+ this.wallet = web3_js_1.Keypair.fromSecretKey(privateKeyBuffer);
59
38
  return this.wallet;
60
39
  }
61
40
  async getBalance(address) {
62
- // TODO
63
- return '';
64
- }
65
- async pay(to, amount) {
66
- (0, utils_1.required)(this.wallet, 'Wallet not connected');
67
- // TODO
68
- return null;
41
+ const publicKey = new web3_js_1.PublicKey(address);
42
+ const balance = await this.provider.getBalance(publicKey);
43
+ return balance.toString();
69
44
  }
45
+ // async pay(to: string, amount: string): Promise<any> {
46
+ // required(this.wallet, 'Wallet not connected')
47
+ // // TODO
48
+ // return null
49
+ // }
70
50
  async info() {
71
- let info = '';
51
+ let info = "";
72
52
  // TODO
73
53
  return info;
74
54
  }
75
55
  // INFO Returning an empty raw transaction skeleton
76
- async createRawTransaction() {
77
- let empty_tx = new solanaWeb3.Transaction();
78
- return empty_tx;
79
- }
56
+ // async createRawTransaction(): Promise<Transaction> {
57
+ // }
80
58
  // INFO Placeholder compatibility function that is here only for the interface
81
- async signTransaction(raw_transaction) {
82
- (0, utils_1.required)(this.wallet, 'Wallet not connected');
59
+ async signTransaction(tx, options) {
60
+ (0, utils_1.required)(this.wallet, "Wallet not connected");
83
61
  // LINK https://docs.shyft.to/tutorials/how-to-sign-transactions-on-solana
84
62
  // NOTE Due to the above, the transaction is signed and sent at the same time.
85
- return raw_transaction;
63
+ // tx.addSignature()
64
+ const txs = await this.signTransactions([tx], options);
65
+ return txs[0];
66
+ }
67
+ async readNonce(address) {
68
+ console.log("reading nonce account: ", address);
69
+ const pubkey = new web3_js_1.PublicKey(address);
70
+ const accountInfo = await this.provider.getAccountInfo(pubkey);
71
+ console.log("accountInfo: ", accountInfo);
72
+ if (accountInfo) {
73
+ return web3_js_1.NonceAccount.fromAccountData(accountInfo?.data);
74
+ }
75
+ return null;
76
+ }
77
+ async createNonceAccount() {
78
+ (0, utils_1.required)(this.wallet, "Wallet not connected");
79
+ let tx = new web3_js_1.Transaction();
80
+ const nonceAccount = web3_js_1.Keypair.generate();
81
+ const create_acc_ix = web3_js_1.SystemProgram.createAccount({
82
+ fromPubkey: this.wallet.publicKey,
83
+ newAccountPubkey: nonceAccount.publicKey,
84
+ lamports: await this.provider.getMinimumBalanceForRentExemption(web3_js_1.NONCE_ACCOUNT_LENGTH),
85
+ space: web3_js_1.NONCE_ACCOUNT_LENGTH,
86
+ programId: web3_js_1.SystemProgram.programId,
87
+ });
88
+ const init_nonce_ix = web3_js_1.SystemProgram.nonceInitialize({
89
+ noncePubkey: nonceAccount.publicKey,
90
+ authorizedPubkey: this.wallet.publicKey,
91
+ });
92
+ tx.add(create_acc_ix, init_nonce_ix);
93
+ const txhash = this.provider.sendTransaction(tx, [
94
+ this.wallet,
95
+ nonceAccount,
96
+ ]);
97
+ console.log("txhash: ", txhash);
98
+ return nonceAccount.publicKey.toBase58();
99
+ }
100
+ async signTransactions(transactions, options) {
101
+ (0, utils_1.required)(this.wallet, "Wallet not connected");
102
+ let nonceAccount = null;
103
+ let advanceNonceIx = null;
104
+ let nonceAuthority = this.wallet;
105
+ const nonceAccAvailable = options && options.nonceAccountAddress ? true : false;
106
+ // if we have the nonce authority, overwrite.
107
+ if (nonceAccAvailable && options.nonceAccountAuthority) {
108
+ nonceAuthority = web3_js_1.Keypair.fromSecretKey(bs58_1.default.decode(options.nonceAccountAuthority));
109
+ }
110
+ // if we have the nonce address, create a nonce advance instruction
111
+ if (nonceAccAvailable) {
112
+ advanceNonceIx = web3_js_1.SystemProgram.nonceAdvance({
113
+ authorizedPubkey: nonceAuthority.publicKey,
114
+ noncePubkey: new web3_js_1.PublicKey(options.nonceAccountAddress),
115
+ });
116
+ nonceAccount = await this.readNonce(options.nonceAccountAddress);
117
+ }
118
+ // if advance instruction is not null
119
+ // ie. we have the nonce address,
120
+ // insert the advance nonce ix at instructions index 0
121
+ // on each transaction
122
+ if (advanceNonceIx && nonceAccount) {
123
+ transactions.forEach(tx => {
124
+ tx.instructions.splice(0, 0, advanceNonceIx);
125
+ // update recent block hash to use the current nonce
126
+ tx.recentBlockhash = nonceAccount.nonce;
127
+ nonceAccount?.nonce;
128
+ // TODO: FIND OUT WHAT HAPPENS WHEN MULTIPLE TX HAVE THE SAME DURABLE NONCE
129
+ });
130
+ }
131
+ const signers = new Set([this.wallet, nonceAuthority]);
132
+ console.log("signers length: ", signers.size);
133
+ console.log("signers: ", signers);
134
+ transactions.forEach(async (tx) => {
135
+ tx.sign(...signers);
136
+ });
137
+ return transactions;
138
+ }
139
+ getAddress() {
140
+ (0, utils_1.required)(this.wallet, "Wallet not connected");
141
+ return this.wallet.publicKey.toBase58();
142
+ }
143
+ getEmptyTransaction() {
144
+ // const recentBlockhash = await this.provider.getLatestBlockhash()
145
+ const options = {
146
+ feePayer: this.wallet.publicKey,
147
+ };
148
+ let empty_tx = new web3_js_1.Transaction(options);
149
+ // empty_tx.recentBlockhash = recentBlockhash.blockhash
150
+ // empty_tx.lastValidBlockHeight = recentBlockhash.lastValidBlockHeight
151
+ return empty_tx;
152
+ }
153
+ async preparePay(receiver, amount, options) {
154
+ const tx = await this.preparePays([{ address: receiver, amount }], options);
155
+ return tx[0];
156
+ }
157
+ async preparePays(payments, options) {
158
+ const recentBlockhash = await this.provider.getLatestBlockhash();
159
+ const transactions = payments.map(payment => {
160
+ const tx = this.getEmptyTransaction();
161
+ tx.recentBlockhash = recentBlockhash.blockhash;
162
+ tx.lastValidBlockHeight = recentBlockhash.lastValidBlockHeight;
163
+ const transferIx = web3_js_1.SystemProgram.transfer({
164
+ fromPubkey: this.wallet.publicKey,
165
+ toPubkey: new web3_js_1.PublicKey(payment.address),
166
+ lamports: parseFloat(payment.amount) * web3_js_1.LAMPORTS_PER_SOL,
167
+ });
168
+ tx.add(transferIx);
169
+ return tx;
170
+ });
171
+ return this.signTransactions(transactions, options);
172
+ }
173
+ async prepareTransfer(receiver, amount, options) {
174
+ return await this.preparePay(receiver, amount, options);
175
+ }
176
+ async prepareTransfers(transfers, options) {
177
+ return await this.preparePays(transfers, options);
86
178
  }
87
179
  // TODO: move sendTransaction to localsdk
88
180
  // INFO Sending a transfer transaction on Solana network
89
181
  // sendTransaction({ to, amount }) {
90
182
  // required(this.wallet, 'Wallet not connected')
91
- // let tx = new solanaWeb3.Transaction()
183
+ // let tx = new Transaction()
92
184
  // tx.add(
93
- // solanaWeb3.SystemProgram.transfer({
185
+ // SystemProgram.transfer({
94
186
  // fromPubkey: this.wallet.publicKey,
95
187
  // toPubkey: to,
96
- // lamports: amount * solanaWeb3.LAMPORTS_PER_SOL,
188
+ // lamports: amount * LAMPORTS_PER_SOL,
97
189
  // })
98
190
  // )
99
- // let result = solanaWeb3.sendAndConfirmTransaction(this.provider, tx, [
191
+ // let result = sendAndConfirmTransaction(this.provider, tx, [
100
192
  // this.wallet,
101
193
  // ])
102
194
  // return result
@@ -115,5 +207,5 @@ class SOLANA extends defaultChain_1.DefaultChain {
115
207
  return SOLANA.instance;
116
208
  }
117
209
  }
118
- exports.default = SOLANA;
210
+ exports.SOLANA = SOLANA;
119
211
  //# sourceMappingURL=solana.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"solana.js","sourceRoot":"","sources":["../../../../src/multichain/core/solana.ts"],"names":[],"mappings":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QACb,CAAC,CAAC,CAAA;QAEF,OAAO,IAAI,CAAC,gBAAgB,CAAC,YAAY,EAAE,OAAO,CAAC,CAAA;IACvD,CAAC;IAEQ,KAAK,CAAC,eAAe,CAC1B,QAAgB,EAChB,MAAc,EACd,OAAW;QAEX,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,CAAA;IAC3D,CAAC;IAEQ,KAAK,CAAC,gBAAgB,CAAC,SAAwB,EAAE,OAAW;QACjE,OAAO,MAAM,IAAI,CAAC,WAAW,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;IACrD,CAAC;IAED,yCAAyC;IACzC,wDAAwD;IACxD,oCAAoC;IACpC,oDAAoD;IACpD,iCAAiC;IACjC,cAAc;IACd,mCAAmC;IACnC,iDAAiD;IACjD,4BAA4B;IAC5B,mDAAmD;IACnD,aAAa;IACb,QAAQ;IACR,kEAAkE;IAClE,uBAAuB;IACvB,SAAS;IACT,oBAAoB;IACpB,IAAI;IAEJ,kCAAkC;IAElC,MAAM,CAAC,WAAW;QACd,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;YACnB,OAAO,KAAK,CAAA;QAChB,CAAC;QACD,OAAO,MAAM,CAAC,QAAQ,CAAA;IAC1B,CAAC;IAED,MAAM,CAAC,cAAc,CAAC,OAAe;QACjC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;YACnB,MAAM,CAAC,QAAQ,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,CAAA;QACzC,CAAC;QACD,OAAO,MAAM,CAAC,QAAQ,CAAA;IAC1B,CAAC;CACJ;AA7RD,wBA6RC"}
@@ -1,5 +1,6 @@
1
1
  import { Contract, TransactionReceipt } from 'ethers';
2
2
  import { IBCConnectWalletOptions, IPayOptions, XmTransactionResponse } from './interfaces';
3
+ import { NonceAccount } from '@solana/web3.js';
3
4
  export declare abstract class DefaultChain {
4
5
  provider: any;
5
6
  name: string;
@@ -129,7 +130,7 @@ export interface IDefaultChainLocal extends DefaultChain {
129
130
  sendTransaction: (signed_tx: any) => Promise<XmTransactionResponse>;
130
131
  }
131
132
  /**
132
- * Base methods for the EVM Default Chain SDK
133
+ * Extension methods for the EVM Default Chain SDK
133
134
  */
134
135
  export interface IEVMDefaultChain {
135
136
  contracts: Map<string, Contract>;
@@ -144,7 +145,27 @@ export interface IEVMDefaultChain {
144
145
  listenForAllEvents: (contract: string, abi: any[]) => Promise<any>;
145
146
  waitForReceipt: (tx_hash: string) => Promise<TransactionReceipt>;
146
147
  }
148
+ /**
149
+ * Extension methods for IBC
150
+ */
147
151
  export interface IBCDefaultChain extends DefaultChain {
148
152
  connectWallet(privateKey: string, options: IBCConnectWalletOptions): Promise<any>;
149
153
  ibcSend: () => Promise<any>;
150
154
  }
155
+ /**
156
+ * Extension methods for Solana
157
+ */
158
+ export interface SolanaDefaultChain extends DefaultChain {
159
+ /**
160
+ * Creates a Nonce account
161
+ *
162
+ * @returns Address of the nonce account
163
+ */
164
+ createNonceAccount: () => Promise<string>;
165
+ /**
166
+ *
167
+ * @param address The address of the nonce account
168
+ * @returns The latest nonce as a 32-byte (base58-encoded) nonce string or null
169
+ */
170
+ readNonce: (address: string) => Promise<NonceAccount | null>;
171
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"defaultChain.js","sourceRoot":"","sources":["../../../../../src/multichain/core/types/defaultChain.ts"],"names":[],"mappings":";;;AAOA,MAAsB,YAAY;IAQ9B,sDAAsD;IACtD,6DAA6D;IAC7D,wDAAwD;IACxD,4CAA4C;IAC5C,YAAY,OAAe;QAX3B,aAAQ,GAAQ,IAAI,CAAA;QACpB,SAAI,GAAW,EAAE,CAAA;QACjB,WAAM,GAAQ,IAAI,CAAA;QAClB,WAAM,GAAQ,IAAI,CAAA;QAClB,YAAO,GAAW,EAAE,CAAA;QACpB,cAAS,GAAY,KAAK,CAAA;QAOtB,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;IACxB,CA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MAAM,QAAQ,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,CAAA;QAClC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;QAExB,IAAI,OAAO,EAAE,CAAC;YACV,MAAM,QAAQ,CAAC,OAAO,EAAE,CAAA;QAC5B,CAAC;QAED,OAAO,QAAQ,CAAA;IACnB,CAAC;IAED;;OAEG;IACO,aAAa;QACnB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAA;QACpB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAA;QAClB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAA;QAClB,IAAI,CAAC,SAAS,GAAG,KAAK,CAAA;IAC1B,CAAC;CA6GJ;AAhKD,oCAgKC"}
@@ -1,3 +1,4 @@
1
+ import { pki } from "node-forge";
1
2
  export interface BlockContent {
2
3
  ordered_transactions: string[];
3
4
  per_address_transactions: Map<string, string[]>;
@@ -5,3 +6,11 @@ export interface BlockContent {
5
6
  previousHash: string;
6
7
  timestamp: number;
7
8
  }
9
+ export interface Block {
10
+ number: number;
11
+ hash: string;
12
+ content: BlockContent;
13
+ status: "derived" | "confirmed";
14
+ proposer: pki.PublicKey | pki.ed25519.BinaryBuffer;
15
+ validation_data: any;
16
+ }
@@ -2,7 +2,7 @@ export { GenesisArtifact, GenesisImmutableProperties, GenesisMutableProperties,
2
2
  export { ISignature } from './blockchain/ISignature';
3
3
  export { TxFee } from './blockchain/TxFee';
4
4
  export { ValidityData } from './blockchain/ValidityData';
5
- export { BlockContent } from './blockchain/blocks';
5
+ export { BlockContent, Block } from './blockchain/blocks';
6
6
  export { Transaction, TransactionContent, XMPayload, Web2Payload, NativePayload, StringifiedPayload } from './blockchain/Transaction';
7
7
  export { RawTransaction } from './blockchain/rawTransaction';
8
8
  export { Bundle, BundleContent } from './communication/transmit';
@@ -0,0 +1,4 @@
1
+ export declare function ObjectToHex(obj: any): Promise<string>;
2
+ export declare function HexToObject(hex: string): Promise<any>;
3
+ export declare function ForgeToHex(forgeBuffer: any): string;
4
+ export declare function HexToForge(forgeString: string): Uint8Array;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HexToForge = exports.ForgeToHex = exports.HexToObject = exports.ObjectToHex = void 0;
4
+ async function ObjectToHex(obj) {
5
+ return Buffer.from(JSON.stringify(obj)).toString('hex');
6
+ }
7
+ exports.ObjectToHex = ObjectToHex;
8
+ async function HexToObject(hex) {
9
+ return JSON.parse(Buffer.from(hex, 'hex').toString('utf8'));
10
+ }
11
+ exports.HexToObject = HexToObject;
12
+ /* REVIEW Could we possibly ditch the below functions? */
13
+ // INFO forgeBuffer comes in as the raw result of forge methods
14
+ function ForgeToHex(forgeBuffer) {
15
+ console.log("[forge to string encoded]");
16
+ //console.log(forgeBuffer)
17
+ let rebuffer = Buffer.from(forgeBuffer);
18
+ forgeBuffer = rebuffer.toString("hex");
19
+ console.log("DECODED INTO:");
20
+ console.log("0x" + forgeBuffer);
21
+ return "0x" + forgeBuffer;
22
+ }
23
+ exports.ForgeToHex = ForgeToHex;
24
+ // INFO finalArray must come out as an acceptable input for forge methods
25
+ // NOTE The above and the below must be revertible with each other
26
+ function HexToForge(forgeString) {
27
+ forgeString = forgeString.slice(2);
28
+ let finalArray = new Uint8Array(64);
29
+ console.log("[string to forge encoded]");
30
+ //console.log(forgeString)
31
+ for (let i = 0; i < forgeString.length; i += 2) {
32
+ const hexValue = forgeString.substr(i, 2);
33
+ const decimalValue = parseInt(hexValue, 16);
34
+ finalArray[i / 2] = decimalValue;
35
+ }
36
+ console.log("ENCODED INTO:");
37
+ //console.log(finalArray)
38
+ return finalArray;
39
+ }
40
+ exports.HexToForge = HexToForge;
41
+ //# sourceMappingURL=dataManipulation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dataManipulation.js","sourceRoot":"","sources":["../../../src/utils/dataManipulation.ts"],"names":[],"mappings":";;;AAAO,KAAK,UAAU,WAAW,CAAC,GAAQ;IACx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,QAAQ,EAAE,EAAE,CAAC,CAAA;QAC3C,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,YAAY,CAAA;IACpC,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAA;IAC5B,yBAAyB;IACzB,OAAO,UAAU,CAAA;AACrB,CAAC;AAbD,gCAaC"}
@@ -0,0 +1 @@
1
+ export * as dataManipulation from './dataManipulation';
@@ -0,0 +1,28 @@
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.dataManipulation = void 0;
27
+ exports.dataManipulation = __importStar(require("./dataManipulation"));
28
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uEAAsD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kynesyslabs/demosdk",
3
- "version": "1.0.15",
3
+ "version": "1.0.17",
4
4
  "main": "build/index.js",
5
5
  "types": "build/index.d.ts",
6
6
  "author": "Kynesys Labs",
@@ -19,7 +19,7 @@
19
19
  "scripts": {
20
20
  "build": "rm -rf build && tsc && resolve-tspaths && mv build/src/* build/ && rm -rf build/src",
21
21
  "publish": "yarn npm publish",
22
- "test:multichain": "rm -rf build && jest --testMatch '**/tests/**/*.ts' --testPathIgnorePatterns **/tests/**/chainProvider* **/tests/utils/* **/tests/**/template* --verbose"
22
+ "test:multichain": "rm -rf build && jest --testMatch '**/tests/**/sol*.ts' --testPathIgnorePatterns **/tests/**/chainProvider* **/tests/utils/* **/tests/**/template* --verbose"
23
23
  },
24
24
  "dependencies": {
25
25
  "@cosmjs/proto-signing": "^0.32.3",
@@ -29,8 +29,10 @@
29
29
  "@multiversx/sdk-network-providers": "^2.4.3",
30
30
  "@multiversx/sdk-wallet": "^4.4.0",
31
31
  "@solana/web3.js": "^1.91.7",
32
+ "bs58": "^5.0.0",
32
33
  "ethers": "^6.11.1",
33
34
  "node-forge": "^1.3.1",
35
+ "node-seal": "^5.1.3",
34
36
  "socket.io-client": "^4.7.2",
35
37
  "xrpl": "^3.0.0"
36
38
  },