@4mica/sdk 1.2.11 → 1.2.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@4mica/sdk",
3
- "version": "1.2.11",
3
+ "version": "1.2.13",
4
4
  "description": "TypeScript SDK for interacting with the 4Mica payment network",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -11,12 +11,12 @@
11
11
  "bugs": {
12
12
  "url": "https://github.com/4mica-Network/ts-sdk-4mica/issues"
13
13
  },
14
- "main": "dist/index.js",
15
- "types": "dist/index.d.ts",
14
+ "main": "dist/src/index.js",
15
+ "types": "dist/src/index.d.ts",
16
16
  "exports": {
17
17
  ".": {
18
- "types": "./dist/index.d.ts",
19
- "default": "./dist/index.js"
18
+ "types": "./dist/src/index.d.ts",
19
+ "default": "./dist/src/index.js"
20
20
  }
21
21
  },
22
22
  "files": [
@@ -56,12 +56,8 @@
56
56
  "@quillai-network/wachai-validation-sdk": "^0.1.0",
57
57
  "viem": "^2.45.1"
58
58
  },
59
- "optionalDependencies": {
60
- "@coinbase/cdp-sdk": "^1.49.2"
61
- },
62
59
  "devDependencies": {
63
- "@4mica/x402": "^1.2.5",
64
- "@coinbase/cdp-sdk": "^1.49.2",
60
+ "@4mica/x402": "^1.2.0",
65
61
  "@eslint/js": "^9.39.2",
66
62
  "@types/node": "^25.2.0",
67
63
  "@typescript-eslint/eslint-plugin": "^8.54.0",
@@ -14,4 +14,3 @@ export * from './guarantee';
14
14
  export * from './bls';
15
15
  export * from './x402/index';
16
16
  export * from './client';
17
- export * from './wallet';
package/dist/src/index.js CHANGED
@@ -30,4 +30,3 @@ __exportStar(require("./guarantee"), exports);
30
30
  __exportStar(require("./bls"), exports);
31
31
  __exportStar(require("./x402/index"), exports);
32
32
  __exportStar(require("./client"), exports);
33
- __exportStar(require("./wallet"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@4mica/sdk",
3
- "version": "1.2.11",
3
+ "version": "1.2.13",
4
4
  "description": "TypeScript SDK for interacting with the 4Mica payment network",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -11,12 +11,12 @@
11
11
  "bugs": {
12
12
  "url": "https://github.com/4mica-Network/ts-sdk-4mica/issues"
13
13
  },
14
- "main": "dist/index.js",
15
- "types": "dist/index.d.ts",
14
+ "main": "dist/src/index.js",
15
+ "types": "dist/src/index.d.ts",
16
16
  "exports": {
17
17
  ".": {
18
- "types": "./dist/index.d.ts",
19
- "default": "./dist/index.js"
18
+ "types": "./dist/src/index.d.ts",
19
+ "default": "./dist/src/index.js"
20
20
  }
21
21
  },
22
22
  "files": [
@@ -1,11 +0,0 @@
1
- import { type Account } from 'viem';
2
- export interface CdpAccountConfig {
3
- /** CDP API key ID from the Coinbase Developer Platform dashboard. */
4
- apiKeyId: string;
5
- /** CDP API key secret from the Coinbase Developer Platform dashboard. */
6
- apiKeySecret: string;
7
- /** Idempotency name — getOrCreateAccount always returns the same wallet for a given name. */
8
- name: string;
9
- }
10
- /** Creates a viem Account backed by a Coinbase CDP MPC wallet (private key never leaves CDP). */
11
- export declare function createCdpAccount(config: CdpAccountConfig): Promise<Account>;
@@ -1,85 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.createCdpAccount = createCdpAccount;
37
- const viem_1 = require("viem");
38
- const accounts_1 = require("viem/accounts");
39
- /** Creates a viem Account backed by a Coinbase CDP MPC wallet (private key never leaves CDP). */
40
- async function createCdpAccount(config) {
41
- const { CdpClient } = await Promise.resolve().then(() => __importStar(require('@coinbase/cdp-sdk')));
42
- const cdp = new CdpClient({
43
- apiKeyId: config.apiKeyId,
44
- apiKeySecret: config.apiKeySecret,
45
- });
46
- const evmAccount = await cdp.evm.getOrCreateAccount({ name: config.name });
47
- const address = evmAccount.address;
48
- async function signMessage({ message }) {
49
- if (typeof message === 'string') {
50
- // CDP's signMessage applies the EIP-191 prefix internally.
51
- const result = await cdp.evm.signMessage({ address, message });
52
- return result.signature;
53
- }
54
- const hash = (0, viem_1.hashMessage)(message);
55
- const result = await cdp.evm.signHash({ address, hash });
56
- return result.signature;
57
- }
58
- async function signTypedData(parameters) {
59
- const { domain, types, primaryType, message } = parameters;
60
- if (domain && types && primaryType && message) {
61
- try {
62
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
63
- const payload = { address, domain, types, primaryType, message };
64
- const result = await cdp.evm.signTypedData(payload);
65
- return result.signature;
66
- }
67
- catch {
68
- // Fall back to hash-then-sign if CDP rejects the typed-data structure.
69
- }
70
- }
71
- const hash = (0, viem_1.hashTypedData)(parameters);
72
- const result = await cdp.evm.signHash({ address, hash });
73
- return result.signature;
74
- }
75
- async function signTransaction(transaction, options) {
76
- const serializer = options?.serializer ?? viem_1.serializeTransaction;
77
- const hash = (0, viem_1.keccak256)(serializer(transaction));
78
- const result = await cdp.evm.signHash({ address, hash });
79
- const { r, s, yParity } = (0, viem_1.hexToSignature)(result.signature);
80
- return serializer(transaction, { r, s, yParity });
81
- }
82
- // viem's signTypedData generic cannot be satisfied by a hand-rolled adapter without casting — same pattern as hdKeyToAccount.
83
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
84
- return (0, accounts_1.toAccount)({ address, signMessage, signTypedData, signTransaction });
85
- }
@@ -1,2 +0,0 @@
1
- export { createCdpAccount } from './cdp';
2
- export type { CdpAccountConfig } from './cdp';
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createCdpAccount = void 0;
4
- var cdp_1 = require("./cdp");
5
- Object.defineProperty(exports, "createCdpAccount", { enumerable: true, get: function () { return cdp_1.createCdpAccount; } });