@aave/graphql 1.0.0-next.27 → 1.0.0-next.28

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/dist/testing.d.ts CHANGED
@@ -173,8 +173,8 @@ type introspection_types = {
173
173
  'BorrowActivity': { kind: 'OBJECT'; name: 'BorrowActivity'; fields: { 'borrowed': { name: 'borrowed'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'Erc20Amount'; ofType: null; }; } }; 'chain': { name: 'chain'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'Chain'; ofType: null; }; } }; 'id': { name: 'id'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'ID'; ofType: null; }; } }; 'reserve': { name: 'reserve'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'ReserveInfo'; ofType: null; }; } }; 'spoke': { name: 'spoke'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'Spoke'; ofType: null; }; } }; 'timestamp': { name: 'timestamp'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'DateTime'; ofType: null; }; } }; 'txHash': { name: 'txHash'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'TxHash'; ofType: null; }; } }; 'user': { name: 'user'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'EvmAddress'; ofType: null; }; } }; }; };
174
174
  'BorrowApyHistoryRequest': { kind: 'INPUT_OBJECT'; name: 'BorrowApyHistoryRequest'; isOneOf: false; inputFields: [{ name: 'reserve'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'ReserveId'; ofType: null; }; }; defaultValue: null }, { name: 'window'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'TimeWindow'; ofType: null; }; }; defaultValue: "LAST_DAY" }]; };
175
175
  'BorrowRequest': { kind: 'INPUT_OBJECT'; name: 'BorrowRequest'; isOneOf: false; inputFields: [{ name: 'reserve'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'ReserveId'; ofType: null; }; }; defaultValue: null }, { name: 'amount'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'INPUT_OBJECT'; name: 'ReserveAmountInput'; ofType: null; }; }; defaultValue: null }, { name: 'sender'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'EvmAddress'; ofType: null; }; }; defaultValue: null }]; };
176
- 'BorrowSwap': { kind: 'OBJECT'; name: 'BorrowSwap'; fields: { 'buyPosition': { name: 'buyPosition'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'PositionAmount'; ofType: null; }; } }; 'kind': { name: 'kind'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'BorrowSwapKind'; ofType: null; }; } }; 'orderClass': { name: 'orderClass'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'SwapOrderClass'; ofType: null; }; } }; 'sellPosition': { name: 'sellPosition'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'PositionAmount'; ofType: null; }; } }; }; };
177
- 'BorrowSwapActivity': { kind: 'OBJECT'; name: 'BorrowSwapActivity'; fields: { 'bought': { name: 'bought'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'UNION'; name: 'SwapAmount'; ofType: null; }; } }; 'chain': { name: 'chain'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'Chain'; ofType: null; }; } }; 'explorerUrl': { name: 'explorerUrl'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; 'id': { name: 'id'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'ID'; ofType: null; }; } }; 'kind': { name: 'kind'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'BorrowSwapKind'; ofType: null; }; } }; 'orderClass': { name: 'orderClass'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'SwapOrderClass'; ofType: null; }; } }; 'sold': { name: 'sold'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'UNION'; name: 'SwapAmount'; ofType: null; }; } }; 'timestamp': { name: 'timestamp'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'DateTime'; ofType: null; }; } }; 'txHash': { name: 'txHash'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'TxHash'; ofType: null; }; } }; 'user': { name: 'user'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'EvmAddress'; ofType: null; }; } }; }; };
176
+ 'BorrowSwap': { kind: 'OBJECT'; name: 'BorrowSwap'; fields: { 'buy': { name: 'buy'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'PositionAmount'; ofType: null; }; } }; 'kind': { name: 'kind'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'BorrowSwapKind'; ofType: null; }; } }; 'orderClass': { name: 'orderClass'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'SwapOrderClass'; ofType: null; }; } }; 'sell': { name: 'sell'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'PositionAmount'; ofType: null; }; } }; }; };
177
+ 'BorrowSwapActivity': { kind: 'OBJECT'; name: 'BorrowSwapActivity'; fields: { 'buy': { name: 'buy'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'PositionAmount'; ofType: null; }; } }; 'chain': { name: 'chain'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'Chain'; ofType: null; }; } }; 'explorerUrl': { name: 'explorerUrl'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; 'id': { name: 'id'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'ID'; ofType: null; }; } }; 'kind': { name: 'kind'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'BorrowSwapKind'; ofType: null; }; } }; 'orderClass': { name: 'orderClass'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'SwapOrderClass'; ofType: null; }; } }; 'sell': { name: 'sell'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'PositionAmount'; ofType: null; }; } }; 'status': { name: 'status'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'SwapActivityStatus'; ofType: null; }; } }; 'timestamp': { name: 'timestamp'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'DateTime'; ofType: null; }; } }; 'txHash': { name: 'txHash'; type: { kind: 'SCALAR'; name: 'TxHash'; ofType: null; } }; 'user': { name: 'user'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'EvmAddress'; ofType: null; }; } }; }; };
178
178
  'BorrowSwapKind': { name: 'BorrowSwapKind'; enumValues: 'CURRENT' | 'NEW'; };
179
179
  'BorrowSwapQuoteRequest': { kind: 'INPUT_OBJECT'; name: 'BorrowSwapQuoteRequest'; isOneOf: true; inputFields: [{ name: 'market'; type: { kind: 'INPUT_OBJECT'; name: 'MarketDebtSwapQuoteInput'; ofType: null; }; defaultValue: null }, { name: 'limit'; type: { kind: 'INPUT_OBJECT'; name: 'LimitDebtSwapQuoteInput'; ofType: null; }; defaultValue: null }, { name: 'fromQuote'; type: { kind: 'INPUT_OBJECT'; name: 'FromQuoteDebtSwapQuoteInput'; ofType: null; }; defaultValue: null }]; };
180
180
  'BorrowSwapQuoteResult': { kind: 'UNION'; name: 'BorrowSwapQuoteResult'; fields: {}; possibleTypes: 'InsufficientLiquidityError' | 'PositionSwapByIntentApprovalsRequired'; };
@@ -263,7 +263,7 @@ type introspection_types = {
263
263
  'MarketDebtSwapQuoteInput': { kind: 'INPUT_OBJECT'; name: 'MarketDebtSwapQuoteInput'; isOneOf: false; inputFields: [{ name: 'accuracy'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'QuoteAccuracy'; ofType: null; }; }; defaultValue: "ACCURATE" }, { name: 'debtPosition'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'UserBorrowItemId'; ofType: null; }; }; defaultValue: null }, { name: 'buyReserve'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'ReserveId'; ofType: null; }; }; defaultValue: null }, { name: 'amount'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'BigDecimal'; ofType: null; }; }; defaultValue: null }, { name: 'user'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'EvmAddress'; ofType: null; }; }; defaultValue: null }, { name: 'selectedSlippage'; type: { kind: 'SCALAR'; name: 'BigDecimal'; ofType: null; }; defaultValue: null }]; };
264
264
  'MarketOrderTokenSwapFromQuoteInput': { kind: 'INPUT_OBJECT'; name: 'MarketOrderTokenSwapFromQuoteInput'; isOneOf: false; inputFields: [{ name: 'quoteId'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'SwapQuoteId'; ofType: null; }; }; defaultValue: null }]; };
265
265
  'MarketOrderTokenSwapQuoteInput': { kind: 'INPUT_OBJECT'; name: 'MarketOrderTokenSwapQuoteInput'; isOneOf: false; inputFields: [{ name: 'accuracy'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'QuoteAccuracy'; ofType: null; }; }; defaultValue: "ACCURATE" }, { name: 'chainId'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'ChainId'; ofType: null; }; }; defaultValue: null }, { name: 'buy'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'INPUT_OBJECT'; name: 'TokenInput'; ofType: null; }; }; defaultValue: null }, { name: 'sell'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'INPUT_OBJECT'; name: 'TokenInput'; ofType: null; }; }; defaultValue: null }, { name: 'amount'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'BigDecimal'; ofType: null; }; }; defaultValue: null }, { name: 'kind'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'TokenSwapKind'; ofType: null; }; }; defaultValue: null }, { name: 'user'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'EvmAddress'; ofType: null; }; }; defaultValue: null }, { name: 'receiver'; type: { kind: 'SCALAR'; name: 'EvmAddress'; ofType: null; }; defaultValue: null }, { name: 'selectedSlippage'; type: { kind: 'SCALAR'; name: 'BigDecimal'; ofType: null; }; defaultValue: null }]; };
266
- 'MarketRepayWithSupplyQuoteInput': { kind: 'INPUT_OBJECT'; name: 'MarketRepayWithSupplyQuoteInput'; isOneOf: false; inputFields: [{ name: 'accuracy'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'QuoteAccuracy'; ofType: null; }; }; defaultValue: "ACCURATE" }, { name: 'debtPosition'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'UserBorrowItemId'; ofType: null; }; }; defaultValue: null }, { name: 'repayWithReserve'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'ReserveId'; ofType: null; }; }; defaultValue: null }, { name: 'amount'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'BigDecimal'; ofType: null; }; }; defaultValue: null }, { name: 'user'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'EvmAddress'; ofType: null; }; }; defaultValue: null }, { name: 'selectedSlippage'; type: { kind: 'SCALAR'; name: 'BigDecimal'; ofType: null; }; defaultValue: null }]; };
266
+ 'MarketRepayWithSupplyQuoteInput': { kind: 'INPUT_OBJECT'; name: 'MarketRepayWithSupplyQuoteInput'; isOneOf: false; inputFields: [{ name: 'accuracy'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'QuoteAccuracy'; ofType: null; }; }; defaultValue: "ACCURATE" }, { name: 'debtPosition'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'UserBorrowItemId'; ofType: null; }; }; defaultValue: null }, { name: 'repayWithReserve'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'ReserveId'; ofType: null; }; }; defaultValue: null }, { name: 'amount'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'BigDecimal'; ofType: null; }; }; defaultValue: null }, { name: 'user'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'EvmAddress'; ofType: null; }; }; defaultValue: null }, { name: 'selectedSlippage'; type: { kind: 'SCALAR'; name: 'BigDecimal'; ofType: null; }; defaultValue: null }, { name: 'kind'; type: { kind: 'ENUM'; name: 'RepayWithSupplyKind'; ofType: null; }; defaultValue: null }]; };
267
267
  'MarketSupplySwapQuoteInput': { kind: 'INPUT_OBJECT'; name: 'MarketSupplySwapQuoteInput'; isOneOf: false; inputFields: [{ name: 'accuracy'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'QuoteAccuracy'; ofType: null; }; }; defaultValue: "ACCURATE" }, { name: 'sellPosition'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'UserSupplyItemId'; ofType: null; }; }; defaultValue: null }, { name: 'buyReserve'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'ReserveId'; ofType: null; }; }; defaultValue: null }, { name: 'amount'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'BigDecimal'; ofType: null; }; }; defaultValue: null }, { name: 'user'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'EvmAddress'; ofType: null; }; }; defaultValue: null }, { name: 'enableCollateral'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'Boolean'; ofType: null; }; }; defaultValue: null }, { name: 'selectedSlippage'; type: { kind: 'SCALAR'; name: 'BigDecimal'; ofType: null; }; defaultValue: null }]; };
268
268
  'MarketWithdrawSwapQuoteInput': { kind: 'INPUT_OBJECT'; name: 'MarketWithdrawSwapQuoteInput'; isOneOf: false; inputFields: [{ name: 'accuracy'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'QuoteAccuracy'; ofType: null; }; }; defaultValue: "ACCURATE" }, { name: 'sellPosition'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'UserSupplyItemId'; ofType: null; }; }; defaultValue: null }, { name: 'buyToken'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'INPUT_OBJECT'; name: 'TokenInput'; ofType: null; }; }; defaultValue: null }, { name: 'amount'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'BigDecimal'; ofType: null; }; }; defaultValue: null }, { name: 'user'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'EvmAddress'; ofType: null; }; }; defaultValue: null }, { name: 'selectedSlippage'; type: { kind: 'SCALAR'; name: 'BigDecimal'; ofType: null; }; defaultValue: null }]; };
269
269
  'MaxLiquidationBonusVariation': { kind: 'OBJECT'; name: 'MaxLiquidationBonusVariation'; fields: { 'after': { name: 'after'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'PercentNumber'; ofType: null; }; } }; 'current': { name: 'current'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'PercentNumber'; ofType: null; }; } }; 'reserveId': { name: 'reserveId'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'ReserveId'; ofType: null; }; } }; 'token': { name: 'token'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'Erc20Token'; ofType: null; }; } }; }; };
@@ -310,8 +310,8 @@ type introspection_types = {
310
310
  'RepayAmountInputWithPermit': { kind: 'INPUT_OBJECT'; name: 'RepayAmountInputWithPermit'; isOneOf: true; inputFields: [{ name: 'native'; type: { kind: 'INPUT_OBJECT'; name: 'AmountInput'; ofType: null; }; defaultValue: null }, { name: 'erc20'; type: { kind: 'INPUT_OBJECT'; name: 'RepayErc20AmountInputWithPermit'; ofType: null; }; defaultValue: null }]; };
311
311
  'RepayErc20AmountInputWithPermit': { kind: 'INPUT_OBJECT'; name: 'RepayErc20AmountInputWithPermit'; isOneOf: false; inputFields: [{ name: 'value'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'INPUT_OBJECT'; name: 'AmountInput'; ofType: null; }; }; defaultValue: null }, { name: 'permitSig'; type: { kind: 'INPUT_OBJECT'; name: 'ERC20PermitSignature'; ofType: null; }; defaultValue: null }]; };
312
312
  'RepayRequest': { kind: 'INPUT_OBJECT'; name: 'RepayRequest'; isOneOf: false; inputFields: [{ name: 'reserve'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'ReserveId'; ofType: null; }; }; defaultValue: null }, { name: 'amount'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'INPUT_OBJECT'; name: 'RepayAmountInputWithPermit'; ofType: null; }; }; defaultValue: null }, { name: 'sender'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'EvmAddress'; ofType: null; }; }; defaultValue: null }]; };
