@solana/signers 2.0.0-experimental.efe6f4d → 2.0.0-experimental.fcff844
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 +214 -12
- package/dist/index.browser.cjs +197 -10
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +189 -12
- package/dist/index.browser.js.map +1 -1
- package/dist/index.development.js +537 -387
- package/dist/index.development.js.map +1 -1
- package/dist/index.native.js +189 -10
- package/dist/index.native.js.map +1 -1
- package/dist/index.node.cjs +197 -10
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.js +189 -10
- package/dist/index.node.js.map +1 -1
- package/dist/index.production.min.js +31 -21
- package/dist/types/account-signer-meta.d.ts +19 -0
- package/dist/types/account-signer-meta.d.ts.map +1 -0
- package/dist/types/add-signers.d.ts +9 -0
- package/dist/types/add-signers.d.ts.map +1 -0
- package/dist/types/deduplicate-signers.d.ts +5 -0
- package/dist/types/deduplicate-signers.d.ts.map +1 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/keypair-signer.d.ts.map +1 -0
- package/dist/types/message-modifying-signer.d.ts +3 -1
- package/dist/types/message-modifying-signer.d.ts.map +1 -0
- package/dist/types/message-partial-signer.d.ts +3 -2
- package/dist/types/message-partial-signer.d.ts.map +1 -0
- package/dist/types/message-signer.d.ts.map +1 -0
- package/dist/types/noop-signer.d.ts +8 -0
- package/dist/types/noop-signer.d.ts.map +1 -0
- package/dist/types/sign-transaction.d.ts +33 -0
- package/dist/types/sign-transaction.d.ts.map +1 -0
- package/dist/types/signable-message.d.ts.map +1 -0
- package/dist/types/transaction-modifying-signer.d.ts +3 -1
- package/dist/types/transaction-modifying-signer.d.ts.map +1 -0
- package/dist/types/transaction-partial-signer.d.ts +3 -2
- package/dist/types/transaction-partial-signer.d.ts.map +1 -0
- package/dist/types/transaction-sending-signer.d.ts +3 -1
- package/dist/types/transaction-sending-signer.d.ts.map +1 -0
- package/dist/types/transaction-signer.d.ts.map +1 -0
- package/dist/types/transaction-with-single-sending-signer.d.ts +11 -0
- package/dist/types/transaction-with-single-sending-signer.d.ts.map +1 -0
- package/dist/types/types.d.ts +3 -0
- package/dist/types/types.d.ts.map +1 -0
- package/package.json +7 -6
|
@@ -2,31 +2,41 @@ this.globalThis = this.globalThis || {};
|
|
|
2
2
|
this.globalThis.solanaWeb3 = (function (exports) {
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
|
-
function
|
|
5
|
+
function y(e){let n={};return e.forEach(r=>{if(!n[r.address])n[r.address]=r;else if(n[r.address]!==r)throw new Error(`Multiple distinct signers were identified for address "${r.address}". Please ensure that you are using the same signer instance for each address.`)}),Object.values(n)}function Oe(e){var n;return y(((n=e.accounts)!=null?n:[]).flatMap(r=>"signer"in r?r.signer:[]))}function B(e){return y(e.instructions.flatMap(Oe))}function ie(e){return e>=2}function We(e,n){if(!n.accounts||n.accounts.length===0)return n;let r=new Map(y(e).map(t=>[t.address,t]));return Object.freeze({...n,accounts:n.accounts.map(t=>{let i=r.get(t.address);return !ie(t.role)||"signer"in t||!i?t:Object.freeze({...t,signer:i})})})}function Fn(e,n){return n.instructions.length===0?n:Object.freeze({...n,instructions:n.instructions.map(r=>We(e,r))})}function M(e,n,r=0){if(n.length-r<=0)throw new Error(`Codec [${e}] cannot decode empty byte arrays.`)}function E(e,n,r,t=0){let i=r.length-t;if(i<n)throw new Error(`Codec [${e}] expected ${n} bytes, got ${i}.`)}var Ue=(e,n)=>{if(e.length>=n)return e;let r=new Uint8Array(n).fill(0);return r.set(e),r},Fe=(e,n)=>Ue(e.length<=n?e:e.slice(0,n),n);function S(e,n){return "fixedSize"in n?n.fixedSize:n.getSizeFromValue(e)}function l(e){return Object.freeze({...e,encode:n=>{let r=new Uint8Array(S(n,e));return e.write(n,r,0),r}})}function p(e){return Object.freeze({...e,decode:(n,r=0)=>e.read(n,r)[0]})}function I(e){return "fixedSize"in e&&typeof e.fixedSize=="number"}function se(e,n){if(!I(e))throw new Error(n!=null?n:"Expected a fixed-size codec, got a variable-size one.")}function Le(e){return !I(e)}function N(e,n){return l({fixedSize:n,write:(r,t,i)=>{let o=e.encode(r),s=o.length>n?o.slice(0,n):o;return t.set(s,i),i+n}})}function V(e,n){return p({fixedSize:n,read:(r,t)=>{E("fixCodec",n,r,t),(t>0||r.length>n)&&(r=r.slice(t,t+n)),I(e)&&(r=Fe(r,e.fixedSize));let[i]=e.read(r,0);return [i,t+n]}})}function z(e,n){return l({...Le(e)?{...e,getSizeFromValue:r=>e.getSizeFromValue(n(r))}:e,write:(r,t,i)=>e.write(n(r),t,i)})}function oe(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 ae(e){return (e==null?void 0:e.endian)!==1}function ce(e){return l({fixedSize:e.size,write(n,r,t){e.range&&oe(e.name,e.range[0],e.range[1],n);let i=new ArrayBuffer(e.size);return e.set(new DataView(i),n,ae(e.config)),r.set(new Uint8Array(i),t),t+e.size}})}function _e(e){return p({fixedSize:e.size,read(n,r=0){M(e.name,n,r),E(e.name,e.size,n,r);let t=new DataView($e(n,r,e.size));return [e.get(t,ae(e.config)),r+e.size]}})}function $e(e,n,r){let t=e.byteOffset+(n!=null?n:0),i=r!=null?r:e.byteLength;return e.buffer.slice(t,t+i)}var h=()=>l({getSizeFromValue:e=>e<=127?1:e<=16383?2:3,maxSize:3,write:(e,n,r)=>{oe("shortU16",0,65535,e);let t=[0];for(let i=0;;i+=1){let o=e>>i*7;if(o===0)break;let s=127&o;t[i]=s,i>0&&(t[i-1]|=128);}return n.set(t,r),r+t.length}});var O=(e={})=>ce({config:e,name:"u32",range:[0,+"0xffffffff"],set:(n,r,t)=>n.setUint32(0,r,t),size:4}),K=(e={})=>_e({config:e,get:(n,r)=>n.getUint32(0,r),name:"u32",size:4});var A=()=>ce({name:"u8",range:[0,+"0xff"],set:(e,n)=>e.setUint8(0,n),size:1});function Ve(e,n,r=n){if(!n.match(new RegExp(`^[${e}]*$`)))throw new Error(`Expected a string of base ${e.length}, got [${r}].`)}var Ke=e=>l({getSizeFromValue:n=>{let[r,t]=de(n,e[0]);if(t==="")return n.length;let i=ge(t,e);return r.length+Math.ceil(i.toString(16).length/2)},write(n,r,t){if(Ve(e,n),n==="")return t;let[i,o]=de(n,e[0]);if(o==="")return r.set(new Uint8Array(i.length).fill(0),t),t+i.length;let s=ge(o,e),a=[];for(;s>0n;)a.unshift(Number(s%256n)),s/=256n;let c=[...Array(i.length).fill(0),...a];return r.set(c,t),t+c.length}}),je=e=>p({read(n,r){let t=r===0?n:n.slice(r);if(t.length===0)return ["",0];let i=t.findIndex(c=>c!==0);i=i===-1?t.length:i;let o=e[0].repeat(i);if(i===t.length)return [o,n.length];let s=t.slice(i).reduce((c,d)=>c*256n+BigInt(d),0n),a=Ge(s,e);return [o+a,n.length]}});function de(e,n){let r=[...e].findIndex(t=>t!==n);return r===-1?[e,""]:[e.slice(0,r),e.slice(r)]}function ge(e,n){let r=BigInt(n.length);return [...e].reduce((t,i)=>t*r+BigInt(n.indexOf(i)),0n)}function Ge(e,n){let r=BigInt(n.length),t=[];for(;e>0n;)t.unshift(n[Number(e%r)]),e/=r;return t.join("")}var fe="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",W=()=>Ke(fe),j=()=>je(fe);var Ye=e=>e.replace(/\u0000/g,"");var He=globalThis.TextDecoder,ue=globalThis.TextEncoder,Xe=()=>{let e;return l({getSizeFromValue:n=>(e||(e=new ue)).encode(n).length,write:(n,r,t)=>{let i=(e||(e=new ue)).encode(n);return r.set(i,t),t+i.length}})},Ze=()=>{let e;return p({read(n,r){let t=(e||(e=new He)).decode(n.slice(r));return [Ye(t),n.length]}})};function U(e={}){var t,i;let n=(t=e.size)!=null?t:O(),r=(i=e.encoding)!=null?i:Xe();return n==="variable"?r:typeof n=="number"?N(r,n):l({getSizeFromValue:o=>{let s=S(o,r);return S(s,n)+s},write:(o,s,a)=>{let c=S(o,r);return a=n.write(c,s,a),r.write(o,s,a)}})}function G(e={}){var t,i;let n=(t=e.size)!=null?t:K(),r=(i=e.encoding)!=null?i:Ze();return n==="variable"?r:typeof n=="number"?V(r,n):p({read:(o,s=0)=>{M("string",o,s);let[a,c]=n.read(o,s),d=Number(a);s=c;let f=o.slice(s,s+d);E("string",d,f);let[te,Re]=r.read(f,0);return s+=Re,[te,s]}})}function Y(){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")}var b;async function qe(e){return b===void 0&&(b=new Promise(n=>{e.generateKey("Ed25519",!1,["sign","verify"]).catch(()=>{n(b=!1);}).then(()=>{n(b=!0);});})),typeof b=="boolean"?b:await b}async function le(){var e;if(Y(),typeof globalThis.crypto>"u"||typeof((e=globalThis.crypto.subtle)==null?void 0:e.generateKey)!="function")throw new Error("No key generation implementation could be found");if(!await qe(globalThis.crypto.subtle))throw new Error(`This runtime does not support the generation of Ed25519 key pairs.
|
|
6
6
|
|
|
7
7
|
Install and import \`@solana/webcrypto-ed25519-polyfill\` before generating keys in environments that do not support Ed25519.
|
|
8
8
|
|
|
9
|
-
For a list of runtimes that currently support Ed25519 operations, visit https://github.com/WICG/webcrypto-secure-curves/issues/20`)}async function de(){if(K(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.exportKey!="function")throw new Error("No key export implementation could be found")}async function ce(){if(K(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.sign!="function")throw new Error("No signing implementation could be found")}var j,V;function H(){return j||(j=M()),j}function $e(){return V||(V=_()),V}function ue(e){return !(e.length<32||e.length>44||H().encode(e).byteLength!==32)}function fe(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=H().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 Ue(e){return fe(e),e}function W(e){return T($({description:e?.description??"Address",encoding:H(),size:32}),n=>Ue(n))}function le(e){return F({description:e?.description??"Address",encoding:$e(),size:32})}function U(){return new Intl.Collator("en",{caseFirst:"lower",ignorePunctuation:!1,localeMatcher:"best fit",numeric:!1,sensitivity:"variant",usage:"sort"}).compare}async function P(e){if(await de(),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]=le().decode(new Uint8Array(n));return r}async function ge(){return await ae(),await crypto.subtle.generateKey("Ed25519",!1,["sign","verify"])}async function N(e,n){await ce();let r=await crypto.subtle.sign("Ed25519",e,n);return new Uint8Array(r)}function G(e){return e.reduce((n,r)=>n===null||r===null?null:n+r,0)}function Ne(e){return typeof e=="object"?e.description:`${e}`}function pe(e,n){if(typeof e!="number")return null;if(e===0)return 0;let r=G(n);return r===null?null:r*e}function Re(e,n){return typeof e=="object"?e.encode(n):new Uint8Array}function Oe(e,n,r){if(n!==r)throw new Error(`Expected [${e}] to have ${n} items, got ${r}.`)}function Le(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}; ${Ne(n)})`,fixedSize:pe(n,[e.fixedSize]),maxSize:pe(n,[e.maxSize])}}function y(e,n={}){let r=n.size??k();return {...Le(e,r,n.description),encode:t=>(typeof r=="number"&&Oe("array",r,t.length),b([Re(r,t.length),...t.map(i=>e.encode(i))]))}}function me(e={}){let n=e.size??"variable",r=typeof n=="object"?n.description:`${n}`,t=e.description??`bytes(${r})`,i={description:t,encode:o=>o,fixedSize:null,maxSize:null};return n==="variable"?i:typeof n=="number"?C(i,n,t):{...i,encode:o=>{let s=i.encode(o),a=n.encode(s.length);return b([a,s])}}}function _e(e,n){let r=e.map(([t,i])=>`${String(t)}: ${i.description}`).join(", ");return {description:n??`struct(${r})`,fixedSize:G(e.map(([,t])=>t.fixedSize)),maxSize:G(e.map(([,t])=>t.maxSize))}}function A(e,n={}){return {..._e(e,n.description),encode:r=>{let t=e.map(([i,o])=>o.encode(r[i]));return b(t)}}}var z=(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))(z||{}),Fe=1;function E(e){return e>=2}function v(e){return (e&Fe)!==0}function he(e,n){return e|n}function Se(e,n,r){e[n]=r(e[n]??{role:z.READONLY});}var c=Symbol("AddressMapTypeProperty");function Ke(e,n){let r={[e]:{[c]:0,role:z.WRITABLE_SIGNER}},t=new Set;for(let i of n){Se(r,i.programAddress,s=>{if(t.add(i.programAddress),c in s){if(v(s.role))switch(s[c]){case 0:throw new Error(`This transaction includes an address (\`${i.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 (\`${i.programAddress}\`) which is both invoked and marked writable. Program addresses may not be writable.`)}if(s[c]===2)return s}return {[c]:2,role:z.READONLY}});let o;if(i.accounts)for(let s of i.accounts)Se(r,s.address,a=>{let{address:l,...d}=s;if(c in a)switch(a[c]){case 0:return a;case 1:{let u=he(a.role,d.role);if("lookupTableAddress"in d){if(a.lookupTableAddress!==d.lookupTableAddress&&(o||(o=U()))(d.lookupTableAddress,a.lookupTableAddress)<0)return {[c]:1,...d,role:u}}else if(E(d.role))return {[c]:2,role:u};return a.role!==u?{...a,role:u}:a}case 2:{let u=he(a.role,d.role);if(t.has(s.address)){if(v(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!==u?{...a,role:u}:a}else return "lookupTableAddress"in d&&!E(a.role)?{...d,[c]:1,role:u}:a.role!==u?{...a,role:u}:a}}return "lookupTableAddress"in d?{...d,[c]:1}:{...d,[c]:2}});}return r}function je(e){let n;return Object.entries(e).sort(([t,i],[o,s])=>{if(i[c]!==s[c]){if(i[c]===0)return -1;if(s[c]===0)return 1;if(i[c]===2)return -1;if(s[c]===2)return 1}let a=E(i.role);if(a!==E(s.role))return a?-1:1;let l=v(i.role);return l!==v(s.role)?l?-1:1:(n||(n=U()),i[c]===1&&s[c]===1&&i.lookupTableAddress!==s.lookupTableAddress?n(i.lookupTableAddress,s.lookupTableAddress):n(t,o))}).map(([t,i])=>({address:t,...i}))}function Ve(e){var n;let r={};for(let t of e){if(!("lookupTableAddress"in t))continue;let i=r[n=t.lookupTableAddress]||(r[n]={readableIndices:[],writableIndices:[]});t.role===z.WRITABLE?i.writableIndices.push(t.addressIndex):i.readableIndices.push(t.addressIndex);}return Object.keys(r).sort(U()).map(t=>({lookupTableAddress:t,...r[t]}))}function He(e){let n=0,r=0,t=0;for(let i of e){if("lookupTableAddress"in i)break;let o=v(i.role);E(i.role)?(t++,o||r++):o||n++;}return {numReadonlyNonSignerAccounts:n,numReadonlySignerAccounts:r,numSignerAccounts:t}}function We(e){let n={};for(let[r,t]of e.entries())n[t.address]=r;return n}function Ge(e,n){let r=We(n);return e.map(({accounts:t,data:i,programAddress:o})=>({programAddressIndex:r[o],...t?{accountIndices:t.map(({address:s})=>r[s])}:null,...i?{data:i}:null}))}function Ye(e){return "nonce"in e?e.nonce:e.blockhash}function Xe(e){let n=e.findIndex(t=>"lookupTableAddress"in t);return (n===-1?e:e.slice(0,n)).map(({address:t})=>t)}function qe(e){let n=Ke(e.feePayer,e.instructions),r=je(n);return {...e.version!=="legacy"?{addressTableLookups:Ve(r)}:null,header:He(r),instructions:Ge(e.instructions,r),lifetimeToken:Ye(e.lifetimeConstraint),staticAccounts:Xe(r),version:e.version}}var Ze="lookupTableAddress",Je="writableIndices",Qe="readableIndices",en="addressTableLookup",Y;function nn(){return Y||(Y=A([["lookupTableAddress",W({description:Ze})],["writableIndices",y(h(),{description:Je,size:m()})],["readableIndices",y(h(),{description:Qe,size:m()})]],{description:en})),Y}var X;function rn(){return X||(X=h()),X}function q(e){let n=rn();return {...n,description:e??n.description}}var tn=void 0,on=void 0,sn=void 0,an=void 0;function dn(){return A([["numSignerAccounts",q(tn)],["numReadonlySignerAccounts",q(on)],["numReadonlyNonSignerAccounts",q(sn)]],{description:an})}var cn="programAddressIndex",un=void 0,fn="accountIndices",ln="data",Z;function gn(){return Z||(Z=T(A([["programAddressIndex",h({description:cn})],["accountIndices",y(h({description:un}),{description:fn,size:m()})],["data",me({description:ln,size:m()})]]),e=>e.accountIndices!==void 0&&e.data!==void 0?e:{...e,accountIndices:e.accountIndices??[],data:e.data??new Uint8Array(0)})),Z}var pn=128,mn={description:"",fixedSize:null,maxSize:1};function hn(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|pn])}function Sn(){return {...mn,encode:hn}}var yn="staticAccounts",xn="lifetimeToken",bn="instructions",An="addressTableLookups";function wn(){return A(ye())}function Tn(){return T(A([...ye(),["addressTableLookups",zn()]]),e=>e.version==="legacy"?e:{...e,addressTableLookups:e.addressTableLookups??[]})}function ye(){return [["version",Sn()],["header",dn()],["staticAccounts",y(W(),{description:yn,size:m()})],["lifetimeToken",$({description:xn,encoding:M(),size:32})],["instructions",y(gn(),{description:bn,size:m()})]]}function zn(){return y(nn(),{description:An,size:m()})}var En="message";function vn(){return {description:En,encode:e=>e.version==="legacy"?wn().encode(e):Tn().encode(e),fixedSize:null,maxSize:null}}async function xe(e,n){let r=qe(n),t="signatures"in n?{...n.signatures}:{},i=vn().encode(r),o=await Promise.all(e.map(a=>Promise.all([P(a.publicKey),N(a.privateKey,i)])));for(let[a,l]of o)t[a]=l;let s={...n,signatures:t};return Object.freeze(s),s}function I(e){return "signMessages"in e&&typeof e.signMessages=="function"}function yr(e){if(!I(e))throw new Error("The provided value does not implement the MessagePartialSigner interface")}function D(e){return "signTransactions"in e&&typeof e.signTransactions=="function"}function Ar(e){if(!D(e))throw new Error("The provided value does not implement the TransactionPartialSigner interface")}function In(e){return "keyPair"in e&&typeof e.keyPair=="object"&&I(e)&&D(e)}function Mr(e){if(!In(e))throw new Error("The provided value does not implement the KeyPairSigner interface")}async function Dn(e){let n=await P(e.publicKey);return Object.freeze({address:n,keyPair:e,signMessages:t=>Promise.all(t.map(async i=>Object.freeze({[n]:await N(e.privateKey,i.content)}))),signTransactions:t=>Promise.all(t.map(async i=>{let o=await xe([e],i);return Object.freeze({[n]:o.signatures[n]})}))})}async function $r(){return Dn(await ge())}function J(e){return ue(e.address)&&"modifyAndSignMessages"in e&&typeof e.modifyAndSignMessages=="function"}function Or(e){if(!J(e))throw new Error("The provided value does not implement the MessageModifyingSigner interface")}function Cn(e){return I(e)||J(e)}function Hr(e){if(!Cn(e))throw new Error("The provided value does not implement any of the MessageSigner interfaces")}var be=globalThis.TextEncoder;function Jr(e,n={}){return Object.freeze({content:typeof e=="string"?new be().encode(e):e,signatures:Object.freeze({...n})})}function Q(e){return "modifyAndSignTransactions"in e&&typeof e.modifyAndSignTransactions=="function"}function nt(e){if(!Q(e))throw new Error("The provided value does not implement the TransactionModifyingSigner interface")}function ee(e){return "signAndSendTransactions"in e&&typeof e.signAndSendTransactions=="function"}function it(e){if(!ee(e))throw new Error("The provided value does not implement the TransactionSendingSigner interface")}function Bn(e){return D(e)||Q(e)||ee(e)}function gt(e){if(!Bn(e))throw new Error("The provided value does not implement any of the TransactionSigner interfaces")}
|
|
9
|
+
For a list of runtimes that currently support Ed25519 operations, visit https://github.com/WICG/webcrypto-secure-curves/issues/20`)}async function me(){var e;if(Y(),typeof globalThis.crypto>"u"||typeof((e=globalThis.crypto.subtle)==null?void 0:e.exportKey)!="function")throw new Error("No key export implementation could be found")}async function Se(){var e;if(Y(),typeof globalThis.crypto>"u"||typeof((e=globalThis.crypto.subtle)==null?void 0:e.sign)!="function")throw new Error("No signing implementation could be found")}var H,X;function Z(){return H||(H=W()),H}function Je(){return X||(X=j()),X}function pe(e){return !(e.length<32||e.length>44||Z().encode(e).byteLength!==32)}function Te(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=Z().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 Qe(e){return Te(e),e}function q(){return z(U({encoding:Z(),size:32}),e=>Qe(e))}function ye(){return G({encoding:Je(),size:32})}function F(){return new Intl.Collator("en",{caseFirst:"lower",ignorePunctuation:!1,localeMatcher:"best fit",numeric:!1,sensitivity:"variant",usage:"sort"}).compare}async function L(e){if(await me(),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);return ye().decode(new Uint8Array(n))}async function he(){return await le(),await crypto.subtle.generateKey("Ed25519",!1,["sign","verify"])}async function _(e,n){await Se();let r=await crypto.subtle.sign("Ed25519",e,n);return new Uint8Array(r)}function rn(e,n,r){if(n!==r)throw new Error(`Expected [${e}] to have ${n} items, got ${r}.`)}function Ae(e){return e.reduce((n,r)=>n===null||r===null?null:n+r,0)}function we(e){return I(e)?e.fixedSize:null}function xe(e){var n;return I(e)?e.fixedSize:(n=e.maxSize)!=null?n:null}function w(e,n={}){var o,s;let r=(o=n.size)!=null?o:O();r==="remainder"&&se(e,'Codecs of "remainder" size must have fixed-size items.');let t=be(r,we(e)),i=(s=be(r,xe(e)))!=null?s:void 0;return l({...t!==null?{fixedSize:t}:{getSizeFromValue:a=>(typeof r=="object"?S(a.length,r):0)+[...a].reduce((d,f)=>d+S(f,e),0),maxSize:i},write:(a,c,d)=>(typeof r=="number"&&rn("array",r,a.length),typeof r=="object"&&(d=r.write(a.length,c,d)),a.forEach(f=>{d=e.write(f,c,d);}),d)})}function be(e,n){return typeof e!="number"?null:e===0?0:n===null?null:n*e}function Ee(e={}){var t;let n=(t=e.size)!=null?t:"variable",r=l({getSizeFromValue:i=>i.length,write:(i,o,s)=>(o.set(i,s),s+i.length)});return n==="variable"?r:typeof n=="number"?N(r,n):l({getSizeFromValue:i=>S(i.length,n)+i.length,write:(i,o,s)=>(s=n.write(i.length,o,s),r.write(i,o,s))})}function v(e){var i;let n=e.map(([,o])=>o),r=Ae(n.map(we)),t=(i=Ae(n.map(xe)))!=null?i:void 0;return l({...r===null?{getSizeFromValue:o=>e.map(([s,a])=>S(o[s],a)).reduce((s,a)=>s+a,0),maxSize:t}:{fixedSize:r},write:(o,s,a)=>(e.forEach(([c,d])=>{a=d.write(o[c],s,a);}),a)})}var D=(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))(D||{}),tn=1;function C(e){return e>=2}function P(e){return (e&tn)!==0}function Ie(e,n){return e|n}function ze(e,n,r){var t;e[n]=r((t=e[n])!=null?t:{role:D.READONLY});}var u=Symbol("AddressMapTypeProperty");function sn(e,n){let r={[e]:{[u]:0,role:D.WRITABLE_SIGNER}},t=new Set;for(let i of n){ze(r,i.programAddress,s=>{if(t.add(i.programAddress),u in s){if(P(s.role))switch(s[u]){case 0:throw new Error(`This transaction includes an address (\`${i.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 (\`${i.programAddress}\`) which is both invoked and marked writable. Program addresses may not be writable.`)}if(s[u]===2)return s}return {[u]:2,role:D.READONLY}});let o;if(i.accounts)for(let s of i.accounts)ze(r,s.address,a=>{let{address:c,...d}=s;if(u in a)switch(a[u]){case 0:return a;case 1:{let f=Ie(a.role,d.role);if("lookupTableAddress"in d){if(a.lookupTableAddress!==d.lookupTableAddress&&(o||(o=F()))(d.lookupTableAddress,a.lookupTableAddress)<0)return {[u]:1,...d,role:f}}else if(C(d.role))return {[u]:2,role:f};return a.role!==f?{...a,role:f}:a}case 2:{let f=Ie(a.role,d.role);if(t.has(s.address)){if(P(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!==f?{...a,role:f}:a}else return "lookupTableAddress"in d&&!C(a.role)?{...d,[u]:1,role:f}:a.role!==f?{...a,role:f}:a}}return "lookupTableAddress"in d?{...d,[u]:1}:{...d,[u]:2}});}return r}function on(e){let n;return Object.entries(e).sort(([t,i],[o,s])=>{if(i[u]!==s[u]){if(i[u]===0)return -1;if(s[u]===0)return 1;if(i[u]===2)return -1;if(s[u]===2)return 1}let a=C(i.role);if(a!==C(s.role))return a?-1:1;let c=P(i.role);return c!==P(s.role)?c?-1:1:(n||(n=F()),i[u]===1&&s[u]===1&&i.lookupTableAddress!==s.lookupTableAddress?n(i.lookupTableAddress,s.lookupTableAddress):n(t,o))}).map(([t,i])=>({address:t,...i}))}function an(e){var r;let n={};for(let t of e){if(!("lookupTableAddress"in t))continue;let i=n[r=t.lookupTableAddress]||(n[r]={readableIndices:[],writableIndices:[]});t.role===D.WRITABLE?i.writableIndices.push(t.addressIndex):i.readableIndices.push(t.addressIndex);}return Object.keys(n).sort(F()).map(t=>({lookupTableAddress:t,...n[t]}))}function cn(e){let n=0,r=0,t=0;for(let i of e){if("lookupTableAddress"in i)break;let o=P(i.role);C(i.role)?(t++,o||r++):o||n++;}return {numReadonlyNonSignerAccounts:n,numReadonlySignerAccounts:r,numSignerAccounts:t}}function dn(e){let n={};for(let[r,t]of e.entries())n[t.address]=r;return n}function gn(e,n){let r=dn(n);return e.map(({accounts:t,data:i,programAddress:o})=>({programAddressIndex:r[o],...t?{accountIndices:t.map(({address:s})=>r[s])}:null,...i?{data:i}:null}))}function un(e){return "nonce"in e?e.nonce:e.blockhash}function fn(e){let n=e.findIndex(t=>"lookupTableAddress"in t);return (n===-1?e:e.slice(0,n)).map(({address:t})=>t)}function ln(e){let n=sn(e.feePayer,e.instructions),r=on(n);return {...e.version!=="legacy"?{addressTableLookups:an(r)}:null,header:cn(r),instructions:gn(e.instructions,r),lifetimeToken:un(e.lifetimeConstraint),staticAccounts:fn(r),version:e.version}}var J;function mn(){return J||(J=v([["lookupTableAddress",q()],["writableIndices",w(A(),{size:h()})],["readableIndices",w(A(),{size:h()})]])),J}var Q;function ee(){return Q||(Q=A()),Q}function Sn(){return v([["numSignerAccounts",ee()],["numReadonlySignerAccounts",ee()],["numReadonlyNonSignerAccounts",ee()]])}var ne;function pn(){return ne||(ne=z(v([["programAddressIndex",A()],["accountIndices",w(A(),{size:h()})],["data",Ee({size:h()})]]),e=>{var n,r;return e.accountIndices!==void 0&&e.data!==void 0?e:{...e,accountIndices:(n=e.accountIndices)!=null?n:[],data:(r=e.data)!=null?r:new Uint8Array(0)}})),ne}var Tn=128;function yn(){return l({getSizeFromValue:e=>e==="legacy"?0:1,maxSize:1,write:(e,n,r)=>{if(e==="legacy")return r;if(e<0||e>127)throw new Error(`Transaction version must be in the range [0, 127]. \`${e}\` given.`);return n.set([e|Tn],r),r+1}})}function ve(){return v(Be())}function Ce(){return z(v([...Be(),["addressTableLookups",hn()]]),e=>{var n;return e.version==="legacy"?e:{...e,addressTableLookups:(n=e.addressTableLookups)!=null?n:[]}})}function Be(){return [["version",yn()],["header",Sn()],["staticAccounts",w(q(),{size:h()})],["lifetimeToken",U({encoding:W(),size:32})],["instructions",w(pn(),{size:h()})]]}function hn(){return w(mn(),{size:h()})}function An(){return l({getSizeFromValue:e=>e.version==="legacy"?ve().getSizeFromValue(e):Ce().getSizeFromValue(e),write:(e,n,r)=>e.version==="legacy"?ve().write(e,n,r):Ce().write(e,n,r)})}async function Me(e,n){let r=ln(n),t="signatures"in n?{...n.signatures}:{},i=An().encode(r),o=await Promise.all(e.map(a=>Promise.all([L(a.publicKey),_(a.privateKey,i)])));for(let[a,c]of o)t[a]=c;let s={...n,signatures:t};return Object.freeze(s),s}function De(e){let n=e.instructions.flatMap(t=>{var i,o;return (o=(i=t.accounts)==null?void 0:i.filter(s=>C(s.role)))!=null?o:[]}).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 k(e){return "signMessages"in e&&typeof e.signMessages=="function"}function zr(e){if(!k(e))throw new Error("The provided value does not implement the MessagePartialSigner interface")}function m(e){return "signTransactions"in e&&typeof e.signTransactions=="function"}function Br(e){if(!m(e))throw new Error("The provided value does not implement the TransactionPartialSigner interface")}function bn(e){return "keyPair"in e&&typeof e.keyPair=="object"&&k(e)&&m(e)}function Lr(e){if(!bn(e))throw new Error("The provided value does not implement the KeyPairSigner interface")}async function wn(e){let n=await L(e.publicKey);return Object.freeze({address:n,keyPair:e,signMessages:t=>Promise.all(t.map(async i=>Object.freeze({[n]:await _(e.privateKey,i.content)}))),signTransactions:t=>Promise.all(t.map(async i=>{let o=await Me([e],i);return Object.freeze({[n]:o.signatures[n]})}))})}async function _r(){return wn(await he())}function re(e){return pe(e.address)&&"modifyAndSignMessages"in e&&typeof e.modifyAndSignMessages=="function"}function Gr(e){if(!re(e))throw new Error("The provided value does not implement the MessageModifyingSigner interface")}function xn(e){return k(e)||re(e)}function Qr(e){if(!xn(e))throw new Error("The provided value does not implement any of the MessageSigner interfaces")}function rt(e){return Object.freeze({address:e,signMessages:async r=>r.map(()=>Object.freeze({})),signTransactions:async r=>r.map(()=>Object.freeze({}))})}function T(e){return "modifyAndSignTransactions"in e&&typeof e.modifyAndSignTransactions=="function"}function st(e){if(!T(e))throw new Error("The provided value does not implement the TransactionModifyingSigner interface")}function x(e){return "signAndSendTransactions"in e&&typeof e.signAndSendTransactions=="function"}function ct(e){if(!x(e))throw new Error("The provided value does not implement the TransactionSendingSigner interface")}function $(e){return m(e)||T(e)||x(e)}function Tt(e){if(!$(e))throw new Error("The provided value does not implement any of the TransactionSigner interfaces")}async function En(e,n={}){let{partialSigners:r,modifyingSigners:t}=Pe(y(B(e).filter($)),{identifySendingSigner:!1});return ke(e,t,r,n.abortSignal)}async function Rt(e,n={}){let r=await En(e,n);return De(r),r}async function Ot(e,n={}){let r=n.abortSignal,{partialSigners:t,modifyingSigners:i,sendingSigner:o}=Pe(y(B(e).filter($)));r==null||r.throwIfAborted();let s=await ke(e,i,t,r);if(!o)throw new Error("No `TransactionSendingSigner` was identified. Please provide a valid `ITransactionWithSingleSendingSigner` transaction.");r==null||r.throwIfAborted();let[a]=await o.signAndSendTransactions([s],{abortSignal:r});return r==null||r.throwIfAborted(),a}function Pe(e,n={}){var a;let t=((a=n.identifySendingSigner)!=null?a:!0)?In(e):null,i=e.filter(c=>c!==t&&(T(c)||m(c))),o=zn(i),s=i.filter(m).filter(c=>!o.includes(c));return Object.freeze({modifyingSigners:o,partialSigners:s,sendingSigner:t})}function In(e){let n=e.filter(x);if(n.length===0)return null;let r=n.filter(t=>!T(t)&&!m(t));return r.length>0?r[0]:n[0]}function zn(e){let n=e.filter(T);if(n.length===0)return [];let r=n.filter(t=>!m(t));return r.length>0?r:[n[0]]}async function ke(e,n=[],r=[],t){var a;let i=await n.reduce(async(c,d)=>{t==null||t.throwIfAborted();let[f]=await d.modifyAndSignTransactions([await c],{abortSignal:t});return Object.freeze(f)},Promise.resolve(e));t==null||t.throwIfAborted();let o=await Promise.all(r.map(async c=>{let[d]=await c.signTransactions([i],{abortSignal:t});return d})),s={...i,signatures:Object.freeze(o.reduce((c,d)=>({...c,...d}),(a=i.signatures)!=null?a:{}))};return Object.freeze(s)}var Ne=globalThis.TextEncoder;function Vt(e,n={}){return Object.freeze({content:typeof e=="string"?new Ne().encode(e):e,signatures:Object.freeze({...n})})}function qt(e){try{return vn(e),!0}catch{return !1}}function vn(e){let r=B(e).filter(x);if(r.length===0){let i=new Error("No `TransactionSendingSigner` was identified.");throw i.name="MissingTransactionSendingSignerError",i}if(r.filter(i=>!m(i)&&!T(i)).length>1){let i=new Error("More than one `TransactionSendingSigner` was identified.");throw i.name="MultipleTransactionSendingSignersError",i}}
|
|
10
10
|
|
|
11
|
-
exports.
|
|
12
|
-
exports.
|
|
13
|
-
exports.
|
|
14
|
-
exports.
|
|
15
|
-
exports.
|
|
16
|
-
exports.
|
|
17
|
-
exports.
|
|
18
|
-
exports.
|
|
19
|
-
exports.
|
|
20
|
-
exports.
|
|
21
|
-
exports.
|
|
22
|
-
exports.
|
|
23
|
-
exports.
|
|
24
|
-
exports.
|
|
25
|
-
exports.
|
|
26
|
-
exports.
|
|
27
|
-
exports.
|
|
28
|
-
exports.
|
|
29
|
-
exports.
|
|
11
|
+
exports.addSignersToInstruction = We;
|
|
12
|
+
exports.addSignersToTransaction = Fn;
|
|
13
|
+
exports.assertIsKeyPairSigner = Lr;
|
|
14
|
+
exports.assertIsMessageModifyingSigner = Gr;
|
|
15
|
+
exports.assertIsMessagePartialSigner = zr;
|
|
16
|
+
exports.assertIsMessageSigner = Qr;
|
|
17
|
+
exports.assertIsTransactionModifyingSigner = st;
|
|
18
|
+
exports.assertIsTransactionPartialSigner = Br;
|
|
19
|
+
exports.assertIsTransactionSendingSigner = ct;
|
|
20
|
+
exports.assertIsTransactionSigner = Tt;
|
|
21
|
+
exports.assertIsTransactionWithSingleSendingSigner = vn;
|
|
22
|
+
exports.createNoopSigner = rt;
|
|
23
|
+
exports.createSignableMessage = Vt;
|
|
24
|
+
exports.createSignerFromKeyPair = wn;
|
|
25
|
+
exports.generateKeyPairSigner = _r;
|
|
26
|
+
exports.getSignersFromInstruction = Oe;
|
|
27
|
+
exports.getSignersFromTransaction = B;
|
|
28
|
+
exports.isKeyPairSigner = bn;
|
|
29
|
+
exports.isMessageModifyingSigner = re;
|
|
30
|
+
exports.isMessagePartialSigner = k;
|
|
31
|
+
exports.isMessageSigner = xn;
|
|
32
|
+
exports.isTransactionModifyingSigner = T;
|
|
33
|
+
exports.isTransactionPartialSigner = m;
|
|
34
|
+
exports.isTransactionSendingSigner = x;
|
|
35
|
+
exports.isTransactionSigner = $;
|
|
36
|
+
exports.isTransactionWithSingleSendingSigner = qt;
|
|
37
|
+
exports.partiallySignTransactionWithSigners = En;
|
|
38
|
+
exports.signAndSendTransactionWithSigners = Ot;
|
|
39
|
+
exports.signTransactionWithSigners = Rt;
|
|
30
40
|
|
|
31
41
|
return exports;
|
|
32
42
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AccountRole, IAccountLookupMeta, IAccountMeta, IInstruction } from '@solana/instructions';
|
|
2
|
+
import { BaseTransaction, TransactionVersion } from '@solana/transactions';
|
|
3
|
+
import { TransactionSigner } from './transaction-signer';
|
|
4
|
+
/** An extension of the IAccountMeta type that keeps track of its transaction signer. */
|
|
5
|
+
export interface IAccountSignerMeta<TAddress extends string = string, TSigner extends TransactionSigner = TransactionSigner> extends IAccountMeta<TAddress> {
|
|
6
|
+
readonly role: AccountRole.READONLY_SIGNER | AccountRole.WRITABLE_SIGNER;
|
|
7
|
+
readonly signer: TSigner;
|
|
8
|
+
}
|
|
9
|
+
type IAccountMetaWithWithSigner<TSigner extends TransactionSigner = TransactionSigner> = IAccountMeta | IAccountLookupMeta | IAccountSignerMeta<string, TSigner>;
|
|
10
|
+
/** A variation of the instruction type that allows IAccountSignerMeta in its account metas. */
|
|
11
|
+
export type IInstructionWithSigners<TSigner extends TransactionSigner = TransactionSigner, TAccounts extends readonly IAccountMetaWithWithSigner<TSigner>[] = readonly IAccountMetaWithWithSigner<TSigner>[]> = Pick<IInstruction<string, TAccounts>, 'accounts'>;
|
|
12
|
+
/** A variation of the transaction type that allows IAccountSignerMeta in its account metas. */
|
|
13
|
+
export type ITransactionWithSigners<TSigner extends TransactionSigner = TransactionSigner, TAccounts extends readonly IAccountMetaWithWithSigner<TSigner>[] = readonly IAccountMetaWithWithSigner<TSigner>[]> = Pick<BaseTransaction<TransactionVersion, IInstruction & IInstructionWithSigners<TSigner, TAccounts>>, 'instructions'>;
|
|
14
|
+
/** Extract all signers from an instruction that may contain IAccountSignerMeta accounts. */
|
|
15
|
+
export declare function getSignersFromInstruction<TSigner extends TransactionSigner = TransactionSigner>(instruction: IInstructionWithSigners<TSigner>): readonly TSigner[];
|
|
16
|
+
/** Extract all signers from a transaction that may contain IAccountSignerMeta accounts. */
|
|
17
|
+
export declare function getSignersFromTransaction<TSigner extends TransactionSigner = TransactionSigner, TTransaction extends ITransactionWithSigners<TSigner> = ITransactionWithSigners<TSigner>>(transaction: TTransaction): readonly TSigner[];
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=account-signer-meta.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account-signer-meta.d.ts","sourceRoot":"","sources":["../../src/account-signer-meta.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACnG,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,wFAAwF;AACxF,MAAM,WAAW,kBAAkB,CAC/B,QAAQ,SAAS,MAAM,GAAG,MAAM,EAChC,OAAO,SAAS,iBAAiB,GAAG,iBAAiB,CACvD,SAAQ,YAAY,CAAC,QAAQ,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC,eAAe,GAAG,WAAW,CAAC,eAAe,CAAC;IACzE,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC5B;AAED,KAAK,0BAA0B,CAAC,OAAO,SAAS,iBAAiB,GAAG,iBAAiB,IAC/E,YAAY,GACZ,kBAAkB,GAClB,kBAAkB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE1C,+FAA+F;AAC/F,MAAM,MAAM,uBAAuB,CAC/B,OAAO,SAAS,iBAAiB,GAAG,iBAAiB,EACrD,SAAS,SAAS,SAAS,0BAA0B,CAAC,OAAO,CAAC,EAAE,GAAG,SAAS,0BAA0B,CAAC,OAAO,CAAC,EAAE,IACjH,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE,UAAU,CAAC,CAAC;AAEtD,+FAA+F;AAC/F,MAAM,MAAM,uBAAuB,CAC/B,OAAO,SAAS,iBAAiB,GAAG,iBAAiB,EACrD,SAAS,SAAS,SAAS,0BAA0B,CAAC,OAAO,CAAC,EAAE,GAAG,SAAS,0BAA0B,CAAC,OAAO,CAAC,EAAE,IACjH,IAAI,CACJ,eAAe,CAAC,kBAAkB,EAAE,YAAY,GAAG,uBAAuB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,EAC/F,cAAc,CACjB,CAAC;AAEF,4FAA4F;AAC5F,wBAAgB,yBAAyB,CAAC,OAAO,SAAS,iBAAiB,GAAG,iBAAiB,EAC3F,WAAW,EAAE,uBAAuB,CAAC,OAAO,CAAC,GAC9C,SAAS,OAAO,EAAE,CAIpB;AAED,2FAA2F;AAC3F,wBAAgB,yBAAyB,CACrC,OAAO,SAAS,iBAAiB,GAAG,iBAAiB,EACrD,YAAY,SAAS,uBAAuB,CAAC,OAAO,CAAC,GAAG,uBAAuB,CAAC,OAAO,CAAC,EAC1F,WAAW,EAAE,YAAY,GAAG,SAAS,OAAO,EAAE,CAE/C"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IInstruction } from '@solana/instructions';
|
|
2
|
+
import { BaseTransaction } from '@solana/transactions';
|
|
3
|
+
import { IInstructionWithSigners, ITransactionWithSigners } from './account-signer-meta';
|
|
4
|
+
import { TransactionSigner } from './transaction-signer';
|
|
5
|
+
/** Attaches the provided signers to the account metas of an instruction when applicable. */
|
|
6
|
+
export declare function addSignersToInstruction<TInstruction extends IInstruction>(signers: TransactionSigner[], instruction: TInstruction | (TInstruction & IInstructionWithSigners)): TInstruction & IInstructionWithSigners;
|
|
7
|
+
/** Attaches the provided signers to the account metas of a transaction when applicable. */
|
|
8
|
+
export declare function addSignersToTransaction<TTransaction extends BaseTransaction>(signers: TransactionSigner[], transaction: TTransaction | (TTransaction & ITransactionWithSigners)): TTransaction & ITransactionWithSigners;
|
|
9
|
+
//# sourceMappingURL=add-signers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-signers.d.ts","sourceRoot":"","sources":["../../src/add-signers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAgB,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,EAAsB,uBAAuB,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAE7G,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,4FAA4F;AAC5F,wBAAgB,uBAAuB,CAAC,YAAY,SAAS,YAAY,EACrE,OAAO,EAAE,iBAAiB,EAAE,EAC5B,WAAW,EAAE,YAAY,GAAG,CAAC,YAAY,GAAG,uBAAuB,CAAC,GACrE,YAAY,GAAG,uBAAuB,CAgBxC;AAED,2FAA2F;AAC3F,wBAAgB,uBAAuB,CAAC,YAAY,SAAS,eAAe,EACxE,OAAO,EAAE,iBAAiB,EAAE,EAC5B,WAAW,EAAE,YAAY,GAAG,CAAC,YAAY,GAAG,uBAAuB,CAAC,GACrE,YAAY,GAAG,uBAAuB,CASxC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { MessageSigner } from './message-signer';
|
|
2
|
+
import { TransactionSigner } from './transaction-signer';
|
|
3
|
+
/** Removes all duplicated signers from a provided array by comparing their addresses. */
|
|
4
|
+
export declare function deduplicateSigners<TSigner extends MessageSigner | TransactionSigner>(signers: readonly TSigner[]): readonly TSigner[];
|
|
5
|
+
//# sourceMappingURL=deduplicate-signers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deduplicate-signers.d.ts","sourceRoot":"","sources":["../../src/deduplicate-signers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,yFAAyF;AACzF,wBAAgB,kBAAkB,CAAC,OAAO,SAAS,aAAa,GAAG,iBAAiB,EAChF,OAAO,EAAE,SAAS,OAAO,EAAE,GAC5B,SAAS,OAAO,EAAE,CAcpB"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
|
+
export * from './account-signer-meta';
|
|
2
|
+
export * from './add-signers';
|
|
1
3
|
export * from './keypair-signer';
|
|
2
4
|
export * from './message-modifying-signer';
|
|
3
5
|
export * from './message-partial-signer';
|
|
4
6
|
export * from './message-signer';
|
|
7
|
+
export * from './noop-signer';
|
|
8
|
+
export * from './sign-transaction';
|
|
5
9
|
export * from './signable-message';
|
|
6
10
|
export * from './transaction-modifying-signer';
|
|
7
11
|
export * from './transaction-partial-signer';
|
|
8
12
|
export * from './transaction-sending-signer';
|
|
9
13
|
export * from './transaction-signer';
|
|
14
|
+
export * from './transaction-with-single-sending-signer';
|
|
10
15
|
export * from './types';
|
|
11
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sBAAsB,CAAC;AACrC,cAAc,0CAA0C,CAAC;AACzD,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keypair-signer.d.ts","sourceRoot":"","sources":["../../src/keypair-signer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAA2B,MAAM,mBAAmB,CAAC;AAIrE,OAAO,EAA0B,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AACxF,OAAO,EAA8B,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAEpG,2FAA2F;AAC3F,MAAM,MAAM,aAAa,CAAC,QAAQ,SAAS,MAAM,GAAG,MAAM,IAAI,oBAAoB,CAAC,QAAQ,CAAC,GACxF,wBAAwB,CAAC,QAAQ,CAAC,GAAG;IAAE,OAAO,EAAE,aAAa,CAAA;CAAE,CAAC;AAEpE,wFAAwF;AACxF,wBAAgB,eAAe,CAAC,QAAQ,SAAS,MAAM,EAAE,KAAK,EAAE;IAC5D,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC3B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B,GAAG,KAAK,IAAI,aAAa,CAAC,QAAQ,CAAC,CAOnC;AAED,sFAAsF;AACtF,wBAAgB,qBAAqB,CAAC,QAAQ,SAAS,MAAM,EAAE,KAAK,EAAE;IAClE,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC3B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B,GAAG,OAAO,CAAC,KAAK,IAAI,aAAa,CAAC,QAAQ,CAAC,CAK3C;AAED,gEAAgE;AAChE,wBAAsB,uBAAuB,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,CAqB5F;AAED,uGAAuG;AACvG,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,aAAa,CAAC,CAEpE"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { Address } from '@solana/addresses';
|
|
2
2
|
import { SignableMessage } from './signable-message';
|
|
3
|
+
import { BaseSignerConfig } from './types';
|
|
4
|
+
export type MessageModifyingSignerConfig = BaseSignerConfig;
|
|
3
5
|
/** Defines a signer capable of signing messages. */
|
|
4
6
|
export type MessageModifyingSigner<TAddress extends string = string> = Readonly<{
|
|
5
7
|
address: Address<TAddress>;
|
|
6
|
-
modifyAndSignMessages(messages: readonly SignableMessage[]): Promise<readonly SignableMessage[]>;
|
|
8
|
+
modifyAndSignMessages(messages: readonly SignableMessage[], config?: MessageModifyingSignerConfig): Promise<readonly SignableMessage[]>;
|
|
7
9
|
}>;
|
|
8
10
|
/** Checks whether the provided value implements the {@link MessageModifyingSigner} interface. */
|
|
9
11
|
export declare function isMessageModifyingSigner<TAddress extends string>(value: {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message-modifying-signer.d.ts","sourceRoot":"","sources":["../../src/message-modifying-signer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAa,MAAM,mBAAmB,CAAC;AAEvD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C,MAAM,MAAM,4BAA4B,GAAG,gBAAgB,CAAC;AAE5D,oDAAoD;AACpD,MAAM,MAAM,sBAAsB,CAAC,QAAQ,SAAS,MAAM,GAAG,MAAM,IAAI,QAAQ,CAAC;IAC5E,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC3B,qBAAqB,CACjB,QAAQ,EAAE,SAAS,eAAe,EAAE,EACpC,MAAM,CAAC,EAAE,4BAA4B,GACtC,OAAO,CAAC,SAAS,eAAe,EAAE,CAAC,CAAC;CAC1C,CAAC,CAAC;AAEH,iGAAiG;AACjG,wBAAgB,wBAAwB,CAAC,QAAQ,SAAS,MAAM,EAAE,KAAK,EAAE;IACrE,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC3B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B,GAAG,KAAK,IAAI,sBAAsB,CAAC,QAAQ,CAAC,CAM5C;AAED,+FAA+F;AAC/F,wBAAgB,8BAA8B,CAAC,QAAQ,SAAS,MAAM,EAAE,KAAK,EAAE;IAC3E,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC3B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B,GAAG,OAAO,CAAC,KAAK,IAAI,sBAAsB,CAAC,QAAQ,CAAC,CAKpD"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Address } from '@solana/addresses';
|
|
2
2
|
import { SignableMessage } from './signable-message';
|
|
3
|
-
import { SignatureDictionary } from './types';
|
|
3
|
+
import { BaseSignerConfig, SignatureDictionary } from './types';
|
|
4
|
+
export type MessagePartialSignerConfig = BaseSignerConfig;
|
|
4
5
|
/** Defines a signer capable of signing messages. */
|
|
5
6
|
export type MessagePartialSigner<TAddress extends string = string> = Readonly<{
|
|
6
7
|
address: Address<TAddress>;
|
|
7
|
-
signMessages(messages: readonly SignableMessage[]): Promise<readonly SignatureDictionary[]>;
|
|
8
|
+
signMessages(messages: readonly SignableMessage[], config?: MessagePartialSignerConfig): Promise<readonly SignatureDictionary[]>;
|
|
8
9
|
}>;
|
|
9
10
|
/** Checks whether the provided value implements the {@link MessagePartialSigner} interface. */
|
|
10
11
|
export declare function isMessagePartialSigner<TAddress extends string>(value: {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message-partial-signer.d.ts","sourceRoot":"","sources":["../../src/message-partial-signer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEhE,MAAM,MAAM,0BAA0B,GAAG,gBAAgB,CAAC;AAE1D,oDAAoD;AACpD,MAAM,MAAM,oBAAoB,CAAC,QAAQ,SAAS,MAAM,GAAG,MAAM,IAAI,QAAQ,CAAC;IAC1E,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC3B,YAAY,CACR,QAAQ,EAAE,SAAS,eAAe,EAAE,EACpC,MAAM,CAAC,EAAE,0BAA0B,GACpC,OAAO,CAAC,SAAS,mBAAmB,EAAE,CAAC,CAAC;CAC9C,CAAC,CAAC;AAEH,+FAA+F;AAC/F,wBAAgB,sBAAsB,CAAC,QAAQ,SAAS,MAAM,EAAE,KAAK,EAAE;IACnE,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC3B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B,GAAG,KAAK,IAAI,oBAAoB,CAAC,QAAQ,CAAC,CAE1C;AAED,6FAA6F;AAC7F,wBAAgB,4BAA4B,CAAC,QAAQ,SAAS,MAAM,EAAE,KAAK,EAAE;IACzE,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC3B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B,GAAG,OAAO,CAAC,KAAK,IAAI,oBAAoB,CAAC,QAAQ,CAAC,CAKlD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message-signer.d.ts","sourceRoot":"","sources":["../../src/message-signer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,OAAO,EAA4B,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAC9F,OAAO,EAA0B,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAExF,oDAAoD;AACpD,MAAM,MAAM,aAAa,CAAC,QAAQ,SAAS,MAAM,GAAG,MAAM,IACpD,oBAAoB,CAAC,QAAQ,CAAC,GAC9B,sBAAsB,CAAC,QAAQ,CAAC,CAAC;AAEvC,wFAAwF;AACxF,wBAAgB,eAAe,CAAC,QAAQ,SAAS,MAAM,EAAE,KAAK,EAAE;IAC5D,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC3B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B,GAAG,KAAK,IAAI,aAAa,CAAC,QAAQ,CAAC,CAEnC;AAED,sFAAsF;AACtF,wBAAgB,qBAAqB,CAAC,QAAQ,SAAS,MAAM,EAAE,KAAK,EAAE;IAClE,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC3B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B,GAAG,OAAO,CAAC,KAAK,IAAI,aAAa,CAAC,QAAQ,CAAC,CAK3C"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Address } from '@solana/addresses';
|
|
2
|
+
import { MessagePartialSigner } from './message-partial-signer';
|
|
3
|
+
import { TransactionPartialSigner } from './transaction-partial-signer';
|
|
4
|
+
/** Defines a no-operation signer that pretends to partially sign messages and transactions. */
|
|
5
|
+
export type NoopSigner<TAddress extends string = string> = MessagePartialSigner<TAddress> & TransactionPartialSigner<TAddress>;
|
|
6
|
+
/** Creates a NoopSigner from the provided Address. */
|
|
7
|
+
export declare function createNoopSigner(address: Address): NoopSigner;
|
|
8
|
+
//# sourceMappingURL=noop-signer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"noop-signer.d.ts","sourceRoot":"","sources":["../../src/noop-signer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAExE,+FAA+F;AAC/F,MAAM,MAAM,UAAU,CAAC,QAAQ,SAAS,MAAM,GAAG,MAAM,IAAI,oBAAoB,CAAC,QAAQ,CAAC,GACrF,wBAAwB,CAAC,QAAQ,CAAC,CAAC;AAEvC,sDAAsD;AACtD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,UAAU,CAQ7D"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { SignatureBytes } from '@solana/keys';
|
|
2
|
+
import { CompilableTransaction, IFullySignedTransaction, ITransactionWithSignatures } from '@solana/transactions';
|
|
3
|
+
import { ITransactionWithSigners } from './account-signer-meta';
|
|
4
|
+
import { ITransactionWithSingleSendingSigner } from './transaction-with-single-sending-signer';
|
|
5
|
+
type CompilableTransactionWithSigners = CompilableTransaction & ITransactionWithSigners & Partial<ITransactionWithSignatures>;
|
|
6
|
+
/**
|
|
7
|
+
* Signs a transaction using any signers that may be stored in IAccountSignerMeta instruction accounts
|
|
8
|
+
* as well as any signers provided explicitly to this function.
|
|
9
|
+
* It will ignore TransactionSendingSigners since this function does not send the transaction.
|
|
10
|
+
*/
|
|
11
|
+
export declare function partiallySignTransactionWithSigners<TTransaction extends CompilableTransactionWithSigners = CompilableTransactionWithSigners>(transaction: TTransaction, config?: {
|
|
12
|
+
abortSignal?: AbortSignal;
|
|
13
|
+
}): Promise<TTransaction & ITransactionWithSignatures>;
|
|
14
|
+
/**
|
|
15
|
+
* Signs a transaction using any signers that may be stored in IAccountSignerMeta instruction accounts
|
|
16
|
+
* as well as any signers provided explicitly to this function.
|
|
17
|
+
* It will assert that the transaction is fully signed before returning.
|
|
18
|
+
* It will ignore TransactionSendingSigners since this function does not send the transaction.
|
|
19
|
+
*/
|
|
20
|
+
export declare function signTransactionWithSigners<TTransaction extends CompilableTransactionWithSigners = CompilableTransactionWithSigners>(transaction: TTransaction, config?: {
|
|
21
|
+
abortSignal?: AbortSignal;
|
|
22
|
+
}): Promise<TTransaction & IFullySignedTransaction>;
|
|
23
|
+
/**
|
|
24
|
+
* Signs and sends a transaction using any signers that may be stored in IAccountSignerMeta
|
|
25
|
+
* instruction accounts as well as any signers provided explicitly to this function.
|
|
26
|
+
* It will identify a single TransactionSendingSigners to use for sending the transaction, if any.
|
|
27
|
+
* Otherwise, it will send the transaction using the provided fallbackSender.
|
|
28
|
+
*/
|
|
29
|
+
export declare function signAndSendTransactionWithSigners<TTransaction extends CompilableTransactionWithSigners & ITransactionWithSingleSendingSigner = CompilableTransactionWithSigners & ITransactionWithSingleSendingSigner>(transaction: TTransaction, config?: {
|
|
30
|
+
abortSignal?: AbortSignal;
|
|
31
|
+
}): Promise<SignatureBytes>;
|
|
32
|
+
export {};
|
|
33
|
+
//# sourceMappingURL=sign-transaction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sign-transaction.d.ts","sourceRoot":"","sources":["../../src/sign-transaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAEH,qBAAqB,EACrB,uBAAuB,EACvB,0BAA0B,EAC7B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAA6B,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAM3F,OAAO,EAAE,mCAAmC,EAAE,MAAM,0CAA0C,CAAC;AAE/F,KAAK,gCAAgC,GAAG,qBAAqB,GACzD,uBAAuB,GACvB,OAAO,CAAC,0BAA0B,CAAC,CAAC;AAExC;;;;GAIG;AACH,wBAAsB,mCAAmC,CACrD,YAAY,SAAS,gCAAgC,GAAG,gCAAgC,EAExF,WAAW,EAAE,YAAY,EACzB,MAAM,GAAE;IAAE,WAAW,CAAC,EAAE,WAAW,CAAA;CAAO,GAC3C,OAAO,CAAC,YAAY,GAAG,0BAA0B,CAAC,CAOpD;AAED;;;;;GAKG;AACH,wBAAsB,0BAA0B,CAC5C,YAAY,SAAS,gCAAgC,GAAG,gCAAgC,EAExF,WAAW,EAAE,YAAY,EACzB,MAAM,GAAE;IAAE,WAAW,CAAC,EAAE,WAAW,CAAA;CAAO,GAC3C,OAAO,CAAC,YAAY,GAAG,uBAAuB,CAAC,CAIjD;AAED;;;;;GAKG;AACH,wBAAsB,iCAAiC,CACnD,YAAY,SAAS,gCAAgC,GACjD,mCAAmC,GAAG,gCAAgC,GAAG,mCAAmC,EAClH,WAAW,EAAE,YAAY,EAAE,MAAM,GAAE;IAAE,WAAW,CAAC,EAAE,WAAW,CAAA;CAAO,GAAG,OAAO,CAAC,cAAc,CAAC,CA0BhG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signable-message.d.ts","sourceRoot":"","sources":["../../src/signable-message.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAE9C,qFAAqF;AACrF,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC;IACnC,OAAO,EAAE,UAAU,CAAC;IACpB,UAAU,EAAE,mBAAmB,CAAC;CACnC,CAAC,CAAC;AAEH;;;GAGG;AACH,wBAAgB,qBAAqB,CACjC,OAAO,EAAE,MAAM,GAAG,UAAU,EAC5B,UAAU,GAAE,mBAAwB,GACrC,eAAe,CAKjB"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { Address } from '@solana/addresses';
|
|
2
2
|
import { CompilableTransaction } from '@solana/transactions';
|
|
3
|
+
import { BaseSignerConfig } from './types';
|
|
4
|
+
export type TransactionModifyingSignerConfig = BaseSignerConfig;
|
|
3
5
|
/** Defines a signer capable of signing transactions. */
|
|
4
6
|
export type TransactionModifyingSigner<TAddress extends string = string> = Readonly<{
|
|
5
7
|
address: Address<TAddress>;
|
|
6
|
-
modifyAndSignTransactions<TTransaction extends CompilableTransaction>(transactions: readonly TTransaction[]): Promise<readonly TTransaction[]>;
|
|
8
|
+
modifyAndSignTransactions<TTransaction extends CompilableTransaction>(transactions: readonly TTransaction[], config?: TransactionModifyingSignerConfig): Promise<readonly TTransaction[]>;
|
|
7
9
|
}>;
|
|
8
10
|
/** Checks whether the provided value implements the {@link TransactionModifyingSigner} interface. */
|
|
9
11
|
export declare function isTransactionModifyingSigner<TAddress extends string>(value: {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction-modifying-signer.d.ts","sourceRoot":"","sources":["../../src/transaction-modifying-signer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C,MAAM,MAAM,gCAAgC,GAAG,gBAAgB,CAAC;AAEhE,wDAAwD;AACxD,MAAM,MAAM,0BAA0B,CAAC,QAAQ,SAAS,MAAM,GAAG,MAAM,IAAI,QAAQ,CAAC;IAChF,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC3B,yBAAyB,CAAC,YAAY,SAAS,qBAAqB,EAChE,YAAY,EAAE,SAAS,YAAY,EAAE,EACrC,MAAM,CAAC,EAAE,gCAAgC,GAC1C,OAAO,CAAC,SAAS,YAAY,EAAE,CAAC,CAAC;CACvC,CAAC,CAAC;AAEH,qGAAqG;AACrG,wBAAgB,4BAA4B,CAAC,QAAQ,SAAS,MAAM,EAAE,KAAK,EAAE;IACzE,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC3B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B,GAAG,KAAK,IAAI,0BAA0B,CAAC,QAAQ,CAAC,CAEhD;AAED,mGAAmG;AACnG,wBAAgB,kCAAkC,CAAC,QAAQ,SAAS,MAAM,EAAE,KAAK,EAAE;IAC/E,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC3B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B,GAAG,OAAO,CAAC,KAAK,IAAI,0BAA0B,CAAC,QAAQ,CAAC,CAKxD"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Address } from '@solana/addresses';
|
|
2
2
|
import { CompilableTransaction } from '@solana/transactions';
|
|
3
|
-
import { SignatureDictionary } from './types';
|
|
3
|
+
import { BaseSignerConfig, SignatureDictionary } from './types';
|
|
4
|
+
export type TransactionPartialSignerConfig = BaseSignerConfig;
|
|
4
5
|
/** Defines a signer capable of signing transactions. */
|
|
5
6
|
export type TransactionPartialSigner<TAddress extends string = string> = Readonly<{
|
|
6
7
|
address: Address<TAddress>;
|
|
7
|
-
signTransactions(transactions: readonly CompilableTransaction[]): Promise<readonly SignatureDictionary[]>;
|
|
8
|
+
signTransactions(transactions: readonly CompilableTransaction[], config?: TransactionPartialSignerConfig): Promise<readonly SignatureDictionary[]>;
|
|
8
9
|
}>;
|
|
9
10
|
/** Checks whether the provided value implements the {@link TransactionPartialSigner} interface. */
|
|
10
11
|
export declare function isTransactionPartialSigner<TAddress extends string>(value: {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction-partial-signer.d.ts","sourceRoot":"","sources":["../../src/transaction-partial-signer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEhE,MAAM,MAAM,8BAA8B,GAAG,gBAAgB,CAAC;AAE9D,wDAAwD;AACxD,MAAM,MAAM,wBAAwB,CAAC,QAAQ,SAAS,MAAM,GAAG,MAAM,IAAI,QAAQ,CAAC;IAC9E,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC3B,gBAAgB,CACZ,YAAY,EAAE,SAAS,qBAAqB,EAAE,EAC9C,MAAM,CAAC,EAAE,8BAA8B,GACxC,OAAO,CAAC,SAAS,mBAAmB,EAAE,CAAC,CAAC;CAC9C,CAAC,CAAC;AAEH,mGAAmG;AACnG,wBAAgB,0BAA0B,CAAC,QAAQ,SAAS,MAAM,EAAE,KAAK,EAAE;IACvE,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC3B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B,GAAG,KAAK,IAAI,wBAAwB,CAAC,QAAQ,CAAC,CAE9C;AAED,iGAAiG;AACjG,wBAAgB,gCAAgC,CAAC,QAAQ,SAAS,MAAM,EAAE,KAAK,EAAE;IAC7E,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC3B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B,GAAG,OAAO,CAAC,KAAK,IAAI,wBAAwB,CAAC,QAAQ,CAAC,CAKtD"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { Address } from '@solana/addresses';
|
|
2
2
|
import { SignatureBytes } from '@solana/keys';
|
|
3
3
|
import { CompilableTransaction } from '@solana/transactions';
|
|
4
|
+
import { BaseSignerConfig } from './types';
|
|
5
|
+
export type TransactionSendingSignerConfig = BaseSignerConfig;
|
|
4
6
|
/** Defines a signer capable of signing and sending transactions simultaneously. */
|
|
5
7
|
export type TransactionSendingSigner<TAddress extends string = string> = Readonly<{
|
|
6
8
|
address: Address<TAddress>;
|
|
7
|
-
signAndSendTransactions(transactions: readonly CompilableTransaction[]): Promise<readonly SignatureBytes[]>;
|
|
9
|
+
signAndSendTransactions(transactions: readonly CompilableTransaction[], config?: TransactionSendingSignerConfig): Promise<readonly SignatureBytes[]>;
|
|
8
10
|
}>;
|
|
9
11
|
/** Checks whether the provided value implements the {@link TransactionSendingSigner} interface. */
|
|
10
12
|
export declare function isTransactionSendingSigner<TAddress extends string>(value: {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction-sending-signer.d.ts","sourceRoot":"","sources":["../../src/transaction-sending-signer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C,MAAM,MAAM,8BAA8B,GAAG,gBAAgB,CAAC;AAE9D,mFAAmF;AACnF,MAAM,MAAM,wBAAwB,CAAC,QAAQ,SAAS,MAAM,GAAG,MAAM,IAAI,QAAQ,CAAC;IAC9E,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC3B,uBAAuB,CACnB,YAAY,EAAE,SAAS,qBAAqB,EAAE,EAC9C,MAAM,CAAC,EAAE,8BAA8B,GACxC,OAAO,CAAC,SAAS,cAAc,EAAE,CAAC,CAAC;CACzC,CAAC,CAAC;AAEH,mGAAmG;AACnG,wBAAgB,0BAA0B,CAAC,QAAQ,SAAS,MAAM,EAAE,KAAK,EAAE;IACvE,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC3B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B,GAAG,KAAK,IAAI,wBAAwB,CAAC,QAAQ,CAAC,CAE9C;AAED,iGAAiG;AACjG,wBAAgB,gCAAgC,CAAC,QAAQ,SAAS,MAAM,EAAE,KAAK,EAAE;IAC7E,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC3B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B,GAAG,OAAO,CAAC,KAAK,IAAI,wBAAwB,CAAC,QAAQ,CAAC,CAKtD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction-signer.d.ts","sourceRoot":"","sources":["../../src/transaction-signer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,OAAO,EAAgC,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AAC1G,OAAO,EAA8B,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACpG,OAAO,EAA8B,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAEpG,wDAAwD;AACxD,MAAM,MAAM,iBAAiB,CAAC,QAAQ,SAAS,MAAM,GAAG,MAAM,IACxD,wBAAwB,CAAC,QAAQ,CAAC,GAClC,0BAA0B,CAAC,QAAQ,CAAC,GACpC,wBAAwB,CAAC,QAAQ,CAAC,CAAC;AAEzC,4FAA4F;AAC5F,wBAAgB,mBAAmB,CAAC,QAAQ,SAAS,MAAM,EAAE,KAAK,EAAE;IAChE,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC3B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B,GAAG,KAAK,IAAI,iBAAiB,CAAC,QAAQ,CAAC,CAIvC;AAED,0FAA0F;AAC1F,wBAAgB,yBAAyB,CAAC,QAAQ,SAAS,MAAM,EAAE,KAAK,EAAE;IACtE,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC3B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B,GAAG,OAAO,CAAC,KAAK,IAAI,iBAAiB,CAAC,QAAQ,CAAC,CAK/C"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CompilableTransaction } from '@solana/transactions';
|
|
2
|
+
import { ITransactionWithSigners } from './account-signer-meta';
|
|
3
|
+
/** Defines a transaction with exactly one {@link TransactionSendingSigner}. */
|
|
4
|
+
export type ITransactionWithSingleSendingSigner = ITransactionWithSigners & {
|
|
5
|
+
readonly __transactionWithSingleSendingSigner: unique symbol;
|
|
6
|
+
};
|
|
7
|
+
/** Checks whether the provided transaction has exactly one {@link TransactionSendingSigner}. */
|
|
8
|
+
export declare function isTransactionWithSingleSendingSigner<TTransaction extends CompilableTransaction>(transaction: TTransaction): transaction is TTransaction & ITransactionWithSingleSendingSigner;
|
|
9
|
+
/** Asserts that the provided transaction has exactly one {@link TransactionSendingSigner}. */
|
|
10
|
+
export declare function assertIsTransactionWithSingleSendingSigner<TTransaction extends CompilableTransaction>(transaction: TTransaction): asserts transaction is TTransaction & ITransactionWithSingleSendingSigner;
|
|
11
|
+
//# sourceMappingURL=transaction-with-single-sending-signer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction-with-single-sending-signer.d.ts","sourceRoot":"","sources":["../../src/transaction-with-single-sending-signer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,OAAO,EAA6B,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAK3F,+EAA+E;AAC/E,MAAM,MAAM,mCAAmC,GAAG,uBAAuB,GAAG;IACxE,QAAQ,CAAC,oCAAoC,EAAE,OAAO,MAAM,CAAC;CAChE,CAAC;AAEF,gGAAgG;AAChG,wBAAgB,oCAAoC,CAAC,YAAY,SAAS,qBAAqB,EAC3F,WAAW,EAAE,YAAY,GAC1B,WAAW,IAAI,YAAY,GAAG,mCAAmC,CAOnE;AAED,8FAA8F;AAC9F,wBAAgB,0CAA0C,CAAC,YAAY,SAAS,qBAAqB,EACjG,WAAW,EAAE,YAAY,GAC1B,OAAO,CAAC,WAAW,IAAI,YAAY,GAAG,mCAAmC,CAwB3E"}
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { Address } from '@solana/addresses';
|
|
2
2
|
import { SignatureBytes } from '@solana/keys';
|
|
3
3
|
export type SignatureDictionary = Readonly<Record<Address, SignatureBytes>>;
|
|
4
|
+
export type BaseSignerConfig = Readonly<{
|
|
5
|
+
abortSignal?: AbortSignal;
|
|
6
|
+
}>;
|
|
4
7
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC;AAE5E,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC;IAAE,WAAW,CAAC,EAAE,WAAW,CAAA;CAAE,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solana/signers",
|
|
3
|
-
"version": "2.0.0-experimental.
|
|
3
|
+
"version": "2.0.0-experimental.fcff844",
|
|
4
4
|
"description": "An abstraction layer over signing messages and transactions in Solana",
|
|
5
5
|
"exports": {
|
|
6
6
|
"browser": {
|
|
@@ -49,9 +49,10 @@
|
|
|
49
49
|
"node": ">=17.4"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@solana/addresses": "2.0.0-experimental.
|
|
53
|
-
"@solana/
|
|
54
|
-
"@solana/keys": "2.0.0-experimental.
|
|
52
|
+
"@solana/addresses": "2.0.0-experimental.fcff844",
|
|
53
|
+
"@solana/instructions": "2.0.0-experimental.fcff844",
|
|
54
|
+
"@solana/keys": "2.0.0-experimental.fcff844",
|
|
55
|
+
"@solana/transactions": "2.0.0-experimental.fcff844"
|
|
55
56
|
},
|
|
56
57
|
"devDependencies": {
|
|
57
58
|
"@solana/eslint-config-solana": "^1.0.2",
|
|
@@ -67,8 +68,8 @@
|
|
|
67
68
|
"jest-environment-jsdom": "^29.7.0",
|
|
68
69
|
"jest-runner-eslint": "^2.1.2",
|
|
69
70
|
"jest-runner-prettier": "^1.0.0",
|
|
70
|
-
"prettier": "^
|
|
71
|
-
"tsup": "
|
|
71
|
+
"prettier": "^3.1",
|
|
72
|
+
"tsup": "^8.0.1",
|
|
72
73
|
"typescript": "^5.2.2",
|
|
73
74
|
"version-from-git": "^1.1.1",
|
|
74
75
|
"build-scripts": "0.0.0",
|