@solana/keys
Advanced tools
Comparing version 0.0.0-experimental.1 to 2.0.0-experimental.2989216
@@ -6,3 +6,7 @@ import bs58 from 'bs58'; | ||
try { | ||
if (putativeBase58EncodedAddress.length < 32 || putativeBase58EncodedAddress.length > 44) { | ||
if ( | ||
// Lowest address (32 bytes of zeroes) | ||
putativeBase58EncodedAddress.length < 32 || // Highest address (32 bytes of 255) | ||
putativeBase58EncodedAddress.length > 44 | ||
) { | ||
throw new Error("Expected input string to decode to a byte array of length 32."); | ||
@@ -21,5 +25,15 @@ } | ||
} | ||
function getBase58EncodedAddressComparator() { | ||
return new Intl.Collator("en", { | ||
caseFirst: "lower", | ||
ignorePunctuation: false, | ||
localeMatcher: "best fit", | ||
numeric: false, | ||
sensitivity: "variant", | ||
usage: "sort" | ||
}).compare; | ||
} | ||
export { assertIsBase58EncodedAddress }; | ||
export { assertIsBase58EncodedAddress, getBase58EncodedAddressComparator }; | ||
//# sourceMappingURL=out.js.map | ||
//# sourceMappingURL=index.browser.js.map |
@@ -26,2 +26,6 @@ this.globalThis = this.globalThis || {}; | ||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
// If the importer is in node compatibility mode or this is not an ESM | ||
// file that has been converted to a CommonJS file using a Babel- | ||
// compatible transform (i.e. "__esModule" has not been set), then set | ||
// "default" to the CommonJS "module.exports" for node compatibility. | ||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
@@ -186,3 +190,7 @@ mod | ||
try { | ||
if (putativeBase58EncodedAddress.length < 32 || putativeBase58EncodedAddress.length > 44) { | ||
if ( | ||
// Lowest address (32 bytes of zeroes) | ||
putativeBase58EncodedAddress.length < 32 || // Highest address (32 bytes of 255) | ||
putativeBase58EncodedAddress.length > 44 | ||
) { | ||
throw new Error("Expected input string to decode to a byte array of length 32."); | ||
@@ -201,4 +209,15 @@ } | ||
} | ||
function getBase58EncodedAddressComparator() { | ||
return new Intl.Collator("en", { | ||
caseFirst: "lower", | ||
ignorePunctuation: false, | ||
localeMatcher: "best fit", | ||
numeric: false, | ||
sensitivity: "variant", | ||
usage: "sort" | ||
}).compare; | ||
} | ||
exports.assertIsBase58EncodedAddress = assertIsBase58EncodedAddress; | ||
exports.getBase58EncodedAddressComparator = getBase58EncodedAddressComparator; | ||
@@ -205,0 +224,0 @@ return exports; |
@@ -6,3 +6,7 @@ import bs58 from 'bs58'; | ||
try { | ||
if (putativeBase58EncodedAddress.length < 32 || putativeBase58EncodedAddress.length > 44) { | ||
if ( | ||
// Lowest address (32 bytes of zeroes) | ||
putativeBase58EncodedAddress.length < 32 || // Highest address (32 bytes of 255) | ||
putativeBase58EncodedAddress.length > 44 | ||
) { | ||
throw new Error("Expected input string to decode to a byte array of length 32."); | ||
@@ -21,5 +25,15 @@ } | ||
} | ||
function getBase58EncodedAddressComparator() { | ||
return new Intl.Collator("en", { | ||
caseFirst: "lower", | ||
ignorePunctuation: false, | ||
localeMatcher: "best fit", | ||
numeric: false, | ||
sensitivity: "variant", | ||
usage: "sort" | ||
}).compare; | ||
} | ||
export { assertIsBase58EncodedAddress }; | ||
export { assertIsBase58EncodedAddress, getBase58EncodedAddressComparator }; | ||
//# sourceMappingURL=out.js.map | ||
//# sourceMappingURL=index.native.js.map |
@@ -6,3 +6,7 @@ import bs58 from 'bs58'; | ||
try { | ||
if (putativeBase58EncodedAddress.length < 32 || putativeBase58EncodedAddress.length > 44) { | ||
if ( | ||
// Lowest address (32 bytes of zeroes) | ||
putativeBase58EncodedAddress.length < 32 || // Highest address (32 bytes of 255) | ||
putativeBase58EncodedAddress.length > 44 | ||
) { | ||
throw new Error("Expected input string to decode to a byte array of length 32."); | ||
@@ -21,5 +25,15 @@ } | ||
} | ||
function getBase58EncodedAddressComparator() { | ||
return new Intl.Collator("en", { | ||
caseFirst: "lower", | ||
ignorePunctuation: false, | ||
localeMatcher: "best fit", | ||
numeric: false, | ||
sensitivity: "variant", | ||
usage: "sort" | ||
}).compare; | ||
} | ||
export { assertIsBase58EncodedAddress }; | ||
export { assertIsBase58EncodedAddress, getBase58EncodedAddressComparator }; | ||
//# sourceMappingURL=out.js.map | ||
//# sourceMappingURL=index.node.js.map |
@@ -5,5 +5,6 @@ this.globalThis = this.globalThis || {}; | ||
var V=Object.create;var m=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var F=Object.getOwnPropertyNames;var T=Object.getPrototypeOf,B=Object.prototype.hasOwnProperty;var $=(e,r)=>()=>(e&&(r=e(e=0)),r);var z=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports);var k=(e,r,n,p)=>{if(r&&typeof r=="object"||typeof r=="function")for(let v of F(r))!B.call(e,v)&&v!==n&&m(e,v,{get:()=>r[v],enumerable:!(p=q(r,v))||p.enumerable});return e};var G=(e,r,n)=>(n=e!=null?V(T(e)):{},k(r||!e||!e.__esModule?m(n,"default",{value:e,enumerable:!0}):n,e));var l=$(()=>{});var u=z((X,_)=>{l();function I(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var p=0;p<e.length;p++){var v=e.charAt(p),c=v.charCodeAt(0);if(r[c]!==255)throw new TypeError(v+" is ambiguous");r[c]=p;}var b=e.length,U=e.charAt(0),D=Math.log(b)/Math.log(256),O=Math.log(256)/Math.log(b);function R(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(t.length===0)return "";for(var a=0,y=0,i=0,f=t.length;i!==f&&t[i]===0;)i++,a++;for(var s=(f-i)*O+1>>>0,o=new Uint8Array(s);i!==f;){for(var d=t[i],g=0,h=s-1;(d!==0||g<y)&&h!==-1;h--,g++)d+=256*o[h]>>>0,o[h]=d%b>>>0,d=d/b>>>0;if(d!==0)throw new Error("Non-zero carry");y=g,i++;}for(var w=s-y;w!==s&&o[w]===0;)w++;for(var A=U.repeat(a);w<s;++w)A+=e.charAt(o[w]);return A}function x(t){if(typeof t!="string")throw new TypeError("Expected String");if(t.length===0)return new Uint8Array;for(var a=0,y=0,i=0;t[a]===U;)y++,a++;for(var f=(t.length-a)*D+1>>>0,s=new Uint8Array(f);t[a];){var o=r[t.charCodeAt(a)];if(o===255)return;for(var d=0,g=f-1;(o!==0||d<i)&&g!==-1;g--,d++)o+=b*s[g]>>>0,s[g]=o%256>>>0,o=o/256>>>0;if(o!==0)throw new Error("Non-zero carry");i=d,a++;}for(var h=f-i;h!==f&&s[h]===0;)h++;for(var w=new Uint8Array(y+(f-h)),A=y;h!==f;)w[A++]=s[h++];return w}function S(t){var a=x(t);if(a)return a;throw new Error("Non-base"+b+" character")}return {encode:R,decodeUnsafe:x,decode:S}}_.exports=I;});var N=z((Z,M)=>{l();var J=u(),K="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";M.exports=J(K);});l();l();var C=G(N(),1);function L(e){try{if(e.length<32||e.length>44)throw new Error("Expected input string to decode to a byte array of length 32.");let n=C.default.decode(e).byteLength;if(n!==32)throw new Error(`Expected input string to decode to a byte array of length 32. Actual length: ${n}`)}catch(r){throw new Error(`\`${e}\` is not a base-58 encoded address`,{cause:r})}} | ||
var O=Object.create;var x=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var V=Object.getPrototypeOf,q=Object.prototype.hasOwnProperty;var I=(e,r)=>()=>(e&&(r=e(e=0)),r);var U=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports);var $=(e,r,n,p)=>{if(r&&typeof r=="object"||typeof r=="function")for(let v of S(r))!q.call(e,v)&&v!==n&&x(e,v,{get:()=>r[v],enumerable:!(p=R(r,v))||p.enumerable});return e};var k=(e,r,n)=>(n=e!=null?O(V(e)):{},$(r||!e||!e.__esModule?x(n,"default",{value:e,enumerable:!0}):n,e));var g=I(()=>{});var _=U((X,z)=>{g();function G(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var p=0;p<e.length;p++){var v=e.charAt(p),E=v.charCodeAt(0);if(r[E]!==255)throw new TypeError(v+" is ambiguous");r[E]=p;}var A=e.length,u=e.charAt(0),T=Math.log(A)/Math.log(256),B=Math.log(256)/Math.log(A);function D(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(t.length===0)return "";for(var a=0,y=0,s=0,d=t.length;s!==d&&t[s]===0;)s++,a++;for(var f=(d-s)*B+1>>>0,o=new Uint8Array(f);s!==d;){for(var h=t[s],w=0,i=f-1;(h!==0||w<y)&&i!==-1;i--,w++)h+=256*o[i]>>>0,o[i]=h%A>>>0,h=h/A>>>0;if(h!==0)throw new Error("Non-zero carry");y=w,s++;}for(var l=f-y;l!==f&&o[l]===0;)l++;for(var b=u.repeat(a);l<f;++l)b+=e.charAt(o[l]);return b}function m(t){if(typeof t!="string")throw new TypeError("Expected String");if(t.length===0)return new Uint8Array;for(var a=0,y=0,s=0;t[a]===u;)y++,a++;for(var d=(t.length-a)*T+1>>>0,f=new Uint8Array(d);t[a];){var o=r[t.charCodeAt(a)];if(o===255)return;for(var h=0,w=d-1;(o!==0||h<s)&&w!==-1;w--,h++)o+=A*f[w]>>>0,f[w]=o%256>>>0,o=o/256>>>0;if(o!==0)throw new Error("Non-zero carry");s=h,a++;}for(var i=d-s;i!==d&&f[i]===0;)i++;for(var l=new Uint8Array(y+(d-i)),b=y;i!==d;)l[b++]=f[i++];return l}function F(t){var a=m(t);if(a)return a;throw new Error("Non-base"+A+" character")}return {encode:D,decodeUnsafe:m,decode:F}}z.exports=G;});var M=U((Z,C)=>{g();var J=_(),K="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";C.exports=J(K);});g();g();var N=k(M(),1);function L(e){try{if(e.length<32||e.length>44)throw new Error("Expected input string to decode to a byte array of length 32.");let n=N.default.decode(e).byteLength;if(n!==32)throw new Error(`Expected input string to decode to a byte array of length 32. Actual length: ${n}`)}catch(r){throw new Error(`\`${e}\` is not a base-58 encoded address`,{cause:r})}}function P(){return new Intl.Collator("en",{caseFirst:"lower",ignorePunctuation:!1,localeMatcher:"best fit",numeric:!1,sensitivity:"variant",usage:"sort"}).compare} | ||
exports.assertIsBase58EncodedAddress = L; | ||
exports.getBase58EncodedAddressComparator = P; | ||
@@ -10,0 +11,0 @@ return exports; |
@@ -1,5 +0,6 @@ | ||
export type Base58EncodedAddress = string & { | ||
export type Base58EncodedAddress<TAddress extends string = string> = TAddress & { | ||
readonly __base58EncodedAddress: unique symbol; | ||
}; | ||
export declare function assertIsBase58EncodedAddress(putativeBase58EncodedAddress: string): asserts putativeBase58EncodedAddress is Base58EncodedAddress; | ||
export declare function assertIsBase58EncodedAddress(putativeBase58EncodedAddress: string): asserts putativeBase58EncodedAddress is Base58EncodedAddress<typeof putativeBase58EncodedAddress>; | ||
export declare function getBase58EncodedAddressComparator(): (x: string, y: string) => number; | ||
//# sourceMappingURL=base58.d.ts.map |
{ | ||
"name": "@solana/keys", | ||
"version": "0.0.0-experimental.1", | ||
"version": "2.0.0-experimental.2989216", | ||
"description": "Helpers for generating and transforming key material", | ||
@@ -49,10 +49,10 @@ "exports": { | ||
"devDependencies": { | ||
"@solana/eslint-config-solana": "^0.0.4", | ||
"@solana/eslint-config-solana": "^1.0.1", | ||
"@swc/core": "^1.3.18", | ||
"@swc/jest": "^0.2.23", | ||
"@types/jest": "^29.5.0", | ||
"@typescript-eslint/eslint-plugin": "^5.43.0", | ||
"@typescript-eslint/parser": "^5.43.0", | ||
"agadoo": "^2.0.0", | ||
"eslint": "^8.27.0", | ||
"@swc/jest": "^0.2.26", | ||
"@types/jest": "^29.5.1", | ||
"@typescript-eslint/eslint-plugin": "^5.57.1", | ||
"@typescript-eslint/parser": "^5.57.1", | ||
"agadoo": "^3.0.0", | ||
"eslint": "^8.37.0", | ||
"eslint-plugin-jest": "^27.1.5", | ||
@@ -63,10 +63,10 @@ "eslint-plugin-react-hooks": "^4.6.0", | ||
"jest-environment-jsdom": "^29.5.0", | ||
"jest-runner-eslint": "^1.1.0", | ||
"jest-runner-eslint": "^2.1.0", | ||
"jest-runner-prettier": "^1.0.0", | ||
"postcss": "^8.4.12", | ||
"prettier": "^2.7.1", | ||
"prettier": "^2.8.8", | ||
"ts-node": "^10.9.1", | ||
"tsup": "6.5.0", | ||
"turbo": "^1.6.3", | ||
"typescript": "^4.9", | ||
"tsup": "6.7.0", | ||
"typescript": "^5.0.4", | ||
"version-from-git": "^1.1.1", | ||
"build-scripts": "0.0.0", | ||
@@ -91,2 +91,3 @@ "test-config": "0.0.0", | ||
"dev": "jest -c node_modules/test-config/jest-dev.config.ts --rootDir . --watch", | ||
"publish-packages": "pnpm publish --tag experimental --access public --no-git-checks", | ||
"test:lint": "jest -c node_modules/test-config/jest-lint.config.ts --rootDir . --silent", | ||
@@ -93,0 +94,0 @@ "test:prettier": "jest -c node_modules/test-config/jest-prettier.config.ts --rootDir . --silent", |
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
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
48347
21
455
0
0
53