Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@keystonehq/bc-ur-registry-eth

Package Overview
Dependencies
Maintainers
2
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@keystonehq/bc-ur-registry-eth - npm Package Compare versions

Comparing version 0.7.6 to 0.7.7-alpha.0

dist/ETHNFTItem.d.ts

83

dist/bc-ur-registry-eth.cjs.development.js

@@ -17,3 +17,4 @@ 'use strict';

ETH_SIGN_REQUEST: /*#__PURE__*/new RegistryType('eth-sign-request', 401),
ETH_SIGNATAURE: /*#__PURE__*/new RegistryType('eth-signature', 402)
ETH_SIGNATAURE: /*#__PURE__*/new RegistryType('eth-signature', 402),
ETH_NFT_ITEM: /*#__PURE__*/new RegistryType('eth-nft-item', 403)
};

@@ -207,2 +208,81 @@

const {
decodeToDataItem: decodeToDataItem$2
} = bcUrRegistry.extend;
var Keys$2;
(function (Keys) {
Keys[Keys["chainId"] = 1] = "chainId";
Keys[Keys["contractAddress"] = 2] = "contractAddress";
Keys[Keys["name"] = 3] = "name";
Keys[Keys["mediaData"] = 4] = "mediaData";
})(Keys$2 || (Keys$2 = {})); // export enum mediaType {
// png = 1,
// jpeg = 2,
// }
class ETHNFTItem extends bcUrRegistry.RegistryItem {
constructor(args) {
super();
this.getRegistryType = () => ExtendedRegistryTypes.ETH_NFT_ITEM;
this.setupData = args => {
this.chainId = args.chainId;
this.name = args.name;
this.contractAddress = args.contractAddress;
this.mediaData = args.mediaData; // remove the data perfix for android usage
};
this.getChainId = () => this.chainId;
this.getName = () => this.name;
this.getmediaData = () => this.mediaData;
this.getContractAddress = () => this.contractAddress;
this.toDataItem = () => {
const map = {};
map[Keys$2.chainId] = this.chainId;
map[Keys$2.name] = this.name;
map[Keys$2.contractAddress] = this.contractAddress;
map[Keys$2.mediaData] = this.mediaData;
return new bcUrRegistry.DataItem(map);
};
this.setupData(args);
}
static constructETHNFTItem(chainId, contractAddress, name, mediaData) {
return new ETHNFTItem({
chainId,
contractAddress,
mediaData,
name
});
}
}
ETHNFTItem.fromDataItem = dataItem => {
const map = dataItem.getData();
const chainId = map[Keys$2.chainId];
const name = map[Keys$2.name];
const mediaData = map[Keys$2.mediaData];
const contractAddress = map[Keys$2.contractAddress];
return new ETHNFTItem({
chainId,
name,
contractAddress,
mediaData
});
};
ETHNFTItem.fromCBOR = _cborPayload => {
const dataItem = decodeToDataItem$2(_cborPayload);
return ETHNFTItem.fromDataItem(dataItem);
};
// @ts-ignore

@@ -242,2 +322,3 @@ const generateAddressfromXpub = (xpub, derivePath) => {

});
exports.ETHNFTItem = ETHNFTItem;
exports.ETHSignature = ETHSignature;

@@ -244,0 +325,0 @@ exports.EthSignRequest = EthSignRequest;

2

