@skinramp/ts-sdk 0.0.2 → 0.0.3
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 +23 -13
- package/dist/index.mjs +1 -41
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,23 +1,33 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @skinramp/ts-sdk
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Official TypeScript SDK for the Skinramp API.
|
|
4
4
|
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
- Install dependencies:
|
|
5
|
+
## Installation
|
|
8
6
|
|
|
9
7
|
```bash
|
|
10
|
-
npm install
|
|
8
|
+
npm install @skinramp/ts-sdk
|
|
9
|
+
# or
|
|
10
|
+
yarn add @skinramp/ts-sdk
|
|
11
|
+
# or
|
|
12
|
+
pnpm add @skinramp/ts-sdk
|
|
13
|
+
# or
|
|
14
|
+
bun add @skinramp/ts-sdk
|
|
11
15
|
```
|
|
12
16
|
|
|
13
|
-
|
|
17
|
+
## Usage
|
|
14
18
|
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
```
|
|
19
|
+
```typescript
|
|
20
|
+
import Skinramp from "@skinramp/ts-sdk";
|
|
18
21
|
|
|
19
|
-
|
|
22
|
+
const skinramp = new Skinramp("sk_live_...");
|
|
20
23
|
|
|
21
|
-
|
|
22
|
-
|
|
24
|
+
const paymentId = await skinramp.payments.create({
|
|
25
|
+
amount: 1000, // $10.00 in cents
|
|
26
|
+
gameId: "CS2", // optional: "CS2" | "ROBLOX" | "RUST"
|
|
27
|
+
metadata: { orderId: "order_123" }, // optional
|
|
28
|
+
});
|
|
23
29
|
```
|
|
30
|
+
|
|
31
|
+
## License
|
|
32
|
+
|
|
33
|
+
MIT
|
package/dist/index.mjs
CHANGED
|
@@ -1,41 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { anyApi } from "convex/server";
|
|
3
|
-
import "convex/values";
|
|
4
|
-
|
|
5
|
-
//#region src/api.ts
|
|
6
|
-
const api = anyApi;
|
|
7
|
-
|
|
8
|
-
//#endregion
|
|
9
|
-
//#region src/client.ts
|
|
10
|
-
/**
|
|
11
|
-
* Skinramp SDK client
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```typescript
|
|
15
|
-
* const skinramp = new Skinramp('sk_development_...')
|
|
16
|
-
*
|
|
17
|
-
* // Create a payment
|
|
18
|
-
* const payment = await skinramp.payments.create('user_123')
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
var Skinramp = class {
|
|
22
|
-
convexHttp;
|
|
23
|
-
apiKey;
|
|
24
|
-
constructor(apiKey, apiUrl = "https://sync.skinramp.com") {
|
|
25
|
-
if (!apiKey) throw new Error("API key is required");
|
|
26
|
-
this.apiKey = apiKey;
|
|
27
|
-
this.convexHttp = new ConvexHttpClient(apiUrl);
|
|
28
|
-
}
|
|
29
|
-
payments = { create: async (data) => {
|
|
30
|
-
if (!this.apiKey) throw new Error("API key is required");
|
|
31
|
-
return await this.convexHttp.mutation(api.payments.createPayment, {
|
|
32
|
-
apiKey: this.apiKey,
|
|
33
|
-
amount: data.amount,
|
|
34
|
-
gameId: data.gameId,
|
|
35
|
-
metadata: data.metadata
|
|
36
|
-
});
|
|
37
|
-
} };
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
//#endregion
|
|
41
|
-
export { Skinramp, Skinramp as default };
|
|
1
|
+
import{ConvexHttpClient as e}from"convex/browser";import{anyApi as t}from"convex/server";import"convex/values";const n=t;var r=class{convexHttp;apiKey;constructor(t,n=`https://sync.skinramp.com`){if(!t)throw Error(`API key is required`);this.apiKey=t,this.convexHttp=new e(n)}payments={create:async e=>{if(!this.apiKey)throw Error(`API key is required`);return await this.convexHttp.mutation(n.payments.createPayment,{apiKey:this.apiKey,amount:e.amount,gameId:e.gameId,metadata:e.metadata})}}};export{r as Skinramp,r as default};
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skinramp/ts-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "Skinramp TypeScript SDK",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"homepage": "https://
|
|
6
|
+
"homepage": "https://skinramp.com",
|
|
7
7
|
"author": "Skinramp <support@skinramp.com>",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"main": "./dist/index.mjs",
|