@lens-protocol/shared-kernel
Advanced tools
Comparing version 0.11.0-alpha.10 to 0.11.0-alpha.11
import { Amount } from "../Amount.js"; | ||
import { Erc20 } from "../Asset.js"; | ||
import { Erc20, Fiat } from "../Asset.js"; | ||
import { ChainType } from "../ChainType.js"; | ||
@@ -11,3 +11,4 @@ import { Data, EvmAddress } from "../types.js"; | ||
export declare function mockMaticGweiAmount(value: number | string): Amount<import("../Asset.js").Matic>; | ||
export declare function mockUsdAmount(value: number | string): Amount<import("../Asset.js").Fiat>; | ||
export declare function mockUsdAsset(): Fiat; | ||
export declare function mockUsdAmount(value: number | string): Amount<Fiat>; | ||
export declare function mockErc20Asset({ address, symbol, chainType, }: { | ||
@@ -14,0 +15,0 @@ address: string; |
@@ -65,3 +65,3 @@ import { BigDecimal } from "../arithmetic/BigDecimal.js"; | ||
* @example | ||
* Create the USD equivalent of an Ether Amount given the ETH-USD rate: | ||
* Create the Fiat equivalent of an Ether Amount given the ETH-FIAT rate: | ||
* | ||
@@ -71,5 +71,7 @@ * ```ts | ||
* | ||
* const rate = Amount.usd('0.0006'); // Amount<Fiat> | ||
* const fiatAsset = fiat({ name: 'US Dollar', symbol: 'USD' }); // Fiat | ||
* | ||
* const usdAmount = etherAmount.convert(rate); // Amount<Fiat> | ||
* const rate = Amount.fiat(fiatAsset, '0.0006'); // Amount<Fiat> | ||
* | ||
* const fiatAmount = etherAmount.convert(rate); // Amount<Fiat> | ||
* ``` | ||
@@ -202,5 +204,5 @@ */ | ||
/** | ||
* Creates an USD {@link Fiat} Amount with the specified `value`. | ||
* Creates an Amount of the specified {@link Fiat} with the specified `value`. | ||
*/ | ||
static usd(value: AmountValue): Amount<Fiat>; | ||
static fiat<T extends Fiat>(asset: T, value: AmountValue): Amount<Fiat>; | ||
/** | ||
@@ -207,0 +209,0 @@ * Creates an {@link Matic} Amount with the specified `value`. |
@@ -15,5 +15,3 @@ import { ChainType } from "./ChainType.js"; | ||
ETH = "ETH", | ||
MATIC = "MATIC", | ||
USD = "USD", | ||
USDC = "USDC" | ||
MATIC = "MATIC" | ||
} | ||
@@ -170,8 +168,16 @@ /** @internal */ | ||
/** | ||
* A convenience function to create a Fiat asset for USD. | ||
* Initialization object for `fiat` factory function | ||
*/ | ||
export type FiatInfo = { | ||
name: string; | ||
symbol: string; | ||
}; | ||
/** | ||
* Fiat asset factory function. | ||
* | ||
* There is only one USD token, so this function returns the same instance every time. | ||
* Fiat instances, like all {@link Asset} instances, are immutable and can be compared using reference equality (`===`). | ||
* | ||
* @returns The USD Fiat instance. | ||
* @param info - {@link FiatInfo} details | ||
* @returns An Fiat asset instance. | ||
*/ | ||
export declare function usd(): Fiat; | ||
export declare function fiat({ name, symbol }: FiatInfo): Fiat; |
@@ -11,7 +11,2 @@ /** | ||
/** | ||
* A URL | ||
* @deprecated Use `URL` or `URI` instead. | ||
*/ | ||
export type Url = string; | ||
/** | ||
* A Uniform Resource Locator. | ||
@@ -18,0 +13,0 @@ * |
@@ -6,3 +6,3 @@ 'use strict'; | ||
var isObject = require('lodash/isObject'); | ||
var Amount = require('./Amount-781b917e.cjs.dev.js'); | ||
var Amount = require('./Amount-e981b069.cjs.dev.js'); | ||
var defaultTo = require('lodash/defaultTo.js'); | ||
@@ -443,5 +443,5 @@ var isObject$1 = require('lodash/isObject.js'); | ||
exports.ether = Amount.ether; | ||
exports.fiat = Amount.fiat; | ||
exports.invariant = Amount.invariant; | ||
exports.matic = Amount.matic; | ||
exports.usd = Amount.usd; | ||
exports.CausedError = CausedError; | ||
@@ -448,0 +448,0 @@ exports.DateUtils = DateUtils; |
@@ -6,3 +6,3 @@ 'use strict'; | ||
var isObject = require('lodash/isObject'); | ||
var Amount = require('./Amount-58bcc8fb.cjs.prod.js'); | ||
var Amount = require('./Amount-70889ed3.cjs.prod.js'); | ||
var defaultTo = require('lodash/defaultTo.js'); | ||
@@ -443,5 +443,5 @@ var isObject$1 = require('lodash/isObject.js'); | ||
exports.ether = Amount.ether; | ||
exports.fiat = Amount.fiat; | ||
exports.invariant = Amount.invariant; | ||
exports.matic = Amount.matic; | ||
exports.usd = Amount.usd; | ||
exports.CausedError = CausedError; | ||
@@ -448,0 +448,0 @@ exports.DateUtils = DateUtils; |
import isObject$1 from 'lodash/isObject'; | ||
export { default as isObject } from 'lodash/isObject'; | ||
import { _ as _inherits, a as _createSuper, b as _classCallCheck, c as _assertThisInitialized, d as _createClass, e as _wrapNativeSuper, i as invariant, I as InvariantError } from './Amount-5b0c3806.esm.js'; | ||
export { A as Amount, B as BigDecimal, C as ChainType, D as Denomination, I as InvariantError, K as Kind, N as NativeType, W as WellKnownSymbols, f as erc20, g as ether, i as invariant, m as matic, u as usd } from './Amount-5b0c3806.esm.js'; | ||
import { _ as _inherits, a as _createSuper, b as _classCallCheck, c as _assertThisInitialized, d as _createClass, e as _wrapNativeSuper, i as invariant, I as InvariantError } from './Amount-d254bbee.esm.js'; | ||
export { A as Amount, B as BigDecimal, C as ChainType, D as Denomination, I as InvariantError, K as Kind, N as NativeType, W as WellKnownSymbols, f as erc20, g as ether, h as fiat, i as invariant, m as matic } from './Amount-d254bbee.esm.js'; | ||
import defaultTo from 'lodash/defaultTo.js'; | ||
@@ -6,0 +6,0 @@ import isObject from 'lodash/isObject.js'; |
@@ -6,3 +6,3 @@ 'use strict'; | ||
var address = require('@ethersproject/address'); | ||
var Amount = require('../../dist/Amount-781b917e.cjs.dev.js'); | ||
var Amount = require('../../dist/Amount-e981b069.cjs.dev.js'); | ||
require('decimal.js'); | ||
@@ -64,4 +64,10 @@ | ||
} | ||
function mockUsdAsset() { | ||
return Amount.fiat({ | ||
name: 'US Dollar', | ||
symbol: 'USD' | ||
}); | ||
} | ||
function mockUsdAmount(value) { | ||
return Amount.Amount.usd(value); | ||
return Amount.Amount.fiat(mockUsdAsset(), value); | ||
} | ||
@@ -132,3 +138,4 @@ function mockErc20Asset(_ref) { | ||
exports.mockUsdAmount = mockUsdAmount; | ||
exports.mockUsdAsset = mockUsdAsset; | ||
exports.mockUsdcAmount = mockUsdcAmount; | ||
exports.mockUsdcAsset = mockUsdcAsset; |
@@ -6,3 +6,3 @@ 'use strict'; | ||
var address = require('@ethersproject/address'); | ||
var Amount = require('../../dist/Amount-58bcc8fb.cjs.prod.js'); | ||
var Amount = require('../../dist/Amount-70889ed3.cjs.prod.js'); | ||
require('decimal.js'); | ||
@@ -64,4 +64,10 @@ | ||
} | ||
function mockUsdAsset() { | ||
return Amount.fiat({ | ||
name: 'US Dollar', | ||
symbol: 'USD' | ||
}); | ||
} | ||
function mockUsdAmount(value) { | ||
return Amount.Amount.usd(value); | ||
return Amount.Amount.fiat(mockUsdAsset(), value); | ||
} | ||
@@ -132,3 +138,4 @@ function mockErc20Asset(_ref) { | ||
exports.mockUsdAmount = mockUsdAmount; | ||
exports.mockUsdAsset = mockUsdAsset; | ||
exports.mockUsdcAmount = mockUsdcAmount; | ||
exports.mockUsdcAsset = mockUsdcAsset; |
import { getAddress } from '@ethersproject/address'; | ||
import { A as Amount, D as Denomination, C as ChainType, f as erc20 } from '../../dist/Amount-5b0c3806.esm.js'; | ||
import { A as Amount, D as Denomination, h as fiat, C as ChainType, f as erc20 } from '../../dist/Amount-d254bbee.esm.js'; | ||
import 'decimal.js'; | ||
@@ -59,4 +59,10 @@ | ||
} | ||
function mockUsdAsset() { | ||
return fiat({ | ||
name: 'US Dollar', | ||
symbol: 'USD' | ||
}); | ||
} | ||
function mockUsdAmount(value) { | ||
return Amount.usd(value); | ||
return Amount.fiat(mockUsdAsset(), value); | ||
} | ||
@@ -116,2 +122,2 @@ function mockErc20Asset(_ref) { | ||
export { mock32BytesHexString, mockDaiAmount, mockDaiAsset, mockData, mockErc20Asset, mockEtherAmount, mockEtherGweiAmount, mockEvmAddress, mockMaticAmount, mockMaticGweiAmount, mockUsdAmount, mockUsdcAmount, mockUsdcAsset }; | ||
export { mock32BytesHexString, mockDaiAmount, mockDaiAsset, mockData, mockErc20Asset, mockEtherAmount, mockEtherGweiAmount, mockEvmAddress, mockMaticAmount, mockMaticGweiAmount, mockUsdAmount, mockUsdAsset, mockUsdcAmount, mockUsdcAsset }; |
{ | ||
"name": "@lens-protocol/shared-kernel", | ||
"version": "0.11.0-alpha.10", | ||
"version": "0.11.0-alpha.11", | ||
"description": "Shared kernel", | ||
@@ -47,5 +47,5 @@ "repository": { | ||
"typescript": "5.2.2", | ||
"@lens-protocol/tsconfig": "0.2.0", | ||
"@lens-protocol/prettier-config": "0.5.0", | ||
"@lens-protocol/eslint-config": "0.5.0", | ||
"@lens-protocol/prettier-config": "0.5.0" | ||
"@lens-protocol/tsconfig": "0.2.0" | ||
}, | ||
@@ -52,0 +52,0 @@ "prettier": "@lens-protocol/prettier-config", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
175518
5342
1