@metamask-previews/chomp-api-service 0.0.0-preview-08b3d87
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/CHANGELOG.md +14 -0
- package/LICENSE +20 -0
- package/README.md +15 -0
- package/dist/chomp-api-service-method-action-types.cjs +7 -0
- package/dist/chomp-api-service-method-action-types.cjs.map +1 -0
- package/dist/chomp-api-service-method-action-types.d.cts +59 -0
- package/dist/chomp-api-service-method-action-types.d.cts.map +1 -0
- package/dist/chomp-api-service-method-action-types.d.mts +59 -0
- package/dist/chomp-api-service-method-action-types.d.mts.map +1 -0
- package/dist/chomp-api-service-method-action-types.mjs +6 -0
- package/dist/chomp-api-service-method-action-types.mjs.map +1 -0
- package/dist/chomp-api-service.cjs +315 -0
- package/dist/chomp-api-service.cjs.map +1 -0
- package/dist/chomp-api-service.d.cts +139 -0
- package/dist/chomp-api-service.d.cts.map +1 -0
- package/dist/chomp-api-service.d.mts +139 -0
- package/dist/chomp-api-service.d.mts.map +1 -0
- package/dist/chomp-api-service.mjs +311 -0
- package/dist/chomp-api-service.mjs.map +1 -0
- package/dist/index.cjs +6 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +5 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +5 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +2 -0
- package/dist/index.mjs.map +1 -0
- package/dist/types.cjs +3 -0
- package/dist/types.cjs.map +1 -0
- package/dist/types.d.cts +98 -0
- package/dist/types.d.cts.map +1 -0
- package/dist/types.d.mts +98 -0
- package/dist/types.d.mts.map +1 -0
- package/dist/types.mjs +2 -0
- package/dist/types.mjs.map +1 -0
- package/package.json +77 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { ChompApiService } from "./chomp-api-service.cjs";
|
|
2
|
+
export type { ChompApiServiceMessenger, ChompApiServiceActions, ChompApiServiceEvents, ChompApiServiceInvalidateQueriesAction, ChompApiServiceCacheUpdatedEvent, ChompApiServiceGranularCacheUpdatedEvent, } from "./chomp-api-service.cjs";
|
|
3
|
+
export type { ChompApiServiceAssociateAddressAction, ChompApiServiceCreateUpgradeAction, ChompApiServiceGetUpgradeAction, ChompApiServiceVerifyDelegationAction, ChompApiServiceCreateIntentsAction, ChompApiServiceGetIntentsByAddressAction, ChompApiServiceCreateWithdrawalAction, } from "./chomp-api-service-method-action-types.cjs";
|
|
4
|
+
export type { AssociateAddressRequest, AssociateAddressResponse, CreateUpgradeRequest, CreateWithdrawalRequest, CreateWithdrawalResponse, DelegationCaveat, UpgradeResponse, IntentEntry, IntentMetadataRequest, IntentMetadataResponse, SendIntentRequest, SendIntentResponse, SignedDelegation, VerifyDelegationRequest, VerifyDelegationResponse, } from "./types.cjs";
|
|
5
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,gCAA4B;AACtD,YAAY,EACV,wBAAwB,EACxB,sBAAsB,EACtB,qBAAqB,EACrB,sCAAsC,EACtC,gCAAgC,EAChC,wCAAwC,GACzC,gCAA4B;AAC7B,YAAY,EACV,qCAAqC,EACrC,kCAAkC,EAClC,+BAA+B,EAC/B,qCAAqC,EACrC,kCAAkC,EAClC,wCAAwC,EACxC,qCAAqC,GACtC,oDAAgD;AACjD,YAAY,EACV,uBAAuB,EACvB,wBAAwB,EACxB,oBAAoB,EACpB,uBAAuB,EACvB,wBAAwB,EACxB,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,qBAAqB,EACrB,sBAAsB,EACtB,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,uBAAuB,EACvB,wBAAwB,GACzB,oBAAgB"}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { ChompApiService } from "./chomp-api-service.mjs";
|
|
2
|
+
export type { ChompApiServiceMessenger, ChompApiServiceActions, ChompApiServiceEvents, ChompApiServiceInvalidateQueriesAction, ChompApiServiceCacheUpdatedEvent, ChompApiServiceGranularCacheUpdatedEvent, } from "./chomp-api-service.mjs";
|
|
3
|
+
export type { ChompApiServiceAssociateAddressAction, ChompApiServiceCreateUpgradeAction, ChompApiServiceGetUpgradeAction, ChompApiServiceVerifyDelegationAction, ChompApiServiceCreateIntentsAction, ChompApiServiceGetIntentsByAddressAction, ChompApiServiceCreateWithdrawalAction, } from "./chomp-api-service-method-action-types.mjs";
|
|
4
|
+
export type { AssociateAddressRequest, AssociateAddressResponse, CreateUpgradeRequest, CreateWithdrawalRequest, CreateWithdrawalResponse, DelegationCaveat, UpgradeResponse, IntentEntry, IntentMetadataRequest, IntentMetadataResponse, SendIntentRequest, SendIntentResponse, SignedDelegation, VerifyDelegationRequest, VerifyDelegationResponse, } from "./types.mjs";
|
|
5
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,gCAA4B;AACtD,YAAY,EACV,wBAAwB,EACxB,sBAAsB,EACtB,qBAAqB,EACrB,sCAAsC,EACtC,gCAAgC,EAChC,wCAAwC,GACzC,gCAA4B;AAC7B,YAAY,EACV,qCAAqC,EACrC,kCAAkC,EAClC,+BAA+B,EAC/B,qCAAqC,EACrC,kCAAkC,EAClC,wCAAwC,EACxC,qCAAqC,GACtC,oDAAgD;AACjD,YAAY,EACV,uBAAuB,EACvB,wBAAwB,EACxB,oBAAoB,EACpB,uBAAuB,EACvB,wBAAwB,EACxB,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,qBAAqB,EACrB,sBAAsB,EACtB,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,uBAAuB,EACvB,wBAAwB,GACzB,oBAAgB"}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,gCAA4B","sourcesContent":["export { ChompApiService } from './chomp-api-service';\nexport type {\n ChompApiServiceMessenger,\n ChompApiServiceActions,\n ChompApiServiceEvents,\n ChompApiServiceInvalidateQueriesAction,\n ChompApiServiceCacheUpdatedEvent,\n ChompApiServiceGranularCacheUpdatedEvent,\n} from './chomp-api-service';\nexport type {\n ChompApiServiceAssociateAddressAction,\n ChompApiServiceCreateUpgradeAction,\n ChompApiServiceGetUpgradeAction,\n ChompApiServiceVerifyDelegationAction,\n ChompApiServiceCreateIntentsAction,\n ChompApiServiceGetIntentsByAddressAction,\n ChompApiServiceCreateWithdrawalAction,\n} from './chomp-api-service-method-action-types';\nexport type {\n AssociateAddressRequest,\n AssociateAddressResponse,\n CreateUpgradeRequest,\n CreateWithdrawalRequest,\n CreateWithdrawalResponse,\n DelegationCaveat,\n UpgradeResponse,\n IntentEntry,\n IntentMetadataRequest,\n IntentMetadataResponse,\n SendIntentRequest,\n SendIntentResponse,\n SignedDelegation,\n VerifyDelegationRequest,\n VerifyDelegationResponse,\n} from './types';\n"]}
|
package/dist/types.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.cjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Hex } from '@metamask/utils';\n\n// === COMMON TYPES ===\n\nexport type DelegationCaveat = {\n enforcer: Hex;\n terms: Hex;\n args: Hex;\n};\n\nexport type SignedDelegation = {\n delegate: Hex;\n delegator: Hex;\n authority: Hex;\n caveats: DelegationCaveat[];\n salt: Hex;\n signature: Hex;\n};\n\n// === REQUEST TYPES ===\n\nexport type AssociateAddressRequest = {\n signature: string;\n timestamp: string;\n address: string;\n};\n\nexport type CreateUpgradeRequest = {\n r: string;\n s: string;\n v: number;\n yParity: number;\n address: string;\n chainId: string;\n nonce: string;\n};\n\nexport type VerifyDelegationRequest = {\n signedDelegation: SignedDelegation;\n chainId: Hex;\n};\n\nexport type IntentMetadataRequest = {\n allowance: Hex;\n tokenSymbol: string;\n tokenAddress: Hex;\n type: 'cash-deposit' | 'cash-withdrawal';\n};\n\nexport type SendIntentRequest = {\n account: Hex;\n delegationHash: Hex;\n chainId: Hex;\n metadata: IntentMetadataRequest;\n};\n\nexport type CreateWithdrawalRequest = {\n chainId: Hex;\n /** Decimal integer or 0x-prefixed hex string representing the amount. */\n amount: string;\n account: Hex;\n};\n\n// === RESPONSE TYPES ===\n\nexport type AssociateAddressResponse = {\n profileId: string;\n address: string;\n status: string;\n};\n\nexport type UpgradeResponse = {\n signerAddress: string;\n status: string;\n createdAt: string;\n};\n\nexport type VerifyDelegationResponse = {\n valid: boolean;\n delegationHash?: string;\n errors?: string[];\n};\n\nexport type IntentMetadataResponse = {\n allowance: Hex;\n tokenSymbol: string;\n tokenAddress: Hex;\n type: 'cash-deposit' | 'cash-withdrawal';\n};\n\nexport type SendIntentResponse = {\n delegationHash: string;\n metadata: IntentMetadataResponse;\n createdAt: string;\n};\n\n/**\n * The shape returned by GET /v1/intent/account/:address for each intent.\n *\n * Note: the metadata `type` uses 'deposit' | 'withdraw' here, whereas the\n * create-intent endpoint uses 'cash-deposit' | 'cash-withdrawal'.\n */\nexport type IntentEntry = {\n account: Hex;\n delegationHash: Hex;\n chainId: Hex;\n status: 'active' | 'revoked';\n metadata: {\n allowance: Hex;\n tokenAddress: Hex;\n tokenSymbol: string;\n type: 'deposit' | 'withdraw';\n };\n};\n\nexport type CreateWithdrawalResponse = {\n success: true;\n};\n"]}
|
package/dist/types.d.cts
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import type { Hex } from "@metamask/utils";
|
|
2
|
+
export type DelegationCaveat = {
|
|
3
|
+
enforcer: Hex;
|
|
4
|
+
terms: Hex;
|
|
5
|
+
args: Hex;
|
|
6
|
+
};
|
|
7
|
+
export type SignedDelegation = {
|
|
8
|
+
delegate: Hex;
|
|
9
|
+
delegator: Hex;
|
|
10
|
+
authority: Hex;
|
|
11
|
+
caveats: DelegationCaveat[];
|
|
12
|
+
salt: Hex;
|
|
13
|
+
signature: Hex;
|
|
14
|
+
};
|
|
15
|
+
export type AssociateAddressRequest = {
|
|
16
|
+
signature: string;
|
|
17
|
+
timestamp: string;
|
|
18
|
+
address: string;
|
|
19
|
+
};
|
|
20
|
+
export type CreateUpgradeRequest = {
|
|
21
|
+
r: string;
|
|
22
|
+
s: string;
|
|
23
|
+
v: number;
|
|
24
|
+
yParity: number;
|
|
25
|
+
address: string;
|
|
26
|
+
chainId: string;
|
|
27
|
+
nonce: string;
|
|
28
|
+
};
|
|
29
|
+
export type VerifyDelegationRequest = {
|
|
30
|
+
signedDelegation: SignedDelegation;
|
|
31
|
+
chainId: Hex;
|
|
32
|
+
};
|
|
33
|
+
export type IntentMetadataRequest = {
|
|
34
|
+
allowance: Hex;
|
|
35
|
+
tokenSymbol: string;
|
|
36
|
+
tokenAddress: Hex;
|
|
37
|
+
type: 'cash-deposit' | 'cash-withdrawal';
|
|
38
|
+
};
|
|
39
|
+
export type SendIntentRequest = {
|
|
40
|
+
account: Hex;
|
|
41
|
+
delegationHash: Hex;
|
|
42
|
+
chainId: Hex;
|
|
43
|
+
metadata: IntentMetadataRequest;
|
|
44
|
+
};
|
|
45
|
+
export type CreateWithdrawalRequest = {
|
|
46
|
+
chainId: Hex;
|
|
47
|
+
/** Decimal integer or 0x-prefixed hex string representing the amount. */
|
|
48
|
+
amount: string;
|
|
49
|
+
account: Hex;
|
|
50
|
+
};
|
|
51
|
+
export type AssociateAddressResponse = {
|
|
52
|
+
profileId: string;
|
|
53
|
+
address: string;
|
|
54
|
+
status: string;
|
|
55
|
+
};
|
|
56
|
+
export type UpgradeResponse = {
|
|
57
|
+
signerAddress: string;
|
|
58
|
+
status: string;
|
|
59
|
+
createdAt: string;
|
|
60
|
+
};
|
|
61
|
+
export type VerifyDelegationResponse = {
|
|
62
|
+
valid: boolean;
|
|
63
|
+
delegationHash?: string;
|
|
64
|
+
errors?: string[];
|
|
65
|
+
};
|
|
66
|
+
export type IntentMetadataResponse = {
|
|
67
|
+
allowance: Hex;
|
|
68
|
+
tokenSymbol: string;
|
|
69
|
+
tokenAddress: Hex;
|
|
70
|
+
type: 'cash-deposit' | 'cash-withdrawal';
|
|
71
|
+
};
|
|
72
|
+
export type SendIntentResponse = {
|
|
73
|
+
delegationHash: string;
|
|
74
|
+
metadata: IntentMetadataResponse;
|
|
75
|
+
createdAt: string;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* The shape returned by GET /v1/intent/account/:address for each intent.
|
|
79
|
+
*
|
|
80
|
+
* Note: the metadata `type` uses 'deposit' | 'withdraw' here, whereas the
|
|
81
|
+
* create-intent endpoint uses 'cash-deposit' | 'cash-withdrawal'.
|
|
82
|
+
*/
|
|
83
|
+
export type IntentEntry = {
|
|
84
|
+
account: Hex;
|
|
85
|
+
delegationHash: Hex;
|
|
86
|
+
chainId: Hex;
|
|
87
|
+
status: 'active' | 'revoked';
|
|
88
|
+
metadata: {
|
|
89
|
+
allowance: Hex;
|
|
90
|
+
tokenAddress: Hex;
|
|
91
|
+
tokenSymbol: string;
|
|
92
|
+
type: 'deposit' | 'withdraw';
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
export type CreateWithdrawalResponse = {
|
|
96
|
+
success: true;
|
|
97
|
+
};
|
|
98
|
+
//# sourceMappingURL=types.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,wBAAwB;AAI3C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,EAAE,GAAG,CAAC;IACd,KAAK,EAAE,GAAG,CAAC;IACX,IAAI,EAAE,GAA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Hex } from "@metamask/utils";
|
|
2
|
+
export type DelegationCaveat = {
|
|
3
|
+
enforcer: Hex;
|
|
4
|
+
terms: Hex;
|
|
5
|
+
args: Hex;
|
|
6
|
+
};
|
|
7
|
+
export type SignedDelegation = {
|
|
8
|
+
delegate: Hex;
|
|
9
|
+
delegator: Hex;
|
|
10
|
+
authority: Hex;
|
|
11
|
+
caveats: DelegationCaveat[];
|
|
12
|
+
salt: Hex;
|
|
13
|
+
signature: Hex;
|
|
14
|
+
};
|
|
15
|
+
export type AssociateAddressRequest = {
|
|
16
|
+
signature: string;
|
|
17
|
+
timestamp: string;
|
|
18
|
+
address: string;
|
|
19
|
+
};
|
|
20
|
+
export type CreateUpgradeRequest = {
|
|
21
|
+
r: string;
|
|
22
|
+
s: string;
|
|
23
|
+
v: number;
|
|
24
|
+
yParity: number;
|
|
25
|
+
address: string;
|
|
26
|
+
chainId: string;
|
|
27
|
+
nonce: string;
|
|
28
|
+
};
|
|
29
|
+
export type VerifyDelegationRequest = {
|
|
30
|
+
signedDelegation: SignedDelegation;
|
|
31
|
+
chainId: Hex;
|
|
32
|
+
};
|
|
33
|
+
export type IntentMetadataRequest = {
|
|
34
|
+
allowance: Hex;
|
|
35
|
+
tokenSymbol: string;
|
|
36
|
+
tokenAddress: Hex;
|
|
37
|
+
type: 'cash-deposit' | 'cash-withdrawal';
|
|
38
|
+
};
|
|
39
|
+
export type SendIntentRequest = {
|
|
40
|
+
account: Hex;
|
|
41
|
+
delegationHash: Hex;
|
|
42
|
+
chainId: Hex;
|
|
43
|
+
metadata: IntentMetadataRequest;
|
|
44
|
+
};
|
|
45
|
+
export type CreateWithdrawalRequest = {
|
|
46
|
+
chainId: Hex;
|
|
47
|
+
/** Decimal integer or 0x-prefixed hex string representing the amount. */
|
|
48
|
+
amount: string;
|
|
49
|
+
account: Hex;
|
|
50
|
+
};
|
|
51
|
+
export type AssociateAddressResponse = {
|
|
52
|
+
profileId: string;
|
|
53
|
+
address: string;
|
|
54
|
+
status: string;
|
|
55
|
+
};
|
|
56
|
+
export type UpgradeResponse = {
|
|
57
|
+
signerAddress: string;
|
|
58
|
+
status: string;
|
|
59
|
+
createdAt: string;
|
|
60
|
+
};
|
|
61
|
+
export type VerifyDelegationResponse = {
|
|
62
|
+
valid: boolean;
|
|
63
|
+
delegationHash?: string;
|
|
64
|
+
errors?: string[];
|
|
65
|
+
};
|
|
66
|
+
export type IntentMetadataResponse = {
|
|
67
|
+
allowance: Hex;
|
|
68
|
+
tokenSymbol: string;
|
|
69
|
+
tokenAddress: Hex;
|
|
70
|
+
type: 'cash-deposit' | 'cash-withdrawal';
|
|
71
|
+
};
|
|
72
|
+
export type SendIntentResponse = {
|
|
73
|
+
delegationHash: string;
|
|
74
|
+
metadata: IntentMetadataResponse;
|
|
75
|
+
createdAt: string;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* The shape returned by GET /v1/intent/account/:address for each intent.
|
|
79
|
+
*
|
|
80
|
+
* Note: the metadata `type` uses 'deposit' | 'withdraw' here, whereas the
|
|
81
|
+
* create-intent endpoint uses 'cash-deposit' | 'cash-withdrawal'.
|
|
82
|
+
*/
|
|
83
|
+
export type IntentEntry = {
|
|
84
|
+
account: Hex;
|
|
85
|
+
delegationHash: Hex;
|
|
86
|
+
chainId: Hex;
|
|
87
|
+
status: 'active' | 'revoked';
|
|
88
|
+
metadata: {
|
|
89
|
+
allowance: Hex;
|
|
90
|
+
tokenAddress: Hex;
|
|
91
|
+
tokenSymbol: string;
|
|
92
|
+
type: 'deposit' | 'withdraw';
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
export type CreateWithdrawalResponse = {
|
|
96
|
+
success: true;
|
|
97
|
+
};
|
|
98
|
+
//# sourceMappingURL=types.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,wBAAwB;AAI3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AAG;IACrC,OAAO,EAAE,IAAI,CAAC;CACf,CAAC"}
|
package/dist/types.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.mjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Hex } from '@metamask/utils';\n\n// === COMMON TYPES ===\n\nexport type DelegationCaveat = {\n enforcer: Hex;\n terms: Hex;\n args: Hex;\n};\n\nexport type SignedDelegation = {\n delegate: Hex;\n delegator: Hex;\n authority: Hex;\n caveats: DelegationCaveat[];\n salt: Hex;\n signature: Hex;\n};\n\n// === REQUEST TYPES ===\n\nexport type AssociateAddressRequest = {\n signature: string;\n timestamp: string;\n address: string;\n};\n\nexport type CreateUpgradeRequest = {\n r: string;\n s: string;\n v: number;\n yParity: number;\n address: string;\n chainId: string;\n nonce: string;\n};\n\nexport type VerifyDelegationRequest = {\n signedDelegation: SignedDelegation;\n chainId: Hex;\n};\n\nexport type IntentMetadataRequest = {\n allowance: Hex;\n tokenSymbol: string;\n tokenAddress: Hex;\n type: 'cash-deposit' | 'cash-withdrawal';\n};\n\nexport type SendIntentRequest = {\n account: Hex;\n delegationHash: Hex;\n chainId: Hex;\n metadata: IntentMetadataRequest;\n};\n\nexport type CreateWithdrawalRequest = {\n chainId: Hex;\n /** Decimal integer or 0x-prefixed hex string representing the amount. */\n amount: string;\n account: Hex;\n};\n\n// === RESPONSE TYPES ===\n\nexport type AssociateAddressResponse = {\n profileId: string;\n address: string;\n status: string;\n};\n\nexport type UpgradeResponse = {\n signerAddress: string;\n status: string;\n createdAt: string;\n};\n\nexport type VerifyDelegationResponse = {\n valid: boolean;\n delegationHash?: string;\n errors?: string[];\n};\n\nexport type IntentMetadataResponse = {\n allowance: Hex;\n tokenSymbol: string;\n tokenAddress: Hex;\n type: 'cash-deposit' | 'cash-withdrawal';\n};\n\nexport type SendIntentResponse = {\n delegationHash: string;\n metadata: IntentMetadataResponse;\n createdAt: string;\n};\n\n/**\n * The shape returned by GET /v1/intent/account/:address for each intent.\n *\n * Note: the metadata `type` uses 'deposit' | 'withdraw' here, whereas the\n * create-intent endpoint uses 'cash-deposit' | 'cash-withdrawal'.\n */\nexport type IntentEntry = {\n account: Hex;\n delegationHash: Hex;\n chainId: Hex;\n status: 'active' | 'revoked';\n metadata: {\n allowance: Hex;\n tokenAddress: Hex;\n tokenSymbol: string;\n type: 'deposit' | 'withdraw';\n };\n};\n\nexport type CreateWithdrawalResponse = {\n success: true;\n};\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@metamask-previews/chomp-api-service",
|
|
3
|
+
"version": "0.0.0-preview-08b3d87",
|
|
4
|
+
"description": "Data service for the Chomp API",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"Ethereum",
|
|
7
|
+
"MetaMask"
|
|
8
|
+
],
|
|
9
|
+
"homepage": "https://github.com/MetaMask/core/tree/main/packages/chomp-api-service#readme",
|
|
10
|
+
"bugs": {
|
|
11
|
+
"url": "https://github.com/MetaMask/core/issues"
|
|
12
|
+
},
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "https://github.com/MetaMask/core.git"
|
|
16
|
+
},
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"sideEffects": false,
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"import": {
|
|
22
|
+
"types": "./dist/index.d.mts",
|
|
23
|
+
"default": "./dist/index.mjs"
|
|
24
|
+
},
|
|
25
|
+
"require": {
|
|
26
|
+
"types": "./dist/index.d.cts",
|
|
27
|
+
"default": "./dist/index.cjs"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"./package.json": "./package.json"
|
|
31
|
+
},
|
|
32
|
+
"main": "./dist/index.cjs",
|
|
33
|
+
"types": "./dist/index.d.cts",
|
|
34
|
+
"files": [
|
|
35
|
+
"dist/"
|
|
36
|
+
],
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references",
|
|
39
|
+
"build:all": "ts-bridge --project tsconfig.build.json --verbose --clean",
|
|
40
|
+
"build:docs": "typedoc",
|
|
41
|
+
"changelog:update": "../../scripts/update-changelog.sh @metamask/chomp-api-service",
|
|
42
|
+
"changelog:validate": "../../scripts/validate-changelog.sh @metamask/chomp-api-service",
|
|
43
|
+
"since-latest-release": "../../scripts/since-latest-release.sh",
|
|
44
|
+
"test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter",
|
|
45
|
+
"test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache",
|
|
46
|
+
"test:verbose": "NODE_OPTIONS=--experimental-vm-modules jest --verbose",
|
|
47
|
+
"test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch"
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"@metamask/base-data-service": "^0.1.1",
|
|
51
|
+
"@metamask/controller-utils": "^11.20.0",
|
|
52
|
+
"@metamask/messenger": "^1.1.1",
|
|
53
|
+
"@metamask/profile-sync-controller": "^28.0.2",
|
|
54
|
+
"@metamask/superstruct": "^3.1.0",
|
|
55
|
+
"@metamask/utils": "^11.9.0",
|
|
56
|
+
"@tanstack/query-core": "^4.43.0"
|
|
57
|
+
},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"@metamask/auto-changelog": "^6.0.0",
|
|
60
|
+
"@ts-bridge/cli": "^0.6.4",
|
|
61
|
+
"@types/jest": "^29.5.14",
|
|
62
|
+
"deepmerge": "^4.2.2",
|
|
63
|
+
"jest": "^29.7.0",
|
|
64
|
+
"nock": "^13.3.1",
|
|
65
|
+
"ts-jest": "^29.2.5",
|
|
66
|
+
"typedoc": "^0.25.13",
|
|
67
|
+
"typedoc-plugin-missing-exports": "^2.0.0",
|
|
68
|
+
"typescript": "~5.3.3"
|
|
69
|
+
},
|
|
70
|
+
"engines": {
|
|
71
|
+
"node": "^18.18 || >=20"
|
|
72
|
+
},
|
|
73
|
+
"publishConfig": {
|
|
74
|
+
"access": "public",
|
|
75
|
+
"registry": "https://registry.npmjs.org/"
|
|
76
|
+
}
|
|
77
|
+
}
|