Skip to content

Commit 5b8c51c

Browse files
committed
fix: allow overriding default import map
1 parent 816ae53 commit 5b8c51c

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/imports.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ export const resolveImports = async code => {
4545
const addressMap = {}
4646
const importList = extractImports(fixShorthandImports(code))
4747
for (const key in importList) {
48-
if (defaultsByName[key]) {
48+
if(importList[key] && importList[key].toLowerCase().startsWith("0x") && importList[key].length === 18) {
49+
addressMap[key] = importList[key]
50+
}else if (defaultsByName[key] && !(importList[key] && importList[key] === '"DYNAMIC"')) {
4951
addressMap[key] = defaultsByName[key]
5052
} else {
5153
const address = await getContractAddress(key)

src/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export {
2323
getScriptCode,
2424
getContractCode,
2525
getTransactionCode,
26+
defaultsByName,
2627
} from "./file"
2728
export {sendTransaction, executeScript} from "./interaction"
2829
export {getFlowBalance, mintFlow} from "./flow-token"

0 commit comments

Comments
 (0)