@ledgerhq/revault-api 1.29.3 → 1.30.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/{app-types-mEeONvZb.d.mts → app-types-BYy5kDRL.d.mts} +2406 -2110
- package/lib/fakes.d.mts +201 -183
- package/lib/fakes.mjs +261 -278
- package/lib/fakes.mjs.map +1 -1
- package/lib/index.d.mts +771 -616
- package/package.json +2 -2
package/lib/fakes.mjs
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { faker } from '@faker-js/faker';
|
|
2
|
-
import z5, { z } from 'zod';
|
|
3
2
|
import { ChallengeType, PsdModel, AccountType, AccountGovernanceType, ActivationStatus, WhitelistType, UserRole, UserRegistrationState, AdminPermission, RequestType, RequestReviewStatus, RequestState, GateAccountType } from '@prisma/client';
|
|
3
|
+
import z5, { z } from 'zod';
|
|
4
4
|
import 'axios';
|
|
5
5
|
import invariant from 'invariant';
|
|
6
6
|
import { omit, times } from 'lodash';
|
|
7
7
|
import 'crypto';
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
var __defProp = Object.defineProperty;
|
|
10
|
+
var __export = (target, all) => {
|
|
11
|
+
for (var name in all)
|
|
12
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
13
|
+
};
|
|
10
14
|
|
|
11
15
|
// src/errors.ts
|
|
12
16
|
var ValidationError = class extends Error {
|
|
@@ -36,8 +40,6 @@ var zHexString = z.string().regex(/^[0-9a-fA-F]+$/);
|
|
|
36
40
|
var zIntString = z.string().nonempty().regex(/^(-?[1-9]\d*|0)$/);
|
|
37
41
|
var zUnsignedIntString = z.string().nonempty().regex(/^([1-9]\d*|0)$/);
|
|
38
42
|
var zCurrency = z.string().nonempty().max(40).regex(/^\w+$/).describe("Currency");
|
|
39
|
-
|
|
40
|
-
// src/hsm/types.ts
|
|
41
43
|
var zHsmObjectId = z.string().regex(/^[\w-]+$/).min(1);
|
|
42
44
|
var zPubKey = zHexString.describe("Public key");
|
|
43
45
|
var zHsmCertificate = z.object({
|
|
@@ -221,6 +223,11 @@ z5.discriminatedUnion("type", [
|
|
|
221
223
|
priorityFees: zIntString
|
|
222
224
|
})
|
|
223
225
|
]);
|
|
226
|
+
var zMessageType = z5.enum(["EIP191", "EIP712"]);
|
|
227
|
+
var zMessage = z5.object({
|
|
228
|
+
type: zMessageType.describe("Type of the message to sign"),
|
|
229
|
+
data: zHexString.nonempty().describe("Hex data to sign, either a json string for EIP712, or a raw string for EIP191")
|
|
230
|
+
});
|
|
224
231
|
|
|
225
232
|
// src/transactions/request-data.ts
|
|
226
233
|
var zHexDataString = z5.string().regex(/^(?:0x|0X)?[a-fA-F0-9]+$/).transform((hex) => `0x${hex.toLowerCase().replace("0x", "")}`);
|
|
@@ -549,12 +556,20 @@ var zCreateTransactionRequestData = z5.object({
|
|
|
549
556
|
transaction: zTransactionData
|
|
550
557
|
});
|
|
551
558
|
var zSignMessageRequestData = z5.object({
|
|
559
|
+
message: zMessage.describe("Message to sign"),
|
|
552
560
|
accountId: z5.string().min(1).describe("Target account id"),
|
|
553
|
-
|
|
554
|
-
|
|
561
|
+
address: z5.string().nonempty().describe("Address with which to sign the message"),
|
|
562
|
+
derivationPath: z5.string().nonempty().describe("Derivation path of the signing address")
|
|
563
|
+
});
|
|
564
|
+
var zSignMessageUserInputData = zSignMessageRequestData.partial({
|
|
565
|
+
address: true,
|
|
566
|
+
derivationPath: true
|
|
555
567
|
});
|
|
556
568
|
z5.object({
|
|
557
|
-
|
|
569
|
+
// Populated after input data is validated.
|
|
570
|
+
govRuleHsmId: zHsmObjectId.optional(),
|
|
571
|
+
// Populated after request is executed -- it holds the message-signing result.
|
|
572
|
+
signature: zHsmSignature.optional()
|
|
558
573
|
});
|
|
559
574
|
var zDigestData = z5.object({
|
|
560
575
|
digest: zHexString.describe("The hex string digest to sign"),
|
|
@@ -567,6 +582,24 @@ var zSignDigestsRequestData = z5.object({
|
|
|
567
582
|
z5.object({
|
|
568
583
|
signatures: z5.array(zHsmSignature)
|
|
569
584
|
});
|
|
585
|
+
var zValueTransactionOperationType = z.enum([
|
|
586
|
+
"SEND",
|
|
587
|
+
"STAKE",
|
|
588
|
+
"DEPLOY_CONTRACT",
|
|
589
|
+
"EXECUTE_CONTRACT",
|
|
590
|
+
"ACTIVATE_TOKEN"
|
|
591
|
+
]);
|
|
592
|
+
var zValueTransactionOperation = z.object({
|
|
593
|
+
type: zValueTransactionOperationType,
|
|
594
|
+
currency: zCurrency,
|
|
595
|
+
recipient: z.string().nonempty(),
|
|
596
|
+
destinationTag: z.string().nonempty().optional(),
|
|
597
|
+
value: zUnsignedIntString
|
|
598
|
+
});
|
|
599
|
+
var zSigningOperationType = z.enum(["SIGN_MESSAGE", "SIGN_DIGESTS"]);
|
|
600
|
+
var zSigningOperation = z.object({
|
|
601
|
+
type: zSigningOperationType
|
|
602
|
+
});
|
|
570
603
|
var zClassicOperationType = z.enum([
|
|
571
604
|
"SEND",
|
|
572
605
|
"STAKE",
|
|
@@ -575,7 +608,15 @@ var zClassicOperationType = z.enum([
|
|
|
575
608
|
"SIGN_MESSAGE",
|
|
576
609
|
"ACTIVATE_TOKEN"
|
|
577
610
|
]);
|
|
578
|
-
|
|
611
|
+
z.enum(["SIGN_DIGESTS"]);
|
|
612
|
+
var zOperationType = z.enum([
|
|
613
|
+
...zValueTransactionOperationType.options,
|
|
614
|
+
...zSigningOperationType.options
|
|
615
|
+
]);
|
|
616
|
+
z.discriminatedUnion("type", [
|
|
617
|
+
zValueTransactionOperation,
|
|
618
|
+
zSigningOperation
|
|
619
|
+
]);
|
|
579
620
|
var zNote = z5.object({
|
|
580
621
|
title: z5.string().describe("Request note title"),
|
|
581
622
|
content: z5.string().describe("Request note content")
|
|
@@ -661,125 +702,6 @@ z5.discriminatedUnion(
|
|
|
661
702
|
zTransactionResponse.options.map((_) => _.extend({ note: zNote.nullable() }))
|
|
662
703
|
)
|
|
663
704
|
);
|
|
664
|
-
var zCardanoLikeStakingData = z5.object({
|
|
665
|
-
staked: z5.string().describe("Staked balance")
|
|
666
|
-
}).nullable().describe("Cardano-like staking data");
|
|
667
|
-
var zCardanoLikeStakingFields = z5.object({
|
|
668
|
-
type: z5.literal(AccountType.CARDANO_LIKE).describe("Account type"),
|
|
669
|
-
staking: zCardanoLikeStakingData.optional()
|
|
670
|
-
});
|
|
671
|
-
var zEthereumLikeStakingData = z5.object({
|
|
672
|
-
totalStaking: z5.string().describe("Total staked amount"),
|
|
673
|
-
totalRewards: z5.string().describe("Total of rewards"),
|
|
674
|
-
availableRewards: z5.string().describe("Available rewards"),
|
|
675
|
-
networkApy: z5.number().describe("Network APY")
|
|
676
|
-
}).nullable().describe("Ethereum-like staking data");
|
|
677
|
-
var zEthereumLikeStakingFields = z5.object({
|
|
678
|
-
type: z5.literal(AccountType.ETHEREUM_LIKE).describe("Account type"),
|
|
679
|
-
staking: zEthereumLikeStakingData.optional()
|
|
680
|
-
});
|
|
681
|
-
var zPolkadotUnbondingAmount = z5.object({
|
|
682
|
-
amount: z5.string().describe("Amount"),
|
|
683
|
-
waiting_time: z5.string().describe("Waiting time")
|
|
684
|
-
});
|
|
685
|
-
var zPolkadotLikeStakingData = z5.object({
|
|
686
|
-
info: z5.object({
|
|
687
|
-
controllerAddress: z5.string().nullable().describe("Controller address"),
|
|
688
|
-
rewardsDestination: z5.string().nullable().describe("Rewards destination"),
|
|
689
|
-
proxies: z5.array(z5.string()).describe("Proxies"),
|
|
690
|
-
legacyStaking: z5.boolean().describe("True if account uses legacy staking"),
|
|
691
|
-
isNominator: z5.boolean().describe("True if is nominator")
|
|
692
|
-
}),
|
|
693
|
-
balances: z5.object({
|
|
694
|
-
free: z5.string().describe("Free balance"),
|
|
695
|
-
reserved: z5.string().describe("Reserved balance"),
|
|
696
|
-
frozen: z5.string().describe("Frozen balance"),
|
|
697
|
-
bonded: z5.string().describe("Bonded balance"),
|
|
698
|
-
available: z5.string().describe("Available balance"),
|
|
699
|
-
unbonding: z5.array(zPolkadotUnbondingAmount).describe("Unbonding balances"),
|
|
700
|
-
unbonded: z5.array(zPolkadotUnbondingAmount).describe("Unbonded balances"),
|
|
701
|
-
totalUnbonding: z5.string().describe("Total unbonding"),
|
|
702
|
-
totalUnbonded: z5.string().describe("Total unbonded")
|
|
703
|
-
}),
|
|
704
|
-
anonymousProxy: z5.object({
|
|
705
|
-
address: z5.string().describe("Address"),
|
|
706
|
-
createdAt: z5.string().describe("Creation date"),
|
|
707
|
-
isController: z5.boolean().describe("True if is controller"),
|
|
708
|
-
isMain: z5.boolean().describe("True if is main"),
|
|
709
|
-
balances: z5.object({
|
|
710
|
-
free: z5.string().describe("Anonymous proxy free balance"),
|
|
711
|
-
reserved: z5.string().describe("Anonymous proxy reserved balance"),
|
|
712
|
-
frozen: z5.string().describe("Anonymous proxy frozen balance"),
|
|
713
|
-
bonded: z5.string().describe("Anonymous proxy bonded balance"),
|
|
714
|
-
available: z5.string().describe("Anonymous proxy available balance"),
|
|
715
|
-
total: z5.string().describe("Anonymous proxy total balance")
|
|
716
|
-
}).nullable(),
|
|
717
|
-
blockHeight: z5.string().describe("Anonymous proxy block height"),
|
|
718
|
-
extIndex: z5.string().describe("Ext index"),
|
|
719
|
-
index: z5.string().describe("Index"),
|
|
720
|
-
kind: z5.string().describe("Kind")
|
|
721
|
-
}).nullable().describe("Anonymous proxy")
|
|
722
|
-
}).nullable().describe("Polkadot-like staking data");
|
|
723
|
-
var zPolkadotLikeStakingFields = z5.object({
|
|
724
|
-
type: z5.literal(AccountType.POLKADOT_LIKE).describe("Account type"),
|
|
725
|
-
staking: zPolkadotLikeStakingData.optional()
|
|
726
|
-
});
|
|
727
|
-
var zSolanaStakingAccountStatus = z5.enum(["not_sync", "activating", "activated", "deactivating", "deactivated", "deleted"]).describe("Staking account status");
|
|
728
|
-
var zSolanaLikeStakingData = z5.object({
|
|
729
|
-
staked: z5.string().describe("Staked balance"),
|
|
730
|
-
rewards: z5.object({
|
|
731
|
-
total: z5.string().describe("Total rewards"),
|
|
732
|
-
last7: z5.string().describe("Rewards on last 7 days"),
|
|
733
|
-
last30: z5.string().describe("Rewards on last 30 days")
|
|
734
|
-
}),
|
|
735
|
-
stakes: z5.array(
|
|
736
|
-
z5.object({
|
|
737
|
-
uid: z5.string(),
|
|
738
|
-
baseAccountUid: z5.string(),
|
|
739
|
-
pubKey: z5.string().describe("Public key"),
|
|
740
|
-
validatorPubKey: z5.string().nullable().describe("Validator public key"),
|
|
741
|
-
initialAmount: z5.string().describe("Initial amount"),
|
|
742
|
-
activeAmount: z5.string().describe("Active amount"),
|
|
743
|
-
inactiveAmount: z5.string().describe("Inactive amount"),
|
|
744
|
-
totalBalance: z5.string().describe("Total balance"),
|
|
745
|
-
creationDate: z5.string().describe("Creation date"),
|
|
746
|
-
activationEpoch: z5.string().nullable().describe("Activation epoch"),
|
|
747
|
-
activationDate: z5.string().nullable().describe("Activation date"),
|
|
748
|
-
deactivationEpoch: z5.string().nullable().describe("Deactivation epoch"),
|
|
749
|
-
deactivationDate: z5.string().nullable().describe("Deactivation date"),
|
|
750
|
-
status: zSolanaStakingAccountStatus,
|
|
751
|
-
rentExemptReserve: z5.string().describe("Rent exempt reserve"),
|
|
752
|
-
withdrawableAmount: z5.string().describe("Withdrawable amount"),
|
|
753
|
-
totalRewards: z5.string().describe("Total rewards"),
|
|
754
|
-
creationTxHash: z5.string().nullable().describe("Creation transaction hash"),
|
|
755
|
-
actionsTxHashes: z5.array(z5.string()).describe("Actions transactions hashes")
|
|
756
|
-
})
|
|
757
|
-
)
|
|
758
|
-
}).nullable().describe("Solana-like staking data");
|
|
759
|
-
var zSolanaLikeStakingFields = z5.object({
|
|
760
|
-
type: z5.literal(AccountType.SOLANA_LIKE).describe("Account type"),
|
|
761
|
-
staking: zSolanaLikeStakingData.optional()
|
|
762
|
-
});
|
|
763
|
-
var zTezosLikeStakingData = z5.object({
|
|
764
|
-
delegations: z5.array(
|
|
765
|
-
z5.object({
|
|
766
|
-
address: z5.string()
|
|
767
|
-
})
|
|
768
|
-
)
|
|
769
|
-
}).nullable().describe("Tezos-like staking data");
|
|
770
|
-
var zTezosLikeStakingFields = z5.object({
|
|
771
|
-
type: z5.literal(AccountType.TEZOS_LIKE).describe("Account type"),
|
|
772
|
-
staking: zTezosLikeStakingData.optional()
|
|
773
|
-
});
|
|
774
|
-
z5.discriminatedUnion("type", [
|
|
775
|
-
zCardanoLikeStakingFields,
|
|
776
|
-
zEthereumLikeStakingFields,
|
|
777
|
-
zPolkadotLikeStakingFields,
|
|
778
|
-
zSolanaLikeStakingFields,
|
|
779
|
-
zTezosLikeStakingFields
|
|
780
|
-
]);
|
|
781
|
-
|
|
782
|
-
// src/accounts/account-asset-fields.ts
|
|
783
705
|
var zBitcoinLikeAssetFields = z.object({
|
|
784
706
|
type: z.literal(AccountType.BITCOIN_LIKE).describe("Account type"),
|
|
785
707
|
xpub: z.string().describe("xpub (extended public key)")
|
|
@@ -820,7 +742,7 @@ var zTezosLikeAssetFields = z.object({
|
|
|
820
742
|
type: z.literal(AccountType.TEZOS_LIKE).describe("Account type"),
|
|
821
743
|
address: z.string().describe("Account address").nullable()
|
|
822
744
|
}).describe("Tezos-like");
|
|
823
|
-
z.discriminatedUnion("type", [
|
|
745
|
+
var zAccountAssetStaticFields = z.discriminatedUnion("type", [
|
|
824
746
|
zBitcoinLikeAssetFields,
|
|
825
747
|
zCardanoLikeAssetFields,
|
|
826
748
|
zEthereumLikeAssetFields,
|
|
@@ -833,19 +755,6 @@ z.discriminatedUnion("type", [
|
|
|
833
755
|
zStellarLikeAssetFields,
|
|
834
756
|
zTezosLikeAssetFields
|
|
835
757
|
]).describe("Account asset fields");
|
|
836
|
-
var zAccountAssetFields = z.discriminatedUnion("type", [
|
|
837
|
-
zBitcoinLikeAssetFields,
|
|
838
|
-
zCardanoLikeAssetFields.merge(zCardanoLikeStakingFields).describe("Cardano-like"),
|
|
839
|
-
zEthereumLikeAssetFields.merge(zEthereumLikeStakingFields).describe("Ethereum-like"),
|
|
840
|
-
zEthereumTokenLikeAssetFields,
|
|
841
|
-
zGenericLikeAssetFields,
|
|
842
|
-
zPolkadotLikeAssetFields.merge(zPolkadotLikeStakingFields).describe("Polkadot-like"),
|
|
843
|
-
zRawSigningAssetFields,
|
|
844
|
-
zRippleLikeAssetFields,
|
|
845
|
-
zSolanaLikeAssetFields.merge(zSolanaLikeStakingFields).describe("Solana-like"),
|
|
846
|
-
zStellarLikeAssetFields,
|
|
847
|
-
zTezosLikeAssetFields.merge(zTezosLikeStakingFields).describe("Tezos-like")
|
|
848
|
-
]).describe("Asset fields");
|
|
849
758
|
var zReviewStepWithUsers = z.object({
|
|
850
759
|
quorum: z.number().min(0).describe("Number of required approvals for the step"),
|
|
851
760
|
userIds: z.array(z.string().min(1)).describe("User ids in the step")
|
|
@@ -861,6 +770,49 @@ var zReviewStepData = z.union([
|
|
|
861
770
|
}).describe("Review step with group")
|
|
862
771
|
]);
|
|
863
772
|
var zReviewStepsArray = z.array(zReviewStepData).min(1).describe("Review steps");
|
|
773
|
+
|
|
774
|
+
// src/prisma-utils/policy.ts
|
|
775
|
+
var policy_exports = {};
|
|
776
|
+
__export(policy_exports, {
|
|
777
|
+
parseFields: () => parseFields,
|
|
778
|
+
zGovRuleJsonObject: () => zGovRuleJsonObject,
|
|
779
|
+
zGovRulesJsonArray: () => zGovRulesJsonArray,
|
|
780
|
+
zThreshold: () => zThreshold,
|
|
781
|
+
zWhitelistIds: () => zWhitelistIds
|
|
782
|
+
});
|
|
783
|
+
var zThreshold = z.object({
|
|
784
|
+
min: zUnsignedIntString.nullable().describe("Minimum transaction amount"),
|
|
785
|
+
max: zUnsignedIntString.nullable().describe("Maximum transaction amount")
|
|
786
|
+
}).describe("Threshold for the transaction value");
|
|
787
|
+
var zWhitelistIds = z.array(z.string().min(1)).describe("IDs of whitelists for the recipient address");
|
|
788
|
+
var zGovRuleJsonObject = z.object({
|
|
789
|
+
// Required.
|
|
790
|
+
operationType: zOperationType.describe("Allowed operation type"),
|
|
791
|
+
// Optional threshold on transaction value: null `min` = 0, null `max` = +inf
|
|
792
|
+
threshold: zThreshold,
|
|
793
|
+
// Optional whitelist on transaction recipient: Empty list means no whitelist.
|
|
794
|
+
whitelistIds: zWhitelistIds,
|
|
795
|
+
reviewConfigId: z.string().min(1).describe("Id of ReviewConfig"),
|
|
796
|
+
// HSM id for the rule
|
|
797
|
+
hsmId: zHsmObjectId
|
|
798
|
+
}).describe("INTERNAL: Governance rule JSON representation in DB");
|
|
799
|
+
var zGovRulesJsonArray = z.array(zGovRuleJsonObject);
|
|
800
|
+
var parseFields = (policy) => {
|
|
801
|
+
const rulesJsonArray = zGovRulesJsonArray.parse(policy.rulesJsonArray);
|
|
802
|
+
return { ...policy, rulesJsonArray };
|
|
803
|
+
};
|
|
804
|
+
|
|
805
|
+
// src/prisma-utils/review-config.ts
|
|
806
|
+
var review_config_exports = {};
|
|
807
|
+
__export(review_config_exports, {
|
|
808
|
+
INCLUDE_MEMBERS: () => INCLUDE_MEMBERS
|
|
809
|
+
});
|
|
810
|
+
var INCLUDE_MEMBERS = {
|
|
811
|
+
users: true,
|
|
812
|
+
groups: {
|
|
813
|
+
include: { members: true }
|
|
814
|
+
}
|
|
815
|
+
};
|
|
864
816
|
var zUpdateQuorumRequestData = z5.object({
|
|
865
817
|
quorum: z5.number().int().min(2).describe("Workspace quorum")
|
|
866
818
|
});
|
|
@@ -1019,6 +971,123 @@ var zTradelinkAccountGovernanceFields = z.object({
|
|
|
1019
971
|
exchangeConfigs: zTradelinkExchangeConfigs.describe("Tradelink exchange configurations")
|
|
1020
972
|
}).describe("Tradelink");
|
|
1021
973
|
var zAccountGovernanceFields = z.discriminatedUnion("type", [zClassicAccountGovernanceFields, zTradelinkAccountGovernanceFields]).describe("Governance fields");
|
|
974
|
+
var zCardanoLikeStakingData = z5.object({
|
|
975
|
+
staked: z5.string().describe("Staked balance")
|
|
976
|
+
}).nullable().describe("Cardano-like staking data");
|
|
977
|
+
var zCardanoLikeStakingFields = z5.object({
|
|
978
|
+
type: z5.literal(AccountType.CARDANO_LIKE).describe("Account type"),
|
|
979
|
+
staking: zCardanoLikeStakingData.optional()
|
|
980
|
+
});
|
|
981
|
+
var zEthereumLikeStakingData = z5.object({
|
|
982
|
+
totalStaking: z5.string().describe("Total staked amount"),
|
|
983
|
+
totalRewards: z5.string().describe("Total of rewards"),
|
|
984
|
+
availableRewards: z5.string().describe("Available rewards"),
|
|
985
|
+
networkApy: z5.number().describe("Network APY")
|
|
986
|
+
}).nullable().describe("Ethereum-like staking data");
|
|
987
|
+
var zEthereumLikeStakingFields = z5.object({
|
|
988
|
+
type: z5.literal(AccountType.ETHEREUM_LIKE).describe("Account type"),
|
|
989
|
+
staking: zEthereumLikeStakingData.optional()
|
|
990
|
+
});
|
|
991
|
+
var zPolkadotUnbondingAmount = z5.object({
|
|
992
|
+
amount: z5.string().describe("Amount"),
|
|
993
|
+
waiting_time: z5.string().describe("Waiting time")
|
|
994
|
+
});
|
|
995
|
+
var zPolkadotLikeStakingData = z5.object({
|
|
996
|
+
info: z5.object({
|
|
997
|
+
controllerAddress: z5.string().nullable().describe("Controller address"),
|
|
998
|
+
rewardsDestination: z5.string().nullable().describe("Rewards destination"),
|
|
999
|
+
proxies: z5.array(z5.string()).describe("Proxies"),
|
|
1000
|
+
legacyStaking: z5.boolean().describe("True if account uses legacy staking"),
|
|
1001
|
+
isNominator: z5.boolean().describe("True if is nominator")
|
|
1002
|
+
}),
|
|
1003
|
+
balances: z5.object({
|
|
1004
|
+
free: z5.string().describe("Free balance"),
|
|
1005
|
+
reserved: z5.string().describe("Reserved balance"),
|
|
1006
|
+
frozen: z5.string().describe("Frozen balance"),
|
|
1007
|
+
bonded: z5.string().describe("Bonded balance"),
|
|
1008
|
+
available: z5.string().describe("Available balance"),
|
|
1009
|
+
unbonding: z5.array(zPolkadotUnbondingAmount).describe("Unbonding balances"),
|
|
1010
|
+
unbonded: z5.array(zPolkadotUnbondingAmount).describe("Unbonded balances"),
|
|
1011
|
+
totalUnbonding: z5.string().describe("Total unbonding"),
|
|
1012
|
+
totalUnbonded: z5.string().describe("Total unbonded")
|
|
1013
|
+
}),
|
|
1014
|
+
anonymousProxy: z5.object({
|
|
1015
|
+
address: z5.string().describe("Address"),
|
|
1016
|
+
createdAt: z5.string().describe("Creation date"),
|
|
1017
|
+
isController: z5.boolean().describe("True if is controller"),
|
|
1018
|
+
isMain: z5.boolean().describe("True if is main"),
|
|
1019
|
+
balances: z5.object({
|
|
1020
|
+
free: z5.string().describe("Anonymous proxy free balance"),
|
|
1021
|
+
reserved: z5.string().describe("Anonymous proxy reserved balance"),
|
|
1022
|
+
frozen: z5.string().describe("Anonymous proxy frozen balance"),
|
|
1023
|
+
bonded: z5.string().describe("Anonymous proxy bonded balance"),
|
|
1024
|
+
available: z5.string().describe("Anonymous proxy available balance"),
|
|
1025
|
+
total: z5.string().describe("Anonymous proxy total balance")
|
|
1026
|
+
}).nullable(),
|
|
1027
|
+
blockHeight: z5.string().describe("Anonymous proxy block height"),
|
|
1028
|
+
extIndex: z5.string().describe("Ext index"),
|
|
1029
|
+
index: z5.string().describe("Index"),
|
|
1030
|
+
kind: z5.string().describe("Kind")
|
|
1031
|
+
}).nullable().describe("Anonymous proxy")
|
|
1032
|
+
}).nullable().describe("Polkadot-like staking data");
|
|
1033
|
+
var zPolkadotLikeStakingFields = z5.object({
|
|
1034
|
+
type: z5.literal(AccountType.POLKADOT_LIKE).describe("Account type"),
|
|
1035
|
+
staking: zPolkadotLikeStakingData.optional()
|
|
1036
|
+
});
|
|
1037
|
+
var zSolanaStakingAccountStatus = z5.enum(["not_sync", "activating", "activated", "deactivating", "deactivated", "deleted"]).describe("Staking account status");
|
|
1038
|
+
var zSolanaLikeStakingData = z5.object({
|
|
1039
|
+
staked: z5.string().describe("Staked balance"),
|
|
1040
|
+
rewards: z5.object({
|
|
1041
|
+
total: z5.string().describe("Total rewards"),
|
|
1042
|
+
last7: z5.string().describe("Rewards on last 7 days"),
|
|
1043
|
+
last30: z5.string().describe("Rewards on last 30 days")
|
|
1044
|
+
}),
|
|
1045
|
+
stakes: z5.array(
|
|
1046
|
+
z5.object({
|
|
1047
|
+
uid: z5.string(),
|
|
1048
|
+
baseAccountUid: z5.string(),
|
|
1049
|
+
pubKey: z5.string().describe("Public key"),
|
|
1050
|
+
validatorPubKey: z5.string().nullable().describe("Validator public key"),
|
|
1051
|
+
initialAmount: z5.string().describe("Initial amount"),
|
|
1052
|
+
activeAmount: z5.string().describe("Active amount"),
|
|
1053
|
+
inactiveAmount: z5.string().describe("Inactive amount"),
|
|
1054
|
+
totalBalance: z5.string().describe("Total balance"),
|
|
1055
|
+
creationDate: z5.string().describe("Creation date"),
|
|
1056
|
+
activationEpoch: z5.string().nullable().describe("Activation epoch"),
|
|
1057
|
+
activationDate: z5.string().nullable().describe("Activation date"),
|
|
1058
|
+
deactivationEpoch: z5.string().nullable().describe("Deactivation epoch"),
|
|
1059
|
+
deactivationDate: z5.string().nullable().describe("Deactivation date"),
|
|
1060
|
+
status: zSolanaStakingAccountStatus,
|
|
1061
|
+
rentExemptReserve: z5.string().describe("Rent exempt reserve"),
|
|
1062
|
+
withdrawableAmount: z5.string().describe("Withdrawable amount"),
|
|
1063
|
+
totalRewards: z5.string().describe("Total rewards"),
|
|
1064
|
+
creationTxHash: z5.string().nullable().describe("Creation transaction hash"),
|
|
1065
|
+
actionsTxHashes: z5.array(z5.string()).describe("Actions transactions hashes")
|
|
1066
|
+
})
|
|
1067
|
+
)
|
|
1068
|
+
}).nullable().describe("Solana-like staking data");
|
|
1069
|
+
var zSolanaLikeStakingFields = z5.object({
|
|
1070
|
+
type: z5.literal(AccountType.SOLANA_LIKE).describe("Account type"),
|
|
1071
|
+
staking: zSolanaLikeStakingData.optional()
|
|
1072
|
+
});
|
|
1073
|
+
var zTezosLikeStakingData = z5.object({
|
|
1074
|
+
delegations: z5.array(
|
|
1075
|
+
z5.object({
|
|
1076
|
+
address: z5.string()
|
|
1077
|
+
})
|
|
1078
|
+
)
|
|
1079
|
+
}).nullable().describe("Tezos-like staking data");
|
|
1080
|
+
var zTezosLikeStakingFields = z5.object({
|
|
1081
|
+
type: z5.literal(AccountType.TEZOS_LIKE).describe("Account type"),
|
|
1082
|
+
staking: zTezosLikeStakingData.optional()
|
|
1083
|
+
});
|
|
1084
|
+
z5.discriminatedUnion("type", [
|
|
1085
|
+
zCardanoLikeStakingFields,
|
|
1086
|
+
zEthereumLikeStakingFields,
|
|
1087
|
+
zPolkadotLikeStakingFields,
|
|
1088
|
+
zSolanaLikeStakingFields,
|
|
1089
|
+
zTezosLikeStakingFields
|
|
1090
|
+
]);
|
|
1022
1091
|
|
|
1023
1092
|
// src/accounts/types.ts
|
|
1024
1093
|
var zAccountCommonFields = z5.object({
|
|
@@ -1037,8 +1106,7 @@ var zAccountBalanceFields = z5.object({
|
|
|
1037
1106
|
pending: z5.string().describe("Pending balance")
|
|
1038
1107
|
}).describe("Balance fields");
|
|
1039
1108
|
var zAccountResponse = zAccountCommonFields.extend({
|
|
1040
|
-
|
|
1041
|
-
asset: zAccountAssetFields,
|
|
1109
|
+
asset: zAccountAssetStaticFields,
|
|
1042
1110
|
governance: zAccountGovernanceFields
|
|
1043
1111
|
});
|
|
1044
1112
|
z5.enum([
|
|
@@ -1048,6 +1116,46 @@ z5.enum([
|
|
|
1048
1116
|
"createdAt",
|
|
1049
1117
|
"updatedAt"
|
|
1050
1118
|
]).default("createdAt");
|
|
1119
|
+
var zCommonLiveData = z5.object({
|
|
1120
|
+
id: z5.string().describe("Account internal unique identifier"),
|
|
1121
|
+
balance: zAccountBalanceFields
|
|
1122
|
+
});
|
|
1123
|
+
var zBitcoinLikeLiveData = zCommonLiveData.extend({
|
|
1124
|
+
type: z5.literal(AccountType.BITCOIN_LIKE).describe("Account type")
|
|
1125
|
+
}).describe("Bitcoin-like");
|
|
1126
|
+
var zCardanoLikeLiveData = zCommonLiveData.merge(zCardanoLikeStakingFields).describe("Cardano-like");
|
|
1127
|
+
var zEthereumLikeLiveData = zCommonLiveData.merge(zEthereumLikeStakingFields).describe("Ethereum-like");
|
|
1128
|
+
var zEthereumTokenLikeLiveData = zCommonLiveData.extend({
|
|
1129
|
+
type: z5.enum([AccountType.ERC20_LIKE, AccountType.BEP20_LIKE, AccountType.TRC20_LIKE]).describe("Account type")
|
|
1130
|
+
}).describe("Ethereum-like token");
|
|
1131
|
+
var zGenericLikeLiveData = zCommonLiveData.extend({
|
|
1132
|
+
type: z5.literal(AccountType.GENERIC_LIKE).describe("Account type")
|
|
1133
|
+
}).describe("Generic-like");
|
|
1134
|
+
var zPolkadotLikeLiveData = zCommonLiveData.merge(zPolkadotLikeStakingFields).describe("Polkadot-like");
|
|
1135
|
+
var zRawSigningLiveData = zCommonLiveData.extend({
|
|
1136
|
+
type: z5.literal(AccountType.RAW_SIGNING).describe("Account type")
|
|
1137
|
+
}).describe("Raw signing account");
|
|
1138
|
+
var zRippleLikeLiveData = zCommonLiveData.extend({
|
|
1139
|
+
type: z5.literal(AccountType.RIPPLE_LIKE).describe("Account type")
|
|
1140
|
+
}).describe("Ripple-like");
|
|
1141
|
+
var zSolanaLikeLiveData = zCommonLiveData.merge(zSolanaLikeStakingFields).describe("Solana-like");
|
|
1142
|
+
var zStellarLikeLiveData = zCommonLiveData.extend({
|
|
1143
|
+
type: z5.literal(AccountType.STELLAR_LIKE).describe("Account type")
|
|
1144
|
+
}).describe("Stellar-like");
|
|
1145
|
+
var zTezosLikeLiveData = zCommonLiveData.merge(zTezosLikeStakingFields).describe("Tezos-like");
|
|
1146
|
+
z5.discriminatedUnion("type", [
|
|
1147
|
+
zBitcoinLikeLiveData,
|
|
1148
|
+
zCardanoLikeLiveData,
|
|
1149
|
+
zEthereumLikeLiveData,
|
|
1150
|
+
zEthereumTokenLikeLiveData,
|
|
1151
|
+
zGenericLikeLiveData,
|
|
1152
|
+
zPolkadotLikeLiveData,
|
|
1153
|
+
zRawSigningLiveData,
|
|
1154
|
+
zRippleLikeLiveData,
|
|
1155
|
+
zSolanaLikeLiveData,
|
|
1156
|
+
zStellarLikeLiveData,
|
|
1157
|
+
zTezosLikeLiveData
|
|
1158
|
+
]);
|
|
1051
1159
|
|
|
1052
1160
|
// src/accounts/app-types.ts
|
|
1053
1161
|
var zNote2 = z5.object({
|
|
@@ -1082,30 +1190,13 @@ var zEditWhitelistRequestData = z5.object({
|
|
|
1082
1190
|
});
|
|
1083
1191
|
|
|
1084
1192
|
// src/policies/db-utils.ts
|
|
1085
|
-
var zThreshold = z5.object({
|
|
1086
|
-
min: zUnsignedIntString.nullable().describe("Minimum transaction amount"),
|
|
1087
|
-
max: zUnsignedIntString.nullable().describe("Maximum transaction amount")
|
|
1088
|
-
}).describe("Threshold for the transaction value");
|
|
1089
|
-
var zWhitelistIds = z5.array(z5.string().min(1)).describe("IDs of whitelists for the recipient address");
|
|
1090
|
-
var zGovRuleJsonObject = z5.object({
|
|
1091
|
-
// Required.
|
|
1092
|
-
operationType: zOperationType.describe("Allowed operation type"),
|
|
1093
|
-
// Optional threshold on transaction value: null `min` = 0, null `max` = +inf
|
|
1094
|
-
threshold: zThreshold,
|
|
1095
|
-
// Optional whitelist on transaction recipient: Empty list means no whitelist.
|
|
1096
|
-
whitelistIds: zWhitelistIds,
|
|
1097
|
-
reviewConfigId: z5.string().min(1).describe("Id of ReviewConfig"),
|
|
1098
|
-
// HSM id for the rule
|
|
1099
|
-
hsmId: zHsmObjectId
|
|
1100
|
-
}).describe("INTERNAL: Governance rule JSON representation in DB");
|
|
1101
|
-
z5.array(zGovRuleJsonObject);
|
|
1102
1193
|
var zBaseGovRuleData = z5.object({
|
|
1103
1194
|
// Steps of users that will need to review operations
|
|
1104
1195
|
reviewSteps: zReviewStepsArray,
|
|
1105
1196
|
// Optional threshold on transaction value: null `min` = 0, null `max` = +inf
|
|
1106
|
-
threshold: zThreshold.optional(),
|
|
1197
|
+
threshold: policy_exports.zThreshold.optional(),
|
|
1107
1198
|
// Optional whitelist on transaction recipient: Empty list means no whitelist.
|
|
1108
|
-
whitelistIds: zWhitelistIds.optional()
|
|
1199
|
+
whitelistIds: policy_exports.zWhitelistIds.optional()
|
|
1109
1200
|
});
|
|
1110
1201
|
var zClassicGovRuleData = zBaseGovRuleData.extend({
|
|
1111
1202
|
operationType: zClassicOperationType.describe("Allowed operation type")
|
|
@@ -1113,6 +1204,9 @@ var zClassicGovRuleData = zBaseGovRuleData.extend({
|
|
|
1113
1204
|
zBaseGovRuleData.extend({
|
|
1114
1205
|
operationType: zOperationType.describe("Allowed operation type")
|
|
1115
1206
|
}).describe("Governance rule");
|
|
1207
|
+
({
|
|
1208
|
+
reviewConfigs: { include: review_config_exports.INCLUDE_MEMBERS }
|
|
1209
|
+
});
|
|
1116
1210
|
var zPolicyName = z5.string().min(1).max(19).describe("Policy name");
|
|
1117
1211
|
var zCurrency2 = z5.string().min(1).max(40).regex(/^\w+$/).describe("Currency");
|
|
1118
1212
|
var zCreatePublicPolicyRequestData = z5.object({
|
|
@@ -1606,6 +1700,10 @@ var allowedRequestCreationInput = {
|
|
|
1606
1700
|
[RequestType.CREATE_WHITELIST]: zVaultRequestMixinsByType[RequestType.CREATE_WHITELIST],
|
|
1607
1701
|
[RequestType.EDIT_WHITELIST]: zVaultRequestMixinsByType[RequestType.EDIT_WHITELIST],
|
|
1608
1702
|
[RequestType.CREATE_TRANSACTION]: zVaultRequestMixinsByType[RequestType.CREATE_TRANSACTION],
|
|
1703
|
+
[RequestType.SIGN_MESSAGE]: z5.object({
|
|
1704
|
+
type: z5.literal(RequestType.SIGN_MESSAGE),
|
|
1705
|
+
data: zSignMessageUserInputData
|
|
1706
|
+
}),
|
|
1609
1707
|
[RequestType.CREATE_POLICY]: zVaultRequestMixinsByType[RequestType.CREATE_POLICY],
|
|
1610
1708
|
[RequestType.EDIT_POLICY]: zVaultRequestMixinsByType[RequestType.EDIT_POLICY],
|
|
1611
1709
|
[RequestType.CREATE_ACCOUNT]: z5.object({
|
|
@@ -2062,115 +2160,6 @@ var genVaultRequestReview = (opts) => {
|
|
|
2062
2160
|
};
|
|
2063
2161
|
|
|
2064
2162
|
// src/__fakes__/responses.ts
|
|
2065
|
-
var genericBalanceFields = () => {
|
|
2066
|
-
const total = faker.number.int();
|
|
2067
|
-
const pending = faker.number.int({ min: 0, max: total / 2 });
|
|
2068
|
-
return {
|
|
2069
|
-
total: total.toString(),
|
|
2070
|
-
pending: pending.toString()
|
|
2071
|
-
};
|
|
2072
|
-
};
|
|
2073
|
-
var stakingFieldsByAccountType = {
|
|
2074
|
-
BEP20_LIKE: () => null,
|
|
2075
|
-
BITCOIN_LIKE: () => null,
|
|
2076
|
-
CARDANO_LIKE: () => ({
|
|
2077
|
-
type: "CARDANO_LIKE",
|
|
2078
|
-
staking: {
|
|
2079
|
-
staked: faker.number.int().toString()
|
|
2080
|
-
}
|
|
2081
|
-
}),
|
|
2082
|
-
ERC20_LIKE: () => null,
|
|
2083
|
-
ETHEREUM_LIKE: () => ({
|
|
2084
|
-
type: "ETHEREUM_LIKE",
|
|
2085
|
-
staking: {
|
|
2086
|
-
totalStaking: faker.number.int().toString(),
|
|
2087
|
-
totalRewards: faker.number.int().toString(),
|
|
2088
|
-
availableRewards: faker.number.int().toString(),
|
|
2089
|
-
networkApy: faker.number.float({ min: 0, max: 1 })
|
|
2090
|
-
}
|
|
2091
|
-
}),
|
|
2092
|
-
GENERIC_LIKE: () => null,
|
|
2093
|
-
RAW_SIGNING: () => null,
|
|
2094
|
-
POLKADOT_LIKE: () => ({
|
|
2095
|
-
type: "POLKADOT_LIKE",
|
|
2096
|
-
staking: {
|
|
2097
|
-
info: {
|
|
2098
|
-
controllerAddress: "<fake-controller-address>",
|
|
2099
|
-
rewardsDestination: "<fake-rewards-destination>",
|
|
2100
|
-
proxies: ["<fake-proxy>"],
|
|
2101
|
-
legacyStaking: false,
|
|
2102
|
-
isNominator: false
|
|
2103
|
-
},
|
|
2104
|
-
balances: {
|
|
2105
|
-
free: faker.number.int().toString(),
|
|
2106
|
-
reserved: faker.number.int().toString(),
|
|
2107
|
-
frozen: faker.number.int().toString(),
|
|
2108
|
-
bonded: faker.number.int().toString(),
|
|
2109
|
-
available: faker.number.int().toString(),
|
|
2110
|
-
unbonding: [{ amount: faker.number.int().toString(), waiting_time: "<fake-waiting-time>" }],
|
|
2111
|
-
unbonded: [{ amount: faker.number.int().toString(), waiting_time: "<fake-waiting-time>" }],
|
|
2112
|
-
totalUnbonding: faker.number.int().toString(),
|
|
2113
|
-
totalUnbonded: faker.number.int().toString()
|
|
2114
|
-
},
|
|
2115
|
-
anonymousProxy: {
|
|
2116
|
-
address: "<fake-anonymous-proxy-address>",
|
|
2117
|
-
createdAt: faker.date.past().toISOString(),
|
|
2118
|
-
isController: false,
|
|
2119
|
-
isMain: false,
|
|
2120
|
-
balances: {
|
|
2121
|
-
free: faker.number.int().toString(),
|
|
2122
|
-
reserved: faker.number.int().toString(),
|
|
2123
|
-
frozen: faker.number.int().toString(),
|
|
2124
|
-
bonded: faker.number.int().toString(),
|
|
2125
|
-
available: faker.number.int().toString(),
|
|
2126
|
-
total: faker.number.int().toString()
|
|
2127
|
-
},
|
|
2128
|
-
blockHeight: faker.number.int().toString(),
|
|
2129
|
-
extIndex: faker.number.int().toString(),
|
|
2130
|
-
index: faker.number.int().toString(),
|
|
2131
|
-
kind: "<fake-kind>"
|
|
2132
|
-
}
|
|
2133
|
-
}
|
|
2134
|
-
}),
|
|
2135
|
-
RIPPLE_LIKE: () => null,
|
|
2136
|
-
SOLANA_LIKE: () => ({
|
|
2137
|
-
type: "SOLANA_LIKE",
|
|
2138
|
-
staking: {
|
|
2139
|
-
staked: faker.number.int().toString(),
|
|
2140
|
-
rewards: {
|
|
2141
|
-
total: faker.number.int().toString(),
|
|
2142
|
-
last7: faker.number.int().toString(),
|
|
2143
|
-
last30: faker.number.int().toString()
|
|
2144
|
-
},
|
|
2145
|
-
stakes: [
|
|
2146
|
-
{
|
|
2147
|
-
uid: "<fake-stake-uid>",
|
|
2148
|
-
baseAccountUid: "<fake-base-account-uid>",
|
|
2149
|
-
pubKey: "<fake-pub-key>",
|
|
2150
|
-
validatorPubKey: "<fake-validator-pub-key>",
|
|
2151
|
-
initialAmount: faker.number.int().toString(),
|
|
2152
|
-
activeAmount: faker.number.int().toString(),
|
|
2153
|
-
inactiveAmount: faker.number.int().toString(),
|
|
2154
|
-
totalBalance: faker.number.int().toString(),
|
|
2155
|
-
creationDate: faker.date.past().toISOString(),
|
|
2156
|
-
activationEpoch: faker.date.past().toISOString(),
|
|
2157
|
-
activationDate: faker.date.past().toISOString(),
|
|
2158
|
-
deactivationEpoch: "<fake-deactivation-epoch>",
|
|
2159
|
-
deactivationDate: faker.date.past().toISOString(),
|
|
2160
|
-
status: "activated",
|
|
2161
|
-
rentExemptReserve: faker.number.int().toString(),
|
|
2162
|
-
withdrawableAmount: faker.number.int().toString(),
|
|
2163
|
-
totalRewards: faker.number.int().toString(),
|
|
2164
|
-
creationTxHash: "<fake-creation-tx-hash>",
|
|
2165
|
-
actionsTxHashes: ["<fake-action-tx-hash>"]
|
|
2166
|
-
}
|
|
2167
|
-
]
|
|
2168
|
-
}
|
|
2169
|
-
}),
|
|
2170
|
-
STELLAR_LIKE: () => null,
|
|
2171
|
-
TEZOS_LIKE: () => null,
|
|
2172
|
-
TRC20_LIKE: () => null
|
|
2173
|
-
};
|
|
2174
2163
|
function genVaultRequestResponse(opts, reviews = []) {
|
|
2175
2164
|
const request = genVaultRequest(opts);
|
|
2176
2165
|
const requestWithReviews = { ...request, reviews };
|
|
@@ -2179,13 +2168,7 @@ function genVaultRequestResponse(opts, reviews = []) {
|
|
|
2179
2168
|
function genAccountResponse(overrides) {
|
|
2180
2169
|
const dbAccount = genAccount(overrides);
|
|
2181
2170
|
const account = serializeAccount(dbAccount);
|
|
2182
|
-
|
|
2183
|
-
Object.assign(account.asset, staking);
|
|
2184
|
-
const response = {
|
|
2185
|
-
...account,
|
|
2186
|
-
balance: genericBalanceFields()
|
|
2187
|
-
};
|
|
2188
|
-
return zAccountResponse.parse(response);
|
|
2171
|
+
return zAccountResponse.parse(account);
|
|
2189
2172
|
}
|
|
2190
2173
|
|
|
2191
2174
|
export { genAccountResponse, genVaultRequestResponse, genVaultRequestReview };
|