Recalling the idea from previous post there is a requirement to sign game item change by game developer. In such a way that the duo of change (link to metadata.json) and signature are public data and can not be breached.







Signing change by game developer


The JS part that allows for data signing is following:

async sign() {
	const domain = {
    	name: 'Upgadeable NFT Change',
        version: '1',
        chainId: 4,
        verifyingContract: 'contractAddress',    	};
        // The named list of all type definitions
        const types = {
        	Change: 
            	[{ name: 'newURI', type: 'string' }],
            };
            // The data to sign
            const value = {
            	newURI:"ipfs://path-to-content"
            };
         const signer = this.provider.getSigner();
         const signature = await signer._signTypedData(
         	domain,
         	types,
         	value
         );
}

And the result of running this code is following:

This is is pretty convenient as there is no doubt about what is being signed the whole message is presented in the metamask interface and there is little place for error.


Verification of change by user

Video summary