Skip to content

Commit b9d220d

Browse files
Allow overriding ipfsGatewayUrl in SDK Options
1 parent f741f0b commit b9d220d

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

Assets/Thirdweb/Scripts/ThirdwebSDK.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public class ThirdwebSDK
1212
public struct Options
1313
{
1414
public GaslessOptions? gasless;
15+
public string ipfsGatewayUrl;
1516
}
1617

1718
/// <summary>

Assets/WebGLTemplates/Thirdweb/lib/thirdweb.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/// --- Thirdweb Brige ---
22
import { ethers } from "./ethers.js";
3+
import { ThirdwebStorage } from "https://esm.sh/@thirdweb-dev/storage?bundle";
34
import { ThirdwebSDK } from "https://esm.sh/@thirdweb-dev/sdk?bundle";
45

56
const separator = "/";
@@ -24,7 +25,16 @@ const w = window;
2425
w.bridge = {};
2526
w.bridge.initialize = (chain, options) => {
2627
console.debug("thirdwebSDK initialization:", chain, options);
27-
const sdk = new ThirdwebSDK(chain, JSON.parse(options));
28+
const sdkOptions = JSON.parse(options);
29+
let storage = new ThirdwebStorage();
30+
if (sdkOptions && sdkOptions.ipfsGatewayUrl) {
31+
storage = new ThirdwebStorage({
32+
gatewayUrls: {
33+
"ipfs://": [sdkOptions.ipfsGatewayUrl],
34+
},
35+
});
36+
}
37+
const sdk = new ThirdwebSDK(chain, sdkOptions, storage);
2838
w.thirdweb = sdk;
2939
};
3040

0 commit comments

Comments
 (0)