@cashie/ethereum-provider 1.0.0
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/README.md +16 -0
- package/dist/constant.d.ts +4 -0
- package/dist/ecdh/ecdh-manager.d.ts +78 -0
- package/dist/ecdh/ecdh.types.d.ts +30 -0
- package/dist/ecdh/index.d.ts +2 -0
- package/dist/iframe/iframe-handler.d.ts +71 -0
- package/dist/iframe/iframe.d.ts +50 -0
- package/dist/iframe/index.d.ts +2 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +2 -0
- package/dist/index.mjs.map +7 -0
- package/dist/provider/eip-1193-bridge.d.ts +14 -0
- package/dist/provider/eip-6963/announce-provider.d.ts +7 -0
- package/dist/provider/eip-6963/icon.d.ts +4 -0
- package/dist/provider/eip-6963/index.d.ts +2 -0
- package/dist/provider/eip-6963/types.d.ts +30 -0
- package/dist/provider/errors.d.ts +100 -0
- package/dist/provider/index.d.ts +5 -0
- package/dist/provider/transeptor-ethereum-provider.d.ts +48 -0
- package/dist/provider/types.d.ts +56 -0
- package/dist/types/checkout.types.d.ts +10 -0
- package/dist/types/error.types.d.ts +8 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/json-rpc.types.d.ts +76 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/payment.d.ts +3 -0
- package/dist/utils/random.d.ts +7 -0
- package/dist/utils/time.d.ts +30 -0
- package/dist/utils/validate.d.ts +69 -0
- package/package.json +54 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { InboundJsonRpcEventRequest, InboundRpcRequestEventsMethodNames, JsonRpcResponse, FatalError } from '../types/index.js';
|
|
2
|
+
import { SecureMessage, SecureMessageType } from '../ecdh/ecdh.types.js';
|
|
3
|
+
type JsonRpcResponseValidator = {
|
|
4
|
+
isValid: boolean;
|
|
5
|
+
response: JsonRpcResponse | null;
|
|
6
|
+
};
|
|
7
|
+
type JsonRpcEventRequestValidator = {
|
|
8
|
+
isValid: boolean;
|
|
9
|
+
eventRequest: InboundJsonRpcEventRequest<InboundRpcRequestEventsMethodNames> | null;
|
|
10
|
+
};
|
|
11
|
+
type JsonRpcKeyExchangeResponseValidator = {
|
|
12
|
+
isValid: boolean;
|
|
13
|
+
keyExchangeResponse: SecureMessage<SecureMessageType.KeyExchangeResponse> | null;
|
|
14
|
+
};
|
|
15
|
+
type JsonRpcKeyExchangeDoneValidator = {
|
|
16
|
+
isValid: boolean;
|
|
17
|
+
keyExchangeDone: SecureMessage<SecureMessageType.KeyExchangeDone> | null;
|
|
18
|
+
};
|
|
19
|
+
type EncryptedRequestValidator = {
|
|
20
|
+
isValid: boolean;
|
|
21
|
+
encryptedRequest: SecureMessage<SecureMessageType.Encrypted> | null;
|
|
22
|
+
};
|
|
23
|
+
type FatalErrorValidator = {
|
|
24
|
+
isValid: boolean;
|
|
25
|
+
fatalError: FatalError | null;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Validate a JSON-RPC response
|
|
29
|
+
*
|
|
30
|
+
* @param message - The message to be validated
|
|
31
|
+
* @returns The validated request
|
|
32
|
+
*/
|
|
33
|
+
export declare const jsonRpcResponseValidator: (message: unknown) => JsonRpcResponseValidator;
|
|
34
|
+
/**
|
|
35
|
+
* Validate a JSON-RPC event request
|
|
36
|
+
*
|
|
37
|
+
* @param message - The message to be validated
|
|
38
|
+
* @returns The validated request
|
|
39
|
+
*/
|
|
40
|
+
export declare const inboundJsonRpcEventRequestValidator: (message: unknown) => JsonRpcEventRequestValidator;
|
|
41
|
+
/**
|
|
42
|
+
* Validate a JSON-RPC key exchange response request
|
|
43
|
+
*
|
|
44
|
+
* @param message - The message to be validated
|
|
45
|
+
* @returns The validated request
|
|
46
|
+
*/
|
|
47
|
+
export declare const jsonRpcKeyExchangeResponseValidator: (message: unknown) => JsonRpcKeyExchangeResponseValidator;
|
|
48
|
+
/**
|
|
49
|
+
* Validate a JSON-RPC key exchange done request
|
|
50
|
+
*
|
|
51
|
+
* @param message - The message to be validated
|
|
52
|
+
* @returns The validated request
|
|
53
|
+
*/
|
|
54
|
+
export declare const jsonRpcKeyExchangeDoneValidator: (message: unknown) => JsonRpcKeyExchangeDoneValidator;
|
|
55
|
+
/**
|
|
56
|
+
* Validate a JSON-RPC encrypted message
|
|
57
|
+
*
|
|
58
|
+
* @param message - The message to be validated
|
|
59
|
+
* @returns The validated request
|
|
60
|
+
*/
|
|
61
|
+
export declare const encryptedMessageValidator: (message: unknown) => EncryptedRequestValidator;
|
|
62
|
+
/**
|
|
63
|
+
* Validate a fatal error
|
|
64
|
+
*
|
|
65
|
+
* @param message - The message to be validated
|
|
66
|
+
* @returns The validated request
|
|
67
|
+
*/
|
|
68
|
+
export declare const fatalErrorValidator: (message: unknown) => FatalErrorValidator;
|
|
69
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cashie/ethereum-provider",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A EIP-1193 provider for the Cashie Protocol client",
|
|
5
|
+
"homepage": "https://github.com/transeptorlabs/cashie-core/blob/main/packages/ethereum-provider/README.md",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/transeptorlabs/cashie-core.git"
|
|
9
|
+
},
|
|
10
|
+
"bugs": {
|
|
11
|
+
"url": "https://github.com/transeptorlabs/cashie-core/issues"
|
|
12
|
+
},
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"author": "Transeptor Labs",
|
|
15
|
+
"type": "module",
|
|
16
|
+
"main": "dist/index.cjs",
|
|
17
|
+
"module": "dist/index.mjs",
|
|
18
|
+
"types": "dist/index.d.ts",
|
|
19
|
+
"exports": {
|
|
20
|
+
"require": {
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"default": "./dist/index.cjs"
|
|
23
|
+
},
|
|
24
|
+
"import": {
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"default": "./dist/index.mjs"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"dist"
|
|
31
|
+
],
|
|
32
|
+
"scripts": {
|
|
33
|
+
"build": "yarn build:esbuild && yarn build:types",
|
|
34
|
+
"build:esbuild": "node ./build-package.mjs",
|
|
35
|
+
"build:types": "tsc --emitDeclarationOnly",
|
|
36
|
+
"build:docs": "typedoc",
|
|
37
|
+
"build:pack": "yarn build && yarn pack --filename ../../deps/cashie-ethereum-provider-0.0.0.tgz",
|
|
38
|
+
"lint:eslint": "eslint . --ext ts --cache",
|
|
39
|
+
"lint:dependencies": "yarn dedupe",
|
|
40
|
+
"lint:misc": "prettier '**/*.json' '**/*.md' '**/*.yml' '!**/CHANGELOG.md' '!.yarnrc.yml' --ignore-path .gitignore --no-error-on-unmatched-pattern",
|
|
41
|
+
"lint": "yarn lint:eslint && yarn lint:misc --check && yarn lint:dependencies --check",
|
|
42
|
+
"lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write && yarn lint:dependencies",
|
|
43
|
+
"test": "vitest run --config ./vitest.config.ts --coverage",
|
|
44
|
+
"test:watch": "vitest --config ./vitest.config.ts"
|
|
45
|
+
},
|
|
46
|
+
"engines": {
|
|
47
|
+
"node": ">=22.14.0"
|
|
48
|
+
},
|
|
49
|
+
"packageManager": "yarn@4.7.0",
|
|
50
|
+
"publishConfig": {
|
|
51
|
+
"access": "public",
|
|
52
|
+
"registry": "https://registry.npmjs.org/"
|
|
53
|
+
}
|
|
54
|
+
}
|