@nightlylabs/dex-sdk 0.3.27 → 0.3.29

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.cjs CHANGED
@@ -23293,7 +23293,7 @@ var MAINNET_CONFIG = {
23293
23293
  fullnode: "https://rpc.mainnet.neony.exchange/v1",
23294
23294
  indexer: "https://rpc.mainnet.neony.exchange/v1/graphql",
23295
23295
  faucet: void 0,
23296
- chainId: 1,
23296
+ chainId: 23,
23297
23297
  apiUrl: "https://api.mainnet.neony.exchange"
23298
23298
  };
23299
23299
  function getNetworkConfig(mode) {
@@ -23337,7 +23337,7 @@ function createAptosClientFromEnv() {
23337
23337
  // src/abi.ts
23338
23338
  function getABIsForNetwork(networkMode) {
23339
23339
  const ABIsSource = networkMode === "mainnet" ? generated_types_mainnet_exports : generated_types_testnet_exports;
23340
- return {
23340
+ const abis = {
23341
23341
  AddApiKeyABI: ABIsSource.AddApiKeyABI,
23342
23342
  AddCreditsABI: ABIsSource.AddCreditsABI,
23343
23343
  CancelAllPerpOrdersABI: ABIsSource.CancelAllPerpOrdersABI,
@@ -23399,6 +23399,14 @@ function getABIsForNetwork(networkMode) {
23399
23399
  TestFaucetABI: testFaucet_default
23400
23400
  } : {}
23401
23401
  };
23402
+ const addresses = Object.values(abis).map((abi) => abi.address);
23403
+ const unique = new Set(addresses);
23404
+ if (unique.size !== 1) {
23405
+ throw new Error(
23406
+ `[${networkMode}] ABIs have inconsistent contract addresses: ${[...unique].join(", ")}`
23407
+ );
23408
+ }
23409
+ return abis;
23402
23410
  }
23403
23411
  var ABIs = getABIsForNetwork(getNetworkModeFromEnv());
23404
23412
 
@@ -24344,6 +24352,7 @@ var Client = class _Client {
24344
24352
  this._serverUrl = url || networkConfig.apiUrl;
24345
24353
  this._sequenceNumberManager = new AccountSequenceNumber(this._aptos, this._apiKey);
24346
24354
  this._abis = getABIsForNetwork(networkMode);
24355
+ this._contractAddress = Object.values(this._abis)[0].address;
24347
24356
  this._maxGas = params?.maxGas || 2e4;
24348
24357
  this._gasUnitPrice = params?.gasUnitPrice || 100;
24349
24358
  this._expirationTimestampDelay = params?.expirationTimestampSecs || 20;
@@ -24399,6 +24408,9 @@ var Client = class _Client {
24399
24408
  this._sequenceNumberManager = new AccountSequenceNumber(this._aptos, this._apiKey);
24400
24409
  await this._sequenceNumberManager.initialize();
24401
24410
  }
24411
+ getContractAddress() {
24412
+ return this._contractAddress;
24413
+ }
24402
24414
  getApiKeySequenceNumber() {
24403
24415
  return this._sequenceNumberManager.nextSequenceNumber();
24404
24416
  }
package/dist/index.d.cts CHANGED
@@ -5756,6 +5756,7 @@ declare class Client {
5756
5756
  _expirationTimestampDelay: number;
5757
5757
  timeout: number;
5758
5758
  _abis: ReturnType<typeof getABIsForNetwork>;
5759
+ _contractAddress: string;
5759
5760
  static init(connection: Aptos, enableWs?: boolean, url?: string, apiKey?: Account, chainId?: number, params?: TxParams, networkMode?: NetworkMode): Promise<Client>;
5760
5761
  constructor(connection: Aptos, enableWs: boolean, url?: string, apiKey?: Account, chainId?: number, params?: TxParams, networkMode?: NetworkMode);
5761
5762
  /**
@@ -5788,6 +5789,7 @@ declare class Client {
5788
5789
  */
5789
5790
  static create(connection: Aptos, networkMode?: NetworkMode, enableWs?: boolean, url?: string, apiKey?: Account): Promise<Client>;
5790
5791
  setApiKey(apiKey: Account): Promise<void>;
5792
+ getContractAddress(): string;
5791
5793
  getApiKeySequenceNumber(): Promise<bigint | null>;
5792
5794
  fetchApiKeySequenceNumber(): Promise<number>;
5793
5795
  setTxParams(params: TxParams): void;
package/dist/index.d.ts CHANGED
@@ -5756,6 +5756,7 @@ declare class Client {
5756
5756
  _expirationTimestampDelay: number;
5757
5757
  timeout: number;
5758
5758
  _abis: ReturnType<typeof getABIsForNetwork>;
5759
+ _contractAddress: string;
5759
5760
  static init(connection: Aptos, enableWs?: boolean, url?: string, apiKey?: Account, chainId?: number, params?: TxParams, networkMode?: NetworkMode): Promise<Client>;
5760
5761
  constructor(connection: Aptos, enableWs: boolean, url?: string, apiKey?: Account, chainId?: number, params?: TxParams, networkMode?: NetworkMode);
5761
5762
  /**
@@ -5788,6 +5789,7 @@ declare class Client {
5788
5789
  */
5789
5790
  static create(connection: Aptos, networkMode?: NetworkMode, enableWs?: boolean, url?: string, apiKey?: Account): Promise<Client>;
5790
5791
  setApiKey(apiKey: Account): Promise<void>;
5792
+ getContractAddress(): string;
5791
5793
  getApiKeySequenceNumber(): Promise<bigint | null>;
5792
5794
  fetchApiKeySequenceNumber(): Promise<number>;
5793
5795
  setTxParams(params: TxParams): void;
package/dist/index.js CHANGED
@@ -23251,7 +23251,7 @@ var MAINNET_CONFIG = {
23251
23251
  fullnode: "https://rpc.mainnet.neony.exchange/v1",
23252
23252
  indexer: "https://rpc.mainnet.neony.exchange/v1/graphql",
23253
23253
  faucet: void 0,
23254
- chainId: 1,
23254
+ chainId: 23,
23255
23255
  apiUrl: "https://api.mainnet.neony.exchange"
23256
23256
  };
23257
23257
  function getNetworkConfig(mode) {
@@ -23295,7 +23295,7 @@ function createAptosClientFromEnv() {
23295
23295
  // src/abi.ts
23296
23296
  function getABIsForNetwork(networkMode) {
23297
23297
  const ABIsSource = networkMode === "mainnet" ? generated_types_mainnet_exports : generated_types_testnet_exports;
23298
- return {
23298
+ const abis = {
23299
23299
  AddApiKeyABI: ABIsSource.AddApiKeyABI,
23300
23300
  AddCreditsABI: ABIsSource.AddCreditsABI,
23301
23301
  CancelAllPerpOrdersABI: ABIsSource.CancelAllPerpOrdersABI,
@@ -23357,6 +23357,14 @@ function getABIsForNetwork(networkMode) {
23357
23357
  TestFaucetABI: testFaucet_default
23358
23358
  } : {}
23359
23359
  };
23360
+ const addresses = Object.values(abis).map((abi) => abi.address);
23361
+ const unique = new Set(addresses);
23362
+ if (unique.size !== 1) {
23363
+ throw new Error(
23364
+ `[${networkMode}] ABIs have inconsistent contract addresses: ${[...unique].join(", ")}`
23365
+ );
23366
+ }
23367
+ return abis;
23360
23368
  }
23361
23369
  var ABIs = getABIsForNetwork(getNetworkModeFromEnv());
23362
23370
 
@@ -24302,6 +24310,7 @@ var Client = class _Client {
24302
24310
  this._serverUrl = url || networkConfig.apiUrl;
24303
24311
  this._sequenceNumberManager = new AccountSequenceNumber(this._aptos, this._apiKey);
24304
24312
  this._abis = getABIsForNetwork(networkMode);
24313
+ this._contractAddress = Object.values(this._abis)[0].address;
24305
24314
  this._maxGas = params?.maxGas || 2e4;
24306
24315
  this._gasUnitPrice = params?.gasUnitPrice || 100;
24307
24316
  this._expirationTimestampDelay = params?.expirationTimestampSecs || 20;
@@ -24357,6 +24366,9 @@ var Client = class _Client {
24357
24366
  this._sequenceNumberManager = new AccountSequenceNumber(this._aptos, this._apiKey);
24358
24367
  await this._sequenceNumberManager.initialize();
24359
24368
  }
24369
+ getContractAddress() {
24370
+ return this._contractAddress;
24371
+ }
24360
24372
  getApiKeySequenceNumber() {
24361
24373
  return this._sequenceNumberManager.nextSequenceNumber();
24362
24374
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nightlylabs/dex-sdk",
3
- "version": "0.3.27",
3
+ "version": "0.3.29",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -19,6 +19,7 @@
19
19
  "dist"
20
20
  ],
21
21
  "scripts": {
22
+ "prebuild": "bun scripts/validate-abis.ts",
22
23
  "build": "tsup src/index.ts --format cjs,esm --dts",
23
24
  "dev": "tsup src/index.ts --format cjs,esm --dts --watch",
24
25
  "clean": "rm -rf dist",
@@ -59,7 +60,8 @@
59
60
  "mainnet:predeposit-to-vault": "bun scripts/mainnet/mainnet-predepositToVault.ts",
60
61
  "mainnet:redeploy:start": "bun scripts/mainnet/mainnet-redeploy-start.ts",
61
62
  "mainnet:redeploy:finish": "bun scripts/mainnet/mainnet-redeploy-finish.ts",
62
- "mainnet:large-packages": "bun scripts/mainnet/large_packages_module.ts"
63
+ "mainnet:large-packages": "bun scripts/mainnet/large_packages_module.ts",
64
+ "mainnet:change-tokens-data": "bun scripts/mainnet/mainnet-changeTokensData.ts"
63
65
  },
64
66
  "keywords": [],
65
67
  "author": "",