313
- 'RepayWithSupply': { kind: 'OBJECT'; name: 'RepayWithSupply'; fields: { 'buyPosition': { name: 'buyPosition'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'PositionAmount'; ofType: null; }; } }; 'kind': { name: 'kind'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'RepayWithSupplyKind'; ofType: null; }; } }; 'orderClass': { name: 'orderClass'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'SwapOrderClass'; ofType: null; }; } }; 'sellPosition': { name: 'sellPosition'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'PositionAmount'; ofType: null; }; } }; }; };
314
- 'RepayWithSupplyActivity': { kind: 'OBJECT'; name: 'RepayWithSupplyActivity'; fields: { 'chain': { name: 'chain'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'Chain'; ofType: null; }; } }; 'debtRepaid': { name: 'debtRepaid'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'UNION'; name: 'SwapAmount'; ofType: null; }; } }; 'explorerUrl': { name: 'explorerUrl'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; 'id': { name: 'id'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'ID'; ofType: null; }; } }; 'kind': { name: 'kind'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'RepayWithSupplyKind'; ofType: null; }; } }; 'orderClass': { name: 'orderClass'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'SwapOrderClass'; ofType: null; }; } }; 'supplyUsed': { name: 'supplyUsed'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'UNION'; name: 'SwapAmount'; ofType: null; }; } }; 'timestamp': { name: 'timestamp'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'DateTime'; ofType: null; }; } }; 'txHash': { name: 'txHash'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'TxHash'; ofType: null; }; } }; 'user': { name: 'user'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'EvmAddress'; ofType: null; }; } }; }; };
313
+ 'RepayWithSupply': { kind: 'OBJECT'; name: 'RepayWithSupply'; fields: { 'kind': { name: 'kind'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'RepayWithSupplyKind'; ofType: null; }; } }; 'orderClass': { name: 'orderClass'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'SwapOrderClass'; ofType: null; }; } }; 'repay': { name: 'repay'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'PositionAmount'; ofType: null; }; } }; 'supply': { name: 'supply'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'PositionAmount'; ofType: null; }; } }; }; };
314
+ 'RepayWithSupplyActivity': { kind: 'OBJECT'; name: 'RepayWithSupplyActivity'; fields: { 'chain': { name: 'chain'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'Chain'; ofType: null; }; } }; 'explorerUrl': { name: 'explorerUrl'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; 'id': { name: 'id'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'ID'; ofType: null; }; } }; 'kind': { name: 'kind'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'RepayWithSupplyKind'; ofType: null; }; } }; 'orderClass': { name: 'orderClass'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'SwapOrderClass'; ofType: null; }; } }; 'repay': { name: 'repay'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'PositionAmount'; ofType: null; }; } }; 'status': { name: 'status'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'SwapActivityStatus'; ofType: null; }; } }; 'supply': { name: 'supply'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'PositionAmount'; ofType: null; }; } }; 'timestamp': { name: 'timestamp'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'DateTime'; ofType: null; }; } }; 'txHash': { name: 'txHash'; type: { kind: 'SCALAR'; name: 'TxHash'; ofType: null; } }; 'user': { name: 'user'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'EvmAddress'; ofType: null; }; } }; }; };
315
315
  'RepayWithSupplyKind': { name: 'RepayWithSupplyKind'; enumValues: 'REPAY' | 'SUPPLY'; };
316
316
  'RepayWithSupplyQuoteRequest': { kind: 'INPUT_OBJECT'; name: 'RepayWithSupplyQuoteRequest'; isOneOf: true; inputFields: [{ name: 'market'; type: { kind: 'INPUT_OBJECT'; name: 'MarketRepayWithSupplyQuoteInput'; ofType: null; }; defaultValue: null }, { name: 'limit'; type: { kind: 'INPUT_OBJECT'; name: 'LimitRepayWithSupplyQuoteInput'; ofType: null; }; defaultValue: null }, { name: 'fromQuote'; type: { kind: 'INPUT_OBJECT'; name: 'FromQuoteRepayWithSupplyQuoteInput'; ofType: null; }; defaultValue: null }]; };
317
317
  'RepayWithSupplyQuoteResult': { kind: 'UNION'; name: 'RepayWithSupplyQuoteResult'; fields: {}; possibleTypes: 'InsufficientLiquidityError' | 'PositionSwapByIntentApprovalsRequired'; };
@@ -352,12 +352,12 @@ type introspection_types = {
352
352
  'SupplyActivity': { kind: 'OBJECT'; name: 'SupplyActivity'; fields: { 'chain': { name: 'chain'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'Chain'; ofType: null; }; } }; 'id': { name: 'id'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'ID'; ofType: null; }; } }; 'reserve': { name: 'reserve'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'ReserveInfo'; ofType: null; }; } }; 'spoke': { name: 'spoke'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'Spoke'; ofType: null; }; } }; 'supplied': { name: 'supplied'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'Erc20Amount'; ofType: null; }; } }; 'timestamp': { name: 'timestamp'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'DateTime'; ofType: null; }; } }; 'txHash': { name: 'txHash'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'TxHash'; ofType: null; }; } }; 'user': { name: 'user'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'EvmAddress'; ofType: null; }; } }; }; };
353
353
  'SupplyApyHistoryRequest': { kind: 'INPUT_OBJECT'; name: 'SupplyApyHistoryRequest'; isOneOf: false; inputFields: [{ name: 'reserve'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'ReserveId'; ofType: null; }; }; defaultValue: null }, { name: 'window'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'TimeWindow'; ofType: null; }; }; defaultValue: "LAST_DAY" }]; };
354
354
  'SupplyRequest': { kind: 'INPUT_OBJECT'; name: 'SupplyRequest'; isOneOf: false; inputFields: [{ name: 'reserve'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'ReserveId'; ofType: null; }; }; defaultValue: null }, { name: 'amount'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'INPUT_OBJECT'; name: 'ReserveAmountInputWithPermit'; ofType: null; }; }; defaultValue: null }, { name: 'enableCollateral'; type: { kind: 'SCALAR'; name: 'AlwaysTrue'; ofType: null; }; defaultValue: null }, { name: 'sender'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'EvmAddress'; ofType: null; }; }; defaultValue: null }]; };
355
- 'SupplySwap': { kind: 'OBJECT'; name: 'SupplySwap'; fields: { 'buyPosition': { name: 'buyPosition'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'PositionAmount'; ofType: null; }; } }; 'kind': { name: 'kind'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'SupplySwapKind'; ofType: null; }; } }; 'orderClass': { name: 'orderClass'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'SwapOrderClass'; ofType: null; }; } }; 'sellPosition': { name: 'sellPosition'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'PositionAmount'; ofType: null; }; } }; }; };
356
- 'SupplySwapActivity': { kind: 'OBJECT'; name: 'SupplySwapActivity'; fields: { 'bought': { name: 'bought'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'UNION'; name: 'SwapAmount'; ofType: null; }; } }; 'chain': { name: 'chain'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'Chain'; ofType: null; }; } }; 'explorerUrl': { name: 'explorerUrl'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; 'id': { name: 'id'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'ID'; ofType: null; }; } }; 'kind': { name: 'kind'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'SupplySwapKind'; ofType: null; }; } }; 'orderClass': { name: 'orderClass'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'SwapOrderClass'; ofType: null; }; } }; 'sold': { name: 'sold'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'UNION'; name: 'SwapAmount'; ofType: null; }; } }; 'timestamp': { name: 'timestamp'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'DateTime'; ofType: null; }; } }; 'txHash': { name: 'txHash'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'TxHash'; ofType: null; }; } }; 'user': { name: 'user'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'EvmAddress'; ofType: null; }; } }; }; };
355
+ 'SupplySwap': { kind: 'OBJECT'; name: 'SupplySwap'; fields: { 'buy': { name: 'buy'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'PositionAmount'; ofType: null; }; } }; 'kind': { name: 'kind'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'SupplySwapKind'; ofType: null; }; } }; 'orderClass': { name: 'orderClass'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'SwapOrderClass'; ofType: null; }; } }; 'sell': { name: 'sell'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'PositionAmount'; ofType: null; }; } }; }; };
356
+ 'SupplySwapActivity': { kind: 'OBJECT'; name: 'SupplySwapActivity'; fields: { 'buy': { name: 'buy'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'PositionAmount'; ofType: null; }; } }; 'chain': { name: 'chain'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'Chain'; ofType: null; }; } }; 'explorerUrl': { name: 'explorerUrl'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; 'id': { name: 'id'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'ID'; ofType: null; }; } }; 'kind': { name: 'kind'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'SupplySwapKind'; ofType: null; }; } }; 'orderClass': { name: 'orderClass'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'SwapOrderClass'; ofType: null; }; } }; 'sell': { name: 'sell'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'PositionAmount'; ofType: null; }; } }; 'status': { name: 'status'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'SwapActivityStatus'; ofType: null; }; } }; 'timestamp': { name: 'timestamp'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'DateTime'; ofType: null; }; } }; 'txHash': { name: 'txHash'; type: { kind: 'SCALAR'; name: 'TxHash'; ofType: null; } }; 'user': { name: 'user'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'EvmAddress'; ofType: null; }; } }; }; };
357
357
  'SupplySwapKind': { name: 'SupplySwapKind'; enumValues: 'CURRENT' | 'NEW'; };
358
358
  'SupplySwapQuoteRequest': { kind: 'INPUT_OBJECT'; name: 'SupplySwapQuoteRequest'; isOneOf: true; inputFields: [{ name: 'market'; type: { kind: 'INPUT_OBJECT'; name: 'MarketSupplySwapQuoteInput'; ofType: null; }; defaultValue: null }, { name: 'limit'; type: { kind: 'INPUT_OBJECT'; name: 'LimitSupplySwapQuoteInput'; ofType: null; }; defaultValue: null }, { name: 'fromQuote'; type: { kind: 'INPUT_OBJECT'; name: 'FromQuoteSupplySwapQuoteInput'; ofType: null; }; defaultValue: null }]; };
359
359
  'SupplySwapQuoteResult': { kind: 'UNION'; name: 'SupplySwapQuoteResult'; fields: {}; possibleTypes: 'InsufficientLiquidityError' | 'PositionSwapByIntentApprovalsRequired'; };
360
- 'SwapAmount': { kind: 'UNION'; name: 'SwapAmount'; fields: {}; possibleTypes: 'Erc20Amount' | 'NativeAmount' | 'PositionAmount'; };
360
+ 'SwapActivityStatus': { name: 'SwapActivityStatus'; enumValues: 'FULFILLED' | 'CANCELLED' | 'EXPIRED'; };
361
361
  'SwapByIntent': { kind: 'OBJECT'; name: 'SwapByIntent'; fields: { 'quote': { name: 'quote'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'SwapQuote'; ofType: null; }; } }; }; };
362
362
  'SwapByIntentInput': { kind: 'INPUT_OBJECT'; name: 'SwapByIntentInput'; isOneOf: false; inputFields: [{ name: 'quoteId'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'SwapQuoteId'; ofType: null; }; }; defaultValue: null }, { name: 'signature'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'Signature'; ofType: null; }; }; defaultValue: null }]; };
363
363
  'SwapByIntentWithApprovalRequired': { kind: 'OBJECT'; name: 'SwapByIntentWithApprovalRequired'; fields: { 'approval': { name: 'approval'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'Erc20Approval'; ofType: null; }; } }; 'approvals': { name: 'approvals'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'Erc20Approval'; ofType: null; }; }; }; } }; 'quote': { name: 'quote'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'SwapQuote'; ofType: null; }; } }; }; };
@@ -395,8 +395,8 @@ type introspection_types = {
395
395
  'TokenInfo': { kind: 'OBJECT'; name: 'TokenInfo'; fields: { 'categories': { name: 'categories'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'TokenCategory'; ofType: null; }; }; }; } }; 'decimals': { name: 'decimals'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'Int'; ofType: null; }; } }; 'icon': { name: 'icon'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; 'id': { name: 'id'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'TokenInfoId'; ofType: null; }; } }; 'name': { name: 'name'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; 'symbol': { name: 'symbol'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; }; };
396
396
  'TokenInfoId': unknown;
397
397
  'TokenInput': { kind: 'INPUT_OBJECT'; name: 'TokenInput'; isOneOf: true; inputFields: [{ name: 'native'; type: { kind: 'SCALAR'; name: 'AlwaysTrue'; ofType: null; }; defaultValue: null }, { name: 'erc20'; type: { kind: 'SCALAR'; name: 'EvmAddress'; ofType: null; }; defaultValue: null }]; };
398
- 'TokenSwap': { kind: 'OBJECT'; name: 'TokenSwap'; fields: { 'bought': { name: 'bought'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'UNION'; name: 'TokenAmount'; ofType: null; }; } }; 'kind': { name: 'kind'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'TokenSwapKind'; ofType: null; }; } }; 'orderClass': { name: 'orderClass'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'SwapOrderClass'; ofType: null; }; } }; 'sold': { name: 'sold'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'UNION'; name: 'TokenAmount'; ofType: null; }; } }; }; };
399
- 'TokenSwapActivity': { kind: 'OBJECT'; name: 'TokenSwapActivity'; fields: { 'bought': { name: 'bought'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'UNION'; name: 'SwapAmount'; ofType: null; }; } }; 'chain': { name: 'chain'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'Chain'; ofType: null; }; } }; 'explorerUrl': { name: 'explorerUrl'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; 'id': { name: 'id'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'ID'; ofType: null; }; } }; 'kind': { name: 'kind'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'TokenSwapKind'; ofType: null; }; } }; 'orderClass': { name: 'orderClass'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'SwapOrderClass'; ofType: null; }; } }; 'sold': { name: 'sold'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'UNION'; name: 'SwapAmount'; ofType: null; }; } }; 'timestamp': { name: 'timestamp'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'DateTime'; ofType: null; }; } }; 'txHash': { name: 'txHash'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'TxHash'; ofType: null; }; } }; 'user': { name: 'user'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'EvmAddress'; ofType: null; }; } }; }; };
398
+ 'TokenSwap': { kind: 'OBJECT'; name: 'TokenSwap'; fields: { 'buy': { name: 'buy'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'UNION'; name: 'TokenAmount'; ofType: null; }; } }; 'kind': { name: 'kind'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'TokenSwapKind'; ofType: null; }; } }; 'orderClass': { name: 'orderClass'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'SwapOrderClass'; ofType: null; }; } }; 'sell': { name: 'sell'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'UNION'; name: 'TokenAmount'; ofType: null; }; } }; }; };
399
+ 'TokenSwapActivity': { kind: 'OBJECT'; name: 'TokenSwapActivity'; fields: { 'buy': { name: 'buy'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'UNION'; name: 'TokenAmount'; ofType: null; }; } }; 'chain': { name: 'chain'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'Chain'; ofType: null; }; } }; 'explorerUrl': { name: 'explorerUrl'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; 'id': { name: 'id'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'ID'; ofType: null; }; } }; 'kind': { name: 'kind'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'TokenSwapKind'; ofType: null; }; } }; 'orderClass': { name: 'orderClass'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'SwapOrderClass'; ofType: null; }; } }; 'sell': { name: 'sell'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'UNION'; name: 'TokenAmount'; ofType: null; }; } }; 'status': { name: 'status'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'SwapActivityStatus'; ofType: null; }; } }; 'timestamp': { name: 'timestamp'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'DateTime'; ofType: null; }; } }; 'txHash': { name: 'txHash'; type: { kind: 'SCALAR'; name: 'TxHash'; ofType: null; } }; 'user': { name: 'user'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'EvmAddress'; ofType: null; }; } }; }; };
400
400
  'TokenSwapKind': { name: 'TokenSwapKind'; enumValues: 'BUY' | 'SELL'; };
