saito-js 0.0.5 → 0.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 (58) hide show
  1. package/package.json +1 -1
  2. package/.github/workflows/publish.yml +0 -50
  3. package/.prettierrc.json +0 -3
  4. package/babel.config.json +0 -13
  5. package/configs.ts +0 -26
  6. package/index.node.ts +0 -51
  7. package/index.web.ts +0 -47
  8. package/lib/block.ts +0 -42
  9. package/lib/blockchain.ts +0 -14
  10. package/lib/custom/custom_shared_methods.ts +0 -92
  11. package/lib/custom/shared_methods.web.ts +0 -123
  12. package/lib/factory.ts +0 -32
  13. package/lib/peer.ts +0 -50
  14. package/lib/saito_factory.ts +0 -18
  15. package/lib/slip.ts +0 -119
  16. package/lib/transaction.ts +0 -179
  17. package/lib/wallet.ts +0 -61
  18. package/saito.ts +0 -404
  19. package/shared_methods.ts +0 -40
  20. package/tests/index.test.ts +0 -35
  21. package/tsconfig.json +0 -111
  22. package/tsconfig.testing.json +0 -19
  23. package/webpack.config.js +0 -136
  24. package/webpack.prod.config.js +0 -136
  25. /package/{dist/browser → browser}/index.js +0 -0
  26. /package/{dist/configs.d.ts → configs.d.ts} +0 -0
  27. /package/{dist/configs.d.ts.map → configs.d.ts.map} +0 -0
  28. /package/{dist/index.node.d.ts → index.node.d.ts} +0 -0
  29. /package/{dist/index.node.d.ts.map → index.node.d.ts.map} +0 -0
  30. /package/{dist/index.web.d.ts → index.web.d.ts} +0 -0
  31. /package/{dist/index.web.d.ts.map → index.web.d.ts.map} +0 -0
  32. /package/{dist/lib → lib}/block.d.ts +0 -0
  33. /package/{dist/lib → lib}/block.d.ts.map +0 -0
  34. /package/{dist/lib → lib}/blockchain.d.ts +0 -0
  35. /package/{dist/lib → lib}/blockchain.d.ts.map +0 -0
  36. /package/{dist/lib → lib}/custom/custom_shared_methods.d.ts +0 -0
  37. /package/{dist/lib → lib}/custom/custom_shared_methods.d.ts.map +0 -0
  38. /package/{dist/lib → lib}/custom/shared_methods.web.d.ts +0 -0
  39. /package/{dist/lib → lib}/custom/shared_methods.web.d.ts.map +0 -0
  40. /package/{dist/lib → lib}/factory.d.ts +0 -0
  41. /package/{dist/lib → lib}/factory.d.ts.map +0 -0
  42. /package/{dist/lib → lib}/peer.d.ts +0 -0
  43. /package/{dist/lib → lib}/peer.d.ts.map +0 -0
  44. /package/{dist/lib → lib}/saito_factory.d.ts +0 -0
  45. /package/{dist/lib → lib}/saito_factory.d.ts.map +0 -0
  46. /package/{dist/lib → lib}/slip.d.ts +0 -0
  47. /package/{dist/lib → lib}/slip.d.ts.map +0 -0
  48. /package/{dist/lib → lib}/transaction.d.ts +0 -0
  49. /package/{dist/lib → lib}/transaction.d.ts.map +0 -0
  50. /package/{dist/lib → lib}/wallet.d.ts +0 -0
  51. /package/{dist/lib → lib}/wallet.d.ts.map +0 -0
  52. /package/{dist/saito.d.ts → saito.d.ts} +0 -0
  53. /package/{dist/saito.d.ts.map → saito.d.ts.map} +0 -0
  54. /package/{dist/server → server}/index.js +0 -0
  55. /package/{dist/shared_methods.d.ts → shared_methods.d.ts} +0 -0
  56. /package/{dist/shared_methods.d.ts.map → shared_methods.d.ts.map} +0 -0
  57. /package/{dist/tests → tests}/index.test.d.ts +0 -0
  58. /package/{dist/tests → tests}/index.test.d.ts.map +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "saito-js",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "description": "js wrappings around saito-core using wasm",
