Skip to content

Commit

Permalink
Fix crossmint api calls
Browse files Browse the repository at this point in the history
  • Loading branch information
0xaguspunk committed Dec 18, 2024
1 parent 9d12cb6 commit 0927d9c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
5 changes: 5 additions & 0 deletions typescript/.changeset/weak-books-wonder.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@goat-sdk/crossmint": patch
---

Add content type to API calls
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,19 @@ export class CrossmintFaucetService {

const options = {
method: "POST",
headers: this.client.authHeaders,
headers: {
...this.client.authHeaders,
"Content-Type": "application/json",
},
body: JSON.stringify({
amount: parameters.amount,
amount: 10,
currency: "usdc",
chain,
}),
};

console.log("options", options);

const response = await fetch(
`${this.client.baseUrl}/api/v1-alpha2/wallets/${resolvedWalletAddress}/balances`,
options,
Expand Down
15 changes: 12 additions & 3 deletions typescript/packages/wallets/crossmint/src/plugins/mint.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ export class CrossmintMintService {
...parameters,
chain: getCrossmintChainString(walletClient.getChain()),
}),
headers: this.client.authHeaders,
headers: {
...this.client.authHeaders,
"Content-Type": "application/json",
},
});

const result = await response.json();
Expand All @@ -44,7 +47,10 @@ export class CrossmintMintService {
})
async getAllCollections(walletClient: EVMWalletClient, parameters: GetAllCollectionsParameters) {
const response = await fetch(`${this.client.baseUrl}/collections/`, {
headers: this.client.authHeaders,
headers: {
...this.client.authHeaders,
"Content-Type": "application/json",
},
});

return await response.json();
Expand Down Expand Up @@ -101,7 +107,10 @@ export class CrossmintMintService {
while (true) {
attempts++;
const response = await fetch(`${this.client.baseUrl}/api/2022-06-09/actions/${actionId}`, {
headers: this.client.authHeaders,
headers: {
...this.client.authHeaders,
"Content-Type": "application/json",
},
});

const body = await response.json();
Expand Down

0 comments on commit 0927d9c

Please sign in to comment.