@magic-ext/farcaster
Advanced tools
Comparing version 0.18.1-canary.841.12040077262.0 to 0.18.1-canary.841.12054994372.0
@@ -1,2 +0,2 @@ | ||
"use strict";var s=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var w=Object.prototype.hasOwnProperty;var E=(r,n)=>{for(var t in n)s(r,t,{get:n[t],enumerable:!0})},v=(r,n,t,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let e of f(n))!w.call(r,e)&&e!==t&&s(r,e,{get:()=>n[e],enumerable:!(o=p(n,e))||o.enumerable});return r};var C=r=>v(s({},"__esModule",{value:!0}),r);var I={};E(I,{FarcasterExtension:()=>c,isMobile:()=>i});module.exports=C(I);var u=require("@magic-sdk/commons");function m(){return typeof navigator!="undefined"&&/android/i.test(navigator.userAgent)}function b(){return typeof navigator!="undefined"&&/iPhone|iPod/.test(navigator.userAgent)}function A(){return typeof navigator!="undefined"&&(/iPad/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)}function y(){return b()||A()}function i(){return m()||y()}function d(){return typeof window!="undefined"&&window===window.top}var x=!0;var R="https://relay.farcaster.xyz",c=class extends u.Extension.Internal{constructor(){super(...arguments);this.name="farcaster";this.config={};this.login=t=>{let o=()=>fetch(`${R}/v1/channel`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({domain:window.location.host,siweUri:window.location.origin})}).then(e=>{if(!e.ok)throw new Error("Error creating channel.");return e.json()}).then(e=>{if(!e)throw new Error("Channel not created yet.");return e});try{return o().then(a=>{var l;let g=this.utils.createJsonRpcRequestPayload("farcaster_show_QR",[{data:{showUI:(l=t==null?void 0:t.showUI)!=null?l:x,domain:window.location.origin,isMobile:i(),channel:a}}]),h=this.request(g);return i()&&d()&&(window.location.href=a.url),h}).catch(a=>{throw new Error(a)})}catch(e){throw new Error(e.message)}}}}; | ||
"use strict";var u=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var C=(r,n)=>{for(var e in n)u(r,e,{get:n[e],enumerable:!0})},b=(r,n,e,a)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of E(n))!m.call(r,o)&&o!==e&&u(r,o,{get:()=>n[o],enumerable:!(a=w(n,o))||a.enumerable});return r};var y=r=>b(u({},"__esModule",{value:!0}),r);var p=(r,n,e)=>new Promise((a,o)=>{var d=t=>{try{i(e.next(t))}catch(s){o(s)}},c=t=>{try{i(e.throw(t))}catch(s){o(s)}},i=t=>t.done?a(t.value):Promise.resolve(t.value).then(d,c);i((e=e.apply(r,n)).next())});var O={};C(O,{FarcasterExtension:()=>g,isMobile:()=>l});module.exports=y(O);var f=require("@magic-sdk/commons");function A(){return typeof navigator!="undefined"&&/android/i.test(navigator.userAgent)}function x(){return typeof navigator!="undefined"&&/iPhone|iPod/.test(navigator.userAgent)}function R(){return typeof navigator!="undefined"&&(/iPad/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)}function F(){return x()||R()}function l(){return A()||F()}function h(){return typeof window!="undefined"&&window===window.top}var I=!0;var L="https://relay.farcaster.xyz",g=class extends f.Extension.Internal{constructor(){super(...arguments);this.name="farcaster";this.config={};this.login=e=>this.utils.createPromiEvent((o,d)=>p(this,null,function*(){var c;try{let i=yield fetch(`${L}/v1/channel`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({domain:window.location.host,siweUri:window.location.origin})});if(!i.ok)throw new Error("Error creating channel.");let t=yield i.json();if(!t)throw new Error("Channel not created yet.");let s=this.utils.createJsonRpcRequestPayload("farcaster_show_QR",[{data:{showUI:(c=e==null?void 0:e.showUI)!=null?c:I,domain:window.location.origin,isMobile:l(),channel:t}}]),v=this.request(s);l()&&h()&&(window.location.href=t.url),o(v)}catch(i){d(i)}}))}}; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict";var s=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var w=Object.prototype.hasOwnProperty;var E=(r,n)=>{for(var t in n)s(r,t,{get:n[t],enumerable:!0})},v=(r,n,t,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let e of f(n))!w.call(r,e)&&e!==t&&s(r,e,{get:()=>n[e],enumerable:!(o=p(n,e))||o.enumerable});return r};var C=r=>v(s({},"__esModule",{value:!0}),r);var I={};E(I,{FarcasterExtension:()=>c,isMobile:()=>i});module.exports=C(I);var u=require("@magic-sdk/commons");function m(){return typeof navigator!="undefined"&&/android/i.test(navigator.userAgent)}function b(){return typeof navigator!="undefined"&&/iPhone|iPod/.test(navigator.userAgent)}function A(){return typeof navigator!="undefined"&&(/iPad/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)}function y(){return b()||A()}function i(){return m()||y()}function d(){return typeof window!="undefined"&&window===window.top}var x=!0;var R="https://relay.farcaster.xyz",c=class extends u.Extension.Internal{constructor(){super(...arguments);this.name="farcaster";this.config={};this.login=t=>{let o=()=>fetch(`${R}/v1/channel`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({domain:window.location.host,siweUri:window.location.origin})}).then(e=>{if(!e.ok)throw new Error("Error creating channel.");return e.json()}).then(e=>{if(!e)throw new Error("Channel not created yet.");return e});try{return o().then(a=>{var l;let g=this.utils.createJsonRpcRequestPayload("farcaster_show_QR",[{data:{showUI:(l=t==null?void 0:t.showUI)!=null?l:x,domain:window.location.origin,isMobile:i(),channel:a}}]),h=this.request(g);return i()&&d()&&(window.location.href=a.url),h}).catch(a=>{throw new Error(a)})}catch(e){throw new Error(e.message)}}}}; | ||
"use strict";var u=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var C=(r,n)=>{for(var e in n)u(r,e,{get:n[e],enumerable:!0})},b=(r,n,e,a)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of E(n))!m.call(r,o)&&o!==e&&u(r,o,{get:()=>n[o],enumerable:!(a=w(n,o))||a.enumerable});return r};var y=r=>b(u({},"__esModule",{value:!0}),r);var p=(r,n,e)=>new Promise((a,o)=>{var d=t=>{try{i(e.next(t))}catch(s){o(s)}},c=t=>{try{i(e.throw(t))}catch(s){o(s)}},i=t=>t.done?a(t.value):Promise.resolve(t.value).then(d,c);i((e=e.apply(r,n)).next())});var O={};C(O,{FarcasterExtension:()=>g,isMobile:()=>l});module.exports=y(O);var f=require("@magic-sdk/commons");function A(){return typeof navigator!="undefined"&&/android/i.test(navigator.userAgent)}function x(){return typeof navigator!="undefined"&&/iPhone|iPod/.test(navigator.userAgent)}function R(){return typeof navigator!="undefined"&&(/iPad/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)}function F(){return x()||R()}function l(){return A()||F()}function h(){return typeof window!="undefined"&&window===window.top}var I=!0;var L="https://relay.farcaster.xyz",g=class extends f.Extension.Internal{constructor(){super(...arguments);this.name="farcaster";this.config={};this.login=e=>this.utils.createPromiEvent((o,d)=>p(this,null,function*(){var c;try{let i=yield fetch(`${L}/v1/channel`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({domain:window.location.host,siweUri:window.location.origin})});if(!i.ok)throw new Error("Error creating channel.");let t=yield i.json();if(!t)throw new Error("Channel not created yet.");let s=this.utils.createJsonRpcRequestPayload("farcaster_show_QR",[{data:{showUI:(c=e==null?void 0:e.showUI)!=null?c:I,domain:window.location.origin,isMobile:l(),channel:t}}]),v=this.request(s);l()&&h()&&(window.location.href=t.url),o(v)}catch(i){d(i)}}))}}; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
import{Extension as p}from"@magic-sdk/commons";function d(){return typeof navigator!="undefined"&&/android/i.test(navigator.userAgent)}function u(){return typeof navigator!="undefined"&&/iPhone|iPod/.test(navigator.userAgent)}function g(){return typeof navigator!="undefined"&&(/iPad/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)}function h(){return u()||g()}function t(){return d()||h()}function a(){return typeof window!="undefined"&&window===window.top}var f=!0;var w="https://relay.farcaster.xyz",i=class extends p.Internal{constructor(){super(...arguments);this.name="farcaster";this.config={};this.login=r=>{let s=()=>fetch(`${w}/v1/channel`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({domain:window.location.host,siweUri:window.location.origin})}).then(e=>{if(!e.ok)throw new Error("Error creating channel.");return e.json()}).then(e=>{if(!e)throw new Error("Channel not created yet.");return e});try{return s().then(n=>{var o;let c=this.utils.createJsonRpcRequestPayload("farcaster_show_QR",[{data:{showUI:(o=r==null?void 0:r.showUI)!=null?o:f,domain:window.location.origin,isMobile:t(),channel:n}}]),l=this.request(c);return t()&&a()&&(window.location.href=n.url),l}).catch(n=>{throw new Error(n)})}catch(e){throw new Error(e.message)}}}};export{i as FarcasterExtension,t as isMobile}; | ||
var u=(c,l,n)=>new Promise((d,o)=>{var a=e=>{try{t(n.next(e))}catch(r){o(r)}},i=e=>{try{t(n.throw(e))}catch(r){o(r)}},t=e=>e.done?d(e.value):Promise.resolve(e.value).then(a,i);t((n=n.apply(c,l)).next())});import{Extension as m}from"@magic-sdk/commons";function f(){return typeof navigator!="undefined"&&/android/i.test(navigator.userAgent)}function v(){return typeof navigator!="undefined"&&/iPhone|iPod/.test(navigator.userAgent)}function w(){return typeof navigator!="undefined"&&(/iPad/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)}function E(){return v()||w()}function s(){return f()||E()}function g(){return typeof window!="undefined"&&window===window.top}var C=!0;var b="https://relay.farcaster.xyz",p=class extends m.Internal{constructor(){super(...arguments);this.name="farcaster";this.config={};this.login=n=>this.utils.createPromiEvent((o,a)=>u(this,null,function*(){var i;try{let t=yield fetch(`${b}/v1/channel`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({domain:window.location.host,siweUri:window.location.origin})});if(!t.ok)throw new Error("Error creating channel.");let e=yield t.json();if(!e)throw new Error("Channel not created yet.");let r=this.utils.createJsonRpcRequestPayload("farcaster_show_QR",[{data:{showUI:(i=n==null?void 0:n.showUI)!=null?i:C,domain:window.location.origin,isMobile:s(),channel:e}}]),h=this.request(r);s()&&g()&&(window.location.href=e.url),o(h)}catch(t){a(t)}}))}};export{p as FarcasterExtension,s as isMobile}; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict";var MagicFarcasterExtension=(()=>{var E=Object.create;var i=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var m=Object.getPrototypeOf,b=Object.prototype.hasOwnProperty;var A=(e,n)=>()=>(n||e((n={exports:{}}).exports,n),n.exports),x=(e,n)=>{for(var t in n)i(e,t,{get:n[t],enumerable:!0})},d=(e,n,t,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of C(n))!b.call(e,r)&&r!==t&&i(e,r,{get:()=>n[r],enumerable:!(o=v(n,r))||o.enumerable});return e};var y=(e,n,t)=>(t=e!=null?E(m(e)):{},d(n||!e||!e.__esModule?i(t,"default",{value:e,enumerable:!0}):t,e)),R=e=>d(i({},"__esModule",{value:!0}),e);var g=A((H,u)=>{u.exports=Magic});var _={};x(_,{FarcasterExtension:()=>c,isMobile:()=>s});var p=y(g());function I(){return typeof navigator!="undefined"&&/android/i.test(navigator.userAgent)}function O(){return typeof navigator!="undefined"&&/iPhone|iPod/.test(navigator.userAgent)}function S(){return typeof navigator!="undefined"&&(/iPad/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)}function F(){return O()||S()}function s(){return I()||F()}function h(){return typeof window!="undefined"&&window===window.top}var L=!0;var P="https://relay.farcaster.xyz",c=class extends p.Extension.Internal{constructor(){super(...arguments);this.name="farcaster";this.config={};this.login=t=>{let o=()=>fetch(`${P}/v1/channel`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({domain:window.location.host,siweUri:window.location.origin})}).then(r=>{if(!r.ok)throw new Error("Error creating channel.");return r.json()}).then(r=>{if(!r)throw new Error("Channel not created yet.");return r});try{return o().then(a=>{var l;let f=this.utils.createJsonRpcRequestPayload("farcaster_show_QR",[{data:{showUI:(l=t==null?void 0:t.showUI)!=null?l:L,domain:window.location.origin,isMobile:s(),channel:a}}]),w=this.request(f);return s()&&h()&&(window.location.href=a.url),w}).catch(a=>{throw new Error(a)})}catch(r){throw new Error(r.message)}}}};return R(_);})(); | ||
"use strict";var MagicFarcasterExtension=(()=>{var C=Object.create;var l=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var A=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty;var R=(e,n)=>()=>(n||e((n={exports:{}}).exports,n),n.exports),F=(e,n)=>{for(var t in n)l(e,t,{get:n[t],enumerable:!0})},p=(e,n,t,a)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of y(n))!x.call(e,o)&&o!==t&&l(e,o,{get:()=>n[o],enumerable:!(a=b(n,o))||a.enumerable});return e};var I=(e,n,t)=>(t=e!=null?C(A(e)):{},p(n||!e||!e.__esModule?l(t,"default",{value:e,enumerable:!0}):t,e)),L=e=>p(l({},"__esModule",{value:!0}),e);var h=(e,n,t)=>new Promise((a,o)=>{var u=r=>{try{i(t.next(r))}catch(s){o(s)}},c=r=>{try{i(t.throw(r))}catch(s){o(s)}},i=r=>r.done?a(r.value):Promise.resolve(r.value).then(u,c);i((t=t.apply(e,n)).next())});var v=R((q,f)=>{f.exports=Magic});var M={};F(M,{FarcasterExtension:()=>g,isMobile:()=>d});var E=I(v());function O(){return typeof navigator!="undefined"&&/android/i.test(navigator.userAgent)}function P(){return typeof navigator!="undefined"&&/iPhone|iPod/.test(navigator.userAgent)}function S(){return typeof navigator!="undefined"&&(/iPad/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)}function _(){return P()||S()}function d(){return O()||_()}function w(){return typeof window!="undefined"&&window===window.top}var U=!0;var H="https://relay.farcaster.xyz",g=class extends E.Extension.Internal{constructor(){super(...arguments);this.name="farcaster";this.config={};this.login=t=>this.utils.createPromiEvent((o,u)=>h(this,null,function*(){var c;try{let i=yield fetch(`${H}/v1/channel`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({domain:window.location.host,siweUri:window.location.origin})});if(!i.ok)throw new Error("Error creating channel.");let r=yield i.json();if(!r)throw new Error("Channel not created yet.");let s=this.utils.createJsonRpcRequestPayload("farcaster_show_QR",[{data:{showUI:(c=t==null?void 0:t.showUI)!=null?c:U,domain:window.location.origin,isMobile:d(),channel:r}}]),m=this.request(s);d()&&w()&&(window.location.href=r.url),o(m)}catch(i){u(i)}}))}};return L(M);})(); | ||
if (MagicFarcasterExtension && MagicFarcasterExtension.default != null) { MagicFarcasterExtension = Object.assign(MagicFarcasterExtension.default, MagicFarcasterExtension); delete MagicFarcasterExtension.default; } |
@@ -6,7 +6,57 @@ import { Extension } from '@magic-sdk/commons'; | ||
}; | ||
declare const FarcasterLoginEventOnReceived: { | ||
readonly OpenChannel: "channel"; | ||
readonly Success: "success"; | ||
readonly Failed: "failed"; | ||
}; | ||
interface CreateChannelAPIResponse { | ||
channelToken: string; | ||
url: string; | ||
nonce: string; | ||
} | ||
type Hex = `0x${string}`; | ||
interface StatusAPIResponse { | ||
state: 'pending' | 'completed'; | ||
nonce: string; | ||
url: string; | ||
message?: string; | ||
signature?: `0x${string}`; | ||
fid?: number; | ||
username?: string; | ||
bio?: string; | ||
displayName?: string; | ||
pfpUrl?: string; | ||
verifications?: Hex[]; | ||
custody?: Hex; | ||
} | ||
type AuthClientErrorCode = 'unauthenticated' | 'unauthorized' | 'bad_request' | 'bad_request.validation_failure' | 'not_found' | 'not_implemented' | 'unavailable' | 'unknown'; | ||
interface AuthClientErrorOpts { | ||
message: string; | ||
cause: Error | AuthClientError; | ||
presentable: boolean; | ||
} | ||
declare class AuthClientError extends Error { | ||
readonly errCode: AuthClientErrorCode; | ||
readonly presentable: boolean; | ||
/** | ||
* @param errCode - the AuthClientError code for this message | ||
* @param context - a message, another Error, or a AuthClientErrorOpts | ||
*/ | ||
constructor(errCode: AuthClientErrorCode, context: Partial<AuthClientErrorOpts> | string | Error); | ||
} | ||
type FarcasterLoginEventHandlers = { | ||
[FarcasterLoginEventOnReceived.OpenChannel]: (channel: CreateChannelAPIResponse) => void; | ||
[FarcasterLoginEventOnReceived.Success]: (data: StatusAPIResponse) => void; | ||
[FarcasterLoginEventOnReceived.Failed]: (error: AuthClientError) => void; | ||
}; | ||
export declare class FarcasterExtension extends Extension.Internal<'farcaster'> { | ||
name: "farcaster"; | ||
config: {}; | ||
login: (params?: LoginParams) => Promise<string>; | ||
login: (params?: LoginParams) => import("@magic-sdk/commons").PromiEvent<string, FarcasterLoginEventHandlers & { | ||
done: (result: string) => void; | ||
error: (reason: any) => void; | ||
settled: () => void; | ||
"closed-by-user": () => void; | ||
}>; | ||
} | ||
export { isMobile }; |
{ | ||
"name": "@magic-ext/farcaster", | ||
"version": "0.18.1-canary.841.12040077262.0", | ||
"version": "0.18.1-canary.841.12054994372.0", | ||
"description": "magic farcaster extension", | ||
@@ -31,5 +31,5 @@ "author": "Magic <team@magic.link> (https://magic.link/)", | ||
"devDependencies": { | ||
"@magic-sdk/commons": "24.18.1-canary.841.12040077262.0" | ||
"@magic-sdk/commons": "24.18.1-canary.841.12054994372.0" | ||
}, | ||
"gitHead": "51cdf8fe38482d1608ce7956d33353fa9724389a" | ||
"gitHead": "17d2e322d3c1f1001bedc8c30a2394139b0eb964" | ||
} |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
41250
113