Skip to content

[wallets, react] expose onAuthSuccess callback in paperWallet #1815

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Oct 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/dirty-guests-turn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@thirdweb-dev/wallets": patch
---

add onAuthSuccess callback for paperWallet
5 changes: 5 additions & 0 deletions .changeset/metal-ants-taste.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@thirdweb-dev/react": patch
---

Add onAuthSuccess for paperWallet
2 changes: 1 addition & 1 deletion packages/react/src/wallet/wallets/paper/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export type PaperConfig = Omit<
"chain" | "clientId"
> & {
/**
* If true, the wallet will be tagged as "reccomended" in ConnectWallet Modal
* If true, the wallet will be tagged as "recomended" in ConnectWallet Modal
*/
recommended?: boolean;
};
Expand Down
4 changes: 2 additions & 2 deletions packages/wallets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@
"@magic-ext/oauth": "^7.6.2",
"@magic-sdk/provider": "^13.6.2",
"@metamask/eth-sig-util": "^4.0.0",
"@paperxyz/embedded-wallet-service-sdk": "^1.2.4",
"@paperxyz/embedded-wallet-service-sdk": "^1.2.5",
"@paperxyz/sdk-common-utilities": "^0.1.0",
"@safe-global/safe-core-sdk": "^3.3.4",
"@safe-global/safe-ethers-adapters": "0.1.0-alpha.17",
Expand Down Expand Up @@ -455,8 +455,8 @@
"ethereum-provider": "^0.7.7",
"ethers": "^5.7.2",
"ethers-aws-kms-signer": "^1.3.2",
"tweetnacl": "^1.0.3",
"rimraf": "^3.0.2",
"tweetnacl": "^1.0.3",
"typedoc": "^0.25.2",
"typescript": "^5.1.6"
},
Expand Down
1 change: 1 addition & 0 deletions packages/wallets/src/evm/connectors/paper/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export class PaperWalletConnector extends Connector<Record<string, never>> {
clientId: this.options.clientId,
chain: "Ethereum",
styles: this.options.styles,
onAuthSuccess: this.options.onAuthSuccess,
}),
);
} catch (err) {
Expand Down
3 changes: 3 additions & 0 deletions packages/wallets/src/evm/connectors/paper/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type {
AuthAndWalletRpcReturnType,
PaperConstructorType,
RecoveryShareManagement,
} from "@paperxyz/embedded-wallet-service-sdk";
Expand All @@ -14,6 +15,7 @@ export type PaperWalletAdditionalOptions = {
styles?: PaperConstructorType<RecoveryShareManagement>["styles"];
paperClientId?: string;
clientId?: string;
onAuthSuccess?: (authResult: AuthAndWalletRpcReturnType) => void;
};

export interface PaperWalletConnectorOptions {
Expand All @@ -22,6 +24,7 @@ export interface PaperWalletConnectorOptions {
chains: Chain[];
advancedOptions?: PaperAdvanceOptions;
styles?: PaperConstructorType<RecoveryShareManagement>["styles"];
onAuthSuccess?: (authResult: AuthAndWalletRpcReturnType) => void;
}

export interface PaperWalletConnectionArgs {
Expand Down
3 changes: 3 additions & 0 deletions packages/wallets/src/evm/wallets/paper-wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export class PaperWallet extends AbstractClientWallet<

paperClientId: string;
chain: PaperWalletAdditionalOptions_["chain"];
onAuthSuccess: PaperWalletAdditionalOptions_["onAuthSuccess"];

constructor(options: PaperWalletOptions) {
super(PaperWallet.id, {
Expand Down Expand Up @@ -84,6 +85,7 @@ export class PaperWallet extends AbstractClientWallet<

// cast is okay because we assert that either clientId or paperClientId is defined above
this.paperClientId = (options.paperClientId ?? options.clientId) as string;
this.onAuthSuccess = options.onAuthSuccess;
}
private isClientIdLegacyPaper(clientId: string): boolean {
return clientId.indexOf("-") > 0 && clientId.length === 36;
Expand All @@ -96,6 +98,7 @@ export class PaperWallet extends AbstractClientWallet<
clientId: this.paperClientId,
chain: this.chain,
chains: this.chains,
onAuthSuccess: this.onAuthSuccess,
advancedOptions: {
recoveryShareManagement:
this.options?.advancedOptions?.recoveryShareManagement,
Expand Down
109 changes: 30 additions & 79 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.