@magic-ext/farcaster
Advanced tools
Comparing version 0.18.1-canary.841.12040077262.0 to 0.18.1-canary.842.12051126778.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 d=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var w=Object.prototype.hasOwnProperty;var m=(t,n)=>{for(var e in n)d(t,e,{get:n[e],enumerable:!0})},A=(t,n,e,a)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of v(n))!w.call(t,r)&&r!==e&&d(t,r,{get:()=>n[r],enumerable:!(a=C(n,r))||a.enumerable});return t};var b=t=>A(d({},"__esModule",{value:!0}),t);var h=(t,n,e)=>new Promise((a,r)=>{var i=o=>{try{l(e.next(o))}catch(c){r(c)}},f=o=>{try{l(e.throw(o))}catch(c){r(c)}},l=o=>o.done?a(o.value):Promise.resolve(o.value).then(i,f);l((e=e.apply(t,n)).next())});var P={};m(P,{FarcasterExtension:()=>u,isMobile:()=>s});module.exports=b(P);var p=require("@magic-sdk/commons");function E(){return typeof navigator!="undefined"&&/android/i.test(navigator.userAgent)}function y(){return typeof navigator!="undefined"&&/iPhone|iPod/.test(navigator.userAgent)}function x(){return typeof navigator!="undefined"&&(/iPad/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)}function R(){return y()||x()}function s(){return E()||R()}function g(){return typeof window!="undefined"&&window===window.top}var I=!0;var O="https://relay.farcaster.xyz",u=class extends p.Extension.Internal{constructor(){super();this.name="farcaster";this.config={};this.channel=null;this.login=e=>{var i;if(!this.channel)throw new Error("Channel not created yet.");let a=this.utils.createJsonRpcRequestPayload("farcaster_show_QR",[{data:{showUI:(i=e==null?void 0:e.showUI)!=null?i:I,domain:window.location.origin,isMobile:s(),channel:this.channel}}]),r=this.request(a);return s()&&g()&&(window.location.href=this.channel.url),r};h(this,null,function*(){this.channel=yield fetch(`${O}/v1/channel`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({domain:window.location.host,siweUri:window.location.origin})}).then(e=>e.json())})}}; | ||
//# 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 d=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var w=Object.prototype.hasOwnProperty;var m=(t,n)=>{for(var e in n)d(t,e,{get:n[e],enumerable:!0})},A=(t,n,e,a)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of v(n))!w.call(t,r)&&r!==e&&d(t,r,{get:()=>n[r],enumerable:!(a=C(n,r))||a.enumerable});return t};var b=t=>A(d({},"__esModule",{value:!0}),t);var h=(t,n,e)=>new Promise((a,r)=>{var i=o=>{try{l(e.next(o))}catch(c){r(c)}},f=o=>{try{l(e.throw(o))}catch(c){r(c)}},l=o=>o.done?a(o.value):Promise.resolve(o.value).then(i,f);l((e=e.apply(t,n)).next())});var P={};m(P,{FarcasterExtension:()=>u,isMobile:()=>s});module.exports=b(P);var p=require("@magic-sdk/commons");function E(){return typeof navigator!="undefined"&&/android/i.test(navigator.userAgent)}function y(){return typeof navigator!="undefined"&&/iPhone|iPod/.test(navigator.userAgent)}function x(){return typeof navigator!="undefined"&&(/iPad/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)}function R(){return y()||x()}function s(){return E()||R()}function g(){return typeof window!="undefined"&&window===window.top}var I=!0;var O="https://relay.farcaster.xyz",u=class extends p.Extension.Internal{constructor(){super();this.name="farcaster";this.config={};this.channel=null;this.login=e=>{var i;if(!this.channel)throw new Error("Channel not created yet.");let a=this.utils.createJsonRpcRequestPayload("farcaster_show_QR",[{data:{showUI:(i=e==null?void 0:e.showUI)!=null?i:I,domain:window.location.origin,isMobile:s(),channel:this.channel}}]),r=this.request(a);return s()&&g()&&(window.location.href=this.channel.url),r};h(this,null,function*(){this.channel=yield fetch(`${O}/v1/channel`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({domain:window.location.host,siweUri:window.location.origin})}).then(e=>e.json())})}}; | ||
//# 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 d=(l,c,e)=>new Promise((o,t)=>{var r=n=>{try{a(e.next(n))}catch(i){t(i)}},g=n=>{try{a(e.throw(n))}catch(i){t(i)}},a=n=>n.done?o(n.value):Promise.resolve(n.value).then(r,g);a((e=e.apply(l,c)).next())});import{Extension as w}from"@magic-sdk/commons";function p(){return typeof navigator!="undefined"&&/android/i.test(navigator.userAgent)}function f(){return typeof navigator!="undefined"&&/iPhone|iPod/.test(navigator.userAgent)}function C(){return typeof navigator!="undefined"&&(/iPad/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)}function v(){return f()||C()}function s(){return p()||v()}function u(){return typeof window!="undefined"&&window===window.top}var m=!0;var A="https://relay.farcaster.xyz",h=class extends w.Internal{constructor(){super();this.name="farcaster";this.config={};this.channel=null;this.login=e=>{var r;if(!this.channel)throw new Error("Channel not created yet.");let o=this.utils.createJsonRpcRequestPayload("farcaster_show_QR",[{data:{showUI:(r=e==null?void 0:e.showUI)!=null?r:m,domain:window.location.origin,isMobile:s(),channel:this.channel}}]),t=this.request(o);return s()&&u()&&(window.location.href=this.channel.url),t};d(this,null,function*(){this.channel=yield fetch(`${A}/v1/channel`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({domain:window.location.host,siweUri:window.location.origin})}).then(e=>e.json())})}};export{h 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 m=Object.create;var s=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var E=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty;var y=(e,n)=>()=>(n||e((n={exports:{}}).exports,n),n.exports),R=(e,n)=>{for(var t in n)s(e,t,{get:n[t],enumerable:!0})},h=(e,n,t,a)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of b(n))!x.call(e,r)&&r!==t&&s(e,r,{get:()=>n[r],enumerable:!(a=A(n,r))||a.enumerable});return e};var I=(e,n,t)=>(t=e!=null?m(E(e)):{},h(n||!e||!e.__esModule?s(t,"default",{value:e,enumerable:!0}):t,e)),O=e=>h(s({},"__esModule",{value:!0}),e);var g=(e,n,t)=>new Promise((a,r)=>{var i=o=>{try{c(t.next(o))}catch(d){r(d)}},w=o=>{try{c(t.throw(o))}catch(d){r(d)}},c=o=>o.done?a(o.value):Promise.resolve(o.value).then(i,w);c((t=t.apply(e,n)).next())});var f=y((T,p)=>{p.exports=Magic});var H={};R(H,{FarcasterExtension:()=>u,isMobile:()=>l});var v=I(f());function P(){return typeof navigator!="undefined"&&/android/i.test(navigator.userAgent)}function S(){return typeof navigator!="undefined"&&/iPhone|iPod/.test(navigator.userAgent)}function F(){return typeof navigator!="undefined"&&(/iPad/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)}function L(){return S()||F()}function l(){return P()||L()}function C(){return typeof window!="undefined"&&window===window.top}var _=!0;var U="https://relay.farcaster.xyz",u=class extends v.Extension.Internal{constructor(){super();this.name="farcaster";this.config={};this.channel=null;this.login=t=>{var i;if(!this.channel)throw new Error("Channel not created yet.");let a=this.utils.createJsonRpcRequestPayload("farcaster_show_QR",[{data:{showUI:(i=t==null?void 0:t.showUI)!=null?i:_,domain:window.location.origin,isMobile:l(),channel:this.channel}}]),r=this.request(a);return l()&&C()&&(window.location.href=this.channel.url),r};g(this,null,function*(){this.channel=yield fetch(`${U}/v1/channel`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({domain:window.location.host,siweUri:window.location.origin})}).then(t=>t.json())})}};return O(H);})(); | ||
if (MagicFarcasterExtension && MagicFarcasterExtension.default != null) { MagicFarcasterExtension = Object.assign(MagicFarcasterExtension.default, MagicFarcasterExtension); delete MagicFarcasterExtension.default; } |
@@ -6,7 +6,59 @@ 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>; | ||
channel: CreateChannelAPIResponse | null; | ||
constructor(); | ||
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.842.12051126778.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.842.12051126778.0" | ||
}, | ||
"gitHead": "51cdf8fe38482d1608ce7956d33353fa9724389a" | ||
"gitHead": "a9538e190a31510f0369a7813930f7da1822eca5" | ||
} |
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
39726
115