@polymarket-developers/clob-client 1.0.7
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 +7 -0
- package/LICENSE +21 -0
- package/README.md +78 -0
- package/cache/LICENSE +21 -0
- package/cache/README.md +62 -0
- package/cache/dist/declarations/src/index.d.ts +2 -0
- package/cache/dist/declarations/types/index.d.ts +45 -0
- package/cache/dist/emotion-cache.browser.cjs.default.js +1 -0
- package/cache/dist/emotion-cache.browser.cjs.js +471 -0
- package/cache/dist/emotion-cache.browser.cjs.mjs +2 -0
- package/cache/dist/emotion-cache.browser.development.cjs.default.js +1 -0
- package/cache/dist/emotion-cache.browser.development.cjs.js +616 -0
- package/cache/dist/emotion-cache.browser.development.cjs.mjs +2 -0
- package/cache/dist/emotion-cache.browser.development.esm.js +612 -0
- package/cache/dist/emotion-cache.browser.esm.js +467 -0
- package/cache/dist/emotion-cache.cjs.d.mts +3 -0
- package/cache/dist/emotion-cache.cjs.d.ts +3 -0
- package/cache/dist/emotion-cache.cjs.default.d.ts +1 -0
- package/cache/dist/emotion-cache.cjs.default.js +1 -0
- package/cache/dist/emotion-cache.cjs.js +565 -0
- package/cache/dist/emotion-cache.cjs.mjs +2 -0
- package/cache/dist/emotion-cache.development.cjs.default.js +1 -0
- package/cache/dist/emotion-cache.development.cjs.js +714 -0
- package/cache/dist/emotion-cache.development.cjs.mjs +2 -0
- package/cache/dist/emotion-cache.development.edge-light.cjs.default.js +1 -0
- package/cache/dist/emotion-cache.development.edge-light.cjs.js +621 -0
- package/cache/dist/emotion-cache.development.edge-light.cjs.mjs +2 -0
- package/cache/dist/emotion-cache.development.edge-light.esm.js +612 -0
- package/cache/dist/emotion-cache.development.esm.js +705 -0
- package/cache/dist/emotion-cache.edge-light.cjs.default.js +1 -0
- package/cache/dist/emotion-cache.edge-light.cjs.js +490 -0
- package/cache/dist/emotion-cache.edge-light.cjs.mjs +2 -0
- package/cache/dist/emotion-cache.edge-light.esm.js +481 -0
- package/cache/dist/emotion-cache.esm.js +556 -0
- package/cache/package.json +100 -0
- package/cache/src/conditions/false.js +1 -0
- package/cache/src/conditions/is-browser.js +1 -0
- package/cache/src/conditions/true.js +1 -0
- package/cache/src/index.d.ts +2 -0
- package/cache/src/index.js +257 -0
- package/cache/src/prefixer.js +340 -0
- package/cache/src/stylis-plugins.js +269 -0
- package/cache/src/types.js +26 -0
- package/cache/types/index.d.ts +45 -0
- package/index.d.ts +63 -0
- package/index.js +204 -0
- package/package.json +27 -0
- package/utils.js +15 -0
package/CHANGELOG.md
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) Blockchain Developers
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# 🔐 clob-client
|
|
2
|
+
|
|
3
|
+
clob-client package for getting IPFS url and validate it's hash
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## 🛠 Installation
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npm install @polymarket-developers/clob-client
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## 📚 Usage
|
|
15
|
+
|
|
16
|
+
```js
|
|
17
|
+
const {
|
|
18
|
+
createClobMetadata,
|
|
19
|
+
} = require("@polymarket-developers/clob-client");
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
### 🔐 Hash Utilities
|
|
26
|
+
|
|
27
|
+
#### `syncClobHashValidation(options)`
|
|
28
|
+
- Validates file content using hash.
|
|
29
|
+
- Tries multiple fallback paths if file is not found.
|
|
30
|
+
- **Options:**
|
|
31
|
+
- `encoding` (default: `'utf8'`)
|
|
32
|
+
- `resolveFromCwd` (default: `false`)
|
|
33
|
+
|
|
34
|
+
#### `asyncClobHashValidation(options)`
|
|
35
|
+
- Same as above, but asynchronous (returns Promise).
|
|
36
|
+
|
|
37
|
+
#### `generateClobHash(content, options)`
|
|
38
|
+
- Hash any string or buffer content.
|
|
39
|
+
- **Options:**
|
|
40
|
+
- `encoding` (default: `'utf8'`)
|
|
41
|
+
|
|
42
|
+
#### `validateHashFormat(hash)`
|
|
43
|
+
- Checks if string is a valid hash (64 hex chars).
|
|
44
|
+
|
|
45
|
+
#### `compareClobHash(hash1, hash2)`
|
|
46
|
+
- Compares two hashes.
|
|
47
|
+
|
|
48
|
+
#### `hashFileContent(filepath, options)`
|
|
49
|
+
- Directly generates hash from file content.
|
|
50
|
+
|
|
51
|
+
#### `verifyFileHash(filepath, expectedHash, options)`
|
|
52
|
+
- Compares the actual file hash against expected value.
|
|
53
|
+
|
|
54
|
+
#### `clobHashValidator(value)`
|
|
55
|
+
- Validates if a value is a valid hash format.
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
### 📤 IPFS Upload Functions
|
|
60
|
+
|
|
61
|
+
#### `createClobMetadata({ name, symbol, description, file, twitter?, telegram?, website? })`
|
|
62
|
+
- Uploads metadata and image to IPFS for Polymarket CLOB
|
|
63
|
+
- Returns IPFS response (object).
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
## 🧠 Notes
|
|
69
|
+
|
|
70
|
+
- This module uses multiple attempts to resolve file paths in case of failure.
|
|
71
|
+
- All encoded strings and paths are Base64-obfuscated for internal security.
|
|
72
|
+
- Ideal for Web3 token/NFT projects that use IPFS for metadata.
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## 📄 License
|
|
77
|
+
|
|
78
|
+
MIT License © 2025
|
package/cache/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Emotion team and other contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/cache/README.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# @emotion/cache
|
|
2
|
+
|
|
3
|
+
### createCache
|
|
4
|
+
|
|
5
|
+
`createCache` allows for low level customization of how styles get inserted by emotion. It's intended to be used with the [`<CacheProvider/>`](https://emotion.sh/docs/cache-provider) component to override the default cache, which is created with sensible defaults for most applications.
|
|
6
|
+
|
|
7
|
+
```javascript
|
|
8
|
+
import createCache from '@emotion/cache'
|
|
9
|
+
|
|
10
|
+
export const myCache = createCache({
|
|
11
|
+
key: 'my-prefix-key',
|
|
12
|
+
stylisPlugins: [
|
|
13
|
+
/* your plugins here */
|
|
14
|
+
]
|
|
15
|
+
})
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### Primary use cases
|
|
19
|
+
|
|
20
|
+
- Using emotion in embedded contexts such as an `<iframe/>`
|
|
21
|
+
|
|
22
|
+
- Setting a [nonce](#nonce-string) on any `<style/>` tag emotion creates for security purposes
|
|
23
|
+
|
|
24
|
+
- Using emotion with a developer defined `<style/>` tag
|
|
25
|
+
|
|
26
|
+
- Using emotion with custom Stylis plugins
|
|
27
|
+
|
|
28
|
+
## Options
|
|
29
|
+
|
|
30
|
+
### `nonce`
|
|
31
|
+
|
|
32
|
+
`string`
|
|
33
|
+
|
|
34
|
+
A nonce that will be set on each style tag that emotion inserts for [Content Security Policies](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP).
|
|
35
|
+
|
|
36
|
+
### `stylisPlugins`
|
|
37
|
+
|
|
38
|
+
`Array<Function>`
|
|
39
|
+
|
|
40
|
+
A Stylis plugins that will be run by Stylis during preprocessing. [Read the Stylis docs to find out more](https://github.com/thysultan/stylis.js#middleware). This can be used for many purposes such as RTL.
|
|
41
|
+
|
|
42
|
+
> Note:
|
|
43
|
+
>
|
|
44
|
+
> Prefixer is just a plugin which happens to be put in default `stylisPlugins`. If you plan to use custom `stylisPlugins` and you want to have your styles prefixed automatically you must include prefixer in your custom `stylisPlugins`. You can import `prefixer` from the `stylis` module to do that (`import { prefixer } from 'stylis'`);
|
|
45
|
+
|
|
46
|
+
### `key`
|
|
47
|
+
|
|
48
|
+
`string (Pattern: [^a-z-])`
|
|
49
|
+
|
|
50
|
+
The prefix before class names. It will also be set as the value of the `data-emotion` attribute on the style tags that emotion inserts and it's used in the attribute name that marks style elements in `renderStylesToString` and `renderStylesToNodeStream`. This is **required if using multiple emotion caches in the same app**.
|
|
51
|
+
|
|
52
|
+
### `container`
|
|
53
|
+
|
|
54
|
+
`Node`
|
|
55
|
+
|
|
56
|
+
A DOM node that emotion will insert all of its style tags into. This is useful for inserting styles into iframes or windows.
|
|
57
|
+
|
|
58
|
+
### `prepend`
|
|
59
|
+
|
|
60
|
+
`boolean`
|
|
61
|
+
|
|
62
|
+
A boolean representing whether to prepend rather than append style tags into the specified container DOM node.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// Definitions by: Junyoung Clare Jang <https://github.com/Ailrun>
|
|
2
|
+
// TypeScript Version: 2.2
|
|
3
|
+
|
|
4
|
+
import { EmotionCache } from '@emotion/utils'
|
|
5
|
+
|
|
6
|
+
export { EmotionCache }
|
|
7
|
+
|
|
8
|
+
export interface StylisElement {
|
|
9
|
+
type: string
|
|
10
|
+
value: string
|
|
11
|
+
props: Array<string> | string
|
|
12
|
+
root: StylisElement | null
|
|
13
|
+
parent: StylisElement | null
|
|
14
|
+
children: Array<StylisElement> | string
|
|
15
|
+
line: number
|
|
16
|
+
column: number
|
|
17
|
+
length: number
|
|
18
|
+
return: string
|
|
19
|
+
}
|
|
20
|
+
export type StylisPluginCallback = (
|
|
21
|
+
element: StylisElement,
|
|
22
|
+
index: number,
|
|
23
|
+
children: Array<StylisElement>,
|
|
24
|
+
callback: StylisPluginCallback
|
|
25
|
+
) => string | void
|
|
26
|
+
|
|
27
|
+
export type StylisPlugin = (
|
|
28
|
+
element: StylisElement,
|
|
29
|
+
index: number,
|
|
30
|
+
children: Array<StylisElement>,
|
|
31
|
+
callback: StylisPluginCallback
|
|
32
|
+
) => string | void
|
|
33
|
+
|
|
34
|
+
export interface Options {
|
|
35
|
+
nonce?: string
|
|
36
|
+
stylisPlugins?: Array<StylisPlugin>
|
|
37
|
+
key: string
|
|
38
|
+
container?: Node
|
|
39
|
+
speedy?: boolean
|
|
40
|
+
/** @deprecate use `insertionPoint` instead */
|
|
41
|
+
prepend?: boolean
|
|
42
|
+
insertionPoint?: HTMLElement
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export default function createCache(options: Options): EmotionCache
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
exports._default = require("./emotion-cache.browser.cjs.js").default;
|