@magic-ext/farcaster
Advanced tools
Comparing version 0.18.1-canary.841.12039449504.0 to 0.18.1-canary.841.12039649060.0
@@ -1,2 +0,2 @@ | ||
"use strict";var u=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var b=(r,n)=>{for(var e in n)u(r,e,{get:n[e],enumerable:!0})},y=(r,n,e,a)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of m(n))!C.call(r,o)&&o!==e&&u(r,o,{get:()=>n[o],enumerable:!(a=E(n,o))||a.enumerable});return r};var A=r=>y(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 F={};b(F,{FarcasterExtension:()=>g,isMobile:()=>l});module.exports=A(F);var f=require("@magic-sdk/commons");function x(){return typeof navigator!="undefined"&&/android/i.test(navigator.userAgent)}function R(){return typeof navigator!="undefined"&&/iPhone|iPod/.test(navigator.userAgent)}function I(){return typeof navigator!="undefined"&&(/iPad/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)}function O(){return R()||I()}function l(){return x()||O()}function h(){return typeof window!="undefined"&&window===window.top}var P=!0;var S="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(`${S}/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:P,domain:window.location.origin,isMobile:l(),channel:t}}]),w=this.request(s);l()&&h()&&(window.location.href=t.url);let v=yield w;o(v)}catch(i){d(i)}}))}}; | ||
"use strict";var u=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var b=(r,n)=>{for(var e in n)u(r,e,{get:n[e],enumerable:!0})},y=(r,n,e,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of m(n))!C.call(r,o)&&o!==e&&u(r,o,{get:()=>n[o],enumerable:!(i=E(n,o))||i.enumerable});return r};var A=r=>y(u({},"__esModule",{value:!0}),r);var p=(r,n,e)=>new Promise((i,o)=>{var d=t=>{try{a(e.next(t))}catch(s){o(s)}},c=t=>{try{a(e.throw(t))}catch(s){o(s)}},a=t=>t.done?i(t.value):Promise.resolve(t.value).then(d,c);a((e=e.apply(r,n)).next())});var P={};b(P,{FarcasterExtension:()=>g,isMobile:()=>l});module.exports=A(P);var f=require("@magic-sdk/commons");function x(){return typeof navigator!="undefined"&&/android/i.test(navigator.userAgent)}function R(){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 I(){return R()||F()}function l(){return x()||I()}function h(){return typeof window!="undefined"&&window===window.top}var L=!0;var O="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 a=yield fetch(`${O}/v1/channel`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({domain:window.location.host,siweUri:window.location.origin})});if(!a.ok)throw new Error("Error creating channel.");let t=yield a.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:L,domain:window.location.origin,isMobile:l(),channel:t}}]),v=this.request(s);l()&&h()&&(window.location.href=t.url);let w=yield v;o(w)}catch(a){d(a)}}))}}; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict";var u=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var b=(r,n)=>{for(var e in n)u(r,e,{get:n[e],enumerable:!0})},y=(r,n,e,a)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of m(n))!C.call(r,o)&&o!==e&&u(r,o,{get:()=>n[o],enumerable:!(a=E(n,o))||a.enumerable});return r};var A=r=>y(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 F={};b(F,{FarcasterExtension:()=>g,isMobile:()=>l});module.exports=A(F);var f=require("@magic-sdk/commons");function x(){return typeof navigator!="undefined"&&/android/i.test(navigator.userAgent)}function R(){return typeof navigator!="undefined"&&/iPhone|iPod/.test(navigator.userAgent)}function I(){return typeof navigator!="undefined"&&(/iPad/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)}function O(){return R()||I()}function l(){return x()||O()}function h(){return typeof window!="undefined"&&window===window.top}var P=!0;var S="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(`${S}/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:P,domain:window.location.origin,isMobile:l(),channel:t}}]),w=this.request(s);l()&&h()&&(window.location.href=t.url);let v=yield w;o(v)}catch(i){d(i)}}))}}; | ||
"use strict";var u=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var b=(r,n)=>{for(var e in n)u(r,e,{get:n[e],enumerable:!0})},y=(r,n,e,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of m(n))!C.call(r,o)&&o!==e&&u(r,o,{get:()=>n[o],enumerable:!(i=E(n,o))||i.enumerable});return r};var A=r=>y(u({},"__esModule",{value:!0}),r);var p=(r,n,e)=>new Promise((i,o)=>{var d=t=>{try{a(e.next(t))}catch(s){o(s)}},c=t=>{try{a(e.throw(t))}catch(s){o(s)}},a=t=>t.done?i(t.value):Promise.resolve(t.value).then(d,c);a((e=e.apply(r,n)).next())});var P={};b(P,{FarcasterExtension:()=>g,isMobile:()=>l});module.exports=A(P);var f=require("@magic-sdk/commons");function x(){return typeof navigator!="undefined"&&/android/i.test(navigator.userAgent)}function R(){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 I(){return R()||F()}function l(){return x()||I()}function h(){return typeof window!="undefined"&&window===window.top}var L=!0;var O="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 a=yield fetch(`${O}/v1/channel`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({domain:window.location.host,siweUri:window.location.origin})});if(!a.ok)throw new Error("Error creating channel.");let t=yield a.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:L,domain:window.location.origin,isMobile:l(),channel:t}}]),v=this.request(s);l()&&h()&&(window.location.href=t.url);let w=yield v;o(w)}catch(a){d(a)}}))}}; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
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 C}from"@magic-sdk/commons";function w(){return typeof navigator!="undefined"&&/android/i.test(navigator.userAgent)}function v(){return typeof navigator!="undefined"&&/iPhone|iPod/.test(navigator.userAgent)}function E(){return typeof navigator!="undefined"&&(/iPad/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)}function m(){return v()||E()}function s(){return w()||m()}function g(){return typeof window!="undefined"&&window===window.top}var b=!0;var y="https://relay.farcaster.xyz",p=class extends C.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(`${y}/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:b,domain:window.location.origin,isMobile:s(),channel:e}}]),h=this.request(r);s()&&g()&&(window.location.href=e.url);let f=yield h;o(f)}catch(t){a(t)}}))}};export{p as FarcasterExtension,s as isMobile}; | ||
var u=(c,l,n)=>new Promise((d,o)=>{var i=e=>{try{t(n.next(e))}catch(r){o(r)}},a=e=>{try{t(n.throw(e))}catch(r){o(r)}},t=e=>e.done?d(e.value):Promise.resolve(e.value).then(i,a);t((n=n.apply(c,l)).next())});import{Extension as C}from"@magic-sdk/commons";function v(){return typeof navigator!="undefined"&&/android/i.test(navigator.userAgent)}function w(){return typeof navigator!="undefined"&&/iPhone|iPod/.test(navigator.userAgent)}function E(){return typeof navigator!="undefined"&&(/iPad/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)}function m(){return w()||E()}function s(){return v()||m()}function g(){return typeof window!="undefined"&&window===window.top}var b=!0;var y="https://relay.farcaster.xyz",p=class extends C.Internal{constructor(){super(...arguments);this.name="farcaster";this.config={};this.login=n=>this.utils.createPromiEvent((o,i)=>u(this,null,function*(){var a;try{let t=yield fetch(`${y}/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:(a=n==null?void 0:n.showUI)!=null?a:b,domain:window.location.origin,isMobile:s(),channel:e}}]),h=this.request(r);s()&&g()&&(window.location.href=e.url);let f=yield h;o(f)}catch(t){i(t)}}))}};export{p as FarcasterExtension,s as isMobile}; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict";var MagicFarcasterExtension=(()=>{var b=Object.create;var l=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var x=Object.getPrototypeOf,R=Object.prototype.hasOwnProperty;var I=(e,n)=>()=>(n||e((n={exports:{}}).exports,n),n.exports),O=(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 A(n))!R.call(e,o)&&o!==t&&l(e,o,{get:()=>n[o],enumerable:!(a=y(n,o))||a.enumerable});return e};var P=(e,n,t)=>(t=e!=null?b(x(e)):{},p(n||!e||!e.__esModule?l(t,"default",{value:e,enumerable:!0}):t,e)),S=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 w=I((k,f)=>{f.exports=Magic});var T={};O(T,{FarcasterExtension:()=>g,isMobile:()=>d});var E=P(w());function F(){return typeof navigator!="undefined"&&/android/i.test(navigator.userAgent)}function L(){return typeof navigator!="undefined"&&/iPhone|iPod/.test(navigator.userAgent)}function _(){return typeof navigator!="undefined"&&(/iPad/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)}function U(){return L()||_()}function d(){return F()||U()}function v(){return typeof window!="undefined"&&window===window.top}var H=!0;var M="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(`${M}/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:H,domain:window.location.origin,isMobile:d(),channel:r}}]),m=this.request(s);d()&&v()&&(window.location.href=r.url);let C=yield m;o(C)}catch(i){u(i)}}))}};return S(T);})(); | ||
"use strict";var MagicFarcasterExtension=(()=>{var b=Object.create;var l=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var x=Object.getPrototypeOf,R=Object.prototype.hasOwnProperty;var F=(e,n)=>()=>(n||e((n={exports:{}}).exports,n),n.exports),I=(e,n)=>{for(var t in n)l(e,t,{get:n[t],enumerable:!0})},p=(e,n,t,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of A(n))!R.call(e,o)&&o!==t&&l(e,o,{get:()=>n[o],enumerable:!(i=y(n,o))||i.enumerable});return e};var L=(e,n,t)=>(t=e!=null?b(x(e)):{},p(n||!e||!e.__esModule?l(t,"default",{value:e,enumerable:!0}):t,e)),O=e=>p(l({},"__esModule",{value:!0}),e);var h=(e,n,t)=>new Promise((i,o)=>{var u=r=>{try{a(t.next(r))}catch(s){o(s)}},c=r=>{try{a(t.throw(r))}catch(s){o(s)}},a=r=>r.done?i(r.value):Promise.resolve(r.value).then(u,c);a((t=t.apply(e,n)).next())});var v=F((k,f)=>{f.exports=Magic});var T={};I(T,{FarcasterExtension:()=>g,isMobile:()=>d});var E=L(v());function P(){return typeof navigator!="undefined"&&/android/i.test(navigator.userAgent)}function S(){return typeof navigator!="undefined"&&/iPhone|iPod/.test(navigator.userAgent)}function _(){return typeof navigator!="undefined"&&(/iPad/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)}function U(){return S()||_()}function d(){return P()||U()}function w(){return typeof window!="undefined"&&window===window.top}var H=!0;var M="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 a=yield fetch(`${M}/v1/channel`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({domain:window.location.host,siweUri:window.location.origin})});if(!a.ok)throw new Error("Error creating channel.");let r=yield a.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:H,domain:window.location.origin,isMobile:d(),channel:r}}]),m=this.request(s);d()&&w()&&(window.location.href=r.url);let C=yield m;o(C)}catch(a){u(a)}}))}};return O(T);})(); | ||
if (MagicFarcasterExtension && MagicFarcasterExtension.default != null) { MagicFarcasterExtension = Object.assign(MagicFarcasterExtension.default, MagicFarcasterExtension); delete MagicFarcasterExtension.default; } |
@@ -6,6 +6,51 @@ 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) => import("@magic-sdk/commons").PromiEvent<string, { | ||
login: (params?: LoginParams) => import("@magic-sdk/commons").PromiEvent<string, FarcasterLoginEventHandlers & { | ||
done: (result: string) => void; | ||
@@ -12,0 +57,0 @@ error: (reason: any) => void; |
{ | ||
"name": "@magic-ext/farcaster", | ||
"version": "0.18.1-canary.841.12039449504.0", | ||
"version": "0.18.1-canary.841.12039649060.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.12039449504.0" | ||
"@magic-sdk/commons": "24.18.1-canary.841.12039649060.0" | ||
}, | ||
"gitHead": "758d273fcfa672d0a6590e4f4a351ad9e31350a2" | ||
"gitHead": "2e3397a91aa9bf073626e537d0d4974f4ea8049b" | ||
} |
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
41503
113