@sorandomains/holder 0.1.0 → 0.1.1
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 +2 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.js +15 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -28,11 +28,12 @@ await me.setProfile("alice.nova", { // the standard keys every wallet reads
|
|
|
28
28
|
| --- | --- |
|
|
29
29
|
| `setRecord` | Point your name's explicit resolver record at any address (generation-gated — stops resolving the moment the name changes hands) |
|
|
30
30
|
| `setAddress` | Re-point the built-in (Registrar) resolution target |
|
|
31
|
-
| `setText` / `setProfile` | Publish text records; `setProfile` writes the standard `PROFILE_KEYS` (one transaction per key) |
|
|
31
|
+
| `setText` / `setProfile` / `clearText` | Publish text records; `setProfile` writes the standard `PROFILE_KEYS` (one transaction per key); records are overwrite-only on chain — `clearText` retracts by writing the empty value standard readers treat as unset |
|
|
32
32
|
| `setReverse` / `clearReverse` | Claim your address→name reverse record — the contract refuses names that don't already resolve to you (`ForwardMismatch`) |
|
|
33
33
|
| `setPrimary` / `clearPrimary` | Your one cross-namespace display name, re-verified on chain at every read |
|
|
34
34
|
| `proposeNameTransfer` / `acceptNameTransfer` / `cancelNameTransfer` | Two-step, accept-to-move name transfers (policy-gated) |
|
|
35
35
|
| `pendingNameTransfer` | Read the pending proposal |
|
|
36
|
+
| `registrarOf` / `resolverOf` | Discover the namespace's attested Registrar / resolver pointer |
|
|
36
37
|
|
|
37
38
|
Everything is holder-authorized **on chain** — the Resolver checks you hold
|
|
38
39
|
the name right now, reverse and primary claims are authorized by the address
|
package/dist/index.d.ts
CHANGED
|
@@ -158,6 +158,11 @@ export declare class SoranHolder {
|
|
|
158
158
|
* and the contract enforces that the name's forward record already
|
|
159
159
|
* resolves to you (ForwardMismatch otherwise): a reverse claim on a name
|
|
160
160
|
* that doesn't point back at you is spoofing, and the chain refuses it.
|
|
161
|
+
*
|
|
162
|
+
* NOTE the forward proof must be the RESOLVER's OWN record — the
|
|
163
|
+
* Registrar's built-in target (which `lookup.resolve` also honors for
|
|
164
|
+
* fresh names) does not count. On a freshly issued name, call
|
|
165
|
+
* `setRecord(name, yourAddress)` first, then `setReverse(name)`.
|
|
161
166
|
*/
|
|
162
167
|
setReverse(name: string): Promise<Submitted>;
|
|
163
168
|
/** Remove your reverse record on a namespace's resolver. */
|
package/dist/index.js
CHANGED
|
@@ -322,12 +322,26 @@ export class SoranHolder {
|
|
|
322
322
|
* and the contract enforces that the name's forward record already
|
|
323
323
|
* resolves to you (ForwardMismatch otherwise): a reverse claim on a name
|
|
324
324
|
* that doesn't point back at you is spoofing, and the chain refuses it.
|
|
325
|
+
*
|
|
326
|
+
* NOTE the forward proof must be the RESOLVER's OWN record — the
|
|
327
|
+
* Registrar's built-in target (which `lookup.resolve` also honors for
|
|
328
|
+
* fresh names) does not count. On a freshly issued name, call
|
|
329
|
+
* `setRecord(name, yourAddress)` first, then `setReverse(name)`.
|
|
325
330
|
*/
|
|
326
331
|
async setReverse(name) {
|
|
327
332
|
const { namespace } = parseName(name);
|
|
328
333
|
const resolverId = await this.resolverOf(namespace);
|
|
329
334
|
const pub = await this.signer.publicKey();
|
|
330
|
-
|
|
335
|
+
let r;
|
|
336
|
+
try {
|
|
337
|
+
r = await this.invoke(resolverId, "set_reverse", [addrArg(pub), nativeToScVal(name.toLowerCase(), { type: "string" })], RESOLVER_ERRORS);
|
|
338
|
+
}
|
|
339
|
+
catch (e) {
|
|
340
|
+
if (e instanceof HolderError && e.codeName === "ForwardMismatch") {
|
|
341
|
+
throw new HolderError(`${e.message} — the resolver only accepts its OWN forward record as proof; if this name still resolves via the Registrar's built-in target, call setRecord(name, yourAddress) first, then retry setReverse`, e.contractId, e.fn, e.code, e.codeName, e.txHash);
|
|
342
|
+
}
|
|
343
|
+
throw e;
|
|
344
|
+
}
|
|
331
345
|
return { hash: r.hash, ledger: r.ledger };
|
|
332
346
|
}
|
|
333
347
|
/** Remove your reverse record on a namespace's resolver. */
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sorandomains/holder",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Manage your own Soran name on Stellar
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Manage your own Soran name on Stellar \u2014 records, profile, reverse, primary, and transfers, signed by your key.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|