File tree Expand file tree Collapse file tree 8 files changed +39
-19
lines changed
packages/thirdweb/src/wallets/in-app Expand file tree Collapse file tree 8 files changed +39
-19
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " thirdweb " : patch
3+ ---
4+
5+ Expose getAuthToken from inapp and ecosystem wallets
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import type { ThirdwebClient } from "../../../../client/client.js";
33import type { SupportedSmsCountry } from "../../../../react/web/wallets/in-app/supported-sms-countries.js" ;
44import type { AsyncStorage } from "../../../../utils/storage/AsyncStorage.js" ;
55import type { Prettify } from "../../../../utils/type-utils.js" ;
6+ import type { Wallet } from "../../../interfaces/wallet.js" ;
67import type { SmartWalletOptions } from "../../../smart/types.js" ;
78import type {
89 AuthOption ,
@@ -17,6 +18,14 @@ import type {
1718} from "../authentication/types.js" ;
1819import type { UserStatus } from "./enclave-wallet.js" ;
1920
21+ export type InAppWallet = Wallet < "inApp" > & {
22+ getAuthToken : ( ) => string | null ;
23+ } ;
24+
25+ export type EcosystemWallet = Wallet < EcosystemWalletId > & {
26+ getAuthToken : ( ) => string | null ;
27+ } ;
28+
2029export type Ecosystem = {
2130 id : EcosystemWalletId ;
2231 partnerId ?: string ;
Original file line number Diff line number Diff line change 11import type { ThirdwebClient } from "../../../client/client.js" ;
2- import type { Wallet } from "../../interfaces/wallet.js" ;
32import type {
43 CreateWalletArgs ,
54 EcosystemWalletId ,
65} from "../../wallet-types.js" ;
76import { createInAppWallet } from "../core/wallet/in-app-core.js" ;
7+ import type { EcosystemWallet } from "../core/wallet/types.js" ;
88
99/**
1010 * Creates an [Ecosystem Wallet](https://portal.thirdweb.com/connect/ecosystems/overview) based on various authentication methods.
@@ -63,7 +63,7 @@ import { createInAppWallet } from "../core/wallet/in-app-core.js";
6363 */
6464export function ecosystemWallet (
6565 ...args : CreateWalletArgs < EcosystemWalletId >
66- ) : Wallet < EcosystemWalletId > {
66+ ) : EcosystemWallet {
6767 const [ ecosystemId , createOptions ] = args ;
6868 const ecosystem = {
6969 id : ecosystemId ,
@@ -87,5 +87,5 @@ export function ecosystemWallet(
8787 partnerId : createOptions ?. partnerId ,
8888 } ,
8989 ecosystem,
90- } ) as Wallet < EcosystemWalletId > ;
90+ } ) as EcosystemWallet ;
9191}
Original file line number Diff line number Diff line change 11import type { ThirdwebClient } from "../../../client/client.js" ;
2- import type { Wallet } from "../../interfaces/wallet.js" ;
32import { createInAppWallet } from "../core/wallet/in-app-core.js" ;
4- import type { InAppWalletCreationOptions } from "../core/wallet/types.js" ;
3+ import type {
4+ InAppWallet ,
5+ InAppWalletCreationOptions ,
6+ } from "../core/wallet/types.js" ;
57
68/**
79 * Creates an in-app wallet.
@@ -57,7 +59,7 @@ import type { InAppWalletCreationOptions } from "../core/wallet/types.js";
5759 */
5860export function inAppWallet (
5961 createOptions ?: InAppWalletCreationOptions ,
60- ) : Wallet < "inApp" > {
62+ ) : InAppWallet {
6163 return createInAppWallet ( {
6264 connectorFactory : async ( client : ThirdwebClient ) => {
6365 const { InAppNativeConnector } = await import ( "./native-connector.js" ) ;
@@ -68,5 +70,5 @@ export function inAppWallet(
6870 } ) ;
6971 } ,
7072 createOptions,
71- } ) as Wallet < "inApp" > ;
73+ } ) as InAppWallet ;
7274}
Original file line number Diff line number Diff line change 11import type { ThirdwebClient } from "../../../client/client.js" ;
2- import type { Wallet } from "../../interfaces/wallet.js" ;
32import type {
43 CreateWalletArgs ,
54 EcosystemWalletId ,
65} from "../../wallet-types.js" ;
76import { createInAppWallet } from "../core/wallet/in-app-core.js" ;
7+ import type { EcosystemWallet } from "../core/wallet/types.js" ;
88
99/**
1010 * Creates an [Ecosystem Wallet](https://portal.thirdweb.com/connect/wallet/overview) based on various authentication methods. Full list of available authentication methods [here](/connect/wallet/sign-in-methods/configure).
@@ -53,7 +53,7 @@ import { createInAppWallet } from "../core/wallet/in-app-core.js";
5353 */
5454export function ecosystemWallet (
5555 ...args : CreateWalletArgs < EcosystemWalletId >
56- ) : Wallet < EcosystemWalletId > {
56+ ) : EcosystemWallet {
5757 const [ ecosystemId , createOptions ] = args ;
5858 const ecosystem = {
5959 id : ecosystemId ,
@@ -76,5 +76,5 @@ export function ecosystemWallet(
7676 partnerId : ecosystem . partnerId ,
7777 } ,
7878 ecosystem,
79- } ) as Wallet < EcosystemWalletId > ;
79+ } ) as EcosystemWallet ;
8080}
Original file line number Diff line number Diff line change 11import type { ThirdwebClient } from "../../../client/client.js" ;
2- import type { Wallet } from "../../interfaces/wallet.js" ;
32import { createInAppWallet } from "../core/wallet/in-app-core.js" ;
4- import type { InAppWalletCreationOptions } from "../core/wallet/types.js" ;
3+ import type {
4+ InAppWallet ,
5+ InAppWalletCreationOptions ,
6+ } from "../core/wallet/types.js" ;
57
68/**
79 * Creates an app scoped wallet for users based on various authentication methods. Full list of available authentication methods [here](https://portal.thirdweb.com/connect/wallet/sign-in-methods/configure).
@@ -302,7 +304,7 @@ import type { InAppWalletCreationOptions } from "../core/wallet/types.js";
302304 */
303305export function inAppWallet (
304306 createOptions ?: InAppWalletCreationOptions ,
305- ) : Wallet < "inApp" > {
307+ ) : InAppWallet {
306308 return createInAppWallet ( {
307309 connectorFactory : async ( client : ThirdwebClient ) => {
308310 const { InAppWebConnector } = await import ( "./lib/web-connector.js" ) ;
@@ -313,5 +315,5 @@ export function inAppWallet(
313315 } ) ;
314316 } ,
315317 createOptions,
316- } ) as Wallet < "inApp" > ;
318+ } ) as InAppWallet ;
317319}
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ describe
3838 strategy : "backend" ,
3939 walletSecret : "test-secret" ,
4040 } ) ;
41- authToken = wallet . getAuthToken ?. ( ) ;
41+ authToken = wallet . getAuthToken ( ) ;
4242 expect ( authToken ) . toBeDefined ( ) ;
4343 } ) ;
4444
@@ -59,7 +59,7 @@ describe
5959 ] ,
6060 signingOptions : {
6161 from : account . address ,
62- type : "eoa " ,
62+ type : "EOA " ,
6363 } ,
6464 } ,
6565 bodySerializer : stringify ,
@@ -69,7 +69,7 @@ describe
6969 } ,
7070 } ) ;
7171
72- const signatureResult = signResult . data ?. result ?. results [ 0 ] ;
72+ const signatureResult = signResult . data ?. result [ 0 ] ;
7373 if ( signatureResult && "result" in signatureResult ) {
7474 expect ( signatureResult . result . signature ) . toEqual ( rawSignature ) ;
7575 } else {
@@ -79,7 +79,7 @@ describe
7979 }
8080 } ) ;
8181
82- it ( "should queue a 4337 transaction" , async ( ) => {
82+ it ( "should queue a 7702 transaction" , async ( ) => {
8383 const body = {
8484 executionOptions : {
8585 chainId : sepolia . id ,
@@ -120,7 +120,7 @@ describe
120120 transactionId : txId ,
121121 } ) ;
122122
123- console . log ( tx ) ;
123+ console . log ( tx . transactionHash ) ;
124124 expect ( tx . transactionHash ) . toBeDefined ( ) ;
125125 } ) ;
126126 } ) ;
You can’t perform that action at this time.
0 commit comments