@orb-labs/orby-core 0.0.15 → 0.0.17

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 (82) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/cjs/actions/operation.d.ts +2 -2
  3. package/dist/cjs/actions/operation.js +74 -4
  4. package/dist/cjs/entities/account.js +1 -1
  5. package/dist/cjs/interfaces/operation.d.ts +2 -2
  6. package/dist/cjs/types.d.ts +20 -0
  7. package/dist/esm/actions/operation.d.ts +2 -2
  8. package/dist/esm/actions/operation.js +75 -5
  9. package/dist/esm/actions/token.js +1 -1
  10. package/dist/esm/entities/account.js +1 -1
  11. package/dist/esm/interfaces/operation.d.ts +2 -2
  12. package/dist/esm/types.d.ts +20 -0
  13. package/dist/tsconfig.cjs.tsbuildinfo +1 -1
  14. package/dist/tsconfig.esm.tsbuildinfo +1 -1
  15. package/package.json +1 -2
  16. package/dist/actions/account_cluster.d.ts +0 -32
  17. package/dist/actions/account_cluster.js +0 -207
  18. package/dist/actions/admin.d.ts +0 -17
  19. package/dist/actions/admin.js +0 -39
  20. package/dist/actions/application.d.ts +0 -6
  21. package/dist/actions/application.js +0 -16
  22. package/dist/actions/blockchain.d.ts +0 -16
  23. package/dist/actions/blockchain.js +0 -35
  24. package/dist/actions/instance.d.ts +0 -15
  25. package/dist/actions/instance.js +0 -94
  26. package/dist/actions/operation.d.ts +0 -99
  27. package/dist/actions/operation.js +0 -341
  28. package/dist/actions/token.d.ts +0 -15
  29. package/dist/actions/token.js +0 -46
  30. package/dist/constants.d.ts +0 -14
  31. package/dist/constants.js +0 -133
  32. package/dist/entities/account.d.ts +0 -14
  33. package/dist/entities/account.js +0 -45
  34. package/dist/entities/financial/account_balance.d.ts +0 -12
  35. package/dist/entities/financial/account_balance.js +0 -31
  36. package/dist/entities/financial/asset.d.ts +0 -31
  37. package/dist/entities/financial/asset.js +0 -38
  38. package/dist/entities/financial/currency.d.ts +0 -41
  39. package/dist/entities/financial/currency.js +0 -49
  40. package/dist/entities/financial/currency_amount.d.ts +0 -34
  41. package/dist/entities/financial/currency_amount.js +0 -92
  42. package/dist/entities/financial/fungible_token.d.ts +0 -41
  43. package/dist/entities/financial/fungible_token.js +0 -64
  44. package/dist/entities/financial/fungible_token_amount.d.ts +0 -36
  45. package/dist/entities/financial/fungible_token_amount.js +0 -95
  46. package/dist/entities/financial/non_fungible_token.d.ts +0 -39
  47. package/dist/entities/financial/non_fungible_token.js +0 -61
  48. package/dist/entities/financial/semi_fungible_token.d.ts +0 -41
  49. package/dist/entities/financial/semi_fungible_token.js +0 -63
  50. package/dist/entities/library_request.d.ts +0 -8
  51. package/dist/entities/library_request.js +0 -30
  52. package/dist/entities/state.d.ts +0 -22
  53. package/dist/entities/state.js +0 -102
  54. package/dist/enums.d.ts +0 -116
  55. package/dist/enums.js +0 -135
  56. package/dist/index.d.ts +0 -29
  57. package/dist/index.js +0 -33
  58. package/dist/interfaces/account_cluster.d.ts +0 -30
  59. package/dist/interfaces/account_cluster.js +0 -1
  60. package/dist/interfaces/admin.d.ts +0 -14
  61. package/dist/interfaces/admin.js +0 -1
  62. package/dist/interfaces/application.d.ts +0 -3
  63. package/dist/interfaces/application.js +0 -1
  64. package/dist/interfaces/blockchain.d.ts +0 -13
  65. package/dist/interfaces/blockchain.js +0 -1
  66. package/dist/interfaces/instance.d.ts +0 -12
  67. package/dist/interfaces/instance.js +0 -1
  68. package/dist/interfaces/operation.d.ts +0 -97
  69. package/dist/interfaces/operation.js +0 -1
  70. package/dist/interfaces/orby.d.ts +0 -9
  71. package/dist/interfaces/orby.js +0 -1
  72. package/dist/interfaces/token.d.ts +0 -12
  73. package/dist/interfaces/token.js +0 -1
  74. package/dist/tsconfig.tsbuildinfo +0 -1
  75. package/dist/types.d.ts +0 -152
  76. package/dist/types.js +0 -1
  77. package/dist/utils/action_helpers.d.ts +0 -22
  78. package/dist/utils/action_helpers.js +0 -250
  79. package/dist/utils/utils.d.ts +0 -10
  80. package/dist/utils/utils.js +0 -70
  81. package/dist/utils/validateAndParseAddress.d.ts +0 -10
  82. package/dist/utils/validateAndParseAddress.js +0 -25