401
401
  'TokenSwapQuoteRequest': { kind: 'INPUT_OBJECT'; name: 'TokenSwapQuoteRequest'; isOneOf: true; inputFields: [{ name: 'market'; type: { kind: 'INPUT_OBJECT'; name: 'MarketOrderTokenSwapQuoteInput'; ofType: null; }; defaultValue: null }, { name: 'limit'; type: { kind: 'INPUT_OBJECT'; name: 'LimitOrderTokenSwapQuoteInput'; ofType: null; }; defaultValue: null }, { name: 'fromQuote'; type: { kind: 'INPUT_OBJECT'; name: 'MarketOrderTokenSwapFromQuoteInput'; ofType: null; }; defaultValue: null }]; };
402
402
  'TokenSwapQuoteResult': { kind: 'UNION'; name: 'TokenSwapQuoteResult'; fields: {}; possibleTypes: 'InsufficientLiquidityError' | 'SwapByIntent' | 'SwapByIntentWithApprovalRequired' | 'SwapByTransaction'; };
@@ -455,8 +455,8 @@ type introspection_types = {
455
455
  'WithdrawActivity': { kind: 'OBJECT'; name: 'WithdrawActivity'; fields: { 'chain': { name: 'chain'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'Chain'; ofType: null; }; } }; 'id': { name: 'id'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'ID'; ofType: null; }; } }; 'reserve': { name: 'reserve'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'ReserveInfo'; ofType: null; }; } }; 'spoke': { name: 'spoke'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'Spoke'; ofType: null; }; } }; 'timestamp': { name: 'timestamp'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'DateTime'; ofType: null; }; } }; 'txHash': { name: 'txHash'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'TxHash'; ofType: null; }; } }; 'user': { name: 'user'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'EvmAddress'; ofType: null; }; } }; 'withdrawn': { name: 'withdrawn'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'Erc20Amount'; ofType: null; }; } }; }; };
456
456
  'WithdrawRequest': { kind: 'INPUT_OBJECT'; name: 'WithdrawRequest'; isOneOf: false; inputFields: [{ name: 'reserve'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'ReserveId'; ofType: null; }; }; defaultValue: null }, { name: 'amount'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'INPUT_OBJECT'; name: 'WithdrawReserveAmountInput'; ofType: null; }; }; defaultValue: null }, { name: 'sender'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'EvmAddress'; ofType: null; }; }; defaultValue: null }]; };
457
457
  'WithdrawReserveAmountInput': { kind: 'INPUT_OBJECT'; name: 'WithdrawReserveAmountInput'; isOneOf: true; inputFields: [{ name: 'native'; type: { kind: 'INPUT_OBJECT'; name: 'AmountInput'; ofType: null; }; defaultValue: null }, { name: 'erc20'; type: { kind: 'INPUT_OBJECT'; name: 'AmountInput'; ofType: null; }; defaultValue: null }]; };
458
- 'WithdrawSwap': { kind: 'OBJECT'; name: 'WithdrawSwap'; fields: { 'buyToken': { name: 'buyToken'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'UNION'; name: 'TokenAmount'; ofType: null; }; } }; 'kind': { name: 'kind'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'WithdrawSwapKind'; ofType: null; }; } }; 'orderClass': { name: 'orderClass'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'SwapOrderClass'; ofType: null; }; } }; 'sellPosition': { name: 'sellPosition'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'PositionAmount'; ofType: null; }; } }; }; };
459
- 'WithdrawSwapActivity': { kind: 'OBJECT'; name: 'WithdrawSwapActivity'; fields: { 'bought': { name: 'bought'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'UNION'; name: 'SwapAmount'; ofType: null; }; } }; 'chain': { name: 'chain'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'Chain'; ofType: null; }; } }; 'explorerUrl': { name: 'explorerUrl'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; 'id': { name: 'id'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'ID'; ofType: null; }; } }; 'kind': { name: 'kind'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'WithdrawSwapKind'; ofType: null; }; } }; 'orderClass': { name: 'orderClass'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'SwapOrderClass'; ofType: null; }; } }; 'timestamp': { name: 'timestamp'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'DateTime'; ofType: null; }; } }; 'txHash': { name: 'txHash'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'TxHash'; ofType: null; }; } }; 'user': { name: 'user'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'EvmAddress'; ofType: null; }; } }; 'withdrawn': { name: 'withdrawn'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'UNION'; name: 'SwapAmount'; ofType: null; }; } }; }; };
458
+ 'WithdrawSwap': { kind: 'OBJECT'; name: 'WithdrawSwap'; fields: { 'buy': { name: 'buy'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'UNION'; name: 'TokenAmount'; ofType: null; }; } }; 'kind': { name: 'kind'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'WithdrawSwapKind'; ofType: null; }; } }; 'orderClass': { name: 'orderClass'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'SwapOrderClass'; ofType: null; }; } }; 'withdraw': { name: 'withdraw'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'PositionAmount'; ofType: null; }; } }; }; };
459
+ 'WithdrawSwapActivity': { kind: 'OBJECT'; name: 'WithdrawSwapActivity'; fields: { 'buy': { name: 'buy'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'UNION'; name: 'TokenAmount'; ofType: null; }; } }; 'chain': { name: 'chain'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'Chain'; ofType: null; }; } }; 'explorerUrl': { name: 'explorerUrl'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; 'id': { name: 'id'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'ID'; ofType: null; }; } }; 'kind': { name: 'kind'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'WithdrawSwapKind'; ofType: null; }; } }; 'orderClass': { name: 'orderClass'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'SwapOrderClass'; ofType: null; }; } }; 'status': { name: 'status'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'SwapActivityStatus'; ofType: null; }; } }; 'timestamp': { name: 'timestamp'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'DateTime'; ofType: null; }; } }; 'txHash': { name: 'txHash'; type: { kind: 'SCALAR'; name: 'TxHash'; ofType: null; } }; 'user': { name: 'user'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'EvmAddress'; ofType: null; }; } }; 'withdraw': { name: 'withdraw'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'PositionAmount'; ofType: null; }; } }; }; };
460
460
  'WithdrawSwapKind': { name: 'WithdrawSwapKind'; enumValues: 'WITHDRAW' | 'BUY'; };
461
461
  'WithdrawSwapQuoteRequest': { kind: 'INPUT_OBJECT'; name: 'WithdrawSwapQuoteRequest'; isOneOf: true; inputFields: [{ name: 'market'; type: { kind: 'INPUT_OBJECT'; name: 'MarketWithdrawSwapQuoteInput'; ofType: null; }; defaultValue: null }, { name: 'limit'; type: { kind: 'INPUT_OBJECT'; name: 'LimitWithdrawSwapQuoteInput'; ofType: null; }; defaultValue: null }, { name: 'fromQuote'; type: { kind: 'INPUT_OBJECT'; name: 'FromQuoteWithdrawSwapQuoteInput'; ofType: null; }; defaultValue: null }]; };
462
462
  'WithdrawSwapQuoteResult': { kind: 'UNION'; name: 'WithdrawSwapQuoteResult'; fields: {}; possibleTypes: 'InsufficientLiquidityError' | 'PositionSwapByIntentApprovalsRequired'; };
