near_dart 0.2.2
near_dart: ^0.2.2 copied to clipboard
Complete NEAR Protocol SDK for Flutter/Dart. RPC client, wallet integration, and type-safe primitives.
0.2.2 #
- Docs: add an Android demo GIF (glass example app) to the README.
0.2.1 #
- Docs: "Verified on real devices & chains" — recorded Android-emulator + web evidence and the explorer tx for the on-chain demos.
- Example: full "NEAR Terminal" glassmorphism redesign of the reference app (animated dark glass, NEAR branding), verified on web and Android.
- Tests: updated testnet integration tests for real 2026 RPC provider behavior (FastNear empty key lists, TOO_LARGE_CONTRACT_STATE).
- dartdoc: fixed unresolved references (now 0 warnings).
0.2.0 #
The release that makes near_dart a full SDK: local signing and transaction broadcasting, validated byte-for-byte against near-api-js and end-to-end against real testnet.
Added #
-
Local transaction signing
KeyPairEd25519: generate, import (ed25519:extended secret or 32-byte seed), sign, verifysignTransaction(transaction, keyPair)→SignedTransactionwithhashandencodeToBase64()verifySignature()for standalone signature checks
-
Borsh serialization in the core (
BorshWriter,serializeTransaction,serializeSignedTransaction,sha256Hash), validated byte-for-byte against canonical near-api-js@7.2.0 vectors -
Transaction broadcasting:
NearRpcClient.sendTransaction(send_txwith configurableTxExecutionStatuswait levels) andsendTransactionAsync(broadcast_tx_async) -
High-level
AccountAPI:transfer(),callFunction(),signAndSendTransaction()— resolves nonce + block hash, signs and broadcasts in one call, with local nonce tracking for consecutive sends -
NEP-591 Global Contracts:
DeployGlobalContractAction,UseGlobalContractAction(by code hash or account ID) -
base58 encoding/decoding (
base58Encode,base58Decode) -
Transactionnow carries optionalpublicKey,nonce,blockHash(+copyWith) -
NearTokenhardening: exactparse()(decimal NEAR → yocto, no float),toNearString()(precise display, optional fixed decimals), and safe arithmetic (+,-with negative guard,</>/<=/>=,compareTo).toString()is now exact. -
Configurable RPC
timeout(default 30s): a stalled node yieldsRpcError.timeoutand triggers failover instead of hanging forever -
Real-transaction E2E test against testnet (faucet account → transfer → delete), wired into scheduled CI
-
Verified on every platform: VM, web (dart2js and dart2wasm) — local signing produces identical bytes on all
-
Real wallet sign-in (function-call key + local signing):
MyNearWalletAdapter.signIn()now generates an ed25519 function-call key pair, launches/loginwith its real public key (fixing a bug where the literal string'true'was sent) andmethodNamesas repeated query params;completeSignIn(callbackUri)verifies and promotes the provisioned key so subsequent contract calls are signed locally with no further redirects.keyFor(accountId)exposes the stored key for use withAccount. -
KeyStoreabstraction (KeyStore,InMemoryKeyStore): pure-Dart key persistence interface mirroring near-api-js; the adapter'sgetAccounts/isSignedIn/signOutread from it so a connection survives app restarts. Provide a persistent implementation (see the example'sSharedPrefsKeyStore) to survive the web sign-in redirect. -
Example app: redirect-based Connect Wallet flow verified end-to-end on web and Android (incl.
nearsdk://deep-link callback), native deep link config for Android/iOS, and multi-platform CI builds (Android/iOS/web)
Changed #
- RPC defaults moved to FastNear (
https://free.rpc.fastnear.com/https://test.rpc.fastnear.com): the*.near.orgendpoints were deprecated in 2025 and are severely rate limited; they remain as automatic fallbacks MyNearWalletAdapter.buildSignInUrlnow requires thepublicKeybeing provisioned;buildTransactionUrlrequires fully-formed transactions (publicKey/nonce/blockHash) and encodes them as base64 Borsh (comma-separated), the format MyNearWallet actually consumes- Removed
MyNearWalletAdapter.setAccount(restore connections through a persistentKeyStoreinstead) and theed25519:placeholderstub NearRpcClientnow supportsfallbackUrlswith transport-level failover (network errors, HTTP 429/5xx); JSON-RPC errors never fail overTransactionResponseand transaction status types are now exported- Removed the
betanetfactory (network was shut down)
0.1.0 #
Initial release of near_dart SDK.
Features #
-
RPC Client
- Multi-network support: Mainnet, Testnet, or custom RPC
- Methods:
status,block,viewAccount,viewAccessKey,callFunction,validators,gasPrice - Type-safe responses with sealed classes
-
Type-Safe Primitives
AccountIdwith validationNearTokenfor handling 24-decimal precisionPublicKeywith key type detectionCryptoHashfor block/transaction hashesBlockReferencefor querying at specific points
-
Wallet Integration
WalletAdapterinterface for wallet integrationsMyNearWalletAdapterfor deep link wallet connectionWalletConnectAdapterBasefor WalletConnect 2.0
-
Transaction Building
- All action types:
CreateAccount,DeployContract,FunctionCall,Transfer,Stake,AddKey,DeleteKey,DeleteAccount - Multi-action transaction support
- NEP-413 message signing
- All action types:
-
Platform Support
- iOS, Android, Web, Desktop
- Pure Dart with no platform-specific dependencies