Comparing version 0.4.0 to 0.5.0
@@ -17,8 +17,8 @@ "use strict"; | ||
return new ChainID({ | ||
namespace: params[1], | ||
reference: params[0], | ||
namespace: params[0], | ||
reference: params[1], | ||
}); | ||
} | ||
static format(params) { | ||
return params.reference + this.delimiter + params.namespace; | ||
return params.namespace + this.delimiter + params.reference; | ||
} | ||
@@ -25,0 +25,0 @@ toString() { |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("CAIP",[],t):"object"==typeof exports?exports.CAIP=t():e.CAIP=t()}(this,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=1)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});class n{constructor(e){this.namespace=e.namespace,this.reference=e.reference}static isValid(e){return e.includes(this.delimiter)}static parse(e){if(!n.isValid(e))throw new Error("Invalid chainId provided: "+e);const t=e.split(this.delimiter);return new n({namespace:t[1],reference:t[0]})}static format(e){return e.reference+this.delimiter+e.namespace}toString(){return n.format(this.toJson())}toJson(){return{namespace:this.namespace,reference:this.reference}}}t.ChainID=n,n.standard="caip-2",n.delimiter=":"},function(e,t,r){"use strict";function n(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}Object.defineProperty(t,"__esModule",{value:!0}),n(r(2)),n(r(0))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(0);class i{constructor(e){this.chainId=n.ChainID.parse(e.chainId),this.address=e.address}static isValid(e){return e.includes(this.delimiter)}static parse(e){if(!i.isValid(e))throw new Error("Invalid accountId provided: "+e);const t=e.split(this.delimiter);return new i({chainId:t[1],address:t[0]})}static format(e){return e.address+this.delimiter+e.chainId}toString(){return i.format(this.toJson())}toJson(){return{chainId:this.chainId.toString(),address:this.address}}}t.AccountID=i,i.standard="caip-10",i.delimiter="@"}])})); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("CAIP",[],t):"object"==typeof exports?exports.CAIP=t():e.CAIP=t()}(this,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=1)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});class n{constructor(e){this.namespace=e.namespace,this.reference=e.reference}static isValid(e){return e.includes(this.delimiter)}static parse(e){if(!n.isValid(e))throw new Error("Invalid chainId provided: "+e);const t=e.split(this.delimiter);return new n({namespace:t[0],reference:t[1]})}static format(e){return e.namespace+this.delimiter+e.reference}toString(){return n.format(this.toJson())}toJson(){return{namespace:this.namespace,reference:this.reference}}}t.ChainID=n,n.standard="caip-2",n.delimiter=":"},function(e,t,r){"use strict";function n(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}Object.defineProperty(t,"__esModule",{value:!0}),n(r(2)),n(r(0))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(0);class i{constructor(e){this.chainId=n.ChainID.parse(e.chainId),this.address=e.address}static isValid(e){return e.includes(this.delimiter)}static parse(e){if(!i.isValid(e))throw new Error("Invalid accountId provided: "+e);const t=e.split(this.delimiter);return new i({chainId:t[1],address:t[0]})}static format(e){return e.address+this.delimiter+e.chainId}toString(){return i.format(this.toJson())}toJson(){return{chainId:this.chainId.toString(),address:this.address}}}t.AccountID=i,i.standard="caip-10",i.delimiter="@"}])})); |
{ | ||
"name": "caip", | ||
"description": "CAIP standard utils", | ||
"version": "0.4.0", | ||
"version": "0.5.0", | ||
"author": "Pedro Gomes <github.com/pedrouid>", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
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