@@ -4625,7 +4625,7 @@ declare const SwapTransactionRequestFragment: gql_tada.TadaDocumentNode<{
4625
4625
  type SwapTransactionRequest = FragmentOf<typeof SwapTransactionRequestFragment>;
4626
4626
  declare const TokenSwapFragment: gql_tada.TadaDocumentNode<{
4627
4627
  __typename: "TokenSwap";
4628
- sold: {
4628
+ sell: {
4629
4629
  __typename: "Erc20Amount";
4630
4630
  token: {
4631
4631
  __typename: "Erc20Token";
@@ -4740,7 +4740,7 @@ declare const TokenSwapFragment: gql_tada.TadaDocumentNode<{
4740
4740
  value: _aave_types.BigDecimal;
4741
4741
  };
4742
4742
  };
4743
- bought: {
4743
+ buy: {
4744
4744
  __typename: "Erc20Amount";
4745
4745
  token: {
4746
4746
  __typename: "Erc20Token";
@@ -4871,7 +4871,7 @@ declare const SwapCancelledFragment: gql_tada.TadaDocumentNode<{
4871
4871
  explorerUrl: string;
4872
4872
  operation: {
4873
4873
  __typename: "TokenSwap";
4874
- sold: {
4874
+ sell: {
4875
4875
  __typename: "Erc20Amount";
4876
4876
  token: {
4877
4877
  __typename: "Erc20Token";
@@ -4986,7 +4986,7 @@ declare const SwapCancelledFragment: gql_tada.TadaDocumentNode<{
4986
4986
  value: _aave_types.BigDecimal;
4987
4987
  };
4988
4988
  };
4989
- bought: {
4989
+ buy: {
4990
4990
  __typename: "Erc20Amount";
4991
4991
  token: {
4992
4992
  __typename: "Erc20Token";
@@ -5105,7 +5105,7 @@ declare const SwapCancelledFragment: gql_tada.TadaDocumentNode<{
5105
5105
  orderClass: SwapOrderClass;
5106
5106
  } | {
5107
5107
  __typename: "SupplySwap";
5108
- sellPosition: {
5108
+ sell: {
5109
5109
  __typename: "PositionAmount";
5110
5110
  reserve: {
5111
5111
  __typename: "ReserveInfo";
@@ -5585,7 +5585,7 @@ declare const SwapCancelledFragment: gql_tada.TadaDocumentNode<{
5585
5585
  };
5586
5586
  };
5587
5587
  };
5588
- buyPosition: {
5588
+ buy: {
5589
5589
  __typename: "PositionAmount";
5590
5590
  reserve: {
5591
5591
  __typename: "ReserveInfo";
@@ -6069,7 +6069,7 @@ declare const SwapCancelledFragment: gql_tada.TadaDocumentNode<{
6069
6069
  orderClass: SwapOrderClass;
6070
6070
  } | {
6071
6071
  __typename: "BorrowSwap";
6072
- sellPosition: {
6072
+ sell: {
6073
6073
  __typename: "PositionAmount";
6074
6074
  reserve: {
6075
6075
  __typename: "ReserveInfo";
@@ -6549,7 +6549,7 @@ declare const SwapCancelledFragment: gql_tada.TadaDocumentNode<{
6549
6549
  };
6550
6550
  };
6551
6551
  };
6552
- buyPosition: {
6552
+ buy: {
6553
6553
  __typename: "PositionAmount";
6554
6554
  reserve: {
6555
6555
  __typename: "ReserveInfo";
@@ -7033,7 +7033,7 @@ declare const SwapCancelledFragment: gql_tada.TadaDocumentNode<{
7033
7033
  orderClass: SwapOrderClass;
7034
7034
  } | {
7035
7035
  __typename: "RepayWithSupply";
7036
- sellPosition: {
7036
+ repay: {
7037
7037
  __typename: "PositionAmount";
7038
7038
  reserve: {
7039
7039
  __typename: "ReserveInfo";
@@ -7513,7 +7513,7 @@ declare const SwapCancelledFragment: gql_tada.TadaDocumentNode<{
7513
7513
  };
7514
7514
  };
7515
7515
  };
7516
- buyPosition: {
7516
+ supply: {
7517
7517
  __typename: "PositionAmount";
7518
7518
  reserve: {
7519
7519
  __typename: "ReserveInfo";
@@ -7997,7 +7997,7 @@ declare const SwapCancelledFragment: gql_tada.TadaDocumentNode<{
7997
7997
  orderClass: SwapOrderClass;
7998
7998
  } | {
7999
7999
  __typename: "WithdrawSwap";
8000
- sellPosition: {
8000
+ withdraw: {
8001
8001
  __typename: "PositionAmount";
8002
8002
  reserve: {
8003
8003
  __typename: "ReserveInfo";
@@ -8477,7 +8477,7 @@ declare const SwapCancelledFragment: gql_tada.TadaDocumentNode<{
8477
8477
  };
8478
8478
  };
8479
8479
  };
8480
- buyToken: {
8480
+ buy: {
8481
8481
  __typename: "Erc20Amount";
8482
8482
  token: {
8483
8483
  __typename: "Erc20Token";
@@ -8609,7 +8609,7 @@ declare const SwapOpenFragment: gql_tada.TadaDocumentNode<{
8609
8609
  explorerUrl: string;
8610
8610
  operation: {
8611
8611
  __typename: "TokenSwap";
8612
- sold: {
8612
+ sell: {
8613
8613
  __typename: "Erc20Amount";
8614
8614
  token: {
8615
8615
  __typename: "Erc20Token";
@@ -8724,7 +8724,7 @@ declare const SwapOpenFragment: gql_tada.TadaDocumentNode<{
8724
8724
  value: _aave_types.BigDecimal;
8725
8725
  };
8726
8726
  };
8727
- bought: {
8727
+ buy: {
8728
8728
  __typename: "Erc20Amount";
8729
8729
  token: {
8730
8730
  __typename: "Erc20Token";
@@ -8843,7 +8843,7 @@ declare const SwapOpenFragment: gql_tada.TadaDocumentNode<{
8843
8843
  orderClass: SwapOrderClass;
8844
8844
  } | {
8845
8845
  __typename: "SupplySwap";
8846
- sellPosition: {
8846
+ sell: {
8847
8847
  __typename: "PositionAmount";
8848
8848
  reserve: {
8849
8849
  __typename: "ReserveInfo";
@@ -9323,7 +9323,7 @@ declare const SwapOpenFragment: gql_tada.TadaDocumentNode<{
9323
9323
  };
9324
9324
  };
9325
9325
  };
9326
- buyPosition: {
9326
+ buy: {
9327
9327
  __typename: "PositionAmount";
9328
9328
  reserve: {
9329
9329
  __typename: "ReserveInfo";
@@ -9807,7 +9807,7 @@ declare const SwapOpenFragment: gql_tada.TadaDocumentNode<{
9807
9807
  orderClass: SwapOrderClass;
9808
9808
  } | {
9809
9809
  __typename: "BorrowSwap";
9810
- sellPosition: {
9810
+ sell: {
9811
9811
  __typename: "PositionAmount";
9812
9812
  reserve: {
9813
9813
  __typename: "ReserveInfo";
@@ -10287,7 +10287,7 @@ declare const SwapOpenFragment: gql_tada.TadaDocumentNode<{
10287
10287
  };
10288
10288
  };
10289
10289
  };
10290
- buyPosition: {
10290
+ buy: {
10291
10291
  __typename: "PositionAmount";
10292
10292
  reserve: {
10293
10293
  __typename: "ReserveInfo";
@@ -10771,7 +10771,7 @@ declare const SwapOpenFragment: gql_tada.TadaDocumentNode<{
10771
10771
  orderClass: SwapOrderClass;
10772
10772
  } | {
10773
10773
  __typename: "RepayWithSupply";
10774
- sellPosition: {
10774
+ repay: {
10775
10775
  __typename: "PositionAmount";
10776
10776
  reserve: {
10777
10777
  __typename: "ReserveInfo";
@@ -11251,7 +11251,7 @@ declare const SwapOpenFragment: gql_tada.TadaDocumentNode<{
11251
11251
  };
11252
11252
  };
11253
11253
  };
11254
- buyPosition: {
11254
+ supply: {
11255
11255
  __typename: "PositionAmount";
11256
11256
  reserve: {
11257
11257
  __typename: "ReserveInfo";
@@ -11735,7 +11735,7 @@ declare const SwapOpenFragment: gql_tada.TadaDocumentNode<{
11735
11735
  orderClass: SwapOrderClass;
11736
11736
  } | {
11737
11737
  __typename: "WithdrawSwap";
11738
- sellPosition: {
11738
+ withdraw: {
11739
11739
  __typename: "PositionAmount";
11740
11740
  reserve: {
11741
11741
  __typename: "ReserveInfo";
@@ -12215,7 +12215,7 @@ declare const SwapOpenFragment: gql_tada.TadaDocumentNode<{
12215
12215
  };
12216
12216
  };
12217
12217
  };
12218
- buyToken: {
12218
+ buy: {
12219
12219
  __typename: "Erc20Amount";
12220
12220
  token: {
12221
12221
  __typename: "Erc20Token";
package/dist/testing.js CHANGED
@@ -1,3 +1,3 @@
1
- import {bigDecimal,evmAddress,chainId,invariant}from'@aave/types';function u(e){return invariant(typeof e=="string"&&e.length>0,`Invalid UserBorrowItemId: ${e}`),invariant(/^[A-Za-z0-9+/]*={0,2}$/.test(e),`UserBorrowItemId must be valid base64: ${e}`),e}function y(e){return invariant(typeof e=="string"&&e.length>0,`Invalid UserSupplyItemId: ${e}`),invariant(/^[A-Za-z0-9+/]*={0,2}$/.test(e),`UserSupplyItemId must be valid base64: ${e}`),e}function S(e){return invariant(typeof e=="string"&&e.length>0,`Invalid TokenInfoId: ${e}`),e}function a(){return btoa(crypto.randomUUID())}function q(){return u(a())}function N(){return y(a())}function O(){return a()}function T(e,t=6){let o=bigDecimal(e);return {__typename:"PercentNumber",value:o.div(2),normalized:o,onChainValue:BigInt(o.rescale(t).toApproximateNumber()),decimals:t}}function g(e,t=18){return {__typename:"DecimalNumber",value:bigDecimal(e),onChainValue:BigInt(bigDecimal(e).rescale(t).toApproximateNumber()),decimals:t}}function k(e){return [...Array(e)].map(()=>Math.floor(Math.random()*16).toString(16)).join("")}function r(){return evmAddress(`0x${k(40)}`)}var i={WETH:{name:"Wrapped Ether",decimals:18,address:"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",isWrappedNativeToken:true},USDC:{name:"USD Coin",decimals:6,address:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",isWrappedNativeToken:false},GHO:{name:"Gho Token",decimals:18,address:"0x40D16FC0246aD3160Ccc09B8D0D3A2cD28aE6C2f",isWrappedNativeToken:false},AAVE:{name:"Aave Token",decimals:18,address:"0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9",isWrappedNativeToken:false}};function l(e){let{name:t,decimals:o}=i[e];return {__typename:"TokenInfo",id:S(a()),name:t,symbol:e,decimals:o,icon:"https://example.com/icon.png",categories:[]}}function A(){return {__typename:"Chain",name:"Ethereum",icon:"https://example.com/icon.png",chainId:chainId(1),rpcUrl:"https://example.com/rpc.json",explorerUrl:"https://example.com/explorer.json",isTestnet:false,isFork:false,nativeWrappedToken:r(),nativeGateway:r(),signatureGateway:r(),nativeInfo:l("WETH")}}function h(e){let{isWrappedNativeToken:t}=i[e];return {__typename:"Erc20Token",address:r(),chain:A(),info:l(e),isWrappedNativeToken:t}}function b(e){return {__typename:"ExchangeAmount",value:bigDecimal(e),name:"USD",symbol:"$",icon:"https://example.com/icon.png",decimals:2}}function n(e,t){return {__typename:"Erc20Amount",amount:g(e,i[t].decimals),token:h(t),exchange:b(e),exchangeRate:g(e)}}function c({chainId:e=chainId(1),from:t=r()}={}){return {__typename:"TransactionRequest",to:t,from:t,data:"0x",value:0n,chainId:e,operations:[]}}function I(){return {__typename:"SwapTypedData",primaryType:"Swap",types:{Swap:[{name:"amount",type:"uint256"},{name:"deadline",type:"uint256"}]},domain:{__typename:"DomainData",name:"Swap",version:"1",chainId:chainId(1),verifyingContract:r()},message:{amount:"1000000000000000000",deadline:1234567890}}}function w(){return a()}function m({accuracy:e="ACCURATE",buyAmount:t=1e3}={}){return {__typename:"SwapQuote",accuracy:e,quoteId:w(),suggestedSlippage:T(.01),selectedSlippage:null,buy:n(t,"USDC"),sell:n(1e3,"WETH"),costs:{__typename:"SwapQuoteCosts",networkCosts:n(1e3,"WETH"),partnerFee:n(1e3,"USDC"),flashloanFee:n(1e3,"WETH"),providerFee:n(1e3,"USDC")},finalBuy:n(t,"USDC"),finalSell:n(1e3,"WETH")}}function C(){return {__typename:"SwapReceipt",id:a(),createdAt:new Date,explorerUrl:"https://example.com/explorer.json"}}function x(){return {__typename:"TokenSwap",sold:n(1e3,"WETH"),bought:n(1e3,"USDC"),kind:"SELL",orderClass:"MARKET"}}function Q(){return {__typename:"SwapOpen",swapId:a(),createdAt:new Date,deadline:new Date(Date.now()+36e5),explorerUrl:"https://example.com/explorer.json",operation:x()}}function W(){return {__typename:"SwapCancelled",swapId:a(),createdAt:new Date,cancelledAt:new Date,explorerUrl:"https://example.com/explorer.json",operation:x()}}function z(){return {__typename:"SwapCancelledResult",swapId:a(),createdAt:new Date,cancelledAt:new Date,explorerUrl:"https://example.com/explorer.json"}}function M({bySignature:e=I()}={}){return {__typename:"PositionSwapAdapterContractApproval",bySignature:e}}function Z({bySignature:e=I(),byTransaction:t=c()}={}){return {__typename:"PositionSwapPositionManagerApproval",bySignature:e,byTransaction:t}}function j({transaction:e=c()}={}){return {__typename:"SwapTransactionRequest",transaction:e,orderReceipt:C()}}function F(){return {__typename:"SwapByTransaction",quote:m()}}function G({quote:e=m()}={}){return {__typename:"SwapByIntent",quote:e}}function V(){return {__typename:"PrepareSwapOrder",newQuoteId:w(),data:I()}}function _(){return {__typename:"PermitTypedData",types:{EIP712Domain:[{name:"name",type:"string"}],Permit:[{name:"owner",type:"address"},{name:"spender",type:"address"},{name:"value",type:"uint256"},{name:"nonce",type:"uint256"},{name:"deadline",type:"uint256"}]},primaryType:"Permit",domain:{__typename:"DomainData",name:"Permit",version:"1",chainId:chainId(1),verifyingContract:r()},message:{owner:r(),spender:r(),value:"1000000000000000000",nonce:"0",deadline:1234567890}}}function D({byTransaction:e=c()}={}){return {__typename:"Erc20Approval",byTransaction:e,bySignature:_()}}function K({approval:e=D()}={}){return {__typename:"SwapByIntentWithApprovalRequired",quote:m(),approvals:[e]}}
1
+ import {bigDecimal,evmAddress,chainId,invariant}from'@aave/types';function u(e){return invariant(typeof e=="string"&&e.length>0,`Invalid UserBorrowItemId: ${e}`),invariant(/^[A-Za-z0-9+/]*={0,2}$/.test(e),`UserBorrowItemId must be valid base64: ${e}`),e}function y(e){return invariant(typeof e=="string"&&e.length>0,`Invalid UserSupplyItemId: ${e}`),invariant(/^[A-Za-z0-9+/]*={0,2}$/.test(e),`UserSupplyItemId must be valid base64: ${e}`),e}function S(e){return invariant(typeof e=="string"&&e.length>0,`Invalid TokenInfoId: ${e}`),e}function a(){return btoa(crypto.randomUUID())}function q(){return u(a())}function N(){return y(a())}function O(){return a()}function T(e,t=6){let o=bigDecimal(e);return {__typename:"PercentNumber",value:o.div(2),normalized:o,onChainValue:BigInt(o.rescale(t).toApproximateNumber()),decimals:t}}function g(e,t=18){return {__typename:"DecimalNumber",value:bigDecimal(e),onChainValue:BigInt(bigDecimal(e).rescale(t).toApproximateNumber()),decimals:t}}function k(e){return [...Array(e)].map(()=>Math.floor(Math.random()*16).toString(16)).join("")}function r(){return evmAddress(`0x${k(40)}`)}var i={WETH:{name:"Wrapped Ether",decimals:18,address:"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",isWrappedNativeToken:true},USDC:{name:"USD Coin",decimals:6,address:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",isWrappedNativeToken:false},GHO:{name:"Gho Token",decimals:18,address:"0x40D16FC0246aD3160Ccc09B8D0D3A2cD28aE6C2f",isWrappedNativeToken:false},AAVE:{name:"Aave Token",decimals:18,address:"0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9",isWrappedNativeToken:false}};function l(e){let{name:t,decimals:o}=i[e];return {__typename:"TokenInfo",id:S(a()),name:t,symbol:e,decimals:o,icon:"https://example.com/icon.png",categories:[]}}function A(){return {__typename:"Chain",name:"Ethereum",icon:"https://example.com/icon.png",chainId:chainId(1),rpcUrl:"https://example.com/rpc.json",explorerUrl:"https://example.com/explorer.json",isTestnet:false,isFork:false,nativeWrappedToken:r(),nativeGateway:r(),signatureGateway:r(),nativeInfo:l("WETH")}}function h(e){let{isWrappedNativeToken:t}=i[e];return {__typename:"Erc20Token",address:r(),chain:A(),info:l(e),isWrappedNativeToken:t}}function b(e){return {__typename:"ExchangeAmount",value:bigDecimal(e),name:"USD",symbol:"$",icon:"https://example.com/icon.png",decimals:2}}function n(e,t){return {__typename:"Erc20Amount",amount:g(e,i[t].decimals),token:h(t),exchange:b(e),exchangeRate:g(e)}}function c({chainId:e=chainId(1),from:t=r()}={}){return {__typename:"TransactionRequest",to:t,from:t,data:"0x",value:0n,chainId:e,operations:[]}}function I(){return {__typename:"SwapTypedData",primaryType:"Swap",types:{Swap:[{name:"amount",type:"uint256"},{name:"deadline",type:"uint256"}]},domain:{__typename:"DomainData",name:"Swap",version:"1",chainId:chainId(1),verifyingContract:r()},message:{amount:"1000000000000000000",deadline:1234567890}}}function w(){return a()}function m({accuracy:e="ACCURATE",buyAmount:t=1e3}={}){return {__typename:"SwapQuote",accuracy:e,quoteId:w(),suggestedSlippage:T(.01),selectedSlippage:null,buy:n(t,"USDC"),sell:n(1e3,"WETH"),costs:{__typename:"SwapQuoteCosts",networkCosts:n(1e3,"WETH"),partnerFee:n(1e3,"USDC"),flashloanFee:n(1e3,"WETH"),providerFee:n(1e3,"USDC")},finalBuy:n(t,"USDC"),finalSell:n(1e3,"WETH")}}function C(){return {__typename:"SwapReceipt",id:a(),createdAt:new Date,explorerUrl:"https://example.com/explorer.json"}}function x(){return {__typename:"TokenSwap",sell:n(1e3,"WETH"),buy:n(1e3,"USDC"),kind:"SELL",orderClass:"MARKET"}}function Q(){return {__typename:"SwapOpen",swapId:a(),createdAt:new Date,deadline:new Date(Date.now()+36e5),explorerUrl:"https://example.com/explorer.json",operation:x()}}function W(){return {__typename:"SwapCancelled",swapId:a(),createdAt:new Date,cancelledAt:new Date,explorerUrl:"https://example.com/explorer.json",operation:x()}}function z(){return {__typename:"SwapCancelledResult",swapId:a(),createdAt:new Date,cancelledAt:new Date,explorerUrl:"https://example.com/explorer.json"}}function M({bySignature:e=I()}={}){return {__typename:"PositionSwapAdapterContractApproval",bySignature:e}}function Z({bySignature:e=I(),byTransaction:t=c()}={}){return {__typename:"PositionSwapPositionManagerApproval",bySignature:e,byTransaction:t}}function j({transaction:e=c()}={}){return {__typename:"SwapTransactionRequest",transaction:e,orderReceipt:C()}}function F(){return {__typename:"SwapByTransaction",quote:m()}}function G({quote:e=m()}={}){return {__typename:"SwapByIntent",quote:e}}function V(){return {__typename:"PrepareSwapOrder",newQuoteId:w(),data:I()}}function _(){return {__typename:"PermitTypedData",types:{EIP712Domain:[{name:"name",type:"string"}],Permit:[{name:"owner",type:"address"},{name:"spender",type:"address"},{name:"value",type:"uint256"},{name:"nonce",type:"uint256"},{name:"deadline",type:"uint256"}]},primaryType:"Permit",domain:{__typename:"DomainData",name:"Permit",version:"1",chainId:chainId(1),verifyingContract:r()},message:{owner:r(),spender:r(),value:"1000000000000000000",nonce:"0",deadline:1234567890}}}function D({byTransaction:e=c()}={}){return {__typename:"Erc20Approval",byTransaction:e,bySignature:_()}}function K({approval:e=D()}={}){return {__typename:"SwapByIntentWithApprovalRequired",quote:m(),approvals:[e]}}
2
2
  export{i as TestTokens,g as decimalNumber,A as makeChain,n as makeErc20Amount,D as makeErc20Approval,h as makeErc20Token,b as makeExchangeAmount,_ as makePermitTypedData,M as makePositionSwapAdapterContractApproval,Z as makePositionSwapPositionManagerApproval,V as makePrepareSwapOrder,O as makeReserveId,G as makeSwapByIntent,K as makeSwapByIntentWithApprovalRequired,F as makeSwapByTransaction,W as makeSwapCancelled,z as makeSwapCancelledResult,Q as makeSwapOpen,m as makeSwapQuote,C as makeSwapReceipt,j as makeSwapTransactionRequest,I as makeSwapTypedData,l as makeTokenInfo,x as makeTokenSwap,c as makeTransactionRequest,q as makeUserBorrowItemId,N as makeUserSupplyItemId,T as percentNumber,r as randomEvmAddress};//# sourceMappingURL=testing.js.map
3
3
  //# sourceMappingURL=testing.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/id.ts","../src/testing.ts"],"names":["userBorrowItemId","value","invariant","userSupplyItemId","tokenInfoId","randomBase64String","makeUserBorrowItemId","makeUserSupplyItemId","makeReserveId","percentNumber","decimals","normalized","bigDecimal","decimalNumber","randomHexString","size","randomEvmAddress","evmAddress","TestTokens","makeTokenInfo","symbol","name","makeChain","toChainId","makeErc20Token","isWrappedNativeToken","makeExchangeAmount","makeErc20Amount","makeTransactionRequest","chainId","from","makeSwapTypedData","makeQuoteId","makeSwapQuote","accuracy","buyAmount","makeSwapReceipt","makeTokenSwap","makeSwapOpen","makeSwapCancelled","makeSwapCancelledResult","makePositionSwapAdapterContractApproval","bySignature","makePositionSwapPositionManagerApproval","byTransaction","makeSwapTransactionRequest","transaction","makeSwapByTransaction","makeSwapByIntent","quote","makePrepareSwapOrder","makePermitTypedData","makeErc20Approval","makeSwapByIntentWithApprovalRequired","approval"],"mappings":"kEA6YO,SAASA,CAAAA,CAAiBC,CAAAA,CAAiC,CAChE,OAAAC,SAAAA,CACE,OAAOD,CAAAA,EAAU,QAAA,EAAYA,CAAAA,CAAM,OAAS,CAAA,CAC5C,CAAA,0BAAA,EAA6BA,CAAK,CAAA,CACpC,CAAA,CAEAC,SAAAA,CACE,wBAAA,CAAyB,IAAA,CAAKD,CAAK,CAAA,CACnC,CAAA,uCAAA,EAA0CA,CAAK,CAAA,CACjD,CAAA,CACOA,CACT,CAcO,SAASE,CAAAA,CAAiBF,CAAAA,CAAiC,CAChE,OAAAC,SAAAA,CACE,OAAOD,CAAAA,EAAU,QAAA,EAAYA,CAAAA,CAAM,MAAA,CAAS,CAAA,CAC5C,CAAA,0BAAA,EAA6BA,CAAK,CAAA,CACpC,CAAA,CAEAC,SAAAA,CACE,wBAAA,CAAyB,IAAA,CAAKD,CAAK,CAAA,CACnC,CAAA,uCAAA,EAA0CA,CAAK,CAAA,CACjD,CAAA,CACOA,CACT,CAUO,SAASG,EAAYH,CAAAA,CAA4B,CACtD,OAAAC,SAAAA,CACE,OAAOD,CAAAA,EAAU,QAAA,EAAYA,CAAAA,CAA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,CAAM,SAAU,CAAA,CACnC,CAAE,IAAA,CAAM,OAAA,CAAS,IAAA,CAAM,SAAU,CAAA,CACjC,CAAE,IAAA,CAAM,OAAA,CAAS,IAAA,CAAM,SAAU,EACjC,CAAE,IAAA,CAAM,UAAA,CAAY,IAAA,CAAM,SAAU,CACtC,CACF,CAAA,CACA,WAAA,CAAa,QAAA,CACb,MAAA,CAAQ,CACN,UAAA,CAAY,YAAA,CACZ,KAAM,QAAA,CACN,OAAA,CAAS,GAAA,CACT,OAAA,CAAS5B,OAAAA,CAAU,CAAC,CAAA,CACpB,iBAAA,CAAmBP,CAAAA,EACrB,CAAA,CACA,OAAA,CAAS,CACP,KAAA,CAAOA,GAAiB,CACxB,OAAA,CAASA,CAAAA,EAAiB,CAC1B,KAAA,CAAO,qBAAA,CACP,KAAA,CAAO,GAAA,CACP,QAAA,CAAU,UACZ,CACF,CACF,CAKO,SAASoC,EAAkB,CAChC,aAAA,CAAAR,CAAAA,CAAgBhB,CAAAA,EAClB,CAAA,CAEI,EAAC,CAAkB,CACrB,OAAO,CACL,UAAA,CAAY,eAAA,CACZ,aAAA,CAAAgB,EACA,WAAA,CAAaO,CAAAA,EACf,CACF,CAKO,SAASE,CAAAA,CAAqC,CACnD,QAAA,CAAAC,CAAAA,CAAWF,CAAAA,EACb,CAAA,CAEI,GAAsC,CACxC,OAAO,CACL,UAAA,CAAY,kCAAA,CACZ,KAAA,CAAOnB,CAAAA,EAAc,CACrB,SAAA,CAAW,CAACqB,CAAQ,CACtB,CACF","file":"testing.js","sourcesContent":["import {\n type ChainId,\n chainId,\n type EvmAddress,\n evmAddress,\n invariant,\n isValidHexString,\n} from '@aave/types';\nimport type { Tagged } from 'type-fest';\n\n/**\n * An identifier.\n */\nexport type ID = Tagged<string, 'ID'>;\n\n/**\n * A base64 encoded composite identifier.\n *\n * @internal\n */\nexport type Base64EncodedCompositeId = Tagged<\n string,\n 'Base64EncodedCompositeId'\n>;\n\nfunction decodeBase64(value: Base64EncodedCompositeId): string {\n return new TextDecoder().decode(\n Uint8Array.from(atob(value), (c) => c.charCodeAt(0)),\n );\n}\n\nfunction encodeBase64(value: string): Base64EncodedCompositeId {\n return btoa(\n String.fromCharCode(...new TextEncoder().encode(value)),\n ) as Base64EncodedCompositeId;\n}\n\nconst COMPOSITE_ID_SEPARATOR = '::';\n\n/**\n * An asset identifier.\n */\nexport type AssetId = Tagged<Base64EncodedCompositeId, 'AssetId'>;\n\n/**\n * Creates an asset identifier from a given base64 value.\n *\n * @remarks\n * This is meant to be used in tests and POC context. In normal circumstances\n * use the `Asset.id` retrieved from another API call.\n */\nexport function assetId(value: string): AssetId {\n invariant(\n typeof value === 'string' && value.length > 0,\n `Invalid AssetId: ${value}`,\n );\n // Basic base64 validation - contains only valid base64 characters\n invariant(\n /^[A-Za-z0-9+/]*={0,2}$/.test(value),\n `AssetId must be valid base64: ${value}`,\n );\n return value as AssetId;\n}\n\n/**\n * A hub identifier.\n */\nexport type HubId = Tagged<Base64EncodedCompositeId, 'HubId'>;\n\n/**\n * Creates a hub identifier from a given base64 value.\n *\n * @remarks\n * This is meant to be used in tests and POC context. In normal circumstances\n * use the `Hub.id` retrieved from another API call.\n */\nexport function hubId(value: string): HubId {\n invariant(\n typeof value === 'string' && value.length > 0,\n `Invalid HubId: ${value}`,\n );\n // Basic base64 validation - contains only valid base64 characters\n invariant(\n /^[A-Za-z0-9+/]*={0,2}$/.test(value),\n `HubId must be valid base64: ${value}`,\n );\n return value as HubId;\n}\n\n/**\n * @internal\n */\nexport type HubIdParts = {\n address: EvmAddress;\n chainId: ChainId;\n};\n\n/**\n * @internal\n */\nexport function encodeHubId(hub: HubIdParts): HubId {\n return hubId(\n encodeBase64(`${hub.chainId}${COMPOSITE_ID_SEPARATOR}${hub.address}`),\n );\n}\n\n/**\n * @internal\n */\nexport function decodeHubId(value: HubId): HubIdParts {\n const decoded = decodeBase64(value);\n const [a, b] = decoded.split(COMPOSITE_ID_SEPARATOR) as [string, string];\n return {\n chainId: chainId(Number.parseInt(a, 10)),\n address: evmAddress(b),\n };\n}\n\n/**\n * A hub asset identifier.\n */\nexport type HubAssetId = Tagged<Base64EncodedCompositeId, 'HubAssetId'>;\n\n/**\n * Creates a hub asset identifier from a given base64 value.\n *\n * @remarks\n * This is meant to be used in tests and POC context. In normal circumstances\n * use the `HubAsset.id` retrieved from another API call.\n */\nexport function hubAssetId(value: string): HubAssetId {\n invariant(\n typeof value === 'string' && value.length > 0,\n `Invalid HubAssetId: ${value}`,\n );\n // Basic base64 validation - contains only valid base64 characters\n invariant(\n /^[A-Za-z0-9+/]*={0,2}$/.test(value),\n `HubAssetId must be valid base64: ${value}`,\n );\n return value as HubAssetId;\n}\n\n/**\n * The on-chain ID of a HubAsset. This is scoped to the specific Hub.\n */\nexport type OnChainHubAssetId = Tagged<number, 'OnChainHubAssetId'>;\n\n/**\n * The on-chain ID of a Reserve. This is scoped to the specific Spoke.\n */\nexport type OnChainReserveId = Tagged<string, 'OnChainReserveId'>;\n\n/**\n * A reserve identifier.\n */\nexport type ReserveId = Tagged<Base64EncodedCompositeId, 'ReserveId'>;\n\n/**\n * Creates a reserve identifier from a given value.\n *\n * @remarks\n * This is meant to be used in tests and POC context. In normal ciscumstances\n * use the `Reserve.id` from data retrieved from the API.\n */\nexport function reserveId(value: string): ReserveId {\n return value as ReserveId;\n}\n\n/**\n * @internal\n */\nexport type ReserveIdParts = {\n chainId: ChainId;\n spoke: EvmAddress;\n onChainId: OnChainReserveId;\n};\n\n/**\n * @internal\n */\nexport function decodeReserveId(value: ReserveId): ReserveIdParts {\n const decoded = decodeBase64(value);\n const [a, b, c] = decoded.split(COMPOSITE_ID_SEPARATOR) as [\n string,\n string,\n string,\n ];\n return {\n chainId: chainId(Number.parseInt(a, 10)),\n spoke: evmAddress(b),\n onChainId: c as OnChainReserveId,\n };\n}\n\n/**\n * @internal\n */\nexport function encodeReserveId(reserve: ReserveIdParts): ReserveId {\n return reserveId(\n encodeBase64(\n `${reserve.chainId}${COMPOSITE_ID_SEPARATOR}${reserve.spoke}${COMPOSITE_ID_SEPARATOR}${reserve.onChainId}`,\n ),\n );\n}\n\n/**\n * A user position identifier.\n */\nexport type UserPositionId = Tagged<string, 'UserPositionId'>;\n\n/**\n * Creates a user position identifier from a given base64 value.\n *\n * @remarks\n * This is meant to be used in tests and POC context. In normal ciscumstances\n * use the `UserPosition.id` retrieved from another API call.\n */\nexport function userPositionId(value: string): UserPositionId {\n invariant(\n typeof value === 'string' && value.length > 0,\n `Invalid UserPositionId: ${value}`,\n );\n // Basic base64 validation - contains only valid base64 characters\n invariant(\n /^[A-Za-z0-9+/]*={0,2}$/.test(value),\n `UserPositionId must be valid base64: ${value}`,\n );\n return value as UserPositionId;\n}\n\n/**\n * @internal\n */\nexport type UserPositionIdParts = {\n chainId: ChainId;\n spoke: EvmAddress;\n user: EvmAddress;\n};\n\n/**\n * @internal\n */\nexport function decodeUserPositionId(\n value: UserPositionId,\n): UserPositionIdParts {\n const decoded = decodeBase64(value as unknown as Base64EncodedCompositeId);\n const [a, b, c] = decoded.split(COMPOSITE_ID_SEPARATOR) as [\n string,\n string,\n string,\n ];\n return {\n chainId: chainId(Number.parseInt(a, 10)),\n spoke: evmAddress(b),\n user: evmAddress(c),\n };\n}\n\n/**\n * @internal\n */\nexport function encodeUserPositionId(\n parts: UserPositionIdParts,\n): UserPositionId {\n return userPositionId(\n encodeBase64(\n `${parts.chainId}${COMPOSITE_ID_SEPARATOR}${parts.spoke}${COMPOSITE_ID_SEPARATOR}${parts.user}`,\n ),\n );\n}\n\n/**\n * A swap identifier.\n */\nexport type SwapId = Tagged<string, 'SwapId'>;\n\n/**\n * Creates a type-safe swap Id.\n *\n * @remarks\n * This is meant to be used in tests and POC context. In normal ciscumstances\n * use the `Swap.id` retrieved from another API call.\n */\nexport function swapId(value: string): SwapId {\n invariant(isValidHexString(value), `Invalid SwapId: ${value}`);\n return value as SwapId;\n}\n\n/**\n * A swap quote identifier.\n */\nexport type SwapQuoteId = Tagged<string, 'SwapQuoteId'>;\n\n/**\n * Creates a type-safe Swap Quote ID.\n *\n * @remarks\n * This is meant to be used in tests and POC context. In normal circumstances\n * use the `SwapQuote.id` retrieved from another API call.\n */\nexport function swapQuoteId(value: string): SwapQuoteId {\n invariant(isValidHexString(value), `Invalid SwapQuoteId: ${value}`);\n return value as SwapQuoteId;\n}\n\n/**\n * A spoke identifier.\n */\nexport type SpokeId = Tagged<Base64EncodedCompositeId, 'SpokeId'>;\n\n/**\n * @internal\n */\nexport type SpokeIdParts = {\n address: EvmAddress;\n chainId: ChainId;\n};\n\n/**\n * @internal\n */\nexport function encodeSpokeId(spoke: SpokeIdParts): SpokeId {\n return spokeId(\n encodeBase64(`${spoke.chainId}${COMPOSITE_ID_SEPARATOR}${spoke.address}`),\n );\n}\n\n/**\n * @internal\n */\nexport function decodeSpokeId(value: SpokeId): SpokeIdParts {\n const decoded = decodeBase64(value);\n const [a, b] = decoded.split(COMPOSITE_ID_SEPARATOR) as [string, string];\n return {\n chainId: chainId(Number.parseInt(a, 10)),\n address: evmAddress(b),\n };\n}\n\n/**\n * Creates a spoke identifier from a given base64 value.\n *\n * @remarks\n * This is meant to be used in tests and POC context. In normal circumstances\n * use the `Spoke.id` retrieved from another API call.\n */\nexport function spokeId(value: string): SpokeId {\n invariant(\n typeof value === 'string' && value.length > 0,\n `Invalid SpokeId: ${value}`,\n );\n // Basic base64 validation - contains only valid base64 characters\n invariant(\n /^[A-Za-z0-9+/]*={0,2}$/.test(value),\n `SpokeId must be valid base64: ${value}`,\n );\n return value as SpokeId;\n}\n\n/**\n * A user balance identifier.\n */\nexport type UserBalanceId = Tagged<string, 'UserBalanceId'>;\n\n/**\n * Creates a user balance identifier from a given base64 value.\n *\n * @remarks\n * This is meant to be used in tests and POC context. In normal circumstances\n * use the `UserBalance.id` retrieved from another API call.\n */\nexport function userBalanceId(value: string): UserBalanceId {\n invariant(\n typeof value === 'string' && value.length > 0,\n `Invalid UserBalanceId: ${value}`,\n );\n // Basic base64 validation - contains only valid base64 characters\n invariant(\n /^[A-Za-z0-9+/]*={0,2}$/.test(value),\n `UserBalanceId must be valid base64: ${value}`,\n );\n return value as UserBalanceId;\n}\n\n/**\n * A user borrow item identifier.\n */\nexport type UserBorrowItemId = Tagged<string, 'UserBorrowItemId'>;\n\n/**\n * Creates a user borrow item identifier from a given base64 value.\n *\n * @remarks\n * This is meant to be used in tests and POC context. In normal circumstances\n * use the `UserBorrowItem.id` retrieved from another API call.\n */\nexport function userBorrowItemId(value: string): UserBorrowItemId {\n invariant(\n typeof value === 'string' && value.length > 0,\n `Invalid UserBorrowItemId: ${value}`,\n );\n // Basic base64 validation - contains only valid base64 characters\n invariant(\n /^[A-Za-z0-9+/]*={0,2}$/.test(value),\n `UserBorrowItemId must be valid base64: ${value}`,\n );\n return value as UserBorrowItemId;\n}\n\n/**\n * A user supply item identifier.\n */\nexport type UserSupplyItemId = Tagged<string, 'UserSupplyItemId'>;\n\n/**\n * Creates a user supply item identifier from a given base64 value.\n *\n * @remarks\n * This is meant to be used in tests and POC context. In normal circumstances\n * use the `UserSupplyItem.id` retrieved from another API call.\n */\nexport function userSupplyItemId(value: string): UserSupplyItemId {\n invariant(\n typeof value === 'string' && value.length > 0,\n `Invalid UserSupplyItemId: ${value}`,\n );\n // Basic base64 validation - contains only valid base64 characters\n invariant(\n /^[A-Za-z0-9+/]*={0,2}$/.test(value),\n `UserSupplyItemId must be valid base64: ${value}`,\n );\n return value as UserSupplyItemId;\n}\n\n/**\n * A token info identifier.\n */\nexport type TokenInfoId = Tagged<string, 'TokenInfoId'>;\n\n/**\n * @internal\n */\nexport function tokenInfoId(value: string): TokenInfoId {\n invariant(\n typeof value === 'string' && value.length > 0,\n `Invalid TokenInfoId: ${value}`,\n );\n return value as TokenInfoId;\n}\n","import {\n type BlockchainData,\n bigDecimal,\n type ChainId,\n type EvmAddress,\n evmAddress,\n chainId as toChainId,\n} from '@aave/types';\nimport { QuoteAccuracy, SwapOrderClass, TokenSwapKind } from './enums';\nimport type {\n Chain,\n DecimalNumber,\n DomainData,\n Erc20Amount,\n Erc20Approval,\n Erc20Token,\n ExchangeAmount,\n PercentNumber,\n PermitTypedData,\n PositionSwapAdapterContractApproval,\n PositionSwapPositionManagerApproval,\n PrepareSwapOrder,\n SwapByIntent,\n SwapByIntentWithApprovalRequired,\n SwapByTransaction,\n SwapCancelled,\n SwapCancelledResult,\n SwapOpen,\n SwapQuote,\n SwapReceipt,\n SwapTransactionRequest,\n SwapTypedData,\n TokenInfo,\n TokenSwap,\n TransactionRequest,\n} from './fragments';\nimport {\n type ReserveId,\n reserveId,\n type SwapId,\n type SwapQuoteId,\n tokenInfoId,\n type UserBorrowItemId,\n type UserSupplyItemId,\n userBorrowItemId,\n userSupplyItemId,\n} from './id';\n\nfunction randomBase64String(): string {\n return btoa(crypto.randomUUID());\n}\n\n/**\n * @internal\n */\nexport function makeUserBorrowItemId(): UserBorrowItemId {\n return userBorrowItemId(randomBase64String());\n}\n\n/**\n * @internal\n */\nexport function makeUserSupplyItemId(): UserSupplyItemId {\n return userSupplyItemId(randomBase64String());\n}\n\n/**\n * @internal\n */\nexport function makeReserveId(): ReserveId {\n return reserveId(randomBase64String());\n}\n\n/**\n * @internal\n */\nexport function percentNumber(value: number, decimals = 6): PercentNumber {\n const normalized = bigDecimal(value);\n\n return {\n __typename: 'PercentNumber',\n value: normalized.div(2),\n normalized,\n onChainValue: BigInt(normalized.rescale(decimals).toApproximateNumber()),\n decimals,\n };\n}\n\n/**\n * @internal\n */\nexport function decimalNumber(value: number, decimals = 18): DecimalNumber {\n return {\n __typename: 'DecimalNumber',\n value: bigDecimal(value),\n onChainValue: BigInt(\n bigDecimal(value).rescale(decimals).toApproximateNumber(),\n ),\n decimals,\n };\n}\n\nfunction randomHexString(size: number): `0x${string}` {\n return [...Array<string>(size)]\n .map(() => Math.floor(Math.random() * 16).toString(16))\n .join('') as `0x${string}`;\n}\n\n/**\n * @internal\n */\nexport function randomEvmAddress(): EvmAddress {\n return evmAddress(`0x${randomHexString(20 * 2)}`);\n}\n\nexport const TestTokens = {\n WETH: {\n name: 'Wrapped Ether',\n decimals: 18,\n address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',\n isWrappedNativeToken: true,\n },\n USDC: {\n name: 'USD Coin',\n decimals: 6,\n address: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',\n isWrappedNativeToken: false,\n },\n GHO: {\n name: 'Gho Token',\n decimals: 18,\n address: '0x40D16FC0246aD3160Ccc09B8D0D3A2cD28aE6C2f',\n isWrappedNativeToken: false,\n },\n AAVE: {\n name: 'Aave Token',\n decimals: 18,\n address: '0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9',\n isWrappedNativeToken: false,\n },\n} as const;\n\nexport function makeTokenInfo(symbol: keyof typeof TestTokens): TokenInfo {\n const { name, decimals } = TestTokens[symbol];\n\n return {\n __typename: 'TokenInfo',\n id: tokenInfoId(randomBase64String()),\n name,\n symbol,\n decimals,\n icon: 'https://example.com/icon.png',\n categories: [],\n };\n}\n\nexport function makeChain(): Chain {\n return {\n __typename: 'Chain',\n name: 'Ethereum',\n icon: 'https://example.com/icon.png',\n chainId: toChainId(1),\n rpcUrl: 'https://example.com/rpc.json',\n explorerUrl: 'https://example.com/explorer.json',\n isTestnet: false,\n isFork: false,\n nativeWrappedToken: randomEvmAddress(),\n nativeGateway: randomEvmAddress(),\n signatureGateway: randomEvmAddress(),\n nativeInfo: makeTokenInfo('WETH'),\n };\n}\n\nexport function makeErc20Token(symbol: keyof typeof TestTokens): Erc20Token {\n const { isWrappedNativeToken } = TestTokens[symbol];\n\n return {\n __typename: 'Erc20Token',\n address: randomEvmAddress(),\n chain: makeChain(),\n info: makeTokenInfo(symbol),\n isWrappedNativeToken,\n };\n}\n\nexport function makeExchangeAmount(value: number): ExchangeAmount {\n return {\n __typename: 'ExchangeAmount',\n value: bigDecimal(value),\n name: 'USD',\n symbol: '$',\n icon: 'https://example.com/icon.png',\n decimals: 2,\n };\n}\n\n/**\n * @internal\n */\nexport function makeErc20Amount(\n value: number,\n symbol: keyof typeof TestTokens,\n): Erc20Amount {\n return {\n __typename: 'Erc20Amount',\n amount: decimalNumber(value, TestTokens[symbol].decimals),\n token: makeErc20Token(symbol),\n exchange: makeExchangeAmount(value),\n exchangeRate: decimalNumber(value),\n };\n}\n\n/**\n * @internal\n */\nexport function makeTransactionRequest({\n chainId = toChainId(1),\n from = randomEvmAddress(),\n}: {\n chainId?: ChainId;\n from?: EvmAddress;\n} = {}): TransactionRequest {\n return {\n __typename: 'TransactionRequest',\n to: from,\n from,\n data: '0x' as BlockchainData,\n value: 0n,\n chainId,\n operations: [],\n };\n}\n\n/**\n * @internal\n */\nexport function makeSwapTypedData(): SwapTypedData {\n // __typenames that you see and are normally not part of the fragment fieldset selection\n // are used here to allow the URQL cache to be able to normalize the data. Hence the need to\n // assert the type (as DomainData)\n return {\n __typename: 'SwapTypedData',\n primaryType: 'Swap',\n types: {\n Swap: [\n { name: 'amount', type: 'uint256' },\n { name: 'deadline', type: 'uint256' },\n ],\n },\n domain: {\n __typename: 'DomainData',\n name: 'Swap',\n version: '1',\n chainId: toChainId(1),\n verifyingContract: randomEvmAddress(),\n } as DomainData,\n message: {\n amount: '1000000000000000000',\n deadline: 1234567890,\n },\n };\n}\n\nfunction makeQuoteId(): SwapQuoteId {\n return randomBase64String() as SwapQuoteId;\n}\n\n/**\n * @internal\n */\nexport function makeSwapQuote({\n accuracy = QuoteAccuracy.Accurate,\n buyAmount = 1000,\n}: {\n accuracy?: QuoteAccuracy;\n buyAmount?: number;\n} = {}): SwapQuote {\n return {\n __typename: 'SwapQuote',\n accuracy,\n quoteId: makeQuoteId(),\n suggestedSlippage: percentNumber(0.01),\n selectedSlippage: null,\n buy: makeErc20Amount(buyAmount, 'USDC'),\n sell: makeErc20Amount(1000, 'WETH'),\n costs: {\n __typename: 'SwapQuoteCosts',\n networkCosts: makeErc20Amount(1000, 'WETH'),\n partnerFee: makeErc20Amount(1000, 'USDC'),\n flashloanFee: makeErc20Amount(1000, 'WETH'),\n providerFee: makeErc20Amount(1000, 'USDC'),\n },\n finalBuy: makeErc20Amount(buyAmount, 'USDC'),\n finalSell: makeErc20Amount(1000, 'WETH'),\n };\n}\n\n/**\n * @internal\n */\nexport function makeSwapReceipt(): SwapReceipt {\n return {\n __typename: 'SwapReceipt',\n id: randomBase64String() as SwapId,\n createdAt: new Date(),\n explorerUrl: 'https://example.com/explorer.json',\n };\n}\n\n/**\n * @internal\n */\nexport function makeTokenSwap(): TokenSwap {\n return {\n __typename: 'TokenSwap',\n sold: makeErc20Amount(1000, 'WETH'),\n bought: makeErc20Amount(1000, 'USDC'),\n kind: TokenSwapKind.Sell,\n orderClass: SwapOrderClass.Market,\n };\n}\n\n/**\n * @internal\n */\nexport function makeSwapOpen(): SwapOpen {\n return {\n __typename: 'SwapOpen',\n swapId: randomBase64String() as SwapId,\n createdAt: new Date(),\n deadline: new Date(Date.now() + 3600_000), // 1 hour from now\n explorerUrl: 'https://example.com/explorer.json',\n operation: makeTokenSwap(),\n };\n}\n\n/**\n * @internal\n */\nexport function makeSwapCancelled(): SwapCancelled {\n return {\n __typename: 'SwapCancelled',\n swapId: randomBase64String() as SwapId,\n createdAt: new Date(),\n cancelledAt: new Date(),\n explorerUrl: 'https://example.com/explorer.json',\n operation: makeTokenSwap(),\n };\n}\n\n/**\n * @internal\n */\nexport function makeSwapCancelledResult(): SwapCancelledResult {\n return {\n __typename: 'SwapCancelledResult',\n swapId: randomBase64String() as SwapId,\n createdAt: new Date(),\n cancelledAt: new Date(),\n explorerUrl: 'https://example.com/explorer.json',\n };\n}\n\n/**\n * @internal\n */\nexport function makePositionSwapAdapterContractApproval({\n bySignature = makeSwapTypedData(),\n}: {\n bySignature?: SwapTypedData;\n byTransaction?: TransactionRequest;\n} = {}): PositionSwapAdapterContractApproval {\n return {\n __typename: 'PositionSwapAdapterContractApproval',\n bySignature,\n };\n}\n\n/**\n * @internal\n */\nexport function makePositionSwapPositionManagerApproval({\n bySignature = makeSwapTypedData(),\n byTransaction = makeTransactionRequest(),\n}: {\n bySignature?: SwapTypedData;\n byTransaction?: TransactionRequest;\n} = {}): PositionSwapPositionManagerApproval {\n return {\n __typename: 'PositionSwapPositionManagerApproval',\n bySignature,\n byTransaction,\n };\n}\n\n/**\n * @internal\n */\nexport function makeSwapTransactionRequest({\n transaction = makeTransactionRequest(),\n}: {\n transaction?: TransactionRequest;\n} = {}): SwapTransactionRequest {\n return {\n __typename: 'SwapTransactionRequest',\n transaction,\n orderReceipt: makeSwapReceipt(),\n };\n}\n\n/**\n * @internal\n */\nexport function makeSwapByTransaction(): SwapByTransaction {\n return {\n __typename: 'SwapByTransaction',\n quote: makeSwapQuote(),\n };\n}\n\n/**\n * @internal\n */\nexport function makeSwapByIntent({\n quote = makeSwapQuote(),\n}: {\n quote?: SwapQuote;\n} = {}): SwapByIntent {\n return {\n __typename: 'SwapByIntent',\n quote,\n };\n}\n\n/**\n * @internal\n */\nexport function makePrepareSwapOrder(): PrepareSwapOrder {\n return {\n __typename: 'PrepareSwapOrder',\n newQuoteId: makeQuoteId(),\n data: makeSwapTypedData(),\n };\n}\n\n/**\n * @internal\n */\nexport function makePermitTypedData(): PermitTypedData {\n // __typenames that you see and are normally not part of the fragment fieldset selection\n // are used here to allow the URQL cache to be able to normalize the data. Hence the need to\n // assert the type as DomainData\n return {\n __typename: 'PermitTypedData',\n types: {\n EIP712Domain: [{ name: 'name', type: 'string' }],\n Permit: [\n { name: 'owner', type: 'address' },\n { name: 'spender', type: 'address' },\n { name: 'value', type: 'uint256' },\n { name: 'nonce', type: 'uint256' },\n { name: 'deadline', type: 'uint256' },\n ],\n },\n primaryType: 'Permit',\n domain: {\n __typename: 'DomainData',\n name: 'Permit',\n version: '1',\n chainId: toChainId(1),\n verifyingContract: randomEvmAddress(),\n } as DomainData,\n message: {\n owner: randomEvmAddress(),\n spender: randomEvmAddress(),\n value: '1000000000000000000',\n nonce: '0',\n deadline: 1234567890,\n },\n };\n}\n\n/**\n * @internal\n */\nexport function makeErc20Approval({\n byTransaction = makeTransactionRequest(),\n}: {\n byTransaction?: TransactionRequest;\n} = {}): Erc20Approval {\n return {\n __typename: 'Erc20Approval',\n byTransaction,\n bySignature: makePermitTypedData(),\n };\n}\n\n/**\n * @internal\n */\nexport function makeSwapByIntentWithApprovalRequired({\n approval = makeErc20Approval(),\n}: {\n approval?: Erc20Approval;\n} = {}): SwapByIntentWithApprovalRequired {\n return {\n __typename: 'SwapByIntentWithApprovalRequired',\n quote: makeSwapQuote(),\n approvals: [approval],\n };\n}\n"]}
1
+ {"version":3,"sources":["../src/id.ts","../src/testing.ts"],"names":["userBorrowItemId","value","invariant","userSupplyItemId","tokenInfoId","randomBase64String","makeUserBorrowItemId","makeUserSupplyItemId","makeReserveId","percentNumber","decimals","normalized","bigDecimal","decimalNumber","randomHexString","size","randomEvmAddress","evmAddress","TestTokens","makeTokenInfo","symbol","name","makeChain","toChainId","makeErc20Token","isWrappedNativeToken","makeExchangeAmount","makeErc20Amount","makeTransactionRequest","chainId","from","makeSwapTypedData","makeQuoteId","makeSwapQuote","accuracy","buyAmount","makeSwapReceipt","makeTokenSwap","makeSwapOpen","makeSwapCancelled","makeSwapCancelledResult","makePositionSwapAdapterContractApproval","bySignature","makePositionSwapPositionManagerApproval","byTransaction","makeSwapTransactionRequest","transaction","makeSwapByTransaction","makeSwapByIntent","quote","makePrepareSwapOrder","makePermitTypedData","makeErc20Approval","makeSwapByIntentWithApprovalRequired","approval"],"mappings":"kEA6YO,SAASA,CAAAA,CAAiBC,CAAAA,CAAiC,CAChE,OAAAC,SAAAA,CACE,OAAOD,CAAAA,EAAU,QAAA,EAAYA,CAAAA,CAAM,OAAS,CAAA,CAC5C,CAAA,0BAAA,EAA6BA,CAAK,CAAA,CACpC,CAAA,CAEAC,SAAAA,CACE,wBAAA,CAAyB,IAAA,CAAKD,CAAK,CAAA,CACnC,CAAA,uCAAA,EAA0CA,CAAK,CAAA,CACjD,CAAA,CACOA,CAC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,GAAsC,CACxC,OAAO,CACL,UAAA,CAAY,kCAAA,CACZ,KAAA,CAAOnB,CAAAA,EAAc,CACrB,SAAA,CAAW,CAACqB,CAAQ,CACtB,CACF","file":"testing.js","sourcesContent":["import {\n type ChainId,\n chainId,\n type EvmAddress,\n evmAddress,\n invariant,\n isValidHexString,\n} from '@aave/types';\nimport type { Tagged } from 'type-fest';\n\n/**\n * An identifier.\n */\nexport type ID = Tagged<string, 'ID'>;\n\n/**\n * A base64 encoded composite identifier.\n *\n * @internal\n */\nexport type Base64EncodedCompositeId = Tagged<\n string,\n 'Base64EncodedCompositeId'\n>;\n\nfunction decodeBase64(value: Base64EncodedCompositeId): string {\n return new TextDecoder().decode(\n Uint8Array.from(atob(value), (c) => c.charCodeAt(0)),\n );\n}\n\nfunction encodeBase64(value: string): Base64EncodedCompositeId {\n return btoa(\n String.fromCharCode(...new TextEncoder().encode(value)),\n ) as Base64EncodedCompositeId;\n}\n\nconst COMPOSITE_ID_SEPARATOR = '::';\n\n/**\n * An asset identifier.\n */\nexport type AssetId = Tagged<Base64EncodedCompositeId, 'AssetId'>;\n\n/**\n * Creates an asset identifier from a given base64 value.\n *\n * @remarks\n * This is meant to be used in tests and POC context. In normal circumstances\n * use the `Asset.id` retrieved from another API call.\n */\nexport function assetId(value: string): AssetId {\n invariant(\n typeof value === 'string' && value.length > 0,\n `Invalid AssetId: ${value}`,\n );\n // Basic base64 validation - contains only valid base64 characters\n invariant(\n /^[A-Za-z0-9+/]*={0,2}$/.test(value),\n `AssetId must be valid base64: ${value}`,\n );\n return value as AssetId;\n}\n\n/**\n * A hub identifier.\n */\nexport type HubId = Tagged<Base64EncodedCompositeId, 'HubId'>;\n\n/**\n * Creates a hub identifier from a given base64 value.\n *\n * @remarks\n * This is meant to be used in tests and POC context. In normal circumstances\n * use the `Hub.id` retrieved from another API call.\n */\nexport function hubId(value: string): HubId {\n invariant(\n typeof value === 'string' && value.length > 0,\n `Invalid HubId: ${value}`,\n );\n // Basic base64 validation - contains only valid base64 characters\n invariant(\n /^[A-Za-z0-9+/]*={0,2}$/.test(value),\n `HubId must be valid base64: ${value}`,\n );\n return value as HubId;\n}\n\n/**\n * @internal\n */\nexport type HubIdParts = {\n address: EvmAddress;\n chainId: ChainId;\n};\n\n/**\n * @internal\n */\nexport function encodeHubId(hub: HubIdParts): HubId {\n return hubId(\n encodeBase64(`${hub.chainId}${COMPOSITE_ID_SEPARATOR}${hub.address}`),\n );\n}\n\n/**\n * @internal\n */\nexport function decodeHubId(value: HubId): HubIdParts {\n const decoded = decodeBase64(value);\n const [a, b] = decoded.split(COMPOSITE_ID_SEPARATOR) as [string, string];\n return {\n chainId: chainId(Number.parseInt(a, 10)),\n address: evmAddress(b),\n };\n}\n\n/**\n * A hub asset identifier.\n */\nexport type HubAssetId = Tagged<Base64EncodedCompositeId, 'HubAssetId'>;\n\n/**\n * Creates a hub asset identifier from a given base64 value.\n *\n * @remarks\n * This is meant to be used in tests and POC context. In normal circumstances\n * use the `HubAsset.id` retrieved from another API call.\n */\nexport function hubAssetId(value: string): HubAssetId {\n invariant(\n typeof value === 'string' && value.length > 0,\n `Invalid HubAssetId: ${value}`,\n );\n // Basic base64 validation - contains only valid base64 characters\n invariant(\n /^[A-Za-z0-9+/]*={0,2}$/.test(value),\n `HubAssetId must be valid base64: ${value}`,\n );\n return value as HubAssetId;\n}\n\n/**\n * The on-chain ID of a HubAsset. This is scoped to the specific Hub.\n */\nexport type OnChainHubAssetId = Tagged<number, 'OnChainHubAssetId'>;\n\n/**\n * The on-chain ID of a Reserve. This is scoped to the specific Spoke.\n */\nexport type OnChainReserveId = Tagged<string, 'OnChainReserveId'>;\n\n/**\n * A reserve identifier.\n */\nexport type ReserveId = Tagged<Base64EncodedCompositeId, 'ReserveId'>;\n\n/**\n * Creates a reserve identifier from a given value.\n *\n * @remarks\n * This is meant to be used in tests and POC context. In normal ciscumstances\n * use the `Reserve.id` from data retrieved from the API.\n */\nexport function reserveId(value: string): ReserveId {\n return value as ReserveId;\n}\n\n/**\n * @internal\n */\nexport type ReserveIdParts = {\n chainId: ChainId;\n spoke: EvmAddress;\n onChainId: OnChainReserveId;\n};\n\n/**\n * @internal\n */\nexport function decodeReserveId(value: ReserveId): ReserveIdParts {\n const decoded = decodeBase64(value);\n const [a, b, c] = decoded.split(COMPOSITE_ID_SEPARATOR) as [\n string,\n string,\n string,\n ];\n return {\n chainId: chainId(Number.parseInt(a, 10)),\n spoke: evmAddress(b),\n onChainId: c as OnChainReserveId,\n };\n}\n\n/**\n * @internal\n */\nexport function encodeReserveId(reserve: ReserveIdParts): ReserveId {\n return reserveId(\n encodeBase64(\n `${reserve.chainId}${COMPOSITE_ID_SEPARATOR}${reserve.spoke}${COMPOSITE_ID_SEPARATOR}${reserve.onChainId}`,\n ),\n );\n}\n\n/**\n * A user position identifier.\n */\nexport type UserPositionId = Tagged<string, 'UserPositionId'>;\n\n/**\n * Creates a user position identifier from a given base64 value.\n *\n * @remarks\n * This is meant to be used in tests and POC context. In normal ciscumstances\n * use the `UserPosition.id` retrieved from another API call.\n */\nexport function userPositionId(value: string): UserPositionId {\n invariant(\n typeof value === 'string' && value.length > 0,\n `Invalid UserPositionId: ${value}`,\n );\n // Basic base64 validation - contains only valid base64 characters\n invariant(\n /^[A-Za-z0-9+/]*={0,2}$/.test(value),\n `UserPositionId must be valid base64: ${value}`,\n );\n return value as UserPositionId;\n}\n\n/**\n * @internal\n */\nexport type UserPositionIdParts = {\n chainId: ChainId;\n spoke: EvmAddress;\n user: EvmAddress;\n};\n\n/**\n * @internal\n */\nexport function decodeUserPositionId(\n value: UserPositionId,\n): UserPositionIdParts {\n const decoded = decodeBase64(value as unknown as Base64EncodedCompositeId);\n const [a, b, c] = decoded.split(COMPOSITE_ID_SEPARATOR) as [\n string,\n string,\n string,\n ];\n return {\n chainId: chainId(Number.parseInt(a, 10)),\n spoke: evmAddress(b),\n user: evmAddress(c),\n };\n}\n\n/**\n * @internal\n */\nexport function encodeUserPositionId(\n parts: UserPositionIdParts,\n): UserPositionId {\n return userPositionId(\n encodeBase64(\n `${parts.chainId}${COMPOSITE_ID_SEPARATOR}${parts.spoke}${COMPOSITE_ID_SEPARATOR}${parts.user}`,\n ),\n );\n}\n\n/**\n * A swap identifier.\n */\nexport type SwapId = Tagged<string, 'SwapId'>;\n\n/**\n * Creates a type-safe swap Id.\n *\n * @remarks\n * This is meant to be used in tests and POC context. In normal ciscumstances\n * use the `Swap.id` retrieved from another API call.\n */\nexport function swapId(value: string): SwapId {\n invariant(isValidHexString(value), `Invalid SwapId: ${value}`);\n return value as SwapId;\n}\n\n/**\n * A swap quote identifier.\n */\nexport type SwapQuoteId = Tagged<string, 'SwapQuoteId'>;\n\n/**\n * Creates a type-safe Swap Quote ID.\n *\n * @remarks\n * This is meant to be used in tests and POC context. In normal circumstances\n * use the `SwapQuote.id` retrieved from another API call.\n */\nexport function swapQuoteId(value: string): SwapQuoteId {\n invariant(isValidHexString(value), `Invalid SwapQuoteId: ${value}`);\n return value as SwapQuoteId;\n}\n\n/**\n * A spoke identifier.\n */\nexport type SpokeId = Tagged<Base64EncodedCompositeId, 'SpokeId'>;\n\n/**\n * @internal\n */\nexport type SpokeIdParts = {\n address: EvmAddress;\n chainId: ChainId;\n};\n\n/**\n * @internal\n */\nexport function encodeSpokeId(spoke: SpokeIdParts): SpokeId {\n return spokeId(\n encodeBase64(`${spoke.chainId}${COMPOSITE_ID_SEPARATOR}${spoke.address}`),\n );\n}\n\n/**\n * @internal\n */\nexport function decodeSpokeId(value: SpokeId): SpokeIdParts {\n const decoded = decodeBase64(value);\n const [a, b] = decoded.split(COMPOSITE_ID_SEPARATOR) as [string, string];\n return {\n chainId: chainId(Number.parseInt(a, 10)),\n address: evmAddress(b),\n };\n}\n\n/**\n * Creates a spoke identifier from a given base64 value.\n *\n * @remarks\n * This is meant to be used in tests and POC context. In normal circumstances\n * use the `Spoke.id` retrieved from another API call.\n */\nexport function spokeId(value: string): SpokeId {\n invariant(\n typeof value === 'string' && value.length > 0,\n `Invalid SpokeId: ${value}`,\n );\n // Basic base64 validation - contains only valid base64 characters\n invariant(\n /^[A-Za-z0-9+/]*={0,2}$/.test(value),\n `SpokeId must be valid base64: ${value}`,\n );\n return value as SpokeId;\n}\n\n/**\n * A user balance identifier.\n */\nexport type UserBalanceId = Tagged<string, 'UserBalanceId'>;\n\n/**\n * Creates a user balance identifier from a given base64 value.\n *\n * @remarks\n * This is meant to be used in tests and POC context. In normal circumstances\n * use the `UserBalance.id` retrieved from another API call.\n */\nexport function userBalanceId(value: string): UserBalanceId {\n invariant(\n typeof value === 'string' && value.length > 0,\n `Invalid UserBalanceId: ${value}`,\n );\n // Basic base64 validation - contains only valid base64 characters\n invariant(\n /^[A-Za-z0-9+/]*={0,2}$/.test(value),\n `UserBalanceId must be valid base64: ${value}`,\n );\n return value as UserBalanceId;\n}\n\n/**\n * A user borrow item identifier.\n */\nexport type UserBorrowItemId = Tagged<string, 'UserBorrowItemId'>;\n\n/**\n * Creates a user borrow item identifier from a given base64 value.\n *\n * @remarks\n * This is meant to be used in tests and POC context. In normal circumstances\n * use the `UserBorrowItem.id` retrieved from another API call.\n */\nexport function userBorrowItemId(value: string): UserBorrowItemId {\n invariant(\n typeof value === 'string' && value.length > 0,\n `Invalid UserBorrowItemId: ${value}`,\n );\n // Basic base64 validation - contains only valid base64 characters\n invariant(\n /^[A-Za-z0-9+/]*={0,2}$/.test(value),\n `UserBorrowItemId must be valid base64: ${value}`,\n );\n return value as UserBorrowItemId;\n}\n\n/**\n * A user supply item identifier.\n */\nexport type UserSupplyItemId = Tagged<string, 'UserSupplyItemId'>;\n\n/**\n * Creates a user supply item identifier from a given base64 value.\n *\n * @remarks\n * This is meant to be used in tests and POC context. In normal circumstances\n * use the `UserSupplyItem.id` retrieved from another API call.\n */\nexport function userSupplyItemId(value: string): UserSupplyItemId {\n invariant(\n typeof value === 'string' && value.length > 0,\n `Invalid UserSupplyItemId: ${value}`,\n );\n // Basic base64 validation - contains only valid base64 characters\n invariant(\n /^[A-Za-z0-9+/]*={0,2}$/.test(value),\n `UserSupplyItemId must be valid base64: ${value}`,\n );\n return value as UserSupplyItemId;\n}\n\n/**\n * A token info identifier.\n */\nexport type TokenInfoId = Tagged<string, 'TokenInfoId'>;\n\n/**\n * @internal\n */\nexport function tokenInfoId(value: string): TokenInfoId {\n invariant(\n typeof value === 'string' && value.length > 0,\n `Invalid TokenInfoId: ${value}`,\n );\n return value as TokenInfoId;\n}\n","import {\n type BlockchainData,\n bigDecimal,\n type ChainId,\n type EvmAddress,\n evmAddress,\n chainId as toChainId,\n} from '@aave/types';\nimport { QuoteAccuracy, SwapOrderClass, TokenSwapKind } from './enums';\nimport type {\n Chain,\n DecimalNumber,\n DomainData,\n Erc20Amount,\n Erc20Approval,\n Erc20Token,\n ExchangeAmount,\n PercentNumber,\n PermitTypedData,\n PositionSwapAdapterContractApproval,\n PositionSwapPositionManagerApproval,\n PrepareSwapOrder,\n SwapByIntent,\n SwapByIntentWithApprovalRequired,\n SwapByTransaction,\n SwapCancelled,\n SwapCancelledResult,\n SwapOpen,\n SwapQuote,\n SwapReceipt,\n SwapTransactionRequest,\n SwapTypedData,\n TokenInfo,\n TokenSwap,\n TransactionRequest,\n} from './fragments';\nimport {\n type ReserveId,\n reserveId,\n type SwapId,\n type SwapQuoteId,\n tokenInfoId,\n type UserBorrowItemId,\n type UserSupplyItemId,\n userBorrowItemId,\n userSupplyItemId,\n} from './id';\n\nfunction randomBase64String(): string {\n return btoa(crypto.randomUUID());\n}\n\n/**\n * @internal\n */\nexport function makeUserBorrowItemId(): UserBorrowItemId {\n return userBorrowItemId(randomBase64String());\n}\n\n/**\n * @internal\n */\nexport function makeUserSupplyItemId(): UserSupplyItemId {\n return userSupplyItemId(randomBase64String());\n}\n\n/**\n * @internal\n */\nexport function makeReserveId(): ReserveId {\n return reserveId(randomBase64String());\n}\n\n/**\n * @internal\n */\nexport function percentNumber(value: number, decimals = 6): PercentNumber {\n const normalized = bigDecimal(value);\n\n return {\n __typename: 'PercentNumber',\n value: normalized.div(2),\n normalized,\n onChainValue: BigInt(normalized.rescale(decimals).toApproximateNumber()),\n decimals,\n };\n}\n\n/**\n * @internal\n */\nexport function decimalNumber(value: number, decimals = 18): DecimalNumber {\n return {\n __typename: 'DecimalNumber',\n value: bigDecimal(value),\n onChainValue: BigInt(\n bigDecimal(value).rescale(decimals).toApproximateNumber(),\n ),\n decimals,\n };\n}\n\nfunction randomHexString(size: number): `0x${string}` {\n return [...Array<string>(size)]\n .map(() => Math.floor(Math.random() * 16).toString(16))\n .join('') as `0x${string}`;\n}\n\n/**\n * @internal\n */\nexport function randomEvmAddress(): EvmAddress {\n return evmAddress(`0x${randomHexString(20 * 2)}`);\n}\n\nexport const TestTokens = {\n WETH: {\n name: 'Wrapped Ether',\n decimals: 18,\n address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',\n isWrappedNativeToken: true,\n },\n USDC: {\n name: 'USD Coin',\n decimals: 6,\n address: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',\n isWrappedNativeToken: false,\n },\n GHO: {\n name: 'Gho Token',\n decimals: 18,\n address: '0x40D16FC0246aD3160Ccc09B8D0D3A2cD28aE6C2f',\n isWrappedNativeToken: false,\n },\n AAVE: {\n name: 'Aave Token',\n decimals: 18,\n address: '0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9',\n isWrappedNativeToken: false,\n },\n} as const;\n\nexport function makeTokenInfo(symbol: keyof typeof TestTokens): TokenInfo {\n const { name, decimals } = TestTokens[symbol];\n\n return {\n __typename: 'TokenInfo',\n id: tokenInfoId(randomBase64String()),\n name,\n symbol,\n decimals,\n icon: 'https://example.com/icon.png',\n categories: [],\n };\n}\n\nexport function makeChain(): Chain {\n return {\n __typename: 'Chain',\n name: 'Ethereum',\n icon: 'https://example.com/icon.png',\n chainId: toChainId(1),\n rpcUrl: 'https://example.com/rpc.json',\n explorerUrl: 'https://example.com/explorer.json',\n isTestnet: false,\n isFork: false,\n nativeWrappedToken: randomEvmAddress(),\n nativeGateway: randomEvmAddress(),\n signatureGateway: randomEvmAddress(),\n nativeInfo: makeTokenInfo('WETH'),\n };\n}\n\nexport function makeErc20Token(symbol: keyof typeof TestTokens): Erc20Token {\n const { isWrappedNativeToken } = TestTokens[symbol];\n\n return {\n __typename: 'Erc20Token',\n address: randomEvmAddress(),\n chain: makeChain(),\n info: makeTokenInfo(symbol),\n isWrappedNativeToken,\n };\n}\n\nexport function makeExchangeAmount(value: number): ExchangeAmount {\n return {\n __typename: 'ExchangeAmount',\n value: bigDecimal(value),\n name: 'USD',\n symbol: '$',\n icon: 'https://example.com/icon.png',\n decimals: 2,\n };\n}\n\n/**\n * @internal\n */\nexport function makeErc20Amount(\n value: number,\n symbol: keyof typeof TestTokens,\n): Erc20Amount {\n return {\n __typename: 'Erc20Amount',\n amount: decimalNumber(value, TestTokens[symbol].decimals),\n token: makeErc20Token(symbol),\n exchange: makeExchangeAmount(value),\n exchangeRate: decimalNumber(value),\n };\n}\n\n/**\n * @internal\n */\nexport function makeTransactionRequest({\n chainId = toChainId(1),\n from = randomEvmAddress(),\n}: {\n chainId?: ChainId;\n from?: EvmAddress;\n} = {}): TransactionRequest {\n return {\n __typename: 'TransactionRequest',\n to: from,\n from,\n data: '0x' as BlockchainData,\n value: 0n,\n chainId,\n operations: [],\n };\n}\n\n/**\n * @internal\n */\nexport function makeSwapTypedData(): SwapTypedData {\n // __typenames that you see and are normally not part of the fragment fieldset selection\n // are used here to allow the URQL cache to be able to normalize the data. Hence the need to\n // assert the type (as DomainData)\n return {\n __typename: 'SwapTypedData',\n primaryType: 'Swap',\n types: {\n Swap: [\n { name: 'amount', type: 'uint256' },\n { name: 'deadline', type: 'uint256' },\n ],\n },\n domain: {\n __typename: 'DomainData',\n name: 'Swap',\n version: '1',\n chainId: toChainId(1),\n verifyingContract: randomEvmAddress(),\n } as DomainData,\n message: {\n amount: '1000000000000000000',\n deadline: 1234567890,\n },\n };\n}\n\nfunction makeQuoteId(): SwapQuoteId {\n return randomBase64String() as SwapQuoteId;\n}\n\n/**\n * @internal\n */\nexport function makeSwapQuote({\n accuracy = QuoteAccuracy.Accurate,\n buyAmount = 1000,\n}: {\n accuracy?: QuoteAccuracy;\n buyAmount?: number;\n} = {}): SwapQuote {\n return {\n __typename: 'SwapQuote',\n accuracy,\n quoteId: makeQuoteId(),\n suggestedSlippage: percentNumber(0.01),\n selectedSlippage: null,\n buy: makeErc20Amount(buyAmount, 'USDC'),\n sell: makeErc20Amount(1000, 'WETH'),\n costs: {\n __typename: 'SwapQuoteCosts',\n networkCosts: makeErc20Amount(1000, 'WETH'),\n partnerFee: makeErc20Amount(1000, 'USDC'),\n flashloanFee: makeErc20Amount(1000, 'WETH'),\n providerFee: makeErc20Amount(1000, 'USDC'),\n },\n finalBuy: makeErc20Amount(buyAmount, 'USDC'),\n finalSell: makeErc20Amount(1000, 'WETH'),\n };\n}\n\n/**\n * @internal\n */\nexport function makeSwapReceipt(): SwapReceipt {\n return {\n __typename: 'SwapReceipt',\n id: randomBase64String() as SwapId,\n createdAt: new Date(),\n explorerUrl: 'https://example.com/explorer.json',\n };\n}\n\n/**\n * @internal\n */\nexport function makeTokenSwap(): TokenSwap {\n return {\n __typename: 'TokenSwap',\n sell: makeErc20Amount(1000, 'WETH'),\n buy: makeErc20Amount(1000, 'USDC'),\n kind: TokenSwapKind.Sell,\n orderClass: SwapOrderClass.Market,\n };\n}\n\n/**\n * @internal\n */\nexport function makeSwapOpen(): SwapOpen {\n return {\n __typename: 'SwapOpen',\n swapId: randomBase64String() as SwapId,\n createdAt: new Date(),\n deadline: new Date(Date.now() + 3600_000), // 1 hour from now\n explorerUrl: 'https://example.com/explorer.json',\n operation: makeTokenSwap(),\n };\n}\n\n/**\n * @internal\n */\nexport function makeSwapCancelled(): SwapCancelled {\n return {\n __typename: 'SwapCancelled',\n swapId: randomBase64String() as SwapId,\n createdAt: new Date(),\n cancelledAt: new Date(),\n explorerUrl: 'https://example.com/explorer.json',\n operation: makeTokenSwap(),\n };\n}\n\n/**\n * @internal\n */\nexport function makeSwapCancelledResult(): SwapCancelledResult {\n return {\n __typename: 'SwapCancelledResult',\n swapId: randomBase64String() as SwapId,\n createdAt: new Date(),\n cancelledAt: new Date(),\n explorerUrl: 'https://example.com/explorer.json',\n };\n}\n\n/**\n * @internal\n */\nexport function makePositionSwapAdapterContractApproval({\n bySignature = makeSwapTypedData(),\n}: {\n bySignature?: SwapTypedData;\n byTransaction?: TransactionRequest;\n} = {}): PositionSwapAdapterContractApproval {\n return {\n __typename: 'PositionSwapAdapterContractApproval',\n bySignature,\n };\n}\n\n/**\n * @internal\n */\nexport function makePositionSwapPositionManagerApproval({\n bySignature = makeSwapTypedData(),\n byTransaction = makeTransactionRequest(),\n}: {\n bySignature?: SwapTypedData;\n byTransaction?: TransactionRequest;\n} = {}): PositionSwapPositionManagerApproval {\n return {\n __typename: 'PositionSwapPositionManagerApproval',\n bySignature,\n byTransaction,\n };\n}\n\n/**\n * @internal\n */\nexport function makeSwapTransactionRequest({\n transaction = makeTransactionRequest(),\n}: {\n transaction?: TransactionRequest;\n} = {}): SwapTransactionRequest {\n return {\n __typename: 'SwapTransactionRequest',\n transaction,\n orderReceipt: makeSwapReceipt(),\n };\n}\n\n/**\n * @internal\n */\nexport function makeSwapByTransaction(): SwapByTransaction {\n return {\n __typename: 'SwapByTransaction',\n quote: makeSwapQuote(),\n };\n}\n\n/**\n * @internal\n */\nexport function makeSwapByIntent({\n quote = makeSwapQuote(),\n}: {\n quote?: SwapQuote;\n} = {}): SwapByIntent {\n return {\n __typename: 'SwapByIntent',\n quote,\n };\n}\n\n/**\n * @internal\n */\nexport function makePrepareSwapOrder(): PrepareSwapOrder {\n return {\n __typename: 'PrepareSwapOrder',\n newQuoteId: makeQuoteId(),\n data: makeSwapTypedData(),\n };\n}\n\n/**\n * @internal\n */\nexport function makePermitTypedData(): PermitTypedData {\n // __typenames that you see and are normally not part of the fragment fieldset selection\n // are used here to allow the URQL cache to be able to normalize the data. Hence the need to\n // assert the type as DomainData\n return {\n __typename: 'PermitTypedData',\n types: {\n EIP712Domain: [{ name: 'name', type: 'string' }],\n Permit: [\n { name: 'owner', type: 'address' },\n { name: 'spender', type: 'address' },\n { name: 'value', type: 'uint256' },\n { name: 'nonce', type: 'uint256' },\n { name: 'deadline', type: 'uint256' },\n ],\n },\n primaryType: 'Permit',\n domain: {\n __typename: 'DomainData',\n name: 'Permit',\n version: '1',\n chainId: toChainId(1),\n verifyingContract: randomEvmAddress(),\n } as DomainData,\n message: {\n owner: randomEvmAddress(),\n spender: randomEvmAddress(),\n value: '1000000000000000000',\n nonce: '0',\n deadline: 1234567890,\n },\n };\n}\n\n/**\n * @internal\n */\nexport function makeErc20Approval({\n byTransaction = makeTransactionRequest(),\n}: {\n byTransaction?: TransactionRequest;\n} = {}): Erc20Approval {\n return {\n __typename: 'Erc20Approval',\n byTransaction,\n bySignature: makePermitTypedData(),\n };\n}\n\n/**\n * @internal\n */\nexport function makeSwapByIntentWithApprovalRequired({\n approval = makeErc20Approval(),\n}: {\n approval?: Erc20Approval;\n} = {}): SwapByIntentWithApprovalRequired {\n return {\n __typename: 'SwapByIntentWithApprovalRequired',\n quote: makeSwapQuote(),\n approvals: [approval],\n };\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aave/graphql",
3
- "version": "1.0.0-next.27",
3
+ "version": "1.0.0-next.28",
4
4
  "description": "GraphQL bindings for the Aave API",
5
5
  "repository": {
6
6
  "directory": "packages/graphql",