5
5
  "scripts": {
6
6
  "test": "env TS_NODE_PROJECT=\"tsconfig.testing.json\" mocha --require ts-node/register 'tests/**/*.ts'",
@@ -1,50 +0,0 @@
1
- name: publish
2
-
3
- on:
4
- push:
5
- branches: [ prod, master ]
6
- pull_request:
7
- branches: [ develop, master ]
8
-
9
- jobs:
10
- publish:
11
- runs-on: ubuntu-latest
12
- steps:
13
- - name: checkout repo
14
- uses: actions/Checkout@v3
15
-
16
- - name: setup node
17
- uses: actions/setup-node@v3
18
- with:
19
- node-version: '16.x'
20
- registry-url: 'https://registry.npmjs.org'
21
- cache: npm
22
- # cache-dependency-path: saito-wasm/package-lock.json
23
-
24
- - name: get latest version
25
- run: |
26
- echo latest_version=$(npm show saito-js version) >> $GITHUB_ENV
27
- echo current_version=$(npm pkg get version) >> $GITHUB_ENV
28
- # working-directory: saito-wasm
29
- - name: version check
30
- if: ${{ env.latest_version == env.current_version }}
31
- run: |
32
- echo "same version is already published"
33
- echo "current version : ${{ env.current_version }}"
34
- echo "published version : ${{ env.latest_version }}"
35
-
36
- - name: Install npm packages
37
- if: ${{ env.latest_version != env.current_version }}
38
- run: npm ci
39
- # working-directory: saito-wasm
40
-
41
- - name: build
42
- if: ${{ env.latest_version != env.current_version }}
43
- run: npm run build
44
-
45
- - name: Publish package
46
- if: ${{ env.latest_version != env.current_version }}
47
- run: npm publish
48
- env:
49
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
50
- # working-directory: saito-wasm
package/.prettierrc.json DELETED
@@ -1,3 +0,0 @@
1
- {
2
- "printWidth": 100
3
- }
package/babel.config.json DELETED
@@ -1,13 +0,0 @@
1
- {
2
- "presets": [
3
- [
4
- "@babel/preset-env",
5
- {
6
- "targets": {
7
- "node": "current"
8
- }
9
- }
10
- ],
11
- "@babel/preset-typescript"
12
- ]
13
- }
package/configs.ts DELETED
@@ -1,26 +0,0 @@
1
- type Configs = {
2
- server: {
3
- host: string,
4
- port: number,
5
- protocol: string,
6
- endpoint: {
7
- host: string,
8
- port: number,
9
- protocol: string,
10
- },
11
- verification_threads: number,
12
- channel_size: number,
13
- stat_timer_in_ms: number,
14
- reconnection_wait_time: number,
15
- thread_sleep_time_in_ms: number,
16
- block_fetch_batch_size: number,
17
- },
18
- peers: {
19
- host: string,
20
- port: number,
21
- protocol: string,
22
- synctype: string
23
- }[]
24
- };
25
-
26
- export default Configs;
package/index.node.ts DELETED
@@ -1,51 +0,0 @@
1
- import Saito from "./saito";
2
- import SharedMethods from "./shared_methods";
3
- import Configs from "./configs";
4
- import Transaction from "./lib/transaction";
5
- import Slip from "./lib/slip";
6
- import Block from "./lib/block";
7
- import Peer from "./lib/peer";
8
- import Factory from "./lib/factory";
9
- import Wallet from "./lib/wallet";
10
- import Blockchain from "./lib/blockchain";
11
-
12
- const NODE_MAJOR_VERSION = parseInt(process.versions.node.split(".")[0]);
13
- if (NODE_MAJOR_VERSION < 20) {
14
- let cr = require("crypto");
15
- globalThis.crypto = cr.webcrypto;
16
- }
17
-
18
- /**
19
- *
20
- * @param configs
21
- * @param sharedMethods
22
- */
23
- export async function initialize(
24
- configs: Configs,
25
- sharedMethods: SharedMethods,
26
- factory: Factory,
27
- privateKey: string
28
- ) {
29
- if (Saito.getLibInstance()) {
30
- console.error("saito already initialized");
31
- return;
32
- }
33
- console.log("initializing saito-js");
34
- let saito = await import("saito-wasm/dist/server");
35
- console.log("wasm lib loaded");
36
-
37
- let s = await saito.default;
38
-
39
- Saito.setLibInstance(s);
40
-
41
- Transaction.Type = s.WasmTransaction;
42
- Slip.Type = s.WasmSlip;
43
- Block.Type = s.WasmBlock;
44
- Peer.Type = s.WasmPeer;
45
- Wallet.Type = s.WasmWallet;
46
- Blockchain.Type = s.WasmBlockchain;
47
-
48
- return Saito.initialize(configs, sharedMethods, factory, privateKey);
49
- }
50
-
51
- export default Saito;
package/index.web.ts DELETED
@@ -1,47 +0,0 @@
1
- import Saito from "./saito";
2
- import SharedMethods from "./shared_methods";
3
- import Configs from "./configs";
4
- import Transaction from "./lib/transaction";
5
- import Slip from "./lib/slip";
6
- import Block from "./lib/block";
7
- import Peer from "./lib/peer";
8
- import Factory from "./lib/factory";
9
- import Wallet from "./lib/wallet";
10
- import Blockchain from "./lib/blockchain";
11
-
12
- /**
13
- *
14
- * @param configs
15
- * @param sharedMethods
16
- */
17
- export async function initialize(
18
- configs: Configs,
19
- sharedMethods: SharedMethods,
20
- factory: Factory,
21
- privateKey: string
22
- ) {
23
- if (Saito.getLibInstance()) {
24
- console.error("saito already initialized");
25
- return;
26
- }
27
- console.log("initializing saito-js");
28
-
29
- return import("saito-wasm/dist/browser")
30
- .then((s: any) => {
31
- return s.default;
32
- })
33
- .then((s) => {
34
- Saito.setLibInstance(s);
35
- return s.default().then(() => {
36
- Transaction.Type = s.WasmTransaction;
37
- Slip.Type = s.WasmSlip;
38
- Block.Type = s.WasmBlock;
39
- Peer.Type = s.WasmPeer;
40
- Wallet.Type = s.WasmWallet;
41
- Blockchain.Type = s.WasmBlockchain;
42
- return Saito.initialize(configs, sharedMethods, factory, privateKey);
43
- });
44
- });
45
- }
46
-
47
- export default Saito;
package/lib/block.ts DELETED
@@ -1,42 +0,0 @@
1
- import type {WasmBlock} from 'saito-wasm/dist/types/pkg/node/index_bg';
2
- import Transaction from "./transaction";
3
- import Saito from "../saito";
4
-
5
- export enum BlockType {
6
- Ghost = 0,
7
- Header = 1,
8
- Pruned = 2,
9
- Full = 3,
10
- }
11
-
12
-
13
- export default class Block {
14
- protected block: WasmBlock;
15
- public static Type: any;
16
-
17
- constructor(block?: WasmBlock) {
18
- if (block) {
19
- this.block = block;
20
- } else {
21
- this.block = Block.Type();
22
- }
23
- }
24
-
25
- public get transactions(): Array<Transaction> {
26
- return this.block.transactions.map(tx => {
27
- return Saito.getInstance().factory.createTransaction(tx);
28
- });
29
- }
30
-
31
- public get id(): bigint {
32
- return this.block.id;
33
- }
34
-
35
- public get hash(): string {
36
- return this.block.hash;
37
- }
38
-
39
- public serialize(): Uint8Array {
40
- return this.block.serialize();
41
- }
42
- }
package/lib/blockchain.ts DELETED
@@ -1,14 +0,0 @@
1
- import type {WasmBlockchain} from "saito-wasm/dist/types/pkg/node/index_bg";
2
-
3
- export default class Blockchain {
4
- protected blockchain: WasmBlockchain;
5
- public static Type: any;
6
-
7
- constructor(blockchain: WasmBlockchain) {
8
- this.blockchain = blockchain;
9
- }
10
-
11
- public async reset() {
12
- return this.blockchain.reset();
13
- }
14
- }
@@ -1,92 +0,0 @@
1
- import SharedMethods from "../../shared_methods";
2
- import Saito from "../../saito";
3
- import Wallet from "../wallet";
4
- import Blockchain from "../blockchain";
5
-
6
- export default class CustomSharedMethods implements SharedMethods {
7
- processApiCall(buffer: Uint8Array, msgIndex: number, peerIndex: bigint): Promise<void> {
8
- throw new Error("Method not implemented.");
9
- }
10
-
11
- connectToPeer(peerData: any): void {
12
- throw new Error("Method not implemented.");
13
- }
14
-
15
- disconnectFromPeer(peerIndex: bigint): void {
16
- throw new Error("Method not implemented.");
17
- }
18
-
19
- fetchBlockFromPeer(url: string): Promise<Uint8Array> {
20
- throw new Error("Method not implemented.");
21
- }
22
-
23
- isExistingFile(key: string): boolean {
24
- throw new Error("Method not implemented.");
25
- }
26
-
27
- loadBlockFileList(): Array<string> {
28
- throw new Error("Method not implemented.");
29
- }
30
-
31
- processApiError(buffer: Uint8Array, msgIndex: number, peerIndex: bigint): void {
32
- let promise = Saito.getInstance().promises.get(msgIndex);
33
- if (promise) {
34
- promise.reject(buffer);
35
- } else {
36
- console.error(
37
- "callback not found for callback index : " + msgIndex + " from peer : " + peerIndex
38
- );
39
- }
40
- }
41
-
42
- processApiSuccess(buffer: Uint8Array, msgIndex: number, peerIndex: bigint): void {
43
- let promise = Saito.getInstance().promises.get(msgIndex);
44
- if (promise) {
45
- promise.resolve(buffer);
46
- } else {
47
- console.error(
48
- "callback not found for callback index : " + msgIndex + " from peer : " + peerIndex
49
- );
50
- }
51
- }
52
-
53
- readValue(key: string): Uint8Array | null {
54
- throw new Error("Method not implemented.");
55
- }
56
-
57
- removeValue(key: string): void {
58
- throw new Error("Method not implemented.");
59
- }
60
-
61
- sendMessage(peerIndex: bigint, buffer: Uint8Array): void {
62
- throw new Error("Method not implemented.");
63
- }
64
-
65
- sendMessageToAll(buffer: Uint8Array, exceptions: Array<bigint>): void {
66
- throw new Error("Method not implemented.");
67
- }
68
-
69
- writeValue(key: string, value: Uint8Array): void {
70
- throw new Error("Method not implemented.");
71
- }
72
-
73
- sendInterfaceEvent(event: String, peerIndex: bigint): void {
74
- throw new Error("Method not implemented.");
75
- }
76
-
77
- saveWallet(): void {
78
- throw new Error("Method not implemented.");
79
- }
80
-
81
- loadWallet(): void {
82
- throw new Error("Method not implemented.");
83
- }
84
-
85
- saveBlockchain(): void {
86
- throw new Error("Method not implemented.");
87
- }
88
-
89
- loadBlockchain(): void {
90
- throw new Error("Method not implemented.");
91
- }
92
- }
@@ -1,123 +0,0 @@
1
- import Saito from "../../saito";
2
-
3
- import CustomSharedMethods from "./custom_shared_methods";
4
-
5
- export default class WebSharedMethods extends CustomSharedMethods {
6
- connectToPeer(peerData: any): void {
7
- let protocol = "ws";
8
- if (peerData.protocol === "https") {
9
- protocol = "wss";
10
- }
11
- let url = protocol + "://" + peerData.host + ":" + peerData.port + "/wsopen";
12
-
13
- try {
14
- console.log("connecting to " + url + "....");
15
- let socket = new WebSocket(url);
16
- socket.binaryType = "arraybuffer";
17
- let index = Saito.getInstance().addNewSocket(socket);
18
-
19
- socket.onmessage = (event: MessageEvent) => {
20
- // console.log("buffer : ", event.data);
21
- Saito.getLibInstance().process_msg_buffer_from_peer(new Uint8Array(event.data), index);
22
- };
23
-
24
- socket.onopen = () => {
25
- Saito.getLibInstance().process_new_peer(index, peerData);
26
- };
27
- socket.onclose = () => {
28
- Saito.getLibInstance().process_peer_disconnection(index);
29
- };
30
-
31
- console.log("connected to : " + url + " with peer index : " + index);
32
- } catch (e) {
33
- console.error(e);
34
- }
35
- }
36
-
37
- disconnectFromPeer(peerIndex: bigint): void {
38
- Saito.getInstance().removeSocket(peerIndex);
39
- }
40
-
41
- fetchBlockFromPeer(url: string): Promise<Uint8Array> {
42
- return fetch(url)
43
- .then((res: any) => {
44
- return res.arrayBuffer();
45
- })
46
- .then((buffer: ArrayBuffer) => {
47
- return new Uint8Array(buffer);
48
- });
49
- }
50
-
51
- isExistingFile(key: string): boolean {
52
- try {
53
- return !!localStorage.getItem(key);
54
- } catch (error) {
55
- console.error(error);
56
- return false;
57
- }
58
- }
59
-
60
- loadBlockFileList(): Array<string> {
61
- try {
62
- // console.log("loading block file list...");
63
- // let files = Object.keys(localStorage);
64
- // console.log("files : ", files);
65
- // return files;
66
- return [];
67
- } catch (e) {
68
- console.error(e);
69
- return [];
70
- }
71
- }
72
-
73
- readValue(key: string): Uint8Array | null {
74
- try {
75
- let data = localStorage.getItem(key);
76
- if (!data) {
77
- console.log("item not found for key : " + key);
78
- return null;
79
- }
80
- let buffer = Buffer.from(data, "base64");
81
- return new Uint8Array(buffer);
82
- } catch (error) {
83
- console.error(error);
84
- return null;
85
- }
86
- }
87
-
88
- removeValue(key: string): void {
89
- try {
90
- localStorage.removeItem(key);
91
- } catch (e) {
92
- console.error(e);
93
- }
94
- }
95
-
96
- sendMessage(peerIndex: bigint, buffer: Uint8Array): void {
97
- console.debug("sending message to peer : " + peerIndex);
98
- let socket = Saito.getInstance().getSocket(peerIndex);
99
- socket.send(buffer);
100
- }
101
-
102
- sendMessageToAll(buffer: Uint8Array, exceptions: Array<bigint>): void {
103
- console.debug("sending message to all");
104
- Saito.getInstance().sockets.forEach((socket, key) => {
105
- if (exceptions.includes(key)) {
106
- return;
107
- }
108
- socket.send(buffer);
109
- });
110
- }
111
-
112
- writeValue(key: string, value: Uint8Array): void {
113
- try {
114
- localStorage.setItem(key, Buffer.from(value).toString("base64"));
115
- } catch (error) {
116
- console.error(error);
117
- }
118
- }
119
-
120
- sendInterfaceEvent(event: String, peerIndex: bigint) {
121
- throw new Error("Method not implemented.");
122
- }
123
- }
package/lib/factory.ts DELETED
@@ -1,32 +0,0 @@
1
- import Block from "./block";
2
- import Transaction from "./transaction";
3
- import Slip from "./slip";
4
- import Peer from "./peer";
5
- import Wallet from "./wallet";
6
- import Blockchain from "./blockchain";
7
-
8
- export default class Factory {
9
- constructor() {}
10
-
11
- public createBlock(data?: any): Block {
12
- return new Block(data);
13
- }
14
-
15
- public createTransaction<T extends Transaction>(data?: any): Transaction {
16
- return new Transaction(data);
17
- }
18
-
19
- public createSlip(data?: any): Slip {
20
- return new Slip(data);
21
- }
22
-
23
- public createPeer(data?: any): Peer {
24
- return new Peer(data);
25
- }
26
- public createWallet(data: any): Wallet {
27
- return new Wallet(data);
28
- }
29
- public createBlockchain(data: any): Blockchain {
30
- return new Blockchain(data);
31
- }
32
- }
package/lib/peer.ts DELETED
@@ -1,50 +0,0 @@
1
- import type {WasmPeer} from "saito-wasm/dist/types/pkg/node/index_bg";
2
-
3
- export default class Peer {
4
- protected peer: WasmPeer;
5
- public static Type: any;
6
-
7
- constructor(peer?: WasmPeer, peerIndex?: bigint) {
8
- if (peer) {
9
- this.peer = peer;
10
- } else {
11
- this.peer = new Peer.Type(peerIndex);
12
- }
13
- }
14
-
15
- public get publicKey(): string {
16
- return this.peer.public_key;
17
- }
18
-
19
- // public set publicKey(key: string) {
20
- // this.peer.public_key = key;
21
- // }
22
-
23
- public get keyList(): Array<string> {
24
- return this.peer.key_list;
25
- }
26
-
27
- public get peerIndex(): bigint {
28
- return this.peer.peer_index;
29
- }
30
-
31
- public get synctype(): string {
32
- return this.peer.sync_type;
33
- }
34
-
35
- public get services(): string[] {
36
- return this.peer.services;
37
- }
38
-
39
- public set services(s: string[]) {
40
- this.peer.services = s;
41
- }
42
-
43
- public hasService(service: string): boolean {
44
- return this.peer.has_service(service);
45
- }
46
-
47
- public isMainPeer(): boolean {
48
- return this.peer.is_main_peer();
49
- }
50
- }
@@ -1,18 +0,0 @@
1
- // import Factory from "./factory";
2
- // import Block from "./block";
3
- // import Transaction from "./transaction";
4
- // import Slip from "./slip";
5
- //
6
- // export default class SaitoFactory extends Factory {
7
- // public createBlock(data: any): Block {
8
- // return new Block(data);
9
- // }
10
- //
11
- // public createTransaction(data: any): Transaction {
12
- // return new Transaction(data);
13
- // }
14
- //
15
- // public createSlip(data: any): Slip {
16
- // return new Slip(data);
17
- // }
18
- // }
package/lib/slip.ts DELETED
@@ -1,119 +0,0 @@
1
- import type {WasmSlip} from 'saito-wasm/dist/types/pkg/node/index_bg';
2
-
3
- export enum SlipType {
4
- Normal = 0,
5
- ATR = 1,
6
- VipInput = 2,
7
- VipOutput = 3,
8
- MinerInput = 4,
9
- MinerOutput = 5,
10
- RouterInput = 6,
11
- RouterOutput = 7,
12
- Other = 8,
13
- }
14
-
15
- export default class Slip {
16
- private slip: WasmSlip;
17
- public static Type: any;
18
-
19
- public constructor(slip?: WasmSlip, json?: any) {
20
- if (!slip) {
21
- this.slip = new Slip.Type();
22
- } else {
23
- this.slip = slip;
24
- }
25
- if (json) {
26
- this.publicKey = json.publicKey;
27
- this.type = json.type;
28
- this.amount = json.amount;
29
- this.index = json.index;
30
- this.blockId = json.blockId;
31
- this.txOrdinal = json.txOrdinal;
32
- this.utxoKey = json.utxoKey;
33
- }
34
- }
35
-
36
- public get wasmSlip(): WasmSlip {
37
- return this.slip;
38
- }
39
-
40
- public get type(): SlipType {
41
- return this.slip.slip_type as SlipType;
42
- }
43
-
44
- public set type(type: SlipType) {
45
- this.slip.slip_type = type as number;
46
- }
47
-
48
- public get amount(): bigint {
49
- return this.slip.amount;
50
- }
51
-
52
- public set amount(amount: bigint | number) {
53
- this.slip.amount = BigInt(amount);
54
- }
55
-
56
- public get publicKey(): string {
57
- return this.slip.public_key;
58
- }
59
-
60
- public set publicKey(key: string) {
61
- this.slip.public_key = key;
62
- }
63
-
64
- public set index(index: number) {
65
- this.slip.slip_index = index;
66
- }
67
-
68
- public get index(): number {
69
- return this.slip.slip_index;
70
- }
71
-
72
- public set blockId(id: bigint) {
73
- this.slip.block_id = id;
74
- }
75
-
76
- public get blockId(): bigint {
77
- return this.slip.block_id;
78
- }
79
-
80
- public set txOrdinal(ordinal: bigint) {
81
- this.slip.tx_ordinal = ordinal;
82
- }
83
-
84
- public get txOrdinal(): bigint {
85
- return this.slip.tx_ordinal;
86
- }
87
-
88
- public set utxoKey(key: string) {
89
- this.slip.utxo_key = key;
90
- }
91
-
92
- public get utxoKey(): string {
93
- return this.slip.utxo_key;
94
- }
95
-
96
- public toJson(): {
97
- blockId: bigint;
98
- utxoKey: string;
99
- amount: bigint;
100
- index: number;
101
- publicKey: string;
102
- txOrdinal: bigint;
103
- type: any;
104
- } {
105
- return {
106
- publicKey: this.publicKey,
107
- type: this.type,
108
- amount: this.amount,
109
- index: this.index,
110
- blockId: this.blockId,
111
- txOrdinal: this.txOrdinal,
112
- utxoKey: this.utxoKey,
113
- };
114
- }
115
-
116
- public clone() {
117
- return new Slip(undefined, this.toJson());
118
- }
119
- }