Skip to content

Commit 16fedb5

Browse files
quantumquantum
authored andcommitted
more work
1 parent 83a3cf1 commit 16fedb5

File tree

12 files changed

+303
-226
lines changed

12 files changed

+303
-226
lines changed

.github/workflows/wasm-sdk-documentation-check.yml

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,9 @@ jobs:
5757
echo "status=failure" >> $GITHUB_OUTPUT
5858
fi
5959
60-
# Check if documentation needs to be regenerated
61-
if git diff --quiet docs.html docs_manifest.json AI_REFERENCE.md; then
60+
# Note: At this point, the documentation hasn't been regenerated yet,
61+
# so this check will only detect if the PR already includes documentation changes
62+
if git diff --quiet HEAD -- docs.html docs_manifest.json AI_REFERENCE.md; then
6263
echo "docs_modified=false" >> $GITHUB_OUTPUT
6364
else
6465
echo "docs_modified=true" >> $GITHUB_OUTPUT
@@ -114,13 +115,12 @@ jobs:
114115
}
115116
}
116117
117-
- name: Auto-update documentation
118-
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/v')) && steps.doc-check.outputs.status == 'failure'
118+
- name: Auto-update documentation (non-protected branches)
119+
if: github.event_name == 'push' && !contains(github.ref, 'master') && !contains(github.ref, 'main') && steps.doc-check.outputs.status == 'failure'
119120
working-directory: packages/wasm-sdk
120121
run: |
121122
# Generate updated documentation
122123
python3 generate_docs.py
123-
124124
# Check if there are changes
125125
if ! git diff --quiet docs.html docs_manifest.json AI_REFERENCE.md; then
126126
git config --local user.email "github-actions[bot]@users.noreply.github.com"
@@ -129,6 +129,21 @@ jobs:
129129
git commit -m "chore: update WASM SDK documentation [skip ci]"
130130
git push
131131
fi
132+
133+
- name: Create documentation update PR (protected branches)
134+
if: github.event_name == 'push' && (contains(github.ref, 'master') || contains(github.ref, 'main')) && steps.doc-check.outputs.status == 'failure'
135+
uses: peter-evans/create-pull-request@v5
136+
with:
137+
token: ${{ secrets.GITHUB_TOKEN }}
138+
commit-message: "chore: update WASM SDK documentation"
139+
title: "chore: update WASM SDK documentation"
140+
body: |
141+
This PR updates the WASM SDK documentation to match the current implementation.
142+
143+
Auto-generated by GitHub Actions.
144+
branch: auto-update-wasm-docs-${{ github.run_number }}
145+
base: ${{ github.ref_name }}
146+
path: packages/wasm-sdk
132147

133148
- name: Fail if documentation is out of date
134149
if: steps.doc-check.outputs.status == 'failure' && github.event_name == 'pull_request'

packages/wasm-sdk/AI_REFERENCE.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Parameters:
4444

4545
Example:
4646
```javascript
47-
const identity = await sdk.get_identity("GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec");
47+
const identity = await sdk.getIdentity("GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec");
4848
```
4949

5050
**Get Identity Keys** - `getIdentityKeys`
@@ -109,7 +109,7 @@ Parameters:
109109

110110
Example:
111111
```javascript
112-
const balance = await sdk.get_identity_balance(identityId);
112+
const balance = await sdk.getIdentityBalance(identityId);
113113
```
114114

115115
**Get Identities Balances** - `getIdentitiesBalances`
@@ -267,7 +267,7 @@ Parameters:
267267

268268
Example:
269269
```javascript
270-
const docs = await sdk.get_documents(
270+
const docs = await sdk.getDocuments(
271271
contractId,
272272
"note",
273273
JSON.stringify([["$ownerId", "==", identityId]]),
@@ -1072,7 +1072,7 @@ const result = await sdk.masternodeVote(identityHex, /* params */, privateKeyHex
10721072
### Error Handling
10731073
```javascript
10741074
try {
1075-
const result = await sdk.get_identity(identityId);
1075+
const result = await sdk.getIdentity(identityId);
10761076
console.log(result);
10771077
} catch (error) {
10781078
console.error("Query failed:", error);
@@ -1085,7 +1085,7 @@ try {
10851085
const sdk = await WasmSdk.new(transport, true);
10861086

10871087
// Query with proof verification
1088-
const identityWithProof = await sdk.get_identity(identityId);
1088+
const identityWithProof = await sdk.getIdentity(identityId);
10891089
```
10901090

10911091
### Document Queries with Where/OrderBy
@@ -1101,7 +1101,7 @@ const orderBy = JSON.stringify([
11011101
["$createdAt", "desc"]
11021102
]);
11031103

1104-
const docs = await sdk.get_documents(
1104+
const docs = await sdk.getDocuments(
11051105
contractId,
11061106
documentType,
11071107
whereClause,
@@ -1114,7 +1114,7 @@ const docs = await sdk.get_documents(
11141114
```javascript
11151115
// Get multiple identities
11161116
const identityIds = ["id1", "id2", "id3"];
1117-
const balances = await sdk.get_identities_balances(identityIds);
1117+
const balances = await sdk.getIdentitiesBalances(identityIds);
11181118
```
11191119

11201120
## Important Notes

0 commit comments

Comments
 (0)