@paper-clip/pc 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.js +4 -1
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -40,7 +40,10 @@ export async function getProvider() {
|
|
|
40
40
|
export async function getProgram() {
|
|
41
41
|
const provider = await getProvider();
|
|
42
42
|
anchor.setProvider(provider);
|
|
43
|
-
|
|
43
|
+
// Try npm package location first, fall back to local dev path
|
|
44
|
+
const npmIdlPath = path.resolve(__dirname, "..", "idl", "paperclip_protocol.json");
|
|
45
|
+
const devIdlPath = path.resolve(__dirname, "..", "..", "target", "idl", "paperclip_protocol.json");
|
|
46
|
+
const idlPath = fs.existsSync(npmIdlPath) ? npmIdlPath : devIdlPath;
|
|
44
47
|
const idl = JSON.parse(fs.readFileSync(idlPath, "utf8"));
|
|
45
48
|
// Override address with env-configurable PROGRAM_ID
|
|
46
49
|
idl.address = PROGRAM_ID.toBase58();
|