@dynamic-labs-sdk/solana 0.12.1 → 0.14.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.
- package/dist/{addSolanaWalletStandardExtension-BAfO9QS_.esm.js → addSolanaWalletStandardExtension-B7GpGFx3.esm.js} +2 -2
- package/dist/{addSolanaWalletStandardExtension-BAfO9QS_.esm.js.map → addSolanaWalletStandardExtension-B7GpGFx3.esm.js.map} +1 -1
- package/dist/{addSolanaWalletStandardExtension-Cx6IgVQm.cjs.js → addSolanaWalletStandardExtension-Bv39eDZc.cjs.js} +2 -2
- package/dist/{addSolanaWalletStandardExtension-Cx6IgVQm.cjs.js.map → addSolanaWalletStandardExtension-Bv39eDZc.cjs.js.map} +1 -1
- package/dist/{addWaasSolanaExtension-CQRBZ5Pb.cjs.js → addWaasSolanaExtension-BaxzWnYL.cjs.js} +3 -3
- package/dist/{addWaasSolanaExtension-CQRBZ5Pb.cjs.js.map → addWaasSolanaExtension-BaxzWnYL.cjs.js.map} +1 -1
- package/dist/{addWaasSolanaExtension-D1x1coxf.esm.js → addWaasSolanaExtension-ofYQDYyc.esm.js} +2 -2
- package/dist/{addWaasSolanaExtension-D1x1coxf.esm.js.map → addWaasSolanaExtension-ofYQDYyc.esm.js.map} +1 -1
- package/dist/exports/index.d.ts +6 -2
- package/dist/exports/index.d.ts.map +1 -1
- package/dist/index.cjs.js +980 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +979 -7
- package/dist/index.esm.js.map +1 -1
- package/dist/{isVersionedTransaction-BcQyqyS5.esm.js → isVersionedTransaction-CecentWi.esm.js} +2 -2
- package/dist/{isVersionedTransaction-BcQyqyS5.esm.js.map → isVersionedTransaction-CecentWi.esm.js.map} +1 -1
- package/dist/{isVersionedTransaction-DkFu5HnX.cjs.js → isVersionedTransaction-DW-V1tUS.cjs.js} +3 -3
- package/dist/{isVersionedTransaction-DkFu5HnX.cjs.js.map → isVersionedTransaction-DW-V1tUS.cjs.js.map} +1 -1
- package/dist/phantomRedirect/PhantomRedirectWalletProvider.types.d.ts +112 -0
- package/dist/phantomRedirect/PhantomRedirectWalletProvider.types.d.ts.map +1 -0
- package/dist/phantomRedirect/addPhantomRedirectSolanaExtension/addPhantomRedirectSolanaExtension.d.ts +115 -0
- package/dist/phantomRedirect/addPhantomRedirectSolanaExtension/addPhantomRedirectSolanaExtension.d.ts.map +1 -0
- package/dist/phantomRedirect/addPhantomRedirectSolanaExtension/index.d.ts +3 -0
- package/dist/phantomRedirect/addPhantomRedirectSolanaExtension/index.d.ts.map +1 -0
- package/dist/phantomRedirect/completePhantomRedirect/completePhantomRedirect.d.ts +32 -0
- package/dist/phantomRedirect/completePhantomRedirect/completePhantomRedirect.d.ts.map +1 -0
- package/dist/phantomRedirect/completePhantomRedirect/index.d.ts +3 -0
- package/dist/phantomRedirect/completePhantomRedirect/index.d.ts.map +1 -0
- package/dist/phantomRedirect/createPhantomRedirectWalletProvider/createPhantomRedirectWalletProvider.d.ts +17 -0
- package/dist/phantomRedirect/createPhantomRedirectWalletProvider/createPhantomRedirectWalletProvider.d.ts.map +1 -0
- package/dist/phantomRedirect/createPhantomRedirectWalletProvider/index.d.ts +3 -0
- package/dist/phantomRedirect/createPhantomRedirectWalletProvider/index.d.ts.map +1 -0
- package/dist/phantomRedirect/detectPhantomRedirect/detectPhantomRedirect.d.ts +17 -0
- package/dist/phantomRedirect/detectPhantomRedirect/detectPhantomRedirect.d.ts.map +1 -0
- package/dist/phantomRedirect/detectPhantomRedirect/index.d.ts +3 -0
- package/dist/phantomRedirect/detectPhantomRedirect/index.d.ts.map +1 -0
- package/dist/phantomRedirect/errors/NoPendingPhantomRequestError.d.ts +5 -0
- package/dist/phantomRedirect/errors/NoPendingPhantomRequestError.d.ts.map +1 -0
- package/dist/phantomRedirect/errors/NoPhantomSessionError.d.ts +5 -0
- package/dist/phantomRedirect/errors/NoPhantomSessionError.d.ts.map +1 -0
- package/dist/phantomRedirect/errors/PhantomMissingEncryptionParamsError.d.ts +5 -0
- package/dist/phantomRedirect/errors/PhantomMissingEncryptionParamsError.d.ts.map +1 -0
- package/dist/phantomRedirect/errors/PhantomRedirectDecryptionError.d.ts +5 -0
- package/dist/phantomRedirect/errors/PhantomRedirectDecryptionError.d.ts.map +1 -0
- package/dist/phantomRedirect/errors/PhantomRedirectRejectedError.d.ts +9 -0
- package/dist/phantomRedirect/errors/PhantomRedirectRejectedError.d.ts.map +1 -0
- package/dist/phantomRedirect/errors/PhantomRedirectTimeoutError.d.ts +5 -0
- package/dist/phantomRedirect/errors/PhantomRedirectTimeoutError.d.ts.map +1 -0
- package/dist/phantomRedirect/phantomRedirect.broadcast.types.d.ts +6 -0
- package/dist/phantomRedirect/phantomRedirect.broadcast.types.d.ts.map +1 -0
- package/dist/phantomRedirect/phantomRedirect.constants.d.ts +5 -0
- package/dist/phantomRedirect/phantomRedirect.constants.d.ts.map +1 -0
- package/dist/phantomRedirect/phantomRedirect.events.d.ts +152 -0
- package/dist/phantomRedirect/phantomRedirect.events.d.ts.map +1 -0
- package/dist/phantomRedirect/storage/pendingRequestStorageSchema/index.d.ts +2 -0
- package/dist/phantomRedirect/storage/pendingRequestStorageSchema/index.d.ts.map +1 -0
- package/dist/phantomRedirect/storage/pendingRequestStorageSchema/pendingRequestStorageSchema.d.ts +15 -0
- package/dist/phantomRedirect/storage/pendingRequestStorageSchema/pendingRequestStorageSchema.d.ts.map +1 -0
- package/dist/phantomRedirect/storage/phantomSessionStorageSchema/index.d.ts +2 -0
- package/dist/phantomRedirect/storage/phantomSessionStorageSchema/index.d.ts.map +1 -0
- package/dist/phantomRedirect/storage/phantomSessionStorageSchema/phantomSessionStorageSchema.d.ts +14 -0
- package/dist/phantomRedirect/storage/phantomSessionStorageSchema/phantomSessionStorageSchema.d.ts.map +1 -0
- package/dist/phantomRedirect/utils/broadcastPhantomEvent/broadcastPhantomEvent.d.ts +16 -0
- package/dist/phantomRedirect/utils/broadcastPhantomEvent/broadcastPhantomEvent.d.ts.map +1 -0
- package/dist/phantomRedirect/utils/broadcastPhantomEvent/index.d.ts +2 -0
- package/dist/phantomRedirect/utils/broadcastPhantomEvent/index.d.ts.map +1 -0
- package/dist/phantomRedirect/utils/buildPhantomDeepLink/buildPhantomDeepLink.d.ts +23 -0
- package/dist/phantomRedirect/utils/buildPhantomDeepLink/buildPhantomDeepLink.d.ts.map +1 -0
- package/dist/phantomRedirect/utils/buildPhantomDeepLink/index.d.ts +3 -0
- package/dist/phantomRedirect/utils/buildPhantomDeepLink/index.d.ts.map +1 -0
- package/dist/phantomRedirect/utils/cleanPhantomParamsFromUrl/cleanPhantomParamsFromUrl.d.ts +15 -0
- package/dist/phantomRedirect/utils/cleanPhantomParamsFromUrl/cleanPhantomParamsFromUrl.d.ts.map +1 -0
- package/dist/phantomRedirect/utils/cleanPhantomParamsFromUrl/index.d.ts +3 -0
- package/dist/phantomRedirect/utils/cleanPhantomParamsFromUrl/index.d.ts.map +1 -0
- package/dist/phantomRedirect/utils/crypto/createNaClSharedSecret/createNaClSharedSecret.d.ts +13 -0
- package/dist/phantomRedirect/utils/crypto/createNaClSharedSecret/createNaClSharedSecret.d.ts.map +1 -0
- package/dist/phantomRedirect/utils/crypto/createNaClSharedSecret/index.d.ts +3 -0
- package/dist/phantomRedirect/utils/crypto/createNaClSharedSecret/index.d.ts.map +1 -0
- package/dist/phantomRedirect/utils/crypto/decryptPayload/decryptPayload.d.ts +16 -0
- package/dist/phantomRedirect/utils/crypto/decryptPayload/decryptPayload.d.ts.map +1 -0
- package/dist/phantomRedirect/utils/crypto/decryptPayload/index.d.ts +3 -0
- package/dist/phantomRedirect/utils/crypto/decryptPayload/index.d.ts.map +1 -0
- package/dist/phantomRedirect/utils/crypto/encryptPayload/encryptPayload.d.ts +17 -0
- package/dist/phantomRedirect/utils/crypto/encryptPayload/encryptPayload.d.ts.map +1 -0
- package/dist/phantomRedirect/utils/crypto/encryptPayload/index.d.ts +3 -0
- package/dist/phantomRedirect/utils/crypto/encryptPayload/index.d.ts.map +1 -0
- package/dist/phantomRedirect/utils/crypto/generateNaClKeyPair/generateNaClKeyPair.d.ts +11 -0
- package/dist/phantomRedirect/utils/crypto/generateNaClKeyPair/generateNaClKeyPair.d.ts.map +1 -0
- package/dist/phantomRedirect/utils/crypto/generateNaClKeyPair/index.d.ts +3 -0
- package/dist/phantomRedirect/utils/crypto/generateNaClKeyPair/index.d.ts.map +1 -0
- package/dist/phantomRedirect/utils/getPhantomCluster/getPhantomCluster.d.ts +23 -0
- package/dist/phantomRedirect/utils/getPhantomCluster/getPhantomCluster.d.ts.map +1 -0
- package/dist/phantomRedirect/utils/getPhantomOriginTab/getPhantomOriginTab.d.ts +19 -0
- package/dist/phantomRedirect/utils/getPhantomOriginTab/getPhantomOriginTab.d.ts.map +1 -0
- package/dist/phantomRedirect/utils/getPhantomOriginTab/index.d.ts +3 -0
- package/dist/phantomRedirect/utils/getPhantomOriginTab/index.d.ts.map +1 -0
- package/dist/phantomRedirect/utils/listenForPhantomBroadcast/index.d.ts +2 -0
- package/dist/phantomRedirect/utils/listenForPhantomBroadcast/index.d.ts.map +1 -0
- package/dist/phantomRedirect/utils/listenForPhantomBroadcast/listenForPhantomBroadcast.d.ts +15 -0
- package/dist/phantomRedirect/utils/listenForPhantomBroadcast/listenForPhantomBroadcast.d.ts.map +1 -0
- package/dist/phantomRedirect/utils/parsePhantomRedirectParams/index.d.ts +3 -0
- package/dist/phantomRedirect/utils/parsePhantomRedirectParams/index.d.ts.map +1 -0
- package/dist/phantomRedirect/utils/parsePhantomRedirectParams/parsePhantomRedirectParams.d.ts +22 -0
- package/dist/phantomRedirect/utils/parsePhantomRedirectParams/parsePhantomRedirectParams.d.ts.map +1 -0
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/waas.cjs.js +3 -3
- package/dist/waas.esm.js +2 -2
- package/dist/walletStandard.cjs.js +2 -2
- package/dist/walletStandard.esm.js +2 -2
- package/package.json +7 -5
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { DynamicClient } from '@dynamic-labs-sdk/client';
|
|
2
|
+
export type CompletePhantomRedirectParams = {
|
|
3
|
+
url: URL;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Completes the Phantom wallet redirect flow after the deep link callback.
|
|
7
|
+
*
|
|
8
|
+
* This function is called on the page that Phantom redirects back to after the
|
|
9
|
+
* user approves or rejects a wallet operation. It processes the redirect URL,
|
|
10
|
+
* decrypts the response, updates session storage, and emits the appropriate
|
|
11
|
+
* events so that waiting callers (in this tab or the originating tab) can
|
|
12
|
+
* resolve or reject their pending promises.
|
|
13
|
+
*
|
|
14
|
+
* ## Cross-tab delivery
|
|
15
|
+
*
|
|
16
|
+
* On mobile browsers, Phantom opens the redirect URL in a **new tab** (the
|
|
17
|
+
* clone tab). Events are delivered to the originating tab via the
|
|
18
|
+
* `BroadcastChannel` API. Once delivery is complete this function emits
|
|
19
|
+
* `phantomRedirectCloseTab` so that the clone tab can be closed and the user
|
|
20
|
+
* is returned to the originating tab. See the `phantomRedirectCloseTab` event
|
|
21
|
+
* JSDoc for details on how to handle tab closing.
|
|
22
|
+
*
|
|
23
|
+
* @param params.url - The callback URL received from Phantom
|
|
24
|
+
* @param client - The Dynamic client instance
|
|
25
|
+
* @throws {NoPendingPhantomRequestError} If no pending request is found in storage
|
|
26
|
+
* @throws {PhantomMissingEncryptionParamsError} If the URL is missing the
|
|
27
|
+
* required encryption parameters (`phantom_encryption_public_key`, `data`,
|
|
28
|
+
* `nonce`) and does not carry an error code either
|
|
29
|
+
* @throws {PhantomRedirectRejectedError} If the user rejected the request in Phantom
|
|
30
|
+
*/
|
|
31
|
+
export declare const completePhantomRedirect: ({ url }: CompletePhantomRedirectParams, client?: DynamicClient) => Promise<void>;
|
|
32
|
+
//# sourceMappingURL=completePhantomRedirect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"completePhantomRedirect.d.ts","sourceRoot":"","sources":["../../../src/phantomRedirect/completePhantomRedirect/completePhantomRedirect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAmC9D,MAAM,MAAM,6BAA6B,GAAG;IAC1C,GAAG,EAAE,GAAG,CAAC;CACV,CAAC;AAqEF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,uBAAuB,YACzB,6BAA6B,WAC9B,aAAa,KACpB,OAAO,CAAC,IAAI,CAqJd,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/phantomRedirect/completePhantomRedirect/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,YAAY,EAAE,6BAA6B,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { DynamicClient } from '@dynamic-labs-sdk/client';
|
|
2
|
+
import type { SolanaWalletProvider } from '../../SolanaWalletProvider.types';
|
|
3
|
+
export type CreatePhantomRedirectWalletProviderParams = {
|
|
4
|
+
baseRedirectUrl: string;
|
|
5
|
+
dynamicClient: DynamicClient;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Creates a Phantom redirect-based Solana wallet provider.
|
|
9
|
+
*
|
|
10
|
+
* This wallet provider uses Phantom's deep link protocol for mobile wallet
|
|
11
|
+
* interactions with end-to-end encryption using NaCl.
|
|
12
|
+
*
|
|
13
|
+
* @param params.dynamicClient - The Dynamic client instance
|
|
14
|
+
* @returns A Phantom redirect wallet provider
|
|
15
|
+
*/
|
|
16
|
+
export declare const createPhantomRedirectWalletProvider: ({ baseRedirectUrl, dynamicClient, }: CreatePhantomRedirectWalletProviderParams) => SolanaWalletProvider;
|
|
17
|
+
//# sourceMappingURL=createPhantomRedirectWalletProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createPhantomRedirectWalletProvider.d.ts","sourceRoot":"","sources":["../../../src/phantomRedirect/createPhantomRedirectWalletProvider/createPhantomRedirectWalletProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAe9D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAiB7E,MAAM,MAAM,yCAAyC,GAAG;IACtD,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,aAAa,CAAC;CAC9B,CAAC;AAsBF;;;;;;;;GAQG;AACH,eAAO,MAAM,mCAAmC,wCAG7C,yCAAyC,KAAG,oBA8e9C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/phantomRedirect/createPhantomRedirectWalletProvider/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mCAAmC,EAAE,MAAM,uCAAuC,CAAC;AAC5F,YAAY,EAAE,yCAAyC,EAAE,MAAM,uCAAuC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { DynamicClient } from '@dynamic-labs-sdk/client';
|
|
2
|
+
export type DetectPhantomRedirectParams = {
|
|
3
|
+
url: URL;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Detects if the current URL is a Phantom wallet redirect.
|
|
7
|
+
*
|
|
8
|
+
* This function examines the URL parameters to determine if it contains
|
|
9
|
+
* redirect data from a Phantom wallet deep link operation, and validates
|
|
10
|
+
* that there is a corresponding pending request in storage.
|
|
11
|
+
*
|
|
12
|
+
* @param params.url - The URL to check for Phantom redirect parameters
|
|
13
|
+
* @param client - The Dynamic client instance
|
|
14
|
+
* @returns A promise that resolves to true if the URL is a valid Phantom redirect, false otherwise
|
|
15
|
+
*/
|
|
16
|
+
export declare const detectPhantomRedirect: ({ url }: DetectPhantomRedirectParams, client?: DynamicClient) => Promise<boolean>;
|
|
17
|
+
//# sourceMappingURL=detectPhantomRedirect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detectPhantomRedirect.d.ts","sourceRoot":"","sources":["../../../src/phantomRedirect/detectPhantomRedirect/detectPhantomRedirect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAK9D,MAAM,MAAM,2BAA2B,GAAG;IACxC,GAAG,EAAE,GAAG,CAAC;CACV,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,qBAAqB,YACvB,2BAA2B,WAC5B,aAAa,KACpB,OAAO,CAAC,OAAO,CAmBjB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/phantomRedirect/detectPhantomRedirect/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,YAAY,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NoPendingPhantomRequestError.d.ts","sourceRoot":"","sources":["../../../src/phantomRedirect/errors/NoPendingPhantomRequestError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAErD,qBAAa,4BAA6B,SAAQ,SAAS;;CAW1D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NoPhantomSessionError.d.ts","sourceRoot":"","sources":["../../../src/phantomRedirect/errors/NoPhantomSessionError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAErD,qBAAa,qBAAsB,SAAQ,SAAS;;CAUnD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PhantomMissingEncryptionParamsError.d.ts","sourceRoot":"","sources":["../../../src/phantomRedirect/errors/PhantomMissingEncryptionParamsError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAErD,qBAAa,mCAAoC,SAAQ,SAAS;;CAWjE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PhantomRedirectDecryptionError.d.ts","sourceRoot":"","sources":["../../../src/phantomRedirect/errors/PhantomRedirectDecryptionError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAErD,qBAAa,8BAA+B,SAAQ,SAAS;;CAW5D"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseError } from '@dynamic-labs-sdk/client';
|
|
2
|
+
export type PhantomRedirectRejectedErrorParams = {
|
|
3
|
+
errorCode: string;
|
|
4
|
+
errorMessage?: string;
|
|
5
|
+
};
|
|
6
|
+
export declare class PhantomRedirectRejectedError extends BaseError {
|
|
7
|
+
constructor({ errorCode, errorMessage }: PhantomRedirectRejectedErrorParams);
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=PhantomRedirectRejectedError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PhantomRedirectRejectedError.d.ts","sourceRoot":"","sources":["../../../src/phantomRedirect/errors/PhantomRedirectRejectedError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAErD,MAAM,MAAM,kCAAkC,GAAG;IAC/C,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,qBAAa,4BAA6B,SAAQ,SAAS;gBAC7C,EAAE,SAAS,EAAE,YAAY,EAAE,EAAE,kCAAkC;CAW5E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PhantomRedirectTimeoutError.d.ts","sourceRoot":"","sources":["../../../src/phantomRedirect/errors/PhantomRedirectTimeoutError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAErD,qBAAa,2BAA4B,SAAQ,SAAS;;CAWzD"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type PhantomEvents = Pick<DynamicEvents, 'phantomRedirectConnectionComplete' | 'phantomRedirectConnectionError' | 'phantomRedirectDisconnectComplete' | 'phantomRedirectDisconnectError' | 'phantomRedirectSignAllTransactionsComplete' | 'phantomRedirectSignAllTransactionsError' | 'phantomRedirectSignAndSendTransactionComplete' | 'phantomRedirectSignAndSendTransactionError' | 'phantomRedirectSignMessageComplete' | 'phantomRedirectSignMessageError' | 'phantomRedirectSignTransactionComplete' | 'phantomRedirectSignTransactionError'>;
|
|
2
|
+
export type PhantomBroadcastMessage<K extends keyof PhantomEvents> = {
|
|
3
|
+
args: Parameters<PhantomEvents[K]>[0];
|
|
4
|
+
event: K;
|
|
5
|
+
};
|
|
6
|
+
//# sourceMappingURL=phantomRedirect.broadcast.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phantomRedirect.broadcast.types.d.ts","sourceRoot":"","sources":["../../src/phantomRedirect/phantomRedirect.broadcast.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,IAAI,CAC9B,aAAa,EACX,mCAAmC,GACnC,gCAAgC,GAChC,mCAAmC,GACnC,gCAAgC,GAChC,4CAA4C,GAC5C,yCAAyC,GACzC,+CAA+C,GAC/C,4CAA4C,GAC5C,oCAAoC,GACpC,iCAAiC,GACjC,wCAAwC,GACxC,qCAAqC,CACxC,CAAC;AAEF,MAAM,MAAM,uBAAuB,CAAC,CAAC,SAAS,MAAM,aAAa,IAAI;IACnE,IAAI,EAAE,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACtC,KAAK,EAAE,CAAC,CAAC;CACV,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const PHANTOM_DEEPLINK_BASE_URL = "https://phantom.app/ul/v1";
|
|
2
|
+
export declare const PHANTOM_SESSION_STORAGE_KEY = "phantom_session";
|
|
3
|
+
export declare const PHANTOM_PENDING_REQUEST_STORAGE_KEY = "phantom_pending_request";
|
|
4
|
+
export declare const PHANTOM_REDIRECT_TIMEOUT_MS = 300000;
|
|
5
|
+
//# sourceMappingURL=phantomRedirect.constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phantomRedirect.constants.d.ts","sourceRoot":"","sources":["../../src/phantomRedirect/phantomRedirect.constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,yBAAyB,8BAA8B,CAAC;AAErE,eAAO,MAAM,2BAA2B,oBAAoB,CAAC;AAE7D,eAAO,MAAM,mCAAmC,4BAA4B,CAAC;AAE7E,eAAO,MAAM,2BAA2B,SAAS,CAAC"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
interface DynamicEvents {
|
|
3
|
+
/**
|
|
4
|
+
* Emitted by `completePhantomRedirect` when it determines the current tab
|
|
5
|
+
* is a **clone tab** — a new browser tab that Phantom opened to deliver the
|
|
6
|
+
* redirect callback on mobile browsers.
|
|
7
|
+
*
|
|
8
|
+
* ## Why this event exists
|
|
9
|
+
*
|
|
10
|
+
* On mobile browsers, after deeplinking to Phantom and the user approves or rejects the request, Phantom
|
|
11
|
+
* navigates back to your app *in a new tab*. This means the
|
|
12
|
+
* completion logic (`completePhantomRedirect`) runs in a **different tab**
|
|
13
|
+
* than the one that initiated the request. Once the events have been
|
|
14
|
+
* broadcast back to the originating tab via `BroadcastChannel`, the clone
|
|
15
|
+
* tab has served its purpose and should be closed to return the user to
|
|
16
|
+
* the originating tab.
|
|
17
|
+
*
|
|
18
|
+
* In **mobile native** environments (e.g. React Native / Capacitor), the
|
|
19
|
+
* deep link is handled in the **same JavaScript context** — no new tab is
|
|
20
|
+
* created. The SDK detects this via a per-client `isOriginTab` flag stored
|
|
21
|
+
* in `runtimeServices` and set by `setupPhantomListeners` when the request
|
|
22
|
+
* is initiated. Because each JavaScript context has its own client
|
|
23
|
+
* instance, the clone tab's client starts with the flag unset and this
|
|
24
|
+
* event is correctly emitted only there.
|
|
25
|
+
*
|
|
26
|
+
* ## How to handle it
|
|
27
|
+
*
|
|
28
|
+
* Pass an `onCloseTab` callback to `addPhantomRedirectSolanaExtension`.
|
|
29
|
+
* The SDK registers it as a one-time listener for this event automatically:
|
|
30
|
+
*
|
|
31
|
+
* ```ts
|
|
32
|
+
* addPhantomRedirectSolanaExtension({
|
|
33
|
+
* url: new URL(window.location.href),
|
|
34
|
+
* onCloseTab: () => window.close(),
|
|
35
|
+
* });
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* To explicitly opt out of automatic tab closing, pass an empty function:
|
|
39
|
+
*
|
|
40
|
+
* ```ts
|
|
41
|
+
* onCloseTab: () => {}
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* You can also subscribe to this event directly if you need more control:
|
|
45
|
+
*
|
|
46
|
+
* ```ts
|
|
47
|
+
* onEvent({ event: 'phantomRedirectCloseTab', listener: () => window.close() }, client);
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
phantomRedirectCloseTab: (args: Record<string, never>) => void;
|
|
51
|
+
/**
|
|
52
|
+
* Emitted when the Phantom redirect connection flow completes successfully.
|
|
53
|
+
* The wallet address and public key of the connected account are included.
|
|
54
|
+
*/
|
|
55
|
+
phantomRedirectConnectionComplete: (args: {
|
|
56
|
+
address: string;
|
|
57
|
+
publicKey: string;
|
|
58
|
+
}) => void;
|
|
59
|
+
/**
|
|
60
|
+
* Emitted when the Phantom redirect connection flow fails (e.g. the user
|
|
61
|
+
* rejected the request in Phantom).
|
|
62
|
+
*/
|
|
63
|
+
phantomRedirectConnectionError: (args: {
|
|
64
|
+
error: Error;
|
|
65
|
+
}) => void;
|
|
66
|
+
/**
|
|
67
|
+
* Emitted when the Phantom redirect disconnect flow completes successfully.
|
|
68
|
+
*
|
|
69
|
+
* ## Why a dedicated event is needed for disconnect
|
|
70
|
+
*
|
|
71
|
+
* Unlike every other Phantom deeplink method, the `disconnect` callback URL
|
|
72
|
+
* carries **no query parameters at all** on success — Phantom simply
|
|
73
|
+
* redirects to `redirect_link` with nothing appended. There is no `data`
|
|
74
|
+
* or `nonce` to decrypt, and no `phantom_encryption_public_key`. This
|
|
75
|
+
* makes disconnect structurally different from all sign/connect callbacks,
|
|
76
|
+
* which always carry at least `nonce` + `data`.
|
|
77
|
+
*
|
|
78
|
+
* `completePhantomRedirect` handles this by checking for
|
|
79
|
+
* `pendingRequest.method === 'disconnect'` **before** the
|
|
80
|
+
* `!params.data || !params.nonce` guard, so an empty callback URL is
|
|
81
|
+
* treated as a successful disconnect rather than as a
|
|
82
|
+
* `PhantomMissingEncryptionParamsError`.
|
|
83
|
+
*
|
|
84
|
+
* After this event fires the session storage is cleared by the
|
|
85
|
+
* `createPhantomRedirectWalletProvider` disconnect handler.
|
|
86
|
+
*/
|
|
87
|
+
phantomRedirectDisconnectComplete: (args: Record<string, never>) => void;
|
|
88
|
+
/**
|
|
89
|
+
* Emitted when the Phantom redirect disconnect flow fails (e.g. the user
|
|
90
|
+
* rejected the request in Phantom).
|
|
91
|
+
*/
|
|
92
|
+
phantomRedirectDisconnectError: (args: {
|
|
93
|
+
error: Error;
|
|
94
|
+
}) => void;
|
|
95
|
+
/**
|
|
96
|
+
* Emitted when the Phantom redirect signAllTransactions flow completes
|
|
97
|
+
* successfully. The signed transactions are returned as base-58 strings.
|
|
98
|
+
*/
|
|
99
|
+
phantomRedirectSignAllTransactionsComplete: (args: {
|
|
100
|
+
transactions: string[];
|
|
101
|
+
}) => void;
|
|
102
|
+
/**
|
|
103
|
+
* Emitted when the Phantom redirect signAllTransactions flow fails.
|
|
104
|
+
*/
|
|
105
|
+
phantomRedirectSignAllTransactionsError: (args: {
|
|
106
|
+
error: Error;
|
|
107
|
+
}) => void;
|
|
108
|
+
/**
|
|
109
|
+
* Emitted when the Phantom redirect signAndSendTransaction flow completes
|
|
110
|
+
* successfully. The transaction signature is included.
|
|
111
|
+
*/
|
|
112
|
+
phantomRedirectSignAndSendTransactionComplete: (args: {
|
|
113
|
+
signature: string;
|
|
114
|
+
}) => void;
|
|
115
|
+
/**
|
|
116
|
+
* Emitted when the Phantom redirect signAndSendTransaction flow fails.
|
|
117
|
+
*/
|
|
118
|
+
phantomRedirectSignAndSendTransactionError: (args: {
|
|
119
|
+
error: Error;
|
|
120
|
+
}) => void;
|
|
121
|
+
/**
|
|
122
|
+
* Emitted when the Phantom redirect signMessage flow completes
|
|
123
|
+
* successfully. The original message and its base-58 signature are
|
|
124
|
+
* included.
|
|
125
|
+
*/
|
|
126
|
+
phantomRedirectSignMessageComplete: (args: {
|
|
127
|
+
message?: string;
|
|
128
|
+
signature: string;
|
|
129
|
+
}) => void;
|
|
130
|
+
/**
|
|
131
|
+
* Emitted when the Phantom redirect signMessage flow fails.
|
|
132
|
+
*/
|
|
133
|
+
phantomRedirectSignMessageError: (args: {
|
|
134
|
+
error: Error;
|
|
135
|
+
}) => void;
|
|
136
|
+
/**
|
|
137
|
+
* Emitted when the Phantom redirect signTransaction flow completes
|
|
138
|
+
* successfully. The signed transaction is returned as a base-58 string.
|
|
139
|
+
*/
|
|
140
|
+
phantomRedirectSignTransactionComplete: (args: {
|
|
141
|
+
transaction: string;
|
|
142
|
+
}) => void;
|
|
143
|
+
/**
|
|
144
|
+
* Emitted when the Phantom redirect signTransaction flow fails.
|
|
145
|
+
*/
|
|
146
|
+
phantomRedirectSignTransactionError: (args: {
|
|
147
|
+
error: Error;
|
|
148
|
+
}) => void;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
export {};
|
|
152
|
+
//# sourceMappingURL=phantomRedirect.events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phantomRedirect.events.d.ts","sourceRoot":"","sources":["../../src/phantomRedirect/phantomRedirect.events.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,aAAa;QACrB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WA8CG;QACH,uBAAuB,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,KAAK,IAAI,CAAC;QAE/D;;;WAGG;QACH,iCAAiC,EAAE,CAAC,IAAI,EAAE;YACxC,OAAO,EAAE,MAAM,CAAC;YAChB,SAAS,EAAE,MAAM,CAAC;SACnB,KAAK,IAAI,CAAC;QAEX;;;WAGG;QACH,8BAA8B,EAAE,CAAC,IAAI,EAAE;YAAE,KAAK,EAAE,KAAK,CAAA;SAAE,KAAK,IAAI,CAAC;QAEjE;;;;;;;;;;;;;;;;;;;;WAoBG;QACH,iCAAiC,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,KAAK,IAAI,CAAC;QAEzE;;;WAGG;QACH,8BAA8B,EAAE,CAAC,IAAI,EAAE;YAAE,KAAK,EAAE,KAAK,CAAA;SAAE,KAAK,IAAI,CAAC;QAEjE;;;WAGG;QACH,0CAA0C,EAAE,CAAC,IAAI,EAAE;YACjD,YAAY,EAAE,MAAM,EAAE,CAAC;SACxB,KAAK,IAAI,CAAC;QAEX;;WAEG;QACH,uCAAuC,EAAE,CAAC,IAAI,EAAE;YAAE,KAAK,EAAE,KAAK,CAAA;SAAE,KAAK,IAAI,CAAC;QAE1E;;;WAGG;QACH,6CAA6C,EAAE,CAAC,IAAI,EAAE;YACpD,SAAS,EAAE,MAAM,CAAC;SACnB,KAAK,IAAI,CAAC;QAEX;;WAEG;QACH,0CAA0C,EAAE,CAAC,IAAI,EAAE;YACjD,KAAK,EAAE,KAAK,CAAC;SACd,KAAK,IAAI,CAAC;QAEX;;;;WAIG;QACH,kCAAkC,EAAE,CAAC,IAAI,EAAE;YACzC,OAAO,CAAC,EAAE,MAAM,CAAC;YACjB,SAAS,EAAE,MAAM,CAAC;SACnB,KAAK,IAAI,CAAC;QAEX;;WAEG;QACH,+BAA+B,EAAE,CAAC,IAAI,EAAE;YAAE,KAAK,EAAE,KAAK,CAAA;SAAE,KAAK,IAAI,CAAC;QAElE;;;WAGG;QACH,sCAAsC,EAAE,CAAC,IAAI,EAAE;YAC7C,WAAW,EAAE,MAAM,CAAC;SACrB,KAAK,IAAI,CAAC;QAEX;;WAEG;QACH,mCAAmC,EAAE,CAAC,IAAI,EAAE;YAAE,KAAK,EAAE,KAAK,CAAA;SAAE,KAAK,IAAI,CAAC;KACvE;CACF;AAED,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/phantomRedirect/storage/pendingRequestStorageSchema/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,+BAA+B,CAAC"}
|
package/dist/phantomRedirect/storage/pendingRequestStorageSchema/pendingRequestStorageSchema.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Storage schema for tracking pending Phantom wallet requests.
|
|
3
|
+
* This temporary data is used to match redirect responses with their
|
|
4
|
+
* originating requests and includes the encryption keys needed for decryption.
|
|
5
|
+
*/
|
|
6
|
+
export declare const pendingRequestStorageKeySchema: import("@dynamic-labs-sdk/client/core").StorageKeySchema<{
|
|
7
|
+
dappPublicKey: string;
|
|
8
|
+
dappSecretKey: string;
|
|
9
|
+
method: string;
|
|
10
|
+
requestId: string;
|
|
11
|
+
timestamp: number;
|
|
12
|
+
message?: string | undefined;
|
|
13
|
+
walletAddress?: string | undefined;
|
|
14
|
+
}>;
|
|
15
|
+
//# sourceMappingURL=pendingRequestStorageSchema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pendingRequestStorageSchema.d.ts","sourceRoot":"","sources":["../../../../src/phantomRedirect/storage/pendingRequestStorageSchema/pendingRequestStorageSchema.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,eAAO,MAAM,8BAA8B;;;;;;;;EAWzC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/phantomRedirect/storage/phantomSessionStorageSchema/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,+BAA+B,CAAC"}
|
package/dist/phantomRedirect/storage/phantomSessionStorageSchema/phantomSessionStorageSchema.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Storage schema for persisting Phantom wallet session data.
|
|
3
|
+
* This includes the encryption keys and session information needed
|
|
4
|
+
* for subsequent operations after the initial connection.
|
|
5
|
+
*/
|
|
6
|
+
export declare const phantomSessionStorageKeySchema: import("@dynamic-labs-sdk/client/core").StorageKeySchema<{
|
|
7
|
+
dappPublicKey: string;
|
|
8
|
+
dappSecretKey: string;
|
|
9
|
+
phantomPublicKey: string;
|
|
10
|
+
sessionToken: string;
|
|
11
|
+
sharedSecret: string;
|
|
12
|
+
walletAddress: string;
|
|
13
|
+
}>;
|
|
14
|
+
//# sourceMappingURL=phantomSessionStorageSchema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phantomSessionStorageSchema.d.ts","sourceRoot":"","sources":["../../../../src/phantomRedirect/storage/phantomSessionStorageSchema/phantomSessionStorageSchema.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,eAAO,MAAM,8BAA8B;;;;;;;EAUzC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { DynamicClient } from '@dynamic-labs-sdk/client';
|
|
2
|
+
import type { PhantomBroadcastMessage, PhantomEvents } from '../../phantomRedirect.broadcast.types';
|
|
3
|
+
/**
|
|
4
|
+
* Broadcasts a Phantom redirect event to other tabs via the crossTabBroadcast
|
|
5
|
+
* service.
|
|
6
|
+
*
|
|
7
|
+
* Used by the redirect-completion tab to notify the originating tab that
|
|
8
|
+
* an operation has finished, since onceEvent listeners are in-memory and
|
|
9
|
+
* do not cross tab boundaries.
|
|
10
|
+
*
|
|
11
|
+
* @param params.event - The DynamicEvents event name to broadcast
|
|
12
|
+
* @param params.args - The event arguments to include in the message
|
|
13
|
+
* @param client - The Dynamic client instance
|
|
14
|
+
*/
|
|
15
|
+
export declare const broadcastPhantomEvent: <K extends keyof PhantomEvents>({ args, event }: PhantomBroadcastMessage<K>, client: DynamicClient) => void;
|
|
16
|
+
//# sourceMappingURL=broadcastPhantomEvent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"broadcastPhantomEvent.d.ts","sourceRoot":"","sources":["../../../../src/phantomRedirect/utils/broadcastPhantomEvent/broadcastPhantomEvent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAG9D,OAAO,KAAK,EACV,uBAAuB,EACvB,aAAa,EACd,MAAM,uCAAuC,CAAC;AAE/C;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,qBAAqB,GAAI,CAAC,SAAS,MAAM,aAAa,mBAChD,uBAAuB,CAAC,CAAC,CAAC,UACnC,aAAa,KACpB,IAEF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/phantomRedirect/utils/broadcastPhantomEvent/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type BuildPhantomDeepLinkParams = {
|
|
2
|
+
appUrl?: string;
|
|
3
|
+
cluster?: string;
|
|
4
|
+
dappPublicKey: string;
|
|
5
|
+
method: string;
|
|
6
|
+
nonce?: string;
|
|
7
|
+
payload?: string;
|
|
8
|
+
redirectUrl: string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Builds a Phantom wallet deep link URL for wallet operations.
|
|
12
|
+
*
|
|
13
|
+
* @param params.method - The operation method (connect, signMessage, signTransaction, etc.)
|
|
14
|
+
* @param params.appUrl - Optional dApp URL shown in Phantom's UI
|
|
15
|
+
* @param params.dappPublicKey - The dApp's base58-encoded public encryption key
|
|
16
|
+
* @param params.redirectUrl - The URL to redirect back to after the operation
|
|
17
|
+
* @param params.cluster - Optional Solana cluster (mainnet-beta, devnet, testnet)
|
|
18
|
+
* @param params.payload - Optional encrypted payload for signing operations
|
|
19
|
+
* @param params.nonce - Optional nonce for encrypted payload
|
|
20
|
+
* @returns The complete Phantom deep link URL
|
|
21
|
+
*/
|
|
22
|
+
export declare const buildPhantomDeepLink: ({ appUrl, cluster, dappPublicKey, method, nonce, payload, redirectUrl, }: BuildPhantomDeepLinkParams) => URL;
|
|
23
|
+
//# sourceMappingURL=buildPhantomDeepLink.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildPhantomDeepLink.d.ts","sourceRoot":"","sources":["../../../../src/phantomRedirect/utils/buildPhantomDeepLink/buildPhantomDeepLink.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,0BAA0B,GAAG;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,oBAAoB,6EAQ9B,0BAA0B,KAAG,GAuB/B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/phantomRedirect/utils/buildPhantomDeepLink/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,YAAY,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type CleanPhantomParamsFromUrlParams = {
|
|
2
|
+
url: URL;
|
|
3
|
+
};
|
|
4
|
+
/**
|
|
5
|
+
* Removes Phantom wallet redirect parameters from a URL.
|
|
6
|
+
*
|
|
7
|
+
* This is useful for cleaning up the browser address bar after
|
|
8
|
+
* handling a Phantom redirect, removing the Phantom-specific
|
|
9
|
+
* query parameters while preserving other parameters.
|
|
10
|
+
*
|
|
11
|
+
* @param params.url - The URL to clean
|
|
12
|
+
* @returns A new URL with Phantom parameters removed
|
|
13
|
+
*/
|
|
14
|
+
export declare const cleanPhantomParamsFromUrl: ({ url, }: CleanPhantomParamsFromUrlParams) => URL;
|
|
15
|
+
//# sourceMappingURL=cleanPhantomParamsFromUrl.d.ts.map
|
package/dist/phantomRedirect/utils/cleanPhantomParamsFromUrl/cleanPhantomParamsFromUrl.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cleanPhantomParamsFromUrl.d.ts","sourceRoot":"","sources":["../../../../src/phantomRedirect/utils/cleanPhantomParamsFromUrl/cleanPhantomParamsFromUrl.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,+BAA+B,GAAG;IAC5C,GAAG,EAAE,GAAG,CAAC;CACV,CAAC;AAWF;;;;;;;;;GASG;AACH,eAAO,MAAM,yBAAyB,aAEnC,+BAA+B,KAAG,GAQpC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/phantomRedirect/utils/cleanPhantomParamsFromUrl/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,YAAY,EAAE,+BAA+B,EAAE,MAAM,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type CreateNaClSharedSecretParams = {
|
|
2
|
+
ourSecretKey: string;
|
|
3
|
+
theirPublicKey: string;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Creates a shared secret for NaCl box encryption using our secret key and their public key.
|
|
7
|
+
*
|
|
8
|
+
* @param params.ourSecretKey - Our base58-encoded secret key
|
|
9
|
+
* @param params.theirPublicKey - Their base58-encoded public key
|
|
10
|
+
* @returns The base58-encoded shared secret
|
|
11
|
+
*/
|
|
12
|
+
export declare const createNaClSharedSecret: ({ ourSecretKey, theirPublicKey, }: CreateNaClSharedSecretParams) => string;
|
|
13
|
+
//# sourceMappingURL=createNaClSharedSecret.d.ts.map
|
package/dist/phantomRedirect/utils/crypto/createNaClSharedSecret/createNaClSharedSecret.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createNaClSharedSecret.d.ts","sourceRoot":"","sources":["../../../../../src/phantomRedirect/utils/crypto/createNaClSharedSecret/createNaClSharedSecret.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,4BAA4B,GAAG;IACzC,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,sCAGhC,4BAA4B,KAAG,MAOjC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/phantomRedirect/utils/crypto/createNaClSharedSecret/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,YAAY,EAAE,4BAA4B,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type DecryptPayloadParams = {
|
|
2
|
+
data: string;
|
|
3
|
+
nonce: string;
|
|
4
|
+
sharedSecret: string;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Decrypts a payload using NaCl box encryption with a shared secret.
|
|
8
|
+
*
|
|
9
|
+
* @param params.data - The base58-encoded encrypted data
|
|
10
|
+
* @param params.nonce - The base58-encoded nonce
|
|
11
|
+
* @param params.sharedSecret - The base58-encoded shared secret
|
|
12
|
+
* @returns The decrypted payload object
|
|
13
|
+
* @throws {PhantomRedirectDecryptionError} If decryption fails
|
|
14
|
+
*/
|
|
15
|
+
export declare const decryptPayload: ({ data, nonce, sharedSecret, }: DecryptPayloadParams) => Record<string, unknown>;
|
|
16
|
+
//# sourceMappingURL=decryptPayload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decryptPayload.d.ts","sourceRoot":"","sources":["../../../../../src/phantomRedirect/utils/crypto/decryptPayload/decryptPayload.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,mCAIxB,oBAAoB,KAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAwB/C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/phantomRedirect/utils/crypto/decryptPayload/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type EncryptPayloadParams = {
|
|
2
|
+
payload: Record<string, unknown>;
|
|
3
|
+
sharedSecret: string;
|
|
4
|
+
};
|
|
5
|
+
export type EncryptedPayload = {
|
|
6
|
+
data: string;
|
|
7
|
+
nonce: string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Encrypts a payload using NaCl box encryption with a shared secret.
|
|
11
|
+
*
|
|
12
|
+
* @param params.payload - The payload object to encrypt
|
|
13
|
+
* @param params.sharedSecret - The base58-encoded shared secret
|
|
14
|
+
* @returns The encrypted data and nonce, both base58-encoded
|
|
15
|
+
*/
|
|
16
|
+
export declare const encryptPayload: ({ payload, sharedSecret, }: EncryptPayloadParams) => EncryptedPayload;
|
|
17
|
+
//# sourceMappingURL=encryptPayload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encryptPayload.d.ts","sourceRoot":"","sources":["../../../../../src/phantomRedirect/utils/crypto/encryptPayload/encryptPayload.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,oBAAoB,GAAG;IACjC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,+BAGxB,oBAAoB,KAAG,gBAezB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/phantomRedirect/utils/crypto/encryptPayload/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC"}
|