sablier 3.7.2 → 3.7.3
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 +10 -0
- package/dist/cjs/evm/releases/index.js +1 -0
- package/dist/cjs/evm/releases/index.js.map +1 -1
- package/dist/cjs/helpers.js +0 -1
- package/dist/cjs/helpers.js.map +1 -1
- package/dist/esm/evm/releases/index.js +1 -0
- package/dist/esm/evm/releases/index.js.map +1 -1
- package/dist/esm/helpers.js +0 -1
- package/dist/esm/helpers.js.map +1 -1
- package/dist/types/evm/releases/index.d.ts +1 -0
- package/dist/types/evm/releases/index.d.ts.map +1 -1
- package/dist/types/helpers.d.ts +0 -1
- package/dist/types/helpers.d.ts.map +1 -1
- package/package.json +6 -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.3]: https://github.com/sablier-labs/sdk/releases/tag/v3.7.3
|
|
12
13
|
[3.7.2]: https://github.com/sablier-labs/sdk/releases/tag/v3.7.2
|
|
13
14
|
[3.7.1]: https://github.com/sablier-labs/sdk/releases/tag/v3.7.1
|
|
14
15
|
[3.7.0]: https://github.com/sablier-labs/sdk/releases/tag/v3.7.0
|
|
@@ -45,6 +46,15 @@ The format is based on [Common Changelog](https://common-changelog.org/).
|
|
|
45
46
|
[1.1.0]: https://github.com/sablier-labs/sdk/releases/tag/v1.1.0
|
|
46
47
|
[1.0.0]: https://github.com/sablier-labs/sdk/releases/tag/v1.0.0
|
|
47
48
|
|
|
49
|
+
## [3.7.3] - 2026-04-10
|
|
50
|
+
|
|
51
|
+
### Fixed
|
|
52
|
+
|
|
53
|
+
- Fix root `sablier` release-feature helper exports for downstream type-checkers
|
|
54
|
+
([`93947a7`](https://github.com/sablier-labs/sdk/commit/93947a7))
|
|
55
|
+
- Fix `sablier/evm/releases` and `sablier/evm/releases/features` package exports
|
|
56
|
+
([`93947a7`](https://github.com/sablier-labs/sdk/commit/93947a7))
|
|
57
|
+
|
|
48
58
|
## [3.7.2] - 2026-04-10
|
|
49
59
|
|
|
50
60
|
### Added
|
|
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./data.js"), exports);
|
|
18
|
+
__exportStar(require("./features.js"), exports);
|
|
18
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/evm/releases/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B","sourcesContent":["export * from \"./data.js\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/evm/releases/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,gDAA8B","sourcesContent":["export * from \"./data.js\";\nexport * from \"./features.js\";\n"]}
|
package/dist/cjs/helpers.js
CHANGED
|
@@ -25,7 +25,6 @@ const enums_js_1 = require("./evm/enums.js");
|
|
|
25
25
|
const helpers_js_1 = require("./evm/helpers.js");
|
|
26
26
|
const chains_js_1 = require("./solana/chains/chains.js");
|
|
27
27
|
const helpers_js_2 = require("./solana/helpers.js");
|
|
28
|
-
__exportStar(require("./evm/helpers.js"), exports);
|
|
29
28
|
__exportStar(require("./solana/helpers.js"), exports);
|
|
30
29
|
const MULTI_ECOSYSTEM_PROTOCOLS = new Set([enums_js_1.Protocol.Airdrops, enums_js_1.Protocol.Lockup]);
|
|
31
30
|
function compareVersions(a, b) {
|
package/dist/cjs/helpers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAgCA,0CAQC;AAWD,0CAEC;AAWD,wCAEC;AAiCD,4CAaC;AAeD,0CAIC;AA6BD,0CA+BC;AA/LD,6CAAyD;AAEzD,iDAA+F;AAC/F,yDAA6D;AAC7D,oDAAmF;AAMnF,sDAAoC;AAUpC,MAAM,yBAAyB,GAAG,IAAI,GAAG,CAAC,CAAC,mBAAW,CAAC,QAAQ,EAAE,mBAAW,CAAC,MAAM,CAAC,CAAC,CAAC;AAYtF,SAAgB,eAAe,CAAC,CAAU,EAAE,CAAU;IACpD,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC3D,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAE3D,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;QACtB,OAAO,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;IACD,OAAO,MAAM,GAAG,MAAM,CAAC;AACzB,CAAC;AAWD,SAAgB,eAAe,CAAC,OAAgB,EAAE,MAAe;IAC/D,OAAO,eAAe,CAAC,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;AAC9C,CAAC;AAWD,SAAgB,cAAc,CAAC,OAAgB,EAAE,KAAc;IAC7D,OAAO,eAAe,CAAC,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;AAC7C,CAAC;AAiCD,SAAgB,gBAAgB,CAC9B,iBAA2D,EAC3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Content":["import { Protocol as EvmProtocol } from \"./evm/enums.js\";\nimport type { PayableEvmProtocol } from \"./evm/helpers.js\";\nimport { isEvmReleasePayable, resolveEvmStreamId, truncateEvmAddress } from \"./evm/helpers.js\";\nimport { SOLANA_CHAIN_IDS } from \"./solana/chains/chains.js\";\nimport { resolveSolanaStreamId, truncateSolanaAddress } from \"./solana/helpers.js\";\nimport type { Sablier, TruncateAddressOptions } from \"./types.js\";\n\n// Re-export platform-specific helpers. EVM helpers are surfaced from the\n// package root via `src/evm/index.ts`, so keep this barrel Solana-only to avoid\n// duplicate `export *` paths for the same EVM names at `sablier`.\nexport * from \"./solana/helpers.js\";\n\n// Re-export shared types\nexport type { TruncateAddressOptions } from \"./types.js\";\n\n/** Version type supporting both EVM and Solana protocols */\ntype Version = Sablier.EVM.Version | Sablier.Solana.Version;\ntype EvmReleaseReference = Pick<Sablier.EVM.Release, \"protocol\" | \"version\">;\n\n/** Protocols that exist on both EVM and Solana ecosystems */\nconst MULTI_ECOSYSTEM_PROTOCOLS = new Set([EvmProtocol.Airdrops, EvmProtocol.Lockup]);\n\n/**\n * Compare two semantic version strings.\n * @param a - First version string (e.g., \"v1.0\")\n * @param b - Second version string (e.g., \"v1.0\")\n * @returns -1 if a < b, 0 if a === b, 1 if a > b\n * @example\n * compareVersions(\"v1.0\", \"v2.0\") // -1\n * compareVersions(\"v2.0\", \"v1.0\") // 1\n * compareVersions(\"v1.1\", \"v1.1\") // 0\n */\nexport function compareVersions(a: Version, b: Version): number {\n const [aMajor, aMinor] = a.slice(1).split(\".\").map(Number);\n const [bMajor, bMinor] = b.slice(1).split(\".\").map(Number);\n\n if (aMajor !== bMajor) {\n return aMajor - bMajor;\n }\n return aMinor - bMinor;\n}\n\n/**\n * Check if a version comes before another chronologically.\n * @param version - The version to check\n * @param before - The reference version to compare against\n * @returns true if version comes before the reference version\n * @example\n * isVersionBefore(\"v1.0\", \"v2.0\") // true\n * isVersionBefore(\"v2.0\", \"v1.0\") // false\n */\nexport function isVersionBefore(version: Version, before: Version): boolean {\n return compareVersions(version, before) < 0;\n}\n\n/**\n * Check if a version comes after another chronologically.\n * @param version - The version to check\n * @param after - The reference version to compare against\n * @returns true if version comes after the reference version\n * @example\n * isVersionAfter(\"v2.0\", \"v1.0\") // true\n * isVersionAfter(\"v1.0\", \"v2.0\") // false\n */\nexport function isVersionAfter(version: Version, after: Version): boolean {\n return compareVersions(version, after) > 0;\n}\n\n/**\n * Check if a protocol release charges ETH fees on withdraw/claim operations.\n *\n * Starting from specific versions, Sablier contracts charge a small ETH fee when\n * recipients withdraw or claim tokens from streams and airdrops.\n *\n * @param release - The release object or `{ protocol, version }` pair to check\n * @returns true if the release charges fees\n * @see {@link https://docs.sablier.com/concepts/fees} for fee details\n * @example\n * isReleasePayable({ protocol: \"airdrops\", version: \"v1.2\" }) // false\n * isReleasePayable({ protocol: \"airdrops\", version: \"v1.3\" }) // true\n * isReleasePayable(\"airdrops\", \"v1.2\") // false\n * isReleasePayable(\"airdrops\", \"v1.3\") // true\n * isReleasePayable({ protocol: \"lockup\", version: \"v1.2\" }) // false\n * isReleasePayable({ protocol: \"lockup\", version: \"v2.0\" }) // true\n * isReleasePayable(\"lockup\", \"v1.2\") // false\n * isReleasePayable(\"lockup\", \"v2.0\") // true\n * isReleasePayable({ protocol: \"flow\", version: \"v1.0\" }) // false\n * isReleasePayable({ protocol: \"flow\", version: \"v1.1\" }) // true\n * isReleasePayable(\"flow\", \"v1.0\") // false\n * isReleasePayable(\"flow\", \"v1.1\") // true\n */\nexport function isReleasePayable(release: EvmReleaseReference): boolean;\n/**\n * @deprecated Pass a release object instead. This overload will be removed in the next major version (v4).\n */\nexport function isReleasePayable(\n protocol: PayableEvmProtocol,\n version: Sablier.EVM.Version\n): boolean;\nexport function isReleasePayable(\n releaseOrProtocol: EvmReleaseReference | PayableEvmProtocol,\n version?: Sablier.EVM.Version\n): boolean {\n if (typeof releaseOrProtocol !== \"string\") {\n return isEvmReleasePayable(releaseOrProtocol);\n }\n\n if (!version) {\n throw new Error('Sablier SDK: Missing \"version\" for isEvmReleasePayable(protocol, version)');\n }\n\n return isEvmReleasePayable(releaseOrProtocol, version);\n}\n\n/**\n * Truncate an Ethereum or Solana address for display purposes.\n * Automatically routes to the appropriate typed function based on address format.\n *\n * @param address - The address to truncate (Ethereum 0x-prefixed or Solana base58)\n * @param options - Optional truncation options with start and end character counts (default: 4 each)\n * @returns Truncated address in format \"0xcafe...beef\" or \"DYw8...NSKK\" or original if too short\n * @example\n * truncateAddress(\"0x1234567890abcdef1234567890abcdef12345678\") // \"0x1234...5678\"\n * truncateAddress(\"0x1234567890abcdef1234567890abcdef12345678\", { start: 6, end: 6 }) // \"0x123456...345678\"\n * truncateAddress(\"DYw8jCTfwHNRJhhmFcbXvVDTqWMEVFBX6ZKUmG5CNSKK\") // \"DYw8...NSKK\"\n * truncateAddress(\"0x123\") // \"0x123\" (too short, returns original)\n */\nexport function truncateAddress(address: string, options?: TruncateAddressOptions): string {\n return address.startsWith(\"0x\")\n ? truncateEvmAddress(address as Sablier.EVM.Address, options)\n : truncateSolanaAddress(address, options);\n}\n\n/**\n * Convenience alias for {@link truncateAddress}.\n * Also suitable for truncating arbitrary hex strings, not just addresses.\n */\nexport const truncate = truncateAddress;\n\n/**\n * Resolves a stream/airdrop entity ID for use with Sablier indexers.\n * Automatically routes to EVM or Solana based on chain ID.\n *\n * Format: `{contractAddress}-{chainId}-{tokenId}`\n *\n * @param opts - Configuration object\n * @param opts.alias - Contract/program alias (e.g., \"LL2\", \"LK2\", \"FL2\" for EVM; \"LL\" for Solana)\n * @param opts.chainId - Chain ID (EVM chains or Solana chains: 900000010, 900000020)\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\" (EVM) or \"DYw8jC...-900000010-123\" (Solana)\n * @example\n * // EVM\n * resolveStreamId({ alias: \"LL2\", chainId: 1, tokenId: 123n })\n * // => \"0xabc...-1-123\"\n *\n * // Solana\n * resolveStreamId({ alias: \"LL\", chainId: 900000010, tokenId: 456n })\n * // => \"DYw8jC...-900000010-456\"\n */\nexport function resolveStreamId(opts: {\n alias: string;\n chainId: number;\n tokenId: bigint | string | number;\n protocol?: Sablier.EVM.Protocol | Sablier.Solana.Protocol;\n}): string {\n const { alias, chainId, tokenId, protocol } = opts;\n const isSolanaChain = SOLANA_CHAIN_IDS.has(chainId);\n\n // Validate protocol/chain compatibility\n if (protocol && isSolanaChain && !MULTI_ECOSYSTEM_PROTOCOLS.has(protocol as EvmProtocol)) {\n throw new Error(\n `Sablier SDK: Protocol \"${protocol}\" is EVM-only and not valid for Solana chain ${chainId}`\n );\n }\n\n if (isSolanaChain) {\n return resolveSolanaStreamId({\n alias,\n chainId,\n protocol: protocol as Sablier.Solana.Protocol,\n tokenId,\n });\n }\n\n return resolveEvmStreamId({\n alias,\n chainId,\n protocol: protocol as Sablier.EVM.Protocol,\n tokenId,\n });\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/evm/releases/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC","sourcesContent":["export * from \"./data.js\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/evm/releases/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC","sourcesContent":["export * from \"./data.js\";\nexport * from \"./features.js\";\n"]}
|
package/dist/esm/helpers.js
CHANGED
|
@@ -2,7 +2,6 @@ import { Protocol as EvmProtocol } from "./evm/enums.js";
|
|
|
2
2
|
import { isEvmReleasePayable, resolveEvmStreamId, truncateEvmAddress } from "./evm/helpers.js";
|
|
3
3
|
import { SOLANA_CHAIN_IDS } from "./solana/chains/chains.js";
|
|
4
4
|
import { resolveSolanaStreamId, truncateSolanaAddress } from "./solana/helpers.js";
|
|
5
|
-
export * from "./evm/helpers.js";
|
|
6
5
|
export * from "./solana/helpers.js";
|
|
7
6
|
const MULTI_ECOSYSTEM_PROTOCOLS = new Set([EvmProtocol.Airdrops, EvmProtocol.Lockup]);
|
|
8
7
|
export function compareVersions(a, b) {
|
package/dist/esm/helpers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAEzD,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC/F,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAEzD,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC/F,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAMnF,cAAc,qBAAqB,CAAC;AAUpC,MAAM,yBAAyB,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,CAAC,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;AAYtF,MAAM,UAAU,eAAe,CAAC,CAAU,EAAE,CAAU;IACpD,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC3D,MAAM,CAAC,M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OAAO,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;IACnD,MAAM,aAAa,GAAG,gBAAgB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAGpD,IAAI,QAAQ,IAAI,aAAa,IAAI,CAAC,yBAAyB,CAAC,GAAG,CAAC,QAAuB,CAAC,EAAE,CAAC;QACzF,MAAM,IAAI,KAAK,CACb,0BAA0B,QAAQ,gDAAgD,OAAO,EAAE,CAC5F,CAAC;IACJ,CAAC;IAED,IAAI,aAAa,EAAE,CAAC;QAClB,OAAO,qBAAqB,CAAC;YAC3B,KAAK;YACL,OAAO;YACP,QAAQ,EAAE,QAAmC;YAC7C,OAAO;SACR,CAAC,CAAC;IACL,CAAC;IAED,OAAO,kBAAkB,CAAC;QACxB,KAAK;QACL,OAAO;QACP,QAAQ,EAAE,QAAgC;QAC1C,OAAO;KACR,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { Protocol as EvmProtocol } from \"./evm/enums.js\";\nimport type { PayableEvmProtocol } from \"./evm/helpers.js\";\nimport { isEvmReleasePayable, resolveEvmStreamId, truncateEvmAddress } from \"./evm/helpers.js\";\nimport { SOLANA_CHAIN_IDS } from \"./solana/chains/chains.js\";\nimport { resolveSolanaStreamId, truncateSolanaAddress } from \"./solana/helpers.js\";\nimport type { Sablier, TruncateAddressOptions } from \"./types.js\";\n\n// Re-export platform-specific helpers. EVM helpers are surfaced from the\n// package root via `src/evm/index.ts`, so keep this barrel Solana-only to avoid\n// duplicate `export *` paths for the same EVM names at `sablier`.\nexport * from \"./solana/helpers.js\";\n\n// Re-export shared types\nexport type { TruncateAddressOptions } from \"./types.js\";\n\n/** Version type supporting both EVM and Solana protocols */\ntype Version = Sablier.EVM.Version | Sablier.Solana.Version;\ntype EvmReleaseReference = Pick<Sablier.EVM.Release, \"protocol\" | \"version\">;\n\n/** Protocols that exist on both EVM and Solana ecosystems */\nconst MULTI_ECOSYSTEM_PROTOCOLS = new Set([EvmProtocol.Airdrops, EvmProtocol.Lockup]);\n\n/**\n * Compare two semantic version strings.\n * @param a - First version string (e.g., \"v1.0\")\n * @param b - Second version string (e.g., \"v1.0\")\n * @returns -1 if a < b, 0 if a === b, 1 if a > b\n * @example\n * compareVersions(\"v1.0\", \"v2.0\") // -1\n * compareVersions(\"v2.0\", \"v1.0\") // 1\n * compareVersions(\"v1.1\", \"v1.1\") // 0\n */\nexport function compareVersions(a: Version, b: Version): number {\n const [aMajor, aMinor] = a.slice(1).split(\".\").map(Number);\n const [bMajor, bMinor] = b.slice(1).split(\".\").map(Number);\n\n if (aMajor !== bMajor) {\n return aMajor - bMajor;\n }\n return aMinor - bMinor;\n}\n\n/**\n * Check if a version comes before another chronologically.\n * @param version - The version to check\n * @param before - The reference version to compare against\n * @returns true if version comes before the reference version\n * @example\n * isVersionBefore(\"v1.0\", \"v2.0\") // true\n * isVersionBefore(\"v2.0\", \"v1.0\") // false\n */\nexport function isVersionBefore(version: Version, before: Version): boolean {\n return compareVersions(version, before) < 0;\n}\n\n/**\n * Check if a version comes after another chronologically.\n * @param version - The version to check\n * @param after - The reference version to compare against\n * @returns true if version comes after the reference version\n * @example\n * isVersionAfter(\"v2.0\", \"v1.0\") // true\n * isVersionAfter(\"v1.0\", \"v2.0\") // false\n */\nexport function isVersionAfter(version: Version, after: Version): boolean {\n return compareVersions(version, after) > 0;\n}\n\n/**\n * Check if a protocol release charges ETH fees on withdraw/claim operations.\n *\n * Starting from specific versions, Sablier contracts charge a small ETH fee when\n * recipients withdraw or claim tokens from streams and airdrops.\n *\n * @param release - The release object or `{ protocol, version }` pair to check\n * @returns true if the release charges fees\n * @see {@link https://docs.sablier.com/concepts/fees} for fee details\n * @example\n * isReleasePayable({ protocol: \"airdrops\", version: \"v1.2\" }) // false\n * isReleasePayable({ protocol: \"airdrops\", version: \"v1.3\" }) // true\n * isReleasePayable(\"airdrops\", \"v1.2\") // false\n * isReleasePayable(\"airdrops\", \"v1.3\") // true\n * isReleasePayable({ protocol: \"lockup\", version: \"v1.2\" }) // false\n * isReleasePayable({ protocol: \"lockup\", version: \"v2.0\" }) // true\n * isReleasePayable(\"lockup\", \"v1.2\") // false\n * isReleasePayable(\"lockup\", \"v2.0\") // true\n * isReleasePayable({ protocol: \"flow\", version: \"v1.0\" }) // false\n * isReleasePayable({ protocol: \"flow\", version: \"v1.1\" }) // true\n * isReleasePayable(\"flow\", \"v1.0\") // false\n * isReleasePayable(\"flow\", \"v1.1\") // true\n */\nexport function isReleasePayable(release: EvmReleaseReference): boolean;\n/**\n * @deprecated Pass a release object instead. This overload will be removed in the next major version (v4).\n */\nexport function isReleasePayable(\n protocol: PayableEvmProtocol,\n version: Sablier.EVM.Version\n): boolean;\nexport function isReleasePayable(\n releaseOrProtocol: EvmReleaseReference | PayableEvmProtocol,\n version?: Sablier.EVM.Version\n): boolean {\n if (typeof releaseOrProtocol !== \"string\") {\n return isEvmReleasePayable(releaseOrProtocol);\n }\n\n if (!version) {\n throw new Error('Sablier SDK: Missing \"version\" for isEvmReleasePayable(protocol, version)');\n }\n\n return isEvmReleasePayable(releaseOrProtocol, version);\n}\n\n/**\n * Truncate an Ethereum or Solana address for display purposes.\n * Automatically routes to the appropriate typed function based on address format.\n *\n * @param address - The address to truncate (Ethereum 0x-prefixed or Solana base58)\n * @param options - Optional truncation options with start and end character counts (default: 4 each)\n * @returns Truncated address in format \"0xcafe...beef\" or \"DYw8...NSKK\" or original if too short\n * @example\n * truncateAddress(\"0x1234567890abcdef1234567890abcdef12345678\") // \"0x1234...5678\"\n * truncateAddress(\"0x1234567890abcdef1234567890abcdef12345678\", { start: 6, end: 6 }) // \"0x123456...345678\"\n * truncateAddress(\"DYw8jCTfwHNRJhhmFcbXvVDTqWMEVFBX6ZKUmG5CNSKK\") // \"DYw8...NSKK\"\n * truncateAddress(\"0x123\") // \"0x123\" (too short, returns original)\n */\nexport function truncateAddress(address: string, options?: TruncateAddressOptions): string {\n return address.startsWith(\"0x\")\n ? truncateEvmAddress(address as Sablier.EVM.Address, options)\n : truncateSolanaAddress(address, options);\n}\n\n/**\n * Convenience alias for {@link truncateAddress}.\n * Also suitable for truncating arbitrary hex strings, not just addresses.\n */\nexport const truncate = truncateAddress;\n\n/**\n * Resolves a stream/airdrop entity ID for use with Sablier indexers.\n * Automatically routes to EVM or Solana based on chain ID.\n *\n * Format: `{contractAddress}-{chainId}-{tokenId}`\n *\n * @param opts - Configuration object\n * @param opts.alias - Contract/program alias (e.g., \"LL2\", \"LK2\", \"FL2\" for EVM; \"LL\" for Solana)\n * @param opts.chainId - Chain ID (EVM chains or Solana chains: 900000010, 900000020)\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\" (EVM) or \"DYw8jC...-900000010-123\" (Solana)\n * @example\n * // EVM\n * resolveStreamId({ alias: \"LL2\", chainId: 1, tokenId: 123n })\n * // => \"0xabc...-1-123\"\n *\n * // Solana\n * resolveStreamId({ alias: \"LL\", chainId: 900000010, tokenId: 456n })\n * // => \"DYw8jC...-900000010-456\"\n */\nexport function resolveStreamId(opts: {\n alias: string;\n chainId: number;\n tokenId: bigint | string | number;\n protocol?: Sablier.EVM.Protocol | Sablier.Solana.Protocol;\n}): string {\n const { alias, chainId, tokenId, protocol } = opts;\n const isSolanaChain = SOLANA_CHAIN_IDS.has(chainId);\n\n // Validate protocol/chain compatibility\n if (protocol && isSolanaChain && !MULTI_ECOSYSTEM_PROTOCOLS.has(protocol as EvmProtocol)) {\n throw new Error(\n `Sablier SDK: Protocol \"${protocol}\" is EVM-only and not valid for Solana chain ${chainId}`\n );\n }\n\n if (isSolanaChain) {\n return resolveSolanaStreamId({\n alias,\n chainId,\n protocol: protocol as Sablier.Solana.Protocol,\n tokenId,\n });\n }\n\n return resolveEvmStreamId({\n alias,\n chainId,\n protocol: protocol as Sablier.EVM.Protocol,\n tokenId,\n });\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/evm/releases/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/evm/releases/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC"}
|
package/dist/types/helpers.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { PayableEvmProtocol } from "./evm/helpers.js";
|
|
2
2
|
import type { Sablier, TruncateAddressOptions } from "./types.js";
|
|
3
|
-
export * from "./evm/helpers.js";
|
|
4
3
|
export * from "./solana/helpers.js";
|
|
5
4
|
export type { TruncateAddressOptions } from "./types.js";
|
|
6
5
|
type Version = Sablier.EVM.Version | Sablier.Solana.Version;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/helpers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAI3D,OAAO,KAAK,EAAE,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/helpers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAI3D,OAAO,KAAK,EAAE,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAKlE,cAAc,qBAAqB,CAAC;AAGpC,YAAY,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAGzD,KAAK,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC;AAC5D,KAAK,mBAAmB,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,UAAU,GAAG,SAAS,CAAC,CAAC;AAe7E,wBAAgB,eAAe,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,MAAM,CAQ9D;AAWD,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAE1E;AAWD,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAExE;AAyBD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC;AAIxE,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,GAC3B,OAAO,CAAC;AA6BX,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,sBAAsB,GAAG,MAAM,CAIzF;AAMD,eAAO,MAAM,QAAQ,wBAAkB,CAAC;AAuBxC,wBAAgB,eAAe,CAAC,IAAI,EAAE;IACpC,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,GAAG,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC;CAC3D,GAAG,MAAM,CA0BT"}
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"sideEffects": false,
|
|
8
8
|
"types": "./dist/types/index.d.ts",
|
|
9
9
|
"typings": "./dist/types/index.d.ts",
|
|
10
|
-
"version": "3.7.
|
|
10
|
+
"version": "3.7.3",
|
|
11
11
|
"type": "module",
|
|
12
12
|
"author": {
|
|
13
13
|
"name": "Sablier Labs Ltd",
|
|
@@ -100,6 +100,11 @@
|
|
|
100
100
|
"import": "./dist/esm/evm/releases/index.js",
|
|
101
101
|
"default": "./dist/cjs/evm/releases/index.js"
|
|
102
102
|
},
|
|
103
|
+
"./evm/releases/features": {
|
|
104
|
+
"types": "./dist/types/evm/releases/features.d.ts",
|
|
105
|
+
"import": "./dist/esm/evm/releases/features.js",
|
|
106
|
+
"default": "./dist/cjs/evm/releases/features.js"
|
|
107
|
+
},
|
|
103
108
|
"./evm/*": {
|
|
104
109
|
"types": "./dist/types/evm/*/index.d.ts",
|
|
105
110
|
"import": "./dist/esm/evm/*/index.js",
|