@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.
- package/README.md +29 -28
- package/build/types/Operation.d.ts +11 -1
- package/build/types/StateChange.d.ts +19 -0
- package/build/types/StateChange.js +13 -0
- package/build/types/StateChange.js.map +1 -0
- package/build/types/Transaction.d.ts +11 -1
- package/build/types/TransactionContent.d.ts +1 -13
- package/build/types/addressInfo.d.ts +6 -0
- package/build/types/addressInfo.js +3 -0
- package/build/types/addressInfo.js.map +1 -0
- package/build/types/blocks.d.ts +7 -0
- package/build/types/blocks.js +13 -0
- package/build/types/blocks.js.map +1 -0
- package/build/types/communication/transmit.d.ts +14 -0
- package/build/types/communication/transmit.js +13 -0
- package/build/types/communication/transmit.js.map +1 -0
- package/build/types/genesisTypes.d.ts +29 -0
- package/build/types/genesisTypes.js +4 -0
- package/build/types/genesisTypes.js.map +1 -0
- package/build/types/index.d.ts +14 -4
- package/build/types/network/ExecutionResult.d.ts +7 -0
- package/build/types/network/ExecutionResult.js +3 -0
- package/build/types/network/ExecutionResult.js.map +1 -0
- package/build/types/network/SecurityTypes.d.ts +15 -0
- package/build/types/network/SecurityTypes.js +3 -0
- package/build/types/network/SecurityTypes.js.map +1 -0
- package/build/types/peers/Peer.d.ts +6 -0
- package/build/types/peers/Peer.js +13 -0
- package/build/types/peers/Peer.js.map +1 -0
- package/build/types/rawTransaction.d.ts +16 -0
- package/build/types/rawTransaction.js +13 -0
- package/build/types/rawTransaction.js.map +1 -0
- package/build/types/statusNative.d.ts +6 -0
- package/build/types/statusNative.js +3 -0
- package/build/types/statusNative.js.map +1 -0
- package/build/types/statusProperties.d.ts +8 -0
- package/build/types/statusProperties.js +3 -0
- package/build/types/statusProperties.js.map +1 -0
- package/build/types/web2/index.d.ts +49 -0
- package/build/types/web2/index.js +3 -0
- package/build/types/web2/index.js.map +1 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -1,48 +1,50 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @kynesyslabs/demosdk
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Demos SDKs metapackage
|
|
4
4
|
|
|
5
|
-
|
|
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
|
-
|
|
10
|
+
### Adding stuff
|
|
18
11
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
-
|
|
27
|
+
### Running tests
|
|
37
28
|
|
|
38
29
|
```sh
|
|
39
30
|
# multichain
|
|
40
31
|
yarn test:multichain
|
|
41
32
|
```
|
|
42
33
|
|
|
43
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 @@
|
|
|
1
|
+
{"version":3,"file":"addressInfo.js","sourceRoot":"","sources":["../../../src/types/addressInfo.ts"],"names":[],"mappings":""}
|
|
@@ -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,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 @@
|
|
|
1
|
+
{"version":3,"file":"genesisTypes.js","sourceRoot":"","sources":["../../../src/types/genesisTypes.ts"],"names":[],"mappings":";AAAA,qBAAqB"}
|
package/build/types/index.d.ts
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
|
-
export {
|
|
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 @@
|
|
|
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 @@
|
|
|
1
|
+
{"version":3,"file":"SecurityTypes.js","sourceRoot":"","sources":["../../../../src/types/network/SecurityTypes.ts"],"names":[],"mappings":""}
|
|
@@ -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 @@
|
|
|
1
|
+
{"version":3,"file":"statusNative.js","sourceRoot":"","sources":["../../../src/types/statusNative.ts"],"names":[],"mappings":""}
|
|
@@ -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 @@
|
|
|
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.
|
|
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": {
|