sablier 3.7.0 → 3.7.1
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/CHANGELOG.md +8 -0
- package/dist/cjs/evm/helpers.js +3 -1
- package/dist/cjs/evm/helpers.js.map +1 -1
- package/dist/esm/evm/helpers.js +1 -1
- package/dist/esm/evm/helpers.js.map +1 -1
- package/dist/types/evm/helpers.d.ts +2 -2
- package/dist/types/evm/helpers.d.ts.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,7 @@ The format is based on [Common Changelog](https://common-changelog.org/).
|
|
|
9
9
|
> Starting with v2.0.0, this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). In v1.x, it
|
|
10
10
|
> did not always follow Semantic Versioning.
|
|
11
11
|
|
|
12
|
+
[3.7.1]: https://github.com/sablier-labs/sdk/releases/tag/v3.7.1
|
|
12
13
|
[3.7.0]: https://github.com/sablier-labs/sdk/releases/tag/v3.7.0
|
|
13
14
|
[3.6.0]: https://github.com/sablier-labs/sdk/releases/tag/v3.6.0
|
|
14
15
|
[3.5.0]: https://github.com/sablier-labs/sdk/releases/tag/v3.5.0
|
|
@@ -43,6 +44,13 @@ The format is based on [Common Changelog](https://common-changelog.org/).
|
|
|
43
44
|
[1.1.0]: https://github.com/sablier-labs/sdk/releases/tag/v1.1.0
|
|
44
45
|
[1.0.0]: https://github.com/sablier-labs/sdk/releases/tag/v1.0.0
|
|
45
46
|
|
|
47
|
+
## [3.7.1] - 2026-04-10
|
|
48
|
+
|
|
49
|
+
### Fixed
|
|
50
|
+
|
|
51
|
+
- Export missing feature helpers and types from `sablier/evm/helpers` subpath
|
|
52
|
+
([`7bfbb85`](https://github.com/sablier-labs/sdk/commit/7bfbb85))
|
|
53
|
+
|
|
46
54
|
## [3.7.0] - 2026-04-10
|
|
47
55
|
|
|
48
56
|
### Changed
|
package/dist/cjs/evm/helpers.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.usesLockupSplit = exports.supportsLockupShape = exports.supportsLockupPrbProxy = exports.supportsLockupBatch = exports.isEvmReleasePayable = exports.hasSponsor = exports.hasSplitLockupArchitecture = exports.hasOnchainMinFee = exports.hasClaimTo = exports.getLockupReleaseFeatures = exports.getFlowReleaseFeatures = exports.getAirdropsReleaseFeatures = void 0;
|
|
3
|
+
exports.usesLockupSplit = exports.supportsLockupShape = exports.supportsLockupPrbProxy = exports.supportsLockupBatch = exports.isEvmReleasePayable = exports.hasSponsor = exports.hasSplitLockupArchitecture = exports.hasOnchainMinFee = exports.hasClaimTo = exports.getLockupReleaseFeatures = exports.getFlowReleaseFeatures = exports.getEvmReleaseFeatures = exports.getAirdropsReleaseFeatures = exports.evmReleaseFeatures = void 0;
|
|
4
4
|
exports.getContractExplorerURL = getContractExplorerURL;
|
|
5
5
|
exports.resolveEvmStreamId = resolveEvmStreamId;
|
|
6
6
|
exports.resolveEvmContractByAlias = resolveEvmContractByAlias;
|
|
@@ -9,7 +9,9 @@ const explorer_url_js_1 = require("../internal/utils/explorer-url.js");
|
|
|
9
9
|
const alias_catalog_js_1 = require("./contracts/alias-catalog.js");
|
|
10
10
|
const enums_js_1 = require("./enums.js");
|
|
11
11
|
var features_js_1 = require("./releases/features.js");
|
|
12
|
+
Object.defineProperty(exports, "evmReleaseFeatures", { enumerable: true, get: function () { return features_js_1.evmReleaseFeatures; } });
|
|
12
13
|
Object.defineProperty(exports, "getAirdropsReleaseFeatures", { enumerable: true, get: function () { return features_js_1.getAirdropsReleaseFeatures; } });
|
|
14
|
+
Object.defineProperty(exports, "getEvmReleaseFeatures", { enumerable: true, get: function () { return features_js_1.getEvmReleaseFeatures; } });
|
|
13
15
|
Object.defineProperty(exports, "getFlowReleaseFeatures", { enumerable: true, get: function () { return features_js_1.getFlowReleaseFeatures; } });
|
|
14
16
|
Object.defineProperty(exports, "getLockupReleaseFeatures", { enumerable: true, get: function () { return features_js_1.getLockupReleaseFeatures; } });
|
|
15
17
|
Object.defineProperty(exports, "hasClaimTo", { enumerable: true, get: function () { return features_js_1.hasClaimTo; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/evm/helpers.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/evm/helpers.ts"],"names":[],"mappings":";;;AAkCA,wDAEC;AAkBD,gDAUC;AAeD,8DAyCC;AAaD,gDAoBC;AAzJD,0EAAgH;AAEhH,mEAA+D;AAC/D,yCAAsC;AAQtC,sDAegC;AAd9B,iHAAA,kBAAkB,OAAA;AAClB,yHAAA,0BAA0B,OAAA;AAC1B,oHAAA,qBAAqB,OAAA;AACrB,qHAAA,sBAAsB,OAAA;AACtB,uHAAA,wBAAwB,OAAA;AACxB,yGAAA,UAAU,OAAA;AACV,+GAAA,gBAAgB,OAAA;AAChB,yHAAA,0BAA0B,OAAA;AAC1B,yGAAA,UAAU,OAAA;AACV,kHAAA,mBAAmB,OAAA;AACnB,kHAAA,mBAAmB,OAAA;AACnB,qHAAA,sBAAsB,OAAA;AACtB,kHAAA,mBAAmB,OAAA;AACnB,8GAAA,eAAe,OAAA;AASjB,SAAgB,sBAAsB,CAAC,WAAmB,EAAE,eAAoC;IAC9F,OAAO,IAAA,wCAA8B,EAAC,WAAW,EAAE,eAAe,CAAC,CAAC;AACtE,CAAC;AAkBD,SAAgB,kBAAkB,CAAC,IAKlC;IACC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;IAEnD,MAAM,QAAQ,GAAG,yBAAyB,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC;IACzE,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,WAAW,EAAE,IAAI,OAAO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,OAA4B,EAC5B,OAAgC;IAEhC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,MAAM,KAAK,GAAG,OAAO,EAAE,KAAK,IAAI,CAAC,CAAC;IAClC,MAAM,GAAG,GAAG,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;IAC9B,MAAM,SAAS,GAAG,CAAC,GAAG,KAAK,GAAG,GAAG,CAAC;IAElC,IAAI,OAAO,CAAC,MAAM,IAAI,SAAS,EAAE,CAAC;QAChC,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC;IAC3C,MAAM,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC;IAEpD,OAAO,GAAG,MAAM,MAAM,MAAM,EAAE,CAAC;AACjC,CAAC","sourcesContent":["import { getContractExplorerURL as getContractExplorerURLInternal } from \"@/src/internal/utils/explorer-url.js\";\nimport type { Sablier, TruncateAddressOptions } from \"@/src/types.js\";\nimport { getAliasCatalog } from \"./contracts/alias-catalog.js\";\nimport { Protocol } from \"./enums.js\";\n\nexport type {\n EvmReleaseFeatureSetByProtocol,\n EvmReleaseVersionByProtocol,\n PayableEvmProtocol,\n ReleaseFeaturesForProtocol,\n} from \"./releases/features.js\";\nexport {\n evmReleaseFeatures,\n getAirdropsReleaseFeatures,\n getEvmReleaseFeatures,\n getFlowReleaseFeatures,\n getLockupReleaseFeatures,\n hasClaimTo,\n hasOnchainMinFee,\n hasSplitLockupArchitecture,\n hasSponsor,\n isEvmReleasePayable,\n supportsLockupBatch,\n supportsLockupPrbProxy,\n supportsLockupShape,\n usesLockupSplit,\n} from \"./releases/features.js\";\n\n/**\n * Get the explorer URL for a contract. Compatible with Etherscan, Blockscout, etc.\n * @param explorerURL - The base explorer URL, e.g. https://etherscan.io\n * @param contractAddress - The contract object\n * @returns The explorer URL for the contract, e.g. https://etherscan.io/address/0x123...\n */\nexport function getContractExplorerURL(explorerURL: string, contractAddress: Sablier.EVM.Address) {\n return getContractExplorerURLInternal(explorerURL, contractAddress);\n}\n\n/**\n * Constructs a stream/airdrop entity ID for EVM chains in the format used by Sablier indexers.\n * Format: `{contractAddress}-{chainId}-{tokenId}`\n *\n * The contract address is lowercased for normalization, as EVM addresses are case-insensitive.\n *\n * @param opts - Configuration object\n * @param opts.alias - Contract alias (e.g., \"LL2\", \"LK2\", \"FL2\")\n * @param opts.chainId - Chain ID where the contract is deployed\n * @param opts.tokenId - Stream/airdrop token ID\n * @param opts.protocol - Optional protocol to disambiguate aliases\n * @returns Stream ID in format \"0xabc...-1-123\"\n * @example\n * resolveEvmStreamId({ alias: \"LL2\", chainId: 1, tokenId: 123n })\n * // => \"0xabc...-1-123\"\n */\nexport function resolveEvmStreamId(opts: {\n alias: string;\n chainId: number;\n tokenId: bigint | string | number;\n protocol?: Sablier.EVM.Protocol;\n}): string {\n const { alias, chainId, tokenId, protocol } = opts;\n\n const contract = resolveEvmContractByAlias({ alias, chainId, protocol });\n return `${contract.address.toLowerCase()}-${chainId}-${tokenId}`;\n}\n\n/**\n * Resolves an EVM contract by its alias from the alias catalog.\n *\n * @param opts - Configuration object\n * @param opts.alias - Contract alias (e.g., \"LL2\", \"LK2\", \"FL2\")\n * @param opts.chainId - Chain ID where the contract is deployed\n * @param opts.protocol - Optional protocol to disambiguate aliases that exist in multiple protocols\n * @returns The resolved contract\n * @throws Error if alias is not found or is ambiguous without protocol specified\n * @example\n * resolveEvmContractByAlias({ alias: \"LL2\", chainId: 1 })\n * // => { address: \"0x...\", name: \"SablierLockupLinear\", ... }\n */\nexport function resolveEvmContractByAlias(opts: {\n alias: string;\n chainId: number;\n protocol?: Sablier.EVM.Protocol;\n}): Sablier.EVM.Contract {\n const { alias, chainId, protocol } = opts;\n const aliasCatalog = getAliasCatalog();\n\n if (protocol) {\n const contract = aliasCatalog[protocol]?.[chainId]?.[alias];\n if (!contract) {\n throw new Error(\n `Sablier SDK: Unknown EVM contract alias \"${alias}\" on chain ${chainId} for protocol \"${protocol}\"`\n );\n }\n return contract;\n }\n\n const protocols: Sablier.EVM.Protocol[] = [\n Protocol.Airdrops,\n Protocol.Bob,\n Protocol.Flow,\n Protocol.Legacy,\n Protocol.Lockup,\n ];\n\n const matches = protocols\n .map((p) => aliasCatalog[p]?.[chainId]?.[alias])\n .filter(Boolean) as Sablier.EVM.Contract[];\n\n if (matches.length === 0) {\n throw new Error(`Sablier SDK: Unknown EVM contract alias \"${alias}\" on chain ${chainId}`);\n }\n\n if (matches.length > 1) {\n throw new Error(\n `Sablier SDK: Ambiguous EVM contract alias \"${alias}\" on chain ${chainId}; specify protocol`\n );\n }\n\n return matches[0];\n}\n\n/**\n * Truncate an Ethereum address for display purposes.\n * @param address - The Ethereum address to truncate (0x-prefixed)\n * @param options - Truncation options with start/end character counts (default: 4 each, must be >= 1)\n * @returns Truncated address in format \"0xcafe...beef\" or original if too short\n * @example\n * truncateEvmAddress(\"0x1234567890abcdef1234567890abcdef12345678\") // \"0x1234...5678\"\n * truncateEvmAddress(\"0x1234567890abcdef1234567890abcdef12345678\", { start: 6, end: 6 }) // \"0x123456...345678\"\n * truncateEvmAddress(\"0x1234567890abcdef1234567890abcdef12345678\", { start: 2, end: 6 }) // \"0x12...345678\"\n * truncateEvmAddress(\"0x123\") // \"0x123\" (too short, returns original)\n */\nexport function truncateEvmAddress(\n address: Sablier.EVM.Address,\n options?: TruncateAddressOptions\n): string {\n if (!address) {\n return address;\n }\n\n const start = options?.start ?? 4;\n const end = options?.end ?? 4;\n const minLength = 2 + start + end;\n\n if (address.length <= minLength) {\n return address;\n }\n\n const prefix = address.slice(0, 2 + start);\n const suffix = end === 0 ? \"\" : address.slice(-end);\n\n return `${prefix}...${suffix}`;\n}\n"]}
|
package/dist/esm/evm/helpers.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getContractExplorerURL as getContractExplorerURLInternal } from "../internal/utils/explorer-url.js";
|
|
2
2
|
import { getAliasCatalog } from "./contracts/alias-catalog.js";
|
|
3
3
|
import { Protocol } from "./enums.js";
|
|
4
|
-
export { getAirdropsReleaseFeatures, getFlowReleaseFeatures, getLockupReleaseFeatures, hasClaimTo, hasOnchainMinFee, hasSplitLockupArchitecture, hasSponsor, isEvmReleasePayable, supportsLockupBatch, supportsLockupPrbProxy, supportsLockupShape, usesLockupSplit, } from "./releases/features.js";
|
|
4
|
+
export { evmReleaseFeatures, getAirdropsReleaseFeatures, getEvmReleaseFeatures, getFlowReleaseFeatures, getLockupReleaseFeatures, hasClaimTo, hasOnchainMinFee, hasSplitLockupArchitecture, hasSponsor, isEvmReleasePayable, supportsLockupBatch, supportsLockupPrbProxy, supportsLockupShape, usesLockupSplit, } from "./releases/features.js";
|
|
5
5
|
export function getContractExplorerURL(explorerURL, contractAddress) {
|
|
6
6
|
return getContractExplorerURLInternal(explorerURL, contractAddress);
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/evm/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,IAAI,8BAA8B,EAAE,MAAM,sCAAsC,CAAC;AAEhH,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/evm/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,IAAI,8BAA8B,EAAE,MAAM,sCAAsC,CAAC;AAEhH,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAQtC,OAAO,EACL,kBAAkB,EACl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AAM,EAAE,CAAC;AACjC,CAAC","sourcesContent":["import { getContractExplorerURL as getContractExplorerURLInternal } from \"@/src/internal/utils/explorer-url.js\";\nimport type { Sablier, TruncateAddressOptions } from \"@/src/types.js\";\nimport { getAliasCatalog } from \"./contracts/alias-catalog.js\";\nimport { Protocol } from \"./enums.js\";\n\nexport type {\n EvmReleaseFeatureSetByProtocol,\n EvmReleaseVersionByProtocol,\n PayableEvmProtocol,\n ReleaseFeaturesForProtocol,\n} from \"./releases/features.js\";\nexport {\n evmReleaseFeatures,\n getAirdropsReleaseFeatures,\n getEvmReleaseFeatures,\n getFlowReleaseFeatures,\n getLockupReleaseFeatures,\n hasClaimTo,\n hasOnchainMinFee,\n hasSplitLockupArchitecture,\n hasSponsor,\n isEvmReleasePayable,\n supportsLockupBatch,\n supportsLockupPrbProxy,\n supportsLockupShape,\n usesLockupSplit,\n} from \"./releases/features.js\";\n\n/**\n * Get the explorer URL for a contract. Compatible with Etherscan, Blockscout, etc.\n * @param explorerURL - The base explorer URL, e.g. https://etherscan.io\n * @param contractAddress - The contract object\n * @returns The explorer URL for the contract, e.g. https://etherscan.io/address/0x123...\n */\nexport function getContractExplorerURL(explorerURL: string, contractAddress: Sablier.EVM.Address) {\n return getContractExplorerURLInternal(explorerURL, contractAddress);\n}\n\n/**\n * Constructs a stream/airdrop entity ID for EVM chains in the format used by Sablier indexers.\n * Format: `{contractAddress}-{chainId}-{tokenId}`\n *\n * The contract address is lowercased for normalization, as EVM addresses are case-insensitive.\n *\n * @param opts - Configuration object\n * @param opts.alias - Contract alias (e.g., \"LL2\", \"LK2\", \"FL2\")\n * @param opts.chainId - Chain ID where the contract is deployed\n * @param opts.tokenId - Stream/airdrop token ID\n * @param opts.protocol - Optional protocol to disambiguate aliases\n * @returns Stream ID in format \"0xabc...-1-123\"\n * @example\n * resolveEvmStreamId({ alias: \"LL2\", chainId: 1, tokenId: 123n })\n * // => \"0xabc...-1-123\"\n */\nexport function resolveEvmStreamId(opts: {\n alias: string;\n chainId: number;\n tokenId: bigint | string | number;\n protocol?: Sablier.EVM.Protocol;\n}): string {\n const { alias, chainId, tokenId, protocol } = opts;\n\n const contract = resolveEvmContractByAlias({ alias, chainId, protocol });\n return `${contract.address.toLowerCase()}-${chainId}-${tokenId}`;\n}\n\n/**\n * Resolves an EVM contract by its alias from the alias catalog.\n *\n * @param opts - Configuration object\n * @param opts.alias - Contract alias (e.g., \"LL2\", \"LK2\", \"FL2\")\n * @param opts.chainId - Chain ID where the contract is deployed\n * @param opts.protocol - Optional protocol to disambiguate aliases that exist in multiple protocols\n * @returns The resolved contract\n * @throws Error if alias is not found or is ambiguous without protocol specified\n * @example\n * resolveEvmContractByAlias({ alias: \"LL2\", chainId: 1 })\n * // => { address: \"0x...\", name: \"SablierLockupLinear\", ... }\n */\nexport function resolveEvmContractByAlias(opts: {\n alias: string;\n chainId: number;\n protocol?: Sablier.EVM.Protocol;\n}): Sablier.EVM.Contract {\n const { alias, chainId, protocol } = opts;\n const aliasCatalog = getAliasCatalog();\n\n if (protocol) {\n const contract = aliasCatalog[protocol]?.[chainId]?.[alias];\n if (!contract) {\n throw new Error(\n `Sablier SDK: Unknown EVM contract alias \"${alias}\" on chain ${chainId} for protocol \"${protocol}\"`\n );\n }\n return contract;\n }\n\n const protocols: Sablier.EVM.Protocol[] = [\n Protocol.Airdrops,\n Protocol.Bob,\n Protocol.Flow,\n Protocol.Legacy,\n Protocol.Lockup,\n ];\n\n const matches = protocols\n .map((p) => aliasCatalog[p]?.[chainId]?.[alias])\n .filter(Boolean) as Sablier.EVM.Contract[];\n\n if (matches.length === 0) {\n throw new Error(`Sablier SDK: Unknown EVM contract alias \"${alias}\" on chain ${chainId}`);\n }\n\n if (matches.length > 1) {\n throw new Error(\n `Sablier SDK: Ambiguous EVM contract alias \"${alias}\" on chain ${chainId}; specify protocol`\n );\n }\n\n return matches[0];\n}\n\n/**\n * Truncate an Ethereum address for display purposes.\n * @param address - The Ethereum address to truncate (0x-prefixed)\n * @param options - Truncation options with start/end character counts (default: 4 each, must be >= 1)\n * @returns Truncated address in format \"0xcafe...beef\" or original if too short\n * @example\n * truncateEvmAddress(\"0x1234567890abcdef1234567890abcdef12345678\") // \"0x1234...5678\"\n * truncateEvmAddress(\"0x1234567890abcdef1234567890abcdef12345678\", { start: 6, end: 6 }) // \"0x123456...345678\"\n * truncateEvmAddress(\"0x1234567890abcdef1234567890abcdef12345678\", { start: 2, end: 6 }) // \"0x12...345678\"\n * truncateEvmAddress(\"0x123\") // \"0x123\" (too short, returns original)\n */\nexport function truncateEvmAddress(\n address: Sablier.EVM.Address,\n options?: TruncateAddressOptions\n): string {\n if (!address) {\n return address;\n }\n\n const start = options?.start ?? 4;\n const end = options?.end ?? 4;\n const minLength = 2 + start + end;\n\n if (address.length <= minLength) {\n return address;\n }\n\n const prefix = address.slice(0, 2 + start);\n const suffix = end === 0 ? \"\" : address.slice(-end);\n\n return `${prefix}...${suffix}`;\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Sablier, TruncateAddressOptions } from "../types.js";
|
|
2
|
-
export type { PayableEvmProtocol } from "./releases/features.js";
|
|
3
|
-
export { getAirdropsReleaseFeatures, getFlowReleaseFeatures, getLockupReleaseFeatures, hasClaimTo, hasOnchainMinFee, hasSplitLockupArchitecture, hasSponsor, isEvmReleasePayable, supportsLockupBatch, supportsLockupPrbProxy, supportsLockupShape, usesLockupSplit, } from "./releases/features.js";
|
|
2
|
+
export type { EvmReleaseFeatureSetByProtocol, EvmReleaseVersionByProtocol, PayableEvmProtocol, ReleaseFeaturesForProtocol, } from "./releases/features.js";
|
|
3
|
+
export { evmReleaseFeatures, getAirdropsReleaseFeatures, getEvmReleaseFeatures, getFlowReleaseFeatures, getLockupReleaseFeatures, hasClaimTo, hasOnchainMinFee, hasSplitLockupArchitecture, hasSponsor, isEvmReleasePayable, supportsLockupBatch, supportsLockupPrbProxy, supportsLockupShape, usesLockupSplit, } from "./releases/features.js";
|
|
4
4
|
export declare function getContractExplorerURL(explorerURL: string, contractAddress: Sablier.EVM.Address): string;
|
|
5
5
|
export declare function resolveEvmStreamId(opts: {
|
|
6
6
|
alias: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/evm/helpers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAItE,YAAY,
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/evm/helpers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAItE,YAAY,EACV,8BAA8B,EAC9B,2BAA2B,EAC3B,kBAAkB,EAClB,0BAA0B,GAC3B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,kBAAkB,EAClB,0BAA0B,EAC1B,qBAAqB,EACrB,sBAAsB,EACtB,wBAAwB,EACxB,UAAU,EACV,gBAAgB,EAChB,0BAA0B,EAC1B,UAAU,EACV,mBAAmB,EACnB,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB,EACnB,eAAe,GAChB,MAAM,wBAAwB,CAAC;AAQhC,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,MAAM,EAAE,eAAe,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,UAE/F;AAkBD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;CACjC,GAAG,MAAM,CAKT;AAeD,wBAAgB,yBAAyB,CAAC,IAAI,EAAE;IAC9C,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,C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