@magic-sdk/provider 29.4.3-canary.934.17055415696.0 → 29.4.3-canary.934.17056135207.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/package.json +2 -2
  2. package/dist/cjs/index.js +0 -6
  3. package/dist/cjs/index.js.map +0 -7
  4. package/dist/es/index.js +0 -6
  5. package/dist/es/index.js.map +0 -7
  6. package/dist/es/index.mjs +0 -6
  7. package/dist/es/index.mjs.map +0 -7
  8. package/dist/types/core/json-rpc.d.ts +0 -32
  9. package/dist/types/core/sdk-environment.d.ts +0 -29
  10. package/dist/types/core/sdk-exceptions.d.ts +0 -87
  11. package/dist/types/core/sdk.d.ts +0 -75
  12. package/dist/types/core/view-controller.d.ts +0 -61
  13. package/dist/types/index.d.ts +0 -8
  14. package/dist/types/modules/auth.d.ts +0 -129
  15. package/dist/types/modules/base-extension.d.ts +0 -113
  16. package/dist/types/modules/base-module.d.ts +0 -27
  17. package/dist/types/modules/nft.d.ts +0 -22
  18. package/dist/types/modules/rpc-provider.d.ts +0 -50
  19. package/dist/types/modules/third-party-wallets.d.ts +0 -26
  20. package/dist/types/modules/user.d.ts +0 -93
  21. package/dist/types/modules/wallet.d.ts +0 -66
  22. package/dist/types/util/base64-json.d.ts +0 -8
  23. package/dist/types/util/device-share-web-crypto.d.ts +0 -7
  24. package/dist/types/util/events.d.ts +0 -23
  25. package/dist/types/util/get-payload-id.d.ts +0 -4
  26. package/dist/types/util/index.d.ts +0 -10
  27. package/dist/types/util/promise-tools.d.ts +0 -48
  28. package/dist/types/util/semver.d.ts +0 -23
  29. package/dist/types/util/storage.d.ts +0 -8
  30. package/dist/types/util/type-guards.d.ts +0 -30
  31. package/dist/types/util/url.d.ts +0 -4
  32. package/dist/types/util/uuid.d.ts +0 -1
  33. package/dist/types/util/version-check.d.ts +0 -1
  34. package/dist/types/util/view-controller-utils.d.ts +0 -26
  35. package/dist/types/util/web-crypto.d.ts +0 -5