@@ -1,70 +0,0 @@
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;
9
- chainId = !Number.isNaN(Number(potentialId))
10
- ? BigInt(potentialId)
11
- : undefined;
12
- }
13
- else {
14
- const blockchain = getBlockchainFromName(formattedValue);
15
- const potentialId = blockchain
16
- ? getBlockchainIdFromBlockchain(blockchain)
17
- : undefined;
18
- chainId = potentialId ? BigInt(potentialId) : undefined;
19
- }
20
- return chainId;
21
- };
22
- export const getOrbyChainId = (chainId) => {
23
- if (!chainId) {
24
- return undefined;
25
- }
26
- return `EIP155-${chainId.toString()}`;
27
- };
28
- export const getBlockchainIdFromBlockchain = (blockchain) => {
29
- return BLOCKCHAIN_ID[blockchain];
30
- };
31
- export const hasError = (data) => {
32
- if (data?.code && data?.message) {
33
- return { code: data.code, message: data.message };
34
- }
35
- return undefined;
36
- };
37
- export const getBlockchainFromName = (chainName) => {
38
- const formattedChainName = chainName?.toLowerCase()?.replace("-", "_");
39
- switch (formattedChainName) {
40
- case "bnbt": {
41
- return Blockchain.BINANCE_TESTNET;
42
- }
43
- case "matic_amoy": {
44
- return Blockchain.POLYGON_AMOY;
45
- }
46
- case "matic": {
47
- return Blockchain.POLYGON;
48
- }
49
- case "mainnet": {
50
- return Blockchain.ETHEREUM;
51
- }
52
- case "holesky": {
53
- return Blockchain.ETHEREUM_HOLESKY;
54
- }
55
- case "sepolia": {
56
- return Blockchain.ETHEREUM_SEPOLIA;
57
- }
58
- case "unknown": {
59
- return undefined;
60
- }
61
- default: {
62
- //statements;
63
- return formattedChainName;
64
- }
65
- }
66
- };
67
- export const isMainnet = (chainId) => {
68
- const blockchain = BLOCKCHAIN_ID_TO_BLOCKCHAIN[Number(chainId)];
69
- return CHAIN_CONFIGS[blockchain].environment == BlockchainEnvironment.MAINNET;
70
- };
@@ -1,10 +0,0 @@
1
- /**
2
- * Validates an address and returns the parsed (checksummed) version of that address
3
- * @param address the unchecksummed hex address
4
- */
5
- export declare function validateAndParseAddress(address: string): string;
6
- /**
7
- * Checks if an address is valid by checking 0x prefix, length === 42 and hex encoding.
8
- * @param address the unchecksummed hex address
9
- */
10
- export declare function checkValidAddress(address: string): string;
@@ -1,25 +0,0 @@
1
- import { getAddress } from "@ethersproject/address";
2
- /**
3
- * Validates an address and returns the parsed (checksummed) version of that address
4
- * @param address the unchecksummed hex address
5
- */
6
- export function validateAndParseAddress(address) {
7
- try {
8
- return getAddress(address);
9
- }
10
- catch (error) {
11
- throw new Error(`${address} is not a valid address.`);
12
- }
13
- }
14
- // Checks a string starts with 0x, is 42 characters long and contains only hex characters after 0x
15
- const startsWith0xLen42HexRegex = /^0x[0-9a-fA-F]{40}$/;
16
- /**
17
- * Checks if an address is valid by checking 0x prefix, length === 42 and hex encoding.
18
- * @param address the unchecksummed hex address
19
- */
20
- export function checkValidAddress(address) {
21
- if (startsWith0xLen42HexRegex.test(address)) {
22
- return address;
23
- }
24
- throw new Error(`${address} is not a valid address.`);
25
- }