UNPKG

wowok_agent

Version:

Create, collaborate, and transact on your own terms with the AI-driven web3 collaboration protocol.

1 lines 9.71 kB
"use strict";(this.webpackChunkwowok_agent=this.webpackChunkwowok_agent||[]).push([[652],{99:(e,t,r)=>{r.d(t,{c:()=>i,i:()=>n});const n="1.7.0",i="1.32.0"},747:(e,t,r)=>{r.d(t,{N:()=>s});var n=r(621),i=r(4364);function s(e){function t(t,r){if("string"==typeof t)return e(o(t).serialize(r));if(t instanceof Uint8Array||(0,n.d_)(t))return e(t);throw new Error("tx.pure must be called either a bcs type name, or a serialized bcs value")}return t.u8=t=>e(i.jy.U8.serialize(t)),t.u16=t=>e(i.jy.U16.serialize(t)),t.u32=t=>e(i.jy.U32.serialize(t)),t.u64=t=>e(i.jy.U64.serialize(t)),t.u128=t=>e(i.jy.U128.serialize(t)),t.u256=t=>e(i.jy.U256.serialize(t)),t.bool=t=>e(i.jy.Bool.serialize(t)),t.string=t=>e(i.jy.String.serialize(t)),t.address=t=>e(i.jy.Address.serialize(t)),t.id=t.address,t.vector=(t,r)=>e(i.jy.vector(o(t)).serialize(r)),t.option=(t,r)=>e(i.jy.option(o(t)).serialize(r)),t}function o(e){switch(e){case"u8":return i.jy.u8();case"u16":return i.jy.u16();case"u32":return i.jy.u32();case"u64":return i.jy.u64();case"u128":return i.jy.u128();case"u256":return i.jy.u256();case"bool":return i.jy.bool();case"string":return i.jy.string();case"id":case"address":return i.jy.Address}const t=e.match(/^(vector|option)<(.+)>$/);if(t){const[e,r]=t.slice(1);return"vector"===e?i.jy.vector(o(r)):i.jy.option(o(r))}throw new Error(`Invalid Pure type name: ${e}`)}},801:(e,t,r)=>{r.d(t,{n:()=>s});const n=/^(?!.*(^(?!@)|[-.@])($|[-.@]))(?:[a-z0-9-]{0,63}(?:\.[a-z0-9-]{0,63})*)?@[a-z0-9-]{0,63}$/i,i=/^(?!.*(^|[-.])($|[-.]))(?:[a-z0-9-]{0,63}\.)+sui$/i;function s(e,t="at"){const r=e.toLowerCase();let s;if(r.includes("@")){if(!n.test(r))throw new Error(`Invalid SuiNS name ${e}`);const[t,i]=r.split("@");s=[...t?t.split("."):[],i]}else{if(!i.test(r))throw new Error(`Invalid SuiNS name ${e}`);s=r.split(".").slice(0,-1)}return"dot"===t?`${s.join(".")}.sui`:`${s.slice(0,-1).join(".")}@${s[s.length-1]}`}},833:(e,t,r)=>{r.d(t,{g3:()=>g,oO:()=>h,yq:()=>p});var n=r(4364),i=r(7388),s=r(9298);const o="object",a="ID",u="ascii",c="String",l="string",d="String",y="option",f="Option";function p(e){const t="object"==typeof e.body&&"datatype"in e.body?e.body.datatype:null;return!!t&&(0,s.t4)(t.package)===(0,s.t4)("0x2")&&"tx_context"===t.module&&"TxContext"===t.type}function g(e){if("string"==typeof e)switch(e){case"address":return n.jy.Address;case"bool":return n.jy.Bool;case"u8":return n.jy.U8;case"u16":return n.jy.U16;case"u32":return n.jy.U32;case"u64":return n.jy.U64;case"u128":return n.jy.U128;case"u256":return n.jy.U256;default:throw new Error(`Unknown type signature ${e}`)}if("vector"in e){if("u8"===e.vector)return n.jy.vector(n.jy.U8).transform({input:e=>"string"==typeof e?(new TextEncoder).encode(e):e,output:e=>e});const t=g(e.vector);return t?n.jy.vector(t):null}if("datatype"in e){const t=(0,s.t4)(e.datatype.package);if(t===(0,s.t4)(i.Yy)){if(e.datatype.module===u&&e.datatype.type===c)return n.jy.String;if(e.datatype.module===l&&e.datatype.type===d)return n.jy.String;if(e.datatype.module===y&&e.datatype.type===f){const t=g(e.datatype.typeParameters[0]);return t?n.jy.vector(t):null}}if(t===(0,s.t4)(i.C6)&&e.datatype.module===o&&e.datatype.type===a)return n.jy.Address}return null}function h(e){return"object"==typeof e&&"Reference"in e?{ref:"&",body:j(e.Reference)}:"object"==typeof e&&"MutableReference"in e?{ref:"&mut",body:j(e.MutableReference)}:{ref:null,body:j(e)}}function j(e){if("string"==typeof e)switch(e){case"Address":return"address";case"Bool":return"bool";case"U8":return"u8";case"U16":return"u16";case"U32":return"u32";case"U64":return"u64";case"U128":return"u128";case"U256":return"u256";default:throw new Error(`Unexpected type ${e}`)}if("Vector"in e)return{vector:j(e.Vector)};if("Struct"in e)return{datatype:{package:e.Struct.address,module:e.Struct.module,type:e.Struct.name,typeParameters:e.Struct.typeArguments.map(j)}};if("TypeParameter"in e)return{typeParameter:e.TypeParameter};throw new Error(`Unexpected type ${JSON.stringify(e)}`)}},6092:(e,t,r)=>{r.d(t,{eu:()=>k});var n=r(9440),i=r(4278),s=r(1646),o=r(3274),a=r(7745);function u(e){if(1!==e.length)throw new Error("Invalid base64Url character: "+e);const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".indexOf(e);if(-1===t)throw new Error("Invalid base64Url character: "+e);const r=t.toString(2).padStart(6,"0");return Array.from(r).map(Number)}function c(e,t){const r=function(e,t){if(e.length<2)throw new Error(`Input (s = ${e}) is not tightly packed because s.length < 2`);let r=function(e){let t=[];for(let r=0;r<e.length;r++){const n=u(e.charAt(r));t=t.concat(n)}return t}(e);const n=t%4;if(0===n);else if(1===n)r=r.slice(2);else{if(2!==n)throw new Error(`Input (s = ${e}) is not tightly packed because i%4 = 3 (i = ${t}))`);r=r.slice(4)}const i=(t+e.length-1)%4;if(3===i);else if(2===i)r=r.slice(0,r.length-2);else{if(1!==i)throw new Error(`Input (s = ${e}) is not tightly packed because (i + s.length - 1)%4 = 0 (i = ${t}))`);r=r.slice(0,r.length-4)}if(r.length%8!=0)throw new Error("We should never reach here...");const s=new Uint8Array(Math.floor(r.length/8));let o=0;for(let e=0;e<r.length;e+=8){const t=r.slice(e,e+8),n=parseInt(t.join(""),2);s[o++]=n}return(new TextDecoder).decode(s)}(e.value,e.indexMod4),[n,i]=function(e){if("}"!==e.slice(-1)&&","!==e.slice(-1))throw new Error("Invalid claim");const t=JSON.parse("{"+e.slice(0,-1)+"}");if(1!==Object.keys(t).length)throw new Error("Invalid claim");const r=Object.keys(t)[0];return[r,t[r]]}(r);if(n!==t)throw new Error(`Invalid field name: found ${n} expected ${t}`);return i}var l=r(5412);const d=l.j.struct("ZkLoginSignature",{inputs:l.j.struct("ZkLoginSignatureInputs",{proofPoints:l.j.struct("ZkLoginSignatureInputsProofPoints",{a:l.j.vector(l.j.string()),b:l.j.vector(l.j.vector(l.j.string())),c:l.j.vector(l.j.string())}),issBase64Details:l.j.struct("ZkLoginSignatureInputsClaim",{value:l.j.string(),indexMod4:l.j.u8()}),headerBase64:l.j.string(),addressSeed:l.j.string()}),maxEpoch:l.j.u64(),userSignature:l.j.vector(l.j.u8())});var y=r(4976);var f,p,g=e=>{throw TypeError(e)},h=(e,t,r)=>t.has(e)||g("Cannot "+r),j=(e,t,r)=>(h(e,t,"read from private field"),r?r.call(e):t.get(e)),w=(e,t,r)=>t.has(e)?g("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),b=(e,t,r,n)=>(h(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);const S=class e extends i.J{constructor(e,{client:t}={}){super(),w(this,f),w(this,p),b(this,p,t),"string"==typeof e?b(this,f,(0,n.Z)(e)):e instanceof Uint8Array?b(this,f,e):b(this,f,Uint8Array.from(e))}equals(e){return super.equals(e)}toRawBytes(){return j(this,f)}flag(){return s.uD.ZkLogin}async verify(e,t){throw Error("does not support")}verifyPersonalMessage(t,r){const i=k(r);return U({address:new e(i.publicKey).toSuiAddress(),bytes:(0,n.o)(t),signature:i.serializedSignature,intentScope:"PERSONAL_MESSAGE",client:j(this,p)})}verifyTransaction(t,r){const i=k(r);return U({address:new e(i.publicKey).toSuiAddress(),bytes:(0,n.o)(t),signature:i.serializedSignature,intentScope:"TRANSACTION_DATA",client:j(this,p)})}};f=new WeakMap,p=new WeakMap;let v=S;const m=(0,a.UG)("\n\tquery Zklogin(\n\t\t$bytes: Base64!\n\t\t$signature: Base64!\n\t\t$intentScope: ZkLoginIntentScope!\n\t\t$author: SuiAddress!\n\t) {\n\t\tverifyZkloginSignature(\n\t\t\tbytes: $bytes\n\t\t\tsignature: $signature\n\t\t\tintentScope: $intentScope\n\t\t\tauthor: $author\n\t\t) {\n\t\t\tsuccess\n\t\t\terrors\n\t\t}\n\t}\n");async function U({address:e,bytes:t,signature:r,intentScope:n,client:i=new o.A({url:"https://sui-mainnet.mystenlabs.com/graphql"})}){const s=await i.query({query:m,variables:{bytes:t,signature:r,intentScope:n,author:e}});return!0===s.data?.verifyZkloginSignature.success&&0===s.data?.verifyZkloginSignature.errors.length}function k(e){const t="string"==typeof e?(0,n.Z)(e):e;if(t[0]!==s.uD.ZkLogin)throw new Error("Invalid signature scheme");const r=t.slice(1),{inputs:i,maxEpoch:o,userSignature:a}=function(e){return d.parse("string"==typeof e?(0,n.Z)(e):e)}(r),{issBase64Details:u,addressSeed:l}=i,f=c(u,"iss"),p=function(e,t){const r=function(e,t){const r=e.toString(16);return(0,y.aT)(r.padStart(2*t,"0").slice(2*-t))}(e,32),n=(new TextEncoder).encode(t),i=new Uint8Array(1+n.length+r.length);return i.set([n.length],0),i.set(n,1),i.set(r,1+n.length),new v(i,void 0)}(BigInt(l),f);return{serializedSignature:(0,n.o)(t),signatureScheme:"ZkLogin",zkLogin:{inputs:i,maxEpoch:o,userSignature:a,iss:f,addressSeed:BigInt(l)},signature:t,publicKey:p.toRawBytes()}}},7388:(e,t,r)=>{r.d(t,{Ac:()=>o,C6:()=>s,Yy:()=>i});var n=r(9298);BigInt(1e9);const i="0x1",s="0x2",o=((0,n.fN)("0x6"),`${s}::sui::SUI`);(0,n.fN)("0x5")},7668:(e,t,r)=>{r.d(t,{_t:()=>i});var n=r(9298);function i(e){return"string"==typeof e?(0,n.t4)(e):e.Object?e.Object.ImmOrOwnedObject?(0,n.t4)(e.Object.ImmOrOwnedObject.objectId):e.Object.Receiving?(0,n.t4)(e.Object.Receiving.objectId):(0,n.t4)(e.Object.SharedObject.objectId):e.UnresolvedObject?(0,n.t4)(e.UnresolvedObject.objectId):void 0}},8978:(e,t,r)=>{function n(e){function t(t){return e(t)}return t.system=()=>t("0x5"),t.clock=()=>t("0x6"),t.random=()=>t("0x8"),t.denyList=()=>t("0x403"),t}r.d(t,{O:()=>n})},9298:(e,t,r)=>{r.d(t,{AP:()=>a,fN:()=>l,n4:()=>s,qD:()=>u,t4:()=>c,wn:()=>o});var n=r(9835);const i=32;function s(e){try{return(0,n.Q)(e).length===i}catch(e){return!1}}const o=32;function a(e){return function(e){return/^(0x|0X)?[a-fA-F0-9]+$/.test(e)&&e.length%2==0}(e)&&function(e){return/^(0x|0X)/.test(e)?(e.length-2)/2:e.length/2}(e)===o}function u(e){return a(e)}function c(e,t=!1){let r=e.toLowerCase();return!t&&r.startsWith("0x")&&(r=r.slice(2)),`0x${r.padStart(2*o,"0")}`}function l(e,t=!1){return c(e,t)}}}]);