@mimicprotocol/sdk 0.1.3 → 0.1.4
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/dist/client/core/config.d.ts +5 -1
- package/dist/client/core/config.d.ts.map +1 -1
- package/dist/client/core/config.js +17 -7
- package/dist/client/core/config.js.map +1 -1
- package/dist/client/index.d.ts +2 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/index.js.map +1 -1
- package/dist/shared/utils/constants.d.ts +2 -0
- package/dist/shared/utils/constants.d.ts.map +1 -1
- package/dist/shared/utils/constants.js +3 -1
- package/dist/shared/utils/constants.js.map +1 -1
- package/package.json +1 -1
|
@@ -6,6 +6,10 @@ export interface DomainConfig {
|
|
|
6
6
|
timeoutMs?: number;
|
|
7
7
|
defaultHeaders?: Record<string, string>;
|
|
8
8
|
}
|
|
9
|
+
export interface IntegrationConfig {
|
|
10
|
+
slug?: string;
|
|
11
|
+
apiKey?: string;
|
|
12
|
+
}
|
|
9
13
|
export type CoreConfig = Record<DomainName, DomainConfig>;
|
|
10
|
-
export declare function resolveCoreConfig(initConfig?: Partial<CoreConfig>, baseUrl?: string, defaultAuth?: AuthStrategy): CoreConfig;
|
|
14
|
+
export declare function resolveCoreConfig(initConfig?: Partial<CoreConfig>, baseUrl?: string, defaultAuth?: AuthStrategy, integration?: IntegrationConfig): CoreConfig;
|
|
11
15
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/client/core/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/client/core/config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AAErC,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,WAAW,GAAG,YAAY,GAAG,SAAS,GAAG,UAAU,GAAG,OAAO,CAAA;AAInG,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,YAAY,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACxC;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,EAAE,YAAY,CAAC,CAAA;AAEzD,wBAAgB,iBAAiB,CAC/B,UAAU,GAAE,OAAO,CAAC,UAAU,CAAM,EACpC,OAAO,CAAC,EAAE,MAAM,EAChB,WAAW,CAAC,EAAE,YAAY,EAC1B,WAAW,CAAC,EAAE,iBAAiB,GAC9B,UAAU,CAaZ"}
|
|
@@ -1,17 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resolveCoreConfig = resolveCoreConfig;
|
|
4
|
+
const shared_1 = require("../../shared");
|
|
4
5
|
const DEFAULT_API_URL = 'https://api-protocol.mimic.fi';
|
|
5
|
-
function resolveCoreConfig(initConfig = {}, baseUrl, defaultAuth) {
|
|
6
|
+
function resolveCoreConfig(initConfig = {}, baseUrl, defaultAuth, integration) {
|
|
7
|
+
const defaultHeaders = getIntegrationHeaders(integration);
|
|
6
8
|
const coreConfig = {
|
|
7
|
-
balances: { baseUrl: baseUrl ?? DEFAULT_API_URL, auth: defaultAuth },
|
|
8
|
-
triggers: { baseUrl: baseUrl ?? DEFAULT_API_URL, auth: defaultAuth },
|
|
9
|
-
executions: { baseUrl: baseUrl ?? DEFAULT_API_URL, auth: defaultAuth },
|
|
10
|
-
intents: { baseUrl: baseUrl ?? DEFAULT_API_URL, auth: defaultAuth },
|
|
11
|
-
functions: { baseUrl: baseUrl ?? DEFAULT_API_URL, auth: defaultAuth },
|
|
12
|
-
users: { baseUrl: baseUrl ?? DEFAULT_API_URL, auth: defaultAuth },
|
|
9
|
+
balances: { baseUrl: baseUrl ?? DEFAULT_API_URL, auth: defaultAuth, defaultHeaders },
|
|
10
|
+
triggers: { baseUrl: baseUrl ?? DEFAULT_API_URL, auth: defaultAuth, defaultHeaders },
|
|
11
|
+
executions: { baseUrl: baseUrl ?? DEFAULT_API_URL, auth: defaultAuth, defaultHeaders },
|
|
12
|
+
intents: { baseUrl: baseUrl ?? DEFAULT_API_URL, auth: defaultAuth, defaultHeaders },
|
|
13
|
+
functions: { baseUrl: baseUrl ?? DEFAULT_API_URL, auth: defaultAuth, defaultHeaders },
|
|
14
|
+
users: { baseUrl: baseUrl ?? DEFAULT_API_URL, auth: defaultAuth, defaultHeaders },
|
|
13
15
|
...initConfig,
|
|
14
16
|
};
|
|
15
17
|
return coreConfig;
|
|
16
18
|
}
|
|
19
|
+
function getIntegrationHeaders(integration) {
|
|
20
|
+
const headers = {};
|
|
21
|
+
if (integration?.slug)
|
|
22
|
+
headers[shared_1.INTEGRATION_SLUG_HEADER] = integration.slug;
|
|
23
|
+
if (integration?.apiKey)
|
|
24
|
+
headers[shared_1.INTEGRATION_API_KEY_HEADER] = integration.apiKey;
|
|
25
|
+
return Object.keys(headers).length > 0 ? headers : undefined;
|
|
26
|
+
}
|
|
17
27
|
//# sourceMappingURL=config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/client/core/config.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/client/core/config.ts"],"names":[],"mappings":";;AAsBA,8CAkBC;AAxCD,yCAAkF;AAMlF,MAAM,eAAe,GAAG,+BAA+B,CAAA;AAgBvD,SAAgB,iBAAiB,CAC/B,aAAkC,EAAE,EACpC,OAAgB,EAChB,WAA0B,EAC1B,WAA+B;IAE/B,MA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, BearerAuth, type CoreConfig } from './core';
|
|
2
|
+
import { ApiKeyAuth, type AuthStrategy, BearerAuth, type CoreConfig, type IntegrationConfig } from './core';
|
|
3
3
|
import { BalancesClient, ExecutionsClient, FunctionsClient, IntentsClient, TriggersClient, UsersClient } from './domains';
|
|
4
4
|
export * from './core/errors';
|
|
5
5
|
export interface InitOptions {
|
|
6
6
|
domains?: Partial<CoreConfig>;
|
|
7
7
|
baseUrl?: string;
|
|
8
8
|
auth?: AuthStrategy;
|
|
9
|
+
integration?: IntegrationConfig;
|
|
9
10
|
signer?: Signer;
|
|
10
11
|
}
|
|
11
12
|
export declare class Client {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAElC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAElC,OAAO,EACL,UAAU,EACV,KAAK,YAAY,EACjB,UAAU,EACV,KAAK,UAAU,EACf,KAAK,iBAAiB,EAEvB,MAAM,QAAQ,CAAA;AACf,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,cAAc,EACd,WAAW,EACZ,MAAM,WAAW,CAAA;AAElB,cAAc,eAAe,CAAA;AAE7B,MAAM,WAAW,WAAW;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAA;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,YAAY,CAAA;IACnB,WAAW,CAAC,EAAE,iBAAiB,CAAA;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,qBAAa,MAAM;IACjB,SAAgB,QAAQ,EAAE,cAAc,CAAA;IACxC,SAAgB,QAAQ,EAAE,cAAc,CAAA;IACxC,SAAgB,UAAU,EAAE,gBAAgB,CAAA;IAC5C,SAAgB,OAAO,EAAE,aAAa,CAAA;IACtC,SAAgB,SAAS,EAAE,eAAe,CAAA;IAC1C,SAAgB,KAAK,EAAE,WAAW,CAAA;gBAEtB,OAAO,CAAC,EAAE,WAAW;CAelC;AAED,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,CAAA"}
|
package/dist/client/index.js
CHANGED
|
@@ -22,7 +22,7 @@ const domains_1 = require("./domains");
|
|
|
22
22
|
__exportStar(require("./core/errors"), exports);
|
|
23
23
|
class Client {
|
|
24
24
|
constructor(options) {
|
|
25
|
-
const config = (0, core_1.resolveCoreConfig)(options?.domains, options?.baseUrl, options?.auth);
|
|
25
|
+
const config = (0, core_1.resolveCoreConfig)(options?.domains, options?.baseUrl, options?.auth, options?.integration);
|
|
26
26
|
this.balances = new domains_1.BalancesClient(config.balances, options?.signer);
|
|
27
27
|
this.triggers = new domains_1.TriggersClient(config.triggers, options?.signer);
|
|
28
28
|
this.executions = new domains_1.ExecutionsClient(config.executions, options?.signer);
|
package/dist/client/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAEA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAEA,iCAOe;AA6CN,2FAnDP,iBAAU,OAmDO;AAAE,2FAjDnB,iBAAU,OAiDmB;AA5C/B,uCAOkB;AAElB,gDAA6B;AAU7B,MAAa,MAAM;IAQjB,YAAY,OAAqB;QAC/B,MAAM,MAAM,GAAe,IAAA,wBAAiB,EAC1C,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,IAAI,EACb,OAAO,EAAE,WAAW,CACrB,CAAA;QAED,IAAI,CAAC,QAAQ,GAAG,IAAI,wBAAc,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA;QACpE,IAAI,CAAC,QAAQ,GAAG,IAAI,wBAAc,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA;QACpE,IAAI,CAAC,UAAU,GAAG,IAAI,0BAAgB,CAAC,MAAM,CAAC,UAAU,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA;QAC1E,IAAI,CAAC,OAAO,GAAG,IAAI,uBAAa,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA;QACjE,IAAI,CAAC,SAAS,GAAG,IAAI,yBAAe,CAAC,MAAM,CAAC,SAAS,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA;QACvE,IAAI,CAAC,KAAK,GAAG,IAAI,qBAAW,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA;IAC7D,CAAC;CACF;AAvBD,wBAuBC"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export declare const PROTOCOL_DECIMALS = 8;
|
|
2
2
|
export declare const DEFAULT_STRING_MAX_LENGTH = 255;
|
|
3
3
|
export declare const PROTOCOL_EXPLORER_URL = "https://protocol.mimic.fi";
|
|
4
|
+
export declare const INTEGRATION_SLUG_HEADER = "x-integration-slug";
|
|
5
|
+
export declare const INTEGRATION_API_KEY_HEADER = "x-integration-api-key";
|
|
4
6
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/shared/utils/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,IAAI,CAAA;AAElC,eAAO,MAAM,yBAAyB,MAAM,CAAA;AAE5C,eAAO,MAAM,qBAAqB,8BAA8B,CAAA"}
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/shared/utils/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,IAAI,CAAA;AAElC,eAAO,MAAM,yBAAyB,MAAM,CAAA;AAE5C,eAAO,MAAM,qBAAqB,8BAA8B,CAAA;AAEhE,eAAO,MAAM,uBAAuB,uBAAuB,CAAA;AAC3D,eAAO,MAAM,0BAA0B,0BAA0B,CAAA"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PROTOCOL_EXPLORER_URL = exports.DEFAULT_STRING_MAX_LENGTH = exports.PROTOCOL_DECIMALS = void 0;
|
|
3
|
+
exports.INTEGRATION_API_KEY_HEADER = exports.INTEGRATION_SLUG_HEADER = exports.PROTOCOL_EXPLORER_URL = exports.DEFAULT_STRING_MAX_LENGTH = exports.PROTOCOL_DECIMALS = void 0;
|
|
4
4
|
exports.PROTOCOL_DECIMALS = 8;
|
|
5
5
|
exports.DEFAULT_STRING_MAX_LENGTH = 255;
|
|
6
6
|
exports.PROTOCOL_EXPLORER_URL = 'https://protocol.mimic.fi';
|
|
7
|
+
exports.INTEGRATION_SLUG_HEADER = 'x-integration-slug';
|
|
8
|
+
exports.INTEGRATION_API_KEY_HEADER = 'x-integration-api-key';
|
|
7
9
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/shared/utils/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,iBAAiB,GAAG,CAAC,CAAA;AAErB,QAAA,yBAAyB,GAAG,GAAG,CAAA;AAE/B,QAAA,qBAAqB,GAAG,2BAA2B,CAAA"}
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/shared/utils/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,iBAAiB,GAAG,CAAC,CAAA;AAErB,QAAA,yBAAyB,GAAG,GAAG,CAAA;AAE/B,QAAA,qBAAqB,GAAG,2BAA2B,CAAA;AAEnD,QAAA,uBAAuB,GAAG,oBAAoB,CAAA;AAC9C,QAAA,0BAA0B,GAAG,uBAAuB,CAAA"}
|