@augustdigital/sdk 5.1.1 → 7.0.0
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/lib/adapters/evm/getters.d.ts +1 -1
- package/lib/adapters/evm/getters.js +14 -19
- package/lib/adapters/evm/index.d.ts +8 -1
- package/lib/adapters/evm/index.js +24 -0
- package/lib/adapters/solana/index.d.ts +4 -4
- package/lib/adapters/solana/utils.d.ts +5 -4
- package/lib/adapters/solana/utils.js +82 -45
- package/lib/adapters/solana/vault.actions.d.ts +2 -2
- package/lib/adapters/solana/vault.actions.js +112 -74
- package/lib/adapters/stellar/actions.js +3 -2
- package/lib/adapters/stellar/constants.d.ts +2 -0
- package/lib/adapters/stellar/constants.js +3 -1
- package/lib/adapters/stellar/getters.js +2 -2
- package/lib/adapters/stellar/soroban.js +19 -8
- package/lib/adapters/stellar/submit.js +16 -6
- package/lib/adapters/stellar/utils.d.ts +2 -1
- package/lib/adapters/stellar/utils.js +7 -15
- package/lib/adapters/sui/utils.d.ts +1 -1
- package/lib/adapters/sui/utils.js +3 -7
- package/lib/core/analytics/chain-name.d.ts +1 -0
- package/lib/core/analytics/chain-name.js +26 -0
- package/lib/core/analytics/env.d.ts +4 -0
- package/lib/core/analytics/env.js +33 -0
- package/lib/core/analytics/index.d.ts +6 -2
- package/lib/core/analytics/index.js +16 -1
- package/lib/core/analytics/instrumentation.js +56 -48
- package/lib/core/analytics/method-taxonomy.d.ts +3 -0
- package/lib/core/analytics/method-taxonomy.js +82 -0
- package/lib/core/analytics/metrics.js +18 -42
- package/lib/core/analytics/sanitize.d.ts +1 -0
- package/lib/core/analytics/sanitize.js +34 -0
- package/lib/core/analytics/sentry-runtime.d.ts +4 -0
- package/lib/core/analytics/sentry-runtime.js +78 -0
- package/lib/core/analytics/sentry.d.ts +7 -1
- package/lib/core/analytics/sentry.js +107 -51
- package/lib/core/analytics/types.d.ts +2 -0
- package/lib/core/analytics/version.d.ts +1 -0
- package/lib/core/analytics/version.js +5 -0
- package/lib/core/base.class.d.ts +2 -1
- package/lib/core/base.class.js +5 -1
- package/lib/core/cache.d.ts +4 -0
- package/lib/core/cache.js +25 -0
- package/lib/core/constants/web3.js +1 -1
- package/lib/core/fetcher.d.ts +4 -4
- package/lib/core/fetcher.js +49 -60
- package/lib/core/helpers/chain-address.d.ts +3 -0
- package/lib/core/helpers/chain-address.js +36 -0
- package/lib/core/helpers/explorer-link.d.ts +2 -0
- package/lib/core/helpers/explorer-link.js +11 -0
- package/lib/core/helpers/vault-version.d.ts +4 -0
- package/lib/core/helpers/vault-version.js +59 -0
- package/lib/core/helpers/vaults.d.ts +3 -4
- package/lib/core/helpers/vaults.js +12 -62
- package/lib/core/helpers/web3.d.ts +6 -6
- package/lib/core/helpers/web3.js +142 -79
- package/lib/core/logger/slack.js +2 -2
- package/lib/core/vault-metadata.d.ts +6 -0
- package/lib/core/vault-metadata.js +36 -0
- package/lib/evm/methods/crossChainVault.js +72 -16
- package/lib/evm/types/crossChain.d.ts +4 -0
- package/lib/evm/types/crossChain.js +6 -0
- package/lib/modules/vaults/fetcher.d.ts +1 -6
- package/lib/modules/vaults/fetcher.js +27 -36
- package/lib/modules/vaults/getters.d.ts +1 -1
- package/lib/modules/vaults/getters.js +3 -2
- package/lib/modules/vaults/read.actions.d.ts +27 -0
- package/lib/modules/vaults/read.actions.js +220 -0
- package/lib/modules/vaults/utils/date-utils.js +1 -2
- package/lib/modules/vaults/utils.js +57 -36
- package/lib/modules/vaults/write.actions.d.ts +35 -2
- package/lib/modules/vaults/write.actions.js +254 -94
- package/package.json +5 -2
|
@@ -528,51 +528,72 @@ async function generatePermitSignature(token, owner, spender, value, deadline, s
|
|
|
528
528
|
provider: signer,
|
|
529
529
|
abi: abis_1.ABI_TOKENIZED_VAULT_V2_RECEIPT,
|
|
530
530
|
});
|
|
531
|
-
const
|
|
532
|
-
|
|
533
|
-
|
|
531
|
+
const noncePromise = tokenContract.nonces(owner);
|
|
532
|
+
const domainSeparatorPromise = (async () => {
|
|
533
|
+
try {
|
|
534
|
+
return await tokenContract.DOMAIN_SEPARATOR();
|
|
535
|
+
}
|
|
536
|
+
catch (error) {
|
|
537
|
+
core_1.Logger.log.error('generatePermitSignature', error, {
|
|
538
|
+
message: 'Could not fetch DOMAIN_SEPARATOR from contract',
|
|
539
|
+
});
|
|
540
|
+
throw error;
|
|
541
|
+
}
|
|
542
|
+
})();
|
|
543
|
+
const [nonce, contractDomainSeparator] = await Promise.all([
|
|
544
|
+
noncePromise,
|
|
545
|
+
domainSeparatorPromise,
|
|
534
546
|
]);
|
|
535
547
|
const valueBigInt = typeof value === 'string' ? BigInt(value) : value;
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
contractDomainSeparator = await tokenContract.DOMAIN_SEPARATOR();
|
|
539
|
-
}
|
|
540
|
-
catch (error) {
|
|
541
|
-
console.error('Could not fetch DOMAIN_SEPARATOR from contract');
|
|
542
|
-
throw error;
|
|
543
|
-
}
|
|
544
|
-
const domainConfigs = [
|
|
545
|
-
{ name, version: '1', chainId, verifyingContract: token },
|
|
546
|
-
{ name, version: '2', chainId, verifyingContract: token },
|
|
547
|
-
{ name, chainId, verifyingContract: token },
|
|
548
|
-
{
|
|
549
|
-
name,
|
|
550
|
-
version: '1',
|
|
551
|
-
chainId,
|
|
552
|
-
verifyingContract: token,
|
|
553
|
-
salt: ethers_1.ethers.zeroPadValue('0x', 32),
|
|
554
|
-
},
|
|
555
|
-
];
|
|
548
|
+
const permitDomainCacheKey = `permit-domain-${chainId}-${token.toLowerCase()}`;
|
|
549
|
+
const cachedDomain = core_1.CACHE.get(permitDomainCacheKey);
|
|
556
550
|
let matchingDomain = null;
|
|
557
|
-
|
|
558
|
-
const
|
|
559
|
-
if (
|
|
560
|
-
matchingDomain =
|
|
561
|
-
|
|
551
|
+
if (cachedDomain) {
|
|
552
|
+
const cachedHash = ethers_1.ethers.TypedDataEncoder.hashDomain(cachedDomain);
|
|
553
|
+
if (cachedHash.toLowerCase() === contractDomainSeparator.toLowerCase()) {
|
|
554
|
+
matchingDomain = cachedDomain;
|
|
555
|
+
}
|
|
556
|
+
else {
|
|
557
|
+
core_1.CACHE.delete(permitDomainCacheKey);
|
|
562
558
|
}
|
|
563
559
|
}
|
|
564
560
|
if (!matchingDomain) {
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
561
|
+
const name = (await tokenContract.name());
|
|
562
|
+
const domainConfigs = [
|
|
563
|
+
{ name, version: '1', chainId, verifyingContract: token },
|
|
564
|
+
{ name, version: '2', chainId, verifyingContract: token },
|
|
565
|
+
{ name, chainId, verifyingContract: token },
|
|
566
|
+
{
|
|
567
|
+
name,
|
|
568
|
+
version: '1',
|
|
569
|
+
chainId,
|
|
570
|
+
verifyingContract: token,
|
|
571
|
+
salt: ethers_1.ethers.zeroPadValue('0x', 32),
|
|
572
|
+
},
|
|
573
|
+
];
|
|
574
|
+
for (const domain of domainConfigs) {
|
|
575
|
+
const computed = ethers_1.ethers.TypedDataEncoder.hashDomain(domain);
|
|
576
|
+
if (computed.toLowerCase() === contractDomainSeparator.toLowerCase()) {
|
|
577
|
+
matchingDomain = domain;
|
|
578
|
+
break;
|
|
571
579
|
}
|
|
572
580
|
}
|
|
573
|
-
|
|
574
|
-
|
|
581
|
+
if (!matchingDomain) {
|
|
582
|
+
try {
|
|
583
|
+
const version = await tokenContract.version();
|
|
584
|
+
matchingDomain = { name, version, chainId, verifyingContract: token };
|
|
585
|
+
const computed = ethers_1.ethers.TypedDataEncoder.hashDomain(matchingDomain);
|
|
586
|
+
if (computed.toLowerCase() !== contractDomainSeparator.toLowerCase()) {
|
|
587
|
+
throw new Error('Could not match DOMAIN_SEPARATOR even with contract version');
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
catch {
|
|
591
|
+
throw new Error(`Could not determine correct domain configuration. Contract DOMAIN_SEPARATOR: ${contractDomainSeparator}`);
|
|
592
|
+
}
|
|
575
593
|
}
|
|
594
|
+
core_1.CACHE.set(permitDomainCacheKey, matchingDomain, {
|
|
595
|
+
ttl: 60 * 60 * 1000,
|
|
596
|
+
});
|
|
576
597
|
}
|
|
577
598
|
const types = {
|
|
578
599
|
Permit: [
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Signer, Wallet } from 'ethers';
|
|
1
|
+
import { Signer, Wallet, TransactionResponse } from 'ethers';
|
|
2
2
|
import { IAddress } from '../../types';
|
|
3
3
|
export type IContractWriteOptions = {
|
|
4
4
|
target: IAddress;
|
|
@@ -17,7 +17,40 @@ export type INativeDepositOptions = {
|
|
|
17
17
|
amount: string | bigint | number;
|
|
18
18
|
wait?: boolean;
|
|
19
19
|
};
|
|
20
|
-
export declare function
|
|
20
|
+
export declare function safeBigInt(value: unknown, context?: string): bigint;
|
|
21
|
+
export declare function resolveDepositTokenDecimals(args: {
|
|
22
|
+
actualDepositAsset: IAddress;
|
|
23
|
+
underlyingAsset: IAddress;
|
|
24
|
+
isNativeToken: boolean;
|
|
25
|
+
isMultiAssetVault: boolean;
|
|
26
|
+
vaultDecimals: number;
|
|
27
|
+
readErc20Decimals: (address: IAddress) => Promise<number>;
|
|
28
|
+
}): Promise<number>;
|
|
29
|
+
export declare function resolveSpender(args: {
|
|
30
|
+
target: IAddress;
|
|
31
|
+
isMultiAssetVault: boolean;
|
|
32
|
+
isAdapterDeposit: boolean;
|
|
33
|
+
adapterWrapperAddress?: IAddress;
|
|
34
|
+
}): IAddress;
|
|
35
|
+
export declare function validateAmountPrecision(amount: string | bigint | number): void;
|
|
36
|
+
export declare function isNonceParsing(error: unknown): boolean;
|
|
37
|
+
export declare function safeWaitForTx(tx: TransactionResponse): Promise<import("ethers").TransactionReceipt>;
|
|
38
|
+
export declare function safeSendTx(contractCall: () => Promise<TransactionResponse>, provider: Signer | Wallet, shouldWait?: boolean): Promise<{
|
|
39
|
+
tx: TransactionResponse | null;
|
|
40
|
+
hash: string;
|
|
41
|
+
}>;
|
|
42
|
+
export declare function tryRecoverTxHash(error: unknown, signer: Signer | Wallet, wait?: boolean): Promise<string | null>;
|
|
43
|
+
export type ApproveResult = {
|
|
44
|
+
kind: 'sent';
|
|
45
|
+
hash: string;
|
|
46
|
+
} | {
|
|
47
|
+
kind: 'sufficient';
|
|
48
|
+
existing: bigint;
|
|
49
|
+
} | {
|
|
50
|
+
kind: 'native';
|
|
51
|
+
};
|
|
52
|
+
export declare function vaultApprove(signer: Signer | Wallet, options: IContractWriteOptions): Promise<string | undefined>;
|
|
53
|
+
export declare function approve(signer: Signer | Wallet, options: IContractWriteOptions): Promise<ApproveResult>;
|
|
21
54
|
export declare function vaultDeposit(signer: Signer | Wallet, options: IContractWriteOptions): Promise<string>;
|
|
22
55
|
export declare function vaultRequestRedeem(signer: Signer | Wallet, options: IContractWriteOptions): Promise<string>;
|
|
23
56
|
export declare function vaultRedeem(signer: Signer | Wallet, options: IContractWriteOptions & {
|