This commit is contained in:
aozhiwei 2024-06-07 14:31:58 +08:00
parent 8776feb103
commit 9df5e6ef19
4 changed files with 26 additions and 11 deletions

View File

@ -1,5 +1,5 @@
{ {
"user_address": "0x50A8e60041A206AcaA5F844a1104896224be6F39", "user_address": "0x50A8e60041A206AcaA5F844a1104896224be6F39",
"private_key": "0xd9ed33809372932059c1ba7b336a33f406b4c55e7430daef8297134c67429d60", "private_key": "0xd9ed33809372932059c1ba7b336a33f406b4c55e7430daef8297134c67429d60",
"block_server": "https://rpc.testnet.immutable.com." "block_server": "https://rpc.testnet.immutable.com"
} }

View File

@ -10,7 +10,8 @@ const jwksKeyHash = {};
async function refreshKey() { async function refreshKey() {
while (true) { while (true) {
const keyList = []; const keyList = [];
jwksKeyHash.forEach((key, val) => { Object.keys(jwksKeyHash).forEach((key) => {
const val = jwksKeyHash[key];
if (utils.getUtcTime() - val['lastRefreshTime'] > 60 * 30) { if (utils.getUtcTime() - val['lastRefreshTime'] > 60 * 30) {
keyList.push(val); keyList.push(val);
} }
@ -51,6 +52,7 @@ async function asyncGetKey(jwksUri, header, cb) {
try { try {
if (jwksUri in jwksKeyHash) { if (jwksUri in jwksKeyHash) {
const c = jwksKeyHash[jwksUri]; const c = jwksKeyHash[jwksUri];
console.log(c['key']);
cb(null, c['key']); cb(null, c['key']);
return; return;
} }
@ -59,10 +61,11 @@ async function asyncGetKey(jwksUri, header, cb) {
}); });
client.getSigningKey(header.kid, function(err, key) { client.getSigningKey(header.kid, function(err, key) {
try { try {
console.log(err, key);
const signingKey = key.publicKey || key.rsaPublicKey; const signingKey = key.publicKey || key.rsaPublicKey;
if (!err) { if (!err) {
jwksKeyHash[jwksUri] = { jwksKeyHash[jwksUri] = {
'key': key, 'key': signingKey,
'uri': jwksUri, 'uri': jwksUri,
'header': header, 'header': header,
'lastRefreshTime': utils.getUtcTime() 'lastRefreshTime': utils.getUtcTime()
@ -100,6 +103,7 @@ function asyncVerify(jwksUri, data) {
} }
async function verify(session) { async function verify(session) {
console.log('aaaaaaaaaaaaaa');
const postData = session.getBody(); const postData = session.getBody();
const jwksUri = postData['jwksUri']; const jwksUri = postData['jwksUri'];
//const arr = postData['data'].split('.'); //const arr = postData['data'].split('.');

View File

@ -84,14 +84,15 @@ async function activate721Nft(session) {
]); ]);
const nonce = transId; const nonce = transId;
const nftList = [ const nftList = [
{ [
'tokenId': tokenId, tokenId,
'isMint': true true
} ]
]; ];
let nftListStr = ''; const nftListArr = [];
nftList.forEach((item) => { nftList.forEach((item) => {
nftListStr += item['tokenId'].toString() + '0x01'; nftListArr.push(item[0].toString());
nftListArr.push('0x01');
}); });
const signature = await bc.soliditySha3Sign( const signature = await bc.soliditySha3Sign(
account, account,
@ -100,7 +101,17 @@ async function activate721Nft(session) {
netId, netId,
nowTime, nowTime,
nonce, nonce,
...nftListStr ...nftListArr,
);
console.log(
account,
nftAddress,
thisContractAddress,
netId,
nowTime,
nonce,
nftListArr,
signature
); );
let data = instance.methods.unlockOrMint let data = instance.methods.unlockOrMint

2
third_party/j7 vendored

@ -1 +1 @@
Subproject commit da5693a00ff2c85613decb6737bb22e010c61162 Subproject commit 4b9a0250b2957088fa0b20a8eaa3ea50b2e9b422