@collabland/chain
Advanced tools
Comparing version 0.14.3 to 0.14.4
@@ -13,3 +13,3 @@ "use strict"; | ||
const types_1 = require("./types"); | ||
const debug = (0, common_1.debugFactory)('collabland:connector'); | ||
const debug = common_1.debugFactory('collabland:connector'); | ||
/** | ||
@@ -30,3 +30,3 @@ * Base chain connector | ||
getChain(chainIdOrNetwork, options) { | ||
return (0, chain_resource_1.resolveChainResource)({ | ||
return 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 (0, common_1.pMap)(requests, async (req) => { | ||
const assets = await common_1.pMap(requests, async (req) => { | ||
var _a, _b; | ||
@@ -80,3 +80,3 @@ let asset; | ||
const tokenId = tid == null ? undefined : String(tid); | ||
const assetUri = (0, chain_resource_1.getChainUri)({ | ||
const assetUri = chain_resource_1.getChainUri({ | ||
chainId: account.chainId, | ||
@@ -114,3 +114,3 @@ assetName, | ||
}, { concurrency: this.concurrency }); | ||
debug('Assets: %s', (0, common_1.stringify)(assets)); | ||
debug('Assets: %s', common_1.stringify(assets)); | ||
return assets; | ||
@@ -138,5 +138,5 @@ } | ||
try { | ||
const fetch = (0, common_1.getFetch)(); | ||
const fetch = common_1.getFetch(); | ||
if (url.startsWith('ipfs://')) { | ||
const ipfsGateway = (0, common_1.getEnvVar)('IPFS_GATEWAY_URL', 'https://ipfs.io'); | ||
const ipfsGateway = 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 (0, common_1.handleFetchResponse)(res, 200); | ||
token.metadata = await common_1.handleFetchResponse(res, 200); | ||
} | ||
@@ -151,0 +151,0 @@ catch (err) { |
@@ -23,3 +23,3 @@ "use strict"; | ||
static parse(id) { | ||
const { chainId: chainIdParams, address } = (0, utils_1.parseCaipId)(id, this.spec); | ||
const { chainId: chainIdParams, address } = 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 (0, utils_1.formatCaipId)(params, this.spec); | ||
return utils_1.formatCaipId(params, this.spec); | ||
} | ||
@@ -32,0 +32,0 @@ toString() { |
@@ -24,6 +24,6 @@ "use strict"; | ||
static parse(id) { | ||
return new AssetId((0, utils_1.parseCaipId)(id, this.spec)).toJSON(); | ||
return new AssetId(utils_1.parseCaipId(id, this.spec)).toJSON(); | ||
} | ||
static format(params) { | ||
return (0, utils_1.formatCaipId)(params, this.spec); | ||
return utils_1.formatCaipId(params, this.spec); | ||
} | ||
@@ -30,0 +30,0 @@ toString() { |
@@ -25,6 +25,6 @@ "use strict"; | ||
static parse(id) { | ||
return new AssetNameId((0, utils_1.parseCaipId)(id, this.spec)).toJSON(); | ||
return new AssetNameId(utils_1.parseCaipId(id, this.spec)).toJSON(); | ||
} | ||
static format(params) { | ||
return (0, utils_1.formatCaipId)(params, this.spec); | ||
return utils_1.formatCaipId(params, this.spec); | ||
} | ||
@@ -31,0 +31,0 @@ /** |
@@ -22,6 +22,6 @@ "use strict"; | ||
static parse(id) { | ||
return new AssetName((0, utils_1.parseCaipId)(id, this.spec)).toJSON(); | ||
return new AssetName(utils_1.parseCaipId(id, this.spec)).toJSON(); | ||
} | ||
static format(params) { | ||
return (0, utils_1.formatCaipId)(params, this.spec); | ||
return utils_1.formatCaipId(params, this.spec); | ||
} | ||
@@ -28,0 +28,0 @@ toString() { |
@@ -24,6 +24,6 @@ "use strict"; | ||
static parse(id) { | ||
return new AssetType((0, utils_1.parseCaipId)(id, this.spec)).toJSON(); | ||
return new AssetType(utils_1.parseCaipId(id, this.spec)).toJSON(); | ||
} | ||
static format(params) { | ||
return (0, utils_1.formatCaipId)(params, this.spec); | ||
return utils_1.formatCaipId(params, this.spec); | ||
} | ||
@@ -30,0 +30,0 @@ toString() { |
@@ -22,6 +22,6 @@ "use strict"; | ||
static parse(id) { | ||
return new ChainId((0, utils_1.parseCaipId)(id, this.spec)).toJSON(); | ||
return new ChainId(utils_1.parseCaipId(id, this.spec)).toJSON(); | ||
} | ||
static format(params) { | ||
return (0, utils_1.formatCaipId)(params, this.spec); | ||
return 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 | ||
(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); | ||
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); | ||
const account_id_1 = require("./account-id"); | ||
@@ -40,3 +40,3 @@ const asset_id_1 = require("./asset-id"); | ||
} | ||
if ((0, utils_1.isValidCaipId)(id, t.spec)) { | ||
if (utils_1.isValidCaipId(id, t.spec)) { | ||
return new t(id); | ||
@@ -46,12 +46,12 @@ } | ||
} | ||
if ((0, types_1.isAssetId)(id)) { | ||
if (types_1.isAssetId(id)) { | ||
return new asset_id_1.AssetId(id); | ||
} | ||
if ((0, types_1.isAssetType)(id)) { | ||
if (types_1.isAssetType(id)) { | ||
return new asset_type_1.AssetType(id); | ||
} | ||
if ((0, types_1.isAccountId)(id)) { | ||
if (types_1.isAccountId(id)) { | ||
return new account_id_1.AccountId(id); | ||
} | ||
if ((0, types_1.isChainId)(id)) { | ||
if (types_1.isChainId(id)) { | ||
return new chain_id_1.ChainId(id); | ||
@@ -69,13 +69,13 @@ } | ||
function stringifyCaipId(id) { | ||
if ((0, types_1.isAssetId)(id)) { | ||
return (0, utils_1.formatCaipId)(id, asset_id_1.AssetId.spec); | ||
if (types_1.isAssetId(id)) { | ||
return utils_1.formatCaipId(id, asset_id_1.AssetId.spec); | ||
} | ||
if ((0, types_1.isAssetType)(id)) { | ||
return (0, utils_1.formatCaipId)(id, asset_type_1.AssetType.spec); | ||
if (types_1.isAssetType(id)) { | ||
return utils_1.formatCaipId(id, asset_type_1.AssetType.spec); | ||
} | ||
if ((0, types_1.isAccountId)(id)) { | ||
return (0, utils_1.formatCaipId)(id, account_id_1.AccountId.spec); | ||
if (types_1.isAccountId(id)) { | ||
return utils_1.formatCaipId(id, account_id_1.AccountId.spec); | ||
} | ||
if ((0, types_1.isChainId)(id)) { | ||
return (0, utils_1.formatCaipId)(id, chain_id_1.ChainId.spec); | ||
if (types_1.isChainId(id)) { | ||
return utils_1.formatCaipId(id, chain_id_1.ChainId.spec); | ||
} | ||
@@ -94,5 +94,5 @@ return String(id); | ||
} | ||
return (0, types_1.isChainId)(id) ? new chain_id_1.ChainId(id) : new chain_id_1.ChainId(id.chainId); | ||
return 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 = (0, common_1.debugFactory)('collabland:chain'); | ||
const debug = common_1.debugFactory('collabland:chain'); | ||
/** | ||
@@ -121,12 +121,12 @@ * Chain id resource | ||
let resolved; | ||
if ((0, caip_1.isAssetId)(params)) { | ||
if (caip_1.isAssetId(params)) { | ||
resolved = new AssetIdResource(params, options); | ||
} | ||
else if ((0, caip_1.isAssetType)(params)) { | ||
else if (caip_1.isAssetType(params)) { | ||
resolved = new AssetTypeResource(params, options); | ||
} | ||
else if ((0, caip_1.isAccountId)(params)) { | ||
else if (caip_1.isAccountId(params)) { | ||
resolved = new AccountIdResource(params, options); | ||
} | ||
else if ((0, caip_1.isChainId)(params)) { | ||
else if (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: ${(0, common_1.stringify)(resource)}`); | ||
throw new Error(`Invalid chain resource: ${common_1.stringify(resource)}`); | ||
} | ||
@@ -173,3 +173,3 @@ return resolved; | ||
var _a; | ||
const uri = (0, caip_1.stringifyCaipId)(chainResource); | ||
const uri = 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 = (0, caip_1.asCaipId)(id); | ||
const caipId = caip_1.asCaipId(id); | ||
const chainResource = { | ||
@@ -202,0 +202,0 @@ ...caipId.toJSON(), |
@@ -8,8 +8,8 @@ "use strict"; | ||
const tslib_1 = require("tslib"); | ||
(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); | ||
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); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@collabland/chain", | ||
"version": "0.14.3", | ||
"version": "0.14.4", | ||
"description": "CollabLand Ethereum Integration", | ||
@@ -34,3 +34,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@collabland/common": "^0.25.0", | ||
"@collabland/common": "^0.25.1", | ||
"tslib": "^2.0.0" | ||
@@ -47,3 +47,3 @@ }, | ||
"author": "Abridged, Inc.", | ||
"gitHead": "e71f252bdb0c382b2d35727ce369c6edeaa370b7" | ||
"gitHead": "3e58ad40eda0179804c558bec244221fc36cb981" | ||
} |
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
125493
Updated@collabland/common@^0.25.1