@arxiumlabs/sdk 0.4.0 → 0.5.0
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 +14 -0
- package/dist/actions.d.ts +24 -0
- package/dist/actions.js +35 -1
- package/dist/cli.js +0 -0
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -123,3 +123,17 @@ stateful witnesses; `arx verify SIGNATURE --policy FILE` accepts that policy.
|
|
|
123
123
|
|
|
124
124
|
See [the programmable-account guide](../../docs/Programmable_Accounts.md) for
|
|
125
125
|
configuration shapes, fees, block-height windows, recovery and reset requirements.
|
|
126
|
+
|
|
127
|
+
## Release validation
|
|
128
|
+
|
|
129
|
+
CI builds and installs the packed SDK on pull requests. Run `npm ci`,
|
|
130
|
+
`npm run test:release`, `npm test`, then `npm run check:package` locally.
|
|
131
|
+
The package check installs the tarball in a temporary directory, imports its
|
|
132
|
+
public entry point and checks the CLI version; it makes no chain calls.
|
|
133
|
+
|
|
134
|
+
Publication runs only for an approved `sdk-vX.Y.Z` tag matching package.json.
|
|
135
|
+
The publish job builds its own checkout, checks the packed files and smoke-tests
|
|
136
|
+
the tarball, then publishes that exact tarball with provenance. Existing npm
|
|
137
|
+
versions cannot be replaced. npm trusted-publisher configuration and release
|
|
138
|
+
authorization are still required; a passing package check is not publication
|
|
139
|
+
or on-chain compatibility proof.
|
package/dist/actions.d.ts
CHANGED
|
@@ -23,7 +23,15 @@ export declare const ACTION_VARIANT: {
|
|
|
23
23
|
readonly issuerForcedTransfer: 22;
|
|
24
24
|
readonly recoverHolder: 23;
|
|
25
25
|
readonly issueAssetTo: 24;
|
|
26
|
+
readonly lockIssuance: 25;
|
|
27
|
+
readonly transferIssuer: 26;
|
|
28
|
+
readonly setAssetMetadataUri: 27;
|
|
26
29
|
readonly setAssetLimits: 28;
|
|
30
|
+
readonly lockHolderAmountUntil: 29;
|
|
31
|
+
readonly snapshotHolders: 33;
|
|
32
|
+
readonly distributeToHolders: 34;
|
|
33
|
+
readonly redeemHolders: 35;
|
|
34
|
+
readonly splitAsset: 36;
|
|
27
35
|
readonly verifyClaimProof: 37;
|
|
28
36
|
readonly setPrivateClaims: 38;
|
|
29
37
|
readonly submitProposal: 30;
|
|
@@ -89,6 +97,22 @@ export declare function encodeLockHolderAmount(asset: string, holder: string, am
|
|
|
89
97
|
export declare function encodeIssuerForcedTransfer(asset: string, from: string, to: string, amount: bigint, reason: string): Uint8Array;
|
|
90
98
|
export declare function encodeRecoverHolder(asset: string, lost: string, replacement: string): Uint8Array;
|
|
91
99
|
export declare function encodeIssueAssetTo(asset: string, to: string, amount: bigint): Uint8Array;
|
|
100
|
+
/** One-way: the issuer gives up minting and `max_supply` is pinned to the current supply. */
|
|
101
|
+
export declare function encodeLockIssuance(asset: string): Uint8Array;
|
|
102
|
+
/** Hands every issuer right over `asset` to `newIssuer` (key rotation, compromise remedy). */
|
|
103
|
+
export declare function encodeTransferIssuer(asset: string, newIssuer: string): Uint8Array;
|
|
104
|
+
/** `null` clears the link. */
|
|
105
|
+
export declare function encodeSetAssetMetadataUri(asset: string, metadataUri: string | null): Uint8Array;
|
|
106
|
+
/** A holding period: the lock releases itself at `untilHeight`. */
|
|
107
|
+
export declare function encodeLockHolderAmountUntil(asset: string, holder: string, amount: bigint, untilHeight: bigint): Uint8Array;
|
|
108
|
+
/** Records the record-date cap table; the corporate actions below name it by its block height. */
|
|
109
|
+
export declare function encodeSnapshotHolders(asset: string): Uint8Array;
|
|
110
|
+
/** Dividend/coupon: pays `total` of `payoutAsset` pro rata to the snapshot at `snapshotHeight`. */
|
|
111
|
+
export declare function encodeDistributeToHolders(asset: string, snapshotHeight: bigint, payoutAsset: string, total: bigint): Uint8Array;
|
|
112
|
+
/** Forces every snapshot balance back to the issuer. Send the proceeds with `encodeDistributeToHolders` first. */
|
|
113
|
+
export declare function encodeRedeemHolders(asset: string, snapshotHeight: bigint): Uint8Array;
|
|
114
|
+
/** Each snapshot holding `b` becomes `b * numerator / denominator` (split if >1, consolidation if <1). */
|
|
115
|
+
export declare function encodeSplitAsset(asset: string, snapshotHeight: bigint, numerator: bigint, denominator: bigint): Uint8Array;
|
|
92
116
|
/** Sets issuer-controlled investor, concentration, and attestation-age limits. `null` clears each limit. */
|
|
93
117
|
/** zk-KYC: a holder's private eligibility proof. `sub` is a fixed 32-byte array on the node, so it rides raw (no length prefix); `proof` is length-prefixed. */
|
|
94
118
|
export declare function encodeVerifyClaimProof(asset: string, sub: Uint8Array, todayDays: number, proof: Uint8Array): Uint8Array;
|
package/dist/actions.js
CHANGED
|
@@ -8,7 +8,9 @@ export const ACTION_VARIANT = {
|
|
|
8
8
|
registerAsset: 12, issueAsset: 13, transferAsset: 14, freezeAsset: 16, unfreezeAsset: 17,
|
|
9
9
|
burnAsset: 18, setHolderFrozen: 19, lockHolderAmount: 20, unlockHolderAmount: 21,
|
|
10
10
|
issuerForcedTransfer: 22, recoverHolder: 23, issueAssetTo: 24,
|
|
11
|
-
|
|
11
|
+
lockIssuance: 25, transferIssuer: 26, setAssetMetadataUri: 27, setAssetLimits: 28, lockHolderAmountUntil: 29,
|
|
12
|
+
snapshotHolders: 33, distributeToHolders: 34, redeemHolders: 35, splitAsset: 36,
|
|
13
|
+
verifyClaimProof: 37, setPrivateClaims: 38,
|
|
12
14
|
submitProposal: 30, voteProposal: 31, executeProposal: 32,
|
|
13
15
|
applyAttestor: 41, blockAttestor: 42,
|
|
14
16
|
};
|
|
@@ -38,6 +40,22 @@ export function encodeLockHolderAmount(asset, holder, amount, lock) { return new
|
|
|
38
40
|
export function encodeIssuerForcedTransfer(asset, from, to, amount, reason) { return new Writer().varint(ACTION_VARIANT.issuerForcedTransfer).string(asset).string(from).string(to).varint(amount).string(reason).bytes(); }
|
|
39
41
|
export function encodeRecoverHolder(asset, lost, replacement) { return new Writer().varint(ACTION_VARIANT.recoverHolder).string(asset).string(lost).string(replacement).bytes(); }
|
|
40
42
|
export function encodeIssueAssetTo(asset, to, amount) { return new Writer().varint(ACTION_VARIANT.issueAssetTo).string(asset).string(to).varint(amount).bytes(); }
|
|
43
|
+
/** One-way: the issuer gives up minting and `max_supply` is pinned to the current supply. */
|
|
44
|
+
export function encodeLockIssuance(asset) { return new Writer().varint(ACTION_VARIANT.lockIssuance).string(asset).bytes(); }
|
|
45
|
+
/** Hands every issuer right over `asset` to `newIssuer` (key rotation, compromise remedy). */
|
|
46
|
+
export function encodeTransferIssuer(asset, newIssuer) { return new Writer().varint(ACTION_VARIANT.transferIssuer).string(asset).string(newIssuer).bytes(); }
|
|
47
|
+
/** `null` clears the link. */
|
|
48
|
+
export function encodeSetAssetMetadataUri(asset, metadataUri) { return new Writer().varint(ACTION_VARIANT.setAssetMetadataUri).string(asset).option(metadataUri, (w, uri) => w.string(uri)).bytes(); }
|
|
49
|
+
/** A holding period: the lock releases itself at `untilHeight`. */
|
|
50
|
+
export function encodeLockHolderAmountUntil(asset, holder, amount, untilHeight) { return new Writer().varint(ACTION_VARIANT.lockHolderAmountUntil).string(asset).string(holder).varint(amount).varint(untilHeight).bytes(); }
|
|
51
|
+
/** Records the record-date cap table; the corporate actions below name it by its block height. */
|
|
52
|
+
export function encodeSnapshotHolders(asset) { return new Writer().varint(ACTION_VARIANT.snapshotHolders).string(asset).bytes(); }
|
|
53
|
+
/** Dividend/coupon: pays `total` of `payoutAsset` pro rata to the snapshot at `snapshotHeight`. */
|
|
54
|
+
export function encodeDistributeToHolders(asset, snapshotHeight, payoutAsset, total) { return new Writer().varint(ACTION_VARIANT.distributeToHolders).string(asset).varint(snapshotHeight).string(payoutAsset).varint(total).bytes(); }
|
|
55
|
+
/** Forces every snapshot balance back to the issuer. Send the proceeds with `encodeDistributeToHolders` first. */
|
|
56
|
+
export function encodeRedeemHolders(asset, snapshotHeight) { return new Writer().varint(ACTION_VARIANT.redeemHolders).string(asset).varint(snapshotHeight).bytes(); }
|
|
57
|
+
/** Each snapshot holding `b` becomes `b * numerator / denominator` (split if >1, consolidation if <1). */
|
|
58
|
+
export function encodeSplitAsset(asset, snapshotHeight, numerator, denominator) { return new Writer().varint(ACTION_VARIANT.splitAsset).string(asset).varint(snapshotHeight).varint(numerator).varint(denominator).bytes(); }
|
|
41
59
|
/** Sets issuer-controlled investor, concentration, and attestation-age limits. `null` clears each limit. */
|
|
42
60
|
/** zk-KYC: a holder's private eligibility proof. `sub` is a fixed 32-byte array on the node, so it rides raw (no length prefix); `proof` is length-prefixed. */
|
|
43
61
|
export function encodeVerifyClaimProof(asset, sub, todayDays, proof) { if (sub.length !== 32)
|
|
@@ -96,6 +114,14 @@ export function encodePayload({ name, input }) {
|
|
|
96
114
|
case "issuerForcedTransfer": return encodeIssuerForcedTransfer(input.asset, input.from, input.to, BigInt(input.amount), input.reason);
|
|
97
115
|
case "recoverHolder": return encodeRecoverHolder(input.asset, input.lost, input.replacement);
|
|
98
116
|
case "issueAssetTo": return encodeIssueAssetTo(input.asset, input.to, BigInt(input.amount));
|
|
117
|
+
case "lockIssuance": return encodeLockIssuance(input.asset);
|
|
118
|
+
case "transferIssuer": return encodeTransferIssuer(input.asset, input.newIssuer);
|
|
119
|
+
case "setAssetMetadataUri": return encodeSetAssetMetadataUri(input.asset, input.metadataUri);
|
|
120
|
+
case "lockHolderAmountUntil": return encodeLockHolderAmountUntil(input.asset, input.holder, BigInt(input.amount), BigInt(input.untilHeight));
|
|
121
|
+
case "snapshotHolders": return encodeSnapshotHolders(input.asset);
|
|
122
|
+
case "distributeToHolders": return encodeDistributeToHolders(input.asset, BigInt(input.snapshotHeight), input.payoutAsset, BigInt(input.total));
|
|
123
|
+
case "redeemHolders": return encodeRedeemHolders(input.asset, BigInt(input.snapshotHeight));
|
|
124
|
+
case "splitAsset": return encodeSplitAsset(input.asset, BigInt(input.snapshotHeight), BigInt(input.numerator), BigInt(input.denominator));
|
|
99
125
|
case "setAssetLimits": return encodeSetAssetLimits(input.asset, input.maxHolders, nullableBig(input.maxBalancePerHolder), nullableBig(input.maxAttestationAge));
|
|
100
126
|
case "verifyClaimProof": return encodeVerifyClaimProof(input.asset, Uint8Array.from(input.sub), input.todayDays, Uint8Array.from(input.proof));
|
|
101
127
|
case "setPrivateClaims": return encodeSetPrivateClaims(input.asset, input.enabled);
|
|
@@ -154,6 +180,14 @@ export function decodePayload(payload) {
|
|
|
154
180
|
issuerForcedTransfer: () => ({ asset: str(), from: str(), to: str(), amount: amount(), reason: str() }),
|
|
155
181
|
recoverHolder: () => ({ asset: str(), lost: str(), replacement: str() }),
|
|
156
182
|
issueAssetTo: () => ({ asset: str(), to: str(), amount: amount() }),
|
|
183
|
+
lockIssuance: () => ({ asset: str() }),
|
|
184
|
+
transferIssuer: () => ({ asset: str(), newIssuer: str() }),
|
|
185
|
+
setAssetMetadataUri: () => ({ asset: str(), metadataUri: r.option(str) }),
|
|
186
|
+
lockHolderAmountUntil: () => ({ asset: str(), holder: str(), amount: amount(), untilHeight: amount() }),
|
|
187
|
+
snapshotHolders: () => ({ asset: str() }),
|
|
188
|
+
distributeToHolders: () => ({ asset: str(), snapshotHeight: amount(), payoutAsset: str(), total: amount() }),
|
|
189
|
+
redeemHolders: () => ({ asset: str(), snapshotHeight: amount() }),
|
|
190
|
+
splitAsset: () => ({ asset: str(), snapshotHeight: amount(), numerator: amount(), denominator: amount() }),
|
|
157
191
|
setAssetLimits: () => ({ asset: str(), maxHolders: r.option((rr) => Number(rr.varint())), maxBalancePerHolder: r.option(amount), maxAttestationAge: r.option(amount) }),
|
|
158
192
|
verifyClaimProof: () => ({ asset: str(), sub: Array.from({ length: 32 }, () => r.u8()), todayDays: Number(r.varint()), proof: bytes() }),
|
|
159
193
|
setPrivateClaims: () => ({ asset: str(), enabled: r.bool() }),
|
package/dist/cli.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arxiumlabs/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Arxium TypeScript SDK and arx CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -32,6 +32,8 @@
|
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|
|
34
34
|
"build": "tsc -p tsconfig.json",
|
|
35
|
+
"check:package": "node scripts/release-check.mjs",
|
|
36
|
+
"test:release": "node --test scripts/release-check.test.mjs",
|
|
35
37
|
"test": "npm run build && node dist/codec.test.js && node dist/policy.test.js && node dist/cli.test.js"
|
|
36
38
|
},
|
|
37
39
|
"devDependencies": {
|