@keystonehq/bc-ur-registry-eth
Advanced tools
Comparing version 0.19.1 to 0.20.0
@@ -23,3 +23,2 @@ 'use strict'; | ||
var Keys; | ||
(function (Keys) { | ||
@@ -34,3 +33,2 @@ Keys[Keys["requestId"] = 1] = "requestId"; | ||
})(Keys || (Keys = {})); | ||
(function (DataType) { | ||
@@ -42,44 +40,28 @@ DataType[DataType["transaction"] = 1] = "transaction"; | ||
})(exports.DataType || (exports.DataType = {})); | ||
class EthSignRequest extends bcUrRegistry.RegistryItem { | ||
constructor(args) { | ||
super(); | ||
this.getRegistryType = () => ExtendedRegistryTypes.ETH_SIGN_REQUEST; | ||
this.getRequestId = () => this.requestId; | ||
this.getSignData = () => this.signData; | ||
this.getDataType = () => this.dataType; | ||
this.getChainId = () => this.chainId; | ||
this.getDerivationPath = () => this.derivationPath.getPath(); | ||
this.getSourceFingerprint = () => this.derivationPath.getSourceFingerprint(); | ||
this.getSignRequestAddress = () => this.address; | ||
this.getOrigin = () => this.origin; | ||
this.toDataItem = () => { | ||
const map = {}; | ||
if (this.requestId) { | ||
map[Keys.requestId] = new bcUrRegistry.DataItem(this.requestId, RegistryTypes.UUID.getTag()); | ||
} | ||
if (this.address) { | ||
map[Keys.address] = this.address; | ||
} | ||
if (this.chainId) { | ||
map[Keys.chainId] = Number(this.chainId); | ||
} | ||
if (this.origin) { | ||
map[Keys.origin] = this.origin; | ||
} | ||
map[Keys.signData] = this.signData; | ||
@@ -92,3 +74,2 @@ map[Keys.dataType] = this.dataType; | ||
}; | ||
this.requestId = args.requestId; | ||
@@ -102,3 +83,2 @@ this.signData = args.signData; | ||
} | ||
static constructETHRequest(signData, signDataType, hdPath, xfp, uuidString, chainId, address, origin) { | ||
@@ -109,7 +89,5 @@ const paths = hdPath.replace(/[m|M]\//, "").split("/"); | ||
let isHardened = false; | ||
if (path.endsWith("'")) { | ||
isHardened = true; | ||
} | ||
return new bcUrRegistry.PathComponent({ | ||
@@ -130,5 +108,3 @@ index, | ||
} | ||
} | ||
EthSignRequest.fromDataItem = dataItem => { | ||
@@ -153,3 +129,2 @@ const map = dataItem.getData(); | ||
}; | ||
EthSignRequest.fromCBOR = _cborPayload => { | ||
@@ -165,3 +140,2 @@ const dataItem = decodeToDataItem(_cborPayload); | ||
var Keys$1; | ||
(function (Keys) { | ||
@@ -172,22 +146,14 @@ Keys[Keys["requestId"] = 1] = "requestId"; | ||
})(Keys$1 || (Keys$1 = {})); | ||
class ETHSignature extends bcUrRegistry.RegistryItem { | ||
constructor(signature, requestId, origin) { | ||
super(); | ||
this.getRegistryType = () => ExtendedRegistryTypes.ETH_SIGNATURE; | ||
this.getRequestId = () => this.requestId; | ||
this.getSignature = () => this.signature; | ||
this.getOrigin = () => this.origin; | ||
this.toDataItem = () => { | ||
const map = {}; | ||
if (this.requestId) { | ||
map[Keys$1.requestId] = new bcUrRegistry.DataItem(this.requestId, RegistryTypes$1.UUID.getTag()); | ||
} | ||
if (this.origin) map[Keys$1.origin] = this.origin; | ||
@@ -197,3 +163,2 @@ map[Keys$1.signature] = this.signature; | ||
}; | ||
this.signature = signature; | ||
@@ -203,5 +168,3 @@ this.requestId = requestId; | ||
} | ||
} | ||
ETHSignature.fromDataItem = dataItem => { | ||
@@ -213,3 +176,2 @@ const map = dataItem.getData(); | ||
}; | ||
ETHSignature.fromCBOR = _cborPayload => { | ||
@@ -224,3 +186,2 @@ const dataItem = decodeToDataItem$1(_cborPayload); | ||
var Keys$2; | ||
(function (Keys) { | ||
@@ -233,19 +194,11 @@ Keys[Keys["chainId"] = 1] = "chainId"; | ||
})(Keys$2 || (Keys$2 = {})); | ||
class ETHNFTItem extends bcUrRegistry.RegistryItem { | ||
constructor(args) { | ||
super(); | ||
this.getRegistryType = () => ExtendedRegistryTypes.ETH_NFT_ITEM; | ||
this.getChainId = () => this.chainId; | ||
this.getName = () => this.name; | ||
this.getmediaData = () => this.mediaData; | ||
this.getContractAddress = () => this.contractAddress; | ||
this.getContractName = () => this.contractName; | ||
this.toDataItem = () => { | ||
@@ -260,3 +213,2 @@ const map = {}; | ||
}; | ||
this.chainId = args.chainId; | ||
@@ -268,3 +220,2 @@ this.name = args.name; | ||
} | ||
static constructETHNFTItem(chainId, contractAddress, contractName, name, mediaData) { | ||
@@ -279,5 +230,3 @@ return new ETHNFTItem({ | ||
} | ||
} | ||
ETHNFTItem.fromDataItem = dataItem => { | ||
@@ -298,3 +247,2 @@ const map = dataItem.getData(); | ||
}; | ||
ETHNFTItem.fromCBOR = _cborPayload => { | ||
@@ -310,3 +258,3 @@ const dataItem = decodeToDataItem$2(_cborPayload); | ||
const publicKey = node.derive(derivePath); | ||
const address = "0x" + util.publicToAddress(publicKey.publicKey, true).toString("hex"); | ||
const address = "0x" + Buffer.from(util.publicToAddress(publicKey.publicKey, true)).toString("hex"); | ||
return util.toChecksumAddress(address); | ||
@@ -317,5 +265,3 @@ }; | ||
const path = `M/0/${i}`; | ||
const _address = generateAddressFromXpub(xpub, path); | ||
if (address.toLowerCase() == _address.toLowerCase()) { | ||
@@ -325,3 +271,2 @@ return `${rootPath}/0/${i}`; | ||
} | ||
return null; | ||
@@ -328,0 +273,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e=require("@keystonehq/bc-ur-registry"),a=require("uuid"),s=(t=require("hdkey"))&&"object"==typeof t&&"default"in t?t.default:t,i=require("@ethereumjs/util");const r={ETH_SIGN_REQUEST:new e.RegistryType("eth-sign-request",401),ETH_SIGNATURE:new e.RegistryType("eth-signature",402),ETH_NFT_ITEM:new e.RegistryType("eth-nft-item",403)},{decodeToDataItem:n,RegistryTypes:d}=e.extend;var o,h;!function(t){t[t.requestId=1]="requestId",t[t.signData=2]="signData",t[t.dataType=3]="dataType",t[t.chainId=4]="chainId",t[t.derivationPath=5]="derivationPath",t[t.address=6]="address",t[t.origin=7]="origin"}(o||(o={})),(h=exports.DataType||(exports.DataType={}))[h.transaction=1]="transaction",h[h.typedData=2]="typedData",h[h.personalMessage=3]="personalMessage",h[h.typedTransaction=4]="typedTransaction";class c extends e.RegistryItem{constructor(t){super(),this.getRegistryType=()=>r.ETH_SIGN_REQUEST,this.getRequestId=()=>this.requestId,this.getSignData=()=>this.signData,this.getDataType=()=>this.dataType,this.getChainId=()=>this.chainId,this.getDerivationPath=()=>this.derivationPath.getPath(),this.getSourceFingerprint=()=>this.derivationPath.getSourceFingerprint(),this.getSignRequestAddress=()=>this.address,this.getOrigin=()=>this.origin,this.toDataItem=()=>{const t={};this.requestId&&(t[o.requestId]=new e.DataItem(this.requestId,d.UUID.getTag())),this.address&&(t[o.address]=this.address),this.chainId&&(t[o.chainId]=Number(this.chainId)),this.origin&&(t[o.origin]=this.origin),t[o.signData]=this.signData,t[o.dataType]=this.dataType;const a=this.derivationPath.toDataItem();return a.setTag(this.derivationPath.getRegistryType().getTag()),t[o.derivationPath]=a,new e.DataItem(t)},this.requestId=t.requestId,this.signData=t.signData,this.dataType=t.dataType,this.chainId=t.chainId,this.derivationPath=t.derivationPath,this.address=t.address,this.origin=t.origin}static constructETHRequest(t,s,i,r,n,d,o,h){const g=i.replace(/[m|M]\//,"").split("/"),u=new e.CryptoKeypath(g.map(t=>{const a=parseInt(t.replace("'",""));let s=!1;return t.endsWith("'")&&(s=!0),new e.PathComponent({index:a,hardened:s})}),Buffer.from(r,"hex"));return new c({requestId:n?Buffer.from(a.parse(n)):void 0,signData:t,dataType:s,derivationPath:u,chainId:d,address:o?Buffer.from(o.replace("0x",""),"hex"):void 0,origin:h||void 0})}}c.fromDataItem=t=>{const a=t.getData(),s=a[o.signData],i=a[o.dataType],r=e.CryptoKeypath.fromDataItem(a[o.derivationPath]),n=a[o.chainId]?a[o.chainId]:void 0,d=a[o.address]?a[o.address]:void 0,h=a[o.requestId]?a[o.requestId].getData():void 0;return new c({requestId:h,signData:s,dataType:i,chainId:n,derivationPath:r,address:d,origin:a[o.origin]?a[o.origin]:void 0})},c.fromCBOR=t=>{const e=n(t);return c.fromDataItem(e)};const{RegistryTypes:g,decodeToDataItem:u}=e.extend;var m;!function(t){t[t.requestId=1]="requestId",t[t.signature=2]="signature",t[t.origin=3]="origin"}(m||(m={}));class I extends e.RegistryItem{constructor(t,a,s){super(),this.getRegistryType=()=>r.ETH_SIGNATURE,this.getRequestId=()=>this.requestId,this.getSignature=()=>this.signature,this.getOrigin=()=>this.origin,this.toDataItem=()=>{const t={};return this.requestId&&(t[m.requestId]=new e.DataItem(this.requestId,g.UUID.getTag())),this.origin&&(t[m.origin]=this.origin),t[m.signature]=this.signature,new e.DataItem(t)},this.signature=t,this.requestId=a,this.origin=s}}I.fromDataItem=t=>{const e=t.getData(),a=e[m.signature],s=e[m.requestId]?e[m.requestId].getData():void 0;return new I(a,s,e[m.origin])},I.fromCBOR=t=>{const e=u(t);return I.fromDataItem(e)};const{decodeToDataItem:p}=e.extend;var D;!function(t){t[t.chainId=1]="chainId",t[t.contractAddress=2]="contractAddress",t[t.contractName=3]="contractName",t[t.name=4]="name",t[t.mediaData=5]="mediaData"}(D||(D={}));class T extends e.RegistryItem{constructor(t){super(),this.getRegistryType=()=>r.ETH_NFT_ITEM,this.getChainId=()=>this.chainId,this.getName=()=>this.name,this.getmediaData=()=>this.mediaData,this.getContractAddress=()=>this.contractAddress,this.getContractName=()=>this.contractName,this.toDataItem=()=>{const t={};return t[D.chainId]=this.chainId,t[D.name]=this.name,t[D.contractAddress]=this.contractAddress,t[D.contractName]=this.contractName,t[D.mediaData]=this.mediaData,new e.DataItem(t)},this.chainId=t.chainId,this.name=t.name,this.contractAddress=t.contractAddress,this.contractName=t.contractName,this.mediaData=t.mediaData}static constructETHNFTItem(t,e,a,s,i){return new T({chainId:t,contractAddress:e,contractName:a,mediaData:i,name:s})}}T.fromDataItem=t=>{const e=t.getData();return new T({chainId:e[D.chainId],name:e[D.name],contractAddress:e[D.contractAddress],contractName:e[D.contractName],mediaData:e[D.mediaData]})},T.fromCBOR=t=>{const e=p(t);return T.fromDataItem(e)};const y=(t,e)=>{const a=s.fromExtendedKey(t).derive(e),r="0x"+i.publicToAddress(a.publicKey,!0).toString("hex");return i.toChecksumAddress(r)};e.patchTags(Object.values(r).filter(t=>!!t.getTag()).map(t=>t.getTag())),Object.keys(e).forEach((function(t){"default"!==t&&Object.defineProperty(exports,t,{enumerable:!0,get:function(){return e[t]}})})),exports.ETHNFTItem=T,exports.ETHSignature=I,exports.EthSignRequest=c,exports.findHDPathFromAddress=(t,e,a,s)=>{for(let i=0;i<a;i++){const a=y(e,"M/0/"+i);if(t.toLowerCase()==a.toLowerCase())return`${s}/0/${i}`}return null},exports.generateAddressFromXpub=y; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e=require("@keystonehq/bc-ur-registry"),a=require("uuid"),s=(t=require("hdkey"))&&"object"==typeof t&&"default"in t?t.default:t,i=require("@ethereumjs/util");const r={ETH_SIGN_REQUEST:new e.RegistryType("eth-sign-request",401),ETH_SIGNATURE:new e.RegistryType("eth-signature",402),ETH_NFT_ITEM:new e.RegistryType("eth-nft-item",403)},{decodeToDataItem:n,RegistryTypes:d}=e.extend;var o,h;!function(t){t[t.requestId=1]="requestId",t[t.signData=2]="signData",t[t.dataType=3]="dataType",t[t.chainId=4]="chainId",t[t.derivationPath=5]="derivationPath",t[t.address=6]="address",t[t.origin=7]="origin"}(o||(o={})),(h=exports.DataType||(exports.DataType={}))[h.transaction=1]="transaction",h[h.typedData=2]="typedData",h[h.personalMessage=3]="personalMessage",h[h.typedTransaction=4]="typedTransaction";class c extends e.RegistryItem{constructor(t){super(),this.getRegistryType=()=>r.ETH_SIGN_REQUEST,this.getRequestId=()=>this.requestId,this.getSignData=()=>this.signData,this.getDataType=()=>this.dataType,this.getChainId=()=>this.chainId,this.getDerivationPath=()=>this.derivationPath.getPath(),this.getSourceFingerprint=()=>this.derivationPath.getSourceFingerprint(),this.getSignRequestAddress=()=>this.address,this.getOrigin=()=>this.origin,this.toDataItem=()=>{const t={};this.requestId&&(t[o.requestId]=new e.DataItem(this.requestId,d.UUID.getTag())),this.address&&(t[o.address]=this.address),this.chainId&&(t[o.chainId]=Number(this.chainId)),this.origin&&(t[o.origin]=this.origin),t[o.signData]=this.signData,t[o.dataType]=this.dataType;const a=this.derivationPath.toDataItem();return a.setTag(this.derivationPath.getRegistryType().getTag()),t[o.derivationPath]=a,new e.DataItem(t)},this.requestId=t.requestId,this.signData=t.signData,this.dataType=t.dataType,this.chainId=t.chainId,this.derivationPath=t.derivationPath,this.address=t.address,this.origin=t.origin}static constructETHRequest(t,s,i,r,n,d,o,h){const g=i.replace(/[m|M]\//,"").split("/"),u=new e.CryptoKeypath(g.map(t=>{const a=parseInt(t.replace("'",""));let s=!1;return t.endsWith("'")&&(s=!0),new e.PathComponent({index:a,hardened:s})}),Buffer.from(r,"hex"));return new c({requestId:n?Buffer.from(a.parse(n)):void 0,signData:t,dataType:s,derivationPath:u,chainId:d,address:o?Buffer.from(o.replace("0x",""),"hex"):void 0,origin:h||void 0})}}c.fromDataItem=t=>{const a=t.getData(),s=a[o.signData],i=a[o.dataType],r=e.CryptoKeypath.fromDataItem(a[o.derivationPath]),n=a[o.chainId]?a[o.chainId]:void 0,d=a[o.address]?a[o.address]:void 0,h=a[o.requestId]?a[o.requestId].getData():void 0;return new c({requestId:h,signData:s,dataType:i,chainId:n,derivationPath:r,address:d,origin:a[o.origin]?a[o.origin]:void 0})},c.fromCBOR=t=>{const e=n(t);return c.fromDataItem(e)};const{RegistryTypes:g,decodeToDataItem:u}=e.extend;var m;!function(t){t[t.requestId=1]="requestId",t[t.signature=2]="signature",t[t.origin=3]="origin"}(m||(m={}));class I extends e.RegistryItem{constructor(t,a,s){super(),this.getRegistryType=()=>r.ETH_SIGNATURE,this.getRequestId=()=>this.requestId,this.getSignature=()=>this.signature,this.getOrigin=()=>this.origin,this.toDataItem=()=>{const t={};return this.requestId&&(t[m.requestId]=new e.DataItem(this.requestId,g.UUID.getTag())),this.origin&&(t[m.origin]=this.origin),t[m.signature]=this.signature,new e.DataItem(t)},this.signature=t,this.requestId=a,this.origin=s}}I.fromDataItem=t=>{const e=t.getData(),a=e[m.signature],s=e[m.requestId]?e[m.requestId].getData():void 0;return new I(a,s,e[m.origin])},I.fromCBOR=t=>{const e=u(t);return I.fromDataItem(e)};const{decodeToDataItem:p}=e.extend;var D;!function(t){t[t.chainId=1]="chainId",t[t.contractAddress=2]="contractAddress",t[t.contractName=3]="contractName",t[t.name=4]="name",t[t.mediaData=5]="mediaData"}(D||(D={}));class T extends e.RegistryItem{constructor(t){super(),this.getRegistryType=()=>r.ETH_NFT_ITEM,this.getChainId=()=>this.chainId,this.getName=()=>this.name,this.getmediaData=()=>this.mediaData,this.getContractAddress=()=>this.contractAddress,this.getContractName=()=>this.contractName,this.toDataItem=()=>{const t={};return t[D.chainId]=this.chainId,t[D.name]=this.name,t[D.contractAddress]=this.contractAddress,t[D.contractName]=this.contractName,t[D.mediaData]=this.mediaData,new e.DataItem(t)},this.chainId=t.chainId,this.name=t.name,this.contractAddress=t.contractAddress,this.contractName=t.contractName,this.mediaData=t.mediaData}static constructETHNFTItem(t,e,a,s,i){return new T({chainId:t,contractAddress:e,contractName:a,mediaData:i,name:s})}}T.fromDataItem=t=>{const e=t.getData();return new T({chainId:e[D.chainId],name:e[D.name],contractAddress:e[D.contractAddress],contractName:e[D.contractName],mediaData:e[D.mediaData]})},T.fromCBOR=t=>{const e=p(t);return T.fromDataItem(e)};const y=(t,e)=>{const a=s.fromExtendedKey(t).derive(e),r="0x"+Buffer.from(i.publicToAddress(a.publicKey,!0)).toString("hex");return i.toChecksumAddress(r)};e.patchTags(Object.values(r).filter(t=>!!t.getTag()).map(t=>t.getTag())),Object.keys(e).forEach((function(t){"default"!==t&&Object.defineProperty(exports,t,{enumerable:!0,get:function(){return e[t]}})})),exports.ETHNFTItem=T,exports.ETHSignature=I,exports.EthSignRequest=c,exports.findHDPathFromAddress=(t,e,a,s)=>{for(let i=0;i<a;i++){const a=y(e,"M/0/"+i);if(t.toLowerCase()==a.toLowerCase())return`${s}/0/${i}`}return null},exports.generateAddressFromXpub=y; | ||
//# sourceMappingURL=bc-ur-registry-eth.cjs.production.min.js.map |
@@ -18,3 +18,2 @@ import { RegistryType, RegistryItem, DataItem, CryptoKeypath, PathComponent, extend, patchTags } from '@keystonehq/bc-ur-registry'; | ||
var Keys; | ||
(function (Keys) { | ||
@@ -29,5 +28,3 @@ Keys[Keys["requestId"] = 1] = "requestId"; | ||
})(Keys || (Keys = {})); | ||
var DataType; | ||
(function (DataType) { | ||
@@ -39,44 +36,28 @@ DataType[DataType["transaction"] = 1] = "transaction"; | ||
})(DataType || (DataType = {})); | ||
class EthSignRequest extends RegistryItem { | ||
constructor(args) { | ||
super(); | ||
this.getRegistryType = () => ExtendedRegistryTypes.ETH_SIGN_REQUEST; | ||
this.getRequestId = () => this.requestId; | ||
this.getSignData = () => this.signData; | ||
this.getDataType = () => this.dataType; | ||
this.getChainId = () => this.chainId; | ||
this.getDerivationPath = () => this.derivationPath.getPath(); | ||
this.getSourceFingerprint = () => this.derivationPath.getSourceFingerprint(); | ||
this.getSignRequestAddress = () => this.address; | ||
this.getOrigin = () => this.origin; | ||
this.toDataItem = () => { | ||
const map = {}; | ||
if (this.requestId) { | ||
map[Keys.requestId] = new DataItem(this.requestId, RegistryTypes.UUID.getTag()); | ||
} | ||
if (this.address) { | ||
map[Keys.address] = this.address; | ||
} | ||
if (this.chainId) { | ||
map[Keys.chainId] = Number(this.chainId); | ||
} | ||
if (this.origin) { | ||
map[Keys.origin] = this.origin; | ||
} | ||
map[Keys.signData] = this.signData; | ||
@@ -89,3 +70,2 @@ map[Keys.dataType] = this.dataType; | ||
}; | ||
this.requestId = args.requestId; | ||
@@ -99,3 +79,2 @@ this.signData = args.signData; | ||
} | ||
static constructETHRequest(signData, signDataType, hdPath, xfp, uuidString, chainId, address, origin) { | ||
@@ -106,7 +85,5 @@ const paths = hdPath.replace(/[m|M]\//, "").split("/"); | ||
let isHardened = false; | ||
if (path.endsWith("'")) { | ||
isHardened = true; | ||
} | ||
return new PathComponent({ | ||
@@ -127,5 +104,3 @@ index, | ||
} | ||
} | ||
EthSignRequest.fromDataItem = dataItem => { | ||
@@ -150,3 +125,2 @@ const map = dataItem.getData(); | ||
}; | ||
EthSignRequest.fromCBOR = _cborPayload => { | ||
@@ -162,3 +136,2 @@ const dataItem = decodeToDataItem(_cborPayload); | ||
var Keys$1; | ||
(function (Keys) { | ||
@@ -169,22 +142,14 @@ Keys[Keys["requestId"] = 1] = "requestId"; | ||
})(Keys$1 || (Keys$1 = {})); | ||
class ETHSignature extends RegistryItem { | ||
constructor(signature, requestId, origin) { | ||
super(); | ||
this.getRegistryType = () => ExtendedRegistryTypes.ETH_SIGNATURE; | ||
this.getRequestId = () => this.requestId; | ||
this.getSignature = () => this.signature; | ||
this.getOrigin = () => this.origin; | ||
this.toDataItem = () => { | ||
const map = {}; | ||
if (this.requestId) { | ||
map[Keys$1.requestId] = new DataItem(this.requestId, RegistryTypes$1.UUID.getTag()); | ||
} | ||
if (this.origin) map[Keys$1.origin] = this.origin; | ||
@@ -194,3 +159,2 @@ map[Keys$1.signature] = this.signature; | ||
}; | ||
this.signature = signature; | ||
@@ -200,5 +164,3 @@ this.requestId = requestId; | ||
} | ||
} | ||
ETHSignature.fromDataItem = dataItem => { | ||
@@ -210,3 +172,2 @@ const map = dataItem.getData(); | ||
}; | ||
ETHSignature.fromCBOR = _cborPayload => { | ||
@@ -221,3 +182,2 @@ const dataItem = decodeToDataItem$1(_cborPayload); | ||
var Keys$2; | ||
(function (Keys) { | ||
@@ -230,19 +190,11 @@ Keys[Keys["chainId"] = 1] = "chainId"; | ||
})(Keys$2 || (Keys$2 = {})); | ||
class ETHNFTItem extends RegistryItem { | ||
constructor(args) { | ||
super(); | ||
this.getRegistryType = () => ExtendedRegistryTypes.ETH_NFT_ITEM; | ||
this.getChainId = () => this.chainId; | ||
this.getName = () => this.name; | ||
this.getmediaData = () => this.mediaData; | ||
this.getContractAddress = () => this.contractAddress; | ||
this.getContractName = () => this.contractName; | ||
this.toDataItem = () => { | ||
@@ -257,3 +209,2 @@ const map = {}; | ||
}; | ||
this.chainId = args.chainId; | ||
@@ -265,3 +216,2 @@ this.name = args.name; | ||
} | ||
static constructETHNFTItem(chainId, contractAddress, contractName, name, mediaData) { | ||
@@ -276,5 +226,3 @@ return new ETHNFTItem({ | ||
} | ||
} | ||
ETHNFTItem.fromDataItem = dataItem => { | ||
@@ -295,3 +243,2 @@ const map = dataItem.getData(); | ||
}; | ||
ETHNFTItem.fromCBOR = _cborPayload => { | ||
@@ -307,3 +254,3 @@ const dataItem = decodeToDataItem$2(_cborPayload); | ||
const publicKey = node.derive(derivePath); | ||
const address = "0x" + publicToAddress(publicKey.publicKey, true).toString("hex"); | ||
const address = "0x" + Buffer.from(publicToAddress(publicKey.publicKey, true)).toString("hex"); | ||
return toChecksumAddress(address); | ||
@@ -314,5 +261,3 @@ }; | ||
const path = `M/0/${i}`; | ||
const _address = generateAddressFromXpub(xpub, path); | ||
if (address.toLowerCase() == _address.toLowerCase()) { | ||
@@ -322,3 +267,2 @@ return `${rootPath}/0/${i}`; | ||
} | ||
return null; | ||
@@ -325,0 +269,0 @@ }; |
{ | ||
"name": "@keystonehq/bc-ur-registry-eth", | ||
"version": "0.19.1", | ||
"version": "0.20.0", | ||
"description": "bc-ur-registry extension for ETH", | ||
@@ -15,9 +15,2 @@ "main": "dist/index.js", | ||
], | ||
"scripts": { | ||
"clean": "rm -rf ./dist", | ||
"start": "tsdx watch", | ||
"build": "tsdx build", | ||
"test": "jest --passWithNoTests", | ||
"bundle": "webpack" | ||
}, | ||
"publishConfig": { | ||
@@ -29,3 +22,3 @@ "access": "public" | ||
"dependencies": { | ||
"@ethereumjs/util": "^8.0.0", | ||
"@ethereumjs/util": "^9.0.3", | ||
"@keystonehq/bc-ur-registry": "^0.6.0", | ||
@@ -47,3 +40,10 @@ "hdkey": "^2.0.1", | ||
}, | ||
"gitHead": "e7df2021cfd688bd0365aed7cc1a31cad8c74ff5" | ||
} | ||
"gitHead": "83d8e223d29e5cc71dccc963388d65a87c894636", | ||
"scripts": { | ||
"clean": "rm -rf ./dist", | ||
"start": "tsdx watch", | ||
"build": "tsdx build", | ||
"test": "jest --passWithNoTests", | ||
"bundle": "webpack" | ||
} | ||
} |
@@ -10,3 +10,3 @@ // @ts-ignore | ||
const address = | ||
"0x" + publicToAddress(publicKey.publicKey, true).toString("hex"); | ||
"0x" + Buffer.from(publicToAddress(publicKey.publicKey, true)).toString("hex"); | ||
return toChecksumAddress(address); | ||
@@ -13,0 +13,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
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
95026
+ Added@ethereumjs/rlp@5.0.2(transitive)
+ Added@ethereumjs/util@9.1.0(transitive)
- Removed@ethereumjs/rlp@4.0.1(transitive)
- Removed@ethereumjs/util@8.1.0(transitive)
- Removedmicro-ftch@0.3.1(transitive)
Updated@ethereumjs/util@^9.0.3