diff --git a/packages/internal/generated-clients/Makefile b/packages/internal/generated-clients/Makefile index b4008c306d..21cf6b5aa9 100644 --- a/packages/internal/generated-clients/Makefile +++ b/packages/internal/generated-clients/Makefile @@ -80,3 +80,28 @@ generate-blockchain-data-types: -o /app/src/blockchain-data \ -c /app/config/blockchain-data.config.json \ --additional-properties=stringEnums=true + +# ------------------------------------------------- +# Magic TEE +# ------------------------------------------------- + +.PHONY: generate-magic-tee-openapi +generate-magic-tee-openapi: get-magic-tee-openapi generate-magic-tee-client + +.PHONY: get-magic-tee-openapi +get-magic-tee-openapi: + rm -f src/magic-tee-openapi.json && touch src/magic-tee-openapi.json && \ + curl -H "Accept: application/json+v3" \ + https://tee.express.magiclabs.com/openapi.json \ + -o src/magic-tee-openapi.json + +.PHONY: generate-magic-tee-client +generate-magic-tee-client: + pnpm rimraf src/magic-tee && \ + mkdir src/magic-tee && \ + docker run --rm -v $(shell pwd):/app openapitools/openapi-generator-cli:v7.0.1 generate \ + --inline-schema-options REFACTOR_ALLOF_INLINE_SCHEMAS=true \ + -i ./app/src/magic-tee-openapi.json \ + -g typescript-axios \ + -o /app/src/magic-tee \ + -c /app/config/magic-tee.config.json diff --git a/packages/internal/generated-clients/config/magic-tee.config.json b/packages/internal/generated-clients/config/magic-tee.config.json new file mode 100644 index 0000000000..0123605af7 --- /dev/null +++ b/packages/internal/generated-clients/config/magic-tee.config.json @@ -0,0 +1,9 @@ +{ + "supportsES6": true, + "npmVersion": "6.9.0", + "typescriptThreePlus": true, + "withSeparateModelsAndApi": true, + "modelPackage": "models", + "apiPackage": "domain", + "useSingleRequestParameter": true +} diff --git a/packages/internal/generated-clients/src/index.ts b/packages/internal/generated-clients/src/index.ts index 949fc689d4..e45f68ade7 100644 --- a/packages/internal/generated-clients/src/index.ts +++ b/packages/internal/generated-clients/src/index.ts @@ -3,6 +3,7 @@ export * as mr from './multi-rollup'; export * as BlockchainData from './blockchain-data/index'; export { ImxApiClients } from './imx-api-clients'; export { MultiRollupApiClients } from './mr-api-clients'; +export { MagicTeeApiClients } from './magic-tee-api-clients'; export { imxApiConfig, multiRollupConfig, createConfig, diff --git a/packages/internal/generated-clients/src/magic-tee-api-clients.ts b/packages/internal/generated-clients/src/magic-tee-api-clients.ts new file mode 100644 index 0000000000..acaea36ef8 --- /dev/null +++ b/packages/internal/generated-clients/src/magic-tee-api-clients.ts @@ -0,0 +1,29 @@ +import axios from 'axios'; +import { TransactionApi, WalletApi } from './magic-tee'; + +export type MagicTeeApiClientsConfig = { + basePath: string; + timeout: number; + magicPublishableApiKey: string; + magicProviderId: string; +}; + +export class MagicTeeApiClients { + public transactionApi: TransactionApi; + + public walletApi: WalletApi; + + constructor(config: MagicTeeApiClientsConfig) { + const instance = axios.create({ + timeout: config.timeout, + headers: { + 'Content-Type': 'application/json', + 'X-Magic-API-Key': config.magicPublishableApiKey, + 'X-OIDC-Provider-ID': config.magicProviderId, + }, + }); + + this.transactionApi = new TransactionApi(undefined, config.basePath, instance); + this.walletApi = new WalletApi(undefined, config.basePath, instance); + } +} diff --git a/packages/internal/generated-clients/src/magic-tee-openapi.json b/packages/internal/generated-clients/src/magic-tee-openapi.json new file mode 100644 index 0000000000..2724759f16 --- /dev/null +++ b/packages/internal/generated-clients/src/magic-tee-openapi.json @@ -0,0 +1 @@ +{"openapi":"3.1.0","info":{"title":"TEE Express","description":"\nTEE Express is a service that simplifies wallet management for developers. Unlike traditional wallet solutions that require complex key management, TEE Express handles all key management internally, providing a streamlined API for wallet operations.\nTEE Express leverages secure enclave technology to ensure that private keys never leave the secure environment. All wallet operations, including creation, signing, and key management, are performed within a trusted execution environment (TEE). This provides enterprise-grade security while maintaining the simplicity of a REST API.\n\nThe service supports Ethereum wallets and provides endpoints for wallet creation, transaction signing, and message signing. All operations are authenticated using JWT tokens passed in the Authorization header, ensuring secure access to user wallets.\n\n**Migration Notice:**\nIf you're an existing customer, your users' wallets have been automatically migrated to TEE Express. There's no action required on your part - all existing wallets are now accessible through the TEE Express API using the same JWT tokens you currently use for authentication.\n\nSimply update your API calls to use the TEE Express endpoints, and pass your existing JWT token in the Authorization header for all requests.\n\n**Authentication:**\n- An API key via the `X-Magic-API-Key` header or a secret key via the `X-Magic-Secret-Key` header.\n- The OIDC provider ID via the `X-OIDC-Provider-ID` header.\n- Bearer token in the `Authorization` header.\n\n**Data Hashing for Signing:**\n\nFor personal sign operations, encode your data as base64:\n\n```typescript\nconst message = Buffer.from(data, 'utf-8').toString('base64');\n```\n\nFor signing transaction data or other structured data, provide a keccak256 hash:\n\n```typescript\nimport {\n MessageTypes,\n SignTypedDataVersion,\n TypedDataUtils,\n TypedDataV1,\n TypedMessage,\n typedSignatureHash,\n} from '@metamask/eth-sig-util';\nimport { resolveProperties, Signature, Transaction, TransactionLike, TransactionRequest } from 'ethers';\n\nconst computeEip712Hash = (\n data: TypedMessage,\n version: SignTypedDataVersion.V3 | SignTypedDataVersion.V4,\n): string => {\n const hashBuffer = TypedDataUtils.eip712Hash(data, version);\n return '0x' + hashBuffer.toString('hex');\n};\n\nconst personalSign = async (data: string) => {\n const message = Buffer.from(data, 'utf-8').toString('base64');\n const body = { message_base64: message, chain: 'ETH' };\n return await fetch('/v1/wallet/personal-sign', { method: 'POST', body: JSON.stringify(body) });\n};\n\nconst signTypedDataV1 = async (data: TypedDataV1) => {\n const rawDataHash = typedSignatureHash(data);\n const body = { raw_data_hash: rawDataHash, chain: 'ETH' };\n return await fetch('/v1/wallet/sign', { method: 'POST', body: JSON.stringify(body) });\n};\n\nconst signTypedDataV3 = async (data: TypedMessage) => {\n const rawDataHash = computeEip712Hash(data, SignTypedDataVersion.V3);\n const body = { raw_data_hash: rawDataHash, chain: 'ETH' };\n return await fetch('/v1/wallet/sign', { method: 'POST', body: JSON.stringify(body) });\n};\n\nconst signTypedDataV4 = async (data: TypedMessage) => {\n const rawDataHash = computeEip712Hash(data, SignTypedDataVersion.V4);\n const body = { raw_data_hash: rawDataHash, chain: 'ETH' };\n return await fetch('/v1/wallet/sign', { method: 'POST', body: JSON.stringify(body) });\n};\n\nconst signTransaction = async (tx: TransactionRequest) => {\n const resolvedTx = await resolveProperties(tx);\n const txForSigning = { ...resolvedTx };\n delete txForSigning.from;\n\n const btx = Transaction.from(txForSigning as TransactionLike);\n\n const body = { raw_data_hash: btx.unsignedHash, chain: 'ETH' };\n const res = await fetch('/v1/wallet/sign', { method: 'POST', body: JSON.stringify(body) });\n const { r, s, v } = res.json();\n btx.signature = Signature.from({ r, s, v });\n return btx.serialized;\n};\n```\n","version":"0.1.0"},"paths":{"/v1/wallet/personal-sign":{"post":{"tags":["Transaction"],"summary":"Sign a message with the wallet.","description":"Signs an arbitrary message using the wallet's private key. Useful for authentication and off-chain verification.\n\n**Example cURL:**\n```bash\ncurl -X POST 'https://tee.express.magiclabs.com/v1/wallet/personal-sign' \\\n -H 'Content-Type: application/json' \\\n -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjNhYVl5dGR3d2UwMzJzMXIzVElyOSJ9...' \\\n -H 'X-Magic-API-Key: your-magic-api-key' \\\n -H 'X-OIDC-Provider-ID: your-oidc-provider-id' \\\n -d '{\n \"chain\": \"ETH\",\n \"message_base64\": \"bm9uZQ==\"\n }'\n```\n\n**Example Response:**\n```json\n{\n \"signature\": \"0x0cebb670d8375ac74122b46c44def7e1ce593e80434a3e6557108ae124f8b44f3c5068fc104279fe7f51918cbe4c249d707bc1c0ce2ffb6d201d3cf4e2fdee8d1b\",\n \"r\": \"0x0cebb670d8375ac74122b46c44def7e1ce593e80434a3e6557108ae124f8b44f\",\n \"s\": \"0x3c5068fc104279fe7f51918cbe4c249d707bc1c0ce2ffb6d201d3cf4e2fdee8d\",\n \"v\": \"27\"\n}\n```","operationId":"sign_message_v1_wallet_personal_sign_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"X-Magic-API-Key","in":"header","required":false,"schema":{"type":"string","title":"X-Magic-Api-Key"}},{"name":"X-Magic-Secret-Key","in":"header","required":false,"schema":{"type":"string","title":"X-Magic-Secret-Key"}},{"name":"X-OIDC-Provider-ID","in":"header","required":false,"schema":{"type":"string","title":"X-Oidc-Provider-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PersonalSignRequest"},{"type":"array","items":{"$ref":"#/components/schemas/PersonalSignRequest"}}],"title":"Item"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PersonalSignResponse"},{"type":"array","items":{"$ref":"#/components/schemas/PersonalSignResponse"}}],"title":"Response Sign Message V1 Wallet Personal Sign Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/wallet/sign":{"post":{"tags":["Transaction"],"summary":"Sign arbitrary data with the wallet.","description":"Signs a hash of arbitrary data using the wallet's private key.\n\n**Example cURL:**\n```bash\ncurl -X POST 'https://tee.express.magiclabs.com/v1/wallet/sign' \\\n -H 'Content-Type: application/json' \\\n -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjNhYVl5dGR3d2UwMzJzMXIzVElyOSJ9...' \\\n -H 'X-Magic-API-Key: your-magic-api-key' \\\n -H 'X-OIDC-Provider-ID: your-oidc-provider-id' \\\n -d '{\n \"chain\": \"ETH\",\n \"raw_data_hash\": \"0xabc123def4567890abc123def4567890abc123def4567890abc123def4567890\"\n }'\n```\n\n**Example Response:**\n```json\n{\n \"message_hash\": \"0xabc123def4567890abc123def4567890abc123def4567890abc123def4567890\",\n \"signature\": \"0x8e7d6c5b4a3928172635445566778899aabbccddeeff00112233445566778899\",\n \"r\": \"0x3d4e5f678901234567890abcdef1234567890abcdef1234567890abcdef1234\",\n \"s\": \"0x4e5f678901234567890abcdef1234567890abcdef1234567890abcdef123456\",\n \"v\": \"27\"\n}\n```","operationId":"sign_data_v1_wallet_sign_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"X-Magic-API-Key","in":"header","required":false,"schema":{"type":"string","title":"X-Magic-Api-Key"}},{"name":"X-Magic-Secret-Key","in":"header","required":false,"schema":{"type":"string","title":"X-Magic-Secret-Key"}},{"name":"X-OIDC-Provider-ID","in":"header","required":false,"schema":{"type":"string","title":"X-Oidc-Provider-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SignDataRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SignDataResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/wallet":{"get":{"tags":["Wallet"],"summary":"Get wallet details.","description":"Returns the wallet's public address for the given chain.\n\n**Example cURL:**\n```bash\ncurl -X GET 'https://tee.express.magiclabs.com/v1/wallet?chain=ETH' \\\n -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjNhYVl5dGR3d2UwMzJzMXIzVElyOSJ9...' \\\n -H 'X-Magic-API-Key: your-magic-api-key' \\\n -H 'X-OIDC-Provider-ID: your-oidc-provider-id'\n```\n\n**Example Response:**\n```json\n{\n \"public_address\": \"0x6b422EefBFBc47a6900A1fc5454Ef4b940B7e36e\"\n}\n```","operationId":"get_wallet_v1_wallet_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"chain","in":"query","required":true,"schema":{"$ref":"#/components/schemas/Chain"}},{"name":"X-Magic-API-Key","in":"header","required":false,"schema":{"type":"string","title":"X-Magic-Api-Key"}},{"name":"X-Magic-Secret-Key","in":"header","required":false,"schema":{"type":"string","title":"X-Magic-Secret-Key"}},{"name":"X-OIDC-Provider-ID","in":"header","required":false,"schema":{"type":"string","title":"X-Oidc-Provider-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/WalletResponseModel"},{"type":"null"}],"title":"Response Get Wallet V1 Wallet Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["Wallet"],"summary":"Create a new wallet.","description":"Creates a new wallet for the given chain and returns its public address.\n\n**Example cURL:**\n```bash\ncurl -X POST 'https://tee.express.magiclabs.com/v1/wallet' \\\n -H 'Content-Type: application/json' \\\n -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjNhYVl5dGR3d2UwMzJzMXIzVElyOSJ9...' \\\n -H 'X-Magic-API-Key: your-magic-api-key' \\\n -H 'X-OIDC-Provider-ID: your-oidc-provider-id' \\\n -d '{\n \"chain\": \"ETH\"\n }'\n```\n\n**Example Response:**\n```json\n{\n \"public_address\": \"0x6b422EefBFBc47a6900A1fc5454Ef4b940B7e36e\"\n}\n```","operationId":"create_wallet_v1_wallet_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"X-Magic-API-Key","in":"header","required":false,"schema":{"type":"string","title":"X-Magic-Api-Key"}},{"name":"X-Magic-Secret-Key","in":"header","required":false,"schema":{"type":"string","title":"X-Magic-Secret-Key"}},{"name":"X-OIDC-Provider-ID","in":"header","required":false,"schema":{"type":"string","title":"X-Oidc-Provider-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateWalletRequestModel"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WalletResponseModel"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"Chain":{"type":"string","enum":["ETH"],"title":"Chain"},"CreateWalletRequestModel":{"properties":{"chain":{"$ref":"#/components/schemas/Chain"}},"type":"object","required":["chain"],"title":"CreateWalletRequestModel"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"PersonalSignRequest":{"properties":{"chain":{"$ref":"#/components/schemas/Chain"},"message_base64":{"type":"string","title":"Message Base64"}},"type":"object","required":["chain","message_base64"],"title":"PersonalSignRequest"},"PersonalSignResponse":{"properties":{"signature":{"type":"string","title":"Signature"},"r":{"type":"string","title":"R"},"s":{"type":"string","title":"S"},"v":{"type":"string","title":"V"}},"type":"object","required":["signature","r","s","v"],"title":"PersonalSignResponse"},"SignDataRequest":{"properties":{"chain":{"$ref":"#/components/schemas/Chain"},"raw_data_hash":{"type":"string","title":"Raw Data Hash"}},"type":"object","required":["chain","raw_data_hash"],"title":"SignDataRequest"},"SignDataResponse":{"properties":{"message_hash":{"type":"string","title":"Message Hash"},"signature":{"type":"string","title":"Signature"},"r":{"type":"string","title":"R"},"s":{"type":"string","title":"S"},"v":{"type":"string","title":"V"}},"type":"object","required":["message_hash","signature","r","s","v"],"title":"SignDataResponse"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"},"WalletResponseModel":{"properties":{"public_address":{"type":"string","title":"Public Address"}},"type":"object","required":["public_address"],"title":"WalletResponseModel"}},"securitySchemes":{"HTTPBearer":{"type":"http","scheme":"bearer"}}}} \ No newline at end of file diff --git a/packages/internal/generated-clients/src/magic-tee/.gitignore b/packages/internal/generated-clients/src/magic-tee/.gitignore new file mode 100644 index 0000000000..149b576547 --- /dev/null +++ b/packages/internal/generated-clients/src/magic-tee/.gitignore @@ -0,0 +1,4 @@ +wwwroot/*.js +node_modules +typings +dist diff --git a/packages/internal/generated-clients/src/magic-tee/.npmignore b/packages/internal/generated-clients/src/magic-tee/.npmignore new file mode 100644 index 0000000000..999d88df69 --- /dev/null +++ b/packages/internal/generated-clients/src/magic-tee/.npmignore @@ -0,0 +1 @@ +# empty npmignore to ensure all required files (e.g., in the dist folder) are published by npm \ No newline at end of file diff --git a/packages/internal/generated-clients/src/magic-tee/.openapi-generator-ignore b/packages/internal/generated-clients/src/magic-tee/.openapi-generator-ignore new file mode 100644 index 0000000000..7484ee590a --- /dev/null +++ b/packages/internal/generated-clients/src/magic-tee/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/packages/internal/generated-clients/src/magic-tee/.openapi-generator/FILES b/packages/internal/generated-clients/src/magic-tee/.openapi-generator/FILES new file mode 100644 index 0000000000..c496539633 --- /dev/null +++ b/packages/internal/generated-clients/src/magic-tee/.openapi-generator/FILES @@ -0,0 +1,22 @@ +.gitignore +.npmignore +.openapi-generator-ignore +api.ts +base.ts +common.ts +configuration.ts +domain/transaction-api.ts +domain/wallet-api.ts +git_push.sh +index.ts +models/chain.ts +models/create-wallet-request-model.ts +models/httpvalidation-error.ts +models/index.ts +models/personal-sign-request.ts +models/personal-sign-response.ts +models/sign-data-request.ts +models/sign-data-response.ts +models/validation-error-loc-inner.ts +models/validation-error.ts +models/wallet-response-model.ts diff --git a/packages/internal/generated-clients/src/magic-tee/.openapi-generator/VERSION b/packages/internal/generated-clients/src/magic-tee/.openapi-generator/VERSION new file mode 100644 index 0000000000..73a86b1970 --- /dev/null +++ b/packages/internal/generated-clients/src/magic-tee/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.0.1 \ No newline at end of file diff --git a/packages/internal/generated-clients/src/magic-tee/api.ts b/packages/internal/generated-clients/src/magic-tee/api.ts new file mode 100644 index 0000000000..df996067bf --- /dev/null +++ b/packages/internal/generated-clients/src/magic-tee/api.ts @@ -0,0 +1,19 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * TEE Express + * TEE Express is a service that simplifies wallet management for developers. Unlike traditional wallet solutions that require complex key management, TEE Express handles all key management internally, providing a streamlined API for wallet operations. TEE Express leverages secure enclave technology to ensure that private keys never leave the secure environment. All wallet operations, including creation, signing, and key management, are performed within a trusted execution environment (TEE). This provides enterprise-grade security while maintaining the simplicity of a REST API. The service supports Ethereum wallets and provides endpoints for wallet creation, transaction signing, and message signing. All operations are authenticated using JWT tokens passed in the Authorization header, ensuring secure access to user wallets. **Migration Notice:** If you\'re an existing customer, your users\' wallets have been automatically migrated to TEE Express. There\'s no action required on your part - all existing wallets are now accessible through the TEE Express API using the same JWT tokens you currently use for authentication. Simply update your API calls to use the TEE Express endpoints, and pass your existing JWT token in the Authorization header for all requests. **Authentication:** - An API key via the `X-Magic-API-Key` header or a secret key via the `X-Magic-Secret-Key` header. - The OIDC provider ID via the `X-OIDC-Provider-ID` header. - Bearer token in the `Authorization` header. **Data Hashing for Signing:** For personal sign operations, encode your data as base64: ```typescript const message = Buffer.from(data, \'utf-8\').toString(\'base64\'); ``` For signing transaction data or other structured data, provide a keccak256 hash: ```typescript import { MessageTypes, SignTypedDataVersion, TypedDataUtils, TypedDataV1, TypedMessage, typedSignatureHash, } from \'@metamask/eth-sig-util\'; import { resolveProperties, Signature, Transaction, TransactionLike, TransactionRequest } from \'ethers\'; const computeEip712Hash = ( data: TypedMessage, version: SignTypedDataVersion.V3 | SignTypedDataVersion.V4, ): string => { const hashBuffer = TypedDataUtils.eip712Hash(data, version); return \'0x\' + hashBuffer.toString(\'hex\'); }; const personalSign = async (data: string) => { const message = Buffer.from(data, \'utf-8\').toString(\'base64\'); const body = { message_base64: message, chain: \'ETH\' }; return await fetch(\'/v1/wallet/personal-sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV1 = async (data: TypedDataV1) => { const rawDataHash = typedSignatureHash(data); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV3 = async (data: TypedMessage) => { const rawDataHash = computeEip712Hash(data, SignTypedDataVersion.V3); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV4 = async (data: TypedMessage) => { const rawDataHash = computeEip712Hash(data, SignTypedDataVersion.V4); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTransaction = async (tx: TransactionRequest) => { const resolvedTx = await resolveProperties(tx); const txForSigning = { ...resolvedTx }; delete txForSigning.from; const btx = Transaction.from(txForSigning as TransactionLike); const body = { raw_data_hash: btx.unsignedHash, chain: \'ETH\' }; const res = await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); const { r, s, v } = res.json(); btx.signature = Signature.from({ r, s, v }); return btx.serialized; }; ``` + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +export * from './domain/transaction-api'; +export * from './domain/wallet-api'; + diff --git a/packages/internal/generated-clients/src/magic-tee/base.ts b/packages/internal/generated-clients/src/magic-tee/base.ts new file mode 100644 index 0000000000..92a044e499 --- /dev/null +++ b/packages/internal/generated-clients/src/magic-tee/base.ts @@ -0,0 +1,72 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * TEE Express + * TEE Express is a service that simplifies wallet management for developers. Unlike traditional wallet solutions that require complex key management, TEE Express handles all key management internally, providing a streamlined API for wallet operations. TEE Express leverages secure enclave technology to ensure that private keys never leave the secure environment. All wallet operations, including creation, signing, and key management, are performed within a trusted execution environment (TEE). This provides enterprise-grade security while maintaining the simplicity of a REST API. The service supports Ethereum wallets and provides endpoints for wallet creation, transaction signing, and message signing. All operations are authenticated using JWT tokens passed in the Authorization header, ensuring secure access to user wallets. **Migration Notice:** If you\'re an existing customer, your users\' wallets have been automatically migrated to TEE Express. There\'s no action required on your part - all existing wallets are now accessible through the TEE Express API using the same JWT tokens you currently use for authentication. Simply update your API calls to use the TEE Express endpoints, and pass your existing JWT token in the Authorization header for all requests. **Authentication:** - An API key via the `X-Magic-API-Key` header or a secret key via the `X-Magic-Secret-Key` header. - The OIDC provider ID via the `X-OIDC-Provider-ID` header. - Bearer token in the `Authorization` header. **Data Hashing for Signing:** For personal sign operations, encode your data as base64: ```typescript const message = Buffer.from(data, \'utf-8\').toString(\'base64\'); ``` For signing transaction data or other structured data, provide a keccak256 hash: ```typescript import { MessageTypes, SignTypedDataVersion, TypedDataUtils, TypedDataV1, TypedMessage, typedSignatureHash, } from \'@metamask/eth-sig-util\'; import { resolveProperties, Signature, Transaction, TransactionLike, TransactionRequest } from \'ethers\'; const computeEip712Hash = ( data: TypedMessage, version: SignTypedDataVersion.V3 | SignTypedDataVersion.V4, ): string => { const hashBuffer = TypedDataUtils.eip712Hash(data, version); return \'0x\' + hashBuffer.toString(\'hex\'); }; const personalSign = async (data: string) => { const message = Buffer.from(data, \'utf-8\').toString(\'base64\'); const body = { message_base64: message, chain: \'ETH\' }; return await fetch(\'/v1/wallet/personal-sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV1 = async (data: TypedDataV1) => { const rawDataHash = typedSignatureHash(data); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV3 = async (data: TypedMessage) => { const rawDataHash = computeEip712Hash(data, SignTypedDataVersion.V3); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV4 = async (data: TypedMessage) => { const rawDataHash = computeEip712Hash(data, SignTypedDataVersion.V4); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTransaction = async (tx: TransactionRequest) => { const resolvedTx = await resolveProperties(tx); const txForSigning = { ...resolvedTx }; delete txForSigning.from; const btx = Transaction.from(txForSigning as TransactionLike); const body = { raw_data_hash: btx.unsignedHash, chain: \'ETH\' }; const res = await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); const { r, s, v } = res.json(); btx.signature = Signature.from({ r, s, v }); return btx.serialized; }; ``` + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import type { Configuration } from './configuration'; +// Some imports not used depending on template conditions +// @ts-ignore +import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; + +export const BASE_PATH = "http://localhost".replace(/\/+$/, ""); + +/** + * + * @export + */ +export const COLLECTION_FORMATS = { + csv: ",", + ssv: " ", + tsv: "\t", + pipes: "|", +}; + +/** + * + * @export + * @interface RequestArgs + */ +export interface RequestArgs { + url: string; + options: AxiosRequestConfig; +} + +/** + * + * @export + * @class BaseAPI + */ +export class BaseAPI { + protected configuration: Configuration | undefined; + + constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) { + if (configuration) { + this.configuration = configuration; + this.basePath = configuration.basePath || this.basePath; + } + } +}; + +/** + * + * @export + * @class RequiredError + * @extends {Error} + */ +export class RequiredError extends Error { + constructor(public field: string, msg?: string) { + super(msg); + this.name = "RequiredError" + } +} diff --git a/packages/internal/generated-clients/src/magic-tee/common.ts b/packages/internal/generated-clients/src/magic-tee/common.ts new file mode 100644 index 0000000000..d235a19984 --- /dev/null +++ b/packages/internal/generated-clients/src/magic-tee/common.ts @@ -0,0 +1,150 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * TEE Express + * TEE Express is a service that simplifies wallet management for developers. Unlike traditional wallet solutions that require complex key management, TEE Express handles all key management internally, providing a streamlined API for wallet operations. TEE Express leverages secure enclave technology to ensure that private keys never leave the secure environment. All wallet operations, including creation, signing, and key management, are performed within a trusted execution environment (TEE). This provides enterprise-grade security while maintaining the simplicity of a REST API. The service supports Ethereum wallets and provides endpoints for wallet creation, transaction signing, and message signing. All operations are authenticated using JWT tokens passed in the Authorization header, ensuring secure access to user wallets. **Migration Notice:** If you\'re an existing customer, your users\' wallets have been automatically migrated to TEE Express. There\'s no action required on your part - all existing wallets are now accessible through the TEE Express API using the same JWT tokens you currently use for authentication. Simply update your API calls to use the TEE Express endpoints, and pass your existing JWT token in the Authorization header for all requests. **Authentication:** - An API key via the `X-Magic-API-Key` header or a secret key via the `X-Magic-Secret-Key` header. - The OIDC provider ID via the `X-OIDC-Provider-ID` header. - Bearer token in the `Authorization` header. **Data Hashing for Signing:** For personal sign operations, encode your data as base64: ```typescript const message = Buffer.from(data, \'utf-8\').toString(\'base64\'); ``` For signing transaction data or other structured data, provide a keccak256 hash: ```typescript import { MessageTypes, SignTypedDataVersion, TypedDataUtils, TypedDataV1, TypedMessage, typedSignatureHash, } from \'@metamask/eth-sig-util\'; import { resolveProperties, Signature, Transaction, TransactionLike, TransactionRequest } from \'ethers\'; const computeEip712Hash = ( data: TypedMessage, version: SignTypedDataVersion.V3 | SignTypedDataVersion.V4, ): string => { const hashBuffer = TypedDataUtils.eip712Hash(data, version); return \'0x\' + hashBuffer.toString(\'hex\'); }; const personalSign = async (data: string) => { const message = Buffer.from(data, \'utf-8\').toString(\'base64\'); const body = { message_base64: message, chain: \'ETH\' }; return await fetch(\'/v1/wallet/personal-sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV1 = async (data: TypedDataV1) => { const rawDataHash = typedSignatureHash(data); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV3 = async (data: TypedMessage) => { const rawDataHash = computeEip712Hash(data, SignTypedDataVersion.V3); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV4 = async (data: TypedMessage) => { const rawDataHash = computeEip712Hash(data, SignTypedDataVersion.V4); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTransaction = async (tx: TransactionRequest) => { const resolvedTx = await resolveProperties(tx); const txForSigning = { ...resolvedTx }; delete txForSigning.from; const btx = Transaction.from(txForSigning as TransactionLike); const body = { raw_data_hash: btx.unsignedHash, chain: \'ETH\' }; const res = await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); const { r, s, v } = res.json(); btx.signature = Signature.from({ r, s, v }); return btx.serialized; }; ``` + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import type { Configuration } from "./configuration"; +import type { RequestArgs } from "./base"; +import type { AxiosInstance, AxiosResponse } from 'axios'; +import { RequiredError } from "./base"; + +/** + * + * @export + */ +export const DUMMY_BASE_URL = 'https://example.com' + +/** + * + * @throws {RequiredError} + * @export + */ +export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) { + if (paramValue === null || paramValue === undefined) { + throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`); + } +} + +/** + * + * @export + */ +export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) { + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? await configuration.apiKey(keyParamName) + : await configuration.apiKey; + object[keyParamName] = localVarApiKeyValue; + } +} + +/** + * + * @export + */ +export const setBasicAuthToObject = function (object: any, configuration?: Configuration) { + if (configuration && (configuration.username || configuration.password)) { + object["auth"] = { username: configuration.username, password: configuration.password }; + } +} + +/** + * + * @export + */ +export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) { + if (configuration && configuration.accessToken) { + const accessToken = typeof configuration.accessToken === 'function' + ? await configuration.accessToken() + : await configuration.accessToken; + object["Authorization"] = "Bearer " + accessToken; + } +} + +/** + * + * @export + */ +export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) { + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? await configuration.accessToken(name, scopes) + : await configuration.accessToken; + object["Authorization"] = "Bearer " + localVarAccessTokenValue; + } +} + +function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void { + if (parameter == null) return; + if (typeof parameter === "object") { + if (Array.isArray(parameter)) { + (parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key)); + } + else { + Object.keys(parameter).forEach(currentKey => + setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`) + ); + } + } + else { + if (urlSearchParams.has(key)) { + urlSearchParams.append(key, parameter); + } + else { + urlSearchParams.set(key, parameter); + } + } +} + +/** + * + * @export + */ +export const setSearchParams = function (url: URL, ...objects: any[]) { + const searchParams = new URLSearchParams(url.search); + setFlattenedQueryParams(searchParams, objects); + url.search = searchParams.toString(); +} + +/** + * + * @export + */ +export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) { + const nonString = typeof value !== 'string'; + const needsSerialization = nonString && configuration && configuration.isJsonMime + ? configuration.isJsonMime(requestOptions.headers['Content-Type']) + : nonString; + return needsSerialization + ? JSON.stringify(value !== undefined ? value : {}) + : (value || ""); +} + +/** + * + * @export + */ +export const toPathString = function (url: URL) { + return url.pathname + url.search + url.hash +} + +/** + * + * @export + */ +export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) { + return >(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || axios.defaults.baseURL || basePath) + axiosArgs.url}; + return axios.request(axiosRequestArgs); + }; +} diff --git a/packages/internal/generated-clients/src/magic-tee/configuration.ts b/packages/internal/generated-clients/src/magic-tee/configuration.ts new file mode 100644 index 0000000000..0c9c78ccab --- /dev/null +++ b/packages/internal/generated-clients/src/magic-tee/configuration.ts @@ -0,0 +1,101 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * TEE Express + * TEE Express is a service that simplifies wallet management for developers. Unlike traditional wallet solutions that require complex key management, TEE Express handles all key management internally, providing a streamlined API for wallet operations. TEE Express leverages secure enclave technology to ensure that private keys never leave the secure environment. All wallet operations, including creation, signing, and key management, are performed within a trusted execution environment (TEE). This provides enterprise-grade security while maintaining the simplicity of a REST API. The service supports Ethereum wallets and provides endpoints for wallet creation, transaction signing, and message signing. All operations are authenticated using JWT tokens passed in the Authorization header, ensuring secure access to user wallets. **Migration Notice:** If you\'re an existing customer, your users\' wallets have been automatically migrated to TEE Express. There\'s no action required on your part - all existing wallets are now accessible through the TEE Express API using the same JWT tokens you currently use for authentication. Simply update your API calls to use the TEE Express endpoints, and pass your existing JWT token in the Authorization header for all requests. **Authentication:** - An API key via the `X-Magic-API-Key` header or a secret key via the `X-Magic-Secret-Key` header. - The OIDC provider ID via the `X-OIDC-Provider-ID` header. - Bearer token in the `Authorization` header. **Data Hashing for Signing:** For personal sign operations, encode your data as base64: ```typescript const message = Buffer.from(data, \'utf-8\').toString(\'base64\'); ``` For signing transaction data or other structured data, provide a keccak256 hash: ```typescript import { MessageTypes, SignTypedDataVersion, TypedDataUtils, TypedDataV1, TypedMessage, typedSignatureHash, } from \'@metamask/eth-sig-util\'; import { resolveProperties, Signature, Transaction, TransactionLike, TransactionRequest } from \'ethers\'; const computeEip712Hash = ( data: TypedMessage, version: SignTypedDataVersion.V3 | SignTypedDataVersion.V4, ): string => { const hashBuffer = TypedDataUtils.eip712Hash(data, version); return \'0x\' + hashBuffer.toString(\'hex\'); }; const personalSign = async (data: string) => { const message = Buffer.from(data, \'utf-8\').toString(\'base64\'); const body = { message_base64: message, chain: \'ETH\' }; return await fetch(\'/v1/wallet/personal-sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV1 = async (data: TypedDataV1) => { const rawDataHash = typedSignatureHash(data); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV3 = async (data: TypedMessage) => { const rawDataHash = computeEip712Hash(data, SignTypedDataVersion.V3); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV4 = async (data: TypedMessage) => { const rawDataHash = computeEip712Hash(data, SignTypedDataVersion.V4); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTransaction = async (tx: TransactionRequest) => { const resolvedTx = await resolveProperties(tx); const txForSigning = { ...resolvedTx }; delete txForSigning.from; const btx = Transaction.from(txForSigning as TransactionLike); const body = { raw_data_hash: btx.unsignedHash, chain: \'ETH\' }; const res = await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); const { r, s, v } = res.json(); btx.signature = Signature.from({ r, s, v }); return btx.serialized; }; ``` + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface ConfigurationParameters { + apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); + username?: string; + password?: string; + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + basePath?: string; + baseOptions?: any; + formDataCtor?: new () => any; +} + +export class Configuration { + /** + * parameter for apiKey security + * @param name security name + * @memberof Configuration + */ + apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + username?: string; + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + password?: string; + /** + * parameter for oauth2 security + * @param name security name + * @param scopes oauth2 scope + * @memberof Configuration + */ + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + /** + * override base path + * + * @type {string} + * @memberof Configuration + */ + basePath?: string; + /** + * base options for axios calls + * + * @type {any} + * @memberof Configuration + */ + baseOptions?: any; + /** + * The FormData constructor that will be used to create multipart form data + * requests. You can inject this here so that execution environments that + * do not support the FormData class can still run the generated client. + * + * @type {new () => FormData} + */ + formDataCtor?: new () => any; + + constructor(param: ConfigurationParameters = {}) { + this.apiKey = param.apiKey; + this.username = param.username; + this.password = param.password; + this.accessToken = param.accessToken; + this.basePath = param.basePath; + this.baseOptions = param.baseOptions; + this.formDataCtor = param.formDataCtor; + } + + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * application/vnd.company+json + * @param mime - MIME (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + public isJsonMime(mime: string): boolean { + const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i'); + return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json'); + } +} diff --git a/packages/internal/generated-clients/src/magic-tee/domain/transaction-api.ts b/packages/internal/generated-clients/src/magic-tee/domain/transaction-api.ts new file mode 100644 index 0000000000..1c4fab12f8 --- /dev/null +++ b/packages/internal/generated-clients/src/magic-tee/domain/transaction-api.ts @@ -0,0 +1,322 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * TEE Express + * TEE Express is a service that simplifies wallet management for developers. Unlike traditional wallet solutions that require complex key management, TEE Express handles all key management internally, providing a streamlined API for wallet operations. TEE Express leverages secure enclave technology to ensure that private keys never leave the secure environment. All wallet operations, including creation, signing, and key management, are performed within a trusted execution environment (TEE). This provides enterprise-grade security while maintaining the simplicity of a REST API. The service supports Ethereum wallets and provides endpoints for wallet creation, transaction signing, and message signing. All operations are authenticated using JWT tokens passed in the Authorization header, ensuring secure access to user wallets. **Migration Notice:** If you\'re an existing customer, your users\' wallets have been automatically migrated to TEE Express. There\'s no action required on your part - all existing wallets are now accessible through the TEE Express API using the same JWT tokens you currently use for authentication. Simply update your API calls to use the TEE Express endpoints, and pass your existing JWT token in the Authorization header for all requests. **Authentication:** - An API key via the `X-Magic-API-Key` header or a secret key via the `X-Magic-Secret-Key` header. - The OIDC provider ID via the `X-OIDC-Provider-ID` header. - Bearer token in the `Authorization` header. **Data Hashing for Signing:** For personal sign operations, encode your data as base64: ```typescript const message = Buffer.from(data, \'utf-8\').toString(\'base64\'); ``` For signing transaction data or other structured data, provide a keccak256 hash: ```typescript import { MessageTypes, SignTypedDataVersion, TypedDataUtils, TypedDataV1, TypedMessage, typedSignatureHash, } from \'@metamask/eth-sig-util\'; import { resolveProperties, Signature, Transaction, TransactionLike, TransactionRequest } from \'ethers\'; const computeEip712Hash = ( data: TypedMessage, version: SignTypedDataVersion.V3 | SignTypedDataVersion.V4, ): string => { const hashBuffer = TypedDataUtils.eip712Hash(data, version); return \'0x\' + hashBuffer.toString(\'hex\'); }; const personalSign = async (data: string) => { const message = Buffer.from(data, \'utf-8\').toString(\'base64\'); const body = { message_base64: message, chain: \'ETH\' }; return await fetch(\'/v1/wallet/personal-sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV1 = async (data: TypedDataV1) => { const rawDataHash = typedSignatureHash(data); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV3 = async (data: TypedMessage) => { const rawDataHash = computeEip712Hash(data, SignTypedDataVersion.V3); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV4 = async (data: TypedMessage) => { const rawDataHash = computeEip712Hash(data, SignTypedDataVersion.V4); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTransaction = async (tx: TransactionRequest) => { const resolvedTx = await resolveProperties(tx); const txForSigning = { ...resolvedTx }; delete txForSigning.from; const btx = Transaction.from(txForSigning as TransactionLike); const body = { raw_data_hash: btx.unsignedHash, chain: \'ETH\' }; const res = await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); const { r, s, v } = res.json(); btx.signature = Signature.from({ r, s, v }); return btx.serialized; }; ``` + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import type { Configuration } from '../configuration'; +import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; +// Some imports not used depending on template conditions +// @ts-ignore +import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common'; +// @ts-ignore +import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base'; +// @ts-ignore +import { HTTPValidationError } from '../models'; +// @ts-ignore +import { PersonalSignRequest } from '../models'; +// @ts-ignore +import { PersonalSignResponse } from '../models'; +// @ts-ignore +import { SignDataRequest } from '../models'; +// @ts-ignore +import { SignDataResponse } from '../models'; +/** + * TransactionApi - axios parameter creator + * @export + */ +export const TransactionApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * Signs a hash of arbitrary data using the wallet\'s private key. **Example cURL:** ```bash curl -X POST \'https://tee.express.magiclabs.com/v1/wallet/sign\' \\ -H \'Content-Type: application/json\' \\ -H \'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjNhYVl5dGR3d2UwMzJzMXIzVElyOSJ9...\' \\ -H \'X-Magic-API-Key: your-magic-api-key\' \\ -H \'X-OIDC-Provider-ID: your-oidc-provider-id\' \\ -d \'{ \"chain\": \"ETH\", \"raw_data_hash\": \"0xabc123def4567890abc123def4567890abc123def4567890abc123def4567890\" }\' ``` **Example Response:** ```json { \"message_hash\": \"0xabc123def4567890abc123def4567890abc123def4567890abc123def4567890\", \"signature\": \"0x8e7d6c5b4a3928172635445566778899aabbccddeeff00112233445566778899\", \"r\": \"0x3d4e5f678901234567890abcdef1234567890abcdef1234567890abcdef1234\", \"s\": \"0x4e5f678901234567890abcdef1234567890abcdef1234567890abcdef123456\", \"v\": \"27\" } ``` + * @summary Sign arbitrary data with the wallet. + * @param {SignDataRequest} signDataRequest + * @param {string} [xMagicAPIKey] + * @param {string} [xMagicSecretKey] + * @param {string} [xOIDCProviderID] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + signDataV1WalletSignPost: async (signDataRequest: SignDataRequest, xMagicAPIKey?: string, xMagicSecretKey?: string, xOIDCProviderID?: string, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'signDataRequest' is not null or undefined + assertParamExists('signDataV1WalletSignPost', 'signDataRequest', signDataRequest) + const localVarPath = `/v1/wallet/sign`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication HTTPBearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) + + if (xMagicAPIKey != null) { + localVarHeaderParameter['X-Magic-API-Key'] = String(xMagicAPIKey); + } + + if (xMagicSecretKey != null) { + localVarHeaderParameter['X-Magic-Secret-Key'] = String(xMagicSecretKey); + } + + if (xOIDCProviderID != null) { + localVarHeaderParameter['X-OIDC-Provider-ID'] = String(xOIDCProviderID); + } + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(signDataRequest, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Signs an arbitrary message using the wallet\'s private key. Useful for authentication and off-chain verification. **Example cURL:** ```bash curl -X POST \'https://tee.express.magiclabs.com/v1/wallet/personal-sign\' \\ -H \'Content-Type: application/json\' \\ -H \'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjNhYVl5dGR3d2UwMzJzMXIzVElyOSJ9...\' \\ -H \'X-Magic-API-Key: your-magic-api-key\' \\ -H \'X-OIDC-Provider-ID: your-oidc-provider-id\' \\ -d \'{ \"chain\": \"ETH\", \"message_base64\": \"bm9uZQ==\" }\' ``` **Example Response:** ```json { \"signature\": \"0x0cebb670d8375ac74122b46c44def7e1ce593e80434a3e6557108ae124f8b44f3c5068fc104279fe7f51918cbe4c249d707bc1c0ce2ffb6d201d3cf4e2fdee8d1b\", \"r\": \"0x0cebb670d8375ac74122b46c44def7e1ce593e80434a3e6557108ae124f8b44f\", \"s\": \"0x3c5068fc104279fe7f51918cbe4c249d707bc1c0ce2ffb6d201d3cf4e2fdee8d\", \"v\": \"27\" } ``` + * @summary Sign a message with the wallet. + * @param {PersonalSignRequest} personalSignRequest + * @param {string} [xMagicAPIKey] + * @param {string} [xMagicSecretKey] + * @param {string} [xOIDCProviderID] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + signMessageV1WalletPersonalSignPost: async (personalSignRequest: PersonalSignRequest, xMagicAPIKey?: string, xMagicSecretKey?: string, xOIDCProviderID?: string, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'personalSignRequest' is not null or undefined + assertParamExists('signMessageV1WalletPersonalSignPost', 'personalSignRequest', personalSignRequest) + const localVarPath = `/v1/wallet/personal-sign`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication HTTPBearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) + + if (xMagicAPIKey != null) { + localVarHeaderParameter['X-Magic-API-Key'] = String(xMagicAPIKey); + } + + if (xMagicSecretKey != null) { + localVarHeaderParameter['X-Magic-Secret-Key'] = String(xMagicSecretKey); + } + + if (xOIDCProviderID != null) { + localVarHeaderParameter['X-OIDC-Provider-ID'] = String(xOIDCProviderID); + } + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(personalSignRequest, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * TransactionApi - functional programming interface + * @export + */ +export const TransactionApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = TransactionApiAxiosParamCreator(configuration) + return { + /** + * Signs a hash of arbitrary data using the wallet\'s private key. **Example cURL:** ```bash curl -X POST \'https://tee.express.magiclabs.com/v1/wallet/sign\' \\ -H \'Content-Type: application/json\' \\ -H \'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjNhYVl5dGR3d2UwMzJzMXIzVElyOSJ9...\' \\ -H \'X-Magic-API-Key: your-magic-api-key\' \\ -H \'X-OIDC-Provider-ID: your-oidc-provider-id\' \\ -d \'{ \"chain\": \"ETH\", \"raw_data_hash\": \"0xabc123def4567890abc123def4567890abc123def4567890abc123def4567890\" }\' ``` **Example Response:** ```json { \"message_hash\": \"0xabc123def4567890abc123def4567890abc123def4567890abc123def4567890\", \"signature\": \"0x8e7d6c5b4a3928172635445566778899aabbccddeeff00112233445566778899\", \"r\": \"0x3d4e5f678901234567890abcdef1234567890abcdef1234567890abcdef1234\", \"s\": \"0x4e5f678901234567890abcdef1234567890abcdef1234567890abcdef123456\", \"v\": \"27\" } ``` + * @summary Sign arbitrary data with the wallet. + * @param {SignDataRequest} signDataRequest + * @param {string} [xMagicAPIKey] + * @param {string} [xMagicSecretKey] + * @param {string} [xOIDCProviderID] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async signDataV1WalletSignPost(signDataRequest: SignDataRequest, xMagicAPIKey?: string, xMagicSecretKey?: string, xOIDCProviderID?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.signDataV1WalletSignPost(signDataRequest, xMagicAPIKey, xMagicSecretKey, xOIDCProviderID, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * Signs an arbitrary message using the wallet\'s private key. Useful for authentication and off-chain verification. **Example cURL:** ```bash curl -X POST \'https://tee.express.magiclabs.com/v1/wallet/personal-sign\' \\ -H \'Content-Type: application/json\' \\ -H \'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjNhYVl5dGR3d2UwMzJzMXIzVElyOSJ9...\' \\ -H \'X-Magic-API-Key: your-magic-api-key\' \\ -H \'X-OIDC-Provider-ID: your-oidc-provider-id\' \\ -d \'{ \"chain\": \"ETH\", \"message_base64\": \"bm9uZQ==\" }\' ``` **Example Response:** ```json { \"signature\": \"0x0cebb670d8375ac74122b46c44def7e1ce593e80434a3e6557108ae124f8b44f3c5068fc104279fe7f51918cbe4c249d707bc1c0ce2ffb6d201d3cf4e2fdee8d1b\", \"r\": \"0x0cebb670d8375ac74122b46c44def7e1ce593e80434a3e6557108ae124f8b44f\", \"s\": \"0x3c5068fc104279fe7f51918cbe4c249d707bc1c0ce2ffb6d201d3cf4e2fdee8d\", \"v\": \"27\" } ``` + * @summary Sign a message with the wallet. + * @param {PersonalSignRequest} personalSignRequest + * @param {string} [xMagicAPIKey] + * @param {string} [xMagicSecretKey] + * @param {string} [xOIDCProviderID] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async signMessageV1WalletPersonalSignPost(personalSignRequest: PersonalSignRequest, xMagicAPIKey?: string, xMagicSecretKey?: string, xOIDCProviderID?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.signMessageV1WalletPersonalSignPost(personalSignRequest, xMagicAPIKey, xMagicSecretKey, xOIDCProviderID, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + } +}; + +/** + * TransactionApi - factory interface + * @export + */ +export const TransactionApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = TransactionApiFp(configuration) + return { + /** + * Signs a hash of arbitrary data using the wallet\'s private key. **Example cURL:** ```bash curl -X POST \'https://tee.express.magiclabs.com/v1/wallet/sign\' \\ -H \'Content-Type: application/json\' \\ -H \'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjNhYVl5dGR3d2UwMzJzMXIzVElyOSJ9...\' \\ -H \'X-Magic-API-Key: your-magic-api-key\' \\ -H \'X-OIDC-Provider-ID: your-oidc-provider-id\' \\ -d \'{ \"chain\": \"ETH\", \"raw_data_hash\": \"0xabc123def4567890abc123def4567890abc123def4567890abc123def4567890\" }\' ``` **Example Response:** ```json { \"message_hash\": \"0xabc123def4567890abc123def4567890abc123def4567890abc123def4567890\", \"signature\": \"0x8e7d6c5b4a3928172635445566778899aabbccddeeff00112233445566778899\", \"r\": \"0x3d4e5f678901234567890abcdef1234567890abcdef1234567890abcdef1234\", \"s\": \"0x4e5f678901234567890abcdef1234567890abcdef1234567890abcdef123456\", \"v\": \"27\" } ``` + * @summary Sign arbitrary data with the wallet. + * @param {TransactionApiSignDataV1WalletSignPostRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + signDataV1WalletSignPost(requestParameters: TransactionApiSignDataV1WalletSignPostRequest, options?: AxiosRequestConfig): AxiosPromise { + return localVarFp.signDataV1WalletSignPost(requestParameters.signDataRequest, requestParameters.xMagicAPIKey, requestParameters.xMagicSecretKey, requestParameters.xOIDCProviderID, options).then((request) => request(axios, basePath)); + }, + /** + * Signs an arbitrary message using the wallet\'s private key. Useful for authentication and off-chain verification. **Example cURL:** ```bash curl -X POST \'https://tee.express.magiclabs.com/v1/wallet/personal-sign\' \\ -H \'Content-Type: application/json\' \\ -H \'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjNhYVl5dGR3d2UwMzJzMXIzVElyOSJ9...\' \\ -H \'X-Magic-API-Key: your-magic-api-key\' \\ -H \'X-OIDC-Provider-ID: your-oidc-provider-id\' \\ -d \'{ \"chain\": \"ETH\", \"message_base64\": \"bm9uZQ==\" }\' ``` **Example Response:** ```json { \"signature\": \"0x0cebb670d8375ac74122b46c44def7e1ce593e80434a3e6557108ae124f8b44f3c5068fc104279fe7f51918cbe4c249d707bc1c0ce2ffb6d201d3cf4e2fdee8d1b\", \"r\": \"0x0cebb670d8375ac74122b46c44def7e1ce593e80434a3e6557108ae124f8b44f\", \"s\": \"0x3c5068fc104279fe7f51918cbe4c249d707bc1c0ce2ffb6d201d3cf4e2fdee8d\", \"v\": \"27\" } ``` + * @summary Sign a message with the wallet. + * @param {TransactionApiSignMessageV1WalletPersonalSignPostRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + signMessageV1WalletPersonalSignPost(requestParameters: TransactionApiSignMessageV1WalletPersonalSignPostRequest, options?: AxiosRequestConfig): AxiosPromise { + return localVarFp.signMessageV1WalletPersonalSignPost(requestParameters.personalSignRequest, requestParameters.xMagicAPIKey, requestParameters.xMagicSecretKey, requestParameters.xOIDCProviderID, options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * Request parameters for signDataV1WalletSignPost operation in TransactionApi. + * @export + * @interface TransactionApiSignDataV1WalletSignPostRequest + */ +export interface TransactionApiSignDataV1WalletSignPostRequest { + /** + * + * @type {SignDataRequest} + * @memberof TransactionApiSignDataV1WalletSignPost + */ + readonly signDataRequest: SignDataRequest + + /** + * + * @type {string} + * @memberof TransactionApiSignDataV1WalletSignPost + */ + readonly xMagicAPIKey?: string + + /** + * + * @type {string} + * @memberof TransactionApiSignDataV1WalletSignPost + */ + readonly xMagicSecretKey?: string + + /** + * + * @type {string} + * @memberof TransactionApiSignDataV1WalletSignPost + */ + readonly xOIDCProviderID?: string +} + +/** + * Request parameters for signMessageV1WalletPersonalSignPost operation in TransactionApi. + * @export + * @interface TransactionApiSignMessageV1WalletPersonalSignPostRequest + */ +export interface TransactionApiSignMessageV1WalletPersonalSignPostRequest { + /** + * + * @type {PersonalSignRequest} + * @memberof TransactionApiSignMessageV1WalletPersonalSignPost + */ + readonly personalSignRequest: PersonalSignRequest + + /** + * + * @type {string} + * @memberof TransactionApiSignMessageV1WalletPersonalSignPost + */ + readonly xMagicAPIKey?: string + + /** + * + * @type {string} + * @memberof TransactionApiSignMessageV1WalletPersonalSignPost + */ + readonly xMagicSecretKey?: string + + /** + * + * @type {string} + * @memberof TransactionApiSignMessageV1WalletPersonalSignPost + */ + readonly xOIDCProviderID?: string +} + +/** + * TransactionApi - object-oriented interface + * @export + * @class TransactionApi + * @extends {BaseAPI} + */ +export class TransactionApi extends BaseAPI { + /** + * Signs a hash of arbitrary data using the wallet\'s private key. **Example cURL:** ```bash curl -X POST \'https://tee.express.magiclabs.com/v1/wallet/sign\' \\ -H \'Content-Type: application/json\' \\ -H \'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjNhYVl5dGR3d2UwMzJzMXIzVElyOSJ9...\' \\ -H \'X-Magic-API-Key: your-magic-api-key\' \\ -H \'X-OIDC-Provider-ID: your-oidc-provider-id\' \\ -d \'{ \"chain\": \"ETH\", \"raw_data_hash\": \"0xabc123def4567890abc123def4567890abc123def4567890abc123def4567890\" }\' ``` **Example Response:** ```json { \"message_hash\": \"0xabc123def4567890abc123def4567890abc123def4567890abc123def4567890\", \"signature\": \"0x8e7d6c5b4a3928172635445566778899aabbccddeeff00112233445566778899\", \"r\": \"0x3d4e5f678901234567890abcdef1234567890abcdef1234567890abcdef1234\", \"s\": \"0x4e5f678901234567890abcdef1234567890abcdef1234567890abcdef123456\", \"v\": \"27\" } ``` + * @summary Sign arbitrary data with the wallet. + * @param {TransactionApiSignDataV1WalletSignPostRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof TransactionApi + */ + public signDataV1WalletSignPost(requestParameters: TransactionApiSignDataV1WalletSignPostRequest, options?: AxiosRequestConfig) { + return TransactionApiFp(this.configuration).signDataV1WalletSignPost(requestParameters.signDataRequest, requestParameters.xMagicAPIKey, requestParameters.xMagicSecretKey, requestParameters.xOIDCProviderID, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Signs an arbitrary message using the wallet\'s private key. Useful for authentication and off-chain verification. **Example cURL:** ```bash curl -X POST \'https://tee.express.magiclabs.com/v1/wallet/personal-sign\' \\ -H \'Content-Type: application/json\' \\ -H \'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjNhYVl5dGR3d2UwMzJzMXIzVElyOSJ9...\' \\ -H \'X-Magic-API-Key: your-magic-api-key\' \\ -H \'X-OIDC-Provider-ID: your-oidc-provider-id\' \\ -d \'{ \"chain\": \"ETH\", \"message_base64\": \"bm9uZQ==\" }\' ``` **Example Response:** ```json { \"signature\": \"0x0cebb670d8375ac74122b46c44def7e1ce593e80434a3e6557108ae124f8b44f3c5068fc104279fe7f51918cbe4c249d707bc1c0ce2ffb6d201d3cf4e2fdee8d1b\", \"r\": \"0x0cebb670d8375ac74122b46c44def7e1ce593e80434a3e6557108ae124f8b44f\", \"s\": \"0x3c5068fc104279fe7f51918cbe4c249d707bc1c0ce2ffb6d201d3cf4e2fdee8d\", \"v\": \"27\" } ``` + * @summary Sign a message with the wallet. + * @param {TransactionApiSignMessageV1WalletPersonalSignPostRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof TransactionApi + */ + public signMessageV1WalletPersonalSignPost(requestParameters: TransactionApiSignMessageV1WalletPersonalSignPostRequest, options?: AxiosRequestConfig) { + return TransactionApiFp(this.configuration).signMessageV1WalletPersonalSignPost(requestParameters.personalSignRequest, requestParameters.xMagicAPIKey, requestParameters.xMagicSecretKey, requestParameters.xOIDCProviderID, options).then((request) => request(this.axios, this.basePath)); + } +} + diff --git a/packages/internal/generated-clients/src/magic-tee/domain/wallet-api.ts b/packages/internal/generated-clients/src/magic-tee/domain/wallet-api.ts new file mode 100644 index 0000000000..a33f091351 --- /dev/null +++ b/packages/internal/generated-clients/src/magic-tee/domain/wallet-api.ts @@ -0,0 +1,321 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * TEE Express + * TEE Express is a service that simplifies wallet management for developers. Unlike traditional wallet solutions that require complex key management, TEE Express handles all key management internally, providing a streamlined API for wallet operations. TEE Express leverages secure enclave technology to ensure that private keys never leave the secure environment. All wallet operations, including creation, signing, and key management, are performed within a trusted execution environment (TEE). This provides enterprise-grade security while maintaining the simplicity of a REST API. The service supports Ethereum wallets and provides endpoints for wallet creation, transaction signing, and message signing. All operations are authenticated using JWT tokens passed in the Authorization header, ensuring secure access to user wallets. **Migration Notice:** If you\'re an existing customer, your users\' wallets have been automatically migrated to TEE Express. There\'s no action required on your part - all existing wallets are now accessible through the TEE Express API using the same JWT tokens you currently use for authentication. Simply update your API calls to use the TEE Express endpoints, and pass your existing JWT token in the Authorization header for all requests. **Authentication:** - An API key via the `X-Magic-API-Key` header or a secret key via the `X-Magic-Secret-Key` header. - The OIDC provider ID via the `X-OIDC-Provider-ID` header. - Bearer token in the `Authorization` header. **Data Hashing for Signing:** For personal sign operations, encode your data as base64: ```typescript const message = Buffer.from(data, \'utf-8\').toString(\'base64\'); ``` For signing transaction data or other structured data, provide a keccak256 hash: ```typescript import { MessageTypes, SignTypedDataVersion, TypedDataUtils, TypedDataV1, TypedMessage, typedSignatureHash, } from \'@metamask/eth-sig-util\'; import { resolveProperties, Signature, Transaction, TransactionLike, TransactionRequest } from \'ethers\'; const computeEip712Hash = ( data: TypedMessage, version: SignTypedDataVersion.V3 | SignTypedDataVersion.V4, ): string => { const hashBuffer = TypedDataUtils.eip712Hash(data, version); return \'0x\' + hashBuffer.toString(\'hex\'); }; const personalSign = async (data: string) => { const message = Buffer.from(data, \'utf-8\').toString(\'base64\'); const body = { message_base64: message, chain: \'ETH\' }; return await fetch(\'/v1/wallet/personal-sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV1 = async (data: TypedDataV1) => { const rawDataHash = typedSignatureHash(data); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV3 = async (data: TypedMessage) => { const rawDataHash = computeEip712Hash(data, SignTypedDataVersion.V3); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV4 = async (data: TypedMessage) => { const rawDataHash = computeEip712Hash(data, SignTypedDataVersion.V4); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTransaction = async (tx: TransactionRequest) => { const resolvedTx = await resolveProperties(tx); const txForSigning = { ...resolvedTx }; delete txForSigning.from; const btx = Transaction.from(txForSigning as TransactionLike); const body = { raw_data_hash: btx.unsignedHash, chain: \'ETH\' }; const res = await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); const { r, s, v } = res.json(); btx.signature = Signature.from({ r, s, v }); return btx.serialized; }; ``` + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import type { Configuration } from '../configuration'; +import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; +// Some imports not used depending on template conditions +// @ts-ignore +import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common'; +// @ts-ignore +import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base'; +// @ts-ignore +import { Chain } from '../models'; +// @ts-ignore +import { CreateWalletRequestModel } from '../models'; +// @ts-ignore +import { HTTPValidationError } from '../models'; +// @ts-ignore +import { WalletResponseModel } from '../models'; +/** + * WalletApi - axios parameter creator + * @export + */ +export const WalletApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * Creates a new wallet for the given chain and returns its public address. **Example cURL:** ```bash curl -X POST \'https://tee.express.magiclabs.com/v1/wallet\' \\ -H \'Content-Type: application/json\' \\ -H \'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjNhYVl5dGR3d2UwMzJzMXIzVElyOSJ9...\' \\ -H \'X-Magic-API-Key: your-magic-api-key\' \\ -H \'X-OIDC-Provider-ID: your-oidc-provider-id\' \\ -d \'{ \"chain\": \"ETH\" }\' ``` **Example Response:** ```json { \"public_address\": \"0x6b422EefBFBc47a6900A1fc5454Ef4b940B7e36e\" } ``` + * @summary Create a new wallet. + * @param {CreateWalletRequestModel} createWalletRequestModel + * @param {string} [xMagicAPIKey] + * @param {string} [xMagicSecretKey] + * @param {string} [xOIDCProviderID] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createWalletV1WalletPost: async (createWalletRequestModel: CreateWalletRequestModel, xMagicAPIKey?: string, xMagicSecretKey?: string, xOIDCProviderID?: string, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'createWalletRequestModel' is not null or undefined + assertParamExists('createWalletV1WalletPost', 'createWalletRequestModel', createWalletRequestModel) + const localVarPath = `/v1/wallet`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication HTTPBearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) + + if (xMagicAPIKey != null) { + localVarHeaderParameter['X-Magic-API-Key'] = String(xMagicAPIKey); + } + + if (xMagicSecretKey != null) { + localVarHeaderParameter['X-Magic-Secret-Key'] = String(xMagicSecretKey); + } + + if (xOIDCProviderID != null) { + localVarHeaderParameter['X-OIDC-Provider-ID'] = String(xOIDCProviderID); + } + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(createWalletRequestModel, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns the wallet\'s public address for the given chain. **Example cURL:** ```bash curl -X GET \'https://tee.express.magiclabs.com/v1/wallet?chain=ETH\' \\ -H \'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjNhYVl5dGR3d2UwMzJzMXIzVElyOSJ9...\' \\ -H \'X-Magic-API-Key: your-magic-api-key\' \\ -H \'X-OIDC-Provider-ID: your-oidc-provider-id\' ``` **Example Response:** ```json { \"public_address\": \"0x6b422EefBFBc47a6900A1fc5454Ef4b940B7e36e\" } ``` + * @summary Get wallet details. + * @param {Chain} chain + * @param {string} [xMagicAPIKey] + * @param {string} [xMagicSecretKey] + * @param {string} [xOIDCProviderID] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getWalletV1WalletGet: async (chain: Chain, xMagicAPIKey?: string, xMagicSecretKey?: string, xOIDCProviderID?: string, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'chain' is not null or undefined + assertParamExists('getWalletV1WalletGet', 'chain', chain) + const localVarPath = `/v1/wallet`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication HTTPBearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) + + if (chain !== undefined) { + localVarQueryParameter['chain'] = chain; + } + + if (xMagicAPIKey != null) { + localVarHeaderParameter['X-Magic-API-Key'] = String(xMagicAPIKey); + } + + if (xMagicSecretKey != null) { + localVarHeaderParameter['X-Magic-Secret-Key'] = String(xMagicSecretKey); + } + + if (xOIDCProviderID != null) { + localVarHeaderParameter['X-OIDC-Provider-ID'] = String(xOIDCProviderID); + } + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * WalletApi - functional programming interface + * @export + */ +export const WalletApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = WalletApiAxiosParamCreator(configuration) + return { + /** + * Creates a new wallet for the given chain and returns its public address. **Example cURL:** ```bash curl -X POST \'https://tee.express.magiclabs.com/v1/wallet\' \\ -H \'Content-Type: application/json\' \\ -H \'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjNhYVl5dGR3d2UwMzJzMXIzVElyOSJ9...\' \\ -H \'X-Magic-API-Key: your-magic-api-key\' \\ -H \'X-OIDC-Provider-ID: your-oidc-provider-id\' \\ -d \'{ \"chain\": \"ETH\" }\' ``` **Example Response:** ```json { \"public_address\": \"0x6b422EefBFBc47a6900A1fc5454Ef4b940B7e36e\" } ``` + * @summary Create a new wallet. + * @param {CreateWalletRequestModel} createWalletRequestModel + * @param {string} [xMagicAPIKey] + * @param {string} [xMagicSecretKey] + * @param {string} [xOIDCProviderID] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async createWalletV1WalletPost(createWalletRequestModel: CreateWalletRequestModel, xMagicAPIKey?: string, xMagicSecretKey?: string, xOIDCProviderID?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.createWalletV1WalletPost(createWalletRequestModel, xMagicAPIKey, xMagicSecretKey, xOIDCProviderID, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * Returns the wallet\'s public address for the given chain. **Example cURL:** ```bash curl -X GET \'https://tee.express.magiclabs.com/v1/wallet?chain=ETH\' \\ -H \'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjNhYVl5dGR3d2UwMzJzMXIzVElyOSJ9...\' \\ -H \'X-Magic-API-Key: your-magic-api-key\' \\ -H \'X-OIDC-Provider-ID: your-oidc-provider-id\' ``` **Example Response:** ```json { \"public_address\": \"0x6b422EefBFBc47a6900A1fc5454Ef4b940B7e36e\" } ``` + * @summary Get wallet details. + * @param {Chain} chain + * @param {string} [xMagicAPIKey] + * @param {string} [xMagicSecretKey] + * @param {string} [xOIDCProviderID] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getWalletV1WalletGet(chain: Chain, xMagicAPIKey?: string, xMagicSecretKey?: string, xOIDCProviderID?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getWalletV1WalletGet(chain, xMagicAPIKey, xMagicSecretKey, xOIDCProviderID, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + } +}; + +/** + * WalletApi - factory interface + * @export + */ +export const WalletApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = WalletApiFp(configuration) + return { + /** + * Creates a new wallet for the given chain and returns its public address. **Example cURL:** ```bash curl -X POST \'https://tee.express.magiclabs.com/v1/wallet\' \\ -H \'Content-Type: application/json\' \\ -H \'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjNhYVl5dGR3d2UwMzJzMXIzVElyOSJ9...\' \\ -H \'X-Magic-API-Key: your-magic-api-key\' \\ -H \'X-OIDC-Provider-ID: your-oidc-provider-id\' \\ -d \'{ \"chain\": \"ETH\" }\' ``` **Example Response:** ```json { \"public_address\": \"0x6b422EefBFBc47a6900A1fc5454Ef4b940B7e36e\" } ``` + * @summary Create a new wallet. + * @param {WalletApiCreateWalletV1WalletPostRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createWalletV1WalletPost(requestParameters: WalletApiCreateWalletV1WalletPostRequest, options?: AxiosRequestConfig): AxiosPromise { + return localVarFp.createWalletV1WalletPost(requestParameters.createWalletRequestModel, requestParameters.xMagicAPIKey, requestParameters.xMagicSecretKey, requestParameters.xOIDCProviderID, options).then((request) => request(axios, basePath)); + }, + /** + * Returns the wallet\'s public address for the given chain. **Example cURL:** ```bash curl -X GET \'https://tee.express.magiclabs.com/v1/wallet?chain=ETH\' \\ -H \'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjNhYVl5dGR3d2UwMzJzMXIzVElyOSJ9...\' \\ -H \'X-Magic-API-Key: your-magic-api-key\' \\ -H \'X-OIDC-Provider-ID: your-oidc-provider-id\' ``` **Example Response:** ```json { \"public_address\": \"0x6b422EefBFBc47a6900A1fc5454Ef4b940B7e36e\" } ``` + * @summary Get wallet details. + * @param {WalletApiGetWalletV1WalletGetRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getWalletV1WalletGet(requestParameters: WalletApiGetWalletV1WalletGetRequest, options?: AxiosRequestConfig): AxiosPromise { + return localVarFp.getWalletV1WalletGet(requestParameters.chain, requestParameters.xMagicAPIKey, requestParameters.xMagicSecretKey, requestParameters.xOIDCProviderID, options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * Request parameters for createWalletV1WalletPost operation in WalletApi. + * @export + * @interface WalletApiCreateWalletV1WalletPostRequest + */ +export interface WalletApiCreateWalletV1WalletPostRequest { + /** + * + * @type {CreateWalletRequestModel} + * @memberof WalletApiCreateWalletV1WalletPost + */ + readonly createWalletRequestModel: CreateWalletRequestModel + + /** + * + * @type {string} + * @memberof WalletApiCreateWalletV1WalletPost + */ + readonly xMagicAPIKey?: string + + /** + * + * @type {string} + * @memberof WalletApiCreateWalletV1WalletPost + */ + readonly xMagicSecretKey?: string + + /** + * + * @type {string} + * @memberof WalletApiCreateWalletV1WalletPost + */ + readonly xOIDCProviderID?: string +} + +/** + * Request parameters for getWalletV1WalletGet operation in WalletApi. + * @export + * @interface WalletApiGetWalletV1WalletGetRequest + */ +export interface WalletApiGetWalletV1WalletGetRequest { + /** + * + * @type {Chain} + * @memberof WalletApiGetWalletV1WalletGet + */ + readonly chain: Chain + + /** + * + * @type {string} + * @memberof WalletApiGetWalletV1WalletGet + */ + readonly xMagicAPIKey?: string + + /** + * + * @type {string} + * @memberof WalletApiGetWalletV1WalletGet + */ + readonly xMagicSecretKey?: string + + /** + * + * @type {string} + * @memberof WalletApiGetWalletV1WalletGet + */ + readonly xOIDCProviderID?: string +} + +/** + * WalletApi - object-oriented interface + * @export + * @class WalletApi + * @extends {BaseAPI} + */ +export class WalletApi extends BaseAPI { + /** + * Creates a new wallet for the given chain and returns its public address. **Example cURL:** ```bash curl -X POST \'https://tee.express.magiclabs.com/v1/wallet\' \\ -H \'Content-Type: application/json\' \\ -H \'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjNhYVl5dGR3d2UwMzJzMXIzVElyOSJ9...\' \\ -H \'X-Magic-API-Key: your-magic-api-key\' \\ -H \'X-OIDC-Provider-ID: your-oidc-provider-id\' \\ -d \'{ \"chain\": \"ETH\" }\' ``` **Example Response:** ```json { \"public_address\": \"0x6b422EefBFBc47a6900A1fc5454Ef4b940B7e36e\" } ``` + * @summary Create a new wallet. + * @param {WalletApiCreateWalletV1WalletPostRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof WalletApi + */ + public createWalletV1WalletPost(requestParameters: WalletApiCreateWalletV1WalletPostRequest, options?: AxiosRequestConfig) { + return WalletApiFp(this.configuration).createWalletV1WalletPost(requestParameters.createWalletRequestModel, requestParameters.xMagicAPIKey, requestParameters.xMagicSecretKey, requestParameters.xOIDCProviderID, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Returns the wallet\'s public address for the given chain. **Example cURL:** ```bash curl -X GET \'https://tee.express.magiclabs.com/v1/wallet?chain=ETH\' \\ -H \'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjNhYVl5dGR3d2UwMzJzMXIzVElyOSJ9...\' \\ -H \'X-Magic-API-Key: your-magic-api-key\' \\ -H \'X-OIDC-Provider-ID: your-oidc-provider-id\' ``` **Example Response:** ```json { \"public_address\": \"0x6b422EefBFBc47a6900A1fc5454Ef4b940B7e36e\" } ``` + * @summary Get wallet details. + * @param {WalletApiGetWalletV1WalletGetRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof WalletApi + */ + public getWalletV1WalletGet(requestParameters: WalletApiGetWalletV1WalletGetRequest, options?: AxiosRequestConfig) { + return WalletApiFp(this.configuration).getWalletV1WalletGet(requestParameters.chain, requestParameters.xMagicAPIKey, requestParameters.xMagicSecretKey, requestParameters.xOIDCProviderID, options).then((request) => request(this.axios, this.basePath)); + } +} + diff --git a/packages/internal/generated-clients/src/magic-tee/git_push.sh b/packages/internal/generated-clients/src/magic-tee/git_push.sh new file mode 100644 index 0000000000..f53a75d4fa --- /dev/null +++ b/packages/internal/generated-clients/src/magic-tee/git_push.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=$(git remote) +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' diff --git a/packages/internal/generated-clients/src/magic-tee/index.ts b/packages/internal/generated-clients/src/magic-tee/index.ts new file mode 100644 index 0000000000..6eb2123b36 --- /dev/null +++ b/packages/internal/generated-clients/src/magic-tee/index.ts @@ -0,0 +1,18 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * TEE Express + * TEE Express is a service that simplifies wallet management for developers. Unlike traditional wallet solutions that require complex key management, TEE Express handles all key management internally, providing a streamlined API for wallet operations. TEE Express leverages secure enclave technology to ensure that private keys never leave the secure environment. All wallet operations, including creation, signing, and key management, are performed within a trusted execution environment (TEE). This provides enterprise-grade security while maintaining the simplicity of a REST API. The service supports Ethereum wallets and provides endpoints for wallet creation, transaction signing, and message signing. All operations are authenticated using JWT tokens passed in the Authorization header, ensuring secure access to user wallets. **Migration Notice:** If you\'re an existing customer, your users\' wallets have been automatically migrated to TEE Express. There\'s no action required on your part - all existing wallets are now accessible through the TEE Express API using the same JWT tokens you currently use for authentication. Simply update your API calls to use the TEE Express endpoints, and pass your existing JWT token in the Authorization header for all requests. **Authentication:** - An API key via the `X-Magic-API-Key` header or a secret key via the `X-Magic-Secret-Key` header. - The OIDC provider ID via the `X-OIDC-Provider-ID` header. - Bearer token in the `Authorization` header. **Data Hashing for Signing:** For personal sign operations, encode your data as base64: ```typescript const message = Buffer.from(data, \'utf-8\').toString(\'base64\'); ``` For signing transaction data or other structured data, provide a keccak256 hash: ```typescript import { MessageTypes, SignTypedDataVersion, TypedDataUtils, TypedDataV1, TypedMessage, typedSignatureHash, } from \'@metamask/eth-sig-util\'; import { resolveProperties, Signature, Transaction, TransactionLike, TransactionRequest } from \'ethers\'; const computeEip712Hash = ( data: TypedMessage, version: SignTypedDataVersion.V3 | SignTypedDataVersion.V4, ): string => { const hashBuffer = TypedDataUtils.eip712Hash(data, version); return \'0x\' + hashBuffer.toString(\'hex\'); }; const personalSign = async (data: string) => { const message = Buffer.from(data, \'utf-8\').toString(\'base64\'); const body = { message_base64: message, chain: \'ETH\' }; return await fetch(\'/v1/wallet/personal-sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV1 = async (data: TypedDataV1) => { const rawDataHash = typedSignatureHash(data); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV3 = async (data: TypedMessage) => { const rawDataHash = computeEip712Hash(data, SignTypedDataVersion.V3); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV4 = async (data: TypedMessage) => { const rawDataHash = computeEip712Hash(data, SignTypedDataVersion.V4); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTransaction = async (tx: TransactionRequest) => { const resolvedTx = await resolveProperties(tx); const txForSigning = { ...resolvedTx }; delete txForSigning.from; const btx = Transaction.from(txForSigning as TransactionLike); const body = { raw_data_hash: btx.unsignedHash, chain: \'ETH\' }; const res = await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); const { r, s, v } = res.json(); btx.signature = Signature.from({ r, s, v }); return btx.serialized; }; ``` + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export * from "./api"; +export * from "./configuration"; +export * from "./models"; diff --git a/packages/internal/generated-clients/src/magic-tee/models/chain.ts b/packages/internal/generated-clients/src/magic-tee/models/chain.ts new file mode 100644 index 0000000000..1a5121d1ee --- /dev/null +++ b/packages/internal/generated-clients/src/magic-tee/models/chain.ts @@ -0,0 +1,30 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * TEE Express + * TEE Express is a service that simplifies wallet management for developers. Unlike traditional wallet solutions that require complex key management, TEE Express handles all key management internally, providing a streamlined API for wallet operations. TEE Express leverages secure enclave technology to ensure that private keys never leave the secure environment. All wallet operations, including creation, signing, and key management, are performed within a trusted execution environment (TEE). This provides enterprise-grade security while maintaining the simplicity of a REST API. The service supports Ethereum wallets and provides endpoints for wallet creation, transaction signing, and message signing. All operations are authenticated using JWT tokens passed in the Authorization header, ensuring secure access to user wallets. **Migration Notice:** If you\'re an existing customer, your users\' wallets have been automatically migrated to TEE Express. There\'s no action required on your part - all existing wallets are now accessible through the TEE Express API using the same JWT tokens you currently use for authentication. Simply update your API calls to use the TEE Express endpoints, and pass your existing JWT token in the Authorization header for all requests. **Authentication:** - An API key via the `X-Magic-API-Key` header or a secret key via the `X-Magic-Secret-Key` header. - The OIDC provider ID via the `X-OIDC-Provider-ID` header. - Bearer token in the `Authorization` header. **Data Hashing for Signing:** For personal sign operations, encode your data as base64: ```typescript const message = Buffer.from(data, \'utf-8\').toString(\'base64\'); ``` For signing transaction data or other structured data, provide a keccak256 hash: ```typescript import { MessageTypes, SignTypedDataVersion, TypedDataUtils, TypedDataV1, TypedMessage, typedSignatureHash, } from \'@metamask/eth-sig-util\'; import { resolveProperties, Signature, Transaction, TransactionLike, TransactionRequest } from \'ethers\'; const computeEip712Hash = ( data: TypedMessage, version: SignTypedDataVersion.V3 | SignTypedDataVersion.V4, ): string => { const hashBuffer = TypedDataUtils.eip712Hash(data, version); return \'0x\' + hashBuffer.toString(\'hex\'); }; const personalSign = async (data: string) => { const message = Buffer.from(data, \'utf-8\').toString(\'base64\'); const body = { message_base64: message, chain: \'ETH\' }; return await fetch(\'/v1/wallet/personal-sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV1 = async (data: TypedDataV1) => { const rawDataHash = typedSignatureHash(data); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV3 = async (data: TypedMessage) => { const rawDataHash = computeEip712Hash(data, SignTypedDataVersion.V3); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV4 = async (data: TypedMessage) => { const rawDataHash = computeEip712Hash(data, SignTypedDataVersion.V4); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTransaction = async (tx: TransactionRequest) => { const resolvedTx = await resolveProperties(tx); const txForSigning = { ...resolvedTx }; delete txForSigning.from; const btx = Transaction.from(txForSigning as TransactionLike); const body = { raw_data_hash: btx.unsignedHash, chain: \'ETH\' }; const res = await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); const { r, s, v } = res.json(); btx.signature = Signature.from({ r, s, v }); return btx.serialized; }; ``` + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +/** + * + * @export + * @enum {string} + */ + +export const Chain = { + Eth: 'ETH' +} as const; + +export type Chain = typeof Chain[keyof typeof Chain]; + + + diff --git a/packages/internal/generated-clients/src/magic-tee/models/create-wallet-request-model.ts b/packages/internal/generated-clients/src/magic-tee/models/create-wallet-request-model.ts new file mode 100644 index 0000000000..ecbff8d921 --- /dev/null +++ b/packages/internal/generated-clients/src/magic-tee/models/create-wallet-request-model.ts @@ -0,0 +1,35 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * TEE Express + * TEE Express is a service that simplifies wallet management for developers. Unlike traditional wallet solutions that require complex key management, TEE Express handles all key management internally, providing a streamlined API for wallet operations. TEE Express leverages secure enclave technology to ensure that private keys never leave the secure environment. All wallet operations, including creation, signing, and key management, are performed within a trusted execution environment (TEE). This provides enterprise-grade security while maintaining the simplicity of a REST API. The service supports Ethereum wallets and provides endpoints for wallet creation, transaction signing, and message signing. All operations are authenticated using JWT tokens passed in the Authorization header, ensuring secure access to user wallets. **Migration Notice:** If you\'re an existing customer, your users\' wallets have been automatically migrated to TEE Express. There\'s no action required on your part - all existing wallets are now accessible through the TEE Express API using the same JWT tokens you currently use for authentication. Simply update your API calls to use the TEE Express endpoints, and pass your existing JWT token in the Authorization header for all requests. **Authentication:** - An API key via the `X-Magic-API-Key` header or a secret key via the `X-Magic-Secret-Key` header. - The OIDC provider ID via the `X-OIDC-Provider-ID` header. - Bearer token in the `Authorization` header. **Data Hashing for Signing:** For personal sign operations, encode your data as base64: ```typescript const message = Buffer.from(data, \'utf-8\').toString(\'base64\'); ``` For signing transaction data or other structured data, provide a keccak256 hash: ```typescript import { MessageTypes, SignTypedDataVersion, TypedDataUtils, TypedDataV1, TypedMessage, typedSignatureHash, } from \'@metamask/eth-sig-util\'; import { resolveProperties, Signature, Transaction, TransactionLike, TransactionRequest } from \'ethers\'; const computeEip712Hash = ( data: TypedMessage, version: SignTypedDataVersion.V3 | SignTypedDataVersion.V4, ): string => { const hashBuffer = TypedDataUtils.eip712Hash(data, version); return \'0x\' + hashBuffer.toString(\'hex\'); }; const personalSign = async (data: string) => { const message = Buffer.from(data, \'utf-8\').toString(\'base64\'); const body = { message_base64: message, chain: \'ETH\' }; return await fetch(\'/v1/wallet/personal-sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV1 = async (data: TypedDataV1) => { const rawDataHash = typedSignatureHash(data); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV3 = async (data: TypedMessage) => { const rawDataHash = computeEip712Hash(data, SignTypedDataVersion.V3); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV4 = async (data: TypedMessage) => { const rawDataHash = computeEip712Hash(data, SignTypedDataVersion.V4); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTransaction = async (tx: TransactionRequest) => { const resolvedTx = await resolveProperties(tx); const txForSigning = { ...resolvedTx }; delete txForSigning.from; const btx = Transaction.from(txForSigning as TransactionLike); const body = { raw_data_hash: btx.unsignedHash, chain: \'ETH\' }; const res = await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); const { r, s, v } = res.json(); btx.signature = Signature.from({ r, s, v }); return btx.serialized; }; ``` + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +// May contain unused imports in some cases +// @ts-ignore +import { Chain } from './chain'; + +/** + * + * @export + * @interface CreateWalletRequestModel + */ +export interface CreateWalletRequestModel { + /** + * + * @type {Chain} + * @memberof CreateWalletRequestModel + */ + 'chain': Chain; +} + + + diff --git a/packages/internal/generated-clients/src/magic-tee/models/httpvalidation-error.ts b/packages/internal/generated-clients/src/magic-tee/models/httpvalidation-error.ts new file mode 100644 index 0000000000..1761c19ed5 --- /dev/null +++ b/packages/internal/generated-clients/src/magic-tee/models/httpvalidation-error.ts @@ -0,0 +1,33 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * TEE Express + * TEE Express is a service that simplifies wallet management for developers. Unlike traditional wallet solutions that require complex key management, TEE Express handles all key management internally, providing a streamlined API for wallet operations. TEE Express leverages secure enclave technology to ensure that private keys never leave the secure environment. All wallet operations, including creation, signing, and key management, are performed within a trusted execution environment (TEE). This provides enterprise-grade security while maintaining the simplicity of a REST API. The service supports Ethereum wallets and provides endpoints for wallet creation, transaction signing, and message signing. All operations are authenticated using JWT tokens passed in the Authorization header, ensuring secure access to user wallets. **Migration Notice:** If you\'re an existing customer, your users\' wallets have been automatically migrated to TEE Express. There\'s no action required on your part - all existing wallets are now accessible through the TEE Express API using the same JWT tokens you currently use for authentication. Simply update your API calls to use the TEE Express endpoints, and pass your existing JWT token in the Authorization header for all requests. **Authentication:** - An API key via the `X-Magic-API-Key` header or a secret key via the `X-Magic-Secret-Key` header. - The OIDC provider ID via the `X-OIDC-Provider-ID` header. - Bearer token in the `Authorization` header. **Data Hashing for Signing:** For personal sign operations, encode your data as base64: ```typescript const message = Buffer.from(data, \'utf-8\').toString(\'base64\'); ``` For signing transaction data or other structured data, provide a keccak256 hash: ```typescript import { MessageTypes, SignTypedDataVersion, TypedDataUtils, TypedDataV1, TypedMessage, typedSignatureHash, } from \'@metamask/eth-sig-util\'; import { resolveProperties, Signature, Transaction, TransactionLike, TransactionRequest } from \'ethers\'; const computeEip712Hash = ( data: TypedMessage, version: SignTypedDataVersion.V3 | SignTypedDataVersion.V4, ): string => { const hashBuffer = TypedDataUtils.eip712Hash(data, version); return \'0x\' + hashBuffer.toString(\'hex\'); }; const personalSign = async (data: string) => { const message = Buffer.from(data, \'utf-8\').toString(\'base64\'); const body = { message_base64: message, chain: \'ETH\' }; return await fetch(\'/v1/wallet/personal-sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV1 = async (data: TypedDataV1) => { const rawDataHash = typedSignatureHash(data); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV3 = async (data: TypedMessage) => { const rawDataHash = computeEip712Hash(data, SignTypedDataVersion.V3); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV4 = async (data: TypedMessage) => { const rawDataHash = computeEip712Hash(data, SignTypedDataVersion.V4); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTransaction = async (tx: TransactionRequest) => { const resolvedTx = await resolveProperties(tx); const txForSigning = { ...resolvedTx }; delete txForSigning.from; const btx = Transaction.from(txForSigning as TransactionLike); const body = { raw_data_hash: btx.unsignedHash, chain: \'ETH\' }; const res = await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); const { r, s, v } = res.json(); btx.signature = Signature.from({ r, s, v }); return btx.serialized; }; ``` + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +// May contain unused imports in some cases +// @ts-ignore +import { ValidationError } from './validation-error'; + +/** + * + * @export + * @interface HTTPValidationError + */ +export interface HTTPValidationError { + /** + * + * @type {Array} + * @memberof HTTPValidationError + */ + 'detail'?: Array; +} + diff --git a/packages/internal/generated-clients/src/magic-tee/models/index.ts b/packages/internal/generated-clients/src/magic-tee/models/index.ts new file mode 100644 index 0000000000..670504f0a6 --- /dev/null +++ b/packages/internal/generated-clients/src/magic-tee/models/index.ts @@ -0,0 +1,10 @@ +export * from './chain'; +export * from './create-wallet-request-model'; +export * from './httpvalidation-error'; +export * from './personal-sign-request'; +export * from './personal-sign-response'; +export * from './sign-data-request'; +export * from './sign-data-response'; +export * from './validation-error'; +export * from './validation-error-loc-inner'; +export * from './wallet-response-model'; diff --git a/packages/internal/generated-clients/src/magic-tee/models/personal-sign-request.ts b/packages/internal/generated-clients/src/magic-tee/models/personal-sign-request.ts new file mode 100644 index 0000000000..5cbde8a82e --- /dev/null +++ b/packages/internal/generated-clients/src/magic-tee/models/personal-sign-request.ts @@ -0,0 +1,41 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * TEE Express + * TEE Express is a service that simplifies wallet management for developers. Unlike traditional wallet solutions that require complex key management, TEE Express handles all key management internally, providing a streamlined API for wallet operations. TEE Express leverages secure enclave technology to ensure that private keys never leave the secure environment. All wallet operations, including creation, signing, and key management, are performed within a trusted execution environment (TEE). This provides enterprise-grade security while maintaining the simplicity of a REST API. The service supports Ethereum wallets and provides endpoints for wallet creation, transaction signing, and message signing. All operations are authenticated using JWT tokens passed in the Authorization header, ensuring secure access to user wallets. **Migration Notice:** If you\'re an existing customer, your users\' wallets have been automatically migrated to TEE Express. There\'s no action required on your part - all existing wallets are now accessible through the TEE Express API using the same JWT tokens you currently use for authentication. Simply update your API calls to use the TEE Express endpoints, and pass your existing JWT token in the Authorization header for all requests. **Authentication:** - An API key via the `X-Magic-API-Key` header or a secret key via the `X-Magic-Secret-Key` header. - The OIDC provider ID via the `X-OIDC-Provider-ID` header. - Bearer token in the `Authorization` header. **Data Hashing for Signing:** For personal sign operations, encode your data as base64: ```typescript const message = Buffer.from(data, \'utf-8\').toString(\'base64\'); ``` For signing transaction data or other structured data, provide a keccak256 hash: ```typescript import { MessageTypes, SignTypedDataVersion, TypedDataUtils, TypedDataV1, TypedMessage, typedSignatureHash, } from \'@metamask/eth-sig-util\'; import { resolveProperties, Signature, Transaction, TransactionLike, TransactionRequest } from \'ethers\'; const computeEip712Hash = ( data: TypedMessage, version: SignTypedDataVersion.V3 | SignTypedDataVersion.V4, ): string => { const hashBuffer = TypedDataUtils.eip712Hash(data, version); return \'0x\' + hashBuffer.toString(\'hex\'); }; const personalSign = async (data: string) => { const message = Buffer.from(data, \'utf-8\').toString(\'base64\'); const body = { message_base64: message, chain: \'ETH\' }; return await fetch(\'/v1/wallet/personal-sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV1 = async (data: TypedDataV1) => { const rawDataHash = typedSignatureHash(data); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV3 = async (data: TypedMessage) => { const rawDataHash = computeEip712Hash(data, SignTypedDataVersion.V3); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV4 = async (data: TypedMessage) => { const rawDataHash = computeEip712Hash(data, SignTypedDataVersion.V4); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTransaction = async (tx: TransactionRequest) => { const resolvedTx = await resolveProperties(tx); const txForSigning = { ...resolvedTx }; delete txForSigning.from; const btx = Transaction.from(txForSigning as TransactionLike); const body = { raw_data_hash: btx.unsignedHash, chain: \'ETH\' }; const res = await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); const { r, s, v } = res.json(); btx.signature = Signature.from({ r, s, v }); return btx.serialized; }; ``` + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +// May contain unused imports in some cases +// @ts-ignore +import { Chain } from './chain'; + +/** + * + * @export + * @interface PersonalSignRequest + */ +export interface PersonalSignRequest { + /** + * + * @type {Chain} + * @memberof PersonalSignRequest + */ + 'chain': Chain; + /** + * + * @type {string} + * @memberof PersonalSignRequest + */ + 'message_base64': string; +} + + + diff --git a/packages/internal/generated-clients/src/magic-tee/models/personal-sign-response.ts b/packages/internal/generated-clients/src/magic-tee/models/personal-sign-response.ts new file mode 100644 index 0000000000..6f8834873e --- /dev/null +++ b/packages/internal/generated-clients/src/magic-tee/models/personal-sign-response.ts @@ -0,0 +1,48 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * TEE Express + * TEE Express is a service that simplifies wallet management for developers. Unlike traditional wallet solutions that require complex key management, TEE Express handles all key management internally, providing a streamlined API for wallet operations. TEE Express leverages secure enclave technology to ensure that private keys never leave the secure environment. All wallet operations, including creation, signing, and key management, are performed within a trusted execution environment (TEE). This provides enterprise-grade security while maintaining the simplicity of a REST API. The service supports Ethereum wallets and provides endpoints for wallet creation, transaction signing, and message signing. All operations are authenticated using JWT tokens passed in the Authorization header, ensuring secure access to user wallets. **Migration Notice:** If you\'re an existing customer, your users\' wallets have been automatically migrated to TEE Express. There\'s no action required on your part - all existing wallets are now accessible through the TEE Express API using the same JWT tokens you currently use for authentication. Simply update your API calls to use the TEE Express endpoints, and pass your existing JWT token in the Authorization header for all requests. **Authentication:** - An API key via the `X-Magic-API-Key` header or a secret key via the `X-Magic-Secret-Key` header. - The OIDC provider ID via the `X-OIDC-Provider-ID` header. - Bearer token in the `Authorization` header. **Data Hashing for Signing:** For personal sign operations, encode your data as base64: ```typescript const message = Buffer.from(data, \'utf-8\').toString(\'base64\'); ``` For signing transaction data or other structured data, provide a keccak256 hash: ```typescript import { MessageTypes, SignTypedDataVersion, TypedDataUtils, TypedDataV1, TypedMessage, typedSignatureHash, } from \'@metamask/eth-sig-util\'; import { resolveProperties, Signature, Transaction, TransactionLike, TransactionRequest } from \'ethers\'; const computeEip712Hash = ( data: TypedMessage, version: SignTypedDataVersion.V3 | SignTypedDataVersion.V4, ): string => { const hashBuffer = TypedDataUtils.eip712Hash(data, version); return \'0x\' + hashBuffer.toString(\'hex\'); }; const personalSign = async (data: string) => { const message = Buffer.from(data, \'utf-8\').toString(\'base64\'); const body = { message_base64: message, chain: \'ETH\' }; return await fetch(\'/v1/wallet/personal-sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV1 = async (data: TypedDataV1) => { const rawDataHash = typedSignatureHash(data); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV3 = async (data: TypedMessage) => { const rawDataHash = computeEip712Hash(data, SignTypedDataVersion.V3); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV4 = async (data: TypedMessage) => { const rawDataHash = computeEip712Hash(data, SignTypedDataVersion.V4); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTransaction = async (tx: TransactionRequest) => { const resolvedTx = await resolveProperties(tx); const txForSigning = { ...resolvedTx }; delete txForSigning.from; const btx = Transaction.from(txForSigning as TransactionLike); const body = { raw_data_hash: btx.unsignedHash, chain: \'ETH\' }; const res = await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); const { r, s, v } = res.json(); btx.signature = Signature.from({ r, s, v }); return btx.serialized; }; ``` + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +/** + * + * @export + * @interface PersonalSignResponse + */ +export interface PersonalSignResponse { + /** + * + * @type {string} + * @memberof PersonalSignResponse + */ + 'signature': string; + /** + * + * @type {string} + * @memberof PersonalSignResponse + */ + 'r': string; + /** + * + * @type {string} + * @memberof PersonalSignResponse + */ + 's': string; + /** + * + * @type {string} + * @memberof PersonalSignResponse + */ + 'v': string; +} + diff --git a/packages/internal/generated-clients/src/magic-tee/models/sign-data-request.ts b/packages/internal/generated-clients/src/magic-tee/models/sign-data-request.ts new file mode 100644 index 0000000000..0e99cd0383 --- /dev/null +++ b/packages/internal/generated-clients/src/magic-tee/models/sign-data-request.ts @@ -0,0 +1,41 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * TEE Express + * TEE Express is a service that simplifies wallet management for developers. Unlike traditional wallet solutions that require complex key management, TEE Express handles all key management internally, providing a streamlined API for wallet operations. TEE Express leverages secure enclave technology to ensure that private keys never leave the secure environment. All wallet operations, including creation, signing, and key management, are performed within a trusted execution environment (TEE). This provides enterprise-grade security while maintaining the simplicity of a REST API. The service supports Ethereum wallets and provides endpoints for wallet creation, transaction signing, and message signing. All operations are authenticated using JWT tokens passed in the Authorization header, ensuring secure access to user wallets. **Migration Notice:** If you\'re an existing customer, your users\' wallets have been automatically migrated to TEE Express. There\'s no action required on your part - all existing wallets are now accessible through the TEE Express API using the same JWT tokens you currently use for authentication. Simply update your API calls to use the TEE Express endpoints, and pass your existing JWT token in the Authorization header for all requests. **Authentication:** - An API key via the `X-Magic-API-Key` header or a secret key via the `X-Magic-Secret-Key` header. - The OIDC provider ID via the `X-OIDC-Provider-ID` header. - Bearer token in the `Authorization` header. **Data Hashing for Signing:** For personal sign operations, encode your data as base64: ```typescript const message = Buffer.from(data, \'utf-8\').toString(\'base64\'); ``` For signing transaction data or other structured data, provide a keccak256 hash: ```typescript import { MessageTypes, SignTypedDataVersion, TypedDataUtils, TypedDataV1, TypedMessage, typedSignatureHash, } from \'@metamask/eth-sig-util\'; import { resolveProperties, Signature, Transaction, TransactionLike, TransactionRequest } from \'ethers\'; const computeEip712Hash = ( data: TypedMessage, version: SignTypedDataVersion.V3 | SignTypedDataVersion.V4, ): string => { const hashBuffer = TypedDataUtils.eip712Hash(data, version); return \'0x\' + hashBuffer.toString(\'hex\'); }; const personalSign = async (data: string) => { const message = Buffer.from(data, \'utf-8\').toString(\'base64\'); const body = { message_base64: message, chain: \'ETH\' }; return await fetch(\'/v1/wallet/personal-sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV1 = async (data: TypedDataV1) => { const rawDataHash = typedSignatureHash(data); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV3 = async (data: TypedMessage) => { const rawDataHash = computeEip712Hash(data, SignTypedDataVersion.V3); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV4 = async (data: TypedMessage) => { const rawDataHash = computeEip712Hash(data, SignTypedDataVersion.V4); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTransaction = async (tx: TransactionRequest) => { const resolvedTx = await resolveProperties(tx); const txForSigning = { ...resolvedTx }; delete txForSigning.from; const btx = Transaction.from(txForSigning as TransactionLike); const body = { raw_data_hash: btx.unsignedHash, chain: \'ETH\' }; const res = await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); const { r, s, v } = res.json(); btx.signature = Signature.from({ r, s, v }); return btx.serialized; }; ``` + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +// May contain unused imports in some cases +// @ts-ignore +import { Chain } from './chain'; + +/** + * + * @export + * @interface SignDataRequest + */ +export interface SignDataRequest { + /** + * + * @type {Chain} + * @memberof SignDataRequest + */ + 'chain': Chain; + /** + * + * @type {string} + * @memberof SignDataRequest + */ + 'raw_data_hash': string; +} + + + diff --git a/packages/internal/generated-clients/src/magic-tee/models/sign-data-response.ts b/packages/internal/generated-clients/src/magic-tee/models/sign-data-response.ts new file mode 100644 index 0000000000..b2330e9ae7 --- /dev/null +++ b/packages/internal/generated-clients/src/magic-tee/models/sign-data-response.ts @@ -0,0 +1,54 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * TEE Express + * TEE Express is a service that simplifies wallet management for developers. Unlike traditional wallet solutions that require complex key management, TEE Express handles all key management internally, providing a streamlined API for wallet operations. TEE Express leverages secure enclave technology to ensure that private keys never leave the secure environment. All wallet operations, including creation, signing, and key management, are performed within a trusted execution environment (TEE). This provides enterprise-grade security while maintaining the simplicity of a REST API. The service supports Ethereum wallets and provides endpoints for wallet creation, transaction signing, and message signing. All operations are authenticated using JWT tokens passed in the Authorization header, ensuring secure access to user wallets. **Migration Notice:** If you\'re an existing customer, your users\' wallets have been automatically migrated to TEE Express. There\'s no action required on your part - all existing wallets are now accessible through the TEE Express API using the same JWT tokens you currently use for authentication. Simply update your API calls to use the TEE Express endpoints, and pass your existing JWT token in the Authorization header for all requests. **Authentication:** - An API key via the `X-Magic-API-Key` header or a secret key via the `X-Magic-Secret-Key` header. - The OIDC provider ID via the `X-OIDC-Provider-ID` header. - Bearer token in the `Authorization` header. **Data Hashing for Signing:** For personal sign operations, encode your data as base64: ```typescript const message = Buffer.from(data, \'utf-8\').toString(\'base64\'); ``` For signing transaction data or other structured data, provide a keccak256 hash: ```typescript import { MessageTypes, SignTypedDataVersion, TypedDataUtils, TypedDataV1, TypedMessage, typedSignatureHash, } from \'@metamask/eth-sig-util\'; import { resolveProperties, Signature, Transaction, TransactionLike, TransactionRequest } from \'ethers\'; const computeEip712Hash = ( data: TypedMessage, version: SignTypedDataVersion.V3 | SignTypedDataVersion.V4, ): string => { const hashBuffer = TypedDataUtils.eip712Hash(data, version); return \'0x\' + hashBuffer.toString(\'hex\'); }; const personalSign = async (data: string) => { const message = Buffer.from(data, \'utf-8\').toString(\'base64\'); const body = { message_base64: message, chain: \'ETH\' }; return await fetch(\'/v1/wallet/personal-sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV1 = async (data: TypedDataV1) => { const rawDataHash = typedSignatureHash(data); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV3 = async (data: TypedMessage) => { const rawDataHash = computeEip712Hash(data, SignTypedDataVersion.V3); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV4 = async (data: TypedMessage) => { const rawDataHash = computeEip712Hash(data, SignTypedDataVersion.V4); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTransaction = async (tx: TransactionRequest) => { const resolvedTx = await resolveProperties(tx); const txForSigning = { ...resolvedTx }; delete txForSigning.from; const btx = Transaction.from(txForSigning as TransactionLike); const body = { raw_data_hash: btx.unsignedHash, chain: \'ETH\' }; const res = await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); const { r, s, v } = res.json(); btx.signature = Signature.from({ r, s, v }); return btx.serialized; }; ``` + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +/** + * + * @export + * @interface SignDataResponse + */ +export interface SignDataResponse { + /** + * + * @type {string} + * @memberof SignDataResponse + */ + 'message_hash': string; + /** + * + * @type {string} + * @memberof SignDataResponse + */ + 'signature': string; + /** + * + * @type {string} + * @memberof SignDataResponse + */ + 'r': string; + /** + * + * @type {string} + * @memberof SignDataResponse + */ + 's': string; + /** + * + * @type {string} + * @memberof SignDataResponse + */ + 'v': string; +} + diff --git a/packages/internal/generated-clients/src/magic-tee/models/validation-error-loc-inner.ts b/packages/internal/generated-clients/src/magic-tee/models/validation-error-loc-inner.ts new file mode 100644 index 0000000000..9f38dade8e --- /dev/null +++ b/packages/internal/generated-clients/src/magic-tee/models/validation-error-loc-inner.ts @@ -0,0 +1,24 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * TEE Express + * TEE Express is a service that simplifies wallet management for developers. Unlike traditional wallet solutions that require complex key management, TEE Express handles all key management internally, providing a streamlined API for wallet operations. TEE Express leverages secure enclave technology to ensure that private keys never leave the secure environment. All wallet operations, including creation, signing, and key management, are performed within a trusted execution environment (TEE). This provides enterprise-grade security while maintaining the simplicity of a REST API. The service supports Ethereum wallets and provides endpoints for wallet creation, transaction signing, and message signing. All operations are authenticated using JWT tokens passed in the Authorization header, ensuring secure access to user wallets. **Migration Notice:** If you\'re an existing customer, your users\' wallets have been automatically migrated to TEE Express. There\'s no action required on your part - all existing wallets are now accessible through the TEE Express API using the same JWT tokens you currently use for authentication. Simply update your API calls to use the TEE Express endpoints, and pass your existing JWT token in the Authorization header for all requests. **Authentication:** - An API key via the `X-Magic-API-Key` header or a secret key via the `X-Magic-Secret-Key` header. - The OIDC provider ID via the `X-OIDC-Provider-ID` header. - Bearer token in the `Authorization` header. **Data Hashing for Signing:** For personal sign operations, encode your data as base64: ```typescript const message = Buffer.from(data, \'utf-8\').toString(\'base64\'); ``` For signing transaction data or other structured data, provide a keccak256 hash: ```typescript import { MessageTypes, SignTypedDataVersion, TypedDataUtils, TypedDataV1, TypedMessage, typedSignatureHash, } from \'@metamask/eth-sig-util\'; import { resolveProperties, Signature, Transaction, TransactionLike, TransactionRequest } from \'ethers\'; const computeEip712Hash = ( data: TypedMessage, version: SignTypedDataVersion.V3 | SignTypedDataVersion.V4, ): string => { const hashBuffer = TypedDataUtils.eip712Hash(data, version); return \'0x\' + hashBuffer.toString(\'hex\'); }; const personalSign = async (data: string) => { const message = Buffer.from(data, \'utf-8\').toString(\'base64\'); const body = { message_base64: message, chain: \'ETH\' }; return await fetch(\'/v1/wallet/personal-sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV1 = async (data: TypedDataV1) => { const rawDataHash = typedSignatureHash(data); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV3 = async (data: TypedMessage) => { const rawDataHash = computeEip712Hash(data, SignTypedDataVersion.V3); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV4 = async (data: TypedMessage) => { const rawDataHash = computeEip712Hash(data, SignTypedDataVersion.V4); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTransaction = async (tx: TransactionRequest) => { const resolvedTx = await resolveProperties(tx); const txForSigning = { ...resolvedTx }; delete txForSigning.from; const btx = Transaction.from(txForSigning as TransactionLike); const body = { raw_data_hash: btx.unsignedHash, chain: \'ETH\' }; const res = await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); const { r, s, v } = res.json(); btx.signature = Signature.from({ r, s, v }); return btx.serialized; }; ``` + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +/** + * + * @export + * @interface ValidationErrorLocInner + */ +export interface ValidationErrorLocInner { +} + diff --git a/packages/internal/generated-clients/src/magic-tee/models/validation-error.ts b/packages/internal/generated-clients/src/magic-tee/models/validation-error.ts new file mode 100644 index 0000000000..e0183d25e1 --- /dev/null +++ b/packages/internal/generated-clients/src/magic-tee/models/validation-error.ts @@ -0,0 +1,45 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * TEE Express + * TEE Express is a service that simplifies wallet management for developers. Unlike traditional wallet solutions that require complex key management, TEE Express handles all key management internally, providing a streamlined API for wallet operations. TEE Express leverages secure enclave technology to ensure that private keys never leave the secure environment. All wallet operations, including creation, signing, and key management, are performed within a trusted execution environment (TEE). This provides enterprise-grade security while maintaining the simplicity of a REST API. The service supports Ethereum wallets and provides endpoints for wallet creation, transaction signing, and message signing. All operations are authenticated using JWT tokens passed in the Authorization header, ensuring secure access to user wallets. **Migration Notice:** If you\'re an existing customer, your users\' wallets have been automatically migrated to TEE Express. There\'s no action required on your part - all existing wallets are now accessible through the TEE Express API using the same JWT tokens you currently use for authentication. Simply update your API calls to use the TEE Express endpoints, and pass your existing JWT token in the Authorization header for all requests. **Authentication:** - An API key via the `X-Magic-API-Key` header or a secret key via the `X-Magic-Secret-Key` header. - The OIDC provider ID via the `X-OIDC-Provider-ID` header. - Bearer token in the `Authorization` header. **Data Hashing for Signing:** For personal sign operations, encode your data as base64: ```typescript const message = Buffer.from(data, \'utf-8\').toString(\'base64\'); ``` For signing transaction data or other structured data, provide a keccak256 hash: ```typescript import { MessageTypes, SignTypedDataVersion, TypedDataUtils, TypedDataV1, TypedMessage, typedSignatureHash, } from \'@metamask/eth-sig-util\'; import { resolveProperties, Signature, Transaction, TransactionLike, TransactionRequest } from \'ethers\'; const computeEip712Hash = ( data: TypedMessage, version: SignTypedDataVersion.V3 | SignTypedDataVersion.V4, ): string => { const hashBuffer = TypedDataUtils.eip712Hash(data, version); return \'0x\' + hashBuffer.toString(\'hex\'); }; const personalSign = async (data: string) => { const message = Buffer.from(data, \'utf-8\').toString(\'base64\'); const body = { message_base64: message, chain: \'ETH\' }; return await fetch(\'/v1/wallet/personal-sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV1 = async (data: TypedDataV1) => { const rawDataHash = typedSignatureHash(data); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV3 = async (data: TypedMessage) => { const rawDataHash = computeEip712Hash(data, SignTypedDataVersion.V3); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV4 = async (data: TypedMessage) => { const rawDataHash = computeEip712Hash(data, SignTypedDataVersion.V4); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTransaction = async (tx: TransactionRequest) => { const resolvedTx = await resolveProperties(tx); const txForSigning = { ...resolvedTx }; delete txForSigning.from; const btx = Transaction.from(txForSigning as TransactionLike); const body = { raw_data_hash: btx.unsignedHash, chain: \'ETH\' }; const res = await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); const { r, s, v } = res.json(); btx.signature = Signature.from({ r, s, v }); return btx.serialized; }; ``` + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +// May contain unused imports in some cases +// @ts-ignore +import { ValidationErrorLocInner } from './validation-error-loc-inner'; + +/** + * + * @export + * @interface ValidationError + */ +export interface ValidationError { + /** + * + * @type {Array} + * @memberof ValidationError + */ + 'loc': Array; + /** + * + * @type {string} + * @memberof ValidationError + */ + 'msg': string; + /** + * + * @type {string} + * @memberof ValidationError + */ + 'type': string; +} + diff --git a/packages/internal/generated-clients/src/magic-tee/models/wallet-response-model.ts b/packages/internal/generated-clients/src/magic-tee/models/wallet-response-model.ts new file mode 100644 index 0000000000..2ca694918a --- /dev/null +++ b/packages/internal/generated-clients/src/magic-tee/models/wallet-response-model.ts @@ -0,0 +1,30 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * TEE Express + * TEE Express is a service that simplifies wallet management for developers. Unlike traditional wallet solutions that require complex key management, TEE Express handles all key management internally, providing a streamlined API for wallet operations. TEE Express leverages secure enclave technology to ensure that private keys never leave the secure environment. All wallet operations, including creation, signing, and key management, are performed within a trusted execution environment (TEE). This provides enterprise-grade security while maintaining the simplicity of a REST API. The service supports Ethereum wallets and provides endpoints for wallet creation, transaction signing, and message signing. All operations are authenticated using JWT tokens passed in the Authorization header, ensuring secure access to user wallets. **Migration Notice:** If you\'re an existing customer, your users\' wallets have been automatically migrated to TEE Express. There\'s no action required on your part - all existing wallets are now accessible through the TEE Express API using the same JWT tokens you currently use for authentication. Simply update your API calls to use the TEE Express endpoints, and pass your existing JWT token in the Authorization header for all requests. **Authentication:** - An API key via the `X-Magic-API-Key` header or a secret key via the `X-Magic-Secret-Key` header. - The OIDC provider ID via the `X-OIDC-Provider-ID` header. - Bearer token in the `Authorization` header. **Data Hashing for Signing:** For personal sign operations, encode your data as base64: ```typescript const message = Buffer.from(data, \'utf-8\').toString(\'base64\'); ``` For signing transaction data or other structured data, provide a keccak256 hash: ```typescript import { MessageTypes, SignTypedDataVersion, TypedDataUtils, TypedDataV1, TypedMessage, typedSignatureHash, } from \'@metamask/eth-sig-util\'; import { resolveProperties, Signature, Transaction, TransactionLike, TransactionRequest } from \'ethers\'; const computeEip712Hash = ( data: TypedMessage, version: SignTypedDataVersion.V3 | SignTypedDataVersion.V4, ): string => { const hashBuffer = TypedDataUtils.eip712Hash(data, version); return \'0x\' + hashBuffer.toString(\'hex\'); }; const personalSign = async (data: string) => { const message = Buffer.from(data, \'utf-8\').toString(\'base64\'); const body = { message_base64: message, chain: \'ETH\' }; return await fetch(\'/v1/wallet/personal-sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV1 = async (data: TypedDataV1) => { const rawDataHash = typedSignatureHash(data); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV3 = async (data: TypedMessage) => { const rawDataHash = computeEip712Hash(data, SignTypedDataVersion.V3); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV4 = async (data: TypedMessage) => { const rawDataHash = computeEip712Hash(data, SignTypedDataVersion.V4); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTransaction = async (tx: TransactionRequest) => { const resolvedTx = await resolveProperties(tx); const txForSigning = { ...resolvedTx }; delete txForSigning.from; const btx = Transaction.from(txForSigning as TransactionLike); const body = { raw_data_hash: btx.unsignedHash, chain: \'ETH\' }; const res = await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); const { r, s, v } = res.json(); btx.signature = Signature.from({ r, s, v }); return btx.serialized; }; ``` + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +/** + * + * @export + * @interface WalletResponseModel + */ +export interface WalletResponseModel { + /** + * + * @type {string} + * @memberof WalletResponseModel + */ + 'public_address': string; +} +