@veridex/sdk 1.0.0-beta.3 → 1.0.0-beta.4
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/chains/aptos/index.d.mts +7 -2
- package/dist/chains/aptos/index.d.ts +7 -2
- package/dist/chains/aptos/index.js +21 -7
- package/dist/chains/aptos/index.js.map +1 -1
- package/dist/chains/aptos/index.mjs +21 -7
- package/dist/chains/aptos/index.mjs.map +1 -1
- package/dist/index.js +21 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3852,27 +3852,41 @@ var AptosClient = class {
|
|
|
3852
3852
|
targetChain
|
|
3853
3853
|
};
|
|
3854
3854
|
}
|
|
3855
|
+
/**
|
|
3856
|
+
* Get vault address from on-chain VaultRegistry.
|
|
3857
|
+
* Queries the get_vault_address view function which looks up the vault in the registry.
|
|
3858
|
+
*/
|
|
3855
3859
|
async getVaultAddress(userKeyHash) {
|
|
3856
3860
|
try {
|
|
3857
|
-
const
|
|
3858
|
-
const
|
|
3859
|
-
|
|
3861
|
+
const keyHashBytes = this.hexToBytes(userKeyHash.replace("0x", "").padStart(64, "0"));
|
|
3862
|
+
const payload = {
|
|
3863
|
+
function: `${this.moduleAddress}::veridex_spoke::get_vault_address`,
|
|
3864
|
+
type_arguments: [],
|
|
3865
|
+
arguments: [Array.from(keyHashBytes)]
|
|
3866
|
+
};
|
|
3867
|
+
const response = await this.client.view(payload);
|
|
3868
|
+
if (response && response.length > 0) {
|
|
3869
|
+
const vaultAddress = response[0];
|
|
3860
3870
|
return vaultAddress;
|
|
3861
3871
|
}
|
|
3862
3872
|
return null;
|
|
3863
3873
|
} catch (error) {
|
|
3864
|
-
if (error?.status === 404) {
|
|
3874
|
+
if (error?.message?.includes("E_VAULT_NOT_FOUND") || error?.message?.includes("error code 6") || error?.status === 404) {
|
|
3865
3875
|
return null;
|
|
3866
3876
|
}
|
|
3867
|
-
console.error("Error getting vault address:", error);
|
|
3877
|
+
console.error("Error getting vault address from registry:", error);
|
|
3868
3878
|
return null;
|
|
3869
3879
|
}
|
|
3870
3880
|
}
|
|
3871
3881
|
/**
|
|
3872
|
-
*
|
|
3873
|
-
* On Aptos, vaults are
|
|
3882
|
+
* @deprecated Use getVaultAddress() instead - this method uses incorrect address derivation.
|
|
3883
|
+
* On Aptos, vaults are created as named objects by the relayer, not resource accounts.
|
|
3884
|
+
* The vault address depends on which relayer created it, so must be queried on-chain.
|
|
3874
3885
|
*/
|
|
3875
3886
|
computeVaultAddress(userKeyHash) {
|
|
3887
|
+
console.warn(
|
|
3888
|
+
"computeVaultAddress() is deprecated for Aptos. Use getVaultAddress() to query the on-chain VaultRegistry instead."
|
|
3889
|
+
);
|
|
3876
3890
|
return this.computeVaultAddressFromHash(userKeyHash);
|
|
3877
3891
|
}
|
|
3878
3892
|
computeVaultAddressFromHash(userKeyHash) {
|