import { getNativeUUIDv4 } from '../utils/getNewTxId'; import { AUTH_TYPE } from './ConstValue' import { utf8ToUi8 } from '@vf.js/pki'; export const ClientConfig = { serverCBCKey: "KBbOMhX2NJWFVBwar2cAyQ==", serverCBCIv: "JQSrKb9SPgs4TsWIupbiIQ==", /** 基础URL */ baseUrl: 'http://117.50.85.85:8080', /** 类型 */ authType: AUTH_TYPE.PermissionedWithKey, // 链ID chainId: "yfchain_testnet", // 组织ID orgId: "yf1.yufuqkl.com", /** 证书用途 */ certUsage: 'sign', // 用户类型 userType: 'client', /** 交易 _GAS_LIMIT */ limit: 0, /** 精度, 上链时需要 * 10^precision */ precision: 9, /** 默认钱包名字 */ walletName: '我的钱包', // 临时用的 address: 'client13.sign', /** 来源 */ source: 9, appId: 'mall', channelId: "1027", platformId: 1015, deviceId: '14DDDA040975C6EDCF216A390487C36D5756F21F', sessionId: "91227326971c03e2fa19290910354c029952841d", ip: '', } export function getDefaultRequestConfig() { return { appId: ClientConfig.appId, channelId: ClientConfig.channelId, platformId: ClientConfig.platformId, deviceId: ClientConfig.deviceId, sessionId: ClientConfig.sessionId, ip: ClientConfig.ip, source: ClientConfig.source, requestId: getNativeUUIDv4() } } export function getPkByte() { if (ClientConfig.authType === AUTH_TYPE.PermissionedWithKey || ClientConfig.authType === AUTH_TYPE.Public) { return utf8ToUi8(''); } return null; } export function getCertificationAttribute(params: { address: string, orgId: string }) { return [ { name: 'commonName', value: `${params?.address}` }, // 可变 { name: 'countryName', value: 'China' }, { name: 'stateOrProvinceName', value: 'BeiJing' }, { name: 'localityName', value: 'BeiJing' }, { name: 'organizationName', value: params?.orgId }, // 可变 { name: 'organizationalUnitName', value: 'client' }, ]; }