@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,77 @@
|
|
|
1
|
+
import { IAccountBalanceResponse, IAccountDetails, IAccountSignResponse, ITransactionDetails } from '..';
|
|
2
|
+
import { IAccount } from '../account/IAccount';
|
|
3
|
+
/**
|
|
4
|
+
* This module contains the ThyraAccount class. It is responsible for representing an account in the Thyra wallet.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* This class provides methods to interact with Thyra account's {@link balance} and to {@link sign} messages.
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
export declare class ThyraAccount implements IAccount {
|
|
11
|
+
private _providerName;
|
|
12
|
+
private _address;
|
|
13
|
+
private _name;
|
|
14
|
+
/**
|
|
15
|
+
* This constructor takes an object of type IAccountDetails and a providerName string as its arguments.
|
|
16
|
+
*
|
|
17
|
+
* @param address - The address of the account.
|
|
18
|
+
* @param name - The name of the account.
|
|
19
|
+
* @param providerName - The name of the provider.
|
|
20
|
+
* @returns An instance of the Account class.
|
|
21
|
+
*
|
|
22
|
+
* @remarks
|
|
23
|
+
* - The Account constructor takes an object of type IAccountDetails and a providerName string as its arguments.
|
|
24
|
+
* - The IAccountDetails object contains the account's address and name.
|
|
25
|
+
* - The providerName string identifies the provider that is used to interact with the blockchain.
|
|
26
|
+
*/
|
|
27
|
+
constructor({ address, name }: IAccountDetails, providerName: string);
|
|
28
|
+
/**
|
|
29
|
+
* @returns The address of the account.
|
|
30
|
+
*/
|
|
31
|
+
address(): string;
|
|
32
|
+
/**
|
|
33
|
+
* @returns The name of the account.
|
|
34
|
+
*/
|
|
35
|
+
name(): string;
|
|
36
|
+
/**
|
|
37
|
+
* @returns The name of the provider.
|
|
38
|
+
*/
|
|
39
|
+
providerName(): string;
|
|
40
|
+
/**
|
|
41
|
+
* This method aims to retrieve the account's balance.
|
|
42
|
+
*
|
|
43
|
+
* @returns A promise that resolves to an object of type IAccountBalanceResponse. It contains the account's balance.
|
|
44
|
+
*/
|
|
45
|
+
balance(): Promise<IAccountBalanceResponse>;
|
|
46
|
+
/**
|
|
47
|
+
* This method aims to sign a message.
|
|
48
|
+
*
|
|
49
|
+
* @param data - The message to be signed.
|
|
50
|
+
* @returns An IAccountSignResponse object. It contains the signature of the message.
|
|
51
|
+
*/
|
|
52
|
+
sign(data: Uint8Array | string): Promise<IAccountSignResponse>;
|
|
53
|
+
/**
|
|
54
|
+
* This method aims to buy rolls on behalf of the sender.
|
|
55
|
+
*
|
|
56
|
+
* @param amount - The amount of rolls to be bought.
|
|
57
|
+
* @param fee - The fee to be paid for the transaction execution by the node.
|
|
58
|
+
* @returns An ITransactionDetails object. It contains the operationId on the network.
|
|
59
|
+
*/
|
|
60
|
+
buyRolls(amount: bigint, fee: bigint): Promise<ITransactionDetails>;
|
|
61
|
+
/**
|
|
62
|
+
* This method aims to sell rolls on behalf of the sender.
|
|
63
|
+
*
|
|
64
|
+
* @param amount - The amount of rolls to be sold.
|
|
65
|
+
* @param fee - The fee to be paid for the transaction execution by the node.
|
|
66
|
+
* @returns An ITransactionDetails object. It contains the operationId on the network.
|
|
67
|
+
*/
|
|
68
|
+
sellRolls(amount: bigint, fee: bigint): Promise<ITransactionDetails>;
|
|
69
|
+
/**
|
|
70
|
+
* This method aims to transfer MAS on behalf of the sender to a recipient.
|
|
71
|
+
*
|
|
72
|
+
* @param amount - The amount of MAS to be transferred.
|
|
73
|
+
* @param fee - The fee to be paid for the transaction execution by the node.
|
|
74
|
+
* @returns An ITransactionDetails object. It contains the operationId on the network.
|
|
75
|
+
*/
|
|
76
|
+
sendTransaction(amount: bigint, recipientAddress: string, fee: bigint): Promise<ITransactionDetails>;
|
|
77
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ThyraAccount = void 0;
|
|
4
|
+
const RequestHandler_1 = require("./RequestHandler");
|
|
5
|
+
const ThyraProvider_1 = require("./ThyraProvider");
|
|
6
|
+
/**
|
|
7
|
+
* The Thyra's account balance url
|
|
8
|
+
*/
|
|
9
|
+
const THYRA_BALANCE_URL = `https://my.massa/massa/addresses?attributes=balance&addresses`;
|
|
10
|
+
/**
|
|
11
|
+
* This module contains the ThyraAccount class. It is responsible for representing an account in the Thyra wallet.
|
|
12
|
+
*
|
|
13
|
+
* @remarks
|
|
14
|
+
* This class provides methods to interact with Thyra account's {@link balance} and to {@link sign} messages.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
class ThyraAccount {
|
|
18
|
+
/**
|
|
19
|
+
* This constructor takes an object of type IAccountDetails and a providerName string as its arguments.
|
|
20
|
+
*
|
|
21
|
+
* @param address - The address of the account.
|
|
22
|
+
* @param name - The name of the account.
|
|
23
|
+
* @param providerName - The name of the provider.
|
|
24
|
+
* @returns An instance of the Account class.
|
|
25
|
+
*
|
|
26
|
+
* @remarks
|
|
27
|
+
* - The Account constructor takes an object of type IAccountDetails and a providerName string as its arguments.
|
|
28
|
+
* - The IAccountDetails object contains the account's address and name.
|
|
29
|
+
* - The providerName string identifies the provider that is used to interact with the blockchain.
|
|
30
|
+
*/
|
|
31
|
+
constructor({ address, name }, providerName) {
|
|
32
|
+
this._address = address;
|
|
33
|
+
this._name = name;
|
|
34
|
+
this._providerName = providerName;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* @returns The address of the account.
|
|
38
|
+
*/
|
|
39
|
+
address() {
|
|
40
|
+
return this._address;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* @returns The name of the account.
|
|
44
|
+
*/
|
|
45
|
+
name() {
|
|
46
|
+
return this._name;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* @returns The name of the provider.
|
|
50
|
+
*/
|
|
51
|
+
providerName() {
|
|
52
|
+
return this._providerName;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* This method aims to retrieve the account's balance.
|
|
56
|
+
*
|
|
57
|
+
* @returns A promise that resolves to an object of type IAccountBalanceResponse. It contains the account's balance.
|
|
58
|
+
*/
|
|
59
|
+
async balance() {
|
|
60
|
+
let signOpResponse = null;
|
|
61
|
+
try {
|
|
62
|
+
signOpResponse = await (0, RequestHandler_1.getRequest)(`${THYRA_BALANCE_URL}=${this._address}`);
|
|
63
|
+
}
|
|
64
|
+
catch (ex) {
|
|
65
|
+
console.error(`Thyra account balance error`);
|
|
66
|
+
throw ex;
|
|
67
|
+
}
|
|
68
|
+
if (signOpResponse.isError || signOpResponse.error) {
|
|
69
|
+
throw signOpResponse.error;
|
|
70
|
+
}
|
|
71
|
+
const balance = signOpResponse.result.addressesAttributes[this._address].balance;
|
|
72
|
+
return {
|
|
73
|
+
finalBalance: balance.final,
|
|
74
|
+
candidateBalance: balance.pending,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* This method aims to sign a message.
|
|
79
|
+
*
|
|
80
|
+
* @param data - The message to be signed.
|
|
81
|
+
* @returns An IAccountSignResponse object. It contains the signature of the message.
|
|
82
|
+
*/
|
|
83
|
+
async sign(data) {
|
|
84
|
+
let signOpResponse = null;
|
|
85
|
+
try {
|
|
86
|
+
signOpResponse = await (0, RequestHandler_1.postRequest)(`${ThyraProvider_1.THYRA_ACCOUNTS_URL}/${this._name}/signOperation`, {
|
|
87
|
+
operation: data,
|
|
88
|
+
batch: false,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
catch (ex) {
|
|
92
|
+
console.error(`Thyra account signing error`);
|
|
93
|
+
throw ex;
|
|
94
|
+
}
|
|
95
|
+
if (signOpResponse.isError || signOpResponse.error) {
|
|
96
|
+
throw signOpResponse.error;
|
|
97
|
+
}
|
|
98
|
+
return signOpResponse.result;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* This method aims to buy rolls on behalf of the sender.
|
|
102
|
+
*
|
|
103
|
+
* @param amount - The amount of rolls to be bought.
|
|
104
|
+
* @param fee - The fee to be paid for the transaction execution by the node.
|
|
105
|
+
* @returns An ITransactionDetails object. It contains the operationId on the network.
|
|
106
|
+
*/
|
|
107
|
+
buyRolls(amount, fee) {
|
|
108
|
+
throw new Error('Method not implemented.');
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* This method aims to sell rolls on behalf of the sender.
|
|
112
|
+
*
|
|
113
|
+
* @param amount - The amount of rolls to be sold.
|
|
114
|
+
* @param fee - The fee to be paid for the transaction execution by the node.
|
|
115
|
+
* @returns An ITransactionDetails object. It contains the operationId on the network.
|
|
116
|
+
*/
|
|
117
|
+
sellRolls(amount, fee) {
|
|
118
|
+
throw new Error('Method not implemented.');
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* This method aims to transfer MAS on behalf of the sender to a recipient.
|
|
122
|
+
*
|
|
123
|
+
* @param amount - The amount of MAS to be transferred.
|
|
124
|
+
* @param fee - The fee to be paid for the transaction execution by the node.
|
|
125
|
+
* @returns An ITransactionDetails object. It contains the operationId on the network.
|
|
126
|
+
*/
|
|
127
|
+
sendTransaction(amount, recipientAddress, fee) {
|
|
128
|
+
throw new Error('Method not implemented.');
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
exports.ThyraAccount = ThyraAccount;
|
|
132
|
+
//# sourceMappingURL=ThyraAccount.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThyraAccount.js","sourceRoot":"","sources":["../../src/thyra/ThyraAccount.ts"],"names":[],"mappings":";;;AAOA,qDAAgF;AAChF,mDAAqD;AAErD;;GAEG;AACH,MAAM,iBAAiB,GAAG,+DAA+D,CAAC;AA4B1F;;;;;;GAMG;AACH,MAAa,YAAY;IAKvB;;;;;;;;;;;;OAYG;IACH,YAAmB,EAAE,OAAO,EAAE,IAAI,EAAmB,EAAE,YAAoB;QACzE,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;IACpC,CAAC;IAED;;OAEG;IACI,OAAO;QACZ,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED;;OAEG;IACI,IAAI;QACT,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IA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AAC,MAAc,EAAE,GAAW;QAClC,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED;;;;;;OAMG;IACH,SAAS,CAAC,MAAc,EAAE,GAAW;QACnC,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED;;;;;;OAMG;IACH,eAAe,CACb,MAAc,EACd,gBAAwB,EACxB,GAAW;QAEX,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;CACF;AArID,oCAqIC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file defines a TypeScript class named ThyraDiscovery.
|
|
3
|
+
* The class is being used to recursively search for a connection to Thyra's server
|
|
4
|
+
* and if so report this via emitting messages.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* - If you are only looking to use our library, the connector ThyraDiscovery will not be useful to you.
|
|
8
|
+
* - If you want to work on this repo, you will probably be interested in this object
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
/// <reference types="node" />
|
|
12
|
+
import { EventEmitter } from 'events';
|
|
13
|
+
/**
|
|
14
|
+
* Url used for the thyra discovery and pinging the thyra server's index.html
|
|
15
|
+
*/
|
|
16
|
+
export declare const THYRA_DISCOVERY_URL = "https://my.massa/thyra/home/index.html";
|
|
17
|
+
/**
|
|
18
|
+
* A message emitted on successful Thyra discovery
|
|
19
|
+
*/
|
|
20
|
+
export declare const ON_THYRA_DISCOVERED = "ON_THYRA_DISCOVERED";
|
|
21
|
+
/**
|
|
22
|
+
* A message emitted on Thyra disconnect
|
|
23
|
+
*/
|
|
24
|
+
export declare const ON_THYRA_DISCONNECTED = "ON_THYRA_DISCONNECTED";
|
|
25
|
+
/**
|
|
26
|
+
* This file defines a TypeScript class named ThyraDiscovery.
|
|
27
|
+
* The class is being used to recursively ping Thyra's server
|
|
28
|
+
* and if a response is received emit a message so Thyra can be enlisted as a wallet provider in the `Connector` class.
|
|
29
|
+
*/
|
|
30
|
+
export declare class ThyraDiscovery extends EventEmitter {
|
|
31
|
+
private readonly pollIntervalMillis;
|
|
32
|
+
private timeoutId;
|
|
33
|
+
private isDiscovered;
|
|
34
|
+
/**
|
|
35
|
+
* ThyraDiscovery constructor
|
|
36
|
+
*
|
|
37
|
+
* @param pollIntervalMillis - Polling interval defined in milliseconds
|
|
38
|
+
*
|
|
39
|
+
* @remarks
|
|
40
|
+
* - It creates a timeout using the given `pollIntervalMillis` argument on every trigger of which
|
|
41
|
+
* the Thyra pinging is triggered and if a successful response is fetched,
|
|
42
|
+
* a message `ON_THYRA_DISCOVERED` is emitted that Thyra has been discovered
|
|
43
|
+
* as a wallet provider upon which the `Connector` class will enlist Thyra as a wallet provider
|
|
44
|
+
* - If once found, but then disconnected the following message `ON_THYRA_DISCONNECTED` is being emitted
|
|
45
|
+
* so that the `Connector` class delists Thyra as a wallet provider
|
|
46
|
+
*
|
|
47
|
+
* @returns An instance of the ThyraDiscovery class.
|
|
48
|
+
*
|
|
49
|
+
*/
|
|
50
|
+
constructor(pollIntervalMillis: number);
|
|
51
|
+
/**
|
|
52
|
+
* A callback method that triggers a ping of the Thyra's server
|
|
53
|
+
*
|
|
54
|
+
* @returns void
|
|
55
|
+
*/
|
|
56
|
+
private callback;
|
|
57
|
+
/**
|
|
58
|
+
* A method to stop listening for a connection to Thyra's server
|
|
59
|
+
*
|
|
60
|
+
* @returns void
|
|
61
|
+
*/
|
|
62
|
+
stopListening(): void;
|
|
63
|
+
/**
|
|
64
|
+
* A method to start listening for a connection to Thyra's server.
|
|
65
|
+
*
|
|
66
|
+
* @returns void
|
|
67
|
+
*/
|
|
68
|
+
startListening(): void;
|
|
69
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file defines a TypeScript class named ThyraDiscovery.
|
|
4
|
+
* The class is being used to recursively search for a connection to Thyra's server
|
|
5
|
+
* and if so report this via emitting messages.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* - If you are only looking to use our library, the connector ThyraDiscovery will not be useful to you.
|
|
9
|
+
* - If you want to work on this repo, you will probably be interested in this object
|
|
10
|
+
*
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.ThyraDiscovery = exports.ON_THYRA_DISCONNECTED = exports.ON_THYRA_DISCOVERED = exports.THYRA_DISCOVERY_URL = void 0;
|
|
14
|
+
const events_1 = require("events");
|
|
15
|
+
const time_1 = require("../utils/time");
|
|
16
|
+
const RequestHandler_1 = require("./RequestHandler");
|
|
17
|
+
/**
|
|
18
|
+
* Url used for the thyra discovery and pinging the thyra server's index.html
|
|
19
|
+
*/
|
|
20
|
+
exports.THYRA_DISCOVERY_URL = 'https://my.massa/thyra/home/index.html';
|
|
21
|
+
/**
|
|
22
|
+
* A message emitted on successful Thyra discovery
|
|
23
|
+
*/
|
|
24
|
+
exports.ON_THYRA_DISCOVERED = 'ON_THYRA_DISCOVERED';
|
|
25
|
+
/**
|
|
26
|
+
* A message emitted on Thyra disconnect
|
|
27
|
+
*/
|
|
28
|
+
exports.ON_THYRA_DISCONNECTED = 'ON_THYRA_DISCONNECTED';
|
|
29
|
+
/**
|
|
30
|
+
* This file defines a TypeScript class named ThyraDiscovery.
|
|
31
|
+
* The class is being used to recursively ping Thyra's server
|
|
32
|
+
* and if a response is received emit a message so Thyra can be enlisted as a wallet provider in the `Connector` class.
|
|
33
|
+
*/
|
|
34
|
+
class ThyraDiscovery extends events_1.EventEmitter {
|
|
35
|
+
/**
|
|
36
|
+
* ThyraDiscovery constructor
|
|
37
|
+
*
|
|
38
|
+
* @param pollIntervalMillis - Polling interval defined in milliseconds
|
|
39
|
+
*
|
|
40
|
+
* @remarks
|
|
41
|
+
* - It creates a timeout using the given `pollIntervalMillis` argument on every trigger of which
|
|
42
|
+
* the Thyra pinging is triggered and if a successful response is fetched,
|
|
43
|
+
* a message `ON_THYRA_DISCOVERED` is emitted that Thyra has been discovered
|
|
44
|
+
* as a wallet provider upon which the `Connector` class will enlist Thyra as a wallet provider
|
|
45
|
+
* - If once found, but then disconnected the following message `ON_THYRA_DISCONNECTED` is being emitted
|
|
46
|
+
* so that the `Connector` class delists Thyra as a wallet provider
|
|
47
|
+
*
|
|
48
|
+
* @returns An instance of the ThyraDiscovery class.
|
|
49
|
+
*
|
|
50
|
+
*/
|
|
51
|
+
constructor(pollIntervalMillis) {
|
|
52
|
+
super();
|
|
53
|
+
this.pollIntervalMillis = pollIntervalMillis;
|
|
54
|
+
this.timeoutId = null;
|
|
55
|
+
this.isDiscovered = false;
|
|
56
|
+
// bind class methods
|
|
57
|
+
this.callback = this.callback.bind(this);
|
|
58
|
+
this.stopListening = this.stopListening.bind(this);
|
|
59
|
+
this.startListening = this.startListening.bind(this);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* A callback method that triggers a ping of the Thyra's server
|
|
63
|
+
*
|
|
64
|
+
* @returns void
|
|
65
|
+
*/
|
|
66
|
+
async callback() {
|
|
67
|
+
let resp = null;
|
|
68
|
+
try {
|
|
69
|
+
resp = await (0, RequestHandler_1.getRequest)(exports.THYRA_DISCOVERY_URL);
|
|
70
|
+
}
|
|
71
|
+
catch (ex) {
|
|
72
|
+
console.error(`Error calling ${exports.THYRA_DISCOVERY_URL}`);
|
|
73
|
+
}
|
|
74
|
+
if (!resp.isError && !resp.error) {
|
|
75
|
+
this.isDiscovered = true;
|
|
76
|
+
this.emit(exports.ON_THYRA_DISCOVERED);
|
|
77
|
+
}
|
|
78
|
+
if ((resp.isError || resp.error) && this.isDiscovered) {
|
|
79
|
+
this.emit(exports.ON_THYRA_DISCONNECTED);
|
|
80
|
+
}
|
|
81
|
+
// reset the interval
|
|
82
|
+
this.timeoutId = new time_1.Timeout(this.pollIntervalMillis, () => this.callback());
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* A method to stop listening for a connection to Thyra's server
|
|
86
|
+
*
|
|
87
|
+
* @returns void
|
|
88
|
+
*/
|
|
89
|
+
stopListening() {
|
|
90
|
+
if (this.timeoutId)
|
|
91
|
+
this.timeoutId.clear();
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* A method to start listening for a connection to Thyra's server.
|
|
95
|
+
*
|
|
96
|
+
* @returns void
|
|
97
|
+
*/
|
|
98
|
+
startListening() {
|
|
99
|
+
const that = this;
|
|
100
|
+
if (this.timeoutId) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
this.timeoutId = new time_1.Timeout(this.pollIntervalMillis, () => that.callback());
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
exports.ThyraDiscovery = ThyraDiscovery;
|
|
107
|
+
//# sourceMappingURL=ThyraDiscovery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThyraDiscovery.js","sourceRoot":"","sources":["../../src/thyra/ThyraDiscovery.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAEH,mCAAsC;AACtC,wCAAwC;AACxC,qDAAmE;AAEnE;;GAEG;AACU,QAAA,mBAAmB,GAAG,wCAAwC,CAAC;AAE5E;;GAEG;AACU,QAAA,mBAAmB,GAAG,qBAAqB,CAAC;AAEzD;;GAEG;AACU,QAAA,qBAAqB,GAAG,uBAAuB,CAAC;AAE7D;;;;GAIG;AACH,MAAa,cAAe,SAAQ,qBAAY;IAI9C;;;;;;;;;;;;;;;OAeG;IACH,YAAoC,kBAA0B;QAC5D,KAAK,EAAE,CAAC;QAD0B,uBAAkB,GAAlB,kBAAkB,CAAQ;QAnBtD,cAAS,GAAmB,IAAI,CAAC;QACjC,iBAAY,GAAG,KAAK,CAAC;QAqB3B,qBAAqB;QACrB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACzC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,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;CACF;AAhFD,wCAgFC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { IAccountDeletionResponse } from '../provider/AccountDeletion';
|
|
2
|
+
import { IAccountImportResponse } from '../provider/AccountImport';
|
|
3
|
+
import { IProvider } from '../provider/IProvider';
|
|
4
|
+
import { IAccount } from '../account/IAccount';
|
|
5
|
+
import { IAccountDetails } from '../account';
|
|
6
|
+
/**
|
|
7
|
+
* The Thyra accounts url
|
|
8
|
+
*/
|
|
9
|
+
export declare const THYRA_ACCOUNTS_URL = "https://my.massa/thyra/plugin/massalabs/wallet/rest/wallet";
|
|
10
|
+
/**
|
|
11
|
+
* Thyra's url for importing accounts
|
|
12
|
+
*/
|
|
13
|
+
export declare const THYRA_IMPORT_ACCOUNTS_URL: string;
|
|
14
|
+
/**
|
|
15
|
+
* Thyra's wallet provider name
|
|
16
|
+
*/
|
|
17
|
+
export declare const THYRA_PROVIDER_NAME = "THYRA";
|
|
18
|
+
/**
|
|
19
|
+
* This interface represents the payload returned by making a call to Thyra's accounts url.
|
|
20
|
+
*/
|
|
21
|
+
export interface IThyraWallet {
|
|
22
|
+
address: string;
|
|
23
|
+
nickname: string;
|
|
24
|
+
keyPair: {
|
|
25
|
+
nonce: string;
|
|
26
|
+
privateKey: string;
|
|
27
|
+
publicKey: string;
|
|
28
|
+
salt: string;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* This class provides an implementation for communicating with the Thyra wallet provider.
|
|
33
|
+
* @remarks
|
|
34
|
+
* This class is used as a proxy to the Thyra server for exchanging message over https calls.
|
|
35
|
+
*/
|
|
36
|
+
export declare class ThyraProvider implements IProvider {
|
|
37
|
+
private providerName;
|
|
38
|
+
/**
|
|
39
|
+
* Provider constructor
|
|
40
|
+
*
|
|
41
|
+
* @param providerName - The name of the provider.
|
|
42
|
+
* @returns An instance of the Provider class.
|
|
43
|
+
*/
|
|
44
|
+
constructor();
|
|
45
|
+
/**
|
|
46
|
+
* This method returns the name of the provider.
|
|
47
|
+
* @returns The name of the provider.
|
|
48
|
+
*/
|
|
49
|
+
name(): string;
|
|
50
|
+
/**
|
|
51
|
+
* This method sends a message to the Thyra server to get the list of accounts for the provider.
|
|
52
|
+
* It returns a Promise that resolves to an array of Account instances.
|
|
53
|
+
*
|
|
54
|
+
* @returns A promise that resolves to an array of Account instances.
|
|
55
|
+
*/
|
|
56
|
+
accounts(): Promise<IAccount[]>;
|
|
57
|
+
/**
|
|
58
|
+
* This method makes an http call to the Thyra server to import an account with the given publicKey and privateKey.
|
|
59
|
+
*
|
|
60
|
+
* @remarks This method in not yet implemented and depends on `massalabs/thyra-plugin-wallet#82` to be merged first
|
|
61
|
+
*
|
|
62
|
+
* @param publicKey - The public key of the account.
|
|
63
|
+
* @param privateKey - The private key of the account.
|
|
64
|
+
* @returns a Promise that resolves to an instance of IAccountImportResponse.
|
|
65
|
+
*
|
|
66
|
+
*/
|
|
67
|
+
importAccount(publicKey: string, privateKey: string): Promise<IAccountImportResponse>;
|
|
68
|
+
/**
|
|
69
|
+
* This method sends an http call to the Thyra server to delete the account associated with the given address.
|
|
70
|
+
*
|
|
71
|
+
* @param address - The address of the account.
|
|
72
|
+
* @returns a Promise that resolves to an instance of IAccountDeletionResponse.
|
|
73
|
+
*/
|
|
74
|
+
deleteAccount(address: string): Promise<IAccountDeletionResponse>;
|
|
75
|
+
/**
|
|
76
|
+
* This method sends an http call to the Thyra server to obtain node urls.
|
|
77
|
+
*
|
|
78
|
+
* @returns a Promise that resolves to a list of node urls.
|
|
79
|
+
*/
|
|
80
|
+
getNodesUrls(): Promise<string[]>;
|
|
81
|
+
/**
|
|
82
|
+
* This method sends an http call to the Thyra server to create a new random account.
|
|
83
|
+
*
|
|
84
|
+
* @returns a Promise that resolves to the details of the newly generated account.
|
|
85
|
+
*/
|
|
86
|
+
generateNewAccount(name: string): Promise<IAccountDetails>;
|
|
87
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ThyraProvider = exports.THYRA_PROVIDER_NAME = exports.THYRA_IMPORT_ACCOUNTS_URL = exports.THYRA_ACCOUNTS_URL = void 0;
|
|
4
|
+
const AccountDeletion_1 = require("../provider/AccountDeletion");
|
|
5
|
+
const RequestHandler_1 = require("./RequestHandler");
|
|
6
|
+
const ThyraAccount_1 = require("./ThyraAccount");
|
|
7
|
+
/**
|
|
8
|
+
* The Thyra accounts url
|
|
9
|
+
*/
|
|
10
|
+
exports.THYRA_ACCOUNTS_URL = 'https://my.massa/thyra/plugin/massalabs/wallet/rest/wallet';
|
|
11
|
+
/**
|
|
12
|
+
* Thyra's url for importing accounts
|
|
13
|
+
*/
|
|
14
|
+
exports.THYRA_IMPORT_ACCOUNTS_URL = `${exports.THYRA_ACCOUNTS_URL}/import/`;
|
|
15
|
+
/**
|
|
16
|
+
* Thyra's wallet provider name
|
|
17
|
+
*/
|
|
18
|
+
exports.THYRA_PROVIDER_NAME = 'THYRA';
|
|
19
|
+
/**
|
|
20
|
+
* This class provides an implementation for communicating with the Thyra wallet provider.
|
|
21
|
+
* @remarks
|
|
22
|
+
* This class is used as a proxy to the Thyra server for exchanging message over https calls.
|
|
23
|
+
*/
|
|
24
|
+
class ThyraProvider {
|
|
25
|
+
/**
|
|
26
|
+
* Provider constructor
|
|
27
|
+
*
|
|
28
|
+
* @param providerName - The name of the provider.
|
|
29
|
+
* @returns An instance of the Provider class.
|
|
30
|
+
*/
|
|
31
|
+
constructor() {
|
|
32
|
+
this.providerName = exports.THYRA_PROVIDER_NAME;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* This method returns the name of the provider.
|
|
36
|
+
* @returns The name of the provider.
|
|
37
|
+
*/
|
|
38
|
+
name() {
|
|
39
|
+
return this.providerName;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* This method sends a message to the Thyra server to get the list of accounts for the provider.
|
|
43
|
+
* It returns a Promise that resolves to an array of Account instances.
|
|
44
|
+
*
|
|
45
|
+
* @returns A promise that resolves to an array of Account instances.
|
|
46
|
+
*/
|
|
47
|
+
async accounts() {
|
|
48
|
+
let thyraAccountsResponse = null;
|
|
49
|
+
try {
|
|
50
|
+
thyraAccountsResponse = await (0, RequestHandler_1.getRequest)(exports.THYRA_ACCOUNTS_URL);
|
|
51
|
+
}
|
|
52
|
+
catch (ex) {
|
|
53
|
+
console.error(`Thyra accounts retrieval error`);
|
|
54
|
+
throw ex;
|
|
55
|
+
}
|
|
56
|
+
if (thyraAccountsResponse.isError || thyraAccountsResponse.error) {
|
|
57
|
+
throw thyraAccountsResponse.error.message;
|
|
58
|
+
}
|
|
59
|
+
return thyraAccountsResponse.result.map((thyraAccount) => {
|
|
60
|
+
return new ThyraAccount_1.ThyraAccount({ address: thyraAccount.address, name: thyraAccount.nickname }, this.providerName);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* This method makes an http call to the Thyra server to import an account with the given publicKey and privateKey.
|
|
65
|
+
*
|
|
66
|
+
* @remarks This method in not yet implemented and depends on `massalabs/thyra-plugin-wallet#82` to be merged first
|
|
67
|
+
*
|
|
68
|
+
* @param publicKey - The public key of the account.
|
|
69
|
+
* @param privateKey - The private key of the account.
|
|
70
|
+
* @returns a Promise that resolves to an instance of IAccountImportResponse.
|
|
71
|
+
*
|
|
72
|
+
*/
|
|
73
|
+
async importAccount(publicKey, privateKey) {
|
|
74
|
+
// TODO: once massalabs/thyra-plugin-wallet#82 is merged, to be updated here
|
|
75
|
+
throw new Error(`Unimplemented method!`);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* This method sends an http call to the Thyra server to delete the account associated with the given address.
|
|
79
|
+
*
|
|
80
|
+
* @param address - The address of the account.
|
|
81
|
+
* @returns a Promise that resolves to an instance of IAccountDeletionResponse.
|
|
82
|
+
*/
|
|
83
|
+
async deleteAccount(address) {
|
|
84
|
+
// get all accounts
|
|
85
|
+
let allAccounts = null;
|
|
86
|
+
try {
|
|
87
|
+
allAccounts = await (0, RequestHandler_1.getRequest)(exports.THYRA_ACCOUNTS_URL);
|
|
88
|
+
}
|
|
89
|
+
catch (ex) {
|
|
90
|
+
console.error(`Thyra accounts retrieval error`);
|
|
91
|
+
throw ex;
|
|
92
|
+
}
|
|
93
|
+
if (allAccounts.isError || allAccounts.error) {
|
|
94
|
+
throw allAccounts.error.message;
|
|
95
|
+
}
|
|
96
|
+
// find the account with the desired address
|
|
97
|
+
const accountToDelete = allAccounts.result.find((account) => account.address.toLowerCase() === address.toLowerCase());
|
|
98
|
+
// delete the account in question
|
|
99
|
+
let thyraAccountsResponse = null;
|
|
100
|
+
try {
|
|
101
|
+
thyraAccountsResponse = await (0, RequestHandler_1.deleteRequest)(`${exports.THYRA_ACCOUNTS_URL}/${accountToDelete.nickname}`);
|
|
102
|
+
}
|
|
103
|
+
catch (ex) {
|
|
104
|
+
console.error(`Thyra accounts deletion error`, ex);
|
|
105
|
+
return {
|
|
106
|
+
response: AccountDeletion_1.EAccountDeletionResponse.ERROR,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
if (thyraAccountsResponse.isError || thyraAccountsResponse.error) {
|
|
110
|
+
console.error(`Thyra accounts deletion error`, thyraAccountsResponse.error.message);
|
|
111
|
+
return {
|
|
112
|
+
response: AccountDeletion_1.EAccountDeletionResponse.ERROR,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
return {
|
|
116
|
+
response: AccountDeletion_1.EAccountDeletionResponse.OK,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* This method sends an http call to the Thyra server to obtain node urls.
|
|
121
|
+
*
|
|
122
|
+
* @returns a Promise that resolves to a list of node urls.
|
|
123
|
+
*/
|
|
124
|
+
async getNodesUrls() {
|
|
125
|
+
throw new Error('Method not implemented.');
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* This method sends an http call to the Thyra server to create a new random account.
|
|
129
|
+
*
|
|
130
|
+
* @returns a Promise that resolves to the details of the newly generated account.
|
|
131
|
+
*/
|
|
132
|
+
async generateNewAccount(name) {
|
|
133
|
+
throw new Error('Method not implemented.');
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
exports.ThyraProvider = ThyraProvider;
|
|
137
|
+
//# sourceMappingURL=ThyraProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThyraProvider.js","sourceRoot":"","sources":["../../src/thyra/ThyraProvider.ts"],"names":[],"mappings":";;;AAAA,iEAIqC;AAMrC,qDAI0B;AAC1B,iDAA8C;AAI9C;;GAEG;AACU,QAAA,kBAAkB,GAC7B,4DAA4D,CAAC;AAE/D;;GAEG;AACU,QAAA,yBAAyB,GAAG,GAAG,0BAAkB,UAAU,CAAC;AAEzE;;GAEG;AACU,QAAA,mBAAmB,GAAG,OAAO,CAAC;AAgB3C;;;;GAIG;AACH,MAAa,aAAa;IAGxB;;;;;OAKG;IACH;QACE,IAAI,CAAC,YAAY,GAAG,2BAAmB,CAAC;IAC1C,CAAC;IAED;;;OAGG;IACI,IAAI;QACT,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,QAAQ;QACnB,IAAI,qBAAqB,GAA6C,IAAI,CAAC;QAC3E,IAAI;YACF,qBAAqB,GAAG,MAAM,IAAA,2BAAU,EACtC,0BAAkB,CACnB,CAAC;SACH;QAAC,OAAO,EAAE,EAAE;YACX,OAAO,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC;YAChD,MAAM,EAAE,CAAC;SACV;QACD,IAAI,qBAAqB,CAAC,OAAO,IAAI,qBAAqB,CAAC,KAAK,EAAE;YAChE,MAAM,qBAAqB,CAAC,KAAK,CAAC,OAAO,CAAC;SAC3C;QACD,OAAO,qBAAqB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,YAAY,EAAE,EAAE;YACvD,OAAO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