@catena/cli 0.11.0 → 0.12.0

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 CHANGED
@@ -286,14 +286,14 @@ Request a USD send to a counterparty rail.
286
286
 
287
287
  ```bash
288
288
  npx @catena/cli send \
289
- --rail cprl_... \
289
+ --rail cpr_... \
290
290
  --amount 125.00 \
291
291
  --method ach
292
292
  ```
293
293
 
294
294
  Required flags: `--rail`, `--amount`, `--method`.
295
295
 
296
- Optional flags: `--account`, `--memo`, `--description`, `--idempotency-key`.
296
+ Optional flags: `--account`, `--description`, `--idempotency-key`, and `--memo`.
297
297
 
298
298
  Omit `--account` when the current effective policy allows sends from exactly one
299
299
  account. Zero or multiple send accounts produce an error; other readable or
@@ -309,7 +309,10 @@ pinned. New operations without an explicit source resolve the current policy.
309
309
  Use a new key for a new operation, and reconcile an unknown outcome before
310
310
  sending again.
311
311
 
312
- `--method` must be one of `ach`, `wire`, or `on-chain`.
312
+ `--method` must be one of `ach`, `wire`, or `on-chain`. `--memo` is sent with an
313
+ ACH or wire payment. It remains accepted for on-chain sends for compatibility,
314
+ but is deprecated and is not sent to the blockchain. Use `--description` for an
315
+ internal Catena note on any send.
313
316
 
314
317
  To check whether a send completed, run `intents get <id>` with the returned
315
318
  intent id. A separate invocation without an explicit key is a new send, even
@@ -345,7 +348,7 @@ One intent covers the whole payment, so policy, spend limits and any approval
345
348
  are evaluated once. Gas on both legs is paid by Catena.
346
349
 
