sablier 3.4.0 → 3.5.0
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/helpers.js +2 -1
- package/dist/cjs/evm/helpers.js.map +1 -1
- package/dist/cjs/evm/releases/features.js +46 -6
- package/dist/cjs/evm/releases/features.js.map +1 -1
- package/dist/cjs/evm/types.js.map +1 -1
- package/dist/esm/evm/helpers.js +1 -1
- package/dist/esm/evm/helpers.js.map +1 -1
- package/dist/esm/evm/releases/features.js +45 -6
- package/dist/esm/evm/releases/features.js.map +1 -1
- package/dist/esm/evm/types.js.map +1 -1
- package/dist/types/evm/helpers.d.ts +1 -1
- package/dist/types/evm/helpers.d.ts.map +1 -1
- package/dist/types/evm/releases/features.d.ts +7 -0
- package/dist/types/evm/releases/features.d.ts.map +1 -1
- package/dist/types/evm/types.d.ts +1 -0
- package/dist/types/evm/types.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.5.0]: https://github.com/sablier-labs/sdk/releases/tag/v3.5.0
|
|
12
13
|
[3.4.0]: https://github.com/sablier-labs/sdk/releases/tag/v3.4.0
|
|
13
14
|
[3.3.5]: https://github.com/sablier-labs/sdk/releases/tag/v3.3.5
|
|
14
15
|
[3.3.4]: https://github.com/sablier-labs/sdk/releases/tag/v3.3.4
|
|
@@ -40,6 +41,15 @@ The format is based on [Common Changelog](https://common-changelog.org/).
|
|
|
40
41
|
[1.1.0]: https://github.com/sablier-labs/sdk/releases/tag/v1.1.0
|
|
41
42
|
[1.0.0]: https://github.com/sablier-labs/sdk/releases/tag/v1.0.0
|
|
42
43
|
|
|
44
|
+
## [3.5.0] - 2026-04-07
|
|
45
|
+
|
|
46
|
+
### Added
|
|
47
|
+
|
|
48
|
+
- Add `shape` feature flag to lockup release feature map, tracking on-chain shape parameter support (v2.0+)
|
|
49
|
+
([`a87174c`](https://github.com/sablier-labs/sdk/commit/a87174c))
|
|
50
|
+
- Add `supportsLockupShape` helper for querying shape support by lockup version
|
|
51
|
+
([`a87174c`](https://github.com/sablier-labs/sdk/commit/a87174c))
|
|
52
|
+
|
|
43
53
|
## [3.4.0] - 2026-04-07
|
|
44
54
|
|
|
45
55
|
### Added
|
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.supportsLockupPrbProxy = exports.supportsLockupBatch = exports.isEvmReleasePayable = exports.hasSponsor = exports.hasClaimTo = exports.getLockupReleaseFeatures = exports.getFlowReleaseFeatures = exports.getAirdropsReleaseFeatures = void 0;
|
|
3
|
+
exports.usesLockupSplit = exports.supportsLockupShape = exports.supportsLockupPrbProxy = exports.supportsLockupBatch = exports.isEvmReleasePayable = exports.hasSponsor = exports.hasClaimTo = exports.getLockupReleaseFeatures = exports.getFlowReleaseFeatures = exports.getAirdropsReleaseFeatures = void 0;
|
|
4
4
|
exports.getContractExplorerURL = getContractExplorerURL;
|
|
5
5
|
exports.resolveEvmStreamId = resolveEvmStreamId;
|
|
6
6
|
exports.resolveEvmContractByAlias = resolveEvmContractByAlias;
|
|
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "hasSponsor", { enumerable: true, get: function (
|
|
|
17
17
|
Object.defineProperty(exports, "isEvmReleasePayable", { enumerable: true, get: function () { return features_js_1.isEvmReleasePayable; } });
|
|
18
18
|
Object.defineProperty(exports, "supportsLockupBatch", { enumerable: true, get: function () { return features_js_1.supportsLockupBatch; } });
|
|
19
19
|
Object.defineProperty(exports, "supportsLockupPrbProxy", { enumerable: true, get: function () { return features_js_1.supportsLockupPrbProxy; } });
|
|
20
|
+
Object.defineProperty(exports, "supportsLockupShape", { enumerable: true, get: function () { return features_js_1.supportsLockupShape; } });
|
|
20
21
|
Object.defineProperty(exports, "usesLockupSplit", { enumerable: true, get: function () { return features_js_1.usesLockupSplit; } });
|
|
21
22
|
function getContractExplorerURL(explorerURL, contractAddress) {
|
|
22
23
|
return (0, explorer_url_js_1.getContractExplorerURL)(explorerURL, contractAddress);
|
|
@@ -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":";;;AAyBA,wDAEC;AAkBD,gDAUC;AAeD,8DAyCC;AAaD,gDAoBC;AAhJD,0EAAgH;AAEhH,mEAA+D;AAC/D,yCAAsC;AAGtC,sDAWgC;AAV9B,yHAAA,0BAA0B,OAAA;AAC1B,qHAAA,sBAAsB,OAAA;AACtB,uHAAA,wBAAwB,OAAA;AACxB,yGAAA,UAAU,OAAA;AACV,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,GAA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CAAC,CAAC;AACpB,CAAC;AAaD,SAAgB,kBAAkB,CAChC,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 { PayableEvmProtocol } from \"./releases/features.js\";\nexport {\n getAirdropsReleaseFeatures,\n getFlowReleaseFeatures,\n getLockupReleaseFeatures,\n hasClaimTo,\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"]}
|
|
@@ -11,6 +11,7 @@ exports.hasSponsor = hasSponsor;
|
|
|
11
11
|
exports.supportsLockupBatch = supportsLockupBatch;
|
|
12
12
|
exports.supportsLockupPrbProxy = supportsLockupPrbProxy;
|
|
13
13
|
exports.usesLockupSplit = usesLockupSplit;
|
|
14
|
+
exports.supportsLockupShape = supportsLockupShape;
|
|
14
15
|
const enums_js_1 = require("../../evm/enums.js");
|
|
15
16
|
function deepFreeze(value) {
|
|
16
17
|
if (typeof value !== "object" || value === null || Object.isFrozen(value)) {
|
|
@@ -44,12 +45,48 @@ exports.evmReleaseFeatures = deepFreeze({
|
|
|
44
45
|
[enums_js_1.Version.Legacy.V1_1]: emptyReleaseFeatures,
|
|
45
46
|
},
|
|
46
47
|
[enums_js_1.Protocol.Lockup]: {
|
|
47
|
-
[enums_js_1.Version.Lockup.V1_0]: {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
[enums_js_1.Version.Lockup.V1_0]: {
|
|
49
|
+
batch: false,
|
|
50
|
+
legacyAbi: true,
|
|
51
|
+
payable: false,
|
|
52
|
+
prbProxy: true,
|
|
53
|
+
shape: false,
|
|
54
|
+
},
|
|
55
|
+
[enums_js_1.Version.Lockup.V1_1]: {
|
|
56
|
+
batch: false,
|
|
57
|
+
legacyAbi: true,
|
|
58
|
+
payable: false,
|
|
59
|
+
prbProxy: false,
|
|
60
|
+
shape: false,
|
|
61
|
+
},
|
|
62
|
+
[enums_js_1.Version.Lockup.V1_2]: {
|
|
63
|
+
batch: false,
|
|
64
|
+
legacyAbi: false,
|
|
65
|
+
payable: false,
|
|
66
|
+
prbProxy: false,
|
|
67
|
+
shape: false,
|
|
68
|
+
},
|
|
69
|
+
[enums_js_1.Version.Lockup.V2_0]: {
|
|
70
|
+
batch: true,
|
|
71
|
+
legacyAbi: false,
|
|
72
|
+
payable: true,
|
|
73
|
+
prbProxy: false,
|
|
74
|
+
shape: true,
|
|
75
|
+
},
|
|
76
|
+
[enums_js_1.Version.Lockup.V3_0]: {
|
|
77
|
+
batch: true,
|
|
78
|
+
legacyAbi: false,
|
|
79
|
+
payable: true,
|
|
80
|
+
prbProxy: false,
|
|
81
|
+
shape: true,
|
|
82
|
+
},
|
|
83
|
+
[enums_js_1.Version.Lockup.V4_0]: {
|
|
84
|
+
batch: true,
|
|
85
|
+
legacyAbi: false,
|
|
86
|
+
payable: true,
|
|
87
|
+
prbProxy: false,
|
|
88
|
+
shape: true,
|
|
89
|
+
},
|
|
53
90
|
},
|
|
54
91
|
});
|
|
55
92
|
const evmReleaseFeatureRegistry = exports.evmReleaseFeatures;
|
|
@@ -115,4 +152,7 @@ function supportsLockupPrbProxy(version) {
|
|
|
115
152
|
function usesLockupSplit(version) {
|
|
116
153
|
return getLockupReleaseFeatures(version).legacyAbi;
|
|
117
154
|
}
|
|
155
|
+
function supportsLockupShape(version) {
|
|
156
|
+
return getLockupReleaseFeatures(version).shape;
|
|
157
|
+
}
|
|
118
158
|
//# sourceMappingURL=features.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features.js","sourceRoot":"","sources":["../../../../src/evm/releases/features.ts"],"names":[],"mappings":";;;AAwKA,sDAKC;AAKD,gEAIC;AAKD,wDAIC;AAKD,4DAIC;AAaD,kDAyBC;AAKD,gCAEC;AAKD,gCAEC;AAKD,kDAEC;AAKD,wDAEC;AAKD,0CAEC;AA1QD,iDAAuD;AAqDvD,SAAS,UAAU,CAAI,KAAQ;IAC7B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1E,OAAO,KAAK,CAAC;IACf,CAAC;IAED,KAAK,MAAM,WAAW,IAAI,MAAM,CAAC,MAAM,CAAC,KAAgC,CAAC,EAAE,CAAC;QAC1E,UAAU,CAAC,WAAW,CAAC,CAAC;IAC1B,CAAC;IAED,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC;AAED,MAAM,oBAAoB,GAAG,UAAU,CAAC,EAAsD,CAAC,CAAC;AAKnF,QAAA,kBA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AAgB,wBAAwB,CACtC,OAAmC;IAEnC,OAAO,qBAAqB,CAAC,mBAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AACzD,CAAC;AAaD,SAAgB,mBAAmB,CACjC,iBAA6D,EAC7D,OAA6B;IAE7B,MAAM,OAAO,GAAG,4BAA4B,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC;IAEzE,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,EAAE,CAAC;QAClC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,gBAAgB,GAAG,6BAA6B,CAAC,OAAO,CAAC,QAAQ,CAE1D,CAAC;IAEd,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACtB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,eAAe,GAAG,gBAAgB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAE1D,IAAI,CAAC,eAAe,EAAE,CAAC;QACrB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,eAAe,CAAC,OAAO,CAAC;AACjC,CAAC;AAKD,SAAgB,UAAU,CAAC,OAAqC;IAC9D,OAAO,0BAA0B,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC;AACrD,CAAC;AAKD,SAAgB,UAAU,CAAC,OAAqC;IAC9D,OAAO,0BAA0B,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC;AACrD,CAAC;AAKD,SAAgB,mBAAmB,CAAC,OAAmC;IACrE,OAAO,wBAAwB,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC;AACjD,CAAC;AAKD,SAAgB,sBAAsB,CAAC,OAAmC;IACxE,OAAO,wBAAwB,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC;AACpD,CAAC;AAKD,SAAgB,eAAe,CAAC,OAAmC;IACjE,OAAO,wBAAwB,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC;AACrD,CAAC","sourcesContent":["/**\n * @file Canonical capability registry for every shipped EVM release.\n *\n * Release builders attach these feature bags to exported release objects, and\n * helper functions read from the same registry so version-dependent behavior\n * stays defined in one place.\n */\nimport { Protocol, Version } from \"@/src/evm/enums.js\";\nimport type { Sablier } from \"@/src/types.js\";\n\n/* -------------------------------------------------------------------------- */\n/* TYPES */\n/* -------------------------------------------------------------------------- */\n\nexport type EvmReleaseVersionByProtocol = {\n airdrops: Sablier.EVM.Version.Airdrops;\n bob: Sablier.EVM.Version.Bob;\n flow: Sablier.EVM.Version.Flow;\n legacy: Sablier.EVM.Version.Legacy;\n lockup: Sablier.EVM.Version.Lockup;\n};\n\nexport type EvmReleaseFeatureSetByProtocol = {\n airdrops: Sablier.EVM.AirdropsReleaseFeatures;\n bob: Sablier.EVM.EmptyReleaseFeatures;\n flow: Sablier.EVM.FlowReleaseFeatures;\n legacy: Sablier.EVM.EmptyReleaseFeatures;\n lockup: Sablier.EVM.LockupReleaseFeatures;\n};\n\ntype EvmReleaseFeatureRegistry = {\n [TProtocol in keyof EvmReleaseVersionByProtocol]: Record<\n EvmReleaseVersionByProtocol[TProtocol],\n EvmReleaseFeatureSetByProtocol[TProtocol]\n >;\n};\n\nexport type ReleaseFeaturesForProtocol<TProtocol extends keyof EvmReleaseFeatureSetByProtocol> =\n EvmReleaseFeatureSetByProtocol[TProtocol];\n\ntype ProtocolFeatureSet<TProtocol extends keyof EvmReleaseFeatureSetByProtocol> =\n EvmReleaseFeatureSetByProtocol[TProtocol];\n\ntype ProtocolWithBooleanFeature<TFeature extends PropertyKey> = {\n [TProtocol in keyof EvmReleaseFeatureSetByProtocol]: ProtocolFeatureSet<TProtocol> extends Record<\n TFeature,\n boolean\n >\n ? TProtocol\n : never;\n}[keyof EvmReleaseFeatureSetByProtocol];\n\ntype EvmReleaseReference = Pick<Sablier.EVM.Release, \"protocol\" | \"version\">;\ntype PayableEvmReleaseReference = {\n [TProtocol in PayableEvmProtocol]: {\n protocol: TProtocol;\n version: EvmReleaseVersionByProtocol[TProtocol];\n };\n}[PayableEvmProtocol];\n\nfunction deepFreeze<T>(value: T): T {\n if (typeof value !== \"object\" || value === null || Object.isFrozen(value)) {\n return value;\n }\n\n for (const nestedValue of Object.values(value as Record<string, unknown>)) {\n deepFreeze(nestedValue);\n }\n\n return Object.freeze(value);\n}\n\nconst emptyReleaseFeatures = deepFreeze({} as const satisfies Sablier.EVM.EmptyReleaseFeatures);\n\n/**\n * Protocol/version feature matrix used by both release resolvers and public helpers.\n */\nexport const evmReleaseFeatures = deepFreeze({\n [Protocol.Airdrops]: {\n [Version.Airdrops.V1_1]: { claimTo: false, payable: false, sponsor: false },\n [Version.Airdrops.V1_2]: { claimTo: false, payable: false, sponsor: false },\n [Version.Airdrops.V1_3]: { claimTo: false, payable: true, sponsor: false },\n [Version.Airdrops.V2_0]: { claimTo: true, payable: true, sponsor: false },\n [Version.Airdrops.V3_0]: { claimTo: true, payable: true, sponsor: true },\n },\n [Protocol.Bob]: {\n [Version.Bob.V1_0]: emptyReleaseFeatures,\n },\n [Protocol.Flow]: {\n [Version.Flow.V1_0]: { payable: false },\n [Version.Flow.V1_1]: { payable: true },\n [Version.Flow.V2_0]: { payable: true },\n [Version.Flow.V3_0]: { payable: true },\n },\n [Protocol.Legacy]: {\n [Version.Legacy.V1_0]: emptyReleaseFeatures,\n [Version.Legacy.V1_1]: emptyReleaseFeatures,\n },\n [Protocol.Lockup]: {\n [Version.Lockup.V1_0]: { batch: false, legacyAbi: true, payable: false, prbProxy: true },\n [Version.Lockup.V1_1]: { batch: false, legacyAbi: true, payable: false, prbProxy: false },\n [Version.Lockup.V1_2]: { batch: false, legacyAbi: false, payable: false, prbProxy: false },\n [Version.Lockup.V2_0]: { batch: true, legacyAbi: false, payable: true, prbProxy: false },\n [Version.Lockup.V3_0]: { batch: true, legacyAbi: false, payable: true, prbProxy: false },\n [Version.Lockup.V4_0]: { batch: true, legacyAbi: false, payable: true, prbProxy: false },\n },\n} as const satisfies EvmReleaseFeatureRegistry);\n\nexport type PayableEvmProtocol = ProtocolWithBooleanFeature<\"payable\">;\n\n/* -------------------------------------------------------------------------- */\n/* PRIVATE HELPERS */\n/* -------------------------------------------------------------------------- */\n\nconst evmReleaseFeatureRegistry: EvmReleaseFeatureRegistry = evmReleaseFeatures;\n\ntype PayableReleaseFeatureRegistry = {\n [TProtocol in PayableEvmProtocol]: Record<\n EvmReleaseVersionByProtocol[TProtocol],\n Pick<ProtocolFeatureSet<TProtocol>, \"payable\">\n >;\n};\n\nconst payableReleaseFeatureRegistry = deepFreeze({\n [Protocol.Airdrops]: evmReleaseFeatures[Protocol.Airdrops],\n [Protocol.Flow]: evmReleaseFeatures[Protocol.Flow],\n [Protocol.Lockup]: evmReleaseFeatures[Protocol.Lockup],\n} satisfies PayableReleaseFeatureRegistry);\n\n/**\n * Narrows protocol checks for helpers that only apply to fee-charging releases.\n */\nfunction isPayableEvmProtocol(protocol: Sablier.EVM.Protocol): protocol is PayableEvmProtocol {\n return protocol in payableReleaseFeatureRegistry;\n}\n\n/**\n * Narrows a release descriptor to protocols whose feature bag includes a payable flag.\n */\nfunction isPayableEvmRelease(release: EvmReleaseReference): release is PayableEvmReleaseReference {\n return isPayableEvmProtocol(release.protocol);\n}\n\n/**\n * Normalizes the supported payable helper overloads to the canonical release shape.\n */\nfunction normalizePayableReleaseInput(\n releaseOrProtocol: EvmReleaseReference | Sablier.EVM.Protocol,\n version?: Sablier.EVM.Version\n): EvmReleaseReference {\n if (typeof releaseOrProtocol !== \"string\") {\n return releaseOrProtocol;\n }\n\n if (!version) {\n throw new Error('Sablier SDK: Missing \"version\" for isEvmReleasePayable(protocol, version)');\n }\n\n return { protocol: releaseOrProtocol, version };\n}\n\n/* -------------------------------------------------------------------------- */\n/* FEATURES */\n/* -------------------------------------------------------------------------- */\n\n/**\n * Returns the protocol-specific feature bag for a single EVM release.\n */\nexport function getEvmReleaseFeatures<TProtocol extends keyof EvmReleaseFeatureSetByProtocol>(\n protocol: TProtocol,\n version: EvmReleaseVersionByProtocol[TProtocol]\n): ReleaseFeaturesForProtocol<TProtocol> {\n return evmReleaseFeatureRegistry[protocol][version] as ReleaseFeaturesForProtocol<TProtocol>;\n}\n\n/**\n * Reads the airdrops capability matrix for one released version.\n */\nexport function getAirdropsReleaseFeatures(\n version: Sablier.EVM.Version.Airdrops\n): Sablier.EVM.AirdropsReleaseFeatures {\n return getEvmReleaseFeatures(Protocol.Airdrops, version);\n}\n\n/**\n * Reads the flow capability matrix for one released version.\n */\nexport function getFlowReleaseFeatures(\n version: Sablier.EVM.Version.Flow\n): Sablier.EVM.FlowReleaseFeatures {\n return getEvmReleaseFeatures(Protocol.Flow, version);\n}\n\n/**\n * Reads the lockup capability matrix for one released version.\n */\nexport function getLockupReleaseFeatures(\n version: Sablier.EVM.Version.Lockup\n): Sablier.EVM.LockupReleaseFeatures {\n return getEvmReleaseFeatures(Protocol.Lockup, version);\n}\n\n/**\n * Returns whether a release charges native-token fees on claim or withdraw operations.\n */\nexport function isEvmReleasePayable(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 isEvmReleasePayable(\n protocol: Sablier.EVM.Protocol,\n version: Sablier.EVM.Version\n): boolean;\nexport function isEvmReleasePayable(\n releaseOrProtocol: EvmReleaseReference | Sablier.EVM.Protocol,\n version?: Sablier.EVM.Version\n): boolean {\n const release = normalizePayableReleaseInput(releaseOrProtocol, version);\n\n if (!isPayableEvmRelease(release)) {\n return false;\n }\n\n const protocolRegistry = payableReleaseFeatureRegistry[release.protocol] as\n | Record<Sablier.EVM.Version, { payable: boolean }>\n | undefined;\n\n if (!protocolRegistry) {\n return false;\n }\n\n const releaseFeatures = protocolRegistry[release.version];\n\n if (!releaseFeatures) {\n return false;\n }\n\n return releaseFeatures.payable;\n}\n\n/**\n * Returns whether the airdrops release supports the `claimTo` function for claiming to a third-party address.\n */\nexport function hasClaimTo(version: Sablier.EVM.Version.Airdrops): boolean {\n return getAirdropsReleaseFeatures(version).claimTo;\n}\n\n/**\n * Returns whether the airdrops release supports sponsor-driven claims.\n */\nexport function hasSponsor(version: Sablier.EVM.Version.Airdrops): boolean {\n return getAirdropsReleaseFeatures(version).sponsor;\n}\n\n/**\n * Returns whether the lockup release exposes batch create or withdraw flows.\n */\nexport function supportsLockupBatch(version: Sablier.EVM.Version.Lockup): boolean {\n return getLockupReleaseFeatures(version).batch;\n}\n\n/**\n * Returns whether the lockup release integrates with PRBProxy.\n */\nexport function supportsLockupPrbProxy(version: Sablier.EVM.Version.Lockup): boolean {\n return getLockupReleaseFeatures(version).prbProxy;\n}\n\n/**\n * Returns whether the lockup release uses the split ABI layout.\n */\nexport function usesLockupSplit(version: Sablier.EVM.Version.Lockup): boolean {\n return getLockupReleaseFeatures(version).legacyAbi;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"features.js","sourceRoot":"","sources":["../../../../src/evm/releases/features.ts"],"names":[],"mappings":";;;AA4MA,sDAKC;AAKD,gEAIC;AAKD,wDAIC;AAKD,4DAIC;AAaD,kDAyBC;AAKD,gCAEC;AAKD,gCAEC;AAKD,kDAEC;AAKD,wDAEC;AAKD,0CAEC;AAKD,kDAEC;AArTD,iDAAuD;AAqDvD,SAAS,UAAU,CAAI,KAAQ;IAC7B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1E,OAAO,KAAK,CAAC;IACf,CAAC;IAED,KAAK,MAAM,WAAW,IAAI,MAAM,CAAC,MAAM,CAAC,KAAgC,CAAC,EAAE,CAAC;QAC1E,UAAU,CAAC,WAAW,CAAC,CAAC;IAC1B,CAAC;IAED,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC;AAED,MAAM,oBAAoB,GAAG,UAAU,CAAC,EAAsD,CAAC,CAAC;AAKnF,QAAA,kBAAkB,GAAG,UAAU,CAAC;IAC3C,CAAC,mBAAQ,CAAC,QAAQ,CAAC,EAAE;QACnB,CAAC,kBAAO,CA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E,OAAO,wBAAwB,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC;AACjD,CAAC","sourcesContent":["/**\n * @file Canonical capability registry for every shipped EVM release.\n *\n * Release builders attach these feature bags to exported release objects, and\n * helper functions read from the same registry so version-dependent behavior\n * stays defined in one place.\n */\nimport { Protocol, Version } from \"@/src/evm/enums.js\";\nimport type { Sablier } from \"@/src/types.js\";\n\n/* -------------------------------------------------------------------------- */\n/* TYPES */\n/* -------------------------------------------------------------------------- */\n\nexport type EvmReleaseVersionByProtocol = {\n airdrops: Sablier.EVM.Version.Airdrops;\n bob: Sablier.EVM.Version.Bob;\n flow: Sablier.EVM.Version.Flow;\n legacy: Sablier.EVM.Version.Legacy;\n lockup: Sablier.EVM.Version.Lockup;\n};\n\nexport type EvmReleaseFeatureSetByProtocol = {\n airdrops: Sablier.EVM.AirdropsReleaseFeatures;\n bob: Sablier.EVM.EmptyReleaseFeatures;\n flow: Sablier.EVM.FlowReleaseFeatures;\n legacy: Sablier.EVM.EmptyReleaseFeatures;\n lockup: Sablier.EVM.LockupReleaseFeatures;\n};\n\ntype EvmReleaseFeatureRegistry = {\n [TProtocol in keyof EvmReleaseVersionByProtocol]: Record<\n EvmReleaseVersionByProtocol[TProtocol],\n EvmReleaseFeatureSetByProtocol[TProtocol]\n >;\n};\n\nexport type ReleaseFeaturesForProtocol<TProtocol extends keyof EvmReleaseFeatureSetByProtocol> =\n EvmReleaseFeatureSetByProtocol[TProtocol];\n\ntype ProtocolFeatureSet<TProtocol extends keyof EvmReleaseFeatureSetByProtocol> =\n EvmReleaseFeatureSetByProtocol[TProtocol];\n\ntype ProtocolWithBooleanFeature<TFeature extends PropertyKey> = {\n [TProtocol in keyof EvmReleaseFeatureSetByProtocol]: ProtocolFeatureSet<TProtocol> extends Record<\n TFeature,\n boolean\n >\n ? TProtocol\n : never;\n}[keyof EvmReleaseFeatureSetByProtocol];\n\ntype EvmReleaseReference = Pick<Sablier.EVM.Release, \"protocol\" | \"version\">;\ntype PayableEvmReleaseReference = {\n [TProtocol in PayableEvmProtocol]: {\n protocol: TProtocol;\n version: EvmReleaseVersionByProtocol[TProtocol];\n };\n}[PayableEvmProtocol];\n\nfunction deepFreeze<T>(value: T): T {\n if (typeof value !== \"object\" || value === null || Object.isFrozen(value)) {\n return value;\n }\n\n for (const nestedValue of Object.values(value as Record<string, unknown>)) {\n deepFreeze(nestedValue);\n }\n\n return Object.freeze(value);\n}\n\nconst emptyReleaseFeatures = deepFreeze({} as const satisfies Sablier.EVM.EmptyReleaseFeatures);\n\n/**\n * Protocol/version feature matrix used by both release resolvers and public helpers.\n */\nexport const evmReleaseFeatures = deepFreeze({\n [Protocol.Airdrops]: {\n [Version.Airdrops.V1_1]: { claimTo: false, payable: false, sponsor: false },\n [Version.Airdrops.V1_2]: { claimTo: false, payable: false, sponsor: false },\n [Version.Airdrops.V1_3]: { claimTo: false, payable: true, sponsor: false },\n [Version.Airdrops.V2_0]: { claimTo: true, payable: true, sponsor: false },\n [Version.Airdrops.V3_0]: { claimTo: true, payable: true, sponsor: true },\n },\n [Protocol.Bob]: {\n [Version.Bob.V1_0]: emptyReleaseFeatures,\n },\n [Protocol.Flow]: {\n [Version.Flow.V1_0]: { payable: false },\n [Version.Flow.V1_1]: { payable: true },\n [Version.Flow.V2_0]: { payable: true },\n [Version.Flow.V3_0]: { payable: true },\n },\n [Protocol.Legacy]: {\n [Version.Legacy.V1_0]: emptyReleaseFeatures,\n [Version.Legacy.V1_1]: emptyReleaseFeatures,\n },\n [Protocol.Lockup]: {\n [Version.Lockup.V1_0]: {\n batch: false,\n legacyAbi: true,\n payable: false,\n prbProxy: true,\n shape: false,\n },\n [Version.Lockup.V1_1]: {\n batch: false,\n legacyAbi: true,\n payable: false,\n prbProxy: false,\n shape: false,\n },\n [Version.Lockup.V1_2]: {\n batch: false,\n legacyAbi: false,\n payable: false,\n prbProxy: false,\n shape: false,\n },\n [Version.Lockup.V2_0]: {\n batch: true,\n legacyAbi: false,\n payable: true,\n prbProxy: false,\n shape: true,\n },\n [Version.Lockup.V3_0]: {\n batch: true,\n legacyAbi: false,\n payable: true,\n prbProxy: false,\n shape: true,\n },\n [Version.Lockup.V4_0]: {\n batch: true,\n legacyAbi: false,\n payable: true,\n prbProxy: false,\n shape: true,\n },\n },\n} as const satisfies EvmReleaseFeatureRegistry);\n\nexport type PayableEvmProtocol = ProtocolWithBooleanFeature<\"payable\">;\n\n/* -------------------------------------------------------------------------- */\n/* PRIVATE HELPERS */\n/* -------------------------------------------------------------------------- */\n\nconst evmReleaseFeatureRegistry: EvmReleaseFeatureRegistry = evmReleaseFeatures;\n\ntype PayableReleaseFeatureRegistry = {\n [TProtocol in PayableEvmProtocol]: Record<\n EvmReleaseVersionByProtocol[TProtocol],\n Pick<ProtocolFeatureSet<TProtocol>, \"payable\">\n >;\n};\n\nconst payableReleaseFeatureRegistry = deepFreeze({\n [Protocol.Airdrops]: evmReleaseFeatures[Protocol.Airdrops],\n [Protocol.Flow]: evmReleaseFeatures[Protocol.Flow],\n [Protocol.Lockup]: evmReleaseFeatures[Protocol.Lockup],\n} satisfies PayableReleaseFeatureRegistry);\n\n/**\n * Narrows protocol checks for helpers that only apply to fee-charging releases.\n */\nfunction isPayableEvmProtocol(protocol: Sablier.EVM.Protocol): protocol is PayableEvmProtocol {\n return protocol in payableReleaseFeatureRegistry;\n}\n\n/**\n * Narrows a release descriptor to protocols whose feature bag includes a payable flag.\n */\nfunction isPayableEvmRelease(release: EvmReleaseReference): release is PayableEvmReleaseReference {\n return isPayableEvmProtocol(release.protocol);\n}\n\n/**\n * Normalizes the supported payable helper overloads to the canonical release shape.\n */\nfunction normalizePayableReleaseInput(\n releaseOrProtocol: EvmReleaseReference | Sablier.EVM.Protocol,\n version?: Sablier.EVM.Version\n): EvmReleaseReference {\n if (typeof releaseOrProtocol !== \"string\") {\n return releaseOrProtocol;\n }\n\n if (!version) {\n throw new Error('Sablier SDK: Missing \"version\" for isEvmReleasePayable(protocol, version)');\n }\n\n return { protocol: releaseOrProtocol, version };\n}\n\n/* -------------------------------------------------------------------------- */\n/* FEATURES */\n/* -------------------------------------------------------------------------- */\n\n/**\n * Returns the protocol-specific feature bag for a single EVM release.\n */\nexport function getEvmReleaseFeatures<TProtocol extends keyof EvmReleaseFeatureSetByProtocol>(\n protocol: TProtocol,\n version: EvmReleaseVersionByProtocol[TProtocol]\n): ReleaseFeaturesForProtocol<TProtocol> {\n return evmReleaseFeatureRegistry[protocol][version] as ReleaseFeaturesForProtocol<TProtocol>;\n}\n\n/**\n * Reads the airdrops capability matrix for one released version.\n */\nexport function getAirdropsReleaseFeatures(\n version: Sablier.EVM.Version.Airdrops\n): Sablier.EVM.AirdropsReleaseFeatures {\n return getEvmReleaseFeatures(Protocol.Airdrops, version);\n}\n\n/**\n * Reads the flow capability matrix for one released version.\n */\nexport function getFlowReleaseFeatures(\n version: Sablier.EVM.Version.Flow\n): Sablier.EVM.FlowReleaseFeatures {\n return getEvmReleaseFeatures(Protocol.Flow, version);\n}\n\n/**\n * Reads the lockup capability matrix for one released version.\n */\nexport function getLockupReleaseFeatures(\n version: Sablier.EVM.Version.Lockup\n): Sablier.EVM.LockupReleaseFeatures {\n return getEvmReleaseFeatures(Protocol.Lockup, version);\n}\n\n/**\n * Returns whether a release charges native-token fees on claim or withdraw operations.\n */\nexport function isEvmReleasePayable(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 isEvmReleasePayable(\n protocol: Sablier.EVM.Protocol,\n version: Sablier.EVM.Version\n): boolean;\nexport function isEvmReleasePayable(\n releaseOrProtocol: EvmReleaseReference | Sablier.EVM.Protocol,\n version?: Sablier.EVM.Version\n): boolean {\n const release = normalizePayableReleaseInput(releaseOrProtocol, version);\n\n if (!isPayableEvmRelease(release)) {\n return false;\n }\n\n const protocolRegistry = payableReleaseFeatureRegistry[release.protocol] as\n | Record<Sablier.EVM.Version, { payable: boolean }>\n | undefined;\n\n if (!protocolRegistry) {\n return false;\n }\n\n const releaseFeatures = protocolRegistry[release.version];\n\n if (!releaseFeatures) {\n return false;\n }\n\n return releaseFeatures.payable;\n}\n\n/**\n * Returns whether the airdrops release supports the `claimTo` function for claiming to a third-party address.\n */\nexport function hasClaimTo(version: Sablier.EVM.Version.Airdrops): boolean {\n return getAirdropsReleaseFeatures(version).claimTo;\n}\n\n/**\n * Returns whether the airdrops release supports sponsor-driven claims.\n */\nexport function hasSponsor(version: Sablier.EVM.Version.Airdrops): boolean {\n return getAirdropsReleaseFeatures(version).sponsor;\n}\n\n/**\n * Returns whether the lockup release exposes batch create or withdraw flows.\n */\nexport function supportsLockupBatch(version: Sablier.EVM.Version.Lockup): boolean {\n return getLockupReleaseFeatures(version).batch;\n}\n\n/**\n * Returns whether the lockup release integrates with PRBProxy.\n */\nexport function supportsLockupPrbProxy(version: Sablier.EVM.Version.Lockup): boolean {\n return getLockupReleaseFeatures(version).prbProxy;\n}\n\n/**\n * Returns whether the lockup release uses the split ABI layout.\n */\nexport function usesLockupSplit(version: Sablier.EVM.Version.Lockup): boolean {\n return getLockupReleaseFeatures(version).legacyAbi;\n}\n\n/**\n * Returns whether the lockup release stores shape as an on-chain parameter.\n */\nexport function supportsLockupShape(version: Sablier.EVM.Version.Lockup): boolean {\n return getLockupReleaseFeatures(version).shape;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/evm/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { AliasMap, Repository, Shared } from \"@/src/shared/types.js\";\nimport type * as enums from \"./enums.js\";\n\nexport namespace EVM {\n /** Ethereum address in the format 0x followed by 40 hex characters. */\n export type Address = `0x${string}`;\n\n export type AbiMap = { [contractName: string]: readonly object[] };\n export type Chain = Shared.Chain & {\n /** Whether this is a zkEVM like zkSync. */\n isZK: boolean;\n rpc: Shared.Chain[\"rpc\"] & {\n /** Alchemy RPC URL generator. */\n alchemy?: (apiKey: string) => string;\n /** Infura RPC URL generator. */\n infura?: (apiKey: string) => string;\n /** RouteMesh RPC URL generator. */\n routemesh?: (apiKey: string) => string;\n };\n };\n\n /**\n * The base contract type for EVM chains.\n */\n export type Contract = Shared.Contract<Address, Protocol, Version>;\n\n /**\n * Reverse mapping of contracts so that we can look up contracts by address.\n */\n export type ContractCatalog = {\n [protocol in Protocol]: {\n [chainId: number]: {\n [address: Address]: Contract;\n };\n };\n };\n\n /**\n * Reverse mapping of contracts by alias for O(1) lookup.\n */\n export type AliasCatalog = {\n [protocol in Protocol]: {\n [chainId: number]: {\n [alias: string]: Contract;\n };\n };\n };\n\n /** @internal */\n export type ContractMap = Shared.ContractMap<Address>;\n\n export type Protocol = `${enums.Protocol}` | enums.Protocol;\n\n export type CompilerSettings = {\n /** The EVM version such as shanghai, paris, etc. */\n evmVersion: string;\n /** Whether the optimizer is enabled. */\n optimizer: boolean;\n /** The number of optimizer runs. */\n optimizerRuns: number;\n /** Optional salt used for CREATE2 deployment. None implies deployment using CREATE. */\n salt?: string;\n /** The solc version used. */\n solcVersion: `v${number}.${number}.${number}`;\n /** Whether the IR is used. */\n viaIR: boolean;\n /** Optional zk version used, only valid for zkEVM chains. */\n zkVersion?: `v${number}.${number}.${number}`;\n };\n\n /* -------------------------------------------------------------------------- */\n /* DEPLOYMENT */\n /* -------------------------------------------------------------------------- */\n\n export namespace Deployment {\n export type Standard = {\n chainId: number;\n contracts: Contract[];\n /** TODO: Compiler settings for the contract. Not implemented yet. */\n compilerSettings?: CompilerSettings;\n };\n\n export type LockupV1 = Standard & {\n core: Contract[];\n periphery: Contract[];\n };\n }\n\n export type Deployment = Deployment.Standard | Deployment.LockupV1;\n\n /* -------------------------------------------------------------------------- */\n /* MANIFEST */\n /* -------------------------------------------------------------------------- */\n\n /**\n * Contract names for a given protocol and version.\n * Note that this may contain both deployed contracts and abstract contracts that are not deployed.\n */\n export namespace Manifest {\n export type LockupV1 = {\n core: Standard;\n periphery: Standard;\n };\n\n export type Standard = Shared.Manifest;\n }\n\n export type Manifest = Manifest.LockupV1 | Manifest.Standard;\n\n /* -------------------------------------------------------------------------- */\n /* RELEASE */\n /* -------------------------------------------------------------------------- */\n\n export type AirdropsReleaseFeatures = {\n payable: boolean;\n claimTo: boolean;\n sponsor: boolean;\n };\n\n export type FlowReleaseFeatures = {\n payable: boolean;\n };\n\n export type LockupReleaseFeatures = {\n payable: boolean;\n prbProxy: boolean;\n batch: boolean;\n legacyAbi: boolean;\n };\n\n export type EmptyReleaseFeatures = Record<never, never>;\n\n export type EvmReleaseFeatures =\n | AirdropsReleaseFeatures\n | FlowReleaseFeatures\n | LockupReleaseFeatures\n | EmptyReleaseFeatures;\n\n /**\n * A collection of deployments for a given protocol and version.\n */\n export namespace Release {\n type Common<\n TAbiMap extends AbiMap = AbiMap,\n TFeatures extends EvmReleaseFeatures = EvmReleaseFeatures,\n > = {\n abi: TAbiMap;\n /** A map of contract names to their aliases, used in the Sablier Interface and the Graph. */\n aliases?: AliasMap;\n /** An array of contract names. */\n contractNames: string[];\n /** Release capabilities keyed to the owning protocol. */\n features: TFeatures;\n /** Whether this is the latest release for this protocol. */\n isLatest: boolean;\n /** The kind of release. */\n kind: \"standard\" | \"lockupV1\";\n /** The Sablier protocol released, e.g. `airdrops`. */\n protocol: Protocol;\n /** Repository information for the release. */\n repository?: Repository;\n /** The version of the release, e.g., `v1.3`. */\n version: Version;\n };\n\n /**\n * Lockup v1.x release used to separate Lockup contracts into core and periphery sub-categories.\n * @see https://github.com/sablier-labs/v2-periphery\n */\n export type LockupV1<\n TAbiMap extends AbiMap = AbiMap,\n TFeatures extends EvmReleaseFeatures = EvmReleaseFeatures,\n > = Common<TAbiMap, TFeatures> & {\n deployments: Deployment.LockupV1[];\n kind: \"lockupV1\";\n manifest: Manifest.LockupV1;\n };\n\n export type Standard<\n TAbiMap extends AbiMap = AbiMap,\n TFeatures extends EvmReleaseFeatures = EvmReleaseFeatures,\n > = Common<TAbiMap, TFeatures> & {\n deployments: Deployment.Standard[];\n kind: \"standard\";\n manifest: Manifest.Standard;\n };\n }\n\n export type Release = Release.Standard | Release.LockupV1;\n\n /* -------------------------------------------------------------------------- */\n /* VERSION */\n /* -------------------------------------------------------------------------- */\n\n export namespace Version {\n export type Airdrops = `${enums.Version.Airdrops}` | enums.Version.Airdrops;\n\n export type Bob = `${enums.Version.Bob}` | enums.Version.Bob;\n\n export type Flow = `${enums.Version.Flow}` | enums.Version.Flow;\n\n export type Legacy = `${enums.Version.Legacy}` | enums.Version.Legacy;\n\n export type Lockup = `${enums.Version.Lockup}` | enums.Version.Lockup;\n }\n export type Version =\n | Version.Airdrops\n | Version.Bob\n | Version.Flow\n | Version.Legacy\n | Version.Lockup;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/evm/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { AliasMap, Repository, Shared } from \"@/src/shared/types.js\";\nimport type * as enums from \"./enums.js\";\n\nexport namespace EVM {\n /** Ethereum address in the format 0x followed by 40 hex characters. */\n export type Address = `0x${string}`;\n\n export type AbiMap = { [contractName: string]: readonly object[] };\n export type Chain = Shared.Chain & {\n /** Whether this is a zkEVM like zkSync. */\n isZK: boolean;\n rpc: Shared.Chain[\"rpc\"] & {\n /** Alchemy RPC URL generator. */\n alchemy?: (apiKey: string) => string;\n /** Infura RPC URL generator. */\n infura?: (apiKey: string) => string;\n /** RouteMesh RPC URL generator. */\n routemesh?: (apiKey: string) => string;\n };\n };\n\n /**\n * The base contract type for EVM chains.\n */\n export type Contract = Shared.Contract<Address, Protocol, Version>;\n\n /**\n * Reverse mapping of contracts so that we can look up contracts by address.\n */\n export type ContractCatalog = {\n [protocol in Protocol]: {\n [chainId: number]: {\n [address: Address]: Contract;\n };\n };\n };\n\n /**\n * Reverse mapping of contracts by alias for O(1) lookup.\n */\n export type AliasCatalog = {\n [protocol in Protocol]: {\n [chainId: number]: {\n [alias: string]: Contract;\n };\n };\n };\n\n /** @internal */\n export type ContractMap = Shared.ContractMap<Address>;\n\n export type Protocol = `${enums.Protocol}` | enums.Protocol;\n\n export type CompilerSettings = {\n /** The EVM version such as shanghai, paris, etc. */\n evmVersion: string;\n /** Whether the optimizer is enabled. */\n optimizer: boolean;\n /** The number of optimizer runs. */\n optimizerRuns: number;\n /** Optional salt used for CREATE2 deployment. None implies deployment using CREATE. */\n salt?: string;\n /** The solc version used. */\n solcVersion: `v${number}.${number}.${number}`;\n /** Whether the IR is used. */\n viaIR: boolean;\n /** Optional zk version used, only valid for zkEVM chains. */\n zkVersion?: `v${number}.${number}.${number}`;\n };\n\n /* -------------------------------------------------------------------------- */\n /* DEPLOYMENT */\n /* -------------------------------------------------------------------------- */\n\n export namespace Deployment {\n export type Standard = {\n chainId: number;\n contracts: Contract[];\n /** TODO: Compiler settings for the contract. Not implemented yet. */\n compilerSettings?: CompilerSettings;\n };\n\n export type LockupV1 = Standard & {\n core: Contract[];\n periphery: Contract[];\n };\n }\n\n export type Deployment = Deployment.Standard | Deployment.LockupV1;\n\n /* -------------------------------------------------------------------------- */\n /* MANIFEST */\n /* -------------------------------------------------------------------------- */\n\n /**\n * Contract names for a given protocol and version.\n * Note that this may contain both deployed contracts and abstract contracts that are not deployed.\n */\n export namespace Manifest {\n export type LockupV1 = {\n core: Standard;\n periphery: Standard;\n };\n\n export type Standard = Shared.Manifest;\n }\n\n export type Manifest = Manifest.LockupV1 | Manifest.Standard;\n\n /* -------------------------------------------------------------------------- */\n /* RELEASE */\n /* -------------------------------------------------------------------------- */\n\n export type AirdropsReleaseFeatures = {\n payable: boolean;\n claimTo: boolean;\n sponsor: boolean;\n };\n\n export type FlowReleaseFeatures = {\n payable: boolean;\n };\n\n export type LockupReleaseFeatures = {\n payable: boolean;\n prbProxy: boolean;\n batch: boolean;\n legacyAbi: boolean;\n shape: boolean;\n };\n\n export type EmptyReleaseFeatures = Record<never, never>;\n\n export type EvmReleaseFeatures =\n | AirdropsReleaseFeatures\n | FlowReleaseFeatures\n | LockupReleaseFeatures\n | EmptyReleaseFeatures;\n\n /**\n * A collection of deployments for a given protocol and version.\n */\n export namespace Release {\n type Common<\n TAbiMap extends AbiMap = AbiMap,\n TFeatures extends EvmReleaseFeatures = EvmReleaseFeatures,\n > = {\n abi: TAbiMap;\n /** A map of contract names to their aliases, used in the Sablier Interface and the Graph. */\n aliases?: AliasMap;\n /** An array of contract names. */\n contractNames: string[];\n /** Release capabilities keyed to the owning protocol. */\n features: TFeatures;\n /** Whether this is the latest release for this protocol. */\n isLatest: boolean;\n /** The kind of release. */\n kind: \"standard\" | \"lockupV1\";\n /** The Sablier protocol released, e.g. `airdrops`. */\n protocol: Protocol;\n /** Repository information for the release. */\n repository?: Repository;\n /** The version of the release, e.g., `v1.3`. */\n version: Version;\n };\n\n /**\n * Lockup v1.x release used to separate Lockup contracts into core and periphery sub-categories.\n * @see https://github.com/sablier-labs/v2-periphery\n */\n export type LockupV1<\n TAbiMap extends AbiMap = AbiMap,\n TFeatures extends EvmReleaseFeatures = EvmReleaseFeatures,\n > = Common<TAbiMap, TFeatures> & {\n deployments: Deployment.LockupV1[];\n kind: \"lockupV1\";\n manifest: Manifest.LockupV1;\n };\n\n export type Standard<\n TAbiMap extends AbiMap = AbiMap,\n TFeatures extends EvmReleaseFeatures = EvmReleaseFeatures,\n > = Common<TAbiMap, TFeatures> & {\n deployments: Deployment.Standard[];\n kind: \"standard\";\n manifest: Manifest.Standard;\n };\n }\n\n export type Release = Release.Standard | Release.LockupV1;\n\n /* -------------------------------------------------------------------------- */\n /* VERSION */\n /* -------------------------------------------------------------------------- */\n\n export namespace Version {\n export type Airdrops = `${enums.Version.Airdrops}` | enums.Version.Airdrops;\n\n export type Bob = `${enums.Version.Bob}` | enums.Version.Bob;\n\n export type Flow = `${enums.Version.Flow}` | enums.Version.Flow;\n\n export type Legacy = `${enums.Version.Legacy}` | enums.Version.Legacy;\n\n export type Lockup = `${enums.Version.Lockup}` | enums.Version.Lockup;\n }\n export type Version =\n | Version.Airdrops\n | Version.Bob\n | Version.Flow\n | Version.Legacy\n | Version.Lockup;\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, hasSponsor, isEvmReleasePayable, supportsLockupBatch, supportsLockupPrbProxy, usesLockupSplit, } from "./releases/features.js";
|
|
4
|
+
export { getAirdropsReleaseFeatures, getFlowReleaseFeatures, getLockupReleaseFeatures, hasClaimTo, 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;AAGtC,OAAO,EACL,0BAA0B,EAC1B,sBAAsB,EACtB,wBAAwB,EACxB,UAAU,EACV,UAAU,EACV,mBAAmB,EACnB,mBAAmB,EACnB,sBAAsB,EACtB,eAAe,GAChB,MAAM,wBAAwB,CAAC;AAQhC,MAAM,UAAU,sBAAsB,CAAC,WAAmB,EAAE,eAAoC;IAC9F,OAAO,8BAA8B,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;AACtE,CAAC;AAkBD,MAAM,UAAU,kBAAkB,CAAC,IAKlC;IACC,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AC5F,CAAC;IAED,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CACb,8CAA8C,KAAK,cAAc,OAAO,oBAAoB,CAC7F,CAAC;IACJ,CAAC;IAED,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC;AAaD,MAAM,UAAU,kBAAkB,CAChC,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 { PayableEvmProtocol } from \"./releases/features.js\";\nexport {\n getAirdropsReleaseFeatures,\n getFlowReleaseFeatures,\n getLockupReleaseFeatures,\n hasClaimTo,\n hasSponsor,\n isEvmReleasePayable,\n supportsLockupBatch,\n supportsLockupPrbProxy,\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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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 { PayableEvmProtocol } from \"./releases/features.js\";\nexport {\n getAirdropsReleaseFeatures,\n getFlowReleaseFeatures,\n getLockupReleaseFeatures,\n hasClaimTo,\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"]}
|
|
@@ -31,12 +31,48 @@ export const evmReleaseFeatures = deepFreeze({
|
|
|
31
31
|
[Version.Legacy.V1_1]: emptyReleaseFeatures,
|
|
32
32
|
},
|
|
33
33
|
[Protocol.Lockup]: {
|
|
34
|
-
[Version.Lockup.V1_0]: {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
[Version.Lockup.V1_0]: {
|
|
35
|
+
batch: false,
|
|
36
|
+
legacyAbi: true,
|
|
37
|
+
payable: false,
|
|
38
|
+
prbProxy: true,
|
|
39
|
+
shape: false,
|
|
40
|
+
},
|
|
41
|
+
[Version.Lockup.V1_1]: {
|
|
42
|
+
batch: false,
|
|
43
|
+
legacyAbi: true,
|
|
44
|
+
payable: false,
|
|
45
|
+
prbProxy: false,
|
|
46
|
+
shape: false,
|
|
47
|
+
},
|
|
48
|
+
[Version.Lockup.V1_2]: {
|
|
49
|
+
batch: false,
|
|
50
|
+
legacyAbi: false,
|
|
51
|
+
payable: false,
|
|
52
|
+
prbProxy: false,
|
|
53
|
+
shape: false,
|
|
54
|
+
},
|
|
55
|
+
[Version.Lockup.V2_0]: {
|
|
56
|
+
batch: true,
|
|
57
|
+
legacyAbi: false,
|
|
58
|
+
payable: true,
|
|
59
|
+
prbProxy: false,
|
|
60
|
+
shape: true,
|
|
61
|
+
},
|
|
62
|
+
[Version.Lockup.V3_0]: {
|
|
63
|
+
batch: true,
|
|
64
|
+
legacyAbi: false,
|
|
65
|
+
payable: true,
|
|
66
|
+
prbProxy: false,
|
|
67
|
+
shape: true,
|
|
68
|
+
},
|
|
69
|
+
[Version.Lockup.V4_0]: {
|
|
70
|
+
batch: true,
|
|
71
|
+
legacyAbi: false,
|
|
72
|
+
payable: true,
|
|
73
|
+
prbProxy: false,
|
|
74
|
+
shape: true,
|
|
75
|
+
},
|
|
40
76
|
},
|
|
41
77
|
});
|
|
42
78
|
const evmReleaseFeatureRegistry = evmReleaseFeatures;
|
|
@@ -102,4 +138,7 @@ export function supportsLockupPrbProxy(version) {
|
|
|
102
138
|
export function usesLockupSplit(version) {
|
|
103
139
|
return getLockupReleaseFeatures(version).legacyAbi;
|
|
104
140
|
}
|
|
141
|
+
export function supportsLockupShape(version) {
|
|
142
|
+
return getLockupReleaseFeatures(version).shape;
|
|
143
|
+
}
|
|
105
144
|
//# sourceMappingURL=features.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features.js","sourceRoot":"","sources":["../../../../src/evm/releases/features.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAqDvD,SAAS,UAAU,CAAI,KAAQ;IAC7B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,MAAM,C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AU,mBAAmB,CAAC,OAAmC;IACrE,OAAO,wBAAwB,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC;AACjD,CAAC;AAKD,MAAM,UAAU,sBAAsB,CAAC,OAAmC;IACxE,OAAO,wBAAwB,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC;AACpD,CAAC;AAKD,MAAM,UAAU,eAAe,CAAC,OAAmC;IACjE,OAAO,wBAAwB,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC;AACrD,CAAC","sourcesContent":["/**\n * @file Canonical capability registry for every shipped EVM release.\n *\n * Release builders attach these feature bags to exported release objects, and\n * helper functions read from the same registry so version-dependent behavior\n * stays defined in one place.\n */\nimport { Protocol, Version } from \"@/src/evm/enums.js\";\nimport type { Sablier } from \"@/src/types.js\";\n\n/* -------------------------------------------------------------------------- */\n/* TYPES */\n/* -------------------------------------------------------------------------- */\n\nexport type EvmReleaseVersionByProtocol = {\n airdrops: Sablier.EVM.Version.Airdrops;\n bob: Sablier.EVM.Version.Bob;\n flow: Sablier.EVM.Version.Flow;\n legacy: Sablier.EVM.Version.Legacy;\n lockup: Sablier.EVM.Version.Lockup;\n};\n\nexport type EvmReleaseFeatureSetByProtocol = {\n airdrops: Sablier.EVM.AirdropsReleaseFeatures;\n bob: Sablier.EVM.EmptyReleaseFeatures;\n flow: Sablier.EVM.FlowReleaseFeatures;\n legacy: Sablier.EVM.EmptyReleaseFeatures;\n lockup: Sablier.EVM.LockupReleaseFeatures;\n};\n\ntype EvmReleaseFeatureRegistry = {\n [TProtocol in keyof EvmReleaseVersionByProtocol]: Record<\n EvmReleaseVersionByProtocol[TProtocol],\n EvmReleaseFeatureSetByProtocol[TProtocol]\n >;\n};\n\nexport type ReleaseFeaturesForProtocol<TProtocol extends keyof EvmReleaseFeatureSetByProtocol> =\n EvmReleaseFeatureSetByProtocol[TProtocol];\n\ntype ProtocolFeatureSet<TProtocol extends keyof EvmReleaseFeatureSetByProtocol> =\n EvmReleaseFeatureSetByProtocol[TProtocol];\n\ntype ProtocolWithBooleanFeature<TFeature extends PropertyKey> = {\n [TProtocol in keyof EvmReleaseFeatureSetByProtocol]: ProtocolFeatureSet<TProtocol> extends Record<\n TFeature,\n boolean\n >\n ? TProtocol\n : never;\n}[keyof EvmReleaseFeatureSetByProtocol];\n\ntype EvmReleaseReference = Pick<Sablier.EVM.Release, \"protocol\" | \"version\">;\ntype PayableEvmReleaseReference = {\n [TProtocol in PayableEvmProtocol]: {\n protocol: TProtocol;\n version: EvmReleaseVersionByProtocol[TProtocol];\n };\n}[PayableEvmProtocol];\n\nfunction deepFreeze<T>(value: T): T {\n if (typeof value !== \"object\" || value === null || Object.isFrozen(value)) {\n return value;\n }\n\n for (const nestedValue of Object.values(value as Record<string, unknown>)) {\n deepFreeze(nestedValue);\n }\n\n return Object.freeze(value);\n}\n\nconst emptyReleaseFeatures = deepFreeze({} as const satisfies Sablier.EVM.EmptyReleaseFeatures);\n\n/**\n * Protocol/version feature matrix used by both release resolvers and public helpers.\n */\nexport const evmReleaseFeatures = deepFreeze({\n [Protocol.Airdrops]: {\n [Version.Airdrops.V1_1]: { claimTo: false, payable: false, sponsor: false },\n [Version.Airdrops.V1_2]: { claimTo: false, payable: false, sponsor: false },\n [Version.Airdrops.V1_3]: { claimTo: false, payable: true, sponsor: false },\n [Version.Airdrops.V2_0]: { claimTo: true, payable: true, sponsor: false },\n [Version.Airdrops.V3_0]: { claimTo: true, payable: true, sponsor: true },\n },\n [Protocol.Bob]: {\n [Version.Bob.V1_0]: emptyReleaseFeatures,\n },\n [Protocol.Flow]: {\n [Version.Flow.V1_0]: { payable: false },\n [Version.Flow.V1_1]: { payable: true },\n [Version.Flow.V2_0]: { payable: true },\n [Version.Flow.V3_0]: { payable: true },\n },\n [Protocol.Legacy]: {\n [Version.Legacy.V1_0]: emptyReleaseFeatures,\n [Version.Legacy.V1_1]: emptyReleaseFeatures,\n },\n [Protocol.Lockup]: {\n [Version.Lockup.V1_0]: { batch: false, legacyAbi: true, payable: false, prbProxy: true },\n [Version.Lockup.V1_1]: { batch: false, legacyAbi: true, payable: false, prbProxy: false },\n [Version.Lockup.V1_2]: { batch: false, legacyAbi: false, payable: false, prbProxy: false },\n [Version.Lockup.V2_0]: { batch: true, legacyAbi: false, payable: true, prbProxy: false },\n [Version.Lockup.V3_0]: { batch: true, legacyAbi: false, payable: true, prbProxy: false },\n [Version.Lockup.V4_0]: { batch: true, legacyAbi: false, payable: true, prbProxy: false },\n },\n} as const satisfies EvmReleaseFeatureRegistry);\n\nexport type PayableEvmProtocol = ProtocolWithBooleanFeature<\"payable\">;\n\n/* -------------------------------------------------------------------------- */\n/* PRIVATE HELPERS */\n/* -------------------------------------------------------------------------- */\n\nconst evmReleaseFeatureRegistry: EvmReleaseFeatureRegistry = evmReleaseFeatures;\n\ntype PayableReleaseFeatureRegistry = {\n [TProtocol in PayableEvmProtocol]: Record<\n EvmReleaseVersionByProtocol[TProtocol],\n Pick<ProtocolFeatureSet<TProtocol>, \"payable\">\n >;\n};\n\nconst payableReleaseFeatureRegistry = deepFreeze({\n [Protocol.Airdrops]: evmReleaseFeatures[Protocol.Airdrops],\n [Protocol.Flow]: evmReleaseFeatures[Protocol.Flow],\n [Protocol.Lockup]: evmReleaseFeatures[Protocol.Lockup],\n} satisfies PayableReleaseFeatureRegistry);\n\n/**\n * Narrows protocol checks for helpers that only apply to fee-charging releases.\n */\nfunction isPayableEvmProtocol(protocol: Sablier.EVM.Protocol): protocol is PayableEvmProtocol {\n return protocol in payableReleaseFeatureRegistry;\n}\n\n/**\n * Narrows a release descriptor to protocols whose feature bag includes a payable flag.\n */\nfunction isPayableEvmRelease(release: EvmReleaseReference): release is PayableEvmReleaseReference {\n return isPayableEvmProtocol(release.protocol);\n}\n\n/**\n * Normalizes the supported payable helper overloads to the canonical release shape.\n */\nfunction normalizePayableReleaseInput(\n releaseOrProtocol: EvmReleaseReference | Sablier.EVM.Protocol,\n version?: Sablier.EVM.Version\n): EvmReleaseReference {\n if (typeof releaseOrProtocol !== \"string\") {\n return releaseOrProtocol;\n }\n\n if (!version) {\n throw new Error('Sablier SDK: Missing \"version\" for isEvmReleasePayable(protocol, version)');\n }\n\n return { protocol: releaseOrProtocol, version };\n}\n\n/* -------------------------------------------------------------------------- */\n/* FEATURES */\n/* -------------------------------------------------------------------------- */\n\n/**\n * Returns the protocol-specific feature bag for a single EVM release.\n */\nexport function getEvmReleaseFeatures<TProtocol extends keyof EvmReleaseFeatureSetByProtocol>(\n protocol: TProtocol,\n version: EvmReleaseVersionByProtocol[TProtocol]\n): ReleaseFeaturesForProtocol<TProtocol> {\n return evmReleaseFeatureRegistry[protocol][version] as ReleaseFeaturesForProtocol<TProtocol>;\n}\n\n/**\n * Reads the airdrops capability matrix for one released version.\n */\nexport function getAirdropsReleaseFeatures(\n version: Sablier.EVM.Version.Airdrops\n): Sablier.EVM.AirdropsReleaseFeatures {\n return getEvmReleaseFeatures(Protocol.Airdrops, version);\n}\n\n/**\n * Reads the flow capability matrix for one released version.\n */\nexport function getFlowReleaseFeatures(\n version: Sablier.EVM.Version.Flow\n): Sablier.EVM.FlowReleaseFeatures {\n return getEvmReleaseFeatures(Protocol.Flow, version);\n}\n\n/**\n * Reads the lockup capability matrix for one released version.\n */\nexport function getLockupReleaseFeatures(\n version: Sablier.EVM.Version.Lockup\n): Sablier.EVM.LockupReleaseFeatures {\n return getEvmReleaseFeatures(Protocol.Lockup, version);\n}\n\n/**\n * Returns whether a release charges native-token fees on claim or withdraw operations.\n */\nexport function isEvmReleasePayable(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 isEvmReleasePayable(\n protocol: Sablier.EVM.Protocol,\n version: Sablier.EVM.Version\n): boolean;\nexport function isEvmReleasePayable(\n releaseOrProtocol: EvmReleaseReference | Sablier.EVM.Protocol,\n version?: Sablier.EVM.Version\n): boolean {\n const release = normalizePayableReleaseInput(releaseOrProtocol, version);\n\n if (!isPayableEvmRelease(release)) {\n return false;\n }\n\n const protocolRegistry = payableReleaseFeatureRegistry[release.protocol] as\n | Record<Sablier.EVM.Version, { payable: boolean }>\n | undefined;\n\n if (!protocolRegistry) {\n return false;\n }\n\n const releaseFeatures = protocolRegistry[release.version];\n\n if (!releaseFeatures) {\n return false;\n }\n\n return releaseFeatures.payable;\n}\n\n/**\n * Returns whether the airdrops release supports the `claimTo` function for claiming to a third-party address.\n */\nexport function hasClaimTo(version: Sablier.EVM.Version.Airdrops): boolean {\n return getAirdropsReleaseFeatures(version).claimTo;\n}\n\n/**\n * Returns whether the airdrops release supports sponsor-driven claims.\n */\nexport function hasSponsor(version: Sablier.EVM.Version.Airdrops): boolean {\n return getAirdropsReleaseFeatures(version).sponsor;\n}\n\n/**\n * Returns whether the lockup release exposes batch create or withdraw flows.\n */\nexport function supportsLockupBatch(version: Sablier.EVM.Version.Lockup): boolean {\n return getLockupReleaseFeatures(version).batch;\n}\n\n/**\n * Returns whether the lockup release integrates with PRBProxy.\n */\nexport function supportsLockupPrbProxy(version: Sablier.EVM.Version.Lockup): boolean {\n return getLockupReleaseFeatures(version).prbProxy;\n}\n\n/**\n * Returns whether the lockup release uses the split ABI layout.\n */\nexport function usesLockupSplit(version: Sablier.EVM.Version.Lockup): boolean {\n return getLockupReleaseFeatures(version).legacyAbi;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"features.js","sourceRoot":"","sources":["../../../../src/evm/releases/features.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAqDvD,SAAS,UAAU,CAAI,KAAQ;IAC7B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1E,OAAO,KAAK,CAAC;IACf,CAAC;IAED,KAAK,MAAM,WAAW,IAAI,MAAM,CAAC,MAAM,CAAC,KAAgC,CAAC,EAAE,CAAC;QAC1E,UAAU,C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AAC,CAAC,KAAK,CAAC;AACjD,CAAC;AAKD,MAAM,UAAU,sBAAsB,CAAC,OAAmC;IACxE,OAAO,wBAAwB,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC;AACpD,CAAC;AAKD,MAAM,UAAU,eAAe,CAAC,OAAmC;IACjE,OAAO,wBAAwB,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC;AACrD,CAAC;AAKD,MAAM,UAAU,mBAAmB,CAAC,OAAmC;IACrE,OAAO,wBAAwB,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC;AACjD,CAAC","sourcesContent":["/**\n * @file Canonical capability registry for every shipped EVM release.\n *\n * Release builders attach these feature bags to exported release objects, and\n * helper functions read from the same registry so version-dependent behavior\n * stays defined in one place.\n */\nimport { Protocol, Version } from \"@/src/evm/enums.js\";\nimport type { Sablier } from \"@/src/types.js\";\n\n/* -------------------------------------------------------------------------- */\n/* TYPES */\n/* -------------------------------------------------------------------------- */\n\nexport type EvmReleaseVersionByProtocol = {\n airdrops: Sablier.EVM.Version.Airdrops;\n bob: Sablier.EVM.Version.Bob;\n flow: Sablier.EVM.Version.Flow;\n legacy: Sablier.EVM.Version.Legacy;\n lockup: Sablier.EVM.Version.Lockup;\n};\n\nexport type EvmReleaseFeatureSetByProtocol = {\n airdrops: Sablier.EVM.AirdropsReleaseFeatures;\n bob: Sablier.EVM.EmptyReleaseFeatures;\n flow: Sablier.EVM.FlowReleaseFeatures;\n legacy: Sablier.EVM.EmptyReleaseFeatures;\n lockup: Sablier.EVM.LockupReleaseFeatures;\n};\n\ntype EvmReleaseFeatureRegistry = {\n [TProtocol in keyof EvmReleaseVersionByProtocol]: Record<\n EvmReleaseVersionByProtocol[TProtocol],\n EvmReleaseFeatureSetByProtocol[TProtocol]\n >;\n};\n\nexport type ReleaseFeaturesForProtocol<TProtocol extends keyof EvmReleaseFeatureSetByProtocol> =\n EvmReleaseFeatureSetByProtocol[TProtocol];\n\ntype ProtocolFeatureSet<TProtocol extends keyof EvmReleaseFeatureSetByProtocol> =\n EvmReleaseFeatureSetByProtocol[TProtocol];\n\ntype ProtocolWithBooleanFeature<TFeature extends PropertyKey> = {\n [TProtocol in keyof EvmReleaseFeatureSetByProtocol]: ProtocolFeatureSet<TProtocol> extends Record<\n TFeature,\n boolean\n >\n ? TProtocol\n : never;\n}[keyof EvmReleaseFeatureSetByProtocol];\n\ntype EvmReleaseReference = Pick<Sablier.EVM.Release, \"protocol\" | \"version\">;\ntype PayableEvmReleaseReference = {\n [TProtocol in PayableEvmProtocol]: {\n protocol: TProtocol;\n version: EvmReleaseVersionByProtocol[TProtocol];\n };\n}[PayableEvmProtocol];\n\nfunction deepFreeze<T>(value: T): T {\n if (typeof value !== \"object\" || value === null || Object.isFrozen(value)) {\n return value;\n }\n\n for (const nestedValue of Object.values(value as Record<string, unknown>)) {\n deepFreeze(nestedValue);\n }\n\n return Object.freeze(value);\n}\n\nconst emptyReleaseFeatures = deepFreeze({} as const satisfies Sablier.EVM.EmptyReleaseFeatures);\n\n/**\n * Protocol/version feature matrix used by both release resolvers and public helpers.\n */\nexport const evmReleaseFeatures = deepFreeze({\n [Protocol.Airdrops]: {\n [Version.Airdrops.V1_1]: { claimTo: false, payable: false, sponsor: false },\n [Version.Airdrops.V1_2]: { claimTo: false, payable: false, sponsor: false },\n [Version.Airdrops.V1_3]: { claimTo: false, payable: true, sponsor: false },\n [Version.Airdrops.V2_0]: { claimTo: true, payable: true, sponsor: false },\n [Version.Airdrops.V3_0]: { claimTo: true, payable: true, sponsor: true },\n },\n [Protocol.Bob]: {\n [Version.Bob.V1_0]: emptyReleaseFeatures,\n },\n [Protocol.Flow]: {\n [Version.Flow.V1_0]: { payable: false },\n [Version.Flow.V1_1]: { payable: true },\n [Version.Flow.V2_0]: { payable: true },\n [Version.Flow.V3_0]: { payable: true },\n },\n [Protocol.Legacy]: {\n [Version.Legacy.V1_0]: emptyReleaseFeatures,\n [Version.Legacy.V1_1]: emptyReleaseFeatures,\n },\n [Protocol.Lockup]: {\n [Version.Lockup.V1_0]: {\n batch: false,\n legacyAbi: true,\n payable: false,\n prbProxy: true,\n shape: false,\n },\n [Version.Lockup.V1_1]: {\n batch: false,\n legacyAbi: true,\n payable: false,\n prbProxy: false,\n shape: false,\n },\n [Version.Lockup.V1_2]: {\n batch: false,\n legacyAbi: false,\n payable: false,\n prbProxy: false,\n shape: false,\n },\n [Version.Lockup.V2_0]: {\n batch: true,\n legacyAbi: false,\n payable: true,\n prbProxy: false,\n shape: true,\n },\n [Version.Lockup.V3_0]: {\n batch: true,\n legacyAbi: false,\n payable: true,\n prbProxy: false,\n shape: true,\n },\n [Version.Lockup.V4_0]: {\n batch: true,\n legacyAbi: false,\n payable: true,\n prbProxy: false,\n shape: true,\n },\n },\n} as const satisfies EvmReleaseFeatureRegistry);\n\nexport type PayableEvmProtocol = ProtocolWithBooleanFeature<\"payable\">;\n\n/* -------------------------------------------------------------------------- */\n/* PRIVATE HELPERS */\n/* -------------------------------------------------------------------------- */\n\nconst evmReleaseFeatureRegistry: EvmReleaseFeatureRegistry = evmReleaseFeatures;\n\ntype PayableReleaseFeatureRegistry = {\n [TProtocol in PayableEvmProtocol]: Record<\n EvmReleaseVersionByProtocol[TProtocol],\n Pick<ProtocolFeatureSet<TProtocol>, \"payable\">\n >;\n};\n\nconst payableReleaseFeatureRegistry = deepFreeze({\n [Protocol.Airdrops]: evmReleaseFeatures[Protocol.Airdrops],\n [Protocol.Flow]: evmReleaseFeatures[Protocol.Flow],\n [Protocol.Lockup]: evmReleaseFeatures[Protocol.Lockup],\n} satisfies PayableReleaseFeatureRegistry);\n\n/**\n * Narrows protocol checks for helpers that only apply to fee-charging releases.\n */\nfunction isPayableEvmProtocol(protocol: Sablier.EVM.Protocol): protocol is PayableEvmProtocol {\n return protocol in payableReleaseFeatureRegistry;\n}\n\n/**\n * Narrows a release descriptor to protocols whose feature bag includes a payable flag.\n */\nfunction isPayableEvmRelease(release: EvmReleaseReference): release is PayableEvmReleaseReference {\n return isPayableEvmProtocol(release.protocol);\n}\n\n/**\n * Normalizes the supported payable helper overloads to the canonical release shape.\n */\nfunction normalizePayableReleaseInput(\n releaseOrProtocol: EvmReleaseReference | Sablier.EVM.Protocol,\n version?: Sablier.EVM.Version\n): EvmReleaseReference {\n if (typeof releaseOrProtocol !== \"string\") {\n return releaseOrProtocol;\n }\n\n if (!version) {\n throw new Error('Sablier SDK: Missing \"version\" for isEvmReleasePayable(protocol, version)');\n }\n\n return { protocol: releaseOrProtocol, version };\n}\n\n/* -------------------------------------------------------------------------- */\n/* FEATURES */\n/* -------------------------------------------------------------------------- */\n\n/**\n * Returns the protocol-specific feature bag for a single EVM release.\n */\nexport function getEvmReleaseFeatures<TProtocol extends keyof EvmReleaseFeatureSetByProtocol>(\n protocol: TProtocol,\n version: EvmReleaseVersionByProtocol[TProtocol]\n): ReleaseFeaturesForProtocol<TProtocol> {\n return evmReleaseFeatureRegistry[protocol][version] as ReleaseFeaturesForProtocol<TProtocol>;\n}\n\n/**\n * Reads the airdrops capability matrix for one released version.\n */\nexport function getAirdropsReleaseFeatures(\n version: Sablier.EVM.Version.Airdrops\n): Sablier.EVM.AirdropsReleaseFeatures {\n return getEvmReleaseFeatures(Protocol.Airdrops, version);\n}\n\n/**\n * Reads the flow capability matrix for one released version.\n */\nexport function getFlowReleaseFeatures(\n version: Sablier.EVM.Version.Flow\n): Sablier.EVM.FlowReleaseFeatures {\n return getEvmReleaseFeatures(Protocol.Flow, version);\n}\n\n/**\n * Reads the lockup capability matrix for one released version.\n */\nexport function getLockupReleaseFeatures(\n version: Sablier.EVM.Version.Lockup\n): Sablier.EVM.LockupReleaseFeatures {\n return getEvmReleaseFeatures(Protocol.Lockup, version);\n}\n\n/**\n * Returns whether a release charges native-token fees on claim or withdraw operations.\n */\nexport function isEvmReleasePayable(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 isEvmReleasePayable(\n protocol: Sablier.EVM.Protocol,\n version: Sablier.EVM.Version\n): boolean;\nexport function isEvmReleasePayable(\n releaseOrProtocol: EvmReleaseReference | Sablier.EVM.Protocol,\n version?: Sablier.EVM.Version\n): boolean {\n const release = normalizePayableReleaseInput(releaseOrProtocol, version);\n\n if (!isPayableEvmRelease(release)) {\n return false;\n }\n\n const protocolRegistry = payableReleaseFeatureRegistry[release.protocol] as\n | Record<Sablier.EVM.Version, { payable: boolean }>\n | undefined;\n\n if (!protocolRegistry) {\n return false;\n }\n\n const releaseFeatures = protocolRegistry[release.version];\n\n if (!releaseFeatures) {\n return false;\n }\n\n return releaseFeatures.payable;\n}\n\n/**\n * Returns whether the airdrops release supports the `claimTo` function for claiming to a third-party address.\n */\nexport function hasClaimTo(version: Sablier.EVM.Version.Airdrops): boolean {\n return getAirdropsReleaseFeatures(version).claimTo;\n}\n\n/**\n * Returns whether the airdrops release supports sponsor-driven claims.\n */\nexport function hasSponsor(version: Sablier.EVM.Version.Airdrops): boolean {\n return getAirdropsReleaseFeatures(version).sponsor;\n}\n\n/**\n * Returns whether the lockup release exposes batch create or withdraw flows.\n */\nexport function supportsLockupBatch(version: Sablier.EVM.Version.Lockup): boolean {\n return getLockupReleaseFeatures(version).batch;\n}\n\n/**\n * Returns whether the lockup release integrates with PRBProxy.\n */\nexport function supportsLockupPrbProxy(version: Sablier.EVM.Version.Lockup): boolean {\n return getLockupReleaseFeatures(version).prbProxy;\n}\n\n/**\n * Returns whether the lockup release uses the split ABI layout.\n */\nexport function usesLockupSplit(version: Sablier.EVM.Version.Lockup): boolean {\n return getLockupReleaseFeatures(version).legacyAbi;\n}\n\n/**\n * Returns whether the lockup release stores shape as an on-chain parameter.\n */\nexport function supportsLockupShape(version: Sablier.EVM.Version.Lockup): boolean {\n return getLockupReleaseFeatures(version).shape;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/evm/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { AliasMap, Repository, Shared } from \"@/src/shared/types.js\";\nimport type * as enums from \"./enums.js\";\n\nexport namespace EVM {\n /** Ethereum address in the format 0x followed by 40 hex characters. */\n export type Address = `0x${string}`;\n\n export type AbiMap = { [contractName: string]: readonly object[] };\n export type Chain = Shared.Chain & {\n /** Whether this is a zkEVM like zkSync. */\n isZK: boolean;\n rpc: Shared.Chain[\"rpc\"] & {\n /** Alchemy RPC URL generator. */\n alchemy?: (apiKey: string) => string;\n /** Infura RPC URL generator. */\n infura?: (apiKey: string) => string;\n /** RouteMesh RPC URL generator. */\n routemesh?: (apiKey: string) => string;\n };\n };\n\n /**\n * The base contract type for EVM chains.\n */\n export type Contract = Shared.Contract<Address, Protocol, Version>;\n\n /**\n * Reverse mapping of contracts so that we can look up contracts by address.\n */\n export type ContractCatalog = {\n [protocol in Protocol]: {\n [chainId: number]: {\n [address: Address]: Contract;\n };\n };\n };\n\n /**\n * Reverse mapping of contracts by alias for O(1) lookup.\n */\n export type AliasCatalog = {\n [protocol in Protocol]: {\n [chainId: number]: {\n [alias: string]: Contract;\n };\n };\n };\n\n /** @internal */\n export type ContractMap = Shared.ContractMap<Address>;\n\n export type Protocol = `${enums.Protocol}` | enums.Protocol;\n\n export type CompilerSettings = {\n /** The EVM version such as shanghai, paris, etc. */\n evmVersion: string;\n /** Whether the optimizer is enabled. */\n optimizer: boolean;\n /** The number of optimizer runs. */\n optimizerRuns: number;\n /** Optional salt used for CREATE2 deployment. None implies deployment using CREATE. */\n salt?: string;\n /** The solc version used. */\n solcVersion: `v${number}.${number}.${number}`;\n /** Whether the IR is used. */\n viaIR: boolean;\n /** Optional zk version used, only valid for zkEVM chains. */\n zkVersion?: `v${number}.${number}.${number}`;\n };\n\n /* -------------------------------------------------------------------------- */\n /* DEPLOYMENT */\n /* -------------------------------------------------------------------------- */\n\n export namespace Deployment {\n export type Standard = {\n chainId: number;\n contracts: Contract[];\n /** TODO: Compiler settings for the contract. Not implemented yet. */\n compilerSettings?: CompilerSettings;\n };\n\n export type LockupV1 = Standard & {\n core: Contract[];\n periphery: Contract[];\n };\n }\n\n export type Deployment = Deployment.Standard | Deployment.LockupV1;\n\n /* -------------------------------------------------------------------------- */\n /* MANIFEST */\n /* -------------------------------------------------------------------------- */\n\n /**\n * Contract names for a given protocol and version.\n * Note that this may contain both deployed contracts and abstract contracts that are not deployed.\n */\n export namespace Manifest {\n export type LockupV1 = {\n core: Standard;\n periphery: Standard;\n };\n\n export type Standard = Shared.Manifest;\n }\n\n export type Manifest = Manifest.LockupV1 | Manifest.Standard;\n\n /* -------------------------------------------------------------------------- */\n /* RELEASE */\n /* -------------------------------------------------------------------------- */\n\n export type AirdropsReleaseFeatures = {\n payable: boolean;\n claimTo: boolean;\n sponsor: boolean;\n };\n\n export type FlowReleaseFeatures = {\n payable: boolean;\n };\n\n export type LockupReleaseFeatures = {\n payable: boolean;\n prbProxy: boolean;\n batch: boolean;\n legacyAbi: boolean;\n };\n\n export type EmptyReleaseFeatures = Record<never, never>;\n\n export type EvmReleaseFeatures =\n | AirdropsReleaseFeatures\n | FlowReleaseFeatures\n | LockupReleaseFeatures\n | EmptyReleaseFeatures;\n\n /**\n * A collection of deployments for a given protocol and version.\n */\n export namespace Release {\n type Common<\n TAbiMap extends AbiMap = AbiMap,\n TFeatures extends EvmReleaseFeatures = EvmReleaseFeatures,\n > = {\n abi: TAbiMap;\n /** A map of contract names to their aliases, used in the Sablier Interface and the Graph. */\n aliases?: AliasMap;\n /** An array of contract names. */\n contractNames: string[];\n /** Release capabilities keyed to the owning protocol. */\n features: TFeatures;\n /** Whether this is the latest release for this protocol. */\n isLatest: boolean;\n /** The kind of release. */\n kind: \"standard\" | \"lockupV1\";\n /** The Sablier protocol released, e.g. `airdrops`. */\n protocol: Protocol;\n /** Repository information for the release. */\n repository?: Repository;\n /** The version of the release, e.g., `v1.3`. */\n version: Version;\n };\n\n /**\n * Lockup v1.x release used to separate Lockup contracts into core and periphery sub-categories.\n * @see https://github.com/sablier-labs/v2-periphery\n */\n export type LockupV1<\n TAbiMap extends AbiMap = AbiMap,\n TFeatures extends EvmReleaseFeatures = EvmReleaseFeatures,\n > = Common<TAbiMap, TFeatures> & {\n deployments: Deployment.LockupV1[];\n kind: \"lockupV1\";\n manifest: Manifest.LockupV1;\n };\n\n export type Standard<\n TAbiMap extends AbiMap = AbiMap,\n TFeatures extends EvmReleaseFeatures = EvmReleaseFeatures,\n > = Common<TAbiMap, TFeatures> & {\n deployments: Deployment.Standard[];\n kind: \"standard\";\n manifest: Manifest.Standard;\n };\n }\n\n export type Release = Release.Standard | Release.LockupV1;\n\n /* -------------------------------------------------------------------------- */\n /* VERSION */\n /* -------------------------------------------------------------------------- */\n\n export namespace Version {\n export type Airdrops = `${enums.Version.Airdrops}` | enums.Version.Airdrops;\n\n export type Bob = `${enums.Version.Bob}` | enums.Version.Bob;\n\n export type Flow = `${enums.Version.Flow}` | enums.Version.Flow;\n\n export type Legacy = `${enums.Version.Legacy}` | enums.Version.Legacy;\n\n export type Lockup = `${enums.Version.Lockup}` | enums.Version.Lockup;\n }\n export type Version =\n | Version.Airdrops\n | Version.Bob\n | Version.Flow\n | Version.Legacy\n | Version.Lockup;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/evm/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { AliasMap, Repository, Shared } from \"@/src/shared/types.js\";\nimport type * as enums from \"./enums.js\";\n\nexport namespace EVM {\n /** Ethereum address in the format 0x followed by 40 hex characters. */\n export type Address = `0x${string}`;\n\n export type AbiMap = { [contractName: string]: readonly object[] };\n export type Chain = Shared.Chain & {\n /** Whether this is a zkEVM like zkSync. */\n isZK: boolean;\n rpc: Shared.Chain[\"rpc\"] & {\n /** Alchemy RPC URL generator. */\n alchemy?: (apiKey: string) => string;\n /** Infura RPC URL generator. */\n infura?: (apiKey: string) => string;\n /** RouteMesh RPC URL generator. */\n routemesh?: (apiKey: string) => string;\n };\n };\n\n /**\n * The base contract type for EVM chains.\n */\n export type Contract = Shared.Contract<Address, Protocol, Version>;\n\n /**\n * Reverse mapping of contracts so that we can look up contracts by address.\n */\n export type ContractCatalog = {\n [protocol in Protocol]: {\n [chainId: number]: {\n [address: Address]: Contract;\n };\n };\n };\n\n /**\n * Reverse mapping of contracts by alias for O(1) lookup.\n */\n export type AliasCatalog = {\n [protocol in Protocol]: {\n [chainId: number]: {\n [alias: string]: Contract;\n };\n };\n };\n\n /** @internal */\n export type ContractMap = Shared.ContractMap<Address>;\n\n export type Protocol = `${enums.Protocol}` | enums.Protocol;\n\n export type CompilerSettings = {\n /** The EVM version such as shanghai, paris, etc. */\n evmVersion: string;\n /** Whether the optimizer is enabled. */\n optimizer: boolean;\n /** The number of optimizer runs. */\n optimizerRuns: number;\n /** Optional salt used for CREATE2 deployment. None implies deployment using CREATE. */\n salt?: string;\n /** The solc version used. */\n solcVersion: `v${number}.${number}.${number}`;\n /** Whether the IR is used. */\n viaIR: boolean;\n /** Optional zk version used, only valid for zkEVM chains. */\n zkVersion?: `v${number}.${number}.${number}`;\n };\n\n /* -------------------------------------------------------------------------- */\n /* DEPLOYMENT */\n /* -------------------------------------------------------------------------- */\n\n export namespace Deployment {\n export type Standard = {\n chainId: number;\n contracts: Contract[];\n /** TODO: Compiler settings for the contract. Not implemented yet. */\n compilerSettings?: CompilerSettings;\n };\n\n export type LockupV1 = Standard & {\n core: Contract[];\n periphery: Contract[];\n };\n }\n\n export type Deployment = Deployment.Standard | Deployment.LockupV1;\n\n /* -------------------------------------------------------------------------- */\n /* MANIFEST */\n /* -------------------------------------------------------------------------- */\n\n /**\n * Contract names for a given protocol and version.\n * Note that this may contain both deployed contracts and abstract contracts that are not deployed.\n */\n export namespace Manifest {\n export type LockupV1 = {\n core: Standard;\n periphery: Standard;\n };\n\n export type Standard = Shared.Manifest;\n }\n\n export type Manifest = Manifest.LockupV1 | Manifest.Standard;\n\n /* -------------------------------------------------------------------------- */\n /* RELEASE */\n /* -------------------------------------------------------------------------- */\n\n export type AirdropsReleaseFeatures = {\n payable: boolean;\n claimTo: boolean;\n sponsor: boolean;\n };\n\n export type FlowReleaseFeatures = {\n payable: boolean;\n };\n\n export type LockupReleaseFeatures = {\n payable: boolean;\n prbProxy: boolean;\n batch: boolean;\n legacyAbi: boolean;\n shape: boolean;\n };\n\n export type EmptyReleaseFeatures = Record<never, never>;\n\n export type EvmReleaseFeatures =\n | AirdropsReleaseFeatures\n | FlowReleaseFeatures\n | LockupReleaseFeatures\n | EmptyReleaseFeatures;\n\n /**\n * A collection of deployments for a given protocol and version.\n */\n export namespace Release {\n type Common<\n TAbiMap extends AbiMap = AbiMap,\n TFeatures extends EvmReleaseFeatures = EvmReleaseFeatures,\n > = {\n abi: TAbiMap;\n /** A map of contract names to their aliases, used in the Sablier Interface and the Graph. */\n aliases?: AliasMap;\n /** An array of contract names. */\n contractNames: string[];\n /** Release capabilities keyed to the owning protocol. */\n features: TFeatures;\n /** Whether this is the latest release for this protocol. */\n isLatest: boolean;\n /** The kind of release. */\n kind: \"standard\" | \"lockupV1\";\n /** The Sablier protocol released, e.g. `airdrops`. */\n protocol: Protocol;\n /** Repository information for the release. */\n repository?: Repository;\n /** The version of the release, e.g., `v1.3`. */\n version: Version;\n };\n\n /**\n * Lockup v1.x release used to separate Lockup contracts into core and periphery sub-categories.\n * @see https://github.com/sablier-labs/v2-periphery\n */\n export type LockupV1<\n TAbiMap extends AbiMap = AbiMap,\n TFeatures extends EvmReleaseFeatures = EvmReleaseFeatures,\n > = Common<TAbiMap, TFeatures> & {\n deployments: Deployment.LockupV1[];\n kind: \"lockupV1\";\n manifest: Manifest.LockupV1;\n };\n\n export type Standard<\n TAbiMap extends AbiMap = AbiMap,\n TFeatures extends EvmReleaseFeatures = EvmReleaseFeatures,\n > = Common<TAbiMap, TFeatures> & {\n deployments: Deployment.Standard[];\n kind: \"standard\";\n manifest: Manifest.Standard;\n };\n }\n\n export type Release = Release.Standard | Release.LockupV1;\n\n /* -------------------------------------------------------------------------- */\n /* VERSION */\n /* -------------------------------------------------------------------------- */\n\n export namespace Version {\n export type Airdrops = `${enums.Version.Airdrops}` | enums.Version.Airdrops;\n\n export type Bob = `${enums.Version.Bob}` | enums.Version.Bob;\n\n export type Flow = `${enums.Version.Flow}` | enums.Version.Flow;\n\n export type Legacy = `${enums.Version.Legacy}` | enums.Version.Legacy;\n\n export type Lockup = `${enums.Version.Lockup}` | enums.Version.Lockup;\n }\n export type Version =\n | Version.Airdrops\n | Version.Bob\n | Version.Flow\n | Version.Legacy\n | Version.Lockup;\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Sablier, TruncateAddressOptions } from "../types.js";
|
|
2
2
|
export type { PayableEvmProtocol } from "./releases/features.js";
|
|
3
|
-
export { getAirdropsReleaseFeatures, getFlowReleaseFeatures, getLockupReleaseFeatures, hasClaimTo, hasSponsor, isEvmReleasePayable, supportsLockupBatch, supportsLockupPrbProxy, usesLockupSplit, } from "./releases/features.js";
|
|
3
|
+
export { getAirdropsReleaseFeatures, getFlowReleaseFeatures, getLockupReleaseFeatures, hasClaimTo, 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,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EACL,0BAA0B,EAC1B,sBAAsB,EACtB,wBAAwB,EACxB,UAAU,EACV,UAAU,EACV,mBAAmB,EACnB,mBAAmB,EACnB,sBAAsB,EACtB,eAAe,GAChB,MAAM,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,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,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;CACjC,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,CAqCvB;AAaD,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,EAC5B,OAAO,CAAC,EAAE,sBAAsB,GAC/B,MAAM,CAiBR"}
|
|
@@ -74,36 +74,42 @@ export declare const evmReleaseFeatures: {
|
|
|
74
74
|
readonly legacyAbi: true;
|
|
75
75
|
readonly payable: false;
|
|
76
76
|
readonly prbProxy: true;
|
|
77
|
+
readonly shape: false;
|
|
77
78
|
};
|
|
78
79
|
readonly "v1.1": {
|
|
79
80
|
readonly batch: false;
|
|
80
81
|
readonly legacyAbi: true;
|
|
81
82
|
readonly payable: false;
|
|
82
83
|
readonly prbProxy: false;
|
|
84
|
+
readonly shape: false;
|
|
83
85
|
};
|
|
84
86
|
readonly "v1.2": {
|
|
85
87
|
readonly batch: false;
|
|
86
88
|
readonly legacyAbi: false;
|
|
87
89
|
readonly payable: false;
|
|
88
90
|
readonly prbProxy: false;
|
|
91
|
+
readonly shape: false;
|
|
89
92
|
};
|
|
90
93
|
readonly "v2.0": {
|
|
91
94
|
readonly batch: true;
|
|
92
95
|
readonly legacyAbi: false;
|
|
93
96
|
readonly payable: true;
|
|
94
97
|
readonly prbProxy: false;
|
|
98
|
+
readonly shape: true;
|
|
95
99
|
};
|
|
96
100
|
readonly "v3.0": {
|
|
97
101
|
readonly batch: true;
|
|
98
102
|
readonly legacyAbi: false;
|
|
99
103
|
readonly payable: true;
|
|
100
104
|
readonly prbProxy: false;
|
|
105
|
+
readonly shape: true;
|
|
101
106
|
};
|
|
102
107
|
readonly "v4.0": {
|
|
103
108
|
readonly batch: true;
|
|
104
109
|
readonly legacyAbi: false;
|
|
105
110
|
readonly payable: true;
|
|
106
111
|
readonly prbProxy: false;
|
|
112
|
+
readonly shape: true;
|
|
107
113
|
};
|
|
108
114
|
};
|
|
109
115
|
};
|
|
@@ -119,5 +125,6 @@ export declare function hasSponsor(version: Sablier.EVM.Version.Airdrops): boole
|
|
|
119
125
|
export declare function supportsLockupBatch(version: Sablier.EVM.Version.Lockup): boolean;
|
|
120
126
|
export declare function supportsLockupPrbProxy(version: Sablier.EVM.Version.Lockup): boolean;
|
|
121
127
|
export declare function usesLockupSplit(version: Sablier.EVM.Version.Lockup): boolean;
|
|
128
|
+
export declare function supportsLockupShape(version: Sablier.EVM.Version.Lockup): boolean;
|
|
122
129
|
export {};
|
|
123
130
|
//# sourceMappingURL=features.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features.d.ts","sourceRoot":"","sources":["../../../../src/evm/releases/features.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAM9C,MAAM,MAAM,2BAA2B,GAAG;IACxC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC;IACvC,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC;IAC7B,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC;IAC/B,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC;IACnC,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,8BAA8B,GA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G,OAAO,CAE5E;AAKD,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,GAAG,OAAO,CAEhF"}
|
|
@@ -71,6 +71,7 @@ export declare namespace EVM {
|
|
|
71
71
|
prbProxy: boolean;
|
|
72
72
|
batch: boolean;
|
|
73
73
|
legacyAbi: boolean;
|
|
74
|
+
shape: boolean;
|
|
74
75
|
};
|
|
75
76
|
type EmptyReleaseFeatures = Record<never, never>;
|
|
76
77
|
type EvmReleaseFeatures = AirdropsReleaseFeatures | FlowReleaseFeatures | LockupReleaseFeatures | EmptyReleaseFeatures;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/evm/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,KAAK,KAAK,KAAK,MAAM,YAAY,CAAC;AAEzC,yBAAiB,GAAG,CAAC;IAEnB,KAAY,OAAO,GAAG,KAAK,MAAM,EAAE,CAAC;IAEpC,KAAY,MAAM,GAAG;QAAE,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAA;KAAE,CAAC;IACnE,KAAY,KAAK,GAAG,MAAM,CAAC,KAAK,GAAG;QAEjC,IAAI,EAAE,OAAO,CAAC;QACd,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG;YAEzB,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;YAErC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;YAEpC,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;SACxC,CAAC;KACH,CAAC;IAKF,KAAY,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,QA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