@massalabs/wallet-provider 1.3.6-dev.20230911180149 → 1.3.6-dev.20230918072353
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/bundle.js +49 -1
- package/bundle.min.js +1 -1
- package/dist/bearbyWallet/BearbyConnect.d.ts.map +1 -1
- package/dist/bearbyWallet/BearbyConnect.js +0 -1
- package/dist/bearbyWallet/BearbyProvider.d.ts +1 -0
- package/dist/bearbyWallet/BearbyProvider.d.ts.map +1 -1
- package/dist/bearbyWallet/BearbyProvider.js +4 -0
- package/dist/cmd/bearbyWallet/BearbyAccount.js.map +1 -1
- package/dist/cmd/bearbyWallet/BearbyConnect.d.ts.map +1 -1
- package/dist/cmd/bearbyWallet/BearbyConnect.js +0 -1
- package/dist/cmd/bearbyWallet/BearbyConnect.js.map +1 -1
- package/dist/cmd/bearbyWallet/BearbyProvider.d.ts +1 -0
- package/dist/cmd/bearbyWallet/BearbyProvider.d.ts.map +1 -1
- package/dist/cmd/bearbyWallet/BearbyProvider.js +4 -0
- package/dist/cmd/bearbyWallet/BearbyProvider.js.map +1 -1
- package/dist/cmd/connector/Connector.d.ts.map +1 -1
- package/dist/cmd/connector/Connector.js.map +1 -1
- package/dist/cmd/index.d.ts +1 -0
- package/dist/cmd/index.d.ts.map +1 -1
- package/dist/cmd/index.js +1 -0
- package/dist/cmd/index.js.map +1 -1
- package/dist/cmd/massaStation/MassaStationAccount.d.ts.map +1 -1
- package/dist/cmd/massaStation/MassaStationAccount.js +2 -0
- package/dist/cmd/massaStation/MassaStationAccount.js.map +1 -1
- package/dist/cmd/massaStation/MassaStationProvider.d.ts +10 -0
- package/dist/cmd/massaStation/MassaStationProvider.d.ts.map +1 -1
- package/dist/cmd/massaStation/MassaStationProvider.js +24 -0
- package/dist/cmd/massaStation/MassaStationProvider.js.map +1 -1
- package/dist/cmd/massaStation/types.d.ts +11 -0
- package/dist/cmd/massaStation/types.d.ts.map +1 -0
- package/dist/cmd/massaStation/types.js +3 -0
- package/dist/cmd/massaStation/types.js.map +1 -0
- package/dist/cmd/provider/IProvider.d.ts +1 -0
- package/dist/cmd/provider/IProvider.d.ts.map +1 -1
- package/dist/cmd/provider/IProvider.js.map +1 -1
- package/dist/cmd/provider/Provider.d.ts +6 -0
- package/dist/cmd/provider/Provider.d.ts.map +1 -1
- package/dist/cmd/provider/Provider.js +17 -0
- package/dist/cmd/provider/Provider.js.map +1 -1
- package/dist/cmd/utils/typeCheck.d.ts.map +1 -1
- package/dist/cmd/utils/typeCheck.js +1 -0
- package/dist/cmd/utils/typeCheck.js.map +1 -1
- package/dist/connector/Connector.d.ts.map +1 -1
- package/dist/esm/bearbyWallet/BearbyAccount.js.map +1 -1
- package/dist/esm/bearbyWallet/BearbyConnect.d.ts.map +1 -1
- package/dist/esm/bearbyWallet/BearbyConnect.js +0 -1
- package/dist/esm/bearbyWallet/BearbyConnect.js.map +1 -1
- package/dist/esm/bearbyWallet/BearbyProvider.d.ts +1 -0
- package/dist/esm/bearbyWallet/BearbyProvider.d.ts.map +1 -1
- package/dist/esm/bearbyWallet/BearbyProvider.js +4 -0
- package/dist/esm/bearbyWallet/BearbyProvider.js.map +1 -1
- package/dist/esm/connector/Connector.d.ts.map +1 -1
- package/dist/esm/connector/Connector.js.map +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/massaStation/MassaStationAccount.d.ts.map +1 -1
- package/dist/esm/massaStation/MassaStationAccount.js +2 -0
- package/dist/esm/massaStation/MassaStationAccount.js.map +1 -1
- package/dist/esm/massaStation/MassaStationProvider.d.ts +10 -0
- package/dist/esm/massaStation/MassaStationProvider.d.ts.map +1 -1
- package/dist/esm/massaStation/MassaStationProvider.js +24 -0
- package/dist/esm/massaStation/MassaStationProvider.js.map +1 -1
- package/dist/esm/massaStation/types.d.ts +11 -0
- package/dist/esm/massaStation/types.d.ts.map +1 -0
- package/dist/esm/massaStation/types.js +2 -0
- package/dist/esm/massaStation/types.js.map +1 -0
- package/dist/esm/provider/IProvider.d.ts +1 -0
- package/dist/esm/provider/IProvider.d.ts.map +1 -1
- package/dist/esm/provider/IProvider.js.map +1 -1
- package/dist/esm/provider/Provider.d.ts +6 -0
- package/dist/esm/provider/Provider.d.ts.map +1 -1
- package/dist/esm/provider/Provider.js +17 -0
- package/dist/esm/provider/Provider.js.map +1 -1
- package/dist/esm/utils/typeCheck.d.ts.map +1 -1
- package/dist/esm/utils/typeCheck.js +1 -0
- package/dist/esm/utils/typeCheck.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/massaStation/MassaStationAccount.d.ts.map +1 -1
- package/dist/massaStation/MassaStationAccount.js +2 -0
- package/dist/massaStation/MassaStationProvider.d.ts +10 -0
- package/dist/massaStation/MassaStationProvider.d.ts.map +1 -1
- package/dist/massaStation/MassaStationProvider.js +24 -0
- package/dist/massaStation/types.d.ts +11 -0
- package/dist/massaStation/types.d.ts.map +1 -0
- package/dist/massaStation/types.js +1 -0
- package/dist/provider/IProvider.d.ts +1 -0
- package/dist/provider/IProvider.d.ts.map +1 -1
- package/dist/provider/Provider.d.ts +6 -0
- package/dist/provider/Provider.d.ts.map +1 -1
- package/dist/provider/Provider.js +17 -0
- package/dist/utils/typeCheck.d.ts.map +1 -1
- package/dist/utils/typeCheck.js +1 -0
- package/package.json +2 -1
package/bundle.js
CHANGED
|
@@ -6307,7 +6307,6 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
6307
6307
|
exports.disconnectBearby = exports.connectBearby = exports.detectBearby = void 0;
|
|
6308
6308
|
const bearby_js_1 = __webpack_require__(/*! @hicaru/bearby.js */ "./node_modules/@hicaru/bearby.js/dist/index.js");
|
|
6309
6309
|
async function detectBearby() {
|
|
6310
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6311
6310
|
if (globalThis.window && globalThis.window['bearby']) {
|
|
6312
6311
|
return true;
|
|
6313
6312
|
}
|
|
@@ -6377,6 +6376,10 @@ class BearbyProvider {
|
|
|
6377
6376
|
async getNodesUrls() {
|
|
6378
6377
|
return ['https://buildnet.massa.net/api/v2'];
|
|
6379
6378
|
}
|
|
6379
|
+
async getNetwork() {
|
|
6380
|
+
const network = await bearby_js_1.web3.wallet.network;
|
|
6381
|
+
return network.net;
|
|
6382
|
+
}
|
|
6380
6383
|
async generateNewAccount(name) {
|
|
6381
6384
|
throw new Error('Method not implemented.');
|
|
6382
6385
|
}
|
|
@@ -6649,6 +6652,7 @@ var AvailableCommands;
|
|
|
6649
6652
|
AvailableCommands["ProviderDeleteAccount"] = "DELETE_ACCOUNT";
|
|
6650
6653
|
AvailableCommands["ProviderImportAccount"] = "IMPORT_ACCOUNT";
|
|
6651
6654
|
AvailableCommands["ProviderGetNodesUrls"] = "GET_NODES_URLS";
|
|
6655
|
+
AvailableCommands["ProviderGetNetwork"] = "GET_NETWORK";
|
|
6652
6656
|
AvailableCommands["AccountBalance"] = "ACCOUNT_BALANCE";
|
|
6653
6657
|
AvailableCommands["AccountSign"] = "ACCOUNT_SIGN";
|
|
6654
6658
|
AvailableCommands["ProviderGenerateNewAccount"] = "GENERATE_NEW_ACCOUNT";
|
|
@@ -6963,6 +6967,8 @@ class MassaStationAccount {
|
|
|
6963
6967
|
name: functionName,
|
|
6964
6968
|
at: contractAddress,
|
|
6965
6969
|
args: args,
|
|
6970
|
+
fee: amount.toString(),
|
|
6971
|
+
maxGas: maxGas.toString(),
|
|
6966
6972
|
coins: Number(amount),
|
|
6967
6973
|
async: true,
|
|
6968
6974
|
};
|
|
@@ -7303,6 +7309,8 @@ class MassaStationProvider {
|
|
|
7303
7309
|
/**
|
|
7304
7310
|
* This method sends an http call to the MassaStation server to obtain node urls.
|
|
7305
7311
|
*
|
|
7312
|
+
* @throws an error if the call fails.
|
|
7313
|
+
*
|
|
7306
7314
|
* @returns a Promise that resolves to a list of node urls.
|
|
7307
7315
|
*/
|
|
7308
7316
|
async getNodesUrls() {
|
|
@@ -7321,6 +7329,28 @@ class MassaStationProvider {
|
|
|
7321
7329
|
throw ex;
|
|
7322
7330
|
}
|
|
7323
7331
|
}
|
|
7332
|
+
/**
|
|
7333
|
+
* Returns the name of the network MassaStation is connected to.
|
|
7334
|
+
*
|
|
7335
|
+
* @throws an error if the call fails.
|
|
7336
|
+
*
|
|
7337
|
+
* @returns a Promise that resolves to a network.
|
|
7338
|
+
*/
|
|
7339
|
+
async getNetwork() {
|
|
7340
|
+
let nodesResponse = null;
|
|
7341
|
+
try {
|
|
7342
|
+
nodesResponse = await (0, RequestHandler_1.getRequest)(`${exports.MASSA_STATION_URL}massa/node`);
|
|
7343
|
+
if (nodesResponse.isError || nodesResponse.error) {
|
|
7344
|
+
throw nodesResponse.error.message;
|
|
7345
|
+
}
|
|
7346
|
+
const nodes = nodesResponse.result;
|
|
7347
|
+
return nodes.network;
|
|
7348
|
+
}
|
|
7349
|
+
catch (ex) {
|
|
7350
|
+
console.error(`MassaStation nodes retrieval error`, ex);
|
|
7351
|
+
throw ex;
|
|
7352
|
+
}
|
|
7353
|
+
}
|
|
7324
7354
|
/**
|
|
7325
7355
|
* This method sends an http call to the MassaStation server to create a new random account.
|
|
7326
7356
|
*
|
|
@@ -7661,6 +7691,23 @@ class Provider {
|
|
|
7661
7691
|
});
|
|
7662
7692
|
});
|
|
7663
7693
|
}
|
|
7694
|
+
/**
|
|
7695
|
+
* Returns the name of the network the provider is connected to.
|
|
7696
|
+
*
|
|
7697
|
+
* @returns a Promise that resolves to the network name (string).
|
|
7698
|
+
*/
|
|
7699
|
+
async getNetwork() {
|
|
7700
|
+
return new Promise((resolve, reject) => {
|
|
7701
|
+
Connector_1.connector.sendMessageToContentScript(this.providerName, __1.AvailableCommands.ProviderGetNetwork, {}, (result, err) => {
|
|
7702
|
+
if (err)
|
|
7703
|
+
return reject(err);
|
|
7704
|
+
else if (typeof result !== 'string') {
|
|
7705
|
+
return reject(new Error(`Expected a string but got ${typeof result} instead`));
|
|
7706
|
+
}
|
|
7707
|
+
return resolve(result);
|
|
7708
|
+
});
|
|
7709
|
+
});
|
|
7710
|
+
}
|
|
7664
7711
|
/**
|
|
7665
7712
|
* This method generates a new account by a given name and adds it to the wallet.
|
|
7666
7713
|
*
|
|
@@ -7878,6 +7925,7 @@ exports.withTimeoutRejection = withTimeoutRejection;
|
|
|
7878
7925
|
|
|
7879
7926
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
7880
7927
|
exports.isArrayOfNumbers = void 0;
|
|
7928
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7881
7929
|
function isArrayOfNumbers(input) {
|
|
7882
7930
|
return (Array.isArray(input) && input.every((item) => typeof item === 'number'));
|
|
7883
7931
|
}
|