@kynesyslabs/demosdk 1.0.4 → 1.0.6

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 (42) hide show
  1. package/README.md +29 -28
  2. package/build/types/Operation.d.ts +11 -1
  3. package/build/types/StateChange.d.ts +19 -0
  4. package/build/types/StateChange.js +13 -0
  5. package/build/types/StateChange.js.map +1 -0
  6. package/build/types/Transaction.d.ts +11 -1
  7. package/build/types/TransactionContent.d.ts +1 -13
  8. package/build/types/addressInfo.d.ts +6 -0
  9. package/build/types/addressInfo.js +3 -0
  10. package/build/types/addressInfo.js.map +1 -0
  11. package/build/types/blocks.d.ts +7 -0
  12. package/build/types/blocks.js +13 -0
  13. package/build/types/blocks.js.map +1 -0
  14. package/build/types/communication/transmit.d.ts +14 -0
  15. package/build/types/communication/transmit.js +13 -0
  16. package/build/types/communication/transmit.js.map +1 -0
  17. package/build/types/genesisTypes.d.ts +29 -0
  18. package/build/types/genesisTypes.js +4 -0
  19. package/build/types/genesisTypes.js.map +1 -0
  20. package/build/types/index.d.ts +14 -4
  21. package/build/types/network/ExecutionResult.d.ts +7 -0
  22. package/build/types/network/ExecutionResult.js +3 -0
  23. package/build/types/network/ExecutionResult.js.map +1 -0
  24. package/build/types/network/SecurityTypes.d.ts +15 -0
  25. package/build/types/network/SecurityTypes.js +3 -0
  26. package/build/types/network/SecurityTypes.js.map +1 -0
  27. package/build/types/peers/Peer.d.ts +6 -0
  28. package/build/types/peers/Peer.js +13 -0
  29. package/build/types/peers/Peer.js.map +1 -0
  30. package/build/types/rawTransaction.d.ts +16 -0
  31. package/build/types/rawTransaction.js +13 -0
  32. package/build/types/rawTransaction.js.map +1 -0
  33. package/build/types/statusNative.d.ts +6 -0
  34. package/build/types/statusNative.js +3 -0
  35. package/build/types/statusNative.js.map +1 -0
  36. package/build/types/statusProperties.d.ts +8 -0
  37. package/build/types/statusProperties.js +3 -0
  38. package/build/types/statusProperties.js.map +1 -0
  39. package/build/types/web2/index.d.ts +49 -0
  40. package/build/types/web2/index.js +3 -0
  41. package/build/types/web2/index.js.map +1 -0
  42. package/package.json +2 -1
package/README.md CHANGED
@@ -1,48 +1,50 @@
1
- # DEMOS SDKs
1
+ # @kynesyslabs/demosdk
2
2
 
3
- This repo contains all the Demos SDKs
3
+ Demos SDKs metapackage
4
4
 
5
- ## Usage
6
-
7
- ### Core
8
-
9
- TODO: Update once ported.
10
-
11
- ### Multichain SDKs
5
+ ### Multichain SDKs Usage
12
6
 
13
7
  Check out the [multichain documentation](./documentation/multichain/README.md).
14
8
 
15
- ## Organization
16
9
 
17
- The packages are structured like this:
10
+ ### Adding stuff
18
11
 
19
- ```sh
20
- ./src
21
- ├── core # blockchain interface stuff <todo: port from frontend>
22
-
23
- ├── types # shared types
24
-
25
- ├── multichain
26
- │   ├── core # default chain sdk implementation for all chains
27
- │   ├── localsdk # local sdks for all chains
28
- │   └── websdk # web sdks for all chains
12
+ Create a new folder in the `src` directory and add your stuff. Export items on the `index.ts` file in your new folder. Then add an export entry in `package.json` as shown:
13
+
14
+ ```json
15
+ "exports": {
16
+ // ...
17
+ "./stuff": "./build/stuff/index.js"
18
+ }
29
19
  ```
30
20
 
31
- ## Development setup
32
- ```sh
33
- yarn install
21
+ This will allow users to use the new things as follows:
22
+
23
+ ```js
24
+ import { Stuff, otherStuff } from '@kynesyslabs/demosdk/stuff'
34
25
  ```
35
26
 
36
- ## Running tests
27
+ ### Running tests
37
28
 
38
29
  ```sh
39
30
  # multichain
40
31
  yarn test:multichain
41
32
  ```
