stablecoin-games-renpy 0.0.0-stage → 0.1.4
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/LICENSE +21 -0
- package/README.md +60 -2
- package/bin/stablecoin-games-renpy.js +4 -0
- package/lib/install.js +145 -0
- package/package.json +53 -4
- package/plugin/game/python-packages/scfg_core/__init__.py +7 -0
- package/plugin/game/python-packages/scfg_core/_qrcodegen.py +907 -0
- package/plugin/game/python-packages/scfg_core/_xkcp.py +90 -0
- package/plugin/game/python-packages/scfg_core/amounts.py +84 -0
- package/plugin/game/python-packages/scfg_core/backends/__init__.py +42 -0
- package/plugin/game/python-packages/scfg_core/backends/base.py +36 -0
- package/plugin/game/python-packages/scfg_core/backends/evm.py +40 -0
- package/plugin/game/python-packages/scfg_core/backends/solana.py +359 -0
- package/plugin/game/python-packages/scfg_core/chains.py +228 -0
- package/plugin/game/python-packages/scfg_core/checkout.py +516 -0
- package/plugin/game/python-packages/scfg_core/coio.py +118 -0
- package/plugin/game/python-packages/scfg_core/config.py +384 -0
- package/plugin/game/python-packages/scfg_core/engine.py +243 -0
- package/plugin/game/python-packages/scfg_core/errors.py +9 -0
- package/plugin/game/python-packages/scfg_core/evm.py +98 -0
- package/plugin/game/python-packages/scfg_core/keccak.py +17 -0
- package/plugin/game/python-packages/scfg_core/local_server.py +203 -0
- package/plugin/game/python-packages/scfg_core/models.py +46 -0
- package/plugin/game/python-packages/scfg_core/overlay.py +110 -0
- package/plugin/game/python-packages/scfg_core/page_messages.py +42 -0
- package/plugin/game/python-packages/scfg_core/paylinks.py +41 -0
- package/plugin/game/python-packages/scfg_core/payments.py +57 -0
- package/plugin/game/python-packages/scfg_core/pump_worker.py +168 -0
- package/plugin/game/python-packages/scfg_core/receipts.py +68 -0
- package/plugin/game/python-packages/scfg_core/restore.py +132 -0
- package/plugin/game/python-packages/scfg_core/restore_flow.py +100 -0
- package/plugin/game/python-packages/scfg_core/reverify.py +99 -0
- package/plugin/game/python-packages/scfg_core/rpc.py +263 -0
- package/plugin/game/python-packages/scfg_core/sessions.py +97 -0
- package/plugin/game/python-packages/scfg_core/solana/__init__.py +2 -0
- package/plugin/game/python-packages/scfg_core/solana/base58.py +48 -0
- package/plugin/game/python-packages/scfg_core/solana/ed25519.py +24 -0
- package/plugin/game/python-packages/scfg_core/solana/paylinks.py +16 -0
- package/plugin/game/python-packages/scfg_core/solana/pda.py +36 -0
- package/plugin/game/python-packages/scfg_core/solana/rpc.py +143 -0
- package/plugin/game/python-packages/scfg_core/solana/tx.py +104 -0
- package/plugin/game/python-packages/scfg_core/transfers.py +20 -0
- package/plugin/game/python-packages/scfg_core/watcher.py +184 -0
- package/plugin/game/python-packages/scfg_core/web_page.py +98 -0
- package/plugin/game/python-packages/scfg_core/worker.py +100 -0
- package/plugin/game/scfg/scfg_api.rpy +769 -0
- package/plugin/game/scfg/scfg_screens.rpy +848 -0
- package/plugin/game/scfg/ui/dot.png +0 -0
- package/plugin/game/scfg/ui/fill.png +0 -0
- package/plugin/game/scfg/ui/line.png +0 -0
- package/plugin/game/scfg/web/app.js +224 -0
- package/plugin/game/scfg/web/bridge.js +284 -0
- package/plugin/game/scfg/web/evm.js +195 -0
- package/plugin/game/scfg/web/index.html +71 -0
- package/plugin/game/scfg/web/solana.js +182 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Repulse Game Studio
|
|
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
CHANGED
|
@@ -1,3 +1,61 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Stablecoin for Games
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Take tips and sell unlocks in **USDC** and **USDT** inside your Ren'Py game, on Ethereum,
|
|
4
|
+
Arbitrum, Polygon, Base, Arc or Solana. The player's wallet pays yours directly. There is no
|
|
5
|
+
store, account or server in between: the game watches the blockchain itself. Prices are in
|
|
6
|
+
dollars. There are no tokens to buy and no NFTs.
|
|
7
|
+
|
|
8
|
+

