@zubari/sdk 0.1.31 → 0.2.1
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/{WalletManager-Du9oKIeu.d.mts → WalletManager-DKPzfA74.d.mts} +61 -144
- package/dist/{WalletManager-Ry-PqMUp.d.ts → WalletManager-IOHFgvpT.d.ts} +61 -144
- package/dist/{index-BK6MH30q.d.ts → index-BCX8EYxv.d.ts} +57 -3
- package/dist/{index-6y3uV1Sh.d.mts → index-Be7yLGAO.d.mts} +31 -5
- package/dist/{index-6y3uV1Sh.d.ts → index-Be7yLGAO.d.ts} +31 -5
- package/dist/{index-yA3Aorn-.d.mts → index-BrLMTY29.d.mts} +57 -3
- package/dist/index.d.mts +4 -5
- package/dist/index.d.ts +4 -5
- package/dist/index.js +120 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +117 -9
- package/dist/index.mjs.map +1 -1
- package/dist/protocols/index.d.mts +33 -3
- package/dist/protocols/index.d.ts +33 -3
- package/dist/protocols/index.js +117 -8
- package/dist/protocols/index.js.map +1 -1
- package/dist/protocols/index.mjs +117 -8
- package/dist/protocols/index.mjs.map +1 -1
- package/dist/react/index.d.mts +4 -5
- package/dist/react/index.d.ts +4 -5
- package/dist/services/index.d.mts +1 -1
- package/dist/services/index.d.ts +1 -1
- package/dist/services/index.js.map +1 -1
- package/dist/services/index.mjs.map +1 -1
- package/dist/wallet/index.d.mts +4 -5
- package/dist/wallet/index.d.ts +4 -5
- package/dist/wallet/index.js.map +1 -1
- package/dist/wallet/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Z as ZubariWalletConfig, N as NetworkType, A as Account, a as NetworkBalance, S as SendParams, b as TxResult } from './index-
|
|
2
|
-
import './WalletManager-
|
|
1
|
+
import { Z as ZubariWalletConfig, N as NetworkType, A as Account, a as NetworkBalance, S as SendParams, b as TxResult } from './index-Be7yLGAO.js';
|
|
2
|
+
import './WalletManager-IOHFgvpT.js';
|
|
3
3
|
|
|
4
4
|
interface ContractAddresses {
|
|
5
5
|
registry: string;
|
|
@@ -15,6 +15,7 @@ interface ContractAddresses {
|
|
|
15
15
|
usdt: string;
|
|
16
16
|
weth: string;
|
|
17
17
|
}
|
|
18
|
+
declare const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
18
19
|
declare const ZUBARI_CONTRACTS: Record<'testnet' | 'mainnet', ContractAddresses>;
|
|
19
20
|
declare const PLATFORM_CONFIG: {
|
|
20
21
|
readonly tipFeeBps: 300;
|
|
@@ -23,6 +24,59 @@ declare const PLATFORM_CONFIG: {
|
|
|
23
24
|
readonly voucherValiditySecs: number;
|
|
24
25
|
readonly swapDeadlineSecs: number;
|
|
25
26
|
};
|
|
27
|
+
declare const NFT_VOUCHER_DOMAIN: {
|
|
28
|
+
readonly name: "ZubariNFT";
|
|
29
|
+
readonly version: "1";
|
|
30
|
+
};
|
|
31
|
+
declare const NFT_VOUCHER_TYPES: {
|
|
32
|
+
readonly NFTVoucher: readonly [{
|
|
33
|
+
readonly name: "tokenId";
|
|
34
|
+
readonly type: "bytes32";
|
|
35
|
+
}, {
|
|
36
|
+
readonly name: "uri";
|
|
37
|
+
readonly type: "string";
|
|
38
|
+
}, {
|
|
39
|
+
readonly name: "creator";
|
|
40
|
+
readonly type: "address";
|
|
41
|
+
}, {
|
|
42
|
+
readonly name: "royaltyBps";
|
|
43
|
+
readonly type: "uint256";
|
|
44
|
+
}, {
|
|
45
|
+
readonly name: "deadline";
|
|
46
|
+
readonly type: "uint256";
|
|
47
|
+
}, {
|
|
48
|
+
readonly name: "price";
|
|
49
|
+
readonly type: "uint256";
|
|
50
|
+
}, {
|
|
51
|
+
readonly name: "currency";
|
|
52
|
+
readonly type: "address";
|
|
53
|
+
}, {
|
|
54
|
+
readonly name: "nonce";
|
|
55
|
+
readonly type: "uint256";
|
|
56
|
+
}, {
|
|
57
|
+
readonly name: "contentHash";
|
|
58
|
+
readonly type: "bytes32";
|
|
59
|
+
}, {
|
|
60
|
+
readonly name: "userId";
|
|
61
|
+
readonly type: "bytes32";
|
|
62
|
+
}, {
|
|
63
|
+
readonly name: "watermarkTimestamp";
|
|
64
|
+
readonly type: "uint256";
|
|
65
|
+
}, {
|
|
66
|
+
readonly name: "sessionId";
|
|
67
|
+
readonly type: "bytes32";
|
|
68
|
+
}];
|
|
69
|
+
};
|
|
70
|
+
declare const CURRENCY_ADDRESSES: {
|
|
71
|
+
readonly testnet: {
|
|
72
|
+
readonly ETH: "0x0000000000000000000000000000000000000000";
|
|
73
|
+
readonly USDT: "0xaA8E23Fb1079EA71e0a56F48a2aA51851D8433D0";
|
|
74
|
+
};
|
|
75
|
+
readonly mainnet: {
|
|
76
|
+
readonly ETH: "0x0000000000000000000000000000000000000000";
|
|
77
|
+
readonly USDT: "0xdAC17F958D2ee523a2206206994597C13D831ec7";
|
|
78
|
+
};
|
|
79
|
+
};
|
|
26
80
|
declare function getContractAddresses(network: 'testnet' | 'mainnet'): ContractAddresses;
|
|
27
81
|
|
|
28
82
|
/**
|
|
@@ -133,4 +187,4 @@ declare class ZubariWallet {
|
|
|
133
187
|
getContractAddresses(): ContractAddresses;
|
|
134
188
|
}
|
|
135
189
|
|
|
136
|
-
export { PLATFORM_CONFIG as P, ZubariWallet as Z, ZUBARI_CONTRACTS as a, getContractAddresses as g };
|
|
190
|
+
export { CURRENCY_ADDRESSES as C, NFT_VOUCHER_DOMAIN as N, PLATFORM_CONFIG as P, ZubariWallet as Z, ZUBARI_CONTRACTS as a, ZERO_ADDRESS as b, NFT_VOUCHER_TYPES as c, getContractAddresses as g };
|
|
@@ -46,16 +46,35 @@ interface Account {
|
|
|
46
46
|
publicKey: string;
|
|
47
47
|
derivationPath: string;
|
|
48
48
|
}
|
|
49
|
+
type NFTCurrency = 'ETH' | 'USDT';
|
|
50
|
+
interface NFTAttribute {
|
|
51
|
+
trait_type: string;
|
|
52
|
+
value: string | number;
|
|
53
|
+
display_type?: 'boost_number' | 'boost_percentage' | 'number' | 'date';
|
|
54
|
+
max_value?: number;
|
|
55
|
+
}
|
|
49
56
|
interface NFTMetadata {
|
|
50
57
|
name: string;
|
|
51
58
|
description: string;
|
|
52
59
|
image: string;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}>;
|
|
60
|
+
externalUrl?: string;
|
|
61
|
+
animationUrl?: string;
|
|
62
|
+
attributes?: NFTAttribute[];
|
|
57
63
|
royaltyBps: number;
|
|
58
64
|
}
|
|
65
|
+
interface WatermarkingData {
|
|
66
|
+
contentHash: string;
|
|
67
|
+
userId: string;
|
|
68
|
+
sessionId: string;
|
|
69
|
+
}
|
|
70
|
+
interface CreateVoucherParams {
|
|
71
|
+
metadata: NFTMetadata;
|
|
72
|
+
creatorAddress: string;
|
|
73
|
+
price: string;
|
|
74
|
+
currency: NFTCurrency;
|
|
75
|
+
nonce?: number;
|
|
76
|
+
watermarking?: WatermarkingData;
|
|
77
|
+
}
|
|
59
78
|
interface LazyMintVoucher {
|
|
60
79
|
tokenId: string;
|
|
61
80
|
uri: string;
|
|
@@ -63,6 +82,13 @@ interface LazyMintVoucher {
|
|
|
63
82
|
royaltyBps: number;
|
|
64
83
|
deadline: number;
|
|
65
84
|
signature: string;
|
|
85
|
+
price: string;
|
|
86
|
+
currency: string;
|
|
87
|
+
nonce: number;
|
|
88
|
+
contentHash?: string;
|
|
89
|
+
userId?: string;
|
|
90
|
+
watermarkTimestamp?: number;
|
|
91
|
+
sessionId?: string;
|
|
66
92
|
}
|
|
67
93
|
interface NFT {
|
|
68
94
|
tokenId: string;
|
|
@@ -179,4 +205,4 @@ declare class ZubariError extends Error {
|
|
|
179
205
|
constructor(code: ZubariErrorCode, message: string, details?: unknown | undefined);
|
|
180
206
|
}
|
|
181
207
|
|
|
182
|
-
export { type Account as A, type BuyParams as B, type EarningsBreakdown as E, type LazyMintVoucher as L, type NetworkType as N, type RevenueSplit as R, type SendParams as S, type TokenBalance as T, type ZubariWalletConfig as Z, type NetworkBalance as a, type TxResult as b, type
|
|
208
|
+
export { type Account as A, type BuyParams as B, type CreateVoucherParams as C, type EarningsBreakdown as E, type LazyMintVoucher as L, type NetworkType as N, type RevenueSplit as R, type SendParams as S, type TokenBalance as T, type WatermarkingData as W, type ZubariWalletConfig as Z, type NetworkBalance as a, type TxResult as b, type NFTCurrency as c, type NFTAttribute as d, type NFTMetadata as e, type NFT as f, type ListingParams as g, type Listing as h, type TipData as i, type TipResult as j, type TipStats as k, type Tip as l, type SubscriptionPlan as m, type Subscription as n, type SwapQuote as o, type SwapParams as p, type ZubariErrorCode as q, ZubariError as r };
|
|
@@ -46,16 +46,35 @@ interface Account {
|
|
|
46
46
|
publicKey: string;
|
|
47
47
|
derivationPath: string;
|
|
48
48
|
}
|
|
49
|
+
type NFTCurrency = 'ETH' | 'USDT';
|
|
50
|
+
interface NFTAttribute {
|
|
51
|
+
trait_type: string;
|
|
52
|
+
value: string | number;
|
|
53
|
+
display_type?: 'boost_number' | 'boost_percentage' | 'number' | 'date';
|
|
54
|
+
max_value?: number;
|
|
55
|
+
}
|
|
49
56
|
interface NFTMetadata {
|
|
50
57
|
name: string;
|
|
51
58
|
description: string;
|
|
52
59
|
image: string;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}>;
|
|
60
|
+
externalUrl?: string;
|
|
61
|
+
animationUrl?: string;
|
|
62
|
+
attributes?: NFTAttribute[];
|
|
57
63
|
royaltyBps: number;
|
|
58
64
|
}
|
|
65
|
+
interface WatermarkingData {
|
|
66
|
+
contentHash: string;
|
|
67
|
+
userId: string;
|
|
68
|
+
sessionId: string;
|
|
69
|
+
}
|
|
70
|
+
interface CreateVoucherParams {
|
|
71
|
+
metadata: NFTMetadata;
|
|
72
|
+
creatorAddress: string;
|
|
73
|
+
price: string;
|
|
74
|
+
currency: NFTCurrency;
|
|
75
|
+
nonce?: number;
|
|
76
|
+
watermarking?: WatermarkingData;
|
|
77
|
+
}
|
|
59
78
|
interface LazyMintVoucher {
|
|
60
79
|
tokenId: string;
|
|
61
80
|
uri: string;
|
|
@@ -63,6 +82,13 @@ interface LazyMintVoucher {
|
|
|
63
82
|
royaltyBps: number;
|
|
64
83
|
deadline: number;
|
|
65
84
|
signature: string;
|
|
85
|
+
price: string;
|
|
86
|
+
currency: string;
|
|
87
|
+
nonce: number;
|
|
88
|
+
contentHash?: string;
|
|
89
|
+
userId?: string;
|
|
90
|
+
watermarkTimestamp?: number;
|
|
91
|
+
sessionId?: string;
|
|
66
92
|
}
|
|
67
93
|
interface NFT {
|
|
68
94
|
tokenId: string;
|
|
@@ -179,4 +205,4 @@ declare class ZubariError extends Error {
|
|
|
179
205
|
constructor(code: ZubariErrorCode, message: string, details?: unknown | undefined);
|
|
180
206
|
}
|
|
181
207
|
|
|
182
|
-
export { type Account as A, type BuyParams as B, type EarningsBreakdown as E, type LazyMintVoucher as L, type NetworkType as N, type RevenueSplit as R, type SendParams as S, type TokenBalance as T, type ZubariWalletConfig as Z, type NetworkBalance as a, type TxResult as b, type
|
|
208
|
+
export { type Account as A, type BuyParams as B, type CreateVoucherParams as C, type EarningsBreakdown as E, type LazyMintVoucher as L, type NetworkType as N, type RevenueSplit as R, type SendParams as S, type TokenBalance as T, type WatermarkingData as W, type ZubariWalletConfig as Z, type NetworkBalance as a, type TxResult as b, type NFTCurrency as c, type NFTAttribute as d, type NFTMetadata as e, type NFT as f, type ListingParams as g, type Listing as h, type TipData as i, type TipResult as j, type TipStats as k, type Tip as l, type SubscriptionPlan as m, type Subscription as n, type SwapQuote as o, type SwapParams as p, type ZubariErrorCode as q, ZubariError as r };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Z as ZubariWalletConfig, N as NetworkType, A as Account, a as NetworkBalance, S as SendParams, b as TxResult } from './index-
|
|
2
|
-
import './WalletManager-
|
|
1
|
+
import { Z as ZubariWalletConfig, N as NetworkType, A as Account, a as NetworkBalance, S as SendParams, b as TxResult } from './index-Be7yLGAO.mjs';
|
|
2
|
+
import './WalletManager-DKPzfA74.mjs';
|
|
3
3
|
|
|
4
4
|
interface ContractAddresses {
|
|
5
5
|
registry: string;
|
|
@@ -15,6 +15,7 @@ interface ContractAddresses {
|
|
|
15
15
|
usdt: string;
|
|
16
16
|
weth: string;
|
|
17
17
|
}
|
|
18
|
+
declare const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
18
19
|
declare const ZUBARI_CONTRACTS: Record<'testnet' | 'mainnet', ContractAddresses>;
|
|
19
20
|
declare const PLATFORM_CONFIG: {
|
|
20
21
|
readonly tipFeeBps: 300;
|
|
@@ -23,6 +24,59 @@ declare const PLATFORM_CONFIG: {
|
|
|
23
24
|
readonly voucherValiditySecs: number;
|
|
24
25
|
readonly swapDeadlineSecs: number;
|
|
25
26
|
};
|
|
27
|
+
declare const NFT_VOUCHER_DOMAIN: {
|
|
28
|
+
readonly name: "ZubariNFT";
|
|
29
|
+
readonly version: "1";
|
|
30
|
+
};
|
|
31
|
+
declare const NFT_VOUCHER_TYPES: {
|
|
32
|
+
readonly NFTVoucher: readonly [{
|
|
33
|
+
readonly name: "tokenId";
|
|
34
|
+
readonly type: "bytes32";
|
|
35
|
+
}, {
|
|
36
|
+
readonly name: "uri";
|
|
37
|
+
readonly type: "string";
|
|
38
|
+
}, {
|
|
39
|
+
readonly name: "creator";
|
|
40
|
+
readonly type: "address";
|
|
41
|
+
}, {
|
|
42
|
+
readonly name: "royaltyBps";
|
|
43
|
+
readonly type: "uint256";
|
|
44
|
+
}, {
|
|
45
|
+
readonly name: "deadline";
|
|
46
|
+
readonly type: "uint256";
|
|
47
|
+
}, {
|
|
48
|
+
readonly name: "price";
|
|
49
|
+
readonly type: "uint256";
|
|
50
|
+
}, {
|
|
51
|
+
readonly name: "currency";
|
|
52
|
+
readonly type: "address";
|
|
53
|
+
}, {
|
|
54
|
+
readonly name: "nonce";
|
|
55
|
+
readonly type: "uint256";
|
|
56
|
+
}, {
|
|
57
|
+
readonly name: "contentHash";
|
|
58
|
+
readonly type: "bytes32";
|
|
59
|
+
}, {
|
|
60
|
+
readonly name: "userId";
|
|
61
|
+
readonly type: "bytes32";
|
|
62
|
+
}, {
|
|
63
|
+
readonly name: "watermarkTimestamp";
|
|
64
|
+
readonly type: "uint256";
|
|
65
|
+
}, {
|
|
66
|
+
readonly name: "sessionId";
|
|
67
|
+
readonly type: "bytes32";
|
|
68
|
+
}];
|
|
69
|
+
};
|
|
70
|
+
declare const CURRENCY_ADDRESSES: {
|
|
71
|
+
readonly testnet: {
|
|
72
|
+
readonly ETH: "0x0000000000000000000000000000000000000000";
|
|
73
|
+
readonly USDT: "0xaA8E23Fb1079EA71e0a56F48a2aA51851D8433D0";
|
|
74
|
+
};
|
|
75
|
+
readonly mainnet: {
|
|
76
|
+
readonly ETH: "0x0000000000000000000000000000000000000000";
|
|
77
|
+
readonly USDT: "0xdAC17F958D2ee523a2206206994597C13D831ec7";
|
|
78
|
+
};
|
|
79
|
+
};
|
|
26
80
|
declare function getContractAddresses(network: 'testnet' | 'mainnet'): ContractAddresses;
|
|
27
81
|
|
|
28
82
|
/**
|
|
@@ -133,4 +187,4 @@ declare class ZubariWallet {
|
|
|
133
187
|
getContractAddresses(): ContractAddresses;
|
|
134
188
|
}
|
|
135
189
|
|
|
136
|
-
export { PLATFORM_CONFIG as P, ZubariWallet as Z, ZUBARI_CONTRACTS as a, getContractAddresses as g };
|
|
190
|
+
export { CURRENCY_ADDRESSES as C, NFT_VOUCHER_DOMAIN as N, PLATFORM_CONFIG as P, ZubariWallet as Z, ZUBARI_CONTRACTS as a, ZERO_ADDRESS as b, NFT_VOUCHER_TYPES as c, getContractAddresses as g };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
export { P as PLATFORM_CONFIG, a as ZUBARI_CONTRACTS, Z as ZubariWallet, g as getContractAddresses } from './index-
|
|
2
|
-
export { D as DERIVATION_PATHS, N as NETWORKS, T as TESTNET_NETWORKS, W as WalletManager, b as WalletManagerConfig, a as WalletState, g as getNetworkConfig } from './WalletManager-
|
|
1
|
+
export { C as CURRENCY_ADDRESSES, N as NFT_VOUCHER_DOMAIN, c as NFT_VOUCHER_TYPES, P as PLATFORM_CONFIG, b as ZERO_ADDRESS, a as ZUBARI_CONTRACTS, Z as ZubariWallet, g as getContractAddresses } from './index-BrLMTY29.mjs';
|
|
2
|
+
export { D as DERIVATION_PATHS, N as NETWORKS, T as TESTNET_NETWORKS, W as WalletManager, b as WalletManagerConfig, a as WalletState, g as getNetworkConfig } from './WalletManager-DKPzfA74.mjs';
|
|
3
3
|
export { M as MemoryStorageAdapter, S as SecureStorageAdapter, W as WebEncryptedStorageAdapter, c as createSecureStorage } from './SecureStorage-jO783AhC.mjs';
|
|
4
4
|
export { ZubariMarketProtocol, ZubariNFTProtocol, ZubariPayoutsProtocol, ZubariSubscriptionProtocol, ZubariTipsProtocol } from './protocols/index.mjs';
|
|
5
5
|
export { BrowserAddressDerivation, ChainAddress, ChainBalance, FeeEstimate, FeeRates, MultiChainAddresses, SupportedChain, SwapService, TransactionHistoryItem, TransactionParams, TransactionResult, TransactionService, TransactionServiceConfig, WdkApiClient, ZubariWdkService, ZubariWdkServiceConfig, createTransactionService, createZubariWdkService, getTransactionService, getWdkApiClient, getZubariWdkService, isBrowser } from './services/index.mjs';
|
|
6
|
-
export { A as Account, B as BuyParams, E as EarningsBreakdown, L as LazyMintVoucher,
|
|
6
|
+
export { A as Account, B as BuyParams, C as CreateVoucherParams, E as EarningsBreakdown, L as LazyMintVoucher, h as Listing, g as ListingParams, f as NFT, d as NFTAttribute, c as NFTCurrency, e as NFTMetadata, a as NetworkBalance, N as NetworkType, R as RevenueSplit, S as SendParams, n as Subscription, m as SubscriptionPlan, p as SwapParams, o as SwapQuote, l as Tip, i as TipData, j as TipResult, k as TipStats, T as TokenBalance, b as TxResult, W as WatermarkingData, r as ZubariError, q as ZubariErrorCode, Z as ZubariWalletConfig } from './index-Be7yLGAO.mjs';
|
|
7
7
|
export { FeeEstimateResult, SendTransactionResult, UseWalletManagerOptions, UseWalletManagerReturn, useWalletManager } from './react/index.mjs';
|
|
8
|
-
import '
|
|
9
|
-
import 'node_modules/viem/_types/utils/ccip';
|
|
8
|
+
import 'abitype';
|
|
10
9
|
import 'viem';
|
|
11
10
|
import 'ethers';
|
|
12
11
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
export { P as PLATFORM_CONFIG, a as ZUBARI_CONTRACTS, Z as ZubariWallet, g as getContractAddresses } from './index-
|
|
2
|
-
export { D as DERIVATION_PATHS, N as NETWORKS, T as TESTNET_NETWORKS, W as WalletManager, b as WalletManagerConfig, a as WalletState, g as getNetworkConfig } from './WalletManager-
|
|
1
|
+
export { C as CURRENCY_ADDRESSES, N as NFT_VOUCHER_DOMAIN, c as NFT_VOUCHER_TYPES, P as PLATFORM_CONFIG, b as ZERO_ADDRESS, a as ZUBARI_CONTRACTS, Z as ZubariWallet, g as getContractAddresses } from './index-BCX8EYxv.js';
|
|
2
|
+
export { D as DERIVATION_PATHS, N as NETWORKS, T as TESTNET_NETWORKS, W as WalletManager, b as WalletManagerConfig, a as WalletState, g as getNetworkConfig } from './WalletManager-IOHFgvpT.js';
|
|
3
3
|
export { M as MemoryStorageAdapter, S as SecureStorageAdapter, W as WebEncryptedStorageAdapter, c as createSecureStorage } from './SecureStorage-jO783AhC.js';
|
|
4
4
|
export { ZubariMarketProtocol, ZubariNFTProtocol, ZubariPayoutsProtocol, ZubariSubscriptionProtocol, ZubariTipsProtocol } from './protocols/index.js';
|
|
5
5
|
export { BrowserAddressDerivation, ChainAddress, ChainBalance, FeeEstimate, FeeRates, MultiChainAddresses, SupportedChain, SwapService, TransactionHistoryItem, TransactionParams, TransactionResult, TransactionService, TransactionServiceConfig, WdkApiClient, ZubariWdkService, ZubariWdkServiceConfig, createTransactionService, createZubariWdkService, getTransactionService, getWdkApiClient, getZubariWdkService, isBrowser } from './services/index.js';
|
|
6
|
-
export { A as Account, B as BuyParams, E as EarningsBreakdown, L as LazyMintVoucher,
|
|
6
|
+
export { A as Account, B as BuyParams, C as CreateVoucherParams, E as EarningsBreakdown, L as LazyMintVoucher, h as Listing, g as ListingParams, f as NFT, d as NFTAttribute, c as NFTCurrency, e as NFTMetadata, a as NetworkBalance, N as NetworkType, R as RevenueSplit, S as SendParams, n as Subscription, m as SubscriptionPlan, p as SwapParams, o as SwapQuote, l as Tip, i as TipData, j as TipResult, k as TipStats, T as TokenBalance, b as TxResult, W as WatermarkingData, r as ZubariError, q as ZubariErrorCode, Z as ZubariWalletConfig } from './index-Be7yLGAO.js';
|
|
7
7
|
export { FeeEstimateResult, SendTransactionResult, UseWalletManagerOptions, UseWalletManagerReturn, useWalletManager } from './react/index.js';
|
|
8
|
-
import '
|
|
9
|
-
import 'node_modules/viem/_types/utils/ccip';
|
|
8
|
+
import 'abitype';
|
|
10
9
|
import 'viem';
|
|
11
10
|
import 'ethers';
|
|
12
11
|
|
package/dist/index.js
CHANGED
|
@@ -206,9 +206,30 @@ var NFT_VOUCHER_TYPES = {
|
|
|
206
206
|
{ name: "uri", type: "string" },
|
|
207
207
|
{ name: "creator", type: "address" },
|
|
208
208
|
{ name: "royaltyBps", type: "uint256" },
|
|
209
|
-
{ name: "deadline", type: "uint256" }
|
|
209
|
+
{ name: "deadline", type: "uint256" },
|
|
210
|
+
// Pricing fields
|
|
211
|
+
{ name: "price", type: "uint256" },
|
|
212
|
+
{ name: "currency", type: "address" },
|
|
213
|
+
{ name: "nonce", type: "uint256" },
|
|
214
|
+
// Watermarking fields
|
|
215
|
+
{ name: "contentHash", type: "bytes32" },
|
|
216
|
+
{ name: "userId", type: "bytes32" },
|
|
217
|
+
{ name: "watermarkTimestamp", type: "uint256" },
|
|
218
|
+
{ name: "sessionId", type: "bytes32" }
|
|
210
219
|
]
|
|
211
220
|
};
|
|
221
|
+
var CURRENCY_ADDRESSES = {
|
|
222
|
+
testnet: {
|
|
223
|
+
ETH: ZERO_ADDRESS,
|
|
224
|
+
USDT: "0xaA8E23Fb1079EA71e0a56F48a2aA51851D8433D0"
|
|
225
|
+
// USDT on Sepolia
|
|
226
|
+
},
|
|
227
|
+
mainnet: {
|
|
228
|
+
ETH: ZERO_ADDRESS,
|
|
229
|
+
USDT: "0xdAC17F958D2ee523a2206206994597C13D831ec7"
|
|
230
|
+
// USDT on Ethereum
|
|
231
|
+
}
|
|
232
|
+
};
|
|
212
233
|
function getContractAddresses(network) {
|
|
213
234
|
return ZUBARI_CONTRACTS[network];
|
|
214
235
|
}
|
|
@@ -2313,28 +2334,88 @@ var ZubariNFTProtocol = class {
|
|
|
2313
2334
|
contractAddress;
|
|
2314
2335
|
_marketplaceAddress;
|
|
2315
2336
|
chainId;
|
|
2316
|
-
|
|
2337
|
+
network;
|
|
2338
|
+
nonceCounter = 0;
|
|
2339
|
+
constructor(contractAddress, marketplaceAddress, chainId, network = "testnet") {
|
|
2317
2340
|
this.contractAddress = contractAddress;
|
|
2318
2341
|
this._marketplaceAddress = marketplaceAddress;
|
|
2319
2342
|
this.chainId = chainId;
|
|
2343
|
+
this.network = network;
|
|
2344
|
+
}
|
|
2345
|
+
/**
|
|
2346
|
+
* Convert human-readable price to wei
|
|
2347
|
+
* @param price - Price in human-readable format (e.g., "1.5")
|
|
2348
|
+
* @param currency - ETH (18 decimals) or USDT (6 decimals)
|
|
2349
|
+
*/
|
|
2350
|
+
priceToWei(price, currency) {
|
|
2351
|
+
const decimals = currency === "ETH" ? 18 : 6;
|
|
2352
|
+
const [whole, fraction = ""] = price.split(".");
|
|
2353
|
+
const paddedFraction = fraction.padEnd(decimals, "0").slice(0, decimals);
|
|
2354
|
+
const wei = whole + paddedFraction;
|
|
2355
|
+
return wei.replace(/^0+/, "") || "0";
|
|
2356
|
+
}
|
|
2357
|
+
/**
|
|
2358
|
+
* Get currency address for the configured network
|
|
2359
|
+
*/
|
|
2360
|
+
getCurrencyAddress(currency) {
|
|
2361
|
+
return CURRENCY_ADDRESSES[this.network][currency];
|
|
2362
|
+
}
|
|
2363
|
+
/**
|
|
2364
|
+
* Generate a unique nonce
|
|
2365
|
+
*/
|
|
2366
|
+
generateNonce() {
|
|
2367
|
+
return Date.now() * 1e3 + this.nonceCounter++;
|
|
2368
|
+
}
|
|
2369
|
+
/**
|
|
2370
|
+
* Pad string to bytes32 format
|
|
2371
|
+
*/
|
|
2372
|
+
toBytes32(value) {
|
|
2373
|
+
if (value.startsWith("0x")) {
|
|
2374
|
+
return value.padEnd(66, "0");
|
|
2375
|
+
}
|
|
2376
|
+
const hex = Buffer.from(value).toString("hex");
|
|
2377
|
+
return "0x" + hex.padEnd(64, "0");
|
|
2320
2378
|
}
|
|
2321
2379
|
/**
|
|
2322
2380
|
* Create a lazy mint voucher for off-chain NFT creation
|
|
2323
2381
|
* The voucher can be redeemed on-chain when purchased
|
|
2382
|
+
*
|
|
2383
|
+
* @param params - Voucher creation parameters
|
|
2384
|
+
* @param signer - Object with signTypedData method (ethers.js wallet or viem client)
|
|
2324
2385
|
*/
|
|
2325
|
-
async createLazyMintVoucher(
|
|
2326
|
-
|
|
2386
|
+
async createLazyMintVoucher(params, signer) {
|
|
2387
|
+
const { metadata, creatorAddress, price, currency, nonce, watermarking } = params;
|
|
2388
|
+
const royaltyBps = metadata.royaltyBps ?? 500;
|
|
2389
|
+
if (royaltyBps > PLATFORM_CONFIG.maxRoyaltyBps) {
|
|
2327
2390
|
throw new Error(`Royalty cannot exceed ${PLATFORM_CONFIG.maxRoyaltyBps / 100}%`);
|
|
2328
2391
|
}
|
|
2392
|
+
if (!price || parseFloat(price) <= 0) {
|
|
2393
|
+
throw new Error("Price must be greater than 0");
|
|
2394
|
+
}
|
|
2329
2395
|
const tokenId = this.generateTokenId();
|
|
2330
2396
|
const deadline = Math.floor(Date.now() / 1e3) + PLATFORM_CONFIG.voucherValiditySecs;
|
|
2397
|
+
const priceInWei = this.priceToWei(price, currency);
|
|
2398
|
+
const currencyAddress = this.getCurrencyAddress(currency);
|
|
2399
|
+
const voucherNonce = nonce ?? this.generateNonce();
|
|
2400
|
+
const watermarkTimestamp = watermarking ? Math.floor(Date.now() / 1e3) : 0;
|
|
2401
|
+
const contentHash = watermarking ? this.toBytes32(watermarking.contentHash) : ZERO_ADDRESS.replace("0x", "0x" + "0".repeat(64)).slice(0, 66);
|
|
2402
|
+
const userId = watermarking ? this.toBytes32(watermarking.userId) : ZERO_ADDRESS.replace("0x", "0x" + "0".repeat(64)).slice(0, 66);
|
|
2403
|
+
const sessionId = watermarking ? this.toBytes32(watermarking.sessionId) : ZERO_ADDRESS.replace("0x", "0x" + "0".repeat(64)).slice(0, 66);
|
|
2331
2404
|
const voucherData = {
|
|
2332
2405
|
tokenId,
|
|
2333
2406
|
uri: metadata.image,
|
|
2334
2407
|
// Will be IPFS URI
|
|
2335
2408
|
creator: creatorAddress,
|
|
2336
|
-
royaltyBps
|
|
2337
|
-
|
|
2409
|
+
royaltyBps,
|
|
2410
|
+
// Use the validated/defaulted value
|
|
2411
|
+
deadline,
|
|
2412
|
+
price: priceInWei,
|
|
2413
|
+
currency: currencyAddress,
|
|
2414
|
+
nonce: voucherNonce,
|
|
2415
|
+
contentHash,
|
|
2416
|
+
userId,
|
|
2417
|
+
watermarkTimestamp,
|
|
2418
|
+
sessionId
|
|
2338
2419
|
};
|
|
2339
2420
|
const domain = {
|
|
2340
2421
|
...NFT_VOUCHER_DOMAIN,
|
|
@@ -2343,10 +2424,37 @@ var ZubariNFTProtocol = class {
|
|
|
2343
2424
|
};
|
|
2344
2425
|
const signature = await signer.signTypedData(domain, NFT_VOUCHER_TYPES, voucherData);
|
|
2345
2426
|
return {
|
|
2346
|
-
|
|
2347
|
-
|
|
2427
|
+
tokenId,
|
|
2428
|
+
uri: metadata.image,
|
|
2429
|
+
creator: creatorAddress,
|
|
2430
|
+
royaltyBps,
|
|
2431
|
+
// Use the validated/defaulted value
|
|
2432
|
+
deadline,
|
|
2433
|
+
signature,
|
|
2434
|
+
price: priceInWei,
|
|
2435
|
+
currency: currencyAddress,
|
|
2436
|
+
nonce: voucherNonce,
|
|
2437
|
+
contentHash: watermarking ? contentHash : void 0,
|
|
2438
|
+
userId: watermarking ? userId : void 0,
|
|
2439
|
+
watermarkTimestamp: watermarking ? watermarkTimestamp : void 0,
|
|
2440
|
+
sessionId: watermarking ? sessionId : void 0
|
|
2348
2441
|
};
|
|
2349
2442
|
}
|
|
2443
|
+
/**
|
|
2444
|
+
* @deprecated Use createLazyMintVoucher(params, signer) instead
|
|
2445
|
+
* Legacy method for backward compatibility
|
|
2446
|
+
*/
|
|
2447
|
+
async createLazyMintVoucherLegacy(metadata, creatorAddress, signer) {
|
|
2448
|
+
return this.createLazyMintVoucher(
|
|
2449
|
+
{
|
|
2450
|
+
metadata,
|
|
2451
|
+
creatorAddress,
|
|
2452
|
+
price: "0.01",
|
|
2453
|
+
currency: "ETH"
|
|
2454
|
+
},
|
|
2455
|
+
signer
|
|
2456
|
+
);
|
|
2457
|
+
}
|
|
2350
2458
|
/**
|
|
2351
2459
|
* Redeem a lazy mint voucher to mint the NFT on-chain
|
|
2352
2460
|
*/
|
|
@@ -6212,10 +6320,13 @@ function normalizeAddress(address) {
|
|
|
6212
6320
|
}
|
|
6213
6321
|
|
|
6214
6322
|
exports.BrowserAddressDerivation = BrowserAddressDerivation_exports;
|
|
6323
|
+
exports.CURRENCY_ADDRESSES = CURRENCY_ADDRESSES;
|
|
6215
6324
|
exports.DERIVATION_PATHS = DERIVATION_PATHS;
|
|
6216
6325
|
exports.KeyManager = KeyManager;
|
|
6217
6326
|
exports.MemoryStorageAdapter = MemoryStorageAdapter;
|
|
6218
6327
|
exports.NETWORKS = NETWORKS;
|
|
6328
|
+
exports.NFT_VOUCHER_DOMAIN = NFT_VOUCHER_DOMAIN;
|
|
6329
|
+
exports.NFT_VOUCHER_TYPES = NFT_VOUCHER_TYPES;
|
|
6219
6330
|
exports.PLATFORM_CONFIG = PLATFORM_CONFIG;
|
|
6220
6331
|
exports.SwapService = SwapService;
|
|
6221
6332
|
exports.TESTNET_NETWORKS = TESTNET_NETWORKS;
|
|
@@ -6223,6 +6334,7 @@ exports.TransactionService = TransactionService;
|
|
|
6223
6334
|
exports.WalletManager = WalletManager;
|
|
6224
6335
|
exports.WdkApiClient = WdkApiClient;
|
|
6225
6336
|
exports.WebEncryptedStorageAdapter = WebEncryptedStorageAdapter;
|
|
6337
|
+
exports.ZERO_ADDRESS = ZERO_ADDRESS;
|
|
6226
6338
|
exports.ZUBARI_CONTRACTS = ZUBARI_CONTRACTS;
|
|
6227
6339
|
exports.ZubariError = ZubariError;
|
|
6228
6340
|
exports.ZubariMarketProtocol = ZubariMarketProtocol;
|