@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.
- package/dist/index.js +15 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -2
- package/dist/index.mjs.map +1 -1
- package/dist/types/model.d.ts +3 -0
- package/package.json +1 -1
- package/src/models/scallop.ts +1 -0
- package/src/models/scallopAddress.ts +13 -1
- package/src/models/scallopClient.ts +1 -0
- package/src/types/model.ts +3 -0
package/dist/types/model.d.ts
CHANGED
|
@@ -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
package/src/models/scallop.ts
CHANGED
|
@@ -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
|
/**
|
package/src/types/model.ts
CHANGED
|
@@ -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
|
|