@terminal3/t3n-sdk 0.14.0 → 1.1.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/dist/index.d.ts CHANGED
@@ -745,6 +745,80 @@ declare class T3nClient {
745
745
  * @throws {ContractResponseError} when the response is not valid JSON
746
746
  */
747
747
  executeAndDecode<T = unknown>(payload: unknown, schema?: ContractResponseSchema<T>): Promise<T>;
748
+ /**
749
+ * Return the authenticated user's Ethereum address from their
750
+ * T3N-hosted per-user wallet, as a 0x-prefixed lowercase hex string.
751
+ * Returns `null` if the user has no wallet yet (pre-backfill edge
752
+ * case — `tee:user` has not yet been migrated for this DID).
753
+ *
754
+ * Backed by the `tee:user/get-self-eth-address` contract function,
755
+ * which delegates to the signing host's `get-user-eth-address`
756
+ * primitive (T3-TS-027 §7.1). The request carries no body; the
757
+ * authenticated user's DID is read from session context by the host.
758
+ *
759
+ * Requires the session to be Authenticated (same precondition as
760
+ * {@link execute}).
761
+ *
762
+ * @throws if unauthenticated, if the node rejects the action, or if
763
+ * the response is not a JSON string / `null`.
764
+ */
765
+ getSelfEthAddress(): Promise<string | null>;
766
+ /**
767
+ * Enumerate every wallet the authenticated user currently controls
768
+ * under T3-TS-028 multi-wallet custody.
769
+ *
770
+ * `primary` is the identity-bearing wallet — same address
771
+ * {@link getSelfEthAddress} returns, same address the host signs
772
+ * with under `sign-as-user`. `secondary` is an insertion-ordered
773
+ * list of archival wallets absorbed through prior
774
+ * {@link mergeProfiles} calls (most recent last); these are signable
775
+ * only via an explicit sign-with-wallet flow — never ambient.
776
+ *
777
+ * Backed by `tee:user/list-user-wallets` which delegates to the
778
+ * signing host's `list-user-wallets` primitive. See T3-TS-028 §7.1.
779
+ *
780
+ * @throws if unauthenticated, if the node rejects the action, or if
781
+ * the response shape is unexpected.
782
+ */
783
+ listUserWallets(): Promise<{
784
+ primary: string;
785
+ secondary: string[];
786
+ }>;
787
+ /**
788
+ * Return the ownership audit trail for a specific wallet address.
789
+ *
790
+ * The response is an array of `AuditEntry` objects (newest last)
791
+ * describing every DID that has owned the wallet: `Created` at DID
792
+ * creation, `MergedFrom { source_did }` for every merge that pulled
793
+ * this wallet onto a new owner, `Abandoned` if
794
+ * {@link removeUserWithWalletAbandonment} was called on the last
795
+ * owner. Public-safe data: DIDs + timestamps + reason codes only,
796
+ * no key material or PII. See T3-TS-028 §4.1.
797
+ *
798
+ * @param walletAddress 0x-prefixed 40-char hex Ethereum address.
799
+ * @throws if the node rejects the action or if the response is not
800
+ * a JSON array.
801
+ */
802
+ getWalletHistory(walletAddress: string): Promise<unknown[]>;
803
+ /**
804
+ * Remove the authenticated user's account AND explicitly abandon
805
+ * any wallets. Writes `Abandoned` audit rows to wallet history,
806
+ * clears the DID's wallet index, then runs the usual user-removal
807
+ * cleanup (profile, authenticators, VCs, attribution).
808
+ *
809
+ * `wallet_secrets[*]` is NOT deleted — key material stays preserved
810
+ * in the TEE but becomes unreachable from any DID. This path
811
+ * exists as an opt-in alternative to {@link removeUser}, which
812
+ * refuses when the DID owns wallets. Callers must sweep funds
813
+ * off-chain BEFORE calling this if they want to retain access —
814
+ * the host does not reconcile balances. See T3-TS-028 §6.2.
815
+ *
816
+ * Requires the session to be Authenticated (SelfOnly delegation).
817
+ *
818
+ * @throws if unauthenticated, if the node rejects the action, or if
819
+ * the response cannot be decoded.
820
+ */
821
+ removeUserWithWalletAbandonment(): Promise<unknown>;
748
822
  /**
749
823
  * The server-minted session ID once handshake has completed, or
750
824
  * `null` beforehand (pentest M-1 / MAT-983).