@moralisweb3/common-aptos-utils
Advanced tools
Comparing version 2.13.0 to 2.14.0
import Core, { Module } from '@moralisweb3/common-core'; | ||
import * as dataTypes from './dataTypes'; | ||
export declare class CommonAptosUtils extends Module { | ||
@@ -8,3 +9,6 @@ static readonly moduleName = "aptosUtils"; | ||
start(): void; | ||
get AptosAddress(): typeof dataTypes.AptosAddress; | ||
get AptosNative(): typeof dataTypes.AptosNative; | ||
get AptosNetwork(): typeof dataTypes.AptosNetwork; | ||
} | ||
//# sourceMappingURL=CommonAptosUtils.d.ts.map |
@@ -17,2 +17,25 @@ "use strict"; | ||
})(); | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -22,2 +45,3 @@ exports.CommonAptosUtils = void 0; | ||
var config_1 = require("./config"); | ||
var dataTypes = __importStar(require("./dataTypes")); | ||
var CommonAptosUtils = /** @class */ (function (_super) { | ||
@@ -37,2 +61,23 @@ __extends(CommonAptosUtils, _super); | ||
}; | ||
Object.defineProperty(CommonAptosUtils.prototype, "AptosAddress", { | ||
get: function () { | ||
return dataTypes.AptosAddress; | ||
}, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
Object.defineProperty(CommonAptosUtils.prototype, "AptosNative", { | ||
get: function () { | ||
return dataTypes.AptosNative; | ||
}, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
Object.defineProperty(CommonAptosUtils.prototype, "AptosNetwork", { | ||
get: function () { | ||
return dataTypes.AptosNetwork; | ||
}, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
CommonAptosUtils.moduleName = 'aptosUtils'; | ||
@@ -39,0 +84,0 @@ return CommonAptosUtils; |
@@ -5,4 +5,3 @@ "use strict"; | ||
var common_core_1 = require("@moralisweb3/common-core"); | ||
var aptos_1 = require("aptos"); | ||
var AccountAddress = aptos_1.TxnBuilderTypes.AccountAddress; | ||
var AccountAddress_1 = require("../../utils/AccountAddress"); | ||
/** | ||
@@ -30,3 +29,3 @@ * A representation of an address on the Aptos network. | ||
try { | ||
if (!AccountAddress.isValid(address)) { | ||
if (!AccountAddress_1.AccountAddress.isValid(address)) { | ||
// Throw and catch locally to resolve the same way if it is invalid and if it cannot be parsed | ||
@@ -33,0 +32,0 @@ throw new Error(); |
@@ -6,2 +6,6 @@ "use strict"; | ||
var aptosNetworkNames = ['mainnet', 'testnet', 'devnet']; | ||
var aptosChainIdToNetworkNames = { | ||
'1': 'mainnet', | ||
'2': 'testnet', | ||
}; | ||
/** | ||
@@ -62,11 +66,17 @@ * A representation of a Aptos network. | ||
AptosNetwork.parse = function (network) { | ||
if (typeof network === 'string') { | ||
if (!aptosNetworkNames.includes(network)) { | ||
throw new common_core_1.CoreError({ | ||
code: common_core_1.CoreErrorCode.INVALID_ARGUMENT, | ||
message: "Aptos network is not supported: ".concat(network), | ||
}); | ||
} | ||
var _a; | ||
if (typeof network !== 'string') { | ||
throw new common_core_1.CoreError({ | ||
code: common_core_1.CoreErrorCode.INVALID_ARGUMENT, | ||
message: "Aptos network is not supported: ".concat(network), | ||
}); | ||
} | ||
return network; | ||
var networkName = (_a = aptosChainIdToNetworkNames[network]) !== null && _a !== void 0 ? _a : network; | ||
if (!aptosNetworkNames.includes(networkName)) { | ||
throw new common_core_1.CoreError({ | ||
code: common_core_1.CoreErrorCode.INVALID_ARGUMENT, | ||
message: "Aptos network is not supported: ".concat(network), | ||
}); | ||
} | ||
return networkName; | ||
}; | ||
@@ -73,0 +83,0 @@ /** |
{ | ||
"name": "@moralisweb3/common-aptos-utils", | ||
"author": "Moralis", | ||
"version": "2.13.0", | ||
"version": "2.14.0", | ||
"license": "MIT", | ||
@@ -33,5 +33,5 @@ "main": "./lib/index.js", | ||
"dependencies": { | ||
"@moralisweb3/common-core": "^2.13.0", | ||
"aptos": "^1.6.0" | ||
"@moralisweb3/common-core": "^2.14.0", | ||
"@noble/hashes": "^1.2.0" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
60113
62
1120
+ Added@noble/hashes@^1.2.0
+ Added@noble/hashes@1.5.0(transitive)
+ Addedform-data@4.0.1(transitive)
- Removedaptos@^1.6.0
- Removed@aptos-labs/aptos-client@0.1.1(transitive)
- Removed@noble/hashes@1.3.3(transitive)
- Removed@scure/base@1.1.9(transitive)
- Removed@scure/bip39@1.2.1(transitive)
- Removed@sindresorhus/is@4.6.0(transitive)
- Removed@szmarczak/http-timer@4.0.6(transitive)
- Removed@types/cacheable-request@6.0.3(transitive)
- Removed@types/http-cache-semantics@4.0.4(transitive)
- Removed@types/keyv@3.1.4(transitive)
- Removed@types/node@22.7.7(transitive)
- Removed@types/responselike@1.0.3(transitive)
- Removedaptos@1.21.0(transitive)
- Removedaxios@1.7.4(transitive)
- Removedcacheable-lookup@5.0.4(transitive)
- Removedcacheable-request@7.0.4(transitive)
- Removedclone-response@1.0.3(transitive)
- Removeddecompress-response@6.0.0(transitive)
- Removeddefer-to-connect@2.0.1(transitive)
- Removedend-of-stream@1.4.4(transitive)
- Removedeventemitter3@5.0.1(transitive)
- Removedform-data@4.0.0(transitive)
- Removedget-stream@5.2.0(transitive)
- Removedgot@11.8.6(transitive)
- Removedhttp-cache-semantics@4.1.1(transitive)
- Removedhttp2-wrapper@1.0.3(transitive)
- Removedjson-buffer@3.0.1(transitive)
- Removedkeyv@4.5.4(transitive)
- Removedlowercase-keys@2.0.0(transitive)
- Removedmimic-response@1.0.13.1.0(transitive)
- Removednormalize-url@6.1.0(transitive)
- Removedonce@1.4.0(transitive)
- Removedp-cancelable@2.1.1(transitive)
- Removedpump@3.0.2(transitive)
- Removedquick-lru@5.1.1(transitive)
- Removedresolve-alpn@1.2.1(transitive)
- Removedresponselike@2.0.1(transitive)
- Removedtweetnacl@1.0.3(transitive)
- Removedundici-types@6.19.8(transitive)
- Removedwrappy@1.0.2(transitive)