@railgun-community/shared-models 1.0.3 → 1.0.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/LICENSE +21 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.js +53 -0
- package/dist/index.js.map +1 -0
- package/dist/models/response-types.js.map +1 -1
- package/package.json +2 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 RAILGUN Project Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the “Software”), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as ArtifactModels from './models/artifact';
|
|
2
|
+
import * as FallbackProviderModels from './models/fallback-provider';
|
|
3
|
+
import * as MerkletreeScanModels from './models/merkletree-scan';
|
|
4
|
+
import * as NetworkConfigModels from './models/network-config';
|
|
5
|
+
import * as ProofModels from './models/proof';
|
|
6
|
+
import * as ResponseTypesModels from './models/response-types';
|
|
7
|
+
import * as WalletModels from './models/wallet';
|
|
8
|
+
declare const _default: {
|
|
9
|
+
serializeUnsignedTransaction: (transaction: import("@ethersproject/contracts").PopulatedTransaction) => string;
|
|
10
|
+
deserializeTransaction: (rawTransaction: string, nonce: Optional<number>, chainId: number) => import("@ethersproject/abstract-provider").TransactionRequest;
|
|
11
|
+
calculateGasLimit: (gasEstimate: import("@ethersproject/bignumber").BigNumber) => import("@ethersproject/bignumber").BigNumber;
|
|
12
|
+
calculateTotalGas: (transactionGasDetails: ResponseTypesModels.TransactionGasDetails) => import("@ethersproject/bignumber").BigNumber;
|
|
13
|
+
calculateMaximumGas: (transactionGasDetails: ResponseTypesModels.TransactionGasDetails) => import("@ethersproject/bignumber").BigNumber;
|
|
14
|
+
sanitizeError: (err: Error) => Error;
|
|
15
|
+
compareChains: (chainA: ResponseTypesModels.Chain, chainB: ResponseTypesModels.Chain) => boolean;
|
|
16
|
+
WalletCreationType: typeof WalletModels.WalletCreationType;
|
|
17
|
+
ChainType: typeof ResponseTypesModels.ChainType;
|
|
18
|
+
ProofType: typeof ProofModels.ProofType;
|
|
19
|
+
NetworkName: typeof NetworkConfigModels.NetworkName;
|
|
20
|
+
BaseTokenWrappedAddress: typeof NetworkConfigModels.BaseTokenWrappedAddress;
|
|
21
|
+
RailgunProxyDeploymentBlock: typeof NetworkConfigModels.RailgunProxyDeploymentBlock;
|
|
22
|
+
EVMGasType: typeof NetworkConfigModels.EVMGasType;
|
|
23
|
+
NETWORK_CONFIG: MapType<NetworkConfigModels.Network>;
|
|
24
|
+
networkForChain: (chain: ResponseTypesModels.Chain) => Optional<NetworkConfigModels.Network>;
|
|
25
|
+
MerkletreeScanStatus: typeof MerkletreeScanModels.MerkletreeScanStatus;
|
|
26
|
+
createFallbackProviderFromJsonConfig: (config: FallbackProviderModels.FallbackProviderJsonConfig, debugMessage?: ((msg: string) => void) | undefined) => import("@ethersproject/providers").FallbackProvider;
|
|
27
|
+
OFAC_TORNADO_CASH_SANCTIONS_LIST_ETH_ADDRESS: string[];
|
|
28
|
+
ArtifactName: typeof ArtifactModels.ArtifactName;
|
|
29
|
+
ArtifactVariant: typeof ArtifactModels.ArtifactVariant;
|
|
30
|
+
ARTIFACT_URL_PATHS_VARIANTS_V1: ArtifactModels.ArtifactVariantMapping;
|
|
31
|
+
};
|
|
32
|
+
export default _default;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
+
}) : function(o, v) {
|
|
27
|
+
o["default"] = v;
|
|
28
|
+
});
|
|
29
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
30
|
+
if (mod && mod.__esModule) return mod;
|
|
31
|
+
var result = {};
|
|
32
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
+
__setModuleDefault(result, mod);
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
36
|
+
exports.__esModule = true;
|
|
37
|
+
var ArtifactModels = __importStar(require("./models/artifact"));
|
|
38
|
+
var BlockedAddressModels = __importStar(require("./models/blocked-address"));
|
|
39
|
+
var FallbackProviderModels = __importStar(require("./models/fallback-provider"));
|
|
40
|
+
var FeeTokenModels = __importStar(require("./models/fee-token"));
|
|
41
|
+
var FunctionTypesModels = __importStar(require("./models/function-types"));
|
|
42
|
+
var MerkletreeScanModels = __importStar(require("./models/merkletree-scan"));
|
|
43
|
+
var NetworkConfigModels = __importStar(require("./models/network-config"));
|
|
44
|
+
var ProofModels = __importStar(require("./models/proof"));
|
|
45
|
+
var ResponseTypesModels = __importStar(require("./models/response-types"));
|
|
46
|
+
var TransactionModels = __importStar(require("./models/transaction"));
|
|
47
|
+
var WalletModels = __importStar(require("./models/wallet"));
|
|
48
|
+
var CompareUtils = __importStar(require("./utils/compare"));
|
|
49
|
+
var ErrorUtils = __importStar(require("./utils/error"));
|
|
50
|
+
var GasUtils = __importStar(require("./utils/gas"));
|
|
51
|
+
var SerializerUtils = __importStar(require("./utils/serializer"));
|
|
52
|
+
exports["default"] = __assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({}, ArtifactModels), BlockedAddressModels), FallbackProviderModels), FeeTokenModels), FunctionTypesModels), MerkletreeScanModels), NetworkConfigModels), ProofModels), ResponseTypesModels), TransactionModels), WalletModels), CompareUtils), ErrorUtils), GasUtils), SerializerUtils);
|
|
53
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gEAAoD;AACpD,6EAAiE;AACjE,iFAAqE;AACrE,iEAAqD;AACrD,2EAA+D;AAC/D,6EAAiE;AACjE,2EAA+D;AAC/D,0DAA8C;AAC9C,2EAA+D;AAC/D,sEAA0D;AAC1D,4DAAgD;AAEhD,4DAAgD;AAChD,wDAA4C;AAC5C,oDAAwC;AACxC,kEAAsD;AAEtD,gKACK,cAAc,GACd,oBAAoB,GACpB,sBAAsB,GACtB,cAAc,GACd,mBAAmB,GACnB,oBAAoB,GACpB,mBAAmB,GACnB,WAAW,GACX,mBAAmB,GACnB,iBAAiB,GACjB,YAAY,GAEZ,YAAY,GACZ,UAAU,GACV,QAAQ,GACR,eAAe,EAClB","sourcesContent":["import * as ArtifactModels from './models/artifact';\nimport * as BlockedAddressModels from './models/blocked-address';\nimport * as FallbackProviderModels from './models/fallback-provider';\nimport * as FeeTokenModels from './models/fee-token';\nimport * as FunctionTypesModels from './models/function-types';\nimport * as MerkletreeScanModels from './models/merkletree-scan';\nimport * as NetworkConfigModels from './models/network-config';\nimport * as ProofModels from './models/proof';\nimport * as ResponseTypesModels from './models/response-types';\nimport * as TransactionModels from './models/transaction';\nimport * as WalletModels from './models/wallet';\n\nimport * as CompareUtils from './utils/compare';\nimport * as ErrorUtils from './utils/error';\nimport * as GasUtils from './utils/gas';\nimport * as SerializerUtils from './utils/serializer';\n\nexport default {\n ...ArtifactModels,\n ...BlockedAddressModels,\n ...FallbackProviderModels,\n ...FeeTokenModels,\n ...FunctionTypesModels,\n ...MerkletreeScanModels,\n ...NetworkConfigModels,\n ...ProofModels,\n ...ResponseTypesModels,\n ...TransactionModels,\n ...WalletModels,\n\n ...CompareUtils,\n ...ErrorUtils,\n ...GasUtils,\n ...SerializerUtils,\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"response-types.js","sourceRoot":"","sources":["../../src/models/response-types.ts"],"names":[],"mappings":";;;AAmDA,IAAY,SAEX;AAFD,WAAY,SAAS;IACnB,uCAAO,CAAA;AACT,CAAC,EAFW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAEpB","sourcesContent":["import { BigNumber } from '@ethersproject/bignumber';\nimport { MerkletreeScanStatus } from './merkletree-scan';\nimport { EVMGasType, FeesSerialized } from './network-config';\n\nexport type RailgunAPICiphertext = {\n iv: string;\n data: string[];\n};\n\nexport type TransactionGasDetails =\n | TransactionGasDetailsType0\n | TransactionGasDetailsType2;\n\nexport type TransactionGasDetailsType0 = {\n evmGasType: EVMGasType.Type0;\n gasEstimate: BigNumber;\n gasPrice: BigNumber;\n};\n\nexport type TransactionGasDetailsType2 = {\n evmGasType: EVMGasType.Type2;\n gasEstimate: BigNumber;\n maxFeePerGas: BigNumber;\n maxPriorityFeePerGas: BigNumber;\n};\n\nexport type TransactionGasDetailsSerialized =\n | TransactionGasDetailsSerializedType0\n | TransactionGasDetailsSerializedType2;\n\nexport type TransactionGasDetailsSerializedType0 = {\n evmGasType: EVMGasType.Type0;\n gasEstimateString: string;\n gasPriceString: string;\n};\n\nexport type TransactionGasDetailsSerializedType2 = {\n evmGasType: EVMGasType.Type2;\n gasEstimateString: string;\n maxFeePerGasString: string;\n maxPriorityFeePerGasString: string;\n};\n\nexport type StartRailgunEngineResponse = {\n error?: string;\n};\n\nexport type DownloadInitialArtifactsResponse = {\n error?: string;\n};\n\nexport enum ChainType {\n EVM = 0,\n}\n\nexport type Chain = {\n type: ChainType;\n id: number;\n};\n\nexport type RailgunBalancesEvent = {\n chain: Chain;\n tokenBalancesSerialized: RailgunShieldedTokenBalanceSerialized[];\n railgunWalletID: string;\n};\n\nexport type MerkletreeScanUpdateEvent = {\n chain: Chain;\n scanStatus: MerkletreeScanStatus;\n progress: number;\n};\n\nexport type LoadProviderResponse = {\n feesSerialized?: FeesSerialized;\n error?: string;\n};\n\nexport type RailgunWalletInfo = {\n id: string;\n railgunAddress: string;\n};\n\nexport type LoadRailgunWalletResponse = {\n railgunWalletInfo?: RailgunWalletInfo;\n error?: string;\n};\n\nexport type UnloadRailgunWalletResponse = {\n error?: string;\n};\n\nexport type RailgunWalletAddressDataSerialized = {\n masterPublicKey: string;\n viewingPublicKey: string;\n};\n\nexport type RailgunBalanceResponse = {\n error?: string;\n};\n\nexport type RailgunShieldedTokenBalanceSerialized = {\n tokenAddress: string;\n balanceString: string;\n};\n\nexport type RailgunProveTransactionResponse = {\n error?: string;\n};\n\nexport type RailgunPopulateTransactionResponse = {\n serializedTransaction?: string;\n error?: string;\n};\n\nexport type RailgunTransactionGasEstimateResponse = {\n gasEstimateString?: string;\n error?: string;\n};\n\nexport type RailgunWalletTokenAmount = {\n tokenAddress: string;\n amountString: string;\n};\n\nexport type EncryptDataWithSharedKeyResponse = {\n encryptedData: [string, string];\n randomPubKey: string;\n sharedKey: Uint8Array;\n};\n\nexport type EncryptDataWithSharedKeySerialized = {\n encryptedData: [string, string];\n randomPubKey: string;\n sharedKey: string;\n};\n\nexport type ValidateCachedProvedTransactionResponse = {\n isValid: boolean;\n error?: string;\n};\n\nexport type Pbkdf2Response = string;\n\nexport
|
|
1
|
+
{"version":3,"file":"response-types.js","sourceRoot":"","sources":["../../src/models/response-types.ts"],"names":[],"mappings":";;;AAmDA,IAAY,SAEX;AAFD,WAAY,SAAS;IACnB,uCAAO,CAAA;AACT,CAAC,EAFW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAEpB","sourcesContent":["import { BigNumber } from '@ethersproject/bignumber';\nimport { MerkletreeScanStatus } from './merkletree-scan';\nimport { EVMGasType, FeesSerialized } from './network-config';\n\nexport type RailgunAPICiphertext = {\n iv: string;\n data: string[];\n};\n\nexport type TransactionGasDetails =\n | TransactionGasDetailsType0\n | TransactionGasDetailsType2;\n\nexport type TransactionGasDetailsType0 = {\n evmGasType: EVMGasType.Type0;\n gasEstimate: BigNumber;\n gasPrice: BigNumber;\n};\n\nexport type TransactionGasDetailsType2 = {\n evmGasType: EVMGasType.Type2;\n gasEstimate: BigNumber;\n maxFeePerGas: BigNumber;\n maxPriorityFeePerGas: BigNumber;\n};\n\nexport type TransactionGasDetailsSerialized =\n | TransactionGasDetailsSerializedType0\n | TransactionGasDetailsSerializedType2;\n\nexport type TransactionGasDetailsSerializedType0 = {\n evmGasType: EVMGasType.Type0;\n gasEstimateString: string;\n gasPriceString: string;\n};\n\nexport type TransactionGasDetailsSerializedType2 = {\n evmGasType: EVMGasType.Type2;\n gasEstimateString: string;\n maxFeePerGasString: string;\n maxPriorityFeePerGasString: string;\n};\n\nexport type StartRailgunEngineResponse = {\n error?: string;\n};\n\nexport type DownloadInitialArtifactsResponse = {\n error?: string;\n};\n\nexport enum ChainType {\n EVM = 0,\n}\n\nexport type Chain = {\n type: ChainType;\n id: number;\n};\n\nexport type RailgunBalancesEvent = {\n chain: Chain;\n tokenBalancesSerialized: RailgunShieldedTokenBalanceSerialized[];\n railgunWalletID: string;\n};\n\nexport type MerkletreeScanUpdateEvent = {\n chain: Chain;\n scanStatus: MerkletreeScanStatus;\n progress: number;\n};\n\nexport type LoadProviderResponse = {\n feesSerialized?: FeesSerialized;\n error?: string;\n};\n\nexport type RailgunWalletInfo = {\n id: string;\n railgunAddress: string;\n};\n\nexport type LoadRailgunWalletResponse = {\n railgunWalletInfo?: RailgunWalletInfo;\n error?: string;\n};\n\nexport type UnloadRailgunWalletResponse = {\n error?: string;\n};\n\nexport type RailgunWalletAddressDataSerialized = {\n masterPublicKey: string;\n viewingPublicKey: string;\n};\n\nexport type RailgunBalanceResponse = {\n error?: string;\n};\n\nexport type RailgunShieldedTokenBalanceSerialized = {\n tokenAddress: string;\n balanceString: string;\n};\n\nexport type RailgunProveTransactionResponse = {\n error?: string;\n};\n\nexport type RailgunPopulateTransactionResponse = {\n serializedTransaction?: string;\n error?: string;\n};\n\nexport type RailgunTransactionGasEstimateResponse = {\n gasEstimateString?: string;\n error?: string;\n};\n\nexport type RailgunWalletTokenAmount = {\n tokenAddress: string;\n amountString: string;\n};\n\nexport type EncryptDataWithSharedKeyResponse = {\n encryptedData: [string, string];\n randomPubKey: string;\n sharedKey: Uint8Array;\n};\n\nexport type EncryptDataWithSharedKeySerialized = {\n encryptedData: [string, string];\n randomPubKey: string;\n sharedKey: string;\n};\n\nexport type ValidateCachedProvedTransactionResponse = {\n isValid: boolean;\n error?: string;\n};\n\nexport type Pbkdf2Response = string;\n\nexport type RailgunWalletSendTokenAmount = RailgunWalletTokenAmount & {\n recipientAddress?: string;\n walletSource?: string;\n memoText?: string;\n};\n\nexport type RailgunWalletReceiveTokenAmount = RailgunWalletTokenAmount & {\n memoText?: string;\n};\n\nexport type TransactionHistoryItem = {\n txid: string;\n receiveTokenAmounts: RailgunWalletReceiveTokenAmount[];\n transferTokenAmounts: RailgunWalletSendTokenAmount[];\n changeTokenAmounts: RailgunWalletTokenAmount[];\n relayerFeeTokenAmount?: RailgunWalletTokenAmount;\n version: number;\n};\n\nexport type TransactionHistorySerializedResponse = {\n items?: TransactionHistoryItem[];\n error?: string;\n};\n"]}
|