@collabland/chain
Advanced tools
Comparing version 0.14.4 to 0.14.5
@@ -13,3 +13,3 @@ "use strict"; | ||
const types_1 = require("./types"); | ||
const debug = common_1.debugFactory('collabland:connector'); | ||
const debug = (0, common_1.debugFactory)('collabland:connector'); | ||
/** | ||
@@ -30,3 +30,3 @@ * Base chain connector | ||
getChain(chainIdOrNetwork, options) { | ||
return chain_resource_1.resolveChainResource({ | ||
return (0, chain_resource_1.resolveChainResource)({ | ||
namespace: this.chainType, | ||
@@ -73,3 +73,3 @@ reference: String(chainIdOrNetwork), | ||
debug('Getting balances for %s: %O', account, requests); | ||
const assets = await common_1.pMap(requests, async (req) => { | ||
const assets = await (0, common_1.pMap)(requests, async (req) => { | ||
var _a, _b; | ||
@@ -80,3 +80,3 @@ let asset; | ||
const tokenId = tid == null ? undefined : String(tid); | ||
const assetUri = chain_resource_1.getChainUri({ | ||
const assetUri = (0, chain_resource_1.getChainUri)({ | ||
chainId: account.chainId, | ||
@@ -114,3 +114,3 @@ assetName, | ||
}, { concurrency: this.concurrency }); | ||
debug('Assets: %s', common_1.stringify(assets)); | ||
debug('Assets: %s', (0, common_1.stringify)(assets)); | ||
return assets; | ||
@@ -138,5 +138,5 @@ } | ||
try { | ||
const fetch = common_1.getFetch(); | ||
const fetch = (0, common_1.getFetch)(); | ||
if (url.startsWith('ipfs://')) { | ||
const ipfsGateway = common_1.getEnvVar('IPFS_GATEWAY_URL', 'https://ipfs.io'); | ||
const ipfsGateway = (0, common_1.getEnvVar)('IPFS_GATEWAY_URL', 'https://ipfs.io'); | ||
// https://{gateway URL}/ipfs/{CID}/{optional path to resource} | ||
@@ -148,3 +148,3 @@ // https://{CID}.ipfs.{gatewayURL}/{optional path to resource} | ||
const res = await fetch(url); | ||
token.metadata = await common_1.handleFetchResponse(res, 200); | ||
token.metadata = await (0, common_1.handleFetchResponse)(res, 200); | ||
} | ||
@@ -151,0 +151,0 @@ catch (err) { |
@@ -23,3 +23,3 @@ "use strict"; | ||
static parse(id) { | ||
const { chainId: chainIdParams, address } = utils_1.parseCaipId(id, this.spec); | ||
const { chainId: chainIdParams, address } = (0, utils_1.parseCaipId)(id, this.spec); | ||
const chainId = new chain_id_1.ChainId(chainIdParams); | ||
@@ -29,3 +29,3 @@ return new AccountId({ chainId, address }).toJSON(); | ||
static format(params) { | ||
return utils_1.formatCaipId(params, this.spec); | ||
return (0, utils_1.formatCaipId)(params, this.spec); | ||
} | ||
@@ -32,0 +32,0 @@ toString() { |
@@ -24,6 +24,6 @@ "use strict"; | ||
static parse(id) { | ||
return new AssetId(utils_1.parseCaipId(id, this.spec)).toJSON(); | ||
return new AssetId((0, utils_1.parseCaipId)(id, this.spec)).toJSON(); | ||
} | ||
static format(params) { | ||
return utils_1.formatCaipId(params, this.spec); | ||
return (0, utils_1.formatCaipId)(params, this.spec); | ||
} | ||
@@ -30,0 +30,0 @@ toString() { |
@@ -25,6 +25,6 @@ "use strict"; | ||
static parse(id) { | ||
return new AssetNameId(utils_1.parseCaipId(id, this.spec)).toJSON(); | ||
return new AssetNameId((0, utils_1.parseCaipId)(id, this.spec)).toJSON(); | ||
} | ||
static format(params) { | ||
return utils_1.formatCaipId(params, this.spec); | ||
return (0, utils_1.formatCaipId)(params, this.spec); | ||
} | ||
@@ -31,0 +31,0 @@ /** |
@@ -22,6 +22,6 @@ "use strict"; | ||
static parse(id) { | ||
return new AssetName(utils_1.parseCaipId(id, this.spec)).toJSON(); | ||
return new AssetName((0, utils_1.parseCaipId)(id, this.spec)).toJSON(); | ||
} | ||
static format(params) { | ||
return utils_1.formatCaipId(params, this.spec); | ||
return (0, utils_1.formatCaipId)(params, this.spec); | ||
} | ||
@@ -28,0 +28,0 @@ toString() { |
@@ -24,6 +24,6 @@ "use strict"; | ||
static parse(id) { | ||
return new AssetType(utils_1.parseCaipId(id, this.spec)).toJSON(); | ||
return new AssetType((0, utils_1.parseCaipId)(id, this.spec)).toJSON(); | ||
} | ||
static format(params) { | ||
return utils_1.formatCaipId(params, this.spec); | ||
return (0, utils_1.formatCaipId)(params, this.spec); | ||
} | ||
@@ -30,0 +30,0 @@ toString() { |
@@ -22,6 +22,6 @@ "use strict"; | ||
static parse(id) { | ||
return new ChainId(utils_1.parseCaipId(id, this.spec)).toJSON(); | ||
return new ChainId((0, utils_1.parseCaipId)(id, this.spec)).toJSON(); | ||
} | ||
static format(params) { | ||
return utils_1.formatCaipId(params, this.spec); | ||
return (0, utils_1.formatCaipId)(params, this.spec); | ||
} | ||
@@ -28,0 +28,0 @@ toString() { |
@@ -10,10 +10,10 @@ "use strict"; | ||
// This is a fork of https://github.com/ChainAgnostic/caip-js | ||
tslib_1.__exportStar(require("./account-id"), exports); | ||
tslib_1.__exportStar(require("./asset-id"), exports); | ||
tslib_1.__exportStar(require("./asset-name"), exports); | ||
tslib_1.__exportStar(require("./asset-name-id"), exports); | ||
tslib_1.__exportStar(require("./asset-type"), exports); | ||
tslib_1.__exportStar(require("./chain-id"), exports); | ||
tslib_1.__exportStar(require("./types"), exports); | ||
tslib_1.__exportStar(require("./utils"), exports); | ||
(0, tslib_1.__exportStar)(require("./account-id"), exports); | ||
(0, tslib_1.__exportStar)(require("./asset-id"), exports); | ||
(0, tslib_1.__exportStar)(require("./asset-name"), exports); | ||
(0, tslib_1.__exportStar)(require("./asset-name-id"), exports); | ||
(0, tslib_1.__exportStar)(require("./asset-type"), exports); | ||
(0, tslib_1.__exportStar)(require("./chain-id"), exports); | ||
(0, tslib_1.__exportStar)(require("./types"), exports); | ||
(0, tslib_1.__exportStar)(require("./utils"), exports); | ||
const account_id_1 = require("./account-id"); | ||
@@ -40,3 +40,3 @@ const asset_id_1 = require("./asset-id"); | ||
} | ||
if (utils_1.isValidCaipId(id, t.spec)) { | ||
if ((0, utils_1.isValidCaipId)(id, t.spec)) { | ||
return new t(id); | ||
@@ -46,12 +46,12 @@ } | ||
} | ||
if (types_1.isAssetId(id)) { | ||
if ((0, types_1.isAssetId)(id)) { | ||
return new asset_id_1.AssetId(id); | ||
} | ||
if (types_1.isAssetType(id)) { | ||
if ((0, types_1.isAssetType)(id)) { | ||
return new asset_type_1.AssetType(id); | ||
} | ||
if (types_1.isAccountId(id)) { | ||
if ((0, types_1.isAccountId)(id)) { | ||
return new account_id_1.AccountId(id); | ||
} | ||
if (types_1.isChainId(id)) { | ||
if ((0, types_1.isChainId)(id)) { | ||
return new chain_id_1.ChainId(id); | ||
@@ -69,13 +69,13 @@ } | ||
function stringifyCaipId(id) { | ||
if (types_1.isAssetId(id)) { | ||
return utils_1.formatCaipId(id, asset_id_1.AssetId.spec); | ||
if ((0, types_1.isAssetId)(id)) { | ||
return (0, utils_1.formatCaipId)(id, asset_id_1.AssetId.spec); | ||
} | ||
if (types_1.isAssetType(id)) { | ||
return utils_1.formatCaipId(id, asset_type_1.AssetType.spec); | ||
if ((0, types_1.isAssetType)(id)) { | ||
return (0, utils_1.formatCaipId)(id, asset_type_1.AssetType.spec); | ||
} | ||
if (types_1.isAccountId(id)) { | ||
return utils_1.formatCaipId(id, account_id_1.AccountId.spec); | ||
if ((0, types_1.isAccountId)(id)) { | ||
return (0, utils_1.formatCaipId)(id, account_id_1.AccountId.spec); | ||
} | ||
if (types_1.isChainId(id)) { | ||
return utils_1.formatCaipId(id, chain_id_1.ChainId.spec); | ||
if ((0, types_1.isChainId)(id)) { | ||
return (0, utils_1.formatCaipId)(id, chain_id_1.ChainId.spec); | ||
} | ||
@@ -94,5 +94,5 @@ return String(id); | ||
} | ||
return types_1.isChainId(id) ? new chain_id_1.ChainId(id) : new chain_id_1.ChainId(id.chainId); | ||
return (0, types_1.isChainId)(id) ? new chain_id_1.ChainId(id) : new chain_id_1.ChainId(id.chainId); | ||
} | ||
exports.getChainId = getChainId; | ||
//# sourceMappingURL=index.js.map |
@@ -10,3 +10,3 @@ "use strict"; | ||
const caip_1 = require("./caip"); | ||
const debug = common_1.debugFactory('collabland:chain'); | ||
const debug = (0, common_1.debugFactory)('collabland:chain'); | ||
/** | ||
@@ -121,12 +121,12 @@ * Chain id resource | ||
let resolved; | ||
if (caip_1.isAssetId(params)) { | ||
if ((0, caip_1.isAssetId)(params)) { | ||
resolved = new AssetIdResource(params, options); | ||
} | ||
else if (caip_1.isAssetType(params)) { | ||
else if ((0, caip_1.isAssetType)(params)) { | ||
resolved = new AssetTypeResource(params, options); | ||
} | ||
else if (caip_1.isAccountId(params)) { | ||
else if ((0, caip_1.isAccountId)(params)) { | ||
resolved = new AccountIdResource(params, options); | ||
} | ||
else if (caip_1.isChainId(params)) { | ||
else if ((0, caip_1.isChainId)(params)) { | ||
resolved = new ChainIdResource(params, options); | ||
@@ -136,3 +136,3 @@ } | ||
debug('Invalid chain resource: %O', resource); | ||
throw new Error(`Invalid chain resource: ${common_1.stringify(resource)}`); | ||
throw new Error(`Invalid chain resource: ${(0, common_1.stringify)(resource)}`); | ||
} | ||
@@ -173,3 +173,3 @@ return resolved; | ||
var _a; | ||
const uri = caip_1.stringifyCaipId(chainResource); | ||
const uri = (0, caip_1.stringifyCaipId)(chainResource); | ||
let query = Object.entries((_a = chainResource.options) !== null && _a !== void 0 ? _a : {}) | ||
@@ -199,3 +199,3 @@ .map(p => `${p[0]}=${encodeURIComponent(p[1])}`) | ||
} | ||
const caipId = caip_1.asCaipId(id); | ||
const caipId = (0, caip_1.asCaipId)(id); | ||
const chainResource = { | ||
@@ -202,0 +202,0 @@ ...caipId.toJSON(), |
@@ -8,8 +8,8 @@ "use strict"; | ||
const tslib_1 = require("tslib"); | ||
tslib_1.__exportStar(require("./base-connector"), exports); | ||
tslib_1.__exportStar(require("./caip"), exports); | ||
tslib_1.__exportStar(require("./chain-connector"), exports); | ||
tslib_1.__exportStar(require("./chain-resource"), exports); | ||
tslib_1.__exportStar(require("./crypto"), exports); | ||
tslib_1.__exportStar(require("./types"), exports); | ||
(0, tslib_1.__exportStar)(require("./base-connector"), exports); | ||
(0, tslib_1.__exportStar)(require("./caip"), exports); | ||
(0, tslib_1.__exportStar)(require("./chain-connector"), exports); | ||
(0, tslib_1.__exportStar)(require("./chain-resource"), exports); | ||
(0, tslib_1.__exportStar)(require("./crypto"), exports); | ||
(0, tslib_1.__exportStar)(require("./types"), exports); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@collabland/chain", | ||
"version": "0.14.4", | ||
"version": "0.14.5", | ||
"description": "CollabLand Ethereum Integration", | ||
@@ -34,3 +34,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@collabland/common": "^0.25.1", | ||
"@collabland/common": "^0.25.2", | ||
"tslib": "^2.0.0" | ||
@@ -47,3 +47,3 @@ }, | ||
"author": "Abridged, Inc.", | ||
"gitHead": "3e58ad40eda0179804c558bec244221fc36cb981" | ||
"gitHead": "3b88a84c0572e426788dcf3632a73ea06fbd2a17" | ||
} |
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
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
125983
Updated@collabland/common@^0.25.2