Skip to content

Commit

Permalink
add support for a dapp generated api key (#421)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xmaayan authored Sep 13, 2024
1 parent bd54d77 commit e252fce
Show file tree
Hide file tree
Showing 8 changed files with 103 additions and 68 deletions.
7 changes: 7 additions & 0 deletions .changeset/poor-apricots-beg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@aptos-labs/wallet-adapter-react": minor
"@aptos-labs/wallet-adapter-core": minor
"@aptos-labs/wallet-adapter-nextjs-example": patch
---

Add support for a dapp generated api key
2 changes: 2 additions & 0 deletions apps/nextjs-example/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

.env

# dependencies
/node_modules
/.pnp
Expand Down
3 changes: 2 additions & 1 deletion apps/nextjs-example/src/components/WalletProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ export const WalletProvider = ({ children }: PropsWithChildren) => {
autoConnect={autoConnect}
dappConfig={{
network: Network.TESTNET,
aptosConnectDappId: "57fa42a9-29c6-4f1e-939c-4eefa36d9ff5",
aptosApiKey: process.env.NEXT_PUBLIC_APTOS_API_KEY,
aptosConnect: { dappId: "57fa42a9-29c6-4f1e-939c-4eefa36d9ff5" },
mizuwallet: {
manifestURL:
"https://assets.mz.xyz/static/config/mizuwallet-connect-manifest.json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import {
generalizedErrorMessage,
getAptosConfig,
} from "../utils";
import { DappConfig } from "../WalletCore";

export class WalletCoreV1 extends EventEmitter<WalletCoreEvents> {
async connect(wallet: Wallet) {
Expand All @@ -54,11 +55,12 @@ export class WalletCoreV1 extends EventEmitter<WalletCoreEvents> {
payloadData: InputGenerateTransactionPayloadData,
network: NetworkInfo | null,
wallet: Wallet,
transactionInput: InputTransactionData
transactionInput: InputTransactionData,
dappConfig?: DappConfig
) {
// first check if each argument is a BCS serialized argument
if (areBCSArguments(payloadData.functionArguments)) {
const aptosConfig = getAptosConfig(network);
const aptosConfig = getAptosConfig(network, dappConfig);
const newPayload = await generateTransactionPayload({
...(payloadData as InputEntryFunctionDataWithRemoteABI),
aptosConfig: aptosConfig,
Expand Down
Loading

0 comments on commit e252fce

Please sign in to comment.