@settlemint/dalp-sdk 3.1.26-main.39717604394 → 3.1.26-main.39728385283
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 +26 -0
- package/dist/auth.js +1 -1
- package/dist/chunk-4bv3dw58.js +4 -0
- package/dist/chunk-a94wx6kr.js +5 -0
- package/dist/{chunk-hmjes1ct.js → chunk-em0bmf8p.js} +1 -1
- package/dist/{chunk-zd6v7wgm.js → chunk-hjmbz6fm.js} +3 -2
- package/dist/{chunk-87ahzhr1.js → chunk-znm8mz8x.js} +1 -1
- package/dist/effect.d.ts +3 -3
- package/dist/effect.js +2 -2
- package/dist/errors/error-codes.d.ts +1 -1
- package/dist/generated/api-types.d.ts +2021 -2002
- package/dist/generated/api-types.ts +2023 -2002
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -4
- package/dist/proxy/client-core.d.ts +5 -3
- package/dist/proxy/client.d.ts +1 -1
- package/dist/react-query.js +1 -1
- package/dist/routes/console.d.ts +1 -1
- package/dist/routes/console.js +3 -3
- package/dist/routes/index.js +1 -1
- package/dist/scalars/dalp-scalars.d.ts +28 -0
- package/dist/scalars/ethereum-address.d.ts +3 -5
- package/dist/scalars/exchange-rates.d.ts +2 -2
- package/dist/scalars/index.d.ts +2 -1
- package/dist/scalars/index.js +107 -14
- package/package.json +1 -1
- package/dist/chunk-d6g8cadp.js +0 -5
- package/dist/chunk-k2an4kvc.js +0 -4
package/README.md
CHANGED
|
@@ -155,6 +155,32 @@ declaration says one lives rather than guessing from a field name.
|
|
|
155
155
|
`OrganizationId` is the only entity id branded end to end across the platform;
|
|
156
156
|
every other identifier crossing this boundary is a plain string.
|
|
157
157
|
|
|
158
|
+
Request and response types brand the wire scalars the API validates, so a raw
|
|
159
|
+
string does not compile where the API wants an address, hash or amount. Build the
|
|
160
|
+
brand with a constructor, which throws a `DalpSdkError` (code
|
|
161
|
+
`sdk.scalar.EVM_ADDRESS_INVALID` for an address, `sdk.scalar.VALUE_INVALID` for
|
|
162
|
+
the rest) when the value is not valid, or narrow with the matching guard:
|
|
163
|
+
|
|
164
|
+
```ts
|
|
165
|
+
import { evmAddress, integerString, isEvmAddress } from "@settlemint/dalp-sdk/scalars";
|
|
166
|
+
|
|
167
|
+
await dalp.api.token.mint({
|
|
168
|
+
assetId: evmAddress("0x52908400098527886e0f7030069857d2e4169ee7"),
|
|
169
|
+
recipients: evmAddress("0x5A0b54D5dc17e0AadC383d2db43B0a0D3E029c4c"),
|
|
170
|
+
amounts: integerString(1000n),
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
const value: unknown = await readFromSomewhere();
|
|
174
|
+
if (isEvmAddress(value)) {
|
|
175
|
+
await dalp.api.token.mint({ assetId: value, recipients: value, amounts: "100" });
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
The constructors are `evmAddress`, `ethereumHash`, `ethereumHex`,
|
|
180
|
+
`cantonPartyId`, `fiatCurrency`, `networkId`, `timestamp`, `integerString` and
|
|
181
|
+
`decimalString`; each has an `is...` guard, such as `isEthereumHash`. Integer
|
|
182
|
+
text is typed `${bigint}` and decimal text `${number}`.
|
|
183
|
+
|
|
158
184
|
## Auth
|
|
159
185
|
|
|
160
186
|
```ts
|