42
33
 
43
- ## Publishing on NPM
34
+ ### Publishing on NPM
35
+
36
+ Publishing to NPM is automated using a Github Workflow. To publish a new version:
37
+
38
+ 1. Incrememt the `package.json` version field
39
+ 2. Commit your changes with a message starting with the word `release`
40
+ 3. Push to Github.
41
+
42
+ ```sh
43
+ # Example:
44
+ git commit -m "release v1.0.5"
45
+ ```
44
46
 
45
- TODO!
47
+ The commit will trigger a workflow run to build the files and publish a new version on NPM.
46
48
 
47
49
  ## What has Changed?
48
50
 
@@ -56,4 +58,3 @@ new: `rpc_url`, `chain_id`, `isEIP1559`
56
58
  ## TODOs
57
59
 
58
60
  - Review `getBalance` return type. Should it be a string or an object?
59
- -
@@ -2,10 +2,20 @@ import { TxFee } from "./TxFee";
2
2
  export interface Operation {
3
3
  operator: string;
4
4
  actor: string;
5
- params: {};
5
+ params: any;
6
6
  hash: string;
7
7
  nonce: number;
8
8
  timestamp: number;
9
9
  status: boolean | "pending";
10
10
  fees: TxFee;
11
11
  }
12
+ export interface OperationResult {
13
+ success: boolean;
14
+ message: string;
15
+ }
16
+ export interface OperationRegistrySlot {
17
+ operation: Operation;
18
+ status: boolean | "pending";
19
+ result: OperationResult;
20
+ timestamp: number;
21
+ }
@@ -0,0 +1,19 @@
1
+ import forge from "node-forge";
2
+ interface TokenTransfer {
3
+ address: string;
4
+ amount: number;
5
+ }
6
+ interface NFTTransfer {
7
+ address: string;
8
+ tokenId: string;
9
+ amount: number;
10
+ }
11
+ export interface StateChange {
12
+ sender: forge.pki.ed25519.BinaryBuffer;
13
+ receiver: forge.pki.ed25519.BinaryBuffer;
14
+ nativeAmount: number;
15
+ tx_hash: string;
16
+ token: TokenTransfer;
17
+ nft: NFTTransfer;
18
+ }
19
+ export {};
@@ -0,0 +1,13 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ //# sourceMappingURL=StateChange.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StateChange.js","sourceRoot":"","sources":["../../../src/types/StateChange.ts"],"names":[],"mappings":";AAAA;;;;;;;;;EASE"}
@@ -1,6 +1,16 @@
1
1
  import { ISignature } from "./ISignature";
2
- import { TransactionContent } from "./TransactionContent";
3
2
  import * as forge from "node-forge";
