@scallop-io/sui-scallop-sdk 0.47.5 → 0.47.6

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.
@@ -3,6 +3,7 @@ import type { TransactionBlock, TransactionResult } from '@mysten/sui.js/transac
3
3
  import type { SuiKit, SuiKitParams, NetworkType } from '@scallop-io/sui-kit';
4
4
  import type { ScallopAddress, ScallopQuery, ScallopUtils, ScallopBuilder, ScallopIndexer } from '../models';
5
5
  import { ScallopCache } from 'src/models/scallopCache';
6
+ import { AddressesInterface } from './address';
6
7
  export type ScallopClientFnReturnType<T extends boolean> = T extends true ? SuiTransactionBlockResponse : TransactionBlock;
7
8
  export type ScallopClientVeScaReturnType<T extends boolean> = T extends true ? SuiTransactionBlockResponse : {
8
9
  tx: TransactionBlock;
@@ -35,9 +36,11 @@ export type ScallopAddressParams = {
35
36
  id: string;
36
37
  auth?: string;
37
38
  network?: NetworkType;
39
+ forceInterface?: Record<NetworkType, AddressesInterface>;
38
40
  };
39
41
  export type ScallopParams = {
40
42
  addressesId?: string;
43
+ forceAddressesInterface?: Record<NetworkType, AddressesInterface>;
41
44
  walletAddress?: string;
42
45
  } & SuiKitParams;
43
46
  export type ScallopClientParams = ScallopParams & ScallopBuilderParams & ScallopQueryParams & ScallopUtilsParams;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scallop-io/sui-scallop-sdk",
3
- "version": "0.47.5",
3
+ "version": "0.47.6",
4
4
  "description": "Typescript sdk for interacting with Scallop contract on SUI",
5
5
  "keywords": [
6
6
  "sui",
@@ -64,6 +64,7 @@ export class Scallop {
64
64
  {
65
65
  id: params?.addressesId || ADDRESSES_ID,
66
66
  network: params?.networkType,
67
+ forceInterface: params?.forceAddressesInterface,
67
68
  },
68
69
  { cache: this.cache }
69
70
  );
@@ -377,7 +377,7 @@ export class ScallopAddress {
377
377
  params: ScallopAddressParams,
378
378
  instance?: ScallopAddressInstanceParams
379
379
  ) {
380
- const { id, auth, network } = params;
380
+ const { id, auth, network, forceInterface } = params;
381
381
  this.cache =
382
382
  instance?.cache ??
383
383
  new ScallopCache(
@@ -401,6 +401,18 @@ export class ScallopAddress {
401
401
  ? new Map([['mainnet', TEST_ADDRESSES]])
402
402
  : new Map();
403
403
  if (USE_TEST_ADDRESS) this._currentAddresses = TEST_ADDRESSES;
404
+
405
+ // Set the addresses from the forceInterface if it is provided.
406
+ if (forceInterface) {
407
+ for (const [network, addresses] of Object.entries<AddressesInterface>(
408
+ forceInterface
409
+ )) {
410
+ if (['localnet', 'devnet', 'testnet', 'mainnet'].includes(network)) {
411
+ if (network === this._network) this._currentAddresses = addresses;
412
+ this._addressesMap.set(network as NetworkType, addresses);
413
+ }
414
+ }
415
+ }
404
416
  }
405
417
 
406
418
  /**
@@ -84,6 +84,7 @@ export class ScallopClient {
84
84
  this.address = new ScallopAddress(
85
85
  {
86
86
  id: params?.addressesId || ADDRESSES_ID,
87
+ forceInterface: params?.forceAddressesInterface,
87
88
  network: params?.networkType,
88
89
  },
89
90
  {
@@ -12,6 +12,7 @@ import type {
12
12
  ScallopIndexer,
13
13
  } from '../models';
14
14
  import { ScallopCache } from 'src/models/scallopCache';
15
+ import { AddressesInterface } from './address';
15
16
 
16
17
  export type ScallopClientFnReturnType<T extends boolean> = T extends true
17
18
  ? SuiTransactionBlockResponse
@@ -59,10 +60,12 @@ export type ScallopAddressParams = {
59
60
  id: string;
60
61
  auth?: string;
61
62
  network?: NetworkType;
63
+ forceInterface?: Record<NetworkType, AddressesInterface>;
62
64
  };
63
65
 
64
66
  export type ScallopParams = {
65
67
  addressesId?: string;
68
+ forceAddressesInterface?: Record<NetworkType, AddressesInterface>;
66
69
  walletAddress?: string;
67
70
  } & SuiKitParams;
68
71