four-flap-meme-sdk 4.3.20 → 4.3.22
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/chains/robinhood/constants.d.ts +2 -5
- package/dist/chains/robinhood/constants.js +8 -7
- package/dist/chains/robinhood/longetf/launch.js +4 -4
- package/dist/chains/robinhood/pons-v2/launch.js +2 -2
- package/dist/chains/robinhood/sign.js +9 -2
- package/dist/core/constants/gas.d.ts +0 -8
- package/dist/core/constants/gas.js +0 -9
- package/package.json +1 -1
|
@@ -25,11 +25,8 @@ export declare const LONG_XYZ_HOOK: "0x4e3468951d49f2eea976ed0d6e75ffcb44a9a544"
|
|
|
25
25
|
export declare const LONG_XYZ_PROTOCOL_BENEFICIARY: "0x21e2ce70511e4fe542a97708e89520471daa7a66";
|
|
26
26
|
export declare const PONS_V2_FACTORY: "0x7eD598BcEf8bd9Edd8C97A195C6d13f40801EC7e";
|
|
27
27
|
export declare const PONS_V2_LAUNCH_AND_BUY: "0xe33E9E479dF8802cb0866d5d05258bEc4cF62948";
|
|
28
|
-
|
|
29
|
-
export declare
|
|
30
|
-
export declare const LONGETF_REGISTER_GAS_LIMIT: 500000n;
|
|
31
|
-
export declare const PONS_V2_LAUNCH_GAS_LIMIT: 3000000n;
|
|
32
|
-
export declare function robinhoodConfiguredGas(key: string, fallback: bigint): bigint;
|
|
28
|
+
/** 只读服务端灌进来的 chain_gas_configs。没下发就报错,不在 SDK 里再留一份可调数字。 */
|
|
29
|
+
export declare function robinhoodConfiguredGas(key: string): bigint;
|
|
33
30
|
/** Word index after the 4-byte selector in long.xyz create() template. */
|
|
34
31
|
export declare const LONGETF_LAUNCH_WORDS: {
|
|
35
32
|
readonly salt: 13;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Robinhood Chain 发币常量
|
|
3
3
|
*/
|
|
4
|
-
import { ADDRESSES, CHAINS,
|
|
4
|
+
import { ADDRESSES, CHAINS, getChainGasNumber } from '../../core/constants/index.js';
|
|
5
5
|
export const ROBINHOOD_CHAIN_ID = CHAINS.ROBINHOOD.chainId;
|
|
6
6
|
export const ROBINHOOD_RPC_URL = CHAINS.ROBINHOOD.rpcUrls.default;
|
|
7
7
|
export const ROBINHOOD_EXPLORER = CHAINS.ROBINHOOD.explorer;
|
|
@@ -12,12 +12,13 @@ export const LONG_XYZ_HOOK = ADDRESSES.ROBINHOOD.LongXyzHook;
|
|
|
12
12
|
export const LONG_XYZ_PROTOCOL_BENEFICIARY = ADDRESSES.ROBINHOOD.LongXyzProtocolBeneficiary;
|
|
13
13
|
export const PONS_V2_FACTORY = ADDRESSES.ROBINHOOD.PonsV2Factory;
|
|
14
14
|
export const PONS_V2_LAUNCH_AND_BUY = ADDRESSES.ROBINHOOD.PonsV2LaunchAndBuy;
|
|
15
|
-
|
|
16
|
-
export
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
/** 只读服务端灌进来的 chain_gas_configs。没下发就报错,不在 SDK 里再留一份可调数字。 */
|
|
16
|
+
export function robinhoodConfiguredGas(key) {
|
|
17
|
+
const value = getChainGasNumber(ROBINHOOD_CHAIN_ID, key, 0);
|
|
18
|
+
if (!Number.isFinite(value) || value <= 0) {
|
|
19
|
+
throw new Error(`缺少服务端 gas 配置 ${key}`);
|
|
20
|
+
}
|
|
21
|
+
return BigInt(Math.floor(value));
|
|
21
22
|
}
|
|
22
23
|
/** Word index after the 4-byte selector in long.xyz create() template. */
|
|
23
24
|
export const LONGETF_LAUNCH_WORDS = {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* 必须逐笔等确认,不能一次签完再广播。
|
|
4
4
|
*/
|
|
5
5
|
import { JsonRpcProvider } from 'ethers';
|
|
6
|
-
import {
|
|
6
|
+
import { LONGETF_FACTORY, robinhoodConfiguredGas, LONG_XYZ_LAUNCHER, ROBINHOOD_CHAIN_ID, ROBINHOOD_RPC_URL, } from '../constants.js';
|
|
7
7
|
import { signRobinhoodTx } from '../sign.js';
|
|
8
8
|
import { LONGETF_VAULT_INITCODE } from './assets.js';
|
|
9
9
|
import { encodeLongetfDeployVault, encodeLongetfIsTickerAvailable, encodeLongetfRegister, longetfVaultInitCodeHash, mineLongetfVaultSalt, patchLongetfLaunchCalldata, } from './encode.js';
|
|
@@ -25,7 +25,7 @@ export async function signLongetfDeployVault(params) {
|
|
|
25
25
|
privateKey: params.privateKey,
|
|
26
26
|
to: LONGETF_FACTORY,
|
|
27
27
|
data: encodeLongetfDeployVault(params.salt, params.creator, initCode),
|
|
28
|
-
gasLimit: robinhoodConfiguredGas('longetf_deploy_vault_gas'
|
|
28
|
+
gasLimit: robinhoodConfiguredGas('longetf_deploy_vault_gas'),
|
|
29
29
|
gasPrice: params.gasPrice,
|
|
30
30
|
nonce: params.nonce,
|
|
31
31
|
});
|
|
@@ -42,7 +42,7 @@ export async function signLongetfLaunch(params) {
|
|
|
42
42
|
vault: params.vault,
|
|
43
43
|
metaUri: params.metaUri,
|
|
44
44
|
}, params.launchTemplate),
|
|
45
|
-
gasLimit: robinhoodConfiguredGas('longetf_launch_gas'
|
|
45
|
+
gasLimit: robinhoodConfiguredGas('longetf_launch_gas'),
|
|
46
46
|
gasPrice: params.gasPrice,
|
|
47
47
|
nonce: params.nonce,
|
|
48
48
|
});
|
|
@@ -53,7 +53,7 @@ export async function signLongetfRegister(params) {
|
|
|
53
53
|
privateKey: params.privateKey,
|
|
54
54
|
to: LONGETF_FACTORY,
|
|
55
55
|
data: encodeLongetfRegister(params.token, params.vault),
|
|
56
|
-
gasLimit: robinhoodConfiguredGas('longetf_register_gas'
|
|
56
|
+
gasLimit: robinhoodConfiguredGas('longetf_register_gas'),
|
|
57
57
|
gasPrice: params.gasPrice,
|
|
58
58
|
nonce: params.nonce,
|
|
59
59
|
});
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* pons v2 发币:读 launchFee + expectedEconomics,再签 launchToken 或 launchAndBuy
|
|
3
3
|
*/
|
|
4
4
|
import { Contract, JsonRpcProvider, Wallet, ZeroAddress } from 'ethers';
|
|
5
|
-
import { PONS_V2_FACTORY, PONS_V2_FACTORY_ABI,
|
|
5
|
+
import { PONS_V2_FACTORY, PONS_V2_FACTORY_ABI, robinhoodConfiguredGas, ROBINHOOD_CHAIN_ID, ROBINHOOD_RPC_URL, } from '../constants.js';
|
|
6
6
|
import { signRobinhoodTx } from '../sign.js';
|
|
7
7
|
import { buildPonsV2LaunchCall, encodePonsV2PreviewLaunchEconomics, randomPonsV2Salt, } from './encode.js';
|
|
8
8
|
export async function getPonsV2LaunchFee(rpcUrl = ROBINHOOD_RPC_URL) {
|
|
@@ -92,7 +92,7 @@ export async function signPonsV2Launch(params) {
|
|
|
92
92
|
to: call.to,
|
|
93
93
|
data: call.data,
|
|
94
94
|
value: call.value,
|
|
95
|
-
gasLimit: robinhoodConfiguredGas('pons_launch_gas'
|
|
95
|
+
gasLimit: robinhoodConfiguredGas('pons_launch_gas'),
|
|
96
96
|
gasPrice: params.gasPrice,
|
|
97
97
|
nonce: params.nonce,
|
|
98
98
|
});
|
|
@@ -9,7 +9,14 @@ export async function signRobinhoodTx(params) {
|
|
|
9
9
|
const wallet = new Wallet(params.privateKey, provider);
|
|
10
10
|
const nonce = params.nonce ?? (await wallet.getNonce());
|
|
11
11
|
const feeData = await provider.getFeeData();
|
|
12
|
-
const
|
|
12
|
+
const block = await provider.getBlock('latest');
|
|
13
|
+
const base = block?.baseFeePerGas ?? 0n;
|
|
14
|
+
const priority = feeData.maxPriorityFeePerGas ?? 0n;
|
|
15
|
+
const floor = base + base / 8n + priority;
|
|
16
|
+
let maxFeePerGas = params.gasPrice ?? feeData.maxFeePerGas ?? feeData.gasPrice ?? 1000000000n;
|
|
17
|
+
if (maxFeePerGas < floor)
|
|
18
|
+
maxFeePerGas = floor;
|
|
19
|
+
const maxPriorityFeePerGas = priority > maxFeePerGas ? maxFeePerGas : priority;
|
|
13
20
|
const signedTx = await wallet.signTransaction({
|
|
14
21
|
to: params.to,
|
|
15
22
|
value: params.value ?? 0n,
|
|
@@ -18,7 +25,7 @@ export async function signRobinhoodTx(params) {
|
|
|
18
25
|
chainId: ROBINHOOD_CHAIN_ID,
|
|
19
26
|
type: 2,
|
|
20
27
|
maxFeePerGas,
|
|
21
|
-
maxPriorityFeePerGas
|
|
28
|
+
maxPriorityFeePerGas,
|
|
22
29
|
gasLimit: params.gasLimit,
|
|
23
30
|
});
|
|
24
31
|
const tx = Transaction.from(signedTx);
|
|
@@ -43,14 +43,6 @@ export declare const GAS_LIMITS: {
|
|
|
43
43
|
readonly AA_PRE_VERIFICATION: 60000n;
|
|
44
44
|
/** AA 默认 Call Gas Limit */
|
|
45
45
|
readonly AA_CALL_GAS_LIMIT: 800000n;
|
|
46
|
-
/** LONGETF deployVault(页面固定 3,000,000) */
|
|
47
|
-
readonly ROBINHOOD_LONGETF_DEPLOY_VAULT: 3000000n;
|
|
48
|
-
/** LONGETF long.xyz create() */
|
|
49
|
-
readonly ROBINHOOD_LONGETF_LAUNCH: 3000000n;
|
|
50
|
-
/** LONGETF factory register */
|
|
51
|
-
readonly ROBINHOOD_LONGETF_REGISTER: 500000n;
|
|
52
|
-
/** pons v2 launchToken / launchAndBuy */
|
|
53
|
-
readonly ROBINHOOD_PONS_LAUNCH: 3000000n;
|
|
54
46
|
};
|
|
55
47
|
export declare const GAS_CONFIG: {
|
|
56
48
|
/** Gas 估算安全余量(20%) */
|
|
@@ -52,15 +52,6 @@ export const GAS_LIMITS = {
|
|
|
52
52
|
AA_PRE_VERIFICATION: 60000n,
|
|
53
53
|
/** AA 默认 Call Gas Limit */
|
|
54
54
|
AA_CALL_GAS_LIMIT: 800000n,
|
|
55
|
-
// ==================== Robinhood Chain 发币 ====================
|
|
56
|
-
/** LONGETF deployVault(页面固定 3,000,000) */
|
|
57
|
-
ROBINHOOD_LONGETF_DEPLOY_VAULT: 3000000n,
|
|
58
|
-
/** LONGETF long.xyz create() */
|
|
59
|
-
ROBINHOOD_LONGETF_LAUNCH: 3000000n,
|
|
60
|
-
/** LONGETF factory register */
|
|
61
|
-
ROBINHOOD_LONGETF_REGISTER: 500000n,
|
|
62
|
-
/** pons v2 launchToken / launchAndBuy */
|
|
63
|
-
ROBINHOOD_PONS_LAUNCH: 3000000n,
|
|
64
55
|
};
|
|
65
56
|
// ============================================================================
|
|
66
57
|
// Gas 相关配置
|