@solana/transactions 2.0.0-experimental.ce179f2 → 2.0.0-experimental.cf6ca9d
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.
- package/README.md +314 -5
- package/dist/index.browser.cjs +344 -134
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +346 -139
- package/dist/index.browser.js.map +1 -1
- package/dist/index.development.js +571 -772
- package/dist/index.development.js.map +1 -1
- package/dist/index.native.js +346 -139
- package/dist/index.native.js.map +1 -1
- package/dist/index.node.cjs +342 -134
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.js +344 -139
- package/dist/index.node.js.map +1 -1
- package/dist/index.production.min.js +20 -17
- package/dist/types/decompile-transaction.d.ts +7 -0
- package/dist/types/durable-nonce.d.ts +2 -3
- package/dist/types/serializers/message.d.ts +4 -4
- package/dist/types/serializers/transaction.d.ts +7 -4
- package/dist/types/signatures.d.ts +1 -0
- package/dist/types/wire-transaction.d.ts +1 -1
- package/package.json +9 -7
- package/dist/types/serializers/unimplemented.d.ts +0 -3
|
@@ -2,24 +2,27 @@ this.globalThis = this.globalThis || {};
|
|
|
2
2
|
this.globalThis.solanaWeb3 = (function (exports) {
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
|
-
var _r=Object.defineProperty;var kr=(e,r,n)=>r in e?_r(e,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[r]=n;var y=(e,r,n)=>(kr(e,typeof r!="symbol"?r+"":r,n),n);var x=e=>{let r=e.reduce((o,i)=>o+i.length,0),n=new Uint8Array(r),t=0;return e.forEach(o=>{n.set(o,t),t+=o.length;}),n},we=(e,r)=>{if(e.length>=r)return e;let n=new Uint8Array(r).fill(0);return n.set(e),n},j=(e,r)=>we(e.slice(0,r),r);var T=class extends Error{constructor(n){super(`Serializer [${n}] cannot deserialize empty buffers.`);y(this,"name","DeserializingEmptyBufferError");}},h=class extends Error{constructor(n,t,o){super(`Serializer [${n}] expected ${t} bytes, got ${o}.`);y(this,"name","NotEnoughBytesError");}},z=class extends Error{constructor(n){n??(n="Expected a fixed-size serializer, got a variable-size one.");super(n);y(this,"name","ExpectedFixedSizeSerializerError");}};function M(e,r,n){return {description:n??`fixed(${r}, ${e.description})`,fixedSize:r,maxSize:r,serialize:t=>j(e.serialize(t),r),deserialize:(t,o=0)=>{if(t=t.slice(o,o+r),t.length<r)throw new h("fixSerializer",r,t.length);e.fixedSize!==null&&(t=j(t,e.fixedSize));let[i]=e.deserialize(t,0);return [i,o+r]}}}function ce(e,r,n){return {description:e.description,fixedSize:e.fixedSize,maxSize:e.maxSize,serialize:t=>e.serialize(r(t)),deserialize:(t,o=0)=>{let[i,s]=e.deserialize(t,o);return n?[n(i,t,o),s]:[i,s]}}}var K=class extends Error{constructor(n,t,o){let i=`Expected a string of base ${t}, got [${n}].`;super(i);y(this,"name","InvalidBaseStringError");this.cause=o;}};var Be=e=>{let r=e.length,n=BigInt(r);return {description:`base${r}`,fixedSize:null,maxSize:null,serialize(t){if(!t.match(new RegExp(`^[${e}]*$`)))throw new K(t,r);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 a=o.slice(i),u=0n,d=1n;for(let f=a.length-1;f>=0;f-=1)u+=d*BigInt(e.indexOf(a[f])),d*=n;let l=[];for(;u>0n;)l.unshift(Number(u%256n)),u/=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 a=e[0].repeat(s);if(s===i.length)return [a,t.length];let u=i.slice(s).reduce((l,f)=>l*256n+BigInt(f),0n),d=[];for(;u>0n;)d.unshift(e[Number(u%n)]),u/=n;return [a+d.join(""),t.length]}}};var b=Be("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");var Ce=e=>e.replace(/\u0000/g,"");var de={description:"utf8",fixedSize:null,maxSize:null,serialize(e){return new TextEncoder().encode(e)},deserialize(e,r=0){let n=new TextDecoder().decode(e.slice(r));return [Ce(n),e.length]}};var Y;(function(e){e.Little="le",e.Big="be";})(Y||(Y={}));var G=class extends RangeError{constructor(n,t,o,i){super(`Serializer [${n}] expected number to be between ${t} and ${o}, got ${i}.`);y(this,"name","NumberOutOfRangeError");}};function De(e){let r,n=e.name;return e.size>1&&(r=!("endian"in e.options)||e.options.endian===Y.Little,n+=r?"(le)":"(be)"),{description:e.options.description??n,fixedSize:e.size,maxSize:e.size,serialize(t){e.range&&ue(e.name,e.range[0],e.range[1],t);let o=new ArrayBuffer(e.size);return e.set(new DataView(o),t,r),new Uint8Array(o)},deserialize(t,o=0){let i=t.slice(o,o+e.size);$r("i8",i,e.size);let s=Rr(i);return [e.get(s,r),o+e.size]}}}var Ur=e=>e.buffer.slice(e.byteOffset,e.byteLength+e.byteOffset),Rr=e=>new DataView(Ur(e)),ue=(e,r,n,t)=>{if(t<r||t>n)throw new G(e,r,n,t)},$r=(e,r,n)=>{if(r.length===0)throw new T(e);if(r.length<n)throw new h(e,n,r.length)};var P=(e={})=>De({name:"u32",size:4,range:[0,+"0xffffffff"],set:(r,n,t)=>r.setUint32(0,Number(n),t),get:(r,n)=>r.getUint32(0,n),options:e});var I=(e={})=>({description:e.description??"shortU16",fixedSize:null,maxSize:3,serialize:r=>{ue("shortU16",0,65535,r);let n=[0];for(let t=0;;t+=1){let o=r>>t*7;if(o===0)break;let i=127&o;n[t]=i,t>0&&(n[t-1]|=128);}return new Uint8Array(n)},deserialize:(r,n=0)=>{let t=0,o=0;for(;++o;){let i=o-1,s=r[n+i],a=127&s;if(t|=a<<i*7,!(s&128))break}return [t,n+o]}});var q=class extends Error{constructor(n,t,o){super(`Expected [${n}] to have ${t} items, got ${o}.`);y(this,"name","InvalidNumberOfItemsError");}},X=class extends Error{constructor(n,t){super(`The remainder of the buffer (${n} bytes) cannot be split into chunks of ${t} bytes. Serializers of "remainder" size must have a remainder that is a multiple of its item size. In other words, ${n} modulo ${t} should be equal to zero.`);y(this,"name","InvalidArrayLikeRemainderSizeError");}},Z=class extends Error{constructor(n){super(`Unrecognized array-like serializer size: ${JSON.stringify(n)}`);y(this,"name","UnrecognizedArrayLikeSerializerSizeError");}};function v(e){return e.reduce((r,n)=>r===null||n===null?null:r+n,0)}function ve(e,r,n,t){if(typeof e=="number")return [e,t];if(typeof e=="object")return e.deserialize(n,t);if(e==="remainder"){let o=v(r);if(o===null)throw new z('Serializers of "remainder" size must have fixed-size items.');let i=n.slice(t).length;if(i%o!==0)throw new X(i,o);return [i/o,t]}throw new Z(e)}function N(e){return typeof e=="object"?e.description:`${e}`}function le(e,r){if(typeof e!="number")return null;if(e===0)return 0;let n=v(r);return n===null?null:n*e}function Ne(e,r){return typeof e=="object"?e.serialize(r):new Uint8Array}function w(e,r={}){let n=r.size??P();if(n==="remainder"&&e.fixedSize===null)throw new z('Serializers of "remainder" size must have fixed-size items.');return {description:r.description??`array(${e.description}; ${N(n)})`,fixedSize:le(n,[e.fixedSize]),maxSize:le(n,[e.maxSize]),serialize:t=>{if(typeof n=="number"&&t.length!==n)throw new q("array",n,t.length);return x([Ne(n,t.length),...t.map(o=>e.serialize(o))])},deserialize:(t,o=0)=>{if(typeof n=="object"&&t.slice(o).length===0)return [[],o];let[i,s]=ve(n,[e.fixedSize],t,o);o=s;let a=[];for(let u=0;u<i;u+=1){let[d,l]=e.deserialize(t,o);a.push(d),o=l;}return [a,o]}}}function fe(e={}){let r=e.size??"variable",n=e.description??`bytes(${N(r)})`,t={description:n,fixedSize:null,maxSize:null,serialize:o=>new Uint8Array(o),deserialize:(o,i=0)=>{let s=o.slice(i);return [s,i+s.length]}};return r==="variable"?t:typeof r=="number"?M(t,r,n):{description:n,fixedSize:null,maxSize:null,serialize:o=>{let i=t.serialize(o),s=r.serialize(i.length);return x([s,i])},deserialize:(o,i=0)=>{if(o.slice(i).length===0)throw new T("bytes");let[s,a]=r.deserialize(o,i),u=Number(s);i=a;let d=o.slice(i,i+u);if(d.length<u)throw new h("bytes",u,d.length);let[l,f]=t.deserialize(d);return i+=f,[l,i]}}}function me(e={}){let r=e.size??P(),n=e.encoding??de,t=e.description??`string(${n.description}; ${N(r)})`;return r==="variable"?{...n,description:t}:typeof r=="number"?M(n,r,t):{description:t,fixedSize:null,maxSize:null,serialize:o=>{let i=n.serialize(o),s=r.serialize(i.length);return x([s,i])},deserialize:(o,i=0)=>{if(o.slice(i).length===0)throw new T("string");let[s,a]=r.deserialize(o,i),u=Number(s);i=a;let d=o.slice(i,i+u);if(d.length<u)throw new h("string",u,d.length);let[l,f]=n.deserialize(d);return i+=f,[l,i]}}}function _(e,r={}){let n=e.map(([t,o])=>`${String(t)}: ${o.description}`).join(", ");return {description:r.description??`struct(${n})`,fixedSize:v(e.map(([,t])=>t.fixedSize)),maxSize:v(e.map(([,t])=>t.maxSize)),serialize:t=>{let o=e.map(([i,s])=>s.serialize(t[i]));return x(o)},deserialize:(t,o=0)=>{let i={};return e.forEach(([s,a])=>{let[u,d]=a.deserialize(t,o);o=d,i[s]=u;}),[i,o]}}}function S(e){if("signatures"in e){let{signatures:r,...n}=e;return n}else return e}function bo(e){try{if(e.length<32||e.length>44)throw new Error("Expected input string to decode to a byte array of length 32.");let n=b.serialize(e).byteLength;if(n!==32)throw new Error(`Expected input string to decode to a byte array of length 32. Actual length: ${n}`)}catch(r){throw new Error(`\`${e}\` is not a blockhash`,{cause:r})}}function So(e,r){if("lifetimeConstraint"in r&&r.lifetimeConstraint.blockhash===e.blockhash&&r.lifetimeConstraint.lastValidBlockHeight===e.lastValidBlockHeight)return r;let n={...S(r),lifetimeConstraint:e};return Object.freeze(n),n}function zo({version:e}){let r={instructions:[],version:e};return Object.freeze(r),r}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 Lr=1;function B(e){return e>=2}function C(e){return (e&Lr)!==0}function ge(e,r){return e|r}var _e="SysvarRecentB1ockHashes11111111111111111111",ke="11111111111111111111111111111111";function Uo(e){if(!Ue(e))throw new Error("Transaction is not a durable nonce transaction")}function Or(e,r){return {accounts:[{address:e,role:g.WRITABLE},{address:_e,role:g.READONLY},{address:r,role:g.READONLY_SIGNER}],data:new Uint8Array([4,0,0,0]),programAddress:ke}}function Mr(e){return e.programAddress===ke&&e.data!=null&&Pr(e.data)&&e.accounts?.length===3&&e.accounts[0].address!=null&&e.accounts[0].role===g.WRITABLE&&e.accounts[1].address===_e&&e.accounts[1].role===g.READONLY&&e.accounts[2].address!=null&&e.accounts[2].role===g.READONLY_SIGNER}function Pr(e){return e.byteLength===4&&e[0]===4&&e[1]===0&&e[2]===0&&e[3]===0}function Ue(e){return "lifetimeConstraint"in e&&typeof e.lifetimeConstraint.nonce=="string"&&e.instructions[0]!=null&&Mr(e.instructions[0])}function Ro({nonce:e,nonceAccountAddress:r,nonceAuthorityAddress:n},t){let o=Ue(t);if(o&&t.lifetimeConstraint.nonce===e&&t.instructions[0].accounts[0].address===r&&t.instructions[0].accounts[2].address===n)return t;let i={...S(t),instructions:[Or(r,n),...o?t.instructions.slice(1):t.instructions],lifetimeConstraint:{nonce:e}};return Object.freeze(i),i}function Mo(e,r){if("feePayer"in r&&e===r.feePayer)return r;let n={...S(r),feePayer:e};return Object.freeze(n),n}function Wo(e,r){let n={...S(r),instructions:[...r.instructions,e]};return Object.freeze(n),n}function Ho(e,r){let n={...S(r),instructions:[e,...r.instructions]};return Object.freeze(n),n}function k(e,r,n=0){if(r.length-n<=0)throw new Error(`Codec [${e}] cannot decode empty byte arrays.`)}function D(e,r,n,t=0){let o=n.length-t;if(o<r)throw new Error(`Codec [${e}] expected ${r} bytes, got ${o}.`)}var U=e=>{let r=e.filter(i=>i.length);if(r.length===0)return e.length?e[0]:new Uint8Array;if(r.length===1)return r[0];let n=r.reduce((i,s)=>i+s.length,0),t=new Uint8Array(n),o=0;return r.forEach(i=>{t.set(i,o),o+=i.length;}),t},Vr=(e,r)=>{if(e.length>=r)return e;let n=new Uint8Array(r).fill(0);return n.set(e),n},pe=(e,r)=>Vr(e.length<=r?e:e.slice(0,r),r);function p(e,r,n){if(e.fixedSize!==r.fixedSize)throw new Error(`Encoder and decoder must have the same fixed size, got [${e.fixedSize}] and [${r.fixedSize}].`);if(e.maxSize!==r.maxSize)throw new Error(`Encoder and decoder must have the same max size, got [${e.maxSize}] and [${r.maxSize}].`);if(n===void 0&&e.description!==r.description)throw new Error(`Encoder and decoder must have the same description, got [${e.description}] and [${r.description}]. Pass a custom description as a third argument if you want to override the description and bypass this error.`);return {decode:r.decode,description:n??e.description,encode:e.encode,fixedSize:e.fixedSize,maxSize:e.maxSize}}function Re(e,r,n){return {description:n??`fixed(${r}, ${e.description})`,fixedSize:r,maxSize:r}}function J(e,r,n){return {...Re(e,r,n),encode:t=>pe(e.encode(t),r)}}function Q(e,r,n){return {...Re(e,r,n),decode:(t,o=0)=>{D("fixCodec",r,t,o),(o>0||t.length>r)&&(t=t.slice(o,o+r)),e.fixedSize!==null&&(t=pe(t,e.fixedSize));let[i]=e.decode(t,0);return [i,o+r]}}}function ee(e,r){return {description:e.description,encode:n=>e.encode(r(n)),fixedSize:e.fixedSize,maxSize:e.maxSize}}function $e(e,r){return {decode:(n,t=0)=>{let[o,i]=e.decode(n,t);return [r(o,n,t),i]},description:e.description,fixedSize:e.fixedSize,maxSize:e.maxSize}}function Le(e,r,n,t){if(t<r||t>n)throw new Error(`Codec [${e}] expected number to be in the range [${r}, ${n}], got ${t}.`)}function Oe(e){let r,n=e.name;return e.size>1&&(r=!("endian"in e.options)||e.options.endian===0,n+=r?"(le)":"(be)"),{description:e.options.description??n,fixedSize:e.size,littleEndian:r,maxSize:e.size}}function Me(e){let r=Oe(e);return {description:r.description,encode(n){e.range&&Le(e.name,e.range[0],e.range[1],n);let t=new ArrayBuffer(e.size);return e.set(new DataView(t),n,r.littleEndian),new Uint8Array(t)},fixedSize:r.fixedSize,maxSize:r.maxSize}}function Pe(e){let r=Oe(e);return {decode(n,t=0){k(r.description,n,t),D(r.description,e.size,n,t);let o=new DataView(Fr(n,t,e.size));return [e.get(o,r.littleEndian),t+e.size]},description:r.description,fixedSize:r.fixedSize,maxSize:r.maxSize}}function Fr(e,r,n){let t=e.byteOffset+(r??0),o=n??e.byteLength;return e.buffer.slice(t,t+o)}var R=(e={})=>({description:e.description??"shortU16",encode:r=>{Le("shortU16",0,65535,r);let n=[0];for(let t=0;;t+=1){let o=r>>t*7;if(o===0)break;let i=127&o;n[t]=i,t>0&&(n[t-1]|=128);}return new Uint8Array(n)},fixedSize:null,maxSize:3}),$=(e={})=>({decode:(r,n=0)=>{let t=0,o=0;for(;++o;){let i=o-1,s=r[n+i],a=127&s;if(t|=a<<i*7,!(s&128))break}return [t,n+o]},description:e.description??"shortU16",fixedSize:null,maxSize:3});var re=(e={})=>Me({name:"u32",options:e,range:[0,+"0xffffffff"],set:(r,n,t)=>r.setUint32(0,n,t),size:4}),ne=(e={})=>Pe({get:(r,n)=>r.getUint32(0,n),name:"u32",options:e,size:4});var A=(e={})=>Me({name:"u8",options:e,range:[0,+"0xff"],set:(r,n)=>r.setUint8(0,n),size:1}),E=(e={})=>Pe({get:r=>r.getUint8(0),name:"u8",options:e,size:1}),Ve=(e={})=>p(A(e),E(e));function Wr(e,r,n=r){if(!r.match(new RegExp(`^[${e}]*$`)))throw new Error(`Expected a string of base ${e.length}, got [${n}].`)}var Hr=e=>{let r=e.length,n=BigInt(r);return {description:`base${r}`,encode(t){if(Wr(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 a=o.slice(i),u=0n,d=1n;for(let f=a.length-1;f>=0;f-=1)u+=d*BigInt(e.indexOf(a[f])),d*=n;let l=[];for(;u>0n;)l.unshift(Number(u%256n)),u/=256n;return Uint8Array.from(s.concat(l))},fixedSize:null,maxSize:null}},jr=e=>{let r=e.length,n=BigInt(r);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 a=e[0].repeat(s);if(s===i.length)return [a,t.length];let u=i.slice(s).reduce((l,f)=>l*256n+BigInt(f),0n),d=[];for(;u>0n;)d.unshift(e[Number(u%n)]),u/=n;return [a+d.join(""),t.length]},description:`base${r}`,fixedSize:null,maxSize:null}};var Fe="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",We=()=>Hr(Fe),He=()=>jr(Fe);var Kr=e=>e.replace(/\u0000/g,"");var Yr=globalThis.TextDecoder,Gr=globalThis.TextEncoder,qr=()=>{let e;return {description:"utf8",encode:r=>new Uint8Array((e||(e=new Gr)).encode(r)),fixedSize:null,maxSize:null}},Xr=()=>{let e;return {decode(r,n=0){let t=(e||(e=new Yr)).decode(r.slice(n));return [Kr(t),r.length]},description:"utf8",fixedSize:null,maxSize:null}};var je=(e={})=>{let r=e.size??re(),n=e.encoding??qr(),t=e.description??`string(${n.description}; ${Ye(r)})`;return r==="variable"?{...n,description:t}:typeof r=="number"?J(n,r,t):{description:t,encode:o=>{let i=n.encode(o),s=r.encode(i.length);return U([s,i])},fixedSize:null,maxSize:null}},Ke=(e={})=>{let r=e.size??ne(),n=e.encoding??Xr(),t=e.description??`string(${n.description}; ${Ye(r)})`;return r==="variable"?{...n,description:t}:typeof r=="number"?Q(n,r,t):{decode:(o,i=0)=>{k("string",o,i);let[s,a]=r.decode(o,i),u=Number(s);i=a;let d=o.slice(i,i+u);D("string",u,d);let[l,f]=n.decode(d);return i+=f,[l,i]},description:t,fixedSize:null,maxSize:null}};function Ye(e){return typeof e=="object"?e.description:`${e}`}function Ge(){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 qe(){if(Ge(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.exportKey!="function")throw new Error("No key export implementation could be found")}async function Xe(){if(Ge(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.sign!="function")throw new Error("No signing implementation could be found")}var ye,he;function Ze(){return ye||(ye=We()),ye}function Zr(){return he||(he=He()),he}function Jr(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=Ze().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(r){throw new Error(`\`${e}\` is not a base-58 encoded address`,{cause:r})}}function Qr(e){return Jr(e),e}function xe(e){return ee(je({description:e?.description??"Base58EncodedAddress",encoding:Ze(),size:32}),r=>Qr(r))}function te(e){return Ke({description:e?.description??"Base58EncodedAddress",encoding:Zr(),size:32})}function Je(e){return p(xe(e),te(e))}function V(){return new Intl.Collator("en",{caseFirst:"lower",ignorePunctuation:!1,localeMatcher:"best fit",numeric:!1,sensitivity:"variant",usage:"sort"}).compare}async function Qe(e){if(await qe(),e.type!=="public"||e.algorithm.name!=="Ed25519")throw new Error("The `CryptoKey` must be an `Ed25519` public key");let r=await crypto.subtle.exportKey("raw",e),[n]=te().decode(new Uint8Array(r));return n}function er(e,r,n){e[r]=n(e[r]??{role:g.READONLY});}var m=Symbol("AddressMapTypeProperty");function rr(e,r){let n={[e]:{[m]:0,role:g.WRITABLE_SIGNER}},t=new Set;for(let o of r){er(n,o.programAddress,s=>{if(t.add(o.programAddress),m in s){if(C(s.role))switch(s[m]){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[m]===2)return s}return {[m]:2,role:g.READONLY}});let i;if(o.accounts)for(let s of o.accounts)er(n,s.address,a=>{let{address:u,...d}=s;if(m in a)switch(a[m]){case 0:return a;case 1:{let l=ge(a.role,d.role);if("lookupTableAddress"in d){if(a.lookupTableAddress!==d.lookupTableAddress&&(i||(i=V()))(d.lookupTableAddress,a.lookupTableAddress)<0)return {[m]:1,...d,role:l}}else if(B(d.role))return {[m]:2,role:l};return a.role!==l?{...a,role:l}:a}case 2:{let l=ge(a.role,d.role);if(t.has(s.address)){if(C(d.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 a.role!==l?{...a,role:l}:a}else return "lookupTableAddress"in d&&!B(a.role)?{...d,[m]:1,role:l}:a.role!==l?{...a,role:l}:a}}return "lookupTableAddress"in d?{...d,[m]:1}:{...d,[m]:2}});}return n}function nr(e){let r;return Object.entries(e).sort(([t,o],[i,s])=>{if(o[m]!==s[m]){if(o[m]===0)return -1;if(s[m]===0)return 1;if(o[m]===2)return -1;if(s[m]===2)return 1}let a=B(o.role);if(a!==B(s.role))return a?-1:1;let u=C(o.role);return u!==C(s.role)?u?-1:1:(r||(r=V()),o[m]===1&&s[m]===1&&o.lookupTableAddress!==s.lookupTableAddress?r(o.lookupTableAddress,s.lookupTableAddress):r(t,i))}).map(([t,o])=>({address:t,...o}))}function tr(e){var n;let r={};for(let t of e){if(!("lookupTableAddress"in t))continue;let o=r[n=t.lookupTableAddress]||(r[n]={readableIndices:[],writableIndices:[]});t.role===g.WRITABLE?o.writableIndices.push(t.addressIndex):o.readableIndices.push(t.addressIndex);}return Object.keys(r).sort(V()).map(t=>({lookupTableAddress:t,...r[t]}))}function or(e){let r=0,n=0,t=0;for(let o of e){if("lookupTableAddress"in o)break;let i=C(o.role);B(o.role)?(t++,i||n++):i||r++;}return {numReadonlyNonSignerAccounts:r,numReadonlySignerAccounts:n,numSignerAccounts:t}}function en(e){let r={};for(let[n,t]of e.entries())r[t.address]=n;return r}function ir(e,r){let n=en(r);return e.map(({accounts:t,data:o,programAddress:i})=>({programAddressIndex:n[i],...t?{accountIndices:t.map(({address:s})=>n[s])}:null,...o?{data:o}:null}))}function sr(e){return "nonce"in e?e.nonce:e.blockhash}function ar(e){let r=e.findIndex(t=>"lookupTableAddress"in t);return (r===-1?e:e.slice(0,r)).map(({address:t})=>t)}function oe(e){let r=rr(e.feePayer,e.instructions),n=nr(r);return {...e.version!=="legacy"?{addressTableLookups:tr(n)}:null,header:or(n),instructions:ir(e.instructions,n),lifetimeToken:sr(e.lifetimeConstraint),staticAccounts:ar(n),version:e.version}}function cr(e){let r=oe(e),n;if("signatures"in e){n=[];for(let t=0;t<r.header.numSignerAccounts;t++)n[t]=e.signatures[r.staticAccounts[t]]??new Uint8Array(Array(64).fill(0));}else n=Array(r.header.numSignerAccounts).fill(new Uint8Array(Array(64).fill(0)));return {compiledMessage:r,signatures:n}}function ie(e){return e.reduce((r,n)=>r===null||n===null?null:r+n,0)}function rn(e,r,n,t){if(typeof e=="number")return [e,t];if(typeof e=="object")return e.decode(n,t);if(e==="remainder"){let o=ie(r);if(o===null)throw new Error('Codecs of "remainder" size must have fixed-size items.');let i=n.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 nn(e){return typeof e=="object"?e.description:`${e}`}function dr(e,r){if(typeof e!="number")return null;if(e===0)return 0;let n=ie(r);return n===null?null:n*e}function tn(e,r){return typeof e=="object"?e.encode(r):new Uint8Array}function on(e,r,n){if(r!==n)throw new Error(`Expected [${e}] to have ${r} items, got ${n}.`)}function ur(e,r,n){if(r==="remainder"&&e.fixedSize===null)throw new Error('Codecs of "remainder" size must have fixed-size items.');return {description:n??`array(${e.description}; ${nn(r)})`,fixedSize:dr(r,[e.fixedSize]),maxSize:dr(r,[e.maxSize])}}function F(e,r={}){let n=r.size??re();return {...ur(e,n,r.description),encode:t=>(typeof n=="number"&&on("array",n,t.length),U([tn(n,t.length),...t.map(o=>e.encode(o))]))}}function W(e,r={}){let n=r.size??ne();return {...ur(e,n,r.description),decode:(t,o=0)=>{if(typeof n=="object"&&t.slice(o).length===0)return [[],o];let[i,s]=rn(n,[e.fixedSize],t,o);o=s;let a=[];for(let u=0;u<i;u+=1){let[d,l]=e.decode(t,o);a.push(d),o=l;}return [a,o]}}}function lr(e={}){let r=e.size??"variable",n=typeof r=="object"?r.description:`${r}`,t=e.description??`bytes(${n})`,o={description:t,encode:i=>i,fixedSize:null,maxSize:null};return r==="variable"?o:typeof r=="number"?J(o,r,t):{...o,encode:i=>{let s=o.encode(i),a=r.encode(s.length);return U([a,s])}}}function fr(e={}){let r=e.size??"variable",n=typeof r=="object"?r.description:`${r}`,t=e.description??`bytes(${n})`,o={decode:(i,s=0)=>{let a=i.slice(s);return [a,s+a.length]},description:t,fixedSize:null,maxSize:null};return r==="variable"?o:typeof r=="number"?Q(o,r,t):{...o,decode:(i,s=0)=>{k("bytes",i,s);let[a,u]=r.decode(i,s),d=Number(a);s=u;let l=i.slice(s,s+d);D("bytes",d,l);let[f,Nr]=o.decode(l);return s+=Nr,[f,s]}}}function mr(e,r){let n=e.map(([t,o])=>`${String(t)}: ${o.description}`).join(", ");return {description:r??`struct(${n})`,fixedSize:ie(e.map(([,t])=>t.fixedSize)),maxSize:ie(e.map(([,t])=>t.maxSize))}}function L(e,r={}){return {...mr(e,r.description),encode:n=>{let t=e.map(([o,i])=>i.encode(n[o]));return U(t)}}}function O(e,r={}){return {...mr(e,r.description),decode:(n,t=0)=>{let o={};return e.forEach(([i,s])=>{let[a,u]=s.decode(n,t);t=u,o[i]=a;}),[o,t]}}}function gr(e,r={}){return p(L(e,r),O(e,r))}var pr="lookupTableAddress",yr="writableIndices",hr="readableIndices",xr="addressTableLookup",Te;function sn(){return Te||(Te=L([["lookupTableAddress",xe({description:pr})],["writableIndices",F(A(),{description:yr,size:R()})],["readableIndices",F(A(),{description:hr,size:R()})]],{description:xr})),Te}var be;function an(){return be||(be=O([["lookupTableAddress",te({description:pr})],["writableIndices",W(E(),{description:yr,size:$()})],["readableIndices",W(E(),{description:hr,size:$()})]],{description:xr})),be}function Tr(){return p(sn(),an())}var Se;function cn(){return Se||(Se=Ve()),Se}function Ae(e){let r=cn();return {...r,description:e??r.description}}var dn=void 0,un=void 0,ln=void 0,fn=void 0;function br(){return gr([["numSignerAccounts",Ae(dn)],["numReadonlySignerAccounts",Ae(un)],["numReadonlyNonSignerAccounts",Ae(ln)]],{description:fn})}var Sr="programAddressIndex",Ar=void 0,Er="accountIndices",zr="data",Ee;function mn(){return Ee||(Ee=ee(L([["programAddressIndex",A({description:Sr})],["accountIndices",F(A({description:Ar}),{description:Er,size:R()})],["data",lr({description:zr,size:R()})]]),e=>e.accountIndices!==void 0&&e.data!==void 0?e:{...e,accountIndices:e.accountIndices??[],data:e.data??new Uint8Array(0)})),Ee}var ze;function gn(){return ze||(ze=$e(O([["programAddressIndex",E({description:Sr})],["accountIndices",W(E({description:Ar}),{description:Er,size:$()})],["data",fr({description:zr,size:$()})]]),e=>{if(e.accountIndices.length&&e.data.byteLength)return e;let{accountIndices:r,data:n,...t}=e;return {...t,...r.length?{accountIndices:r}:null,...n.byteLength?{data:n}:null}})),ze}function Ir(){return p(mn(),gn())}var Ie=128,wr={description:"",fixedSize:null,maxSize:1};function pn(e,r=0){let n=e[r];return n&Ie?[n^Ie,r+1]:["legacy",r]}function yn(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|Ie])}function hn(){return {...wr,decode:pn}}function xn(){return {...wr,encode:yn}}function Br(){return p(xn(),hn())}function Tn(e,r){let n=r+e[0].toUpperCase()+e.slice(1);return new Error(`No ${e} exists for ${r}. Use \`get${n}()\` if you need a ${e}, and \`get${r}Codec()\` if you need to both encode and decode ${r}`)}function se(e){return ()=>{throw Tn("decoder",e)}}var bn={description:"",fixedSize:null,maxSize:null};function Sn(e){return e.version==="legacy"?_(Cr()).serialize(e):ce(_([...Cr(),["addressTableLookups",An()]]),r=>r.version==="legacy"?r:{...r,addressTableLookups:r.addressTableLookups??[]}).serialize(e)}function H(e){return {description:e.description,deserialize:e.decode,fixedSize:e.fixedSize,maxSize:e.maxSize,serialize:e.encode}}function Cr(){return [["version",H(Br())],["header",H(br())],["staticAccounts",w(H(Je()),{description:"",size:I()})],["lifetimeToken",me({description:"",encoding:b,size:32})],["instructions",w(H(Ir()),{description:"",size:I()})]]}function An(){return w(H(Tr()),{size:I()})}function ae(){return {...bn,deserialize:se("CompiledMessage"),serialize:Sn}}var En={description:"",fixedSize:null,maxSize:null};function zn(e){let r=cr(e);return _([["signatures",w(fe({size:64}),{size:I()})],["compiledMessage",ae()]]).serialize(r)}function Dr(){return {...En,deserialize:se("CompiledMessage"),serialize:zn}}async function vr(e,r){await Xe();let n=await crypto.subtle.sign("Ed25519",e,r);return new Uint8Array(n)}function In(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 n=b.serialize(e).byteLength;if(n!==64)throw new Error(`Expected input string to decode to a byte array of length 64. Actual length: ${n}`)}catch(r){throw new Error(`\`${e}\` is not a transaction signature`,{cause:r})}}function ia(e){return !(e.length<64||e.length>88||b.serialize(e).byteLength!==64)}async function wn(e,r){let n=ae().serialize(e);return await vr(r,n)}function sa(e){let r=e.signatures[e.feePayer];if(!r)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(r)[0]}async function aa(e,r){let n=oe(r),t="signatures"in r?{...r.signatures}:{},o=await Promise.all(e.map(s=>Promise.all([Qe(s.publicKey),wn(n,s.privateKey)])));for(let[s,a]of o)t[s]=a;let i={...r,signatures:t};return Object.freeze(i),i}function ca(e){return In(e),e}function fa(e){let r=Dr().serialize(e);return btoa(String.fromCharCode(...r))}
|
|
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))}
|
|
6
6
|
|
|
7
|
-
exports.appendTransactionInstruction =
|
|
8
|
-
exports.assertIsBlockhash =
|
|
9
|
-
exports.assertIsDurableNonceTransaction =
|
|
10
|
-
exports.assertIsTransactionSignature =
|
|
11
|
-
exports.
|
|
12
|
-
exports.
|
|
13
|
-
exports.
|
|
14
|
-
exports.
|
|
15
|
-
exports.
|
|
16
|
-
exports.
|
|
17
|
-
exports.
|
|
18
|
-
exports.
|
|
19
|
-
exports.
|
|
20
|
-
exports.
|
|
21
|
-
exports.
|
|
22
|
-
exports.
|
|
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;
|
|
23
26
|
|
|
24
27
|
return exports;
|
|
25
28
|
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { getCompiledTransaction } from './compile-transaction';
|
|
2
|
+
import { ITransactionWithSignatures } from './signatures';
|
|
3
|
+
type CompiledTransaction = ReturnType<typeof getCompiledTransaction>;
|
|
4
|
+
type CompilableTransaction = Parameters<typeof getCompiledTransaction>[0];
|
|
5
|
+
export declare function decompileTransaction(compiledTransaction: CompiledTransaction, lastValidBlockHeight?: bigint): CompilableTransaction | (CompilableTransaction & ITransactionWithSignatures);
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=decompile-transaction.d.ts.map
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { Base58EncodedAddress } from '@solana/addresses';
|
|
2
|
-
import { IInstruction, IInstructionWithAccounts, IInstructionWithData } from '@solana/instructions';
|
|
3
|
-
import { ReadonlyAccount, ReadonlySignerAccount, WritableAccount } from '@solana/instructions/dist/types/accounts';
|
|
2
|
+
import { IInstruction, IInstructionWithAccounts, IInstructionWithData, ReadonlyAccount, ReadonlySignerAccount, WritableAccount, WritableSignerAccount } from '@solana/instructions';
|
|
4
3
|
import { ITransactionWithSignatures } from './signatures';
|
|
5
4
|
import { BaseTransaction } from './types';
|
|
6
5
|
type AdvanceNonceAccountInstruction<TNonceAccountAddress extends string = string, TNonceAuthorityAddress extends string = string> = IInstruction<'11111111111111111111111111111111'> & IInstructionWithAccounts<readonly [
|
|
7
6
|
WritableAccount<TNonceAccountAddress>,
|
|
8
7
|
ReadonlyAccount<'SysvarRecentB1ockHashes11111111111111111111'>,
|
|
9
|
-
ReadonlySignerAccount<TNonceAuthorityAddress>
|
|
8
|
+
ReadonlySignerAccount<TNonceAuthorityAddress> | WritableSignerAccount<TNonceAuthorityAddress>
|
|
10
9
|
]> & IInstructionWithData<AdvanceNonceAccountInstructionData>;
|
|
11
10
|
type AdvanceNonceAccountInstructionData = Uint8Array & {
|
|
12
11
|
readonly __brand: unique symbol;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Codec, Decoder, Encoder } from '@solana/codecs-core';
|
|
2
2
|
import { CompiledMessage } from '../message';
|
|
3
|
-
export declare function getCompiledMessageEncoder():
|
|
4
|
-
export declare function getCompiledMessageDecoder():
|
|
5
|
-
export declare function getCompiledMessageCodec():
|
|
3
|
+
export declare function getCompiledMessageEncoder(): Encoder<CompiledMessage>;
|
|
4
|
+
export declare function getCompiledMessageDecoder(): Decoder<CompiledMessage>;
|
|
5
|
+
export declare function getCompiledMessageCodec(): Codec<CompiledMessage>;
|
|
6
6
|
//# sourceMappingURL=message.d.ts.map
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { Codec, Decoder, Encoder } from '@solana/codecs-core';
|
|
2
|
+
import { compileMessage } from '../message';
|
|
3
|
+
import { ITransactionWithSignatures } from '../signatures';
|
|
4
|
+
type CompilableTransaction = Parameters<typeof compileMessage>[0];
|
|
5
|
+
export declare function getTransactionEncoder(): Encoder<CompilableTransaction | (CompilableTransaction & ITransactionWithSignatures)>;
|
|
6
|
+
export declare function getTransactionDecoder(lastValidBlockHeight?: bigint): Decoder<CompilableTransaction | (CompilableTransaction & ITransactionWithSignatures)>;
|
|
7
|
+
export declare function getTransactionCodec(lastValidBlockHeight?: bigint): Codec<CompilableTransaction | (CompilableTransaction & ITransactionWithSignatures)>;
|
|
5
8
|
export {};
|
|
6
9
|
//# sourceMappingURL=transaction.d.ts.map
|
|
@@ -16,4 +16,5 @@ export declare function isTransactionSignature(putativeTransactionSignature: str
|
|
|
16
16
|
export declare function getSignatureFromTransaction(transaction: ITransactionWithFeePayer & ITransactionWithSignatures): TransactionSignature;
|
|
17
17
|
export declare function signTransaction<TTransaction extends Parameters<typeof compileMessage>[0]>(keyPairs: CryptoKeyPair[], transaction: TTransaction | (TTransaction & ITransactionWithSignatures)): Promise<TTransaction & ITransactionWithSignatures>;
|
|
18
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;
|
|
19
20
|
//# sourceMappingURL=signatures.d.ts.map
|
|
@@ -2,5 +2,5 @@ import { getTransactionEncoder } from './serializers/transaction';
|
|
|
2
2
|
export type Base64EncodedWireTransaction = string & {
|
|
3
3
|
readonly __brand: unique symbol;
|
|
4
4
|
};
|
|
5
|
-
export declare function getBase64EncodedWireTransaction(transaction: Parameters<ReturnType<typeof getTransactionEncoder>['
|
|
5
|
+
export declare function getBase64EncodedWireTransaction(transaction: Parameters<ReturnType<typeof getTransactionEncoder>['encode']>[0]): Base64EncodedWireTransaction;
|
|
6
6
|
//# sourceMappingURL=wire-transaction.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solana/transactions",
|
|
3
|
-
"version": "2.0.0-experimental.
|
|
3
|
+
"version": "2.0.0-experimental.cf6ca9d",
|
|
4
4
|
"description": "Helpers for creating and serializing transactions",
|
|
5
5
|
"exports": {
|
|
6
6
|
"browser": {
|
|
@@ -47,11 +47,13 @@
|
|
|
47
47
|
],
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@metaplex-foundation/umi-serializers": "^0.8.9",
|
|
50
|
-
"@solana/addresses": "2.0.0-experimental.
|
|
51
|
-
"@solana/codecs-core": "2.0.0-experimental.
|
|
52
|
-
"@solana/codecs-data-structures": "2.0.0-experimental.
|
|
53
|
-
"@solana/codecs-numbers": "2.0.0-experimental.
|
|
54
|
-
"@solana/
|
|
50
|
+
"@solana/addresses": "2.0.0-experimental.cf6ca9d",
|
|
51
|
+
"@solana/codecs-core": "2.0.0-experimental.cf6ca9d",
|
|
52
|
+
"@solana/codecs-data-structures": "2.0.0-experimental.cf6ca9d",
|
|
53
|
+
"@solana/codecs-numbers": "2.0.0-experimental.cf6ca9d",
|
|
54
|
+
"@solana/codecs-strings": "2.0.0-experimental.cf6ca9d",
|
|
55
|
+
"@solana/functional": "2.0.0-experimental.cf6ca9d",
|
|
56
|
+
"@solana/keys": "2.0.0-experimental.cf6ca9d"
|
|
55
57
|
},
|
|
56
58
|
"devDependencies": {
|
|
57
59
|
"@solana/eslint-config-solana": "^1.0.2",
|
|
@@ -70,7 +72,7 @@
|
|
|
70
72
|
"tsup": "7.2.0",
|
|
71
73
|
"typescript": "^5.2.2",
|
|
72
74
|
"version-from-git": "^1.1.1",
|
|
73
|
-
"@solana/instructions": "2.0.0-experimental.
|
|
75
|
+
"@solana/instructions": "2.0.0-experimental.cf6ca9d",
|
|
74
76
|
"build-scripts": "0.0.0",
|
|
75
77
|
"test-config": "0.0.0",
|
|
76
78
|
"test-matchers": "0.0.0",
|