Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
542 changes: 500 additions & 42 deletions bindings/ios/bitkitcore.swift

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions bindings/ios/bitkitcoreFFI.h
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,11 @@ uint64_t uniffi_bitkitcore_fn_method_usdtwallet_balance(void*_Nonnull ptr
uint64_t uniffi_bitkitcore_fn_method_usdtwallet_check_recent_execution(void*_Nonnull ptr, RustBuffer id
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_BITKITCORE_FN_METHOD_USDTWALLET_CREATE_PAYMENT_PROOF
#define UNIFFI_FFIDEF_UNIFFI_BITKITCORE_FN_METHOD_USDTWALLET_CREATE_PAYMENT_PROOF
uint64_t uniffi_bitkitcore_fn_method_usdtwallet_create_payment_proof(void*_Nonnull ptr, RustBuffer transfer_id, RustBuffer binding, RustBuffer mnemonic, RustBuffer passphrase
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_BITKITCORE_FN_METHOD_USDTWALLET_HISTORY
#define UNIFFI_FFIDEF_UNIFFI_BITKITCORE_FN_METHOD_USDTWALLET_HISTORY
RustBuffer uniffi_bitkitcore_fn_method_usdtwallet_history(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
Expand Down Expand Up @@ -760,6 +765,11 @@ uint64_t uniffi_bitkitcore_fn_method_usdtwallet_send(void*_Nonnull ptr, RustBuff
uint64_t uniffi_bitkitcore_fn_method_usdtwallet_sync_history(void*_Nonnull ptr
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_BITKITCORE_FN_METHOD_USDTWALLET_VERIFY_PAYMENT_PROOF
#define UNIFFI_FFIDEF_UNIFFI_BITKITCORE_FN_METHOD_USDTWALLET_VERIFY_PAYMENT_PROOF
uint64_t uniffi_bitkitcore_fn_method_usdtwallet_verify_payment_proof(void*_Nonnull ptr, RustBuffer binding, RustBuffer proof
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_BITKITCORE_FN_FUNC_ACTIVITIES_FROM_JSON
#define UNIFFI_FFIDEF_UNIFFI_BITKITCORE_FN_FUNC_ACTIVITIES_FROM_JSON
RustBuffer uniffi_bitkitcore_fn_func_activities_from_json(RustBuffer json, RustCallStatus *_Nonnull out_status
Expand Down Expand Up @@ -3548,6 +3558,12 @@ uint16_t uniffi_bitkitcore_checksum_method_usdtwallet_balance(void
#define UNIFFI_FFIDEF_UNIFFI_BITKITCORE_CHECKSUM_METHOD_USDTWALLET_CHECK_RECENT_EXECUTION
uint16_t uniffi_bitkitcore_checksum_method_usdtwallet_check_recent_execution(void

);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_BITKITCORE_CHECKSUM_METHOD_USDTWALLET_CREATE_PAYMENT_PROOF
#define UNIFFI_FFIDEF_UNIFFI_BITKITCORE_CHECKSUM_METHOD_USDTWALLET_CREATE_PAYMENT_PROOF
uint16_t uniffi_bitkitcore_checksum_method_usdtwallet_create_payment_proof(void

);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_BITKITCORE_CHECKSUM_METHOD_USDTWALLET_HISTORY
Expand Down Expand Up @@ -3590,6 +3606,12 @@ uint16_t uniffi_bitkitcore_checksum_method_usdtwallet_send(void
#define UNIFFI_FFIDEF_UNIFFI_BITKITCORE_CHECKSUM_METHOD_USDTWALLET_SYNC_HISTORY
uint16_t uniffi_bitkitcore_checksum_method_usdtwallet_sync_history(void

);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_BITKITCORE_CHECKSUM_METHOD_USDTWALLET_VERIFY_PAYMENT_PROOF
#define UNIFFI_FFIDEF_UNIFFI_BITKITCORE_CHECKSUM_METHOD_USDTWALLET_VERIFY_PAYMENT_PROOF
uint16_t uniffi_bitkitcore_checksum_method_usdtwallet_verify_payment_proof(void

);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_BITKITCORE_CHECKSUM_CONSTRUCTOR_URDECODER_NEW
Expand Down
5 changes: 3 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,9 @@ pub use modules::seedqr::{decode_compact_seed_qr, decode_standard_seed_qr, SeedQ
pub use modules::usdt::{
usdt_address, usdt_format_amount, usdt_parse_amount, usdt_parse_payment_request, UsdtDeposit,
UsdtDepositAddress, UsdtDepositClient, UsdtDepositDetail, UsdtDepositNetwork, UsdtDepositOrder,
UsdtDepositPage, UsdtDestination, UsdtError, UsdtPaymentRequest, UsdtQuote, UsdtTransfer,
UsdtTransferStatus, UsdtWallet,
UsdtDepositPage, UsdtDestination, UsdtError, UsdtPaymentProof, UsdtPaymentProofBinding,
UsdtPaymentRequest, UsdtQuote, UsdtTransfer, UsdtTransferStatus, UsdtVerifiedPayment,
UsdtWallet,
};

use bip39::Mnemonic;
Expand Down
8 changes: 8 additions & 0 deletions src/modules/usdt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,11 @@ History returns at most 50 rows per page. Start with `offset = 0`, then use `nex
Refunds require a user-approved address on the source network and provider eligibility; an acknowledgment means queued, not paid. Never infer a refund address from the original sender, which may be an exchange hot wallet. Unconverted Tron refunds require provider assistance. Missing optional metadata must not hide pending deposits. Address recovery depends on the same Orchestra partner account and immutable account-derived reference; provider availability and address control remain trust dependencies.

Use a matching [bitkit-usdt-service](https://github.com/synonymdev/bitkit-usdt-service) deployment with `ORCHESTRA_API_KEY` and `ORCHESTRA_DEPOSIT_NETWORKS`. Enable each source only after funded delivery and provider recovery acceptance. See [Orchestra deposit addresses](https://docs.flashnet.xyz/orchestra/deposit-addresses).

## Request-bound payment proofs

`create_payment_proof` signs an executed direct Arbitrum payment using Paykit's `erc20-transfer-eip712` profile. The binding identifies the authenticated payer and payee, the app owning the accepted endpoint, request, reference, billing period and selected conversion quote. Persist this immutable binding and the quote/payment ID before `send`. Retry proof creation and delivery independently after execution; neither action sends funds. A pending payment returns `None`.

`verify_payment_proof` checks the exact receipt log, pinned chain/token/recipient, canonical successful receipt and payer signature. Ordinary ERC-20 senders are supported. The service must retain receipt status and each retained log's original `receiptLogIndex` before filtering. The returned `payment_id` must be claimed at most once across requests and billing periods; `transfer_id` remains the activity identity. Applications validate authenticated request terms, endpoint app ownership, quoted amounts and deadlines against the returned amount and block timestamp.

The proof binding and interoperability vectors follow [Paykit rc59](https://github.com/pubky/paykit-rs/blob/v0.1.0-rc59/specs/erc20-payment-proofs.md). Receipt positions are canonical decimal strings on the wire.
2 changes: 2 additions & 0 deletions src/modules/usdt/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ use thiserror::Error;

#[derive(Debug, Error, uniffi::Error)]
pub enum UsdtError {
#[error("The payment proof does not match this request or a successful USDT payment")]
InvalidPaymentProof,
#[error("Enter a valid USDT amount with at most six decimal places")]
InvalidAmount,
#[error("Enter a valid address for the selected network")]
Expand Down
Loading
Loading