sablier 2.0.0-beta.2 → 2.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/evm/contracts/queries.d.ts +5 -5
- package/dist/evm/contracts/queries.d.ts.map +1 -1
- package/dist/evm/contracts/queries.js +7 -75
- package/dist/evm/contracts/queries.js.map +1 -1
- package/dist/evm/index.d.ts +24 -0
- package/dist/evm/index.d.ts.map +1 -1
- package/dist/evm/index.js +49 -1
- package/dist/evm/index.js.map +1 -1
- package/dist/evm/releases/helpers.d.ts +0 -1
- package/dist/evm/releases/helpers.d.ts.map +1 -1
- package/dist/evm/releases/helpers.js +0 -13
- package/dist/evm/releases/helpers.js.map +1 -1
- package/dist/evm/releases/queries.d.ts +2 -2
- package/dist/evm/releases/queries.d.ts.map +1 -1
- package/dist/evm/releases/queries.js +5 -33
- package/dist/evm/releases/queries.js.map +1 -1
- package/dist/evm/releases/resolvers.d.ts.map +1 -1
- package/dist/evm/releases/resolvers.js +17 -38
- package/dist/evm/releases/resolvers.js.map +1 -1
- package/dist/helpers.d.ts +1 -0
- package/dist/helpers.d.ts.map +1 -1
- package/dist/helpers.js +13 -0
- package/dist/helpers.js.map +1 -1
- package/dist/internal/query-factory.d.ts +58 -0
- package/dist/internal/query-factory.d.ts.map +1 -0
- package/dist/internal/query-factory.js +119 -0
- package/dist/internal/query-factory.js.map +1 -0
- package/dist/internal/resolver-factory.d.ts +33 -0
- package/dist/internal/resolver-factory.d.ts.map +1 -0
- package/dist/internal/resolver-factory.js +43 -0
- package/dist/internal/resolver-factory.js.map +1 -0
- package/dist/sablier.d.ts +21 -21
- package/dist/sablier.d.ts.map +1 -1
- package/dist/solana/contracts/queries.d.ts +5 -5
- package/dist/solana/contracts/queries.d.ts.map +1 -1
- package/dist/solana/contracts/queries.js +7 -72
- package/dist/solana/contracts/queries.js.map +1 -1
- package/dist/solana/releases/helpers.d.ts +0 -1
- package/dist/solana/releases/helpers.d.ts.map +1 -1
- package/dist/solana/releases/helpers.js +0 -13
- package/dist/solana/releases/helpers.js.map +1 -1
- package/dist/solana/releases/queries.d.ts +2 -2
- package/dist/solana/releases/queries.d.ts.map +1 -1
- package/dist/solana/releases/queries.js +5 -33
- package/dist/solana/releases/queries.js.map +1 -1
- package/dist/solana/releases/resolvers.d.ts.map +1 -1
- package/dist/solana/releases/resolvers.js +5 -28
- package/dist/solana/releases/resolvers.js.map +1 -1
- package/package.json +13 -1
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.createReleasesQueries = createReleasesQueries;
|
|
7
|
+
exports.createContractsQueries = createContractsQueries;
|
|
8
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
9
|
+
function createReleasesQueries(config) {
|
|
10
|
+
const { releases, ProtocolEnum } = config;
|
|
11
|
+
return {
|
|
12
|
+
get: (opts) => {
|
|
13
|
+
const { protocol, version } = opts;
|
|
14
|
+
return lodash_1.default.get(releases, [protocol, version]);
|
|
15
|
+
},
|
|
16
|
+
getAll: (opts) => {
|
|
17
|
+
const { protocol } = opts || {};
|
|
18
|
+
if (protocol) {
|
|
19
|
+
return lodash_1.default.flatMap(lodash_1.default.values(releases[protocol]));
|
|
20
|
+
}
|
|
21
|
+
return lodash_1.default.flatMap(Object.values(ProtocolEnum), (protocolName) => lodash_1.default.flatMap(lodash_1.default.values(releases[protocolName])));
|
|
22
|
+
},
|
|
23
|
+
getFirst: (opts) => {
|
|
24
|
+
const { protocol, chainId } = opts;
|
|
25
|
+
const list = releases[protocol];
|
|
26
|
+
if (chainId) {
|
|
27
|
+
return lodash_1.default.find(list, (r) => lodash_1.default.some(r.deployments, { chainId }));
|
|
28
|
+
}
|
|
29
|
+
return lodash_1.default.values(list)[0];
|
|
30
|
+
},
|
|
31
|
+
getLatest: (opts) => {
|
|
32
|
+
const list = lodash_1.default.values(releases[opts.protocol]);
|
|
33
|
+
const latest = list[list.length - 1];
|
|
34
|
+
if (!latest.isLatest) {
|
|
35
|
+
throw new Error(`Sablier SDK: No latest release found for Sablier ${opts.protocol}. Please report on GitHub.`);
|
|
36
|
+
}
|
|
37
|
+
return latest;
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function createContractsQueries(config) {
|
|
42
|
+
const { catalog, releasesQueries, protocols, normalizeAddress } = config;
|
|
43
|
+
return {
|
|
44
|
+
get: (opts) => {
|
|
45
|
+
const { chainId, contractAddress, contractName, protocol, release } = opts;
|
|
46
|
+
if (contractAddress && contractName) {
|
|
47
|
+
throw new Error("Sablier SDK: Cannot specify both contractAddress and contractName");
|
|
48
|
+
}
|
|
49
|
+
if (contractName) {
|
|
50
|
+
if (!release) {
|
|
51
|
+
throw new Error("Sablier SDK: contractName requires release to be specified");
|
|
52
|
+
}
|
|
53
|
+
const dep = lodash_1.default.find(release.deployments, { chainId });
|
|
54
|
+
return dep ? lodash_1.default.find(dep.contracts, { name: contractName }) : undefined;
|
|
55
|
+
}
|
|
56
|
+
if (contractAddress) {
|
|
57
|
+
const address = normalizeAddress(contractAddress);
|
|
58
|
+
if (release) {
|
|
59
|
+
const dep = lodash_1.default.find(release.deployments, { chainId });
|
|
60
|
+
return dep
|
|
61
|
+
? lodash_1.default.find(dep.contracts, (c) => normalizeAddress(c.address) === address)
|
|
62
|
+
: undefined;
|
|
63
|
+
}
|
|
64
|
+
if (protocol) {
|
|
65
|
+
const releases = releasesQueries.getAll({ protocol });
|
|
66
|
+
const matches = releases.filter((rel) => {
|
|
67
|
+
const dep = lodash_1.default.find(rel.deployments, { chainId });
|
|
68
|
+
return dep && lodash_1.default.some(dep.contracts, (c) => normalizeAddress(c.address) === address);
|
|
69
|
+
});
|
|
70
|
+
if (matches.length > 1) {
|
|
71
|
+
const versions = matches.map((r) => r.version).join(", ");
|
|
72
|
+
throw new Error(`Sablier SDK: Contract ${contractAddress} exists in multiple releases (${versions}) for "${protocol}". ` +
|
|
73
|
+
`Specify release: { chainId, contractAddress, release }`);
|
|
74
|
+
}
|
|
75
|
+
return lodash_1.default.get(catalog, [protocol, chainId, address]);
|
|
76
|
+
}
|
|
77
|
+
for (const protocol of protocols) {
|
|
78
|
+
const contract = lodash_1.default.get(catalog, [protocol, chainId, address]);
|
|
79
|
+
if (contract)
|
|
80
|
+
return contract;
|
|
81
|
+
}
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
return undefined;
|
|
85
|
+
},
|
|
86
|
+
getAll: (opts) => {
|
|
87
|
+
const { protocol, chainId, release } = opts || {};
|
|
88
|
+
if (protocol && release) {
|
|
89
|
+
throw new Error("Sablier SDK: Cannot specify both protocol and release as query options");
|
|
90
|
+
}
|
|
91
|
+
if (protocol) {
|
|
92
|
+
const releases = releasesQueries.getAll({ protocol });
|
|
93
|
+
let deps = lodash_1.default.flatMap(releases, (r) => r.deployments);
|
|
94
|
+
if (chainId) {
|
|
95
|
+
deps = lodash_1.default.filter(deps, (d) => d.chainId === chainId);
|
|
96
|
+
if (deps.length === 0)
|
|
97
|
+
return undefined;
|
|
98
|
+
}
|
|
99
|
+
return lodash_1.default.flatMap(deps, (d) => d.contracts);
|
|
100
|
+
}
|
|
101
|
+
if (release) {
|
|
102
|
+
let deps = release.deployments;
|
|
103
|
+
if (chainId) {
|
|
104
|
+
deps = lodash_1.default.filter(deps, (d) => d.chainId === chainId);
|
|
105
|
+
if (deps.length === 0)
|
|
106
|
+
return undefined;
|
|
107
|
+
}
|
|
108
|
+
return lodash_1.default.flatMap(deps, (d) => d.contracts);
|
|
109
|
+
}
|
|
110
|
+
if (chainId) {
|
|
111
|
+
const deps = lodash_1.default.flatMap(releasesQueries.getAll(), (r) => r.deployments);
|
|
112
|
+
const filtered = lodash_1.default.filter(deps, (d) => d.chainId === chainId);
|
|
113
|
+
return lodash_1.default.flatMap(filtered, (d) => d.contracts);
|
|
114
|
+
}
|
|
115
|
+
return lodash_1.default.flatMap(releasesQueries.getAll(), (r) => r.deployments.flatMap((d) => d.contracts));
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=query-factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-factory.js","sourceRoot":"","sources":["../../src/internal/query-factory.ts"],"names":[],"mappings":";;;;;AAMA,sDAuDC;AAMD,wDA2IC;AA9MD,oDAAuB;AAMvB,SAAgB,qBAAqB,CAInC,MAA0G;IAC1G,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,MAAM,CAAC;IAE1C,OAAO;QACL,GAAG,EAAE,CAAC,IAAgD,EAAwB,EAAE;YAC9E,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;YACnC,OAAO,gBAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAyB,CAAC;QACtE,CAAC;QAMD,MAAM,EAAE,CAAC,IAA+B,EAAc,EAAE;YACtD,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,IAAI,EAAE,CAAC;YAChC,IAAI,QAAQ,EAAE,CAAC;gBACb,OAAO,gBAAC,CAAC,OAAO,CAAC,gBAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAe,CAAC;YAC/D,CAAC;YAED,OAAO,gBAAC,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC,YAAY,EAAE,EAAE,CAC7D,gBAAC,CAAC,OAAO,CAAC,gBAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,CAC9B,CAAC;QAClB,CAAC;QAMD,QAAQ,EAAE,CAAC,IAA+C,EAAwB,EAAE;YAClF,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C,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;YACjD,CAAC;YAGD,OAAO,gBAAC,CAAC,OAAO,CAAC,eAAe,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;QAC/F,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
type ChainsQueries = {
|
|
2
|
+
getOrThrow: (chainId: number) => {
|
|
3
|
+
blockExplorers: {
|
|
4
|
+
default: {
|
|
5
|
+
url: string;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
type ContractMapperParams<TProtocol, TVersion> = {
|
|
11
|
+
chainId: number;
|
|
12
|
+
protocol: TProtocol;
|
|
13
|
+
version: TVersion;
|
|
14
|
+
aliasMap: {
|
|
15
|
+
[contractName: string]: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
type ContractMap = {
|
|
19
|
+
[contractName: string]: string | [string, number];
|
|
20
|
+
};
|
|
21
|
+
export declare function createContractMapper<TContract, TProtocol, TVersion>(chainsQueries: ChainsQueries): (contractMap: ContractMap, params: ContractMapperParams<TProtocol, TVersion>) => TContract[];
|
|
22
|
+
export declare function createStandardDeploymentResolver<TDeployment, TContract, TProtocol, TVersion>(contractMapper: ReturnType<typeof createContractMapper<TContract, TProtocol, TVersion>>): (params: {
|
|
23
|
+
protocol: TProtocol;
|
|
24
|
+
version: TVersion;
|
|
25
|
+
chainId: number;
|
|
26
|
+
aliasMap: {
|
|
27
|
+
[contractName: string]: string;
|
|
28
|
+
};
|
|
29
|
+
contractMap: ContractMap;
|
|
30
|
+
}) => TDeployment;
|
|
31
|
+
export declare function extractContractNames<T extends Record<string, string | Record<string, string>>>(manifest: T, getNestedValues: (obj: T) => string[]): string[];
|
|
32
|
+
export {};
|
|
33
|
+
//# sourceMappingURL=resolver-factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolver-factory.d.ts","sourceRoot":"","sources":["../../src/internal/resolver-factory.ts"],"names":[],"mappings":"AAOA,KAAK,aAAa,GAAG;IACnB,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK;QAAE,cAAc,EAAE;YAAE,OAAO,EAAE;gBAAE,GAAG,EAAE,MAAM,CAAA;aAAE,CAAA;SAAE,CAAA;KAAE,CAAC;CACnF,CAAC;AAEF,KAAK,oBAAoB,CAAC,SAAS,EAAE,QAAQ,IAAI;IAC/C,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,SAAS,CAAC;IACpB,OAAO,EAAE,QAAQ,CAAC;IAClB,QAAQ,EAAE;QAAE,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;CAC9C,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACnD,CAAC;AASF,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,EAAE,aAAa,IACvF,aAAa,WAAW,EAAE,QAAQ,oBAAoB,CAAC,SAAS,EAAE,QAAQ,CAAC,KAAG,SAAS,EAAE,CAmBlG;AAKD,wBAAgB,gCAAgC,CAAC,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAC1F,cAAc,EAAE,UAAU,CAAC,OAAO,oBAAoB,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC,IAE/E,QAAQ;IACd,QAAQ,EAAE,SAAS,CAAC;IACpB,OAAO,EAAE,QAAQ,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE;QAAE,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAC7C,WAAW,EAAE,WAAW,CAAC;CAC1B,KAAG,WAAW,CAShB;AAKD,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAC5F,QAAQ,EAAE,CAAC,EACX,eAAe,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,MAAM,EAAE,GACpC,MAAM,EAAE,CAEV"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.createContractMapper = createContractMapper;
|
|
7
|
+
exports.createStandardDeploymentResolver = createStandardDeploymentResolver;
|
|
8
|
+
exports.extractContractNames = extractContractNames;
|
|
9
|
+
const helpers_1 = require("../helpers");
|
|
10
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
11
|
+
function createContractMapper(chainsQueries) {
|
|
12
|
+
return (contractMap, params) => {
|
|
13
|
+
const { chainId, protocol, version, aliasMap } = params;
|
|
14
|
+
const chain = chainsQueries.getOrThrow(chainId);
|
|
15
|
+
return lodash_1.default.entries(contractMap).map(([name, addressOrTuple]) => {
|
|
16
|
+
const [address, blockNumber] = Array.isArray(addressOrTuple) ? addressOrTuple : [addressOrTuple];
|
|
17
|
+
return {
|
|
18
|
+
address,
|
|
19
|
+
alias: aliasMap[name],
|
|
20
|
+
block: blockNumber,
|
|
21
|
+
chainId,
|
|
22
|
+
explorerURL: (0, helpers_1.getContractExplorerURL)(chain.blockExplorers.default.url, address),
|
|
23
|
+
name,
|
|
24
|
+
protocol,
|
|
25
|
+
version,
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function createStandardDeploymentResolver(contractMapper) {
|
|
31
|
+
return (params) => {
|
|
32
|
+
const { contractMap, ...baseParams } = params;
|
|
33
|
+
const contracts = contractMapper(contractMap, baseParams);
|
|
34
|
+
return {
|
|
35
|
+
chainId: baseParams.chainId,
|
|
36
|
+
contracts,
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function extractContractNames(manifest, getNestedValues) {
|
|
41
|
+
return getNestedValues(manifest);
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=resolver-factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolver-factory.js","sourceRoot":"","sources":["../../src/internal/resolver-factory.ts"],"names":[],"mappings":";;;;;AA6BA,oDAoBC;AAKD,4EAkBC;AAKD,oDAKC;AAlFD,0CAAsD;AACtD,oDAAuB;AA4BvB,SAAgB,oBAAoB,CAAiC,aAA4B;IAC/F,OAAO,CAAC,WAAwB,EAAE,MAAiD,EAAe,EAAE;QAClG,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC;QACxD,MAAM,KAAK,GAAG,aAAa,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QAEhD,OAAO,gBAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,cAAc,CAAC,EAAE,EAAE;YAC3D,MAAM,CAAC,OAAO,EAAE,WAAW,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC;YAEjG,OAAO;gBACL,OAAO;gBACP,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC;gBACrB,KAAK,EAAE,WAAW;gBAClB,OAAO;gBACP,WAAW,EAAE,IAAA,gCAAsB,EAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,GAAG,EAAE,OAAwB,CAAC;gBAC/F,IAAI;gBACJ,QAAQ;gBACR,OAAO;aACK,CAAC;QACjB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AAKD,SAAgB,gCAAgC,CAC9C,cAAuF;IAEvF,OAAO,CAAC,MAMP,EAAe,EAAE;QAChB,MAAM,EAAE,WAAW,EAAE,GAAG,UAAU,EAAE,GAAG,MAAM,CAAC;QAC9C,MAAM,SAAS,GAAG,cAAc,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;QAE1D,OAAO;YACL,OAAO,EAAE,UAAU,CAAC,OAAO;YAC3B,SAAS;SACK,CAAC;IACnB,CAAC,CAAC;AACJ,CAAC;AAKD,SAAgB,oBAAoB,CAClC,QAAW,EACX,eAAqC;IAErC,OAAO,eAAe,CAAC,QAAQ,CAAC,CAAC;AACnC,CAAC"}
|
package/dist/sablier.d.ts
CHANGED
|
@@ -14,14 +14,14 @@ export declare const sablier: {
|
|
|
14
14
|
chainId: number;
|
|
15
15
|
contractAddress?: string;
|
|
16
16
|
contractName?: string;
|
|
17
|
-
protocol?: Sablier.EVM.Protocol;
|
|
18
|
-
release?: Sablier.EVM.Release;
|
|
17
|
+
protocol?: Sablier.EVM.Protocol | undefined;
|
|
18
|
+
release?: Sablier.EVM.Release | undefined;
|
|
19
19
|
}) => Sablier.EVM.Contract | undefined;
|
|
20
20
|
getAll: (opts?: {
|
|
21
21
|
chainId?: number;
|
|
22
|
-
protocol?: Sablier.EVM.Protocol;
|
|
23
|
-
release?: Sablier.EVM.Release;
|
|
24
|
-
}) => Sablier.EVM.Contract[] | undefined;
|
|
22
|
+
protocol?: Sablier.EVM.Protocol | undefined;
|
|
23
|
+
release?: Sablier.EVM.Release | undefined;
|
|
24
|
+
} | undefined) => Sablier.EVM.Contract[] | undefined;
|
|
25
25
|
};
|
|
26
26
|
deployments: {
|
|
27
27
|
get: (opts: {
|
|
@@ -36,8 +36,8 @@ export declare const sablier: {
|
|
|
36
36
|
version: Sablier.EVM.Version;
|
|
37
37
|
}) => Sablier.EVM.Release | undefined;
|
|
38
38
|
getAll: (opts?: {
|
|
39
|
-
protocol?: Sablier.EVM.Protocol;
|
|
40
|
-
}) => Sablier.EVM.Release[];
|
|
39
|
+
protocol?: Sablier.EVM.Protocol | undefined;
|
|
40
|
+
} | undefined) => Sablier.EVM.Release[];
|
|
41
41
|
getFirst: (opts: {
|
|
42
42
|
protocol: Sablier.EVM.Protocol;
|
|
43
43
|
chainId?: number;
|
|
@@ -61,14 +61,14 @@ export declare const sablier: {
|
|
|
61
61
|
chainId: number;
|
|
62
62
|
contractAddress?: string;
|
|
63
63
|
contractName?: string;
|
|
64
|
-
protocol?: Sablier.Solana.Protocol;
|
|
65
|
-
release?: Sablier.Solana.Release;
|
|
64
|
+
protocol?: Sablier.Solana.Protocol | undefined;
|
|
65
|
+
release?: Sablier.Solana.Release | undefined;
|
|
66
66
|
}) => Sablier.Solana.Contract | undefined;
|
|
67
67
|
getAll: (opts?: {
|
|
68
68
|
chainId?: number;
|
|
69
|
-
protocol?: Sablier.Solana.Protocol;
|
|
70
|
-
release?: Sablier.Solana.Release;
|
|
71
|
-
}) => Sablier.Solana.Contract[] | undefined;
|
|
69
|
+
protocol?: Sablier.Solana.Protocol | undefined;
|
|
70
|
+
release?: Sablier.Solana.Release | undefined;
|
|
71
|
+
} | undefined) => Sablier.Solana.Contract[] | undefined;
|
|
72
72
|
};
|
|
73
73
|
deployments: {
|
|
74
74
|
get: (opts: {
|
|
@@ -83,8 +83,8 @@ export declare const sablier: {
|
|
|
83
83
|
version: Sablier.Solana.Version;
|
|
84
84
|
}) => Sablier.Solana.Release | undefined;
|
|
85
85
|
getAll: (opts?: {
|
|
86
|
-
protocol?: Sablier.Solana.Protocol;
|
|
87
|
-
}) => Sablier.Solana.Release[];
|
|
86
|
+
protocol?: Sablier.Solana.Protocol | undefined;
|
|
87
|
+
} | undefined) => Sablier.Solana.Release[];
|
|
88
88
|
getFirst: (opts: {
|
|
89
89
|
protocol: Sablier.Solana.Protocol;
|
|
90
90
|
chainId?: number;
|
|
@@ -107,14 +107,14 @@ export declare const sablier: {
|
|
|
107
107
|
chainId: number;
|
|
108
108
|
contractAddress?: string;
|
|
109
109
|
contractName?: string;
|
|
110
|
-
protocol?: Sablier.EVM.Protocol;
|
|
111
|
-
release?: Sablier.EVM.Release;
|
|
110
|
+
protocol?: Sablier.EVM.Protocol | undefined;
|
|
111
|
+
release?: Sablier.EVM.Release | undefined;
|
|
112
112
|
}) => Sablier.EVM.Contract | undefined;
|
|
113
113
|
getAll: (opts?: {
|
|
114
114
|
chainId?: number;
|
|
115
|
-
protocol?: Sablier.EVM.Protocol;
|
|
116
|
-
release?: Sablier.EVM.Release;
|
|
117
|
-
}) => Sablier.EVM.Contract[] | undefined;
|
|
115
|
+
protocol?: Sablier.EVM.Protocol | undefined;
|
|
116
|
+
release?: Sablier.EVM.Release | undefined;
|
|
117
|
+
} | undefined) => Sablier.EVM.Contract[] | undefined;
|
|
118
118
|
};
|
|
119
119
|
deployments: {
|
|
120
120
|
get: (opts: {
|
|
@@ -129,8 +129,8 @@ export declare const sablier: {
|
|
|
129
129
|
version: Sablier.EVM.Version;
|
|
130
130
|
}) => Sablier.EVM.Release | undefined;
|
|
131
131
|
getAll: (opts?: {
|
|
132
|
-
protocol?: Sablier.EVM.Protocol;
|
|
133
|
-
}) => Sablier.EVM.Release[];
|
|
132
|
+
protocol?: Sablier.EVM.Protocol | undefined;
|
|
133
|
+
} | undefined) => Sablier.EVM.Release[];
|
|
134
134
|
getFirst: (opts: {
|
|
135
135
|
protocol: Sablier.EVM.Protocol;
|
|
136
136
|
chainId?: number;
|
package/dist/sablier.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sablier.d.ts","sourceRoot":"","sources":["../src/sablier.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAwD1C,eAAO,MAAM,OAAO
|
|
1
|
+
{"version":3,"file":"sablier.d.ts","sourceRoot":"","sources":["../src/sablier.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAwD1C,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;wBAtCN;gBAAE,OAAO,EAAE,MAAM,CAAC;gBAAC,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAA;aAAE,KAAG,OAAO,CAAC,GAAG,CAAC,UAAU,GAAG,SAAS;0BAItF,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAWxB;gBAAE,OAAO,EAAE,MAAM,CAAC;gBAAC,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,OAAO,CAAA;aAAE,KAAG,OAAO,CAAC,MAAM,CAAC,UAAU,GAAG,SAAS;0BAI5F,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAnB3B;YAAE,OAAO,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAA;SAAE,KAAG,OAAO,CAAC,GAAG,CAAC,UAAU,GAAG,SAAS;sBAItF,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE;;;;;;;;;;;;;;;;;;CAsCrC,CAAC"}
|
|
@@ -4,13 +4,13 @@ export declare const contractsQueries: {
|
|
|
4
4
|
chainId: number;
|
|
5
5
|
contractAddress?: string;
|
|
6
6
|
contractName?: string;
|
|
7
|
-
protocol?: Sablier.Solana.Protocol;
|
|
8
|
-
release?: Sablier.Solana.Release;
|
|
7
|
+
protocol?: Sablier.Solana.Protocol | undefined;
|
|
8
|
+
release?: Sablier.Solana.Release | undefined;
|
|
9
9
|
}) => Sablier.Solana.Contract | undefined;
|
|
10
10
|
getAll: (opts?: {
|
|
11
11
|
chainId?: number;
|
|
12
|
-
protocol?: Sablier.Solana.Protocol;
|
|
13
|
-
release?: Sablier.Solana.Release;
|
|
14
|
-
}) => Sablier.Solana.Contract[] | undefined;
|
|
12
|
+
protocol?: Sablier.Solana.Protocol | undefined;
|
|
13
|
+
release?: Sablier.Solana.Release | undefined;
|
|
14
|
+
} | undefined) => Sablier.Solana.Contract[] | undefined;
|
|
15
15
|
};
|
|
16
16
|
//# sourceMappingURL=queries.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../../src/solana/contracts/queries.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../../src/solana/contracts/queries.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAG1C,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;CAU3B,CAAC"}
|
|
@@ -1,79 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.contractsQueries = void 0;
|
|
4
|
+
const query_factory_1 = require("../../internal/query-factory");
|
|
7
5
|
const enums_1 = require("../../solana/enums");
|
|
8
6
|
const queries_1 = require("../../solana/releases/queries");
|
|
9
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
10
7
|
const catalog_1 = require("./catalog");
|
|
11
|
-
exports.contractsQueries = {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
if (contractName) {
|
|
18
|
-
if (!release) {
|
|
19
|
-
throw new Error("Sablier SDK: contractName requires release to be specified");
|
|
20
|
-
}
|
|
21
|
-
const dep = lodash_1.default.find(release.deployments, { chainId });
|
|
22
|
-
return dep ? lodash_1.default.find(dep.contracts, { name: contractName }) : undefined;
|
|
23
|
-
}
|
|
24
|
-
if (contractAddress) {
|
|
25
|
-
if (release) {
|
|
26
|
-
const dep = lodash_1.default.find(release.deployments, { chainId });
|
|
27
|
-
return dep ? lodash_1.default.find(dep.contracts, (c) => c.address === contractAddress) : undefined;
|
|
28
|
-
}
|
|
29
|
-
if (protocol) {
|
|
30
|
-
const releases = queries_1.releasesQueries.getAll({ protocol });
|
|
31
|
-
const matches = releases.filter((rel) => {
|
|
32
|
-
const dep = lodash_1.default.find(rel.deployments, { chainId });
|
|
33
|
-
return dep && lodash_1.default.some(dep.contracts, (c) => c.address === contractAddress);
|
|
34
|
-
});
|
|
35
|
-
if (matches.length > 1) {
|
|
36
|
-
const versions = matches.map((r) => r.version).join(", ");
|
|
37
|
-
throw new Error(`Sablier SDK: Contract ${contractAddress} exists in multiple releases (${versions}) for "${protocol}". ` +
|
|
38
|
-
`Specify release: { chainId, contractAddress, release }`);
|
|
39
|
-
}
|
|
40
|
-
return lodash_1.default.get(catalog_1.catalog, [protocol, chainId, contractAddress]);
|
|
41
|
-
}
|
|
42
|
-
return (lodash_1.default.get(catalog_1.catalog, [enums_1.Protocol.Airdrops, chainId, contractAddress]) ||
|
|
43
|
-
lodash_1.default.get(catalog_1.catalog, [enums_1.Protocol.Lockup, chainId, contractAddress]));
|
|
44
|
-
}
|
|
45
|
-
return undefined;
|
|
46
|
-
},
|
|
47
|
-
getAll: (opts) => {
|
|
48
|
-
const { protocol, chainId, release } = opts || {};
|
|
49
|
-
if (protocol && release) {
|
|
50
|
-
throw new Error("Sablier SDK: Cannot specify both protocol and release as query options");
|
|
51
|
-
}
|
|
52
|
-
if (protocol) {
|
|
53
|
-
const releases = queries_1.releasesQueries.getAll({ protocol });
|
|
54
|
-
let deps = lodash_1.default.flatMap(releases, (r) => r.deployments);
|
|
55
|
-
if (chainId) {
|
|
56
|
-
deps = lodash_1.default.filter(deps, (d) => d.chainId === chainId);
|
|
57
|
-
if (deps.length === 0)
|
|
58
|
-
return undefined;
|
|
59
|
-
}
|
|
60
|
-
return lodash_1.default.flatMap(deps, (d) => d.contracts);
|
|
61
|
-
}
|
|
62
|
-
if (release) {
|
|
63
|
-
let deps = release.deployments;
|
|
64
|
-
if (chainId) {
|
|
65
|
-
deps = lodash_1.default.filter(deps, (d) => d.chainId === chainId);
|
|
66
|
-
if (deps.length === 0)
|
|
67
|
-
return undefined;
|
|
68
|
-
}
|
|
69
|
-
return lodash_1.default.flatMap(deps, (d) => d.contracts);
|
|
70
|
-
}
|
|
71
|
-
if (chainId) {
|
|
72
|
-
const deps = lodash_1.default.flatMap(queries_1.releasesQueries.getAll(), (r) => r.deployments);
|
|
73
|
-
const filtered = lodash_1.default.filter(deps, (d) => d.chainId === chainId);
|
|
74
|
-
return lodash_1.default.flatMap(filtered, (d) => d.contracts);
|
|
75
|
-
}
|
|
76
|
-
return lodash_1.default.flatMap(queries_1.releasesQueries.getAll(), (r) => r.deployments.flatMap((d) => d.contracts));
|
|
77
|
-
},
|
|
78
|
-
};
|
|
8
|
+
exports.contractsQueries = (0, query_factory_1.createContractsQueries)({
|
|
9
|
+
catalog: catalog_1.catalog,
|
|
10
|
+
normalizeAddress: (address) => address,
|
|
11
|
+
protocols: [enums_1.Protocol.Airdrops, enums_1.Protocol.Lockup],
|
|
12
|
+
releasesQueries: queries_1.releasesQueries,
|
|
13
|
+
});
|
|
79
14
|
//# sourceMappingURL=queries.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queries.js","sourceRoot":"","sources":["../../../src/solana/contracts/queries.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"queries.js","sourceRoot":"","sources":["../../../src/solana/contracts/queries.ts"],"names":[],"mappings":";;;AAAA,+DAAqE;AACrE,6CAA6C;AAC7C,0DAA+D;AAE/D,uCAAoC;AAEvB,QAAA,gBAAgB,GAAG,IAAA,sCAAsB,EAKpD;IACA,OAAO,EAAP,iBAAO;IACP,gBAAgB,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO;IACtC,SAAS,EAAE,CAAC,gBAAQ,CAAC,QAAQ,EAAE,gBAAQ,CAAC,MAAM,CAAC;IAC/C,eAAe,EAAf,yBAAe;CAChB,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/solana/releases/helpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/solana/releases/helpers.ts"],"names":[],"mappings":"AAEA,wBAAgB,eAAe,CAAC,CAAC,SAAS;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,EAAE,WAAW,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAMpF"}
|
|
@@ -1,20 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getNestedValues = getNestedValues;
|
|
7
3
|
exports.sortDeployments = sortDeployments;
|
|
8
4
|
const queries_1 = require("../../solana/chains/queries");
|
|
9
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
10
|
-
function getNestedValues(obj) {
|
|
11
|
-
return lodash_1.default.flatMap(obj, (value) => {
|
|
12
|
-
if (lodash_1.default.isObject(value) && !lodash_1.default.isArray(value)) {
|
|
13
|
-
return getNestedValues(value);
|
|
14
|
-
}
|
|
15
|
-
return lodash_1.default.isString(value) ? value : [];
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
5
|
function sortDeployments(deployments) {
|
|
19
6
|
return deployments.sort((a, b) => {
|
|
20
7
|
const aChain = queries_1.chainsQueries.getOrThrow(a.chainId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/solana/releases/helpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/solana/releases/helpers.ts"],"names":[],"mappings":";;AAEA,0CAMC;AARD,wDAA2D;AAE3D,SAAgB,eAAe,CAAgC,WAAgB;IAC7E,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QAC/B,MAAM,MAAM,GAAG,uBAAa,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QACnD,MAAM,MAAM,GAAG,uBAAa,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QACnD,OAAO,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -5,8 +5,8 @@ export declare const releasesQueries: {
|
|
|
5
5
|
version: Sablier.Solana.Version;
|
|
6
6
|
}) => Sablier.Solana.Release | undefined;
|
|
7
7
|
getAll: (opts?: {
|
|
8
|
-
protocol?: Sablier.Solana.Protocol;
|
|
9
|
-
}) => Sablier.Solana.Release[];
|
|
8
|
+
protocol?: Sablier.Solana.Protocol | undefined;
|
|
9
|
+
} | undefined) => Sablier.Solana.Release[];
|
|
10
10
|
getFirst: (opts: {
|
|
11
11
|
protocol: Sablier.Solana.Protocol;
|
|
12
12
|
chainId?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../../src/solana/releases/queries.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../../src/solana/releases/queries.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAG1C,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;CAO1B,CAAC"}
|
|
@@ -1,39 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.releasesQueries = void 0;
|
|
4
|
+
const query_factory_1 = require("../../internal/query-factory");
|
|
7
5
|
const enums_1 = require("../../solana/enums");
|
|
8
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
9
6
|
const data_1 = require("./data");
|
|
10
|
-
exports.releasesQueries = {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
},
|
|
15
|
-
getAll: (opts) => {
|
|
16
|
-
const { protocol } = opts || {};
|
|
17
|
-
if (protocol) {
|
|
18
|
-
return lodash_1.default.flatMap(lodash_1.default.values(data_1.releases[protocol]));
|
|
19
|
-
}
|
|
20
|
-
return lodash_1.default.flatMap(Object.values(enums_1.Protocol), (protocolName) => lodash_1.default.flatMap(lodash_1.default.values(data_1.releases[protocolName])));
|
|
21
|
-
},
|
|
22
|
-
getFirst: (opts) => {
|
|
23
|
-
const { protocol, chainId } = opts;
|
|
24
|
-
const list = data_1.releases[protocol];
|
|
25
|
-
if (chainId) {
|
|
26
|
-
return lodash_1.default.find(list, (r) => lodash_1.default.some(r.deployments, { chainId }));
|
|
27
|
-
}
|
|
28
|
-
return lodash_1.default.values(list)[0];
|
|
29
|
-
},
|
|
30
|
-
getLatest: (opts) => {
|
|
31
|
-
const list = lodash_1.default.values(data_1.releases[opts.protocol]);
|
|
32
|
-
const latest = list[list.length - 1];
|
|
33
|
-
if (!latest.isLatest) {
|
|
34
|
-
throw new Error(`Sablier SDK: No latest release found for Sablier ${opts.protocol}. Please report on GitHub.`);
|
|
35
|
-
}
|
|
36
|
-
return latest;
|
|
37
|
-
},
|
|
38
|
-
};
|
|
7
|
+
exports.releasesQueries = (0, query_factory_1.createReleasesQueries)({
|
|
8
|
+
ProtocolEnum: enums_1.Protocol,
|
|
9
|
+
releases: data_1.releases,
|
|
10
|
+
});
|
|
39
11
|
//# sourceMappingURL=queries.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queries.js","sourceRoot":"","sources":["../../../src/solana/releases/queries.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"queries.js","sourceRoot":"","sources":["../../../src/solana/releases/queries.ts"],"names":[],"mappings":";;;AAAA,+DAAoE;AACpE,6CAA6C;AAE7C,iCAAkC;AAErB,QAAA,eAAe,GAAG,IAAA,qCAAqB,EAIlD;IACA,YAAY,EAAE,gBAAQ;IACtB,QAAQ,EAAE,eAAmF;CAC9F,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolvers.d.ts","sourceRoot":"","sources":["../../../src/solana/releases/resolvers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resolvers.d.ts","sourceRoot":"","sources":["../../../src/solana/releases/resolvers.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAM1C,KAAK,gBAAgB,GAAG;IACtB,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC;IAClC,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC;IAClC,WAAW,EAAE,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC;CACzC,CAAC;AAEF,KAAK,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;AAqBnE,eAAO,MAAM,SAAS;;2BAKC,gBAAgB,KAAG,OAAO,CAAC,MAAM,CAAC,UAAU;;;2BAS5C,aAAa,KAAG,OAAO,CAAC,MAAM,CAAC,OAAO;;CAO5D,CAAC"}
|
|
@@ -1,21 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.resolvers = void 0;
|
|
4
|
+
const helpers_1 = require("../../helpers");
|
|
5
|
+
const resolver_factory_1 = require("../../internal/resolver-factory");
|
|
7
6
|
const queries_1 = require("../../solana/chains/queries");
|
|
8
|
-
const
|
|
9
|
-
const
|
|
7
|
+
const contractMapper = (0, resolver_factory_1.createContractMapper)(queries_1.chainsQueries);
|
|
8
|
+
const standardDeploymentResolver = (0, resolver_factory_1.createStandardDeploymentResolver)(contractMapper);
|
|
10
9
|
exports.resolvers = {
|
|
11
10
|
deployment: {
|
|
12
11
|
standard: (params) => {
|
|
13
|
-
|
|
14
|
-
const contracts = mapContractsToDeployment(contractMap, baseParams);
|
|
15
|
-
return {
|
|
16
|
-
chainId: baseParams.chainId,
|
|
17
|
-
contracts,
|
|
18
|
-
};
|
|
12
|
+
return standardDeploymentResolver(params);
|
|
19
13
|
},
|
|
20
14
|
},
|
|
21
15
|
release: {
|
|
@@ -27,21 +21,4 @@ exports.resolvers = {
|
|
|
27
21
|
},
|
|
28
22
|
},
|
|
29
23
|
};
|
|
30
|
-
function mapContractsToDeployment(contractMap, params) {
|
|
31
|
-
const { chainId, protocol, version, aliasMap } = params;
|
|
32
|
-
const chain = queries_1.chainsQueries.getOrThrow(chainId);
|
|
33
|
-
return lodash_1.default.entries(contractMap).map(([name, addressOrTuple]) => {
|
|
34
|
-
const [address, blockNumber] = Array.isArray(addressOrTuple) ? addressOrTuple : [addressOrTuple];
|
|
35
|
-
return {
|
|
36
|
-
address,
|
|
37
|
-
alias: aliasMap[name],
|
|
38
|
-
block: blockNumber,
|
|
39
|
-
chainId,
|
|
40
|
-
explorerURL: `${chain.blockExplorers.default.url}/address/${address}`,
|
|
41
|
-
name,
|
|
42
|
-
protocol,
|
|
43
|
-
version,
|
|
44
|
-
};
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
24
|
//# sourceMappingURL=resolvers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolvers.js","sourceRoot":"","sources":["../../../src/solana/releases/resolvers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resolvers.js","sourceRoot":"","sources":["../../../src/solana/releases/resolvers.ts"],"names":[],"mappings":";;;AAAA,0CAA+C;AAC/C,qEAAwG;AACxG,wDAA2D;AAqB3D,MAAM,cAAc,GAAG,IAAA,uCAAoB,EACzC,uBAAa,CACd,CAAC;AAEF,MAAM,0BAA0B,GAAG,IAAA,mDAAgC,EAKjE,cAAc,CAAC,CAAC;AAML,QAAA,SAAS,GAAG;IACvB,UAAU,EAAE;QAIV,QAAQ,EAAE,CAAC,MAAwB,EAA6B,EAAE;YAChE,OAAO,0BAA0B,CAAC,MAAM,CAAC,CAAC;QAC5C,CAAC;KACF;IAED,OAAO,EAAE;QAIP,QAAQ,EAAE,CAAC,MAAqB,EAA0B,EAAE;YAC1D,OAAO;gBACL,GAAG,MAAM;gBACT,aAAa,EAAE,IAAA,yBAAe,EAAC,MAAM,CAAC,QAAQ,CAAC;aAChD,CAAC;QACJ,CAAC;KACF;CACF,CAAC"}
|