@orb-labs/orby-core 0.0.5 → 0.0.7

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 (54) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/actions/account_cluster.d.ts +5 -5
  3. package/dist/actions/account_cluster.js +147 -330
  4. package/dist/actions/admin.d.ts +3 -3
  5. package/dist/actions/admin.js +37 -127
  6. package/dist/actions/application.d.ts +2 -2
  7. package/dist/actions/application.js +14 -77
  8. package/dist/actions/instance.d.ts +3 -3
  9. package/dist/actions/instance.js +98 -255
  10. package/dist/actions/operation.d.ts +4 -4
  11. package/dist/actions/operation.js +92 -263
  12. package/dist/actions/token.d.ts +3 -3
  13. package/dist/actions/token.js +34 -119
  14. package/dist/constants.d.ts +3 -3
  15. package/dist/constants.js +70 -71
  16. package/dist/entities/account.d.ts +1 -1
  17. package/dist/entities/account.js +25 -30
  18. package/dist/entities/financial/account_balance.d.ts +2 -2
  19. package/dist/entities/financial/account_balance.js +20 -22
  20. package/dist/entities/financial/asset.js +13 -15
  21. package/dist/entities/financial/currency.d.ts +1 -1
  22. package/dist/entities/financial/currency.js +16 -35
  23. package/dist/entities/financial/currency_amount.d.ts +1 -1
  24. package/dist/entities/financial/currency_amount.js +49 -71
  25. package/dist/entities/financial/fungible_token.d.ts +2 -2
  26. package/dist/entities/financial/fungible_token.js +31 -52
  27. package/dist/entities/financial/fungible_token_amount.d.ts +2 -2
  28. package/dist/entities/financial/fungible_token_amount.js +53 -75
  29. package/dist/entities/financial/non_fungible_token.d.ts +2 -2
  30. package/dist/entities/financial/non_fungible_token.js +25 -45
  31. package/dist/entities/financial/semi_fungible_token.d.ts +2 -2
  32. package/dist/entities/financial/semi_fungible_token.js +25 -45
  33. package/dist/entities/library_request.d.ts +1 -1
  34. package/dist/entities/library_request.js +7 -9
  35. package/dist/entities/state.d.ts +4 -4
  36. package/dist/entities/state.js +57 -67
  37. package/dist/index.d.ts +27 -27
  38. package/dist/index.js +27 -27
  39. package/dist/interfaces/account_cluster.d.ts +4 -4
  40. package/dist/interfaces/admin.d.ts +1 -1
  41. package/dist/interfaces/instance.d.ts +1 -1
  42. package/dist/interfaces/operation.d.ts +3 -3
  43. package/dist/interfaces/orby.d.ts +6 -6
  44. package/dist/interfaces/token.d.ts +1 -1
  45. package/dist/tsconfig.tsbuildinfo +1 -1
  46. package/dist/types.d.ts +7 -7
  47. package/dist/utils/action_helpers.d.ts +1 -1
  48. package/dist/utils/action_helpers.js +42 -58
  49. package/dist/utils/jsbi.d.ts +2 -0
  50. package/dist/utils/jsbi.js +2 -0
  51. package/dist/utils/utils.d.ts +1 -1
  52. package/dist/utils/utils.js +17 -19
  53. package/dist/utils/validateAndParseAddress.js +3 -3
  54. package/package.json +4 -2