3
+ import { TxFee } from "./TxFee";
4
+ export interface TransactionContent {
5
+ type: string;
6
+ from: forge.pki.ed25519.BinaryBuffer | forge.pki.PublicKey | ISignature;
7
+ to: forge.pki.ed25519.BinaryBuffer | forge.pki.PrivateKey | ISignature;
8
+ amount: number;
9
+ data: [string, string];
10
+ nonce: number;
11
+ timestamp: number;
12
+ transaction_fee: TxFee;
13
+ }
4
14
  export interface Transaction {
5
15
  content: TransactionContent;
6
16
  signature: ISignature | forge.pki.ed25519.BinaryBuffer;
@@ -1,13 +1 @@
1
- import forge from 'node-forge';
2
- import { TxFee } from './TxFee';
3
- import { ISignature } from './ISignature';
4
- export interface TransactionContent {
5
- type: string;
6
- from: forge.pki.ed25519.BinaryBuffer | forge.pki.PublicKey | ISignature;
7
- to: forge.pki.ed25519.BinaryBuffer | forge.pki.PrivateKey | ISignature;
8
- amount: number;
9
- data: [string, string];
10
- nonce: number;
11
- timestamp: number;
12
- transaction_fee: TxFee;
13
- }
1
+ export {};
@@ -0,0 +1,6 @@
1
+ import { StatusNative } from "./statusNative";
2
+ import { statusNative as StatusProperties } from "./statusProperties";
3
+ export default interface AddressInfo {
4
+ native: StatusNative | null;
5
+ properties: StatusProperties | null;
6
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=addressInfo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addressInfo.js","sourceRoot":"","sources":["../../../src/types/addressInfo.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ export interface BlockContent {
2
+ ordered_transactions: string[];
3
+ per_address_transactions: Map<string, string[]>;
4
+ web2data: {};
5
+ previousHash: string;
6
+ timestamp: number;
7
+ }
@@ -0,0 +1,13 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ //# sourceMappingURL=blocks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blocks.js","sourceRoot":"","sources":["../../../src/types/blocks.ts"],"names":[],"mappings":";AAAA;;;;;;;;;EASE"}
@@ -0,0 +1,14 @@
1
+ export interface BundleContent {
2
+ type: string;
3
+ message: string;
4
+ sender: any;
5
+ receiver: any;
6
+ timestamp: number;
7
+ data: any;
8
+ extra: string;
9
+ }
10
+ export interface Bundle {
11
+ content: BundleContent;
12
+ hash: string;
13
+ signature: any;
14
+ }
@@ -0,0 +1,13 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ //# sourceMappingURL=transmit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transmit.js","sourceRoot":"","sources":["../../../../src/types/communication/transmit.ts"],"names":[],"mappings":";AAAA;;;;;;;;;EASE"}
@@ -0,0 +1,29 @@
1
+ export interface GenesisImmutableProperties {
2
+ id: number;
3
+ name: string;
4
+ currency: string;
5
+ }
6
+ export interface GenesisMutableProperties {
7
+ minBlocksForValidationOnlineStatus: number;
8
+ }
9
+ export interface GenesisArtifact {
10
+ properties: GenesisImmutableProperties;
11
+ mutables: GenesisMutableProperties;
12
+ balances: [[address: string, amount: string]];
13
+ timestamp: number;
14
+ previous_genesis_hash: string;
15
+ previous_block_hash: string;
16
+ signature: string;
17
+ hash: string;
18
+ number: number;
19
+ }
20
+ export interface StandardGenesis {
21
+ properties: GenesisImmutableProperties;
22
+ mutables: GenesisMutableProperties;
23
+ balances: [[address: string, amount: string]];
24
+ timestamp: number;
25
+ }
26
+ export interface forkGenesis extends StandardGenesis {
27
+ previous_genesis_hash: string;
28
+ previous_block_hash: string;
29
+ }
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ // SECTION Primitives
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ //# sourceMappingURL=genesisTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"genesisTypes.js","sourceRoot":"","sources":["../../../src/types/genesisTypes.ts"],"names":[],"mappings":";AAAA,qBAAqB"}
@@ -1,6 +1,16 @@
1
- export { ISignature } from './ISignature';
2
- export { Operation } from './Operation';
3
- export { Transaction } from './Transaction';
4
- export { TransactionContent } from './TransactionContent';
1
+ export { GenesisArtifact, GenesisImmutableProperties, GenesisMutableProperties, StandardGenesis, forkGenesis, } from './genesisTypes';
5
2
  export { TxFee } from './TxFee';
3
+ export { BlockContent } from './blocks';
4
+ export { ISignature } from './ISignature';
5
+ export { StateChange } from './StateChange';
6
6
  export { ValidityData } from './ValidityData';
7
+ export { RawTransaction } from './rawTransaction';
8
+ export { Bundle, BundleContent } from './communication/transmit';
9
+ export { Transaction, TransactionContent } from './Transaction';
10
+ export { StatusNative } from './statusNative';
11
+ export { statusNative as StatusProperties } from './statusProperties';
12
+ export { Operation, OperationRegistrySlot, OperationResult } from './Operation';
13
+ export { ISecurityReport, SIComlink, SIResponseRegistry, } from './network/SecurityTypes';
14
+ export { ExecutionResult } from './network/ExecutionResult';
15
+ export { IPeerConfig } from './peers/Peer';
16
+ export { IParam, IWeb2Payload, IWeb2Request, IWeb2Result, IRawWeb2Request, IWeb2Attestation, } from './web2';
@@ -0,0 +1,7 @@
1
+ import { Operation } from "../Operation";
2
+ export interface ExecutionResult {
3
+ response: any;
4
+ extra: any;
5
+ require_reply: boolean;
6
+ operations?: Operation[];
7
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=ExecutionResult.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExecutionResult.js","sourceRoot":"","sources":["../../../../src/types/network/ExecutionResult.ts"],"names":[],"mappings":""}
@@ -0,0 +1,15 @@
1
+ export interface ISecurityReport {
2
+ state: boolean;
3
+ code: string;
4
+ message: string;
5
+ }
6
+ export interface SIResponseRegistry {
7
+ prune_interval: number;
8
+ }
9
+ export interface SIComlink {
10
+ rate_limit_size: number;
11
+ rate_limit_time: number;
12
+ rate_limit_bin: number;
13
+ rate_limit_timestamp: number;
14
+ checkRateLimits: Function;
15
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=SecurityTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SecurityTypes.js","sourceRoot":"","sources":["../../../../src/types/network/SecurityTypes.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ import { Socket } from "socket.io-client";
2
+ export interface IPeerConfig {
3
+ connectionString?: string;
4
+ socket?: Socket;
5
+ identity?: string;
6
+ }
@@ -0,0 +1,13 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ //# sourceMappingURL=Peer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Peer.js","sourceRoot":"","sources":["../../../../src/types/peers/Peer.ts"],"names":[],"mappings":";AAAA;;;;;;;;;EASE"}
@@ -0,0 +1,16 @@
1
+ export interface RawTransaction {
2
+ blockNumber: number;
3
+ signature: string;
4
+ status: string;
5
+ hash: string;
6
+ content: NonNullable<string>;
7
+ type: string;
8
+ from: any;
9
+ to: any;
10
+ amount: number;
11
+ nonce: number;
12
+ timestamp: number;
13
+ networkFee: number;
14
+ rpcFee: number;
15
+ additionalFee: number;
16
+ }
@@ -0,0 +1,13 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ //# sourceMappingURL=rawTransaction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rawTransaction.js","sourceRoot":"","sources":["../../../src/types/rawTransaction.ts"],"names":[],"mappings":";AAAA;;;;;;;;;EASE"}
@@ -0,0 +1,6 @@
1
+ export interface StatusNative {
2
+ address: string;
3
+ balance: number;
4
+ nonce: number;
5
+ tx_list: string;
6
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=statusNative.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"statusNative.js","sourceRoot":"","sources":["../../../src/types/statusNative.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ export interface statusNative {
2
+ address: string;
3
+ tokens: string;
4
+ nfts: string;
5
+ xm: string;
6
+ web2: string;
7
+ other: string;
8
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=statusProperties.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"statusProperties.js","sourceRoot":"","sources":["../../../src/types/statusProperties.ts"],"names":[],"mappings":""}
@@ -0,0 +1,49 @@
1
+ import forge from "node-forge";
2
+ export interface IParam {
3
+ name: string;
4
+ value: any;
5
+ }
6
+ export interface IWeb2Payload {
7
+ type: "web2Request";
8
+ message: IWeb2Request;
9
+ sender: any;
10
+ receiver: any;
11
+ timestamp: any;
12
+ data: any;
13
+ extra: any;
14
+ }
15
+ export interface IWeb2Result {
16
+ status: number;
17
+ statusText: string;
18
+ data: any;
19
+ }
20
+ export interface IWeb2Request {
21
+ raw: IRawWeb2Request;
22
+ result: any;
23
+ attestations: {};
24
+ hash: string;
25
+ signature?: forge.pki.ed25519.BinaryBuffer;
26
+ }
27
+ export interface IRawWeb2Request {
28
+ action: string;
29
+ parameters: IParam[];
30
+ requestedParameters: [] | null;
31
+ method: "POST" | "GET" | "PUT" | "DELETE" | "PATCH";
32
+ url: string;
33
+ headers: any;
34
+ minAttestations: number;
35
+ stage: {
36
+ origin: {
37
+ identity: forge.pki.ed25519.BinaryBuffer;
38
+ connection_url: string;
39
+ };
40
+ hop_number: number;
41
+ };
42
+ }
43
+ export interface IWeb2Attestation {
44
+ hash: string;
45
+ timestamp: number;
46
+ identity: forge.pki.PublicKey;
47
+ signature: forge.pki.ed25519.BinaryBuffer;
48
+ valid: boolean;
49
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/types/web2/index.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kynesyslabs/demosdk",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "main": "build/index.js",
5
5
  "types": "build/index.d.ts",
6
6
  "author": "Kynesys Labs",
@@ -29,6 +29,7 @@
29
29
  "@multiversx/sdk-wallet": "^4.4.0",
30
30
  "ethers": "^6.11.1",
31
31
  "node-forge": "^1.3.1",
32
+ "socket.io-client": "^4.7.2",
32
33
  "xrpl": "^3.0.0"
33
34
  },
34
35
  "devDependencies": {