Skip to content

Commit

Permalink
override param
Browse files Browse the repository at this point in the history
  • Loading branch information
tian000 committed Dec 9, 2024
1 parent 546da54 commit a916f97
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/unlucky-fishes-tease.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@phantom/wallet-sdk": patch
---

Add SDK override URL parameter
4 changes: 3 additions & 1 deletion packages/sdk/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ export type CreatePhantomConfig = Partial<{
paddingTop: number
paddingLeft: number
position: Position
sdkURL: string
}>

export function createPhantom (config: CreatePhantomConfig = {}): void {
const container = document.head ?? document.documentElement
const scriptTag = document.createElement('script')

const sdkURL = new URL(SDK_URL)
const sdkURL = new URL(config.sdkURL ?? SDK_URL)
if ('zIndex' in config && config.zIndex != null) {
sdkURL.searchParams.append('zIndex', config.zIndex.toString())
}
Expand Down Expand Up @@ -60,3 +61,4 @@ export function createPhantom (config: CreatePhantomConfig = {}): void {
container.insertBefore(scriptTag, container.children[0])
container.removeChild(scriptTag)
}

0 comments on commit a916f97

Please sign in to comment.