@@ -1,93 +0,0 @@
1
- import { GetIdTokenConfiguration, MagicUserMetadata, GenerateIdTokenConfiguration, UserInfo, RequestUserInfoScope, RecoverAccountConfiguration, ShowSettingsConfiguration, EnableMFAConfiguration, EnableMFAEventHandlers, DisableMFAConfiguration, DisableMFAEventHandlers, RecoverAccountEventHandlers } from '@magic-sdk/types';
2
- import { BaseModule } from './base-module';
3
- type UserLoggedOutCallback = (loggedOut: boolean) => void;
4
- export declare class UserModule extends BaseModule {
5
- getIdToken(configuration?: GetIdTokenConfiguration): import("../util").PromiEvent<string, {
6
- done: (result: string) => void;
7
- error: (reason: any) => void;
8
- settled: () => void;
9
- "closed-by-user": () => void;
10
- }>;
11
- generateIdToken(configuration?: GenerateIdTokenConfiguration): import("../util").PromiEvent<string, {
12
- done: (result: string) => void;
13
- error: (reason: any) => void;
14
- settled: () => void;
15
- "closed-by-user": () => void;
16
- }>;
17
- getInfo(): import("../util").PromiEvent<MagicUserMetadata, {
18
- done: (result: MagicUserMetadata) => void;
19
- error: (reason: any) => void;
20
- settled: () => void;
21
- "closed-by-user": () => void;
22
- }>;
23
- isLoggedIn(): import("../util").PromiEvent<boolean, any>;
24
- logout(): import("../util").PromiEvent<boolean, any>;
25
- requestInfoWithUI(scope?: RequestUserInfoScope): import("../util").PromiEvent<UserInfo, {
26
- done: (result: UserInfo) => void;
27
- error: (reason: any) => void;
28
- settled: () => void;
29
- "closed-by-user": () => void;
30
- }>;
31
- showSettings(configuration?: ShowSettingsConfiguration): import("../util").PromiEvent<string | null, {
32
- "send-new-phone-number": (phone_number: string) => void;
33
- "send-otp-code": (otp: string) => void;
34
- "start-edit-phone-number": () => void;
35
- cancel: () => void;
36
- "enter-new-phone-number": () => void;
37
- "enter-otp-code": () => void;
38
- "recovery-factor-already-exists": () => void;
39
- "malformed-phone-number": () => void;
40
- "invalid-otp-code": () => void;
41
- "recovery-factor-updated": (updatedFactor: {
42
- type: string;
43
- value: string;
44
- }) => void;
45
- "recovery-factor-deleted": () => void;
46
- } & import("@magic-sdk/types").RecencyCheckEventHandlers & {
47
- done: (result: string | null) => void;
48
- error: (reason: any) => void;
49
- settled: () => void;
50
- "closed-by-user": () => void;
51
- }>;
52
- recoverAccount(configuration: RecoverAccountConfiguration): import("../util").PromiEvent<string | boolean | null, RecoverAccountEventHandlers & {
53
- "UpdateEmail/new-email-needs-verification": () => void;
54
- "UpdateEmail/email-updated": () => void;
55
- "UpdateEmail/new-email-invalid-email-otp": () => void;
56
- "UpdateEmail/new-email-verification-email-not-deliverable": () => void;
57
- "UpdateEmail/new-email-verification-email-expired": () => void;
58
- "UpdateEmail/new-email-verification-email-sent": () => void;
59
- "UpdateEmail/new-email-invalid": () => void;
60
- "UpdateEmail/new-email-already-exists": () => void;
61
- "UpdateEmail/new-email-verification-cancel": () => void;
62
- "UpdateEmail/retry-with-new-email": (email?: string) => void;
63
- "UpdateEmail/new-email-verify-otp": (otp: string) => void;
64
- } & import("@magic-sdk/types").RecencyCheckEventHandlers & {
65
- done: (result: string | boolean | null) => void;
66
- error: (reason: any) => void;
67
- settled: () => void;
68
- "closed-by-user": () => void;
69
- }>;
70
- revealPrivateKey(): import("../util").PromiEvent<boolean, {
71
- done: (result: boolean) => void;
72
- error: (reason: any) => void;
73
- settled: () => void;
74
- "closed-by-user": () => void;
75
- }>;
76
- onUserLoggedOut(callback: UserLoggedOutCallback): void;
77
- enableMFA(configuration: EnableMFAConfiguration): import("../util").PromiEvent<string | boolean | null, EnableMFAEventHandlers & {
78
- done: (result: string | boolean | null) => void;
79
- error: (reason: any) => void;
80
- settled: () => void;
81
- "closed-by-user": () => void;
82
- }>;
83
- disableMFA(configuration: DisableMFAConfiguration): import("../util").PromiEvent<string | boolean | null, DisableMFAEventHandlers & {
84
- done: (result: string | boolean | null) => void;
85
- error: (reason: any) => void;
86
- settled: () => void;
87
- "closed-by-user": () => void;
88
- }>;
89
- private emitUserLoggedOut;
90
- private localForageIsLoggedInKey;
91
- private userLoggedOutCallbacks;
92
- }
93
- export {};
@@ -1,66 +0,0 @@
1
- import { GasApiResponse, GaslessTransactionRequest, ConnectWithUIOptions, ShowUIPromiEvents } from '@magic-sdk/types';
2
- import { BaseModule } from './base-module';
3
- type ShowUiConfig = {
4
- onramperParams?: {
5
- [key: string]: string;
6
- };
7
- };
8
- export declare class WalletModule extends BaseModule {
9
- connectWithUI(options?: ConnectWithUIOptions): import("../util").PromiEvent<string[], {
10
- 'id-token-created': (params: {
11
- idToken: string;
12
- }) => void;
13
- } & {
14
- wallet_connected: () => void;
15
- wallet_rejected: () => void;
16
- web3modal_selected: () => void;
17
- } & {
18
- done: (result: string[]) => void;
19
- error: (reason: any) => void;
20
- settled: () => void;
21
- "closed-by-user": () => void;
22
- }>;
23
- showUI(config?: ShowUiConfig): import("../util").PromiEvent<boolean, ShowUIPromiEvents & {
24
- done: (result: boolean) => void;
25
- error: (reason: any) => void;
26
- settled: () => void;
27
- "closed-by-user": () => void;
28
- }>;
29
- showAddress(): import("../util").PromiEvent<boolean, {
30
- done: (result: boolean) => void;
31
- error: (reason: any) => void;
32
- settled: () => void;
33
- "closed-by-user": () => void;
34
- }>;
35
- showSendTokensUI(): import("../util").PromiEvent<boolean, {
36
- done: (result: boolean) => void;
37
- error: (reason: any) => void;
38
- settled: () => void;
39
- "closed-by-user": () => void;
40
- }>;
41
- showOnRamp(): import("../util").PromiEvent<boolean, {
42
- done: (result: boolean) => void;
43
- error: (reason: any) => void;
44
- settled: () => void;
45
- "closed-by-user": () => void;
46
- }>;
47
- showNFTs(): import("../util").PromiEvent<boolean, {
48
- done: (result: boolean) => void;
49
- error: (reason: any) => void;
50
- settled: () => void;
51
- "closed-by-user": () => void;
52
- }>;
53
- showBalances(): import("../util").PromiEvent<boolean, {
54
- done: (result: boolean) => void;
55
- error: (reason: any) => void;
56
- settled: () => void;
57
- "closed-by-user": () => void;
58
- }>;
59
- sendGaslessTransaction(address: string, transaction: GaslessTransactionRequest): import("../util").PromiEvent<GasApiResponse, {
60
- done: (result: GasApiResponse) => void;
61
- error: (reason: any) => void;
62
- settled: () => void;
63
- "closed-by-user": () => void;
64
- }>;
65
- }
66
- export {};
@@ -1,8 +0,0 @@
1
- /**
2
- * Given a JSON-serializable object, encode as a Base64 string.
3
- */
4
- export declare function encodeJSON<T>(options: T): string;
5
- /**
6
- * Given a Base64 JSON string, decode a JavaScript object.
7
- */
8
- export declare function decodeJSON<T>(queryString: string): T;
@@ -1,7 +0,0 @@
1
- export declare const DEVICE_SHARE_KEY = "ds";
2
- export declare const ENCRYPTION_KEY_KEY = "ek";
3
- export declare const INITIALIZATION_VECTOR_KEY = "iv";
4
- export declare function clearDeviceShares(): Promise<void>;
5
- export declare function base64ToArrayBuffer(base64: string): ArrayBuffer;
6
- export declare function encryptAndPersistDeviceShare(deviceShareBase64: string, networkHash: string): Promise<void>;
7
- export declare function getDecryptedDeviceShare(networkHash: string): Promise<string | undefined>;
@@ -1,23 +0,0 @@
1
- import EventEmitter from 'eventemitter3';
2
- export type EventsDefinition = {
3
- [K in string | symbol]: (...args: any[]) => void;
4
- } | void;
5
- /**
6
- * An extension of `EventEmitter` (provided by `eventemitter3`) with an adjusted
7
- * type interface that supports the unique structure of Magic SDK modules.
8
- */
9
- export declare class TypedEmitter<Events extends EventsDefinition = void> extends EventEmitter<Events extends void ? string | symbol : Events> {
10
- }
11
- type ChainingMethods = 'on' | 'once' | 'addListener' | 'off' | 'removeListener' | 'removeAllListeners';
12
- type NonChainingMethods = 'emit' | 'eventNames' | 'listeners' | 'listenerCount';
13
- type ReplaceReturnType<T extends (...a: any) => any, TNewReturn> = (...a: Parameters<T>) => TNewReturn;
14
- /**
15
- * Creates a `TypedEmitter` instance and returns helper functions for easily
16
- * mixing `TypedEmitter` methods into other objects.
17
- */
18
- export declare function createTypedEmitter<Events extends EventsDefinition = void>(): {
19
- emitter: TypedEmitter<Events>;
20
- createChainingEmitterMethod: <T1 extends ChainingMethods, T2>(method: T1, source: T2) => ReplaceReturnType<TypedEmitter[T1], T2>;
21
- createBoundEmitterMethod: <T extends NonChainingMethods>(method: T) => TypedEmitter[T];
22
- };
23
- export {};
@@ -1,4 +0,0 @@
1
- /**
2
- * Get an integer ID for attaching to a JSON RPC request payload.
3
- */
4
- export declare function getPayloadId(): number;
@@ -1,10 +0,0 @@
1
- export * from './base64-json';
2
- export * from './events';
3
- export * from './get-payload-id';
4
- export * from './promise-tools';
5
- export * as storage from './storage';
6
- export * from './type-guards';
7
- export * from './url';
8
- export * from './uuid';
9
- export * from './web-crypto';
10
- export * from './version-check';
@@ -1,48 +0,0 @@
1
- import { UserEventsEmit } from '@magic-sdk/types';
2
- import { TypedEmitter, EventsDefinition } from './events';
3
- /**
4
- * Extends `Promise` with a polymorphic `this` type to accommodate arbitrary
5
- * `Promise` API extensions.
6
- */
7
- interface ExtendedPromise<T> extends Promise<T> {
8
- then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): ExtendedPromise<TResult1 | TResult2> & this;
9
- catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): ExtendedPromise<T | TResult> & this;
10
- finally(onfinally?: (() => void) | undefined | null): ExtendedPromise<T> & this;
11
- }
12
- /**
13
- * A `Promise` and `EventEmitter` all in one!
14
- */
15
- export type PromiEvent<TResult, TEvents extends EventsDefinition = void> = ExtendedPromise<TResult> & TypedEmitter<TEvents extends void ? DefaultEvents<TResult> : TEvents & DefaultEvents<TResult>>;
16
- /**
17
- * Default events attached to every `PromiEvent`.
18
- */
19
- type DefaultEvents<TResult> = {
20
- done: (result: TResult) => void;
21
- error: (reason: any) => void;
22
- settled: () => void;
23
- [UserEventsEmit.ClosedByUser]: () => void;
24
- };
25
- /**
26
- * A `Promise` executor with can be optionally asynchronous.
27
- */
28
- type AsyncPromiseExecutor<TResult> = (resolve: (value: TResult | PromiseLike<TResult>) => void, reject: (reason?: any) => void) => void | Promise<void>;
29
- /**
30
- * Returns `true` if the given `value` is a `PromiEvent`.
31
- */
32
- export declare function isPromiEvent(value: any): value is PromiEvent<any>;
33
- /**
34
- * Create a native JavaScript `Promise` overloaded with strongly-typed methods
35
- * from `EventEmitter`.
36
- */
37
- export declare function createPromiEvent<TResult, TEvents extends EventsDefinition = void>(executor: AsyncPromiseExecutor<TResult>): PromiEvent<TResult, TEvents extends void ? DefaultEvents<TResult> : TEvents & DefaultEvents<TResult>>;
38
- /**
39
- * Creates a `Promise` with an **async executor** that automatically catches
40
- * errors occurring within the executor. Nesting promises in this way is usually
41
- * deemed an _anti-pattern_, but it's useful and clean when promisifying the
42
- * event-based code that's inherent to JSON RPC.
43
- *
44
- * So, here we solve the issue of nested promises by ensuring that no errors
45
- * mistakenly go unhandled!
46
- */
47
- export declare function createPromise<TResult>(executor: AsyncPromiseExecutor<TResult>): Promise<TResult>;
48
- export {};
@@ -1,23 +0,0 @@
1
- export function satisfies(e: any, r: any, t: any): any;
2
- export function coerce(e: any, r: any): SemVer | null;
3
- declare class SemVer {
4
- constructor(e: any, r: any);
5
- options: any;
6
- loose: boolean | undefined;
7
- includePrerelease: boolean | undefined;
8
- raw: any;
9
- major: number | undefined;
10
- minor: number | undefined;
11
- patch: number | undefined;
12
- prerelease: any;
13
- build: any;
14
- format(): string;
15
- version: string | undefined;
16
- toString(): string | undefined;
17
- compare(e: any): 1 | 0 | -1 | undefined;
18
- compareMain(e: any): 1 | 0 | -1;
19
- comparePre(e: any): 1 | 0 | -1 | undefined;
20
- compareBuild(e: any): 1 | 0 | -1 | undefined;
21
- inc(e: any, r: any): this;
22
- }
23
- export {};
@@ -1,8 +0,0 @@
1
- export declare const getItem: <T>(key: string, callback?: (err: any, value: T | null) => void) => Promise<T | null>;
2
- export declare const setItem: <T>(key: string, value: T, callback?: (err: any, value: T) => void) => Promise<T>;
3
- export declare const removeItem: (key: string, callback?: (err: any) => void) => Promise<void>;
4
- export declare const clear: (callback?: (err: any) => void) => Promise<void>;
5
- export declare const length: (callback?: (err: any, numberOfKeys: number) => void) => Promise<number>;
6
- export declare const key: (keyIndex: number, callback?: (err: any, key: string) => void) => Promise<string>;
7
- export declare const keys: (callback?: (err: any, keys: string[]) => void) => Promise<string[]>;
8
- export declare const iterate: <T, U>(iteratee: (value: T, key: string, iterationNumber: number) => U, callback?: (err: any, result: U) => void) => Promise<U>;
@@ -1,30 +0,0 @@
1
- /**
2
- * This file contains our type guards.
3
- *
4
- * Type guards are a feature of TypeScript which narrow the type signature of
5
- * intersection types (types that can be one thing or another).
6
- *
7
- * @see
8
- * https://www.typescriptlang.org/docs/handbook/advanced-types.html#type-guards-and-differentiating-types
9
- */
10
- import { JsonRpcRequestPayload, JsonRpcResponsePayload, MagicPayloadMethod, RPCErrorCode } from '@magic-sdk/types';
11
- /**
12
- * Assert `value` is a `JsonRpcRequestPayload` object.
13
- */
14
- export declare function isJsonRpcRequestPayload(value?: JsonRpcRequestPayload): value is JsonRpcRequestPayload;
15
- /**
16
- * Assert `value` is a `JsonRpcResponsePayload` object.
17
- */
18
- export declare function isJsonRpcResponsePayload(value: any): value is JsonRpcResponsePayload;
19
- /**
20
- * Assert `value` is a Magic SDK payload method identifier.
21
- */
22
- export declare function isMagicPayloadMethod(value?: any): value is MagicPayloadMethod;
23
- /**
24
- * Assert `value` is an expected JSON RPC error code.
25
- */
26
- export declare function isJsonRpcErrorCode(value?: any): value is RPCErrorCode;
27
- /**
28
- * Assert `value` is an empty, plain object.
29
- */
30
- export declare function isEmpty(value?: any): value is {};
@@ -1,4 +0,0 @@
1
- /**
2
- * Builds a `URL` object safely.
3
- */
4
- export declare function createURL(url: string, base?: string): URL;
@@ -1 +0,0 @@
1
- export declare function uuid(): string;
@@ -1 +0,0 @@
1
- export declare function isMajorVersionAtLeast(version: string, majorVersion: number): boolean;
@@ -1,26 +0,0 @@
1
- import { JsonRpcResponse } from '../core/json-rpc';
2
- import { JsonRpcRequestPayload, MagicMessageEvent } from '@magic-sdk/types';
3
- interface StandardizedResponse {
4
- id?: string | number;
5
- response?: JsonRpcResponse;
6
- }
7
- interface StandardizedMagicRequest {
8
- msgType: string;
9
- payload: JsonRpcRequestPayload | JsonRpcRequestPayload[];
10
- jwt?: string;
11
- rt?: string;
12
- deviceShare?: string;
13
- }
14
- /**
15
- * Get the originating payload from a batch request using the specified `id`.
16
- */
17
- export declare function getRequestPayloadFromBatch(requestPayload: JsonRpcRequestPayload | JsonRpcRequestPayload[], id?: string | number | null): JsonRpcRequestPayload | undefined;
18
- /**
19
- * Ensures the incoming response follows the expected schema and parses for a
20
- * JSON RPC payload ID.
21
- */
22
- export declare function standardizeResponse(requestPayload: JsonRpcRequestPayload | JsonRpcRequestPayload[], event: MagicMessageEvent): StandardizedResponse;
23
- export declare function createMagicRequest(msgType: string, payload: JsonRpcRequestPayload | JsonRpcRequestPayload[], networkHash: string): Promise<StandardizedMagicRequest>;
24
- export declare function persistMagicEventRefreshToken(event: MagicMessageEvent): Promise<void>;
25
- export declare function debounce<T extends (...args: unknown[]) => void>(func: T, delay: number): (...args: Parameters<T>) => void;
26
- export {};
@@ -1,5 +0,0 @@
1
- export declare const STORE_KEY_PRIVATE_KEY = "STORE_KEY_PRIVATE_KEY";
2
- export declare const STORE_KEY_PUBLIC_JWK = "STORE_KEY_PUBLIC_JWK";
3
- export declare function isWebCryptoSupported(): boolean;
4
- export declare function clearKeys(): void;
5
- export declare function createJwt(): Promise<string | undefined>;