@polyester/sdk 0.35.0-devnet-20261111025029 → 0.35.0-devnet-20261111140253
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/CHANGELOG.md +43 -1
- package/dist/catalogs/index.d.ts +2 -2
- package/dist/catalogs/snapshot-validation.js +7 -3
- package/dist/catalogs/snapshot-validation.js.map +1 -1
- package/dist/gen/ai/v1/assistant_pb.d.ts +4164 -0
- package/dist/gen/ai/v1/assistant_pb.d.ts.map +1 -0
- package/dist/gen/ai/v1/assistant_pb.js +1174 -0
- package/dist/gen/ai/v1/assistant_pb.js.map +1 -0
- package/dist/gen/alerts/v1/price_alerts_pb.d.ts +776 -0
- package/dist/gen/alerts/v1/price_alerts_pb.d.ts.map +1 -0
- package/dist/gen/alerts/v1/price_alerts_pb.js +378 -0
- package/dist/gen/alerts/v1/price_alerts_pb.js.map +1 -0
- package/dist/gen/auth/v1/address_book_pb.d.ts +6 -0
- package/dist/gen/auth/v1/address_book_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/address_book_pb.js +6 -0
- package/dist/gen/auth/v1/address_book_pb.js.map +1 -1
- package/dist/gen/auth/v1/api_keys_pb.d.ts +247 -3
- package/dist/gen/auth/v1/api_keys_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/api_keys_pb.js +81 -2
- package/dist/gen/auth/v1/api_keys_pb.js.map +1 -1
- package/dist/gen/auth/v1/auth_pb.d.ts +55 -6
- package/dist/gen/auth/v1/auth_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/auth_pb.js +55 -6
- package/dist/gen/auth/v1/auth_pb.js.map +1 -1
- package/dist/gen/auth/v1/policies_pb.d.ts +186 -14
- package/dist/gen/auth/v1/policies_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/policies_pb.js +163 -6
- package/dist/gen/auth/v1/policies_pb.js.map +1 -1
- package/dist/gen/auth/v1/profile_pb.d.ts +4 -2
- package/dist/gen/auth/v1/profile_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/profile_pb.js.map +1 -1
- package/dist/gen/auth/v1/resolve_pb.d.ts +1 -0
- package/dist/gen/auth/v1/resolve_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/resolve_pb.js.map +1 -1
- package/dist/gen/auth/v1/social_verification_pb.d.ts +170 -11
- package/dist/gen/auth/v1/social_verification_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/social_verification_pb.js +41 -3
- package/dist/gen/auth/v1/social_verification_pb.js.map +1 -1
- package/dist/gen/auth/v1/subaccounts_pb.d.ts +25 -9
- package/dist/gen/auth/v1/subaccounts_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/subaccounts_pb.js.map +1 -1
- package/dist/gen/chain/deposit/v1/deposit_pb.d.ts +4 -2
- package/dist/gen/chain/deposit/v1/deposit_pb.d.ts.map +1 -1
- package/dist/gen/chain/deposit/v1/deposit_pb.js.map +1 -1
- package/dist/gen/chain/guard/v1/guard_signer_pb.d.ts +5 -0
- package/dist/gen/chain/guard/v1/guard_signer_pb.d.ts.map +1 -1
- package/dist/gen/chain/guard/v1/guard_signer_pb.js.map +1 -1
- package/dist/gen/chain/lifecycle/v1/lifecycle_read_pb.d.ts +10 -0
- package/dist/gen/chain/lifecycle/v1/lifecycle_read_pb.d.ts.map +1 -1
- package/dist/gen/chain/lifecycle/v1/lifecycle_read_pb.js +1 -1
- package/dist/gen/chain/lifecycle/v1/lifecycle_read_pb.js.map +1 -1
- package/dist/gen/chain/lifecycle/v1/types_pb.d.ts +32 -4
- package/dist/gen/chain/lifecycle/v1/types_pb.d.ts.map +1 -1
- package/dist/gen/chain/lifecycle/v1/types_pb.js +32 -4
- package/dist/gen/chain/lifecycle/v1/types_pb.js.map +1 -1
- package/dist/gen/chain/withdraw/v1/auto_withdraw_pb.d.ts +391 -42
- package/dist/gen/chain/withdraw/v1/auto_withdraw_pb.d.ts.map +1 -1
- package/dist/gen/chain/withdraw/v1/auto_withdraw_pb.js +103 -17
- package/dist/gen/chain/withdraw/v1/auto_withdraw_pb.js.map +1 -1
- package/dist/gen/chain/withdraw/v1/withdraw_pb.d.ts +172 -4
- package/dist/gen/chain/withdraw/v1/withdraw_pb.d.ts.map +1 -1
- package/dist/gen/chain/withdraw/v1/withdraw_pb.js +63 -2
- package/dist/gen/chain/withdraw/v1/withdraw_pb.js.map +1 -1
- package/dist/gen/chain/zipper/v1/zipper_pb.d.ts +57 -3
- package/dist/gen/chain/zipper/v1/zipper_pb.d.ts.map +1 -1
- package/dist/gen/chain/zipper/v1/zipper_pb.js +41 -3
- package/dist/gen/chain/zipper/v1/zipper_pb.js.map +1 -1
- package/dist/gen/checkpoints/v1/checkpoints_pb.d.ts +2 -1
- package/dist/gen/checkpoints/v1/checkpoints_pb.d.ts.map +1 -1
- package/dist/gen/checkpoints/v1/checkpoints_pb.js.map +1 -1
- package/dist/gen/claims/v1/claims_pb.d.ts +20 -3
- package/dist/gen/claims/v1/claims_pb.d.ts.map +1 -1
- package/dist/gen/claims/v1/claims_pb.js +12 -3
- package/dist/gen/claims/v1/claims_pb.js.map +1 -1
- package/dist/gen/index.d.ts +9 -5
- package/dist/gen/index.js +5 -1
- package/dist/gen/ledger/v1/catalog_pb.d.ts +52 -1
- package/dist/gen/ledger/v1/catalog_pb.d.ts.map +1 -1
- package/dist/gen/ledger/v1/catalog_pb.js +52 -1
- package/dist/gen/ledger/v1/catalog_pb.js.map +1 -1
- package/dist/gen/marketdata/v1/heatmap_pb.d.ts +6 -0
- package/dist/gen/marketdata/v1/heatmap_pb.d.ts.map +1 -1
- package/dist/gen/marketdata/v1/heatmap_pb.js.map +1 -1
- package/dist/gen/marketdata/v1/marketdata_pb.d.ts +8 -0
- package/dist/gen/marketdata/v1/marketdata_pb.d.ts.map +1 -1
- package/dist/gen/marketdata/v1/marketdata_pb.js +1 -1
- package/dist/gen/marketdata/v1/marketdata_pb.js.map +1 -1
- package/dist/gen/orders/v1/orders_pb.d.ts +29 -8
- package/dist/gen/orders/v1/orders_pb.d.ts.map +1 -1
- package/dist/gen/orders/v1/orders_pb.js +18 -5
- package/dist/gen/orders/v1/orders_pb.js.map +1 -1
- package/dist/gen/polyester/ratelimit/v1/types_pb.d.ts +20 -1
- package/dist/gen/polyester/ratelimit/v1/types_pb.d.ts.map +1 -1
- package/dist/gen/polyester/ratelimit/v1/types_pb.js +20 -1
- package/dist/gen/polyester/ratelimit/v1/types_pb.js.map +1 -1
- package/dist/gen/rewards/v1/rewards_pb.d.ts +74 -3
- package/dist/gen/rewards/v1/rewards_pb.d.ts.map +1 -1
- package/dist/gen/rewards/v1/rewards_pb.js +16 -4
- package/dist/gen/rewards/v1/rewards_pb.js.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.d.ts +1268 -67
- package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.d.ts.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.js +306 -5
- package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.js.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_pb.d.ts +298 -54
- package/dist/gen/swap/quickswap/v1/quickswap_pb.d.ts.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_pb.js +183 -37
- package/dist/gen/swap/quickswap/v1/quickswap_pb.js.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_referral_pb.d.ts +933 -0
- package/dist/gen/swap/quickswap/v1/quickswap_referral_pb.d.ts.map +1 -0
- package/dist/gen/swap/quickswap/v1/quickswap_referral_pb.js +292 -0
- package/dist/gen/swap/quickswap/v1/quickswap_referral_pb.js.map +1 -0
- package/dist/gen/system/v1/system_pb.d.ts +77 -0
- package/dist/gen/system/v1/system_pb.d.ts.map +1 -0
- package/dist/gen/system/v1/system_pb.js +34 -0
- package/dist/gen/system/v1/system_pb.js.map +1 -0
- package/dist/gen/tradews/v1/trade_ws_pb.d.ts +2 -2
- package/dist/gen/tradews/v1/trade_ws_pb.js.map +1 -1
- package/dist/gen/transfer/v1/internal_transfer_pb.d.ts +101 -2
- package/dist/gen/transfer/v1/internal_transfer_pb.d.ts.map +1 -1
- package/dist/gen/transfer/v1/internal_transfer_pb.js +14 -2
- package/dist/gen/transfer/v1/internal_transfer_pb.js.map +1 -1
- package/dist/gen/vip/v1/vip_pb.d.ts +1 -0
- package/dist/gen/vip/v1/vip_pb.d.ts.map +1 -1
- package/dist/gen/vip/v1/vip_pb.js.map +1 -1
- package/dist/index.d.ts +9 -9
- package/dist/index.js +2 -2
- package/dist/services/address-book/address-book.schemas.d.ts +2 -2
- package/dist/services/api-keys/api-keys.codecs.js +10 -1
- package/dist/services/api-keys/api-keys.codecs.js.map +1 -1
- package/dist/services/api-keys/api-keys.schemas.d.ts +4 -0
- package/dist/services/api-keys/api-keys.schemas.d.ts.map +1 -1
- package/dist/services/api-keys/api-keys.schemas.js +3 -1
- package/dist/services/api-keys/api-keys.schemas.js.map +1 -1
- package/dist/services/auto-withdraw/auto-withdraw.codecs.d.ts +9 -2
- package/dist/services/auto-withdraw/auto-withdraw.codecs.d.ts.map +1 -1
- package/dist/services/auto-withdraw/auto-withdraw.codecs.js +9 -1
- package/dist/services/auto-withdraw/auto-withdraw.codecs.js.map +1 -1
- package/dist/services/auto-withdraw/auto-withdraw.d.ts +15 -4
- package/dist/services/auto-withdraw/auto-withdraw.d.ts.map +1 -1
- package/dist/services/auto-withdraw/auto-withdraw.js +24 -8
- package/dist/services/auto-withdraw/auto-withdraw.js.map +1 -1
- package/dist/services/auto-withdraw/auto-withdraw.schemas.d.ts +375 -7
- package/dist/services/auto-withdraw/auto-withdraw.schemas.d.ts.map +1 -1
- package/dist/services/auto-withdraw/auto-withdraw.schemas.js +66 -11
- package/dist/services/auto-withdraw/auto-withdraw.schemas.js.map +1 -1
- package/dist/services/auto-withdraw/auto-withdraw.types.d.ts +3 -3
- package/dist/services/changelog/changelog.schemas.d.ts +17 -17
- package/dist/services/checkpoints/checkpoints.schemas.d.ts +2 -2
- package/dist/services/claims/claims.d.ts +5 -2
- package/dist/services/claims/claims.d.ts.map +1 -1
- package/dist/services/claims/claims.js +5 -2
- package/dist/services/claims/claims.js.map +1 -1
- package/dist/services/heatmap/heatmap.schemas.d.ts +4 -4
- package/dist/services/internal-transfers/internal-transfers.d.ts +13 -4
- package/dist/services/internal-transfers/internal-transfers.d.ts.map +1 -1
- package/dist/services/internal-transfers/internal-transfers.js +17 -3
- package/dist/services/internal-transfers/internal-transfers.js.map +1 -1
- package/dist/services/internal-transfers/internal-transfers.schemas.d.ts +59 -4
- package/dist/services/internal-transfers/internal-transfers.schemas.d.ts.map +1 -1
- package/dist/services/internal-transfers/internal-transfers.schemas.js +32 -2
- package/dist/services/internal-transfers/internal-transfers.schemas.js.map +1 -1
- package/dist/services/internal-transfers/internal-transfers.types.d.ts +2 -2
- package/dist/services/lifecycle/lifecycle.codecs.d.ts +2 -2
- package/dist/services/lifecycle/lifecycle.codecs.d.ts.map +1 -1
- package/dist/services/lifecycle/lifecycle.codecs.js +3 -1
- package/dist/services/lifecycle/lifecycle.codecs.js.map +1 -1
- package/dist/services/lifecycle/lifecycle.schemas.d.ts +114 -90
- package/dist/services/lifecycle/lifecycle.schemas.d.ts.map +1 -1
- package/dist/services/lifecycle/lifecycle.schemas.js +7 -1
- package/dist/services/lifecycle/lifecycle.schemas.js.map +1 -1
- package/dist/services/market-data/market-data.schemas.js +7 -2
- package/dist/services/market-data/market-data.schemas.js.map +1 -1
- package/dist/services/orderbook/orderbook.schemas.d.ts +1 -1
- package/dist/services/orders/order-errors.schemas.d.ts +2 -2
- package/dist/services/orders/orders-batch.schemas.d.ts +54 -54
- package/dist/services/orders/orders-input.schemas.d.ts +7 -7
- package/dist/services/orders/orders-output.schemas.d.ts +19 -19
- package/dist/services/orders/orders.d.ts +2 -0
- package/dist/services/orders/orders.d.ts.map +1 -1
- package/dist/services/orders/orders.js +2 -0
- package/dist/services/orders/orders.js.map +1 -1
- package/dist/services/policies/api-key-policies/api-key-policies.schemas.d.ts +15 -15
- package/dist/services/policies/api-key-policies/api-key-policies.schemas.js +1 -1
- package/dist/services/policies/shared.codecs.js +85 -3
- package/dist/services/policies/shared.codecs.js.map +1 -1
- package/dist/services/policies/shared.d.ts +1 -1
- package/dist/services/policies/shared.d.ts.map +1 -1
- package/dist/services/policies/shared.js +5 -14
- package/dist/services/policies/shared.js.map +1 -1
- package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.d.ts +3 -3
- package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.js +3 -3
- package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.js.map +1 -1
- package/dist/services/rewards/rewards.d.ts +13 -3
- package/dist/services/rewards/rewards.d.ts.map +1 -1
- package/dist/services/rewards/rewards.js +17 -3
- package/dist/services/rewards/rewards.js.map +1 -1
- package/dist/services/rewards/rewards.schemas.d.ts +101 -4
- package/dist/services/rewards/rewards.schemas.d.ts.map +1 -1
- package/dist/services/rewards/rewards.schemas.js +12 -2
- package/dist/services/rewards/rewards.schemas.js.map +1 -1
- package/dist/services/rewards/rewards.types.d.ts +2 -2
- package/dist/services/social-verification/social-verification.codecs.js +13 -5
- package/dist/services/social-verification/social-verification.codecs.js.map +1 -1
- package/dist/services/social-verification/social-verification.d.ts +18 -3
- package/dist/services/social-verification/social-verification.d.ts.map +1 -1
- package/dist/services/social-verification/social-verification.js +26 -3
- package/dist/services/social-verification/social-verification.js.map +1 -1
- package/dist/services/social-verification/social-verification.schemas.d.ts +33 -7
- package/dist/services/social-verification/social-verification.schemas.d.ts.map +1 -1
- package/dist/services/social-verification/social-verification.schemas.js +35 -10
- package/dist/services/social-verification/social-verification.schemas.js.map +1 -1
- package/dist/services/social-verification/social-verification.types.d.ts +2 -2
- package/dist/services/subaccounts/subaccounts.schemas.d.ts +17 -17
- package/dist/services/trades/trades.schemas.d.ts +2 -2
- package/dist/services/trading-withdraws/trading-withdraws.d.ts +7 -1
- package/dist/services/trading-withdraws/trading-withdraws.d.ts.map +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.js +11 -1
- package/dist/services/trading-withdraws/trading-withdraws.js.map +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.schemas.d.ts +42 -1
- package/dist/services/trading-withdraws/trading-withdraws.schemas.d.ts.map +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.schemas.js +19 -3
- package/dist/services/trading-withdraws/trading-withdraws.schemas.js.map +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.types.d.ts +2 -2
- package/dist/services/transfers/transfers.schemas.d.ts +4 -4
- package/dist/services/triggers/trigger-input.schemas.d.ts +2 -2
- package/dist/services/triggers/triggers-output.schemas.d.ts +30 -30
- package/dist/services/zipper/zipper.schemas.d.ts +2 -2
- package/dist/services/zipper/zipper.schemas.d.ts.map +1 -1
- package/dist/services/zipper/zipper.schemas.js +13 -2
- package/dist/services/zipper/zipper.schemas.js.map +1 -1
- package/dist/services/zipper/zipper.types.d.ts +2 -2
- package/dist/shared/catalog-config.d.ts +18 -1
- package/dist/shared/catalog-config.d.ts.map +1 -1
- package/dist/shared/catalog-config.js +7 -1
- package/dist/shared/catalog-config.js.map +1 -1
- package/dist/shared/connect-error-mapping.d.ts.map +1 -1
- package/dist/shared/connect-error-mapping.js +5 -1
- package/dist/shared/connect-error-mapping.js.map +1 -1
- package/dist/shared/error-detail.d.ts +8 -0
- package/dist/shared/error-detail.d.ts.map +1 -1
- package/dist/shared/error-detail.js.map +1 -1
- package/dist/shared/error-details/claims.js +7 -2
- package/dist/shared/error-details/claims.js.map +1 -1
- package/dist/shared/error-details/withdraw.js +11 -2
- package/dist/shared/error-details/withdraw.js.map +1 -1
- package/dist/shared/errors.d.ts +20 -3
- package/dist/shared/errors.d.ts.map +1 -1
- package/dist/shared/errors.js +17 -1
- package/dist/shared/errors.js.map +1 -1
- package/dist/shared/ledger-codes.d.ts +7 -1
- package/dist/shared/ledger-codes.d.ts.map +1 -1
- package/dist/shared/ledger-codes.js +27 -3
- package/dist/shared/ledger-codes.js.map +1 -1
- package/dist/shared/rate-limit.schemas.d.ts +2 -2
- package/dist/shared/rate-limit.schemas.d.ts.map +1 -1
- package/dist/shared/rate-limit.schemas.js +4 -1
- package/dist/shared/rate-limit.schemas.js.map +1 -1
- package/dist/shared/transports.d.ts +2 -1
- package/dist/shared/transports.d.ts.map +1 -1
- package/dist/shared/transports.js.map +1 -1
- package/package.json +1 -1
|
@@ -3,11 +3,11 @@ import { removeUndefined } from "../../utils/remove-undefined.js";
|
|
|
3
3
|
import { toConnectCallOptions } from "../../shared/request-options.js";
|
|
4
4
|
import { resolveAccountScopedInput } from "../subaccount-resolver.js";
|
|
5
5
|
import { InternalTransferService } from "../../gen/transfer/v1/internal_transfer_pb.js";
|
|
6
|
-
import { createCreateInternalTransferInputSchema, createCreateInternalTransferResultSchema } from "./internal-transfers.schemas.js";
|
|
6
|
+
import { GetInternalTransferInputSchema, GetInternalTransferResultSchema, createCreateInternalTransferInputSchema, createCreateInternalTransferResultSchema } from "./internal-transfers.schemas.js";
|
|
7
7
|
import { createClient } from "@connectrpc/connect";
|
|
8
8
|
//#region src/services/internal-transfers/internal-transfers.ts
|
|
9
9
|
/**
|
|
10
|
-
* Creates authenticated Trading-to-Trading internal transfer requests.
|
|
10
|
+
* Creates and reads authenticated Trading-to-Trading internal transfer requests.
|
|
11
11
|
*/
|
|
12
12
|
var InternalTransfersService = class {
|
|
13
13
|
#client;
|
|
@@ -23,7 +23,7 @@ var InternalTransfersService = class {
|
|
|
23
23
|
this.#resultSchema = createCreateInternalTransferResultSchema();
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
|
-
* Creates or returns an idempotent internal transfer from the resolved source account to a destination root account, subaccount, or smart-account address. The request carries asset id, a decimal quantity, and a stable idempotency key; the response includes request/transfer ids, resolved destination, and status. Rejections and failures, such as insufficient funds or a missing step-up, raise errors instead of returning a result.
|
|
26
|
+
* Creates or returns an idempotent internal transfer from the resolved source account to a destination root account, subaccount, or smart-account address. The request carries asset id, a decimal quantity, and a stable idempotency key; the response includes request/transfer ids, the lifecycle `flowId`, resolved destination, and status. Rejections and failures, such as insufficient funds or a missing step-up, raise errors instead of returning a result.
|
|
27
27
|
*/
|
|
28
28
|
async create(input, options) {
|
|
29
29
|
await this.#scales.ready();
|
|
@@ -32,6 +32,20 @@ var InternalTransfersService = class {
|
|
|
32
32
|
const res = await this.#client.createInternalTransfer(removeUndefined(validatedInput), toConnectCallOptions(options));
|
|
33
33
|
return parse(this.#resultSchema, res);
|
|
34
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Reads an accepted transfer of the resolved source account by exactly one of `requestId` or
|
|
37
|
+
* `transferId`, and returns both IDs, the lifecycle `flowId` and the acceptance time. Use it
|
|
38
|
+
* to reconcile a transfer without resubmitting it; pass `flowId` to `lifecycle.getFlow`,
|
|
39
|
+
* whose ledger settlement step carries the transfer ID. An unknown, pending or inaccessible
|
|
40
|
+
* transfer is a `ResourceNotFoundError`, including briefly after a delegate is granted access.
|
|
41
|
+
* Session JWT only; API keys are refused. Moves no money and needs no step-up.
|
|
42
|
+
*/
|
|
43
|
+
async get(input, options) {
|
|
44
|
+
const resolvedInput = resolveAccountScopedInput(input, this.#resolver);
|
|
45
|
+
const request = parse(GetInternalTransferInputSchema, resolvedInput);
|
|
46
|
+
const res = await this.#client.getInternalTransfer(removeUndefined(request), toConnectCallOptions(options));
|
|
47
|
+
return parse(GetInternalTransferResultSchema, res);
|
|
48
|
+
}
|
|
35
49
|
};
|
|
36
50
|
//#endregion
|
|
37
51
|
export { InternalTransfersService };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal-transfers.js","names":["#client","Proto.InternalTransferService","#resolver","#scales","#inputSchema","#resultSchema"],"sources":["../../../src/services/internal-transfers/internal-transfers.ts"],"sourcesContent":["import { createClient, type Client } from \"@connectrpc/connect\";\nimport * as Proto from \"../../gen/transfer/v1/internal_transfer_pb.js\";\nimport type { AuthApiTransports } from \"../../shared/transports.js\";\nimport { removeUndefined } from \"../../utils/remove-undefined.js\";\nimport {\n toConnectCallOptions,\n type PolyesterMutationOptions,\n} from \"../../shared/request-options.js\";\nimport { type SubaccountResolver, resolveAccountScopedInput } from \"../subaccount-resolver.js\";\nimport type { SdkScales } from \"../../shared/decimal-surface.js\";\nimport { parse } from \"../../shared/validation.js\";\nimport {\n createCreateInternalTransferInputSchema,\n createCreateInternalTransferResultSchema,\n type CreateInternalTransferInput,\n type CreateInternalTransferResult,\n} from \"./internal-transfers.schemas.js\";\n\n/**\n * Creates authenticated Trading-to-Trading internal transfer requests.\n */\nexport class InternalTransfersService {\n #client: Client<typeof Proto.InternalTransferService>;\n #resolver?: SubaccountResolver;\n #scales: SdkScales;\n #inputSchema: ReturnType<typeof createCreateInternalTransferInputSchema>;\n #resultSchema: ReturnType<typeof createCreateInternalTransferResultSchema>;\n\n constructor(\n transports: AuthApiTransports,\n resolver: SubaccountResolver | undefined,\n scales: SdkScales,\n ) {\n this.#client = createClient(Proto.InternalTransferService, transports.authApi);\n this.#resolver = resolver;\n this.#scales = scales;\n this.#inputSchema = createCreateInternalTransferInputSchema(scales);\n this.#resultSchema = createCreateInternalTransferResultSchema();\n }\n\n /**\n * Creates or returns an idempotent internal transfer from the resolved source account to a destination root account, subaccount, or smart-account address. The request carries asset id, a decimal quantity, and a stable idempotency key; the response includes request/transfer ids, resolved destination, and status. Rejections and failures, such as insufficient funds or a missing step-up, raise errors instead of returning a result.\n */\n async create(\n input: CreateInternalTransferInput,\n options?: PolyesterMutationOptions,\n ): Promise<CreateInternalTransferResult> {\n await this.#scales.ready();\n const resolvedInput = resolveAccountScopedInput(input, this.#resolver);\n const validatedInput = parse(this.#inputSchema, resolvedInput);\n const res = await this.#client.createInternalTransfer(\n removeUndefined(validatedInput),\n toConnectCallOptions(options),\n );\n return parse(this.#resultSchema, res);\n }\n}\n"],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"internal-transfers.js","names":["#client","Proto.InternalTransferService","#resolver","#scales","#inputSchema","#resultSchema"],"sources":["../../../src/services/internal-transfers/internal-transfers.ts"],"sourcesContent":["import { createClient, type Client } from \"@connectrpc/connect\";\nimport * as Proto from \"../../gen/transfer/v1/internal_transfer_pb.js\";\nimport type { AuthApiTransports } from \"../../shared/transports.js\";\nimport { removeUndefined } from \"../../utils/remove-undefined.js\";\nimport {\n toConnectCallOptions,\n type PolyesterMutationOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport { type SubaccountResolver, resolveAccountScopedInput } from \"../subaccount-resolver.js\";\nimport type { SdkScales } from \"../../shared/decimal-surface.js\";\nimport { parse } from \"../../shared/validation.js\";\nimport {\n createCreateInternalTransferInputSchema,\n createCreateInternalTransferResultSchema,\n type CreateInternalTransferInput,\n type CreateInternalTransferResult,\n GetInternalTransferInputSchema,\n GetInternalTransferResultSchema,\n type GetInternalTransferInput,\n type GetInternalTransferResult,\n} from \"./internal-transfers.schemas.js\";\n\n/**\n * Creates and reads authenticated Trading-to-Trading internal transfer requests.\n */\nexport class InternalTransfersService {\n #client: Client<typeof Proto.InternalTransferService>;\n #resolver?: SubaccountResolver;\n #scales: SdkScales;\n #inputSchema: ReturnType<typeof createCreateInternalTransferInputSchema>;\n #resultSchema: ReturnType<typeof createCreateInternalTransferResultSchema>;\n\n constructor(\n transports: AuthApiTransports,\n resolver: SubaccountResolver | undefined,\n scales: SdkScales,\n ) {\n this.#client = createClient(Proto.InternalTransferService, transports.authApi);\n this.#resolver = resolver;\n this.#scales = scales;\n this.#inputSchema = createCreateInternalTransferInputSchema(scales);\n this.#resultSchema = createCreateInternalTransferResultSchema();\n }\n\n /**\n * Creates or returns an idempotent internal transfer from the resolved source account to a destination root account, subaccount, or smart-account address. The request carries asset id, a decimal quantity, and a stable idempotency key; the response includes request/transfer ids, the lifecycle `flowId`, resolved destination, and status. Rejections and failures, such as insufficient funds or a missing step-up, raise errors instead of returning a result.\n */\n async create(\n input: CreateInternalTransferInput,\n options?: PolyesterMutationOptions,\n ): Promise<CreateInternalTransferResult> {\n await this.#scales.ready();\n const resolvedInput = resolveAccountScopedInput(input, this.#resolver);\n const validatedInput = parse(this.#inputSchema, resolvedInput);\n const res = await this.#client.createInternalTransfer(\n removeUndefined(validatedInput),\n toConnectCallOptions(options),\n );\n return parse(this.#resultSchema, res);\n }\n\n /**\n * Reads an accepted transfer of the resolved source account by exactly one of `requestId` or\n * `transferId`, and returns both IDs, the lifecycle `flowId` and the acceptance time. Use it\n * to reconcile a transfer without resubmitting it; pass `flowId` to `lifecycle.getFlow`,\n * whose ledger settlement step carries the transfer ID. An unknown, pending or inaccessible\n * transfer is a `ResourceNotFoundError`, including briefly after a delegate is granted access.\n * Session JWT only; API keys are refused. Moves no money and needs no step-up.\n */\n async get(\n input: GetInternalTransferInput,\n options?: PolyesterRequestOptions,\n ): Promise<GetInternalTransferResult> {\n const resolvedInput = resolveAccountScopedInput(input, this.#resolver);\n const request = parse(GetInternalTransferInputSchema, resolvedInput);\n const res = await this.#client.getInternalTransfer(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return parse(GetInternalTransferResultSchema, res);\n }\n}\n"],"mappings":";;;;;;;;;;;AA0BA,IAAa,2BAAb,MAAsC;CAClC;CACA;CACA;CACA;CACA;CAEA,YACI,YACA,UACA,QACF;EACE,KAAKA,UAAU,aAAaC,yBAA+B,WAAW,OAAO;EAC7E,KAAKC,YAAY;EACjB,KAAKC,UAAU;EACf,KAAKC,eAAe,wCAAwC,MAAM;EAClE,KAAKC,gBAAgB,yCAAyC;CAClE;;;;CAKA,MAAM,OACF,OACA,SACqC;EACrC,MAAM,KAAKF,QAAQ,MAAM;EACzB,MAAM,gBAAgB,0BAA0B,OAAO,KAAKD,SAAS;EACrE,MAAM,iBAAiB,MAAM,KAAKE,cAAc,aAAa;EAC7D,MAAM,MAAM,MAAM,KAAKJ,QAAQ,uBAC3B,gBAAgB,cAAc,GAC9B,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,KAAKK,eAAe,GAAG;CACxC;;;;;;;;;CAUA,MAAM,IACF,OACA,SACkC;EAClC,MAAM,gBAAgB,0BAA0B,OAAO,KAAKH,SAAS;EACrE,MAAM,UAAU,MAAM,gCAAgC,aAAa;EACnE,MAAM,MAAM,MAAM,KAAKF,QAAQ,oBAC3B,gBAAgB,OAAO,GACvB,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,iCAAiC,GAAG;CACrD;AACJ"}
|
|
@@ -138,7 +138,9 @@ declare function createCreateInternalTransferResultSchema(): v.SchemaWithPipe<re
|
|
|
138
138
|
subaccountId: string | undefined;
|
|
139
139
|
smartAccountAddress: string | undefined;
|
|
140
140
|
}>]>, undefined>;
|
|
141
|
-
readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "
|
|
141
|
+
readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "accepted" | "rejected" | "failed">]>;
|
|
142
|
+
/** Lifecycle flow ID for `lifecycle.getFlow`; empty when the server did not return one. */
|
|
143
|
+
readonly flowId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, "">;
|
|
142
144
|
}, undefined>, v.TransformAction<{
|
|
143
145
|
requestId: string;
|
|
144
146
|
transferId: string;
|
|
@@ -155,7 +157,8 @@ declare function createCreateInternalTransferResultSchema(): v.SchemaWithPipe<re
|
|
|
155
157
|
subaccountId: string | undefined;
|
|
156
158
|
smartAccountAddress: string | undefined;
|
|
157
159
|
} | undefined;
|
|
158
|
-
status: "unspecified" | "
|
|
160
|
+
status: "unspecified" | "accepted" | "rejected" | "failed";
|
|
161
|
+
flowId: string;
|
|
159
162
|
}, {
|
|
160
163
|
acceptedAtUnixMs: number;
|
|
161
164
|
quantity: string;
|
|
@@ -169,9 +172,61 @@ declare function createCreateInternalTransferResultSchema(): v.SchemaWithPipe<re
|
|
|
169
172
|
subaccountId: string | undefined;
|
|
170
173
|
smartAccountAddress: string | undefined;
|
|
171
174
|
} | undefined;
|
|
172
|
-
status: "unspecified" | "
|
|
175
|
+
status: "unspecified" | "accepted" | "rejected" | "failed";
|
|
176
|
+
flowId: string;
|
|
173
177
|
}>]>;
|
|
174
178
|
type CreateInternalTransferResult = v.InferOutput<ReturnType<typeof createCreateInternalTransferResultSchema>>;
|
|
179
|
+
declare const GetInternalTransferInputSchema: v.SchemaWithPipe<readonly [v.UnionSchema<[v.StrictObjectSchema<{
|
|
180
|
+
readonly requestId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
|
|
181
|
+
readonly account: v.OptionalSchema<v.UnionSchema<[v.PicklistSchema<["active", "main"], undefined>, v.StrictObjectSchema<{
|
|
182
|
+
readonly subaccountId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
|
|
183
|
+
}, undefined>], undefined>, undefined>;
|
|
184
|
+
}, undefined>, v.StrictObjectSchema<{
|
|
185
|
+
readonly transferId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
|
|
186
|
+
readonly account: v.OptionalSchema<v.UnionSchema<[v.PicklistSchema<["active", "main"], undefined>, v.StrictObjectSchema<{
|
|
187
|
+
readonly subaccountId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
|
|
188
|
+
}, undefined>], undefined>, undefined>;
|
|
189
|
+
}, undefined>], "Pass exactly one of requestId or transferId.">, v.TransformAction<{
|
|
190
|
+
requestId: string;
|
|
191
|
+
account?: "active" | "main" | {
|
|
192
|
+
subaccountId: string;
|
|
193
|
+
} | undefined;
|
|
194
|
+
} | {
|
|
195
|
+
transferId: string;
|
|
196
|
+
account?: "active" | "main" | {
|
|
197
|
+
subaccountId: string;
|
|
198
|
+
} | undefined;
|
|
199
|
+
}, {
|
|
200
|
+
subaccountId: bigint | undefined;
|
|
201
|
+
identifier: {
|
|
202
|
+
case: "requestId";
|
|
203
|
+
value: string;
|
|
204
|
+
} | {
|
|
205
|
+
case: "transferId";
|
|
206
|
+
value: string;
|
|
207
|
+
};
|
|
208
|
+
}>]>;
|
|
209
|
+
/** Selects an accepted transfer by exactly one of its `requestId` or `transferId`. */
|
|
210
|
+
type GetInternalTransferInput = v.InferInput<typeof GetInternalTransferInputSchema>;
|
|
211
|
+
declare const GetInternalTransferResultSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
212
|
+
readonly requestId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
|
|
213
|
+
readonly transferId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
|
|
214
|
+
readonly flowId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
|
|
215
|
+
readonly acceptedAtTsNs: v.BigintSchema<undefined>;
|
|
216
|
+
}, undefined>, v.TransformAction<{
|
|
217
|
+
requestId: string;
|
|
218
|
+
transferId: string;
|
|
219
|
+
flowId: string;
|
|
220
|
+
acceptedAtTsNs: bigint;
|
|
221
|
+
}, {
|
|
222
|
+
acceptedAtUnixMs: number;
|
|
223
|
+
/** Exact acceptance time in nanoseconds since epoch, as a decimal string. */
|
|
224
|
+
acceptedAtNs: string;
|
|
225
|
+
requestId: string;
|
|
226
|
+
transferId: string;
|
|
227
|
+
flowId: string;
|
|
228
|
+
}>]>;
|
|
229
|
+
type GetInternalTransferResult = v.InferOutput<typeof GetInternalTransferResultSchema>;
|
|
175
230
|
//#endregion
|
|
176
|
-
export { CreateInternalTransferInput, CreateInternalTransferResult, InternalTransferDestination, InternalTransferDestinationInputSchema, ResolvedInternalTransferDestination, ResolvedInternalTransferDestinationSchema, createCreateInternalTransferInputSchema, createCreateInternalTransferResultSchema };
|
|
231
|
+
export { CreateInternalTransferInput, CreateInternalTransferResult, GetInternalTransferInput, GetInternalTransferInputSchema, GetInternalTransferResult, GetInternalTransferResultSchema, InternalTransferDestination, InternalTransferDestinationInputSchema, ResolvedInternalTransferDestination, ResolvedInternalTransferDestinationSchema, createCreateInternalTransferInputSchema, createCreateInternalTransferResultSchema };
|
|
177
232
|
//# sourceMappingURL=internal-transfers.schemas.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal-transfers.schemas.d.ts","names":[],"sources":["../../../src/services/internal-transfers/internal-transfers.schemas.ts"],"mappings":";;;;cAyBa,wCAAsC,EAAA,yBAAA,EAAA,uBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAoCvC,8BAA8B,EAAE,kBACjC;iBAGK,wCAAwC,QAAQ,YAAS,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAAA;;;;;;;;;;;;;;;KA0B7D,8BAA8B,EAAE,WACxC,kBAAkB;cAYT,2CAAyC,EAAA,yBAAA,EAAA;;;;;;;;;;;;;KAa1C,sCAAsC,EAAE,mBACzC;iBAGK,4CAAwC,EAAA,yBAAA,EAAA
|
|
1
|
+
{"version":3,"file":"internal-transfers.schemas.d.ts","names":[],"sources":["../../../src/services/internal-transfers/internal-transfers.schemas.ts"],"mappings":";;;;cAyBa,wCAAsC,EAAA,yBAAA,EAAA,uBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAoCvC,8BAA8B,EAAE,kBACjC;iBAGK,wCAAwC,QAAQ,YAAS,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAAA;;;;;;;;;;;;;;;KA0B7D,8BAA8B,EAAE,WACxC,kBAAkB;cAYT,2CAAyC,EAAA,yBAAA,EAAA;;;;;;;;;;;;;KAa1C,sCAAsC,EAAE,mBACzC;iBAGK,4CAAwC,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAuB5C,+BAA+B,EAAE,YACzC,kBAAkB;cAKT,gCAA8B,EAAA,yBAAA,EAAA,aAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAqB/B,2BAA2B,EAAE,kBAAkB;cAE9C,iCAA+B,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;KAehC,4BAA4B,EAAE,mBAAmB"}
|
|
@@ -76,14 +76,44 @@ function createCreateInternalTransferResultSchema() {
|
|
|
76
76
|
uAssetId: NonEmptyResponseStringSchema,
|
|
77
77
|
amountE18: U128Schema,
|
|
78
78
|
destination: v.optional(ResolvedInternalTransferDestinationSchema),
|
|
79
|
-
status: enumLabelSchema(InternalTransferStatusCodec.protoToOutput)
|
|
79
|
+
status: enumLabelSchema(InternalTransferStatusCodec.protoToOutput),
|
|
80
|
+
/** Lifecycle flow ID for `lifecycle.getFlow`; empty when the server did not return one. */
|
|
81
|
+
flowId: v.optional(v.pipe(v.string(), v.trim()), "")
|
|
80
82
|
}), v.transform(({ acceptedAtTsNs, amountE18, ...result }) => ({
|
|
81
83
|
...result,
|
|
82
84
|
acceptedAtUnixMs: tsNsToMs(acceptedAtTsNs),
|
|
83
85
|
quantity: scaledToDecimalOutput(fromU128(amountE18), 18)
|
|
84
86
|
})));
|
|
85
87
|
}
|
|
88
|
+
const TransferLookupIdSchema = v.pipe(v.string(), v.trim(), v.minLength(1));
|
|
89
|
+
const GetInternalTransferInputSchema = v.pipe(v.union([v.strictObject({
|
|
90
|
+
...AccountScopeInputEntries,
|
|
91
|
+
requestId: TransferLookupIdSchema
|
|
92
|
+
}), v.strictObject({
|
|
93
|
+
...AccountScopeInputEntries,
|
|
94
|
+
transferId: TransferLookupIdSchema
|
|
95
|
+
})], "Pass exactly one of requestId or transferId."), v.transform(({ account, ...selector }) => ({
|
|
96
|
+
subaccountId: accountScopeToSubaccountId(account),
|
|
97
|
+
identifier: "requestId" in selector ? {
|
|
98
|
+
case: "requestId",
|
|
99
|
+
value: selector.requestId
|
|
100
|
+
} : {
|
|
101
|
+
case: "transferId",
|
|
102
|
+
value: selector.transferId
|
|
103
|
+
}
|
|
104
|
+
})));
|
|
105
|
+
const GetInternalTransferResultSchema = v.pipe(v.object({
|
|
106
|
+
requestId: NonEmptyResponseStringSchema,
|
|
107
|
+
transferId: NonEmptyResponseStringSchema,
|
|
108
|
+
flowId: NonEmptyResponseStringSchema,
|
|
109
|
+
acceptedAtTsNs: v.bigint()
|
|
110
|
+
}), v.transform(({ acceptedAtTsNs, ...result }) => ({
|
|
111
|
+
...result,
|
|
112
|
+
acceptedAtUnixMs: tsNsToMs(acceptedAtTsNs),
|
|
113
|
+
/** Exact acceptance time in nanoseconds since epoch, as a decimal string. */
|
|
114
|
+
acceptedAtNs: acceptedAtTsNs.toString()
|
|
115
|
+
})));
|
|
86
116
|
//#endregion
|
|
87
|
-
export { InternalTransferDestinationInputSchema, ResolvedInternalTransferDestinationSchema, createCreateInternalTransferInputSchema, createCreateInternalTransferResultSchema };
|
|
117
|
+
export { GetInternalTransferInputSchema, GetInternalTransferResultSchema, InternalTransferDestinationInputSchema, ResolvedInternalTransferDestinationSchema, createCreateInternalTransferInputSchema, createCreateInternalTransferResultSchema };
|
|
88
118
|
|
|
89
119
|
//# sourceMappingURL=internal-transfers.schemas.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal-transfers.schemas.js","names":[],"sources":["../../../src/services/internal-transfers/internal-transfers.schemas.ts"],"sourcesContent":["import type { MessageInitShape } from \"@bufbuild/protobuf\";\nimport { PositiveUint32InputSchema } from \"../shared.js\";\nimport * as v from \"valibot\";\nimport type * as Proto from \"../../gen/transfer/v1/internal_transfer_pb.js\";\nimport { idInputSchema, U128Schema } from \"../../shared/schemas.js\";\nimport { tsNsToMs } from \"../../utils/time.js\";\nimport {\n E18_SCALE,\n quantityInputToE18,\n scaledToDecimalOutput,\n type SdkScales,\n} from \"../../shared/decimal-surface.js\";\nimport {\n InternalTransferDestinationCodec,\n InternalTransferStatusCodec,\n} from \"./internal-transfers.codecs.js\";\nimport { enumLabelSchema } from \"../../shared/proto-enum-codec.js\";\nimport {\n AccountScopeInputEntries,\n accountScopeToSubaccountId,\n} from \"../../shared/account-scope.js\";\nimport { fromU128, toU128 } from \"../../utils/u128.js\";\n\nconst IdSchema = idInputSchema;\n\nexport const InternalTransferDestinationInputSchema = v.pipe(\n v.variant(\"type\", [\n v.strictObject({\n type: v.literal(\"account\"),\n accountId: IdSchema(\"accountId\"),\n }),\n v.strictObject({\n type: v.literal(\"subaccount\"),\n subaccountId: IdSchema(\"subaccountId\"),\n }),\n v.strictObject({\n type: v.literal(\"smartAccountAddress\"),\n address: v.pipe(v.string(), v.trim(), v.minLength(1)),\n }),\n ]),\n v.transform((destination) => {\n switch (destination.type) {\n case \"account\":\n return {\n case: InternalTransferDestinationCodec.inputToProtoCase.account,\n value: destination.accountId,\n } as const;\n case \"subaccount\":\n return {\n case: InternalTransferDestinationCodec.inputToProtoCase.subaccount,\n value: destination.subaccountId,\n } as const;\n case \"smartAccountAddress\":\n return {\n case: InternalTransferDestinationCodec.inputToProtoCase.smartAccountAddress,\n value: destination.address,\n } as const;\n }\n }),\n);\n\nexport type InternalTransferDestination = v.InferInput<\n typeof InternalTransferDestinationInputSchema\n>;\n\nexport function createCreateInternalTransferInputSchema(scales: SdkScales) {\n return v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n destination: InternalTransferDestinationInputSchema,\n assetId: PositiveUint32InputSchema,\n quantity: v.string(),\n idempotencyKey: v.pipe(v.string(), v.trim(), v.minLength(1)),\n }),\n v.transform(\n ({ account, quantity, ...input }) =>\n ({\n ...input,\n amountE18: toU128(\n quantityInputToE18({\n scales,\n assetId: input.assetId,\n quantity,\n }),\n ),\n subaccountId: accountScopeToSubaccountId(account),\n }) satisfies MessageInitShape<typeof Proto.CreateInternalTransferRequestSchema>,\n ),\n );\n}\n\nexport type CreateInternalTransferInput = v.InferInput<\n ReturnType<typeof createCreateInternalTransferInputSchema>\n>;\nexport type CreateInternalTransferRequest = v.InferOutput<\n ReturnType<typeof createCreateInternalTransferInputSchema>\n>;\n\nconst NonEmptyResponseStringSchema = v.pipe(v.string(), v.trim(), v.minLength(1));\nconst OptionalResponseStringSchema = v.pipe(\n v.optional(v.pipe(v.string(), v.trim())),\n v.transform((value) => (value ? value : undefined)),\n);\n\nexport const ResolvedInternalTransferDestinationSchema = v.pipe(\n v.object({\n rootAccountPublicId: OptionalResponseStringSchema,\n subaccountPublicId: OptionalResponseStringSchema,\n smartAccountAddress: OptionalResponseStringSchema,\n }),\n v.transform(({ rootAccountPublicId, subaccountPublicId, smartAccountAddress }) => ({\n rootAccountId: rootAccountPublicId,\n subaccountId: subaccountPublicId,\n smartAccountAddress,\n })),\n);\n\nexport type ResolvedInternalTransferDestination = v.InferOutput<\n typeof ResolvedInternalTransferDestinationSchema\n>;\n\nexport function createCreateInternalTransferResultSchema() {\n return v.pipe(\n v.object({\n requestId: NonEmptyResponseStringSchema,\n transferId: NonEmptyResponseStringSchema,\n acceptedAtTsNs: v.bigint(),\n assetId: v.number(),\n assetCode: NonEmptyResponseStringSchema,\n uAssetId: NonEmptyResponseStringSchema,\n amountE18: U128Schema,\n destination: v.optional(ResolvedInternalTransferDestinationSchema),\n status: enumLabelSchema(InternalTransferStatusCodec.protoToOutput),\n }),\n v.transform(({ acceptedAtTsNs, amountE18, ...result }) => ({\n ...result,\n acceptedAtUnixMs: tsNsToMs(acceptedAtTsNs),\n quantity: scaledToDecimalOutput(fromU128(amountE18), E18_SCALE),\n })),\n );\n}\n\nexport type CreateInternalTransferResult = v.InferOutput<\n ReturnType<typeof createCreateInternalTransferResultSchema>\n>;\n"],"mappings":";;;;;;;;;;AAuBA,MAAM,WAAW;AAEjB,MAAa,yCAAyC,EAAE,KACpD,EAAE,QAAQ,QAAQ;CACd,EAAE,aAAa;EACX,MAAM,EAAE,QAAQ,SAAS;E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AE,KACvD,EAAE,OAAO;CACL,qBAAqB;CACrB,oBAAoB;CACpB,qBAAqB;AACzB,CAAC,GACD,EAAE,WAAW,EAAE,qBAAqB,oBAAoB,2BAA2B;CAC/E,eAAe;CACf,cAAc;CACd;AACJ,EAAE,CACN;AAMA,SAAgB,2CAA2C;CACvD,OAAO,EAAE,KACL,EAAE,OAAO;EACL,WAAW;EACX,YAAY;EACZ,gBAAgB,EAAE,OAAO;EACzB,SAAS,EAAE,OAAO;EAClB,WAAW;EACX,UAAU;EACV,WAAW;EACX,aAAa,EAAE,SAAS,yCAAyC;EACjE,QAAQ,gBAAgB,4BAA4B,aAAa;
|
|
1
|
+
{"version":3,"file":"internal-transfers.schemas.js","names":[],"sources":["../../../src/services/internal-transfers/internal-transfers.schemas.ts"],"sourcesContent":["import type { MessageInitShape } from \"@bufbuild/protobuf\";\nimport { PositiveUint32InputSchema } from \"../shared.js\";\nimport * as v from \"valibot\";\nimport type * as Proto from \"../../gen/transfer/v1/internal_transfer_pb.js\";\nimport { idInputSchema, U128Schema } from \"../../shared/schemas.js\";\nimport { tsNsToMs } from \"../../utils/time.js\";\nimport {\n E18_SCALE,\n quantityInputToE18,\n scaledToDecimalOutput,\n type SdkScales,\n} from \"../../shared/decimal-surface.js\";\nimport {\n InternalTransferDestinationCodec,\n InternalTransferStatusCodec,\n} from \"./internal-transfers.codecs.js\";\nimport { enumLabelSchema } from \"../../shared/proto-enum-codec.js\";\nimport {\n AccountScopeInputEntries,\n accountScopeToSubaccountId,\n} from \"../../shared/account-scope.js\";\nimport { fromU128, toU128 } from \"../../utils/u128.js\";\n\nconst IdSchema = idInputSchema;\n\nexport const InternalTransferDestinationInputSchema = v.pipe(\n v.variant(\"type\", [\n v.strictObject({\n type: v.literal(\"account\"),\n accountId: IdSchema(\"accountId\"),\n }),\n v.strictObject({\n type: v.literal(\"subaccount\"),\n subaccountId: IdSchema(\"subaccountId\"),\n }),\n v.strictObject({\n type: v.literal(\"smartAccountAddress\"),\n address: v.pipe(v.string(), v.trim(), v.minLength(1)),\n }),\n ]),\n v.transform((destination) => {\n switch (destination.type) {\n case \"account\":\n return {\n case: InternalTransferDestinationCodec.inputToProtoCase.account,\n value: destination.accountId,\n } as const;\n case \"subaccount\":\n return {\n case: InternalTransferDestinationCodec.inputToProtoCase.subaccount,\n value: destination.subaccountId,\n } as const;\n case \"smartAccountAddress\":\n return {\n case: InternalTransferDestinationCodec.inputToProtoCase.smartAccountAddress,\n value: destination.address,\n } as const;\n }\n }),\n);\n\nexport type InternalTransferDestination = v.InferInput<\n typeof InternalTransferDestinationInputSchema\n>;\n\nexport function createCreateInternalTransferInputSchema(scales: SdkScales) {\n return v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n destination: InternalTransferDestinationInputSchema,\n assetId: PositiveUint32InputSchema,\n quantity: v.string(),\n idempotencyKey: v.pipe(v.string(), v.trim(), v.minLength(1)),\n }),\n v.transform(\n ({ account, quantity, ...input }) =>\n ({\n ...input,\n amountE18: toU128(\n quantityInputToE18({\n scales,\n assetId: input.assetId,\n quantity,\n }),\n ),\n subaccountId: accountScopeToSubaccountId(account),\n }) satisfies MessageInitShape<typeof Proto.CreateInternalTransferRequestSchema>,\n ),\n );\n}\n\nexport type CreateInternalTransferInput = v.InferInput<\n ReturnType<typeof createCreateInternalTransferInputSchema>\n>;\nexport type CreateInternalTransferRequest = v.InferOutput<\n ReturnType<typeof createCreateInternalTransferInputSchema>\n>;\n\nconst NonEmptyResponseStringSchema = v.pipe(v.string(), v.trim(), v.minLength(1));\nconst OptionalResponseStringSchema = v.pipe(\n v.optional(v.pipe(v.string(), v.trim())),\n v.transform((value) => (value ? value : undefined)),\n);\n\nexport const ResolvedInternalTransferDestinationSchema = v.pipe(\n v.object({\n rootAccountPublicId: OptionalResponseStringSchema,\n subaccountPublicId: OptionalResponseStringSchema,\n smartAccountAddress: OptionalResponseStringSchema,\n }),\n v.transform(({ rootAccountPublicId, subaccountPublicId, smartAccountAddress }) => ({\n rootAccountId: rootAccountPublicId,\n subaccountId: subaccountPublicId,\n smartAccountAddress,\n })),\n);\n\nexport type ResolvedInternalTransferDestination = v.InferOutput<\n typeof ResolvedInternalTransferDestinationSchema\n>;\n\nexport function createCreateInternalTransferResultSchema() {\n return v.pipe(\n v.object({\n requestId: NonEmptyResponseStringSchema,\n transferId: NonEmptyResponseStringSchema,\n acceptedAtTsNs: v.bigint(),\n assetId: v.number(),\n assetCode: NonEmptyResponseStringSchema,\n uAssetId: NonEmptyResponseStringSchema,\n amountE18: U128Schema,\n destination: v.optional(ResolvedInternalTransferDestinationSchema),\n status: enumLabelSchema(InternalTransferStatusCodec.protoToOutput),\n /** Lifecycle flow ID for `lifecycle.getFlow`; empty when the server did not return one. */\n flowId: v.optional(v.pipe(v.string(), v.trim()), \"\"),\n }),\n v.transform(({ acceptedAtTsNs, amountE18, ...result }) => ({\n ...result,\n acceptedAtUnixMs: tsNsToMs(acceptedAtTsNs),\n quantity: scaledToDecimalOutput(fromU128(amountE18), E18_SCALE),\n })),\n );\n}\n\nexport type CreateInternalTransferResult = v.InferOutput<\n ReturnType<typeof createCreateInternalTransferResultSchema>\n>;\n\nconst TransferLookupIdSchema = v.pipe(v.string(), v.trim(), v.minLength(1));\n\nexport const GetInternalTransferInputSchema = v.pipe(\n v.union(\n [\n v.strictObject({ ...AccountScopeInputEntries, requestId: TransferLookupIdSchema }),\n v.strictObject({ ...AccountScopeInputEntries, transferId: TransferLookupIdSchema }),\n ],\n \"Pass exactly one of requestId or transferId.\",\n ),\n v.transform(\n ({ account, ...selector }) =>\n ({\n subaccountId: accountScopeToSubaccountId(account),\n identifier:\n \"requestId\" in selector\n ? { case: \"requestId\", value: selector.requestId }\n : { case: \"transferId\", value: selector.transferId },\n }) satisfies MessageInitShape<typeof Proto.GetInternalTransferRequestSchema>,\n ),\n);\n\n/** Selects an accepted transfer by exactly one of its `requestId` or `transferId`. */\nexport type GetInternalTransferInput = v.InferInput<typeof GetInternalTransferInputSchema>;\n\nexport const GetInternalTransferResultSchema = v.pipe(\n v.object({\n requestId: NonEmptyResponseStringSchema,\n transferId: NonEmptyResponseStringSchema,\n flowId: NonEmptyResponseStringSchema,\n acceptedAtTsNs: v.bigint(),\n }),\n v.transform(({ acceptedAtTsNs, ...result }) => ({\n ...result,\n acceptedAtUnixMs: tsNsToMs(acceptedAtTsNs),\n /** Exact acceptance time in nanoseconds since epoch, as a decimal string. */\n acceptedAtNs: acceptedAtTsNs.toString(),\n })),\n);\n\nexport type GetInternalTransferResult = v.InferOutput<typeof GetInternalTransferResultSchema>;\n"],"mappings":";;;;;;;;;;AAuBA,MAAM,WAAW;AAEjB,MAAa,yCAAyC,EAAE,KACpD,EAAE,QAAQ,QAAQ;CACd,EAAE,aAAa;EACX,MAAM,EAAE,QAAQ,SAAS;EACzB,WAAW,SAAS,WAAW;CACnC,CAAC;CACD,EAAE,aAAa;EACX,MAAM,EAAE,QAAQ,YAAY;EAC5B,cAAc,SAAS,cAAc;CACzC,CAAC;CACD,EAAE,aAAa;EACX,MAAM,EAAE,QAAQ,qBAAqB;EACrC,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,KAAK,GAAG,EAAE,UAAU,CAAC,CAAC;CACxD,CAAC;AACL,CAAC,GACD,EAAE,WAAW,gBAAgB;CACzB,QAAQ,YAAY,MAApB;EACI,KAAK,WACD,OAAO;GACH,MAAM,iCAAiC,iBAAiB;GACxD,OAAO,YAAY;EACvB;EACJ,KAAK,cACD,OAAO;GACH,MAAM,iCAAiC,iBAAiB;GACxD,OAAO,YAAY;EACvB;EACJ,KAAK,uBACD,OAAO;GACH,MAAM,iCAAiC,iBAAiB;GACxD,OAAO,YAAY;EACvB;CACR;AACJ,CAAC,CACL;AAMA,SAAgB,wCAAwC,QAAmB;CACvE,OAAO,EAAE,KACL,EAAE,aAAa;EACX,GAAG;EACH,aAAa;EACb,SAAS;EACT,UAAU,EAAE,OAAO;EACnB,gBAAgB,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,KAAK,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AE1E,MAAa,iCAAiC,EAAE,KAC5C,EAAE,MACE,CACI,EAAE,aAAa;CAAE,GAAG;CAA0B,WAAW;AAAuB,CAAC,GACjF,EAAE,aAAa;CAAE,GAAG;CAA0B,YAAY;AAAuB,CAAC,CACtF,GACA,8CACJ,GACA,EAAE,WACG,EAAE,SAAS,GAAG,gBACV;CACG,cAAc,2BAA2B,OAAO;CAChD,YACI,eAAe,WACT;EAAE,MAAM;EAAa,OAAO,SAAS;CAAU,IAC/C;EAAE,MAAM;EAAc,OAAO,SAAS;CAAW;AAC/D,EACR,CACJ;AAKA,MAAa,kCAAkC,EAAE,KAC7C,EAAE,OAAO;CACL,WAAW;CACX,YAAY;CACZ,QAAQ;CACR,gBAAgB,EAAE,OAAO;AAC7B,CAAC,GACD,EAAE,WAAW,EAAE,gBAAgB,GAAG,cAAc;CAC5C,GAAG;CACH,kBAAkB,SAAS,cAAc;;CAEzC,cAAc,eAAe,SAAS;AAC1C,EAAE,CACN"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { CreateInternalTransferInput, CreateInternalTransferResult, InternalTransferDestination, ResolvedInternalTransferDestination } from "./internal-transfers.schemas.js";
|
|
1
|
+
import { CreateInternalTransferInput, CreateInternalTransferResult, GetInternalTransferInput, GetInternalTransferResult, InternalTransferDestination, ResolvedInternalTransferDestination } from "./internal-transfers.schemas.js";
|
|
2
2
|
import { InternalTransferStatus } from "./internal-transfers.codecs.js";
|
|
3
|
-
export type { CreateInternalTransferInput, CreateInternalTransferResult, InternalTransferDestination, InternalTransferStatus, ResolvedInternalTransferDestination };
|
|
3
|
+
export type { CreateInternalTransferInput, CreateInternalTransferResult, GetInternalTransferInput, GetInternalTransferResult, InternalTransferDestination, InternalTransferStatus, ResolvedInternalTransferDestination };
|
|
@@ -9,14 +9,14 @@ declare const LIFECYCLE_SORT_VALUES: readonly ["newest", "oldest"];
|
|
|
9
9
|
type LifecycleSortValue = (typeof LIFECYCLE_SORT_VALUES)[number];
|
|
10
10
|
declare const LIFECYCLE_LIST_ORDER_BY_VALUES: readonly ["last_activity", "started_at"];
|
|
11
11
|
type LifecycleListOrderByValue = (typeof LIFECYCLE_LIST_ORDER_BY_VALUES)[number];
|
|
12
|
-
declare const LIFECYCLE_REASON_VALUES: readonly ["unspecified", "zipper_validation_rejected", "zipper_execution_rejected", "zipper_withdraw_execution_failed", "zipper_deposit_refund_failed", "ledger_mirror_rejected", "ledger_mirror_transfer_exceeds_credits", "ledger_mirror_transfer_exists", "ledger_mirror_pending_transfer_not_found", "ledger_mirror_transfer_id_already_failed", "trading_withdraw_policy_denied", "trading_withdraw_contract_reverted", "trading_withdraw_execution_failed", "deposit_source_not_confirmed"];
|
|
12
|
+
declare const LIFECYCLE_REASON_VALUES: readonly ["unspecified", "zipper_validation_rejected", "zipper_execution_rejected", "zipper_withdraw_execution_failed", "zipper_deposit_refund_failed", "zipper_compliance_transferred", "ledger_mirror_rejected", "ledger_mirror_transfer_exceeds_credits", "ledger_mirror_transfer_exists", "ledger_mirror_pending_transfer_not_found", "ledger_mirror_transfer_id_already_failed", "trading_withdraw_policy_denied", "trading_withdraw_contract_reverted", "trading_withdraw_execution_failed", "deposit_source_not_confirmed"];
|
|
13
13
|
/**
|
|
14
14
|
* Catalog labels plus a code-preserving fallback for wire values the generated
|
|
15
15
|
* enum does not know. Proto3 enums are open — the backend can emit codes ahead
|
|
16
16
|
* of a contract update — and rejecting them froze flows out of the UI.
|
|
17
17
|
*/
|
|
18
18
|
type LifecycleReasonValue = (typeof LIFECYCLE_REASON_VALUES)[number] | `unknown_reason_${number}`;
|
|
19
|
-
declare const LIFECYCLE_REQUEST_FEE_STATUS_VALUES: readonly ["locked", "settled"];
|
|
19
|
+
declare const LIFECYCLE_REQUEST_FEE_STATUS_VALUES: readonly ["locked", "settled", "kept"];
|
|
20
20
|
type LifecycleRequestFeeStatusValue = (typeof LIFECYCLE_REQUEST_FEE_STATUS_VALUES)[number];
|
|
21
21
|
//#endregion
|
|
22
22
|
export { LIFECYCLE_LIST_ORDER_BY_VALUES, LIFECYCLE_LIST_SCOPE_VALUES, LIFECYCLE_REASON_VALUES, LIFECYCLE_REQUEST_FEE_STATUS_VALUES, LIFECYCLE_SORT_VALUES, LIFECYCLE_TX_LOOKUP_KIND_VALUES, LifecycleListOrderByValue, LifecycleListScopeValue, LifecycleReasonValue, LifecycleRequestFeeStatusValue, LifecycleSortValue, LifecycleTxLookupKindValue };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lifecycle.codecs.d.ts","names":[],"sources":["../../../src/services/lifecycle/lifecycle.codecs.ts"],"mappings":";;;cAkCa;KACD,kCAAkC;cAKjC;KACD,qCAAqC;cAEpC;KACD,6BAA6B;cAE5B;KACD,oCAAoC;cAEnC;;;;;;
|
|
1
|
+
{"version":3,"file":"lifecycle.codecs.d.ts","names":[],"sources":["../../../src/services/lifecycle/lifecycle.codecs.ts"],"mappings":";;;cAkCa;KACD,kCAAkC;cAKjC;KACD,qCAAqC;cAEpC;KACD,6BAA6B;cAE5B;KACD,oCAAoC;cAEnC;;;;;;KAsBD,+BACE;cAyCD;KACD,yCAAyC"}
|
|
@@ -110,6 +110,7 @@ const LifecycleReasonCodec = { protoToOutput: {
|
|
|
110
110
|
[102]: "zipper_execution_rejected",
|
|
111
111
|
[103]: "zipper_withdraw_execution_failed",
|
|
112
112
|
[104]: "zipper_deposit_refund_failed",
|
|
113
|
+
[105]: "zipper_compliance_transferred",
|
|
113
114
|
[200]: "ledger_mirror_rejected",
|
|
114
115
|
[201]: "ledger_mirror_transfer_exceeds_credits",
|
|
115
116
|
[202]: "ledger_mirror_transfer_exists",
|
|
@@ -180,7 +181,8 @@ const LifecycleFlowTimelineStatusCodec = { protoToOutput: {
|
|
|
180
181
|
const LifecycleRequestFeeStatusCodec = { protoToOutput: {
|
|
181
182
|
[0]: "unspecified",
|
|
182
183
|
[1]: "locked",
|
|
183
|
-
[2]: "settled"
|
|
184
|
+
[2]: "settled",
|
|
185
|
+
[3]: "kept"
|
|
184
186
|
} };
|
|
185
187
|
//#endregion
|
|
186
188
|
export { LIFECYCLE_FLOW_KIND_VALUES, LIFECYCLE_FLOW_PARTICIPATION_VALUES, LIFECYCLE_FLOW_STATE_VALUES, LIFECYCLE_LIST_ORDER_BY_VALUES, LIFECYCLE_LIST_SCOPE_VALUES, LIFECYCLE_SORT_VALUES, LIFECYCLE_TX_LOOKUP_KIND_VALUES, LifecycleFlowDomainCodec, LifecycleFlowKindCodec, LifecycleFlowParticipationCodec, LifecycleFlowStateCodec, LifecycleFlowStepActivityKindCodec, LifecycleFlowStepCodec, LifecycleFlowTimelineStatusCodec, LifecycleListOrderByCodec, LifecycleListScopeCodec, LifecycleReasonCodec, LifecycleRequestFeeStatusCodec, LifecycleSortCodec, LifecycleSourceCodec, LifecycleTxLookupKindCodec, lifecycleReasonFromCode };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lifecycle.codecs.js","names":[],"sources":["../../../src/services/lifecycle/lifecycle.codecs.ts"],"sourcesContent":["import {\n FlowDomain,\n FlowKind,\n FlowState,\n LifecycleReason,\n LifecycleSource,\n RequestFeeStatus,\n} from \"../../gen/chain/lifecycle/v1/types_pb.js\";\nimport {\n FlowParticipation,\n FlowStep,\n FlowStepActivityKind,\n FlowTimelineStatus,\n ListOrderBy,\n ListScope,\n Sort,\n TxLookupKind,\n} from \"../../gen/chain/lifecycle/v1/lifecycle_read_pb.js\";\nimport type { InputToProto, ProtoToOutput } from \"../../utils/types.js\";\n\nexport const LIFECYCLE_FLOW_KIND_VALUES = [\"deposit\", \"withdraw\", \"transfer\"] as const;\nexport type LifecycleFlowKindValue = (typeof LIFECYCLE_FLOW_KIND_VALUES)[number];\n\nexport const LIFECYCLE_FLOW_STATE_VALUES = [\n \"pending_source\",\n \"pending_polyester_chain\",\n \"pending_ledger\",\n \"completed\",\n \"failed\",\n \"dropped\",\n \"refunded\",\n] as const;\nexport type LifecycleFlowStateValue = (typeof LIFECYCLE_FLOW_STATE_VALUES)[number];\n\nexport const LIFECYCLE_LIST_SCOPE_VALUES = [\"all\", \"open\", \"terminal\"] as const;\nexport type LifecycleListScopeValue = (typeof LIFECYCLE_LIST_SCOPE_VALUES)[number];\n\nexport const LIFECYCLE_FLOW_PARTICIPATION_VALUES = [\"owner\", \"recipient\"] as const;\nexport type LifecycleFlowParticipationValue = (typeof LIFECYCLE_FLOW_PARTICIPATION_VALUES)[number];\n\nexport const LIFECYCLE_TX_LOOKUP_KIND_VALUES = [\"source\", \"any\"] as const;\nexport type LifecycleTxLookupKindValue = (typeof LIFECYCLE_TX_LOOKUP_KIND_VALUES)[number];\n\nexport const LIFECYCLE_SORT_VALUES = [\"newest\", \"oldest\"] as const;\nexport type LifecycleSortValue = (typeof LIFECYCLE_SORT_VALUES)[number];\n\nexport const LIFECYCLE_LIST_ORDER_BY_VALUES = [\"last_activity\", \"started_at\"] as const;\nexport type LifecycleListOrderByValue = (typeof LIFECYCLE_LIST_ORDER_BY_VALUES)[number];\n\nexport const LIFECYCLE_REASON_VALUES = [\n \"unspecified\",\n \"zipper_validation_rejected\",\n \"zipper_execution_rejected\",\n \"zipper_withdraw_execution_failed\",\n \"zipper_deposit_refund_failed\",\n \"ledger_mirror_rejected\",\n \"ledger_mirror_transfer_exceeds_credits\",\n \"ledger_mirror_transfer_exists\",\n \"ledger_mirror_pending_transfer_not_found\",\n \"ledger_mirror_transfer_id_already_failed\",\n \"trading_withdraw_policy_denied\",\n \"trading_withdraw_contract_reverted\",\n \"trading_withdraw_execution_failed\",\n \"deposit_source_not_confirmed\",\n] as const;\n/**\n * Catalog labels plus a code-preserving fallback for wire values the generated\n * enum does not know. Proto3 enums are open — the backend can emit codes ahead\n * of a contract update — and rejecting them froze flows out of the UI.\n */\nexport type LifecycleReasonValue =\n | (typeof LIFECYCLE_REASON_VALUES)[number]\n | `unknown_reason_${number}`;\n\nexport const LIFECYCLE_FLOW_STEP_VALUES = [\n \"source\",\n \"transfer\",\n \"request\",\n \"validation\",\n \"execution\",\n \"bridge_fulfillment\",\n \"dropped\",\n \"failed\",\n \"refunded\",\n \"fulfilling\",\n \"settlement\",\n] as const;\nexport type LifecycleFlowStepValue = (typeof LIFECYCLE_FLOW_STEP_VALUES)[number];\n\nexport const LIFECYCLE_SOURCE_VALUES = [\n \"unspecified\",\n \"relayer\",\n \"polyester_chain\",\n \"executor\",\n \"ledger\",\n \"lifecycle\",\n] as const;\nexport type LifecycleSourceValue = (typeof LIFECYCLE_SOURCE_VALUES)[number];\n\nexport const LIFECYCLE_FLOW_STEP_ACTIVITY_KIND_VALUES = [\n \"minted\",\n \"funding\",\n \"trading\",\n \"unspecified\",\n] as const;\nexport type LifecycleFlowStepActivityKindValue =\n (typeof LIFECYCLE_FLOW_STEP_ACTIVITY_KIND_VALUES)[number];\n\nexport const LIFECYCLE_FLOW_TIMELINE_STATUS_VALUES = [\"completed\", \"current\", \"planned\"] as const;\nexport type LifecycleFlowTimelineStatusValue =\n (typeof LIFECYCLE_FLOW_TIMELINE_STATUS_VALUES)[number];\n\nexport const LIFECYCLE_REQUEST_FEE_STATUS_VALUES = [\"locked\", \"settled\"] as const;\nexport type LifecycleRequestFeeStatusValue = (typeof LIFECYCLE_REQUEST_FEE_STATUS_VALUES)[number];\n\nexport const LIFECYCLE_FLOW_DOMAIN_VALUES = [\n \"external_chain\",\n \"zipper\",\n \"funding\",\n \"trading\",\n \"lending\",\n] as const;\nexport type LifecycleFlowDomainValue = (typeof LIFECYCLE_FLOW_DOMAIN_VALUES)[number];\n\nexport const LifecycleFlowDomainCodec = {\n protoToOutput: {\n [FlowDomain.DOMAIN_UNSPECIFIED]: \"unspecified\",\n [FlowDomain.DOMAIN_EXTERNAL_CHAIN]: \"external_chain\",\n [FlowDomain.DOMAIN_ZIPPER]: \"zipper\",\n [FlowDomain.DOMAIN_FUNDING]: \"funding\",\n [FlowDomain.DOMAIN_TRADING]: \"trading\",\n [FlowDomain.DOMAIN_LENDING]: \"lending\",\n } satisfies ProtoToOutput<FlowDomain, LifecycleFlowDomainValue>,\n} as const;\n\nexport const LifecycleFlowKindCodec = {\n inputToProto: {\n deposit: FlowKind.KIND_DEPOSIT,\n withdraw: FlowKind.KIND_WITHDRAW,\n transfer: FlowKind.KIND_TRANSFER,\n } satisfies InputToProto<LifecycleFlowKindValue, FlowKind>,\n protoToOutput: {\n [FlowKind.KIND_UNSPECIFIED]: \"unspecified\",\n [FlowKind.KIND_DEPOSIT]: \"deposit\",\n [FlowKind.KIND_WITHDRAW]: \"withdraw\",\n [FlowKind.KIND_TRANSFER]: \"transfer\",\n } satisfies ProtoToOutput<FlowKind, LifecycleFlowKindValue>,\n} as const;\n\nexport const LifecycleFlowStateCodec = {\n inputToProto: {\n pending_source: FlowState.STATE_PENDING_SOURCE,\n pending_polyester_chain: FlowState.STATE_PENDING_POLYESTER_CHAIN,\n pending_ledger: FlowState.STATE_PENDING_LEDGER,\n completed: FlowState.STATE_COMPLETED,\n failed: FlowState.STATE_FAILED,\n dropped: FlowState.STATE_DROPPED,\n refunded: FlowState.STATE_REFUNDED,\n } satisfies InputToProto<LifecycleFlowStateValue, FlowState>,\n protoToOutput: {\n [FlowState.STATE_UNSPECIFIED]: \"unspecified\",\n [FlowState.STATE_PENDING_SOURCE]: \"pending_source\",\n [FlowState.STATE_PENDING_POLYESTER_CHAIN]: \"pending_polyester_chain\",\n [FlowState.STATE_PENDING_LEDGER]: \"pending_ledger\",\n [FlowState.STATE_COMPLETED]: \"completed\",\n [FlowState.STATE_FAILED]: \"failed\",\n [FlowState.STATE_DROPPED]: \"dropped\",\n [FlowState.STATE_REFUNDED]: \"refunded\",\n } satisfies ProtoToOutput<FlowState, LifecycleFlowStateValue>,\n} as const;\n\nexport const LifecycleListScopeCodec = {\n inputToProto: {\n all: ListScope.LIST_ALL,\n open: ListScope.LIST_OPEN_ONLY,\n terminal: ListScope.LIST_TERMINAL_ONLY,\n } satisfies InputToProto<LifecycleListScopeValue, ListScope>,\n protoToOutput: {\n [ListScope.LIST_UNSPECIFIED]: \"unspecified\",\n [ListScope.LIST_ALL]: \"all\",\n [ListScope.LIST_OPEN_ONLY]: \"open\",\n [ListScope.LIST_TERMINAL_ONLY]: \"terminal\",\n } satisfies ProtoToOutput<ListScope, LifecycleListScopeValue>,\n} as const;\n\nexport const LifecycleFlowParticipationCodec = {\n inputToProto: {\n owner: FlowParticipation.PARTICIPATION_OWNER,\n recipient: FlowParticipation.PARTICIPATION_RECIPIENT,\n } satisfies InputToProto<LifecycleFlowParticipationValue, FlowParticipation>,\n protoToOutput: {\n [FlowParticipation.PARTICIPATION_UNSPECIFIED]: \"unspecified\",\n [FlowParticipation.PARTICIPATION_OWNER]: \"owner\",\n [FlowParticipation.PARTICIPATION_RECIPIENT]: \"recipient\",\n } satisfies ProtoToOutput<FlowParticipation, LifecycleFlowParticipationValue>,\n} as const;\n\nexport const LifecycleSortCodec = {\n inputToProto: {\n newest: Sort.NEWEST,\n oldest: Sort.OLDEST,\n } satisfies InputToProto<LifecycleSortValue, Sort>,\n} as const;\n\nexport const LifecycleListOrderByCodec = {\n inputToProto: {\n last_activity: ListOrderBy.ORDER_BY_LAST_ACTIVITY,\n started_at: ListOrderBy.ORDER_BY_STARTED_AT,\n } satisfies InputToProto<LifecycleListOrderByValue, ListOrderBy>,\n} as const;\n\n/**\n * LifecycleReason is a stable product-facing reason catalog. Unlike the other\n * lifecycle enums, `REASON_UNSPECIFIED` (0) is a valid wire value — it is\n * the normal state for flows without a notable reason — so the codec maps the\n * full enum including zero.\n */\nexport const LifecycleReasonCodec = {\n protoToOutput: {\n [LifecycleReason.REASON_UNSPECIFIED]: \"unspecified\",\n [LifecycleReason.ZIPPER_VALIDATION_REJECTED]: \"zipper_validation_rejected\",\n [LifecycleReason.ZIPPER_EXECUTION_REJECTED]: \"zipper_execution_rejected\",\n [LifecycleReason.ZIPPER_WITHDRAW_EXECUTION_FAILED]: \"zipper_withdraw_execution_failed\",\n [LifecycleReason.ZIPPER_DEPOSIT_REFUND_FAILED]: \"zipper_deposit_refund_failed\",\n [LifecycleReason.LEDGER_MIRROR_REJECTED]: \"ledger_mirror_rejected\",\n [LifecycleReason.LEDGER_MIRROR_TRANSFER_EXCEEDS_CREDITS]:\n \"ledger_mirror_transfer_exceeds_credits\",\n [LifecycleReason.LEDGER_MIRROR_TRANSFER_EXISTS]: \"ledger_mirror_transfer_exists\",\n [LifecycleReason.LEDGER_MIRROR_PENDING_TRANSFER_NOT_FOUND]:\n \"ledger_mirror_pending_transfer_not_found\",\n [LifecycleReason.LEDGER_MIRROR_TRANSFER_ID_ALREADY_FAILED]:\n \"ledger_mirror_transfer_id_already_failed\",\n [LifecycleReason.TRADING_WITHDRAW_POLICY_DENIED]: \"trading_withdraw_policy_denied\",\n [LifecycleReason.TRADING_WITHDRAW_CONTRACT_REVERTED]: \"trading_withdraw_contract_reverted\",\n [LifecycleReason.TRADING_WITHDRAW_EXECUTION_FAILED]: \"trading_withdraw_execution_failed\",\n [LifecycleReason.DEPOSIT_SOURCE_NOT_CONFIRMED]: \"deposit_source_not_confirmed\",\n } satisfies Record<LifecycleReason, LifecycleReasonValue>,\n} as const;\n\n/**\n * Maps a wire reason code to its catalog label, preserving uncataloged codes\n * as `unknown_reason_${code}` instead of failing the whole flow payload.\n */\nexport function lifecycleReasonFromCode(code: number): LifecycleReasonValue {\n const known = LifecycleReasonCodec.protoToOutput as Partial<\n Record<number, LifecycleReasonValue>\n >;\n return known[code] ?? `unknown_reason_${code}`;\n}\n\nexport const LifecycleTxLookupKindCodec = {\n inputToProto: {\n source: TxLookupKind.TX_SOURCE,\n any: TxLookupKind.TX_ANY,\n } satisfies InputToProto<LifecycleTxLookupKindValue, TxLookupKind>,\n protoToOutput: {\n [TxLookupKind.TX_UNSPECIFIED]: \"unspecified\",\n [TxLookupKind.TX_SOURCE]: \"source\",\n [TxLookupKind.TX_ANY]: \"any\",\n } satisfies ProtoToOutput<TxLookupKind, LifecycleTxLookupKindValue>,\n} as const;\n\nexport const LifecycleFlowStepCodec = {\n protoToOutput: {\n [FlowStep.UNSPECIFIED]: \"unspecified\",\n [FlowStep.SOURCE]: \"source\",\n [FlowStep.TRANSFER]: \"transfer\",\n [FlowStep.REQUEST]: \"request\",\n [FlowStep.VALIDATION]: \"validation\",\n [FlowStep.EXECUTION]: \"execution\",\n [FlowStep.BRIDGE_FULFILLMENT]: \"bridge_fulfillment\",\n [FlowStep.DROPPED]: \"dropped\",\n [FlowStep.FAILED]: \"failed\",\n [FlowStep.REFUNDED]: \"refunded\",\n [FlowStep.FULFILLING]: \"fulfilling\",\n [FlowStep.SETTLEMENT]: \"settlement\",\n } satisfies ProtoToOutput<FlowStep, LifecycleFlowStepValue>,\n} as const;\n\nexport const LifecycleSourceCodec = {\n /**\n * In-progress flows may emit SOURCE_UNSPECIFIED (0) before a subsystem is\n * attributed, so zero must decode like other lifecycle \"unspecified\" enums.\n */\n protoToOutput: {\n [LifecycleSource.SOURCE_UNSPECIFIED]: \"unspecified\",\n [LifecycleSource.SOURCE_RELAYER]: \"relayer\",\n [LifecycleSource.SOURCE_POLYESTER_CHAIN]: \"polyester_chain\",\n [LifecycleSource.SOURCE_EXECUTOR]: \"executor\",\n [LifecycleSource.SOURCE_LEDGER]: \"ledger\",\n [LifecycleSource.SOURCE_LIFECYCLE]: \"lifecycle\",\n } satisfies Record<LifecycleSource, LifecycleSourceValue>,\n} as const;\n\nexport const LifecycleFlowStepActivityKindCodec = {\n protoToOutput: {\n [FlowStepActivityKind.ACTIVITY_MINTED]: \"minted\",\n [FlowStepActivityKind.ACTIVITY_FUNDING]: \"funding\",\n [FlowStepActivityKind.ACTIVITY_TRADING]: \"trading\",\n [FlowStepActivityKind.ACTIVITY_UNSPECIFIED]: \"unspecified\",\n } satisfies Record<FlowStepActivityKind, LifecycleFlowStepActivityKindValue>,\n} as const;\n\nexport const LifecycleFlowTimelineStatusCodec = {\n protoToOutput: {\n [FlowTimelineStatus.TIMELINE_STATUS_UNSPECIFIED]: \"unspecified\",\n [FlowTimelineStatus.TIMELINE_STATUS_COMPLETED]: \"completed\",\n [FlowTimelineStatus.TIMELINE_STATUS_CURRENT]: \"current\",\n [FlowTimelineStatus.TIMELINE_STATUS_PLANNED]: \"planned\",\n } satisfies ProtoToOutput<FlowTimelineStatus, LifecycleFlowTimelineStatusValue>,\n} as const;\n\nexport const LifecycleRequestFeeStatusCodec = {\n protoToOutput: {\n [RequestFeeStatus.UNSPECIFIED]: \"unspecified\",\n [RequestFeeStatus.LOCKED]: \"locked\",\n [RequestFeeStatus.SETTLED]: \"settled\",\n } satisfies ProtoToOutput<RequestFeeStatus, LifecycleRequestFeeStatusValue>,\n} as const;\n"],"mappings":";;;AAoBA,MAAa,6BAA6B;CAAC;CAAW;CAAY;AAAU;AAG5E,MAAa,8BAA8B;CACvC;CACA;CACA;CACA;CACA;CACA;CACA;AACJ;AAGA,MAAa,8BAA8B;CAAC;CAAO;CAAQ;AAAU;AAGrE,MAAa,sCAAsC,CAAC,SAAS,WAAW;AAGxE,MAAa,kCAAkC,CAAC,UAAU,KAAK;AAG/D,MAAa,wBAAwB,CAAC,UAAU,QAAQ;AAGxD,MAAa,iCAAiC,CAAC,iBAAiB,YAAY;AA8E5E,MAAa,2BAA2B,EACpC,eAAe;EACsB,IAAA;EACG,IAAA;EACR,IAAA;EACC,IAAA;EACA,IAAA;EACA,IAAA;AACjC,EACJ;AAEA,MAAa,yBAAyB;CAClC,cAAc;EACV,SAAA;EACA,UAAA;EACA,UAAA;CACJ;CACA,eAAe;GACkB,IAAA;GACJ,IAAA;GACC,IAAA;GACA,IAAA;CAC9B;AACJ;AAEA,MAAa,0BAA0B;CACnC,cAAc;EACV,gBAAA;EACA,yBAAA;EACA,gBAAA;EACA,WAAA;EACA,QAAA;EACA,SAAA;EACA,UAAA;CACJ;CACA,eAAe;GACoB,IAAA;GACG,IAAA;GACS,IAAA;GACT,IAAA;GACL,IAAA;GACH,IAAA;GACC,IAAA;GACC,IAAA;CAChC;AACJ;AAEA,MAAa,0BAA0B;CACnC,cAAc;EACV,KAA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AA;AAClD,EACJ;AAEA,MAAa,iCAAiC,EAC1C,eAAe;EACqB,IAAA;EACL,IAAA;EACC,IAAA;AAChC,EACJ"}
|
|
1
|
+
{"version":3,"file":"lifecycle.codecs.js","names":[],"sources":["../../../src/services/lifecycle/lifecycle.codecs.ts"],"sourcesContent":["import {\n FlowDomain,\n FlowKind,\n FlowState,\n LifecycleReason,\n LifecycleSource,\n RequestFeeStatus,\n} from \"../../gen/chain/lifecycle/v1/types_pb.js\";\nimport {\n FlowParticipation,\n FlowStep,\n FlowStepActivityKind,\n FlowTimelineStatus,\n ListOrderBy,\n ListScope,\n Sort,\n TxLookupKind,\n} from \"../../gen/chain/lifecycle/v1/lifecycle_read_pb.js\";\nimport type { InputToProto, ProtoToOutput } from \"../../utils/types.js\";\n\nexport const LIFECYCLE_FLOW_KIND_VALUES = [\"deposit\", \"withdraw\", \"transfer\"] as const;\nexport type LifecycleFlowKindValue = (typeof LIFECYCLE_FLOW_KIND_VALUES)[number];\n\nexport const LIFECYCLE_FLOW_STATE_VALUES = [\n \"pending_source\",\n \"pending_polyester_chain\",\n \"pending_ledger\",\n \"completed\",\n \"failed\",\n \"dropped\",\n \"refunded\",\n] as const;\nexport type LifecycleFlowStateValue = (typeof LIFECYCLE_FLOW_STATE_VALUES)[number];\n\nexport const LIFECYCLE_LIST_SCOPE_VALUES = [\"all\", \"open\", \"terminal\"] as const;\nexport type LifecycleListScopeValue = (typeof LIFECYCLE_LIST_SCOPE_VALUES)[number];\n\nexport const LIFECYCLE_FLOW_PARTICIPATION_VALUES = [\"owner\", \"recipient\"] as const;\nexport type LifecycleFlowParticipationValue = (typeof LIFECYCLE_FLOW_PARTICIPATION_VALUES)[number];\n\nexport const LIFECYCLE_TX_LOOKUP_KIND_VALUES = [\"source\", \"any\"] as const;\nexport type LifecycleTxLookupKindValue = (typeof LIFECYCLE_TX_LOOKUP_KIND_VALUES)[number];\n\nexport const LIFECYCLE_SORT_VALUES = [\"newest\", \"oldest\"] as const;\nexport type LifecycleSortValue = (typeof LIFECYCLE_SORT_VALUES)[number];\n\nexport const LIFECYCLE_LIST_ORDER_BY_VALUES = [\"last_activity\", \"started_at\"] as const;\nexport type LifecycleListOrderByValue = (typeof LIFECYCLE_LIST_ORDER_BY_VALUES)[number];\n\nexport const LIFECYCLE_REASON_VALUES = [\n \"unspecified\",\n \"zipper_validation_rejected\",\n \"zipper_execution_rejected\",\n \"zipper_withdraw_execution_failed\",\n \"zipper_deposit_refund_failed\",\n \"zipper_compliance_transferred\",\n \"ledger_mirror_rejected\",\n \"ledger_mirror_transfer_exceeds_credits\",\n \"ledger_mirror_transfer_exists\",\n \"ledger_mirror_pending_transfer_not_found\",\n \"ledger_mirror_transfer_id_already_failed\",\n \"trading_withdraw_policy_denied\",\n \"trading_withdraw_contract_reverted\",\n \"trading_withdraw_execution_failed\",\n \"deposit_source_not_confirmed\",\n] as const;\n/**\n * Catalog labels plus a code-preserving fallback for wire values the generated\n * enum does not know. Proto3 enums are open — the backend can emit codes ahead\n * of a contract update — and rejecting them froze flows out of the UI.\n */\nexport type LifecycleReasonValue =\n | (typeof LIFECYCLE_REASON_VALUES)[number]\n | `unknown_reason_${number}`;\n\nexport const LIFECYCLE_FLOW_STEP_VALUES = [\n \"source\",\n \"transfer\",\n \"request\",\n \"validation\",\n \"execution\",\n \"bridge_fulfillment\",\n \"dropped\",\n \"failed\",\n \"refunded\",\n \"fulfilling\",\n \"settlement\",\n] as const;\nexport type LifecycleFlowStepValue = (typeof LIFECYCLE_FLOW_STEP_VALUES)[number];\n\nexport const LIFECYCLE_SOURCE_VALUES = [\n \"unspecified\",\n \"relayer\",\n \"polyester_chain\",\n \"executor\",\n \"ledger\",\n \"lifecycle\",\n] as const;\nexport type LifecycleSourceValue = (typeof LIFECYCLE_SOURCE_VALUES)[number];\n\nexport const LIFECYCLE_FLOW_STEP_ACTIVITY_KIND_VALUES = [\n \"minted\",\n \"funding\",\n \"trading\",\n \"unspecified\",\n] as const;\nexport type LifecycleFlowStepActivityKindValue =\n (typeof LIFECYCLE_FLOW_STEP_ACTIVITY_KIND_VALUES)[number];\n\nexport const LIFECYCLE_FLOW_TIMELINE_STATUS_VALUES = [\"completed\", \"current\", \"planned\"] as const;\nexport type LifecycleFlowTimelineStatusValue =\n (typeof LIFECYCLE_FLOW_TIMELINE_STATUS_VALUES)[number];\n\nexport const LIFECYCLE_REQUEST_FEE_STATUS_VALUES = [\"locked\", \"settled\", \"kept\"] as const;\nexport type LifecycleRequestFeeStatusValue = (typeof LIFECYCLE_REQUEST_FEE_STATUS_VALUES)[number];\n\nexport const LIFECYCLE_FLOW_DOMAIN_VALUES = [\n \"external_chain\",\n \"zipper\",\n \"funding\",\n \"trading\",\n \"lending\",\n] as const;\nexport type LifecycleFlowDomainValue = (typeof LIFECYCLE_FLOW_DOMAIN_VALUES)[number];\n\nexport const LifecycleFlowDomainCodec = {\n protoToOutput: {\n [FlowDomain.DOMAIN_UNSPECIFIED]: \"unspecified\",\n [FlowDomain.DOMAIN_EXTERNAL_CHAIN]: \"external_chain\",\n [FlowDomain.DOMAIN_ZIPPER]: \"zipper\",\n [FlowDomain.DOMAIN_FUNDING]: \"funding\",\n [FlowDomain.DOMAIN_TRADING]: \"trading\",\n [FlowDomain.DOMAIN_LENDING]: \"lending\",\n } satisfies ProtoToOutput<FlowDomain, LifecycleFlowDomainValue>,\n} as const;\n\nexport const LifecycleFlowKindCodec = {\n inputToProto: {\n deposit: FlowKind.KIND_DEPOSIT,\n withdraw: FlowKind.KIND_WITHDRAW,\n transfer: FlowKind.KIND_TRANSFER,\n } satisfies InputToProto<LifecycleFlowKindValue, FlowKind>,\n protoToOutput: {\n [FlowKind.KIND_UNSPECIFIED]: \"unspecified\",\n [FlowKind.KIND_DEPOSIT]: \"deposit\",\n [FlowKind.KIND_WITHDRAW]: \"withdraw\",\n [FlowKind.KIND_TRANSFER]: \"transfer\",\n } satisfies ProtoToOutput<FlowKind, LifecycleFlowKindValue>,\n} as const;\n\nexport const LifecycleFlowStateCodec = {\n inputToProto: {\n pending_source: FlowState.STATE_PENDING_SOURCE,\n pending_polyester_chain: FlowState.STATE_PENDING_POLYESTER_CHAIN,\n pending_ledger: FlowState.STATE_PENDING_LEDGER,\n completed: FlowState.STATE_COMPLETED,\n failed: FlowState.STATE_FAILED,\n dropped: FlowState.STATE_DROPPED,\n refunded: FlowState.STATE_REFUNDED,\n } satisfies InputToProto<LifecycleFlowStateValue, FlowState>,\n protoToOutput: {\n [FlowState.STATE_UNSPECIFIED]: \"unspecified\",\n [FlowState.STATE_PENDING_SOURCE]: \"pending_source\",\n [FlowState.STATE_PENDING_POLYESTER_CHAIN]: \"pending_polyester_chain\",\n [FlowState.STATE_PENDING_LEDGER]: \"pending_ledger\",\n [FlowState.STATE_COMPLETED]: \"completed\",\n [FlowState.STATE_FAILED]: \"failed\",\n [FlowState.STATE_DROPPED]: \"dropped\",\n [FlowState.STATE_REFUNDED]: \"refunded\",\n } satisfies ProtoToOutput<FlowState, LifecycleFlowStateValue>,\n} as const;\n\nexport const LifecycleListScopeCodec = {\n inputToProto: {\n all: ListScope.LIST_ALL,\n open: ListScope.LIST_OPEN_ONLY,\n terminal: ListScope.LIST_TERMINAL_ONLY,\n } satisfies InputToProto<LifecycleListScopeValue, ListScope>,\n protoToOutput: {\n [ListScope.LIST_UNSPECIFIED]: \"unspecified\",\n [ListScope.LIST_ALL]: \"all\",\n [ListScope.LIST_OPEN_ONLY]: \"open\",\n [ListScope.LIST_TERMINAL_ONLY]: \"terminal\",\n } satisfies ProtoToOutput<ListScope, LifecycleListScopeValue>,\n} as const;\n\nexport const LifecycleFlowParticipationCodec = {\n inputToProto: {\n owner: FlowParticipation.PARTICIPATION_OWNER,\n recipient: FlowParticipation.PARTICIPATION_RECIPIENT,\n } satisfies InputToProto<LifecycleFlowParticipationValue, FlowParticipation>,\n protoToOutput: {\n [FlowParticipation.PARTICIPATION_UNSPECIFIED]: \"unspecified\",\n [FlowParticipation.PARTICIPATION_OWNER]: \"owner\",\n [FlowParticipation.PARTICIPATION_RECIPIENT]: \"recipient\",\n } satisfies ProtoToOutput<FlowParticipation, LifecycleFlowParticipationValue>,\n} as const;\n\nexport const LifecycleSortCodec = {\n inputToProto: {\n newest: Sort.NEWEST,\n oldest: Sort.OLDEST,\n } satisfies InputToProto<LifecycleSortValue, Sort>,\n} as const;\n\nexport const LifecycleListOrderByCodec = {\n inputToProto: {\n last_activity: ListOrderBy.ORDER_BY_LAST_ACTIVITY,\n started_at: ListOrderBy.ORDER_BY_STARTED_AT,\n } satisfies InputToProto<LifecycleListOrderByValue, ListOrderBy>,\n} as const;\n\n/**\n * LifecycleReason is a stable product-facing reason catalog. Unlike the other\n * lifecycle enums, `REASON_UNSPECIFIED` (0) is a valid wire value — it is\n * the normal state for flows without a notable reason — so the codec maps the\n * full enum including zero.\n */\nexport const LifecycleReasonCodec = {\n protoToOutput: {\n [LifecycleReason.REASON_UNSPECIFIED]: \"unspecified\",\n [LifecycleReason.ZIPPER_VALIDATION_REJECTED]: \"zipper_validation_rejected\",\n [LifecycleReason.ZIPPER_EXECUTION_REJECTED]: \"zipper_execution_rejected\",\n [LifecycleReason.ZIPPER_WITHDRAW_EXECUTION_FAILED]: \"zipper_withdraw_execution_failed\",\n [LifecycleReason.ZIPPER_DEPOSIT_REFUND_FAILED]: \"zipper_deposit_refund_failed\",\n [LifecycleReason.ZIPPER_COMPLIANCE_TRANSFERRED]: \"zipper_compliance_transferred\",\n [LifecycleReason.LEDGER_MIRROR_REJECTED]: \"ledger_mirror_rejected\",\n [LifecycleReason.LEDGER_MIRROR_TRANSFER_EXCEEDS_CREDITS]:\n \"ledger_mirror_transfer_exceeds_credits\",\n [LifecycleReason.LEDGER_MIRROR_TRANSFER_EXISTS]: \"ledger_mirror_transfer_exists\",\n [LifecycleReason.LEDGER_MIRROR_PENDING_TRANSFER_NOT_FOUND]:\n \"ledger_mirror_pending_transfer_not_found\",\n [LifecycleReason.LEDGER_MIRROR_TRANSFER_ID_ALREADY_FAILED]:\n \"ledger_mirror_transfer_id_already_failed\",\n [LifecycleReason.TRADING_WITHDRAW_POLICY_DENIED]: \"trading_withdraw_policy_denied\",\n [LifecycleReason.TRADING_WITHDRAW_CONTRACT_REVERTED]: \"trading_withdraw_contract_reverted\",\n [LifecycleReason.TRADING_WITHDRAW_EXECUTION_FAILED]: \"trading_withdraw_execution_failed\",\n [LifecycleReason.DEPOSIT_SOURCE_NOT_CONFIRMED]: \"deposit_source_not_confirmed\",\n } satisfies Record<LifecycleReason, LifecycleReasonValue>,\n} as const;\n\n/**\n * Maps a wire reason code to its catalog label, preserving uncataloged codes\n * as `unknown_reason_${code}` instead of failing the whole flow payload.\n */\nexport function lifecycleReasonFromCode(code: number): LifecycleReasonValue {\n const known = LifecycleReasonCodec.protoToOutput as Partial<\n Record<number, LifecycleReasonValue>\n >;\n return known[code] ?? `unknown_reason_${code}`;\n}\n\nexport const LifecycleTxLookupKindCodec = {\n inputToProto: {\n source: TxLookupKind.TX_SOURCE,\n any: TxLookupKind.TX_ANY,\n } satisfies InputToProto<LifecycleTxLookupKindValue, TxLookupKind>,\n protoToOutput: {\n [TxLookupKind.TX_UNSPECIFIED]: \"unspecified\",\n [TxLookupKind.TX_SOURCE]: \"source\",\n [TxLookupKind.TX_ANY]: \"any\",\n } satisfies ProtoToOutput<TxLookupKind, LifecycleTxLookupKindValue>,\n} as const;\n\nexport const LifecycleFlowStepCodec = {\n protoToOutput: {\n [FlowStep.UNSPECIFIED]: \"unspecified\",\n [FlowStep.SOURCE]: \"source\",\n [FlowStep.TRANSFER]: \"transfer\",\n [FlowStep.REQUEST]: \"request\",\n [FlowStep.VALIDATION]: \"validation\",\n [FlowStep.EXECUTION]: \"execution\",\n [FlowStep.BRIDGE_FULFILLMENT]: \"bridge_fulfillment\",\n [FlowStep.DROPPED]: \"dropped\",\n [FlowStep.FAILED]: \"failed\",\n [FlowStep.REFUNDED]: \"refunded\",\n [FlowStep.FULFILLING]: \"fulfilling\",\n [FlowStep.SETTLEMENT]: \"settlement\",\n } satisfies ProtoToOutput<FlowStep, LifecycleFlowStepValue>,\n} as const;\n\nexport const LifecycleSourceCodec = {\n /**\n * In-progress flows may emit SOURCE_UNSPECIFIED (0) before a subsystem is\n * attributed, so zero must decode like other lifecycle \"unspecified\" enums.\n */\n protoToOutput: {\n [LifecycleSource.SOURCE_UNSPECIFIED]: \"unspecified\",\n [LifecycleSource.SOURCE_RELAYER]: \"relayer\",\n [LifecycleSource.SOURCE_POLYESTER_CHAIN]: \"polyester_chain\",\n [LifecycleSource.SOURCE_EXECUTOR]: \"executor\",\n [LifecycleSource.SOURCE_LEDGER]: \"ledger\",\n [LifecycleSource.SOURCE_LIFECYCLE]: \"lifecycle\",\n } satisfies Record<LifecycleSource, LifecycleSourceValue>,\n} as const;\n\nexport const LifecycleFlowStepActivityKindCodec = {\n protoToOutput: {\n [FlowStepActivityKind.ACTIVITY_MINTED]: \"minted\",\n [FlowStepActivityKind.ACTIVITY_FUNDING]: \"funding\",\n [FlowStepActivityKind.ACTIVITY_TRADING]: \"trading\",\n [FlowStepActivityKind.ACTIVITY_UNSPECIFIED]: \"unspecified\",\n } satisfies Record<FlowStepActivityKind, LifecycleFlowStepActivityKindValue>,\n} as const;\n\nexport const LifecycleFlowTimelineStatusCodec = {\n protoToOutput: {\n [FlowTimelineStatus.TIMELINE_STATUS_UNSPECIFIED]: \"unspecified\",\n [FlowTimelineStatus.TIMELINE_STATUS_COMPLETED]: \"completed\",\n [FlowTimelineStatus.TIMELINE_STATUS_CURRENT]: \"current\",\n [FlowTimelineStatus.TIMELINE_STATUS_PLANNED]: \"planned\",\n } satisfies ProtoToOutput<FlowTimelineStatus, LifecycleFlowTimelineStatusValue>,\n} as const;\n\nexport const LifecycleRequestFeeStatusCodec = {\n protoToOutput: {\n [RequestFeeStatus.UNSPECIFIED]: \"unspecified\",\n [RequestFeeStatus.LOCKED]: \"locked\",\n [RequestFeeStatus.SETTLED]: \"settled\",\n [RequestFeeStatus.KEPT]: \"kept\",\n } satisfies Pro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