@kynesyslabs/demosdk 2.1.9 → 2.1.11
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 +48 -48
- package/build/abstraction/Identities.d.ts +40 -7
- package/build/abstraction/Identities.js +62 -46
- package/build/abstraction/Identities.js.map +1 -1
- package/build/demoswork/workstep.js.map +1 -1
- package/build/encryption/index.d.ts +0 -2
- package/build/encryption/index.js +1 -5
- package/build/encryption/index.js.map +1 -1
- package/build/multichain/core/btc.d.ts +40 -0
- package/build/multichain/core/btc.js +372 -0
- package/build/multichain/core/btc.js.map +1 -0
- package/build/multichain/core/index.d.ts +1 -0
- package/build/multichain/core/index.js +3 -1
- package/build/multichain/core/index.js.map +1 -1
- package/build/multichain/localsdk/btc.d.ts +11 -0
- package/build/multichain/localsdk/btc.js +89 -0
- package/build/multichain/localsdk/btc.js.map +1 -0
- package/build/multichain/localsdk/index.d.ts +1 -0
- package/build/multichain/localsdk/index.js +3 -1
- package/build/multichain/localsdk/index.js.map +1 -1
- package/build/multichain/websdk/btc.d.ts +4 -0
- package/build/multichain/websdk/btc.js +11 -0
- package/build/multichain/websdk/btc.js.map +1 -0
- package/build/multichain/websdk/index.d.ts +1 -0
- package/build/multichain/websdk/index.js +3 -1
- package/build/multichain/websdk/index.js.map +1 -1
- package/build/websdk/DemosTransactions.js +10 -1
- package/build/websdk/DemosTransactions.js.map +1 -1
- package/build/websdk/DemosWebAuth.d.ts +2 -2
- package/build/websdk/DemosWebAuth.js.map +1 -1
- package/build/websdk/demosclass.d.ts +2 -2
- package/build/websdk/demosclass.js.map +1 -1
- package/build/websdk/types/KeyPair.d.ts +2 -2
- package/build/websdk/utils/forge_converter.d.ts +1 -1
- package/build/websdk/utils/forge_converter.js +1 -1
- package/build/websdk/utils/forge_converter.js.map +1 -1
- package/package.json +7 -2
package/README.md
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
Demos SDKs
|
|
1
|
+
# Demos SDKs
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
To use this package, install it in your project using:
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
```sh
|
|
6
|
+
yarn add @kynesyslabs/demosdk
|
|
7
|
+
|
|
8
|
+
# or
|
|
9
|
+
|
|
10
|
+
npm -i @kynesyslabs/demosdk
|
|
11
|
+
```
|
|
6
12
|
|
|
7
|
-
###
|
|
13
|
+
### Installing from local source
|
|
8
14
|
|
|
9
|
-
To use this package
|
|
15
|
+
To use this package from a local folder, follow these steps:
|
|
10
16
|
|
|
11
17
|
On the root of this repo, run:
|
|
12
18
|
|
|
@@ -26,85 +32,59 @@ Assuming both repos are in the same directory, that would be:
|
|
|
26
32
|
yarn add file:../sdks
|
|
27
33
|
```
|
|
28
34
|
|
|
29
|
-
Then you can import stuff from the package normally,
|
|
35
|
+
Then you can import stuff from the package normally, eg:
|
|
30
36
|
|
|
31
37
|
```ts
|
|
32
38
|
import { Demos } from "@kynesyslabs/demosdk/websdk"
|
|
33
39
|
```
|
|
34
40
|
|
|
35
|
-
> [!
|
|
41
|
+
> [!IMPORTANT]
|
|
36
42
|
> Installing this package will replace the NPM version of the package.
|
|
43
|
+
>
|
|
44
|
+
> Changes to the sdks will not be reflected on your project until you rebuild and reinstall the sdk in your project.
|
|
37
45
|
|
|
38
|
-
>
|
|
39
|
-
> Changes to the sdks will not be reflected on your project until you rebuild the sdks and reinstall them in your project all over again.
|
|
46
|
+
<br>
|
|
40
47
|
|
|
41
|
-
###
|
|
48
|
+
### Exporting modules
|
|
42
49
|
|
|
43
|
-
|
|
50
|
+
To export a `src/module/index.ts` from the package as a module, configure `package.json` as shown:
|
|
44
51
|
|
|
45
52
|
```jsonc
|
|
46
53
|
"exports": {
|
|
47
54
|
// ...
|
|
48
|
-
"./
|
|
55
|
+
"./module": "./build/module/index.js"
|
|
49
56
|
}
|
|
50
57
|
```
|
|
51
58
|
|
|
52
|
-
This will allow users to use the
|
|
59
|
+
This will allow users to use the module exports as follows:
|
|
53
60
|
|
|
54
61
|
```js
|
|
55
|
-
import {
|
|
62
|
+
import { ModuleItem, otherModuleItem } from "@kynesyslabs/demosdk/module"
|
|
56
63
|
```
|
|
57
64
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
Here are all the available tests:
|
|
61
|
-
|
|
62
|
-
### 1. Multichain
|
|
63
|
-
|
|
64
|
-
Tests for the multichain SDKs.
|
|
65
|
-
|
|
66
|
-
```sh
|
|
67
|
-
yarn test:multichain
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
### 2. A crosschain write transaction on DEMOS
|
|
71
|
-
|
|
72
|
-
Creates a demos crosschain transaction to send tokens on Sepolia via the DEMOS testnet.
|
|
73
|
-
|
|
74
|
-
```sh
|
|
75
|
-
yarn test:tx
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
### 3. Demoswork
|
|
79
|
-
|
|
80
|
-
```sh
|
|
81
|
-
yarn test:demoswork
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
### 4. Native Transactions
|
|
85
|
-
|
|
86
|
-
```sh
|
|
87
|
-
yarn test:native
|
|
88
|
-
```
|
|
65
|
+
<br>
|
|
89
66
|
|
|
90
67
|
### Publishing on NPM
|
|
91
68
|
|
|
92
69
|
Publishing to NPM is automated using a Github Workflow. To publish a new version:
|
|
93
70
|
|
|
94
|
-
1.
|
|
71
|
+
1. Increment the `package.json` version field
|
|
95
72
|
2. Commit your changes with a message starting with the word `release`
|
|
96
73
|
3. Push to Github.
|
|
97
74
|
|
|
75
|
+
For example:
|
|
76
|
+
|
|
98
77
|
```sh
|
|
99
|
-
# Example:
|
|
100
78
|
git commit -m "release v1.0.5"
|
|
101
79
|
```
|
|
102
80
|
|
|
103
81
|
The commit will trigger a workflow run to build the files and publish a new version on NPM.
|
|
104
82
|
|
|
83
|
+
<br>
|
|
84
|
+
|
|
105
85
|
### Setup pre-push hook
|
|
106
86
|
|
|
107
|
-
The release pre-push hook will prevent you from pushing a release commit, if the code can't build.
|
|
87
|
+
The release pre-push hook will prevent you from pushing a release commit, if the code can't build successfully.
|
|
108
88
|
|
|
109
89
|
```sh
|
|
110
90
|
yarn setup:pre-push
|
|
@@ -114,3 +94,23 @@ The command will copy the pre-push file from `.github/hooks/pre-push` to the `.g
|
|
|
114
94
|
|
|
115
95
|
> [!TIP]
|
|
116
96
|
> This hook is not pushed to Github, so you need to run the command again if you reclone the repository.
|
|
97
|
+
|
|
98
|
+
### Tests
|
|
99
|
+
|
|
100
|
+
```sh
|
|
101
|
+
yarn test:multichain multichain sdks payload generation
|
|
102
|
+
|
|
103
|
+
yarn test:tx sending crosschain pay txs
|
|
104
|
+
|
|
105
|
+
yarn test:demoswork demoswork operations
|
|
106
|
+
|
|
107
|
+
yarn test:native native pay txs
|
|
108
|
+
|
|
109
|
+
yarn test:identities adding xm identities
|
|
110
|
+
|
|
111
|
+
yarn test:identities:web2 adding web2 identities
|
|
112
|
+
|
|
113
|
+
yarn test:web2 using the web2 proxy
|
|
114
|
+
|
|
115
|
+
yarn test:rubic-service rubic brigde service
|
|
116
|
+
```
|
|
@@ -20,6 +20,14 @@ export default class Identities {
|
|
|
20
20
|
* @returns The validity data of the identity transaction.
|
|
21
21
|
*/
|
|
22
22
|
inferIdentity(demos: Demos, context: "xm" | "web2", payload: any): Promise<RPCResponseWithValidityData>;
|
|
23
|
+
/**
|
|
24
|
+
* Remove a crosschain identity associated with an address.
|
|
25
|
+
*
|
|
26
|
+
* @param demos A Demos instance to communicate with the RPC.
|
|
27
|
+
* @param payload The payload to remove the identity from.
|
|
28
|
+
* @returns The response from the RPC call.
|
|
29
|
+
*/
|
|
30
|
+
removeIdentity(demos: Demos, context: "xm" | "web2", payload: any): Promise<RPCResponseWithValidityData>;
|
|
23
31
|
/**
|
|
24
32
|
* Infer a crosschain identity from a signature.
|
|
25
33
|
*
|
|
@@ -38,15 +46,24 @@ export default class Identities {
|
|
|
38
46
|
*/
|
|
39
47
|
inferWeb2Identity(demos: Demos, payload: Web2CoreTargetIdentityPayload): Promise<RPCResponseWithValidityData>;
|
|
40
48
|
/**
|
|
41
|
-
* Remove a crosschain identity
|
|
49
|
+
* Remove a crosschain identity from the network.
|
|
42
50
|
*
|
|
43
51
|
* @param demos A Demos instance to communicate with the RPC.
|
|
44
|
-
* @param payload The payload to remove the identity
|
|
52
|
+
* @param payload The payload to remove the identity.
|
|
45
53
|
* @returns The response from the RPC call.
|
|
46
54
|
*/
|
|
47
|
-
removeIdentity(demos: Demos, context: "xm" | "web2", payload: any): Promise<RPCResponseWithValidityData>;
|
|
48
55
|
removeXmIdentity(demos: Demos, payload: XMCoreTargetIdentityPayload): Promise<RPCResponseWithValidityData>;
|
|
49
|
-
|
|
56
|
+
/**
|
|
57
|
+
* Remove a web2 identity from the network.
|
|
58
|
+
*
|
|
59
|
+
* @param demos A Demos instance to communicate with the RPC.
|
|
60
|
+
* @param payload The payload to remove the identity.
|
|
61
|
+
* @returns The response from the RPC call.
|
|
62
|
+
*/
|
|
63
|
+
removeWeb2Identity(demos: Demos, payload: {
|
|
64
|
+
context: string;
|
|
65
|
+
username: string;
|
|
66
|
+
}): Promise<RPCResponseWithValidityData>;
|
|
50
67
|
/**
|
|
51
68
|
* Add a github identity to the GCR.
|
|
52
69
|
*
|
|
@@ -54,7 +71,7 @@ export default class Identities {
|
|
|
54
71
|
* @param payload The payload to add the identity to.
|
|
55
72
|
* @returns The response from the RPC call.
|
|
56
73
|
*/
|
|
57
|
-
addGithubIdentity(demos: Demos, payload: GithubProof): Promise<
|
|
74
|
+
addGithubIdentity(demos: Demos, payload: GithubProof): Promise<RPCResponseWithValidityData>;
|
|
58
75
|
/**
|
|
59
76
|
* Add a twitter identity to the GCR.
|
|
60
77
|
*
|
|
@@ -62,7 +79,7 @@ export default class Identities {
|
|
|
62
79
|
* @param payload The payload to add the identity to.
|
|
63
80
|
* @returns The response from the RPC call.
|
|
64
81
|
*/
|
|
65
|
-
addTwitterIdentity(demos: Demos, payload: TwitterProof): Promise<
|
|
82
|
+
addTwitterIdentity(demos: Demos, payload: TwitterProof): Promise<RPCResponseWithValidityData>;
|
|
66
83
|
/**
|
|
67
84
|
* Get the identities associated with an address.
|
|
68
85
|
*
|
|
@@ -70,5 +87,21 @@ export default class Identities {
|
|
|
70
87
|
* @param address The address to get identities for.
|
|
71
88
|
* @returns The identities associated with the address.
|
|
72
89
|
*/
|
|
73
|
-
getIdentities(demos: Demos, address?: string): Promise<any>;
|
|
90
|
+
getIdentities(demos: Demos, call?: string, address?: string): Promise<any>;
|
|
91
|
+
/**
|
|
92
|
+
* Get the crosschain identities associated with an address.
|
|
93
|
+
*
|
|
94
|
+
* @param demos A Demos instance to communicate with the RPC.
|
|
95
|
+
* @param address The address to get identities for.
|
|
96
|
+
* @returns The identities associated with the address.
|
|
97
|
+
*/
|
|
98
|
+
getXmIdentities(demos: Demos, address?: string): Promise<any>;
|
|
99
|
+
/**
|
|
100
|
+
* Get the web2 identities associated with an address.
|
|
101
|
+
*
|
|
102
|
+
* @param demos A Demos instance to communicate with the RPC.
|
|
103
|
+
* @param address The address to get identities for.
|
|
104
|
+
* @returns The identities associated with the address.
|
|
105
|
+
*/
|
|
106
|
+
getWeb2Identities(demos: Demos, address?: string): Promise<any>;
|
|
74
107
|
}
|
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
6
6
|
};
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
const
|
|
8
|
+
const Cryptography_1 = require("../encryption/Cryptography");
|
|
9
9
|
const node_forge_1 = __importDefault(require("node-forge"));
|
|
10
10
|
const websdk_1 = require("../websdk");
|
|
11
11
|
class Identities {
|
|
@@ -17,13 +17,13 @@ class Identities {
|
|
|
17
17
|
*/
|
|
18
18
|
async createWeb2ProofPayload(keypair) {
|
|
19
19
|
const message = "dw2p";
|
|
20
|
-
const signature =
|
|
20
|
+
const signature = Cryptography_1.Cryptography.sign(message, keypair.privateKey);
|
|
21
21
|
const payload = {
|
|
22
22
|
message,
|
|
23
23
|
signature: signature.toString("hex"),
|
|
24
24
|
publicKey: keypair.publicKey.toString("hex"),
|
|
25
25
|
};
|
|
26
|
-
const verified =
|
|
26
|
+
const verified = Cryptography_1.Cryptography.verify(message, node_forge_1.default.util.binary.hex.decode(payload.signature), node_forge_1.default.util.binary.hex.decode(payload.publicKey));
|
|
27
27
|
if (!verified) {
|
|
28
28
|
throw new Error("Failed to verify web2 proof payload");
|
|
29
29
|
}
|
|
@@ -61,27 +61,6 @@ class Identities {
|
|
|
61
61
|
const signedTx = await demos.sign(tx);
|
|
62
62
|
return await demos.confirm(signedTx);
|
|
63
63
|
}
|
|
64
|
-
/**
|
|
65
|
-
* Infer a crosschain identity from a signature.
|
|
66
|
-
*
|
|
67
|
-
* @param demos A Demos instance to communicate with the RPC.
|
|
68
|
-
* @param payload The payload to infer the identity from.
|
|
69
|
-
* @returns The validity data of the identity transaction.
|
|
70
|
-
*/
|
|
71
|
-
async inferXmIdentity(demos, payload) {
|
|
72
|
-
return await this.inferIdentity(demos, "xm", payload);
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Infer a web2 identity from a proof payload.
|
|
76
|
-
*
|
|
77
|
-
* @param demos A Demos instance to communicate with the RPC.
|
|
78
|
-
* @param payload The payload to infer the identity from.
|
|
79
|
-
*
|
|
80
|
-
* @returns The validity data of the identity transaction.
|
|
81
|
-
*/
|
|
82
|
-
async inferWeb2Identity(demos, payload) {
|
|
83
|
-
return await this.inferIdentity(demos, "web2", payload);
|
|
84
|
-
}
|
|
85
64
|
/**
|
|
86
65
|
* Remove a crosschain identity associated with an address.
|
|
87
66
|
*
|
|
@@ -112,9 +91,44 @@ class Identities {
|
|
|
112
91
|
const signedTx = await demos.sign(tx);
|
|
113
92
|
return await demos.confirm(signedTx);
|
|
114
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* Infer a crosschain identity from a signature.
|
|
96
|
+
*
|
|
97
|
+
* @param demos A Demos instance to communicate with the RPC.
|
|
98
|
+
* @param payload The payload to infer the identity from.
|
|
99
|
+
* @returns The validity data of the identity transaction.
|
|
100
|
+
*/
|
|
101
|
+
async inferXmIdentity(demos, payload) {
|
|
102
|
+
return await this.inferIdentity(demos, "xm", payload);
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Infer a web2 identity from a proof payload.
|
|
106
|
+
*
|
|
107
|
+
* @param demos A Demos instance to communicate with the RPC.
|
|
108
|
+
* @param payload The payload to infer the identity from.
|
|
109
|
+
*
|
|
110
|
+
* @returns The validity data of the identity transaction.
|
|
111
|
+
*/
|
|
112
|
+
async inferWeb2Identity(demos, payload) {
|
|
113
|
+
return await this.inferIdentity(demos, "web2", payload);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Remove a crosschain identity from the network.
|
|
117
|
+
*
|
|
118
|
+
* @param demos A Demos instance to communicate with the RPC.
|
|
119
|
+
* @param payload The payload to remove the identity.
|
|
120
|
+
* @returns The response from the RPC call.
|
|
121
|
+
*/
|
|
115
122
|
async removeXmIdentity(demos, payload) {
|
|
116
123
|
return await this.removeIdentity(demos, "xm", payload);
|
|
117
124
|
}
|
|
125
|
+
/**
|
|
126
|
+
* Remove a web2 identity from the network.
|
|
127
|
+
*
|
|
128
|
+
* @param demos A Demos instance to communicate with the RPC.
|
|
129
|
+
* @param payload The payload to remove the identity.
|
|
130
|
+
* @returns The response from the RPC call.
|
|
131
|
+
*/
|
|
118
132
|
async removeWeb2Identity(demos, payload) {
|
|
119
133
|
return await this.removeIdentity(demos, "web2", payload);
|
|
120
134
|
}
|
|
@@ -130,16 +144,7 @@ class Identities {
|
|
|
130
144
|
context: "github",
|
|
131
145
|
proof: payload,
|
|
132
146
|
};
|
|
133
|
-
|
|
134
|
-
method: "gcr_routine",
|
|
135
|
-
params: [
|
|
136
|
-
{
|
|
137
|
-
method: "add_github_identity",
|
|
138
|
-
params: [githubPayload], // REVIEW Is this correct?
|
|
139
|
-
},
|
|
140
|
-
],
|
|
141
|
-
};
|
|
142
|
-
return await demos.rpcCall(request, true);
|
|
147
|
+
return await this.inferIdentity(demos, "web2", githubPayload);
|
|
143
148
|
}
|
|
144
149
|
/**
|
|
145
150
|
* Add a twitter identity to the GCR.
|
|
@@ -153,16 +158,7 @@ class Identities {
|
|
|
153
158
|
context: "twitter",
|
|
154
159
|
proof: payload,
|
|
155
160
|
};
|
|
156
|
-
|
|
157
|
-
method: "gcr_routine",
|
|
158
|
-
params: [
|
|
159
|
-
{
|
|
160
|
-
method: "add_twitter_identity",
|
|
161
|
-
params: [twitterPayload],
|
|
162
|
-
},
|
|
163
|
-
],
|
|
164
|
-
};
|
|
165
|
-
return await demos.rpcCall(request, true);
|
|
161
|
+
return await this.inferIdentity(demos, "web2", twitterPayload);
|
|
166
162
|
}
|
|
167
163
|
/**
|
|
168
164
|
* Get the identities associated with an address.
|
|
@@ -171,18 +167,38 @@ class Identities {
|
|
|
171
167
|
* @param address The address to get identities for.
|
|
172
168
|
* @returns The identities associated with the address.
|
|
173
169
|
*/
|
|
174
|
-
async getIdentities(demos, address) {
|
|
170
|
+
async getIdentities(demos, call = "getIdentities", address) {
|
|
175
171
|
const request = {
|
|
176
172
|
method: "gcr_routine",
|
|
177
173
|
params: [
|
|
178
174
|
{
|
|
179
|
-
method:
|
|
175
|
+
method: call,
|
|
180
176
|
params: [address || demos.getAddress()],
|
|
181
177
|
},
|
|
182
178
|
],
|
|
183
179
|
};
|
|
184
180
|
return await demos.rpcCall(request, true);
|
|
185
181
|
}
|
|
182
|
+
/**
|
|
183
|
+
* Get the crosschain identities associated with an address.
|
|
184
|
+
*
|
|
185
|
+
* @param demos A Demos instance to communicate with the RPC.
|
|
186
|
+
* @param address The address to get identities for.
|
|
187
|
+
* @returns The identities associated with the address.
|
|
188
|
+
*/
|
|
189
|
+
async getXmIdentities(demos, address) {
|
|
190
|
+
return await this.getIdentities(demos, "getXmIdentities", address);
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Get the web2 identities associated with an address.
|
|
194
|
+
*
|
|
195
|
+
* @param demos A Demos instance to communicate with the RPC.
|
|
196
|
+
* @param address The address to get identities for.
|
|
197
|
+
* @returns The identities associated with the address.
|
|
198
|
+
*/
|
|
199
|
+
async getWeb2Identities(demos, address) {
|
|
200
|
+
return await this.getIdentities(demos, "getWeb2Identities", address);
|
|
201
|
+
}
|
|
186
202
|
}
|
|
187
203
|
exports.default = Identities;
|
|
188
204
|
//# sourceMappingURL=Identities.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Identities.js","sourceRoot":"","sources":["../../../src/abstraction/Identities.ts"],"names":[],"mappings":";AAAA,4CAA4C;AAC5C,8EAA8E;;;;;AAE9E,
|
|
1
|
+
{"version":3,"file":"Identities.js","sourceRoot":"","sources":["../../../src/abstraction/Identities.ts"],"names":[],"mappings":";AAAA,4CAA4C;AAC5C,8EAA8E;;;;;AAE9E,4DAAwD;AAcxD,4DAA8B;AAC9B,qCAA4C;AAI5C,MAAqB,UAAU;IAC3B;;;;;OAKG;IACH,KAAK,CAAC,sBAAsB,CAAC,OAAiB;QAC1C,MAAM,OAAO,GAAG,MAAM,CAAA;QACtB,MAAM,SAAS,GAAG,2BAAY,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,UAAU,CAAC,CAAA;QAChE,MAAM,OAAO,GAAG;YACZ,OAAO;YACP,SAAS,EAAE,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC;YACpC,SAAS,EAAE,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC;SAC/C,CAAA;QAED,MAAM,QAAQ,GAAG,2BAAY,CAAC,MAAM,CAChC,OAAO,EACP,oBAAK,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,EAC/C,oBAAK,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC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,OAAO;SACjB,CAAA;QAED,OAAO,MAAM,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,aAAa,CAAC,CAAA;IACjE,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,kBAAkB,CAAC,KAAY,EAAE,OAAqB;QACxD,IAAI,cAAc,GAAsB;YACpC,OAAO,EAAE,SAAS;YAClB,KAAK,EAAE,OAAO;SACjB,CAAA;QAED,OAAO,MAAM,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,CAAC,CAAA;IAClE,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,aAAa,CAAC,KAAY,EAAE,IAAI,GAAG,eAAe,EAAE,OAAgB;QACtE,MAAM,OAAO,GAAG;YACZ,MAAM,EAAE,aAAa;YACrB,MAAM,EAAE;gBACJ;oBACI,MAAM,EAAE,IAAI;oBACZ,MAAM,EAAE,CAAC,OAAO,IAAI,KAAK,CAAC,UAAU,EAAE,CAAC;iBAC1C;aACJ;SACJ,CAAA;QAED,OAAO,MAAM,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;IAC7C,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,eAAe,CAAC,KAAY,EAAE,OAAgB;QAChD,OAAO,MAAM,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,iBAAiB,EAAE,OAAO,CAAC,CAAA;IACtE,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,iBAAiB,CAAC,KAAY,EAAE,OAAgB;QAClD,OAAO,MAAM,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,mBAAmB,EAAE,OAAO,CAAC,CAAA;IACxE,CAAC;CACJ;AAzOD,6BAyOC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workstep.js","sourceRoot":"","sources":["../../../src/demoswork/workstep.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"workstep.js","sourceRoot":"","sources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+33,8 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.
|
|
36
|
+
exports.zK = exports.PQC = exports.FHE = void 0;
|
|
37
37
|
exports.FHE = __importStar(require("./FHE"));
|
|
38
38
|
exports.PQC = __importStar(require("./PQC"));
|
|
39
39
|
exports.zK = __importStar(require("./zK"));
|
|
40
|
-
var Cryptography_1 = require("./Cryptography");
|
|
41
|
-
Object.defineProperty(exports, "Cryptography", { enumerable: true, get: function () { return Cryptography_1.Cryptography; } });
|
|
42
|
-
var Hashing_1 = require("./Hashing");
|
|
43
|
-
Object.defineProperty(exports, "Hashing", { enumerable: true, get: function () { return Hashing_1.Hashing; } });
|
|
44
40
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/encryption/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA4B;AAC5B,6CAA4B;AAC5B,2CAA0B
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/encryption/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA4B;AAC5B,6CAA4B;AAC5B,2CAA0B"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as bitcoin from "bitcoinjs-lib";
|
|
2
|
+
import { ECPairInterface } from "ecpair";
|
|
3
|
+
import { DefaultChain } from "./types/defaultChain";
|
|
4
|
+
import { IPayParams } from "./types/interfaces";
|
|
5
|
+
export declare class BTC extends DefaultChain {
|
|
6
|
+
provider: string;
|
|
7
|
+
network: bitcoin.Network;
|
|
8
|
+
wallet: ECPairInterface;
|
|
9
|
+
address?: string;
|
|
10
|
+
private changeIndex;
|
|
11
|
+
private lastUsedUtxos;
|
|
12
|
+
private usedChangeAddresses;
|
|
13
|
+
constructor(rpc_url: string, network?: bitcoin.Network);
|
|
14
|
+
connect(): Promise<boolean>;
|
|
15
|
+
/**
|
|
16
|
+
* Generate a private key for the BTC chain
|
|
17
|
+
* @param seed - The seed to generate the private key from (optional)
|
|
18
|
+
* @returns The private key as a WIF string
|
|
19
|
+
*/
|
|
20
|
+
generatePrivateKey(seed?: Buffer): string;
|
|
21
|
+
private generateChangeAddress;
|
|
22
|
+
connectWallet(privateKeyWIF: string): Promise<ECPairInterface>;
|
|
23
|
+
getAddress(): string;
|
|
24
|
+
private getApiUrl;
|
|
25
|
+
fetchUTXOs(address: string): Promise<any[]>;
|
|
26
|
+
fetchAllUTXOs(): Promise<any[]>;
|
|
27
|
+
getTxHex(txid: string): Promise<string>;
|
|
28
|
+
private toSigner;
|
|
29
|
+
preparePay(address: string, amount: string, overrideFeeRate?: number, addNoise?: boolean): Promise<string>;
|
|
30
|
+
preparePays(payments: IPayParams[], overrideFeeRate?: number, addNoise?: boolean): Promise<string[]>;
|
|
31
|
+
private createUnsignedPSBT;
|
|
32
|
+
getFeeRate(overrideRate?: number): Promise<number>;
|
|
33
|
+
private calculateFee;
|
|
34
|
+
signTransaction(psbt: bitcoin.Psbt): Promise<string>;
|
|
35
|
+
signTransactions(psbts: bitcoin.Psbt[]): Promise<string[]>;
|
|
36
|
+
getBalance(): Promise<string>;
|
|
37
|
+
getEmptyTransaction(): Promise<any>;
|
|
38
|
+
signMessage(): Promise<string>;
|
|
39
|
+
verifyMessage(): Promise<boolean>;
|
|
40
|
+
}
|