epistery 1.2.4 → 1.2.6
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/index.mjs +10 -9
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -207,12 +207,6 @@ class EpisteryAttach {
|
|
|
207
207
|
throw new Error('Domain name not set');
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
-
// Initialize server wallet if not already done
|
|
211
|
-
const serverWallet = Utils.InitServerWallet(this.domainName);
|
|
212
|
-
if (!serverWallet) {
|
|
213
|
-
throw new Error('Server wallet not connected');
|
|
214
|
-
}
|
|
215
|
-
|
|
216
210
|
// Get contract address from domain config
|
|
217
211
|
this.config.setPath(`/${this.domainName}`);
|
|
218
212
|
const contractAddress = this.config.data?.agent_contract_address || process.env.AGENT_CONTRACT_ADDRESS;
|
|
@@ -220,10 +214,17 @@ class EpisteryAttach {
|
|
|
220
214
|
throw new Error('Agent contract address not configured for domain');
|
|
221
215
|
}
|
|
222
216
|
|
|
223
|
-
// Get
|
|
217
|
+
// Get provider from domain config
|
|
218
|
+
const providerConfig = this.config.data?.provider;
|
|
219
|
+
if (!providerConfig || !providerConfig.rpc) {
|
|
220
|
+
throw new Error('Provider not configured for domain');
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// Create ethers provider and contract
|
|
224
224
|
const ethers = await import('ethers');
|
|
225
|
-
const
|
|
226
|
-
const
|
|
225
|
+
const provider = new ethers.providers.JsonRpcProvider(providerConfig.rpc);
|
|
226
|
+
const AgentArtifact = await import('epistery/artifacts/contracts/agent.sol/Agent.json', { with: { type: 'json' } });
|
|
227
|
+
const contract = new ethers.Contract(contractAddress, AgentArtifact.default.abi, provider);
|
|
227
228
|
|
|
228
229
|
return await contract.sponsor();
|
|
229
230
|
}
|
package/package.json
CHANGED