suidouble 0.0.50 → 0.0.51

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/lib/SuiMaster.js CHANGED
@@ -287,28 +287,30 @@ class SuiMaster extends SuiCommonMethods {
287
287
  }
288
288
  }
289
289
 
290
- async requestSuiFromFaucet() {
290
+ async requestSuiFromFaucet() {
291
291
  await this.initialize();
292
-
293
- this.log('requesting sui from faucet...');
294
-
292
+ let amount = BigInt(0);
295
293
  const faucetHost = getFaucetHost(this._providerName.split('sui:').join(''));
296
- const requested = await requestSuiFromFaucetV0({
294
+ if (faucetHost === "mainnet") {
295
+ this.log(`no faucet on ${faucetHost}`);
296
+ } else {
297
+ this.log(`requesting sui from faucet... ${faucetHost}`);
298
+ const requested = await requestSuiFromFaucetV0({
297
299
  host: faucetHost,
298
300
  recipient: this._address,
299
301
  });
300
302
 
301
- let amount = BigInt(0);
302
- let objectsCount = 0;
303
+ let objectsCount = 0;
303
304
 
304
- if (requested && requested.transferredGasObjects) {
305
- for (let transferredGasObject of requested.transferredGasObjects) {
306
- amount += BigInt(transferredGasObject.amount);
307
- objectsCount++;
305
+ if (requested && requested.transferredGasObjects) {
306
+ for (let transferredGasObject of requested.transferredGasObjects) {
307
+ amount += BigInt(transferredGasObject.amount);
308
+ objectsCount++;
309
+ }
308
310
  }
309
- }
310
311
 
311
- this.log('got from faucet', amount, 'MIST in', objectsCount, 'objects');
312
+ this.log('got from faucet', amount, 'MIST in', objectsCount, 'objects');
313
+ }
312
314
 
313
315
  return amount;
314
316
  }
@@ -423,4 +425,4 @@ SuiMaster.MIST_PER_SUI = BigInt(MIST_PER_SUI);
423
425
  SuiMaster.TransactionBlock = TransactionBlock;
424
426
  SuiMaster.Transactions = Transactions;
425
427
 
426
- module.exports = SuiMaster;
428
+ module.exports = SuiMaster;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "suidouble",
3
- "version": "0.0.50",
3
+ "version": "0.0.51",
4
4
  "description": "Set of provider, package and object classes for javascript representation of Sui Move smart contracts. Use same code for publishing, upgrading, integration testing, interaction with smart contracts and integration in browser web3 dapps",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -22,7 +22,6 @@
22
22
  "license": "Apache-2.0",
23
23
  "dependencies": {
24
24
  "@mysten/sui.js": "^0.43.3",
25
- "@mysten/zklogin": "^0.1.8",
26
25
  "@wallet-standard/core": "^1.0.3"
27
26
  },
28
27
  "devDependencies": {
@@ -20,3 +20,8 @@ source = { git = "https://github.com/MystenLabs/sui.git", rev = "testnet", subdi
20
20
  dependencies = [
21
21
  { name = "MoveStdlib" },
22
22
  ]
23
+
24
+ [move.toolchain-version]
25
+ compiler-version = "1.22.0"
26
+ edition = "legacy"
27
+ flavor = "sui"
@@ -1,39 +0,0 @@
1
- const { generateNonce, generateRandomness } = require('@mysten/zklogin');
2
- const SuiCommonMethods = require('./SuiCommonMethods.js');
3
- const { Ed25519Keypair } = require('@mysten/sui.js/keypairs/ed25519');
4
-
5
- class SuidoubleZKLogin extends SuiCommonMethods {
6
- constructor(params = {}) {
7
- super(params);
8
- this._suiMaster = params.suiMaster;
9
- if (!this._suiMaster) {
10
- throw new Error('suiMaster is required');
11
- }
12
-
13
- this._clientId = '623255759333-fr0ijf03itgc4t70e8aj99iud9lnsuqm.apps.googleusercontent.com';
14
- }
15
-
16
- async getNonce() {
17
- const client = this._suiMaster.provider;
18
- const { epoch, epochDurationMs, epochStartTimestampMs } = await client.getLatestSuiSystemState();
19
- const maxEpoch = Number(epoch) + 2; // this means the ephemeral key will be active for 2 epochs from now.
20
- const randomness = generateRandomness();
21
-
22
- const ephemeralKeyPair = new Ed25519Keypair();
23
- const nonce = generateNonce(ephemeralKeyPair.getPublicKey(), maxEpoch, randomness);
24
-
25
- return nonce;
26
- }
27
-
28
- async getOAuthURL(params = {}) {
29
- const redirectURL = params.redirectURL;
30
-
31
- const nonce = await this.getNonce();
32
- const url = `https://accounts.google.com/o/oauth2/v2/auth?client_id=${this._clientId}&response_type=id_token&redirect_uri=${redirectURL}&scope=openid&nonce=${nonce}`;
33
-
34
- return url;
35
- }
36
-
37
- }
38
-
39
- module.exports = SuidoubleZKLogin;