@massalabs/wallet-provider 0.0.0 → 0.0.1-dev.20230424074402
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 +2 -5
- package/bundle.js +3738 -0
- package/dist/account/Account.d.ts +80 -0
- package/dist/account/Account.js +139 -0
- package/dist/account/Account.js.map +1 -0
- package/dist/account/AccountBalance.d.ts +13 -0
- package/dist/account/AccountBalance.js +3 -0
- package/dist/account/AccountBalance.js.map +1 -0
- package/dist/account/AccountSign.d.ts +15 -0
- package/dist/account/AccountSign.js +3 -0
- package/dist/account/AccountSign.js.map +1 -0
- package/dist/account/IAccount.d.ts +16 -0
- package/dist/account/IAccount.js +3 -0
- package/dist/account/IAccount.js.map +1 -0
- package/dist/account/IAccountDetails.d.ts +7 -0
- package/dist/account/IAccountDetails.js +3 -0
- package/dist/account/IAccountDetails.js.map +1 -0
- package/dist/account/IAccountRolls.d.ts +7 -0
- package/dist/account/IAccountRolls.js +3 -0
- package/dist/account/IAccountRolls.js.map +1 -0
- package/dist/account/IAccountSendTransaction.d.ts +8 -0
- package/dist/account/IAccountSendTransaction.js +3 -0
- package/dist/account/IAccountSendTransaction.js.map +1 -0
- package/dist/account/index.d.ts +7 -0
- package/dist/account/index.js +6 -0
- package/dist/account/index.js.map +1 -0
- package/dist/connector/Connector.d.ts +79 -0
- package/dist/connector/Connector.js +164 -0
- package/dist/connector/Connector.js.map +1 -0
- package/dist/connector/ICustomEventMessageRequest.d.ts +9 -0
- package/dist/connector/ICustomEventMessageRequest.js +3 -0
- package/dist/connector/ICustomEventMessageRequest.js.map +1 -0
- package/dist/connector/ICustomEventMessageResponse.d.ts +10 -0
- package/dist/connector/ICustomEventMessageResponse.js +3 -0
- package/dist/connector/ICustomEventMessageResponse.js.map +1 -0
- package/dist/connector/IRegisterEvent.d.ts +7 -0
- package/dist/connector/IRegisterEvent.js +3 -0
- package/dist/connector/IRegisterEvent.js.map +1 -0
- package/dist/connector/index.d.ts +4 -0
- package/dist/connector/index.js +6 -0
- package/dist/connector/index.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +41 -0
- package/dist/index.js.map +1 -0
- package/dist/provider/AccountDeletion.d.ts +23 -0
- package/dist/provider/AccountDeletion.js +14 -0
- package/dist/provider/AccountDeletion.js.map +1 -0
- package/dist/provider/AccountImport.d.ts +25 -0
- package/dist/provider/AccountImport.js +14 -0
- package/dist/provider/AccountImport.js.map +1 -0
- package/dist/provider/AccoutGeneration.d.ts +7 -0
- package/dist/provider/AccoutGeneration.js +3 -0
- package/dist/provider/AccoutGeneration.js.map +1 -0
- package/dist/provider/IProvider.d.ts +15 -0
- package/dist/provider/IProvider.js +3 -0
- package/dist/provider/IProvider.js.map +1 -0
- package/dist/provider/Provider.d.ts +67 -0
- package/dist/provider/Provider.js +126 -0
- package/dist/provider/Provider.js.map +1 -0
- package/dist/provider/index.d.ts +4 -0
- package/dist/provider/index.js +10 -0
- package/dist/provider/index.js.map +1 -0
- package/dist/thyra/RequestHandler.d.ts +35 -0
- package/dist/thyra/RequestHandler.js +103 -0
- package/dist/thyra/RequestHandler.js.map +1 -0
- package/dist/thyra/ThyraAccount.d.ts +77 -0
- package/dist/thyra/ThyraAccount.js +132 -0
- package/dist/thyra/ThyraAccount.js.map +1 -0
- package/dist/thyra/ThyraDiscovery.d.ts +69 -0
- package/dist/thyra/ThyraDiscovery.js +107 -0
- package/dist/thyra/ThyraDiscovery.js.map +1 -0
- package/dist/thyra/ThyraProvider.d.ts +87 -0
- package/dist/thyra/ThyraProvider.js +137 -0
- package/dist/thyra/ThyraProvider.js.map +1 -0
- package/dist/utils/time.d.ts +76 -0
- package/dist/utils/time.js +120 -0
- package/dist/utils/time.js.map +1 -0
- package/package.json +6 -2
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file defines a TypeScript module with various time-related Typescript methods.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* - The classes and their methods implemented here are quite generic and might be useful in other contexts too
|
|
6
|
+
* but have been particularly developed for the purposes of this library
|
|
7
|
+
* - If you want to work on this repo, you will probably be interested in this object
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* This class provides an implementation of a timer calling a callback hook after it ticks.
|
|
12
|
+
* @remarks
|
|
13
|
+
* The timer is being resetted only after the execution of the callback method has finished
|
|
14
|
+
*/
|
|
15
|
+
export declare class Timeout {
|
|
16
|
+
/**
|
|
17
|
+
* Timeout constructor
|
|
18
|
+
*
|
|
19
|
+
* @param timeoutMil - The number of milliseconds for the timeout.
|
|
20
|
+
* @param callback - a callback to execute.
|
|
21
|
+
* @returns An instance of the Timeout class.
|
|
22
|
+
*/
|
|
23
|
+
constructor(timeoutMil: number, callback: () => void);
|
|
24
|
+
private isCleared;
|
|
25
|
+
private isCalled;
|
|
26
|
+
private timeoutHook;
|
|
27
|
+
/**
|
|
28
|
+
* A method to clear the timeout
|
|
29
|
+
*
|
|
30
|
+
* @returns void
|
|
31
|
+
*/
|
|
32
|
+
clear(): void;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* This class provides an implementation of a continuous timer calling a callback hook after every given milliseconds.
|
|
36
|
+
* @remarks
|
|
37
|
+
* The timer is being resetted every given milliseconds
|
|
38
|
+
* irregardless whether the execution of the method is still running or not
|
|
39
|
+
*/
|
|
40
|
+
export declare class Interval {
|
|
41
|
+
/**
|
|
42
|
+
* Interval constructor
|
|
43
|
+
*
|
|
44
|
+
* @param timeoutMil - The number of milliseconds for the interval.
|
|
45
|
+
* @param callback - a callback to execute.
|
|
46
|
+
* @returns An instance of the Interval class.
|
|
47
|
+
*/
|
|
48
|
+
constructor(timeoutMil: number, callback: () => void);
|
|
49
|
+
private isCleared;
|
|
50
|
+
private isCalled;
|
|
51
|
+
private intervalHook;
|
|
52
|
+
/**
|
|
53
|
+
* A method to clear the interval
|
|
54
|
+
*
|
|
55
|
+
* @returns void
|
|
56
|
+
*/
|
|
57
|
+
clear(): void;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* A function that waits pauses the execution loop for a number of milliseconds
|
|
61
|
+
*
|
|
62
|
+
* @param timeMilli - The number of milliseconds to wait.
|
|
63
|
+
* @returns void
|
|
64
|
+
*/
|
|
65
|
+
export declare const wait: (timeMilli: number) => Promise<void>;
|
|
66
|
+
/**
|
|
67
|
+
* A function that awaits a promise with a timeout.
|
|
68
|
+
*
|
|
69
|
+
* @param promise - a promise to execute.
|
|
70
|
+
* @param timeoutMs - The number of milliseconds to wait before a timeout.
|
|
71
|
+
* @returns void
|
|
72
|
+
*
|
|
73
|
+
* @remarks
|
|
74
|
+
* The promise is being polled with a timeout. Once the timeout is reached, if not fulfilled, the error is thrown.
|
|
75
|
+
*/
|
|
76
|
+
export declare function withTimeoutRejection<T>(promise: Promise<T>, timeoutMs: number): Promise<T>;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file defines a TypeScript module with various time-related Typescript methods.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* - The classes and their methods implemented here are quite generic and might be useful in other contexts too
|
|
7
|
+
* but have been particularly developed for the purposes of this library
|
|
8
|
+
* - If you want to work on this repo, you will probably be interested in this object
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.withTimeoutRejection = exports.wait = exports.Interval = exports.Timeout = void 0;
|
|
13
|
+
/**
|
|
14
|
+
* This class provides an implementation of a timer calling a callback hook after it ticks.
|
|
15
|
+
* @remarks
|
|
16
|
+
* The timer is being resetted only after the execution of the callback method has finished
|
|
17
|
+
*/
|
|
18
|
+
class Timeout {
|
|
19
|
+
/**
|
|
20
|
+
* Timeout constructor
|
|
21
|
+
*
|
|
22
|
+
* @param timeoutMil - The number of milliseconds for the timeout.
|
|
23
|
+
* @param callback - a callback to execute.
|
|
24
|
+
* @returns An instance of the Timeout class.
|
|
25
|
+
*/
|
|
26
|
+
constructor(timeoutMil, callback) {
|
|
27
|
+
this.clear = this.clear.bind(this);
|
|
28
|
+
const that = this;
|
|
29
|
+
this.isCleared = false;
|
|
30
|
+
this.isCalled = false;
|
|
31
|
+
this.timeoutHook = setTimeout(() => {
|
|
32
|
+
if (!that.isCleared) {
|
|
33
|
+
this.isCalled = true;
|
|
34
|
+
callback();
|
|
35
|
+
}
|
|
36
|
+
}, timeoutMil);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* A method to clear the timeout
|
|
40
|
+
*
|
|
41
|
+
* @returns void
|
|
42
|
+
*/
|
|
43
|
+
clear() {
|
|
44
|
+
if (!this.isCleared) {
|
|
45
|
+
clearTimeout(this.timeoutHook);
|
|
46
|
+
this.isCleared = true;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.Timeout = Timeout;
|
|
51
|
+
/**
|
|
52
|
+
* This class provides an implementation of a continuous timer calling a callback hook after every given milliseconds.
|
|
53
|
+
* @remarks
|
|
54
|
+
* The timer is being resetted every given milliseconds
|
|
55
|
+
* irregardless whether the execution of the method is still running or not
|
|
56
|
+
*/
|
|
57
|
+
class Interval {
|
|
58
|
+
/**
|
|
59
|
+
* Interval constructor
|
|
60
|
+
*
|
|
61
|
+
* @param timeoutMil - The number of milliseconds for the interval.
|
|
62
|
+
* @param callback - a callback to execute.
|
|
63
|
+
* @returns An instance of the Interval class.
|
|
64
|
+
*/
|
|
65
|
+
constructor(timeoutMil, callback) {
|
|
66
|
+
this.clear = this.clear.bind(this);
|
|
67
|
+
const that = this;
|
|
68
|
+
this.isCleared = false;
|
|
69
|
+
this.isCalled = false;
|
|
70
|
+
this.intervalHook = setInterval(() => {
|
|
71
|
+
if (!that.isCleared) {
|
|
72
|
+
this.isCalled = true;
|
|
73
|
+
callback();
|
|
74
|
+
}
|
|
75
|
+
}, timeoutMil);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* A method to clear the interval
|
|
79
|
+
*
|
|
80
|
+
* @returns void
|
|
81
|
+
*/
|
|
82
|
+
clear() {
|
|
83
|
+
if (!this.isCleared) {
|
|
84
|
+
clearInterval(this.intervalHook);
|
|
85
|
+
this.isCleared = true;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
exports.Interval = Interval;
|
|
90
|
+
/**
|
|
91
|
+
* A function that waits pauses the execution loop for a number of milliseconds
|
|
92
|
+
*
|
|
93
|
+
* @param timeMilli - The number of milliseconds to wait.
|
|
94
|
+
* @returns void
|
|
95
|
+
*/
|
|
96
|
+
const wait = async (timeMilli) => {
|
|
97
|
+
return new Promise((resolve, reject) => {
|
|
98
|
+
const timeout = new Timeout(timeMilli, () => {
|
|
99
|
+
timeout.clear();
|
|
100
|
+
return resolve();
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
exports.wait = wait;
|
|
105
|
+
/**
|
|
106
|
+
* A function that awaits a promise with a timeout.
|
|
107
|
+
*
|
|
108
|
+
* @param promise - a promise to execute.
|
|
109
|
+
* @param timeoutMs - The number of milliseconds to wait before a timeout.
|
|
110
|
+
* @returns void
|
|
111
|
+
*
|
|
112
|
+
* @remarks
|
|
113
|
+
* The promise is being polled with a timeout. Once the timeout is reached, if not fulfilled, the error is thrown.
|
|
114
|
+
*/
|
|
115
|
+
async function withTimeoutRejection(promise, timeoutMs) {
|
|
116
|
+
const sleep = new Promise((resolve, reject) => setTimeout(() => reject(new Error(`Timeout of ${timeoutMs} has passed and promise did not resolve`)), timeoutMs));
|
|
117
|
+
return Promise.race([promise, sleep]);
|
|
118
|
+
}
|
|
119
|
+
exports.withTimeoutRejection = withTimeoutRejection;
|
|
120
|
+
//# sourceMappingURL=time.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time.js","sourceRoot":"","sources":["../../src/utils/time.ts"],"names":[],"mappings":";AAAA;;;;;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;;;OAIG;IACI,KAAK;QACV,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACnB,aAAa,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YACjC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;SACvB;IACH,CAAC;CACF;AApCD,4BAoCC;AAED;;;;;GAKG;AACI,MAAM,IAAI,GAAG,KAAK,EAAE,SAAiB,EAAiB,EAAE;IAC7D,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC3C,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,SAAS,EAAE,GAAG,EAAE;YAC1C,OAAO,CAAC,KAAK,EAAE,CAAC;YAChB,OAAO,OAAO,EAAE,CAAC;QACnB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAPW,QAAA,IAAI,QAOf;AAEF;;;;;;;;;GASG;AACI,KAAK,UAAU,oBAAoB,CACxC,OAAmB,EACnB,SAAiB;IAEjB,MAAM,KAAK,GAAG,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,CAC5C,UAAU,CACR,GAAG,EAAE,CACH,MAAM,CACJ,IAAI,KAAK,CACP,cAAc,SAAS,yCAAyC,CACjE,CACF,EACH,SAAS,CACV,CACF,CAAC;IACF,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,CAAe,CAAC;AACtD,CAAC;AAhBD,oDAgBC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@massalabs/wallet-provider",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.1-dev.20230424074402",
|
|
4
4
|
"description": "massa's wallet provider",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"update-version-major": "npm version major",
|
|
17
17
|
"update-version-minor": "npm version minor",
|
|
18
18
|
"update-version-patch": "npm version patch",
|
|
19
|
-
"test:serve-dapp": "cp ./bundle.js ./test/dapp/bundle.js && http-server test/dapp --cors --port 9009",
|
|
19
|
+
"test:serve-dapp": "cp ./bundle.js ./test/dapp/bundle.js && http-server test/dapp --cors --port 9009",
|
|
20
20
|
"test": "cd ./test && npx playwright test",
|
|
21
21
|
"lint": "eslint .",
|
|
22
22
|
"lint:fix": "eslint . --fix",
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"bundle.min.js"
|
|
54
54
|
],
|
|
55
55
|
"dependencies": {
|
|
56
|
+
"axios": "^0.26.1",
|
|
56
57
|
"bignumber.js": "^9.1.1",
|
|
57
58
|
"buffer": "^6.0.3",
|
|
58
59
|
"esmify": "^2.1.1",
|
|
@@ -76,6 +77,9 @@
|
|
|
76
77
|
"http-server": "^14.1.1",
|
|
77
78
|
"mocha": "^10.2.0",
|
|
78
79
|
"node-ts": "^5.1.2",
|
|
80
|
+
"prettier": "^2.8.4",
|
|
81
|
+
"prettier-eslint": "^15.0.1",
|
|
82
|
+
"prettier-standard": "^16.4.1",
|
|
79
83
|
"ts-node": "^10.9.1",
|
|
80
84
|
"tslib": "^2.5.0",
|
|
81
85
|
"tslint": "^6.1.3",
|