@otim/sdk-server 0.0.1 → 0.0.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/dist/.tsbuildinfo +1 -1
- package/dist/index.cjs +9 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -3
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +4 -3
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +5 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -142,7 +142,7 @@ var OtimAccount = class {
|
|
|
142
142
|
/**
|
|
143
143
|
* Otim Client for server-side blockchain operations.
|
|
144
144
|
*
|
|
145
|
-
* Provides access to authentication, configuration, delegation, and
|
|
145
|
+
* Provides access to activity, authentication, configuration, delegation, and
|
|
146
146
|
* orchestration services.
|
|
147
147
|
* The client must be initialized before use by calling the init() method.
|
|
148
148
|
|
|
@@ -152,6 +152,7 @@ var OtimServerClient = class {
|
|
|
152
152
|
_defineProperty(this, "apiClient", void 0);
|
|
153
153
|
_defineProperty(this, "account", void 0);
|
|
154
154
|
_defineProperty(this, "context", void 0);
|
|
155
|
+
_defineProperty(this, "activity", void 0);
|
|
155
156
|
_defineProperty(this, "auth", void 0);
|
|
156
157
|
_defineProperty(this, "config", void 0);
|
|
157
158
|
_defineProperty(this, "delegation", void 0);
|
|
@@ -162,6 +163,7 @@ var OtimServerClient = class {
|
|
|
162
163
|
...(0, __otim_sdk_core_account.isApiAccountConfig)(config) ? { sessionToken: config.apiKey } : {}
|
|
163
164
|
});
|
|
164
165
|
this.account = new OtimAccount(config);
|
|
166
|
+
this.activity = new __otim_sdk_core_clients.ActivityClient(this.apiClient);
|
|
165
167
|
this.auth = new __otim_sdk_core_clients.AuthClient(this.apiClient, this.account, this.context);
|
|
166
168
|
this.config = new __otim_sdk_core_clients.ConfigClient(this.apiClient);
|
|
167
169
|
this.delegation = new __otim_sdk_core_clients.DelegationClient(this.apiClient);
|
|
@@ -200,6 +202,12 @@ function createOtimServerClient(config) {
|
|
|
200
202
|
}
|
|
201
203
|
|
|
202
204
|
//#endregion
|
|
205
|
+
Object.defineProperty(exports, 'ActivityClient', {
|
|
206
|
+
enumerable: true,
|
|
207
|
+
get: function () {
|
|
208
|
+
return __otim_sdk_core_clients.ActivityClient;
|
|
209
|
+
}
|
|
210
|
+
});
|
|
203
211
|
Object.defineProperty(exports, 'AuthClient', {
|
|
204
212
|
enumerable: true,
|
|
205
213
|
get: function () {
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["Environment","APIClient","ApiKeyStamper","TurnkeyClient","env","ServerAccountType","exhaustiveCheck: never","config: ServerAccountConfig","AuthClient","ConfigClient","DelegationClient","OrchestrationClient","ServerAccountType"],"sources":["../src/client/api-client.ts","../src/client/utils/asserts.ts","../src/client/server-account.ts","../src/client/server-client.ts","../src/client/create-server-client.ts"],"sourcesContent":["import type { CreateInstanceParameters } from \"@otim/utils/api\";\nimport type { Optional } from \"@otim/utils/helpers\";\n\nimport { Environment, getApiUrl } from \"@otim/sdk-core/config\";\nimport { APIClient, createInstance } from \"@otim/utils/api\";\n\nexport interface CreateServerAPIClientOptions\n extends Omit<CreateInstanceParameters, \"baseURL\"> {\n sessionToken?: Optional<string>;\n environment?: Environment;\n}\n\n/**\n * Creates an API client for server-side requests.\n *\n * Configures the base URL and authentication headers for API communication.\n *\n * @param config - Optional configuration for the API client\n * @returns Configured API client instance\n *\n * @internal\n */\nexport const createServerAPIClient = (\n config?: CreateServerAPIClientOptions,\n) => {\n const {\n sessionToken,\n environment = Environment.Sandbox,\n ...restConfig\n } = config ?? {};\n\n const instance = createInstance({\n baseURL: getApiUrl(environment),\n ...restConfig,\n });\n\n instance.interceptors.request.use(async (requestConfig) => {\n if (sessionToken) {\n requestConfig.headers = requestConfig.headers ?? {};\n\n // If the session token does not start with \"Bearer \", add it.\n const authorizationToken = sessionToken.startsWith(\"Bearer \")\n ? sessionToken\n : `Bearer ${sessionToken}`;\n\n requestConfig.headers.Authorization = authorizationToken;\n }\n\n return requestConfig;\n });\n\n return new APIClient({ instance });\n};\n","export function assertDefined<T>(\n value: T,\n errorMessage: string,\n): asserts value is NonNullable<T> {\n if (value === null || value === undefined) {\n throw new Error(errorMessage);\n }\n}\n","import type {\n ApiAccountConfig,\n OtimAccountSignMessageArgs,\n OtimAccount as OtimAccountType,\n PrivateKeyAccountConfig,\n ServerAccountConfig,\n} from \"@otim/sdk-core/account\";\nimport type { Nullable } from \"@otim/utils/helpers\";\nimport type { Hex } from \"viem\";\n\nimport { ServerAccountType } from \"@otim/sdk-core/account\";\nimport { env, getTurnkeyApiUrl } from \"@otim/sdk-core/config\";\nimport { ApiKeyStamper } from \"@turnkey/api-key-stamper\";\nimport { TurnkeyClient } from \"@turnkey/http\";\nimport { createAccount } from \"@turnkey/viem\";\nimport { privateKeyToAccount } from \"viem/accounts\";\n\nimport { assertDefined } from \"./utils/asserts\";\n\ntype PrimitiveAccount = {\n signMessage: (args: {\n message: string | { raw: Hex | Uint8Array };\n }) => Promise<Hex>;\n};\n\nconst createApiAccount = async (\n config: ApiAccountConfig,\n): Promise<PrimitiveAccount> => {\n const stamper = new ApiKeyStamper({\n apiPublicKey: config.publicKey,\n apiPrivateKey: config.privateKey,\n });\n\n const client = new TurnkeyClient(\n {\n baseUrl: getTurnkeyApiUrl(env.ENVIRONMENT),\n },\n stamper,\n );\n\n const account = await createAccount({\n organizationId: config.appId,\n signWith: \"0xB54c8E6f303627f392884412ED2C84fFaF4779CA\",\n client,\n });\n\n return {\n signMessage: (args) => account.signMessage(args),\n };\n};\n\nconst createPrivateKeyAccount = (\n config: PrivateKeyAccountConfig,\n): PrimitiveAccount => {\n const account = privateKeyToAccount(config.privateKey);\n\n return {\n signMessage: (args) => account.signMessage(args),\n };\n};\n\nconst initializeAccount = async (\n config: ServerAccountConfig,\n): Promise<PrimitiveAccount> => {\n switch (config.type) {\n case ServerAccountType.Api:\n return createApiAccount(config);\n case ServerAccountType.PrivateKey:\n return createPrivateKeyAccount(config);\n default: {\n const exhaustiveCheck: never = config;\n throw new Error(\n `Unsupported account type: \"${(exhaustiveCheck as ServerAccountConfig).type}\". Supported types are: ${Object.values(ServerAccountType).join(\", \")}`,\n );\n }\n }\n};\n\n/**\n * Server-side account implementation for signing operations.\n *\n * Supports both private key and API authentication methods.\n *\n * @internal\n */\nexport class OtimAccount implements OtimAccountType {\n private account: Nullable<PrimitiveAccount> = null;\n private initialized = false;\n\n constructor(private readonly config: ServerAccountConfig) {}\n\n async initialize(): Promise<void> {\n if (this.initialized) {\n throw new Error(\n \"Account already initialized. The initialize() method should only be called once.\",\n );\n }\n\n this.account = await initializeAccount(this.config);\n this.initialized = true;\n }\n\n async signMessage({ message }: OtimAccountSignMessageArgs) {\n assertDefined(\n this.account,\n \"Account not initialized. Call initialize() before using signMessage().\",\n );\n return this.account.signMessage({ message });\n }\n}\n","import type { ServerAccountConfig } from \"@otim/sdk-core/account\";\nimport type { OtimServerClientContext } from \"@otim/sdk-core/context\";\nimport type { APIClient } from \"@otim/utils/api\";\n\nimport {\n createClientContext,\n isApiAccountConfig,\n} from \"@otim/sdk-core/account\";\nimport {\n AuthClient,\n ConfigClient,\n DelegationClient,\n OrchestrationClient,\n} from \"@otim/sdk-core/clients\";\n\nimport { createServerAPIClient } from \"./api-client\";\nimport { OtimAccount } from \"./server-account\";\n\n/**\n * Otim Client for server-side blockchain operations.\n *\n * Provides access to authentication, configuration, delegation, and\n * orchestration services.\n * The client must be initialized before use by calling the init() method.\n\n */\nexport class OtimServerClient {\n private readonly apiClient: APIClient;\n private readonly account: OtimAccount;\n private readonly context: OtimServerClientContext;\n\n readonly auth: AuthClient;\n readonly config: ConfigClient;\n readonly delegation: DelegationClient;\n readonly orchestration: OrchestrationClient;\n\n constructor(config: ServerAccountConfig) {\n this.context = createClientContext(config);\n this.apiClient = createServerAPIClient({\n environment: config.environment,\n ...(isApiAccountConfig(config) ? { sessionToken: config.apiKey } : {}),\n });\n\n this.account = new OtimAccount(config);\n\n this.auth = new AuthClient(this.apiClient, this.account, this.context);\n this.config = new ConfigClient(this.apiClient);\n this.delegation = new DelegationClient(this.apiClient);\n this.orchestration = new OrchestrationClient(\n this.apiClient,\n this.account,\n this.context,\n );\n }\n\n /**\n * Initializes the Otim Client.\n *\n * This method must be called before using any other client methods.\n * It sets up the authentication account and prepares the client for use.\n *\n * @throws {Error} If the account is already initialized\n */\n async init(): Promise<void> {\n await this.account.initialize();\n }\n}\n","import type { Environment } from \"@otim/sdk-core/config\";\n\nimport { ServerAccountType } from \"@otim/sdk-core/account\";\n\nimport { OtimServerClient } from \"./server-client\";\n\n/**\n * Creates an Otim Client for server-side blockchain operations.\n *\n * @param config - Configuration with private key only\n * @returns Configured Otim Client instance\n *\n * @example\n * ```typescript\n * import { Environment } from '@otim/sdk';\n *\n * const client = createOtimServerClient({\n * privateKey: '0x...',\n * environment: Environment.Production,\n * });\n * await client.init();\n * ```\n */\nexport function createOtimServerClient(config: {\n privateKey: `0x${string}`;\n environment?: Environment;\n}): OtimServerClient;\n\n/**\n * Creates an Otim Client for server-side operations with API authentication.\n *\n * @param config - Configuration with API credentials\n * @returns Configured Otim Client instance\n *\n * @example\n * ```typescript\n * import { Environment } from '@otim/sdk';\n *\n * const client = createOtimServerClient({\n * appId: 'your-app-id',\n * privateKey: '0x...',\n * publicKey: 'your-public-key',\n * apiKey: 'your-api-key',\n * environment: Environment.Production,\n * });\n * await client.init();\n * ```\n */\nexport function createOtimServerClient(config: {\n appId: string;\n privateKey: `0x${string}`;\n publicKey: string;\n apiKey?: string;\n environment?: Environment;\n}): OtimServerClient;\n\nexport function createOtimServerClient(config: {\n privateKey?: `0x${string}`;\n publicKey?: string;\n apiKey?: string;\n appId?: string;\n environment?: Environment;\n}): OtimServerClient {\n if (config.appId && config.privateKey && config.publicKey && config.apiKey) {\n return new OtimServerClient({\n type: ServerAccountType.Api,\n appId: config.appId,\n privateKey: config.privateKey,\n publicKey: config.publicKey,\n apiKey: config.apiKey,\n environment: config.environment,\n });\n }\n\n if (config.privateKey) {\n return new OtimServerClient({\n type: ServerAccountType.PrivateKey,\n privateKey: config.privateKey,\n environment: config.environment,\n });\n }\n\n throw new Error(\"Invalid Otim Server Client configuration\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAsBA,MAAa,yBACX,WACG;CACH,MAAM,EACJ,cACA,cAAcA,mCAAY,SAC1B,GAAG,eACD,UAAU,EAAE;CAEhB,MAAM,gDAA0B;EAC9B,+CAAmB,YAAY;EAC/B,GAAG;EACJ,CAAC;AAEF,UAAS,aAAa,QAAQ,IAAI,OAAO,kBAAkB;AACzD,MAAI,cAAc;AAChB,iBAAc,UAAU,cAAc,WAAW,EAAE;GAGnD,MAAM,qBAAqB,aAAa,WAAW,UAAU,GACzD,eACA,UAAU;AAEd,iBAAc,QAAQ,gBAAgB;;AAGxC,SAAO;GACP;AAEF,QAAO,IAAIC,2BAAU,EAAE,UAAU,CAAC;;;;;ACnDpC,SAAgB,cACd,OACA,cACiC;AACjC,KAAI,UAAU,QAAQ,UAAU,OAC9B,OAAM,IAAI,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACoBjC,MAAM,mBAAmB,OACvB,WAC8B;CAC9B,MAAM,UAAU,IAAIC,wCAAc;EAChC,cAAc,OAAO;EACrB,eAAe,OAAO;EACvB,CAAC;CAEF,MAAM,SAAS,IAAIC,6BACjB,EACE,sDAA0BC,2BAAI,YAAY,EAC3C,EACD,QACD;CAED,MAAM,UAAU,wCAAoB;EAClC,gBAAgB,OAAO;EACvB,UAAU;EACV;EACD,CAAC;AAEF,QAAO,EACL,cAAc,SAAS,QAAQ,YAAY,KAAK,EACjD;;AAGH,MAAM,2BACJ,WACqB;CACrB,MAAM,iDAA8B,OAAO,WAAW;AAEtD,QAAO,EACL,cAAc,SAAS,QAAQ,YAAY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;;;;ACRnC,SAAgB,uBAAuB,QAMlB;AACnB,KAAI,OAAO,SAAS,OAAO,cAAc,OAAO,aAAa,OAAO,OAClE,QAAO,IAAI,iBAAiB;EAC1B,MAAMC,0CAAkB;EACxB,OAAO,OAAO;EACd,YAAY,OAAO;EACnB,WAAW,OAAO;EAClB,QAAQ,OAAO;EACf,aAAa,OAAO;EACrB,CAAC;AAGJ,KAAI,OAAO,WACT,QAAO,IAAI,iBAAiB;EAC1B,MAAMA,0CAAkB;EACxB,YAAY,OAAO;EACnB,aAAa,OAAO;EACrB,CAAC;AAGJ,OAAM,IAAI,MAAM,2CAA2C"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["Environment","APIClient","ApiKeyStamper","TurnkeyClient","env","ServerAccountType","exhaustiveCheck: never","config: ServerAccountConfig","ActivityClient","AuthClient","ConfigClient","DelegationClient","OrchestrationClient","ServerAccountType"],"sources":["../src/client/api-client.ts","../src/client/utils/asserts.ts","../src/client/server-account.ts","../src/client/server-client.ts","../src/client/create-server-client.ts"],"sourcesContent":["import type { CreateInstanceParameters } from \"@otim/utils/api\";\nimport type { Optional } from \"@otim/utils/helpers\";\n\nimport { Environment, getApiUrl } from \"@otim/sdk-core/config\";\nimport { APIClient, createInstance } from \"@otim/utils/api\";\n\nexport interface CreateServerAPIClientOptions\n extends Omit<CreateInstanceParameters, \"baseURL\"> {\n sessionToken?: Optional<string>;\n environment?: Environment;\n}\n\n/**\n * Creates an API client for server-side requests.\n *\n * Configures the base URL and authentication headers for API communication.\n *\n * @param config - Optional configuration for the API client\n * @returns Configured API client instance\n *\n * @internal\n */\nexport const createServerAPIClient = (\n config?: CreateServerAPIClientOptions,\n) => {\n const {\n sessionToken,\n environment = Environment.Sandbox,\n ...restConfig\n } = config ?? {};\n\n const instance = createInstance({\n baseURL: getApiUrl(environment),\n ...restConfig,\n });\n\n instance.interceptors.request.use(async (requestConfig) => {\n if (sessionToken) {\n requestConfig.headers = requestConfig.headers ?? {};\n\n // If the session token does not start with \"Bearer \", add it.\n const authorizationToken = sessionToken.startsWith(\"Bearer \")\n ? sessionToken\n : `Bearer ${sessionToken}`;\n\n requestConfig.headers.Authorization = authorizationToken;\n }\n\n return requestConfig;\n });\n\n return new APIClient({ instance });\n};\n","export function assertDefined<T>(\n value: T,\n errorMessage: string,\n): asserts value is NonNullable<T> {\n if (value === null || value === undefined) {\n throw new Error(errorMessage);\n }\n}\n","import type {\n ApiAccountConfig,\n OtimAccountSignMessageArgs,\n OtimAccount as OtimAccountType,\n PrivateKeyAccountConfig,\n ServerAccountConfig,\n} from \"@otim/sdk-core/account\";\nimport type { Nullable } from \"@otim/utils/helpers\";\nimport type { Hex } from \"viem\";\n\nimport { ServerAccountType } from \"@otim/sdk-core/account\";\nimport { env, getTurnkeyApiUrl } from \"@otim/sdk-core/config\";\nimport { ApiKeyStamper } from \"@turnkey/api-key-stamper\";\nimport { TurnkeyClient } from \"@turnkey/http\";\nimport { createAccount } from \"@turnkey/viem\";\nimport { privateKeyToAccount } from \"viem/accounts\";\n\nimport { assertDefined } from \"./utils/asserts\";\n\ntype PrimitiveAccount = {\n signMessage: (args: {\n message: string | { raw: Hex | Uint8Array };\n }) => Promise<Hex>;\n};\n\nconst createApiAccount = async (\n config: ApiAccountConfig,\n): Promise<PrimitiveAccount> => {\n const stamper = new ApiKeyStamper({\n apiPublicKey: config.publicKey,\n apiPrivateKey: config.privateKey,\n });\n\n const client = new TurnkeyClient(\n {\n baseUrl: getTurnkeyApiUrl(env.ENVIRONMENT),\n },\n stamper,\n );\n\n const account = await createAccount({\n organizationId: config.appId,\n signWith: \"0xB54c8E6f303627f392884412ED2C84fFaF4779CA\",\n client,\n });\n\n return {\n signMessage: (args) => account.signMessage(args),\n };\n};\n\nconst createPrivateKeyAccount = (\n config: PrivateKeyAccountConfig,\n): PrimitiveAccount => {\n const account = privateKeyToAccount(config.privateKey);\n\n return {\n signMessage: (args) => account.signMessage(args),\n };\n};\n\nconst initializeAccount = async (\n config: ServerAccountConfig,\n): Promise<PrimitiveAccount> => {\n switch (config.type) {\n case ServerAccountType.Api:\n return createApiAccount(config);\n case ServerAccountType.PrivateKey:\n return createPrivateKeyAccount(config);\n default: {\n const exhaustiveCheck: never = config;\n throw new Error(\n `Unsupported account type: \"${(exhaustiveCheck as ServerAccountConfig).type}\". Supported types are: ${Object.values(ServerAccountType).join(\", \")}`,\n );\n }\n }\n};\n\n/**\n * Server-side account implementation for signing operations.\n *\n * Supports both private key and API authentication methods.\n *\n * @internal\n */\nexport class OtimAccount implements OtimAccountType {\n private account: Nullable<PrimitiveAccount> = null;\n private initialized = false;\n\n constructor(private readonly config: ServerAccountConfig) {}\n\n async initialize(): Promise<void> {\n if (this.initialized) {\n throw new Error(\n \"Account already initialized. The initialize() method should only be called once.\",\n );\n }\n\n this.account = await initializeAccount(this.config);\n this.initialized = true;\n }\n\n async signMessage({ message }: OtimAccountSignMessageArgs) {\n assertDefined(\n this.account,\n \"Account not initialized. Call initialize() before using signMessage().\",\n );\n return this.account.signMessage({ message });\n }\n}\n","import type { ServerAccountConfig } from \"@otim/sdk-core/account\";\nimport type { OtimServerClientContext } from \"@otim/sdk-core/context\";\nimport type { APIClient } from \"@otim/utils/api\";\n\nimport {\n createClientContext,\n isApiAccountConfig,\n} from \"@otim/sdk-core/account\";\nimport {\n ActivityClient,\n AuthClient,\n ConfigClient,\n DelegationClient,\n OrchestrationClient,\n} from \"@otim/sdk-core/clients\";\n\nimport { createServerAPIClient } from \"./api-client\";\nimport { OtimAccount } from \"./server-account\";\n\n/**\n * Otim Client for server-side blockchain operations.\n *\n * Provides access to activity, authentication, configuration, delegation, and\n * orchestration services.\n * The client must be initialized before use by calling the init() method.\n\n */\nexport class OtimServerClient {\n private readonly apiClient: APIClient;\n private readonly account: OtimAccount;\n private readonly context: OtimServerClientContext;\n\n readonly activity: ActivityClient;\n readonly auth: AuthClient;\n readonly config: ConfigClient;\n readonly delegation: DelegationClient;\n readonly orchestration: OrchestrationClient;\n\n constructor(config: ServerAccountConfig) {\n this.context = createClientContext(config);\n this.apiClient = createServerAPIClient({\n environment: config.environment,\n ...(isApiAccountConfig(config) ? { sessionToken: config.apiKey } : {}),\n });\n\n this.account = new OtimAccount(config);\n\n this.activity = new ActivityClient(this.apiClient);\n this.auth = new AuthClient(this.apiClient, this.account, this.context);\n this.config = new ConfigClient(this.apiClient);\n this.delegation = new DelegationClient(this.apiClient);\n this.orchestration = new OrchestrationClient(\n this.apiClient,\n this.account,\n this.context,\n );\n }\n\n /**\n * Initializes the Otim Client.\n *\n * This method must be called before using any other client methods.\n * It sets up the authentication account and prepares the client for use.\n *\n * @throws {Error} If the account is already initialized\n */\n async init(): Promise<void> {\n await this.account.initialize();\n }\n}\n","import type { Environment } from \"@otim/sdk-core/config\";\n\nimport { ServerAccountType } from \"@otim/sdk-core/account\";\n\nimport { OtimServerClient } from \"./server-client\";\n\n/**\n * Creates an Otim Client for server-side blockchain operations.\n *\n * @param config - Configuration with private key only\n * @returns Configured Otim Client instance\n *\n * @example\n * ```typescript\n * import { Environment } from '@otim/sdk';\n *\n * const client = createOtimServerClient({\n * privateKey: '0x...',\n * environment: Environment.Production,\n * });\n * await client.init();\n * ```\n */\nexport function createOtimServerClient(config: {\n privateKey: `0x${string}`;\n environment?: Environment;\n}): OtimServerClient;\n\n/**\n * Creates an Otim Client for server-side operations with API authentication.\n *\n * @param config - Configuration with API credentials\n * @returns Configured Otim Client instance\n *\n * @example\n * ```typescript\n * import { Environment } from '@otim/sdk';\n *\n * const client = createOtimServerClient({\n * appId: 'your-app-id',\n * privateKey: '0x...',\n * publicKey: 'your-public-key',\n * apiKey: 'your-api-key',\n * environment: Environment.Production,\n * });\n * await client.init();\n * ```\n */\nexport function createOtimServerClient(config: {\n appId: string;\n privateKey: `0x${string}`;\n publicKey: string;\n apiKey?: string;\n environment?: Environment;\n}): OtimServerClient;\n\nexport function createOtimServerClient(config: {\n privateKey?: `0x${string}`;\n publicKey?: string;\n apiKey?: string;\n appId?: string;\n environment?: Environment;\n}): OtimServerClient {\n if (config.appId && config.privateKey && config.publicKey && config.apiKey) {\n return new OtimServerClient({\n type: ServerAccountType.Api,\n appId: config.appId,\n privateKey: config.privateKey,\n publicKey: config.publicKey,\n apiKey: config.apiKey,\n environment: config.environment,\n });\n }\n\n if (config.privateKey) {\n return new OtimServerClient({\n type: ServerAccountType.PrivateKey,\n privateKey: config.privateKey,\n environment: config.environment,\n });\n }\n\n throw new Error(\"Invalid Otim Server Client configuration\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAsBA,MAAa,yBACX,WACG;CACH,MAAM,EACJ,cACA,cAAcA,mCAAY,SAC1B,GAAG,eACD,UAAU,EAAE;CAEhB,MAAM,gDAA0B;EAC9B,+CAAmB,YAAY;EAC/B,GAAG;EACJ,CAAC;AAEF,UAAS,aAAa,QAAQ,IAAI,OAAO,kBAAkB;AACzD,MAAI,cAAc;AAChB,iBAAc,UAAU,cAAc,WAAW,EAAE;GAGnD,MAAM,qBAAqB,aAAa,WAAW,UAAU,GACzD,eACA,UAAU;AAEd,iBAAc,QAAQ,gBAAgB;;AAGxC,SAAO;GACP;AAEF,QAAO,IAAIC,2BAAU,EAAE,UAAU,CAAC;;;;;ACnDpC,SAAgB,cACd,OACA,cACiC;AACjC,KAAI,UAAU,QAAQ,UAAU,OAC9B,OAAM,IAAI,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACoBjC,MAAM,mBAAmB,OACvB,WAC8B;CAC9B,MAAM,UAAU,IAAIC,wCAAc;EAChC,cAAc,OAAO;EACrB,eAAe,OAAO;EACvB,CAAC;CAEF,MAAM,SAAS,IAAIC,6BACjB,EACE,sDAA0BC,2BAAI,YAAY,EAC3C,EACD,QACD;CAED,MAAM,UAAU,wCAAoB;EAClC,gBAAgB,OAAO;EACvB,UAAU;EACV;EACD,CAAC;AAEF,QAAO,EACL,cAAc,SAAS,QAAQ,YAAY,KAAK,EACjD;;AAGH,MAAM,2BACJ,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AACtD,OAAK,gBAAgB,IAAIC,4CACvB,KAAK,WACL,KAAK,SACL,KAAK,QACN;;;;;;;;;;CAWH,MAAM,OAAsB;AAC1B,QAAM,KAAK,QAAQ,YAAY;;;;;;ACXnC,SAAgB,uBAAuB,QAMlB;AACnB,KAAI,OAAO,SAAS,OAAO,cAAc,OAAO,aAAa,OAAO,OAClE,QAAO,IAAI,iBAAiB;EAC1B,MAAMC,0CAAkB;EACxB,OAAO,OAAO;EACd,YAAY,OAAO;EACnB,WAAW,OAAO;EAClB,QAAQ,OAAO;EACf,aAAa,OAAO;EACrB,CAAC;AAGJ,KAAI,OAAO,WACT,QAAO,IAAI,iBAAiB;EAC1B,MAAMA,0CAAkB;EACxB,YAAY,OAAO;EACnB,aAAa,OAAO;EACrB,CAAC;AAGJ,OAAM,IAAI,MAAM,2CAA2C"}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ApiAccountConfig, OtimAccount, PrivateKeyAccountConfig, ServerAccountConfig, ServerAccountConfig as ServerAccountConfig$1, ServerAccountType } from "@otim/sdk-core/account";
|
|
2
2
|
import { Environment, Environment as Environment$1, EnvironmentType } from "@otim/sdk-core/config";
|
|
3
3
|
import { OtimServerClientContext } from "@otim/sdk-core/context";
|
|
4
|
-
import { ActivatePaymentRequestParams, AuthClient, AuthClient as AuthClient$1, ConfigClient, ConfigClient as ConfigClient$1, CreatePaymentRequestParameters, CreatePaymentRequestResponse, DelegationClient, DelegationClient as DelegationClient$1, OrchestrationClient, OrchestrationClient as OrchestrationClient$1, PaymentRequestsClient } from "@otim/sdk-core/clients";
|
|
4
|
+
import { ActivatePaymentRequestParams, ActivityClient, ActivityClient as ActivityClient$1, AuthClient, AuthClient as AuthClient$1, ConfigClient, ConfigClient as ConfigClient$1, CreatePaymentRequestParameters, CreatePaymentRequestResponse, DelegationClient, DelegationClient as DelegationClient$1, OrchestrationClient, OrchestrationClient as OrchestrationClient$1, PaymentRequestsClient } from "@otim/sdk-core/clients";
|
|
5
5
|
import { allSupportedChains as chains } from "@otim/utils/chains";
|
|
6
6
|
|
|
7
7
|
//#region src/client/server-client.d.ts
|
|
@@ -9,7 +9,7 @@ import { allSupportedChains as chains } from "@otim/utils/chains";
|
|
|
9
9
|
/**
|
|
10
10
|
* Otim Client for server-side blockchain operations.
|
|
11
11
|
*
|
|
12
|
-
* Provides access to authentication, configuration, delegation, and
|
|
12
|
+
* Provides access to activity, authentication, configuration, delegation, and
|
|
13
13
|
* orchestration services.
|
|
14
14
|
* The client must be initialized before use by calling the init() method.
|
|
15
15
|
|
|
@@ -18,6 +18,7 @@ declare class OtimServerClient {
|
|
|
18
18
|
private readonly apiClient;
|
|
19
19
|
private readonly account;
|
|
20
20
|
private readonly context;
|
|
21
|
+
readonly activity: ActivityClient$1;
|
|
21
22
|
readonly auth: AuthClient$1;
|
|
22
23
|
readonly config: ConfigClient$1;
|
|
23
24
|
readonly delegation: DelegationClient$1;
|
|
@@ -84,5 +85,5 @@ declare function createOtimServerClient(config: {
|
|
|
84
85
|
environment?: Environment$1;
|
|
85
86
|
}): OtimServerClient;
|
|
86
87
|
//#endregion
|
|
87
|
-
export { type ActivatePaymentRequestParams, type ApiAccountConfig, AuthClient, ConfigClient, type CreatePaymentRequestParameters, type CreatePaymentRequestResponse, DelegationClient, Environment, type EnvironmentType, OrchestrationClient, type OtimAccount, OtimServerClient, type OtimServerClientContext, PaymentRequestsClient, type PrivateKeyAccountConfig, type ServerAccountConfig, type ServerAccountType, chains, createOtimServerClient };
|
|
88
|
+
export { type ActivatePaymentRequestParams, ActivityClient, type ApiAccountConfig, AuthClient, ConfigClient, type CreatePaymentRequestParameters, type CreatePaymentRequestResponse, DelegationClient, Environment, type EnvironmentType, OrchestrationClient, type OtimAccount, OtimServerClient, type OtimServerClientContext, PaymentRequestsClient, type PrivateKeyAccountConfig, type ServerAccountConfig, type ServerAccountType, chains, createOtimServerClient };
|
|
88
89
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/client/server-client.ts","../src/client/create-server-client.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/client/server-client.ts","../src/client/create-server-client.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;AA2BA;;;AAOmB,cAPN,gBAAA,CAOM;EACI,iBAAA,SAAA;EACG,iBAAA,OAAA;EAEJ,iBAAA,OAAA;EA4BN,SAAA,QAAA,EAlCK,gBAkCL;EAAO,SAAA,IAAA,EAjCN,YAiCM;mBAhCJ;uBACI;0BACG;ECbV,WAAA,CAAA,MAAA,EDeM,qBCbN;EAuBA;;;;;;;;UDkBA;;;;;;;;;AAvChB;;;;;;;;;;;;ACJgB,iBAAA,sBAAA,CAEA,MAAA,EACZ;EAsBY,UAAA,EAAA,KAAA,MAAA,EAAsB;gBAvBtB;IACZ;;;;;;;;;;;;;;;;;;;;;iBAsBY,sBAAA;;;;;gBAKA;IACZ"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Environment, Environment as Environment$1, EnvironmentType } from "@otim/sdk-core/config";
|
|
2
|
-
import { ActivatePaymentRequestParams, AuthClient, AuthClient as AuthClient$1, ConfigClient, ConfigClient as ConfigClient$1, CreatePaymentRequestParameters, CreatePaymentRequestResponse, DelegationClient, DelegationClient as DelegationClient$1, OrchestrationClient, OrchestrationClient as OrchestrationClient$1, PaymentRequestsClient } from "@otim/sdk-core/clients";
|
|
2
|
+
import { ActivatePaymentRequestParams, ActivityClient, ActivityClient as ActivityClient$1, AuthClient, AuthClient as AuthClient$1, ConfigClient, ConfigClient as ConfigClient$1, CreatePaymentRequestParameters, CreatePaymentRequestResponse, DelegationClient, DelegationClient as DelegationClient$1, OrchestrationClient, OrchestrationClient as OrchestrationClient$1, PaymentRequestsClient } from "@otim/sdk-core/clients";
|
|
3
3
|
import { ApiAccountConfig, OtimAccount, PrivateKeyAccountConfig, ServerAccountConfig, ServerAccountConfig as ServerAccountConfig$1, ServerAccountType } from "@otim/sdk-core/account";
|
|
4
4
|
import { allSupportedChains as chains } from "@otim/utils/chains";
|
|
5
5
|
import { OtimServerClientContext } from "@otim/sdk-core/context";
|
|
@@ -9,7 +9,7 @@ import { OtimServerClientContext } from "@otim/sdk-core/context";
|
|
|
9
9
|
/**
|
|
10
10
|
* Otim Client for server-side blockchain operations.
|
|
11
11
|
*
|
|
12
|
-
* Provides access to authentication, configuration, delegation, and
|
|
12
|
+
* Provides access to activity, authentication, configuration, delegation, and
|
|
13
13
|
* orchestration services.
|
|
14
14
|
* The client must be initialized before use by calling the init() method.
|
|
15
15
|
|
|
@@ -18,6 +18,7 @@ declare class OtimServerClient {
|
|
|
18
18
|
private readonly apiClient;
|
|
19
19
|
private readonly account;
|
|
20
20
|
private readonly context;
|
|
21
|
+
readonly activity: ActivityClient$1;
|
|
21
22
|
readonly auth: AuthClient$1;
|
|
22
23
|
readonly config: ConfigClient$1;
|
|
23
24
|
readonly delegation: DelegationClient$1;
|
|
@@ -84,5 +85,5 @@ declare function createOtimServerClient(config: {
|
|
|
84
85
|
environment?: Environment$1;
|
|
85
86
|
}): OtimServerClient;
|
|
86
87
|
//#endregion
|
|
87
|
-
export { type ActivatePaymentRequestParams, type ApiAccountConfig, AuthClient, ConfigClient, type CreatePaymentRequestParameters, type CreatePaymentRequestResponse, DelegationClient, Environment, type EnvironmentType, OrchestrationClient, type OtimAccount, OtimServerClient, type OtimServerClientContext, PaymentRequestsClient, type PrivateKeyAccountConfig, type ServerAccountConfig, type ServerAccountType, chains, createOtimServerClient };
|
|
88
|
+
export { type ActivatePaymentRequestParams, ActivityClient, type ApiAccountConfig, AuthClient, ConfigClient, type CreatePaymentRequestParameters, type CreatePaymentRequestResponse, DelegationClient, Environment, type EnvironmentType, OrchestrationClient, type OtimAccount, OtimServerClient, type OtimServerClientContext, PaymentRequestsClient, type PrivateKeyAccountConfig, type ServerAccountConfig, type ServerAccountType, chains, createOtimServerClient };
|
|
88
89
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/client/server-client.ts","../src/client/create-server-client.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/client/server-client.ts","../src/client/create-server-client.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;AA2BA;;;AAOmB,cAPN,gBAAA,CAOM;EACI,iBAAA,SAAA;EACG,iBAAA,OAAA;EAEJ,iBAAA,OAAA;EA4BN,SAAA,QAAA,EAlCK,gBAkCL;EAAO,SAAA,IAAA,EAjCN,YAiCM;mBAhCJ;uBACI;0BACG;ECbV,WAAA,CAAA,MAAA,EDeM,qBCbN;EAuBA;;;;;;;;UDkBA;;;;;;;;;AAvChB;;;;;;;;;;;;ACJgB,iBAAA,sBAAA,CAEA,MAAA,EACZ;EAsBY,UAAA,EAAA,KAAA,MAAA,EAAsB;gBAvBtB;IACZ;;;;;;;;;;;;;;;;;;;;;iBAsBY,sBAAA;;;;;gBAKA;IACZ"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Environment, Environment as Environment$1, env, getApiUrl, getTurnkeyApiUrl } from "@otim/sdk-core/config";
|
|
2
|
-
import { AuthClient, AuthClient as AuthClient$1, ConfigClient, ConfigClient as ConfigClient$1, DelegationClient, DelegationClient as DelegationClient$1, OrchestrationClient, OrchestrationClient as OrchestrationClient$1, PaymentRequestsClient } from "@otim/sdk-core/clients";
|
|
2
|
+
import { ActivityClient, ActivityClient as ActivityClient$1, AuthClient, AuthClient as AuthClient$1, ConfigClient, ConfigClient as ConfigClient$1, DelegationClient, DelegationClient as DelegationClient$1, OrchestrationClient, OrchestrationClient as OrchestrationClient$1, PaymentRequestsClient } from "@otim/sdk-core/clients";
|
|
3
3
|
import { ServerAccountType, createClientContext, isApiAccountConfig } from "@otim/sdk-core/account";
|
|
4
4
|
import { APIClient, createInstance } from "@otim/utils/api";
|
|
5
5
|
import { ApiKeyStamper } from "@turnkey/api-key-stamper";
|
|
@@ -142,7 +142,7 @@ var OtimAccount = class {
|
|
|
142
142
|
/**
|
|
143
143
|
* Otim Client for server-side blockchain operations.
|
|
144
144
|
*
|
|
145
|
-
* Provides access to authentication, configuration, delegation, and
|
|
145
|
+
* Provides access to activity, authentication, configuration, delegation, and
|
|
146
146
|
* orchestration services.
|
|
147
147
|
* The client must be initialized before use by calling the init() method.
|
|
148
148
|
|
|
@@ -152,6 +152,7 @@ var OtimServerClient = class {
|
|
|
152
152
|
_defineProperty(this, "apiClient", void 0);
|
|
153
153
|
_defineProperty(this, "account", void 0);
|
|
154
154
|
_defineProperty(this, "context", void 0);
|
|
155
|
+
_defineProperty(this, "activity", void 0);
|
|
155
156
|
_defineProperty(this, "auth", void 0);
|
|
156
157
|
_defineProperty(this, "config", void 0);
|
|
157
158
|
_defineProperty(this, "delegation", void 0);
|
|
@@ -162,6 +163,7 @@ var OtimServerClient = class {
|
|
|
162
163
|
...isApiAccountConfig(config) ? { sessionToken: config.apiKey } : {}
|
|
163
164
|
});
|
|
164
165
|
this.account = new OtimAccount(config);
|
|
166
|
+
this.activity = new ActivityClient$1(this.apiClient);
|
|
165
167
|
this.auth = new AuthClient$1(this.apiClient, this.account, this.context);
|
|
166
168
|
this.config = new ConfigClient$1(this.apiClient);
|
|
167
169
|
this.delegation = new DelegationClient$1(this.apiClient);
|
|
@@ -200,5 +202,5 @@ function createOtimServerClient(config) {
|
|
|
200
202
|
}
|
|
201
203
|
|
|
202
204
|
//#endregion
|
|
203
|
-
export { AuthClient, ConfigClient, DelegationClient, Environment, OrchestrationClient, OtimServerClient, PaymentRequestsClient, chains, createOtimServerClient };
|
|
205
|
+
export { ActivityClient, AuthClient, ConfigClient, DelegationClient, Environment, OrchestrationClient, OtimServerClient, PaymentRequestsClient, chains, createOtimServerClient };
|
|
204
206
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["Environment","exhaustiveCheck: never","config: ServerAccountConfig","AuthClient","ConfigClient","DelegationClient","OrchestrationClient"],"sources":["../src/client/api-client.ts","../src/client/utils/asserts.ts","../src/client/server-account.ts","../src/client/server-client.ts","../src/client/create-server-client.ts"],"sourcesContent":["import type { CreateInstanceParameters } from \"@otim/utils/api\";\nimport type { Optional } from \"@otim/utils/helpers\";\n\nimport { Environment, getApiUrl } from \"@otim/sdk-core/config\";\nimport { APIClient, createInstance } from \"@otim/utils/api\";\n\nexport interface CreateServerAPIClientOptions\n extends Omit<CreateInstanceParameters, \"baseURL\"> {\n sessionToken?: Optional<string>;\n environment?: Environment;\n}\n\n/**\n * Creates an API client for server-side requests.\n *\n * Configures the base URL and authentication headers for API communication.\n *\n * @param config - Optional configuration for the API client\n * @returns Configured API client instance\n *\n * @internal\n */\nexport const createServerAPIClient = (\n config?: CreateServerAPIClientOptions,\n) => {\n const {\n sessionToken,\n environment = Environment.Sandbox,\n ...restConfig\n } = config ?? {};\n\n const instance = createInstance({\n baseURL: getApiUrl(environment),\n ...restConfig,\n });\n\n instance.interceptors.request.use(async (requestConfig) => {\n if (sessionToken) {\n requestConfig.headers = requestConfig.headers ?? {};\n\n // If the session token does not start with \"Bearer \", add it.\n const authorizationToken = sessionToken.startsWith(\"Bearer \")\n ? sessionToken\n : `Bearer ${sessionToken}`;\n\n requestConfig.headers.Authorization = authorizationToken;\n }\n\n return requestConfig;\n });\n\n return new APIClient({ instance });\n};\n","export function assertDefined<T>(\n value: T,\n errorMessage: string,\n): asserts value is NonNullable<T> {\n if (value === null || value === undefined) {\n throw new Error(errorMessage);\n }\n}\n","import type {\n ApiAccountConfig,\n OtimAccountSignMessageArgs,\n OtimAccount as OtimAccountType,\n PrivateKeyAccountConfig,\n ServerAccountConfig,\n} from \"@otim/sdk-core/account\";\nimport type { Nullable } from \"@otim/utils/helpers\";\nimport type { Hex } from \"viem\";\n\nimport { ServerAccountType } from \"@otim/sdk-core/account\";\nimport { env, getTurnkeyApiUrl } from \"@otim/sdk-core/config\";\nimport { ApiKeyStamper } from \"@turnkey/api-key-stamper\";\nimport { TurnkeyClient } from \"@turnkey/http\";\nimport { createAccount } from \"@turnkey/viem\";\nimport { privateKeyToAccount } from \"viem/accounts\";\n\nimport { assertDefined } from \"./utils/asserts\";\n\ntype PrimitiveAccount = {\n signMessage: (args: {\n message: string | { raw: Hex | Uint8Array };\n }) => Promise<Hex>;\n};\n\nconst createApiAccount = async (\n config: ApiAccountConfig,\n): Promise<PrimitiveAccount> => {\n const stamper = new ApiKeyStamper({\n apiPublicKey: config.publicKey,\n apiPrivateKey: config.privateKey,\n });\n\n const client = new TurnkeyClient(\n {\n baseUrl: getTurnkeyApiUrl(env.ENVIRONMENT),\n },\n stamper,\n );\n\n const account = await createAccount({\n organizationId: config.appId,\n signWith: \"0xB54c8E6f303627f392884412ED2C84fFaF4779CA\",\n client,\n });\n\n return {\n signMessage: (args) => account.signMessage(args),\n };\n};\n\nconst createPrivateKeyAccount = (\n config: PrivateKeyAccountConfig,\n): PrimitiveAccount => {\n const account = privateKeyToAccount(config.privateKey);\n\n return {\n signMessage: (args) => account.signMessage(args),\n };\n};\n\nconst initializeAccount = async (\n config: ServerAccountConfig,\n): Promise<PrimitiveAccount> => {\n switch (config.type) {\n case ServerAccountType.Api:\n return createApiAccount(config);\n case ServerAccountType.PrivateKey:\n return createPrivateKeyAccount(config);\n default: {\n const exhaustiveCheck: never = config;\n throw new Error(\n `Unsupported account type: \"${(exhaustiveCheck as ServerAccountConfig).type}\". Supported types are: ${Object.values(ServerAccountType).join(\", \")}`,\n );\n }\n }\n};\n\n/**\n * Server-side account implementation for signing operations.\n *\n * Supports both private key and API authentication methods.\n *\n * @internal\n */\nexport class OtimAccount implements OtimAccountType {\n private account: Nullable<PrimitiveAccount> = null;\n private initialized = false;\n\n constructor(private readonly config: ServerAccountConfig) {}\n\n async initialize(): Promise<void> {\n if (this.initialized) {\n throw new Error(\n \"Account already initialized. The initialize() method should only be called once.\",\n );\n }\n\n this.account = await initializeAccount(this.config);\n this.initialized = true;\n }\n\n async signMessage({ message }: OtimAccountSignMessageArgs) {\n assertDefined(\n this.account,\n \"Account not initialized. Call initialize() before using signMessage().\",\n );\n return this.account.signMessage({ message });\n }\n}\n","import type { ServerAccountConfig } from \"@otim/sdk-core/account\";\nimport type { OtimServerClientContext } from \"@otim/sdk-core/context\";\nimport type { APIClient } from \"@otim/utils/api\";\n\nimport {\n createClientContext,\n isApiAccountConfig,\n} from \"@otim/sdk-core/account\";\nimport {\n AuthClient,\n ConfigClient,\n DelegationClient,\n OrchestrationClient,\n} from \"@otim/sdk-core/clients\";\n\nimport { createServerAPIClient } from \"./api-client\";\nimport { OtimAccount } from \"./server-account\";\n\n/**\n * Otim Client for server-side blockchain operations.\n *\n * Provides access to authentication, configuration, delegation, and\n * orchestration services.\n * The client must be initialized before use by calling the init() method.\n\n */\nexport class OtimServerClient {\n private readonly apiClient: APIClient;\n private readonly account: OtimAccount;\n private readonly context: OtimServerClientContext;\n\n readonly auth: AuthClient;\n readonly config: ConfigClient;\n readonly delegation: DelegationClient;\n readonly orchestration: OrchestrationClient;\n\n constructor(config: ServerAccountConfig) {\n this.context = createClientContext(config);\n this.apiClient = createServerAPIClient({\n environment: config.environment,\n ...(isApiAccountConfig(config) ? { sessionToken: config.apiKey } : {}),\n });\n\n this.account = new OtimAccount(config);\n\n this.auth = new AuthClient(this.apiClient, this.account, this.context);\n this.config = new ConfigClient(this.apiClient);\n this.delegation = new DelegationClient(this.apiClient);\n this.orchestration = new OrchestrationClient(\n this.apiClient,\n this.account,\n this.context,\n );\n }\n\n /**\n * Initializes the Otim Client.\n *\n * This method must be called before using any other client methods.\n * It sets up the authentication account and prepares the client for use.\n *\n * @throws {Error} If the account is already initialized\n */\n async init(): Promise<void> {\n await this.account.initialize();\n }\n}\n","import type { Environment } from \"@otim/sdk-core/config\";\n\nimport { ServerAccountType } from \"@otim/sdk-core/account\";\n\nimport { OtimServerClient } from \"./server-client\";\n\n/**\n * Creates an Otim Client for server-side blockchain operations.\n *\n * @param config - Configuration with private key only\n * @returns Configured Otim Client instance\n *\n * @example\n * ```typescript\n * import { Environment } from '@otim/sdk';\n *\n * const client = createOtimServerClient({\n * privateKey: '0x...',\n * environment: Environment.Production,\n * });\n * await client.init();\n * ```\n */\nexport function createOtimServerClient(config: {\n privateKey: `0x${string}`;\n environment?: Environment;\n}): OtimServerClient;\n\n/**\n * Creates an Otim Client for server-side operations with API authentication.\n *\n * @param config - Configuration with API credentials\n * @returns Configured Otim Client instance\n *\n * @example\n * ```typescript\n * import { Environment } from '@otim/sdk';\n *\n * const client = createOtimServerClient({\n * appId: 'your-app-id',\n * privateKey: '0x...',\n * publicKey: 'your-public-key',\n * apiKey: 'your-api-key',\n * environment: Environment.Production,\n * });\n * await client.init();\n * ```\n */\nexport function createOtimServerClient(config: {\n appId: string;\n privateKey: `0x${string}`;\n publicKey: string;\n apiKey?: string;\n environment?: Environment;\n}): OtimServerClient;\n\nexport function createOtimServerClient(config: {\n privateKey?: `0x${string}`;\n publicKey?: string;\n apiKey?: string;\n appId?: string;\n environment?: Environment;\n}): OtimServerClient {\n if (config.appId && config.privateKey && config.publicKey && config.apiKey) {\n return new OtimServerClient({\n type: ServerAccountType.Api,\n appId: config.appId,\n privateKey: config.privateKey,\n publicKey: config.publicKey,\n apiKey: config.apiKey,\n environment: config.environment,\n });\n }\n\n if (config.privateKey) {\n return new OtimServerClient({\n type: ServerAccountType.PrivateKey,\n privateKey: config.privateKey,\n environment: config.environment,\n });\n }\n\n throw new Error(\"Invalid Otim Server Client configuration\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAsBA,MAAa,yBACX,WACG;CACH,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,WACT,QAAO,IAAI,iBAAiB;EAC1B,MAAM,kBAAkB;EACxB,YAAY,OAAO;EACnB,aAAa,OAAO;EACrB,CAAC;AAGJ,OAAM,IAAI,MAAM,2CAA2C"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["Environment","exhaustiveCheck: never","config: ServerAccountConfig","ActivityClient","AuthClient","ConfigClient","DelegationClient","OrchestrationClient"],"sources":["../src/client/api-client.ts","../src/client/utils/asserts.ts","../src/client/server-account.ts","../src/client/server-client.ts","../src/client/create-server-client.ts"],"sourcesContent":["import type { CreateInstanceParameters } from \"@otim/utils/api\";\nimport type { Optional } from \"@otim/utils/helpers\";\n\nimport { Environment, getApiUrl } from \"@otim/sdk-core/config\";\nimport { APIClient, createInstance } from \"@otim/utils/api\";\n\nexport interface CreateServerAPIClientOptions\n extends Omit<CreateInstanceParameters, \"baseURL\"> {\n sessionToken?: Optional<string>;\n environment?: Environment;\n}\n\n/**\n * Creates an API client for server-side requests.\n *\n * Configures the base URL and authentication headers for API communication.\n *\n * @param config - Optional configuration for the API client\n * @returns Configured API client instance\n *\n * @internal\n */\nexport const createServerAPIClient = (\n config?: CreateServerAPIClientOptions,\n) => {\n const {\n sessionToken,\n environment = Environment.Sandbox,\n ...restConfig\n } = config ?? {};\n\n const instance = createInstance({\n baseURL: getApiUrl(environment),\n ...restConfig,\n });\n\n instance.interceptors.request.use(async (requestConfig) => {\n if (sessionToken) {\n requestConfig.headers = requestConfig.headers ?? {};\n\n // If the session token does not start with \"Bearer \", add it.\n const authorizationToken = sessionToken.startsWith(\"Bearer \")\n ? sessionToken\n : `Bearer ${sessionToken}`;\n\n requestConfig.headers.Authorization = authorizationToken;\n }\n\n return requestConfig;\n });\n\n return new APIClient({ instance });\n};\n","export function assertDefined<T>(\n value: T,\n errorMessage: string,\n): asserts value is NonNullable<T> {\n if (value === null || value === undefined) {\n throw new Error(errorMessage);\n }\n}\n","import type {\n ApiAccountConfig,\n OtimAccountSignMessageArgs,\n OtimAccount as OtimAccountType,\n PrivateKeyAccountConfig,\n ServerAccountConfig,\n} from \"@otim/sdk-core/account\";\nimport type { Nullable } from \"@otim/utils/helpers\";\nimport type { Hex } from \"viem\";\n\nimport { ServerAccountType } from \"@otim/sdk-core/account\";\nimport { env, getTurnkeyApiUrl } from \"@otim/sdk-core/config\";\nimport { ApiKeyStamper } from \"@turnkey/api-key-stamper\";\nimport { TurnkeyClient } from \"@turnkey/http\";\nimport { createAccount } from \"@turnkey/viem\";\nimport { privateKeyToAccount } from \"viem/accounts\";\n\nimport { assertDefined } from \"./utils/asserts\";\n\ntype PrimitiveAccount = {\n signMessage: (args: {\n message: string | { raw: Hex | Uint8Array };\n }) => Promise<Hex>;\n};\n\nconst createApiAccount = async (\n config: ApiAccountConfig,\n): Promise<PrimitiveAccount> => {\n const stamper = new ApiKeyStamper({\n apiPublicKey: config.publicKey,\n apiPrivateKey: config.privateKey,\n });\n\n const client = new TurnkeyClient(\n {\n baseUrl: getTurnkeyApiUrl(env.ENVIRONMENT),\n },\n stamper,\n );\n\n const account = await createAccount({\n organizationId: config.appId,\n signWith: \"0xB54c8E6f303627f392884412ED2C84fFaF4779CA\",\n client,\n });\n\n return {\n signMessage: (args) => account.signMessage(args),\n };\n};\n\nconst createPrivateKeyAccount = (\n config: PrivateKeyAccountConfig,\n): PrimitiveAccount => {\n const account = privateKeyToAccount(config.privateKey);\n\n return {\n signMessage: (args) => account.signMessage(args),\n };\n};\n\nconst initializeAccount = async (\n config: ServerAccountConfig,\n): Promise<PrimitiveAccount> => {\n switch (config.type) {\n case ServerAccountType.Api:\n return createApiAccount(config);\n case ServerAccountType.PrivateKey:\n return createPrivateKeyAccount(config);\n default: {\n const exhaustiveCheck: never = config;\n throw new Error(\n `Unsupported account type: \"${(exhaustiveCheck as ServerAccountConfig).type}\". Supported types are: ${Object.values(ServerAccountType).join(\", \")}`,\n );\n }\n }\n};\n\n/**\n * Server-side account implementation for signing operations.\n *\n * Supports both private key and API authentication methods.\n *\n * @internal\n */\nexport class OtimAccount implements OtimAccountType {\n private account: Nullable<PrimitiveAccount> = null;\n private initialized = false;\n\n constructor(private readonly config: ServerAccountConfig) {}\n\n async initialize(): Promise<void> {\n if (this.initialized) {\n throw new Error(\n \"Account already initialized. The initialize() method should only be called once.\",\n );\n }\n\n this.account = await initializeAccount(this.config);\n this.initialized = true;\n }\n\n async signMessage({ message }: OtimAccountSignMessageArgs) {\n assertDefined(\n this.account,\n \"Account not initialized. Call initialize() before using signMessage().\",\n );\n return this.account.signMessage({ message });\n }\n}\n","import type { ServerAccountConfig } from \"@otim/sdk-core/account\";\nimport type { OtimServerClientContext } from \"@otim/sdk-core/context\";\nimport type { APIClient } from \"@otim/utils/api\";\n\nimport {\n createClientContext,\n isApiAccountConfig,\n} from \"@otim/sdk-core/account\";\nimport {\n ActivityClient,\n AuthClient,\n ConfigClient,\n DelegationClient,\n OrchestrationClient,\n} from \"@otim/sdk-core/clients\";\n\nimport { createServerAPIClient } from \"./api-client\";\nimport { OtimAccount } from \"./server-account\";\n\n/**\n * Otim Client for server-side blockchain operations.\n *\n * Provides access to activity, authentication, configuration, delegation, and\n * orchestration services.\n * The client must be initialized before use by calling the init() method.\n\n */\nexport class OtimServerClient {\n private readonly apiClient: APIClient;\n private readonly account: OtimAccount;\n private readonly context: OtimServerClientContext;\n\n readonly activity: ActivityClient;\n readonly auth: AuthClient;\n readonly config: ConfigClient;\n readonly delegation: DelegationClient;\n readonly orchestration: OrchestrationClient;\n\n constructor(config: ServerAccountConfig) {\n this.context = createClientContext(config);\n this.apiClient = createServerAPIClient({\n environment: config.environment,\n ...(isApiAccountConfig(config) ? { sessionToken: config.apiKey } : {}),\n });\n\n this.account = new OtimAccount(config);\n\n this.activity = new ActivityClient(this.apiClient);\n this.auth = new AuthClient(this.apiClient, this.account, this.context);\n this.config = new ConfigClient(this.apiClient);\n this.delegation = new DelegationClient(this.apiClient);\n this.orchestration = new OrchestrationClient(\n this.apiClient,\n this.account,\n this.context,\n );\n }\n\n /**\n * Initializes the Otim Client.\n *\n * This method must be called before using any other client methods.\n * It sets up the authentication account and prepares the client for use.\n *\n * @throws {Error} If the account is already initialized\n */\n async init(): Promise<void> {\n await this.account.initialize();\n }\n}\n","import type { Environment } from \"@otim/sdk-core/config\";\n\nimport { ServerAccountType } from \"@otim/sdk-core/account\";\n\nimport { OtimServerClient } from \"./server-client\";\n\n/**\n * Creates an Otim Client for server-side blockchain operations.\n *\n * @param config - Configuration with private key only\n * @returns Configured Otim Client instance\n *\n * @example\n * ```typescript\n * import { Environment } from '@otim/sdk';\n *\n * const client = createOtimServerClient({\n * privateKey: '0x...',\n * environment: Environment.Production,\n * });\n * await client.init();\n * ```\n */\nexport function createOtimServerClient(config: {\n privateKey: `0x${string}`;\n environment?: Environment;\n}): OtimServerClient;\n\n/**\n * Creates an Otim Client for server-side operations with API authentication.\n *\n * @param config - Configuration with API credentials\n * @returns Configured Otim Client instance\n *\n * @example\n * ```typescript\n * import { Environment } from '@otim/sdk';\n *\n * const client = createOtimServerClient({\n * appId: 'your-app-id',\n * privateKey: '0x...',\n * publicKey: 'your-public-key',\n * apiKey: 'your-api-key',\n * environment: Environment.Production,\n * });\n * await client.init();\n * ```\n */\nexport function createOtimServerClient(config: {\n appId: string;\n privateKey: `0x${string}`;\n publicKey: string;\n apiKey?: string;\n environment?: Environment;\n}): OtimServerClient;\n\nexport function createOtimServerClient(config: {\n privateKey?: `0x${string}`;\n publicKey?: string;\n apiKey?: string;\n appId?: string;\n environment?: Environment;\n}): OtimServerClient {\n if (config.appId && config.privateKey && config.publicKey && config.apiKey) {\n return new OtimServerClient({\n type: ServerAccountType.Api,\n appId: config.appId,\n privateKey: config.privateKey,\n publicKey: config.publicKey,\n apiKey: config.apiKey,\n environment: config.environment,\n });\n }\n\n if (config.privateKey) {\n return new OtimServerClient({\n type: ServerAccountType.PrivateKey,\n privateKey: config.privateKey,\n environment: config.environment,\n });\n }\n\n throw new Error(\"Invalid Otim Server Client configuration\");\n}\n"],"mappings":";;;;;;;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YAAY,OAAO;EACnB,WAAW,OAAO;EAClB,QAAQ,OAAO;EACf,aAAa,OAAO;EACrB,CAAC;AAGJ,KAAI,OAAO,WACT,QAAO,IAAI,iBAAiB;EAC1B,MAAM,kBAAkB;EACxB,YAAY,OAAO;EACnB,aAAa,OAAO;EACrB,CAAC;AAGJ,OAAM,IAAI,MAAM,2CAA2C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@otim/sdk-server",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "Otim's TypeScript SDK for blockchain automation and smart contract interactions",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -62,8 +62,8 @@
|
|
|
62
62
|
"@otim/typescript-config": "0.0.0"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@otim/turnkey": "0.0.2
|
|
66
|
-
"@otim/utils": "0.0.2
|
|
65
|
+
"@otim/turnkey": "0.0.2",
|
|
66
|
+
"@otim/utils": "0.0.2",
|
|
67
67
|
"@t3-oss/env-core": "^0.13.8",
|
|
68
68
|
"@testing-library/user-event": "^14.6.1",
|
|
69
69
|
"@turnkey/api-key-stamper": "^0.5.0",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"viem": "^2.39.3",
|
|
79
79
|
"ws": "^8.18.3",
|
|
80
80
|
"zod": "^4.1.12",
|
|
81
|
-
"@otim/sdk-core": "0.0.
|
|
81
|
+
"@otim/sdk-core": "0.0.3"
|
|
82
82
|
},
|
|
83
83
|
"peerDependencies": {
|
|
84
84
|
"@wagmi/core": "2.x",
|