@fluent.xyz/connect 0.1.4 → 0.2.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/README.md +20 -4
- package/dist/fluent-connect.css +1 -1
- package/dist/index.d.ts +333 -184
- package/dist/index.js +2101 -1039
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -495,53 +495,6 @@ declare const zerodevIntegrationSchema: z.ZodObject<{
|
|
|
495
495
|
type ZerodevIntegration = z.infer<typeof zerodevIntegrationSchema>;
|
|
496
496
|
|
|
497
497
|
declare const fluentChains: {
|
|
498
|
-
readonly devnet: {
|
|
499
|
-
id: string;
|
|
500
|
-
name: string;
|
|
501
|
-
chainId: number;
|
|
502
|
-
testnet: boolean;
|
|
503
|
-
nativeCurrency: {
|
|
504
|
-
symbol: string;
|
|
505
|
-
name: string;
|
|
506
|
-
decimals: number;
|
|
507
|
-
};
|
|
508
|
-
rpcUrls: {
|
|
509
|
-
default: {
|
|
510
|
-
http: string[];
|
|
511
|
-
webSocket?: string[] | undefined;
|
|
512
|
-
};
|
|
513
|
-
};
|
|
514
|
-
blockExplorers: {
|
|
515
|
-
default: {
|
|
516
|
-
name: string;
|
|
517
|
-
url: string;
|
|
518
|
-
};
|
|
519
|
-
};
|
|
520
|
-
infoURL: string;
|
|
521
|
-
faucets?: string[] | undefined;
|
|
522
|
-
parent?: {
|
|
523
|
-
type: "L2";
|
|
524
|
-
chainId: number;
|
|
525
|
-
bridgeUrl: string;
|
|
526
|
-
} | undefined;
|
|
527
|
-
contracts?: {
|
|
528
|
-
fluentBridge?: {
|
|
529
|
-
address: string;
|
|
530
|
-
implementation?: string | undefined;
|
|
531
|
-
} | undefined;
|
|
532
|
-
universalTokenFactory?: {
|
|
533
|
-
address: string;
|
|
534
|
-
implementation?: string | undefined;
|
|
535
|
-
} | undefined;
|
|
536
|
-
paymentGateway?: {
|
|
537
|
-
address: string;
|
|
538
|
-
implementation?: string | undefined;
|
|
539
|
-
} | undefined;
|
|
540
|
-
peggedTokenPrecompile?: {
|
|
541
|
-
address: string;
|
|
542
|
-
} | undefined;
|
|
543
|
-
} | undefined;
|
|
544
|
-
};
|
|
545
498
|
readonly testnet: {
|
|
546
499
|
id: string;
|
|
547
500
|
name: string;
|
|
@@ -728,7 +681,7 @@ declare function resolveL1Definition(definition: FluentChainDefinition): L1Chain
|
|
|
728
681
|
|
|
729
682
|
type FluentClientConfig = {
|
|
730
683
|
/** Fluent network to target. Defaults to `"testnet"`. */
|
|
731
|
-
network?: "
|
|
684
|
+
network?: "testnet" | "mainnet";
|
|
732
685
|
/** Custom RPC URL. Defaults to the selected chain's built-in RPC. */
|
|
733
686
|
rpcUrl?: string;
|
|
734
687
|
/** Advanced override: pass a viem chain directly (takes precedence over `network`). */
|
|
@@ -810,15 +763,19 @@ type FluentPermissionClient = {
|
|
|
810
763
|
};
|
|
811
764
|
declare function createFluentPermissionClient(config: FluentPermissionClientConfig): FluentPermissionClient;
|
|
812
765
|
|
|
813
|
-
type FluentNetworkName = "
|
|
766
|
+
type FluentNetworkName = "testnet" | "mainnet";
|
|
814
767
|
type FluentTokenDefinition = {
|
|
815
768
|
chainId: number;
|
|
816
|
-
|
|
769
|
+
address?: Address;
|
|
817
770
|
name: string;
|
|
771
|
+
symbol: string;
|
|
818
772
|
decimals: number;
|
|
819
|
-
|
|
820
|
-
|
|
773
|
+
logoURI?: string;
|
|
774
|
+
native?: true;
|
|
775
|
+
gasPriority?: number;
|
|
821
776
|
};
|
|
777
|
+
declare function isFluentNativeToken(token: Pick<FluentTokenDefinition, "native">): boolean;
|
|
778
|
+
declare function fluentTokenIdentity(token: Pick<FluentTokenDefinition, "chainId" | "address" | "native">): string;
|
|
822
779
|
type FluentTokenBalance = FluentTokenDefinition & {
|
|
823
780
|
raw: bigint | null;
|
|
824
781
|
formatted: string | null;
|
|
@@ -831,6 +788,8 @@ declare const fluentTestnetTokenDefaults: {
|
|
|
831
788
|
readonly symbol: "ETH";
|
|
832
789
|
readonly name: "Ether";
|
|
833
790
|
readonly decimals: 18;
|
|
791
|
+
readonly native: true;
|
|
792
|
+
readonly gasPriority: 3;
|
|
834
793
|
};
|
|
835
794
|
readonly USDnr: {
|
|
836
795
|
readonly chainId: 20994;
|
|
@@ -838,6 +797,7 @@ declare const fluentTestnetTokenDefaults: {
|
|
|
838
797
|
readonly name: "USDnr";
|
|
839
798
|
readonly decimals: 18;
|
|
840
799
|
readonly address: "0x092AE7564C6611a114C20C6df766B5B35A52334A";
|
|
800
|
+
readonly gasPriority: 2;
|
|
841
801
|
};
|
|
842
802
|
readonly BLEND: {
|
|
843
803
|
readonly chainId: 20994;
|
|
@@ -845,29 +805,17 @@ declare const fluentTestnetTokenDefaults: {
|
|
|
845
805
|
readonly name: "Mock Blend";
|
|
846
806
|
readonly decimals: 18;
|
|
847
807
|
readonly address: "0x83Fed707A8dDDC2535aE591CF19fB6C91D542D8E";
|
|
848
|
-
|
|
849
|
-
readonly USDC: {
|
|
850
|
-
readonly chainId: 20994;
|
|
851
|
-
readonly symbol: "USDC";
|
|
852
|
-
readonly name: "USD Coin";
|
|
853
|
-
readonly decimals: 6;
|
|
854
|
-
readonly address: "0xC8Ebbf08Cb2A87aB90cC8EeC34C721764b7755e9";
|
|
855
|
-
};
|
|
856
|
-
readonly USDT: {
|
|
857
|
-
readonly chainId: 20994;
|
|
858
|
-
readonly symbol: "USDT";
|
|
859
|
-
readonly name: "USDT";
|
|
860
|
-
readonly decimals: 6;
|
|
861
|
-
readonly address: "0xD80Ca465c268e76F0d897D44a35fC97Db75AB797";
|
|
808
|
+
readonly gasPriority: 1;
|
|
862
809
|
};
|
|
863
810
|
};
|
|
864
|
-
declare const fluentTestnetWidgetTokens: readonly FluentTokenDefinition[];
|
|
865
811
|
declare const fluentMainnetTokenDefaults: {
|
|
866
812
|
readonly ETH: {
|
|
867
813
|
readonly chainId: 25363;
|
|
868
814
|
readonly symbol: "ETH";
|
|
869
815
|
readonly name: "Ether";
|
|
870
816
|
readonly decimals: 18;
|
|
817
|
+
readonly native: true;
|
|
818
|
+
readonly gasPriority: 3;
|
|
871
819
|
};
|
|
872
820
|
readonly USDnr: {
|
|
873
821
|
readonly chainId: 25363;
|
|
@@ -875,6 +823,7 @@ declare const fluentMainnetTokenDefaults: {
|
|
|
875
823
|
readonly name: "USDnr";
|
|
876
824
|
readonly decimals: 18;
|
|
877
825
|
readonly address: "0xD48e565561416dE59DA1050ED70b8d75e8eF28f9";
|
|
826
|
+
readonly gasPriority: 2;
|
|
878
827
|
};
|
|
879
828
|
readonly BLEND: {
|
|
880
829
|
readonly chainId: 25363;
|
|
@@ -882,52 +831,17 @@ declare const fluentMainnetTokenDefaults: {
|
|
|
882
831
|
readonly name: "Fluent";
|
|
883
832
|
readonly decimals: 18;
|
|
884
833
|
readonly address: "0x1385b8f55a84f2bda13eed4099d29eae03d553b2";
|
|
834
|
+
readonly gasPriority: 1;
|
|
885
835
|
};
|
|
886
836
|
};
|
|
887
|
-
declare const fluentMainnetWidgetTokens: readonly FluentTokenDefinition[];
|
|
888
|
-
declare const fluentDevnetTokenDefaults: {
|
|
889
|
-
readonly ETH: {
|
|
890
|
-
readonly chainId: 20994;
|
|
891
|
-
readonly symbol: "ETH";
|
|
892
|
-
readonly name: "Ether";
|
|
893
|
-
readonly decimals: 18;
|
|
894
|
-
};
|
|
895
|
-
readonly USDnr: {
|
|
896
|
-
readonly chainId: 20994;
|
|
897
|
-
readonly symbol: "USDnr";
|
|
898
|
-
readonly name: "USDnr";
|
|
899
|
-
readonly decimals: 18;
|
|
900
|
-
readonly address: "0x092AE7564C6611a114C20C6df766B5B35A52334A";
|
|
901
|
-
};
|
|
902
|
-
readonly BLEND: {
|
|
903
|
-
readonly chainId: 20994;
|
|
904
|
-
readonly symbol: "BLEND";
|
|
905
|
-
readonly name: "Mock Blend";
|
|
906
|
-
readonly decimals: 18;
|
|
907
|
-
readonly address: "0x83Fed707A8dDDC2535aE591CF19fB6C91D542D8E";
|
|
908
|
-
};
|
|
909
|
-
readonly USDC: {
|
|
910
|
-
readonly chainId: 20994;
|
|
911
|
-
readonly symbol: "USDC";
|
|
912
|
-
readonly name: "USD Coin";
|
|
913
|
-
readonly decimals: 6;
|
|
914
|
-
readonly address: "0xC8Ebbf08Cb2A87aB90cC8EeC34C721764b7755e9";
|
|
915
|
-
};
|
|
916
|
-
readonly USDT: {
|
|
917
|
-
readonly chainId: 20994;
|
|
918
|
-
readonly symbol: "USDT";
|
|
919
|
-
readonly name: "USDT";
|
|
920
|
-
readonly decimals: 6;
|
|
921
|
-
readonly address: "0xD80Ca465c268e76F0d897D44a35fC97Db75AB797";
|
|
922
|
-
};
|
|
923
|
-
};
|
|
924
|
-
declare const fluentDevnetWidgetTokens: readonly FluentTokenDefinition[];
|
|
925
837
|
declare function getFluentTokenDefaultsForNetwork(network: FluentNetworkName): {
|
|
926
838
|
readonly ETH: {
|
|
927
839
|
readonly chainId: 20994;
|
|
928
840
|
readonly symbol: "ETH";
|
|
929
841
|
readonly name: "Ether";
|
|
930
842
|
readonly decimals: 18;
|
|
843
|
+
readonly native: true;
|
|
844
|
+
readonly gasPriority: 3;
|
|
931
845
|
};
|
|
932
846
|
readonly USDnr: {
|
|
933
847
|
readonly chainId: 20994;
|
|
@@ -935,6 +849,7 @@ declare function getFluentTokenDefaultsForNetwork(network: FluentNetworkName): {
|
|
|
935
849
|
readonly name: "USDnr";
|
|
936
850
|
readonly decimals: 18;
|
|
937
851
|
readonly address: "0x092AE7564C6611a114C20C6df766B5B35A52334A";
|
|
852
|
+
readonly gasPriority: 2;
|
|
938
853
|
};
|
|
939
854
|
readonly BLEND: {
|
|
940
855
|
readonly chainId: 20994;
|
|
@@ -942,20 +857,7 @@ declare function getFluentTokenDefaultsForNetwork(network: FluentNetworkName): {
|
|
|
942
857
|
readonly name: "Mock Blend";
|
|
943
858
|
readonly decimals: 18;
|
|
944
859
|
readonly address: "0x83Fed707A8dDDC2535aE591CF19fB6C91D542D8E";
|
|
945
|
-
|
|
946
|
-
readonly USDC: {
|
|
947
|
-
readonly chainId: 20994;
|
|
948
|
-
readonly symbol: "USDC";
|
|
949
|
-
readonly name: "USD Coin";
|
|
950
|
-
readonly decimals: 6;
|
|
951
|
-
readonly address: "0xC8Ebbf08Cb2A87aB90cC8EeC34C721764b7755e9";
|
|
952
|
-
};
|
|
953
|
-
readonly USDT: {
|
|
954
|
-
readonly chainId: 20994;
|
|
955
|
-
readonly symbol: "USDT";
|
|
956
|
-
readonly name: "USDT";
|
|
957
|
-
readonly decimals: 6;
|
|
958
|
-
readonly address: "0xD80Ca465c268e76F0d897D44a35fC97Db75AB797";
|
|
860
|
+
readonly gasPriority: 1;
|
|
959
861
|
};
|
|
960
862
|
} | {
|
|
961
863
|
readonly ETH: {
|
|
@@ -963,6 +865,8 @@ declare function getFluentTokenDefaultsForNetwork(network: FluentNetworkName): {
|
|
|
963
865
|
readonly symbol: "ETH";
|
|
964
866
|
readonly name: "Ether";
|
|
965
867
|
readonly decimals: 18;
|
|
868
|
+
readonly native: true;
|
|
869
|
+
readonly gasPriority: 3;
|
|
966
870
|
};
|
|
967
871
|
readonly USDnr: {
|
|
968
872
|
readonly chainId: 25363;
|
|
@@ -970,6 +874,7 @@ declare function getFluentTokenDefaultsForNetwork(network: FluentNetworkName): {
|
|
|
970
874
|
readonly name: "USDnr";
|
|
971
875
|
readonly decimals: 18;
|
|
972
876
|
readonly address: "0xD48e565561416dE59DA1050ED70b8d75e8eF28f9";
|
|
877
|
+
readonly gasPriority: 2;
|
|
973
878
|
};
|
|
974
879
|
readonly BLEND: {
|
|
975
880
|
readonly chainId: 25363;
|
|
@@ -977,8 +882,17 @@ declare function getFluentTokenDefaultsForNetwork(network: FluentNetworkName): {
|
|
|
977
882
|
readonly name: "Fluent";
|
|
978
883
|
readonly decimals: 18;
|
|
979
884
|
readonly address: "0x1385b8f55a84f2bda13eed4099d29eae03d553b2";
|
|
885
|
+
readonly gasPriority: 1;
|
|
980
886
|
};
|
|
981
887
|
};
|
|
888
|
+
declare function isFluentDefaultToken(token: Pick<FluentTokenDefinition, "chainId" | "address" | "native">): boolean;
|
|
889
|
+
/**
|
|
890
|
+
* The tokens in `tokens` that declare a `gasPriority`, cheapest priority first.
|
|
891
|
+
* The single spelling of "gas tokens, in order" — do not re-implement the
|
|
892
|
+
* filter and comparator elsewhere.
|
|
893
|
+
*/
|
|
894
|
+
declare function sortFluentGasTokens<T extends FluentTokenDefinition>(tokens: readonly T[]): readonly T[];
|
|
895
|
+
declare function getFluentDefaultWidgetDisplayTokens(network: FluentNetworkName): readonly FluentTokenDefinition[];
|
|
982
896
|
declare function getFluentDefaultWidgetGasTokens(network: FluentNetworkName): readonly FluentTokenDefinition[];
|
|
983
897
|
declare function readFluentTokenBalances<TTransport extends Transport = Transport, TChain extends Chain = Chain>(params: {
|
|
984
898
|
client: PublicClient<TTransport, TChain>;
|
|
@@ -986,6 +900,63 @@ declare function readFluentTokenBalances<TTransport extends Transport = Transpor
|
|
|
986
900
|
tokens: readonly FluentTokenDefinition[];
|
|
987
901
|
}): Promise<FluentTokenBalance[]>;
|
|
988
902
|
|
|
903
|
+
type FluentTokenMetadataResult = {
|
|
904
|
+
status: "ok";
|
|
905
|
+
token: FluentTokenDefinition;
|
|
906
|
+
} | {
|
|
907
|
+
status: "invalid-address";
|
|
908
|
+
} | {
|
|
909
|
+
status: "unreadable";
|
|
910
|
+
reason: string;
|
|
911
|
+
};
|
|
912
|
+
/**
|
|
913
|
+
* Read a token's own account of itself from its contract.
|
|
914
|
+
*
|
|
915
|
+
* Never trust user-typed metadata: the address is the only input, everything
|
|
916
|
+
* else comes from the chain. `decimals` is mandatory — without it every balance
|
|
917
|
+
* we render would be off by an unknown power of ten — so a contract that fails
|
|
918
|
+
* to answer it is rejected rather than defaulted to 18.
|
|
919
|
+
*
|
|
920
|
+
* Reads are issued individually rather than batched: the Fluent chains have no
|
|
921
|
+
* Multicall3 deployment configured, so `client.multicall` would throw.
|
|
922
|
+
*/
|
|
923
|
+
declare function readFluentTokenMetadata<TTransport extends Transport = Transport, TChain extends Chain = Chain>(params: {
|
|
924
|
+
client: PublicClient<TTransport, TChain>;
|
|
925
|
+
address: string;
|
|
926
|
+
chainId: number;
|
|
927
|
+
}): Promise<FluentTokenMetadataResult>;
|
|
928
|
+
|
|
929
|
+
/**
|
|
930
|
+
* Where a display token came from, ordered by how much we trust it. See
|
|
931
|
+
* docs/adr/0002-user-tokens-are-stored-locally-behind-an-interface.md.
|
|
932
|
+
*/
|
|
933
|
+
type FluentTokenSource = "default" | "integrator" | "user";
|
|
934
|
+
type FluentDisplayToken = FluentTokenDefinition & {
|
|
935
|
+
source: FluentTokenSource;
|
|
936
|
+
/** `fluentTokenIdentity` for this token, computed once here. */
|
|
937
|
+
identity: string;
|
|
938
|
+
};
|
|
939
|
+
/**
|
|
940
|
+
* Combine the three token sources into the list the widget renders.
|
|
941
|
+
*
|
|
942
|
+
* Duplicates are resolved by identity, never by symbol, and the more trusted
|
|
943
|
+
* source wins: a token a user added by hand is superseded once we ship it as
|
|
944
|
+
* one of ours, taking our name and logo with it. The user's stored record is only
|
|
945
|
+
* shadowed here — callers must not delete it, so that dropping a token from the
|
|
946
|
+
* default set brings their entry back rather than destroying it.
|
|
947
|
+
*/
|
|
948
|
+
declare function mergeFluentDisplayTokens(params: {
|
|
949
|
+
defaults: readonly FluentTokenDefinition[];
|
|
950
|
+
integrator?: readonly FluentTokenDefinition[];
|
|
951
|
+
user?: readonly FluentTokenDefinition[];
|
|
952
|
+
}): FluentDisplayToken[];
|
|
953
|
+
/**
|
|
954
|
+
* Symbols in `tokens` that more than one token claims. The widget shows the
|
|
955
|
+
* address on every row regardless, but a collision is worth calling out loudly:
|
|
956
|
+
* it is the cheap way to pass a worthless token off as a valuable one.
|
|
957
|
+
*/
|
|
958
|
+
declare function findFluentSymbolCollisions(tokens: readonly FluentTokenDefinition[]): Set<string>;
|
|
959
|
+
|
|
989
960
|
type FluentFamilyTier = "A" | "B" | "C" | "D";
|
|
990
961
|
type FluentFamilyType = "identity" | "tester" | "builder" | "influential" | "predictor";
|
|
991
962
|
type FluentFamily = {
|
|
@@ -1009,19 +980,16 @@ declare function createFluentFamiliesClient(config: FluentFamiliesClientConfig):
|
|
|
1009
980
|
declare function fluentDefinitionToViemChain(definition: FluentChainDefinition): Chain;
|
|
1010
981
|
declare function l1DefinitionToViemChain(definition: L1ChainDefinition): Chain;
|
|
1011
982
|
|
|
1012
|
-
/** Fluent Developer Preview (chain id 20993) */
|
|
1013
|
-
declare const fluentDevnet: viem.Chain;
|
|
1014
983
|
/** Fluent public testnet (chain id 20994) */
|
|
1015
984
|
declare const fluentTestnet: viem.Chain;
|
|
1016
985
|
/** Fluent mainnet (chain id 25363) */
|
|
1017
986
|
declare const fluentMainnet: viem.Chain;
|
|
1018
987
|
declare const fluent$1: {
|
|
1019
|
-
readonly devnet: viem.Chain;
|
|
1020
988
|
readonly testnet: viem.Chain;
|
|
1021
989
|
readonly mainnet: viem.Chain;
|
|
1022
990
|
};
|
|
1023
991
|
|
|
1024
|
-
type FluentNetwork = "
|
|
992
|
+
type FluentNetwork = "testnet" | "mainnet";
|
|
1025
993
|
type FluentInitializeConfig = {
|
|
1026
994
|
network: FluentNetwork;
|
|
1027
995
|
/**
|
|
@@ -1093,8 +1061,8 @@ declare const fluent: {
|
|
|
1093
1061
|
initialize: typeof initialize;
|
|
1094
1062
|
};
|
|
1095
1063
|
|
|
1096
|
-
type FluentWidgetNetwork = "
|
|
1097
|
-
declare function isFaucetNetwork(network: FluentWidgetNetwork): network is "testnet"
|
|
1064
|
+
type FluentWidgetNetwork = "testnet" | "mainnet";
|
|
1065
|
+
declare function isFaucetNetwork(network: FluentWidgetNetwork): network is "testnet";
|
|
1098
1066
|
declare function getFluentChainForNetwork(network: FluentWidgetNetwork): Chain;
|
|
1099
1067
|
declare function getFluentTokenDefaults(network: FluentWidgetNetwork): {
|
|
1100
1068
|
readonly ETH: {
|
|
@@ -1102,6 +1070,8 @@ declare function getFluentTokenDefaults(network: FluentWidgetNetwork): {
|
|
|
1102
1070
|
readonly symbol: "ETH";
|
|
1103
1071
|
readonly name: "Ether";
|
|
1104
1072
|
readonly decimals: 18;
|
|
1073
|
+
readonly native: true;
|
|
1074
|
+
readonly gasPriority: 3;
|
|
1105
1075
|
};
|
|
1106
1076
|
readonly USDnr: {
|
|
1107
1077
|
readonly chainId: 20994;
|
|
@@ -1109,6 +1079,7 @@ declare function getFluentTokenDefaults(network: FluentWidgetNetwork): {
|
|
|
1109
1079
|
readonly name: "USDnr";
|
|
1110
1080
|
readonly decimals: 18;
|
|
1111
1081
|
readonly address: "0x092AE7564C6611a114C20C6df766B5B35A52334A";
|
|
1082
|
+
readonly gasPriority: 2;
|
|
1112
1083
|
};
|
|
1113
1084
|
readonly BLEND: {
|
|
1114
1085
|
readonly chainId: 20994;
|
|
@@ -1116,20 +1087,7 @@ declare function getFluentTokenDefaults(network: FluentWidgetNetwork): {
|
|
|
1116
1087
|
readonly name: "Mock Blend";
|
|
1117
1088
|
readonly decimals: 18;
|
|
1118
1089
|
readonly address: "0x83Fed707A8dDDC2535aE591CF19fB6C91D542D8E";
|
|
1119
|
-
|
|
1120
|
-
readonly USDC: {
|
|
1121
|
-
readonly chainId: 20994;
|
|
1122
|
-
readonly symbol: "USDC";
|
|
1123
|
-
readonly name: "USD Coin";
|
|
1124
|
-
readonly decimals: 6;
|
|
1125
|
-
readonly address: "0xC8Ebbf08Cb2A87aB90cC8EeC34C721764b7755e9";
|
|
1126
|
-
};
|
|
1127
|
-
readonly USDT: {
|
|
1128
|
-
readonly chainId: 20994;
|
|
1129
|
-
readonly symbol: "USDT";
|
|
1130
|
-
readonly name: "USDT";
|
|
1131
|
-
readonly decimals: 6;
|
|
1132
|
-
readonly address: "0xD80Ca465c268e76F0d897D44a35fC97Db75AB797";
|
|
1090
|
+
readonly gasPriority: 1;
|
|
1133
1091
|
};
|
|
1134
1092
|
} | {
|
|
1135
1093
|
readonly ETH: {
|
|
@@ -1137,6 +1095,8 @@ declare function getFluentTokenDefaults(network: FluentWidgetNetwork): {
|
|
|
1137
1095
|
readonly symbol: "ETH";
|
|
1138
1096
|
readonly name: "Ether";
|
|
1139
1097
|
readonly decimals: 18;
|
|
1098
|
+
readonly native: true;
|
|
1099
|
+
readonly gasPriority: 3;
|
|
1140
1100
|
};
|
|
1141
1101
|
readonly USDnr: {
|
|
1142
1102
|
readonly chainId: 25363;
|
|
@@ -1144,6 +1104,7 @@ declare function getFluentTokenDefaults(network: FluentWidgetNetwork): {
|
|
|
1144
1104
|
readonly name: "USDnr";
|
|
1145
1105
|
readonly decimals: 18;
|
|
1146
1106
|
readonly address: "0xD48e565561416dE59DA1050ED70b8d75e8eF28f9";
|
|
1107
|
+
readonly gasPriority: 2;
|
|
1147
1108
|
};
|
|
1148
1109
|
readonly BLEND: {
|
|
1149
1110
|
readonly chainId: 25363;
|
|
@@ -1151,27 +1112,34 @@ declare function getFluentTokenDefaults(network: FluentWidgetNetwork): {
|
|
|
1151
1112
|
readonly name: "Fluent";
|
|
1152
1113
|
readonly decimals: 18;
|
|
1153
1114
|
readonly address: "0x1385b8f55a84f2bda13eed4099d29eae03d553b2";
|
|
1115
|
+
readonly gasPriority: 1;
|
|
1154
1116
|
};
|
|
1155
1117
|
};
|
|
1156
|
-
declare function getFluentDefaultGasTokens(network: FluentWidgetNetwork): readonly FluentTokenDefinition[];
|
|
1157
1118
|
declare function getFluentExplorerBaseUrl(network: FluentWidgetNetwork): string | undefined;
|
|
1158
1119
|
|
|
1159
|
-
|
|
1160
|
-
|
|
1120
|
+
/**
|
|
1121
|
+
* A symbol that can pay for gas. Deliberately `string`: which tokens are
|
|
1122
|
+
* payable is data on the token definitions now, not a fixed set of literals.
|
|
1123
|
+
*/
|
|
1124
|
+
type FluentGasTokenSymbol = string;
|
|
1161
1125
|
/**
|
|
1162
1126
|
* Resolve a gas token symbol to its ERC-20 paymaster address on `network`.
|
|
1163
|
-
* Returns `undefined` for native
|
|
1164
|
-
*
|
|
1127
|
+
* Returns `undefined` for the native currency, which pays gas directly, and for
|
|
1128
|
+
* any symbol that is not a gas token on this network.
|
|
1129
|
+
*
|
|
1130
|
+
* Matching is case-insensitive to agree with
|
|
1131
|
+
* `resolveFluentZeroDevErc20PaymasterToken`, which uppercases its keys — the two
|
|
1132
|
+
* feed the same approval call and must not disagree on `"usdnr"`.
|
|
1165
1133
|
*/
|
|
1166
|
-
declare function getFluentGasTokenAddress(symbol:
|
|
1134
|
+
declare function getFluentGasTokenAddress(symbol: FluentGasTokenSymbol, network: FluentWidgetNetwork): Address | undefined;
|
|
1167
1135
|
type FluentGasPaymentValueTier = "green" | "yellow" | "red" | "neutral" | "unknown";
|
|
1168
|
-
type FluentGasPaymentEthRates = Partial<Record<
|
|
1136
|
+
type FluentGasPaymentEthRates = Partial<Record<FluentGasTokenSymbol, string>>;
|
|
1169
1137
|
declare const FLUENT_GAS_PAYMENT_DEFAULT_ETH_RATES: {
|
|
1170
1138
|
readonly ETH: "1";
|
|
1171
1139
|
};
|
|
1172
1140
|
type FluentGasPaymentSelection = {
|
|
1173
1141
|
status: "ready";
|
|
1174
|
-
symbol:
|
|
1142
|
+
symbol: FluentGasTokenSymbol;
|
|
1175
1143
|
balance: FluentTokenBalance;
|
|
1176
1144
|
} | {
|
|
1177
1145
|
status: "bridge-required";
|
|
@@ -1186,7 +1154,18 @@ declare function selectFluentGasPaymentToken(params: {
|
|
|
1186
1154
|
balances: readonly FluentTokenBalance[];
|
|
1187
1155
|
loading?: boolean;
|
|
1188
1156
|
}): FluentGasPaymentSelection;
|
|
1189
|
-
|
|
1157
|
+
/**
|
|
1158
|
+
* Narrow a token list down to the gas tokens in it, in paymaster priority
|
|
1159
|
+
* order. Only gas selection may use this — running the whole display list
|
|
1160
|
+
* through it is what previously made the token list inextensible.
|
|
1161
|
+
*
|
|
1162
|
+
* `mergeFluentDisplayTokens` already strips `gasPriority` off untrusted
|
|
1163
|
+
* sources, so the `isFluentDefaultToken` filter here is the safety net for a
|
|
1164
|
+
* caller handed a raw list — an integrator prop, say — that never went through
|
|
1165
|
+
* the merge. It stays because this list decides what the paymaster is asked to
|
|
1166
|
+
* charge.
|
|
1167
|
+
*/
|
|
1168
|
+
declare function getFluentGasPaymentTokens<T extends FluentTokenDefinition>(tokens: readonly T[]): readonly T[];
|
|
1190
1169
|
declare function getFluentGasPaymentEthValue(params: {
|
|
1191
1170
|
balance: FluentTokenBalance | undefined;
|
|
1192
1171
|
ethValueByToken?: FluentGasPaymentEthRates;
|
|
@@ -1200,11 +1179,15 @@ declare function getFluentGasPaymentEthValue(params: {
|
|
|
1200
1179
|
tier: FluentGasPaymentValueTier;
|
|
1201
1180
|
};
|
|
1202
1181
|
declare function getFluentGasPaymentValueTier(ethValueWei: bigint): FluentGasPaymentValueTier;
|
|
1203
|
-
declare function formatFluentGasTokenBalance(balance: Pick<FluentTokenBalance, "raw" | "decimals" | "formatted">, maximumFractionDigits?: number): string | null;
|
|
1204
|
-
/** de-DE separators: `.` thousands, `,` decimals (same as portfolio total). */
|
|
1205
|
-
declare function formatFluentLocaleAmount(value: string | number, maximumFractionDigits?: number): string;
|
|
1206
1182
|
|
|
1207
1183
|
declare const FLUENT_WIDGET_SESSION_STORAGE_KEY = "fluent:widget:session:v1";
|
|
1184
|
+
/**
|
|
1185
|
+
* Tokens the user added by hand. Keyed per chain inside the payload, not per
|
|
1186
|
+
* account: one person holds both a Fluent ID and possibly an external wallet
|
|
1187
|
+
* and switches between them, and their list should not appear to vanish when
|
|
1188
|
+
* they disconnect one.
|
|
1189
|
+
*/
|
|
1190
|
+
declare const FLUENT_WIDGET_USER_TOKENS_STORAGE_KEY = "fluent:widget:tokens:v1";
|
|
1208
1191
|
|
|
1209
1192
|
declare const FLUENT_CONNECT_DEFAULT_ASSETS: {
|
|
1210
1193
|
readonly fluentLogo: string;
|
|
@@ -1214,7 +1197,7 @@ declare const FLUENT_CONNECT_DEFAULT_ASSETS: {
|
|
|
1214
1197
|
};
|
|
1215
1198
|
|
|
1216
1199
|
type FluentWidgetSession = FluentSession & {
|
|
1217
|
-
|
|
1200
|
+
partnerId?: string;
|
|
1218
1201
|
idToken: string;
|
|
1219
1202
|
wallet: Omit<FluentSession["wallet"], "smartAccountAddress"> & {
|
|
1220
1203
|
smartAccountAddress: `0x${string}`;
|
|
@@ -1231,7 +1214,16 @@ type FluentWidgetSession = FluentSession & {
|
|
|
1231
1214
|
};
|
|
1232
1215
|
type FluentWidgetAuthMode = "hosted" | "direct";
|
|
1233
1216
|
type FluentWidgetConfig = {
|
|
1234
|
-
|
|
1217
|
+
/** The partner's id (`partner_<32 hex>`) — the same string the console shows and the token's `aud` carries. */
|
|
1218
|
+
partnerId: string;
|
|
1219
|
+
/**
|
|
1220
|
+
* The Privy app client issued by Fluent for this partner. Login configuration, not
|
|
1221
|
+
* identity: it carries the allowed origins for Privy login, while `partnerId` is what
|
|
1222
|
+
* sponsorship, auth and analytics speak.
|
|
1223
|
+
*/
|
|
1224
|
+
privyClientId: string;
|
|
1225
|
+
/** Removed in the PartnerId cutover — the type exists only so the error names the fix. */
|
|
1226
|
+
clientId?: never;
|
|
1235
1227
|
network?: FluentWidgetNetwork;
|
|
1236
1228
|
appName?: string;
|
|
1237
1229
|
/**
|
|
@@ -1254,10 +1246,23 @@ type FluentWidgetConfig = {
|
|
|
1254
1246
|
campaign?: string;
|
|
1255
1247
|
/** Turns off all analytics: PostHog is never initialised, nothing is sent or stored. */
|
|
1256
1248
|
disableAnalytics?: boolean;
|
|
1249
|
+
/**
|
|
1250
|
+
* Point the widget at a sponsorship service other than the network default. Local
|
|
1251
|
+
* development only: the deployed URL is the one every real integration should use.
|
|
1252
|
+
*/
|
|
1253
|
+
sponsorshipUrl?: string;
|
|
1254
|
+
/**
|
|
1255
|
+
* `getAuthToken()` reuses a token until this many seconds before its `exp`, then fetches a
|
|
1256
|
+
* fresh one (the renewal-offset pattern: MSAL's `tokenRenewalOffsetSeconds`, Go oauth2's
|
|
1257
|
+
* `expiryDelta`). Default 30. Set 0 to always fetch — every call then costs a wallet
|
|
1258
|
+
* signature on the external-wallet path.
|
|
1259
|
+
*/
|
|
1260
|
+
authTokenRenewalOffsetSeconds?: number;
|
|
1257
1261
|
assets?: Partial<typeof FLUENT_CONNECT_DEFAULT_ASSETS>;
|
|
1258
1262
|
};
|
|
1259
1263
|
type ResolvedFluentWidgetConfig = {
|
|
1260
|
-
|
|
1264
|
+
partnerId: string;
|
|
1265
|
+
privyClientId: string;
|
|
1261
1266
|
network: FluentWidgetNetwork;
|
|
1262
1267
|
appName: string;
|
|
1263
1268
|
authMode: FluentWidgetAuthMode;
|
|
@@ -1265,6 +1270,8 @@ type ResolvedFluentWidgetConfig = {
|
|
|
1265
1270
|
faucetEndpoint: string;
|
|
1266
1271
|
eventsEndpoint: string;
|
|
1267
1272
|
analyticsHost: string;
|
|
1273
|
+
sponsorshipUrl: string;
|
|
1274
|
+
authTokenRenewalOffsetSeconds: number;
|
|
1268
1275
|
disableAnalytics: boolean;
|
|
1269
1276
|
publicApiUrl: string;
|
|
1270
1277
|
reputationSignupUrl: string;
|
|
@@ -1298,6 +1305,13 @@ declare function FluentWidgetNetworkProvider({ network, children, }: {
|
|
|
1298
1305
|
}): React.JSX.Element;
|
|
1299
1306
|
declare function useFluentWidgetNetwork(): FluentWidgetNetworkContextValue;
|
|
1300
1307
|
|
|
1308
|
+
/** Why an operation was not sponsored, when sponsorship was configured for it. */
|
|
1309
|
+
/**
|
|
1310
|
+
* Why an operation was not sponsored. `not_requested` is the only one that is not a failure:
|
|
1311
|
+
* the caller asked to pay its own gas, so the sponsorship paymaster was never contacted.
|
|
1312
|
+
*/
|
|
1313
|
+
type FluentSponsorshipReason = "no_token" | "denied" | "unauthorized" | "unreachable" | "not_requested";
|
|
1314
|
+
|
|
1301
1315
|
type KernelAccount = Awaited<ReturnType<typeof createKernelAccount>>;
|
|
1302
1316
|
type KernelClient = ReturnType<typeof createKernelAccountClient>;
|
|
1303
1317
|
type FluentZeroDevSignerMode = "prompt" | "silent";
|
|
@@ -1333,6 +1347,9 @@ type FluentZeroDevPermissionCall = {
|
|
|
1333
1347
|
declare function useFluentZeroDevAccount(hookOptions?: {
|
|
1334
1348
|
authorizeUrl?: string;
|
|
1335
1349
|
allowHostedSigner?: boolean;
|
|
1350
|
+
/** Partner id in the sponsorship path. Sponsorship is off unless both this and the URL are set. */
|
|
1351
|
+
partnerId?: string;
|
|
1352
|
+
sponsorshipUrl?: string;
|
|
1336
1353
|
authorizationSession?: {
|
|
1337
1354
|
expiresAt: number;
|
|
1338
1355
|
serializedPermissionAccount: string;
|
|
@@ -1362,7 +1379,12 @@ declare function useFluentZeroDevAccount(hookOptions?: {
|
|
|
1362
1379
|
data?: Hex;
|
|
1363
1380
|
value?: bigint;
|
|
1364
1381
|
}) => Promise<Hash>;
|
|
1365
|
-
sendCalls: (calls: FluentZeroDevCall[], options?: FluentBatchOperationExecuteOptions) => Promise<
|
|
1382
|
+
sendCalls: (calls: FluentZeroDevCall[], options?: FluentBatchOperationExecuteOptions) => Promise<{
|
|
1383
|
+
hash: Hash;
|
|
1384
|
+
sponsored: boolean;
|
|
1385
|
+
sponsorshipReason?: FluentSponsorshipReason;
|
|
1386
|
+
paymaster?: Address;
|
|
1387
|
+
}>;
|
|
1366
1388
|
refresh: () => Promise<FluentZeroDevKernel | null>;
|
|
1367
1389
|
};
|
|
1368
1390
|
declare function createFluentZeroDevPermissionSession(params: {
|
|
@@ -1485,9 +1507,23 @@ type FluentExecuteResult = {
|
|
|
1485
1507
|
hashes: Hash[];
|
|
1486
1508
|
/** True when all calls landed atomically (smart account), false for sequential EOA txs. */
|
|
1487
1509
|
atomic: boolean;
|
|
1510
|
+
/**
|
|
1511
|
+
* True when a partner's sponsorship paid the gas for this operation. Read back off the
|
|
1512
|
+
* settled UserOperation (which contract the EntryPoint charged), not from which client
|
|
1513
|
+
* we chose to send with: a refusal in the sponsorship proxy is a flat 403 and the
|
|
1514
|
+
* account silently pays its own gas, so an optimistic flag would report the failure
|
|
1515
|
+
* mode as a success. Always false for the EOA path, which has no paymaster.
|
|
1516
|
+
*/
|
|
1517
|
+
sponsored: boolean;
|
|
1518
|
+
/**
|
|
1519
|
+
* The paymaster that actually paid, zero address when the account paid itself.
|
|
1520
|
+
* Undefined when the bundler's receipt carried no paymaster field and no
|
|
1521
|
+
* `UserOperationEvent` could be decoded — i.e. `sponsored` is a guess, say so.
|
|
1522
|
+
*/
|
|
1523
|
+
paymaster?: Address;
|
|
1488
1524
|
};
|
|
1489
1525
|
type FluentWidgetGasPayment = {
|
|
1490
|
-
symbol:
|
|
1526
|
+
symbol: FluentGasTokenSymbol;
|
|
1491
1527
|
token?: Address;
|
|
1492
1528
|
decimals: number;
|
|
1493
1529
|
};
|
|
@@ -1517,9 +1553,24 @@ type FluentGasPayment = {
|
|
|
1517
1553
|
/**
|
|
1518
1554
|
* Gas token symbol. The widget resolves the ERC-20 address for the active
|
|
1519
1555
|
* network internally — callers never pass (or risk mistyping) an address.
|
|
1520
|
-
* `"ETH"` means native gas (no paymaster).
|
|
1556
|
+
* `"ETH"` means native gas (no ERC-20 paymaster).
|
|
1521
1557
|
*/
|
|
1522
|
-
symbol:
|
|
1558
|
+
symbol: FluentGasTokenSymbol;
|
|
1559
|
+
/**
|
|
1560
|
+
* Whether to ask the partner's sponsorship paymaster to pay for this operation.
|
|
1561
|
+
*
|
|
1562
|
+
* Defaults to `"auto"`, which is what every caller got before this option existed: try
|
|
1563
|
+
* sponsorship, and if the paymaster refuses, resend with the account paying its own gas.
|
|
1564
|
+
* `"never"` skips the paymaster outright, so the account pays from the first attempt and
|
|
1565
|
+
* the result reports `sponsorshipReason: "not_requested"`.
|
|
1566
|
+
*
|
|
1567
|
+
* The distinction is not cosmetic: under `"auto"` the two outcomes are indistinguishable
|
|
1568
|
+
* before the send and only the settled receipt separates them, so a caller that wants to
|
|
1569
|
+
* *demonstrate* unsponsored execution — or to keep a partner's budget untouched — has no
|
|
1570
|
+
* way to say so. Ignored when `symbol` names an ERC-20: that token's own paymaster pays,
|
|
1571
|
+
* and sponsorship is not in the picture.
|
|
1572
|
+
*/
|
|
1573
|
+
sponsorship?: "auto" | "never";
|
|
1523
1574
|
} & ({
|
|
1524
1575
|
includeApproval: true;
|
|
1525
1576
|
approveAmount: bigint;
|
|
@@ -1560,10 +1611,32 @@ type FluentExternalWalletState = {
|
|
|
1560
1611
|
address?: string;
|
|
1561
1612
|
chainId?: number;
|
|
1562
1613
|
walletClient?: WalletClient;
|
|
1614
|
+
/**
|
|
1615
|
+
* True while the wallet is being restored from a previous visit and neither
|
|
1616
|
+
* `connected` nor "no wallet" is known yet. Optional so hosts supplying their
|
|
1617
|
+
* own wallet state keep working; omitting it just means the widget reports
|
|
1618
|
+
* `"disconnected"` slightly earlier during a reload.
|
|
1619
|
+
*/
|
|
1620
|
+
reconnecting?: boolean;
|
|
1563
1621
|
open: () => void;
|
|
1564
1622
|
disconnect: () => void;
|
|
1565
1623
|
switchChain: (chainId: number) => Promise<void>;
|
|
1566
1624
|
};
|
|
1625
|
+
/**
|
|
1626
|
+
* Top-level connection state of the widget, safe to read on any render.
|
|
1627
|
+
*
|
|
1628
|
+
* The distinction that matters is `"restoring"` vs `"disconnected"`: a session
|
|
1629
|
+
* restored from a previous visit is not known synchronously, so a host that
|
|
1630
|
+
* treats "not connected yet" as "no account" will render a Connect button at
|
|
1631
|
+
* users who do have a live session. Wait out `"restoring"` instead.
|
|
1632
|
+
*
|
|
1633
|
+
* - `"restoring"` — a previous session may exist; nothing is decided yet.
|
|
1634
|
+
* - `"connecting"` — a sign-in the user started is in flight.
|
|
1635
|
+
* - `"connected"` — an account is available. Whether it can send transactions
|
|
1636
|
+
* *right now* is a separate question — see `widget.account.executionStatus`.
|
|
1637
|
+
* - `"disconnected"` — no account, and none is being restored or negotiated.
|
|
1638
|
+
*/
|
|
1639
|
+
type FluentWidgetStatus = "restoring" | "connecting" | "connected" | "disconnected";
|
|
1567
1640
|
|
|
1568
1641
|
type FluentWidgetRenderContext = {
|
|
1569
1642
|
session: FluentWidgetSession | null;
|
|
@@ -1572,8 +1645,28 @@ type FluentWidgetRenderContext = {
|
|
|
1572
1645
|
widget: FluentBatchApi;
|
|
1573
1646
|
openConnect: () => void;
|
|
1574
1647
|
openAccount: () => void;
|
|
1648
|
+
/**
|
|
1649
|
+
* Tear down the current session without going through the widget's account
|
|
1650
|
+
* menu — the same teardown that menu's "Disconnect" runs, for both hosted and
|
|
1651
|
+
* direct auth. Resolves once the session, the stored identity token and any
|
|
1652
|
+
* external wallet connection are cleared, so a host can await it before
|
|
1653
|
+
* resetting its own state.
|
|
1654
|
+
*/
|
|
1655
|
+
disconnect: () => Promise<void>;
|
|
1575
1656
|
hasConnectedAccount: boolean;
|
|
1576
|
-
/**
|
|
1657
|
+
/**
|
|
1658
|
+
* Connection state as a single value that is meaningful on every render —
|
|
1659
|
+
* including the first, before a stored session has been reconciled. Branch on
|
|
1660
|
+
* this rather than on `hasConnectedAccount` alone: `"restoring"` and
|
|
1661
|
+
* `"disconnected"` both have `hasConnectedAccount === false`, and treating
|
|
1662
|
+
* them alike shows a Connect button to users who are already signed in.
|
|
1663
|
+
*/
|
|
1664
|
+
status: FluentWidgetStatus;
|
|
1665
|
+
/**
|
|
1666
|
+
* True while a direct-auth smart account is being prepared after sign-in.
|
|
1667
|
+
* Equivalent to `status === "connecting"`; prefer `status`, which also covers
|
|
1668
|
+
* the restore-in-progress case this flag cannot express.
|
|
1669
|
+
*/
|
|
1577
1670
|
connecting: boolean;
|
|
1578
1671
|
/**
|
|
1579
1672
|
* Refetch the widget's on-chain balances. Transactions run through
|
|
@@ -1581,6 +1674,15 @@ type FluentWidgetRenderContext = {
|
|
|
1581
1674
|
* an external wallet client (outside the widget's execution path).
|
|
1582
1675
|
*/
|
|
1583
1676
|
refreshBalances: () => void;
|
|
1677
|
+
/**
|
|
1678
|
+
* A short-lived (5 min) Fluent-signed JWT for the connected user. Verify it on your backend
|
|
1679
|
+
* against `<iss>/.well-known/jwks.json` (ES256), checking `iss`, `aud` (= your partnerId) and
|
|
1680
|
+
* `exp`; `sub` is stable per user per app. Reused until `authTokenRenewalOffsetSeconds`
|
|
1681
|
+
* before `exp`. Direct auth only; throws `FluentAuthError`
|
|
1682
|
+
* (`code: "hosted_not_supported"`) in hosted mode. External wallets: EOAs and deployed
|
|
1683
|
+
* smart-contract wallets sign in; a not-yet-deployed smart account cannot (no ERC-6492).
|
|
1684
|
+
*/
|
|
1685
|
+
getAuthToken: () => Promise<string>;
|
|
1584
1686
|
};
|
|
1585
1687
|
type FluentWidgetConnectButtonRenderContext = {
|
|
1586
1688
|
connected: boolean;
|
|
@@ -1630,6 +1732,50 @@ declare function useFluentWidget(): FluentWidgetRenderContext;
|
|
|
1630
1732
|
/** Convenience hook returning just the widget API (`createBatchOp`, permissions, account…). */
|
|
1631
1733
|
declare function useWidget(): FluentBatchApi;
|
|
1632
1734
|
|
|
1735
|
+
/** Per chain. A ceiling, not a product limit — it stops storage being abused. */
|
|
1736
|
+
declare const FLUENT_USER_TOKEN_LIMIT = 50;
|
|
1737
|
+
type FluentUserTokenAddResult = {
|
|
1738
|
+
status: "added";
|
|
1739
|
+
} | {
|
|
1740
|
+
status: "already-present";
|
|
1741
|
+
} | {
|
|
1742
|
+
status: "at-capacity";
|
|
1743
|
+
limit: number;
|
|
1744
|
+
} | {
|
|
1745
|
+
status: "invalid";
|
|
1746
|
+
};
|
|
1747
|
+
/**
|
|
1748
|
+
* Persistence for tokens the end user added by hand.
|
|
1749
|
+
*/
|
|
1750
|
+
type UserTokenStore = {
|
|
1751
|
+
list(chainId: number): FluentTokenDefinition[];
|
|
1752
|
+
add(token: FluentTokenDefinition): FluentUserTokenAddResult;
|
|
1753
|
+
remove(token: Pick<FluentTokenDefinition, "chainId" | "address">): void;
|
|
1754
|
+
};
|
|
1755
|
+
/**
|
|
1756
|
+
* The browser-backed store. Falls back to an in-memory list when storage is
|
|
1757
|
+
* unavailable, so the UI keeps working for the current view instead of throwing.
|
|
1758
|
+
*/
|
|
1759
|
+
declare function createFluentUserTokenStore(options?: {
|
|
1760
|
+
storage?: StorageLike;
|
|
1761
|
+
key?: string;
|
|
1762
|
+
}): UserTokenStore;
|
|
1763
|
+
|
|
1764
|
+
declare function useFluentUserTokens(options?: {
|
|
1765
|
+
store?: UserTokenStore;
|
|
1766
|
+
}): {
|
|
1767
|
+
tokens: FluentTokenDefinition[];
|
|
1768
|
+
add: (token: FluentTokenDefinition) => FluentUserTokenAddResult;
|
|
1769
|
+
remove: (token: Pick<FluentTokenDefinition, "chainId" | "address">) => void;
|
|
1770
|
+
};
|
|
1771
|
+
|
|
1772
|
+
type FluentAuthErrorCode = "unknown_partner" | "partner_not_auth_enabled" | "origin_not_allowed" | "origin_missing" | "bad_request" | "nonce_unknown" | "nonce_used" | "nonce_expired" | "partner_mismatch" | "invalid_signature" | "signature_prefix_rejected" | "address_already_linked" | "invalid_privy_token" | "no_embedded_wallet" | "rate_limited" | "internal" | "hosted_not_supported" | "not_connected" | "privy_token_missing" | "origin_mismatch" | "request_failed";
|
|
1773
|
+
declare class FluentAuthError extends Error {
|
|
1774
|
+
readonly code: FluentAuthErrorCode;
|
|
1775
|
+
readonly status?: number | undefined;
|
|
1776
|
+
constructor(code: FluentAuthErrorCode, message: string, status?: number | undefined);
|
|
1777
|
+
}
|
|
1778
|
+
|
|
1633
1779
|
type FluentWidgetConnectButtonProps = {
|
|
1634
1780
|
connected: boolean;
|
|
1635
1781
|
/** Preparing the account after sign-in — disables the button and shows a spinner. */
|
|
@@ -1637,26 +1783,25 @@ type FluentWidgetConnectButtonProps = {
|
|
|
1637
1783
|
addressLabel?: string;
|
|
1638
1784
|
onClick: () => void;
|
|
1639
1785
|
className?: string;
|
|
1786
|
+
userLogoUrl?: string | null;
|
|
1640
1787
|
};
|
|
1641
1788
|
/** Default Fluent Connect / account button — place it anywhere in your layout. */
|
|
1642
|
-
declare function FluentWidgetConnectButton({ connected, pending, addressLabel, onClick, className, }: FluentWidgetConnectButtonProps): React.JSX.Element;
|
|
1789
|
+
declare function FluentWidgetConnectButton({ connected, pending, addressLabel, onClick, className, userLogoUrl, }: FluentWidgetConnectButtonProps): React.JSX.Element;
|
|
1643
1790
|
|
|
1644
1791
|
declare const FLUENT_ZERODEV_ERC20_PAYMASTER_QUERY = "selfFunded=true";
|
|
1645
1792
|
declare const FLUENT_ZERODEV_PAYMASTER_DEMO_RECIPIENT: "0x000000000000000000000000000000000000dEaD";
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
readonly symbol: "BLEND";
|
|
1651
|
-
};
|
|
1652
|
-
readonly USDNR: {
|
|
1653
|
-
readonly address: "0x092AE7564C6611a114C20C6df766B5B35A52334A" | "0xD48e565561416dE59DA1050ED70b8d75e8eF28f9";
|
|
1654
|
-
readonly decimals: 18;
|
|
1655
|
-
readonly symbol: "USDnr";
|
|
1656
|
-
};
|
|
1793
|
+
type FluentZeroDevErc20PaymasterTokenInfo = {
|
|
1794
|
+
address: Address;
|
|
1795
|
+
decimals: number;
|
|
1796
|
+
symbol: string;
|
|
1657
1797
|
};
|
|
1658
|
-
|
|
1659
|
-
|
|
1798
|
+
declare function getFluentZeroDevErc20PaymasterTokens(network?: FluentWidgetNetwork): Record<string, FluentZeroDevErc20PaymasterTokenInfo>;
|
|
1799
|
+
/**
|
|
1800
|
+
* Either a paymaster token symbol (see `getFluentZeroDevErc20PaymasterTokens`),
|
|
1801
|
+
* a bare token address, or an explicit token. Symbols are not a closed union:
|
|
1802
|
+
* which tokens are payable is data on the token definitions.
|
|
1803
|
+
*/
|
|
1804
|
+
type FluentZeroDevErc20PaymasterToken = string | {
|
|
1660
1805
|
address: Address;
|
|
1661
1806
|
symbol?: string;
|
|
1662
1807
|
};
|
|
@@ -1683,15 +1828,19 @@ declare function createFluentZeroDevErc20PaymasterRpcUrl(params?: {
|
|
|
1683
1828
|
chainId?: number;
|
|
1684
1829
|
projectId?: string;
|
|
1685
1830
|
}): string;
|
|
1831
|
+
/** The partner travels in the path, the user in the `Authorization` header. */
|
|
1832
|
+
declare function createFluentSponsorshipRpcUrl(params: {
|
|
1833
|
+
sponsorshipUrl: string;
|
|
1834
|
+
partnerId: string;
|
|
1835
|
+
}): string;
|
|
1836
|
+
declare function createFluentZeroDevSponsoredPaymaster(params: {
|
|
1837
|
+
chain: Chain;
|
|
1838
|
+
rpcUrl: string;
|
|
1839
|
+
accessToken: string;
|
|
1840
|
+
}): {
|
|
1841
|
+
getPaymasterData: (userOperation: GetPaymasterDataParameters) => Promise<_zerodev_sdk.SponsorUserOperationReturnType>;
|
|
1842
|
+
};
|
|
1686
1843
|
declare function resolveFluentZeroDevErc20PaymasterToken(token?: FluentZeroDevErc20PaymasterToken, network?: FluentWidgetNetwork): {
|
|
1687
|
-
readonly address: "0x83Fed707A8dDDC2535aE591CF19fB6C91D542D8E" | "0x1385b8f55a84f2bda13eed4099d29eae03d553b2";
|
|
1688
|
-
readonly decimals: 18;
|
|
1689
|
-
readonly symbol: "BLEND";
|
|
1690
|
-
} | {
|
|
1691
|
-
readonly address: "0x092AE7564C6611a114C20C6df766B5B35A52334A" | "0xD48e565561416dE59DA1050ED70b8d75e8eF28f9";
|
|
1692
|
-
readonly decimals: 18;
|
|
1693
|
-
readonly symbol: "USDnr";
|
|
1694
|
-
} | {
|
|
1695
1844
|
address: Address;
|
|
1696
1845
|
symbol?: string;
|
|
1697
1846
|
};
|
|
@@ -1799,7 +1948,7 @@ declare const Button: React.ForwardRefExoticComponent<Omit<ButtonProps, "ref"> &
|
|
|
1799
1948
|
|
|
1800
1949
|
declare function Dialog({ ...props }: Dialog$1.Root.Props): React.JSX.Element;
|
|
1801
1950
|
declare function DialogTrigger({ ...props }: Dialog$1.Trigger.Props): React.JSX.Element;
|
|
1802
|
-
declare function DialogPortal({ ...props }: Dialog$1.Portal.Props): React.JSX.Element;
|
|
1951
|
+
declare function DialogPortal({ container, ...props }: Dialog$1.Portal.Props): React.JSX.Element;
|
|
1803
1952
|
declare function DialogClose({ ...props }: Dialog$1.Close.Props): React.JSX.Element;
|
|
1804
1953
|
declare function DialogOverlay({ className, ...props }: Dialog$1.Backdrop.Props): React.JSX.Element;
|
|
1805
1954
|
declare function DialogContent({ className, children, showCloseButton, ...props }: Dialog$1.Popup.Props & {
|
|
@@ -1814,9 +1963,9 @@ declare function DialogDescription({ className, ...props }: Dialog$1.Description
|
|
|
1814
1963
|
|
|
1815
1964
|
declare function Separator({ className, orientation, ...props }: Separator$1.Props): React.JSX.Element;
|
|
1816
1965
|
|
|
1817
|
-
type IconName = "coinbase" | "walletConnect" | "metaMask" | "rabby" | "keplr" | "okx" | "fluent" | "x" | "arrow-right-s-line" | "arrow-left-right-line" | "arrow-up-s-fill" | "arrow-down-s-fill" | "plus" | "eth" | "usdnr" | "blend"
|
|
1966
|
+
type IconName = "coinbase" | "walletConnect" | "metaMask" | "rabby" | "keplr" | "okx" | "fluent" | "x" | "arrow-right-s-line" | "arrow-left-right-line" | "arrow-up-s-fill" | "arrow-down-s-fill" | "plus" | "eth" | "usdnr" | "blend";
|
|
1818
1967
|
declare function Icon({ name, className, ...props }: {
|
|
1819
1968
|
name: IconName;
|
|
1820
1969
|
} & SVGProps<SVGSVGElement>): React.JSX.Element;
|
|
1821
1970
|
|
|
1822
|
-
export { type AppDefinition, type BridgeAddresses, Button, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, FLUENT_CONNECT_DEFAULT_ASSETS, FLUENT_GAS_PAYMENT_DEFAULT_ETH_RATES,
|
|
1971
|
+
export { type AppDefinition, type BridgeAddresses, Button, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, FLUENT_CONNECT_DEFAULT_ASSETS, FLUENT_GAS_PAYMENT_DEFAULT_ETH_RATES, FLUENT_USER_TOKEN_LIMIT, FLUENT_WIDGET_SESSION_STORAGE_KEY, FLUENT_WIDGET_USER_TOKENS_STORAGE_KEY, FLUENT_ZERODEV_ERC20_PAYMASTER_QUERY, FLUENT_ZERODEV_PAYMASTER_DEMO_RECIPIENT, type FluentAccountCapabilities, type FluentAccountType, FluentAuthError, type FluentAuthErrorCode, type FluentBatchApi, type FluentBatchCallInput, type FluentBatchConfirmationMode, type FluentBatchOperation, type FluentBatchOperationExecuteOptions, type FluentBatchOperationExecutor, type FluentBatchOperationInput, type FluentBatchOperationReview, type FluentCallPermission, type FluentChainDefinition, type FluentClient, type FluentClientConfig, type FluentEncodedBatchCall, type FluentExecuteResult, type FluentExternalWalletState, type FluentFamilies, type FluentFamiliesClient, type FluentFamiliesClientConfig, type FluentFamily, type FluentFamilyTier, type FluentFamilyType, type FluentGasPayment, type FluentGasPaymentEthRates, type FluentGasPaymentSelection, type FluentGasPaymentValueTier, type FluentGasTokenSymbol, type FluentPermissionApi, type FluentPermissionArgConstraint, type FluentPermissionArgs, type FluentPermissionBatchPolicy, type FluentPermissionBatchPolicyInput, type FluentPermissionCallInput, type FluentPermissionCallPolicy, type FluentPermissionClient, type FluentPermissionClientConfig, type FluentPermissionGrant, type FluentPermissionGrantRequest, type FluentPermissionPolicy, type FluentPermissionPolicyBuilders, type FluentPermissionPreview, type FluentPermissionSession, type FluentPermissionSessionExecutor, type FluentPermissionSessionInput, type FluentPermissionStatus, type FluentSession, type FluentSpendPeriod, type FluentSpendPermission, type FluentSponsorshipReason, type FluentTokenBalance, type FluentTokenDefinition, type FluentUserTokenAddResult, FluentWidget, type FluentWidgetAccount, type FluentWidgetAuthMode, type FluentWidgetConfig, FluentWidgetConnectButton, type FluentWidgetConnectButtonProps, type FluentWidgetConnectButtonRenderContext, type FluentWidgetExecutionStatus, type FluentWidgetGasPayment, type FluentWidgetNetwork, FluentWidgetNetworkProvider, type FluentWidgetProps, type FluentWidgetRenderContext, type FluentWidgetSession, type FluentWidgetStatus, type FluentZeroDevErc20PaymasterToken, type FluentZeroDevErc20PaymasterTokenInfo, type FluentZeroDevKernel, type FluentZeroDevPaymasterDemoResult, type FluentZeroDevPaymasterKernel, type FluentZeroDevPermissionCall, type FluentZeroDevPermissionSession, type FluentZeroDevSignerMode, Icon, type IconName, type L1ChainDefinition, type ResolvedFluentWidgetConfig, Separator, type UserTokenStore, type ZerodevIntegration, buttonVariants, clearPrivyRecentLoginMethod, createFluentBatchOp, createFluentClient, createFluentFamiliesClient, createFluentPermissionApi, createFluentPermissionClient, createFluentPermissionPolicyBuilders, createFluentPermissionSession, createFluentSponsorshipRpcUrl, createFluentUserTokenStore, createFluentZeroDevErc20Paymaster, createFluentZeroDevErc20PaymasterApprovalCall, createFluentZeroDevErc20PaymasterClient, createFluentZeroDevErc20PaymasterRpcUrl, createFluentZeroDevPermissionSession, createFluentZeroDevRpcUrl, createFluentZeroDevSponsoredPaymaster, findFluentSymbolCollisions, fluent, apps as fluentApps, fluentBridgeAbi, fluent$1 as fluentChain, fluentChains, fluentDefinitionToViemChain, integrations as fluentIntegrations, l1Chains as fluentL1Chains, fluentMainnet, fluentMainnetTokenDefaults, fluentTestnet, fluentTestnetTokenDefaults, fluentTokenIdentity, fluentZeroDevChainIds, getApp, getContractAddressFromChain, getFluentChain, getFluentChainByChainId, getFluentChainForNetwork, getFluentDefaultWidgetDisplayTokens, getFluentDefaultWidgetGasTokens, getFluentExplorerBaseUrl, getFluentGasPaymentEthValue, getFluentGasPaymentTokens, getFluentGasPaymentValueTier, getFluentGasTokenAddress, getFluentTokenDefaults, getFluentTokenDefaultsForNetwork, getFluentZeroDevErc20PaymasterTokens, getL1Chain, getL1ForFluentChain, getZeroDevRpcUrl, getZerodevIntegration, isFaucetNetwork, isFluentDefaultToken, isFluentNativeToken, isFluentZeroDevChain, l1DefinitionToViemChain, mergeFluentDisplayTokens, normalizeFluentWidgetNetwork, readFluentTokenBalances, readFluentTokenMetadata, registryVersion, resolveBridgeAddresses, resolveFluentWidgetNetworkFromEnv, resolveFluentZeroDevErc20PaymasterToken, resolveL1Definition, selectFluentGasPaymentToken, sendFluentZeroDevErc20PaymasterDemo, sortFluentGasTokens, useFluentUserTokens, useFluentWidget, useFluentWidgetNetwork, useFluentZeroDevAccount, useWidget };
|