@railgun-community/shared-models 6.3.0 → 6.3.2
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.
|
@@ -170,3 +170,23 @@ export type POIList = {
|
|
|
170
170
|
description: string;
|
|
171
171
|
};
|
|
172
172
|
export declare const POI_REQUIRED_LISTS: POIList[];
|
|
173
|
+
export declare enum POIJSONRPCMethod {
|
|
174
|
+
NodeStatus = "ppoi_node_status",
|
|
175
|
+
POIEvents = "ppoi_poi_events",
|
|
176
|
+
POIMerkletreeLeaves = "ppoi_poi_merkletree_leaves",
|
|
177
|
+
TransactProofs = "ppoi_transact_proofs",
|
|
178
|
+
LegacyTransactProofs = "ppoi_legacy_transact_proofs",
|
|
179
|
+
BlockedShields = "ppoi_blocked_shields",
|
|
180
|
+
SubmitPOIEvents = "ppoi_submit_poi_events",
|
|
181
|
+
SubmitValidatedTXID = "ppoi_submit_validated_txid",
|
|
182
|
+
RemoveTransactProof = "ppoi_remove_transact_proof",
|
|
183
|
+
SubmitTransactProof = "ppoi_submit_transact_proof",
|
|
184
|
+
SubmitLegacyTransactProofs = "ppoi_submit_legacy_transact_proofs",
|
|
185
|
+
SubmitSingleCommitmentProofs = "ppoi_submit_single_commitment_proofs",
|
|
186
|
+
POIsPerList = "ppoi_pois_per_list",
|
|
187
|
+
POIsPerBlindedCommitment = "ppoi_pois_per_blinded_commitment",
|
|
188
|
+
MerkleProofs = "ppoi_merkle_proofs",
|
|
189
|
+
ValidatedTXID = "ppoi_validated_txid",
|
|
190
|
+
ValidateTXIDMerkleroot = "ppoi_validate_txid_merkleroot",
|
|
191
|
+
ValidatePOIMerkleroots = "ppoi_validate_poi_merkleroots"
|
|
192
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.POI_REQUIRED_LISTS = exports.POIListType = exports.POI_SHIELD_PENDING_SEC_TEST_NET_TEXT = exports.POI_SHIELD_PENDING_SEC_TEST_NET = exports.POI_SHIELD_PENDING_SEC_TEXT = exports.POI_SHIELD_PENDING_SEC = exports.POIStatus = exports.BlindedCommitmentType = exports.POIEventType = void 0;
|
|
3
|
+
exports.POIJSONRPCMethod = exports.POI_REQUIRED_LISTS = exports.POIListType = exports.POI_SHIELD_PENDING_SEC_TEST_NET_TEXT = exports.POI_SHIELD_PENDING_SEC_TEST_NET = exports.POI_SHIELD_PENDING_SEC_TEXT = exports.POI_SHIELD_PENDING_SEC = exports.POIStatus = exports.BlindedCommitmentType = exports.POIEventType = void 0;
|
|
4
4
|
var POIEventType;
|
|
5
5
|
(function (POIEventType) {
|
|
6
6
|
POIEventType["Shield"] = "Shield";
|
|
@@ -42,4 +42,25 @@ exports.POI_REQUIRED_LISTS = [
|
|
|
42
42
|
description: 'API which is used to restrict bad actors designated by the US Department of the Treasury. See: https://www.chainalysis.com/free-cryptocurrency-sanctions-screening-tools.',
|
|
43
43
|
},
|
|
44
44
|
];
|
|
45
|
+
var POIJSONRPCMethod;
|
|
46
|
+
(function (POIJSONRPCMethod) {
|
|
47
|
+
POIJSONRPCMethod["NodeStatus"] = "ppoi_node_status";
|
|
48
|
+
POIJSONRPCMethod["POIEvents"] = "ppoi_poi_events";
|
|
49
|
+
POIJSONRPCMethod["POIMerkletreeLeaves"] = "ppoi_poi_merkletree_leaves";
|
|
50
|
+
POIJSONRPCMethod["TransactProofs"] = "ppoi_transact_proofs";
|
|
51
|
+
POIJSONRPCMethod["LegacyTransactProofs"] = "ppoi_legacy_transact_proofs";
|
|
52
|
+
POIJSONRPCMethod["BlockedShields"] = "ppoi_blocked_shields";
|
|
53
|
+
POIJSONRPCMethod["SubmitPOIEvents"] = "ppoi_submit_poi_events";
|
|
54
|
+
POIJSONRPCMethod["SubmitValidatedTXID"] = "ppoi_submit_validated_txid";
|
|
55
|
+
POIJSONRPCMethod["RemoveTransactProof"] = "ppoi_remove_transact_proof";
|
|
56
|
+
POIJSONRPCMethod["SubmitTransactProof"] = "ppoi_submit_transact_proof";
|
|
57
|
+
POIJSONRPCMethod["SubmitLegacyTransactProofs"] = "ppoi_submit_legacy_transact_proofs";
|
|
58
|
+
POIJSONRPCMethod["SubmitSingleCommitmentProofs"] = "ppoi_submit_single_commitment_proofs";
|
|
59
|
+
POIJSONRPCMethod["POIsPerList"] = "ppoi_pois_per_list";
|
|
60
|
+
POIJSONRPCMethod["POIsPerBlindedCommitment"] = "ppoi_pois_per_blinded_commitment";
|
|
61
|
+
POIJSONRPCMethod["MerkleProofs"] = "ppoi_merkle_proofs";
|
|
62
|
+
POIJSONRPCMethod["ValidatedTXID"] = "ppoi_validated_txid";
|
|
63
|
+
POIJSONRPCMethod["ValidateTXIDMerkleroot"] = "ppoi_validate_txid_merkleroot";
|
|
64
|
+
POIJSONRPCMethod["ValidatePOIMerkleroots"] = "ppoi_validate_poi_merkleroots";
|
|
65
|
+
})(POIJSONRPCMethod || (exports.POIJSONRPCMethod = POIJSONRPCMethod = {}));
|
|
45
66
|
//# sourceMappingURL=proof-of-innocence.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proof-of-innocence.js","sourceRoot":"","sources":["../../src/models/proof-of-innocence.ts"],"names":[],"mappings":";;;AAmCA,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,iCAAiB,CAAA;IACjB,qCAAqB,CAAA;IACrB,qCAAqB,CAAA;IACrB,iDAAiC,CAAA;AACnC,CAAC,EALW,YAAY,4BAAZ,YAAY,QAKvB;AA4DD,IAAY,qBAIX;AAJD,WAAY,qBAAqB;IAC/B,0CAAiB,CAAA;IACjB,8CAAqB,CAAA;IACrB,8CAAqB,CAAA;AACvB,CAAC,EAJW,qBAAqB,qCAArB,qBAAqB,QAIhC;AAoCD,IAAY,SASX;AATD,WAAY,SAAS;IACnB,6BAA6B;IAC7B,4BAAe,CAAA;IACf,iBAAiB;IACjB,4CAA+B,CAAA;IAC/B,2DAA2D;IAC3D,8CAAiC,CAAA;IACjC,sEAAsE;IACtE,gCAAmB,CAAA;AACrB,CAAC,EATW,SAAS,yBAAT,SAAS,QASpB;AAyCY,QAAA,sBAAsB,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,SAAS;AAC3C,QAAA,2BAA2B,GAAG,UAAU,CAAC;AACzC,QAAA,+BAA+B,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,YAAY;AACtD,QAAA,oCAAoC,GAAG,cAAc,CAAC;AAEnE,IAAY,WAGX;AAHD,WAAY,WAAW;IACrB,gCAAiB,CAAA;IACjB,gCAAiB,CAAA;AACnB,CAAC,EAHW,WAAW,2BAAX,WAAW,QAGtB;AASY,QAAA,kBAAkB,GAAc;IAC3C;QACE,GAAG,EAAE,kEAAkE;QACvE,IAAI,EAAE,WAAW,CAAC,MAAM;QACxB,IAAI,EAAE,gCAAgC;QACtC,WAAW,EACT,2KAA2K;KAC9K;CACF,CAAC","sourcesContent":["import { TXIDVersion } from './engine';\nimport { NetworkName } from './network-config';\nimport { PreTransactionPOIsPerTxidLeafPerList } from './response-types';\n\nexport type TransactProofData = {\n snarkProof: SnarkProof;\n poiMerkleroots: string[];\n txidMerkleroot: string;\n txidMerklerootIndex: number;\n blindedCommitmentsOut: string[];\n railgunTxidIfHasUnshield: string;\n};\n\nexport type SnarkProof = {\n pi_a: [string, string];\n pi_b: [[string, string], [string, string]];\n pi_c: [string, string];\n};\n\nexport type MerkleProof = {\n leaf: string; // hash of commitment\n elements: string[];\n indices: string;\n root: string;\n};\n\nexport type ShieldQueueStatus = {\n unknown: number;\n pending: number;\n allowed: number;\n blocked: number;\n addedPOI: number;\n latestShield: Optional<string>;\n};\n\nexport enum POIEventType {\n Shield = 'Shield',\n Transact = 'Transact',\n Unshield = 'Unshield',\n LegacyTransact = 'LegacyTransact',\n}\n\nexport type POIEventLengths = Record<POIEventType, number>;\n\nexport type POIListStatus = {\n poiEventLengths: POIEventLengths;\n listProviderPOIEventQueueLength: Optional<number>;\n pendingTransactProofs: number;\n blockedShields: number;\n historicalMerklerootsLength: number;\n latestHistoricalMerkleroot: string;\n};\n\nexport type GetTransactProofsParams = {\n txidVersion: TXIDVersion;\n bloomFilterSerialized: string;\n listKey: string;\n};\n\nexport type GetBlockedShieldsParams = {\n txidVersion: TXIDVersion;\n bloomFilterSerialized: string;\n listKey: string;\n};\n\nexport type LegacyTransactProofData = {\n txidIndex: string;\n npk: string;\n value: string;\n tokenHash: string;\n blindedCommitment: string;\n};\n\nexport type SingleCommitmentProofsData = {\n commitment: string;\n npk: string;\n utxoTreeIn: number;\n utxoTreeOut: number;\n utxoPositionOut: number;\n railgunTxid: string;\n pois: PreTransactionPOIsPerTxidLeafPerList;\n};\n\nexport type SubmitTransactProofParams = {\n txidVersion: TXIDVersion;\n listKey: string;\n transactProofData: TransactProofData;\n};\n\nexport type SubmitLegacyTransactProofParams = {\n txidVersion: TXIDVersion;\n listKeys: string[];\n legacyTransactProofDatas: LegacyTransactProofData[];\n};\n\nexport type SubmitSingleCommitmentProofsParams = {\n txidVersion: TXIDVersion;\n singleCommitmentProofsData: SingleCommitmentProofsData;\n};\n\nexport enum BlindedCommitmentType {\n Shield = 'Shield',\n Transact = 'Transact',\n Unshield = 'Unshield',\n}\n\nexport type ValidatePOIMerklerootsParams = {\n txidVersion: TXIDVersion;\n listKey: string;\n poiMerkleroots: string[];\n};\n\nexport type BlindedCommitmentData = {\n blindedCommitment: string;\n type: BlindedCommitmentType;\n};\n\nexport type GetPOIsPerListParams = {\n txidVersion: TXIDVersion;\n listKeys: string[];\n blindedCommitmentDatas: BlindedCommitmentData[];\n};\n\nexport type GetMerkleProofsParams = {\n txidVersion: TXIDVersion;\n listKey: string;\n blindedCommitments: string[];\n};\n\nexport type ValidateTxidMerklerootParams = {\n txidVersion: TXIDVersion;\n tree: number;\n index: number;\n merkleroot: string;\n};\n\nexport type GetLatestValidatedRailgunTxidParams = {\n txidVersion: TXIDVersion;\n};\n\nexport enum POIStatus {\n // POI valdated in event list\n Valid = 'Valid',\n // Shield blocked\n ShieldBlocked = 'ShieldBlocked',\n // Transact/Unshield proof submitted, but not validated yet\n ProofSubmitted = 'ProofSubmitted',\n // Missing internal/external transact/unshield proof, or ShieldPending\n Missing = 'Missing',\n}\n\nexport type POIsPerList = {\n [listKey: string]: POIStatus;\n};\n\nexport type POIsPerListMap = {\n [blindedCommitment: string]: POIsPerList;\n};\n\nexport type TxidMerkletreeSyncStatus = {\n currentTxidIndex: number;\n currentMerkleroot: string;\n validatedTxidIndex: number;\n validatedMerkleroot: string;\n};\n\nexport type RailgunTxidStatus = {\n currentTxidIndex: Optional<number>;\n currentMerkleroot: Optional<string>;\n validatedTxidIndex: Optional<number>;\n validatedMerkleroot: Optional<string>;\n};\n\nexport type ValidatedRailgunTxidStatus = {\n validatedTxidIndex: Optional<number>;\n validatedMerkleroot: Optional<string>;\n};\n\nexport type NodeStatusAllNetworks = {\n listKeys: string[];\n forNetwork: Partial<Record<NetworkName, NodeStatusForNetwork>>;\n};\n\nexport type NodeStatusForNetwork = {\n txidStatus: RailgunTxidStatus;\n shieldQueueStatus: ShieldQueueStatus;\n listStatuses: Record<string, POIListStatus>;\n legacyTransactProofs: number;\n};\n\nexport const POI_SHIELD_PENDING_SEC = 60 * 60; // 1 hour\nexport const POI_SHIELD_PENDING_SEC_TEXT = 'One hour';\nexport const POI_SHIELD_PENDING_SEC_TEST_NET = 5 * 60; // 5 minutes\nexport const POI_SHIELD_PENDING_SEC_TEST_NET_TEXT = 'Five minutes';\n\nexport enum POIListType {\n Active = 'Active',\n Gather = 'Gather',\n}\n\nexport type POIList = {\n key: string;\n type: POIListType;\n name: string;\n description: string;\n};\n\nexport const POI_REQUIRED_LISTS: POIList[] = [\n {\n key: 'efc6ddb59c098a13fb2b618fdae94c1c3a807abc8fb1837c93620c9143ee9e88',\n type: POIListType.Active,\n name: 'Chainalysis OFAC Sanctions API',\n description:\n 'API which is used to restrict bad actors designated by the US Department of the Treasury. See: https://www.chainalysis.com/free-cryptocurrency-sanctions-screening-tools.',\n },\n];\n"]}
|
|
1
|
+
{"version":3,"file":"proof-of-innocence.js","sourceRoot":"","sources":["../../src/models/proof-of-innocence.ts"],"names":[],"mappings":";;;AAmCA,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,iCAAiB,CAAA;IACjB,qCAAqB,CAAA;IACrB,qCAAqB,CAAA;IACrB,iDAAiC,CAAA;AACnC,CAAC,EALW,YAAY,4BAAZ,YAAY,QAKvB;AA4DD,IAAY,qBAIX;AAJD,WAAY,qBAAqB;IAC/B,0CAAiB,CAAA;IACjB,8CAAqB,CAAA;IACrB,8CAAqB,CAAA;AACvB,CAAC,EAJW,qBAAqB,qCAArB,qBAAqB,QAIhC;AAoCD,IAAY,SASX;AATD,WAAY,SAAS;IACnB,6BAA6B;IAC7B,4BAAe,CAAA;IACf,iBAAiB;IACjB,4CAA+B,CAAA;IAC/B,2DAA2D;IAC3D,8CAAiC,CAAA;IACjC,sEAAsE;IACtE,gCAAmB,CAAA;AACrB,CAAC,EATW,SAAS,yBAAT,SAAS,QASpB;AAyCY,QAAA,sBAAsB,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,SAAS;AAC3C,QAAA,2BAA2B,GAAG,UAAU,CAAC;AACzC,QAAA,+BAA+B,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,YAAY;AACtD,QAAA,oCAAoC,GAAG,cAAc,CAAC;AAEnE,IAAY,WAGX;AAHD,WAAY,WAAW;IACrB,gCAAiB,CAAA;IACjB,gCAAiB,CAAA;AACnB,CAAC,EAHW,WAAW,2BAAX,WAAW,QAGtB;AASY,QAAA,kBAAkB,GAAc;IAC3C;QACE,GAAG,EAAE,kEAAkE;QACvE,IAAI,EAAE,WAAW,CAAC,MAAM;QACxB,IAAI,EAAE,gCAAgC;QACtC,WAAW,EACT,2KAA2K;KAC9K;CACF,CAAC;AAEF,IAAY,gBAmBX;AAnBD,WAAY,gBAAgB;IAC1B,mDAA+B,CAAA;IAC/B,iDAA6B,CAAA;IAC7B,sEAAkD,CAAA;IAClD,2DAAuC,CAAA;IACvC,wEAAoD,CAAA;IACpD,2DAAuC,CAAA;IACvC,8DAA0C,CAAA;IAC1C,sEAAkD,CAAA;IAClD,sEAAkD,CAAA;IAClD,sEAAkD,CAAA;IAClD,qFAAiE,CAAA;IACjE,yFAAqE,CAAA;IACrE,sDAAkC,CAAA;IAClC,iFAA6D,CAAA;IAC7D,uDAAmC,CAAA;IACnC,yDAAqC,CAAA;IACrC,4EAAwD,CAAA;IACxD,4EAAwD,CAAA;AAC1D,CAAC,EAnBW,gBAAgB,gCAAhB,gBAAgB,QAmB3B","sourcesContent":["import { TXIDVersion } from './engine';\nimport { NetworkName } from './network-config';\nimport { PreTransactionPOIsPerTxidLeafPerList } from './response-types';\n\nexport type TransactProofData = {\n snarkProof: SnarkProof;\n poiMerkleroots: string[];\n txidMerkleroot: string;\n txidMerklerootIndex: number;\n blindedCommitmentsOut: string[];\n railgunTxidIfHasUnshield: string;\n};\n\nexport type SnarkProof = {\n pi_a: [string, string];\n pi_b: [[string, string], [string, string]];\n pi_c: [string, string];\n};\n\nexport type MerkleProof = {\n leaf: string; // hash of commitment\n elements: string[];\n indices: string;\n root: string;\n};\n\nexport type ShieldQueueStatus = {\n unknown: number;\n pending: number;\n allowed: number;\n blocked: number;\n addedPOI: number;\n latestShield: Optional<string>;\n};\n\nexport enum POIEventType {\n Shield = 'Shield',\n Transact = 'Transact',\n Unshield = 'Unshield',\n LegacyTransact = 'LegacyTransact',\n}\n\nexport type POIEventLengths = Record<POIEventType, number>;\n\nexport type POIListStatus = {\n poiEventLengths: POIEventLengths;\n listProviderPOIEventQueueLength: Optional<number>;\n pendingTransactProofs: number;\n blockedShields: number;\n historicalMerklerootsLength: number;\n latestHistoricalMerkleroot: string;\n};\n\nexport type GetTransactProofsParams = {\n txidVersion: TXIDVersion;\n bloomFilterSerialized: string;\n listKey: string;\n};\n\nexport type GetBlockedShieldsParams = {\n txidVersion: TXIDVersion;\n bloomFilterSerialized: string;\n listKey: string;\n};\n\nexport type LegacyTransactProofData = {\n txidIndex: string;\n npk: string;\n value: string;\n tokenHash: string;\n blindedCommitment: string;\n};\n\nexport type SingleCommitmentProofsData = {\n commitment: string;\n npk: string;\n utxoTreeIn: number;\n utxoTreeOut: number;\n utxoPositionOut: number;\n railgunTxid: string;\n pois: PreTransactionPOIsPerTxidLeafPerList;\n};\n\nexport type SubmitTransactProofParams = {\n txidVersion: TXIDVersion;\n listKey: string;\n transactProofData: TransactProofData;\n};\n\nexport type SubmitLegacyTransactProofParams = {\n txidVersion: TXIDVersion;\n listKeys: string[];\n legacyTransactProofDatas: LegacyTransactProofData[];\n};\n\nexport type SubmitSingleCommitmentProofsParams = {\n txidVersion: TXIDVersion;\n singleCommitmentProofsData: SingleCommitmentProofsData;\n};\n\nexport enum BlindedCommitmentType {\n Shield = 'Shield',\n Transact = 'Transact',\n Unshield = 'Unshield',\n}\n\nexport type ValidatePOIMerklerootsParams = {\n txidVersion: TXIDVersion;\n listKey: string;\n poiMerkleroots: string[];\n};\n\nexport type BlindedCommitmentData = {\n blindedCommitment: string;\n type: BlindedCommitmentType;\n};\n\nexport type GetPOIsPerListParams = {\n txidVersion: TXIDVersion;\n listKeys: string[];\n blindedCommitmentDatas: BlindedCommitmentData[];\n};\n\nexport type GetMerkleProofsParams = {\n txidVersion: TXIDVersion;\n listKey: string;\n blindedCommitments: string[];\n};\n\nexport type ValidateTxidMerklerootParams = {\n txidVersion: TXIDVersion;\n tree: number;\n index: number;\n merkleroot: string;\n};\n\nexport type GetLatestValidatedRailgunTxidParams = {\n txidVersion: TXIDVersion;\n};\n\nexport enum POIStatus {\n // POI valdated in event list\n Valid = 'Valid',\n // Shield blocked\n ShieldBlocked = 'ShieldBlocked',\n // Transact/Unshield proof submitted, but not validated yet\n ProofSubmitted = 'ProofSubmitted',\n // Missing internal/external transact/unshield proof, or ShieldPending\n Missing = 'Missing',\n}\n\nexport type POIsPerList = {\n [listKey: string]: POIStatus;\n};\n\nexport type POIsPerListMap = {\n [blindedCommitment: string]: POIsPerList;\n};\n\nexport type TxidMerkletreeSyncStatus = {\n currentTxidIndex: number;\n currentMerkleroot: string;\n validatedTxidIndex: number;\n validatedMerkleroot: string;\n};\n\nexport type RailgunTxidStatus = {\n currentTxidIndex: Optional<number>;\n currentMerkleroot: Optional<string>;\n validatedTxidIndex: Optional<number>;\n validatedMerkleroot: Optional<string>;\n};\n\nexport type ValidatedRailgunTxidStatus = {\n validatedTxidIndex: Optional<number>;\n validatedMerkleroot: Optional<string>;\n};\n\nexport type NodeStatusAllNetworks = {\n listKeys: string[];\n forNetwork: Partial<Record<NetworkName, NodeStatusForNetwork>>;\n};\n\nexport type NodeStatusForNetwork = {\n txidStatus: RailgunTxidStatus;\n shieldQueueStatus: ShieldQueueStatus;\n listStatuses: Record<string, POIListStatus>;\n legacyTransactProofs: number;\n};\n\nexport const POI_SHIELD_PENDING_SEC = 60 * 60; // 1 hour\nexport const POI_SHIELD_PENDING_SEC_TEXT = 'One hour';\nexport const POI_SHIELD_PENDING_SEC_TEST_NET = 5 * 60; // 5 minutes\nexport const POI_SHIELD_PENDING_SEC_TEST_NET_TEXT = 'Five minutes';\n\nexport enum POIListType {\n Active = 'Active',\n Gather = 'Gather',\n}\n\nexport type POIList = {\n key: string;\n type: POIListType;\n name: string;\n description: string;\n};\n\nexport const POI_REQUIRED_LISTS: POIList[] = [\n {\n key: 'efc6ddb59c098a13fb2b618fdae94c1c3a807abc8fb1837c93620c9143ee9e88',\n type: POIListType.Active,\n name: 'Chainalysis OFAC Sanctions API',\n description:\n 'API which is used to restrict bad actors designated by the US Department of the Treasury. See: https://www.chainalysis.com/free-cryptocurrency-sanctions-screening-tools.',\n },\n];\n\nexport enum POIJSONRPCMethod {\n NodeStatus = 'ppoi_node_status',\n POIEvents = 'ppoi_poi_events',\n POIMerkletreeLeaves = 'ppoi_poi_merkletree_leaves',\n TransactProofs = 'ppoi_transact_proofs',\n LegacyTransactProofs = 'ppoi_legacy_transact_proofs',\n BlockedShields = 'ppoi_blocked_shields',\n SubmitPOIEvents = 'ppoi_submit_poi_events',\n SubmitValidatedTXID = 'ppoi_submit_validated_txid',\n RemoveTransactProof = 'ppoi_remove_transact_proof',\n SubmitTransactProof = 'ppoi_submit_transact_proof',\n SubmitLegacyTransactProofs = 'ppoi_submit_legacy_transact_proofs',\n SubmitSingleCommitmentProofs = 'ppoi_submit_single_commitment_proofs',\n POIsPerList = 'ppoi_pois_per_list',\n POIsPerBlindedCommitment = 'ppoi_pois_per_blinded_commitment',\n MerkleProofs = 'ppoi_merkle_proofs',\n ValidatedTXID = 'ppoi_validated_txid',\n ValidateTXIDMerkleroot = 'ppoi_validate_txid_merkleroot',\n ValidatePOIMerkleroots = 'ppoi_validate_poi_merkleroots',\n}\n"]}
|
package/dist/utils/error.js
CHANGED
|
@@ -47,6 +47,12 @@ const sanitizeError = (cause) => {
|
|
|
47
47
|
if (lowercaseMsg.includes('error while dialing dial tcp')) {
|
|
48
48
|
return new Error('Error while connecting to RPC provider. Please try again.', { cause });
|
|
49
49
|
}
|
|
50
|
+
if (lowercaseMsg.includes('spendable private balance too low') &&
|
|
51
|
+
lowercaseMsg.includes('relayer fee')) {
|
|
52
|
+
return new Error('Private balance too low to pay relayer fee.', {
|
|
53
|
+
cause,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
50
56
|
// Custom RAILGUN contract error messages
|
|
51
57
|
if (lowercaseMsg.includes('railgunsmartwallet')) {
|
|
52
58
|
if (lowercaseMsg.includes('invalid nft note value')) {
|
|
@@ -79,7 +85,7 @@ const sanitizeError = (cause) => {
|
|
|
79
85
|
return new Error('RailgunSmartWallet: Invalid Snark Proof. Please re-prove your transaction.', { cause });
|
|
80
86
|
}
|
|
81
87
|
}
|
|
82
|
-
return new Error(validAscii(cause.message).replace(`:${STRING_PREFIX_AFTER_UNICODE_REPLACEMENT}`, ': ')
|
|
88
|
+
return new Error(validAscii(cause.message).replace(`:${STRING_PREFIX_AFTER_UNICODE_REPLACEMENT}`, ': '));
|
|
83
89
|
}
|
|
84
90
|
return new Error('Unknown error. Please try again.', { cause });
|
|
85
91
|
};
|
package/dist/utils/error.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/utils/error.ts"],"names":[],"mappings":";;;AAAA,iCAAmC;AAEnC,MAAM,uCAAuC,GAAG,KAAK,CAAC;AAEtD,MAAM,UAAU,GAAG,CAAC,GAAW,EAAE,EAAE;IACjC,OAAO,GAAG,CAAC,OAAO;IAChB,6CAA6C;IAC7C,iEAAiE,EACjE,EAAE,CACH,CAAC;AACJ,CAAC,CAAC;AAEK,MAAM,aAAa,GAAG,CAAC,KAAY,EAAS,EAAE;IACnD,IAAI,IAAA,gBAAS,EAAC,KAAK,CAAC,IAAI,KAAK,CAAC,OAAO,EAAE;QACrC,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;QACjD,IACE,YAAY,CAAC,QAAQ,CAAC,QAAQ,CAAC;YAC/B,YAAY,CAAC,QAAQ,CAAC,sBAAsB,CAAC,EAC7C;YACA,OAAO,IAAI,KAAK,CAAC,oBAAoB,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;SACnD;QACD,IAAI,YAAY,CAAC,QAAQ,CAAC,uBAAuB,CAAC,EAAE;YAClD,OAAO,IAAI,KAAK,CAAC,2BAA2B,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;SAC1D;QACD,IAAI,YAAY,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE;YAC1C,OAAO,IAAI,KAAK,CACd,4DAA4D,EAC5D,EAAE,KAAK,EAAE,CACV,CAAC;SACH;QACD,IAAI,YAAY,CAAC,QAAQ,CAAC,qBAAqB,CAAC,EAAE;YAChD,OAAO,IAAI,KAAK,CAAC,uBAAuB,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;SACtD;QACD,IACE,YAAY,CAAC,QAAQ,CACnB,sDAAsD,CACvD,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LACEMENT = 'y %';\n\nconst validAscii = (str: string) => {\n return str.replace(\n // eslint-disable-next-line no-useless-escape\n /[^A-Za-z 0-9 \\.,\\?\"\"!@#\\$%\\^&\\*\\(\\)-_=\\+;:<>\\/\\\\\\|\\}\\{\\[\\]`~]*/g,\n '',\n );\n};\n\nexport const sanitizeError = (cause: Error): Error => {\n if (isDefined(cause) && cause.message) {\n const lowercaseMsg = cause.message.toLowerCase();\n if (\n lowercaseMsg.includes('quorum') ||\n lowercaseMsg.includes('could not connect to')\n ) {\n return new Error('Could not connect.', { cause });\n }\n if (lowercaseMsg.includes('call revert exception')) {\n return new Error('Failed to connect to RPC.', { cause });\n }\n if (lowercaseMsg.includes('already known')) {\n return new Error(\n 'Transaction successful but ethers request for TXID failed.',\n { cause },\n );\n }\n if (lowercaseMsg.includes('missing revert data')) {\n return new Error('RPC connection error.', { cause });\n }\n if (\n lowercaseMsg.includes(\n 'transaction may fail or may require manual gas limit',\n )\n ) {\n return new Error('Unknown error. Transaction failed.', { cause });\n }\n if (lowercaseMsg.includes('replacement fee too low')) {\n return new Error(\n 'Nonce is used in a pending transaction, and replacement fee is too low. Please increase your network fee to replace the pending transaction.',\n { cause },\n );\n }\n if (lowercaseMsg.includes('intrinsic gas too low')) {\n return new Error(\n 'Gas price rejected. Please select a higher gas price or resubmit.',\n { cause },\n );\n }\n if (lowercaseMsg.includes('transaction underpriced')) {\n return new Error(\n 'Gas fee too low. Please select a higher gas price and resubmit.',\n { cause },\n );\n }\n if (lowercaseMsg.includes('insufficient funds for intrinsic')) {\n return new Error('Insufficient gas to process transaction.', { cause });\n }\n if (lowercaseMsg.includes('nonce has already been used')) {\n return new Error(\n // Do not change 'Nonce already used' string of Error message.\n 'Nonce already used: the transaction was already completed.',\n { cause },\n );\n }\n if (lowercaseMsg.includes('error while dialing dial tcp')) {\n return new Error(\n 'Error while connecting to RPC provider. Please try again.',\n { cause },\n );\n }\n if (\n lowercaseMsg.includes('spendable private balance too low') &&\n lowercaseMsg.includes('relayer fee')\n ) {\n return new Error('Private balance too low to pay relayer fee.', {\n cause,\n });\n }\n\n // Custom RAILGUN contract error messages\n if (lowercaseMsg.includes('railgunsmartwallet')) {\n if (lowercaseMsg.includes('invalid nft note value')) {\n return new Error('RailgunSmartWallet: Invalid NFT Note Value.', {\n cause,\n });\n }\n if (lowercaseMsg.includes('unsupported token')) {\n return new Error(\n 'RailgunSmartWallet: Unsupported Token. This token cannot interact with the RAILGUN contract.',\n { cause },\n );\n }\n if (lowercaseMsg.includes('invalid note value')) {\n return new Error(\n 'RailgunSmartWallet: Invalid Note Value. Please submit transaction with a corrected amount.',\n { cause },\n );\n }\n if (lowercaseMsg.includes('invalid adapt contract as sender')) {\n return new Error(\n 'RailgunSmartWallet: Invalid Adapt Contract as Sender. Please update your frontend to current Adapt module versions.',\n { cause },\n );\n }\n if (lowercaseMsg.includes('invalid merkle root')) {\n return new Error(\n 'RailgunSmartWallet: Invalid Merkle Root. Please sync your balances and try again.',\n { cause },\n );\n }\n if (lowercaseMsg.includes('note already spent')) {\n return new Error(\n 'RailgunSmartWallet: Note Already Spent. Please sync your balances and try again.',\n { cause },\n );\n }\n if (lowercaseMsg.includes('invalid note ciphertext array length')) {\n return new Error(\n 'RailgunSmartWallet: Invalid Note Ciphertext Array Length. Please sync balances and re-prove your transaction.',\n { cause },\n );\n }\n if (lowercaseMsg.includes('invalid withdraw note')) {\n return new Error(\n 'RailgunSmartWallet: Invalid Unshield Note. Please sync balances and re-prove your transaction.',\n { cause },\n );\n }\n if (lowercaseMsg.includes('invalid snark proof')) {\n return new Error(\n 'RailgunSmartWallet: Invalid Snark Proof. Please re-prove your transaction.',\n { cause },\n );\n }\n }\n\n return new Error(\n validAscii(cause.message).replace(\n `:${STRING_PREFIX_AFTER_UNICODE_REPLACEMENT}`,\n ': ',\n ),\n );\n }\n\n return new Error('Unknown error. Please try again.', { cause });\n};\n"]}
|