@railgun-community/shared-models 3.7.4 → 3.7.6
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.
|
@@ -88,6 +88,10 @@ export declare type RailgunBalanceResponse = {
|
|
|
88
88
|
export declare type RailgunProveTransactionResponse = {
|
|
89
89
|
error?: string;
|
|
90
90
|
};
|
|
91
|
+
export declare type RailgunTxidFromNullifiersResponse = {
|
|
92
|
+
txid?: string;
|
|
93
|
+
error?: string;
|
|
94
|
+
};
|
|
91
95
|
export declare type RailgunPopulateTransactionResponse = {
|
|
92
96
|
serializedTransaction?: string;
|
|
93
97
|
nullifiers?: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"response-types.js","sourceRoot":"","sources":["../../src/models/response-types.ts"],"names":[],"mappings":";;;AAiEA,IAAY,SAEX;AAFD,WAAY,SAAS;IACnB,uCAAO,CAAA;AACT,CAAC,EAFW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAEpB;
|
|
1
|
+
{"version":3,"file":"response-types.js","sourceRoot":"","sources":["../../src/models/response-types.ts"],"names":[],"mappings":";;;AAiEA,IAAY,SAEX;AAFD,WAAY,SAAS;IACnB,uCAAO,CAAA;AACT,CAAC,EAFW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAEpB;AA6ED;;GAEG;AACH,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,mDAAU,CAAA;IACV,qDAAW,CAAA;AACb,CAAC,EAHW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAGvB","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 | TransactionGasDetailsType1\n | TransactionGasDetailsType2;\n\nexport type TransactionGasDetailsType0 = {\n evmGasType: EVMGasType.Type0;\n gasEstimate: BigNumber;\n gasPrice: BigNumber;\n};\n\nexport type TransactionGasDetailsType1 = {\n evmGasType: EVMGasType.Type1;\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 | TransactionGasDetailsSerializedType1\n | TransactionGasDetailsSerializedType2;\n\nexport type TransactionGasDetailsSerializedType0 = {\n evmGasType: EVMGasType.Type0;\n gasEstimateString: string;\n gasPriceString: string;\n};\n\nexport type TransactionGasDetailsSerializedType1 = {\n evmGasType: EVMGasType.Type1;\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 erc20Amounts: RailgunERC20Amount[];\n nftAmounts: RailgunNFTAmount[];\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 RailgunProveTransactionResponse = {\n error?: string;\n};\n\nexport declare type RailgunTxidFromNullifiersResponse = {\n txid?: string;\n error?: string;\n};\n\nexport type RailgunPopulateTransactionResponse = {\n serializedTransaction?: string;\n nullifiers?: string[];\n error?: string;\n};\n\nexport type RailgunTransactionGasEstimateResponse = {\n gasEstimateString?: string;\n error?: string;\n};\n\nexport type RailgunERC20Amount = {\n tokenAddress: string;\n amountString: string;\n};\n\nexport type RailgunERC20AmountRecipient = RailgunERC20Amount & {\n recipientAddress: string;\n};\n\n/**\n * Synced NFT types from TokenType (@railgun-community/engine).\n */\nexport enum NFTTokenType {\n ERC721 = 1,\n ERC1155 = 2,\n}\n\nexport type RailgunNFTAmount = {\n nftAddress: string;\n nftTokenType: NFTTokenType;\n tokenSubID: string;\n amountString: string;\n};\n\nexport type RailgunNFTAmountRecipient = RailgunNFTAmount & {\n recipientAddress: 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\ntype SendAdditionalData = {\n recipientAddress?: string;\n walletSource?: string;\n memoText?: string;\n};\n\nexport type RailgunSendERC20Amount = RailgunERC20Amount & SendAdditionalData;\n\nexport type RailgunSendNFTAmount = RailgunNFTAmount & SendAdditionalData;\n\ntype ReceiveAdditionalData = {\n senderAddress?: string;\n memoText?: string;\n};\n\nexport type RailgunReceiveERC20Amount = RailgunERC20Amount &\n ReceiveAdditionalData;\n\nexport type RailgunReceiveNFTAmount = RailgunNFTAmount & ReceiveAdditionalData;\n\nexport type TransactionHistoryItem = {\n txid: string;\n receiveERC20Amounts: RailgunReceiveERC20Amount[];\n transferERC20Amounts: RailgunSendERC20Amount[];\n changeERC20Amounts: RailgunERC20Amount[];\n relayerFeeERC20Amount?: RailgunERC20Amount;\n unshieldERC20Amounts: RailgunSendERC20Amount[];\n receiveNFTAmounts: RailgunReceiveNFTAmount[];\n transferNFTAmounts: RailgunSendNFTAmount[];\n unshieldNFTAmounts: RailgunSendNFTAmount[];\n version: number;\n};\n\nexport type TransactionHistorySerializedResponse = {\n items?: TransactionHistoryItem[];\n error?: string;\n};\n"]}
|
package/dist/utils/serializer.js
CHANGED
|
@@ -35,9 +35,15 @@ exports.serializeUnsignedTransaction = serializeUnsignedTransaction;
|
|
|
35
35
|
// return serialize(transaction, signature);
|
|
36
36
|
// };
|
|
37
37
|
var deserializeTransaction = function (rawTransaction, nonce, chainId) {
|
|
38
|
-
var _a;
|
|
38
|
+
var _a, _b, _c, _d, _e;
|
|
39
39
|
var transaction = (0, transactions_1.parse)(rawTransaction);
|
|
40
|
-
return __assign(__assign({}, transaction), { type: (_a = transaction.type) !== null && _a !== void 0 ? _a : undefined, nonce: nonce, chainId: chainId
|
|
40
|
+
return __assign(__assign({}, transaction), { type: (_a = transaction.type) !== null && _a !== void 0 ? _a : undefined, nonce: nonce, chainId: chainId,
|
|
41
|
+
// Set gas-related vars as undefined if they're zero.
|
|
42
|
+
gasLimit: ((_b = transaction.gasLimit) === null || _b === void 0 ? void 0 : _b.eq(0)) ? undefined : transaction.gasLimit, gasPrice: ((_c = transaction.gasPrice) === null || _c === void 0 ? void 0 : _c.eq(0)) ? undefined : transaction.gasPrice, maxFeePerGas: ((_d = transaction.maxFeePerGas) === null || _d === void 0 ? void 0 : _d.eq(0))
|
|
43
|
+
? undefined
|
|
44
|
+
: transaction.maxFeePerGas, maxPriorityFeePerGas: ((_e = transaction.maxPriorityFeePerGas) === null || _e === void 0 ? void 0 : _e.eq(0))
|
|
45
|
+
? undefined
|
|
46
|
+
: transaction.maxPriorityFeePerGas });
|
|
41
47
|
};
|
|
42
48
|
exports.deserializeTransaction = deserializeTransaction;
|
|
43
49
|
//# sourceMappingURL=serializer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serializer.js","sourceRoot":"","sources":["../../src/utils/serializer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,4DAA4E;AAE5E,2DAAsD;AAEtD,IAAM,oBAAoB,GAAG,UAAC,WAAiC;IAC7D,IAAI,WAAW,CAAC,IAAI,EAAE;QACpB,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;KAClE;IACD,IAAI,WAAW,CAAC,IAAI,KAAK,2BAAU,CAAC,KAAK,IAAI,WAAW,CAAC,UAAU,EAAE;QACnE,MAAM,IAAI,KAAK,CACb,2DAA2D,CAC5D,CAAC;KACH;AACH,CAAC,CAAC;AAEK,IAAM,4BAA4B,GAAG,UAC1C,WAAiC;IAEjC,oBAAoB,CAAC,WAAW,CAAC,CAAC;IAClC,OAAO,IAAA,wBAAS,EAAC,WAAW,CAAC,CAAC;AAChC,CAAC,CAAC;AALW,QAAA,4BAA4B,gCAKvC;AAEF,8CAA8C;AAC9C,uCAAuC;AACvC,8BAA8B;AAC9B,iBAAiB;AACjB,uCAAuC;AACvC,8CAA8C;AAC9C,KAAK;AAEE,IAAM,sBAAsB,GAAG,UACpC,cAAsB,EACtB,KAAuB,EACvB,OAAe;;IAEf,IAAM,WAAW,GAAgB,IAAA,oBAAK,EAAC,cAAc,CAAC,CAAC;IACvD,6BACK,WAAW,KACd,IAAI,EAAE,MAAA,WAAW,CAAC,IAAI,mCAAI,SAAS,EACnC,KAAK,OAAA,EACL,OAAO,SAAA,
|
|
1
|
+
{"version":3,"file":"serializer.js","sourceRoot":"","sources":["../../src/utils/serializer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,4DAA4E;AAE5E,2DAAsD;AAEtD,IAAM,oBAAoB,GAAG,UAAC,WAAiC;IAC7D,IAAI,WAAW,CAAC,IAAI,EAAE;QACpB,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;KA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AC,CAAC,WAAW,CAAC,oBAAoB,IACpC;AACJ,CAAC,CAAC;AAtBW,QAAA,sBAAsB,0BAsBjC","sourcesContent":["import { PopulatedTransaction } from '@ethersproject/contracts';\nimport { parse, serialize, Transaction } from '@ethersproject/transactions';\nimport { TransactionRequest } from '@ethersproject/providers';\nimport { EVMGasType } from '../models/network-config';\n\nconst validatePreserialize = (transaction: PopulatedTransaction) => {\n if (transaction.from) {\n throw new Error(`Cannot serialize 'from' field on transaction.`);\n }\n if (transaction.type === EVMGasType.Type0 && transaction.accessList) {\n throw new Error(\n `Cannot serialize 'accessList' field on Type0 transaction.`,\n );\n }\n};\n\nexport const serializeUnsignedTransaction = (\n transaction: PopulatedTransaction,\n): string => {\n validatePreserialize(transaction);\n return serialize(transaction);\n};\n\n// export const serializeSignedTransaction = (\n// transaction: PopulatedTransaction,\n// signature: SignatureLike,\n// ): string => {\n// validatePreserialize(transaction);\n// return serialize(transaction, signature);\n// };\n\nexport const deserializeTransaction = (\n rawTransaction: string,\n nonce: Optional<number>,\n chainId: number,\n): TransactionRequest => {\n const transaction: Transaction = parse(rawTransaction);\n return {\n ...transaction,\n type: transaction.type ?? undefined,\n nonce,\n chainId,\n\n // Set gas-related vars as undefined if they're zero.\n gasLimit: transaction.gasLimit?.eq(0) ? undefined : transaction.gasLimit,\n gasPrice: transaction.gasPrice?.eq(0) ? undefined : transaction.gasPrice,\n maxFeePerGas: transaction.maxFeePerGas?.eq(0)\n ? undefined\n : transaction.maxFeePerGas,\n maxPriorityFeePerGas: transaction.maxPriorityFeePerGas?.eq(0)\n ? undefined\n : transaction.maxPriorityFeePerGas,\n };\n};\n"]}
|