@dfns/lib-solana 0.1.0 → 0.1.2-rc.1

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.
Files changed (2) hide show
  1. package/index.js +3 -5
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -6,20 +6,18 @@ const web3_js_1 = require("@solana/web3.js");
6
6
  const sleep = (interval = 0) => new Promise((resolve) => setTimeout(resolve, interval));
7
7
  class DfnsWallet {
8
8
  constructor(publicKey, options) {
9
- var _a, _b;
10
9
  this.publicKey = publicKey;
11
10
  this.options = {
12
11
  ...options,
13
- maxRetries: (_a = options.maxRetries) !== null && _a !== void 0 ? _a : 3,
14
- retryInterval: (_b = options.retryInterval) !== null && _b !== void 0 ? _b : 1000,
12
+ maxRetries: options.maxRetries ?? 3,
13
+ retryInterval: options.retryInterval ?? 1000,
15
14
  };
16
15
  }
17
16
  static async init(options) {
18
- var _a, _b;
19
17
  const { walletId, dfnsClient } = options;
20
18
  const res = await dfnsClient.wallets.getWallet({ walletId });
21
19
  if (!res.signingKey || res.signingKey.scheme !== Wallets_1.KeyScheme.EdDSA || res.signingKey.curve !== Wallets_1.KeyCurve.ed25519) {
22
- throw new Error(`wallet ${walletId} has incompatible scheme (${(_a = res.signingKey) === null || _a === void 0 ? void 0 : _a.scheme}) or curve (${(_b = res.signingKey) === null || _b === void 0 ? void 0 : _b.curve})`);
20
+ throw new Error(`wallet ${walletId} has incompatible scheme (${res.signingKey?.scheme}) or curve (${res.signingKey?.curve})`);
23
21
  }
24
22
  const publicKey = new web3_js_1.PublicKey(Buffer.from(res.signingKey.publicKey, 'hex'));
25
23
  return new DfnsWallet(publicKey, options);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dfns/lib-solana",
3
- "version": "0.1.0",
3
+ "version": "0.1.2-rc.1",
4
4
  "main": "./index.js",
5
5
  "type": "commonjs"
6
6
  }