@caspay/sdk 1.1.3 → 1.1.4

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/dist/index.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { PublicKey, ExecutableDeployItem, TransferDeployItem, DeployHeader, Deploy } from 'casper-js-sdk';
2
2
 
3
- const SDK_VERSION = '1.1.3';
3
+ const SDK_VERSION = '1.1.4';
4
4
 
5
5
  class HttpClient {
6
6
  constructor(config) {
@@ -529,6 +529,21 @@ class Wallet {
529
529
  getNetwork() {
530
530
  return this.config.network === 'mainnet' ? 'casper' : 'casper-test';
531
531
  }
532
+ async getActiveNetwork() {
533
+ if (!this.provider) {
534
+ return this.getNetwork();
535
+ }
536
+ try {
537
+ const network = await this.provider.getActiveNetwork?.();
538
+ if (network) {
539
+ // 'casper' or 'casper-test'
540
+ return network;
541
+ }
542
+ }
543
+ catch (error) {
544
+ }
545
+ return this.getNetwork();
546
+ }
532
547
  async signDeploy(deploy) {
533
548
  if (!this.provider) {
534
549
  const error = {
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var casperJsSdk = require('casper-js-sdk');
6
6
 
7
- const SDK_VERSION = '1.1.3';
7
+ const SDK_VERSION = '1.1.4';
8
8
 
9
9
  class HttpClient {
10
10
  constructor(config) {
@@ -533,6 +533,21 @@ class Wallet {
533
533
  getNetwork() {
534
534
  return this.config.network === 'mainnet' ? 'casper' : 'casper-test';
535
535
  }
536
+ async getActiveNetwork() {
537
+ if (!this.provider) {
538
+ return this.getNetwork();
539
+ }
540
+ try {
541
+ const network = await this.provider.getActiveNetwork?.();
542
+ if (network) {
543
+ // 'casper' or 'casper-test'
544
+ return network;
545
+ }
546
+ }
547
+ catch (error) {
548
+ }
549
+ return this.getNetwork();
550
+ }
536
551
  async signDeploy(deploy) {
537
552
  if (!this.provider) {
538
553
  const error = {
@@ -17,5 +17,6 @@ export declare class Wallet {
17
17
  getProvider(): any;
18
18
  getMerchantWalletAddress(): string;
19
19
  getNetwork(): string;
20
+ getActiveNetwork(): Promise<string>;
20
21
  signDeploy(deploy: any): Promise<any>;
21
22
  }
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "1.1.3";
1
+ export declare const SDK_VERSION = "1.1.4";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caspay/sdk",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "description": "Official CasPay JavaScript/TypeScript SDK - Accept crypto payments with Casper blockchain",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",