@solana/transactions 2.0.0-experimental.10bfcd8 → 2.0.0-experimental.13ef878

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/README.md +1 -43
  2. package/dist/index.browser.cjs +17 -47
  3. package/dist/index.browser.cjs.map +1 -1
  4. package/dist/index.browser.js +17 -45
  5. package/dist/index.browser.js.map +1 -1
  6. package/dist/index.development.js +377 -480
  7. package/dist/index.development.js.map +1 -1
  8. package/dist/index.native.js +17 -45
  9. package/dist/index.native.js.map +1 -1
  10. package/dist/index.node.cjs +17 -47
  11. package/dist/index.node.cjs.map +1 -1
  12. package/dist/index.node.js +19 -45
  13. package/dist/index.node.js.map +1 -1
  14. package/dist/index.production.min.js +18 -20
  15. package/dist/types/accounts.d.ts +2 -2
  16. package/dist/types/accounts.d.ts.map +1 -0
  17. package/dist/types/blockhash.d.ts.map +1 -0
  18. package/dist/types/compilable-transaction.d.ts +7 -0
  19. package/dist/types/compilable-transaction.d.ts.map +1 -0
  20. package/dist/types/compile-address-table-lookups.d.ts +2 -2
  21. package/dist/types/compile-address-table-lookups.d.ts.map +1 -0
  22. package/dist/types/compile-header.d.ts.map +1 -0
  23. package/dist/types/compile-instructions.d.ts.map +1 -0
  24. package/dist/types/compile-lifetime-token.d.ts.map +1 -0
  25. package/dist/types/compile-static-accounts.d.ts +2 -2
  26. package/dist/types/compile-static-accounts.d.ts.map +1 -0
  27. package/dist/types/compile-transaction.d.ts +5 -6
  28. package/dist/types/compile-transaction.d.ts.map +1 -0
  29. package/dist/types/create-transaction.d.ts.map +1 -0
  30. package/dist/types/decompile-transaction.d.ts +2 -4
  31. package/dist/types/decompile-transaction.d.ts.map +1 -0
  32. package/dist/types/durable-nonce.d.ts +3 -3
  33. package/dist/types/durable-nonce.d.ts.map +1 -0
  34. package/dist/types/fee-payer.d.ts +4 -4
  35. package/dist/types/fee-payer.d.ts.map +1 -0
  36. package/dist/types/index.d.ts +1 -0
  37. package/dist/types/index.d.ts.map +1 -0
  38. package/dist/types/instructions.d.ts.map +1 -0
  39. package/dist/types/message.d.ts +1 -5
  40. package/dist/types/message.d.ts.map +1 -0
  41. package/dist/types/serializers/address-table-lookup.d.ts.map +1 -0
  42. package/dist/types/serializers/header.d.ts.map +1 -0
  43. package/dist/types/serializers/index.d.ts.map +1 -0
  44. package/dist/types/serializers/instruction.d.ts.map +1 -0
  45. package/dist/types/serializers/message.d.ts.map +1 -0
  46. package/dist/types/serializers/transaction-version.d.ts.map +1 -0
  47. package/dist/types/serializers/transaction.d.ts +1 -3
  48. package/dist/types/serializers/transaction.d.ts.map +1 -0
  49. package/dist/types/signatures.d.ts +8 -13
  50. package/dist/types/signatures.d.ts.map +1 -0
  51. package/dist/types/types.d.ts +6 -13
  52. package/dist/types/types.d.ts.map +1 -0
  53. package/dist/types/unsigned-transaction.d.ts.map +1 -0
  54. package/dist/types/wire-transaction.d.ts.map +1 -0
  55. package/package.json +9 -10
