@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,80 @@
|
|
|
1
|
+
import { IAccountBalanceResponse } from './AccountBalance';
|
|
2
|
+
import { IAccountSignResponse } from './AccountSign';
|
|
3
|
+
import { IAccountDetails } from './IAccountDetails';
|
|
4
|
+
import { ITransactionDetails } from '..';
|
|
5
|
+
import { IAccount } from './IAccount';
|
|
6
|
+
/**
|
|
7
|
+
* This module contains the Account class. It is responsible for representing an account in the wallet.
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* This class provides methods to interact with the account's {@link balance} and to {@link sign} messages.
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
export declare class Account implements IAccount {
|
|
14
|
+
private _providerName;
|
|
15
|
+
private _address;
|
|
16
|
+
private _name;
|
|
17
|
+
/**
|
|
18
|
+
* This constructor takes an object of type IAccountDetails and a providerName string as its arguments.
|
|
19
|
+
*
|
|
20
|
+
* @param address - The address of the account.
|
|
21
|
+
* @param name - The name of the account.
|
|
22
|
+
* @param providerName - The name of the provider.
|
|
23
|
+
* @returns An instance of the Account class.
|
|
24
|
+
*
|
|
25
|
+
* @remarks
|
|
26
|
+
* - The Account constructor takes an object of type IAccountDetails and a providerName string as its arguments.
|
|
27
|
+
* - The IAccountDetails object contains the account's address and name.
|
|
28
|
+
* - The providerName string identifies the provider that is used to interact with the blockchain.
|
|
29
|
+
*/
|
|
30
|
+
constructor({ address, name }: IAccountDetails, providerName: string);
|
|
31
|
+
/**
|
|
32
|
+
* @returns The address of the account.
|
|
33
|
+
*/
|
|
34
|
+
address(): string;
|
|
35
|
+
/**
|
|
36
|
+
* @returns The name of the account.
|
|
37
|
+
*/
|
|
38
|
+
name(): string;
|
|
39
|
+
/**
|
|
40
|
+
* @returns The name of the provider.
|
|
41
|
+
*/
|
|
42
|
+
providerName(): string;
|
|
43
|
+
/**
|
|
44
|
+
* This method aims to retrieve the account's balance.
|
|
45
|
+
*
|
|
46
|
+
* @returns A promise that resolves to an object of type IAccountBalanceResponse. It contains the account's balance.
|
|
47
|
+
*/
|
|
48
|
+
balance(): Promise<IAccountBalanceResponse>;
|
|
49
|
+
/**
|
|
50
|
+
* This method aims to sign a message.
|
|
51
|
+
*
|
|
52
|
+
* @param data - The message to be signed.
|
|
53
|
+
* @returns An IAccountSignResponse object. It contains the signature of the message.
|
|
54
|
+
*/
|
|
55
|
+
sign(data: Uint8Array): Promise<IAccountSignResponse>;
|
|
56
|
+
/**
|
|
57
|
+
* This method aims to buy rolls on behalf of the sender.
|
|
58
|
+
*
|
|
59
|
+
* @param amount - The amount of rolls to be purchased
|
|
60
|
+
* @param fee - The fee to be paid for the transaction execution by the node..
|
|
61
|
+
* @returns An ITransactionDetails object. It contains the operationId on the network.
|
|
62
|
+
*/
|
|
63
|
+
buyRolls(amount: bigint, fee: bigint): Promise<ITransactionDetails>;
|
|
64
|
+
/**
|
|
65
|
+
* This method aims to sell rolls on behalf of the sender.
|
|
66
|
+
*
|
|
67
|
+
* @param amount - The amount of rolls to be sold.
|
|
68
|
+
* @param fee - The fee to be paid for the transaction execution by the node..
|
|
69
|
+
* @returns An ITransactionDetails object. It contains the operationId on the network.
|
|
70
|
+
*/
|
|
71
|
+
sellRolls(amount: bigint, fee: bigint): Promise<ITransactionDetails>;
|
|
72
|
+
/**
|
|
73
|
+
* This method aims to transfer MAS on behalf of the sender to a recipient.
|
|
74
|
+
*
|
|
75
|
+
* @param amount - The amount of MAS to be transferred.
|
|
76
|
+
* @param fee - The fee to be paid for the transaction execution by the node..
|
|
77
|
+
* @returns An ITransactionDetails object. It contains the operationId on the network.
|
|
78
|
+
*/
|
|
79
|
+
sendTransaction(amount: bigint, recipientAddress: string, fee: bigint): Promise<ITransactionDetails>;
|
|
80
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Account = void 0;
|
|
4
|
+
const Connector_1 = require("../connector/Connector");
|
|
5
|
+
const __1 = require("..");
|
|
6
|
+
/**
|
|
7
|
+
* This module contains the Account class. It is responsible for representing an account in the wallet.
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* This class provides methods to interact with the account's {@link balance} and to {@link sign} messages.
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
class Account {
|
|
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 }, providerName) {
|
|
28
|
+
this._address = address;
|
|
29
|
+
this._name = name;
|
|
30
|
+
this._providerName = providerName;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* @returns The address of the account.
|
|
34
|
+
*/
|
|
35
|
+
address() {
|
|
36
|
+
return this._address;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* @returns The name of the account.
|
|
40
|
+
*/
|
|
41
|
+
name() {
|
|
42
|
+
return this._name;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* @returns The name of the provider.
|
|
46
|
+
*/
|
|
47
|
+
providerName() {
|
|
48
|
+
return this._providerName;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* This method aims to retrieve the account's balance.
|
|
52
|
+
*
|
|
53
|
+
* @returns A promise that resolves to an object of type IAccountBalanceResponse. It contains the account's balance.
|
|
54
|
+
*/
|
|
55
|
+
async balance() {
|
|
56
|
+
return new Promise((resolve, reject) => {
|
|
57
|
+
Connector_1.connector.sendMessageToContentScript(this._providerName, __1.AvailableCommands.AccountBalance, { address: this._address }, (result, err) => {
|
|
58
|
+
if (err)
|
|
59
|
+
return reject(err);
|
|
60
|
+
return resolve(result);
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* This method aims to sign a message.
|
|
66
|
+
*
|
|
67
|
+
* @param data - The message to be signed.
|
|
68
|
+
* @returns An IAccountSignResponse object. It contains the signature of the message.
|
|
69
|
+
*/
|
|
70
|
+
async sign(data) {
|
|
71
|
+
return new Promise((resolve, reject) => {
|
|
72
|
+
Connector_1.connector.sendMessageToContentScript(this._providerName, __1.AvailableCommands.AccountSign, { address: this._address, data }, (result, err) => {
|
|
73
|
+
if (err)
|
|
74
|
+
return reject(err);
|
|
75
|
+
return resolve(result);
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* This method aims to buy rolls on behalf of the sender.
|
|
81
|
+
*
|
|
82
|
+
* @param amount - The amount of rolls to be purchased
|
|
83
|
+
* @param fee - The fee to be paid for the transaction execution by the node..
|
|
84
|
+
* @returns An ITransactionDetails object. It contains the operationId on the network.
|
|
85
|
+
*/
|
|
86
|
+
async buyRolls(amount, fee) {
|
|
87
|
+
return new Promise((resolve, reject) => {
|
|
88
|
+
Connector_1.connector.sendMessageToContentScript(this._providerName, __1.AvailableCommands.AccountBuyRolls, {
|
|
89
|
+
amount: amount.toString(),
|
|
90
|
+
fee: fee.toString(),
|
|
91
|
+
}, (result, err) => {
|
|
92
|
+
if (err)
|
|
93
|
+
return reject(err);
|
|
94
|
+
return resolve(result);
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* This method aims to sell rolls on behalf of the sender.
|
|
100
|
+
*
|
|
101
|
+
* @param amount - The amount of rolls to be sold.
|
|
102
|
+
* @param fee - The fee to be paid for the transaction execution by the node..
|
|
103
|
+
* @returns An ITransactionDetails object. It contains the operationId on the network.
|
|
104
|
+
*/
|
|
105
|
+
async sellRolls(amount, fee) {
|
|
106
|
+
return new Promise((resolve, reject) => {
|
|
107
|
+
Connector_1.connector.sendMessageToContentScript(this._providerName, __1.AvailableCommands.AccountSellRolls, {
|
|
108
|
+
amount: amount.toString(),
|
|
109
|
+
fee: fee.toString(),
|
|
110
|
+
}, (result, err) => {
|
|
111
|
+
if (err)
|
|
112
|
+
return reject(err);
|
|
113
|
+
return resolve(result);
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* This method aims to transfer MAS on behalf of the sender to a recipient.
|
|
119
|
+
*
|
|
120
|
+
* @param amount - The amount of MAS to be transferred.
|
|
121
|
+
* @param fee - The fee to be paid for the transaction execution by the node..
|
|
122
|
+
* @returns An ITransactionDetails object. It contains the operationId on the network.
|
|
123
|
+
*/
|
|
124
|
+
async sendTransaction(amount, recipientAddress, fee) {
|
|
125
|
+
return new Promise((resolve, reject) => {
|
|
126
|
+
Connector_1.connector.sendMessageToContentScript(this._providerName, __1.AvailableCommands.AccountSendTransaction, {
|
|
127
|
+
amount: amount.toString(),
|
|
128
|
+
recipientAddress,
|
|
129
|
+
fee: fee.toString(),
|
|
130
|
+
}, (result, err) => {
|
|
131
|
+
if (err)
|
|
132
|
+
return reject(err);
|
|
133
|
+
return resolve(result);
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
exports.Account = Account;
|
|
139
|
+
//# sourceMappingURL=Account.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Account.js","sourceRoot":"","sources":["../../src/account/Account.ts"],"names":[],"mappings":";;;AAKA,sDAAmD;AAEnD,0BAA4D;AAK5D;;;;;;GAMG;AACH,MAAa,OAAO;IAKlB;;;;;;;;;;;;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,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E;aACc,EACnC,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE;gBACd,IAAI,GAAG;oBAAE,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;gBAC5B,OAAO,OAAO,CAAC,MAA6B,CAAC,CAAC;YAChD,CAAC,CACF,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAtKD,0BAsKC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This interface represents the request object of the AccountBalance command.
|
|
3
|
+
*/
|
|
4
|
+
export interface IAccountBalanceRequest {
|
|
5
|
+
address: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* This interface represents the response object of the AccountBalance command sent by the content script.
|
|
9
|
+
*/
|
|
10
|
+
export interface IAccountBalanceResponse {
|
|
11
|
+
finalBalance: string;
|
|
12
|
+
candidateBalance: string;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccountBalance.js","sourceRoot":"","sources":["../../src/account/AccountBalance.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This interface represents the request object for the signing operation sent to the content script.
|
|
3
|
+
*/
|
|
4
|
+
export interface IAccountSignRequest {
|
|
5
|
+
address: string;
|
|
6
|
+
data: Uint8Array;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* This interface represents the response object containing the signed message data, which is sent by the content script
|
|
10
|
+
* after the signing operation.
|
|
11
|
+
*/
|
|
12
|
+
export interface IAccountSignResponse {
|
|
13
|
+
publicKey: string;
|
|
14
|
+
signature: Uint8Array;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccountSign.js","sourceRoot":"","sources":["../../src/account/AccountSign.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ITransactionDetails } from '..';
|
|
2
|
+
import { IAccountBalanceResponse } from './AccountBalance';
|
|
3
|
+
import { IAccountSignResponse } from './AccountSign';
|
|
4
|
+
/**
|
|
5
|
+
* This interface represents an Account object.
|
|
6
|
+
*/
|
|
7
|
+
export interface IAccount {
|
|
8
|
+
address(): string;
|
|
9
|
+
name(): string;
|
|
10
|
+
providerName(): string;
|
|
11
|
+
balance(): Promise<IAccountBalanceResponse>;
|
|
12
|
+
sign(data: Uint8Array | string): Promise<IAccountSignResponse>;
|
|
13
|
+
buyRolls(amount: bigint, fee: bigint): Promise<ITransactionDetails>;
|
|
14
|
+
sellRolls(amount: bigint, fee: bigint): Promise<ITransactionDetails>;
|
|
15
|
+
sendTransaction(amount: bigint, recipientAddress: string, fee: bigint): Promise<ITransactionDetails>;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IAccount.js","sourceRoot":"","sources":["../../src/account/IAccount.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IAccountDetails.js","sourceRoot":"","sources":["../../src/account/IAccountDetails.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IAccountRolls.js","sourceRoot":"","sources":["../../src/account/IAccountRolls.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IAccountSendTransaction.js","sourceRoot":"","sources":["../../src/account/IAccountSendTransaction.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { Account } from './Account';
|
|
2
|
+
export { IAccountBalanceRequest, IAccountBalanceResponse, } from './AccountBalance';
|
|
3
|
+
export { IAccount } from './IAccount';
|
|
4
|
+
export { IAccountSignRequest, IAccountSignResponse } from './AccountSign';
|
|
5
|
+
export { IAccountDetails } from './IAccountDetails';
|
|
6
|
+
export { IAccountRollsRequest } from './IAccountRolls';
|
|
7
|
+
export { IAccountSendTransactionRequest } from './IAccountSendTransaction';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Account = void 0;
|
|
4
|
+
var Account_1 = require("./Account");
|
|
5
|
+
Object.defineProperty(exports, "Account", { enumerable: true, get: function () { return Account_1.Account; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/account/index.ts"],"names":[],"mappings":";;;AAAA,qCAAoC;AAA3B,kGAAA,OAAO,OAAA"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { AvailableCommands, IAccountBalanceRequest, IAccountBalanceResponse, IAccountDeletionRequest, IAccountDeletionResponse, IAccountImportRequest, IAccountImportResponse, IAccountSignRequest, IAccountSignResponse } from '..';
|
|
2
|
+
import { IAccount } from '../account/IAccount';
|
|
3
|
+
type CallbackFunction = (result: AllowedResponses, error: Error | null) => unknown;
|
|
4
|
+
export type AllowedRequests = object | IAccountBalanceRequest | IAccountSignRequest | IAccountImportRequest | IAccountDeletionRequest;
|
|
5
|
+
export type AllowedResponses = object | IAccountBalanceResponse | IAccountSignResponse | IAccountImportResponse | IAccountDeletionResponse | IAccount[] | string;
|
|
6
|
+
/**
|
|
7
|
+
* This class enables communication with the content script by sending and receiving messages.
|
|
8
|
+
* @remarks
|
|
9
|
+
* - This class is used to send messages to the content script and to receive messages from the content script.
|
|
10
|
+
* - It is used to send messages to the content script and to receive messages from the content script.
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
declare class Connector {
|
|
14
|
+
private registeredProviders;
|
|
15
|
+
private pendingRequests;
|
|
16
|
+
private thyraListener;
|
|
17
|
+
/**
|
|
18
|
+
* Connector constructor
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
* - The Connector constructor takes no arguments.
|
|
22
|
+
* - It creates a Map object that is used to store pending requests.
|
|
23
|
+
* - It creates an HTML element that is used to communicate with the content script.
|
|
24
|
+
* - It adds an event listener to the HTML element that is used to communicate with the content script.
|
|
25
|
+
*
|
|
26
|
+
* @returns An instance of the Connector class.
|
|
27
|
+
*
|
|
28
|
+
*/
|
|
29
|
+
constructor();
|
|
30
|
+
/**
|
|
31
|
+
* This method adds a register listener in the web page.
|
|
32
|
+
* It listens to the 'register' event.
|
|
33
|
+
*
|
|
34
|
+
* @returns void
|
|
35
|
+
*
|
|
36
|
+
* @remarks
|
|
37
|
+
* - It is used to register a new provider.
|
|
38
|
+
* - This method creates a new HTML element and a listener that listens to the register event.
|
|
39
|
+
*
|
|
40
|
+
*/
|
|
41
|
+
private register;
|
|
42
|
+
/**
|
|
43
|
+
* This method sends a message from the webpage script to the content script.
|
|
44
|
+
*
|
|
45
|
+
* @remarks
|
|
46
|
+
* Sends a message to the content script using the specified provider name, command, and parameters,
|
|
47
|
+
*
|
|
48
|
+
* @privateRemarks
|
|
49
|
+
* This method registers the response callback with a unique ID.
|
|
50
|
+
*
|
|
51
|
+
* @param providerName - The name of the provider.
|
|
52
|
+
* @param command - The command that is sent to the content script (among the {@link AvailableCommands}).
|
|
53
|
+
* @param params - The parameters that are sent to the content script.
|
|
54
|
+
* @param responseCallback - The callback function that is called when the content script sends a response.
|
|
55
|
+
* @returns void
|
|
56
|
+
*
|
|
57
|
+
*/
|
|
58
|
+
sendMessageToContentScript(providerName: string, command: AvailableCommands, params: AllowedRequests, responseCallback: CallbackFunction): void;
|
|
59
|
+
/**
|
|
60
|
+
* This method returns the registered providers.
|
|
61
|
+
*
|
|
62
|
+
* @returns The registered provider associated with its unique key.
|
|
63
|
+
*
|
|
64
|
+
*/
|
|
65
|
+
getWalletProviders(): {
|
|
66
|
+
[key: string]: string;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* This method handles the response from the content script by
|
|
70
|
+
* calling the response callback with the response and error objects.
|
|
71
|
+
*
|
|
72
|
+
* @param event - The event that is sent from the content script.
|
|
73
|
+
* @returns void
|
|
74
|
+
*
|
|
75
|
+
*/
|
|
76
|
+
private handleResponseFromContentScript;
|
|
77
|
+
}
|
|
78
|
+
export declare const connector: Connector;
|
|
79
|
+
export {};
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.connector = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* This file defines a TypeScript module named connector.
|
|
6
|
+
* It is the tool that allows the 'provider' and 'account' objects to communicate with the web page script.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* - If you are only looking to use our library, the connector object will not be useful to you.
|
|
10
|
+
* - If you want to work on this repo, you will probably be interested in this object
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
const uid_1 = require("uid");
|
|
14
|
+
const __1 = require("..");
|
|
15
|
+
const ThyraDiscovery_1 = require("../thyra/ThyraDiscovery");
|
|
16
|
+
const ThyraProvider_1 = require("../thyra/ThyraProvider");
|
|
17
|
+
/**
|
|
18
|
+
* A constant string that is used to identify the HTML element that is used for
|
|
19
|
+
* communication between the web page script and the content script.
|
|
20
|
+
*/
|
|
21
|
+
const MASSA_WINDOW_OBJECT = 'massaWalletProvider';
|
|
22
|
+
/**
|
|
23
|
+
* This class enables communication with the content script by sending and receiving messages.
|
|
24
|
+
* @remarks
|
|
25
|
+
* - This class is used to send messages to the content script and to receive messages from the content script.
|
|
26
|
+
* - It is used to send messages to the content script and to receive messages from the content script.
|
|
27
|
+
*
|
|
28
|
+
*/
|
|
29
|
+
class Connector {
|
|
30
|
+
/**
|
|
31
|
+
* Connector constructor
|
|
32
|
+
*
|
|
33
|
+
* @remarks
|
|
34
|
+
* - The Connector constructor takes no arguments.
|
|
35
|
+
* - It creates a Map object that is used to store pending requests.
|
|
36
|
+
* - It creates an HTML element that is used to communicate with the content script.
|
|
37
|
+
* - It adds an event listener to the HTML element that is used to communicate with the content script.
|
|
38
|
+
*
|
|
39
|
+
* @returns An instance of the Connector class.
|
|
40
|
+
*
|
|
41
|
+
*/
|
|
42
|
+
constructor() {
|
|
43
|
+
this.registeredProviders = {};
|
|
44
|
+
this.pendingRequests = new Map();
|
|
45
|
+
this.register();
|
|
46
|
+
// start listening to messages from content script
|
|
47
|
+
document
|
|
48
|
+
.getElementById(MASSA_WINDOW_OBJECT)
|
|
49
|
+
.addEventListener('message', this.handleResponseFromContentScript.bind(this));
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* This method adds a register listener in the web page.
|
|
53
|
+
* It listens to the 'register' event.
|
|
54
|
+
*
|
|
55
|
+
* @returns void
|
|
56
|
+
*
|
|
57
|
+
* @remarks
|
|
58
|
+
* - It is used to register a new provider.
|
|
59
|
+
* - This method creates a new HTML element and a listener that listens to the register event.
|
|
60
|
+
*
|
|
61
|
+
*/
|
|
62
|
+
register() {
|
|
63
|
+
// global event target to use for all wallet provider
|
|
64
|
+
if (!document.getElementById(MASSA_WINDOW_OBJECT)) {
|
|
65
|
+
const inv = document.createElement('p');
|
|
66
|
+
inv.id = MASSA_WINDOW_OBJECT;
|
|
67
|
+
inv.setAttribute('style', 'display:none');
|
|
68
|
+
document.body.appendChild(inv);
|
|
69
|
+
}
|
|
70
|
+
// add an invisible HTML element and set a listener to it like the following
|
|
71
|
+
// hook up register handler
|
|
72
|
+
document
|
|
73
|
+
.getElementById(MASSA_WINDOW_OBJECT)
|
|
74
|
+
.addEventListener('register', (evt) => {
|
|
75
|
+
const payload = evt.detail;
|
|
76
|
+
const providerEventTargetName = `${MASSA_WINDOW_OBJECT}_${payload.providerName}`;
|
|
77
|
+
this.registeredProviders[payload.providerName] =
|
|
78
|
+
providerEventTargetName;
|
|
79
|
+
});
|
|
80
|
+
// start thyra discovery
|
|
81
|
+
this.thyraListener = new ThyraDiscovery_1.ThyraDiscovery(1000);
|
|
82
|
+
this.thyraListener.startListening();
|
|
83
|
+
this.thyraListener.on(ThyraDiscovery_1.ON_THYRA_DISCOVERED, () => {
|
|
84
|
+
this.registeredProviders[ThyraProvider_1.THYRA_PROVIDER_NAME] = `${MASSA_WINDOW_OBJECT}_${ThyraProvider_1.THYRA_PROVIDER_NAME}`;
|
|
85
|
+
});
|
|
86
|
+
this.thyraListener.on(ThyraDiscovery_1.ON_THYRA_DISCONNECTED, () => {
|
|
87
|
+
delete this.registeredProviders[ThyraProvider_1.THYRA_PROVIDER_NAME];
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* This method sends a message from the webpage script to the content script.
|
|
92
|
+
*
|
|
93
|
+
* @remarks
|
|
94
|
+
* Sends a message to the content script using the specified provider name, command, and parameters,
|
|
95
|
+
*
|
|
96
|
+
* @privateRemarks
|
|
97
|
+
* This method registers the response callback with a unique ID.
|
|
98
|
+
*
|
|
99
|
+
* @param providerName - The name of the provider.
|
|
100
|
+
* @param command - The command that is sent to the content script (among the {@link AvailableCommands}).
|
|
101
|
+
* @param params - The parameters that are sent to the content script.
|
|
102
|
+
* @param responseCallback - The callback function that is called when the content script sends a response.
|
|
103
|
+
* @returns void
|
|
104
|
+
*
|
|
105
|
+
*/
|
|
106
|
+
sendMessageToContentScript(providerName, command, params, responseCallback) {
|
|
107
|
+
if (!Object.values(__1.AvailableCommands).includes(command)) {
|
|
108
|
+
throw new Error(`Unknown command ${command}`);
|
|
109
|
+
}
|
|
110
|
+
const requestId = (0, uid_1.uid)();
|
|
111
|
+
const eventMessageRequest = {
|
|
112
|
+
params,
|
|
113
|
+
requestId,
|
|
114
|
+
};
|
|
115
|
+
this.pendingRequests.set(requestId, responseCallback);
|
|
116
|
+
// dispatch an event to the specific provider event target
|
|
117
|
+
const specificProviderEventTarget = document.getElementById(`${this.registeredProviders[providerName]}`);
|
|
118
|
+
if (!specificProviderEventTarget) {
|
|
119
|
+
throw new Error(`Registered provider with name ${providerName} does not exist`);
|
|
120
|
+
}
|
|
121
|
+
const isDispatched = specificProviderEventTarget.dispatchEvent(new CustomEvent(command, { detail: eventMessageRequest }));
|
|
122
|
+
if (!isDispatched) {
|
|
123
|
+
throw new Error(`Could not dispatch a message to ${this.registeredProviders[providerName]}`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* This method returns the registered providers.
|
|
128
|
+
*
|
|
129
|
+
* @returns The registered provider associated with its unique key.
|
|
130
|
+
*
|
|
131
|
+
*/
|
|
132
|
+
getWalletProviders() {
|
|
133
|
+
return this.registeredProviders;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* This method handles the response from the content script by
|
|
137
|
+
* calling the response callback with the response and error objects.
|
|
138
|
+
*
|
|
139
|
+
* @param event - The event that is sent from the content script.
|
|
140
|
+
* @returns void
|
|
141
|
+
*
|
|
142
|
+
*/
|
|
143
|
+
handleResponseFromContentScript(event) {
|
|
144
|
+
const { result, error, requestId } = event.detail;
|
|
145
|
+
const responseCallback = this.pendingRequests.get(requestId);
|
|
146
|
+
if (responseCallback) {
|
|
147
|
+
if (error) {
|
|
148
|
+
responseCallback(null, new Error(error.message));
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
responseCallback(result, null);
|
|
152
|
+
}
|
|
153
|
+
const deleted = this.pendingRequests.delete(requestId);
|
|
154
|
+
if (!deleted) {
|
|
155
|
+
console.error(`Error deleting a pending request with id ${requestId}`);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
console.error(`Request Id ${requestId} not found in response callback map`);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
exports.connector = new Connector();
|
|
164
|
+
//# sourceMappingURL=Connector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Connector.js","sourceRoot":"","sources":["../../src/connector/Connector.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;GAQG;AACH,6BAA0B;AAI1B,0BAUY;AACZ,4DAIiC;AACjC,0DAA6D;AAG7D;;;GAGG;AACH,MAAM,mBA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AI,CAAC,mBAAmB,CAAC,YAAY,CAAC,EAAE,CAC5E,CAAC;SACH;IACH,CAAC;IAED;;;;;OAKG;IACI,kBAAkB;QACvB,OAAO,IAAI,CAAC,mBAAmB,CAAC;IAClC,CAAC;IAED;;;;;;;OAOG;IACK,+BAA+B,CAAC,KAAkB;QACxD,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,GAChC,KAAK,CAAC,MAAM,CAAC;QAEf,MAAM,gBAAgB,GACpB,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAEtC,IAAI,gBAAgB,EAAE;YACpB,IAAI,KAAK,EAAE;gBACT,gBAAgB,CAAC,IAAI,EAAE,IAAI,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;aAClD;iBAAM;gBACL,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;aAChC;YACD,MAAM,OAAO,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YACvD,IAAI,CAAC,OAAO,EAAE;gBACZ,OAAO,CAAC,KAAK,CAAC,4CAA4C,SAAS,EAAE,CAAC,CAAC;aACxE;SACF;aAAM;YACL,OAAO,CAAC,KAAK,CACX,cAAc,SAAS,qCAAqC,CAC7D,CAAC;SACH;IACH,CAAC;CACF;AAEY,QAAA,SAAS,GAAG,IAAI,SAAS,EAAE,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AllowedRequests } from './Connector';
|
|
2
|
+
/**
|
|
3
|
+
* This interface represents the request done by the web page script to the content script
|
|
4
|
+
* in order to setup a custom event.
|
|
5
|
+
*/
|
|
6
|
+
export interface ICustomEventMessageRequest {
|
|
7
|
+
params: AllowedRequests;
|
|
8
|
+
requestId: string;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ICustomEventMessageRequest.js","sourceRoot":"","sources":["../../src/connector/ICustomEventMessageRequest.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AllowedResponses } from './Connector';
|
|
2
|
+
/**
|
|
3
|
+
* This interface represents the response from the content script to the web page script
|
|
4
|
+
* for an ICustomEventMessageRequest.
|
|
5
|
+
*/
|
|
6
|
+
export interface ICustomEventMessageResponse {
|
|
7
|
+
result?: AllowedResponses;
|
|
8
|
+
error?: Error;
|
|
9
|
+
requestId: string;
|
|
10
|
+
}
|