@@ -1,37 +1,35 @@
1
- import { Blockchain, BlockchainEnvironment } from "../enums";
2
- import { BLOCKCHAIN_ID, BLOCKCHAIN_ID_TO_BLOCKCHAIN, CHAIN_CONFIGS, } from "../constants";
3
- export var getChainIdFromOrbyChainId = function (value) {
4
- var _a;
5
- var chainId = undefined;
6
- var formattedValue = (_a = value === null || value === void 0 ? void 0 : value.trim()) === null || _a === void 0 ? void 0 : _a.toLowerCase();
7
- if (formattedValue === null || formattedValue === void 0 ? void 0 : formattedValue.includes("eip155")) {
8
- var publicIdElements = formattedValue.split("eip155-");
9
- var potentialId = (publicIdElements === null || publicIdElements === void 0 ? void 0 : publicIdElements.length) > 1 ? publicIdElements[1] : undefined;
1
+ import { Blockchain, BlockchainEnvironment } from "../enums.js";
2
+ import { BLOCKCHAIN_ID, BLOCKCHAIN_ID_TO_BLOCKCHAIN, CHAIN_CONFIGS, } from "../constants.js";
3
+ export const getChainIdFromOrbyChainId = (value) => {
4
+ let chainId = undefined;
5
+ const formattedValue = value?.trim()?.toLowerCase();
6
+ if (formattedValue?.includes("eip155")) {
7
+ const publicIdElements = formattedValue.split("eip155-");
8
+ const potentialId = publicIdElements?.length > 1 ? publicIdElements[1] : undefined;
10
9
  chainId = !Number.isNaN(Number(potentialId))
11
10
  ? BigInt(potentialId)
12
11
  : undefined;
13
12
  }
14
13
  else {
15
- var blockchain = getBlockchainFromName(formattedValue);
16
- var potentialId = blockchain
14
+ const blockchain = getBlockchainFromName(formattedValue);
15
+ const potentialId = blockchain
17
16
  ? getBlockchainIdFromBlockchain(blockchain)
18
17
  : undefined;
19
18
  chainId = potentialId ? BigInt(potentialId) : undefined;
20
19
  }
21
20
  return chainId;
22
21
  };
23
- export var getBlockchainIdFromBlockchain = function (blockchain) {
22
+ export const getBlockchainIdFromBlockchain = (blockchain) => {
24
23
  return BLOCKCHAIN_ID[blockchain];
25
24
  };
26
- export var hasError = function (data) {
27
- if ((data === null || data === void 0 ? void 0 : data.code) && (data === null || data === void 0 ? void 0 : data.message)) {
25
+ export const hasError = (data) => {
26
+ if (data?.code && data?.message) {
28
27
  return { code: data.code, message: data.message };
29
28
  }
30
29
  return undefined;
31
30
  };
32
- export var getBlockchainFromName = function (chainName) {
33
- var _a;
34
- var formattedChainName = (_a = chainName === null || chainName === void 0 ? void 0 : chainName.toLowerCase()) === null || _a === void 0 ? void 0 : _a.replace("-", "_");
31
+ export const getBlockchainFromName = (chainName) => {
32
+ const formattedChainName = chainName?.toLowerCase()?.replace("-", "_");
35
33
  switch (formattedChainName) {
36
34
  case "bnbt": {
37
35
  return Blockchain.BINANCE_TESTNET;
@@ -60,7 +58,7 @@ export var getBlockchainFromName = function (chainName) {
60
58
  }
61
59
  }
62
60
  };
63
- export var isMainnet = function (chainId) {
64
- var blockchain = BLOCKCHAIN_ID_TO_BLOCKCHAIN[Number(chainId)];
61
+ export const isMainnet = (chainId) => {
62
+ const blockchain = BLOCKCHAIN_ID_TO_BLOCKCHAIN[Number(chainId)];
65
63
  return CHAIN_CONFIGS[blockchain].environment == BlockchainEnvironment.MAINNET;
66
64
  };
@@ -8,11 +8,11 @@ export function validateAndParseAddress(address) {
8
8
  return getAddress(address);
9
9
  }
10
10
  catch (error) {
11
- throw new Error("".concat(address, " is not a valid address."));
11
+ throw new Error(`${address} is not a valid address.`);
12
12
  }
13
13
  }
14
14
  // Checks a string starts with 0x, is 42 characters long and contains only hex characters after 0x
15
- var startsWith0xLen42HexRegex = /^0x[0-9a-fA-F]{40}$/;
15
+ const startsWith0xLen42HexRegex = /^0x[0-9a-fA-F]{40}$/;
16
16
  /**
17
17
  * Checks if an address is valid by checking 0x prefix, length === 42 and hex encoding.
18
18
  * @param address the unchecksummed hex address
@@ -21,5 +21,5 @@ export function checkValidAddress(address) {
21
21
  if (startsWith0xLen42HexRegex.test(address)) {
22
22
  return address;
23
23
  }
24
- throw new Error("".concat(address, " is not a valid address."));
24
+ throw new Error(`${address} is not a valid address.`);
25
25
  }
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@orb-labs/orby-core",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
+ "type": "module",
4
5
  "exports": {
5
6
  ".": "./dist/index.js"
6
7
  },
@@ -25,6 +26,7 @@
25
26
  "typescript": "^5.6.3"
26
27
  },
27
28
  "dependencies": {
28
- "@uniswap/sdk-core": "^5.9.0"
29
+ "@uniswap/sdk-core": "^5.9.0",
30
+ "jsbi": "^3.1.4"
29
31
  }
30
32
  }