347
350
  ```bash
348
- npx @catena/cli send --rail cprl_... --amount 250.00 --method on-chain
351
+ npx @catena/cli send --rail cpr_... --amount 250.00 --method on-chain
349
352
  npx @catena/cli intents get int_...
350
353
  npx @catena/cli intents continue int_...
351
354
  ```
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-B0Z9INg1.mjs";import{t}from"./sha256-CJuuQjmL.mjs";function n(e){return e.reduce((e,t)=>e+t.toString(16).padStart(2,`0`),``)}const r=(e,t)=>{if(!e||e.length%2!=0||!/^[0-9A-Fa-f]+$/.test(e))throw Error(`cannot create uint8array from invalid hex string: "${e}"`);let n=new Uint8Array(e.match(/../g).map(e=>parseInt(e,16)));if(!t)return n;if(e.length/2>t)throw Error(`hex value cannot fit in a buffer of `+t+` byte(s)`);let r=new Uint8Array(t);return r.set(n,t-n.length),r},i=(e,t)=>{let n=t-e.length;if(n>0){let t=new Uint8Array(n).fill(0);return new Uint8Array([...t,...e])}if(n<0){let r=n*-1,i=0;for(let t=0;t<r&&t<e.length;t++)e[t]===0&&i++;if(i!==r)throw Error(`invalid number of starting zeroes. Expected number of zeroes: ${r}. Found: ${i}.`);return e.slice(r,r+t)}return e};function a(e){if(e.length>=255)throw TypeError(`Alphabet too long`);let t=new Uint8Array(256);for(let e=0;e<t.length;e++)t[e]=255;for(let n=0;n<e.length;n++){let r=e.charAt(n),i=r.charCodeAt(0);if(t[i]!==255)throw TypeError(r+` is ambiguous`);t[i]=n}let n=e.length,r=e.charAt(0),i=Math.log(n)/Math.log(256),a=Math.log(256)/Math.log(n);function o(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw TypeError(`Expected Uint8Array`);if(t.length===0)return``;let i=0,o=0,s=0,c=t.length;for(;s!==c&&t[s]===0;)s++,i++;let l=(c-s)*a+1>>>0,u=new Uint8Array(l);for(;s!==c;){let e=t[s],r=0;for(let t=l-1;(e!==0||r<o)&&t!==-1;t--,r++)e+=256*u[t]>>>0,u[t]=e%n>>>0,e=e/n>>>0;if(e!==0)throw Error(`Non-zero carry`);o=r,s++}let d=l-o;for(;d!==l&&u[d]===0;)d++;let f=r.repeat(i);for(;d<l;++d)f+=e.charAt(u[d]);return f}function s(e){if(typeof e!=`string`)throw TypeError(`Expected String`);if(e.length===0)return new Uint8Array;let a=0,o=0,s=0;for(;e[a]===r;)o++,a++;let c=(e.length-a)*i+1>>>0,l=new Uint8Array(c);for(;a<e.length;){let r=e.charCodeAt(a);if(r>255)return;let i=t[r];if(i===255)return;let o=0;for(let e=c-1;(i!==0||o<s)&&e!==-1;e--,o++)i+=n*l[e]>>>0,l[e]=i%256>>>0,i=i/256>>>0;if(i!==0)throw Error(`Non-zero carry`);s=o,a++}let u=c-s;for(;u!==c&&l[u]===0;)u++;let d=new Uint8Array(o+(c-u)),f=o;for(;u!==c;)d[f++]=l[u++];return d}function c(e){let t=s(e);if(t)return t;throw Error(`Non-base`+n+` character`)}return{encode:o,decodeUnsafe:s,decode:c}}var o=e({default:()=>s}),s=a(`123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz`);function c(e){let t=e;for(;t&&!(t.encode&&t.decode&&t.decodeUnsafe)&&t.default;)t=t.default;return t}c(o);function l(e){function t(t){var n=Uint8Array.from(t),r=e(n),i=n.length+4,a=new Uint8Array(i);return a.set(n,0),a.set(r.subarray(0,4),n.length),s.encode(a)}function n(t){var n=t.slice(0,-4),r=t.slice(-4),i=e(n);if(!(r[0]^i[0]|r[1]^i[1]|r[2]^i[2]|r[3]^i[3]))return n}function r(e){var t=s.decodeUnsafe(e);if(t!=null)return n(t)}function i(e){var t=n(s.decode(e));if(t==null)throw Error(`Invalid checksum`);return t}return{encode:t,decode:i,decodeUnsafe:r}}var u=e({default:()=>f});function d(e){return t(t(e))}var f=l(d);function p(e){let t=e;for(;t&&!(t.encode&&t.decode&&t.decodeUnsafe)&&t.default;)t=t.default;return t}p(u);export{r as n,n as r,i as t};
@@ -0,0 +1,2 @@
1
+ import{C as e,T as t,_ as n,a as r,c as i,d as a,f as o,h as s,l as c,m as l,o as u,s as ee,u as d,w as te,y as f}from"./sha256-CJuuQjmL.mjs";const p=`2.56.3`;let m={getDocsUrl:({docsBaseUrl:e,docsPath:t=``,docsSlug:n})=>t?`${e??`https://viem.sh`}${t}${n?`#${n}`:``}`:void 0,version:`viem@${p}`};var h=class e extends Error{constructor(t,n={}){let r=n.cause instanceof e?n.cause.details:n.cause?.message?n.cause.message:n.details,i=n.cause instanceof e&&n.cause.docsPath||n.docsPath,a=m.getDocsUrl?.({...n,docsPath:i}),o=[t||`An error occurred.`,``,...n.metaMessages?[...n.metaMessages,``]:[],...a?[`Docs: ${a}`]:[],...r?[`Details: ${r}`]:[],...m.version?[`Version: ${m.version}`]:[]].join(`
2
+ `);super(o,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:`BaseError`}),this.details=r,this.docsPath=i,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=t,this.version=p}walk(e){return g(this,e)}};function g(e,t){return t?.(e)?e:e&&typeof e==`object`&&`cause`in e&&e.cause!==void 0?g(e.cause,t):t?null:e}function _(e,{strict:t=!0}={}){return!e||typeof e!=`string`?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith(`0x`)}function v(e){return _(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}var ne=class extends h{constructor({offset:e,position:t,size:n}){super(`Slice ${t===`start`?`starting`:`ending`} at offset "${e}" is out-of-bounds (size: ${n}).`,{name:`SliceOffsetOutOfBoundsError`})}},y=class extends h{constructor({size:e,targetSize:t,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${e}) exceeds padding size (${t}).`,{name:`SizeExceedsPaddingSizeError`})}};function b(e,{dir:t,size:n=32}={}){return typeof e==`string`?x(e,{dir:t,size:n}):re(e,{dir:t,size:n})}function x(e,{dir:t,size:n=32}={}){if(n===null)return e;let r=e.replace(`0x`,``);if(r.length>n*2)throw new y({size:Math.ceil(r.length/2),targetSize:n,type:`hex`});return`0x${r[t===`right`?`padEnd`:`padStart`](n*2,`0`)}`}function re(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new y({size:e.length,targetSize:n,type:`bytes`});let r=new Uint8Array(n);for(let i=0;i<n;i++){let a=t===`right`;r[a?i:n-i-1]=e[a?i:e.length-i-1]}return r}var S=class extends h{constructor({max:e,min:t,signed:n,size:r,value:i}){super(`Number "${i}" is not in safe ${r?`${r*8}-bit ${n?`signed`:`unsigned`} `:``}integer range ${e?`(${t} to ${e})`:`(above ${t})`}`,{name:`IntegerOutOfRangeError`})}},ie=class extends h{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed ${t} bytes. Given size: ${e} bytes.`,{name:`SizeOverflowError`})}};function C(e,{size:t}){if(v(e)>t)throw new ie({givenSize:v(e),maxSize:t})}function ae(e,t={}){let{signed:n}=t;t.size&&C(e,{size:t.size});let r=BigInt(e);if(!n)return r;let i=Math.ceil((e.length-2)/2);return r<=(1n<<BigInt(i)*8n-1n)-1n?r:r-BigInt(`0x${`f`.padStart(i*2,`f`)}`)-1n}function oe(e,t={}){let n=ae(e,t),r=Number(n);if(!Number.isSafeInteger(r))throw new S({max:`${2**53-1}`,min:`${-(2**53-1)}`,signed:t.signed,size:t.size,value:`${n}n`});return r}const se=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function w(e,t={}){return typeof e==`number`||typeof e==`bigint`?D(e,t):typeof e==`string`?k(e,t):typeof e==`boolean`?T(e,t):E(e,t)}function T(e,t={}){let n=`0x${Number(e)}`;return typeof t.size==`number`?(C(n,{size:t.size}),b(n,{size:t.size})):n}function E(e,t={}){let n=``;for(let t=0;t<e.length;t++)n+=se[e[t]];let r=`0x${n}`;return typeof t.size==`number`?(C(r,{size:t.size}),b(r,{dir:`right`,size:t.size})):r}function D(e,t={}){let{signed:n,size:r}=t,i=BigInt(e),a;r?a=n?(1n<<BigInt(r)*8n-1n)-1n:2n**(BigInt(r)*8n)-1n:typeof e==`number`&&(a=BigInt(2**53-1));let o=typeof a==`bigint`&&n?-a-1n:0;if(a&&i>a||i<o){let t=typeof e==`bigint`?`n`:``;throw new S({max:a?`${a}${t}`:void 0,min:`${o}${t}`,signed:n,size:r,value:`${e}${t}`})}let s=`0x${(n&&i<0?(1n<<BigInt(r*8))+BigInt(i):i).toString(16)}`;return r?b(s,{size:r}):s}const O=new TextEncoder;function k(e,t={}){return E(O.encode(e),t)}const ce=new TextEncoder;function A(e,t={}){return typeof e==`number`||typeof e==`bigint`?ue(e,t):typeof e==`boolean`?le(e,t):_(e)?N(e,t):P(e,t)}function le(e,t={}){let n=new Uint8Array(1);return n[0]=Number(e),typeof t.size==`number`?(C(n,{size:t.size}),b(n,{size:t.size})):n}const j={zero:48,nine:57,A:65,F:70,a:97,f:102};function M(e){if(e>=j.zero&&e<=j.nine)return e-j.zero;if(e>=j.A&&e<=j.F)return e-(j.A-10);if(e>=j.a&&e<=j.f)return e-(j.a-10)}function N(e,t={}){let n=e;t.size&&(C(n,{size:t.size}),n=b(n,{dir:`right`,size:t.size}));let r=n.slice(2);r.length%2&&(r=`0${r}`);let i=r.length/2,a=new Uint8Array(i);for(let e=0,t=0;e<i;e++){let n=M(r.charCodeAt(t++)),i=M(r.charCodeAt(t++));if(n===void 0||i===void 0)throw new h(`Invalid byte sequence ("${r[t-2]}${r[t-1]}" in "${r}").`);a[e]=n*16+i}return a}function ue(e,t){return N(D(e,t))}function P(e,t={}){let n=ce.encode(e);return typeof t.size==`number`?(C(n,{size:t.size}),b(n,{dir:`right`,size:t.size})):n}const F=BigInt(0),I=BigInt(1),L=BigInt(2),R=BigInt(7),z=BigInt(256),B=BigInt(113),V=[],H=[],U=[];for(let e=0,t=I,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],V.push(2*(5*r+n)),H.push((e+1)*(e+2)/2%64);let i=F;for(let e=0;e<7;e++)t=(t<<I^(t>>R)*B)%z,t&L&&(i^=I<<(I<<BigInt(e))-I);U.push(i)}const W=c(U,!0),de=W[0],fe=W[1],G=(e,t,n)=>n>32?r(e,t,n):ee(e,t,n),K=(e,t,n)=>n>32?u(e,t,n):i(e,t,n);function pe(e,t=24){let r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let t=0;t<10;t++)r[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){let n=(t+8)%10,i=(t+2)%10,a=r[i],o=r[i+1],s=G(a,o,1)^r[n],c=K(a,o,1)^r[n+1];for(let n=0;n<50;n+=10)e[t+n]^=s,e[t+n+1]^=c}let t=e[2],i=e[3];for(let n=0;n<24;n++){let r=H[n],a=G(t,i,r),o=K(t,i,r),s=V[n];t=e[s],i=e[s+1],e[s]=a,e[s+1]=o}for(let t=0;t<50;t+=10){for(let n=0;n<10;n++)r[n]=e[t+n];for(let n=0;n<10;n++)e[t+n]^=~r[(n+2)%10]&r[(n+4)%10]}e[0]^=de[n],e[1]^=fe[n]}n(r)}var me=class r extends d{constructor(e,n,r,i=!1,a=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=e,this.suffix=n,this.outputLen=r,this.enableXOF=i,this.rounds=a,l(r),!(0<e&&e<200))throw Error(`only keccak-f1600 function is supported`);this.state=new Uint8Array(200),this.state32=t(this.state)}clone(){return this._cloneInto()}keccak(){e(this.state32),pe(this.state32,this.rounds),e(this.state32),this.posOut=0,this.pos=0}update(e){o(this),e=te(e),a(e);let{blockLen:t,state:n}=this,r=e.length;for(let i=0;i<r;){let a=Math.min(t-this.pos,r-i);for(let t=0;t<a;t++)n[this.pos++]^=e[i++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:e,suffix:t,pos:n,blockLen:r}=this;e[n]^=t,t&128&&n===r-1&&this.keccak(),e[r-1]^=128,this.keccak()}writeInto(e){o(this,!1),a(e),this.finish();let t=this.state,{blockLen:n}=this;for(let r=0,i=e.length;r<i;){this.posOut>=n&&this.keccak();let a=Math.min(n-this.posOut,i-r);e.set(t.subarray(this.posOut,this.posOut+a),r),this.posOut+=a,r+=a}return e}xofInto(e){if(!this.enableXOF)throw Error(`XOF is not possible for this instance`);return this.writeInto(e)}xof(e){return l(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(s(e,this),this.finished)throw Error(`digest() was already called`);return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,n(this.state)}_cloneInto(e){let{blockLen:t,suffix:n,outputLen:i,rounds:a,enableXOF:o}=this;return e||=new r(t,n,i,o,a),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=a,e.suffix=n,e.outputLen=i,e.enableXOF=o,e.destroyed=this.destroyed,e}};const he=((e,t,n)=>f(()=>new me(t,e,n)))(1,136,32);function q(e,t){let n=t||`hex`,r=he(_(e,{strict:!1})?A(e):e);return n===`bytes`?r:w(r)}var J=class extends h{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:[`- Address must be a hex value of 20 bytes (40 hex characters).`,`- Address must match its checksum counterpart.`],name:`InvalidAddressError`})}},Y=class extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){let t=super.get(e);return super.has(e)&&(super.delete(e),super.set(e,t)),t}set(e,t){if(super.has(e)&&super.delete(e),super.set(e,t),this.maxSize&&this.size>this.maxSize){let e=super.keys().next().value;e!==void 0&&super.delete(e)}return this}};const ge=/^0x[a-fA-F0-9]{40}$/,X=new Y(8192);function Z(e,t){let{strict:n=!0}=t??{},r=`${e}.${n}`;if(X.has(r))return X.get(r);let i=ge.test(e)?e.toLowerCase()===e||!n||$(e)===e:!1;return X.set(r,i),i}const Q=new Y(8192);function $(e,t){if(Q.has(`${e}.${t}`))return Q.get(`${e}.${t}`);let n=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),r=q(P(n),`bytes`),i=(t?n.substring(`${t}0x`.length):n).split(``);for(let e=0;e<40;e+=2)r[e>>1]>>4>=8&&i[e]&&(i[e]=i[e].toUpperCase()),(r[e>>1]&15)>=8&&i[e+1]&&(i[e+1]=i[e+1].toUpperCase());let a=`0x${i.join(``)}`;return Q.set(`${e}.${t}`,a),a}function _e(e,t){if(!Z(e,{strict:!1}))throw new J({address:e});return $(e,t)}export{_,N as a,E as c,w as d,oe as f,v as g,ne as h,q as i,D as l,x as m,Z as n,A as o,S as p,J as r,T as s,_e as t,k as u,h as v};
@@ -0,0 +1 @@
1
+ import{_ as e,d as t,f as n,p as r,u as i,w as a}from"./sha256-CJuuQjmL.mjs";var o=class extends i{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,r(t);let i=a(n);if(this.iHash=t.create(),typeof this.iHash.update!=`function`)throw Error(`Expected instance of class which extends utils.Hash`);this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let o=this.blockLen,s=new Uint8Array(o);s.set(i.length>o?t.create().update(i).digest():i);for(let e=0;e<s.length;e++)s[e]^=54;this.iHash.update(s),this.oHash=t.create();for(let e=0;e<s.length;e++)s[e]^=106;this.oHash.update(s),e(s)}update(e){return n(this),this.iHash.update(e),this}digestInto(e){n(this),t(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||=Object.create(Object.getPrototypeOf(this),{});let{oHash:t,iHash:n,finished:r,destroyed:i,blockLen:a,outputLen:o}=this;return e=e,e.finished=r,e.destroyed=i,e.blockLen=a,e.outputLen=o,e.oHash=t._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}};const s=(e,t,n)=>new o(e,t).update(n).digest();s.create=(e,t)=>new o(e,t);export{s as t};