dist/bc-ur-registry-eth.cjs.production.min.js

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e=require("@keystonehq/bc-ur-registry"),s=require("uuid"),a=(t=require("hdkey"))&&"object"==typeof t&&"default"in t?t.default:t,i=require("ethereumjs-util");const{RegistryType:r}=e.extend,n={ETH_SIGN_REQUEST:new r("eth-sign-request",401),ETH_SIGNATAURE:new r("eth-signature",402)},{decodeToDataItem:d,RegistryTypes:o}=e.extend;var h,u;!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"}(h||(h={})),(u=exports.DataType||(exports.DataType={}))[u.transaction=1]="transaction",u[u.typedData=2]="typedData",u[u.personalMessage=3]="personalMessage",u[u.typedTransaction=4]="typedTransaction";class g extends e.RegistryItem{constructor(t){super(),this.getRegistryType=()=>n.ETH_SIGN_REQUEST,this.setupData=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},this.getRequestId=()=>this.requestId,this.getSignData=()=>this.signData,this.getDataType=()=>this.dataType,this.getChainId=()=>this.chainId,this.getDerivationPath=()=>this.derivationPath.getPath(),this.getSignRequestAddress=()=>this.address,this.getOrigin=()=>this.origin,this.toDataItem=()=>{const t={};this.requestId&&(t[h.requestId]=new e.DataItem(this.requestId,o.UUID.getTag())),this.address&&(t[h.address]=this.address),this.chainId&&(t[h.chainId]=this.chainId),this.origin&&(t[h.origin]=this.origin),t[h.signData]=this.signData,t[h.dataType]=this.dataType;const s=this.derivationPath.toDataItem();return s.setTag(this.derivationPath.getRegistryType().getTag()),t[h.derivationPath]=s,new e.DataItem(t)},this.setupData(t)}static constructETHRequest(t,a,i,r,n,d,o,h){const u=i.replace(/[m|M]\//,"").split("/"),c=new e.CryptoKeypath(u.map(t=>{const s=parseInt(t.replace("'",""));let a=!1;return t.endsWith("'")&&(a=!0),new e.PathComponent({index:s,hardened:a})}),Buffer.from(r,"hex"));return new g({requestId:n?Buffer.from(s.parse(n)):void 0,signData:t,dataType:a,derivationPath:c,chainId:d,address:o?Buffer.from(o.replace("0x",""),"hex"):void 0,origin:h||void 0})}}g.fromDataItem=t=>{const s=t.getData(),a=s[h.signData],i=s[h.dataType],r=e.CryptoKeypath.fromDataItem(s[h.derivationPath]),n=s[h.chainId]?s[h.chainId]:void 0,d=s[h.address]?s[h.address]:void 0,o=s[h.requestId]?s[h.requestId].getData():void 0;return new g({requestId:o,signData:a,dataType:i,chainId:n,derivationPath:r,address:d,origin:s[h.origin]?s[h.origin]:void 0})},g.fromCBOR=t=>{const e=d(t);return g.fromDataItem(e)};const{RegistryTypes:c,decodeToDataItem:I}=e.extend;var p;!function(t){t[t.requestId=1]="requestId",t[t.signature=2]="signature"}(p||(p={}));class y extends e.RegistryItem{constructor(t,s){super(),this.getRegistryType=()=>n.ETH_SIGNATAURE,this.getRequestId=()=>this.requestId,this.getSignature=()=>this.signature,this.toDataItem=()=>{const t={};return this.requestId&&(t[p.requestId]=new e.DataItem(this.requestId,c.UUID.getTag())),t[p.signature]=this.signature,new e.DataItem(t)},this.signature=t,this.requestId=s}}y.fromDataItem=t=>{const e=t.getData(),s=e[p.signature],a=e[p.requestId]?e[p.requestId].getData():void 0;return new y(s,a)},y.fromCBOR=t=>{const e=I(t);return y.fromDataItem(e)};const T=(t,e)=>{const s=a.fromExtendedKey(t).derive(e),r="0x"+i.publicToAddress(s.publicKey,!0).toString("hex");return i.toChecksumAddress(r)},{cbor:D}=e.extend;D.patchTags(Object.values(n).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.ETHSignature=y,exports.EthSignRequest=g,exports.findHDpatfromAddress=(t,e,s,a)=>{for(let i=0;i<s;i++){const s=T(e,"M/0/"+i);if(t.toLowerCase()==s.toLowerCase())return`${a}/0/${i}`}return null},exports.generateAddressfromXpub=T;
"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{RegistryType:r}=e.extend,n={ETH_SIGN_REQUEST:new r("eth-sign-request",401),ETH_SIGNATAURE:new r("eth-signature",402),ETH_NFT_ITEM:new r("eth-nft-item",403)},{decodeToDataItem:d,RegistryTypes:o}=e.extend;var h,c;!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"}(h||(h={})),(c=exports.DataType||(exports.DataType={}))[c.transaction=1]="transaction",c[c.typedData=2]="typedData",c[c.personalMessage=3]="personalMessage",c[c.typedTransaction=4]="typedTransaction";class u extends e.RegistryItem{constructor(t){super(),this.getRegistryType=()=>n.ETH_SIGN_REQUEST,this.setupData=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},this.getRequestId=()=>this.requestId,this.getSignData=()=>this.signData,this.getDataType=()=>this.dataType,this.getChainId=()=>this.chainId,this.getDerivationPath=()=>this.derivationPath.getPath(),this.getSignRequestAddress=()=>this.address,this.getOrigin=()=>this.origin,this.toDataItem=()=>{const t={};this.requestId&&(t[h.requestId]=new e.DataItem(this.requestId,o.UUID.getTag())),this.address&&(t[h.address]=this.address),this.chainId&&(t[h.chainId]=this.chainId),this.origin&&(t[h.origin]=this.origin),t[h.signData]=this.signData,t[h.dataType]=this.dataType;const a=this.derivationPath.toDataItem();return a.setTag(this.derivationPath.getRegistryType().getTag()),t[h.derivationPath]=a,new e.DataItem(t)},this.setupData(t)}static constructETHRequest(t,s,i,r,n,d,o,h){const c=i.replace(/[m|M]\//,"").split("/"),g=new e.CryptoKeypath(c.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 u({requestId:n?Buffer.from(a.parse(n)):void 0,signData:t,dataType:s,derivationPath:g,chainId:d,address:o?Buffer.from(o.replace("0x",""),"hex"):void 0,origin:h||void 0})}}u.fromDataItem=t=>{const a=t.getData(),s=a[h.signData],i=a[h.dataType],r=e.CryptoKeypath.fromDataItem(a[h.derivationPath]),n=a[h.chainId]?a[h.chainId]:void 0,d=a[h.address]?a[h.address]:void 0,o=a[h.requestId]?a[h.requestId].getData():void 0;return new u({requestId:o,signData:s,dataType:i,chainId:n,derivationPath:r,address:d,origin:a[h.origin]?a[h.origin]:void 0})},u.fromCBOR=t=>{const e=d(t);return u.fromDataItem(e)};const{RegistryTypes:g,decodeToDataItem:I}=e.extend;var m;!function(t){t[t.requestId=1]="requestId",t[t.signature=2]="signature"}(m||(m={}));class p extends e.RegistryItem{constructor(t,a){super(),this.getRegistryType=()=>n.ETH_SIGNATAURE,this.getRequestId=()=>this.requestId,this.getSignature=()=>this.signature,this.toDataItem=()=>{const t={};return this.requestId&&(t[m.requestId]=new e.DataItem(this.requestId,g.UUID.getTag())),t[m.signature]=this.signature,new e.DataItem(t)},this.signature=t,this.requestId=a}}p.fromDataItem=t=>{const e=t.getData(),a=e[m.signature],s=e[m.requestId]?e[m.requestId].getData():void 0;return new p(a,s)},p.fromCBOR=t=>{const e=I(t);return p.fromDataItem(e)};const{decodeToDataItem:D}=e.extend;var T;!function(t){t[t.chainId=1]="chainId",t[t.contractAddress=2]="contractAddress",t[t.name=3]="name",t[t.mediaData=4]="mediaData"}(T||(T={}));class y extends e.RegistryItem{constructor(t){super(),this.getRegistryType=()=>n.ETH_NFT_ITEM,this.setupData=t=>{this.chainId=t.chainId,this.name=t.name,this.contractAddress=t.contractAddress,this.mediaData=t.mediaData},this.getChainId=()=>this.chainId,this.getName=()=>this.name,this.getmediaData=()=>this.mediaData,this.getContractAddress=()=>this.contractAddress,this.toDataItem=()=>{const t={};return t[T.chainId]=this.chainId,t[T.name]=this.name,t[T.contractAddress]=this.contractAddress,t[T.mediaData]=this.mediaData,new e.DataItem(t)},this.setupData(t)}static constructETHNFTItem(t,e,a,s){return new y({chainId:t,contractAddress:e,mediaData:s,name:a})}}y.fromDataItem=t=>{const e=t.getData();return new y({chainId:e[T.chainId],name:e[T.name],contractAddress:e[T.contractAddress],mediaData:e[T.mediaData]})},y.fromCBOR=t=>{const e=D(t);return y.fromDataItem(e)};const f=(t,e)=>{const a=s.fromExtendedKey(t).derive(e),r="0x"+i.publicToAddress(a.publicKey,!0).toString("hex");return i.toChecksumAddress(r)},{cbor:q}=e.extend;q.patchTags(Object.values(n).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=y,exports.ETHSignature=p,exports.EthSignRequest=u,exports.findHDpatfromAddress=(t,e,a,s)=>{for(let i=0;i<a;i++){const a=f(e,"M/0/"+i);if(t.toLowerCase()==a.toLowerCase())return`${s}/0/${i}`}return null},exports.generateAddressfromXpub=f;
//# sourceMappingURL=bc-ur-registry-eth.cjs.production.min.js.map

@@ -12,3 +12,4 @@ import { extend, RegistryItem, DataItem, CryptoKeypath, PathComponent } from '@keystonehq/bc-ur-registry';

ETH_SIGN_REQUEST: /*#__PURE__*/new RegistryType('eth-sign-request', 401),
ETH_SIGNATAURE: /*#__PURE__*/new RegistryType('eth-signature', 402)
ETH_SIGNATAURE: /*#__PURE__*/new RegistryType('eth-signature', 402),
ETH_NFT_ITEM: /*#__PURE__*/new RegistryType('eth-nft-item', 403)
};

@@ -204,2 +205,81 @@

const {
decodeToDataItem: decodeToDataItem$2
} = extend;
var Keys$2;
(function (Keys) {
Keys[Keys["chainId"] = 1] = "chainId";
Keys[Keys["contractAddress"] = 2] = "contractAddress";
Keys[Keys["name"] = 3] = "name";
Keys[Keys["mediaData"] = 4] = "mediaData";
})(Keys$2 || (Keys$2 = {})); // export enum mediaType {
// png = 1,
// jpeg = 2,
// }
class ETHNFTItem extends RegistryItem {
constructor(args) {
super();
this.getRegistryType = () => ExtendedRegistryTypes.ETH_NFT_ITEM;
this.setupData = args => {
this.chainId = args.chainId;
this.name = args.name;
this.contractAddress = args.contractAddress;
this.mediaData = args.mediaData; // remove the data perfix for android usage
};
this.getChainId = () => this.chainId;
this.getName = () => this.name;
this.getmediaData = () => this.mediaData;
this.getContractAddress = () => this.contractAddress;
this.toDataItem = () => {
const map = {};
map[Keys$2.chainId] = this.chainId;
map[Keys$2.name] = this.name;
map[Keys$2.contractAddress] = this.contractAddress;
map[Keys$2.mediaData] = this.mediaData;
return new DataItem(map);
};
this.setupData(args);
}
static constructETHNFTItem(chainId, contractAddress, name, mediaData) {
return new ETHNFTItem({
chainId,
contractAddress,
mediaData,
name
});
}
}
ETHNFTItem.fromDataItem = dataItem => {
const map = dataItem.getData();
const chainId = map[Keys$2.chainId];
const name = map[Keys$2.name];
const mediaData = map[Keys$2.mediaData];
const contractAddress = map[Keys$2.contractAddress];
return new ETHNFTItem({
chainId,
name,
contractAddress,
mediaData
});
};
ETHNFTItem.fromCBOR = _cborPayload => {
const dataItem = decodeToDataItem$2(_cborPayload);
return ETHNFTItem.fromDataItem(dataItem);
};
// @ts-ignore

@@ -231,3 +311,3 @@ const generateAddressfromXpub = (xpub, derivePath) => {

export { DataType, ETHSignature, EthSignRequest, findHDpatfromAddress, generateAddressfromXpub };
export { DataType, ETHNFTItem, ETHSignature, EthSignRequest, findHDpatfromAddress, generateAddressfromXpub };
//# sourceMappingURL=bc-ur-registry-eth.esm.js.map
export * from '@keystonehq/bc-ur-registry';
export { EthSignRequest, DataType } from './EthSignRequest';
export { ETHSignature } from './EthSignature';
export { ETHNFTItem } from './ETHNFTItem';
export { generateAddressfromXpub, findHDpatfromAddress } from './utlis';
export declare const ExtendedRegistryTypes: {
ETH_SIGN_REQUEST: import("@keystonehq/bc-ur-registry/src/RegistryType").RegistryType;
ETH_SIGNATAURE: import("@keystonehq/bc-ur-registry/src/RegistryType").RegistryType;
ETH_NFT_ITEM: import("@keystonehq/bc-ur-registry/src/RegistryType").RegistryType;
};
{
"name": "@keystonehq/bc-ur-registry-eth",
"version": "0.7.6",
"version": "0.7.7-alpha.0",
"description": "bc-ur-registry extension for ETH",

@@ -37,3 +37,3 @@ "main": "dist/index.js",

},
"gitHead": "0bdc1e97dfce98cabaa7542f4bc18d50d34d69cb"
"gitHead": "2c2dacb28325054e81d673d033bf754e8e8170ad"
}

@@ -13,3 +13,4 @@ export * from '@keystonehq/bc-ur-registry';

export { ETHSignature } from './EthSignature';
export { ETHNFTItem } from './ETHNFTItem';
export { generateAddressfromXpub, findHDpatfromAddress } from './utlis';

@@ -7,2 +7,3 @@ import { extend } from '@keystonehq/bc-ur-registry';

ETH_SIGNATAURE: new RegistryType('eth-signature', 402),
ETH_NFT_ITEM: new RegistryType('eth-nft-item', 403)
};

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc