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

@mcintyre94/compat

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mcintyre94/compat - npm Package Compare versions

Comparing version 2.0.0-experimental.a537d8d to 2.0.0-experimental.e807d29

62

dist/index.browser.js

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

import { createPrivateKeyFromBytes } from '@mcintyre94/keys';
import { pipe } from '@mcintyre94/functional';

@@ -9,62 +10,7 @@ import { AccountRole } from '@mcintyre94/instructions';

}
// src/keypair.ts
function addPkcs8Header(bytes) {
return new Uint8Array([
/**
* PKCS#8 header
*/
48,
// ASN.1 sequence tag
46,
// Length of sequence (46 more bytes)
2,
// ASN.1 integer tag
1,
// Length of integer
0,
// Version number
48,
// ASN.1 sequence tag
5,
// Length of sequence
6,
// ASN.1 object identifier tag
3,
// Length of object identifier
// Edwards curve algorithms identifier https://oid-rep.orange-labs.fr/get/1.3.101.112
43,
// iso(1) / identified-organization(3) (The first node is multiplied by the decimal 40 and the result is added to the value of the second node)
101,
// thawte(101)
// Ed25519 identifier
112,
// id-Ed25519(112)
/**
* Private key payload
*/
4,
// ASN.1 octet string tag
34,
// String length (34 more bytes)
// Private key bytes as octet string
4,
// ASN.1 octet string tag
32,
// String length (32 bytes)
...bytes
]);
}
async function fromLegacyKeypair(keypair, extractable) {
const publicKey = await crypto.subtle.importKey("raw", keypair.publicKey.toBytes(), "Ed25519", true, [
"verify"
const [publicKey, privateKey] = await Promise.all([
crypto.subtle.importKey("raw", keypair.publicKey.toBytes(), "Ed25519", true, ["verify"]),
createPrivateKeyFromBytes(keypair.secretKey.slice(0, 32), extractable)
]);
const privateKeyBytesPkcs8 = addPkcs8Header(keypair.secretKey.slice(0, 32));
const privateKey = await crypto.subtle.importKey(
"pkcs8",
privateKeyBytesPkcs8,
"Ed25519",
extractable ?? false,
["sign"]
);
return {

@@ -71,0 +17,0 @@ privateKey,

108

dist/index.development.js

@@ -10,3 +10,45 @@ this.globalThis = this.globalThis || {};

// src/keypair.ts
// ../codecs-strings/dist/index.browser.js
function assertValidBaseString(alphabet4, testValue, givenValue = testValue) {
if (!testValue.match(new RegExp(`^[${alphabet4}]*$`))) {
throw new Error(`Expected a string of base ${alphabet4.length}, got [${givenValue}].`);
}
}
var getBaseXEncoder = (alphabet4) => {
const base = alphabet4.length;
const baseBigInt = BigInt(base);
return {
description: `base${base}`,
encode(value) {
assertValidBaseString(alphabet4, value);
if (value === "")
return new Uint8Array();
const chars = [...value];
let trailIndex = chars.findIndex((c) => c !== alphabet4[0]);
trailIndex = trailIndex === -1 ? chars.length : trailIndex;
const leadingZeroes = Array(trailIndex).fill(0);
if (trailIndex === chars.length)
return Uint8Array.from(leadingZeroes);
const tailChars = chars.slice(trailIndex);
let base10Number = 0n;
let baseXPower = 1n;
for (let i = tailChars.length - 1; i >= 0; i -= 1) {
base10Number += baseXPower * BigInt(alphabet4.indexOf(tailChars[i]));
baseXPower *= baseBigInt;
}
const tailBytes = [];
while (base10Number > 0n) {
tailBytes.unshift(Number(base10Number % 256n));
base10Number /= 256n;
}
return Uint8Array.from(leadingZeroes.concat(tailBytes));
},
fixedSize: null,
maxSize: null
};
};
var alphabet2 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
var getBase58Encoder = () => getBaseXEncoder(alphabet2);
// ../keys/dist/index.browser.js
function addPkcs8Header(bytes) {

@@ -58,14 +100,16 @@ return new Uint8Array([

}
async function createPrivateKeyFromBytes(bytes, extractable) {
if (bytes.byteLength !== 32) {
throw new Error("Private key bytes must be of length 32");
}
const privateKeyBytesPkcs8 = addPkcs8Header(bytes);
return await crypto.subtle.importKey("pkcs8", privateKeyBytesPkcs8, "Ed25519", extractable != null ? extractable : false, ["sign"]);
}
// src/keypair.ts
async function fromLegacyKeypair(keypair, extractable) {
const publicKey = await crypto.subtle.importKey("raw", keypair.publicKey.toBytes(), "Ed25519", true, [
"verify"
const [publicKey, privateKey] = await Promise.all([
crypto.subtle.importKey("raw", keypair.publicKey.toBytes(), "Ed25519", true, ["verify"]),
createPrivateKeyFromBytes(keypair.secretKey.slice(0, 32), extractable)
]);
const privateKeyBytesPkcs8 = addPkcs8Header(keypair.secretKey.slice(0, 32));
const privateKey = await crypto.subtle.importKey(
"pkcs8",
privateKeyBytesPkcs8,
"Ed25519",
extractable != null ? extractable : false,
["sign"]
);
return {

@@ -77,44 +121,2 @@ privateKey,

// ../codecs-strings/dist/index.browser.js
function assertValidBaseString(alphabet4, testValue, givenValue = testValue) {
if (!testValue.match(new RegExp(`^[${alphabet4}]*$`))) {
throw new Error(`Expected a string of base ${alphabet4.length}, got [${givenValue}].`);
}
}
var getBaseXEncoder = (alphabet4) => {
const base = alphabet4.length;
const baseBigInt = BigInt(base);
return {
description: `base${base}`,
encode(value) {
assertValidBaseString(alphabet4, value);
if (value === "")
return new Uint8Array();
const chars = [...value];
let trailIndex = chars.findIndex((c) => c !== alphabet4[0]);
trailIndex = trailIndex === -1 ? chars.length : trailIndex;
const leadingZeroes = Array(trailIndex).fill(0);
if (trailIndex === chars.length)
return Uint8Array.from(leadingZeroes);
const tailChars = chars.slice(trailIndex);
let base10Number = 0n;
let baseXPower = 1n;
for (let i = tailChars.length - 1; i >= 0; i -= 1) {
base10Number += baseXPower * BigInt(alphabet4.indexOf(tailChars[i]));
baseXPower *= baseBigInt;
}
const tailBytes = [];
while (base10Number > 0n) {
tailBytes.unshift(Number(base10Number % 256n));
base10Number /= 256n;
}
return Uint8Array.from(leadingZeroes.concat(tailBytes));
},
fixedSize: null,
maxSize: null
};
};
var alphabet2 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
var getBase58Encoder = () => getBaseXEncoder(alphabet2);
// ../addresses/dist/index.browser.js

@@ -121,0 +123,0 @@ var memoizedBase58Encoder;

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

import { createPrivateKeyFromBytes } from '@mcintyre94/keys';
import { pipe } from '@mcintyre94/functional';

@@ -9,62 +10,7 @@ import { AccountRole } from '@mcintyre94/instructions';

}
// src/keypair.ts
function addPkcs8Header(bytes) {
return new Uint8Array([
/**
* PKCS#8 header
*/
48,
// ASN.1 sequence tag
46,
// Length of sequence (46 more bytes)
2,
// ASN.1 integer tag
1,
// Length of integer
0,
// Version number
48,
// ASN.1 sequence tag
5,
// Length of sequence
6,
// ASN.1 object identifier tag
3,
// Length of object identifier
// Edwards curve algorithms identifier https://oid-rep.orange-labs.fr/get/1.3.101.112
43,
// iso(1) / identified-organization(3) (The first node is multiplied by the decimal 40 and the result is added to the value of the second node)
101,
// thawte(101)
// Ed25519 identifier
112,
// id-Ed25519(112)
/**
* Private key payload
*/
4,
// ASN.1 octet string tag
34,
// String length (34 more bytes)
// Private key bytes as octet string
4,
// ASN.1 octet string tag
32,
// String length (32 bytes)
...bytes
]);
}
async function fromLegacyKeypair(keypair, extractable) {
const publicKey = await crypto.subtle.importKey("raw", keypair.publicKey.toBytes(), "Ed25519", true, [
"verify"
const [publicKey, privateKey] = await Promise.all([
crypto.subtle.importKey("raw", keypair.publicKey.toBytes(), "Ed25519", true, ["verify"]),
createPrivateKeyFromBytes(keypair.secretKey.slice(0, 32), extractable)
]);
const privateKeyBytesPkcs8 = addPkcs8Header(keypair.secretKey.slice(0, 32));
const privateKey = await crypto.subtle.importKey(
"pkcs8",
privateKeyBytesPkcs8,
"Ed25519",
extractable ?? false,
["sign"]
);
return {

@@ -71,0 +17,0 @@ privateKey,

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

import { createPrivateKeyFromBytes } from '@mcintyre94/keys';
import { pipe } from '@mcintyre94/functional';

@@ -9,62 +10,7 @@ import { AccountRole } from '@mcintyre94/instructions';

}
// src/keypair.ts
function addPkcs8Header(bytes) {
return new Uint8Array([
/**
* PKCS#8 header
*/
48,
// ASN.1 sequence tag
46,
// Length of sequence (46 more bytes)
2,
// ASN.1 integer tag
1,
// Length of integer
0,
// Version number
48,
// ASN.1 sequence tag
5,
// Length of sequence
6,
// ASN.1 object identifier tag
3,
// Length of object identifier
// Edwards curve algorithms identifier https://oid-rep.orange-labs.fr/get/1.3.101.112
43,
// iso(1) / identified-organization(3) (The first node is multiplied by the decimal 40 and the result is added to the value of the second node)
101,
// thawte(101)
// Ed25519 identifier
112,
// id-Ed25519(112)
/**
* Private key payload
*/
4,
// ASN.1 octet string tag
34,
// String length (34 more bytes)
// Private key bytes as octet string
4,
// ASN.1 octet string tag
32,
// String length (32 bytes)
...bytes
]);
}
async function fromLegacyKeypair(keypair, extractable) {
const publicKey = await crypto.subtle.importKey("raw", keypair.publicKey.toBytes(), "Ed25519", true, [
"verify"
const [publicKey, privateKey] = await Promise.all([
crypto.subtle.importKey("raw", keypair.publicKey.toBytes(), "Ed25519", true, ["verify"]),
createPrivateKeyFromBytes(keypair.secretKey.slice(0, 32), extractable)
]);
const privateKeyBytesPkcs8 = addPkcs8Header(keypair.secretKey.slice(0, 32));
const privateKey = await crypto.subtle.importKey(
"pkcs8",
privateKeyBytesPkcs8,
"Ed25519",
extractable ?? false,
["sign"]
);
return {

@@ -71,0 +17,0 @@ privateKey,

@@ -5,8 +5,8 @@ this.globalThis = this.globalThis || {};

function $(e){return e.toBase58()}function k(e){return new Uint8Array([48,46,2,1,0,48,5,6,3,43,101,112,4,34,4,32,...e])}async function F(e,n){let r=await crypto.subtle.importKey("raw",e.publicKey.toBytes(),"Ed25519",!0,["verify"]),t=k(e.secretKey.slice(0,32));return {privateKey:await crypto.subtle.importKey("pkcs8",t,"Ed25519",n!=null?n:!1,["sign"]),publicKey:r}}function z(e,n,r=n){if(!n.match(new RegExp(`^[${e}]*$`)))throw new Error(`Expected a string of base ${e.length}, got [${r}].`)}var N=e=>{let n=e.length,r=BigInt(n);return {description:`base${n}`,encode(t){if(z(e,t),t==="")return new Uint8Array;let o=[...t],s=o.findIndex(f=>f!==e[0]);s=s===-1?o.length:s;let a=Array(s).fill(0);if(s===o.length)return Uint8Array.from(a);let i=o.slice(s),c=0n,u=1n;for(let f=i.length-1;f>=0;f-=1)c+=u*BigInt(e.indexOf(i[f])),u*=r;let p=[];for(;c>0n;)p.unshift(Number(c%256n)),c/=256n;return Uint8Array.from(a.concat(p))},fixedSize:null,maxSize:null}};var C="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",I=()=>N(C);var A;function _(){return A||(A=I()),A}function b(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 t=_().encode(e).byteLength;if(t!==32)throw new Error(`Expected input string to decode to a byte array of length 32. Actual length: ${t}`)}catch(n){throw new Error(`\`${e}\` is not a base-58 encoded address`,{cause:n})}}function y(e,...n){return n.reduce((r,t)=>t(r),e)}var l=(e=>(e[e.WRITABLE_SIGNER=3]="WRITABLE_SIGNER",e[e.READONLY_SIGNER=2]="READONLY_SIGNER",e[e.WRITABLE=1]="WRITABLE",e[e.READONLY=0]="READONLY",e))(l||{});function m(e){if("signatures"in e){let{signatures:n,...r}=e;return r}else return e}function v(e,n){if("lifetimeConstraint"in n&&n.lifetimeConstraint.blockhash===e.blockhash&&n.lifetimeConstraint.lastValidBlockHeight===e.lastValidBlockHeight)return n;let r={...m(n),lifetimeConstraint:e};return Object.freeze(r),r}function E({version:e}){let n={instructions:[],version:e};return Object.freeze(n),n}var g=(e=>(e[e.WRITABLE_SIGNER=3]="WRITABLE_SIGNER",e[e.READONLY_SIGNER=2]="READONLY_SIGNER",e[e.WRITABLE=1]="WRITABLE",e[e.READONLY=0]="READONLY",e))(g||{});function P(e){return e>=2}var x="SysvarRecentB1ockHashes11111111111111111111",D="11111111111111111111111111111111";function S(e,n){return {accounts:[{address:e,role:g.WRITABLE},{address:x,role:g.READONLY},{address:n,role:g.READONLY_SIGNER}],data:new Uint8Array([4,0,0,0]),programAddress:D}}function h(e){var n;return e.programAddress===D&&e.data!=null&&M(e.data)&&((n=e.accounts)==null?void 0:n.length)===3&&e.accounts[0].address!=null&&e.accounts[0].role===g.WRITABLE&&e.accounts[1].address===x&&e.accounts[1].role===g.READONLY&&e.accounts[2].address!=null&&P(e.accounts[2].role)}function M(e){return e.byteLength===4&&e[0]===4&&e[1]===0&&e[2]===0&&e[3]===0}function K(e){return "lifetimeConstraint"in e&&typeof e.lifetimeConstraint.nonce=="string"&&e.instructions[0]!=null&&h(e.instructions[0])}function U(e,n,r){return e.accounts[0].address===n&&e.accounts[2].address===r}function B({nonce:e,nonceAccountAddress:n,nonceAuthorityAddress:r},t){let o,s=t.instructions[0];if(s&&h(s))if(U(s,n,r)){if(K(t)&&t.lifetimeConstraint.nonce===e)return t;o=[s,...t.instructions.slice(1)];}else o=[S(n,r),...t.instructions.slice(1)];else o=[S(n,r),...t.instructions];let a={...m(t),instructions:o,lifetimeConstraint:{nonce:e}};return Object.freeze(a),a}function w(e,n){if("feePayer"in n&&e===n.feePayer)return n;let r={...m(n),feePayer:e};return Object.freeze(r),r}function T(e,n){let r={...m(n),instructions:[...n.instructions,e]};return Object.freeze(r),r}function O(e,n,r){let t=n.get(r);if(!t)throw new Error(`Could not find account address at index ${r}`);let o=e.isAccountSigner(r),s=e.isAccountWritable(r),a=o?s?l.WRITABLE_SIGNER:l.READONLY_SIGNER:s?l.WRITABLE:l.READONLY;return {address:t.toBase58(),role:a}}function R(e,n,r){let t=n.get(r.programIdIndex);if(!t)throw new Error(`Could not find program address at index ${r.programIdIndex}`);let o=r.accountKeyIndexes.map(s=>O(e,n,s));return {programAddress:t.toBase58(),...o.length?{accounts:o}:{},...r.data.length?{data:r.data}:{}}}function L(e,n){return e.signatures.reduce((r,t,o)=>{if(t.every(i=>i===0))return r;let a=n[o].toBase58();return {...r,[a]:t}},{})}function me(e,n){if(e.message.addressTableLookups.length>0)throw new Error("Cannot convert transaction with addressTableLookups");let r=e.message.getAccountKeys(),t=r.staticAccountKeys[0];if(!t)throw new Error("No fee payer set in VersionedTransaction");let o={blockhash:e.message.recentBlockhash,lastValidBlockHeight:n!=null?n:2n**64n-1n},s=e.message.compiledInstructions.map(i=>R(e.message,r,i)),a=L(e,r.staticAccountKeys);return y(E({version:e.version}),i=>w(t.toBase58(),i),i=>v(o,i),i=>s.reduce((c,u)=>T(u,c),i),i=>e.signatures.length?{...i,signatures:a}:i)}function he(e){if(e.message.addressTableLookups.length>0)throw new Error("Cannot convert transaction with addressTableLookups");let n=e.message.getAccountKeys(),r=n.staticAccountKeys[0];if(!r)throw new Error("No fee payer set in VersionedTransaction");let t=e.message.compiledInstructions.map(c=>R(e.message,n,c));if(t.length===0)throw new Error("transaction with no instructions cannot be durable nonce transaction");if(!h(t[0]))throw new Error("transaction first instruction is not advance nonce account instruction");let o=t[0].accounts[0].address;b(o);let s=t[0].accounts[2].address;b(s);let a={nonce:e.message.recentBlockhash,nonceAccountAddress:o,nonceAuthorityAddress:s},i=L(e,n.staticAccountKeys);return y(E({version:e.version}),c=>w(r.toBase58(),c),c=>B(a,c),c=>t.slice(1).reduce((u,p)=>T(p,u),c),c=>e.signatures.length?{...c,signatures:i}:c)}
function F(e){return e.toBase58()}function C(e,n,r=n){if(!n.match(new RegExp(`^[${e}]*$`)))throw new Error(`Expected a string of base ${e.length}, got [${r}].`)}var z=e=>{let n=e.length,r=BigInt(n);return {description:`base${n}`,encode(t){if(C(e,t),t==="")return new Uint8Array;let s=[...t],o=s.findIndex(f=>f!==e[0]);o=o===-1?s.length:o;let a=Array(o).fill(0);if(o===s.length)return Uint8Array.from(a);let i=s.slice(o),c=0n,u=1n;for(let f=i.length-1;f>=0;f-=1)c+=u*BigInt(e.indexOf(i[f])),u*=r;let p=[];for(;c>0n;)p.unshift(Number(c%256n)),c/=256n;return Uint8Array.from(a.concat(p))},fixedSize:null,maxSize:null}};var N="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",I=()=>z(N);function P(e){return new Uint8Array([48,46,2,1,0,48,5,6,3,43,101,112,4,34,4,32,...e])}async function S(e,n){if(e.byteLength!==32)throw new Error("Private key bytes must be of length 32");let r=P(e);return await crypto.subtle.importKey("pkcs8",r,"Ed25519",n!=null?n:!1,["sign"])}async function Q(e,n){let[r,t]=await Promise.all([crypto.subtle.importKey("raw",e.publicKey.toBytes(),"Ed25519",!0,["verify"]),S(e.secretKey.slice(0,32),n)]);return {privateKey:t,publicKey:r}}var b;function _(){return b||(b=I()),b}function y(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 t=_().encode(e).byteLength;if(t!==32)throw new Error(`Expected input string to decode to a byte array of length 32. Actual length: ${t}`)}catch(n){throw new Error(`\`${e}\` is not a base-58 encoded address`,{cause:n})}}function A(e,...n){return n.reduce((r,t)=>t(r),e)}var l=(e=>(e[e.WRITABLE_SIGNER=3]="WRITABLE_SIGNER",e[e.READONLY_SIGNER=2]="READONLY_SIGNER",e[e.WRITABLE=1]="WRITABLE",e[e.READONLY=0]="READONLY",e))(l||{});function m(e){if("signatures"in e){let{signatures:n,...r}=e;return r}else return e}function D(e,n){if("lifetimeConstraint"in n&&n.lifetimeConstraint.blockhash===e.blockhash&&n.lifetimeConstraint.lastValidBlockHeight===e.lastValidBlockHeight)return n;let r={...m(n),lifetimeConstraint:e};return Object.freeze(r),r}function E({version:e}){let n={instructions:[],version:e};return Object.freeze(n),n}var g=(e=>(e[e.WRITABLE_SIGNER=3]="WRITABLE_SIGNER",e[e.READONLY_SIGNER=2]="READONLY_SIGNER",e[e.WRITABLE=1]="WRITABLE",e[e.READONLY=0]="READONLY",e))(g||{});function M(e){return e>=2}var B="SysvarRecentB1ockHashes11111111111111111111",x="11111111111111111111111111111111";function v(e,n){return {accounts:[{address:e,role:g.WRITABLE},{address:B,role:g.READONLY},{address:n,role:g.READONLY_SIGNER}],data:new Uint8Array([4,0,0,0]),programAddress:x}}function h(e){var n;return e.programAddress===x&&e.data!=null&&K(e.data)&&((n=e.accounts)==null?void 0:n.length)===3&&e.accounts[0].address!=null&&e.accounts[0].role===g.WRITABLE&&e.accounts[1].address===B&&e.accounts[1].role===g.READONLY&&e.accounts[2].address!=null&&M(e.accounts[2].role)}function K(e){return e.byteLength===4&&e[0]===4&&e[1]===0&&e[2]===0&&e[3]===0}function U(e){return "lifetimeConstraint"in e&&typeof e.lifetimeConstraint.nonce=="string"&&e.instructions[0]!=null&&h(e.instructions[0])}function O(e,n,r){return e.accounts[0].address===n&&e.accounts[2].address===r}function k({nonce:e,nonceAccountAddress:n,nonceAuthorityAddress:r},t){let s,o=t.instructions[0];if(o&&h(o))if(O(o,n,r)){if(U(t)&&t.lifetimeConstraint.nonce===e)return t;s=[o,...t.instructions.slice(1)];}else s=[v(n,r),...t.instructions.slice(1)];else s=[v(n,r),...t.instructions];let a={...m(t),instructions:s,lifetimeConstraint:{nonce:e}};return Object.freeze(a),a}function w(e,n){if("feePayer"in n&&e===n.feePayer)return n;let r={...m(n),feePayer:e};return Object.freeze(r),r}function T(e,n){let r={...m(n),instructions:[...n.instructions,e]};return Object.freeze(r),r}function W(e,n,r){let t=n.get(r);if(!t)throw new Error(`Could not find account address at index ${r}`);let s=e.isAccountSigner(r),o=e.isAccountWritable(r),a=s?o?l.WRITABLE_SIGNER:l.READONLY_SIGNER:o?l.WRITABLE:l.READONLY;return {address:t.toBase58(),role:a}}function L(e,n,r){let t=n.get(r.programIdIndex);if(!t)throw new Error(`Could not find program address at index ${r.programIdIndex}`);let s=r.accountKeyIndexes.map(o=>W(e,n,o));return {programAddress:t.toBase58(),...s.length?{accounts:s}:{},...r.data.length?{data:r.data}:{}}}function R(e,n){return e.signatures.reduce((r,t,s)=>{if(t.every(i=>i===0))return r;let a=n[s].toBase58();return {...r,[a]:t}},{})}function Ae(e,n){if(e.message.addressTableLookups.length>0)throw new Error("Cannot convert transaction with addressTableLookups");let r=e.message.getAccountKeys(),t=r.staticAccountKeys[0];if(!t)throw new Error("No fee payer set in VersionedTransaction");let s={blockhash:e.message.recentBlockhash,lastValidBlockHeight:n!=null?n:2n**64n-1n},o=e.message.compiledInstructions.map(i=>L(e.message,r,i)),a=R(e,r.staticAccountKeys);return A(E({version:e.version}),i=>w(t.toBase58(),i),i=>D(s,i),i=>o.reduce((c,u)=>T(u,c),i),i=>e.signatures.length?{...i,signatures:a}:i)}function Ee(e){if(e.message.addressTableLookups.length>0)throw new Error("Cannot convert transaction with addressTableLookups");let n=e.message.getAccountKeys(),r=n.staticAccountKeys[0];if(!r)throw new Error("No fee payer set in VersionedTransaction");let t=e.message.compiledInstructions.map(c=>L(e.message,n,c));if(t.length===0)throw new Error("transaction with no instructions cannot be durable nonce transaction");if(!h(t[0]))throw new Error("transaction first instruction is not advance nonce account instruction");let s=t[0].accounts[0].address;y(s);let o=t[0].accounts[2].address;y(o);let a={nonce:e.message.recentBlockhash,nonceAccountAddress:s,nonceAuthorityAddress:o},i=R(e,n.staticAccountKeys);return A(E({version:e.version}),c=>w(r.toBase58(),c),c=>k(a,c),c=>t.slice(1).reduce((u,p)=>T(p,u),c),c=>e.signatures.length?{...c,signatures:i}:c)}
exports.fromLegacyKeypair = F;
exports.fromLegacyPublicKey = $;
exports.fromVersionedTransactionWithBlockhash = me;
exports.fromVersionedTransactionWithDurableNonce = he;
exports.fromLegacyKeypair = Q;
exports.fromLegacyPublicKey = F;
exports.fromVersionedTransactionWithBlockhash = Ae;
exports.fromVersionedTransactionWithDurableNonce = Ee;

@@ -13,0 +13,0 @@ return exports;

{
"name": "@mcintyre94/compat",
"version": "2.0.0-experimental.a537d8d",
"version": "2.0.0-experimental.e807d29",
"description": "Helpers for converting from legacy web3js classes",

@@ -52,5 +52,6 @@ "exports": {

"dependencies": {
"@mcintyre94/functional": "2.0.0-experimental.a537d8d",
"@mcintyre94/instructions": "2.0.0-experimental.a537d8d",
"@mcintyre94/transactions": "2.0.0-experimental.a537d8d"
"@mcintyre94/keys": "2.0.0-experimental.e807d29",
"@mcintyre94/functional": "2.0.0-experimental.e807d29",
"@mcintyre94/transactions": "2.0.0-experimental.e807d29",
"@mcintyre94/instructions": "2.0.0-experimental.e807d29"
},

@@ -75,4 +76,4 @@ "devDependencies": {

"version-from-git": "^1.1.1",
"@mcintyre94/addresses": "2.0.0-experimental.a537d8d",
"@mcintyre94/keys": "2.0.0-experimental.a537d8d",
"@mcintyre94/addresses": "2.0.0-experimental.e807d29",
"@mcintyre94/keys": "2.0.0-experimental.e807d29",
"@solana/web3.js": "0.0.0-development",

@@ -79,0 +80,0 @@ "build-scripts": "0.0.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

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

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