MCPcopy Create free account
hub / github.com/B3Pay/B3Wallet / loader

Function loader

scripts/load-wasm.system.ts:109–127  ·  view source on GitHub ↗
(appId: AvailableAppIds, reload: boolean)

Source from the content-addressed store, hash-verified

107}
108
109const loader = async (appId: AvailableAppIds, reload: boolean) => {
110 const app = await callSystemMethod("get_app", appId)
111
112 if ("Err" in app) {
113 const appView = await createApp(appId)
114 if ("Err" in appView) {
115 console.error("Error creating app:", appView.Err)
116 return
117 } else {
118 appId = appView.Ok.app_id as AvailableAppIds
119 console.log("App created:", appView)
120 }
121 } else {
122 appId = app.Ok.app_id as AvailableAppIds
123 console.log("App exists:", app)
124 }
125
126 await load(appId, reload)
127}
128
129type AvailableAppIds = keyof typeof dfx.canisters
130

Callers 1

Calls 2

createAppFunction · 0.85
loadFunction · 0.70

Tested by

no test coverage detected