@magic-ext/farcaster
Advanced tools
Comparing version 0.0.4 to 0.0.5-canary.754.9662848762.0
@@ -1,2 +0,2 @@ | ||
"use strict";var h=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames,b=Object.getOwnPropertySymbols;var A=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable;var y=(n,e,t)=>e in n?h(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,I=(n,e)=>{for(var t in e||(e={}))A.call(e,t)&&y(n,t,e[t]);if(b)for(var t of b(e))P.call(e,t)&&y(n,t,e[t]);return n};var L=(n,e)=>{for(var t in e)h(n,t,{get:e[t],enumerable:!0})},S=(n,e,t,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of k(e))!A.call(n,r)&&r!==t&&h(n,r,{get:()=>e[r],enumerable:!(l=w(e,r))||l.enumerable});return n};var T=n=>S(h({},"__esModule",{value:!0}),n);var g=(n,e,t)=>new Promise((l,r)=>{var f=s=>{try{c(t.next(s))}catch(u){r(u)}},o=s=>{try{c(t.throw(s))}catch(u){r(u)}},c=s=>s.done?l(s.value):Promise.resolve(s.value).then(f,o);c((t=t.apply(n,e)).next())});var J={};L(J,{FarcasterExtension:()=>C});module.exports=T(J);var m=require("@magic-sdk/commons"),p=require("@farcaster/auth-client");function x(){return typeof navigator!="undefined"&&/android/i.test(navigator.userAgent)}function U(){return typeof navigator!="undefined"&&/iPhone|iPod/.test(navigator.userAgent)}function D(){return typeof navigator!="undefined"&&(/iPad/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)}function _(){return U()||D()}function R(){return x()||_()}var v={CHANNEL:"channel",DONE:"done",ERROR:"error"},H=n=>typeof n=="function",F=n=>typeof n=="function",O="https://relay.farcaster.xyz",N="https://example.com/login",q=6e4,W=500,C=class extends m.Extension.Internal{constructor(){super(...arguments);this.name="farcaster";this.config={};this.login=({showUI:t})=>{let l=(0,p.createAppClient)({relay:O,ethereum:(0,p.viemConnector)()}),r=l.createChannel({siweUri:N,domain:window.location.host}),f=r.then(({data:d})=>l.watchStatus({channelToken:d.channelToken,timeout:q,interval:W}).then(i=>{if(i.isError)throw i.error;return i})),o=null,c,s,u;R()&&(console.info("Info: showUI parameter is ignored on mobile, open URL directly"),o=window.open());let E={on:(d,i)=>(d==="channel"&&g(this,null,function*(){let{data:a}=yield r;!H(i)||(i(a),u=a.channelToken,R()&&(o==null||o.location.assign(a.url)),c=this.utils.createJsonRpcRequestPayload("farcaster_show_QR",[{data:I({showUI:t},a)}]),s=this.request(c))}),d===v.DONE&&g(this,null,function*(){let{data:a}=yield f;a.state==="completed"&&(this.createIntermediaryEvent(m.FarcasterLoginEventEmit.SuccessSignIn,c.id)({channel_token:u,message:a.message,signature:a.signature,fid:a.fid,username:a.username}),yield s,F(i)&&(o==null||o.close(),i(a)))}),d===v.ERROR&&f.catch(a=>{o==null||o.close(),i(a)}),E)};return E}}}; | ||
"use strict";var d=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames,A=Object.getOwnPropertySymbols;var w=Object.prototype.hasOwnProperty,U=Object.prototype.propertyIsEnumerable;var I=(t,n,e)=>n in t?d(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e,v=(t,n)=>{for(var e in n||(n={}))w.call(n,e)&&I(t,e,n[e]);if(A)for(var e of A(n))U.call(n,e)&&I(t,e,n[e]);return t};var S=(t,n)=>{for(var e in n)d(t,e,{get:n[e],enumerable:!0})},T=(t,n,e,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of L(n))!w.call(t,o)&&o!==e&&d(t,o,{get:()=>n[o],enumerable:!(i=k(n,o))||i.enumerable});return t};var _=t=>T(d({},"__esModule",{value:!0}),t);var m=(t,n,e)=>new Promise((i,o)=>{var h=r=>{try{l(e.next(r))}catch(c){o(c)}},f=r=>{try{l(e.throw(r))}catch(c){o(c)}},l=r=>r.done?i(r.value):Promise.resolve(r.value).then(h,f);l((e=e.apply(t,n)).next())});var V={};S(V,{FarcasterExtension:()=>E});module.exports=_(V);var p=require("@magic-sdk/commons"),g=require("@farcaster/auth-client");function x(){return typeof navigator!="undefined"&&/android/i.test(navigator.userAgent)}function D(){return typeof navigator!="undefined"&&/iPhone|iPod/.test(navigator.userAgent)}function H(){return typeof navigator!="undefined"&&(/iPad/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)}function F(){return D()||H()}function C(){return x()||F()}var P={CHANNEL:"channel",DONE:"done",ERROR:"error"},O=t=>typeof t=="function",N=t=>typeof t=="function",q="https://relay.farcaster.xyz",W="https://example.com/login",J=6e4,M=500,Q=!0,E=class extends p.Extension.Internal{constructor(){super(...arguments);this.name="farcaster";this.config={};this.login=e=>{var b;let i=(b=e==null?void 0:e.showUI)!=null?b:Q,o=null,h,f,l;C()&&(console.info("Info: showUI parameter is ignored on mobile, open URL directly"),o=window.open());let r=(0,g.createAppClient)({relay:q,ethereum:(0,g.viemConnector)()}),c=r.createChannel({siweUri:W,domain:window.location.host}),R=c.then(({data:a})=>(C()&&(o==null||o.location.assign(a.url)),l=a.channelToken,h=this.utils.createJsonRpcRequestPayload("farcaster_show_QR",[{data:v({showUI:i},a)}]),f=this.request(h),r.watchStatus({channelToken:a.channelToken,timeout:J,interval:M}).then(s=>{if(s.isError)throw s.error;return s})));R.then(s=>m(this,[s],function*({data:a}){a.state==="completed"&&(this.createIntermediaryEvent(p.FarcasterLoginEventEmit.SuccessSignIn,h.id)({channel_token:l,message:a.message,signature:a.signature,fid:a.fid,username:a.username}),yield f,o==null||o.close())})).catch(a=>{o==null||o.close()});let y={on:(a,s)=>(a==="channel"&&m(this,null,function*(){let{data:u}=yield c;!O(s)||s(u)}),a===P.DONE&&m(this,null,function*(){let{data:u}=yield R;u.state==="completed"&&(!N(s)||s(u))}),a===P.ERROR&&R.catch(u=>{s(u)}),y)};return y}}}; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict";var h=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames,b=Object.getOwnPropertySymbols;var A=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable;var y=(n,e,t)=>e in n?h(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,I=(n,e)=>{for(var t in e||(e={}))A.call(e,t)&&y(n,t,e[t]);if(b)for(var t of b(e))P.call(e,t)&&y(n,t,e[t]);return n};var L=(n,e)=>{for(var t in e)h(n,t,{get:e[t],enumerable:!0})},S=(n,e,t,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of k(e))!A.call(n,r)&&r!==t&&h(n,r,{get:()=>e[r],enumerable:!(l=w(e,r))||l.enumerable});return n};var T=n=>S(h({},"__esModule",{value:!0}),n);var g=(n,e,t)=>new Promise((l,r)=>{var f=s=>{try{c(t.next(s))}catch(u){r(u)}},o=s=>{try{c(t.throw(s))}catch(u){r(u)}},c=s=>s.done?l(s.value):Promise.resolve(s.value).then(f,o);c((t=t.apply(n,e)).next())});var J={};L(J,{FarcasterExtension:()=>C});module.exports=T(J);var m=require("@magic-sdk/commons"),p=require("@farcaster/auth-client");function x(){return typeof navigator!="undefined"&&/android/i.test(navigator.userAgent)}function U(){return typeof navigator!="undefined"&&/iPhone|iPod/.test(navigator.userAgent)}function D(){return typeof navigator!="undefined"&&(/iPad/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)}function _(){return U()||D()}function R(){return x()||_()}var v={CHANNEL:"channel",DONE:"done",ERROR:"error"},H=n=>typeof n=="function",F=n=>typeof n=="function",O="https://relay.farcaster.xyz",N="https://example.com/login",q=6e4,W=500,C=class extends m.Extension.Internal{constructor(){super(...arguments);this.name="farcaster";this.config={};this.login=({showUI:t})=>{let l=(0,p.createAppClient)({relay:O,ethereum:(0,p.viemConnector)()}),r=l.createChannel({siweUri:N,domain:window.location.host}),f=r.then(({data:d})=>l.watchStatus({channelToken:d.channelToken,timeout:q,interval:W}).then(i=>{if(i.isError)throw i.error;return i})),o=null,c,s,u;R()&&(console.info("Info: showUI parameter is ignored on mobile, open URL directly"),o=window.open());let E={on:(d,i)=>(d==="channel"&&g(this,null,function*(){let{data:a}=yield r;!H(i)||(i(a),u=a.channelToken,R()&&(o==null||o.location.assign(a.url)),c=this.utils.createJsonRpcRequestPayload("farcaster_show_QR",[{data:I({showUI:t},a)}]),s=this.request(c))}),d===v.DONE&&g(this,null,function*(){let{data:a}=yield f;a.state==="completed"&&(this.createIntermediaryEvent(m.FarcasterLoginEventEmit.SuccessSignIn,c.id)({channel_token:u,message:a.message,signature:a.signature,fid:a.fid,username:a.username}),yield s,F(i)&&(o==null||o.close(),i(a)))}),d===v.ERROR&&f.catch(a=>{o==null||o.close(),i(a)}),E)};return E}}}; | ||
"use strict";var d=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames,A=Object.getOwnPropertySymbols;var w=Object.prototype.hasOwnProperty,U=Object.prototype.propertyIsEnumerable;var I=(t,n,e)=>n in t?d(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e,v=(t,n)=>{for(var e in n||(n={}))w.call(n,e)&&I(t,e,n[e]);if(A)for(var e of A(n))U.call(n,e)&&I(t,e,n[e]);return t};var S=(t,n)=>{for(var e in n)d(t,e,{get:n[e],enumerable:!0})},T=(t,n,e,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of L(n))!w.call(t,o)&&o!==e&&d(t,o,{get:()=>n[o],enumerable:!(i=k(n,o))||i.enumerable});return t};var _=t=>T(d({},"__esModule",{value:!0}),t);var m=(t,n,e)=>new Promise((i,o)=>{var h=r=>{try{l(e.next(r))}catch(c){o(c)}},f=r=>{try{l(e.throw(r))}catch(c){o(c)}},l=r=>r.done?i(r.value):Promise.resolve(r.value).then(h,f);l((e=e.apply(t,n)).next())});var V={};S(V,{FarcasterExtension:()=>E});module.exports=_(V);var p=require("@magic-sdk/commons"),g=require("@farcaster/auth-client");function x(){return typeof navigator!="undefined"&&/android/i.test(navigator.userAgent)}function D(){return typeof navigator!="undefined"&&/iPhone|iPod/.test(navigator.userAgent)}function H(){return typeof navigator!="undefined"&&(/iPad/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)}function F(){return D()||H()}function C(){return x()||F()}var P={CHANNEL:"channel",DONE:"done",ERROR:"error"},O=t=>typeof t=="function",N=t=>typeof t=="function",q="https://relay.farcaster.xyz",W="https://example.com/login",J=6e4,M=500,Q=!0,E=class extends p.Extension.Internal{constructor(){super(...arguments);this.name="farcaster";this.config={};this.login=e=>{var b;let i=(b=e==null?void 0:e.showUI)!=null?b:Q,o=null,h,f,l;C()&&(console.info("Info: showUI parameter is ignored on mobile, open URL directly"),o=window.open());let r=(0,g.createAppClient)({relay:q,ethereum:(0,g.viemConnector)()}),c=r.createChannel({siweUri:W,domain:window.location.host}),R=c.then(({data:a})=>(C()&&(o==null||o.location.assign(a.url)),l=a.channelToken,h=this.utils.createJsonRpcRequestPayload("farcaster_show_QR",[{data:v({showUI:i},a)}]),f=this.request(h),r.watchStatus({channelToken:a.channelToken,timeout:J,interval:M}).then(s=>{if(s.isError)throw s.error;return s})));R.then(s=>m(this,[s],function*({data:a}){a.state==="completed"&&(this.createIntermediaryEvent(p.FarcasterLoginEventEmit.SuccessSignIn,h.id)({channel_token:l,message:a.message,signature:a.signature,fid:a.fid,username:a.username}),yield f,o==null||o.close())})).catch(a=>{o==null||o.close()});let y={on:(a,s)=>(a==="channel"&&m(this,null,function*(){let{data:u}=yield c;!O(s)||s(u)}),a===P.DONE&&m(this,null,function*(){let{data:u}=yield R;u.state==="completed"&&(!N(s)||s(u))}),a===P.ERROR&&R.catch(u=>{s(u)}),y)};return y}}}; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
var y=Object.defineProperty;var g=Object.getOwnPropertySymbols;var A=Object.prototype.hasOwnProperty,I=Object.prototype.propertyIsEnumerable;var R=(n,t,e)=>t in n?y(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,C=(n,t)=>{for(var e in t||(t={}))A.call(t,e)&&R(n,e,t[e]);if(g)for(var e of g(t))I.call(t,e)&&R(n,e,t[e]);return n};var h=(n,t,e)=>new Promise((d,c)=>{var f=r=>{try{i(e.next(r))}catch(l){c(l)}},o=r=>{try{i(e.throw(r))}catch(l){c(l)}},i=r=>r.done?d(r.value):Promise.resolve(r.value).then(f,o);i((e=e.apply(n,t)).next())});import{Extension as L,FarcasterLoginEventEmit as S}from"@magic-sdk/commons";import{createAppClient as T,viemConnector as x}from"@farcaster/auth-client";function v(){return typeof navigator!="undefined"&&/android/i.test(navigator.userAgent)}function w(){return typeof navigator!="undefined"&&/iPhone|iPod/.test(navigator.userAgent)}function k(){return typeof navigator!="undefined"&&(/iPad/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)}function P(){return w()||k()}function m(){return v()||P()}var E={CHANNEL:"channel",DONE:"done",ERROR:"error"},U=n=>typeof n=="function",D=n=>typeof n=="function",_="https://relay.farcaster.xyz",H="https://example.com/login",F=6e4,O=500,b=class extends L.Internal{constructor(){super(...arguments);this.name="farcaster";this.config={};this.login=({showUI:e})=>{let d=T({relay:_,ethereum:x()}),c=d.createChannel({siweUri:H,domain:window.location.host}),f=c.then(({data:u})=>d.watchStatus({channelToken:u.channelToken,timeout:F,interval:O}).then(s=>{if(s.isError)throw s.error;return s})),o=null,i,r,l;m()&&(console.info("Info: showUI parameter is ignored on mobile, open URL directly"),o=window.open());let p={on:(u,s)=>(u==="channel"&&h(this,null,function*(){let{data:a}=yield c;!U(s)||(s(a),l=a.channelToken,m()&&(o==null||o.location.assign(a.url)),i=this.utils.createJsonRpcRequestPayload("farcaster_show_QR",[{data:C({showUI:e},a)}]),r=this.request(i))}),u===E.DONE&&h(this,null,function*(){let{data:a}=yield f;a.state==="completed"&&(this.createIntermediaryEvent(S.SuccessSignIn,i.id)({channel_token:l,message:a.message,signature:a.signature,fid:a.fid,username:a.username}),yield r,D(s)&&(o==null||o.close(),s(a)))}),u===E.ERROR&&f.catch(a=>{o==null||o.close(),s(a)}),p)};return p}}};export{b as FarcasterExtension}; | ||
var I=Object.defineProperty;var C=Object.getOwnPropertySymbols;var w=Object.prototype.hasOwnProperty,v=Object.prototype.propertyIsEnumerable;var E=(t,o,e)=>o in t?I(t,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[o]=e,y=(t,o)=>{for(var e in o||(o={}))w.call(o,e)&&E(t,e,o[e]);if(C)for(var e of C(o))v.call(o,e)&&E(t,e,o[e]);return t};var f=(t,o,e)=>new Promise((d,a)=>{var u=r=>{try{i(e.next(r))}catch(l){a(l)}},h=r=>{try{i(e.throw(r))}catch(l){a(l)}},i=r=>r.done?d(r.value):Promise.resolve(r.value).then(u,h);i((e=e.apply(t,o)).next())});import{Extension as S,FarcasterLoginEventEmit as T}from"@magic-sdk/commons";import{createAppClient as _,viemConnector as x}from"@farcaster/auth-client";function P(){return typeof navigator!="undefined"&&/android/i.test(navigator.userAgent)}function k(){return typeof navigator!="undefined"&&/iPhone|iPod/.test(navigator.userAgent)}function L(){return typeof navigator!="undefined"&&(/iPad/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)}function U(){return k()||L()}function p(){return P()||U()}var b={CHANNEL:"channel",DONE:"done",ERROR:"error"},D=t=>typeof t=="function",H=t=>typeof t=="function",F="https://relay.farcaster.xyz",O="https://example.com/login",N=6e4,q=500,W=!0,A=class extends S.Internal{constructor(){super(...arguments);this.name="farcaster";this.config={};this.login=e=>{var R;let d=(R=e==null?void 0:e.showUI)!=null?R:W,a=null,u,h,i;p()&&(console.info("Info: showUI parameter is ignored on mobile, open URL directly"),a=window.open());let r=_({relay:F,ethereum:x()}),l=r.createChannel({siweUri:O,domain:window.location.host}),m=l.then(({data:n})=>(p()&&(a==null||a.location.assign(n.url)),i=n.channelToken,u=this.utils.createJsonRpcRequestPayload("farcaster_show_QR",[{data:y({showUI:d},n)}]),h=this.request(u),r.watchStatus({channelToken:n.channelToken,timeout:N,interval:q}).then(s=>{if(s.isError)throw s.error;return s})));m.then(s=>f(this,[s],function*({data:n}){n.state==="completed"&&(this.createIntermediaryEvent(T.SuccessSignIn,u.id)({channel_token:i,message:n.message,signature:n.signature,fid:n.fid,username:n.username}),yield h,a==null||a.close())})).catch(n=>{a==null||a.close()});let g={on:(n,s)=>(n==="channel"&&f(this,null,function*(){let{data:c}=yield l;!D(s)||s(c)}),n===b.DONE&&f(this,null,function*(){let{data:c}=yield m;c.state==="completed"&&(!H(s)||s(c))}),n===b.ERROR&&m.catch(c=>{s(c)}),g)};return g}}};export{A as FarcasterExtension}; | ||
//# sourceMappingURL=index.js.map |
@@ -14,9 +14,10 @@ import { Extension } from '@magic-sdk/commons'; | ||
} | ||
type LoginParams = { | ||
showUI: boolean; | ||
}; | ||
export declare class FarcasterExtension extends Extension.Internal<'farcaster'> { | ||
name: "farcaster"; | ||
config: {}; | ||
login: ({ showUI }: { | ||
showUI: boolean; | ||
}) => Handle; | ||
login: (params?: LoginParams) => Handle; | ||
} | ||
export {}; |
{ | ||
"name": "@magic-ext/farcaster", | ||
"version": "0.0.4", | ||
"version": "0.0.5-canary.754.9662848762.0", | ||
"description": "magic farcaster extension", | ||
@@ -42,3 +42,3 @@ "author": "Magic <team@magic.link> (https://magic.link/)", | ||
}, | ||
"gitHead": "0a4033bd856dd559210906610a69117d92aab858" | ||
"gitHead": "a39da606b88d0d1f2eb7fc10021552ad4d7c046e" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
961590
4191