|
|
9
|
+
|
|
10
|
+
This package installs the plugin into your Ren'Py project. It needs Node 18 or newer and
|
|
11
|
+
nothing else. The plugin itself is plain Python that runs inside Ren'Py, so the game and
|
|
12
|
+
your players never need Node.
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
From your Ren'Py project folder (the one that contains `game/`):
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npx stablecoin-games-renpy install .
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
That adds:
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
game/scfg/ (screens, API, browser checkout page)
|
|
26
|
+
game/python-packages/scfg_core/ (the engine; plain Python)
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Update
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npx stablecoin-games-renpy@latest update .
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
It replaces those two folders with the latest version. Your own files, your configuration
|
|
36
|
+
and your players' purchases are not touched.
|
|
37
|
+
|
|
38
|
+
## Use it
|
|
39
|
+
|
|
40
|
+
```renpy
|
|
41
|
+
init python:
|
|
42
|
+
scfg.configure(wallet="0xYourWallet", testnet=True)
|
|
43
|
+
scfg.add_item("chapter2", code=1, price="4.99", token="USDC", title="Chapter 2")
|
|
44
|
+
|
|
45
|
+
label end_of_chapter1:
|
|
46
|
+
$ result = scfg.pay("unlock", item="chapter2")
|
|
47
|
+
if scfg.owns("chapter2"):
|
|
48
|
+
jump chapter2
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Requires Ren'Py 8.2 or newer. Read the
|
|
52
|
+
[developer guide](https://jrpg.com/stablecoinforgames/docs/developers/install) and the
|
|
53
|
+
[security notes](https://jrpg.com/stablecoinforgames/docs/developers/security) before you
|
|
54
|
+
sell anything: without a server, unlocks are honour-grade.
|
|
55
|
+
|
|
56
|
+
- Website: https://jrpg.com/stablecoinforgames/
|
|
57
|
+
- Docs: https://jrpg.com/stablecoinforgames/docs/
|
|
58
|
+
- Source and release zips: https://github.com/Repulse-Game-Studio/jrpg-stablecoin-games
|
|
59
|
+
- itch.io: https://repulse-games.itch.io/stablecoin-for-games
|
|
60
|
+
- PyPI: https://pypi.org/project/stablecoin-games-renpy/ (`uvx stablecoin-games-renpy install .`)
|
|
61
|
+
- License: MIT
|
package/lib/install.js
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
// Copy the Stablecoin for Games plugin into a Ren'Py project, or update the copy there.
|
|
2
|
+
// Same behaviour as installer/scfg_renpy/cli.py, for developers who have Node but not Python.
|
|
3
|
+
//
|
|
4
|
+
// Ren'Py loads code only from a game's own game/ folder, so the package carries the plugin
|
|
5
|
+
// files and this command puts them where Ren'Py looks:
|
|
6
|
+
//
|
|
7
|
+
// game/scfg/ (screens, API, browser checkout page)
|
|
8
|
+
// game/python-packages/scfg_core/ (the engine)
|
|
9
|
+
|
|
10
|
+
"use strict";
|
|
11
|
+
|
|
12
|
+
const fs = require("node:fs");
|
|
13
|
+
const path = require("node:path");
|
|
14
|
+
|
|
15
|
+
const DOCS_URL = "https://jrpg.com/stablecoinforgames/docs/";
|
|
16
|
+
// Relative to a project's game/ folder.
|
|
17
|
+
const PARTS = [path.join("scfg"), path.join("python-packages", "scfg_core")];
|
|
18
|
+
const IGNORED = /(^|[\\/])__pycache__([\\/]|$)|\.(pyc|rpyc|rpymc)$/;
|
|
19
|
+
const VERSION = /^__version__\s*=\s*["']([^"']+)["']/m;
|
|
20
|
+
|
|
21
|
+
class InstallError extends Error {}
|
|
22
|
+
|
|
23
|
+
/** The plugin's game/ folder: inside the package, or in the repository from a checkout. */
|
|
24
|
+
function bundledGameDir() {
|
|
25
|
+
const here = path.resolve(__dirname, "..");
|
|
26
|
+
for (const candidate of [path.join(here, "plugin", "game"),
|
|
27
|
+
path.join(here, "..", "plugin", "game")]) {
|
|
28
|
+
if (isDir(path.join(candidate, "scfg"))) return candidate;
|
|
29
|
+
}
|
|
30
|
+
throw new InstallError("the plugin files are missing from this installation; reinstall stablecoin-games-renpy");
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function readVersion(gameDir) {
|
|
34
|
+
const init = path.join(gameDir, "python-packages", "scfg_core", "__init__.py");
|
|
35
|
+
if (!isFile(init)) return null;
|
|
36
|
+
const match = VERSION.exec(fs.readFileSync(init, "utf8"));
|
|
37
|
+
return match ? match[1] : null;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** The game/ folder of the Ren'Py project at `p` (the project folder or game/ itself). */
|
|
41
|
+
function findGameDir(p) {
|
|
42
|
+
const resolved = path.resolve(p.replace(/^~(?=$|[\\/])/, require("node:os").homedir()));
|
|
43
|
+
if (!isDir(resolved)) throw new InstallError(`${resolved} is not a folder`);
|
|
44
|
+
const game = path.basename(resolved) === "game" ? resolved : path.join(resolved, "game");
|
|
45
|
+
if (isDir(game) && hasRenpyFiles(game)) return game;
|
|
46
|
+
throw new InstallError(
|
|
47
|
+
`${resolved} doesn't look like a Ren'Py project: expected a game/ folder with .rpy files. ` +
|
|
48
|
+
"Pass your project folder, the one that contains game/.");
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function hasRenpyFiles(dir) {
|
|
52
|
+
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
53
|
+
if (entry.isFile() && /\.rpyc?$/.test(entry.name)) return true;
|
|
54
|
+
if (entry.isDirectory() && hasRenpyFiles(path.join(dir, entry.name))) return true;
|
|
55
|
+
}
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function isInstalled(gameDir) {
|
|
60
|
+
return PARTS.some((part) => fs.existsSync(path.join(gameDir, part)));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function copyPlugin(sourceGame, gameDir) {
|
|
64
|
+
for (const part of PARTS) {
|
|
65
|
+
fs.cpSync(path.join(sourceGame, part), path.join(gameDir, part), {
|
|
66
|
+
recursive: true,
|
|
67
|
+
filter: (src) => !IGNORED.test(src),
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function removePlugin(gameDir) {
|
|
73
|
+
for (const part of PARTS) {
|
|
74
|
+
fs.rmSync(path.join(gameDir, part), { recursive: true, force: true });
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function install(project, sourceGame = bundledGameDir()) {
|
|
79
|
+
const gameDir = findGameDir(project);
|
|
80
|
+
if (isInstalled(gameDir)) {
|
|
81
|
+
const current = readVersion(gameDir) || "unknown version";
|
|
82
|
+
throw new InstallError(`the plugin is already in ${gameDir} (${current}). ` +
|
|
83
|
+
"Use `stablecoin-games-renpy update` to replace it.");
|
|
84
|
+
}
|
|
85
|
+
copyPlugin(sourceGame, gameDir);
|
|
86
|
+
return `Installed Stablecoin for Games ${readVersion(gameDir)} into ${gameDir}`;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function update(project, sourceGame = bundledGameDir()) {
|
|
90
|
+
const gameDir = findGameDir(project);
|
|
91
|
+
const old = isInstalled(gameDir) ? readVersion(gameDir) : null;
|
|
92
|
+
// Remove first, so files dropped in the new version don't linger.
|
|
93
|
+
removePlugin(gameDir);
|
|
94
|
+
copyPlugin(sourceGame, gameDir);
|
|
95
|
+
const now = readVersion(gameDir);
|
|
96
|
+
if (old === null) return `Installed Stablecoin for Games ${now} into ${gameDir}`;
|
|
97
|
+
return `Updated Stablecoin for Games ${old} -> ${now} in ${gameDir}`;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const USAGE = `usage: stablecoin-games-renpy {install,update} [project]
|
|
101
|
+
|
|
102
|
+
Add the Stablecoin for Games plugin to a Ren'Py project, or update it.
|
|
103
|
+
|
|
104
|
+
install [project] copy the plugin into a project
|
|
105
|
+
update [project] replace the plugin in a project with this version
|
|
106
|
+
|
|
107
|
+
project: your Ren'Py project folder (default: the current folder)`;
|
|
108
|
+
|
|
109
|
+
/** Runs the command; returns the exit code. `out`/`err` take one line each. */
|
|
110
|
+
function main(argv, out = console.log, err = console.error) {
|
|
111
|
+
const [command, project = ".", ...extra] = argv;
|
|
112
|
+
if (command === "--version" || command === "-V") {
|
|
113
|
+
let version = null;
|
|
114
|
+
try { version = readVersion(bundledGameDir()); } catch { /* reported as unknown */ }
|
|
115
|
+
out(`stablecoin-games-renpy ${version || "unknown"}`);
|
|
116
|
+
return 0;
|
|
117
|
+
}
|
|
118
|
+
if (command === "--help" || command === "-h") {
|
|
119
|
+
out(USAGE);
|
|
120
|
+
return 0;
|
|
121
|
+
}
|
|
122
|
+
if ((command !== "install" && command !== "update") || extra.length) {
|
|
123
|
+
err(USAGE);
|
|
124
|
+
return 2;
|
|
125
|
+
}
|
|
126
|
+
try {
|
|
127
|
+
out((command === "install" ? install : update)(project));
|
|
128
|
+
} catch (e) {
|
|
129
|
+
if (!(e instanceof InstallError)) throw e;
|
|
130
|
+
err(`stablecoin-games-renpy: ${e.message}`);
|
|
131
|
+
return 1;
|
|
132
|
+
}
|
|
133
|
+
if (command === "install") out(`Next: add scfg.configure(...) in any .rpy file. Guide: ${DOCS_URL}`);
|
|
134
|
+
return 0;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function isDir(p) {
|
|
138
|
+
try { return fs.statSync(p).isDirectory(); } catch { return false; }
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function isFile(p) {
|
|
142
|
+
try { return fs.statSync(p).isFile(); } catch { return false; }
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
module.exports = { InstallError, bundledGameDir, readVersion, findGameDir, install, update, main };
|
package/package.json
CHANGED
|
@@ -1,6 +1,55 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stablecoin-games-renpy",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.4",
|
|
4
|
+
"description": "Stablecoin for Games (SCFG): USDC/USDT tips and unlocks for Ren'Py games, paid straight to your wallet. No server, no tokens, no NFTs. Installs the plugin into your project.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"stablecoin-for-games",
|
|
7
|
+
"stablecoin-games",
|
|
8
|
+
"stablecoinforgames",
|
|
9
|
+
"scfg",
|
|
10
|
+
"renpy",
|
|
11
|
+
"visual-novel",
|
|
12
|
+
"usdc",
|
|
13
|
+
"usdt",
|
|
14
|
+
"stablecoin",
|
|
15
|
+
"payments",
|
|
16
|
+
"tips",
|
|
17
|
+
"game-monetization",
|
|
18
|
+
"solana",
|
|
19
|
+
"ethereum",
|
|
20
|
+
"base",
|
|
21
|
+
"arbitrum",
|
|
22
|
+
"polygon",
|
|
23
|
+
"arc",
|
|
24
|
+
"crypto",
|
|
25
|
+
"web3",
|
|
26
|
+
"donations",
|
|
27
|
+
"monetization",
|
|
28
|
+
"wallet"
|
|
29
|
+
],
|
|
30
|
+
"homepage": "https://jrpg.com/stablecoinforgames/",
|
|
31
|
+
"bugs": "https://github.com/Repulse-Game-Studio/jrpg-stablecoin-games/issues",
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "git+https://github.com/Repulse-Game-Studio/jrpg-stablecoin-games.git",
|
|
35
|
+
"directory": "npm"
|
|
36
|
+
},
|
|
37
|
+
"license": "MIT",
|
|
38
|
+
"bin": {
|
|
39
|
+
"stablecoin-games-renpy": "bin/stablecoin-games-renpy.js",
|
|
40
|
+
"scfg-renpy": "bin/stablecoin-games-renpy.js"
|
|
41
|
+
},
|
|
42
|
+
"main": "lib/install.js",
|
|
43
|
+
"files": [
|
|
44
|
+
"bin/",
|
|
45
|
+
"lib/",
|
|
46
|
+
"plugin/"
|
|
47
|
+
],
|
|
48
|
+
"engines": {
|
|
49
|
+
"node": ">=18"
|
|
50
|
+
},
|
|
51
|
+
"scripts": {
|
|
52
|
+
"prepack": "node scripts/bundle.js",
|
|
53
|
+
"test": "node --test"
|
|
54
|
+
}
|
|
55
|
+
}
|