@@ -2,27 +2,25 @@ this.globalThis = this.globalThis || {};
2
2
  this.globalThis.solanaWeb3 = (function (exports) {
3
3
  'use strict';
4
4
 
5
- var wn=Object.defineProperty;var Dn=(e,n,r)=>n in e?wn(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r;var fe=(e,n,r)=>(Dn(e,typeof n!="symbol"?n+"":n,r),r);var L=class extends Error{constructor(r,t,o){let i=`Expected a string of base ${t}, got [${r}].`;super(i);fe(this,"name","InvalidBaseStringError");this.cause=o;}};var ge=e=>{let n=e.length,r=BigInt(n);return {description:`base${n}`,fixedSize:null,maxSize:null,serialize(t){if(!t.match(new RegExp(`^[${e}]*$`)))throw new L(t,n);if(t==="")return new Uint8Array;let o=[...t],i=o.findIndex(f=>f!==e[0]);i=i===-1?o.length:i;let s=Array(i).fill(0);if(i===o.length)return Uint8Array.from(s);let c=o.slice(i),d=0n,a=1n;for(let f=c.length-1;f>=0;f-=1)d+=a*BigInt(e.indexOf(c[f])),a*=r;let l=[];for(;d>0n;)l.unshift(Number(d%256n)),d/=256n;return Uint8Array.from(s.concat(l))},deserialize(t,o=0){if(t.length===0)return ["",0];let i=t.slice(o),s=i.findIndex(l=>l!==0);s=s===-1?i.length:s;let c=e[0].repeat(s);if(s===i.length)return [c,t.length];let d=i.slice(s).reduce((l,f)=>l*256n+BigInt(f),0n),a=[];for(;d>0n;)a.unshift(e[Number(d%r)]),d/=r;return [c+a.join(""),t.length]}}};var B=ge("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");function x(e){if("signatures"in e){let{signatures:n,...r}=e;return r}else return e}function kr(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 r=B.serialize(e).byteLength;if(r!==32)throw new Error(`Expected input string to decode to a byte array of length 32. Actual length: ${r}`)}catch(n){throw new Error(`\`${e}\` is not a blockhash`,{cause:n})}}function pe(e,n){if("lifetimeConstraint"in n&&n.lifetimeConstraint.blockhash===e.blockhash&&n.lifetimeConstraint.lastValidBlockHeight===e.lastValidBlockHeight)return n;let r={...x(n),lifetimeConstraint:e};return Object.freeze(r),r}function me({version:e}){let n={instructions:[],version:e};return Object.freeze(n),n}var p=(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))(p||{});var vn=1;function y(e){return e>=2}function w(e){return (e&vn)!==0}function J(e,n){return e|n}var ye="SysvarRecentB1ockHashes11111111111111111111",he="11111111111111111111111111111111";function qr(e){if(!Ae(e))throw new Error("Transaction is not a durable nonce transaction")}function Te(e,n){return {accounts:[{address:e,role:p.WRITABLE},{address:ye,role:p.READONLY},{address:n,role:p.READONLY_SIGNER}],data:new Uint8Array([4,0,0,0]),programAddress:he}}function M(e){return e.programAddress===he&&e.data!=null&&Nn(e.data)&&e.accounts?.length===3&&e.accounts[0].address!=null&&e.accounts[0].role===p.WRITABLE&&e.accounts[1].address===ye&&e.accounts[1].role===p.READONLY&&e.accounts[2].address!=null&&y(e.accounts[2].role)}function Nn(e){return e.byteLength===4&&e[0]===4&&e[1]===0&&e[2]===0&&e[3]===0}function Ae(e){return "lifetimeConstraint"in e&&typeof e.lifetimeConstraint.nonce=="string"&&e.instructions[0]!=null&&M(e.instructions[0])}function kn(e,n,r){return e.accounts[0].address===n&&e.accounts[2].address===r}function be({nonce:e,nonceAccountAddress:n,nonceAuthorityAddress:r},t){let o,i=t.instructions[0];if(i&&M(i))if(kn(i,n,r)){if(Ae(t)&&t.lifetimeConstraint.nonce===e)return t;o=[i,...t.instructions.slice(1)];}else o=[Te(n,r),...t.instructions.slice(1)];else o=[Te(n,r),...t.instructions];let s={...x(t),instructions:o,lifetimeConstraint:{nonce:e}};return Object.freeze(s),s}function Ee(e,n){if("feePayer"in n&&e===n.feePayer)return n;let r={...x(n),feePayer:e};return Object.freeze(r),r}function xe(e,n){let r={...x(n),instructions:[...n.instructions,e]};return Object.freeze(r),r}function nt(e,n){let r={...x(n),instructions:[e,...n.instructions]};return Object.freeze(r),r}function N(e,n,r=0){if(n.length-r<=0)throw new Error(`Codec [${e}] cannot decode empty byte arrays.`)}function D(e,n,r,t=0){let o=r.length-t;if(o<n)throw new Error(`Codec [${e}] expected ${n} bytes, got ${o}.`)}var k=e=>{let n=e.filter(i=>i.length);if(n.length===0)return e.length?e[0]:new Uint8Array;if(n.length===1)return n[0];let r=n.reduce((i,s)=>i+s.length,0),t=new Uint8Array(r),o=0;return n.forEach(i=>{t.set(i,o),o+=i.length;}),t},_n=(e,n)=>{if(e.length>=n)return e;let r=new Uint8Array(n).fill(0);return r.set(e),r},Q=(e,n)=>_n(e.length<=n?e:e.slice(0,n),n);function C(e,n,r){if(e.fixedSize!==n.fixedSize)throw new Error(`Encoder and decoder must have the same fixed size, got [${e.fixedSize}] and [${n.fixedSize}].`);if(e.maxSize!==n.maxSize)throw new Error(`Encoder and decoder must have the same max size, got [${e.maxSize}] and [${n.maxSize}].`);if(r===void 0&&e.description!==n.description)throw new Error(`Encoder and decoder must have the same description, got [${e.description}] and [${n.description}]. Pass a custom description as a third argument if you want to override the description and bypass this error.`);return {decode:n.decode,description:r??e.description,encode:e.encode,fixedSize:e.fixedSize,maxSize:e.maxSize}}function Se(e,n,r){return {description:r??`fixed(${n}, ${e.description})`,fixedSize:n,maxSize:n}}function U(e,n,r){return {...Se(e,n,r),encode:t=>Q(e.encode(t),n)}}function O(e,n,r){return {...Se(e,n,r),decode:(t,o=0)=>{D("fixCodec",n,t,o),(o>0||t.length>n)&&(t=t.slice(o,o+n)),e.fixedSize!==null&&(t=Q(t,e.fixedSize));let[i]=e.decode(t,0);return [i,o+n]}}}function z(e,n){return {description:e.description,encode:r=>e.encode(n(r)),fixedSize:e.fixedSize,maxSize:e.maxSize}}function v(e,n){return {decode:(r,t=0)=>{let[o,i]=e.decode(r,t);return [n(o,r,t),i]},description:e.description,fixedSize:e.fixedSize,maxSize:e.maxSize}}function Ie(e,n,r,t){if(t<n||t>r)throw new Error(`Codec [${e}] expected number to be in the range [${n}, ${r}], got ${t}.`)}function Ce(e){let n,r=e.name;return e.size>1&&(n=!("endian"in e.options)||e.options.endian===0,r+=n?"(le)":"(be)"),{description:e.options.description??r,fixedSize:e.size,littleEndian:n,maxSize:e.size}}function ze(e){let n=Ce(e);return {description:n.description,encode(r){e.range&&Ie(e.name,e.range[0],e.range[1],r);let t=new ArrayBuffer(e.size);return e.set(new DataView(t),r,n.littleEndian),new Uint8Array(t)},fixedSize:n.fixedSize,maxSize:n.maxSize}}function Be(e){let n=Ce(e);return {decode(r,t=0){N(n.description,r,t),D(n.description,e.size,r,t);let o=new DataView(Rn(r,t,e.size));return [e.get(o,n.littleEndian),t+e.size]},description:n.description,fixedSize:n.fixedSize,maxSize:n.maxSize}}function Rn(e,n,r){let t=e.byteOffset+(n??0),o=r??e.byteLength;return e.buffer.slice(t,t+o)}var m=(e={})=>({description:e.description??"shortU16",encode:n=>{Ie("shortU16",0,65535,n);let r=[0];for(let t=0;;t+=1){let o=n>>t*7;if(o===0)break;let i=127&o;r[t]=i,t>0&&(r[t-1]|=128);}return new Uint8Array(r)},fixedSize:null,maxSize:3}),T=(e={})=>({decode:(n,r=0)=>{let t=0,o=0;for(;++o;){let i=o-1,s=n[r+i],c=127&s;if(t|=c<<i*7,!(s&128))break}return [t,r+o]},description:e.description??"shortU16",fixedSize:null,maxSize:3});var $=(e={})=>ze({name:"u32",options:e,range:[0,+"0xffffffff"],set:(n,r,t)=>n.setUint32(0,r,t),size:4}),P=(e={})=>Be({get:(n,r)=>n.getUint32(0,r),name:"u32",options:e,size:4});var S=(e={})=>ze({name:"u8",options:e,range:[0,+"0xff"],set:(n,r)=>n.setUint8(0,r),size:1}),I=(e={})=>Be({get:n=>n.getUint8(0),name:"u8",options:e,size:1});function W(e){return e.reduce((n,r)=>n===null||r===null?null:n+r,0)}function Ln(e,n,r,t){if(typeof e=="number")return [e,t];if(typeof e=="object")return e.decode(r,t);if(e==="remainder"){let o=W(n);if(o===null)throw new Error('Codecs of "remainder" size must have fixed-size items.');let i=r.slice(t).length;if(i%o!==0)throw new Error(`The remainder of the byte array (${i} bytes) cannot be split into chunks of ${o} bytes. Codecs of "remainder" size must have a remainder that is a multiple of its item size. In other words, ${i} modulo ${o} should be equal to zero.`);return [i/o,t]}throw new Error(`Unrecognized array-like codec size: ${JSON.stringify(e)}`)}function Mn(e){return typeof e=="object"?e.description:`${e}`}function we(e,n){if(typeof e!="number")return null;if(e===0)return 0;let r=W(n);return r===null?null:r*e}function Un(e,n){return typeof e=="object"?e.encode(n):new Uint8Array}function On(e,n,r){if(n!==r)throw new Error(`Expected [${e}] to have ${n} items, got ${r}.`)}function De(e,n,r){if(n==="remainder"&&e.fixedSize===null)throw new Error('Codecs of "remainder" size must have fixed-size items.');return {description:r??`array(${e.description}; ${Mn(n)})`,fixedSize:we(n,[e.fixedSize]),maxSize:we(n,[e.maxSize])}}function h(e,n={}){let r=n.size??$();return {...De(e,r,n.description),encode:t=>(typeof r=="number"&&On("array",r,t.length),k([Un(r,t.length),...t.map(o=>e.encode(o))]))}}function A(e,n={}){let r=n.size??P();return {...De(e,r,n.description),decode:(t,o=0)=>{if(typeof r=="object"&&t.slice(o).length===0)return [[],o];let[i,s]=Ln(r,[e.fixedSize],t,o);o=s;let c=[];for(let d=0;d<i;d+=1){let[a,l]=e.decode(t,o);c.push(a),o=l;}return [c,o]}}}function V(e={}){let n=e.size??"variable",r=typeof n=="object"?n.description:`${n}`,t=e.description??`bytes(${r})`,o={description:t,encode:i=>i,fixedSize:null,maxSize:null};return n==="variable"?o:typeof n=="number"?U(o,n,t):{...o,encode:i=>{let s=o.encode(i),c=n.encode(s.length);return k([c,s])}}}function F(e={}){let n=e.size??"variable",r=typeof n=="object"?n.description:`${n}`,t=e.description??`bytes(${r})`,o={decode:(i,s=0)=>{let c=i.slice(s);return [c,s+c.length]},description:t,fixedSize:null,maxSize:null};return n==="variable"?o:typeof n=="number"?O(o,n,t):{...o,decode:(i,s=0)=>{N("bytes",i,s);let[c,d]=n.decode(i,s),a=Number(c);s=d;let l=i.slice(s,s+a);D("bytes",a,l);let[f,Bn]=o.decode(l);return s+=Bn,[f,s]}}}function ve(e,n){let r=e.map(([t,o])=>`${String(t)}: ${o.description}`).join(", ");return {description:n??`struct(${r})`,fixedSize:W(e.map(([,t])=>t.fixedSize)),maxSize:W(e.map(([,t])=>t.maxSize))}}function b(e,n={}){return {...ve(e,n.description),encode:r=>{let t=e.map(([o,i])=>i.encode(r[o]));return k(t)}}}function E(e,n={}){return {...ve(e,n.description),decode:(r,t=0)=>{let o={};return e.forEach(([i,s])=>{let[c,d]=s.decode(r,t);t=d,o[i]=c;}),[o,t]}}}function $n(e,n,r=n){if(!n.match(new RegExp(`^[${e}]*$`)))throw new Error(`Expected a string of base ${e.length}, got [${r}].`)}var Pn=e=>{let n=e.length,r=BigInt(n);return {description:`base${n}`,encode(t){if($n(e,t),t==="")return new Uint8Array;let o=[...t],i=o.findIndex(f=>f!==e[0]);i=i===-1?o.length:i;let s=Array(i).fill(0);if(i===o.length)return Uint8Array.from(s);let c=o.slice(i),d=0n,a=1n;for(let f=c.length-1;f>=0;f-=1)d+=a*BigInt(e.indexOf(c[f])),a*=r;let l=[];for(;d>0n;)l.unshift(Number(d%256n)),d/=256n;return Uint8Array.from(s.concat(l))},fixedSize:null,maxSize:null}},Wn=e=>{let n=e.length,r=BigInt(n);return {decode(t,o=0){let i=o===0?t:t.slice(o);if(i.length===0)return ["",0];let s=i.findIndex(l=>l!==0);s=s===-1?i.length:s;let c=e[0].repeat(s);if(s===i.length)return [c,t.length];let d=i.slice(s).reduce((l,f)=>l*256n+BigInt(f),0n),a=[];for(;d>0n;)a.unshift(e[Number(d%r)]),d/=r;return [c+a.join(""),t.length]},description:`base${n}`,fixedSize:null,maxSize:null}};var Ne="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",H=()=>Pn(Ne),K=()=>Wn(Ne);var Vn=e=>e.replace(/\u0000/g,"");var Fn=globalThis.TextDecoder,Hn=globalThis.TextEncoder,Kn=()=>{let e;return {description:"utf8",encode:n=>new Uint8Array((e||(e=new Hn)).encode(n)),fixedSize:null,maxSize:null}},jn=()=>{let e;return {decode(n,r=0){let t=(e||(e=new Fn)).decode(n.slice(r));return [Vn(t),n.length]},description:"utf8",fixedSize:null,maxSize:null}};var j=(e={})=>{let n=e.size??$(),r=e.encoding??Kn(),t=e.description??`string(${r.description}; ${ke(n)})`;return n==="variable"?{...r,description:t}:typeof n=="number"?U(r,n,t):{description:t,encode:o=>{let i=r.encode(o),s=n.encode(i.length);return k([s,i])},fixedSize:null,maxSize:null}},Y=(e={})=>{let n=e.size??P(),r=e.encoding??jn(),t=e.description??`string(${r.description}; ${ke(n)})`;return n==="variable"?{...r,description:t}:typeof n=="number"?O(r,n,t):{decode:(o,i=0)=>{N("string",o,i);let[s,c]=n.decode(o,i),d=Number(s);i=c;let a=o.slice(i,i+d);D("string",d,a);let[l,f]=r.decode(a);return i+=f,[l,i]},description:t,fixedSize:null,maxSize:null}};function ke(e){return typeof e=="object"?e.description:`${e}`}function _e(){if(!globalThis.isSecureContext)throw new Error("Cryptographic operations are only allowed in secure browser contexts. Read more here: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts")}async function Re(){if(_e(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.exportKey!="function")throw new Error("No key export implementation could be found")}async function Le(){if(_e(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.sign!="function")throw new Error("No signing implementation could be found")}var ee,ne;function Me(){return ee||(ee=H()),ee}function Yn(){return ne||(ne=K()),ne}function q(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=Me().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 qn(e){return q(e),e}function G(e){return z(j({description:e?.description??"Base58EncodedAddress",encoding:Me(),size:32}),n=>qn(n))}function _(e){return Y({description:e?.description??"Base58EncodedAddress",encoding:Yn(),size:32})}function R(){return new Intl.Collator("en",{caseFirst:"lower",ignorePunctuation:!1,localeMatcher:"best fit",numeric:!1,sensitivity:"variant",usage:"sort"}).compare}async function Ue(e){if(await Re(),e.type!=="public"||e.algorithm.name!=="Ed25519")throw new Error("The `CryptoKey` must be an `Ed25519` public key");let n=await crypto.subtle.exportKey("raw",e),[r]=_().decode(new Uint8Array(n));return r}function Oe(e,n,r){e[n]=r(e[n]??{role:p.READONLY});}var g=Symbol("AddressMapTypeProperty");function $e(e,n){let r={[e]:{[g]:0,role:p.WRITABLE_SIGNER}},t=new Set;for(let o of n){Oe(r,o.programAddress,s=>{if(t.add(o.programAddress),g in s){if(w(s.role))switch(s[g]){case 0:throw new Error(`This transaction includes an address (\`${o.programAddress}\`) which is both invoked and set as the fee payer. Program addresses may not pay fees.`);default:throw new Error(`This transaction includes an address (\`${o.programAddress}\`) which is both invoked and marked writable. Program addresses may not be writable.`)}if(s[g]===2)return s}return {[g]:2,role:p.READONLY}});let i;if(o.accounts)for(let s of o.accounts)Oe(r,s.address,c=>{let{address:d,...a}=s;if(g in c)switch(c[g]){case 0:return c;case 1:{let l=J(c.role,a.role);if("lookupTableAddress"in a){if(c.lookupTableAddress!==a.lookupTableAddress&&(i||(i=R()))(a.lookupTableAddress,c.lookupTableAddress)<0)return {[g]:1,...a,role:l}}else if(y(a.role))return {[g]:2,role:l};return c.role!==l?{...c,role:l}:c}case 2:{let l=J(c.role,a.role);if(t.has(s.address)){if(w(a.role))throw new Error(`This transaction includes an address (\`${s.address}\`) which is both invoked and marked writable. Program addresses may not be writable.`);return c.role!==l?{...c,role:l}:c}else return "lookupTableAddress"in a&&!y(c.role)?{...a,[g]:1,role:l}:c.role!==l?{...c,role:l}:c}}return "lookupTableAddress"in a?{...a,[g]:1}:{...a,[g]:2}});}return r}function Pe(e){let n;return Object.entries(e).sort(([t,o],[i,s])=>{if(o[g]!==s[g]){if(o[g]===0)return -1;if(s[g]===0)return 1;if(o[g]===2)return -1;if(s[g]===2)return 1}let c=y(o.role);if(c!==y(s.role))return c?-1:1;let d=w(o.role);return d!==w(s.role)?d?-1:1:(n||(n=R()),o[g]===1&&s[g]===1&&o.lookupTableAddress!==s.lookupTableAddress?n(o.lookupTableAddress,s.lookupTableAddress):n(t,i))}).map(([t,o])=>({address:t,...o}))}function We(e){var r;let n={};for(let t of e){if(!("lookupTableAddress"in t))continue;let o=n[r=t.lookupTableAddress]||(n[r]={readableIndices:[],writableIndices:[]});t.role===p.WRITABLE?o.writableIndices.push(t.addressIndex):o.readableIndices.push(t.addressIndex);}return Object.keys(n).sort(R()).map(t=>({lookupTableAddress:t,...n[t]}))}function Ve(e){let n=0,r=0,t=0;for(let o of e){if("lookupTableAddress"in o)break;let i=w(o.role);y(o.role)?(t++,i||r++):i||n++;}return {numReadonlyNonSignerAccounts:n,numReadonlySignerAccounts:r,numSignerAccounts:t}}function Gn(e){let n={};for(let[r,t]of e.entries())n[t.address]=r;return n}function Fe(e,n){let r=Gn(n);return e.map(({accounts:t,data:o,programAddress:i})=>({programAddressIndex:r[i],...t?{accountIndices:t.map(({address:s})=>r[s])}:null,...o?{data:o}:null}))}function He(e){return "nonce"in e?e.nonce:e.blockhash}function Ke(e){let n=e.findIndex(t=>"lookupTableAddress"in t);return (n===-1?e:e.slice(0,n)).map(({address:t})=>t)}function X(e){let n=$e(e.feePayer,e.instructions),r=Pe(n);return {...e.version!=="legacy"?{addressTableLookups:We(r)}:null,header:Ve(r),instructions:Fe(e.instructions,r),lifetimeToken:He(e.lifetimeConstraint),staticAccounts:Ke(r),version:e.version}}function je(e){let n=X(e),r;if("signatures"in e){r=[];for(let t=0;t<n.header.numSignerAccounts;t++)r[t]=e.signatures[n.staticAccounts[t]]??new Uint8Array(Array(64).fill(0));}else r=Array(n.header.numSignerAccounts).fill(new Uint8Array(Array(64).fill(0)));return {compiledMessage:n,signatures:r}}function Ye(e,...n){return n.reduce((r,t)=>t(r),e)}function Xn(e){let{header:n}=e,r=n.numSignerAccounts-n.numReadonlySignerAccounts,t=e.staticAccounts.length-n.numSignerAccounts-n.numReadonlyNonSignerAccounts,o=[],i=0;for(let s=0;s<r;s++)o.push({address:e.staticAccounts[i],role:p.WRITABLE_SIGNER}),i++;for(let s=0;s<n.numReadonlySignerAccounts;s++)o.push({address:e.staticAccounts[i],role:p.READONLY_SIGNER}),i++;for(let s=0;s<t;s++)o.push({address:e.staticAccounts[i],role:p.WRITABLE}),i++;for(let s=0;s<n.numReadonlyNonSignerAccounts;s++)o.push({address:e.staticAccounts[i],role:p.READONLY}),i++;return o}function Zn(e,n){let r=n[e.programAddressIndex]?.address;if(!r)throw new Error(`Could not find program address at index ${e.programAddressIndex}`);let t=e.accountIndices?.map(i=>n[i]),{data:o}=e;return {programAddress:r,...t&&t.length?{accounts:t}:{},...o&&o.length?{data:o}:{}}}function Jn(e,n,r){if(!n||!M(n))return {blockhash:e,lastValidBlockHeight:r??2n**64n-1n};{let t=n.accounts[0].address;q(t);let o=n.accounts[2].address;return q(o),{nonce:e,nonceAccountAddress:t,nonceAuthorityAddress:o}}}function Qn(e){let{compiledMessage:{staticAccounts:n},signatures:r}=e;return r.reduce((t,o,i)=>{if(o.every(d=>d===0))return t;let c=n[i];return {...t,[c]:o}},{})}function qe(e,n){let{compiledMessage:r}=e;if("addressTableLookups"in r&&r.addressTableLookups.length>0)throw new Error("Cannot convert transaction with addressTableLookups");let t=r.staticAccounts[0];if(!t)throw new Error("No fee payer set in CompiledTransaction");let o=Xn(r),i=r.instructions.map(a=>Zn(a,o)),s=i[0],c=Jn(r.lifetimeToken,s,n),d=Qn(e);return Ye(me({version:r.version}),a=>Ee(t,a),a=>i.reduce((l,f)=>xe(f,l),a),a=>"blockhash"in c?pe(c,a):be(c,a),a=>e.signatures.length?{...a,signatures:d}:a)}var Ge="lookupTableAddress",Xe="writableIndices",Ze="readableIndices",Je="addressTableLookup",re;function Qe(){return re||(re=b([["lookupTableAddress",G({description:Ge})],["writableIndices",h(S(),{description:Xe,size:m()})],["readableIndices",h(S(),{description:Ze,size:m()})]],{description:Je})),re}var te;function en(){return te||(te=E([["lookupTableAddress",_({description:Ge})],["writableIndices",A(I(),{description:Xe,size:T()})],["readableIndices",A(I(),{description:Ze,size:T()})]],{description:Je})),te}var oe;function er(){return oe||(oe=S()),oe}function ie(e){let n=er();return {...n,description:e??n.description}}var se;function nr(){return se||(se=I()),se}function ce(e){let n=nr();return {...n,description:e??n.description}}var nn=void 0,rn=void 0,tn=void 0,on=void 0;function sn(){return b([["numSignerAccounts",ie(nn)],["numReadonlySignerAccounts",ie(rn)],["numReadonlyNonSignerAccounts",ie(tn)]],{description:on})}function cn(){return E([["numSignerAccounts",ce(nn)],["numReadonlySignerAccounts",ce(rn)],["numReadonlyNonSignerAccounts",ce(tn)]],{description:on})}var an="programAddressIndex",dn=void 0,un="accountIndices",ln="data",ae;function fn(){return ae||(ae=z(b([["programAddressIndex",S({description:an})],["accountIndices",h(S({description:dn}),{description:un,size:m()})],["data",V({description:ln,size:m()})]]),e=>e.accountIndices!==void 0&&e.data!==void 0?e:{...e,accountIndices:e.accountIndices??[],data:e.data??new Uint8Array(0)})),ae}var de;function gn(){return de||(de=v(E([["programAddressIndex",I({description:an})],["accountIndices",A(I({description:dn}),{description:un,size:T()})],["data",F({description:ln,size:T()})]]),e=>{if(e.accountIndices.length&&e.data.byteLength)return e;let{accountIndices:n,data:r,...t}=e;return {...t,...n.length?{accountIndices:n}:null,...r.byteLength?{data:r}:null}})),de}var ue=128,pn={description:"",fixedSize:null,maxSize:1};function rr(e,n=0){let r=e[n];return r&ue?[r^ue,n+1]:["legacy",n]}function tr(e){if(e==="legacy")return new Uint8Array;if(e<0||e>127)throw new Error(`Transaction version must be in the range [0, 127]. \`${e}\` given.`);return new Uint8Array([e|ue])}function mn(){return {...pn,decode:rr}}function Tn(){return {...pn,encode:tr}}var yn="staticAccounts",hn="lifetimeToken",An="instructions",bn="addressTableLookups";function or(){return b(En())}function ir(){return z(b([...En(),["addressTableLookups",cr()]]),e=>e.version==="legacy"?e:{...e,addressTableLookups:e.addressTableLookups??[]})}function En(){return [["version",Tn()],["header",sn()],["staticAccounts",h(G(),{description:yn,size:m()})],["lifetimeToken",j({description:hn,encoding:H(),size:32})],["instructions",h(fn(),{description:An,size:m()})]]}function sr(){return [["version",mn()],["header",cn()],["staticAccounts",A(_(),{description:yn,size:T()})],["lifetimeToken",Y({description:hn,encoding:K(),size:32})],["instructions",A(gn(),{description:An,size:T()})],["addressTableLookups",ar()]]}function cr(){return h(Qe(),{description:bn,size:m()})}function ar(){return A(en(),{description:bn,size:T()})}var xn="message";function Z(){return {description:xn,encode:e=>e.version==="legacy"?or().encode(e):ir().encode(e),fixedSize:null,maxSize:null}}function Sn(){return v(E(sr(),{description:xn}),({addressTableLookups:e,...n})=>n.version==="legacy"||!e?.length?n:{...n,addressTableLookups:e})}var In="signatures",Cn="transaction";function dr(){return b([["signatures",h(V({size:64}),{description:In,size:m()})],["compiledMessage",Z()]],{description:Cn})}function ur(){return v(F({size:64}),e=>e)}function lr(){return E([["signatures",A(ur(),{description:In,size:T()})],["compiledMessage",Sn()]],{description:Cn})}function le(){return z(dr(),je)}function fr(e){return v(lr(),n=>qe(n,e))}function xi(e){return C(le(),fr(e))}async function zn(e,n){await Le();let r=await crypto.subtle.sign("Ed25519",e,n);return new Uint8Array(r)}function gr(e){try{if(e.length<64||e.length>88)throw new Error("Expected input string to decode to a byte array of length 64.");let r=B.serialize(e).byteLength;if(r!==64)throw new Error(`Expected input string to decode to a byte array of length 64. Actual length: ${r}`)}catch(n){throw new Error(`\`${e}\` is not a transaction signature`,{cause:n})}}function Oi(e){return !(e.length<64||e.length>88||B.serialize(e).byteLength!==64)}function $i(e){let n=e.signatures[e.feePayer];if(!n)throw new Error("Could not determine this transaction's signature. Make sure that the transaction has been signed by its fee payer.");return B.deserialize(n)[0]}async function Pi(e,n){let r=X(n),t="signatures"in n?{...n.signatures}:{},o=Z().encode(r),i=await Promise.all(e.map(c=>Promise.all([Ue(c.publicKey),zn(c.privateKey,o)])));for(let[c,d]of i)t[c]=d;let s={...n,signatures:t};return Object.freeze(s),s}function Wi(e){return gr(e),e}function Vi(e){let n=e.instructions.flatMap(t=>t.accounts?.filter(o=>y(o.role))??[]).map(t=>t.address);new Set([e.feePayer,...n]).forEach(t=>{if(!e.signatures[t])throw new Error(`Transaction is missing signature for address \`${t}\``)});}function ji(e){let n=le().encode(e);return btoa(String.fromCharCode(...n))}
5
+ function v(e,n,r=0){if(n.length-r<=0)throw new Error(`Codec [${e}] cannot decode empty byte arrays.`)}function w(e,n,r,t=0){let o=r.length-t;if(o<n)throw new Error(`Codec [${e}] expected ${n} bytes, got ${o}.`)}var N=e=>{let n=e.filter(i=>i.length);if(n.length===0)return e.length?e[0]:new Uint8Array;if(n.length===1)return n[0];let r=n.reduce((i,s)=>i+s.length,0),t=new Uint8Array(r),o=0;return n.forEach(i=>{t.set(i,o),o+=i.length;}),t},zn=(e,n)=>{if(e.length>=n)return e;let r=new Uint8Array(n).fill(0);return r.set(e),r},X=(e,n)=>zn(e.length<=n?e:e.slice(0,n),n);function C(e,n,r){if(e.fixedSize!==n.fixedSize)throw new Error(`Encoder and decoder must have the same fixed size, got [${e.fixedSize}] and [${n.fixedSize}].`);if(e.maxSize!==n.maxSize)throw new Error(`Encoder and decoder must have the same max size, got [${e.maxSize}] and [${n.maxSize}].`);if(r===void 0&&e.description!==n.description)throw new Error(`Encoder and decoder must have the same description, got [${e.description}] and [${n.description}]. Pass a custom description as a third argument if you want to override the description and bypass this error.`);return {decode:n.decode,description:r??e.description,encode:e.encode,fixedSize:e.fixedSize,maxSize:e.maxSize}}function fe(e,n,r){return {description:r??`fixed(${n}, ${e.description})`,fixedSize:n,maxSize:n}}function M(e,n,r){return {...fe(e,n,r),encode:t=>X(e.encode(t),n)}}function U(e,n,r){return {...fe(e,n,r),decode:(t,o=0)=>{w("fixCodec",n,t,o),(o>0||t.length>n)&&(t=t.slice(o,o+n)),e.fixedSize!==null&&(t=X(t,e.fixedSize));let[i]=e.decode(t,0);return [i,o+n]}}}function z(e,n){return {description:e.description,encode:r=>e.encode(n(r)),fixedSize:e.fixedSize,maxSize:e.maxSize}}function D(e,n){return {decode:(r,t=0)=>{let[o,i]=e.decode(r,t);return [n(o,r,t),i]},description:e.description,fixedSize:e.fixedSize,maxSize:e.maxSize}}function ge(e,n,r,t){if(t<n||t>r)throw new Error(`Codec [${e}] expected number to be in the range [${n}, ${r}], got ${t}.`)}function pe(e){let n,r=e.name;return e.size>1&&(n=!("endian"in e.options)||e.options.endian===0,r+=n?"(le)":"(be)"),{description:e.options.description??r,fixedSize:e.size,littleEndian:n,maxSize:e.size}}function me(e){let n=pe(e);return {description:n.description,encode(r){e.range&&ge(e.name,e.range[0],e.range[1],r);let t=new ArrayBuffer(e.size);return e.set(new DataView(t),r,n.littleEndian),new Uint8Array(t)},fixedSize:n.fixedSize,maxSize:n.maxSize}}function Te(e){let n=pe(e);return {decode(r,t=0){v(n.description,r,t),w(n.description,e.size,r,t);let o=new DataView(wn(r,t,e.size));return [e.get(o,n.littleEndian),t+e.size]},description:n.description,fixedSize:n.fixedSize,maxSize:n.maxSize}}function wn(e,n,r){let t=e.byteOffset+(n??0),o=r??e.byteLength;return e.buffer.slice(t,t+o)}var m=(e={})=>({description:e.description??"shortU16",encode:n=>{ge("shortU16",0,65535,n);let r=[0];for(let t=0;;t+=1){let o=n>>t*7;if(o===0)break;let i=127&o;r[t]=i,t>0&&(r[t-1]|=128);}return new Uint8Array(r)},fixedSize:null,maxSize:3}),T=(e={})=>({decode:(n,r=0)=>{let t=0,o=0;for(;++o;){let i=o-1,s=n[r+i],c=127&s;if(t|=c<<i*7,!(s&128))break}return [t,r+o]},description:e.description??"shortU16",fixedSize:null,maxSize:3});var O=(e={})=>me({name:"u32",options:e,range:[0,+"0xffffffff"],set:(n,r,t)=>n.setUint32(0,r,t),size:4}),$=(e={})=>Te({get:(n,r)=>n.getUint32(0,r),name:"u32",options:e,size:4});var x=(e={})=>me({name:"u8",options:e,range:[0,+"0xff"],set:(n,r)=>n.setUint8(0,r),size:1}),E=(e={})=>Te({get:n=>n.getUint8(0),name:"u8",options:e,size:1});function Dn(e,n,r=n){if(!n.match(new RegExp(`^[${e}]*$`)))throw new Error(`Expected a string of base ${e.length}, got [${r}].`)}var Bn=e=>{let n=e.length,r=BigInt(n);return {description:`base${n}`,encode(t){if(Dn(e,t),t==="")return new Uint8Array;let o=[...t],i=o.findIndex(p=>p!==e[0]);i=i===-1?o.length:i;let s=Array(i).fill(0);if(i===o.length)return Uint8Array.from(s);let c=o.slice(i),u=0n,a=1n;for(let p=c.length-1;p>=0;p-=1)u+=a*BigInt(e.indexOf(c[p])),a*=r;let l=[];for(;u>0n;)l.unshift(Number(u%256n)),u/=256n;return Uint8Array.from(s.concat(l))},fixedSize:null,maxSize:null}},vn=e=>{let n=e.length,r=BigInt(n);return {decode(t,o=0){let i=o===0?t:t.slice(o);if(i.length===0)return ["",0];let s=i.findIndex(l=>l!==0);s=s===-1?i.length:s;let c=e[0].repeat(s);if(s===i.length)return [c,t.length];let u=i.slice(s).reduce((l,p)=>l*256n+BigInt(p),0n),a=[];for(;u>0n;)a.unshift(e[Number(u%r)]),u/=r;return [c+a.join(""),t.length]},description:`base${n}`,fixedSize:null,maxSize:null}};var ye="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",k=()=>Bn(ye),_=()=>vn(ye);var Nn=e=>e.replace(/\u0000/g,"");var kn=globalThis.TextDecoder,_n=globalThis.TextEncoder,Ln=()=>{let e;return {description:"utf8",encode:n=>new Uint8Array((e||(e=new _n)).encode(n)),fixedSize:null,maxSize:null}},Rn=()=>{let e;return {decode(n,r=0){let t=(e||(e=new kn)).decode(n.slice(r));return [Nn(t),n.length]},description:"utf8",fixedSize:null,maxSize:null}};var W=(e={})=>{let n=e.size??O(),r=e.encoding??Ln(),t=e.description??`string(${r.description}; ${Ae(n)})`;return n==="variable"?{...r,description:t}:typeof n=="number"?M(r,n,t):{description:t,encode:o=>{let i=r.encode(o),s=n.encode(i.length);return N([s,i])},fixedSize:null,maxSize:null}},P=(e={})=>{let n=e.size??$(),r=e.encoding??Rn(),t=e.description??`string(${r.description}; ${Ae(n)})`;return n==="variable"?{...r,description:t}:typeof n=="number"?U(r,n,t):{decode:(o,i=0)=>{v("string",o,i);let[s,c]=n.decode(o,i),u=Number(s);i=c;let a=o.slice(i,i+u);w("string",u,a);let[l,p]=r.decode(a);return i+=p,[l,i]},description:t,fixedSize:null,maxSize:null}};function Ae(e){return typeof e=="object"?e.description:`${e}`}function I(e){if("signatures"in e){let{signatures:n,...r}=e;return r}else return e}var Z;function Cr(e){Z||(Z=k());try{if(e.length<32||e.length>44)throw new Error("Expected input string to decode to a byte array of length 32.");let r=Z.encode(e).byteLength;if(r!==32)throw new Error(`Expected input string to decode to a byte array of length 32. Actual length: ${r}`)}catch(n){throw new Error(`\`${e}\` is not a blockhash`,{cause:n})}}function he(e,n){if("lifetimeConstraint"in n&&n.lifetimeConstraint.blockhash===e.blockhash&&n.lifetimeConstraint.lastValidBlockHeight===e.lastValidBlockHeight)return n;let r={...I(n),lifetimeConstraint:e};return Object.freeze(r),r}function be({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||{});var Mn=1;function y(e){return e>=2}function B(e){return (e&Mn)!==0}function J(e,n){return e|n}var xe="SysvarRecentB1ockHashes11111111111111111111",Ee="11111111111111111111111111111111";function Pr(e){if(!Ie(e))throw new Error("Transaction is not a durable nonce transaction")}function Se(e,n){return {accounts:[{address:e,role:g.WRITABLE},{address:xe,role:g.READONLY},{address:n,role:g.READONLY_SIGNER}],data:new Uint8Array([4,0,0,0]),programAddress:Ee}}function V(e){return e.programAddress===Ee&&e.data!=null&&Un(e.data)&&e.accounts?.length===3&&e.accounts[0].address!=null&&e.accounts[0].role===g.WRITABLE&&e.accounts[1].address===xe&&e.accounts[1].role===g.READONLY&&e.accounts[2].address!=null&&y(e.accounts[2].role)}function Un(e){return e.byteLength===4&&e[0]===4&&e[1]===0&&e[2]===0&&e[3]===0}function Ie(e){return "lifetimeConstraint"in e&&typeof e.lifetimeConstraint.nonce=="string"&&e.instructions[0]!=null&&V(e.instructions[0])}function On(e,n,r){return e.accounts[0].address===n&&e.accounts[2].address===r}function Ce({nonce:e,nonceAccountAddress:n,nonceAuthorityAddress:r},t){let o,i=t.instructions[0];if(i&&V(i))if(On(i,n,r)){if(Ie(t)&&t.lifetimeConstraint.nonce===e)return t;o=[i,...t.instructions.slice(1)];}else o=[Se(n,r),...t.instructions.slice(1)];else o=[Se(n,r),...t.instructions];let s={...I(t),instructions:o,lifetimeConstraint:{nonce:e}};return Object.freeze(s),s}function ze(e,n){if("feePayer"in n&&e===n.feePayer)return n;let r={...I(n),feePayer:e};return Object.freeze(r),r}function we(e,n){let r={...I(n),instructions:[...n.instructions,e]};return Object.freeze(r),r}function Gr(e,n){let r={...I(n),instructions:[e,...n.instructions]};return Object.freeze(r),r}function F(e){return e.reduce((n,r)=>n===null||r===null?null:n+r,0)}function $n(e,n,r,t){if(typeof e=="number")return [e,t];if(typeof e=="object")return e.decode(r,t);if(e==="remainder"){let o=F(n);if(o===null)throw new Error('Codecs of "remainder" size must have fixed-size items.');let i=r.slice(t).length;if(i%o!==0)throw new Error(`The remainder of the byte array (${i} bytes) cannot be split into chunks of ${o} bytes. Codecs of "remainder" size must have a remainder that is a multiple of its item size. In other words, ${i} modulo ${o} should be equal to zero.`);return [i/o,t]}throw new Error(`Unrecognized array-like codec size: ${JSON.stringify(e)}`)}function Wn(e){return typeof e=="object"?e.description:`${e}`}function De(e,n){if(typeof e!="number")return null;if(e===0)return 0;let r=F(n);return r===null?null:r*e}function Pn(e,n){return typeof e=="object"?e.encode(n):new Uint8Array}function Vn(e,n,r){if(n!==r)throw new Error(`Expected [${e}] to have ${n} items, got ${r}.`)}function Be(e,n,r){if(n==="remainder"&&e.fixedSize===null)throw new Error('Codecs of "remainder" size must have fixed-size items.');return {description:r??`array(${e.description}; ${Wn(n)})`,fixedSize:De(n,[e.fixedSize]),maxSize:De(n,[e.maxSize])}}function A(e,n={}){let r=n.size??O();return {...Be(e,r,n.description),encode:t=>(typeof r=="number"&&Vn("array",r,t.length),N([Pn(r,t.length),...t.map(o=>e.encode(o))]))}}function h(e,n={}){let r=n.size??$();return {...Be(e,r,n.description),decode:(t,o=0)=>{if(typeof r=="object"&&t.slice(o).length===0)return [[],o];let[i,s]=$n(r,[e.fixedSize],t,o);o=s;let c=[];for(let u=0;u<i;u+=1){let[a,l]=e.decode(t,o);c.push(a),o=l;}return [c,o]}}}function H(e={}){let n=e.size??"variable",r=typeof n=="object"?n.description:`${n}`,t=e.description??`bytes(${r})`,o={description:t,encode:i=>i,fixedSize:null,maxSize:null};return n==="variable"?o:typeof n=="number"?M(o,n,t):{...o,encode:i=>{let s=o.encode(i),c=n.encode(s.length);return N([c,s])}}}function K(e={}){let n=e.size??"variable",r=typeof n=="object"?n.description:`${n}`,t=e.description??`bytes(${r})`,o={decode:(i,s=0)=>{let c=i.slice(s);return [c,s+c.length]},description:t,fixedSize:null,maxSize:null};return n==="variable"?o:typeof n=="number"?U(o,n,t):{...o,decode:(i,s=0)=>{v("bytes",i,s);let[c,u]=n.decode(i,s),a=Number(c);s=u;let l=i.slice(s,s+a);w("bytes",a,l);let[p,Cn]=o.decode(l);return s+=Cn,[p,s]}}}function ve(e,n){let r=e.map(([t,o])=>`${String(t)}: ${o.description}`).join(", ");return {description:n??`struct(${r})`,fixedSize:F(e.map(([,t])=>t.fixedSize)),maxSize:F(e.map(([,t])=>t.maxSize))}}function b(e,n={}){return {...ve(e,n.description),encode:r=>{let t=e.map(([o,i])=>i.encode(r[o]));return N(t)}}}function S(e,n={}){return {...ve(e,n.description),decode:(r,t=0)=>{let o={};return e.forEach(([i,s])=>{let[c,u]=s.decode(r,t);t=u,o[i]=c;}),[o,t]}}}function Ne(){if(!globalThis.isSecureContext)throw new Error("Cryptographic operations are only allowed in secure browser contexts. Read more here: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts")}async function ke(){if(Ne(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.exportKey!="function")throw new Error("No key export implementation could be found")}async function _e(){if(Ne(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.sign!="function")throw new Error("No signing implementation could be found")}var Q,ee;function Le(){return Q||(Q=k()),Q}function Fn(){return ee||(ee=_()),ee}function j(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=Le().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 Hn(e){return j(e),e}function Y(e){return z(W({description:e?.description??"Address",encoding:Le(),size:32}),n=>Hn(n))}function L(e){return P({description:e?.description??"Address",encoding:Fn(),size:32})}function R(){return new Intl.Collator("en",{caseFirst:"lower",ignorePunctuation:!1,localeMatcher:"best fit",numeric:!1,sensitivity:"variant",usage:"sort"}).compare}async function Re(e){if(await ke(),e.type!=="public"||e.algorithm.name!=="Ed25519")throw new Error("The `CryptoKey` must be an `Ed25519` public key");let n=await crypto.subtle.exportKey("raw",e),[r]=L().decode(new Uint8Array(n));return r}function Me(e,n,r){e[n]=r(e[n]??{role:g.READONLY});}var f=Symbol("AddressMapTypeProperty");function Ue(e,n){let r={[e]:{[f]:0,role:g.WRITABLE_SIGNER}},t=new Set;for(let o of n){Me(r,o.programAddress,s=>{if(t.add(o.programAddress),f in s){if(B(s.role))switch(s[f]){case 0:throw new Error(`This transaction includes an address (\`${o.programAddress}\`) which is both invoked and set as the fee payer. Program addresses may not pay fees.`);default:throw new Error(`This transaction includes an address (\`${o.programAddress}\`) which is both invoked and marked writable. Program addresses may not be writable.`)}if(s[f]===2)return s}return {[f]:2,role:g.READONLY}});let i;if(o.accounts)for(let s of o.accounts)Me(r,s.address,c=>{let{address:u,...a}=s;if(f in c)switch(c[f]){case 0:return c;case 1:{let l=J(c.role,a.role);if("lookupTableAddress"in a){if(c.lookupTableAddress!==a.lookupTableAddress&&(i||(i=R()))(a.lookupTableAddress,c.lookupTableAddress)<0)return {[f]:1,...a,role:l}}else if(y(a.role))return {[f]:2,role:l};return c.role!==l?{...c,role:l}:c}case 2:{let l=J(c.role,a.role);if(t.has(s.address)){if(B(a.role))throw new Error(`This transaction includes an address (\`${s.address}\`) which is both invoked and marked writable. Program addresses may not be writable.`);return c.role!==l?{...c,role:l}:c}else return "lookupTableAddress"in a&&!y(c.role)?{...a,[f]:1,role:l}:c.role!==l?{...c,role:l}:c}}return "lookupTableAddress"in a?{...a,[f]:1}:{...a,[f]:2}});}return r}function Oe(e){let n;return Object.entries(e).sort(([t,o],[i,s])=>{if(o[f]!==s[f]){if(o[f]===0)return -1;if(s[f]===0)return 1;if(o[f]===2)return -1;if(s[f]===2)return 1}let c=y(o.role);if(c!==y(s.role))return c?-1:1;let u=B(o.role);return u!==B(s.role)?u?-1:1:(n||(n=R()),o[f]===1&&s[f]===1&&o.lookupTableAddress!==s.lookupTableAddress?n(o.lookupTableAddress,s.lookupTableAddress):n(t,i))}).map(([t,o])=>({address:t,...o}))}function $e(e){var r;let n={};for(let t of e){if(!("lookupTableAddress"in t))continue;let o=n[r=t.lookupTableAddress]||(n[r]={readableIndices:[],writableIndices:[]});t.role===g.WRITABLE?o.writableIndices.push(t.addressIndex):o.readableIndices.push(t.addressIndex);}return Object.keys(n).sort(R()).map(t=>({lookupTableAddress:t,...n[t]}))}function We(e){let n=0,r=0,t=0;for(let o of e){if("lookupTableAddress"in o)break;let i=B(o.role);y(o.role)?(t++,i||r++):i||n++;}return {numReadonlyNonSignerAccounts:n,numReadonlySignerAccounts:r,numSignerAccounts:t}}function Kn(e){let n={};for(let[r,t]of e.entries())n[t.address]=r;return n}function Pe(e,n){let r=Kn(n);return e.map(({accounts:t,data:o,programAddress:i})=>({programAddressIndex:r[i],...t?{accountIndices:t.map(({address:s})=>r[s])}:null,...o?{data:o}:null}))}function Ve(e){return "nonce"in e?e.nonce:e.blockhash}function Fe(e){let n=e.findIndex(t=>"lookupTableAddress"in t);return (n===-1?e:e.slice(0,n)).map(({address:t})=>t)}function G(e){let n=Ue(e.feePayer,e.instructions),r=Oe(n);return {...e.version!=="legacy"?{addressTableLookups:$e(r)}:null,header:We(r),instructions:Pe(e.instructions,r),lifetimeToken:Ve(e.lifetimeConstraint),staticAccounts:Fe(r),version:e.version}}function He(e){let n=G(e),r;if("signatures"in e){r=[];for(let t=0;t<n.header.numSignerAccounts;t++)r[t]=e.signatures[n.staticAccounts[t]]??new Uint8Array(Array(64).fill(0));}else r=Array(n.header.numSignerAccounts).fill(new Uint8Array(Array(64).fill(0)));return {compiledMessage:n,signatures:r}}function Ke(e,...n){return n.reduce((r,t)=>t(r),e)}function jn(e){let{header:n}=e,r=n.numSignerAccounts-n.numReadonlySignerAccounts,t=e.staticAccounts.length-n.numSignerAccounts-n.numReadonlyNonSignerAccounts,o=[],i=0;for(let s=0;s<r;s++)o.push({address:e.staticAccounts[i],role:g.WRITABLE_SIGNER}),i++;for(let s=0;s<n.numReadonlySignerAccounts;s++)o.push({address:e.staticAccounts[i],role:g.READONLY_SIGNER}),i++;for(let s=0;s<t;s++)o.push({address:e.staticAccounts[i],role:g.WRITABLE}),i++;for(let s=0;s<n.numReadonlyNonSignerAccounts;s++)o.push({address:e.staticAccounts[i],role:g.READONLY}),i++;return o}function Yn(e,n){let r=n[e.programAddressIndex]?.address;if(!r)throw new Error(`Could not find program address at index ${e.programAddressIndex}`);let t=e.accountIndices?.map(i=>n[i]),{data:o}=e;return {programAddress:r,...t&&t.length?{accounts:t}:{},...o&&o.length?{data:o}:{}}}function Gn(e,n,r){if(!n||!V(n))return {blockhash:e,lastValidBlockHeight:r??2n**64n-1n};{let t=n.accounts[0].address;j(t);let o=n.accounts[2].address;return j(o),{nonce:e,nonceAccountAddress:t,nonceAuthorityAddress:o}}}function qn(e){let{compiledMessage:{staticAccounts:n},signatures:r}=e;return r.reduce((t,o,i)=>{if(o.every(u=>u===0))return t;let c=n[i];return {...t,[c]:o}},{})}function je(e,n){let{compiledMessage:r}=e;if("addressTableLookups"in r&&r.addressTableLookups.length>0)throw new Error("Cannot convert transaction with addressTableLookups");let t=r.staticAccounts[0];if(!t)throw new Error("No fee payer set in CompiledTransaction");let o=jn(r),i=r.instructions.map(a=>Yn(a,o)),s=i[0],c=Gn(r.lifetimeToken,s,n),u=qn(e);return Ke(be({version:r.version}),a=>ze(t,a),a=>i.reduce((l,p)=>we(p,l),a),a=>"blockhash"in c?he(c,a):Ce(c,a),a=>e.signatures.length?{...a,signatures:u}:a)}var Ye="lookupTableAddress",Ge="writableIndices",qe="readableIndices",Xe="addressTableLookup",ne;function Ze(){return ne||(ne=b([["lookupTableAddress",Y({description:Ye})],["writableIndices",A(x(),{description:Ge,size:m()})],["readableIndices",A(x(),{description:qe,size:m()})]],{description:Xe})),ne}var re;function Je(){return re||(re=S([["lookupTableAddress",L({description:Ye})],["writableIndices",h(E(),{description:Ge,size:T()})],["readableIndices",h(E(),{description:qe,size:T()})]],{description:Xe})),re}var te;function Xn(){return te||(te=x()),te}function oe(e){let n=Xn();return {...n,description:e??n.description}}var ie;function Zn(){return ie||(ie=E()),ie}function se(e){let n=Zn();return {...n,description:e??n.description}}var Qe=void 0,en=void 0,nn=void 0,rn=void 0;function tn(){return b([["numSignerAccounts",oe(Qe)],["numReadonlySignerAccounts",oe(en)],["numReadonlyNonSignerAccounts",oe(nn)]],{description:rn})}function on(){return S([["numSignerAccounts",se(Qe)],["numReadonlySignerAccounts",se(en)],["numReadonlyNonSignerAccounts",se(nn)]],{description:rn})}var sn="programAddressIndex",cn=void 0,an="accountIndices",dn="data",ce;function un(){return ce||(ce=z(b([["programAddressIndex",x({description:sn})],["accountIndices",A(x({description:cn}),{description:an,size:m()})],["data",H({description:dn,size:m()})]]),e=>e.accountIndices!==void 0&&e.data!==void 0?e:{...e,accountIndices:e.accountIndices??[],data:e.data??new Uint8Array(0)})),ce}var ae;function ln(){return ae||(ae=D(S([["programAddressIndex",E({description:sn})],["accountIndices",h(E({description:cn}),{description:an,size:T()})],["data",K({description:dn,size:T()})]]),e=>{if(e.accountIndices.length&&e.data.byteLength)return e;let{accountIndices:n,data:r,...t}=e;return {...t,...n.length?{accountIndices:n}:null,...r.byteLength?{data:r}:null}})),ae}var de=128,fn={description:"",fixedSize:null,maxSize:1};function Jn(e,n=0){let r=e[n];return r&de?[r^de,n+1]:["legacy",n]}function Qn(e){if(e==="legacy")return new Uint8Array;if(e<0||e>127)throw new Error(`Transaction version must be in the range [0, 127]. \`${e}\` given.`);return new Uint8Array([e|de])}function gn(){return {...fn,decode:Jn}}function pn(){return {...fn,encode:Qn}}var mn="staticAccounts",Tn="lifetimeToken",yn="instructions",An="addressTableLookups";function er(){return b(hn())}function nr(){return z(b([...hn(),["addressTableLookups",tr()]]),e=>e.version==="legacy"?e:{...e,addressTableLookups:e.addressTableLookups??[]})}function hn(){return [["version",pn()],["header",tn()],["staticAccounts",A(Y(),{description:mn,size:m()})],["lifetimeToken",W({description:Tn,encoding:k(),size:32})],["instructions",A(un(),{description:yn,size:m()})]]}function rr(){return [["version",gn()],["header",on()],["staticAccounts",h(L(),{description:mn,size:T()})],["lifetimeToken",P({description:Tn,encoding:_(),size:32})],["instructions",h(ln(),{description:yn,size:T()})],["addressTableLookups",or()]]}function tr(){return A(Ze(),{description:An,size:m()})}function or(){return h(Je(),{description:An,size:T()})}var bn="message";function q(){return {description:bn,encode:e=>e.version==="legacy"?er().encode(e):nr().encode(e),fixedSize:null,maxSize:null}}function Sn(){return D(S(rr(),{description:bn}),({addressTableLookups:e,...n})=>n.version==="legacy"||!e?.length?n:{...n,addressTableLookups:e})}var xn="signatures",En="transaction";function ir(){return b([["signatures",A(H({size:64}),{description:xn,size:m()})],["compiledMessage",q()]],{description:En})}function sr(){return D(K({size:64}),e=>e)}function cr(){return S([["signatures",h(sr(),{description:xn,size:T()})],["compiledMessage",Sn()]],{description:En})}function ue(){return z(ir(),He)}function ar(e){return D(cr(),n=>je(n,e))}function ci(e){return C(ue(),ar(e))}async function In(e,n){await _e();let r=await crypto.subtle.sign("Ed25519",e,n);return new Uint8Array(r)}var le;function Ii(e){le||(le=_());let n=e.signatures[e.feePayer];if(!n)throw new Error("Could not determine this transaction's signature. Make sure that the transaction has been signed by its fee payer.");return le.decode(n)[0]}async function dr(e,n){let r=G(n),t="signatures"in n?{...n.signatures}:{},o=q().encode(r),i=await Promise.all(e.map(c=>Promise.all([Re(c.publicKey),In(c.privateKey,o)])));for(let[c,u]of i)t[c]=u;let s={...n,signatures:t};return Object.freeze(s),s}async function Ci(e,n){let r=await dr(e,n);return ur(r),Object.freeze(r),r}function ur(e){let n=e.instructions.flatMap(t=>t.accounts?.filter(o=>y(o.role))??[]).map(t=>t.address);new Set([e.feePayer,...n]).forEach(t=>{if(!e.signatures[t])throw new Error(`Transaction is missing signature for address \`${t}\``)});}function Bi(e){let n=ue().encode(e);return btoa(String.fromCharCode(...n))}
6
6
 
7
- exports.appendTransactionInstruction = xe;
8
- exports.assertIsBlockhash = kr;
9
- exports.assertIsDurableNonceTransaction = qr;
10
- exports.assertIsTransactionSignature = gr;
11
- exports.assertTransactionIsFullySigned = Vi;
12
- exports.createTransaction = me;
13
- exports.getBase64EncodedWireTransaction = ji;
14
- exports.getSignatureFromTransaction = $i;
15
- exports.getTransactionCodec = xi;
16
- exports.getTransactionDecoder = fr;
17
- exports.getTransactionEncoder = le;
18
- exports.isAdvanceNonceAccountInstruction = M;
19
- exports.isTransactionSignature = Oi;
20
- exports.prependTransactionInstruction = nt;
21
- exports.setTransactionFeePayer = Ee;
22
- exports.setTransactionLifetimeUsingBlockhash = pe;
23
- exports.setTransactionLifetimeUsingDurableNonce = be;
24
- exports.signTransaction = Pi;
25
- exports.transactionSignature = Wi;
7
+ exports.appendTransactionInstruction = we;
8
+ exports.assertIsBlockhash = Cr;
9
+ exports.assertIsDurableNonceTransaction = Pr;
10
+ exports.assertTransactionIsFullySigned = ur;
11
+ exports.createTransaction = be;
12
+ exports.getBase64EncodedWireTransaction = Bi;
13
+ exports.getSignatureFromTransaction = Ii;
14
+ exports.getTransactionCodec = ci;
15
+ exports.getTransactionDecoder = ar;
16
+ exports.getTransactionEncoder = ue;
17
+ exports.isAdvanceNonceAccountInstruction = V;
18
+ exports.partiallySignTransaction = dr;
19
+ exports.prependTransactionInstruction = Gr;
20
+ exports.setTransactionFeePayer = ze;
21
+ exports.setTransactionLifetimeUsingBlockhash = he;
22
+ exports.setTransactionLifetimeUsingDurableNonce = Ce;
23
+ exports.signTransaction = Ci;
26
24
 
27
25
  return exports;
28
26
 
@@ -1,4 +1,4 @@
1
- import { Base58EncodedAddress } from '@solana/addresses';
1
+ import { Address } from '@solana/addresses';
2
2
  import { IAccountLookupMeta, IAccountMeta, IInstruction, ReadonlyAccount, ReadonlyAccountLookup, ReadonlySignerAccount, WritableAccount, WritableAccountLookup, WritableSignerAccount } from '@solana/instructions';
3
3
  export declare const enum AddressMapEntryType {
4
4
  FEE_PAYER = 0,
@@ -22,7 +22,7 @@ type StaticAccountEntry = Omit<ReadonlyAccount | ReadonlySignerAccount | Writabl
22
22
  };
23
23
  declare const TYPE: unique symbol;
24
24
  export declare const ADDRESS_MAP_TYPE_PROPERTY: typeof TYPE;
25
- export declare function getAddressMapFromInstructions(feePayer: Base58EncodedAddress, instructions: readonly IInstruction[]): AddressMap;
25
+ export declare function getAddressMapFromInstructions(feePayer: Address, instructions: readonly IInstruction[]): AddressMap;
26
26
  export declare function getOrderedAccountsFromAddressMap(addressMap: AddressMap): OrderedAccounts;
27
27
  export {};
28
28
  //# sourceMappingURL=accounts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accounts.d.ts","sourceRoot":"","sources":["../../src/accounts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAwB,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAEH,kBAAkB,EAClB,YAAY,EACZ,YAAY,EAIZ,eAAe,EACf,qBAAqB,EACrB,qBAAqB,EACrB,eAAe,EACf,qBAAqB,EACrB,qBAAqB,EACxB,MAAM,sBAAsB,CAAC;AAE9B,0BAAkB,mBAAmB;IACjC,SAAS,IAAA;IACT,YAAY,IAAA;IACZ,MAAM,IAAA;CACT;AAED,KAAK,UAAU,GAAG;IACd,CAAC,OAAO,EAAE,MAAM,GAAG,oBAAoB,GAAG,uBAAuB,GAAG,kBAAkB,CAAC;CAC1F,CAAC;AACF,KAAK,oBAAoB,GAAG,IAAI,CAAC,qBAAqB,EAAE,SAAS,CAAC,GAAG;IACjE,CAAC,IAAI,CAAC,EAAE,mBAAmB,CAAC,SAAS,CAAC;CACzC,CAAC;AACF,KAAK,uBAAuB,GAAG,IAAI,CAAC,qBAAqB,GAAG,qBAAqB,EAAE,SAAS,CAAC,GAAG;IAC5F,CAAC,IAAI,CAAC,EAAE,mBAAmB,CAAC,YAAY,CAAC;CAC5C,CAAC;AACF,MAAM,MAAM,eAAe,GAAG,CAAC,YAAY,GAAG,kBAAkB,CAAC,EAAE,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,OAAO,MAAM,CAAA;CAAE,CAAC;AAC1G,KAAK,kBAAkB,GAAG,IAAI,CAC1B,eAAe,GAAG,qBAAqB,GAAG,eAAe,GAAG,qBAAqB,EACjF,SAAS,CACZ,GAAG;IAAE,CAAC,IAAI,CAAC,EAAE,mBAAmB,CAAC,MAAM,CAAA;CAAE,CAAC;AAY3C,QAAA,MAAM,IAAI,eAAmC,CAAC;AAC9C,eAAO,MAAM,yBAAyB,EAAE,OAAO,IAAW,CAAC;AAE3D,wBAAgB,6BAA6B,CAAC,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,YAAY,EAAE,GAAG,UAAU,CAoJlH;AAED,wBAAgB,gCAAgC,CAAC,UAAU,EAAE,UAAU,GAAG,eAAe,CA0CxF"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blockhash.d.ts","sourceRoot":"","sources":["../../src/blockhash.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAG1C,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,OAAO,MAAM,CAAA;CAAE,CAAC;AAErE,KAAK,2BAA2B,GAAG,QAAQ,CAAC;IACxC,SAAS,EAAE,SAAS,CAAC;IACrB,oBAAoB,EAAE,MAAM,CAAC;CAChC,CAAC,CAAC;AAEH,MAAM,WAAW,iCAAiC;IAC9C,QAAQ,CAAC,kBAAkB,EAAE,2BAA2B,CAAC;CAC5D;AAID,wBAAgB,iBAAiB,CAAC,iBAAiB,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,IAAI,SAAS,CAuBnG;AAED,wBAAgB,oCAAoC,CAAC,YAAY,SAAS,eAAe,GAAG,wBAAwB,EAChH,2BAA2B,EAAE,2BAA2B,EACxD,WAAW,EAAE,YAAY,GAAG,CAAC,YAAY,GAAG,0BAA0B,CAAC,GACxE,IAAI,CAAC,YAAY,EAAE,MAAM,0BAA0B,GAAG,oBAAoB,CAAC,GAAG,iCAAiC,CAAC;AAEnH,wBAAgB,oCAAoC,CAChD,YAAY,SAAS,eAAe,GAAG,CAAC,eAAe,GAAG,iCAAiC,CAAC,EAE5F,2BAA2B,EAAE,2BAA2B,EACxD,WAAW,EAAE,YAAY,GAAG,CAAC,YAAY,GAAG,0BAA0B,CAAC,GACxE,IAAI,CAAC,YAAY,EAAE,MAAM,0BAA0B,CAAC,GAAG,iCAAiC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { IInstruction } from '@solana/instructions';
2
+ import { ITransactionWithBlockhashLifetime } from './blockhash';
3
+ import { IDurableNonceTransaction } from './durable-nonce';
4
+ import { ITransactionWithFeePayer } from './fee-payer';
5
+ import { BaseTransaction, TransactionVersion } from './types';
6
+ export type CompilableTransaction<TVersion extends TransactionVersion = TransactionVersion, TInstruction extends IInstruction = IInstruction> = BaseTransaction<TVersion, TInstruction> & ITransactionWithFeePayer & (ITransactionWithBlockhashLifetime | IDurableNonceTransaction);
7
+ //# sourceMappingURL=compilable-transaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compilable-transaction.d.ts","sourceRoot":"","sources":["../../src/compilable-transaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,OAAO,EAAE,iCAAiC,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE9D,MAAM,MAAM,qBAAqB,CAC7B,QAAQ,SAAS,kBAAkB,GAAG,kBAAkB,EACxD,YAAY,SAAS,YAAY,GAAG,YAAY,IAChD,eAAe,CAAC,QAAQ,EAAE,YAAY,CAAC,GACvC,wBAAwB,GACxB,CAAC,iCAAiC,GAAG,wBAAwB,CAAC,CAAC"}
@@ -1,7 +1,7 @@
1
- import { Base58EncodedAddress } from '@solana/addresses';
1
+ import { Address } from '@solana/addresses';
2
2
  import { OrderedAccounts } from './accounts';
3
3
  type AddressTableLookup = Readonly<{
4
- lookupTableAddress: Base58EncodedAddress;
4
+ lookupTableAddress: Address;
5
5
  readableIndices: readonly number[];
6
6
  writableIndices: readonly number[];
7
7
  }>;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compile-address-table-lookups.d.ts","sourceRoot":"","sources":["../../src/compile-address-table-lookups.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAwB,MAAM,mBAAmB,CAAC;AAGlE,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,KAAK,kBAAkB,GAAG,QAAQ,CAAC;IAC/B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,eAAe,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,eAAe,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC,CAAC,CAAC;AAEH,wBAAgB,8BAA8B,CAAC,eAAe,EAAE,eAAe,GAAG,kBAAkB,EAAE,CAsBrG"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compile-header.d.ts","sourceRoot":"","sources":["../../src/compile-header.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,KAAK,aAAa,GAAG,QAAQ,CAAC;IAC1B,4BAA4B,EAAE,MAAM,CAAC;IACrC,yBAAyB,EAAE,MAAM,CAAC;IAClC,iBAAiB,EAAE,MAAM,CAAC;CAC7B,CAAC,CAAC;AAEH,wBAAgB,wBAAwB,CAAC,eAAe,EAAE,eAAe,GAAG,aAAa,CAuBxF"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compile-instructions.d.ts","sourceRoot":"","sources":["../../src/compile-instructions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,KAAK,mBAAmB,GAAG,QAAQ,CAAC;IAChC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,mBAAmB,EAAE,MAAM,CAAC;CAC/B,CAAC,CAAC;AAUH,wBAAgB,uBAAuB,CACnC,YAAY,EAAE,SAAS,YAAY,EAAE,EACrC,eAAe,EAAE,eAAe,GACjC,mBAAmB,EAAE,CASvB"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compile-lifetime-token.d.ts","sourceRoot":"","sources":["../../src/compile-lifetime-token.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,iCAAiC,EAAE,MAAM,SAAS,CAAC;AAEtF,wBAAgB,wBAAwB,CACpC,kBAAkB,EAAE,CAAC,iCAAiC,GAAG,wBAAwB,CAAC,CAAC,oBAAoB,CAAC,GACzG,MAAM,CAKR"}
@@ -1,4 +1,4 @@
1
- import { Base58EncodedAddress } from '@solana/addresses';
1
+ import { Address } from '@solana/addresses';
2
2
  import { OrderedAccounts } from './accounts';
3
- export declare function getCompiledStaticAccounts(orderedAccounts: OrderedAccounts): Base58EncodedAddress[];
3
+ export declare function getCompiledStaticAccounts(orderedAccounts: OrderedAccounts): Address[];
4
4
  //# sourceMappingURL=compile-static-accounts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compile-static-accounts.d.ts","sourceRoot":"","sources":["../../src/compile-static-accounts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,wBAAgB,yBAAyB,CAAC,eAAe,EAAE,eAAe,GAAG,OAAO,EAAE,CAKrF"}
@@ -1,11 +1,10 @@
1
- import { Ed25519Signature } from '@solana/keys';
2
- import { CompiledMessage, compileMessage } from './message';
1
+ import { SignatureBytes } from '@solana/keys';
2
+ import { CompilableTransaction } from './compilable-transaction';
3
+ import { CompiledMessage } from './message';
3
4
  import { ITransactionWithSignatures } from './signatures';
4
- type CompiledTransaction = Readonly<{
5
+ export type CompiledTransaction = Readonly<{
5
6
  compiledMessage: CompiledMessage;
6
- signatures: Ed25519Signature[];
7
+ signatures: SignatureBytes[];
7
8
  }>;
8
- type CompilableTransaction = Parameters<typeof compileMessage>[0];
9
9
  export declare function getCompiledTransaction(transaction: CompilableTransaction | (CompilableTransaction & ITransactionWithSignatures)): CompiledTransaction;
10
- export {};
11
10
  //# sourceMappingURL=compile-transaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compile-transaction.d.ts","sourceRoot":"","sources":["../../src/compile-transaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAkB,MAAM,WAAW,CAAC;AAC5D,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAE1D,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC;IACvC,eAAe,EAAE,eAAe,CAAC;IACjC,UAAU,EAAE,cAAc,EAAE,CAAC;CAChC,CAAC,CAAC;AAEH,wBAAgB,sBAAsB,CAClC,WAAW,EAAE,qBAAqB,GAAG,CAAC,qBAAqB,GAAG,0BAA0B,CAAC,GAC1F,mBAAmB,CAgBrB"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-transaction.d.ts","sourceRoot":"","sources":["../../src/create-transaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE1D,KAAK,iBAAiB,CAAC,QAAQ,SAAS,kBAAkB,IAAI,QAAQ,CAAC;IACnE,OAAO,EAAE,QAAQ,CAAC;CACrB,CAAC,CAAC;AAEH,wBAAgB,iBAAiB,CAAC,QAAQ,SAAS,kBAAkB,EACjE,MAAM,EAAE,iBAAiB,CAAC,QAAQ,CAAC,GACpC,OAAO,CAAC,WAAW,EAAE;IAAE,OAAO,EAAE,QAAQ,CAAA;CAAE,CAAC,CAAC"}
@@ -1,7 +1,5 @@
1
- import { getCompiledTransaction } from './compile-transaction';
1
+ import { CompilableTransaction } from './compilable-transaction';
2
+ import { CompiledTransaction } from './compile-transaction';
2
3
  import { ITransactionWithSignatures } from './signatures';
3
- type CompiledTransaction = ReturnType<typeof getCompiledTransaction>;
4
- type CompilableTransaction = Parameters<typeof getCompiledTransaction>[0];
5
4
  export declare function decompileTransaction(compiledTransaction: CompiledTransaction, lastValidBlockHeight?: bigint): CompilableTransaction | (CompilableTransaction & ITransactionWithSignatures);
6
- export {};
7
5
  //# sourceMappingURL=decompile-transaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decompile-transaction.d.ts","sourceRoot":"","sources":["../../src/decompile-transaction.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAM5D,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAyH1D,wBAAgB,oBAAoB,CAChC,mBAAmB,EAAE,mBAAmB,EACxC,oBAAoB,CAAC,EAAE,MAAM,GAC9B,qBAAqB,GAAG,CAAC,qBAAqB,GAAG,0BAA0B,CAAC,CAyC9E"}
@@ -1,4 +1,4 @@
1
- import { Base58EncodedAddress } from '@solana/addresses';
1
+ import { Address } from '@solana/addresses';
2
2
  import { IInstruction, IInstructionWithAccounts, IInstructionWithData, ReadonlyAccount, ReadonlySignerAccount, WritableAccount, WritableSignerAccount } from '@solana/instructions';
3
3
  import { ITransactionWithSignatures } from './signatures';
4
4
  import { BaseTransaction } from './types';
@@ -12,8 +12,8 @@ type AdvanceNonceAccountInstructionData = Uint8Array & {
12
12
  };
13
13
  type DurableNonceConfig<TNonceAccountAddress extends string = string, TNonceAuthorityAddress extends string = string, TNonceValue extends string = string> = Readonly<{
14
14
  readonly nonce: Nonce<TNonceValue>;
15
- readonly nonceAccountAddress: Base58EncodedAddress<TNonceAccountAddress>;
16
- readonly nonceAuthorityAddress: Base58EncodedAddress<TNonceAuthorityAddress>;
15
+ readonly nonceAccountAddress: Address<TNonceAccountAddress>;
16
+ readonly nonceAuthorityAddress: Address<TNonceAuthorityAddress>;
17
17
  }>;
18
18
  export type Nonce<TNonceValue extends string = string> = TNonceValue & {
19
19
  readonly __brand: unique symbol;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"durable-nonce.d.ts","sourceRoot":"","sources":["../../src/durable-nonce.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAEH,YAAY,EACZ,wBAAwB,EACxB,oBAAoB,EAEpB,eAAe,EACf,qBAAqB,EACrB,eAAe,EACf,qBAAqB,EACxB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAG1C,KAAK,8BAA8B,CAC/B,oBAAoB,SAAS,MAAM,GAAG,MAAM,EAC5C,sBAAsB,SAAS,MAAM,GAAG,MAAM,IAC9C,YAAY,CAAC,kCAAkC,CAAC,GAChD,wBAAwB,CACpB,SAAS;IACL,eAAe,CAAC,oBAAoB,CAAC;IACrC,eAAe,CAAC,6CAA6C,CAAC;IAC9D,qBAAqB,CAAC,sBAAsB,CAAC,GAAG,qBAAqB,CAAC,sBAAsB,CAAC;CAChG,CACJ,GACD,oBAAoB,CAAC,kCAAkC,CAAC,CAAC;AAC7D,KAAK,kCAAkC,GAAG,UAAU,GAAG;IACnD,QAAQ,CAAC,OAAO,EAAE,OAAO,MAAM,CAAC;CACnC,CAAC;AACF,KAAK,kBAAkB,CACnB,oBAAoB,SAAS,MAAM,GAAG,MAAM,EAC5C,sBAAsB,SAAS,MAAM,GAAG,MAAM,EAC9C,WAAW,SAAS,MAAM,GAAG,MAAM,IACnC,QAAQ,CAAC;IACT,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;IACnC,QAAQ,CAAC,mBAAmB,EAAE,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAC5D,QAAQ,CAAC,qBAAqB,EAAE,OAAO,CAAC,sBAAsB,CAAC,CAAC;CACnE,CAAC,CAAC;AACH,MAAM,MAAM,KAAK,CAAC,WAAW,SAAS,MAAM,GAAG,MAAM,IAAI,WAAW,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,OAAO,MAAM,CAAA;CAAE,CAAC;AAC3G,KAAK,uBAAuB,CAAC,WAAW,SAAS,MAAM,GAAG,MAAM,IAAI,QAAQ,CAAC;IACzE,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;CAC7B,CAAC,CAAC;AAMH,MAAM,WAAW,wBAAwB,CACrC,oBAAoB,SAAS,MAAM,GAAG,MAAM,EAC5C,sBAAsB,SAAS,MAAM,GAAG,MAAM,EAC9C,WAAW,SAAS,MAAM,GAAG,MAAM;IAEnC,QAAQ,CAAC,YAAY,EAAE,SAAS;QAE5B,8BAA8B,CAAC,oBAAoB,EAAE,sBAAsB,CAAC;QAC5E,GAAG,YAAY,EAAE;KACpB,CAAC;IACF,QAAQ,CAAC,kBAAkB,EAAE,uBAAuB,CAAC,WAAW,CAAC,CAAC;CACrE;AAED,wBAAgB,+BAA+B,CAC3C,WAAW,EAAE,eAAe,GAAG,CAAC,eAAe,GAAG,wBAAwB,CAAC,GAC5E,OAAO,CAAC,WAAW,IAAI,eAAe,GAAG,wBAAwB,CAKnE;AAuBD,wBAAgB,gCAAgC,CAC5C,WAAW,EAAE,YAAY,GAC1B,WAAW,IAAI,8BAA8B,CAkB/C;AAgCD,wBAAgB,uCAAuC,CACnD,YAAY,SAAS,eAAe,EACpC,oBAAoB,SAAS,MAAM,GAAG,MAAM,EAC5C,sBAAsB,SAAS,MAAM,GAAG,MAAM,EAC9C,WAAW,SAAS,MAAM,GAAG,MAAM,EAEnC,EACI,KAAK,EACL,mBAAmB,EACnB,qBAAqB,GACxB,EAAE,kBAAkB,CAAC,oBAAoB,EAAE,sBAAsB,EAAE,WAAW,CAAC,EAChF,WAAW,EAAE,YAAY,GAAG,CAAC,YAAY,GAAG,wBAAwB,CAAC,GACtE,IAAI,CAAC,YAAY,EAAE,MAAM,0BAA0B,CAAC,GACnD,wBAAwB,CAAC,oBAAoB,EAAE,sBAAsB,EAAE,WAAW,CAAC,CAwCtF"}
@@ -1,9 +1,9 @@
1
- import { Base58EncodedAddress } from '@solana/addresses';
1
+ import { Address } from '@solana/addresses';
2
2
  import { ITransactionWithSignatures } from './signatures';
3
3
  import { BaseTransaction } from './types';
4
4
  export interface ITransactionWithFeePayer<TAddress extends string = string> {
5
- readonly feePayer: Base58EncodedAddress<TAddress>;
5
+ readonly feePayer: Address<TAddress>;
6
6
  }
7
- export declare function setTransactionFeePayer<TFeePayerAddress extends string, TTransaction extends BaseTransaction>(feePayer: Base58EncodedAddress<TFeePayerAddress>, transaction: (TTransaction & ITransactionWithSignatures) | (TTransaction & ITransactionWithFeePayer<string> & ITransactionWithSignatures)): Omit<TTransaction, keyof ITransactionWithSignatures> & ITransactionWithFeePayer<TFeePayerAddress>;
8
- export declare function setTransactionFeePayer<TFeePayerAddress extends string, TTransaction extends BaseTransaction>(feePayer: Base58EncodedAddress<TFeePayerAddress>, transaction: TTransaction | (TTransaction & ITransactionWithFeePayer<string>)): TTransaction & ITransactionWithFeePayer<TFeePayerAddress>;
7
+ export declare function setTransactionFeePayer<TFeePayerAddress extends string, TTransaction extends BaseTransaction>(feePayer: Address<TFeePayerAddress>, transaction: (TTransaction & ITransactionWithSignatures) | (TTransaction & ITransactionWithFeePayer<string> & ITransactionWithSignatures)): Omit<TTransaction, keyof ITransactionWithSignatures> & ITransactionWithFeePayer<TFeePayerAddress>;
8
+ export declare function setTransactionFeePayer<TFeePayerAddress extends string, TTransaction extends BaseTransaction>(feePayer: Address<TFeePayerAddress>, transaction: TTransaction | (TTransaction & ITransactionWithFeePayer<string>)): TTransaction & ITransactionWithFeePayer<TFeePayerAddress>;
9
9
  //# sourceMappingURL=fee-payer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fee-payer.d.ts","sourceRoot":"","sources":["../../src/fee-payer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAG1C,MAAM,WAAW,wBAAwB,CAAC,QAAQ,SAAS,MAAM,GAAG,MAAM;IACtE,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;CACxC;AAED,wBAAgB,sBAAsB,CAAC,gBAAgB,SAAS,MAAM,EAAE,YAAY,SAAS,eAAe,EACxG,QAAQ,EAAE,OAAO,CAAC,gBAAgB,CAAC,EACnC,WAAW,EACL,CAAC,YAAY,GAAG,0BAA0B,CAAC,GAC3C,CAAC,YAAY,GAAG,wBAAwB,CAAC,MAAM,CAAC,GAAG,0BAA0B,CAAC,GACrF,IAAI,CAAC,YAAY,EAAE,MAAM,0BAA0B,CAAC,GAAG,wBAAwB,CAAC,gBAAgB,CAAC,CAAC;AAErG,wBAAgB,sBAAsB,CAAC,gBAAgB,SAAS,MAAM,EAAE,YAAY,SAAS,eAAe,EACxG,QAAQ,EAAE,OAAO,CAAC,gBAAgB,CAAC,EACnC,WAAW,EAAE,YAAY,GAAG,CAAC,YAAY,GAAG,wBAAwB,CAAC,MAAM,CAAC,CAAC,GAC9E,YAAY,GAAG,wBAAwB,CAAC,gBAAgB,CAAC,CAAC"}
@@ -1,4 +1,5 @@
1
1
  export * from './blockhash';
2
+ export * from './compilable-transaction';
2
3
  export * from './create-transaction';
3
4
  export * from './durable-nonce';
4
5
  export * from './fee-payer';
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instructions.d.ts","sourceRoot":"","sources":["../../src/instructions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAG1C,wBAAgB,4BAA4B,CAAC,YAAY,SAAS,eAAe,EAC7E,WAAW,EAAE,YAAY,CAAC,cAAc,CAAC,CAAC,MAAM,CAAC,EACjD,WAAW,EAAE,YAAY,GAAG,CAAC,YAAY,GAAG,0BAA0B,CAAC,GACxE,YAAY,GAAG,IAAI,CAAC,YAAY,EAAE,MAAM,0BAA0B,CAAC,CAOrE;AAED,wBAAgB,6BAA6B,CAAC,YAAY,SAAS,eAAe,EAC9E,WAAW,EAAE,YAAY,CAAC,cAAc,CAAC,CAAC,MAAM,CAAC,EACjD,WAAW,EAAE,YAAY,GAAG,CAAC,YAAY,GAAG,0BAA0B,CAAC,GACxE,YAAY,GAAG,IAAI,CAAC,YAAY,EAAE,MAAM,0BAA0B,CAAC,CAOrE"}
@@ -1,19 +1,15 @@
1
- import { ITransactionWithBlockhashLifetime } from './blockhash';
1
+ import { CompilableTransaction } from './compilable-transaction';
2
2
  import { getCompiledAddressTableLookups } from './compile-address-table-lookups';
3
3
  import { getCompiledMessageHeader } from './compile-header';
4
4
  import { getCompiledInstructions } from './compile-instructions';
5
5
  import { getCompiledLifetimeToken } from './compile-lifetime-token';
6
6
  import { getCompiledStaticAccounts } from './compile-static-accounts';
7
- import { IDurableNonceTransaction } from './durable-nonce';
8
- import { ITransactionWithFeePayer } from './fee-payer';
9
- import { BaseTransaction } from './types';
10
7
  type BaseCompiledMessage = Readonly<{
11
8
  header: ReturnType<typeof getCompiledMessageHeader>;
12
9
  instructions: ReturnType<typeof getCompiledInstructions>;
13
10
  lifetimeToken: ReturnType<typeof getCompiledLifetimeToken>;
14
11
  staticAccounts: ReturnType<typeof getCompiledStaticAccounts>;
15
12
  }>;
16
- type CompilableTransaction = BaseTransaction & ITransactionWithFeePayer & (ITransactionWithBlockhashLifetime | IDurableNonceTransaction);
17
13
  export type CompiledMessage = LegacyCompiledMessage | VersionedCompiledMessage;
18
14
  type LegacyCompiledMessage = BaseCompiledMessage & Readonly<{
19
15
  version: 'legacy';
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../src/message.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,8BAA8B,EAAE,MAAM,iCAAiC,CAAC;AACjF,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAEtE,KAAK,mBAAmB,GAAG,QAAQ,CAAC;IAChC,MAAM,EAAE,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC;IACpD,YAAY,EAAE,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC;IACzD,aAAa,EAAE,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC;IAC3D,cAAc,EAAE,UAAU,CAAC,OAAO,yBAAyB,CAAC,CAAC;CAChE,CAAC,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,qBAAqB,GAAG,wBAAwB,CAAC;AAE/E,KAAK,qBAAqB,GAAG,mBAAmB,GAC5C,QAAQ,CAAC;IACL,OAAO,EAAE,QAAQ,CAAC;CACrB,CAAC,CAAC;AAEP,KAAK,wBAAwB,GAAG,mBAAmB,GAC/C,QAAQ,CAAC;IACL,mBAAmB,CAAC,EAAE,UAAU,CAAC,OAAO,8BAA8B,CAAC,CAAC;IACxE,OAAO,EAAE,MAAM,CAAC;CACnB,CAAC,CAAC;AAEP,wBAAgB,cAAc,CAC1B,WAAW,EAAE,qBAAqB,GAAG,QAAQ,CAAC;IAAE,OAAO,EAAE,QAAQ,CAAA;CAAE,CAAC,GACrE,qBAAqB,CAAC;AACzB,wBAAgB,cAAc,CAAC,WAAW,EAAE,qBAAqB,GAAG,wBAAwB,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"address-table-lookup.d.ts","sourceRoot":"","sources":["../../../src/serializers/address-table-lookup.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,KAAK,EAAgB,KAAK,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAI3F,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAEvF,KAAK,kBAAkB,GAAG,UAAU,CAAC,OAAO,8BAA8B,CAAC,CAAC,MAAM,CAAC,CAAC;AAoBpF,wBAAgB,4BAA4B,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAyB1E;AAGD,wBAAgB,4BAA4B,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAyB1E;AAED,wBAAgB,0BAA0B,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAEtE"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"header.d.ts","sourceRoot":"","sources":["../../../src/serializers/header.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAI9D,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAE7D,KAAK,aAAa,GAAG,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC;AA4DjE,wBAAgB,uBAAuB,IAAI,OAAO,CAAC,aAAa,CAAC,CAWhE;AAED,wBAAgB,uBAAuB,IAAI,OAAO,CAAC,aAAa,CAAC,CAWhE;AAED,wBAAgB,qBAAqB,IAAI,KAAK,CAAC,aAAa,CAAC,CAW5D"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/serializers/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instruction.d.ts","sourceRoot":"","sources":["../../../src/serializers/instruction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAgB,OAAO,EAAE,OAAO,EAA0B,MAAM,qBAAqB,CAAC;AAWpG,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAElE,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAC;AAmBtE,wBAAgB,qBAAqB,IAAI,OAAO,CAAC,WAAW,CAAC,CA6B5D;AAGD,wBAAgB,qBAAqB,IAAI,OAAO,CAAC,WAAW,CAAC,CA6B5D;AAED,wBAAgB,mBAAmB,IAAI,KAAK,CAAC,WAAW,CAAC,CAExD"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../src/serializers/message.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAgB,OAAO,EAAE,OAAO,EAA0B,MAAM,qBAAqB,CAAC;AAapG,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAwH7C,wBAAgB,yBAAyB,IAAI,OAAO,CAAC,eAAe,CAAC,CAapE;AAED,wBAAgB,yBAAyB,IAAI,OAAO,CAAC,eAAe,CAAC,CAepE;AAED,wBAAgB,uBAAuB,IAAI,KAAK,CAAC,eAAe,CAAC,CAEhE"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction-version.d.ts","sourceRoot":"","sources":["../../../src/serializers/transaction-version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAgB,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAgC9C,wBAAgB,4BAA4B,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAK1E;AAED,wBAAgB,4BAA4B,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAK1E;AAED,wBAAgB,0BAA0B,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAEtE"}
@@ -1,9 +1,7 @@
1
1
  import { Codec, Decoder, Encoder } from '@solana/codecs-core';
2
- import { compileMessage } from '../message';
2
+ import { CompilableTransaction } from '../compilable-transaction';
3
3
  import { ITransactionWithSignatures } from '../signatures';
4
- type CompilableTransaction = Parameters<typeof compileMessage>[0];
5
4
  export declare function getTransactionEncoder(): Encoder<CompilableTransaction | (CompilableTransaction & ITransactionWithSignatures)>;
6
5
  export declare function getTransactionDecoder(lastValidBlockHeight?: bigint): Decoder<CompilableTransaction | (CompilableTransaction & ITransactionWithSignatures)>;
7
6
  export declare function getTransactionCodec(lastValidBlockHeight?: bigint): Codec<CompilableTransaction | (CompilableTransaction & ITransactionWithSignatures)>;
8
- export {};
9
7
  //# sourceMappingURL=transaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../../src/serializers/transaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAgB,OAAO,EAAE,OAAO,EAA0B,MAAM,qBAAqB,CAAC;AAYpG,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAGlE,OAAO,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AA8C3D,wBAAgB,qBAAqB,IAAI,OAAO,CAC5C,qBAAqB,GAAG,CAAC,qBAAqB,GAAG,0BAA0B,CAAC,CAC/E,CAEA;AAED,wBAAgB,qBAAqB,CACjC,oBAAoB,CAAC,EAAE,MAAM,GAC9B,OAAO,CAAC,qBAAqB,GAAG,CAAC,qBAAqB,GAAG,0BAA0B,CAAC,CAAC,CAIvF;AAED,wBAAgB,mBAAmB,CAC/B,oBAAoB,CAAC,EAAE,MAAM,GAC9B,KAAK,CAAC,qBAAqB,GAAG,CAAC,qBAAqB,GAAG,0BAA0B,CAAC,CAAC,CAErF"}
@@ -1,20 +1,15 @@
1
- import { Base58EncodedAddress } from '@solana/addresses';
2
- import { Ed25519Signature } from '@solana/keys';
1
+ import { Address } from '@solana/addresses';
2
+ import { Signature, SignatureBytes } from '@solana/keys';
3
+ import { CompilableTransaction } from './compilable-transaction';
3
4
  import { ITransactionWithFeePayer } from './fee-payer';
4
- import { compileMessage } from './message';
5
5
  export interface IFullySignedTransaction extends ITransactionWithSignatures {
6
6
  readonly __brand: unique symbol;
7
7
  }
8
8
  export interface ITransactionWithSignatures {
9
- readonly signatures: Readonly<Record<Base58EncodedAddress, Ed25519Signature>>;
9
+ readonly signatures: Readonly<Record<Address, SignatureBytes>>;
10
10
  }
11
- export type TransactionSignature = string & {
12
- readonly __brand: unique symbol;
13
- };
14
- export declare function assertIsTransactionSignature(putativeTransactionSignature: string): asserts putativeTransactionSignature is TransactionSignature;
15
- export declare function isTransactionSignature(putativeTransactionSignature: string): putativeTransactionSignature is TransactionSignature;
16
- export declare function getSignatureFromTransaction(transaction: ITransactionWithFeePayer & ITransactionWithSignatures): TransactionSignature;
17
- export declare function signTransaction<TTransaction extends Parameters<typeof compileMessage>[0]>(keyPairs: CryptoKeyPair[], transaction: TTransaction | (TTransaction & ITransactionWithSignatures)): Promise<TTransaction & ITransactionWithSignatures>;
18
- export declare function transactionSignature(putativeTransactionSignature: string): TransactionSignature;
19
- export declare function assertTransactionIsFullySigned<TTransaction extends Parameters<typeof compileMessage>[0]>(transaction: TTransaction & ITransactionWithSignatures): asserts transaction is TTransaction & IFullySignedTransaction;
11
+ export declare function getSignatureFromTransaction(transaction: ITransactionWithFeePayer & ITransactionWithSignatures): Signature;
12
+ export declare function partiallySignTransaction<TTransaction extends CompilableTransaction>(keyPairs: CryptoKeyPair[], transaction: TTransaction | (TTransaction & ITransactionWithSignatures)): Promise<TTransaction & ITransactionWithSignatures>;
13
+ export declare function signTransaction<TTransaction extends CompilableTransaction>(keyPairs: CryptoKeyPair[], transaction: TTransaction | (TTransaction & ITransactionWithSignatures)): Promise<TTransaction & IFullySignedTransaction>;
14
+ export declare function assertTransactionIsFullySigned<TTransaction extends CompilableTransaction>(transaction: TTransaction & ITransactionWithSignatures): asserts transaction is TTransaction & IFullySignedTransaction;
20
15
  //# sourceMappingURL=signatures.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signatures.d.ts","sourceRoot":"","sources":["../../src/signatures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAA2B,MAAM,mBAAmB,CAAC;AAIrE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAa,MAAM,cAAc,CAAC;AAEpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAIvD,MAAM,WAAW,uBAAwB,SAAQ,0BAA0B;IACvE,QAAQ,CAAC,OAAO,EAAE,OAAO,MAAM,CAAC;CACnC;AACD,MAAM,WAAW,0BAA0B;IACvC,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC;CAClE;AAID,wBAAgB,2BAA2B,CACvC,WAAW,EAAE,wBAAwB,GAAG,0BAA0B,GACnE,SAAS,CAaX;AAED,wBAAsB,wBAAwB,CAAC,YAAY,SAAS,qBAAqB,EACrF,QAAQ,EAAE,aAAa,EAAE,EACzB,WAAW,EAAE,YAAY,GAAG,CAAC,YAAY,GAAG,0BAA0B,CAAC,GACxE,OAAO,CAAC,YAAY,GAAG,0BAA0B,CAAC,CAmBpD;AAED,wBAAsB,eAAe,CAAC,YAAY,SAAS,qBAAqB,EAC5E,QAAQ,EAAE,aAAa,EAAE,EACzB,WAAW,EAAE,YAAY,GAAG,CAAC,YAAY,GAAG,0BAA0B,CAAC,GACxE,OAAO,CAAC,YAAY,GAAG,uBAAuB,CAAC,CAKjD;AAED,wBAAgB,8BAA8B,CAAC,YAAY,SAAS,qBAAqB,EACrF,WAAW,EAAE,YAAY,GAAG,0BAA0B,GACvD,OAAO,CAAC,WAAW,IAAI,YAAY,GAAG,uBAAuB,CAY/D"}
@@ -6,20 +6,13 @@ export type SerializedMessageBytes = Uint8Array & {
6
6
  export type SerializedMessageBytesBase64 = string & {
7
7
  readonly __serializedMessageBytesBase64: unique symbol;
8
8
  };
9
- export type BaseTransaction = Readonly<{
10
- instructions: readonly IInstruction[];
11
- version: TransactionVersion;
12
- }>;
13
- type LegacyTransaction = BaseTransaction & Readonly<{
14
- instructions: readonly (Omit<IInstruction, 'accounts'> & Readonly<{
15
- readonly accounts?: readonly IAccountMeta[];
16
- }>)[];
17
- version: 'legacy';
18
- }>;
19
- type V0Transaction = BaseTransaction & Readonly<{
20
- instructions: readonly IInstruction[];
21
- version: 0;
9
+ export type BaseTransaction<TVersion extends TransactionVersion = TransactionVersion, TInstruction extends IInstruction = IInstruction> = Readonly<{
10
+ instructions: readonly TInstruction[];
11
+ version: TVersion;
22
12
  }>;
13
+ type ILegacyInstruction<TProgramAddress extends string = string> = IInstruction<TProgramAddress, readonly IAccountMeta[]>;
14
+ type LegacyTransaction = BaseTransaction<'legacy', ILegacyInstruction>;
15
+ type V0Transaction = BaseTransaction<0, IInstruction>;
23
16
  export type Transaction = LegacyTransaction | V0Transaction;
24
17
  export type TransactionVersion = 'legacy' | 0;
25
18
  export {};
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAElE,iEAAiE;AACjE,MAAM,MAAM,sBAAsB,GAAG,UAAU,GAAG;IAAE,QAAQ,CAAC,wBAAwB,EAAE,OAAO,MAAM,CAAA;CAAE,CAAC;AACvG,MAAM,MAAM,4BAA4B,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,8BAA8B,EAAE,OAAO,MAAM,CAAA;CAAE,CAAC;AAE/G,MAAM,MAAM,eAAe,CACvB,QAAQ,SAAS,kBAAkB,GAAG,kBAAkB,EACxD,YAAY,SAAS,YAAY,GAAG,YAAY,IAChD,QAAQ,CAAC;IACT,YAAY,EAAE,SAAS,YAAY,EAAE,CAAC;IACtC,OAAO,EAAE,QAAQ,CAAC;CACrB,CAAC,CAAC;AAEH,KAAK,kBAAkB,CAAC,eAAe,SAAS,MAAM,GAAG,MAAM,IAAI,YAAY,CAC3E,eAAe,EACf,SAAS,YAAY,EAAE,CAC1B,CAAC;AACF,KAAK,iBAAiB,GAAG,eAAe,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC;AACvE,KAAK,aAAa,GAAG,eAAe,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;AAEtD,MAAM,MAAM,WAAW,GAAG,iBAAiB,GAAG,aAAa,CAAC;AAC5D,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unsigned-transaction.d.ts","sourceRoot":"","sources":["../../src/unsigned-transaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,GAAG,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,wBAAgB,sBAAsB,CAAC,YAAY,SAAS,eAAe,EACvE,WAAW,EAAE,YAAY,GAAG,CAAC,YAAY,GAAG,0BAA0B,CAAC,GACxE,YAAY,GAAG,IAAI,CAAC,YAAY,GAAG,0BAA0B,EAAE,MAAM,0BAA0B,CAAC,CAWlG"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wire-transaction.d.ts","sourceRoot":"","sources":["../../src/wire-transaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAElE,MAAM,MAAM,4BAA4B,GAAG,MAAM,GAAG;IAChD,QAAQ,CAAC,OAAO,EAAE,OAAO,MAAM,CAAC;CACnC,CAAC;AAEF,wBAAgB,+BAA+B,CAC3C,WAAW,EAAE,UAAU,CAAC,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,GAC/E,4BAA4B,CAO9B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solana/transactions",
3
- "version": "2.0.0-experimental.10bfcd8",
3
+ "version": "2.0.0-experimental.13ef878",
4
4
  "description": "Helpers for creating and serializing transactions",
5
5
  "exports": {
6
6
  "browser": {
@@ -46,14 +46,13 @@
46
46
  "maintained node versions"
47
47
  ],
48
48
  "dependencies": {
49
- "@metaplex-foundation/umi-serializers": "^0.8.9",
50
- "@solana/addresses": "2.0.0-experimental.10bfcd8",
51
- "@solana/codecs-core": "2.0.0-experimental.10bfcd8",
52
- "@solana/codecs-data-structures": "2.0.0-experimental.10bfcd8",
53
- "@solana/codecs-numbers": "2.0.0-experimental.10bfcd8",
54
- "@solana/codecs-strings": "2.0.0-experimental.10bfcd8",
55
- "@solana/functional": "2.0.0-experimental.10bfcd8",
56
- "@solana/keys": "2.0.0-experimental.10bfcd8"
49
+ "@solana/addresses": "2.0.0-experimental.13ef878",
50
+ "@solana/codecs-core": "2.0.0-experimental.13ef878",
51
+ "@solana/codecs-data-structures": "2.0.0-experimental.13ef878",
52
+ "@solana/codecs-numbers": "2.0.0-experimental.13ef878",
53
+ "@solana/codecs-strings": "2.0.0-experimental.13ef878",
54
+ "@solana/functional": "2.0.0-experimental.13ef878",
55
+ "@solana/keys": "2.0.0-experimental.13ef878"
57
56
  },
58
57
  "devDependencies": {
59
58
  "@solana/eslint-config-solana": "^1.0.2",
@@ -72,7 +71,7 @@
72
71
  "tsup": "7.2.0",
73
72
  "typescript": "^5.2.2",
74
73
  "version-from-git": "^1.1.1",
75
- "@solana/instructions": "2.0.0-experimental.10bfcd8",
74
+ "@solana/instructions": "2.0.0-experimental.13ef878",
76
75
  "build-scripts": "0.0.0",
77
76
  "test-config": "0.0.0",
78
77
  "test-matchers": "0.0.0",