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

View File

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

2
third_party/j7 vendored

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